diff --git a/.gn b/.gn index 7d538f8..bc38d48 100644 --- a/.gn +++ b/.gn
@@ -58,7 +58,7 @@ # Overwrite default args declared in the Fuchsia sdk fuchsia_sdk_readelf_exec = "//third_party/llvm-build/Release+Asserts/bin/llvm-readelf" - fuchsia_target_api_level = 8 + fuchsia_target_api_level = 9 devtools_visibility = [ "*" ] }
diff --git a/DEPS b/DEPS index 11db529..d14a0ea 100644 --- a/DEPS +++ b/DEPS
@@ -297,15 +297,15 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '4407fe6d4442eacb561a41659fceeb1ad97787f8', + 'skia_revision': '3ee4ae9c24757b214348bd4d6490195bdb9e9a20', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '51c4d6c6fb319292c4a622c959e66921a33547a3', + 'v8_revision': '185fc09b6eee425cd499549c3d1d84a137912928', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': '08df2000ce13bc22592829d9db5b651a87f21311', + 'angle_revision': '90fa855b4c298b9b516bcf0a85ce6de64181fb45', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -313,7 +313,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': 'd14da8e682e244127db32490365d1c094243e5f3', + 'pdfium_revision': '5aac73e8728c5aed514c9136a365f1cefe8e54f1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling BoringSSL # and whatever else without interference from each other. @@ -368,7 +368,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '07e4a3d3cc6e4ac9d59a051b20669bdd7931d983', + 'catapult_revision': '3384fbd90357b44f9e50dd33dbabc4f1acc1e9e2', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -412,7 +412,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': 'd5030ad463fed3ec1d672c30b56e44cc6829ca4e', + 'dawn_revision': 'a089376daf17ed16c2b527d26aa41338c1ad60f8', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -456,7 +456,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'libcxxabi_revision': 'b954e3e65634a9e2f7b595598a30c455f5f2eb26', + 'libcxxabi_revision': '039323b945911a54cb7400da8fb14fcbb0348e97', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -480,7 +480,7 @@ # If you change this, also update the libc++ revision in # //buildtools/deps_revisions.gni. - 'libcxx_revision': '49e658031b2be0ed59e50183335cc365cdb390cd', + 'libcxx_revision': 'eb79671bfbedd77b747d01dee8c0479ff1693f88', # GN CIPD package version. 'gn_version': 'git_revision:9ef321772ecc161937db69acb346397e0ccc484d', @@ -862,7 +862,7 @@ 'packages': [ { 'package': 'chromium/rts/model/linux-amd64', - 'version': 'XlzIsX8AH06QHVAMzpKt5aT3nfupjnBr78ztG18pXdsC', + 'version': 'UGECyFy8Y6o0mTNHIZJ3g64VqjHuVhTTLcwgrYHYqhgC', }, ], 'dep_type': 'cipd', @@ -884,7 +884,7 @@ 'packages': [ { 'package': 'chromium/rts/model/windows-amd64', - 'version': 'XmZtpYZGxTqwBMgEXpdyfrdCxx79QfYeVlhpviF2OUcC', + 'version': 'v9EH45m32FUGHsz_lHotivX6DAl3fdbmUMJGe4kvn_IC', }, ], 'dep_type': 'cipd', @@ -1184,7 +1184,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '0ba2fd429dd6db431fcbee6995c1278d2a3657a0', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'f353dc3e889584a1b0e1201fefc0464726d22917', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), @@ -1827,7 +1827,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@e770ec7d2df709f557748a2aa1ed45db5a21c670', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@4f158789476269b3880e8d182ee2f4da32d50742', 'condition': 'checkout_src_internal', }, @@ -1857,7 +1857,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/help_app/app', - 'version': 'MqUROEBmHZCBRsEY3abQ7JOvoDr5wZ_MTK3vAN-901wC', + 'version': '6OyzTU0YaSGdqzAelID0NkZAH4Ph_x5FjQT5UyUfE7sC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/android_webview/java/src/org/chromium/android_webview/DarkModeHelper.java b/android_webview/java/src/org/chromium/android_webview/DarkModeHelper.java index bf898bfb..2e491dd 100644 --- a/android_webview/java/src/org/chromium/android_webview/DarkModeHelper.java +++ b/android_webview/java/src/org/chromium/android_webview/DarkModeHelper.java
@@ -7,6 +7,7 @@ import android.content.Context; import android.content.res.Configuration; import android.content.res.TypedArray; +import android.os.Build; import androidx.annotation.VisibleForTesting; import androidx.core.graphics.ColorUtils; @@ -63,12 +64,22 @@ } } + // must use getIdentifier to access resources from another app + @SuppressWarnings("DiscouragedApi") @LightTheme public static int getLightTheme(Context context) { if (sLightThemeForTesting != null) return sLightThemeForTesting; int lightTheme = LightTheme.LIGHT_THEME_UNDEFINED; - TypedArray a = - context.getTheme().obtainStyledAttributes(new int[] {android.R.attr.isLightTheme}); + int resId = android.R.attr.isLightTheme; + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { + // android.R.attr.isLightTheme is added in Q, for pre-Q platform, WebView + // checks if app has isLightTheme attr which could be added by Android X + // and wasn't stripped out. + resId = context.getApplicationContext().getResources().getIdentifier( + "isLightTheme", "attr", context.getApplicationContext().getPackageName()); + if (resId == 0) return lightTheme; + } + TypedArray a = context.getTheme().obtainStyledAttributes(new int[] {resId}); if (a.hasValue(0)) { lightTheme = a.getBoolean(0, true) ? LightTheme.LIGHT_THEME_TRUE : LightTheme.LIGHT_THEME_FALSE;
diff --git a/android_webview/nonembedded/java/src/org/chromium/android_webview/nonembedded/AwPureJavaExceptionReporter.java b/android_webview/nonembedded/java/src/org/chromium/android_webview/nonembedded/AwPureJavaExceptionReporter.java index f6242cc..ddcb222 100644 --- a/android_webview/nonembedded/java/src/org/chromium/android_webview/nonembedded/AwPureJavaExceptionReporter.java +++ b/android_webview/nonembedded/java/src/org/chromium/android_webview/nonembedded/AwPureJavaExceptionReporter.java
@@ -18,7 +18,7 @@ "nonembeded-webview-minidump-"; public AwPureJavaExceptionReporter() { - super(SystemWideCrashDirectories.getOrCreateWebViewCrashDir()); + super(SystemWideCrashDirectories.getOrCreateWebViewCrashDir(), /*attachLogcat=*/false); // The reporter doesn't create a minidump if the crash dump directory doesn't exist, so make // sure to create it. // TODO(https://crbug.com/1293108): this should be shared with chrome as well and removed
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 0421a1f..8b27c87 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -975,6 +975,8 @@ "style/system_shadow.h", "style/system_shadow_on_nine_patch_layer.cc", "style/system_shadow_on_nine_patch_layer.h", + "style/system_shadow_on_texture_layer.cc", + "style/system_shadow_on_texture_layer.h", "style/system_toast_style.cc", "style/system_toast_style.h", "style/temp_palette.cc",
diff --git a/ash/app_list/views/continue_task_view.cc b/ash/app_list/views/continue_task_view.cc index c0fc04c..557e769 100644 --- a/ash/app_list/views/continue_task_view.cc +++ b/ash/app_list/views/continue_task_view.cc
@@ -248,8 +248,7 @@ source->GetWidget(), nullptr /*button_controller*/, source->GetBoundsInScreen(), views::MenuAnchorPosition::kBubbleTopRight, source_type); - views::InkDrop::Get(this)->GetInkDrop()->AnimateToState( - views::InkDropState::ACTIVATED); + views::InkDrop::Get(this)->GetInkDrop()->SnapToActivated(); } void ContinueTaskView::ExecuteCommand(int command_id, int event_flags) {
diff --git a/ash/app_list/views/search_box_view.cc b/ash/app_list/views/search_box_view.cc index ae87d3e0..3f26dcb4 100644 --- a/ash/app_list/views/search_box_view.cc +++ b/ash/app_list/views/search_box_view.cc
@@ -734,42 +734,12 @@ if (user_typed_text == details || user_typed_text == search_text) return; - auto is_valid_autocomplete_text = - [this](const std::u16string& autocomplete_text) { - // Don't set autocomplete text if it's the same as current search box - // text. - if (autocomplete_text == search_box()->GetText()) - return false; - // Don't set autocomplete text if the highlighted text is the same as - // before. - if (autocomplete_text.length() > highlight_range_.start() && - autocomplete_text.substr(highlight_range_.start()) == - search_box()->GetSelectedText()) { - return false; - } - return true; - }; - - if (base::StartsWith(details, user_typed_text, - base::CompareCase::INSENSITIVE_ASCII) && - is_valid_autocomplete_text(details)) { - // Current text in the search_box matches the first result's url. - SetAutocompleteText(details); + if (ProcessPrefixMatchAutocomplete(first_visible_result, user_typed_text)) { RecordAutocompleteMatchMetric(SearchBoxTextMatch::kPrefixMatch); return; } - if (base::StartsWith(search_text, user_typed_text, - base::CompareCase::INSENSITIVE_ASCII) && - is_valid_autocomplete_text(search_text)) { - // Current text in the search_box matches the first result's search result - // text. - SetAutocompleteText(search_text); - RecordAutocompleteMatchMetric(SearchBoxTextMatch::kPrefixMatch); - return; - } - - if (is_valid_autocomplete_text(search_text)) { + if (IsValidAutocompleteText(search_text)) { // Setup autocomplete ghost text for eligible search_text. if (features::IsAutocompleteExtendedSuggestionsEnabled()) { MaybeSetAutocompleteGhostText( @@ -795,10 +765,42 @@ ClearAutocompleteText(); } +bool SearchBoxView::ProcessPrefixMatchAutocomplete( + SearchResult* search_result, + const std::u16string& user_typed_text) { + const std::u16string& details = search_result->details(); + const std::u16string& search_text = search_result->title(); + + if (base::StartsWith(details, user_typed_text, + base::CompareCase::INSENSITIVE_ASCII) && + IsValidAutocompleteText(details)) { + // Current text in the search_box matches the first result's url. + SetAutocompleteText(details); + MaybeSetAutocompleteGhostText(std::u16string(), + GetCategoryName(search_result)); + return true; + } + + if (base::StartsWith(search_text, user_typed_text, + base::CompareCase::INSENSITIVE_ASCII) && + IsValidAutocompleteText(search_text)) { + // Current text in the search_box matches the first result's search result + // text. + SetAutocompleteText(search_text); + MaybeSetAutocompleteGhostText(std::u16string(), + GetCategoryName(search_result)); + return true; + } + return false; +} + void SearchBoxView::ClearAutocompleteText() { if (!ShouldProcessAutocomplete()) return; + // Clear ghost text. + MaybeSetAutocompleteGhostText(std::u16string(), std::u16string()); + // Avoid triggering subsequent query by temporarily setting controller to // nullptr. search_box()->set_controller(nullptr); @@ -835,6 +837,22 @@ return kClassicSearchBoxButtonSizeDip; } +bool SearchBoxView::IsValidAutocompleteText( + const std::u16string& autocomplete_text) { + // Don't set autocomplete text if it's the same as current search box + // text. + if (autocomplete_text == search_box()->GetText()) + return false; + // Don't set autocomplete text if the highlighted text is the same as + // before. + if (autocomplete_text.length() > highlight_range_.start() && + autocomplete_text.substr(highlight_range_.start()) == + search_box()->GetSelectedText()) { + return false; + } + return true; +} + void SearchBoxView::UpdateTextColor() { if (is_app_list_bubble_) { // Bubble launcher uses standard text colors (light-on-dark by default). @@ -1199,8 +1217,18 @@ if (features::IsAutocompleteExtendedSuggestionsEnabled()) { ClearAutocompleteText(); - MaybeSetAutocompleteGhostText(selected_result->title(), - GetCategoryName(selected_result)); + + const std::u16string& details = selected_result->details(); + const std::u16string& search_text = selected_result->title(); + + // Don't set autocomplete text if it's the same as user typed text. + if (current_query_ == details || current_query_ == search_text) + return; + + if (!ProcessPrefixMatchAutocomplete(selected_result, current_query_)) { + MaybeSetAutocompleteGhostText(selected_result->title(), + GetCategoryName(selected_result)); + } } else { if (selected_result->result_type() == AppListSearchResultType::kOmnibox && !selected_result->is_omnibox_search() &&
diff --git a/ash/app_list/views/search_box_view.h b/ash/app_list/views/search_box_view.h index 592f167..f71ec1d 100644 --- a/ash/app_list/views/search_box_view.h +++ b/ash/app_list/views/search_box_view.h
@@ -129,6 +129,10 @@ // Sets the autocomplete text if autocomplete conditions are met. void ProcessAutocomplete(SearchResultBaseView* first_result_view); + // Sets up prefix match autocomplete. Returns true if successful. + bool ProcessPrefixMatchAutocomplete(SearchResult* search_result, + const std::u16string& user_typed_text); + // Removes all autocomplete text. void ClearAutocompleteText(); @@ -170,6 +174,10 @@ private: class FocusRingLayer; + // Whether 'autocomplete_text' is a valid candidate for classic highlighted + // autocomplete. + bool IsValidAutocompleteText(const std::u16string& autocomplete_text); + // Updates the text field text color. void UpdateTextColor();
diff --git a/ash/public/cpp/style/color_provider.h b/ash/public/cpp/style/color_provider.h index 6093c1f..add928a 100644 --- a/ash/public/cpp/style/color_provider.h +++ b/ash/public/cpp/style/color_provider.h
@@ -39,6 +39,7 @@ kTransparent40, kTransparent60, kTransparent80, + kInvertedTransparent80, kTransparent90, kTransparent95,
diff --git a/ash/search_box/search_box_view_base.cc b/ash/search_box/search_box_view_base.cc index 03d4eec..adf6fe2 100644 --- a/ash/search_box/search_box_view_base.cc +++ b/ash/search_box/search_box_view_base.cc
@@ -531,14 +531,16 @@ if (!features::IsAutocompleteExtendedSuggestionsEnabled()) return; - if (title.empty()) { + if (title.empty() && category.empty()) { ghost_text_container_->SetVisible(false); autocomplete_ghost_text_->SetText(std::u16string()); category_ghost_text_->SetText(std::u16string()); } else { ghost_text_container_->SetVisible(true); autocomplete_ghost_text_->SetText(title); + separator_label_->SetVisible(!title.empty()); category_ghost_text_->SetText(category); + category_separator_label_->SetVisible(!category.empty()); } } @@ -558,12 +560,13 @@ UpdatePlaceholderTextStyle(); search_box_->SetCursorEnabled(active); + // Clear ghost text when toggling search box active state. + MaybeSetAutocompleteGhostText(std::u16string(), std::u16string()); + if (active) { search_box_->RequestFocus(); RecordSearchBoxActivationHistogram(event_type); } else { - // Clear ghost text when deactivating the search box. - MaybeSetAutocompleteGhostText(std::u16string(), std::u16string()); search_box_->DestroyTouchSelection(); }
diff --git a/ash/shelf/hotseat_widget.cc b/ash/shelf/hotseat_widget.cc index a26e259..e851a518 100644 --- a/ash/shelf/hotseat_widget.cc +++ b/ash/shelf/hotseat_widget.cc
@@ -21,6 +21,7 @@ #include "ash/shelf/shelf_navigation_widget.h" #include "ash/shelf/shelf_view.h" #include "ash/shell.h" +#include "ash/style/system_shadow.h" #include "ash/system/status_area_widget.h" #include "ash/wallpaper/wallpaper_controller_impl.h" #include "ash/wm/overview/overview_controller.h" @@ -482,6 +483,8 @@ // The most recent color that the |translucent_background_| has been animated // to. SkColor target_color_ = SK_ColorTRANSPARENT; + + std::unique_ptr<SystemShadow> shadow_; }; HotseatWidget::DelegateView::~DelegateView() { @@ -527,18 +530,33 @@ translucent_background_->SetPaintToLayer(ui::LAYER_SOLID_COLOR); } translucent_background_->layer()->SetName("hotseat/Background"); + + // Create a shadow and stack at the bottom. + shadow_ = SystemShadow::CreateShadowOnTextureLayer( + SystemShadow::Type::kElevation12); + auto* parent_layer = translucent_background_->layer()->parent(); + auto* shadow_layer = shadow_->GetLayer(); + parent_layer->Add(shadow_layer); + parent_layer->StackAtBottom(shadow_layer); } void HotseatWidget::DelegateView::UpdateTranslucentBackground() { if (!HotseatWidget::ShouldShowHotseatBackground()) { translucent_background_->SetVisible(false); SetBackgroundBlur(false); + shadow_->GetLayer()->SetVisible(false); return; } DCHECK(scrollable_shelf_view_); SetTranslucentBackground( scrollable_shelf_view_->GetHotseatBackgroundBounds()); + + // Update the shadow content bounds and corner radius. + shadow_->GetLayer()->SetVisible(true); + gfx::Rect background_bounds = translucent_background_->bounds(); + shadow_->SetRoundedCornerRadius(background_bounds.height() / 2); + shadow_->SetContentBounds(background_bounds); } void HotseatWidget::DelegateView::SetTranslucentBackground(
diff --git a/ash/shelf/shelf_tooltip_bubble.cc b/ash/shelf/shelf_tooltip_bubble.cc index 94570dea..a23d18d 100644 --- a/ash/shelf/shelf_tooltip_bubble.cc +++ b/ash/shelf/shelf_tooltip_bubble.cc
@@ -43,11 +43,10 @@ label->SetHorizontalAlignment(gfx::ALIGN_LEFT); const auto* color_provider = AshColorProvider::Get(); const bool is_dark_light_mode_enabled = features::IsDarkLightModeEnabled(); - auto background_color_type = AshColorProvider::BaseLayerType::kTransparent80; - const SkColor tooltip_background = + const SkColor tooltip_background = color_provider->GetBaseLayerColor( is_dark_light_mode_enabled - ? color_provider->GetInvertedBaseLayerColor(background_color_type) - : color_provider->GetBaseLayerColor(background_color_type); + ? AshColorProvider::BaseLayerType::kInvertedTransparent80 + : AshColorProvider::BaseLayerType::kTransparent80); const SkColor tooltip_text = color_provider->GetContentLayerColor( is_dark_light_mode_enabled ? AshColorProvider::ContentLayerType::kInvertedTextColorPrimary
diff --git a/ash/style/ash_color_id.h b/ash/style/ash_color_id.h index cbbbbd4..b8dd6005 100644 --- a/ash/style/ash_color_id.h +++ b/ash/style/ash_color_id.h
@@ -17,6 +17,7 @@ E_CPONLY(kColorAshShieldAndBase40) \ E_CPONLY(kColorAshShieldAndBase60) \ E_CPONLY(kColorAshShieldAndBase80) \ + E_CPONLY(kColorAshInvertedShieldAndBase80) \ E_CPONLY(kColorAshShieldAndBase90) \ E_CPONLY(kColorAshShieldAndBase95) \ E_CPONLY(kColorAshShieldAndBaseOpaque) \ @@ -88,7 +89,8 @@ /* Color for the battery icon in the system info view. */ \ E_CPONLY(kColorAshBatterySystemInfoIconColor) \ /* Color of the capture region in the capture session. */ \ - E_CPONLY(kColorAshCaptureRegionColor) + E_CPONLY(kColorAshCaptureRegionColor) \ + E_CPONLY(kColorAshInkDrop) #include "ui/color/color_id_macros.inc"
diff --git a/ash/style/ash_color_mixer.cc b/ash/style/ash_color_mixer.cc index 5cf6217..af710de 100644 --- a/ash/style/ash_color_mixer.cc +++ b/ash/style/ash_color_mixer.cc
@@ -16,6 +16,7 @@ #include "ui/color/color_mixer.h" #include "ui/color/color_provider.h" #include "ui/color/color_recipe.h" +#include "ui/gfx/color_utils.h" namespace ash { @@ -53,6 +54,8 @@ mixer[kColorAshShieldAndBase40] = {SkColorSetA(background_color, kAlpha40)}; mixer[kColorAshShieldAndBase60] = {SkColorSetA(background_color, kAlpha60)}; mixer[kColorAshShieldAndBase80] = {SkColorSetA(background_color, kAlpha80)}; + mixer[kColorAshInvertedShieldAndBase80] = { + SkColorSetA(color_utils::InvertColor(background_color), kAlpha80)}; mixer[kColorAshShieldAndBase90] = {SkColorSetA(background_color, kAlpha90)}; mixer[kColorAshShieldAndBase95] = {SkColorSetA(background_color, kAlpha95)}; mixer[kColorAshShieldAndBaseOpaque] = { @@ -194,6 +197,19 @@ mixer[kColorAshBatterySystemInfoIconColor] = { kColorAshButtonLabelColorPrimary}; mixer[kColorAshCaptureRegionColor] = {kColorAshProgressBarColorBackground}; + + if (key.user_color.has_value()) { + mixer[kColorAshInkDrop] = ui::SelectBasedOnDarkInput( + {*key.user_color}, /*output_transform_for_dark_input=*/ + ui::SetAlpha(SK_ColorWHITE, kDarkInkDropOpacity), + /*output_transform_for_light_input=*/ + ui::SetAlpha(SK_ColorBLACK, kLightInkDropOpacity)); + } else { + // Default `user_color` is dark if color_mode is dark. + mixer[kColorAshInkDrop] = + use_dark_color ? ui::SetAlpha(SK_ColorWHITE, kDarkInkDropOpacity) + : ui::SetAlpha(SK_ColorBLACK, kLightInkDropOpacity); + } } // Remaps colors generated by cros_colors.json5 to point to equivalent tokens. @@ -398,10 +414,7 @@ mixer[ui::kColorAshSystemUIMenuBackground] = {kColorAshShieldAndBase80}; mixer[ui::kColorAshSystemUIMenuIcon] = {kColorAshIconColorPrimary}; - mixer[ui::kColorAshSystemUIMenuItemBackgroundSelected] = - key.color_mode == ui::ColorProviderManager::ColorMode::kDark - ? ui::SetAlpha(SK_ColorWHITE, kDarkInkDropOpacity) - : ui::SetAlpha(SK_ColorBLACK, kLightInkDropOpacity); + mixer[ui::kColorAshSystemUIMenuItemBackgroundSelected] = {kColorAshInkDrop}; mixer[ui::kColorAshSystemUIMenuSeparator] = {kColorAshSeparatorColor}; }
diff --git a/ash/style/ash_color_provider.cc b/ash/style/ash_color_provider.cc index 10b33b5..fc49645 100644 --- a/ash/style/ash_color_provider.cc +++ b/ash/style/ash_color_provider.cc
@@ -128,16 +128,71 @@ } SkColor AshColorProvider::GetShieldLayerColor(ShieldLayerType type) const { - return GetShieldLayerColorImpl(type, /*inverted=*/false); + constexpr int kAlphas[] = {kAlpha20, kAlpha40, kAlpha60, + kAlpha80, kAlpha90, kAlpha95}; + DCHECK_LT(static_cast<size_t>(type), std::size(kAlphas)); + return SkColorSetA(GetBackgroundColor(), kAlphas[static_cast<int>(type)]); } SkColor AshColorProvider::GetBaseLayerColor(BaseLayerType type) const { - return GetBaseLayerColorImpl(type, /*inverted=*/false); + // TODO(minch): Get all the colors from `GetColorProvider` as + // `kInvertedTransparent80`. + const auto color = GetBackgroundColor(); + switch (type) { + case BaseLayerType::kTransparent20: + return SkColorSetA(color, kAlpha20); + case BaseLayerType::kTransparent40: + return SkColorSetA(color, kAlpha40); + case BaseLayerType::kTransparent60: + return SkColorSetA(color, kAlpha60); + case BaseLayerType::kTransparent80: + return SkColorSetA(color, kAlpha80); + case BaseLayerType::kInvertedTransparent80: + return GetColorProvider()->GetColor(kColorAshInvertedShieldAndBase80); + case BaseLayerType::kTransparent90: + return SkColorSetA(color, kAlpha90); + case BaseLayerType::kTransparent95: + return SkColorSetA(color, kAlpha95); + case BaseLayerType::kOpaque: + return SkColorSetA(color, SK_AlphaOPAQUE); + } } SkColor AshColorProvider::GetControlsLayerColor(ControlsLayerType type) const { - // TODO(skau): Delete this function - return GetControlsLayerColorImpl(type); + // TODO(crbug.com/1292244): Delete this function after all callers migrate. + auto* color_provider = GetColorProvider(); + DCHECK(color_provider); + + switch (type) { + case ControlsLayerType::kHairlineBorderColor: + return color_provider->GetColor(kColorAshHairlineBorderColor); + case ControlsLayerType::kControlBackgroundColorActive: + return color_provider->GetColor(kColorAshControlBackgroundColorActive); + case ControlsLayerType::kControlBackgroundColorInactive: + return color_provider->GetColor(kColorAshControlBackgroundColorInactive); + case ControlsLayerType::kControlBackgroundColorAlert: + return color_provider->GetColor(kColorAshControlBackgroundColorAlert); + case ControlsLayerType::kControlBackgroundColorWarning: + return color_provider->GetColor(kColorAshControlBackgroundColorWarning); + case ControlsLayerType::kControlBackgroundColorPositive: + return color_provider->GetColor(kColorAshControlBackgroundColorPositive); + case ControlsLayerType::kFocusAuraColor: + return color_provider->GetColor(kColorAshFocusAuraColor); + case ControlsLayerType::kFocusRingColor: + return color_provider->GetColor(ui::kColorAshFocusRing); + case ControlsLayerType::kHighlightColor1: + return color_provider->GetColor(ui::kColorAshSystemUIHighlightColor1); + case ControlsLayerType::kHighlightColor2: + return color_provider->GetColor(ui::kColorAshSystemUIHighlightColor2); + case ControlsLayerType::kHighlightColor3: + return color_provider->GetColor(ui::kColorAshSystemUIHighlightColor3); + case ControlsLayerType::kBorderColor1: + return color_provider->GetColor(ui::kColorAshSystemUIBorderColor1); + case ControlsLayerType::kBorderColor2: + return color_provider->GetColor(ui::kColorAshSystemUIBorderColor2); + case ControlsLayerType::kBorderColor3: + return color_provider->GetColor(ui::kColorAshSystemUIBorderColor3); + } } SkColor AshColorProvider::GetContentLayerColor(ContentLayerType type) const { @@ -177,10 +232,6 @@ return std::make_pair(base_color, opacity); } -SkColor AshColorProvider::GetInvertedBaseLayerColor(BaseLayerType type) const { - return GetBaseLayerColorImpl(type, /*inverted=*/true); -} - SkColor AshColorProvider::GetBackgroundColor() const { return GetBackgroundThemedColorImpl(GetBackgroundDefaultColor(), IsDarkModeEnabled()); @@ -196,64 +247,6 @@ use_dark_color); } -SkColor AshColorProvider::GetShieldLayerColorImpl(ShieldLayerType type, - bool inverted) const { - constexpr int kAlphas[] = {kAlpha20, kAlpha40, kAlpha60, - kAlpha80, kAlpha90, kAlpha95}; - DCHECK_LT(static_cast<size_t>(type), std::size(kAlphas)); - return SkColorSetA( - inverted ? GetInvertedBackgroundColor() : GetBackgroundColor(), - kAlphas[static_cast<int>(type)]); -} - -SkColor AshColorProvider::GetBaseLayerColorImpl(BaseLayerType type, - bool inverted) const { - constexpr int kAlphas[] = {kAlpha20, kAlpha40, kAlpha60, kAlpha80, - kAlpha90, kAlpha95, 0xFF}; - DCHECK_LT(static_cast<size_t>(type), std::size(kAlphas)); - return SkColorSetA( - inverted ? GetInvertedBackgroundColor() : GetBackgroundColor(), - kAlphas[static_cast<int>(type)]); -} - -SkColor AshColorProvider::GetControlsLayerColorImpl( - ControlsLayerType type) const { - // TODO(crbug.com/1292244): Delete this function after all callers migrate. - auto* color_provider = GetColorProvider(); - DCHECK(color_provider); - - switch (type) { - case ControlsLayerType::kHairlineBorderColor: - return color_provider->GetColor(kColorAshHairlineBorderColor); - case ControlsLayerType::kControlBackgroundColorActive: - return color_provider->GetColor(kColorAshControlBackgroundColorActive); - case ControlsLayerType::kControlBackgroundColorInactive: - return color_provider->GetColor(kColorAshControlBackgroundColorInactive); - case ControlsLayerType::kControlBackgroundColorAlert: - return color_provider->GetColor(kColorAshControlBackgroundColorAlert); - case ControlsLayerType::kControlBackgroundColorWarning: - return color_provider->GetColor(kColorAshControlBackgroundColorWarning); - case ControlsLayerType::kControlBackgroundColorPositive: - return color_provider->GetColor(kColorAshControlBackgroundColorPositive); - case ControlsLayerType::kFocusAuraColor: - return color_provider->GetColor(kColorAshFocusAuraColor); - case ControlsLayerType::kFocusRingColor: - return color_provider->GetColor(ui::kColorAshFocusRing); - case ControlsLayerType::kHighlightColor1: - return color_provider->GetColor(ui::kColorAshSystemUIHighlightColor1); - case ControlsLayerType::kHighlightColor2: - return color_provider->GetColor(ui::kColorAshSystemUIHighlightColor2); - case ControlsLayerType::kHighlightColor3: - return color_provider->GetColor(ui::kColorAshSystemUIHighlightColor3); - case ControlsLayerType::kBorderColor1: - return color_provider->GetColor(ui::kColorAshSystemUIBorderColor1); - case ControlsLayerType::kBorderColor2: - return color_provider->GetColor(ui::kColorAshSystemUIBorderColor2); - case ControlsLayerType::kBorderColor3: - return color_provider->GetColor(ui::kColorAshSystemUIBorderColor3); - } -} - SkColor AshColorProvider::GetContentLayerColorImpl(ContentLayerType type, bool use_dark_color) const { switch (type) {
diff --git a/ash/style/ash_color_provider.h b/ash/style/ash_color_provider.h index 0e63dd5..86214b0 100644 --- a/ash/style/ash_color_provider.h +++ b/ash/style/ash_color_provider.h
@@ -57,11 +57,6 @@ std::pair<SkColor, float> GetInvertedInkDropBaseColorAndOpacity( SkColor background_color = gfx::kPlaceholderColor) const override; - // Gets the color of |type| of the corresponding layer based on the current - // inverted color mode. For views that need LIGHT colors while DARK mode is - // active, and vice versa. - SkColor GetInvertedBaseLayerColor(BaseLayerType type) const; - // Gets the background color that can be applied on any layer. The returned // color will be different based on color mode and color theme (see // |is_themed_|). @@ -73,13 +68,8 @@ SkColor GetBackgroundColorInMode(bool use_dark_color) const; private: - // Gets the color of |type| of the corresponding layer. Returns color based on - // the current inverted color mode if |inverted| is true. - SkColor GetShieldLayerColorImpl(ShieldLayerType type, bool inverted) const; - SkColor GetBaseLayerColorImpl(BaseLayerType type, bool inverted) const; // Gets the color of |type| of the corresponding layer. Returns the color on // dark mode if |use_dark_color| is true. - SkColor GetControlsLayerColorImpl(ControlsLayerType type) const; SkColor GetContentLayerColorImpl(ContentLayerType type, bool use_dark_color) const;
diff --git a/ash/style/ash_color_provider_unittest.cc b/ash/style/ash_color_provider_unittest.cc index 70cde3af..c9b526a8e 100644 --- a/ash/style/ash_color_provider_unittest.cc +++ b/ash/style/ash_color_provider_unittest.cc
@@ -104,6 +104,9 @@ SkColorSetARGB(0x99, 0xFF, 0xFF, 0xFF)}, {ColorMode::kLight, ColorProvider::BaseLayerType::kTransparent80, SkColorSetARGB(0xCC, 0xFF, 0xFF, 0xFF)}, + {ColorMode::kLight, + ColorProvider::BaseLayerType::kInvertedTransparent80, + SkColorSetARGB(0xCC, 0x00, 0x00, 0x00)}, {ColorMode::kLight, ColorProvider::BaseLayerType::kTransparent90, SkColorSetARGB(0xE6, 0xFF, 0xFF, 0xFF)}, {ColorMode::kLight, ColorProvider::BaseLayerType::kTransparent95, @@ -120,6 +123,9 @@ SkColorSetARGB(0x99, 0x20, 0x21, 0x24)}, {ColorMode::kDark, ColorProvider::BaseLayerType::kTransparent80, SkColorSetARGB(0xCC, 0x20, 0x21, 0x24)}, + {ColorMode::kDark, + ColorProvider::BaseLayerType::kInvertedTransparent80, + SkColorSetARGB(0xCC, 0xDF, 0xDE, 0xDB)}, {ColorMode::kDark, ColorProvider::BaseLayerType::kTransparent90, SkColorSetARGB(0xE6, 0x20, 0x21, 0x24)}, {ColorMode::kDark, ColorProvider::BaseLayerType::kTransparent95,
diff --git a/ash/style/system_shadow.cc b/ash/style/system_shadow.cc index 5b5292f4..5bffb31 100644 --- a/ash/style/system_shadow.cc +++ b/ash/style/system_shadow.cc
@@ -5,6 +5,7 @@ #include "ash/style/system_shadow.h" #include "ash/style/system_shadow_on_nine_patch_layer.h" +#include "ash/style/system_shadow_on_texture_layer.h" #include "base/memory/ptr_util.h" namespace ash { @@ -14,8 +15,7 @@ // static std::unique_ptr<SystemShadow> SystemShadow::CreateShadowOnNinePatchLayer( Type shadow_type) { - int elevation = GetElevationFromType(shadow_type); - return base::WrapUnique(new SystemShadowOnNinePatchLayerImpl(elevation)); + return base::WrapUnique(new SystemShadowOnNinePatchLayerImpl(shadow_type)); } // static @@ -23,9 +23,8 @@ views::View* view, Type shadow_type) { DCHECK(view); - int elevation = GetElevationFromType(shadow_type); return base::WrapUnique( - new SystemViewShadowOnNinePatchLayer(view, elevation)); + new SystemViewShadowOnNinePatchLayer(view, shadow_type)); } // static @@ -33,9 +32,14 @@ SystemShadow::CreateShadowOnNinePatchLayerForWindow(aura::Window* window, Type shadow_type) { DCHECK(window); - int elevation = GetElevationFromType(shadow_type); return base::WrapUnique( - new SystemWindowShadowOnNinePatchLayer(window, elevation)); + new SystemWindowShadowOnNinePatchLayer(window, shadow_type)); +} + +// static +std::unique_ptr<SystemShadow> SystemShadow::CreateShadowOnTextureLayer( + Type shadow_type) { + return base::WrapUnique(new SystemShadowOnTextureLayer(shadow_type)); } // static
diff --git a/ash/style/system_shadow.h b/ash/style/system_shadow.h index 6d62f7ab7..e096697 100644 --- a/ash/style/system_shadow.h +++ b/ash/style/system_shadow.h
@@ -70,6 +70,12 @@ aura::Window* window, Type shadow_type); + // Create a system shadow painted on a texture layer. Painting shadow on a + // texture layer is expensive so only use it when necessary. See + // `SystemShadowOnTextureLayer` for more details. + static std::unique_ptr<SystemShadow> CreateShadowOnTextureLayer( + Type shadow_type); + // Get shadow elevation according to the given type. static int GetElevationFromType(Type type);
diff --git a/ash/style/system_shadow_on_nine_patch_layer.cc b/ash/style/system_shadow_on_nine_patch_layer.cc index 6ecec65a..81ada67 100644 --- a/ash/style/system_shadow_on_nine_patch_layer.cc +++ b/ash/style/system_shadow_on_nine_patch_layer.cc
@@ -39,8 +39,8 @@ // ----------------------------------------------------------------------------- // SystemShadowOnNinePatchLayerImpl: SystemShadowOnNinePatchLayerImpl::SystemShadowOnNinePatchLayerImpl( - int elevation) { - shadow_.Init(elevation); + SystemShadow::Type type) { + shadow_.Init(SystemShadow::GetElevationFromType(type)); shadow_.SetShadowStyle(gfx::ShadowStyle::kChromeOSSystemUI); } @@ -54,8 +54,8 @@ // SystemViewShadowOnNinePatchLayer: SystemViewShadowOnNinePatchLayer::SystemViewShadowOnNinePatchLayer( views::View* view, - int elevation) - : view_shadow_(view, elevation) { + SystemShadow::Type type) + : view_shadow_(view, SystemShadow::GetElevationFromType(type)) { view_shadow_.shadow()->SetShadowStyle(gfx::ShadowStyle::kChromeOSSystemUI); } @@ -77,8 +77,8 @@ // SystemWindowShadowOnNinePatchLayer: SystemWindowShadowOnNinePatchLayer::SystemWindowShadowOnNinePatchLayer( aura::Window* window, - int elevation) - : SystemShadowOnNinePatchLayerImpl(elevation) { + SystemShadow::Type type) + : SystemShadowOnNinePatchLayerImpl(type) { auto* window_layer = window->layer(); auto* shadow_layer = GetLayer(); window_layer->Add(shadow_layer);
diff --git a/ash/style/system_shadow_on_nine_patch_layer.h b/ash/style/system_shadow_on_nine_patch_layer.h index 1c43a91..d5fee8349 100644 --- a/ash/style/system_shadow_on_nine_patch_layer.h +++ b/ash/style/system_shadow_on_nine_patch_layer.h
@@ -42,7 +42,7 @@ // the ui::Shadow. class SystemShadowOnNinePatchLayerImpl : public SystemShadowOnNinePatchLayer { public: - explicit SystemShadowOnNinePatchLayerImpl(int elevation); + explicit SystemShadowOnNinePatchLayerImpl(SystemShadow::Type type); SystemShadowOnNinePatchLayerImpl(const SystemShadowOnNinePatchLayerImpl&) = delete; SystemShadowOnNinePatchLayerImpl& operator=( @@ -62,7 +62,7 @@ // content bounds. class SystemViewShadowOnNinePatchLayer : public SystemShadowOnNinePatchLayer { public: - SystemViewShadowOnNinePatchLayer(views::View* view, int elevation); + SystemViewShadowOnNinePatchLayer(views::View* view, SystemShadow::Type type); SystemViewShadowOnNinePatchLayer(const SystemViewShadowOnNinePatchLayer&) = delete; SystemViewShadowOnNinePatchLayer& operator=( @@ -87,7 +87,8 @@ : public SystemShadowOnNinePatchLayerImpl, public aura::WindowObserver { public: - SystemWindowShadowOnNinePatchLayer(aura::Window* window, int elevation); + SystemWindowShadowOnNinePatchLayer(aura::Window* window, + SystemShadow::Type type); SystemWindowShadowOnNinePatchLayer( const SystemWindowShadowOnNinePatchLayer&) = delete; SystemWindowShadowOnNinePatchLayer& operator=(
diff --git a/ash/style/system_shadow_on_texture_layer.cc b/ash/style/system_shadow_on_texture_layer.cc new file mode 100644 index 0000000..785efbbe --- /dev/null +++ b/ash/style/system_shadow_on_texture_layer.cc
@@ -0,0 +1,86 @@ +// 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 "ash/style/system_shadow_on_texture_layer.h" + +#include "ui/compositor/paint_recorder.h" +#include "ui/gfx/skia_paint_util.h" + +namespace ash { + +SystemShadowOnTextureLayer::SystemShadowOnTextureLayer(SystemShadow::Type type) + : shadow_values_(gfx::ShadowValue::MakeChromeOSSystemUIShadowValues( + SystemShadow::GetElevationFromType(type))) { + layer_.SetFillsBoundsOpaquely(false); + layer_.set_delegate(this); + layer_.SetBounds(GetLayerBounds()); +} + +SystemShadowOnTextureLayer::~SystemShadowOnTextureLayer() = default; + +void SystemShadowOnTextureLayer::SetType(SystemShadow::Type type) { + shadow_values_ = gfx::ShadowValue::MakeChromeOSSystemUIShadowValues( + SystemShadow::GetElevationFromType(type)); + UpdateLayer(); +} + +void SystemShadowOnTextureLayer::SetContentBounds(const gfx::Rect& bounds) { + content_bounds_ = bounds; + layer_.SetBounds(GetLayerBounds()); + UpdateLayer(); +} + +void SystemShadowOnTextureLayer::SetRoundedCornerRadius(int corner_radius) { + corner_radius_ = corner_radius; + UpdateLayer(); +} + +const gfx::Rect& SystemShadowOnTextureLayer::GetContentBounds() { + return content_bounds_; +} + +ui::Layer* SystemShadowOnTextureLayer::GetLayer() { + return &layer_; +} + +ui::Layer* SystemShadowOnTextureLayer::GetNinePatchLayer() { + return nullptr; +} + +gfx::Rect SystemShadowOnTextureLayer::GetLayerBounds() const { + gfx::Rect layer_bounds = content_bounds_; + layer_bounds.Inset(gfx::ShadowValue::GetMargin(shadow_values_)); + return layer_bounds; +} + +void SystemShadowOnTextureLayer::UpdateLayer() { + layer_.SchedulePaint(GetLayerBounds()); +} + +void SystemShadowOnTextureLayer::OnPaintLayer(const ui::PaintContext& context) { + // Create a rounded rect of content area. + const gfx::Rect r_rect_bounds = + content_bounds_ - GetLayerBounds().OffsetFromOrigin(); + const SkRRect r_rect = SkRRect::MakeRectXY(gfx::RectToSkRect(r_rect_bounds), + corner_radius_, corner_radius_); + + // Clip out the center. + ui::PaintRecorder recorder(context, content_bounds_.size()); + recorder.canvas()->sk_canvas()->clipRRect(r_rect, SkClipOp::kDifference, + true); + // Paint shadow. + cc::PaintFlags shadow_flags; + shadow_flags.setAntiAlias(true); + shadow_flags.setLooper(gfx::CreateShadowDrawLooper(shadow_values_)); + // Due to anti alias, we should fill transparent color to the rounded corner + // area. + shadow_flags.setColor(SK_ColorTRANSPARENT); + recorder.canvas()->sk_canvas()->drawRRect(r_rect, shadow_flags); +} + +void SystemShadowOnTextureLayer::OnDeviceScaleFactorChanged( + float old_device_scale_factor, + float new_device_scale_factor) {} + +} // namespace ash
diff --git a/ash/style/system_shadow_on_texture_layer.h b/ash/style/system_shadow_on_texture_layer.h new file mode 100644 index 0000000..e278583 --- /dev/null +++ b/ash/style/system_shadow_on_texture_layer.h
@@ -0,0 +1,64 @@ +// 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 ASH_STYLE_SYSTEM_SHADOW_ON_TEXTURE_LAYER_H_ +#define ASH_STYLE_SYSTEM_SHADOW_ON_TEXTURE_LAYER_H_ + +#include "ash/style/system_shadow.h" +#include "ui/compositor/layer.h" +#include "ui/compositor/layer_delegate.h" +#include "ui/gfx/shadow_value.h" + +namespace ash { + +// An implementation of `SystemShadow` that paints shadow on a texture layer, +// which is used to resolve geometry limitations of the +// SystemShadowOnNinePatchLayer. For SystemShadowOnNinePatchLayer that paints +// the shadow on a nine patch layer will limit the shadow elevation to +// (smaller dimension - 2 * corner radius) / 4 (refer to the implementation of +// `ui::Shadow::UpdateLayerBounds`). This will cause the shadow elevation of the +// UI with a large rounded radius decrease, even be 0 if the corner radius is +// half of the UI surface’s height or width. Use the SystemShadowOnTextureLayer +// in this case. +class SystemShadowOnTextureLayer : public SystemShadow, + public ui::LayerDelegate { + public: + explicit SystemShadowOnTextureLayer(SystemShadow::Type type); + SystemShadowOnTextureLayer(const SystemShadowOnTextureLayer&) = delete; + SystemShadowOnTextureLayer& operator=(const SystemShadowOnTextureLayer&) = + delete; + ~SystemShadowOnTextureLayer() override; + + // SystemShadow: + void SetType(SystemShadow::Type type) override; + void SetContentBounds(const gfx::Rect& bounds) override; + void SetRoundedCornerRadius(int corner_radius) override; + const gfx::Rect& GetContentBounds() override; + ui::Layer* GetLayer() override; + ui::Layer* GetNinePatchLayer() override; + + private: + // Calculate layer bounds according to the content bounds and shadow values. + gfx::Rect GetLayerBounds() const; + + // Repaint the layer after the shadow attributes change. + void UpdateLayer(); + + // ui::LayerDelegate: + void OnPaintLayer(const ui::PaintContext& context) override; + void OnDeviceScaleFactorChanged(float old_device_scale_factor, + float new_device_scale_factor) override; + + // The texture layer on which the shadow is painted. + ui::Layer layer_; + // Shadow values generated according to the shadow type. + gfx::ShadowValues shadow_values_; + // The bounds of the content area. + gfx::Rect content_bounds_; + int corner_radius_ = 0; +}; + +} // namespace ash + +#endif // ASH_STYLE_SYSTEM_SHADOW_ON_TEXTURE_LAYER_H_
diff --git a/ash/system/accessibility/autoclick_scroll_view.cc b/ash/system/accessibility/autoclick_scroll_view.cc index 37c5fd8..c081451 100644 --- a/ash/system/accessibility/autoclick_scroll_view.cc +++ b/ash/system/accessibility/autoclick_scroll_view.cc
@@ -8,6 +8,7 @@ #include "ash/resources/vector_icons/vector_icons.h" #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" +#include "ash/style/ash_color_id.h" #include "ash/style/ash_color_provider.h" #include "ash/system/accessibility/autoclick_menu_bubble_controller.h" #include "ash/system/accessibility/floating_menu_button.h" @@ -39,13 +40,6 @@ constexpr int kScrollPadButtonHypotenuseDips = 192; constexpr int kScrollPadIconPadding = 30; -SkColor HoveredButtonColor() { - const std::pair<SkColor, float> base_color_and_opacity = - AshColorProvider::Get()->GetInkDropBaseColorAndOpacity(); - return SkColorSetA(base_color_and_opacity.first, - 255 * base_color_and_opacity.second); -} - } // namespace // The close button for the automatic clicks scroll bubble. @@ -97,7 +91,7 @@ cc::PaintFlags flags; flags.setAntiAlias(true); flags.setStyle(cc::PaintFlags::kFill_Style); - flags.setColor(HoveredButtonColor()); + flags.setColor(GetColorProvider()->GetColor(kColorAshInkDrop)); canvas->DrawCircle(gfx::PointF(rect.CenterPoint()), kScrollButtonCloseSizeDips / 2, flags); } @@ -259,7 +253,7 @@ flags.setAntiAlias(true); if (active_) { - flags.setColor(HoveredButtonColor()); + flags.setColor(GetColorProvider()->GetColor(kColorAshInkDrop)); flags.setStyle(cc::PaintFlags::kFill_Style); canvas->DrawPath(CreateCustomShapePath(rect), flags); }
diff --git a/ash/system/network/network_list_view.cc b/ash/system/network/network_list_view.cc index 62edcddd..8f6a2d26 100644 --- a/ash/system/network/network_list_view.cc +++ b/ash/system/network/network_list_view.cc
@@ -19,6 +19,7 @@ #include "ash/system/network/network_info.h" #include "ash/system/network/network_section_header_view.h" #include "ash/system/network/network_state_list_detailed_view.h" +#include "ash/system/network/network_utils.h" #include "ash/system/network/tray_network_state_model.h" #include "ash/system/power/power_status.h" #include "ash/system/tray/hover_highlight_view.h" @@ -397,8 +398,10 @@ index += new_guids->size(); if (ShouldMobileDataSectionBeShown()) { - if (!mobile_header_view_) + if (!mobile_header_view_) { + RecordDetailedViewSection(DetailedViewSection::kMobileSection); mobile_header_view_ = new MobileSectionHeaderView(); + } index = UpdateNetworkSectionHeader( NetworkType::kMobile, false /* enabled */, index, mobile_header_view_, @@ -423,8 +426,10 @@ needs_relayout_ = true; } - if (!wifi_header_view_) + if (!wifi_header_view_) { + RecordDetailedViewSection(DetailedViewSection::kWifiSection); wifi_header_view_ = new WifiSectionHeaderView(); + } bool wifi_enabled = model()->GetDeviceState(NetworkType::kWiFi) == DeviceStateType::kEnabled; @@ -701,14 +706,29 @@ void NetworkListView::UpdateNetworkChild(int index, const NetworkInfo* info) { HoverHighlightView* network_view = nullptr; NetworkGuidMap::const_iterator found = network_guid_map_.find(info->guid); + + // This value is used to determine whether at least one network of |type| type + // already existed prior to this method. + bool has_reordered_a_network = false; + if (found == network_guid_map_.end()) { network_view = new HoverHighlightView(this); UpdateViewForNetwork(network_view, *info); } else { + has_reordered_a_network = true; network_view = found->second; if (NeedUpdateViewForNetwork(*info)) UpdateViewForNetwork(network_view, *info); } + + // Only emit ethernet metric each time we show Ethernet section + // for the first time. We use |has_reordered_a_network| to determine + // if Ethernet networks already exist in network detailed list. + if (NetworkTypeMatchesType(info->type, NetworkType::kEthernet) && + !has_reordered_a_network) { + RecordDetailedViewSection(DetailedViewSection::kEthernetSection); + } + PlaceViewAtIndex(network_view, index); network_view->SetEnabled(!info->disable); network_map_[network_view] = info->guid;
diff --git a/ash/system/network/network_section_header_view.cc b/ash/system/network/network_section_header_view.cc index 9e56e0c..70a211e 100644 --- a/ash/system/network/network_section_header_view.cc +++ b/ash/system/network/network_section_header_view.cc
@@ -14,6 +14,7 @@ #include "ash/style/icon_button.h" #include "ash/system/bluetooth/bluetooth_power_controller.h" #include "ash/system/model/system_tray_model.h" +#include "ash/system/network/network_utils.h" #include "ash/system/network/tray_network_state_model.h" #include "ash/system/tray/tray_toggle_button.h" #include "base/bind.h" @@ -309,6 +310,7 @@ } void MobileSectionHeaderView::OnToggleToggled(bool is_on) { + RecordNetworkTypeToggled(NetworkType::kMobile, is_on); DeviceStateType cellular_state = model()->GetDeviceState(NetworkType::kCellular); @@ -463,6 +465,7 @@ } void WifiSectionHeaderView::OnToggleToggled(bool is_on) { + RecordNetworkTypeToggled(NetworkType::kWiFi, is_on); model()->SetNetworkTypeEnabledState(NetworkType::kWiFi, is_on); }
diff --git a/ash/system/network/network_state_list_detailed_view.cc b/ash/system/network/network_state_list_detailed_view.cc index dff0366..94f3ab48 100644 --- a/ash/system/network/network_state_list_detailed_view.cc +++ b/ash/system/network/network_state_list_detailed_view.cc
@@ -12,6 +12,7 @@ #include "ash/strings/grit/ash_strings.h" #include "ash/system/machine_learning/user_settings_event_logger.h" #include "ash/system/model/system_tray_model.h" +#include "ash/system/network/network_utils.h" #include "ash/system/network/tray_network_state_model.h" #include "ash/system/tray/system_menu_button.h" #include "ash/system/tray/tri_view.h" @@ -201,6 +202,7 @@ info_button_(nullptr), settings_button_(nullptr), info_bubble_(nullptr) { + RecordDetailedViewSection(DetailedViewSection::kDetailedSection); OverrideProgressBarAccessibleName(l10n_util::GetStringUTF16( IDS_ASH_STATUS_TRAY_NETWORK_PROGRESS_ACCESSIBLE_NAME)); } @@ -271,6 +273,8 @@ if (!Shell::Get()->session_controller()->ShouldEnableSettings()) { return; } + RecordNetworkRowClickedAction( + NetworkRowClickedAction::kOpenSimUnlockDialog); Shell::Get()->system_tray_model()->client()->ShowSettingsSimUnlock(); return; } @@ -289,6 +293,10 @@ ? UserMetricsAction("StatusArea_VPN_ConnectToNetwork") : UserMetricsAction("StatusArea_Network_ConnectConfigured")); LogUserNetworkEvent(*network.get()); + if (list_type_ == LIST_TYPE_NETWORK) { + RecordNetworkRowClickedAction( + NetworkRowClickedAction::kConnectToNetwork); + } chromeos::NetworkConnect::Get()->ConnectToNetworkId(network->guid); return; } @@ -299,6 +307,10 @@ list_type_ == LIST_TYPE_VPN ? UserMetricsAction("StatusArea_VPN_ConnectionDetails") : UserMetricsAction("StatusArea_Network_ConnectionDetails")); + if (list_type_ == LIST_TYPE_NETWORK) { + RecordNetworkRowClickedAction( + NetworkRowClickedAction::kOpenNetworkSettingsPage); + } Shell::Get()->system_tray_model()->client()->ShowNetworkSettings( network ? network->guid : std::string()); } @@ -332,6 +344,9 @@ ? model_->default_network()->guid : std::string(); + base::RecordAction(base::UserMetricsAction( + "ChromeOS.SystemTray.Network.SettingsButtonPressed")); + // Showing network settings window may close the bubble (and destroy this // view). Explicitly request bubble closure here, before showing network // settings.
diff --git a/ash/webui/personalization_app/resources/BUILD.gn b/ash/webui/personalization_app/resources/BUILD.gn index 0dcb0a2..64298fa 100644 --- a/ash/webui/personalization_app/resources/BUILD.gn +++ b/ash/webui/personalization_app/resources/BUILD.gn
@@ -30,7 +30,6 @@ "trusted/ambient/ambient_observer.ts", "trusted/ambient/ambient_reducers.ts", "trusted/ambient/ambient_state.ts", - "trusted/iframe_api.ts", "trusted/keyboard_backlight/keyboard_backlight_actions.ts", "trusted/keyboard_backlight/keyboard_backlight_controller.ts", "trusted/keyboard_backlight/keyboard_backlight_interface_provider.ts", @@ -61,7 +60,6 @@ "trusted/utils.ts", "trusted/wallpaper/google_photos_metrics_logger.ts", "trusted/wallpaper/wallpaper_actions.ts", - "trusted/wallpaper/untrusted_message_handler.ts", "trusted/wallpaper/wallpaper_controller.ts", "trusted/wallpaper/wallpaper_interface_provider.ts", "trusted/wallpaper/wallpaper_observer.ts", @@ -69,7 +67,6 @@ "trusted/wallpaper/wallpaper_state.ts", "trusted/wallpaper/index.ts", - "untrusted/iframe_api.ts", "untrusted/setup.ts", ]
diff --git a/ash/webui/personalization_app/resources/common/constants.ts b/ash/webui/personalization_app/resources/common/constants.ts index 783e204..49ab0f6 100644 --- a/ash/webui/personalization_app/resources/common/constants.ts +++ b/ash/webui/personalization_app/resources/common/constants.ts
@@ -5,7 +5,7 @@ import {FilePath} from 'chrome://resources/mojo/mojo/public/mojom/base/file_path.mojom-webui.js'; import {Url} from 'chrome://resources/mojo/url/mojom/url.mojom-webui.js'; -import {GooglePhotosEnablementState, GooglePhotosPhoto, WallpaperCollection, WallpaperImage} from '../trusted/personalization_app.mojom-webui.js'; +import {GooglePhotosPhoto, WallpaperImage} from '../trusted/personalization_app.mojom-webui.js'; // A special unique symbol that represents the device default image, normally // not accessible by the user. @@ -23,46 +23,6 @@ export const kMaximumLocalImagePreviews = 4; -export enum EventType { - SEND_COLLECTIONS = 'send_collections', - SEND_GOOGLE_PHOTOS_ENABLED = 'send_google_photos_enabled', - SELECT_COLLECTION = 'select_collection', - SELECT_GOOGLE_PHOTOS_COLLECTION = 'select_google_photos_collection', - SELECT_LOCAL_COLLECTION = 'select_local_collection', - SEND_IMAGE_COUNTS = 'send_image_counts', - SEND_LOCAL_IMAGE_DATA = 'send_local_image_data', - SEND_LOCAL_IMAGES = 'send_local_images', - SEND_VISIBLE = 'send_visible', -} - -export type SendCollectionsEvent = { - type: EventType.SEND_COLLECTIONS, - collections: WallpaperCollection[], -}; - -export type SendGooglePhotosEnabledEvent = { - type: EventType.SEND_GOOGLE_PHOTOS_ENABLED, - enabled: GooglePhotosEnablementState, -}; - -export type SelectCollectionEvent = { - type: EventType.SELECT_COLLECTION, - collectionId: string, -}; - -export type SelectGooglePhotosCollectionEvent = { - type: EventType.SELECT_GOOGLE_PHOTOS_COLLECTION, -}; - -export type SelectLocalCollectionEvent = { - type: EventType.SELECT_LOCAL_COLLECTION, -}; - -export type SendImageCountsEvent = { - type: EventType.SEND_IMAGE_COUNTS, - counts: {[key: string]: number|null}, -}; - /** * A displayable type constructed from WallpaperImages to display them as a * single unit. e.g. Dark/Light wallpaper images. @@ -72,29 +32,3 @@ attribution?: string[], unitId?: bigint, preview: Url[], }; - -export type SendLocalImagesEvent = { - type: EventType.SEND_LOCAL_IMAGES, - images: Array<FilePath|DefaultImageSymbol>, -}; - -/** - * Sends local image data keyed by stringified local image path. - */ -export type SendLocalImageDataEvent = { - type: EventType.SEND_LOCAL_IMAGE_DATA, - data: Record<string|DefaultImageSymbol, string>, -}; - -/** - * Notify an iframe if its visible state changes. - */ -export type SendVisibleEvent = { - type: EventType.SEND_VISIBLE, - visible: boolean, -}; - -export type Events = SendCollectionsEvent|SendGooglePhotosEnabledEvent| - SelectCollectionEvent|SelectGooglePhotosCollectionEvent| - SelectLocalCollectionEvent|SendImageCountsEvent|SendLocalImagesEvent| - SendLocalImageDataEvent|SendVisibleEvent;
diff --git a/ash/webui/personalization_app/resources/trusted/iframe_api.ts b/ash/webui/personalization_app/resources/trusted/iframe_api.ts deleted file mode 100644 index 08d0136..0000000 --- a/ash/webui/personalization_app/resources/trusted/iframe_api.ts +++ /dev/null
@@ -1,140 +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. - -/** - * @fileoverview Helper functions for communicating between trusted and - * untrusted. All trusted -> untrusted communication must happen through the - * functions in this file. - * @deprecated chrome-untrusted://personalization has been removed, but these - * functions still exist to keep the API temporarily the same. This file should - * be removed when possible. - */ - -import {assert, assertNotReached} from 'chrome://resources/js/assert.m.js'; -import {FilePath} from 'chrome://resources/mojo/mojo/public/mojom/base/file_path.mojom-webui.js'; - -import * as constants from '../common/constants.js'; -import {isNonEmptyArray} from '../common/utils.js'; -import {CollectionsGrid} from '../untrusted/collections_grid.js'; - -import {GooglePhotosEnablementState, WallpaperCollection, WallpaperImage} from './personalization_app.mojom-webui.js'; - -/** - * TODO(b:197023872) this class is deprecated and should be removed by more - * post-iframe cleanup. - * @deprecated - */ -export class IFrameApi { - /** - * Send an array of wallpaper collections collections grid.. - */ - sendCollections(target: CollectionsGrid, collections: WallpaperCollection[]) { - const event: constants.SendCollectionsEvent = { - type: constants.EventType.SEND_COLLECTIONS, - collections, - }; - target.onMessageReceived(event); - } - - /** - * Sends whether the user is allowed to access Google Photos to collections - * grid. - */ - sendGooglePhotosEnabled( - target: CollectionsGrid, enabled: GooglePhotosEnablementState) { - const event: constants.SendGooglePhotosEnabledEvent = { - type: constants.EventType.SEND_GOOGLE_PHOTOS_ENABLED, - enabled, - }; - target.onMessageReceived(event); - } - - /** - * Send a mapping of collectionId to the number of images in that collection. - * A value of null for a given collection id represents that the collection - * failed to load. - */ - sendImageCounts( - target: CollectionsGrid, counts: {[key: string]: number|null}) { - const event: constants.SendImageCountsEvent = { - type: constants.EventType.SEND_IMAGE_COUNTS, - counts, - }; - target.onMessageReceived(event); - } - - /** - * Send visibility status to a target iframe. Currently used to trigger a - * resize event on iron-list when an iframe becomes visible again so that - * iron-list will run layout with the current size. - */ - sendVisible(target: CollectionsGrid, visible: boolean) { - const event: constants.SendVisibleEvent = { - type: constants.EventType.SEND_VISIBLE, - visible, - }; - target.onMessageReceived(event); - } - - /** - * Send an array of local images to collections grid. - */ - sendLocalImages( - target: CollectionsGrid, - images: Array<FilePath|constants.DefaultImageSymbol>) { - const event: constants.SendLocalImagesEvent = { - type: constants.EventType.SEND_LOCAL_IMAGES, - images, - }; - target.onMessageReceived(event); - } - - /** - * Sends image data keyed by stringified image id (or default image symbol). - */ - sendLocalImageData( - target: CollectionsGrid, - data: Record<string|constants.DefaultImageSymbol, string>) { - const event: constants.SendLocalImageDataEvent = { - type: constants.EventType.SEND_LOCAL_IMAGE_DATA, - data, - }; - target.onMessageReceived(event); - } - - /** - * Called from trusted code to validate that a received event contains valid - * data. Ignores messages that are not of the expected type. - */ - validateReceivedSelection( - data: constants.Events, - choices: WallpaperCollection[]|null): WallpaperCollection { - assert(isNonEmptyArray(choices), 'choices must be a non-empty array'); - - let selected: WallpaperCollection|WallpaperImage|undefined = undefined; - switch (data.type) { - case constants.EventType.SELECT_COLLECTION: { - assert(!!data.collectionId, 'Expected a collection id parameter'); - selected = (choices as WallpaperCollection[]) - .find(choice => choice.id === data.collectionId); - break; - } - default: - assertNotReached('Unknown event type'); - } - - assert(!!selected, 'No valid selection found in choices'); - return selected!; - } - - static getInstance(): IFrameApi { - return instance || (instance = new IFrameApi()); - } - - static setInstance(obj: IFrameApi) { - instance = obj; - } -} - -let instance: IFrameApi|null = null;
diff --git a/ash/webui/personalization_app/resources/trusted/personalization_app.ts b/ash/webui/personalization_app/resources/trusted/personalization_app.ts index 169d290..31ecfee 100644 --- a/ash/webui/personalization_app/resources/trusted/personalization_app.ts +++ b/ash/webui/personalization_app/resources/trusted/personalization_app.ts
@@ -63,7 +63,6 @@ export {TopicSourceItem} from './ambient/topic_source_item_element.js'; export {TopicSourceList} from './ambient/topic_source_list_element.js'; export {AmbientZeroState} from './ambient/zero_state_element.js'; -export {IFrameApi} from './iframe_api.js'; export {KeyboardBacklightActionName, KeyboardBacklightActions, SetBacklightColorAction, setBacklightColorAction, SetShouldShowNudgeAction, setShouldShowNudgeAction, SetWallpaperColorAction, setWallpaperColorAction} from './keyboard_backlight/keyboard_backlight_actions.js'; export {KeyboardBacklight} from './keyboard_backlight/keyboard_backlight_element.js'; export {setKeyboardBacklightProviderForTesting} from './keyboard_backlight/keyboard_backlight_interface_provider.js';
diff --git a/ash/webui/personalization_app/resources/trusted/wallpaper/untrusted_message_handler.ts b/ash/webui/personalization_app/resources/trusted/wallpaper/untrusted_message_handler.ts deleted file mode 100644 index 92c8f51b..0000000 --- a/ash/webui/personalization_app/resources/trusted/wallpaper/untrusted_message_handler.ts +++ /dev/null
@@ -1,33 +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. - -import {Events, EventType} from '../../common/constants.js'; -import {IFrameApi} from '../iframe_api.js'; -import {Paths, PersonalizationRouter} from '../personalization_router_element.js'; -import {PersonalizationStore} from '../personalization_store.js'; - -/** - * @fileoverview message handler that receives data from untrusted. - */ - -export function onMessageReceived(data: Events) { - const store = PersonalizationStore.getInstance(); - - switch (data.type) { - case EventType.SELECT_COLLECTION: - const collections = store.data.wallpaper.backdrop.collections; - - const selectedCollection = - IFrameApi.getInstance().validateReceivedSelection(data, collections); - PersonalizationRouter.instance().selectCollection(selectedCollection); - break; - case EventType.SELECT_GOOGLE_PHOTOS_COLLECTION: - PersonalizationRouter.instance().goToRoute( - Paths.GOOGLE_PHOTOS_COLLECTION); - break; - case EventType.SELECT_LOCAL_COLLECTION: - PersonalizationRouter.instance().goToRoute(Paths.LOCAL_COLLECTION); - break; - } -}
diff --git a/ash/webui/personalization_app/resources/trusted/wallpaper/wallpaper_collections_element.ts b/ash/webui/personalization_app/resources/trusted/wallpaper/wallpaper_collections_element.ts index ac0c1d6..4710560 100644 --- a/ash/webui/personalization_app/resources/trusted/wallpaper/wallpaper_collections_element.ts +++ b/ash/webui/personalization_app/resources/trusted/wallpaper/wallpaper_collections_element.ts
@@ -11,19 +11,39 @@ import '../../css/wallpaper.css.js'; import {FilePath} from 'chrome://resources/mojo/mojo/public/mojom/base/file_path.mojom-webui.js'; +import {afterNextRender} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {DefaultImageSymbol, kDefaultImageSymbol, kMaximumLocalImagePreviews} from '../../common/constants.js'; +import {DefaultImageSymbol} from '../../common/constants.js'; import {isNonEmptyArray} from '../../common/utils.js'; import {CollectionsGrid} from '../../untrusted/collections_grid.js'; -import {IFrameApi} from '../iframe_api.js'; -import {GooglePhotosEnablementState, WallpaperCollection, WallpaperImage, WallpaperProviderInterface} from '../personalization_app.mojom-webui.js'; +import {WallpaperCollection} from '../personalization_app.mojom-webui.js'; import {WithPersonalizationStore} from '../personalization_store.js'; -import {getPathOrSymbol} from '../utils.js'; import {getTemplate} from './wallpaper_collections_element.html.js'; import {initializeBackdropData} from './wallpaper_controller.js'; import {getWallpaperProvider} from './wallpaper_interface_provider.js'; +function collectionsError( + collections: WallpaperCollection[]|null, + collectionsLoading: boolean): boolean { + return !collectionsLoading && !isNonEmptyArray(collections); +} + +function localImagesError( + localImages: Array<FilePath|DefaultImageSymbol>|null, + localImagesLoading: boolean): boolean { + return !localImagesLoading && !isNonEmptyArray(localImages); +} + +function hasError( + collections: WallpaperCollection[]|null, collectionsLoading: boolean, + localImages: Array<FilePath|DefaultImageSymbol>|null, + localImagesLoading: boolean): boolean { + return localImagesError(localImages, localImagesLoading) && + collectionsError(collections, collectionsLoading); +} + + export interface WallpaperCollections { $: {collectionsGrid: CollectionsGrid}; } @@ -46,106 +66,23 @@ observer: 'onHiddenChanged_', }, - collections_: Array, - - collectionsLoading_: Boolean, - - /** - * Whether the user is allowed to access Google Photos. - */ - googlePhotosEnabled_: { - type: Number, - observer: 'onGooglePhotosEnabledChanged_', - }, - - /** - * Contains a mapping of collection id to an array of images. - */ - images_: Object, - - /** - * Contains a mapping of collection id to loading boolean. - */ - imagesLoading_: Object, - - localImages_: Array, - - /** - * Whether the local image list is currently loading. - */ - localImagesLoading_: Boolean, - - /** - * Stores a mapping of local image id to loading status. - */ - localImageDataLoading_: Object, - - /** - * Stores a mapping of local image id to thumbnail data. - */ - localImageData_: Object, - - hasError_: { - type: Boolean, - // Call computed functions with their dependencies as arguments so that - // polymer knows when to re-run the computation. - computed: - 'computeHasError_(collections_, collectionsLoading_, localImages_, localImagesLoading_)', - }, + hasError_: Boolean, }; } override hidden: boolean; - private collections_: WallpaperCollection[]; - private collectionsLoading_: boolean; - private googlePhotosEnabled_: GooglePhotosEnablementState; - private images_: Record<string, WallpaperImage[]>; - private imagesLoading_: Record<string, boolean>; - private localImages_: Array<FilePath|DefaultImageSymbol>|null; - private localImagesLoading_: boolean; - private localImageData_: Record<FilePath['path']|DefaultImageSymbol, string>; - private localImageDataLoading_: - Record<FilePath['path']|DefaultImageSymbol, boolean>; private hasError_: boolean; - private wallpaperProvider_: WallpaperProviderInterface; - private didSendLocalImageData_: boolean; - - - static get observers() { - return [ - 'onCollectionsChanged_(collections_, collectionsLoading_)', - 'onCollectionImagesChanged_(images_, imagesLoading_)', - 'onLocalImagesChanged_(localImages_, localImagesLoading_)', - 'onLocalImageDataChanged_(localImages_, localImageData_, localImageDataLoading_)', - ]; - } - - constructor() { - super(); - this.wallpaperProvider_ = getWallpaperProvider(); - this.didSendLocalImageData_ = false; - } - override connectedCallback() { super.connectedCallback(); - this.watch('collections_', state => state.wallpaper.backdrop.collections); - this.watch( - 'collectionsLoading_', state => state.wallpaper.loading.collections); - this.watch( - 'googlePhotosEnabled_', state => state.wallpaper.googlePhotos.enabled); - this.watch('images_', state => state.wallpaper.backdrop.images); - this.watch('imagesLoading_', state => state.wallpaper.loading.images); - this.watch('localImages_', state => state.wallpaper.local.images); - this.watch( - 'localImagesLoading_', - state => state.wallpaper.loading.local.images || - state.wallpaper.loading.local.data[kDefaultImageSymbol]); - this.watch('localImageData_', state => state.wallpaper.local.data); - this.watch( - 'localImageDataLoading_', state => state.wallpaper.loading.local.data); + this.watch<boolean>( + 'hasError_', + state => hasError( + state.wallpaper.backdrop.collections, + state.wallpaper.loading.collections, state.wallpaper.local.images, + state.wallpaper.loading.local.images)); this.updateFromStore(); - initializeBackdropData(this.wallpaperProvider_, this.getStore()); + initializeBackdropData(getWallpaperProvider(), this.getStore()); } /** @@ -155,158 +92,7 @@ if (!hidden) { document.title = this.i18n('wallpaperLabel'); } - IFrameApi.getInstance().sendVisible(this.$.collectionsGrid, !hidden); - } - - private computeHasError_( - collections: WallpaperCollection[], collectionsLoading: boolean, - localImages: FilePath[], localImagesLoading: boolean): boolean { - return this.localImagesError_(localImages, localImagesLoading) && - this.collectionsError_(collections, collectionsLoading); - } - - private collectionsError_( - collections: WallpaperCollection[], - collectionsLoading: boolean): boolean { - return !collectionsLoading && !isNonEmptyArray(collections); - } - - private localImagesError_( - localImages: FilePath[], localImagesLoading: boolean): boolean { - return !localImagesLoading && !isNonEmptyArray(localImages); - } - - private onCollectionsChanged_( - collections: WallpaperCollection[], collectionsLoading: boolean) { - // Check whether collections are loaded before sending. Collections could be - // null/empty array. - if (!collectionsLoading) { - IFrameApi.getInstance().sendCollections( - this.$.collectionsGrid, collections); - } - } - - /** - * Send count of image units in each collection when a new collection is - * fetched. D/L variants of the same image represent a count of 1. - */ - private onCollectionImagesChanged_( - images: Record<string, WallpaperImage[]>, - imagesLoading: Record<string, boolean>) { - if (!images || !imagesLoading) { - return; - } - const counts = Object.entries(images) - .filter(([collectionId]) => { - return imagesLoading[collectionId] === false; - }) - .map(([key, value]) => { - // Collection has completed loading. If no images were - // retrieved, set count value to null to indicate - // failure. - if (Array.isArray(value)) { - const unitIds = new Set(); - value.forEach(image => { - unitIds.add(image.unitId); - }); - return [key, unitIds.size] as [string, number]; - } else { - return [key, null] as [string, null]; - } - }) - .reduce((result, [key, value]) => { - result[key!] = value; - return result; - }, {} as Record<string, number|null>); - IFrameApi.getInstance().sendImageCounts(this.$.collectionsGrid, counts); - } - - /** - * Invoked on changes to whether the user is allowed to access Google Photos. - */ - private onGooglePhotosEnabledChanged_( - googlePhotosEnabled: WallpaperCollections['googlePhotosEnabled_']) { - IFrameApi.getInstance().sendGooglePhotosEnabled( - this.$.collectionsGrid, googlePhotosEnabled); - } - - /** - * Send updated local images list. - */ - private onLocalImagesChanged_( - localImages: Array<FilePath|DefaultImageSymbol>|null, - localImagesLoading: boolean) { - this.didSendLocalImageData_ = false; - if (!localImagesLoading && Array.isArray(localImages)) { - IFrameApi.getInstance().sendLocalImages( - this.$.collectionsGrid, localImages); - } - } - - /** - * Send up to |maximumImageThumbnailsCount| image thumbnails. - */ - private onLocalImageDataChanged_( - images: Array<FilePath|DefaultImageSymbol>|null, - imageData: Record<string|DefaultImageSymbol, string>, - imageDataLoading: Record<string|DefaultImageSymbol, boolean>) { - if (!Array.isArray(images) || !imageData || !imageDataLoading || - this.didSendLocalImageData_) { - return; - } - - const successfullyLoaded: Array<string|DefaultImageSymbol> = - images.map(image => getPathOrSymbol(image)).filter(key => { - const doneLoading = imageDataLoading[key] === false; - const success = !!imageData[key]; - return success && doneLoading; - }); - - function shouldSendImageData() { - if (!Array.isArray(images)) { - return false; - } - - // All images (up to |kMaximumLocalImagePreviews|) have loaded. - const didLoadMaximum = successfullyLoaded.length >= - Math.min(kMaximumLocalImagePreviews, images.length); - - return didLoadMaximum || - // No more images to load so send now even if some failed. - images.every( - image => imageDataLoading[getPathOrSymbol(image)] === false); - } - - - if (shouldSendImageData()) { - // Also send information about which images failed to load. This is - // necessary to decide whether to show loading animation or failure svg - // while updating local images. - const failures = - images.map(image => getPathOrSymbol(image)) - .filter((key: string|DefaultImageSymbol) => { - const doneLoading = imageDataLoading[key] === false; - const failure = imageData[key] === ''; - return failure && doneLoading; - }) - .reduce((result, key) => { - // Empty string means that this image failed to - // load. - result[key] = ''; - return result; - }, {} as Record<FilePath['path']|DefaultImageSymbol, string>); - - const data = - successfullyLoaded.filter((_, i) => i < kMaximumLocalImagePreviews) - .reduce((result, key) => { - result[key] = imageData[key]; - return result; - }, failures); - - this.didSendLocalImageData_ = true; - - IFrameApi.getInstance().sendLocalImageData(this.$.collectionsGrid, data); - } + afterNextRender(this, () => this.notifyResize()); } }
diff --git a/ash/webui/personalization_app/resources/untrusted/collections_grid.html b/ash/webui/personalization_app/resources/untrusted/collections_grid.html index 74161c2b..29415d7f 100644 --- a/ash/webui/personalization_app/resources/untrusted/collections_grid.html +++ b/ash/webui/personalization_app/resources/untrusted/collections_grid.html
@@ -213,16 +213,20 @@ <div class="photo-images-border"></div> <template is="dom-repeat" items="[[item.preview]]" as="preview"> <img is="cr-auto-img" auto-src="[[preview.url]]" + data-collection-id$="[[item.id]]" class$="[[getClassForImg_(index, item)]]" aria-hidden="true" on-load="onImgLoad_" on-error="onImgLoad_" is-google-photos="[[isGooglePhotosTile_(item)]]" clear-src> </template> </div> - <div class="photo-text-container" hidden> + <div class="photo-text-container" + hidden$="[[isPhotoTextHidden_(item, loadedCollectionIdPhotos_)]]"> <p title$="[[item.name]]">[[item.name]]</p> <p title$="[[item.count]]">[[item.count]]</p> </div> - <div class="photo-gradient-mask" hidden></div> + <div class="photo-gradient-mask" + hidden$="[[isPhotoTextHidden_(item, loadedCollectionIdPhotos_)]]"> + </div> </div> </template> </div>
diff --git a/ash/webui/personalization_app/resources/untrusted/collections_grid.ts b/ash/webui/personalization_app/resources/untrusted/collections_grid.ts index 362295cc..bfce18d 100644 --- a/ash/webui/personalization_app/resources/untrusted/collections_grid.ts +++ b/ash/webui/personalization_app/resources/untrusted/collections_grid.ts
@@ -7,17 +7,18 @@ import '../css/wallpaper.css.js'; import {loadTimeData} from '//resources/js/load_time_data.m.js'; -import {afterNextRender, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {assert} from 'chrome://resources/js/assert_ts.js'; import {FilePath} from 'chrome://resources/mojo/mojo/public/mojom/base/file_path.mojom-webui.js'; import {Url} from 'chrome://resources/mojo/url/mojom/url.mojom-webui.js'; -import {DefaultImageSymbol, Events, EventType, kMaximumLocalImagePreviews} from '../common/constants.js'; +import {DefaultImageSymbol, kDefaultImageSymbol, kMaximumLocalImagePreviews} from '../common/constants.js'; import {getCountText, getLoadingPlaceholderAnimationDelay, getLoadingPlaceholders, isNonEmptyArray, isSelectionEvent} from '../common/utils.js'; -import {GooglePhotosEnablementState, WallpaperCollection} from '../trusted/personalization_app.mojom-webui.js'; +import {GooglePhotosEnablementState, WallpaperCollection, WallpaperImage} from '../trusted/personalization_app.mojom-webui.js'; +import {Paths, PersonalizationRouter} from '../trusted/personalization_router_element.js'; +import {WithPersonalizationStore} from '../trusted/personalization_store.js'; import {getPathOrSymbol} from '../trusted/utils.js'; import {getTemplate} from './collections_grid.html.js'; -import {selectCollection, selectGooglePhotosCollection, selectLocalCollection, validateReceivedData} from './iframe_api.js'; /** * @fileoverview Responds to |SendCollectionsEvent| from trusted. Handles user @@ -106,8 +107,13 @@ */ function getLocalTile( localImages: Array<FilePath|DefaultImageSymbol>, + localImagesLoading: boolean, localImageData: Record<FilePath['path']|DefaultImageSymbol, string>): ImageTile|LoadingTile { + if (localImagesLoading) { + return {type: TileType.LOADING}; + } + const isMoreToLoad = localImages.some( image => !localImageData.hasOwnProperty(getPathOrSymbol(image))); @@ -135,7 +141,7 @@ }; } -export class CollectionsGrid extends PolymerElement { +export class CollectionsGrid extends WithPersonalizationStore { static get is() { return 'collections-grid'; } @@ -148,6 +154,10 @@ return { collections_: Array, + images_: Object, + + imagesLoading_: Object, + /** * Whether the user is allowed to access Google Photos. */ @@ -160,10 +170,15 @@ * Mapping of collection id to number of images. Loads in progressively * after collections_. */ - imageCounts_: Object, + imageCounts_: { + type: Object, + computed: 'computeImageCounts_(images_, imagesLoading_)', + }, localImages_: Array, + localImagesLoading_: Boolean, + /** * Stores a mapping of local image id to thumbnail data. */ @@ -180,23 +195,92 @@ return getLoadingPlaceholders(() => ({type: TileType.LOADING})); }, }, + + loadedCollectionIdPhotos_: { + type: Set, + value() { + return new Set<string>(); + }, + }, }; } - private collections_: WallpaperCollection[]; + private collections_: WallpaperCollection[]|null; + private images_: Record<string, WallpaperImage[]|null>; + private imagesLoading_: Record<string, boolean>; + private imageCounts_: Record<string, number|null>; private googlePhotosEnabled_: GooglePhotosEnablementState|undefined; - private imageCounts_: {[key: string]: number|null}; - private localImages_: Array<FilePath|DefaultImageSymbol>; - private localImageData_: {[key: string]: string}; + private localImages_: Array<FilePath|DefaultImageSymbol>|null; + private localImagesLoading_: boolean; + private localImageData_: Record<string|DefaultImageSymbol, string>; private tiles_: Tile[]; + private loadedCollectionIdPhotos_: Set<string>; static get observers() { return [ - 'onLocalImagesLoaded_(localImages_, localImageData_)', + 'onLocalImagesChanged_(localImages_, localImagesLoading_, localImageData_)', 'onCollectionLoaded_(collections_, imageCounts_)', ]; } + override connectedCallback() { + super.connectedCallback(); + this.watch<CollectionsGrid['collections_']>( + 'collections_', state => state.wallpaper.backdrop.collections); + this.watch<CollectionsGrid['images_']>( + 'images_', state => state.wallpaper.backdrop.images); + this.watch<CollectionsGrid['imagesLoading_']>( + 'imagesLoading_', state => state.wallpaper.loading.images); + this.watch<CollectionsGrid['googlePhotosEnabled_']>( + 'googlePhotosEnabled_', state => state.wallpaper.googlePhotos.enabled); + this.watch<CollectionsGrid['localImages_']>( + 'localImages_', state => state.wallpaper.local.images); + // Treat as loading if either loading local images list or loading the + // default image thumbnail. This prevents rapid churning of the UI on first + // load. + this.watch<CollectionsGrid['localImagesLoading_']>( + 'localImagesLoading_', + state => state.wallpaper.loading.local.images || + state.wallpaper.loading.local.data[kDefaultImageSymbol]); + this.watch<CollectionsGrid['localImageData_']>( + 'localImageData_', state => state.wallpaper.local.data); + this.updateFromStore(); + } + + + /** + * Calculate count of image units in each collection when a new collection is + * fetched. D/L variants of the same image represent a count of 1. + */ + private computeImageCounts_( + images: Record<string, WallpaperImage[]|null>, + imagesLoading: Record<string, boolean>): Record<string, number|null> { + if (!images || !imagesLoading) { + return {}; + } + return Object.entries(images) + .filter(([collectionId]) => { + return imagesLoading[collectionId] === false; + }) + .map(([key, value]) => { + // Collection has completed loading. If no images were + // retrieved, set count value to null to indicate + // failure. + if (Array.isArray(value)) { + const unitIds = new Set(); + value.forEach(image => { + unitIds.add(image.unitId); + }); + return [key, unitIds.size] as [string, number]; + } else { + return [key, null] as [string, null]; + } + }) + .reduce((result, [key, value]) => { + result[key] = value; + return result; + }, {} as Record<string, number|null>); + } getLoadingPlaceholderAnimationDelay(index: number): string { return getLoadingPlaceholderAnimationDelay(index); @@ -209,8 +293,8 @@ */ private onCollectionLoaded_( collections: WallpaperCollection[]|null, - imageCounts: {[key: string]: number|null}) { - if (!Array.isArray(collections) || !imageCounts) { + imageCounts: Record<string, number|null>) { + if (!isNonEmptyArray(collections) || !imageCounts) { return; } @@ -221,11 +305,15 @@ const offset = loadTimeData.getBoolean('isGooglePhotosIntegrationEnabled') ? 2 : 1; - while (this.tiles_.length < collections.length + offset) { - this.push('tiles_', {type: TileType.LOADING}); + if (this.tiles_.length < collections.length + offset) { + this.push( + 'tiles_', + ...Array.from( + {length: collections.length + offset - this.tiles_.length}, + (): LoadingTile => ({type: TileType.LOADING}))); } - while (this.tiles_.length > collections.length + offset) { - this.pop('tiles_'); + if (this.tiles_.length > collections.length + offset) { + this.splice('tiles_', collections.length + offset); } const isDarkLightModeEnabled = @@ -277,77 +365,17 @@ * Called with updated local image list or local image thumbnail data when * either of those properties changes. */ - private onLocalImagesLoaded_( - localImages: Array<FilePath|DefaultImageSymbol>|undefined, + private onLocalImagesChanged_( + localImages: Array<FilePath|DefaultImageSymbol>|null, + localImagesLoading: boolean, localImageData: Record<FilePath['path']|DefaultImageSymbol, string>) { if (!Array.isArray(localImages) || !localImageData) { return; } - const tile = getLocalTile(localImages, localImageData); + const tile = getLocalTile(localImages, localImagesLoading, localImageData); this.set('tiles_.0', tile); } - /** - * Handler for messages from trusted code. - * TODO(cowmoo) move this up beneath static properties because it is public. - */ - onMessageReceived(event: Events) { - const isValid = validateReceivedData(event); - if (!isValid) { - console.warn('Invalid event message received, event type: ' + event.type); - } - - switch (event.type) { - case EventType.SEND_COLLECTIONS: - this.collections_ = isValid ? event.collections : []; - break; - case EventType.SEND_GOOGLE_PHOTOS_ENABLED: - if (isValid) { - this.googlePhotosEnabled_ = event.enabled; - } - break; - case EventType.SEND_IMAGE_COUNTS: - this.imageCounts_ = event.counts; - break; - case EventType.SEND_LOCAL_IMAGES: - if (isValid) { - this.localImages_ = event.images; - } else { - this.localImages_ = []; - this.localImageData_ = {}; - } - break; - case EventType.SEND_LOCAL_IMAGE_DATA: - if (isValid) { - this.localImageData_ = event.data; - } else { - this.localImages_ = []; - this.localImageData_ = {}; - } - break; - case EventType.SEND_VISIBLE: - if (!isValid) { - return; - } - - const visible = event.visible; - if (visible) { - // If iron-list items were updated while this iron-list was hidden, - // the layout will be incorrect. Trigger another layout when iron-list - // becomes visible again. Wait until |afterNextRender| completes - // otherwise iron-list width may still be 0. - afterNextRender(this, () => { - // Trigger a layout now that iron-list has the correct width. - this.shadowRoot!.querySelector('iron-list')!.fire('iron-resize'); - }); - } - return; - default: - console.error(`Unexpected event type ${event.type}`); - break; - } - } - private getClassForImagesContainer_(tile: ImageTile): string { if (tile.type === TileType.IMAGE_ONLINE) { // Only apply base class for online collections. @@ -386,9 +414,7 @@ 'no_images.svg')}`; } - /** - * Notify trusted code that a user selected a collection. - */ + /** Navigate to the correct route based on user selection. */ private onCollectionSelected_(e: RepeaterEvent) { const tile = e.model.item; if (!isSelectionEvent(e) || !this.isSelectableTile_(tile)) { @@ -396,13 +422,19 @@ } switch (tile.id) { case kGooglePhotosCollectionId: - selectGooglePhotosCollection(); + PersonalizationRouter.instance().goToRoute( + Paths.GOOGLE_PHOTOS_COLLECTION); return; case kLocalCollectionId: - selectLocalCollection(); + PersonalizationRouter.instance().goToRoute(Paths.LOCAL_COLLECTION); return; default: - selectCollection(tile.id); + assert( + isNonEmptyArray(this.collections_), 'collections array required'); + const collection = + this.collections_.find(collection => collection.id === tile.id); + assert(collection, 'collection with matching id required'); + PersonalizationRouter.instance().selectCollection(collection); return; } } @@ -456,6 +488,13 @@ return (!this.isSelectableTile_(item)).toString(); } + private isPhotoTextHidden_( + item: ImageTile, loadedCollectionIdPhotos: Set<string>): boolean { + // Hide text until the first preview image for this collection has notified + // that it finished loading. + return !loadedCollectionIdPhotos.has(item.id); + } + /** * Make the text and background gradient visible again after the image has * finished loading. This is called for both on-load and on-error, as either @@ -463,9 +502,17 @@ */ private onImgLoad_(event: Event) { const self = event.currentTarget! as HTMLElement; - const parent = self.closest('.photo-inner-container'); - for (const elem of parent!.querySelectorAll('[hidden]')) { - elem.removeAttribute('hidden'); + const collectionId = self.dataset['collectionId']; + assert( + collectionId && + ((this.collections_ || + []).some(collection => collection.id === collectionId) || + collectionId === kLocalCollectionId || + collectionId === kGooglePhotosCollectionId), + 'valid collection id required'); + if (!this.loadedCollectionIdPhotos_.has(collectionId)) { + this.loadedCollectionIdPhotos_ = + new Set([...this.loadedCollectionIdPhotos_, collectionId]); } }
diff --git a/ash/webui/personalization_app/resources/untrusted/iframe_api.ts b/ash/webui/personalization_app/resources/untrusted/iframe_api.ts deleted file mode 100644 index a415abc..0000000 --- a/ash/webui/personalization_app/resources/untrusted/iframe_api.ts +++ /dev/null
@@ -1,77 +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. - -import * as constants from '../common/constants.js'; -import {isNullOrArray} from '../common/utils.js'; -import {GooglePhotosEnablementState} from '../trusted/personalization_app.mojom-webui.js'; -import {isDefaultImage, isFilePath} from '../trusted/utils.js'; -import {onMessageReceived} from '../trusted/wallpaper/untrusted_message_handler.js'; - -/** - * @fileoverview Helper functions for communicating between trusted and - * untrusted. All untrusted -> trusted communication must happen through the - * functions in this file. - */ - -/** - * Select a collection. Sent from untrusted to trusted. - */ -export function selectCollection(collectionId: string) { - const event: constants.SelectCollectionEvent = { - type: constants.EventType.SELECT_COLLECTION, - collectionId, - }; - onMessageReceived(event); -} - -/** - * Select the Google Photos collection. Sent from untrusted to trusted. - */ -export function selectGooglePhotosCollection() { - const event: constants.SelectGooglePhotosCollectionEvent = { - type: constants.EventType.SELECT_GOOGLE_PHOTOS_COLLECTION, - }; - onMessageReceived(event); -} - -/** - * Select the local collection. Sent from untrusted to trusted. - */ -export function selectLocalCollection() { - const event: constants.SelectLocalCollectionEvent = { - type: constants.EventType.SELECT_LOCAL_COLLECTION, - }; - onMessageReceived(event); -} - -/** - * Called from untrusted code to validate that a received event is of an - * expected type and contains the expected data. - */ -export function validateReceivedData(event: constants.Events): boolean { - switch (event.type) { - case constants.EventType.SEND_COLLECTIONS: { - return isNullOrArray(event.collections); - } - case constants.EventType.SEND_GOOGLE_PHOTOS_ENABLED: - return typeof event.enabled === 'number' && - event.enabled >= GooglePhotosEnablementState.MIN_VALUE && - event.enabled <= GooglePhotosEnablementState.MAX_VALUE; - case constants.EventType.SEND_IMAGE_COUNTS: - return typeof event.counts === 'object'; - case constants.EventType.SEND_LOCAL_IMAGE_DATA: { - return typeof event.data === 'object'; - } - case constants.EventType.SEND_LOCAL_IMAGES: - // Images array may be empty. - return Array.isArray(event.images) && - event.images.every( - image => isDefaultImage(image) || isFilePath(image)); - case constants.EventType.SEND_VISIBLE: { - return typeof event.visible === 'boolean'; - } - default: - return false; - } -}
diff --git a/base/BUILD.gn b/base/BUILD.gn index 9fc667ea..b981f337 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -4040,6 +4040,7 @@ "android/java/src/org/chromium/base/NativeLibraryLoadedStatus.java", "android/java/src/org/chromium/base/annotations/AccessedByNative.java", "android/java/src/org/chromium/base/annotations/CalledByNative.java", + "android/java/src/org/chromium/base/annotations/CalledByNativeForTesting.java", "android/java/src/org/chromium/base/annotations/CalledByNativeUnchecked.java", "android/java/src/org/chromium/base/annotations/JNIAdditionalImport.java", "android/java/src/org/chromium/base/annotations/JNINamespace.java",
diff --git a/base/android/java/src/org/chromium/base/BuildInfo.java b/base/android/java/src/org/chromium/base/BuildInfo.java index 24d9d98..b1e5c41 100644 --- a/base/android/java/src/org/chromium/base/BuildInfo.java +++ b/base/android/java/src/org/chromium/base/BuildInfo.java
@@ -248,13 +248,15 @@ // Logic for pre-API-finalization: // return BuildCompat.isAtLeastT() && target == Build.VERSION_CODES.CUR_DEVELOPMENT; - // Logic for smooth transition period so that both pre-finalization and final SDKs - // will return true, assuming T will be API 33. - // Keeping this until we upstream the public SDK is a reasonable transition period. - return target >= 33 || - (BuildCompat.isAtLeastT() && target == Build.VERSION_CODES.CUR_DEVELOPMENT); + // Logic for after API finalization but before public SDK release has to + // just hardcode the appropriate SDK integer. This will include Android + // builds with the finalized SDK, and also pre-API-finalization builds + // (because CUR_DEVELOPMENT == 10000). + return target >= 33; - // Logic for public SDK release: + // Once the public SDK is upstreamed we can use the defined constant, + // deprecate this, then eventually inline this at all callsites and + // remove it. // return target >= Build.VERSION_CODES.TIRAMISU; }
diff --git a/base/android/java/src/org/chromium/base/annotations/CalledByNativeForTesting.java b/base/android/java/src/org/chromium/base/annotations/CalledByNativeForTesting.java new file mode 100644 index 0000000..512f3ad --- /dev/null +++ b/base/android/java/src/org/chromium/base/annotations/CalledByNativeForTesting.java
@@ -0,0 +1,26 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.base.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Used by the JNI generator to create the necessary JNI bindings and expose this method to native + * test-only code. + * + * Any method annotated by this will be kept around for tests only. If you wish to call your method + * from non-test code, see {@link CalledByNative} instead. + */ +@Target({ElementType.CONSTRUCTOR, ElementType.METHOD}) +@Retention(RetentionPolicy.CLASS) +public @interface CalledByNativeForTesting { + /* + * If present, tells which inner class the method belongs to. + */ + public String value() default ""; +}
diff --git a/base/android/jni_generator/golden/testCalledByNatives.golden b/base/android/jni_generator/golden/testCalledByNatives.golden index 6249bd6..f647cc14 100644 --- a/base/android/jni_generator/golden/testCalledByNatives.golden +++ b/base/android/jni_generator/golden/testCalledByNatives.golden
@@ -475,4 +475,26 @@ return base::android::ScopedJavaLocalRef<jobject>(env, ret); } +static std::atomic<jmethodID> g_org_chromium_TestJni_returnIntArrayForTesting(nullptr); +static base::android::ScopedJavaLocalRef<jintArray> Java_TestJni_returnIntArrayForTesting(JNIEnv* + env, const base::android::JavaRef<jobject>& obj) { + jclass clazz = org_chromium_TestJni_clazz(env); + CHECK_CLAZZ(env, obj.obj(), + org_chromium_TestJni_clazz(env), NULL); + + jni_generator::JniJavaCallContextChecked call_context; + call_context.Init< + base::android::MethodID::TYPE_INSTANCE>( + env, + clazz, + "returnIntArrayForTesting", + "()[I", + &g_org_chromium_TestJni_returnIntArrayForTesting); + + jintArray ret = + static_cast<jintArray>(env->CallObjectMethod(obj.obj(), + call_context.base.method_id)); + return base::android::ScopedJavaLocalRef<jintArray>(env, ret); +} + #endif // org_chromium_TestJni_JNI
diff --git a/base/android/jni_generator/jni_generator.py b/base/android/jni_generator/jni_generator.py index 9032036..10b6434 100755 --- a/base/android/jni_generator/jni_generator.py +++ b/base/android/jni_generator/jni_generator.py
@@ -319,6 +319,10 @@ return ''.join(out) +def _NameIsTestOnly(name): + return name.endswith('ForTest') or name.endswith('ForTesting') + + class JniParams(object): """Get JNI related parameters.""" @@ -681,7 +685,8 @@ # Regex to match a string like "@CalledByNative public void foo(int bar)". RE_CALLED_BY_NATIVE = re.compile( - r'@CalledByNative(?P<Unchecked>(?:Unchecked)?)(?:\("(?P<annotation>.*)"\))?' + r'@CalledByNative((?P<Unchecked>(?:Unchecked)?|ForTesting))' + r'(?:\("(?P<annotation>.*)"\))?' r'(?:\s+@\w+(?:\(.*\))?)*' # Ignore any other annotations. r'\s+(?P<prefix>(' r'(private|protected|public|static|abstract|final|default|synchronized)' @@ -892,8 +897,20 @@ if not isinstance(hash_b64, str): hash_b64 = hash_b64.decode() - hashed_name = ('M' + hash_b64).rstrip('=') - return hashed_name[0:ProxyHelpers.MAX_CHARS_FOR_HASHED_NATIVE_METHODS] + long_hash = ('M' + hash_b64).rstrip('=') + hashed_name = long_hash[:ProxyHelpers.MAX_CHARS_FOR_HASHED_NATIVE_METHODS] + + # If the method is a test-only method, we don't care about saving size on + # the method name, since it shouldn't show up in the binary. Additionally, + # if we just hash the name, our checkers which enforce that we have no + # "ForTesting" methods by checking for the suffix "ForTesting" will miss + # these. We could preserve the name entirely and not hash anything, but + # that risks collisions. So, instead, we just append "ForTesting" to any + # test-only hashes, to ensure we catch any test-only methods that + # shouldn't be in our final binary. + if _NameIsTestOnly(method_name): + return hashed_name + '_ForTesting' + return hashed_name @staticmethod def CreateProxyMethodName(fully_qualified_class, old_name, use_hash=False): @@ -911,12 +928,18 @@ return EscapeClassName(fully_qualified_class + '/' + old_name) @staticmethod - def ExtractStaticProxyNatives(fully_qualified_class, contents, ptr_type): + def ExtractStaticProxyNatives(fully_qualified_class, + contents, + ptr_type, + include_test_only=True): methods = [] for match in _NATIVE_PROXY_EXTRACTION_REGEX.finditer(contents): interface_body = match.group('interface_body') for method in _EXTRACT_METHODS_REGEX.finditer(interface_body): name = method.group('name') + if not include_test_only and _NameIsTestOnly(name): + continue + params = JniParams.Parse(method.group('params'), use_proxy_types=True) return_type = JavaTypeToProxyCast(method.group('return_type')) proxy_name = ProxyHelpers.CreateProxyMethodName(fully_qualified_class, @@ -1614,6 +1637,9 @@ parser.add_argument('--unchecked_exceptions', action='store_true', help='Do not check that no exceptions were thrown.') + parser.add_argument('--include_test_only', + action='store_true', + help='Whether to maintain ForTesting JNI methods.') parser.add_argument( '--use_proxy_hash', action='store_true',
diff --git a/base/android/jni_generator/jni_generator_tests.py b/base/android/jni_generator/jni_generator_tests.py index fa9b8d1b..a32cdd0 100755 --- a/base/android/jni_generator/jni_generator_tests.py +++ b/base/android/jni_generator/jni_generator_tests.py
@@ -62,6 +62,7 @@ self.always_mangle = False self.unchecked_exceptions = False self.split_name = None + self.include_test_only = True class BaseTest(unittest.TestCase): @@ -583,6 +584,9 @@ @CalledByNative public List<Bitmap.CompressFormat> getCompressFormatList(); + + @CalledByNativeForTesting + public int[] returnIntArrayForTesting(); """ jni_params = jni_generator.JniParams('org/chromium/Foo') jni_params.ExtractImportsAndInnerClasses(test_data) @@ -822,6 +826,17 @@ env_call=('Void', ''), unchecked=False, ), + CalledByNative( + return_type='int[]', + system_class=False, + static=False, + name='returnIntArrayForTesting', + method_id_var_name='returnIntArrayForTesting', + java_class_name='', + params=[], + env_call=('Void', ''), + unchecked=False, + ), ] self.AssertListEquals(golden_called_by_natives, called_by_natives) h = jni_generator.InlHeaderFileGenerator('', 'org/chromium/TestJni', [], @@ -1386,6 +1401,59 @@ self.AssertListEquals(_RemoveHashedNames(natives), golden_natives) + def testForTestingKept(self): + test_data = """ + class SampleProxyJni { + @NativeMethods + interface Natives { + void fooForTesting(); + void fooForTest(); + } + } + """ + qualified_clazz = 'org/chromium/example/SampleProxyJni' + + natives = jni_generator.ProxyHelpers.ExtractStaticProxyNatives( + qualified_clazz, test_data, 'long', True) + + golden_natives = [ + NativeMethod( + return_type='void', + static=True, + name='fooForTesting', + params=[], + java_class_name=None, + is_proxy=True, + proxy_name='org_chromium_example_SampleProxyJni_fooForTesting'), + NativeMethod( + return_type='void', + static=True, + name='fooForTest', + params=[], + java_class_name=None, + is_proxy=True, + proxy_name='org_chromium_example_SampleProxyJni_fooForTest'), + ] + + self.AssertListEquals(_RemoveHashedNames(natives), golden_natives) + + def testForTestingRemoved(self): + test_data = """ + class SampleProxyJni { + @NativeMethods + interface Natives { + void fooForTesting(); + void fooForTest(); + } + } + """ + qualified_clazz = 'org/chromium/example/SampleProxyJni' + + natives = jni_generator.ProxyHelpers.ExtractStaticProxyNatives( + qualified_clazz, test_data, 'long', False) + + self.AssertListEquals(_RemoveHashedNames(natives), []) + def testProxyNativesMainDex(self): test_data = """ @MainDex
diff --git a/base/android/jni_generator/jni_registration_generator.py b/base/android/jni_generator/jni_registration_generator.py index 3226da2..eeaf58e 100755 --- a/base/android/jni_generator/jni_registration_generator.py +++ b/base/android/jni_generator/jni_registration_generator.py
@@ -41,7 +41,8 @@ srcjar_path, proxy_opts, header_path=None, - namespace=''): + namespace='', + include_test_only=True): """Generates files required to perform JNI registration. Generates a srcjar containing a single class, GEN_JNI, that contains all @@ -66,7 +67,8 @@ _DictForPath, use_proxy_hash=proxy_opts.use_hash, enable_jni_multiplexing=proxy_opts.enable_jni_multiplexing, - namespace=namespace), java_file_paths): + namespace=namespace, + include_test_only=include_test_only), java_file_paths): if d: results.append(d) @@ -135,7 +137,8 @@ def _DictForPath(path, use_proxy_hash=False, enable_jni_multiplexing=False, - namespace=''): + namespace='', + include_test_only=True): with open(path) as f: contents = jni_generator.RemoveComments(f.read()) if '@JniIgnoreNatives' in contents: @@ -148,7 +151,8 @@ natives += jni_generator.ProxyHelpers.ExtractStaticProxyNatives( fully_qualified_class=fully_qualified_class, contents=contents, - ptr_type='long') + ptr_type='long', + include_test_only=include_test_only) if len(natives) == 0: return None # The namespace for the content is separate from the namespace for the @@ -918,6 +922,9 @@ '--manual_jni_registration', action='store_true', help='Manually do JNI registration - required for crazy linker') + arg_parser.add_argument('--include_test_only', + action='store_true', + help='Whether to maintain ForTesting JNI methods.') args = arg_parser.parse_args(build_utils.ExpandFileArgs(argv[1:])) if not args.enable_proxy_mocks and args.require_mocks: @@ -948,7 +955,8 @@ args.srcjar_path, proxy_opts=proxy_opts, header_path=args.header_path, - namespace=args.namespace) + namespace=args.namespace, + include_test_only=args.include_test_only) if args.depfile: build_utils.WriteDepfile(args.depfile, args.srcjar_path,
diff --git a/base/location.cc b/base/location.cc index 2be6932..2f00e549 100644 --- a/base/location.cc +++ b/base/location.cc
@@ -10,7 +10,7 @@ // build time. Try not to raise this limit unless absolutely necessary. See // https://chromium.googlesource.com/chromium/src/+/HEAD/docs/wmax_tokens.md #ifndef NACL_TC_REV -#pragma clang max_tokens_here 390100 +#pragma clang max_tokens_here 391000 #endif #if defined(COMPILER_MSVC)
diff --git a/base/values.cc b/base/values.cc index bf81e99..642373c 100644 --- a/base/values.cc +++ b/base/values.cc
@@ -138,6 +138,19 @@ return json; } +// This set of overloads are used to unwrap arguments from the reference +// wrapper, and are used by ValueView when visiting its members and cloning +// them. +template <typename T> +const T& UnwrapReference(std::reference_wrapper<const T> value) { + return value.get(); +} + +template <typename T> +const T& UnwrapReference(const T& value) { + return value; +} + } // namespace // static @@ -262,16 +275,7 @@ } Value Value::Clone() const { - return absl::visit( - [](const auto& member) { - using T = std::decay_t<decltype(member)>; - if constexpr (std::is_same_v<T, Dict> || std::is_same_v<T, List>) { - return Value(member.Clone()); - } else { - return Value(member); - } - }, - data_); + return ValueView(*this).ToValue(); } Value::~Value() = default; @@ -1782,6 +1786,21 @@ : data_view_( value.Visit([](const auto& member) { return ViewType(member); })) {} +base::Value ValueView::ToValue() const { + return absl::visit( + [](const auto& member) { + const auto& value = UnwrapReference(member); + using T = std::decay_t<decltype(value)>; + if constexpr (std::is_same_v<T, Value::Dict> || + std::is_same_v<T, Value::List>) { + return Value(value.Clone()); + } else { + return Value(value); + } + }, + data_view_); +} + ValueSerializer::~ValueSerializer() = default; ValueDeserializer::~ValueDeserializer() = default;
diff --git a/base/values.h b/base/values.h index 59d3ccfc..04ca224 100644 --- a/base/values.h +++ b/base/values.h
@@ -1477,6 +1477,9 @@ return absl::visit(std::forward<Visitor>(visitor), data_view_); } + // Returns a clone of the underlying Value. + Value ToValue() const; + private: using ViewType = absl::variant<absl::monostate,
diff --git a/base/values_unittest.cc b/base/values_unittest.cc index e8ec2d7..2835533 100644 --- a/base/values_unittest.cc +++ b/base/values_unittest.cc
@@ -2542,4 +2542,42 @@ } } +TEST(ValueViewTest, ToValue) { + { + Value val(true); + Value to_val = ValueView(val).ToValue(); + EXPECT_EQ(val, to_val); + } + { + Value val(25); + Value to_val = ValueView(val).ToValue(); + EXPECT_EQ(val, to_val); + } + { + Value val(3.14); + Value to_val = ValueView(val).ToValue(); + EXPECT_EQ(val, to_val); + } + { + Value val("hello world"); + Value to_val = ValueView(val).ToValue(); + EXPECT_EQ(val, to_val); + } + { + Value::Dict dict; + dict.Set("hello", "world"); + Value val(dict.Clone()); + Value to_val = ValueView(val).ToValue(); + EXPECT_EQ(val, to_val); + } + { + Value::List list; + list.Append("hello"); + list.Append("world"); + Value val(list.Clone()); + Value to_val = ValueView(val).ToValue(); + EXPECT_EQ(val, to_val); + } +} + } // namespace base
diff --git a/build/android/docs/java_asserts.md b/build/android/docs/java_asserts.md new file mode 100644 index 0000000..37d94c1e --- /dev/null +++ b/build/android/docs/java_asserts.md
@@ -0,0 +1,80 @@ +# Java Asserts in Chromium +This doc exists to explain how asserts in Java are enabled and disabled by +Chromium's build system. + +## javac Assertion Bytecode +Whenever javac compiles a Java class, assertions are transformed into the +following bytecode: + +``` + Code: + 0: getstatic #2 // Static field $assertionsDisabled + 3: ifne 20 // Conditional jump past assertion throw + 12: new #3 // Class java/lang/AssertionError + 19: athrow // Throwing AssertionError + 20: return + +// NOTE: this static block was made just to check the desiredAssertionStatus. +// There was no static block on the class before javac created one. + static {}; + Code: + 2: invokevirtual #6 // Method java/lang/Class.desiredAssertionStatus() + 5: ifne 12 + 8: iconst_1 + 9: goto 13 + 12: iconst_0 + 13: putstatic #2 // Static field $assertionsDisabled + 16: return +``` + +TL;DR - every single assertion is gated behind a `assertionDisabled` flag check, +which is a static field that can be set by the JRE's +`setDefaultAssertionStatus`, `setPackageAssertionStatus`, and +`setClassAssertionStatus` methods. + +## Assertion Enabling/Disabling +Our tools which consume javac output, namely R8 and D8, each have flags which +the build system uses to enable or disable asserts. We control this with the +`enable_java_asserts` gn arg. It does this by deleting the gating check on +`assertionsDisabled` when enabling, and by eliminating any reference to the +assert when disabling. + +```java +// Example equivalents of: +a = foo(); +assert a != 0; +return a; + +// Traditional, unoptimized javac output. +a = foo(); +if (!assertionsDisabled && a == 0) { + throw new AssertionError(); +} +return a; + +// Optimized with assertions enabled. +a = foo(); +if (a == 0) { + throw new AssertionError(); +} +return a; + +// Optimized with assertions disabled. +a = foo(); +return a; +``` + +## Assertion Enabling on Canary +Recently we [enabled +asserts](https://chromium-review.googlesource.com/c/chromium/src/+/3307087) on +Canary. It spiked our crash rate, and it was decided to not do this again, as +it's bad user experience to crash the app incessantly for non-fatal issues. + +So, we asked the R8 team for a feature which would rewrite the bytecode of these +assertions, which they implemented for us. Now, instead of just turning it on +and throwing an `AssertionError`, [R8 would call a provided assertion +handler](https://r8.googlesource.com/r8/+/aefe7bc18a7ce19f3e9c6dac0bedf6d182bbe142/src/main/java/com/android/tools/r8/ParseFlagInfoImpl.java#124) +with the `AssertionError`. We then wrote a [silent assertion +reporter](https://chromium-review.googlesource.com/c/chromium/src/+/3746261) +and this reports Java `AssertionErrors` to our crash server without crashing +the browser.
diff --git a/build/android/gyp/generate_linker_version_script.py b/build/android/gyp/generate_linker_version_script.py index 995fcd7..3b963a5 100755 --- a/build/android/gyp/generate_linker_version_script.py +++ b/build/android/gyp/generate_linker_version_script.py
@@ -35,6 +35,9 @@ '--export-java-symbols', action='store_true', help='Export Java_* JNI methods') + parser.add_argument('--export-fortesting-java-symbols', + action='store_true', + help='Export Java_*_ForTesting JNI methods') parser.add_argument( '--export-symbol-allowlist-file', action='append', @@ -48,13 +51,38 @@ help='Export JNI_OnLoad_* methods') options = parser.parse_args() + if options.export_fortesting_java_symbols: + assert options.export_java_symbols, ('Must export java symbols if exporting' + 'fortesting java symbols.') + # JNI_OnLoad is always exported. # CrashpadHandlerMain() is the entry point to the Crashpad handler, required # for libcrashpad_handler_trampoline.so. symbol_list = ['CrashpadHandlerMain', 'JNI_OnLoad'] if options.export_java_symbols: - symbol_list.append('Java_*') + if options.export_fortesting_java_symbols: + symbol_list.append('Java_*') + else: + # The linker uses unix shell globbing patterns, not regex. So, we have to + # include everything that doesn't end in "ForTest(ing)" with this set of + # globs. + symbol_list.append('Java_*[!F]orTesting') + symbol_list.append('Java_*[!o]rTesting') + symbol_list.append('Java_*[!r]Testing') + symbol_list.append('Java_*[!T]esting') + symbol_list.append('Java_*[!e]sting') + symbol_list.append('Java_*[!s]ting') + symbol_list.append('Java_*[!t]ing') + symbol_list.append('Java_*[!i]ng') + symbol_list.append('Java_*[!n]g') + symbol_list.append('Java_*[!F]orTest') + symbol_list.append('Java_*[!o]rTest') + symbol_list.append('Java_*[!r]Test') + symbol_list.append('Java_*[!T]est') + symbol_list.append('Java_*[!e]st') + symbol_list.append('Java_*[!s]t') + symbol_list.append('Java_*[!gt]') if options.export_feature_registrations: symbol_list.append('JNI_OnLoad_*')
diff --git a/build/config/android/linker_version_script.gni b/build/config/android/linker_version_script.gni index 96d8b665..bcdd8ef 100644 --- a/build/config/android/linker_version_script.gni +++ b/build/config/android/linker_version_script.gni
@@ -16,6 +16,7 @@ # template("generate_linker_version_script") { action_with_pydeps(target_name) { + forward_variables_from(invoker, TESTONLY_AND_VISIBILITY) script = "//build/android/gyp/generate_linker_version_script.py" outputs = [ invoker.linker_script ] inputs = [] @@ -23,6 +24,9 @@ if (defined(invoker.export_java_symbols) && invoker.export_java_symbols) { args += [ "--export-java-symbols" ] + if (defined(invoker.testonly) && invoker.testonly) { + args += [ "--export-fortesting-java-symbols" ] + } } if (defined(invoker.export_feature_registrations) &&
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni index 15d99775..4de56ff 100644 --- a/build/config/android/rules.gni +++ b/build/config/android/rules.gni
@@ -369,6 +369,14 @@ ] } } + if (defined(invoker.include_testonly)) { + _include_testonly = invoker.include_testonly + } else { + _include_testonly = defined(testonly) && testonly + } + if (_include_testonly) { + args += [ "--include_test_only" ] + } if (use_hashed_jni_names) { args += [ "--use_proxy_hash" ]
diff --git a/build/fuchsia/linux_internal.sdk.sha1 b/build/fuchsia/linux_internal.sdk.sha1 index 0b9d398c..7022318a 100644 --- a/build/fuchsia/linux_internal.sdk.sha1 +++ b/build/fuchsia/linux_internal.sdk.sha1
@@ -1 +1 @@ -9.20220722.1.1 +9.20220722.2.1
diff --git a/buildtools/deps_revisions.gni b/buildtools/deps_revisions.gni index 775faa0..76f0bd1 100644 --- a/buildtools/deps_revisions.gni +++ b/buildtools/deps_revisions.gni
@@ -5,5 +5,5 @@ declare_args() { # Used to cause full rebuilds on libc++ rolls. This should be kept in sync # with the libcxx_revision vars in //DEPS. - libcxx_revision = "49e658031b2be0ed59e50183335cc365cdb390cd" + libcxx_revision = "eb79671bfbedd77b747d01dee8c0479ff1693f88" }
diff --git a/chrome/android/chrome_common_shared_library.gni b/chrome/android/chrome_common_shared_library.gni index 2a73ab3c..d26e3393 100644 --- a/chrome/android/chrome_common_shared_library.gni +++ b/chrome/android/chrome_common_shared_library.gni
@@ -38,6 +38,7 @@ # native_deps. See //chrome/android/modules/chrome_feature_modules.gni for # the descriptor format. template("chrome_common_shared_library") { + forward_variables_from(invoker, TESTONLY_AND_VISIBILITY) _is_monochrome = defined(invoker.is_monochrome) && invoker.is_monochrome _is_webview = defined(invoker.is_webview) && invoker.is_webview _export_java_symbols = _is_monochrome || _is_webview @@ -123,9 +124,14 @@ sources += [ "../browser/android/vr/register_jni_monochrome.cc" ] } else { sources += [ "../browser/android/vr/register_jni.cc" ] - deps += [ - "//chrome/browser/android/vr:jni_registration($default_toolchain)", - ] + if (defined(invoker.testonly) && invoker.testonly) { + defines = [ "JNI_REGISTRATION_FOR_TESTING" ] + deps += [ "//chrome/browser/android/vr:jni_registration_for_testing($default_toolchain)" ] + } else { + deps += [ + "//chrome/browser/android/vr:jni_registration($default_toolchain)", + ] + } } }
diff --git a/chrome/android/chrome_public_apk_tmpl.gni b/chrome/android/chrome_public_apk_tmpl.gni index bf28930..16d6354 100644 --- a/chrome/android/chrome_public_apk_tmpl.gni +++ b/chrome/android/chrome_public_apk_tmpl.gni
@@ -11,7 +11,6 @@ import("//build/config/compiler/compiler.gni") import("//build/config/locales.gni") import("//build/util/version.gni") -import("//chrome/android/chrome_common_shared_library.gni") import("//chrome/android/features/dev_ui/dev_ui_module.gni") import("//chrome/android/modules/chrome_bundle_tmpl.gni") import("//chrome/common/features.gni")
diff --git a/chrome/android/features/cablev2_authenticator/BUILD.gn b/chrome/android/features/cablev2_authenticator/BUILD.gn index 2370e7a6..6df6b7f3d 100644 --- a/chrome/android/features/cablev2_authenticator/BUILD.gn +++ b/chrome/android/features/cablev2_authenticator/BUILD.gn
@@ -3,7 +3,7 @@ # found in the LICENSE file. import("//build/config/android/rules.gni") -import("//chrome/android/chrome_common_shared_library.gni") +import("//chrome/android/modules/buildflags.gni") android_library("java") { sources = [
diff --git a/chrome/android/features/start_surface/java/src/org/chromium/chrome/features/start_surface/StartSurfaceCoordinator.java b/chrome/android/features/start_surface/java/src/org/chromium/chrome/features/start_surface/StartSurfaceCoordinator.java index e2ccbba9..e22acfbf 100644 --- a/chrome/android/features/start_surface/java/src/org/chromium/chrome/features/start_surface/StartSurfaceCoordinator.java +++ b/chrome/android/features/start_surface/java/src/org/chromium/chrome/features/start_surface/StartSurfaceCoordinator.java
@@ -34,6 +34,8 @@ import org.chromium.chrome.browser.feed.FeedSwipeRefreshLayout; import org.chromium.chrome.browser.feed.ScrollListener; import org.chromium.chrome.browser.feed.ScrollableContainerDelegate; +import org.chromium.chrome.browser.flags.CachedFeatureFlags; +import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.fullscreen.BrowserControlsManager; import org.chromium.chrome.browser.init.ChromeActivityNativeDelegate; import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; @@ -274,7 +276,8 @@ || !mIsStartSurfaceEnabled; boolean excludeQueryTiles = StartSurfaceConfiguration.START_SURFACE_EXCLUDE_QUERY_TILES.getValue() - || !mIsStartSurfaceEnabled; + || !mIsStartSurfaceEnabled + || !CachedFeatureFlags.isEnabled(ChromeFeatureList.QUERY_TILES); if (!mIsStartSurfaceEnabled) { // Create Tab switcher directly to save one layer in the view hierarchy. mTabSwitcher = TabManagementModuleProvider.getDelegate().createGridTabSwitcher(activity,
diff --git a/chrome/android/features/start_surface/java/src/org/chromium/chrome/features/start_surface/StartSurfaceMediator.java b/chrome/android/features/start_surface/java/src/org/chromium/chrome/features/start_surface/StartSurfaceMediator.java index 9f68d14..df45bb3 100644 --- a/chrome/android/features/start_surface/java/src/org/chromium/chrome/features/start_surface/StartSurfaceMediator.java +++ b/chrome/android/features/start_surface/java/src/org/chromium/chrome/features/start_surface/StartSurfaceMediator.java
@@ -525,8 +525,7 @@ setMVTilesVisibility(!mIsIncognito); setTabCarouselVisibility(hasNormalTab && !mIsIncognito); setExploreSurfaceVisibility(!mIsIncognito && mExploreSurfaceCoordinatorFactory != null); - // TODO(qinmin): show query tiles when flag is enabled. - setQueryTilesVisibility(false); + setQueryTilesVisibility(!mIsIncognito); setFakeBoxVisibility(!mIsIncognito); setSecondaryTasksSurfaceVisibility(mIsIncognito, /* skipUpdateController = */ false); setTopToolbarPlaceholderHeight(getPixelSize(R.dimen.control_container_height)
diff --git a/chrome/android/features/start_surface/java/src/org/chromium/chrome/features/tasks/TasksSurfaceCoordinator.java b/chrome/android/features/start_surface/java/src/org/chromium/chrome/features/tasks/TasksSurfaceCoordinator.java index 09b3b3c..5cde4d3 100644 --- a/chrome/android/features/start_surface/java/src/org/chromium/chrome/features/tasks/TasksSurfaceCoordinator.java +++ b/chrome/android/features/start_surface/java/src/org/chromium/chrome/features/tasks/TasksSurfaceCoordinator.java
@@ -30,7 +30,9 @@ import org.chromium.chrome.browser.omnibox.OmniboxStub; import org.chromium.chrome.browser.profiles.OriginalProfileSupplier; import org.chromium.chrome.browser.profiles.Profile; +import org.chromium.chrome.browser.profiles.ProfileManager; import org.chromium.chrome.browser.query_tiles.QueryTileSection; +import org.chromium.chrome.browser.query_tiles.QueryTileUtils; import org.chromium.chrome.browser.share.ShareDelegate; import org.chromium.chrome.browser.suggestions.SuggestionsNavigationDelegate; import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegateImpl; @@ -161,14 +163,18 @@ } if (hasQueryTiles) { - mQueryTileProfileSupplier = new OriginalProfileSupplier(); - mQueryTileProfileSupplier.onAvailable(this::initializeQueryTileSection); + if (ProfileManager.isInitialized()) { + initializeQueryTileSection(Profile.getLastUsedRegularProfile()); + } else { + mQueryTileProfileSupplier = new OriginalProfileSupplier(); + mQueryTileProfileSupplier.onAvailable(this::initializeQueryTileSection); + } } } private void initializeQueryTileSection(Profile profile) { assert profile != null; - + if (!QueryTileUtils.isQueryTilesEnabledOnStartSurface()) return; mQueryTileSection = new QueryTileSection(mView.findViewById(R.id.query_tiles_layout), profile, query -> mMediator.performSearchQuery(query.queryText, query.searchParams));
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/UndoGroupSnackbarController.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/UndoGroupSnackbarController.java index cf6b2a3b..742a966 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/UndoGroupSnackbarController.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/UndoGroupSnackbarController.java
@@ -108,7 +108,7 @@ } @Override - public void didCloseTab(Tab tab) { + public void onFinishingTabClosure(Tab tab) { mSnackbarManager.dismissSnackbars(UndoGroupSnackbarController.this); } };
diff --git a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediatorUnitTest.java b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediatorUnitTest.java index 65b2ea3c..c6e95ca 100644 --- a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediatorUnitTest.java +++ b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediatorUnitTest.java
@@ -64,6 +64,7 @@ import org.chromium.chrome.test.util.browser.Features; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.ui.KeyboardVisibilityDelegate; +import org.chromium.ui.base.TestActivity; import org.chromium.ui.modelutil.PropertyModel; import org.chromium.url.GURL; import org.chromium.url.JUnitTestGURLs; @@ -185,8 +186,7 @@ ContextUtils.getApplicationContext())) { mTabSelectionEditorController = null; } - mActivity = Robolectric.buildActivity(Activity.class).get(); - mActivity.setTheme(R.style.Theme_BrowserUI_DayNight); + mActivity = Robolectric.buildActivity(TestActivity.class).get(); mModel = new PropertyModel(TabGridPanelProperties.ALL_KEYS); mMediator = new TabGridDialogMediator(mActivity, mDialogController, mModel, mTabModelSelector, mTabCreatorManager, mTabSwitcherResetHandler,
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 8040eef..329efa80 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
@@ -595,7 +595,7 @@ } mTabModelObserver = new TabModelSelectorTabModelObserver(mTabModelSelector) { @Override - public void didCloseTab(Tab tab) { + public void onFinishingTabClosure(Tab tab) { closeIfNoTabsAndHomepageEnabled(false); openTabletTabSwitcherIfNoTabs(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java index ed877d7..4d95ab1 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java
@@ -163,6 +163,7 @@ import org.chromium.chrome.browser.tab.TabSelectionType; import org.chromium.chrome.browser.tab.TabState; import org.chromium.chrome.browser.tab.TabUtils; +import org.chromium.chrome.browser.tab.TabUtils.LoadIfNeededCaller; import org.chromium.chrome.browser.tab.TabUtils.UseDesktopUserAgentCaller; import org.chromium.chrome.browser.tabmodel.EmptyTabModel; import org.chromium.chrome.browser.tabmodel.TabCreator; @@ -987,11 +988,12 @@ Tab tab = getActivityTab(); if (tab != null) { if (tab.isHidden()) { - tab.show(TabSelectionType.FROM_USER); + tab.show( + TabSelectionType.FROM_USER, LoadIfNeededCaller.ON_ACTIVITY_SHOWN_THEN_SHOW); } else { // The visible Tab's renderer process may have died after the activity was // paused. Ensure that it's restored appropriately. - tab.loadIfNeeded(); + tab.loadIfNeeded(LoadIfNeededCaller.ON_ACTIVITY_SHOWN); } } VrModuleProvider.getDelegate().onActivityShown(this);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/flags/ChromeCachedFlags.java b/chrome/android/java/src/org/chromium/chrome/browser/app/flags/ChromeCachedFlags.java index b1608d2..3fa25ab5 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/app/flags/ChromeCachedFlags.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/app/flags/ChromeCachedFlags.java
@@ -105,6 +105,7 @@ add(ChromeFeatureList.sOptimizationGuidePushNotifications); add(ChromeFeatureList.sPaintPreviewDemo); add(ChromeFeatureList.sPaintPreviewShowOnStartup); + add(ChromeFeatureList.sQueryTiles); add(ChromeFeatureList.sReadLater); add(ChromeFeatureList.sStartSurfaceAndroid); add(ChromeFeatureList.sStartSurfaceRefactor);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java index ec1dc10..bf4611c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java
@@ -54,6 +54,7 @@ import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabCreationState; import org.chromium.chrome.browser.tab.TabObserver; +import org.chromium.chrome.browser.tab.TabUtils.LoadIfNeededCaller; import org.chromium.chrome.browser.tabmodel.TabCreatorManager; import org.chromium.chrome.browser.tabmodel.TabModel; import org.chromium.chrome.browser.tabmodel.TabModelSelector; @@ -1409,7 +1410,7 @@ // Tab needs to be loaded. Once a new Tab is opening and Start surface is hiding, this flag // will be reset. if (tab != null && !StartSurfaceUserData.getInstance().getUnusedTabRestoredAtStartup()) { - tab.loadIfNeeded(); + tab.loadIfNeeded(LoadIfNeededCaller.SET_TAB); } View newView = tab != null ? tab.getView() : null;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerImpl.java index 3d1dfb4..58d4943 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerImpl.java
@@ -234,7 +234,7 @@ } @Override - public void didCloseTab(Tab tab) { + public void onFinishingTabClosure(Tab tab) { tabClosed(tab.getId(), tab.isIncognito(), false); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperManager.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperManager.java index fc9dadde..b927bda 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperManager.java
@@ -586,7 +586,7 @@ } @Override - public void didCloseTab(Tab tab) { + public void onFinishingTabClosure(Tab tab) { getStripLayoutHelper(tab.isIncognito()).tabClosed(time(), tab.getId()); updateModelSwitcherButton(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/crash/ChromePureJavaExceptionReporter.java b/chrome/android/java/src/org/chromium/chrome/browser/crash/ChromePureJavaExceptionReporter.java index ff87911..27251dc 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/crash/ChromePureJavaExceptionReporter.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/crash/ChromePureJavaExceptionReporter.java
@@ -24,7 +24,7 @@ @UsedByReflection("SplitCompatApplication.java") public ChromePureJavaExceptionReporter() { - super(ContextUtils.getApplicationContext().getCacheDir()); + super(ContextUtils.getApplicationContext().getCacheDir(), /*attachLogcat=*/true); } @Override @@ -62,4 +62,4 @@ PostTask.postTask( TaskTraits.BEST_EFFORT_MAY_BLOCK, () -> reportJavaException(javaException)); } -} \ No newline at end of file +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/crash/LogcatExtractionRunnable.java b/chrome/android/java/src/org/chromium/chrome/browser/crash/LogcatExtractionRunnable.java index fd8d1036..900b922 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/crash/LogcatExtractionRunnable.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/crash/LogcatExtractionRunnable.java
@@ -6,8 +6,10 @@ import androidx.annotation.VisibleForTesting; +import org.chromium.base.ContextUtils; import org.chromium.base.Log; import org.chromium.components.crash.LogcatCrashExtractor; +import org.chromium.components.minidump_uploader.CrashFileManager; import java.io.File; @@ -41,7 +43,8 @@ @Override public void run() { - File fileToUpload = mLogcatExtractor.attachLogcatToMinidump(mMinidumpFile); + File fileToUpload = mLogcatExtractor.attachLogcatToMinidump(mMinidumpFile, + new CrashFileManager(ContextUtils.getApplicationContext().getCacheDir())); uploadMinidump(fileToUpload, false); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/PartialCustomTabHeightStrategy.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/PartialCustomTabHeightStrategy.java index f701e79..9550533 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/PartialCustomTabHeightStrategy.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/PartialCustomTabHeightStrategy.java
@@ -94,7 +94,7 @@ private final Integer mNavigationBarDividerColor; private final OnResizedCallback mOnResizedCallback; private final AnimatorListener mSpinnerFadeoutAnimatorListener; - private final int mHandleHeight; + private final int mCachedHandleHeight; private @Px int mInitialHeight; private ValueAnimator mAnimator; private int mShadowOffset; @@ -291,7 +291,7 @@ mNavigationBarColor = navigationBarColor; mNavigationBarDividerColor = navigationBarDividerColor; mDrawOutlineShadow = SysUtils.isLowEndDevice(); - mHandleHeight = + mCachedHandleHeight = mActivity.getResources().getDimensionPixelSize(R.dimen.custom_tabs_handle_height); mSpinnerFadeoutAnimatorListener = new AnimatorListener() { @Override @@ -395,6 +395,7 @@ mToolbarColor = toolbar.getBackground().getColor(); roundCorners(coordinatorView, toolbar, toolbarCornerRadius); toolbar.setHandleStrategy(new PartialCustomTabHandleStrategy(mActivity)); + updateDragBarVisibility(); } // ConfigurationChangedObserver implementation. @@ -513,6 +514,13 @@ // See b/223536648. attributes.y = Math.max(maxExpandedY, mDisplayHeight - height); mActivity.getWindow().setAttributes(attributes); + + updateDragBarVisibility(); + } + + private void updateDragBarVisibility() { + View dragBar = mActivity.findViewById(R.id.drag_bar); + if (dragBar != null) dragBar.setVisibility(isFullHeight() ? View.GONE : View.VISIBLE); } private void updateShadowOffset() { @@ -530,10 +538,14 @@ // Make enough room for the handle View. ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) mToolbarCoordinator.getLayoutParams(); - mlp.setMargins(0, mHandleHeight + mShadowOffset, 0, 0); + mlp.setMargins(0, getHandleHeight() + mShadowOffset, 0, 0); mToolbarCoordinator.requestLayout(); } + private int getHandleHeight() { + return isFullHeight() ? 0 : mCachedHandleHeight; + } + private boolean isFullHeight() { return mOrientation == Configuration.ORIENTATION_LANDSCAPE || mIsInMultiWindowMode; } @@ -596,7 +608,7 @@ // Toolbar should not be hidden by spinner screen. ViewGroup.MarginLayoutParams lp = new ViewGroup.MarginLayoutParams(MATCH_PARENT, 0); - lp.setMargins(0, mToolbarView.getHeight() + mHandleHeight + mShadowOffset, 0, 0); + lp.setMargins(0, mToolbarView.getHeight() + getHandleHeight() + mShadowOffset, 0, 0); mSpinner = new CircularProgressDrawable(mActivity); mSpinner.setStyle(CircularProgressDrawable.LARGE); mSpinnerView.setImageDrawable(mSpinner); @@ -636,7 +648,7 @@ // TODO(jinsukkim): // - Remove the shadow when in full-height so there won't be a gap beneath the status bar. int windowPos = mActivity.getWindow().getAttributes().y; - lp.height = mDisplayHeight - windowPos - mHandleHeight - mShadowOffset - mNavbarHeight; + lp.height = mDisplayHeight - windowPos - getHandleHeight() - mShadowOffset - mNavbarHeight; mCoordinatorLayout.setLayoutParams(lp); if (oldHeight >= 0 && lp.height != oldHeight) mOnResizedCallback.onResized(lp.height); } @@ -682,7 +694,8 @@ // rendered over it due to Window#FLAGS_LAYOUT_NO_LIMITS would be shown. private void setNavbarOffset() { if (mCoordinatorLayout == null) return; - int offset = mCoordinatorLayout.getLayoutParams().height + mHandleHeight + mShadowOffset; + int offset = + mCoordinatorLayout.getLayoutParams().height + getHandleHeight() + mShadowOffset; mNavbar.setTranslationY(offset); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/content/TabObserverRegistrar.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/content/TabObserverRegistrar.java index 8482073..73eb2004 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/content/TabObserverRegistrar.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/content/TabObserverRegistrar.java
@@ -124,7 +124,7 @@ } @Override - public void didCloseTab(Tab tab) { + public void onFinishingTabClosure(Tab tab) { // We don't need to remove the Tab Observers since it's closed. // TODO(peconn): Do we really want to remove the *global* PageLoadMetrics observers here? removePageLoadMetricsObservers();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/PictureInPictureActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/media/PictureInPictureActivity.java index 02cf212..7aa91053 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/media/PictureInPictureActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/media/PictureInPictureActivity.java
@@ -32,27 +32,27 @@ import org.chromium.base.ApplicationStatus; import org.chromium.base.BuildInfo; import org.chromium.base.ContextUtils; -import org.chromium.base.IntentUtils; import org.chromium.base.MathUtils; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.NativeMethods; -import org.chromium.chrome.R; import org.chromium.chrome.browser.init.AsyncInitializationActivity; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabUtils; +import org.chromium.components.browser_ui.media.R; import org.chromium.components.thinwebview.CompositorView; import org.chromium.components.thinwebview.CompositorViewFactory; import org.chromium.components.thinwebview.ThinWebViewConstraints; -import org.chromium.content_public.browser.MediaSession; -import org.chromium.content_public.browser.MediaSessionObserver; import org.chromium.content_public.browser.WebContents; +import org.chromium.media_session.mojom.MediaSessionAction; import org.chromium.ui.base.ActivityWindowAndroid; import org.chromium.ui.base.WindowAndroid; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; /** * A picture in picture activity which get created when requesting @@ -60,8 +60,17 @@ * OverlayWindowAndroid. */ public class PictureInPictureActivity extends AsyncInitializationActivity { - private static final String ACTION_PLAY = - "org.chromium.chrome.browser.media.PictureInPictureActivity.Play"; + // Used to filter media buttons' remote action intents. + private static final String MEDIA_ACTION = + "org.chromium.chrome.browser.media.PictureInPictureActivity.MediaAction"; + // Used to determine which action button has been touched. + private static final String CONTROL_TYPE = + "org.chromium.chrome.browser.media.PictureInPictureActivity.ControlType"; + + // Used to verify Pre-T that the broadcast sender was Chrome. This extra can be removed when the + // min supported version is Android T. + private static final String EXTRA_RECEIVER_TOKEN = + "org.chromium.chrome.browser.media.PictureInPictureActivity.ReceiverToken"; // Use for passing unique window id to each PictureInPictureActivity instance. private static final String NATIVE_POINTER_KEY = @@ -87,13 +96,12 @@ private Tab mInitiatorTab; private InitiatorTabObserver mTabObserver; - // Used to verify Pre-T that the broadcast sender was Chrome. This extra can be removed when the - // min supported version is Android T. - private static final String EXTRA_RECEIVER_TOKEN = "receiver_token"; - private CompositorView mCompositorView; - private MediaSessionObserver mMediaSessionObserver; - private boolean mIsPlayPauseVisible; + + private boolean mIsPlaying; + + // MediaSessionaction, RemoteAction pairs. + private HashMap<Integer, RemoteAction> mRemoteActions = new HashMap<>(); // If present, this is the video's aspect ratio. private Rational mAspectRatio; @@ -112,13 +120,27 @@ return; } - if (intent.getAction() == null || !intent.getAction().equals(ACTION_PLAY)) return; + if (intent.getAction() == null || !intent.getAction().equals(MEDIA_ACTION)) return; if (!intent.hasExtra(EXTRA_RECEIVER_TOKEN) || intent.getIntExtra(EXTRA_RECEIVER_TOKEN, 0) != this.hashCode()) { return; } - PictureInPictureActivityJni.get().play(nativeOverlayWindowAndroid); + switch (intent.getIntExtra(CONTROL_TYPE, -1)) { + case MediaSessionAction.PLAY: + case MediaSessionAction.PAUSE: + // TODO(crbug.com/1345956): Play/pause state might get out of sync. + PictureInPictureActivityJni.get().togglePlayPause(nativeOverlayWindowAndroid); + return; + case MediaSessionAction.PREVIOUS_TRACK: + PictureInPictureActivityJni.get().previousTrack(nativeOverlayWindowAndroid); + return; + case MediaSessionAction.NEXT_TRACK: + PictureInPictureActivityJni.get().nextTrack(nativeOverlayWindowAndroid); + return; + default: + return; + } } }; @@ -249,21 +271,13 @@ mMediaSessionReceiver = new MediaSessionBroadcastReceiver(); ContextUtils.registerNonExportedBroadcastReceiver( - this, mMediaSessionReceiver, new IntentFilter(ACTION_PLAY)); + this, mMediaSessionReceiver, new IntentFilter(MEDIA_ACTION)); + + initializeRemoteActions(); PictureInPictureActivityJni.get().onActivityStart( mNativeOverlayWindowAndroid, this, getWindowAndroid()); - // Add an observer to refresh the Picture-in-Picture params if the media - // session state changes. - MediaSession mediaSession = MediaSession.fromWebContents(mInitiatorTab.getWebContents()); - mMediaSessionObserver = new MediaSessionObserver(mediaSession) { - @Override - public void mediaSessionStateChanged(boolean isControllable, boolean isSuspended) { - updatePictureInPictureParams(); - } - }; - // See if there are PiP hints in the extras. Size size = new Size( intent.getIntExtra(SOURCE_WIDTH_KEY, 0), intent.getIntExtra(SOURCE_HEIGHT_KEY, 0)); @@ -293,11 +307,6 @@ mMediaSessionReceiver = null; } - if (mMediaSessionObserver != null) { - mMediaSessionObserver.stopObserving(); - mMediaSessionObserver = null; - } - if (mInitiatorTab != null) { mInitiatorTab.removeObserver(mTabObserver); mInitiatorTab = null; @@ -346,23 +355,10 @@ private PictureInPictureParams getPictureInPictureParams() { ArrayList<RemoteAction> actions = new ArrayList<>(); - // If the associated media session is not controllable then we should - // place a play button in the Picture-in-Picture window that will - // trigger playback. - if (mMediaSessionObserver != null - && !mMediaSessionObserver.getMediaSession().isControllable() - && mIsPlayPauseVisible) { - Intent intent = new Intent(ACTION_PLAY); - intent.putExtra(EXTRA_RECEIVER_TOKEN, mMediaSessionReceiver.hashCode()); - intent.putExtra(NATIVE_POINTER_KEY, mNativeOverlayWindowAndroid); - PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, - intent, IntentUtils.getPendingIntentMutabilityFlag(false)); - - actions.add(new RemoteAction(Icon.createWithResource(getApplicationContext(), - R.drawable.ic_play_arrow_white_36dp), - getApplicationContext().getResources().getText(R.string.accessibility_play), "", - pendingIntent)); - } + actions.add(mRemoteActions.get(MediaSessionAction.PREVIOUS_TRACK)); + actions.add(mRemoteActions.get( + mIsPlaying ? MediaSessionAction.PAUSE : MediaSessionAction.PLAY)); + actions.add(mRemoteActions.get(MediaSessionAction.NEXT_TRACK)); PictureInPictureParams.Builder builder = new PictureInPictureParams.Builder(); builder.setActions(actions); @@ -372,6 +368,67 @@ } @SuppressLint("NewApi") + private void initializeRemoteActions() { + mRemoteActions.put(MediaSessionAction.PLAY, createRemoteAction(MediaSessionAction.PLAY)); + mRemoteActions.put(MediaSessionAction.PAUSE, createRemoteAction(MediaSessionAction.PAUSE)); + mRemoteActions.put(MediaSessionAction.PREVIOUS_TRACK, + createRemoteAction(MediaSessionAction.PREVIOUS_TRACK)); + mRemoteActions.put( + MediaSessionAction.NEXT_TRACK, createRemoteAction(MediaSessionAction.NEXT_TRACK)); + } + + /** + * Create remote actions for picutre-in-picture window. + * + * @param action {@link MediaSessionAction} that the action button is corresponding to. + */ + @SuppressLint("NewApi") + private RemoteAction createRemoteAction(int action) { + Intent intent = new Intent(MEDIA_ACTION); + intent.putExtra(EXTRA_RECEIVER_TOKEN, mMediaSessionReceiver.hashCode()); + intent.putExtra(CONTROL_TYPE, action); + intent.putExtra(NATIVE_POINTER_KEY, mNativeOverlayWindowAndroid); + PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), action, + intent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT); + + RemoteAction remoteAction; + switch (action) { + case MediaSessionAction.PLAY: + remoteAction = new RemoteAction(Icon.createWithResource(getApplicationContext(), + R.drawable.ic_play_arrow_white_36dp), + getApplicationContext().getResources().getText(R.string.accessibility_play), + "", pendingIntent); + break; + case MediaSessionAction.PAUSE: + remoteAction = new RemoteAction(Icon.createWithResource(getApplicationContext(), + R.drawable.ic_pause_white_36dp), + getApplicationContext().getResources().getText( + R.string.accessibility_pause), + "", pendingIntent); + break; + case MediaSessionAction.NEXT_TRACK: + remoteAction = new RemoteAction(Icon.createWithResource(getApplicationContext(), + R.drawable.ic_skip_next_white_36dp), + getApplicationContext().getResources().getText( + R.string.accessibility_next_track), + "", pendingIntent); + break; + case MediaSessionAction.PREVIOUS_TRACK: + remoteAction = new RemoteAction(Icon.createWithResource(getApplicationContext(), + R.drawable.ic_skip_previous_white_36dp), + getApplicationContext().getResources().getText( + R.string.accessibility_previous_track), + "", pendingIntent); + break; + default: + remoteAction = null; + } + + remoteAction.setEnabled(false); + return remoteAction; + } + + @SuppressLint("NewApi") private void updatePictureInPictureParams() { setPictureInPictureParams(getPictureInPictureParams()); } @@ -400,8 +457,22 @@ @CalledByNative @SuppressLint("NewAPI") - private void setPlayPauseButtonVisibility(boolean isVisible) { - mIsPlayPauseVisible = isVisible; + private void setPlaybackState(boolean isPlaying) { + mIsPlaying = isPlaying; + updatePictureInPictureParams(); + } + + @CalledByNative + @SuppressLint("NewAPI") + private void updateVisibleActions(int[] actions) { + HashSet<Integer> visibleActions = new HashSet<>(); + for (int action : actions) visibleActions.add(action); + + for (Integer actionKey : mRemoteActions.keySet()) { + RemoteAction remoteAction = mRemoteActions.get(actionKey); + if (remoteAction.isEnabled() == visibleActions.contains(actionKey)) continue; + remoteAction.setEnabled(!remoteAction.isEnabled()); + } updatePictureInPictureParams(); } @@ -508,7 +579,9 @@ void destroy(long nativeOverlayWindowAndroid); - void play(long nativeOverlayWindowAndroid); + void togglePlayPause(long nativeOverlayWindowAndroid); + void nextTrack(long nativeOverlayWindowAndroid); + void previousTrack(long nativeOverlayWindowAndroid); void compositorViewCreated(long nativeOverlayWindowAndroid, CompositorView compositorView);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/multiwindow/MultiInstanceManagerApi31.java b/chrome/android/java/src/org/chromium/chrome/browser/multiwindow/MultiInstanceManagerApi31.java index 73b5060..208f855 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/multiwindow/MultiInstanceManagerApi31.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/multiwindow/MultiInstanceManagerApi31.java
@@ -306,9 +306,9 @@ } @Override - public void didCloseTab(Tab tab) { - // didCloseTab is called for both normal/incognito tabs, whereas tabClosureCommitted - // is called for normal tabs only. + public void onFinishingTabClosure(Tab tab) { + // onFinishingTabClosure is called for both normal/incognito tabs, whereas + // tabClosureCommitted is called for normal tabs only. writeTabCount(mInstanceId, selector); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java index d4e6847..801da39 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java
@@ -822,7 +822,7 @@ } @Override - public void didCloseTab(Tab tab) { + public void onFinishingTabClosure(Tab tab) { Profile profile = mTabModelSelector.getModel(tab.isIncognito()).getProfile(); OfflinePageBridge bridge = OfflinePageBridge.getForProfile(profile); if (bridge == null) return;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/query_tiles/QueryTileUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/query_tiles/QueryTileUtils.java index d60da4e..57a2a5b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/query_tiles/QueryTileUtils.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/query_tiles/QueryTileUtils.java
@@ -31,6 +31,7 @@ @JNINamespace("query_tiles") public class QueryTileUtils { private static Boolean sShowQueryTilesOnNTP; + private static Boolean sShowQueryTilesOnStartSurface; private static final String BEHAVIOURAL_TARGETING_KEY = "behavioural_targeting"; private static final String NUM_DAYS_KEEP_SHOWING_QUERY_TILES_KEY = "num_days_keep_showing_query_tiles"; @@ -97,6 +98,19 @@ } /** + * Whether query tiles is enabled and should be shown on start surface. + * @return Whether the query tile feature is enabled on start surface. + */ + public static boolean isQueryTilesEnabledOnStartSurface() { + // Cache the result so it will not change during the same browser session. + if (sShowQueryTilesOnStartSurface != null) return sShowQueryTilesOnStartSurface; + boolean queryTileEnabled = ChromeFeatureList.isEnabled(ChromeFeatureList.QUERY_TILES) + || QueryTileUtilsJni.get().isQueryTilesEnabled(); + sShowQueryTilesOnStartSurface = queryTileEnabled && shouldShowQueryTiles(); + return sShowQueryTilesOnStartSurface; + } + + /** * Called to Check whether query tiles should be displayed. Here are the rules for showing query * tile: If user hasn't clicked on MV tiles for a while, query tiles will be shown for a period * of time. And the decision is reevaluated when it expires.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java index 1d97bcd..6bf7f89 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java
@@ -44,6 +44,7 @@ import org.chromium.chrome.browser.paint_preview.StartupPaintPreviewHelper; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.rlz.RevenueStats; +import org.chromium.chrome.browser.tab.TabUtils.LoadIfNeededCaller; import org.chromium.chrome.browser.tab.TabUtils.UseDesktopUserAgentCaller; import org.chromium.chrome.browser.tab.state.CriticalPersistedTabData; import org.chromium.chrome.browser.tab.state.SerializedCriticalPersistedTabData; @@ -540,7 +541,7 @@ } @Override - public boolean loadIfNeeded() { + public boolean loadIfNeeded(@LoadIfNeededCaller int caller) { if (getActivity() == null) { Log.e(TAG, "Tab couldn't be loaded because Context was null."); return false; @@ -561,7 +562,7 @@ return true; } - switchUserAgentIfNeeded(UseDesktopUserAgentCaller.LOAD_IF_NEEDED); + switchUserAgentIfNeeded(UseDesktopUserAgentCaller.LOAD_IF_NEEDED + caller); restoreIfNeeded(); return true; } @@ -661,7 +662,7 @@ } @Override - public final void show(@TabSelectionType int type) { + public final void show(@TabSelectionType int type, @LoadIfNeededCaller int caller) { try { TraceEvent.begin("Tab.show"); if (!isHidden()) return; @@ -670,7 +671,7 @@ mIsHidden = false; updateInteractableState(); - loadIfNeeded(); + loadIfNeeded(caller); if (getWebContents() != null) getWebContents().onShow(); @@ -1670,7 +1671,7 @@ "Android.RequestDesktopSite.UseDesktopUserAgent", value); } - private void switchUserAgentIfNeeded(@UseDesktopUserAgentCaller int caller) { + private void switchUserAgentIfNeeded(int caller) { if (calculateUserAgentOverrideOption() == UserAgentOverrideOption.INHERIT || getWebContents() == null) { return;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabUtils.java index 269085b..73a20e3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabUtils.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabUtils.java
@@ -52,10 +52,26 @@ @Retention(RetentionPolicy.SOURCE) public @interface UseDesktopUserAgentCaller { int ON_MENU_OR_KEYBOARD_ACTION = 0; - int LOAD_IF_NEEDED = 1; - int RELOAD = 2; - int RELOAD_IGNORING_CACHE = 3; - int OTHER = 4; + int LOAD_IF_NEEDED = 100; + int RELOAD = 200; + int RELOAD_IGNORING_CACHE = 300; + int OTHER = 400; + } + + /** + * Define the callers of TabImpl#loadIfNeeded. + */ + @IntDef({LoadIfNeededCaller.SET_TAB, LoadIfNeededCaller.ON_ACTIVITY_SHOWN, + LoadIfNeededCaller.ON_ACTIVITY_SHOWN_THEN_SHOW, LoadIfNeededCaller.REQUEST_TO_SHOW_TAB, + LoadIfNeededCaller.REQUEST_TO_SHOW_TAB_THEN_SHOW, LoadIfNeededCaller.OTHER}) + @Retention(RetentionPolicy.SOURCE) + public @interface LoadIfNeededCaller { + int SET_TAB = 0; + int ON_ACTIVITY_SHOWN = 1; + int ON_ACTIVITY_SHOWN_THEN_SHOW = 2; + int REQUEST_TO_SHOW_TAB = 3; + int REQUEST_TO_SHOW_TAB_THEN_SHOW = 4; + int OTHER = 5; } // Do not instantiate this class. @@ -114,8 +130,8 @@ * @param forcedByUser Whether this was triggered by users action. * @param caller The caller of this method. */ - public static void switchUserAgent(Tab tab, boolean switchToDesktop, boolean forcedByUser, - @UseDesktopUserAgentCaller int caller) { + public static void switchUserAgent( + Tab tab, boolean switchToDesktop, boolean forcedByUser, int caller) { final boolean reloadOnChange = !tab.isNativePage(); tab.getWebContents().getNavigationController().setUseDesktopUserAgent( switchToDesktop, reloadOnChange, caller);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabModelObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabModelObserver.java index d02cc03..5ea4ec56 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabModelObserver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabModelObserver.java
@@ -38,7 +38,7 @@ } @Override - public void didCloseTabs(List<Tab> tabs) { + public void onFinishingMultipleTabClosure(List<Tab> tabs) { if (!ChromeFeatureList.isEnabled(ChromeFeatureList.BULK_TAB_RESTORE)) { legacyCreateHistoricalTabs(tabs); return;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/PendingTabClosureManager.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/PendingTabClosureManager.java index e50544baa..b68ee640 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/PendingTabClosureManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/PendingTabClosureManager.java
@@ -45,7 +45,7 @@ * Request to notify observers that {@code tabs} will be closed. * @param tabs The list of tabs to close together. */ - public void notifyDidCloseTabs(List<Tab> tabs); + public void notifyOnFinishingMultipleTabClosure(List<Tab> tabs); } /** @@ -341,8 +341,8 @@ while (events.hasNext()) { TabClosureEvent event = events.next(); events.remove(); - // This calls notifyDidCloseTabs once per TabClosureEvent. This is intended so that tabs - // closed as distinct events are recorded as such. + // This calls notifyOnFinishingMultipleTabClosure once per TabClosureEvent. This is + // intended so that tabs closed as distinct events are recorded as such. commitClosuresInternal(event.getList()); } assert mTabClosureEvents.isEmpty(); @@ -379,7 +379,7 @@ // Tabs shouldn't be removed more than once. assert removed; } - mDelegate.notifyDidCloseTabs(tabs); + mDelegate.notifyOnFinishingMultipleTabClosure(tabs); for (Tab tab : tabs) { mDelegate.finalizeClosure(tab); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelImpl.java index cd0f748..b6ee929 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelImpl.java
@@ -129,8 +129,8 @@ } @Override - public void notifyDidCloseTabs(List<Tab> tabs) { - TabModelImpl.this.notifyDidCloseTabs(tabs); + public void notifyOnFinishingMultipleTabClosure(List<Tab> tabs) { + TabModelImpl.this.notifyOnFinishingMultipleTabClosure(tabs); } }); } @@ -409,9 +409,10 @@ * closure even if they are not notified of a pending closure to start * with. * @param notifyDidCloseAlone Whether to notify observers that this tab is closing by itself for - * {@link TabModelObserver#didCloseTabs} if the closure cannot be - * undone. This should be {@code true} if closing the tab by itself, - * and {@code false} if closing as part of a multiple tab closure. + * {@link TabModelObserver#onFinishingMultipleTabClosure} if the + * closure cannot be undone. This should be {@code true} if closing + * the tab by itself, and {@code false} if closing as part of a + * multiple tab closure. */ private boolean closeTab(Tab tabToClose, Tab recommendedNextTab, boolean animate, boolean uponExit, boolean canUndo, boolean notifyPending, boolean notifyDidCloseAlone) { @@ -434,7 +435,7 @@ } if (!canUndo) { if (notifyDidCloseAlone) { - notifyDidCloseTabs(Collections.singletonList(tabToClose)); + notifyOnFinishingMultipleTabClosure(Collections.singletonList(tabToClose)); } finalizeTabClosure(tabToClose, false); } @@ -453,7 +454,7 @@ } final boolean allowUndo = canUndo && supportsPendingClosures(); if (!allowUndo) { - notifyDidCloseTabs(tabs); + notifyOnFinishingMultipleTabClosure(tabs); } for (Tab tab : tabs) { closeTab(tab, null, false, false, canUndo, false, false); @@ -478,7 +479,7 @@ commitAllTabClosures(); for (int i = 0; i < getCount(); i++) getTabAt(i).setClosing(true); - notifyDidCloseTabs(mTabs); + notifyOnFinishingMultipleTabClosure(mTabs); while (getCount() > 0) { Tab tab = getTabAt(0); closeTab(tab, null, true, uponExit, false, false, false); @@ -490,7 +491,7 @@ for (int i = 0; i < getCount(); i++) getTabAt(i).setClosing(true); List<Tab> closedTabs = new ArrayList<>(mTabs); if (!supportsPendingClosures()) { - notifyDidCloseTabs(closedTabs); + notifyOnFinishingMultipleTabClosure(closedTabs); } while (getCount() > 0) { Tab tab = getTabAt(0); @@ -666,7 +667,7 @@ private void finalizeTabClosure(Tab tab, boolean notifyTabClosureCommitted) { mTabContentManager.removeTabThumbnail(tab.getId()); - for (TabModelObserver obs : mObservers) obs.didCloseTab(tab); + for (TabModelObserver obs : mObservers) obs.onFinishingTabClosure(tab); if (notifyTabClosureCommitted) { for (TabModelObserver obs : mObservers) obs.tabClosureCommitted(tab); } @@ -774,7 +775,7 @@ mActive = active; } - private void notifyDidCloseTabs(List<Tab> tabs) { - for (TabModelObserver obs : mObservers) obs.didCloseTabs(tabs); + private void notifyOnFinishingMultipleTabClosure(List<Tab> tabs) { + for (TabModelObserver obs : mObservers) obs.onFinishingMultipleTabClosure(tabs); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelObserverJniBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelObserverJniBridge.java index 6bf0a781..6ed9e59 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelObserverJniBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelObserverJniBridge.java
@@ -53,17 +53,18 @@ } @Override - public final void didCloseTab(Tab tab) { + public final void onFinishingTabClosure(Tab tab) { assert mNativeTabModelObserverJniBridge != 0; - TabModelObserverJniBridgeJni.get().didCloseTab(mNativeTabModelObserverJniBridge, + TabModelObserverJniBridgeJni.get().onFinishingTabClosure(mNativeTabModelObserverJniBridge, TabModelObserverJniBridge.this, tab.getId(), tab.isIncognito()); } @Override - public final void didCloseTabs(List<Tab> tabs) { + public final void onFinishingMultipleTabClosure(List<Tab> tabs) { assert mNativeTabModelObserverJniBridge != 0; - TabModelObserverJniBridgeJni.get().didCloseTabs(mNativeTabModelObserverJniBridge, - TabModelObserverJniBridge.this, tabs.toArray(new Tab[0])); + TabModelObserverJniBridgeJni.get().onFinishingMultipleTabClosure( + mNativeTabModelObserverJniBridge, TabModelObserverJniBridge.this, + tabs.toArray(new Tab[0])); } @Override @@ -175,9 +176,9 @@ void willCloseTab(long nativeTabModelObserverJniBridge, TabModelObserverJniBridge caller, Tab tab, boolean animate); - void didCloseTab(long nativeTabModelObserverJniBridge, TabModelObserverJniBridge caller, - int tabId, boolean incognito); - void didCloseTabs( + void onFinishingTabClosure(long nativeTabModelObserverJniBridge, + TabModelObserverJniBridge caller, int tabId, boolean incognito); + void onFinishingMultipleTabClosure( long nativeTabModelObserverJniBridge, TabModelObserverJniBridge caller, Tab[] tabs); void willAddTab(long nativeTabModelObserverJniBridge, TabModelObserverJniBridge caller, Tab tab, int type);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorImpl.java index 2eb5a8c..7834376 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorImpl.java
@@ -20,6 +20,7 @@ import org.chromium.chrome.browser.tab.TabHidingType; import org.chromium.chrome.browser.tab.TabLaunchType; import org.chromium.chrome.browser.tab.TabSelectionType; +import org.chromium.chrome.browser.tab.TabUtils.LoadIfNeededCaller; import org.chromium.chrome.browser.tabmodel.NextTabPolicy.NextTabPolicySupplier; import org.chromium.ui.base.WindowAndroid; import org.chromium.url.GURL; @@ -267,7 +268,7 @@ // without actual tab switch. if (mVisibleTab == tab && !mVisibleTab.isHidden()) { // The current tab might have been killed by the os while in tab switcher. - tab.loadIfNeeded(); + tab.loadIfNeeded(LoadIfNeededCaller.REQUEST_TO_SHOW_TAB); // |tabToDropImportance| must be null, so no need to drop importance. return; } @@ -277,7 +278,7 @@ // avoids unecessary work (tab restore) and prevents pollution of tab display metrics - see // http://crbug.com/316166. if (type != TabSelectionType.FROM_EXIT) { - tab.show(type); + tab.show(type, LoadIfNeededCaller.REQUEST_TO_SHOW_TAB_THEN_SHOW); tab.getId(); tab.isBeingRestored(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java index 1c1643b..7bf7260 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
@@ -186,7 +186,7 @@ mTabModelObserver = new TabModelObserver() { @Override - public void didCloseTab(Tab tab) { + public void onFinishingTabClosure(Tab tab) { PersistedTabData.onTabClose(tab); removeTabFromQueues(tab); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ui/tablet/emptybackground/EmptyBackgroundViewWrapper.java b/chrome/android/java/src/org/chromium/chrome/browser/ui/tablet/emptybackground/EmptyBackgroundViewWrapper.java index 39bd4f5..5ca2c265 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ui/tablet/emptybackground/EmptyBackgroundViewWrapper.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ui/tablet/emptybackground/EmptyBackgroundViewWrapper.java
@@ -86,7 +86,7 @@ } @Override - public void didCloseTab(Tab tab) { + public void onFinishingTabClosure(Tab tab) { updateEmptyContainerState(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/undo_tab_close_snackbar/UndoBarController.java b/chrome/android/java/src/org/chromium/chrome/browser/undo_tab_close_snackbar/UndoBarController.java index 57fd7a1..d3b212e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/undo_tab_close_snackbar/UndoBarController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/undo_tab_close_snackbar/UndoBarController.java
@@ -127,7 +127,7 @@ } @Override - public void didCloseTabs(List<Tab> tabs) { + public void onFinishingMultipleTabClosure(List<Tab> tabs) { if (disableUndo(false)) return; mSnackbarManagable.getSnackbarManager().dismissSnackbars( UndoBarController.this, tabs);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java index 65a41d11..2e05292 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java
@@ -26,6 +26,7 @@ import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabObserver; import org.chromium.chrome.browser.tab.TabSelectionType; +import org.chromium.chrome.browser.tab.TabUtils.LoadIfNeededCaller; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeApplicationTestUtils; @@ -104,7 +105,8 @@ @DisabledTest(message = "https://crbug.com/1090378") public void testTabRestoredIfKilledWhileActivityStopped() throws Exception { // Ensure the tab is showing before stopping the activity. - TestThreadUtils.runOnUiThreadBlocking(() -> mTab.show(TabSelectionType.FROM_NEW)); + TestThreadUtils.runOnUiThreadBlocking( + () -> mTab.show(TabSelectionType.FROM_NEW, LoadIfNeededCaller.OTHER)); Assert.assertFalse(mTab.needsReload()); Assert.assertFalse(mTab.isHidden());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoPermissionLeakageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoPermissionLeakageTest.java index 0856a36..b309f63 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoPermissionLeakageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoPermissionLeakageTest.java
@@ -43,6 +43,7 @@ import org.chromium.chrome.browser.incognito.IncognitoDataTestUtils.ActivityType; import org.chromium.chrome.browser.incognito.IncognitoDataTestUtils.TestParams; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.TabUtils.LoadIfNeededCaller; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; @@ -105,7 +106,7 @@ private void requestLocationPermission(Tab tab) throws TimeoutException, ExecutionException { // If tab is frozen then getWebContents may return null - TestThreadUtils.runOnUiThreadBlocking(() -> tab.loadIfNeeded()); + TestThreadUtils.runOnUiThreadBlocking(() -> tab.loadIfNeeded(LoadIfNeededCaller.OTHER)); CriteriaHelper.pollUiThread( () -> Criteria.checkThat(tab.getWebContents(), Matchers.notNullValue())); JavaScriptUtils.executeJavaScriptAndWaitForResult(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoStorageLeakageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoStorageLeakageTest.java index d1a2d658..a3ac121 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoStorageLeakageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoStorageLeakageTest.java
@@ -31,6 +31,7 @@ import org.chromium.chrome.browser.incognito.IncognitoDataTestUtils.ActivityType; import org.chromium.chrome.browser.incognito.IncognitoDataTestUtils.TestParams; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.TabUtils.LoadIfNeededCaller; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; @@ -150,7 +151,8 @@ // Due to which tab1 could potentially be marked as frozen and invoking // getWebContents on it may return null. Please see the javadoc for // TabImpl#getWebContents. - TestThreadUtils.runOnUiThreadBlocking(() -> tab1.loadIfNeeded()); + TestThreadUtils.runOnUiThreadBlocking( + () -> tab1.loadIfNeeded(LoadIfNeededCaller.OTHER)); CriteriaHelper.pollUiThread( () -> Criteria.checkThat(tab1.getWebContents(), Matchers.notNullValue())); // Set the storage in tab1 @@ -162,7 +164,8 @@ JavaScriptUtils.runJavascriptWithAsyncResult( tab1.getWebContents(), "has" + type + "()")); - TestThreadUtils.runOnUiThreadBlocking(() -> tab2.loadIfNeeded()); + TestThreadUtils.runOnUiThreadBlocking( + () -> tab2.loadIfNeeded(LoadIfNeededCaller.OTHER)); CriteriaHelper.pollUiThread( () -> Criteria.checkThat(tab2.getWebContents(), Matchers.notNullValue())); // Access the storage from tab2
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/media/PictureInPictureActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/media/PictureInPictureActivityTest.java index 9285a1f..634d3ed 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/media/PictureInPictureActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/media/PictureInPictureActivityTest.java
@@ -10,6 +10,8 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE; + import android.app.Activity; import android.content.Context; import android.content.res.Configuration; @@ -39,6 +41,7 @@ import org.chromium.base.test.util.CriteriaHelper; import org.chromium.base.test.util.JniMocker; import org.chromium.base.test.util.MinAndroidSdkLevel; +import org.chromium.base.test.util.Restriction; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; @@ -138,6 +141,7 @@ @Test @MediumTest @MinAndroidSdkLevel(Build.VERSION_CODES.O) + @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) public void testMakeEnterPictureInPictureWithBadSourceRect() throws Throwable { mSourceRectHint.left = -1; startPictureInPictureActivity(); @@ -148,6 +152,7 @@ @Test @MediumTest @MinAndroidSdkLevel(Build.VERSION_CODES.O) + @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) public void testExitOnBackToTab() throws Throwable { PictureInPictureActivity activity = startPictureInPictureActivity(); Configuration newConfig = activity.getResources().getConfiguration(); @@ -161,6 +166,7 @@ @Test @MediumTest @MinAndroidSdkLevel(Build.VERSION_CODES.O) + @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) public void testResize() throws Throwable { PictureInPictureActivity activity = startPictureInPictureActivity(); // Resize to some reasonable size, and verify that native is told about it.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/FullscreenVideoPictureInPictureControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/FullscreenVideoPictureInPictureControllerTest.java index e808aca..0f07d96 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/FullscreenVideoPictureInPictureControllerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/FullscreenVideoPictureInPictureControllerTest.java
@@ -4,6 +4,8 @@ package org.chromium.chrome.browser.media.ui; +import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE; + import android.os.Build; import android.support.test.InstrumentationRegistry; @@ -22,6 +24,7 @@ import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.FlakyTest; import org.chromium.base.test.util.MinAndroidSdkLevel; +import org.chromium.base.test.util.Restriction; import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.EmptyTabObserver; @@ -81,6 +84,7 @@ @Test @MediumTest @MinAndroidSdkLevel(Build.VERSION_CODES.O) + @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) public void testFullscreenVideoDetectedOnlyWhenPlaying() throws Throwable { enterFullscreen(); @@ -113,6 +117,7 @@ @MediumTest @CommandLineFlags.Add({"enable-features=Portals"}) @MinAndroidSdkLevel(Build.VERSION_CODES.O) + @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) public void testExitPipOnPortalActivation() throws Throwable { testExitOn(() -> JavaScriptUtils.executeJavaScript(getWebContents(), @@ -132,6 +137,7 @@ @Test @MediumTest @MinAndroidSdkLevel(Build.VERSION_CODES.O) + @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) public void testExitOnCloseTab() throws Throwable { // We want 2 Tabs so we can close the first without any special behaviour. mActivityTestRule.loadUrlInNewTab(mTestServer.getURL(TEST_PATH));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerHomepageIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerHomepageIntegrationTest.java index 1c2dd01f..be8f775 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerHomepageIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerHomepageIntegrationTest.java
@@ -164,7 +164,7 @@ InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { tabModel.addObserver(new TabModelObserver() { @Override - public void didCloseTab(Tab tab) { + public void onFinishingTabClosure(Tab tab) { if (tabModel.getCount() == 0) tabClosed.notifyCalled(); } });
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabUmaTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabUmaTest.java index 783ad67a..de7ba10f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabUmaTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabUmaTest.java
@@ -27,6 +27,7 @@ import org.chromium.chrome.browser.TabbedModeTabDelegateFactory; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.share.ShareDelegate; +import org.chromium.chrome.browser.tab.TabUtils.LoadIfNeededCaller; import org.chromium.chrome.browser.ui.RootUiCoordinator; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; @@ -101,7 +102,7 @@ .setDelegateFactory(createTabDelegateFactory()) .setInitiallyHidden(true) .build(); - if (show) bgTab.show(TabSelectionType.FROM_USER); + if (show) bgTab.show(TabSelectionType.FROM_USER, LoadIfNeededCaller.OTHER); return bgTab; }); } @@ -119,7 +120,7 @@ // Simulate the renderer being killed by the OS. if (kill) ChromeTabUtils.simulateRendererKilledForTesting(tab); - tab.show(TabSelectionType.FROM_USER); + tab.show(TabSelectionType.FROM_USER, LoadIfNeededCaller.OTHER); return tab; }); } @@ -139,11 +140,13 @@ int offset = lazyLoadCount.getDelta(); // Show the tab and verify that one sample was recorded in the lazy load bucket. - TestThreadUtils.runOnUiThreadBlocking(() -> { tab.show(TabSelectionType.FROM_USER); }); + TestThreadUtils.runOnUiThreadBlocking( + () -> { tab.show(TabSelectionType.FROM_USER, LoadIfNeededCaller.OTHER); }); Assert.assertEquals(offset + 1, lazyLoadCount.getDelta()); // Show the tab again and verify that we didn't record another sample. - TestThreadUtils.runOnUiThreadBlocking(() -> { tab.show(TabSelectionType.FROM_USER); }); + TestThreadUtils.runOnUiThreadBlocking( + () -> { tab.show(TabSelectionType.FROM_USER, LoadIfNeededCaller.OTHER); }); Assert.assertEquals(offset + 1, lazyLoadCount.getDelta()); } @@ -172,7 +175,8 @@ .build(); }); - TestThreadUtils.runOnUiThreadBlocking(() -> tab.show(TabSelectionType.FROM_USER)); + TestThreadUtils.runOnUiThreadBlocking( + () -> tab.show(TabSelectionType.FROM_USER, LoadIfNeededCaller.OTHER)); // There should be no histogram changes. Assert.assertEquals(switchFgStatusOffset, getHistogram(switchFgStatus)); @@ -230,7 +234,7 @@ .setDelegateFactory(createTabDelegateFactory()) .setTabState(createTabState()) .build(); - tab.show(TabSelectionType.FROM_USER); + tab.show(TabSelectionType.FROM_USER, LoadIfNeededCaller.OTHER); return tab; });
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/UndoTabModelTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/UndoTabModelTest.java index 838a934..88d247292 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/UndoTabModelTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/UndoTabModelTest.java
@@ -174,7 +174,7 @@ } @Override - public void didCloseTab(Tab tab) { + public void onFinishingTabClosure(Tab tab) { mTabClosedCallback.notifyCalled(); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/VoiceToolbarButtonControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/VoiceToolbarButtonControllerTest.java index 44fd115..930baec7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/VoiceToolbarButtonControllerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/VoiceToolbarButtonControllerTest.java
@@ -18,6 +18,7 @@ import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; +import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE; import static org.chromium.ui.test.util.ViewUtils.onViewWaiting; import static org.chromium.ui.test.util.ViewUtils.waitForView; @@ -37,6 +38,7 @@ import org.mockito.junit.MockitoRule; import org.chromium.base.test.util.Batch; +import org.chromium.base.test.util.Restriction; import org.chromium.chrome.R; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.omnibox.LocationBarCoordinator; @@ -117,6 +119,7 @@ @Test @MediumTest + @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) public void testVoiceButtonInToolbarIsDisabledOnNTP() { // Ensure the button starts visible. onView(isRoot()).check(waitForView(allOf(withId(R.id.optional_toolbar_button), @@ -140,6 +143,7 @@ @Test @MediumTest + @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) public void testVoiceButtonDisabledOnIncognito() { // Ensure the button starts visible. onView(isRoot()).check(waitForView(allOf(withId(R.id.optional_toolbar_button), @@ -152,6 +156,7 @@ @Test @MediumTest + @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) public void testVoiceButtonInToolbarIsDisabledDuringModal() { // Ensure the button starts visible. onView(isRoot()).check(waitForView(allOf(withId(R.id.optional_toolbar_button), @@ -192,6 +197,7 @@ @Test @MediumTest + @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) public void testVoiceButtonInToolbarStartsVoiceRecognition() { onViewWaiting(allOf(withId(R.id.optional_toolbar_button), isDisplayed(), isEnabled(), withContentDescription(mButtonString)))
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/ChromeActivityUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/ChromeActivityUnitTest.java index e80635e..fa35835 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/ChromeActivityUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/ChromeActivityUnitTest.java
@@ -16,11 +16,11 @@ import org.robolectric.Robolectric; import org.chromium.base.test.BaseRobolectricTestRunner; -import org.chromium.chrome.R; import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.ui.BottomContainer; import org.chromium.chrome.browser.ui.messages.snackbar.Snackbar; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; +import org.chromium.ui.base.TestActivity; /** * Unit tests for ChromeActivity. @@ -31,8 +31,7 @@ @Before public void setup() { - mActivity = Robolectric.buildActivity(Activity.class).setup().get(); - mActivity.setTheme(R.style.Theme_BrowserUI_DayNight); + mActivity = Robolectric.buildActivity(TestActivity.class).setup().get(); } @Test
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/contextmenu/ContextMenuCoordinatorTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/contextmenu/ContextMenuCoordinatorTest.java index 9040bc62..646be1d 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/contextmenu/ContextMenuCoordinatorTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/contextmenu/ContextMenuCoordinatorTest.java
@@ -52,6 +52,7 @@ import org.chromium.components.embedder_support.contextmenu.ContextMenuParams; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.common.ContentFeatures; +import org.chromium.ui.base.TestActivity; import org.chromium.ui.base.ViewAndroidDelegate; import org.chromium.ui.base.WindowAndroid; import org.chromium.ui.dragdrop.DragStateTracker; @@ -142,8 +143,7 @@ @Before public void setUpTest() { - mActivity = Robolectric.buildActivity(Activity.class).setup().get(); - mActivity.setTheme(R.style.Theme_BrowserUI_DayNight); + mActivity = Robolectric.buildActivity(TestActivity.class).setup().get(); mCoordinator = new ContextMenuCoordinator(TOP_CONTENT_OFFSET_PX, mNativeDelegate); MockitoAnnotations.initMocks(this); mocker.mock(PerformanceHintsObserverJni.TEST_HOOKS, mNativeMock);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/contextmenu/ContextMenuHeaderMediatorTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/contextmenu/ContextMenuHeaderMediatorTest.java index 7cc0741..17f75f57 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/contextmenu/ContextMenuHeaderMediatorTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/contextmenu/ContextMenuHeaderMediatorTest.java
@@ -33,7 +33,6 @@ import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.base.test.util.JniMocker; import org.chromium.blink_public.common.ContextMenuDataMediaType; -import org.chromium.chrome.R; import org.chromium.chrome.browser.performance_hints.PerformanceHintsObserver; import org.chromium.chrome.browser.performance_hints.PerformanceHintsObserver.PerformanceClass; import org.chromium.chrome.browser.performance_hints.PerformanceHintsObserverJni; @@ -42,6 +41,7 @@ import org.chromium.components.embedder_support.contextmenu.ContextMenuParams; import org.chromium.components.favicon.LargeIconBridge; import org.chromium.components.favicon.LargeIconBridgeJni; +import org.chromium.ui.base.TestActivity; import org.chromium.ui.modelutil.PropertyModel; import org.chromium.url.GURL; import org.chromium.url.JUnitTestGURLs; @@ -73,8 +73,7 @@ @Before public void setUpTest() { - mActivity = Robolectric.setupActivity(Activity.class); - mActivity.setTheme(R.style.Theme_BrowserUI_DayNight); + mActivity = Robolectric.setupActivity(TestActivity.class); MockitoAnnotations.initMocks(this); mocker.mock(PerformanceHintsObserverJni.TEST_HOOKS, mMockPerformanceHintsObserverJni); mocker.mock(LargeIconBridgeJni.TEST_HOOKS, mMockLargeIconBridgeJni);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/PartialCustomTabHeightStrategyTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/PartialCustomTabHeightStrategyTest.java index 443aa5c..0aa31981 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/PartialCustomTabHeightStrategyTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/PartialCustomTabHeightStrategyTest.java
@@ -121,6 +121,8 @@ private ViewGroup mContentFrame; @Mock private ViewGroup mCoordinatorLayout; + @Mock + private View mDragBar; private List<WindowManager.LayoutParams> mAttributeResults; private DisplayMetrics mRealMetrics; @@ -137,6 +139,7 @@ when(mActivity.getWindowManager()).thenReturn(mWindowManager); when(mActivity.findViewById(R.id.custom_tabs_handle_view_stub)).thenReturn(mHandleViewStub); when(mActivity.findViewById(R.id.custom_tabs_handle_view)).thenReturn(mHandleView); + when(mActivity.findViewById(R.id.drag_bar)).thenReturn(mDragBar); when(mActivity.findViewById(R.id.coordinator)).thenReturn(mCoordinatorLayout); when(mActivity.findViewById(android.R.id.content)).thenReturn(mContentFrame); when(mHandleView.getLayoutParams()).thenReturn(mLayoutParams); @@ -342,6 +345,27 @@ } @Test + public void showDragHandleOnPortraitMode() { + PartialCustomTabHeightStrategy strategy = createPcctAtHeight(800); + verify(mDragBar).setVisibility(View.VISIBLE); + clearInvocations(mDragBar); + + mConfiguration.orientation = Configuration.ORIENTATION_LANDSCAPE; + strategy.onConfigurationChanged(mConfiguration); + verify(mDragBar).setVisibility(View.GONE); + clearInvocations(mDragBar); + + mConfiguration.orientation = Configuration.ORIENTATION_PORTRAIT; + strategy.onConfigurationChanged(mConfiguration); + verify(mDragBar).setVisibility(View.VISIBLE); + clearInvocations(mDragBar); + + MultiWindowUtils.getInstance().setIsInMultiWindowModeForTesting(true); + strategy.onConfigurationChanged(mConfiguration); + verify(mDragBar).setVisibility(View.GONE); + } + + @Test public void enterMultiwindowModeUnresizable() { PartialCustomTabHeightStrategy strategy = createPcctAtHeight(800);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/multiwindow/MultiInstanceManagerApi31UnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/multiwindow/MultiInstanceManagerApi31UnitTest.java index 4dc1c7c..e123dac3 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/multiwindow/MultiInstanceManagerApi31UnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/multiwindow/MultiInstanceManagerApi31UnitTest.java
@@ -524,7 +524,7 @@ assertEquals(incognitoTabMessage, 1, MultiInstanceManagerApi31.readIncognitoTabCount(INSTANCE_ID_1)); - triggerDidCloseTab(tabModelObserver, mTab1); + triggerOnFinishingTabClosure(tabModelObserver, mTab1); assertEquals(normalTabMessage, 1, MultiInstanceManagerApi31.readTabCount(INSTANCE_ID_1)); assertEquals(incognitoTabMessage, 1, MultiInstanceManagerApi31.readIncognitoTabCount(INSTANCE_ID_1)); @@ -584,7 +584,7 @@ assertEquals("URL should be from the active normal tab", URL2.getSpec(), MultiInstanceManagerApi31.readUrl(INSTANCE_ID_1)); - triggerDidCloseTab(tabModelObserver, mTab1); + triggerOnFinishingTabClosure(tabModelObserver, mTab1); triggerTabRemoved(tabModelObserver, mTab2); assertEquals("Tab count should be zero", 0, MultiInstanceManagerApi31.readTabCount(INSTANCE_ID_1)); @@ -610,13 +610,13 @@ tabModelObserver.didAddTab(tab, 0, 0); } - private void triggerDidCloseTab(TabModelObserver tabModelObserver, Tab tab) { + private void triggerOnFinishingTabClosure(TabModelObserver tabModelObserver, Tab tab) { if (tab.isIncognito()) { mIncognitoTabCount--; } else { mNormalTabCount--; } - tabModelObserver.didCloseTab(tab); + tabModelObserver.onFinishingTabClosure(tab); } private void triggerTabRemoved(TabModelObserver tabModelObserver, Tab tab) {
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/suggestions/tile/TileRendererTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/suggestions/tile/TileRendererTest.java index 01a339b7..51e4f09 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/suggestions/tile/TileRendererTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/suggestions/tile/TileRendererTest.java
@@ -30,7 +30,6 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.robolectric.Robolectric; -import org.robolectric.android.controller.ActivityController; import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowDrawable; @@ -51,6 +50,7 @@ import org.chromium.components.search_engines.TemplateUrlService; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.testing.local.LocalRobolectricTestRunner; +import org.chromium.ui.base.TestActivity; import org.chromium.url.GURL; import org.chromium.url.JUnitTestGURLs; @@ -113,7 +113,6 @@ private ColorStateList mFakeColorStateList; private ShadowPostTaskImpl mPostTaskRunner; - private ActivityController<Activity> mActivityController; private Activity mActivity; private LinearLayout mSharedParent; private final ArgumentCaptor<Drawable> mIconCaptor = ArgumentCaptor.forClass(Drawable.class); @@ -125,10 +124,7 @@ @Before public void setUp() { MockitoAnnotations.initMocks(this); - mActivityController = Robolectric.buildActivity(Activity.class); - mActivityController.setup(); - mActivity = mActivityController.get(); - mActivity.setTheme(R.style.Theme_BrowserUI_DayNight); + mActivity = Robolectric.buildActivity(TestActivity.class).setup().get(); mPostTaskRunner = new ShadowPostTaskImpl(); ShadowPostTask.setTestImpl(mPostTaskRunner);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabModelObserverUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabModelObserverUnitTest.java index ad69434..a552e65 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabModelObserverUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabModelObserverUnitTest.java
@@ -79,7 +79,7 @@ @Test public void testEmpty() { enableBulkTabRestore(true); - mObserver.didCloseTabs(new ArrayList<Tab>()); + mObserver.onFinishingMultipleTabClosure(new ArrayList<Tab>()); verifyNoMoreInteractions(mHistoricalTabSaver); } @@ -87,7 +87,7 @@ @Test public void testEmpty_NoBulkRestore() { enableBulkTabRestore(false); - mObserver.didCloseTabs(new ArrayList<Tab>()); + mObserver.onFinishingMultipleTabClosure(new ArrayList<Tab>()); verifyNoMoreInteractions(mHistoricalTabSaver); } @@ -97,7 +97,7 @@ enableBulkTabRestore(true); MockTab mockTab = createMockTab(0); - mObserver.didCloseTabs(Collections.singletonList(mockTab)); + mObserver.onFinishingMultipleTabClosure(Collections.singletonList(mockTab)); verify(mHistoricalTabSaver, times(1)).createHistoricalTab(eq(mockTab)); } @@ -110,7 +110,7 @@ MockTab mockTab2 = createMockTab(2); Tab[] tabList = new Tab[] {mockTab0, mockTab1, mockTab2}; - mObserver.didCloseTabs(Arrays.asList(tabList)); + mObserver.onFinishingMultipleTabClosure(Arrays.asList(tabList)); ArgumentCaptor<List<HistoricalEntry>> arg = ArgumentCaptor.forClass((Class) List.class); verify(mHistoricalTabSaver, times(1)).createHistoricalBulkClosure(arg.capture()); @@ -134,7 +134,7 @@ MockTab[] tabList = new MockTab[] {mockTab0, mockTab1, mockTab2}; final int groupId = createGroup(title, tabList); - mObserver.didCloseTabs(Arrays.asList(tabList)); + mObserver.onFinishingMultipleTabClosure(Arrays.asList(tabList)); verify(mHistoricalTabSaver, times(1)).createHistoricalTab(eq(mockTab0)); verify(mHistoricalTabSaver, times(1)).createHistoricalTab(eq(mockTab1)); @@ -152,7 +152,7 @@ MockTab[] tabList = new MockTab[] {mockTab0, mockTab1, mockTab2}; final int groupId = createGroup(title, tabList); - mObserver.didCloseTabs(Arrays.asList(tabList)); + mObserver.onFinishingMultipleTabClosure(Arrays.asList(tabList)); // HistoricalTabModelObserver relies on HistoricalTabSaver to simplify to a single group // entry. @@ -183,7 +183,7 @@ when(mSharedPreferences.getString(String.valueOf(groupId), null)).thenReturn(title); MockTab[] tabList = new MockTab[] {mockTab0, mockTab1}; - mObserver.didCloseTabs(Arrays.asList(tabList)); + mObserver.onFinishingMultipleTabClosure(Arrays.asList(tabList)); // HistoricalTabModelObserver relies on HistoricalTabSaver to simplify to a single tab // entry. @@ -220,7 +220,7 @@ final int group2Id = createGroup(group2Title, group2Tabs); Tab[] tabList = new Tab[] {mockTab0, mockTab2, mockTab3, mockTab4, mockTab1, mockTab5}; - mObserver.didCloseTabs(Arrays.asList(tabList)); + mObserver.onFinishingMultipleTabClosure(Arrays.asList(tabList)); // HistoricalTabModelObserver relies on HistoricalTabSaver to simplify to a single group // entry.
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/tabmodel/PendingTabClosureManagerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/tabmodel/PendingTabClosureManagerTest.java index f0b3b264..911014dd 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/tabmodel/PendingTabClosureManagerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/tabmodel/PendingTabClosureManagerTest.java
@@ -104,7 +104,7 @@ public void notifyAllTabsClosureUndone() {} @Override - public void notifyDidCloseTabs(List<Tab> tabs) {} + public void notifyOnFinishingMultipleTabClosure(List<Tab> tabs) {} } FakeTabModel mTabModel; @@ -163,7 +163,8 @@ checkRewoundState(mPendingTabClosureManager, tabList, false); mPendingTabClosureManager.commitTabClosure(tab0.getId()); - delegateInOrder.verify(mDelegate).notifyDidCloseTabs(eq(Arrays.asList(tabList))); + delegateInOrder.verify(mDelegate).notifyOnFinishingMultipleTabClosure( + eq(Arrays.asList(tabList))); delegateInOrder.verify(mDelegate).finalizeClosure(eq(tab0)); checkRewoundState(mPendingTabClosureManager, new Tab[] {}, false); } @@ -206,7 +207,8 @@ // No commits actually occur until later. checkRewoundState(mPendingTabClosureManager, tabList, false); mPendingTabClosureManager.commitTabClosure(tab1.getId()); - delegateInOrder.verify(mDelegate).notifyDidCloseTabs(eq(Arrays.asList(tabList))); + delegateInOrder.verify(mDelegate).notifyOnFinishingMultipleTabClosure( + eq(Arrays.asList(tabList))); delegateInOrder.verify(mDelegate).finalizeClosure(eq(tab1)); delegateInOrder.verify(mDelegate).finalizeClosure(eq(tab0)); checkRewoundState(mPendingTabClosureManager, new Tab[] {}, false); @@ -318,7 +320,7 @@ tabList = new Tab[] {tab0, tab1, tab3}; mPendingTabClosureManager.commitTabClosure(tab4.getId()); checkRewoundState(mPendingTabClosureManager, tabList, true); - delegateInOrder.verify(mDelegate).notifyDidCloseTabs( + delegateInOrder.verify(mDelegate).notifyOnFinishingMultipleTabClosure( eq(Arrays.asList(new Tab[] {tab2, tab4}))); delegateInOrder.verify(mDelegate).finalizeClosure(eq(tab2)); delegateInOrder.verify(mDelegate).finalizeClosure(eq(tab4)); @@ -328,7 +330,8 @@ delegateInOrder.verify(mDelegate).insertUndoneTabClosureAt(eq(tab1), eq(0)); mPendingTabClosureManager.commitTabClosure(tab0.getId()); - delegateInOrder.verify(mDelegate).notifyDidCloseTabs(eq(Collections.singletonList(tab0))); + delegateInOrder.verify(mDelegate).notifyOnFinishingMultipleTabClosure( + eq(Collections.singletonList(tab0))); delegateInOrder.verify(mDelegate).finalizeClosure(eq(tab0)); checkRewoundState(mPendingTabClosureManager, new Tab[] {tab1, tab3}, true); } @@ -363,7 +366,8 @@ // Fully close tab 2. mPendingTabClosureManager.commitTabClosure(tab2.getId()); checkRewoundState(mPendingTabClosureManager, tabList, false); - delegateInOrder.verify(mDelegate).notifyDidCloseTabs(eq(Collections.singletonList(tab2))); + delegateInOrder.verify(mDelegate).notifyOnFinishingMultipleTabClosure( + eq(Collections.singletonList(tab2))); delegateInOrder.verify(mDelegate).finalizeClosure(eq(tab2)); // Restore tab 5. @@ -372,13 +376,15 @@ delegateInOrder.verify(mDelegate).insertUndoneTabClosureAt(eq(tab5), eq(0)); mPendingTabClosureManager.commitAllTabClosures(); - delegateInOrder.verify(mDelegate).notifyDidCloseTabs(eq(Collections.singletonList(tab0))); + delegateInOrder.verify(mDelegate).notifyOnFinishingMultipleTabClosure( + eq(Collections.singletonList(tab0))); delegateInOrder.verify(mDelegate).finalizeClosure(eq(tab0)); - delegateInOrder.verify(mDelegate).notifyDidCloseTabs( + delegateInOrder.verify(mDelegate).notifyOnFinishingMultipleTabClosure( eq(Arrays.asList(new Tab[] {tab1, tab4}))); delegateInOrder.verify(mDelegate).finalizeClosure(eq(tab1)); delegateInOrder.verify(mDelegate).finalizeClosure(eq(tab4)); - delegateInOrder.verify(mDelegate).notifyDidCloseTabs(eq(Collections.singletonList(tab3))); + delegateInOrder.verify(mDelegate).notifyOnFinishingMultipleTabClosure( + eq(Collections.singletonList(tab3))); delegateInOrder.verify(mDelegate).finalizeClosure(eq(tab3)); checkRewoundState(mPendingTabClosureManager, new Tab[] {tab5}, true); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/tabmodel/UndoTabModelUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/tabmodel/UndoTabModelUnitTest.java index bc0ce20..bd29eb5b 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/tabmodel/UndoTabModelUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/tabmodel/UndoTabModelUnitTest.java
@@ -1379,7 +1379,7 @@ /** * Test a {@link TabModel} where undo is not supported and - * {@link TabModelObserver#didCloseTabs()} is called. + * {@link TabModelObserver#onFinishingMultipleTabClosure()} is called. * Action Model List Close List Comprehensive List * 1. Initial State [ 0 1 2 3 4s ] - [ 0 1 2 3 4s ] * 2. CloseTab(1) [ 0 2 3 4s ] - [ 0 2 3 4s ] @@ -1388,7 +1388,7 @@ */ @Test @SmallTest - public void testUndoNotSupportedDidCloseTabs() throws TimeoutException { + public void testUndoNotSupportedOnFinishingMultipleTabClosure() throws TimeoutException { final boolean isIncognito = true; final TabModel model = createTabModel(isIncognito); createTab(model, isIncognito); @@ -1412,7 +1412,7 @@ final ArrayList<Tab> lastClosedTabs = new ArrayList<Tab>(); model.addObserver(new TabModelObserver() { @Override - public void didCloseTabs(List<Tab> tabs) { + public void onFinishingMultipleTabClosure(List<Tab> tabs) { lastClosedTabs.clear(); lastClosedTabs.addAll(tabs); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/usage_stats/PageViewObserverTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/usage_stats/PageViewObserverTest.java index eee86b6b..8b15c51 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/usage_stats/PageViewObserverTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/usage_stats/PageViewObserverTest.java
@@ -36,7 +36,6 @@ import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.Supplier; import org.chromium.base.test.BaseRobolectricTestRunner; -import org.chromium.chrome.R; import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; import org.chromium.chrome.browser.tab.Tab; @@ -46,6 +45,7 @@ import org.chromium.chrome.browser.tab.TabSelectionType; import org.chromium.chrome.browser.tab.TabViewManager; import org.chromium.chrome.browser.tab.TabViewProvider; +import org.chromium.ui.base.TestActivity; import org.chromium.ui.base.WindowAndroid; import org.chromium.url.GURL; import org.chromium.url.JUnitTestGURLs; @@ -119,8 +119,7 @@ mDestroyedUserDataHost = new UserDataHost(); mDestroyedUserDataHost.destroy(); - Activity activity = Robolectric.buildActivity(Activity.class).get(); - activity.setTheme(R.style.Theme_BrowserUI_DayNight); + Activity activity = Robolectric.buildActivity(TestActivity.class).get(); doReturn(false).when(mTab).isIncognito(); doReturn(null).when(mTab).getUrl();
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 6ee33cf..e341545 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -9053,6 +9053,10 @@ desc="Button text for the Screenshot dialog edit button."> Edit </message> + <message name="IDS_BROWSER_SHARING_SCREENSHOT_DIALOG_SEARCH_IMAGE_BUTTON_LABEL" + desc="Button text for the Screenshot dialog search image button."> + Search with Google + </message> <message name="IDS_BROWSER_SHARING_SCREENSHOT_DIALOG_SHARE_BUTTON_LABEL" desc="Button text for the Screenshot dialog share button."> Share
diff --git a/chrome/app/generated_resources_grd/IDS_BROWSER_SHARING_SCREENSHOT_DIALOG_SEARCH_IMAGE_BUTTON_LABEL.png.sha1 b/chrome/app/generated_resources_grd/IDS_BROWSER_SHARING_SCREENSHOT_DIALOG_SEARCH_IMAGE_BUTTON_LABEL.png.sha1 new file mode 100644 index 0000000..6aa7e3ab --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_BROWSER_SHARING_SCREENSHOT_DIALOG_SEARCH_IMAGE_BUTTON_LABEL.png.sha1
@@ -0,0 +1 @@ +193406ee37dbba1ac00127dd327151c847b41672 \ No newline at end of file
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index ed3ba8c6..7182f5c0 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -5147,6 +5147,12 @@ flag_descriptions::kOmniboxMostVisitedTilesDescription, kOsAndroid, FEATURE_VALUE_TYPE(omnibox::kMostVisitedTiles)}, + {"omnibox-remove-suggestion-header-capitalization", + flag_descriptions::kOmniboxRemoveSuggestionHeaderCapitalizationName, + flag_descriptions::kOmniboxRemoveSuggestionHeaderCapitalizationDescription, + kOsAndroid, + FEATURE_VALUE_TYPE(omnibox::kOmniboxRemoveSuggestionHeaderCapitalization)}, + {"omnibox-remove-suggestion-header-chevron", flag_descriptions::kOmniboxRemoveSuggestionHeaderChevronName, flag_descriptions::kOmniboxRemoveSuggestionHeaderChevronDescription,
diff --git a/chrome/browser/android/vr/BUILD.gn b/chrome/browser/android/vr/BUILD.gn index a0519d8..2e2ebe8 100644 --- a/chrome/browser/android/vr/BUILD.gn +++ b/chrome/browser/android/vr/BUILD.gn
@@ -177,6 +177,14 @@ header_output = "$target_gen_dir/${target_name}.h" namespace = "vr" } + + generate_jni_registration("jni_registration_for_testing") { + targets = + [ "//chrome/android:chrome_modern_public_bundle__vr_bundle_module" ] + header_output = "$target_gen_dir/${target_name}.h" + namespace = "vr" + testonly = true + } } group("test_support") { @@ -184,6 +192,7 @@ } test("vr_android_unittests") { + defines = [ "JNI_REGISTRATION_FOR_TESTING" ] sources = [ "arcore_device/arcore_device_unittest.cc", "arcore_device/fake_arcore.cc", @@ -197,7 +206,7 @@ libs = [ "android" ] deps = [ - ":jni_registration", + ":jni_registration_for_testing", ":test_support", ":vr_android", "//base/test:test_support",
diff --git a/chrome/browser/android/vr/register_jni.cc b/chrome/browser/android/vr/register_jni.cc index bfacf816..d999f21a 100644 --- a/chrome/browser/android/vr/register_jni.cc +++ b/chrome/browser/android/vr/register_jni.cc
@@ -5,9 +5,14 @@ #include "chrome/browser/android/vr/register_jni.h" #include "base/android/jni_utils.h" -#include "chrome/browser/android/vr/jni_registration.h" #include "chrome/browser/android/vr/register_gvr_jni.h" +#if defined(JNI_REGISTRATION_FOR_TESTING) +#include "chrome/browser/android/vr/jni_registration_for_testing.h" // nogncheck +#else +#include "chrome/browser/android/vr/jni_registration.h" // nogncheck +#endif // defined(JNI_REGISTRATION_FOR_TESTING) + namespace vr { bool RegisterJni(JNIEnv* env) {
diff --git a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc index 72d48cc..e27e9c6 100644 --- a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc +++ b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc
@@ -4937,6 +4937,20 @@ } /////////////////////////////////////////////////////////////////////////////// +// AutotestPrivateGetDeskCountFunction +/////////////////////////////////////////////////////////////////////////////// + +AutotestPrivateGetDeskCountFunction::AutotestPrivateGetDeskCountFunction() = + default; +AutotestPrivateGetDeskCountFunction::~AutotestPrivateGetDeskCountFunction() = + default; + +ExtensionFunction::ResponseAction AutotestPrivateGetDeskCountFunction::Run() { + return RespondNow( + OneArgument(base::Value(ash::AutotestDesksApi().GetDeskCount()))); +} + +/////////////////////////////////////////////////////////////////////////////// // AutotestPrivateMouseClickFunction ///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.h b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.h index 24d06d7..a23cce0 100644 --- a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.h +++ b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.h
@@ -1305,6 +1305,17 @@ void OnAnimationComplete(); }; +class AutotestPrivateGetDeskCountFunction : public ExtensionFunction { + public: + AutotestPrivateGetDeskCountFunction(); + DECLARE_EXTENSION_FUNCTION("autotestPrivate.getDeskCount", + AUTOTESTPRIVATE_GETDESKCOUNT) + + private: + ~AutotestPrivateGetDeskCountFunction() override; + ResponseAction Run() override; +}; + class AutotestPrivateMouseClickFunction : public ExtensionFunction { public: AutotestPrivateMouseClickFunction();
diff --git a/chrome/browser/download/download_item_model.cc b/chrome/browser/download/download_item_model.cc index 69e492a..d610917 100644 --- a/chrome/browser/download/download_item_model.cc +++ b/chrome/browser/download/download_item_model.cc
@@ -809,12 +809,14 @@ std::string token = safe_browsing::DownloadProtectionService::GetDownloadPingToken( download_); - if (!token.empty()) - report->set_token(token); + if (sb_service) { + if (!token.empty()) + report->set_token(token); - ReportThreatDetailsResult result = - sb_service->SendDownloadReport(profile(), std::move(report)); - DCHECK(result == ReportThreatDetailsResult::SUCCESS); + ReportThreatDetailsResult result = + sb_service->SendDownloadReport(profile(), std::move(report)); + DCHECK(result == ReportThreatDetailsResult::SUCCESS); + } } #endif download_->ValidateDangerousDownload();
diff --git a/chrome/browser/extensions/extension_action_runner.cc b/chrome/browser/extensions/extension_action_runner.cc index 8e43633..43b2913 100644 --- a/chrome/browser/extensions/extension_action_runner.cc +++ b/chrome/browser/extensions/extension_action_runner.cc
@@ -205,6 +205,16 @@ RunBlockedActions(extension); } +void ExtensionActionRunner::HandleUserSiteSettingModified( + const base::flat_set<ToolbarActionsModel::ActionId>& action_ids, + const url::Origin& origin, + PermissionsManager::UserSiteSetting new_site_settings) { + // TODO(crbug.com/1319555): Show reload page bubble when changing user site + // settings needs a page reload. + extensions::PermissionsManager::Get(browser_context_) + ->UpdateUserSiteSetting(origin, new_site_settings); +} + void ExtensionActionRunner::OnActiveTabPermissionGranted( const Extension* extension) { if (ignore_active_tab_granted_)
diff --git a/chrome/browser/extensions/extension_action_runner.h b/chrome/browser/extensions/extension_action_runner.h index 719ea08..a80cec4 100644 --- a/chrome/browser/extensions/extension_action_runner.h +++ b/chrome/browser/extensions/extension_action_runner.h
@@ -78,6 +78,13 @@ SitePermissionsHelper::SiteAccess current_access, SitePermissionsHelper::SiteAccess new_access); + // Notifies the ExtensionActionRunner that the user site setting for `origin` + // with `action_ids` has changed. + void HandleUserSiteSettingModified( + const base::flat_set<ToolbarActionsModel::ActionId>& action_ids, + const url::Origin& origin, + PermissionsManager::UserSiteSetting new_site_settings); + // Notifies the ExtensionActionRunner that an extension has been granted // active tab permissions. This will run any pending injections for that // extension.
diff --git a/chrome/browser/extensions/site_permissions_helper.cc b/chrome/browser/extensions/site_permissions_helper.cc index 05fa3c0..dcd5362 100644 --- a/chrome/browser/extensions/site_permissions_helper.cc +++ b/chrome/browser/extensions/site_permissions_helper.cc
@@ -108,6 +108,22 @@ runner->HandlePageAccessModified(&extension, current_access, new_access); } +void SitePermissionsHelper::UpdateUserSiteSettings( + const base::flat_set<ToolbarActionsModel::ActionId>& action_ids, + content::WebContents* web_contents, + extensions::PermissionsManager::UserSiteSetting site_setting) { + DCHECK(web_contents); + + ExtensionActionRunner* runner = + ExtensionActionRunner::GetForWebContents(web_contents); + if (!runner) + return; + + runner->HandleUserSiteSettingModified( + action_ids, web_contents->GetPrimaryMainFrame()->GetLastCommittedOrigin(), + site_setting); +} + bool SitePermissionsHelper::CanSelectSiteAccess(const Extension& extension, const GURL& url, SiteAccess site_access) const {
diff --git a/chrome/browser/extensions/site_permissions_helper.h b/chrome/browser/extensions/site_permissions_helper.h index c833db1..729d779 100644 --- a/chrome/browser/extensions/site_permissions_helper.h +++ b/chrome/browser/extensions/site_permissions_helper.h
@@ -6,6 +6,8 @@ #define CHROME_BROWSER_EXTENSIONS_SITE_PERMISSIONS_HELPER_H_ #include "base/memory/raw_ptr.h" +#include "chrome/browser/ui/toolbar/toolbar_actions_model.h" +#include "extensions/browser/permissions_manager.h" class Profile; class GURL; @@ -64,6 +66,13 @@ content::WebContents* web_contents, SitePermissionsHelper::SiteAccess new_access); + // Updates the user site settings pointed to by `web_contents` to + // `site_setting` for `action_ids`. + void UpdateUserSiteSettings( + const base::flat_set<ToolbarActionsModel::ActionId>& action_ids, + content::WebContents* web_contents, + PermissionsManager::UserSiteSetting site_setting); + // Returns whether `site_access` option can be selected for `extension` in // `url`. bool CanSelectSiteAccess(const Extension& extension,
diff --git a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedFollowIntroControllerTest.java b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedFollowIntroControllerTest.java index 9728b24..74b694f 100644 --- a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedFollowIntroControllerTest.java +++ b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedFollowIntroControllerTest.java
@@ -39,7 +39,6 @@ import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.base.test.util.JniMocker; import org.chromium.chrome.browser.feature_engagement.TrackerFactory; -import org.chromium.chrome.browser.feed.test.R; import org.chromium.chrome.browser.feed.webfeed.WebFeedSnackbarController.FeedLauncher; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; @@ -55,6 +54,7 @@ import org.chromium.components.prefs.PrefService; import org.chromium.components.user_prefs.UserPrefs; import org.chromium.components.user_prefs.UserPrefsJni; +import org.chromium.ui.base.TestActivity; import org.chromium.ui.modaldialog.ModalDialogManager; import org.chromium.url.GURL; import org.chromium.url.JUnitTestGURLs; @@ -119,9 +119,8 @@ Profile.setLastUsedProfileForTesting(mProfile); Mockito.when(mUserPrefsJniMock.get(mProfile)).thenReturn(mPrefService); - mActivity = Robolectric.setupActivity(Activity.class); // Required for resolving an attribute used in AppMenuItemText. - mActivity.setTheme(R.style.Theme_BrowserUI_DayNight); + mActivity = Robolectric.buildActivity(TestActivity.class).setup().get(); mClock = new FakeClock(); when(mTracker.shouldTriggerHelpUI(FeatureConstants.IPH_WEB_FEED_FOLLOW_FEATURE)) .thenReturn(true);
diff --git a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedMainMenuItemTest.java b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedMainMenuItemTest.java index 2144128..74e233c 100644 --- a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedMainMenuItemTest.java +++ b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedMainMenuItemTest.java
@@ -49,6 +49,7 @@ import org.chromium.components.embedder_support.util.ShadowUrlUtilities; import org.chromium.components.url_formatter.UrlFormatter; import org.chromium.components.url_formatter.UrlFormatterJni; +import org.chromium.ui.base.TestActivity; import org.chromium.ui.modaldialog.ModalDialogManager; import org.chromium.ui.widget.LoadingView; import org.chromium.url.GURL; @@ -108,9 +109,8 @@ doReturn(GURL.emptyGURL()).when(mTab).getOriginalUrl(); doReturn(false).when(mTab).isShowingErrorPage(); - mActivity = Robolectric.setupActivity(Activity.class); // Required for resolving an attribute used in AppMenuItemText. - mActivity.setTheme(R.style.Theme_BrowserUI_DayNight); + mActivity = Robolectric.setupActivity(TestActivity.class); // Add requests for web feed information to mWaitingMetadataCallbacks. doAnswer(invocation -> {
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index b83efe08..c97a75a 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -1146,8 +1146,8 @@ }, { "name": "cups-ipp-printing-backend", - "owners": [ "dhoss", "//printing/OWNERS" ], - "expiry_milestone": 105 + "owners": [ "awscreen", "//printing/OWNERS" ], + "expiry_milestone": 112 }, { "name": "dark-light-mode", @@ -2344,14 +2344,14 @@ "owners": [ "xhwang", "media-dev" ], - "expiry_milestone": 105 + "expiry_milestone": 120 }, { "name": "enable-hardware-secure-decryption-fallback", "owners": [ "xhwang", "media-dev" ], - "expiry_milestone": 105 + "expiry_milestone": 120 }, { "name": "enable-heavy-ad-intervention", @@ -3008,7 +3008,7 @@ { "name": "enable-universal-links", "owners": [ "avi", "olivierli" ], - "expiry_milestone": 105 + "expiry_milestone": 115 }, { "name": "enable-unsafe-webgpu", @@ -3948,7 +3948,7 @@ { "name": "ios-crashpad", "owners": [ "justincohen", "bling-flags@google.com" ], - "expiry_milestone": 105 + "expiry_milestone": 110 }, { "name": "ios-media-permissions-control", @@ -4795,6 +4795,11 @@ "expiry_milestone": 108 }, { + "name": "omnibox-remove-suggestion-header-capitalization", + "owners": [ "rongtan", "ender", "chrome-omnibox-team@google.com" ], + "expiry_milestone": 110 + }, + { "name": "omnibox-remove-suggestion-header-chevron", "owners": [ "rongtan", "ender", "chrome-omnibox-team@google.com" ], "expiry_milestone": 110 @@ -5385,7 +5390,7 @@ { "name": "read-printer-capabilities-with-xps", "owners": [ "awscreen", "//printing/OWNERS" ], - "expiry_milestone": 106 + "expiry_milestone": 112 }, { "name": "reader-mode-heuristics", @@ -6547,7 +6552,7 @@ { "name": "web-otp-backend", "owners": [ "yigu" ], - "expiry_milestone": 105 + "expiry_milestone": 110 }, { "name": "web-share",
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index cc685c8..5b35813 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -1921,6 +1921,11 @@ "Permits longer MV Tiles titles to wrap around to the second line " "to reduce ellipsizing longer titles."; +const char kOmniboxRemoveSuggestionHeaderCapitalizationName[] = + "Omnibox Remove Suggestion Header Capitalization"; +const char kOmniboxRemoveSuggestionHeaderCapitalizationDescription[] = + "Remove the capitalization of the omnibox suggestion search header."; + const char kOmniboxRemoveSuggestionHeaderChevronName[] = "Omnibox Remove Suggestion Header Chevron"; const char kOmniboxRemoveSuggestionHeaderChevronDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index cf45b26c..4c819d1 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -1095,6 +1095,9 @@ extern const char kOmniboxRemoveSuggestionHeaderChevronName[]; extern const char kOmniboxRemoveSuggestionHeaderChevronDescription[]; +extern const char kOmniboxRemoveSuggestionHeaderCapitalizationName[]; +extern const char kOmniboxRemoveSuggestionHeaderCapitalizationDescription[]; + extern const char kOmniboxRichAutocompletionPromisingName[]; extern const char kOmniboxRichAutocompletionPromisingDescription[];
diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc index 031dccf..7ed7921 100644 --- a/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chrome/browser/flags/android/chrome_feature_list.cc
@@ -351,6 +351,7 @@ &omnibox::kMostVisitedTiles, &omnibox::kMostVisitedTilesTitleWrapAround, &omnibox::kOmniboxAssistantVoiceSearch, + &omnibox::kOmniboxRemoveSuggestionHeaderCapitalization, &omnibox::kOmniboxRemoveSuggestionHeaderChevron, &omnibox::kSuggestionAnswersColorReverse, &omnibox::kUpdatedConnectionSecurityIndicators,
diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFeatureFlags.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFeatureFlags.java index 7884d9df..2d6e2f5 100644 --- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFeatureFlags.java +++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFeatureFlags.java
@@ -85,6 +85,7 @@ .put(ChromeFeatureList.OPTIMIZATION_GUIDE_PUSH_NOTIFICATIONS, false) .put(ChromeFeatureList.PAINT_PREVIEW_DEMO, false) .put(ChromeFeatureList.PAINT_PREVIEW_SHOW_ON_STARTUP, false) + .put(ChromeFeatureList.QUERY_TILES, false) .put(ChromeFeatureList.PREFETCH_NOTIFICATION_SCHEDULING_INTEGRATION, false) .put(ChromeFeatureList.READ_LATER, false) .put(ChromeFeatureList.START_SURFACE_ANDROID, false)
diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java index b7af539..3f91f08 100644 --- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java +++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java
@@ -435,6 +435,8 @@ "OmniboxMostVisitedTilesTitleWrapAround"; public static final String OMNIBOX_REMOVE_SUGGESTION_HEADER_CHEVRON = "OmniboxRemoveSuggestionHeaderChevron"; + public static final String OMNIBOX_REMOVE_SUGGESTION_HEADER_CAPITALIZATION = + "OmniboxRemoveSuggestionHeaderCapitalization"; public static final String OMNIBOX_UPDATED_CONNECTION_SECURITY_INDICATORS = "OmniboxUpdatedConnectionSecurityIndicators"; public static final String OPTIMIZATION_GUIDE_PUSH_NOTIFICATIONS = @@ -657,6 +659,7 @@ new CachedFlag(PAINT_PREVIEW_SHOW_ON_STARTUP, false); public static final CachedFlag sPrefetchNotificationSchedulingIntegration = new CachedFlag(PREFETCH_NOTIFICATION_SCHEDULING_INTEGRATION, false); + public static final CachedFlag sQueryTiles = new CachedFlag(QUERY_TILES, false); public static final CachedFlag sReadLater = new CachedFlag(READ_LATER, false); public static final CachedFlag sStartSurfaceAndroid = new CachedFlag(START_SURFACE_ANDROID, false);
diff --git a/chrome/browser/media/library_cdm_test_helper.cc b/chrome/browser/media/library_cdm_test_helper.cc index d2702c3..d6f189b5 100644 --- a/chrome/browser/media/library_cdm_test_helper.cc +++ b/chrome/browser/media/library_cdm_test_helper.cc
@@ -4,12 +4,12 @@ #include "chrome/browser/media/library_cdm_test_helper.h" +#include <string> + #include "base/command_line.h" -#include "base/logging.h" +#include "base/files/file_path.h" #include "base/native_library.h" #include "base/path_service.h" -#include "base/token.h" -#include "content/public/common/cdm_info.h" #include "media/base/media_switches.h" #include "media/cdm/cdm_paths.h"
diff --git a/chrome/browser/media/library_cdm_test_helper.h b/chrome/browser/media/library_cdm_test_helper.h index 65723ccd..5027f578 100644 --- a/chrome/browser/media/library_cdm_test_helper.h +++ b/chrome/browser/media/library_cdm_test_helper.h
@@ -7,13 +7,10 @@ namespace base { class CommandLine; -class Token; } // Registers ClearKeyCdm in |command_line|. void RegisterClearKeyCdm(base::CommandLine* command_line, bool use_wrong_cdm_path = false); -bool IsLibraryCdmRegistered(const base::Token& cdm_type); - #endif // CHROME_BROWSER_MEDIA_LIBRARY_CDM_TEST_HELPER_H_
diff --git a/chrome/browser/platform_util.h b/chrome/browser/platform_util.h index 0318964d..db7d51fd 100644 --- a/chrome/browser/platform_util.h +++ b/chrome/browser/platform_util.h
@@ -95,9 +95,9 @@ bool IsVisible(gfx::NativeView view); #if BUILDFLAG(IS_MAC) -// On 10.7+, back and forward swipe gestures can be triggered using a scroll -// gesture, if enabled in System Preferences. This function returns true if -// the feature is supported and enabled, and false otherwise. +// On the Mac, back and forward swipe gestures can be triggered using a scroll +// gesture, if enabled in System Preferences. This function returns true if the +// feature is enabled, and false otherwise. bool IsSwipeTrackingFromScrollEventsEnabled(); // Returns the active window which accepts keyboard inputs.
diff --git a/chrome/browser/platform_util_mac.mm b/chrome/browser/platform_util_mac.mm index 2e154a4..31835c7 100644 --- a/chrome/browser/platform_util_mac.mm +++ b/chrome/browser/platform_util_mac.mm
@@ -133,9 +133,7 @@ } bool IsSwipeTrackingFromScrollEventsEnabled() { - SEL selector = @selector(isSwipeTrackingFromScrollEventsEnabled); - return [NSEvent respondsToSelector:selector] - && [NSEvent performSelector:selector]; + return NSEvent.swipeTrackingFromScrollEventsEnabled; } NSWindow* GetActiveWindow() {
diff --git a/chrome/browser/query_tiles/query_tile_utils.cc b/chrome/browser/query_tiles/query_tile_utils.cc index 89b2f31..f721507 100644 --- a/chrome/browser/query_tiles/query_tile_utils.cc +++ b/chrome/browser/query_tiles/query_tile_utils.cc
@@ -47,9 +47,7 @@ query_tiles::features::kQueryTilesDisableCountryOverride) && query_tiles::features::IsQueryTilesEnabledForCountry( GetCountryCode())) || - (base::FeatureList::IsEnabled(query_tiles::features::kQueryTiles) && - base::FeatureList::IsEnabled( - query_tiles::features::kQueryTilesInNTP)); + base::FeatureList::IsEnabled(query_tiles::features::kQueryTiles); } #if BUILDFLAG(IS_ANDROID)
diff --git a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper.mm b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper.mm index ef99f25..5d3952d 100644 --- a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper.mm +++ b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper.mm
@@ -351,12 +351,6 @@ return finished; } -- (BOOL)isEventDirectionInverted:(NSEvent*)event { - if ([event respondsToSelector:@selector(isDirectionInvertedFromDevice)]) - return [event isDirectionInvertedFromDevice]; - return NO; -} - - (void)showHistoryOverlay:(history_swiper::NavigationDirection)direction { // We cannot make any assumptions about the current state of the // historyOverlay_, since users may attempt to use multiple gesture input @@ -371,13 +365,6 @@ _historyOverlay = historyOverlay; } -- (BOOL)systemSettingsAllowHistorySwiping:(NSEvent*)event { - if ([NSEvent - respondsToSelector:@selector(isSwipeTrackingFromScrollEventsEnabled)]) - return [NSEvent isSwipeTrackingFromScrollEventsEnabled]; - return NO; -} - - (void)navigateBrowserInDirection: (history_swiper::NavigationDirection)direction { Browser* browser = chrome::FindBrowserWithWindow( @@ -503,9 +490,6 @@ } - (BOOL)handleScrollWheelEvent:(NSEvent*)theEvent { - if (![theEvent respondsToSelector:@selector(phase)]) - return NO; - // The only events that this class consumes have type NSEventPhaseChanged. // This simultaneously weeds our regular mouse wheel scroll events, and // gesture events with incorrect phase. @@ -523,8 +507,7 @@ if ([theEvent momentumPhase] != NSEventPhaseNone) return NO; - BOOL systemSettingsValid = [self systemSettingsAllowHistorySwiping:theEvent]; - if (!systemSettingsValid) + if (!NSEvent.swipeTrackingFromScrollEventsEnabled) return NO; if (![_delegate shouldAllowHistorySwiping]) @@ -560,8 +543,7 @@ return NO; BOOL isRightScroll = xDelta > 0; - BOOL inverted = [self isEventDirectionInverted:theEvent]; - if (inverted) + if (theEvent.directionInvertedFromDevice) isRightScroll = !isRightScroll; history_swiper::NavigationDirection direction = @@ -572,7 +554,7 @@ return NO; _historySwipeDirection = direction; - _historySwipeDirectionInverted = [self isEventDirectionInverted:theEvent]; + _historySwipeDirectionInverted = theEvent.directionInvertedFromDevice; _recognitionState = history_swiper::kPotential; [self showHistoryOverlay:direction]; return [self shouldConsumeWheelEvent:theEvent];
diff --git a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm index 8547c4c..b53723c 100644 --- a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm +++ b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm
@@ -132,12 +132,6 @@ return GetScriptIntValue("document.body.scrollTop"); } - bool IsHistorySwipingSupported() { - // These tests require 10.7+ APIs. - return [NSEvent - respondsToSelector:@selector(isSwipeTrackingFromScrollEventsEnabled)]; - } - // Create mock events -------------------------------------------------------- // Create a gesture event with no useful data. Used to create Begin and End @@ -400,9 +394,6 @@ // recording a real swipe. IN_PROC_BROWSER_TEST_F(ChromeRenderWidgetHostViewMacHistorySwiperTest, DISABLED_TestBackwardsHistoryNavigationRealData) { - if (!IsHistorySwipingSupported()) - return; - QueueTouch(0.510681, 0.444672, DEPLOYMENT_TOUCHES_BEGAN, NSEventTypeGesture, NSEventSubtypeMouseEvent, NO); QueueTrackpadScroll(0, 0, NSEventPhaseMayBegin, YES); @@ -516,9 +507,6 @@ // http://crbug.com/396328 IN_PROC_BROWSER_TEST_F(ChromeRenderWidgetHostViewMacHistorySwiperTest, DISABLED_TestAllDiagonalSwipes) { - if (!IsHistorySwipingSupported()) - return; - QueueBeginningEvents(1, -1); for (int i = 0; i < 150; ++i) QueueScrollAndTouchMoved(1, -1); @@ -534,9 +522,6 @@ // not trigger history navigation. IN_PROC_BROWSER_TEST_F(ChromeRenderWidgetHostViewMacHistorySwiperTest, DISABLED_TestStaggeredDiagonalSwipe) { - if (!IsHistorySwipingSupported()) - return; - QueueBeginningEvents(1, 0); for (int i = 0; i < 150; ++i) { switch (i % 3) { @@ -578,9 +563,6 @@ // trigger a history swipe. This should trigger history navigation. IN_PROC_BROWSER_TEST_F(ChromeRenderWidgetHostViewMacHistorySwiperTest, DISABLED_TestMostlyHorizontal) { - if (!IsHistorySwipingSupported()) - return; - QueueBeginningEvents(1, 1); for (int i = 0; i < 150; ++i) { if (i % 10 == 0) { @@ -604,9 +586,6 @@ // crbug.com/375512 IN_PROC_BROWSER_TEST_F(ChromeRenderWidgetHostViewMacHistorySwiperTest, DISABLED_TestAllHorizontalButFirst) { - if (!IsHistorySwipingSupported()) - return; - QueueBeginningEvents(0, -1); QueueScrollAndTouchMoved(0, -1); for (int i = 0; i < 149; ++i) @@ -621,9 +600,6 @@ // are horizontal, and should not trigger history swiping. IN_PROC_BROWSER_TEST_F(ChromeRenderWidgetHostViewMacHistorySwiperTest, DISABLED_TestIframeHistorySwiping) { - if (!IsHistorySwipingSupported()) - return; - ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url_iframe_)); ASSERT_EQ(url_iframe_, GetWebContents()->GetURL()); @@ -656,9 +632,6 @@ // The gesture ends before the touchesEndedWithEvent: method gets called. IN_PROC_BROWSER_TEST_F(ChromeRenderWidgetHostViewMacHistorySwiperTest, DISABLED_TestGestureEndTiming) { - if (!IsHistorySwipingSupported()) - return; - QueueBeginningEvents(1, 0); for (int i = 0; i < 150; ++i) QueueScrollAndTouchMoved(1, 0); @@ -678,9 +651,6 @@ IN_PROC_BROWSER_TEST_F( ChromeRenderWidgetHostViewMacHistorySwiperTest, DISABLED_InnerScrollersOverscrollBehaviorPreventsNavigation) { - if (!IsHistorySwipingSupported()) - return; - const base::FilePath base_path(FILE_PATH_LITERAL("scroll")); GURL url_overscroll_behavior = ui_test_utils::GetTestUrl( base_path, base::FilePath(FILE_PATH_LITERAL("overscroll_behavior.html")));
diff --git a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_unit_test.mm b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_unit_test.mm index e3e0657..40927077 100644 --- a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_unit_test.mm +++ b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_unit_test.mm
@@ -14,7 +14,6 @@ #include "ui/events/blink/did_overscroll_params.h" @interface HistorySwiper (MacHistorySwiperTest) -- (BOOL)systemSettingsAllowHistorySwiping:(NSEvent*)event; - (BOOL)browserCanNavigateInDirection: (history_swiper::NavigationDirection)forward event:(NSEvent*)event; @@ -42,8 +41,6 @@ [[HistorySwiper alloc] initWithDelegate:mockDelegate]); id mockHistorySwiper = [OCMockObject partialMockForObject:historySwiper]; [[[mockHistorySwiper stub] andReturnBool:YES] - systemSettingsAllowHistorySwiping:[OCMArg any]]; - [[[mockHistorySwiper stub] andReturnBool:YES] browserCanNavigateInDirection:history_swiper::kForwards event:[OCMArg any]]; [[[mockHistorySwiper stub] andReturnBool:YES] @@ -225,11 +222,6 @@ // Test that a simple left-swipe causes navigation. TEST_F(MacHistorySwiperTest, SwipeLeft) { - // These tests require 10.7+ APIs. - if (![NSEvent - respondsToSelector:@selector(isSwipeTrackingFromScrollEventsEnabled)]) - return; - startGestureInMiddle(); moveGestureInMiddle(); onOverscrolled(cc::OverscrollBehavior::Type::kAuto); @@ -252,11 +244,6 @@ // Test that a simple right-swipe causes navigation. TEST_F(MacHistorySwiperTest, SwipeRight) { - // These tests require 10.7+ APIs. - if (![NSEvent - respondsToSelector:@selector(isSwipeTrackingFromScrollEventsEnabled)]) - return; - startGestureInMiddle(); moveGestureInMiddle(); onOverscrolled(cc::OverscrollBehavior::Type::kAuto); @@ -280,11 +267,6 @@ // If the user doesn't swipe enough, the history swiper should begin, but the // browser should not navigate. TEST_F(MacHistorySwiperTest, SwipeLeftSmallAmount) { - // These tests require 10.7+ APIs. - if (![NSEvent - respondsToSelector:@selector(isSwipeTrackingFromScrollEventsEnabled)]) - return; - startGestureInMiddle(); moveGestureInMiddle(); onOverscrolled(cc::OverscrollBehavior::Type::kAuto); @@ -299,11 +281,6 @@ // Diagonal swipes with a slight horizontal bias should not start the history // swiper. TEST_F(MacHistorySwiperTest, SwipeDiagonal) { - // These tests require 10.7+ APIs. - if (![NSEvent - respondsToSelector:@selector(isSwipeTrackingFromScrollEventsEnabled)]) - return; - startGestureInMiddle(); moveGestureInMiddle(); onOverscrolled(cc::OverscrollBehavior::Type::kAuto); @@ -320,11 +297,6 @@ // Swiping left and then down should cancel the history swiper without // navigating. TEST_F(MacHistorySwiperTest, SwipeLeftThenDown) { - // These tests require 10.7+ APIs. - if (![NSEvent - respondsToSelector:@selector(isSwipeTrackingFromScrollEventsEnabled)]) - return; - startGestureInMiddle(); moveGestureInMiddle(); onOverscrolled(cc::OverscrollBehavior::Type::kAuto); @@ -340,11 +312,6 @@ // Sometimes Cocoa gets confused and sends us a momentum swipe event instead of // a swipe gesture event. Momentum events should not cause history swiping. TEST_F(MacHistorySwiperTest, MomentumSwipeLeft) { - // These tests require 10.7+ APIs. - if (![NSEvent - respondsToSelector:@selector(isSwipeTrackingFromScrollEventsEnabled)]) - return; - startGestureInMiddle(); // Send a momentum move gesture. @@ -368,11 +335,6 @@ // Momentum scroll events for magic mouse should not attempt to trigger the // `trackSwipeEventWithOptions:` api, as that throws an exception. TEST_F(MacHistorySwiperTest, MagicMouseMomentumSwipe) { - // These tests require 10.7+ APIs. - if (![NSEvent - respondsToSelector:@selector(isSwipeTrackingFromScrollEventsEnabled)]) - return; - // Magic mouse events don't generate 'touches*' callbacks. NSEvent* event = mockEventWithPoint(makePoint(0.5, 0.5), NSEventTypeGesture); [historySwiper_ beginGestureWithEvent:event]; @@ -393,11 +355,6 @@ // User starts a swipe but doesn't move. TEST_F(MacHistorySwiperTest, NoSwipe) { - // These tests require 10.7+ APIs. - if (![NSEvent - respondsToSelector:@selector(isSwipeTrackingFromScrollEventsEnabled)]) - return; - startGestureInMiddle(); moveGestureInMiddle(); onOverscrolled(cc::OverscrollBehavior::Type::kAuto); @@ -417,11 +374,6 @@ // After a gesture is successfully recognized, momentum events should be // swallowed, but new events should pass through. TEST_F(MacHistorySwiperTest, TouchEventAfterGestureFinishes) { - // These tests require 10.7+ APIs. - if (![NSEvent - respondsToSelector:@selector(isSwipeTrackingFromScrollEventsEnabled)]) - return; - // Successfully pass through a gesture. startGestureInMiddle(); moveGestureInMiddle(); @@ -443,11 +395,6 @@ // The history swipe logic should be resilient against the timing of the // different callbacks that result from scrolling. TEST_F(MacHistorySwiperTest, SwipeRightEventOrdering) { - // These tests require 10.7+ APIs. - if (![NSEvent - respondsToSelector:@selector(isSwipeTrackingFromScrollEventsEnabled)]) - return; - // Touches began. NSEvent* scrollEvent = scrollWheelEventWithPhase(NSEventPhaseBegan); NSEvent* event = mockEventWithPoint(makePoint(0.5, 0.5), NSEventTypeGesture); @@ -485,11 +432,6 @@ // Substantial vertical scrolling followed by horizontal scrolling should not // result in navigation. TEST_F(MacHistorySwiperTest, SubstantialVerticalThenHorizontal) { - // These tests require 10.7+ APIs. - if (![NSEvent - respondsToSelector:@selector(isSwipeTrackingFromScrollEventsEnabled)]) - return; - startGestureInMiddle(); moveGestureInMiddle(); onOverscrolled(cc::OverscrollBehavior::Type::kAuto); @@ -514,11 +456,6 @@ // swiper should still handle this gracefully. It should not turn vertical // motion into history swipes. TEST_F(MacHistorySwiperTest, MagicMouseStateResetsCorrectly) { - // These tests require 10.7+ APIs. - if (![NSEvent - respondsToSelector:@selector(isSwipeTrackingFromScrollEventsEnabled)]) - return; - // Magic mouse events don't generate '-touches*WithEvent:' callbacks. // Send the following events: // - beginGesture @@ -570,11 +507,6 @@ // With overscroll-behavior value as contain, the page should not navigate, // nor should the history overlay appear. TEST_F(MacHistorySwiperTest, OverscrollBehaviorContainPreventsNavigation) { - // These tests require 10.7+ APIs. - if (![NSEvent - respondsToSelector:@selector(isSwipeTrackingFromScrollEventsEnabled)]) - return; - startGestureInMiddle(); moveGestureInMiddle();
diff --git a/chrome/browser/subresource_filter/ad_tagging_browsertest.cc b/chrome/browser/subresource_filter/ad_tagging_browsertest.cc index a58c5c1..22addffb 100644 --- a/chrome/browser/subresource_filter/ad_tagging_browsertest.cc +++ b/chrome/browser/subresource_filter/ad_tagging_browsertest.cc
@@ -300,17 +300,17 @@ GURL ad_url = GetURL("frame_factory.html?2&ad=true"); RenderFrameHost* ad_frame = CreateSrcFrame(GetWebContents(), ad_url); - // Verify that we are not evaluating subframe loads. - EXPECT_FALSE(observer.GetSubframeLoadPolicy(ad_url).has_value()); - EXPECT_FALSE(observer.GetIsAdSubframe(ad_frame->GetFrameTreeNodeId())); + // Verify that we are not evaluating child frame loads. + EXPECT_FALSE(observer.GetChildFrameLoadPolicy(ad_url).has_value()); + EXPECT_FALSE(observer.GetIsAdFrame(ad_frame->GetFrameTreeNodeId())); // Child frame created by ad script. RenderFrameHost* ad_frame_tagged_by_script = CreateSrcFrameFromAdScript( GetWebContents(), GetURL("frame_factory.html?1")); // No frames should be detected by script heuristics. - EXPECT_FALSE(observer.GetIsAdSubframe( - ad_frame_tagged_by_script->GetFrameTreeNodeId())); + EXPECT_FALSE( + observer.GetIsAdFrame(ad_frame_tagged_by_script->GetFrameTreeNodeId())); } IN_PROC_BROWSER_TEST_F(AdTaggingBrowserTest, @@ -328,17 +328,17 @@ GURL ad_url = GetURL("frame_factory.html?2&ad=true"); RenderFrameHost* ad_frame = CreateSrcFrame(GetWebContents(), ad_url); - // Verify that we are evaluating subframe loads. - EXPECT_TRUE(observer.GetSubframeLoadPolicy(ad_url).has_value()); - EXPECT_TRUE(observer.GetIsAdSubframe(ad_frame->GetFrameTreeNodeId())); + // Verify that we are evaluating child frame loads. + EXPECT_TRUE(observer.GetChildFrameLoadPolicy(ad_url).has_value()); + EXPECT_TRUE(observer.GetIsAdFrame(ad_frame->GetFrameTreeNodeId())); // Child frame created by ad script. RenderFrameHost* ad_frame_tagged_by_script = CreateSrcFrameFromAdScript( GetWebContents(), GetURL("frame_factory.html?1")); // Frames should be detected by script heuristics. - EXPECT_TRUE(observer.GetIsAdSubframe( - ad_frame_tagged_by_script->GetFrameTreeNodeId())); + EXPECT_TRUE( + observer.GetIsAdFrame(ad_frame_tagged_by_script->GetFrameTreeNodeId())); } IN_PROC_BROWSER_TEST_F(AdTaggingBrowserTest, FramesByURL) { @@ -347,18 +347,18 @@ // Main frame. ASSERT_TRUE( ui_test_utils::NavigateToURL(browser(), GetURL("frame_factory.html"))); - EXPECT_FALSE(observer.GetIsAdSubframe( + EXPECT_FALSE(observer.GetIsAdFrame( GetWebContents()->GetPrimaryMainFrame()->GetFrameTreeNodeId())); // (1) Vanilla child. content::RenderFrameHost* vanilla_child = CreateSrcFrame(GetWebContents(), GetURL("frame_factory.html?1")); - EXPECT_FALSE(observer.GetIsAdSubframe(vanilla_child->GetFrameTreeNodeId())); + EXPECT_FALSE(observer.GetIsAdFrame(vanilla_child->GetFrameTreeNodeId())); // (2) Ad child. RenderFrameHost* ad_child = CreateSrcFrame(GetWebContents(), GetURL("frame_factory.html?2&ad=true")); - EXPECT_TRUE(observer.GetIsAdSubframe(ad_child->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(ad_child->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( ad_child, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kMatchedBlockingRule, @@ -367,7 +367,7 @@ // (3) Ad child of 2. RenderFrameHost* ad_child_2 = CreateSrcFrame(ad_child, GetURL("frame_factory.html?sub=1&3&ad=true")); - EXPECT_TRUE(observer.GetIsAdSubframe(ad_child_2->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(ad_child_2->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( ad_child_2, /*parent_is_ad=*/true, blink::mojom::FilterListResult::kMatchedBlockingRule, @@ -376,7 +376,7 @@ // (4) Vanilla child of 2. RenderFrameHost* vanilla_child_2 = CreateSrcFrame(ad_child, GetURL("frame_factory.html?4")); - EXPECT_TRUE(observer.GetIsAdSubframe(vanilla_child_2->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(vanilla_child_2->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( vanilla_child_2, /*parent_is_ad=*/true, blink::mojom::FilterListResult::kMatchedNoRules, @@ -389,7 +389,7 @@ // it's able to create an iframe that's not labeled as an ad. RenderFrameHost* vanilla_child_3 = CreateSrcFrame(vanilla_child, GetURL("frame_factory.html?5")); - EXPECT_FALSE(observer.GetIsAdSubframe(vanilla_child_3->GetFrameTreeNodeId())); + EXPECT_FALSE(observer.GetIsAdFrame(vanilla_child_3->GetFrameTreeNodeId())); } const char kSubresourceFilterOriginStatusHistogram[] = @@ -506,7 +506,7 @@ // Child frame created by ad script. RenderFrameHost* ad_child = CreateSrcFrameFromAdScript( GetWebContents(), GetURL("frame_factory.html?1")); - EXPECT_TRUE(observer.GetIsAdSubframe(ad_child->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(ad_child->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( ad_child, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kMatchedNoRules, @@ -524,7 +524,7 @@ // (1) Vanilla child. content::RenderFrameHost* vanilla_frame = CreateDocWrittenFrame(GetWebContents()); - EXPECT_FALSE(observer.GetIsAdSubframe(vanilla_frame->GetFrameTreeNodeId())); + EXPECT_FALSE(observer.GetIsAdFrame(vanilla_frame->GetFrameTreeNodeId())); // (2) Ad child. content::RenderFrameHost* ad_frame = @@ -548,17 +548,16 @@ // Vanilla frame and descendants content::RenderFrameHost* vanilla_frame = CreateDocWrittenFrame(GetWebContents()); - EXPECT_FALSE(observer.GetIsAdSubframe(vanilla_frame->GetFrameTreeNodeId())); + EXPECT_FALSE(observer.GetIsAdFrame(vanilla_frame->GetFrameTreeNodeId())); content::RenderFrameHost* vanilla_child_of_vanilla = CreateSrcFrame(vanilla_frame, GetURL("frame_factory.html")); EXPECT_FALSE( - observer.GetIsAdSubframe(vanilla_child_of_vanilla->GetFrameTreeNodeId())); + observer.GetIsAdFrame(vanilla_child_of_vanilla->GetFrameTreeNodeId())); content::RenderFrameHost* ad_child_of_vanilla = CreateSrcFrameFromAdScript(vanilla_frame, GetURL("frame_factory.html")); - EXPECT_TRUE( - observer.GetIsAdSubframe(ad_child_of_vanilla->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(ad_child_of_vanilla->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( ad_child_of_vanilla, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kMatchedNoRules, @@ -574,8 +573,7 @@ content::RenderFrameHost* vanilla_child_of_ad = CreateSrcFrame(ad_frame, GetURL("frame_factory.html")); - EXPECT_TRUE( - observer.GetIsAdSubframe(vanilla_child_of_ad->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(vanilla_child_of_ad->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( vanilla_child_of_ad, /*parent_is_ad=*/true, blink::mojom::FilterListResult::kMatchedNoRules, @@ -583,7 +581,7 @@ content::RenderFrameHost* ad_child_of_ad = CreateSrcFrameFromAdScript(ad_frame, GetURL("frame_factory.html")); - EXPECT_TRUE(observer.GetIsAdSubframe(ad_child_of_ad->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(ad_child_of_ad->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( ad_child_of_ad, /*parent_is_ad=*/true, blink::mojom::FilterListResult::kMatchedNoRules, @@ -603,14 +601,14 @@ // Vanilla child. content::RenderFrameHost* vanilla_frame_with_aborted_load = CreateFrameWithDocWriteAbortedLoad(GetWebContents()); - EXPECT_FALSE(observer.GetIsAdSubframe( + EXPECT_FALSE(observer.GetIsAdFrame( vanilla_frame_with_aborted_load->GetFrameTreeNodeId())); // Child created by ad script. content::RenderFrameHost* ad_frame_with_aborted_load = CreateFrameWithDocWriteAbortedLoadFromAdScript(GetWebContents()); - EXPECT_TRUE(observer.GetIsAdSubframe( - ad_frame_with_aborted_load->GetFrameTreeNodeId())); + EXPECT_TRUE( + observer.GetIsAdFrame(ad_frame_with_aborted_load->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( ad_frame_with_aborted_load, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kNotChecked, @@ -621,8 +619,8 @@ GetWebContents(), GetURL("frame_factory.html")); content::RenderFrameHost* child_frame_of_ad_with_aborted_load = CreateFrameWithDocWriteAbortedLoad(ad_frame); - EXPECT_TRUE(observer.GetIsAdSubframe(ad_frame->GetFrameTreeNodeId())); - EXPECT_TRUE(observer.GetIsAdSubframe( + EXPECT_TRUE(observer.GetIsAdFrame(ad_frame->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame( child_frame_of_ad_with_aborted_load->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( child_frame_of_ad_with_aborted_load, @@ -643,14 +641,14 @@ // Vanilla child. content::RenderFrameHost* vanilla_frame_with_aborted_load = CreateFrameWithWindowStopAbortedLoad(GetWebContents()); - EXPECT_FALSE(observer.GetIsAdSubframe( + EXPECT_FALSE(observer.GetIsAdFrame( vanilla_frame_with_aborted_load->GetFrameTreeNodeId())); // Child created by ad script. content::RenderFrameHost* ad_frame_with_aborted_load = CreateFrameWithWindowStopAbortedLoadFromAdScript(GetWebContents()); - EXPECT_TRUE(observer.GetIsAdSubframe( - ad_frame_with_aborted_load->GetFrameTreeNodeId())); + EXPECT_TRUE( + observer.GetIsAdFrame(ad_frame_with_aborted_load->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( ad_frame_with_aborted_load, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kNotChecked, @@ -661,8 +659,8 @@ GetWebContents(), GetURL("frame_factory.html")); content::RenderFrameHost* child_frame_of_ad_with_aborted_load = CreateFrameWithWindowStopAbortedLoad(ad_frame); - EXPECT_TRUE(observer.GetIsAdSubframe(ad_frame->GetFrameTreeNodeId())); - EXPECT_TRUE(observer.GetIsAdSubframe( + EXPECT_TRUE(observer.GetIsAdFrame(ad_frame->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame( child_frame_of_ad_with_aborted_load->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( child_frame_of_ad_with_aborted_load, @@ -689,12 +687,11 @@ content::RenderFrameHost* vanilla_child_of_vanilla = CreateSrcFrame( vanilla_frame_with_aborted_load, GetURL("frame_factory.html")); EXPECT_FALSE( - observer.GetIsAdSubframe(vanilla_child_of_vanilla->GetFrameTreeNodeId())); + observer.GetIsAdFrame(vanilla_child_of_vanilla->GetFrameTreeNodeId())); content::RenderFrameHost* ad_child_of_vanilla = CreateSrcFrameFromAdScript( vanilla_frame_with_aborted_load, GetURL("frame_factory.html")); - EXPECT_TRUE( - observer.GetIsAdSubframe(ad_child_of_vanilla->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(ad_child_of_vanilla->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( ad_child_of_vanilla, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kMatchedNoRules, @@ -704,8 +701,8 @@ // this ad frame should be tagged as ads. content::RenderFrameHost* ad_frame_with_aborted_load = CreateFrameWithDocWriteAbortedLoadFromAdScript(GetWebContents()); - EXPECT_TRUE(observer.GetIsAdSubframe( - ad_frame_with_aborted_load->GetFrameTreeNodeId())); + EXPECT_TRUE( + observer.GetIsAdFrame(ad_frame_with_aborted_load->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( ad_frame_with_aborted_load, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kNotChecked, @@ -713,8 +710,7 @@ content::RenderFrameHost* vanilla_child_of_ad = CreateSrcFrame(ad_frame_with_aborted_load, GetURL("frame_factory.html")); - EXPECT_TRUE( - observer.GetIsAdSubframe(vanilla_child_of_ad->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(vanilla_child_of_ad->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( vanilla_child_of_ad, /*parent_is_ad=*/true, blink::mojom::FilterListResult::kMatchedNoRules, @@ -722,7 +718,7 @@ content::RenderFrameHost* ad_child_of_ad = CreateSrcFrameFromAdScript( ad_frame_with_aborted_load, GetURL("frame_factory.html")); - EXPECT_TRUE(observer.GetIsAdSubframe(ad_child_of_ad->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(ad_child_of_ad->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( ad_child_of_ad, /*parent_is_ad=*/true, blink::mojom::FilterListResult::kMatchedNoRules, @@ -749,12 +745,11 @@ content::RenderFrameHost* vanilla_child_of_vanilla = CreateSrcFrame( vanilla_frame_with_aborted_load, GetURL("frame_factory.html")); EXPECT_FALSE( - observer.GetIsAdSubframe(vanilla_child_of_vanilla->GetFrameTreeNodeId())); + observer.GetIsAdFrame(vanilla_child_of_vanilla->GetFrameTreeNodeId())); content::RenderFrameHost* ad_child_of_vanilla = CreateSrcFrameFromAdScript( vanilla_frame_with_aborted_load, GetURL("frame_factory.html")); - EXPECT_TRUE( - observer.GetIsAdSubframe(ad_child_of_vanilla->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(ad_child_of_vanilla->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( ad_child_of_vanilla, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kMatchedNoRules, @@ -764,8 +759,8 @@ // this ad frame should be tagged as ads. content::RenderFrameHost* ad_frame_with_aborted_load = CreateFrameWithWindowStopAbortedLoadFromAdScript(GetWebContents()); - EXPECT_TRUE(observer.GetIsAdSubframe( - ad_frame_with_aborted_load->GetFrameTreeNodeId())); + EXPECT_TRUE( + observer.GetIsAdFrame(ad_frame_with_aborted_load->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( ad_frame_with_aborted_load, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kNotChecked, @@ -773,8 +768,7 @@ content::RenderFrameHost* vanilla_child_of_ad = CreateSrcFrame(ad_frame_with_aborted_load, GetURL("frame_factory.html")); - EXPECT_TRUE( - observer.GetIsAdSubframe(vanilla_child_of_ad->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(vanilla_child_of_ad->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( vanilla_child_of_ad, /*parent_is_ad=*/true, blink::mojom::FilterListResult::kMatchedNoRules, @@ -782,7 +776,7 @@ content::RenderFrameHost* ad_child_of_ad = CreateSrcFrameFromAdScript( ad_frame_with_aborted_load, GetURL("frame_factory.html")); - EXPECT_TRUE(observer.GetIsAdSubframe(ad_child_of_ad->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(ad_child_of_ad->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( vanilla_child_of_ad, /*parent_is_ad=*/true, blink::mojom::FilterListResult::kMatchedNoRules, @@ -802,7 +796,7 @@ content::RenderFrameHost* test_frame = CreateSrcFrame( GetWebContents(), GetURL("frame_factory.html?allowed=true")); - EXPECT_FALSE(observer.GetIsAdSubframe(test_frame->GetFrameTreeNodeId())); + EXPECT_FALSE(observer.GetIsAdFrame(test_frame->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( test_frame, /*parent_is_ad=*/false, /*latest_filter_list_result=*/ @@ -812,7 +806,7 @@ blink::mojom::FrameCreationStackEvidence::kNotCreatedByAdScript)); NavigateFrame(test_frame, GetURL("frame_factory.html")); - EXPECT_FALSE(observer.GetIsAdSubframe(test_frame->GetFrameTreeNodeId())); + EXPECT_FALSE(observer.GetIsAdFrame(test_frame->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( test_frame, /*parent_is_ad=*/false, /*latest_filter_list_result=*/ @@ -822,7 +816,7 @@ blink::mojom::FrameCreationStackEvidence::kNotCreatedByAdScript)); NavigateFrame(test_frame, GetURL("frame_factory.html?allowed=true")); - EXPECT_FALSE(observer.GetIsAdSubframe(test_frame->GetFrameTreeNodeId())); + EXPECT_FALSE(observer.GetIsAdFrame(test_frame->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( test_frame, /*parent_is_ad=*/false, /*latest_filter_list_result=*/ @@ -832,7 +826,7 @@ blink::mojom::FrameCreationStackEvidence::kNotCreatedByAdScript)); NavigateFrame(test_frame, GetURL("frame_factory.html?ad=true")); - EXPECT_TRUE(observer.GetIsAdSubframe(test_frame->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(test_frame->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( test_frame, /*parent_is_ad=*/false, /*latest_filter_list_result=*/ @@ -842,7 +836,7 @@ blink::mojom::FrameCreationStackEvidence::kNotCreatedByAdScript)); NavigateFrame(test_frame, GetURL("frame_factory.html")); - EXPECT_TRUE(observer.GetIsAdSubframe(test_frame->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(test_frame->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( test_frame, /*parent_is_ad=*/false, /*latest_filter_list_result=*/ @@ -889,32 +883,32 @@ } void ExpectWindowOpenUkmEntry(const ukm::TestUkmRecorder& ukm_recorder, - bool from_main_frame, - const GURL& main_frame_url, - bool from_ad_subframe, + bool from_root_frame, + const GURL& root_frame_url, + bool from_ad_frame, bool from_ad_script) { auto entries = ukm_recorder.GetEntriesByName( ukm::builders::AbusiveExperienceHeuristic_WindowOpen::kEntryName); EXPECT_EQ(1u, entries.size()); - // Check that the event is keyed to |main_frame_url| only if it was from the + // Check that the event is keyed to |root_frame_url| only if it was from the // top frame. - if (from_main_frame) { - ukm_recorder.ExpectEntrySourceHasUrl(entries.back(), main_frame_url); + if (from_root_frame) { + ukm_recorder.ExpectEntrySourceHasUrl(entries.back(), root_frame_url); } else { EXPECT_FALSE(ukm_recorder.GetSourceForSourceId(entries.back()->source_id)); } // Check that a DocumentCreated entry was created, and it's keyed to - // |main_frame_url| only if it was from the top frame. However, we can always - // use the navigation source ID to link this source to |main_frame_url|. + // |root_frame_url| only if it was from the top frame. However, we can always + // use the navigation source ID to link this source to |root_frame_url|. const ukm::mojom::UkmEntry* dc_entry = ukm_recorder.GetDocumentCreatedEntryForSourceId( entries.back()->source_id); EXPECT_TRUE(dc_entry); EXPECT_EQ(entries.back()->source_id, dc_entry->source_id); - if (from_main_frame) { - ukm_recorder.ExpectEntrySourceHasUrl(dc_entry, main_frame_url); + if (from_root_frame) { + ukm_recorder.ExpectEntrySourceHasUrl(dc_entry, root_frame_url); } else { EXPECT_FALSE(ukm_recorder.GetSourceForSourceId(dc_entry->source_id)); } @@ -922,16 +916,16 @@ const ukm::UkmSource* navigation_source = ukm_recorder.GetSourceForSourceId(*ukm_recorder.GetEntryMetric( dc_entry, ukm::builders::DocumentCreated::kNavigationSourceIdName)); - EXPECT_EQ(main_frame_url, navigation_source->url()); + EXPECT_EQ(root_frame_url, navigation_source->url()); - EXPECT_EQ(from_main_frame, + EXPECT_EQ(from_root_frame, *ukm_recorder.GetEntryMetric( dc_entry, ukm::builders::DocumentCreated::kIsMainFrameName)); ukm_recorder.ExpectEntryMetric( entries.back(), ukm::builders::AbusiveExperienceHeuristic_WindowOpen::kFromAdSubframeName, - from_ad_subframe); + from_ad_frame); ukm_recorder.ExpectEntryMetric( entries.back(), ukm::builders::AbusiveExperienceHeuristic_WindowOpen::kFromAdScriptName, @@ -1031,34 +1025,33 @@ class AdTaggingEventFromSubframeBrowserTest : public AdTaggingBrowserTest, public ::testing::WithParamInterface< - std::tuple<bool /* cross_origin */, bool /* from_ad_subframe */>> {}; + std::tuple<bool /* cross_origin */, bool /* from_ad_frame */>> {}; // crbug.com/997410. The test is flaky on multiple platforms. IN_PROC_BROWSER_TEST_P(AdTaggingEventFromSubframeBrowserTest, DISABLED_WindowOpenFromSubframe) { - auto [cross_origin, from_ad_subframe] = GetParam(); - SCOPED_TRACE(::testing::Message() - << "cross_origin = " << cross_origin << ", " - << "from_ad_subframe = " << from_ad_subframe); + auto [cross_origin, from_ad_frame] = GetParam(); + SCOPED_TRACE(::testing::Message() << "cross_origin = " << cross_origin << ", " + << "from_ad_frame = " << from_ad_frame); ukm::TestAutoSetUkmRecorder ukm_recorder; base::HistogramTester histogram_tester; - GURL main_frame_url = + GURL root_frame_url = embedded_test_server()->GetURL("a.com", "/ad_tagging/frame_factory.html"); - ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), main_frame_url)); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), root_frame_url)); content::WebContents* main_tab = GetWebContents(); std::string hostname = cross_origin ? "b.com" : "a.com"; - std::string suffix = from_ad_subframe ? "&ad=true" : ""; + std::string suffix = from_ad_frame ? "&ad=true" : ""; RenderFrameHost* child = CreateSrcFrame( main_tab, embedded_test_server()->GetURL( hostname, "/ad_tagging/frame_factory.html?1" + suffix)); EXPECT_TRUE(content::ExecJs(child, "window.open();")); - bool from_ad_script = from_ad_subframe; - ExpectWindowOpenUkmEntry(ukm_recorder, false /* from_main_frame */, - main_frame_url, from_ad_subframe, from_ad_script); + bool from_ad_script = from_ad_frame; + ExpectWindowOpenUkmEntry(ukm_recorder, false /* from_root_frame */, + root_frame_url, from_ad_frame, from_ad_script); } INSTANTIATE_TEST_SUITE_P( @@ -1078,8 +1071,8 @@ ukm::TestAutoSetUkmRecorder ukm_recorder; base::HistogramTester histogram_tester; - GURL main_frame_url = GetURL("frame_factory.html"); - ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), main_frame_url)); + GURL root_frame_url = GetURL("frame_factory.html"); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), root_frame_url)); content::WebContents* main_tab = GetWebContents(); std::string script = from_ad_script ? "windowOpenFromAdScript();" @@ -1087,9 +1080,9 @@ EXPECT_TRUE(content::ExecJs(main_tab, script)); - bool from_ad_subframe = false; - ExpectWindowOpenUkmEntry(ukm_recorder, true /* from_main_frame */, - main_frame_url, from_ad_subframe, from_ad_script); + bool from_ad_frame = false; + ExpectWindowOpenUkmEntry(ukm_recorder, true /* from_root_frame */, + root_frame_url, from_ad_frame, from_ad_script); } INSTANTIATE_TEST_SUITE_P( @@ -1113,12 +1106,12 @@ ASSERT_TRUE(https_server_.Start()); } - bool EvaluatedSubframeLoad(const GURL url) { - return observer_->GetSubframeLoadPolicy(url).has_value(); + bool EvaluatedChildFrameLoad(const GURL url) { + return observer_->GetChildFrameLoadPolicy(url).has_value(); } - bool IsAdSubframe(RenderFrameHost* host) { - return observer_->GetIsAdSubframe(host->GetFrameTreeNodeId()); + bool IsAdFrame(RenderFrameHost* host) { + return observer_->GetIsAdFrame(host->GetFrameTreeNodeId()); } RenderFrameHost* PrimaryMainFrame() { @@ -1146,8 +1139,8 @@ const GURL kUrl = GetURL("frame_factory.html?fencedframe&ad=true"); RenderFrameHost* fenced_frame = CreateFencedFrame(PrimaryMainFrame(), kUrl); - EXPECT_TRUE(EvaluatedSubframeLoad(kUrl)); - EXPECT_TRUE(IsAdSubframe(fenced_frame)); + EXPECT_TRUE(EvaluatedChildFrameLoad(kUrl)); + EXPECT_TRUE(IsAdFrame(fenced_frame)); EXPECT_TRUE(EvidenceForFrameComprises( fenced_frame, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kMatchedBlockingRule, @@ -1158,8 +1151,8 @@ GURL kInnerUrl = GetURL("test_div.html"); RenderFrameHost* inner_frame = CreateSrcFrame(fenced_frame, kInnerUrl); - EXPECT_TRUE(EvaluatedSubframeLoad(kInnerUrl)); - EXPECT_TRUE(IsAdSubframe(inner_frame)); + EXPECT_TRUE(EvaluatedChildFrameLoad(kInnerUrl)); + EXPECT_TRUE(IsAdFrame(inner_frame)); // Note: kCreatedByAdScript is expected since any script running in an ad is // considered ad script. EXPECT_TRUE(EvidenceForFrameComprises( @@ -1180,8 +1173,8 @@ RenderFrameHost* fenced_frame = CreateFencedFrameFromAdScript(PrimaryMainFrame(), kUrl); - EXPECT_TRUE(EvaluatedSubframeLoad(kUrl)); - EXPECT_TRUE(IsAdSubframe(fenced_frame)); + EXPECT_TRUE(EvaluatedChildFrameLoad(kUrl)); + EXPECT_TRUE(IsAdFrame(fenced_frame)); EXPECT_TRUE(EvidenceForFrameComprises( fenced_frame, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kMatchedNoRules, @@ -1192,8 +1185,8 @@ const GURL kInnerUrl = GetURL("test_div.html"); RenderFrameHost* inner_frame = CreateSrcFrame(fenced_frame, kInnerUrl); - EXPECT_TRUE(EvaluatedSubframeLoad(kInnerUrl)); - EXPECT_TRUE(IsAdSubframe(inner_frame)); + EXPECT_TRUE(EvaluatedChildFrameLoad(kInnerUrl)); + EXPECT_TRUE(IsAdFrame(inner_frame)); EXPECT_TRUE(EvidenceForFrameComprises( inner_frame, /*parent_is_ad=*/true, blink::mojom::FilterListResult::kMatchedNoRules, @@ -1205,8 +1198,8 @@ const GURL kUrl = GetURL("frame_factory.html?non+ad+fencedframe"); RenderFrameHost* fenced_frame = CreateFencedFrame(PrimaryMainFrame(), kUrl); - EXPECT_TRUE(EvaluatedSubframeLoad(kUrl)); - EXPECT_FALSE(IsAdSubframe(fenced_frame)); + EXPECT_TRUE(EvaluatedChildFrameLoad(kUrl)); + EXPECT_FALSE(IsAdFrame(fenced_frame)); } } @@ -1222,8 +1215,8 @@ const GURL kAdUrl = GetURL("frame_factory.html?fencedframe&ad=true"); RenderFrameHost* ad_frame = CreateFencedFrame(PrimaryMainFrame(), kAdUrl); - ASSERT_TRUE(EvaluatedSubframeLoad(kAdUrl)); - ASSERT_TRUE(IsAdSubframe(ad_frame)); + ASSERT_TRUE(EvaluatedChildFrameLoad(kAdUrl)); + ASSERT_TRUE(IsAdFrame(ad_frame)); // Create another fenced frame, nested in the first one, that doesn't match // any rules. Since the first fenced frame was tagged as an ad, the inner @@ -1231,8 +1224,8 @@ const GURL kInnerUrl = GetURL("test_div.html?nested+in+fenced+frame"); RenderFrameHost* inner_frame = CreateFencedFrame(ad_frame, kInnerUrl); - EXPECT_TRUE(EvaluatedSubframeLoad(kInnerUrl)); - EXPECT_TRUE(IsAdSubframe(inner_frame)); + EXPECT_TRUE(EvaluatedChildFrameLoad(kInnerUrl)); + EXPECT_TRUE(IsAdFrame(inner_frame)); // Note: kCreatedByAdScript is expected since any script running in an ad // is considered ad script. EXPECT_TRUE(EvidenceForFrameComprises( @@ -1246,8 +1239,8 @@ const GURL kAdUrl = GetURL("frame_factory.html?iframe&ad=true"); RenderFrameHost* ad_frame = CreateSrcFrame(PrimaryMainFrame(), kAdUrl); - ASSERT_TRUE(EvaluatedSubframeLoad(kAdUrl)); - ASSERT_TRUE(IsAdSubframe(ad_frame)); + ASSERT_TRUE(EvaluatedChildFrameLoad(kAdUrl)); + ASSERT_TRUE(IsAdFrame(ad_frame)); // Create a fenced frame, nested in the ad iframe, that doesn't match any // rules. Since the iframe was tagged as an ad, the fenced frame should be @@ -1255,8 +1248,8 @@ const GURL kInnerUrl = GetURL("test_div.html?nested+in+iframe"); RenderFrameHost* inner_frame = CreateFencedFrame(ad_frame, kInnerUrl); - EXPECT_TRUE(EvaluatedSubframeLoad(kInnerUrl)); - EXPECT_TRUE(IsAdSubframe(inner_frame)); + EXPECT_TRUE(EvaluatedChildFrameLoad(kInnerUrl)); + EXPECT_TRUE(IsAdFrame(inner_frame)); // Note: kCreatedByAdScript is expected since any script running in an ad // is considered ad script. EXPECT_TRUE(EvidenceForFrameComprises( @@ -1277,8 +1270,8 @@ RenderFrameHost* fenced_frame = CreateFencedFrame(PrimaryMainFrame(), kOuterUrl); - ASSERT_TRUE(EvaluatedSubframeLoad(kOuterUrl)); - ASSERT_FALSE(IsAdSubframe(fenced_frame)); + ASSERT_TRUE(EvaluatedChildFrameLoad(kOuterUrl)); + ASSERT_FALSE(IsAdFrame(fenced_frame)); // Create an iframe inside the fenced frame that matches an ad rule. It // should be tagged as an ad. @@ -1286,8 +1279,8 @@ const GURL kAdUrl = GetURL("test_div.html?ad=true"); RenderFrameHost* inner_frame = CreateSrcFrame(fenced_frame, kAdUrl); - EXPECT_TRUE(EvaluatedSubframeLoad(kAdUrl)); - EXPECT_TRUE(IsAdSubframe(inner_frame)); + EXPECT_TRUE(EvaluatedChildFrameLoad(kAdUrl)); + EXPECT_TRUE(IsAdFrame(inner_frame)); EXPECT_TRUE(EvidenceForFrameComprises( inner_frame, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kMatchedBlockingRule, @@ -1301,8 +1294,8 @@ RenderFrameHost* inner_frame = CreateSrcFrameFromAdScript(fenced_frame, kNotAdUrl); - EXPECT_TRUE(EvaluatedSubframeLoad(kNotAdUrl)); - EXPECT_TRUE(IsAdSubframe(inner_frame)); + EXPECT_TRUE(EvaluatedChildFrameLoad(kNotAdUrl)); + EXPECT_TRUE(IsAdFrame(inner_frame)); EXPECT_TRUE(EvidenceForFrameComprises( inner_frame, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kMatchedNoRules, @@ -1315,8 +1308,8 @@ const GURL kNotAdUrl = GetURL("test_div.html?also+not+an+ad"); RenderFrameHost* inner_frame = CreateSrcFrame(fenced_frame, kNotAdUrl); - EXPECT_TRUE(EvaluatedSubframeLoad(kNotAdUrl)); - EXPECT_FALSE(IsAdSubframe(inner_frame)); + EXPECT_TRUE(EvaluatedChildFrameLoad(kNotAdUrl)); + EXPECT_FALSE(IsAdFrame(inner_frame)); } } @@ -1331,8 +1324,8 @@ RenderFrameHost* fenced_frame = CreateFencedFrame(PrimaryMainFrame(), kOuterUrl); - ASSERT_TRUE(EvaluatedSubframeLoad(kOuterUrl)); - ASSERT_FALSE(IsAdSubframe(fenced_frame)); + ASSERT_TRUE(EvaluatedChildFrameLoad(kOuterUrl)); + ASSERT_FALSE(IsAdFrame(fenced_frame)); // Create a fenced frame inside the fenced frame that matches an ad rule. It // should be tagged as an ad. @@ -1340,8 +1333,8 @@ const GURL kAdUrl = GetURL("test_div.html?ad=true"); RenderFrameHost* inner_frame = CreateFencedFrame(fenced_frame, kAdUrl); - EXPECT_TRUE(EvaluatedSubframeLoad(kAdUrl)); - EXPECT_TRUE(IsAdSubframe(inner_frame)); + EXPECT_TRUE(EvaluatedChildFrameLoad(kAdUrl)); + EXPECT_TRUE(IsAdFrame(inner_frame)); EXPECT_TRUE(EvidenceForFrameComprises( inner_frame, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kMatchedBlockingRule, @@ -1355,8 +1348,8 @@ RenderFrameHost* inner_frame = CreateFencedFrameFromAdScript(fenced_frame, kNotAdUrl); - EXPECT_TRUE(EvaluatedSubframeLoad(kNotAdUrl)); - EXPECT_TRUE(IsAdSubframe(inner_frame)); + EXPECT_TRUE(EvaluatedChildFrameLoad(kNotAdUrl)); + EXPECT_TRUE(IsAdFrame(inner_frame)); EXPECT_TRUE(EvidenceForFrameComprises( inner_frame, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kMatchedNoRules, @@ -1369,8 +1362,8 @@ const GURL kNotAdUrl = GetURL("test_div.html?also+not+an+ad"); RenderFrameHost* inner_frame = CreateFencedFrame(fenced_frame, kNotAdUrl); - EXPECT_TRUE(EvaluatedSubframeLoad(kNotAdUrl)); - EXPECT_FALSE(IsAdSubframe(inner_frame)); + EXPECT_TRUE(EvaluatedChildFrameLoad(kNotAdUrl)); + EXPECT_FALSE(IsAdFrame(inner_frame)); } }
diff --git a/chrome/browser/subresource_filter/subresource_filter_browsertest.cc b/chrome/browser/subresource_filter/subresource_filter_browsertest.cc index 19cd1cd0..f110beb1 100644 --- a/chrome/browser/subresource_filter/subresource_filter_browsertest.cc +++ b/chrome/browser/subresource_filter/subresource_filter_browsertest.cc
@@ -96,7 +96,7 @@ // This string comes from GetErrorStringForDisallowedLoad() in // blink/renderer/core/loader/subresource_filter.cc -constexpr const char kBlinkDisallowSubframeConsoleMessageFormat[] = +constexpr const char kBlinkDisallowChildFrameConsoleMessageFormat[] = "Chrome blocked resource %s on this site because this site tends to show " "ads that interrupt, distract, mislead, or prevent user control. Learn " "more at https://www.chromestatus.com/feature/5738264052891648"; @@ -131,7 +131,7 @@ EXPECT_FALSE(console_observer.messages().empty()); - // The main frame document should never be filtered. + // The root frame document should never be filtered. SetRulesetToDisallowURLsWithPathSuffix("frame_with_included_script.html"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); EXPECT_TRUE( @@ -223,7 +223,7 @@ EXPECT_FALSE(console_observer.messages().empty()); - // The main frame document should never be filtered. + // The root frame document should never be filtered. SetRulesetToDisallowURLsWithPathSuffix("frame_with_included_script.html"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); EXPECT_TRUE( @@ -254,7 +254,7 @@ IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest, SubFrameActivation) { std::string message_filter = - base::StringPrintf(kBlinkDisallowSubframeConsoleMessageFormat, "*"); + base::StringPrintf(kBlinkDisallowChildFrameConsoleMessageFormat, "*"); content::WebContentsConsoleObserver console_observer(web_contents()); console_observer.SetPattern(message_filter); @@ -274,17 +274,17 @@ kSubresourceFilterActionsHistogram, subresource_filter::SubresourceFilterAction::kUIShown, 1); - // Console message for subframe blocking should be displayed. + // Console message for child frame blocking should be displayed. EXPECT_TRUE(base::MatchPattern( console_observer.GetMessageAt(0u), - base::StringPrintf(kBlinkDisallowSubframeConsoleMessageFormat, + base::StringPrintf(kBlinkDisallowChildFrameConsoleMessageFormat, "*included_script.js"))); } IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest, ActivationDisabled_NoConsoleMessage) { std::string message_filter = - base::StringPrintf(kBlinkDisallowSubframeConsoleMessageFormat, "*"); + base::StringPrintf(kBlinkDisallowChildFrameConsoleMessageFormat, "*"); content::WebContentsConsoleObserver console_observer(web_contents()); console_observer.SetPattern(message_filter); @@ -300,15 +300,15 @@ SetRulesetToDisallowURLsWithPathSuffix("included_script.js")); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); - // Console message for subframe blocking should not be displayed as filtering - // is disabled. + // Console message for child frame blocking should not be displayed as + // filtering is disabled. EXPECT_TRUE(console_observer.messages().empty()); } IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest, ActivationDryRun_NoConsoleMessage) { std::string message_filter = - base::StringPrintf(kBlinkDisallowSubframeConsoleMessageFormat, "*"); + base::StringPrintf(kBlinkDisallowChildFrameConsoleMessageFormat, "*"); content::WebContentsConsoleObserver console_observer(web_contents()); console_observer.SetPattern(message_filter); @@ -324,8 +324,8 @@ SetRulesetToDisallowURLsWithPathSuffix("included_script.js")); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); - // Console message for subframe blocking should not be displayed as filtering - // is enabled in dryrun mode. + // Console message for child frame blocking should not be displayed as + // filtering is enabled in dryrun mode. EXPECT_TRUE(console_observer.messages().empty()); } @@ -335,7 +335,7 @@ GURL url(GetTestUrl(kTestFrameSetPath)); ConfigureAsPhishingURL(url); - // Disallow loading subframe documents that in turn would end up loading + // Disallow loading child frame documents that in turn would end up loading // included_script.js, unless the document is loaded from an allowlisted // domain. This enables the third part of this test disallowing a load only // after the first redirect. @@ -467,7 +467,7 @@ } // The page-level activation state on the browser-side should not be reset when -// a same document navigation starts in the main frame. Verify this by +// a same document navigation starts in the root frame. Verify this by // dynamically inserting a subframe afterwards, and still expecting activation. IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest, PageLevelActivationOutlivesSameDocumentNavigation) {
diff --git a/chrome/browser/subresource_filter/subresource_filter_fenced_frame_browsertest.cc b/chrome/browser/subresource_filter/subresource_filter_fenced_frame_browsertest.cc index 7d658a4..52ed935 100644 --- a/chrome/browser/subresource_filter/subresource_filter_fenced_frame_browsertest.cc +++ b/chrome/browser/subresource_filter/subresource_filter_fenced_frame_browsertest.cc
@@ -27,7 +27,7 @@ namespace { // This string comes from GetErrorStringForDisallowedLoad() in // blink/renderer/core/loader/subresource_filter.cc -constexpr const char kBlinkDisallowSubframeConsoleMessageFormat[] = +constexpr const char kBlinkDisallowChildFrameConsoleMessageFormat[] = "Chrome blocked resource %s on this site because this site tends to show " "ads that interrupt, distract, mislead, or prevent user control. Learn " "more at https://www.chromestatus.com/feature/5738264052891648"; @@ -117,7 +117,7 @@ IN_PROC_BROWSER_TEST_F(SubresourceFilterFencedFrameBrowserTest, OutermostFrameActivation) { const std::string kMessageFilter = - base::StringPrintf(kBlinkDisallowSubframeConsoleMessageFormat, "*"); + base::StringPrintf(kBlinkDisallowChildFrameConsoleMessageFormat, "*"); content::WebContentsConsoleObserver console_observer(web_contents()); console_observer.SetPattern(kMessageFilter); @@ -146,7 +146,7 @@ // Console message for subframe blocking should be displayed. EXPECT_TRUE(base::MatchPattern( console_observer.GetMessageAt(0u), - base::StringPrintf(kBlinkDisallowSubframeConsoleMessageFormat, + base::StringPrintf(kBlinkDisallowChildFrameConsoleMessageFormat, "*included_script.js"))); }
diff --git a/chrome/browser/subresource_filter/subresource_filter_prerender_browsertest.cc b/chrome/browser/subresource_filter/subresource_filter_prerender_browsertest.cc index 71128c8..9264bca 100644 --- a/chrome/browser/subresource_filter/subresource_filter_prerender_browsertest.cc +++ b/chrome/browser/subresource_filter/subresource_filter_prerender_browsertest.cc
@@ -272,7 +272,7 @@ console_activation_observer.SetPattern(kActivationConsoleMessage); WebContentsConsoleObserver console_blocked_observer(web_contents()); console_blocked_observer.SetPattern( - base::StringPrintf(kDisallowSubframeConsoleMessageFormat, "*")); + base::StringPrintf(kDisallowChildFrameConsoleMessageFormat, "*")); // Configure filtering of `included_script.js` only on the prerendering URL. { @@ -453,7 +453,7 @@ { ad_rfh = CreateSrcFrameFromAdScript(prerender_rfh, kAdUrl); ASSERT_NE(ad_rfh, nullptr); - EXPECT_TRUE(observer.GetIsAdSubframe(ad_rfh->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(ad_rfh->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( ad_rfh, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kMatchedNoRules, @@ -466,7 +466,7 @@ { prerender_helper_.NavigatePrimaryPage(kPrerenderingUrl); ASSERT_EQ(kPrerenderingUrl, web_contents()->GetLastCommittedURL()); - EXPECT_TRUE(observer.GetIsAdSubframe(ad_rfh->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(ad_rfh->GetFrameTreeNodeId())); EXPECT_TRUE(EvidenceForFrameComprises( ad_rfh, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kMatchedNoRules,
diff --git a/chrome/browser/sync/test/integration/single_client_passwords_sync_test.cc b/chrome/browser/sync/test/integration/single_client_passwords_sync_test.cc index 1ce7513..1a57477 100644 --- a/chrome/browser/sync/test/integration/single_client_passwords_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_passwords_sync_test.cc
@@ -124,6 +124,21 @@ base::test::ScopedFeatureList feature_list_; }; +class SingleClientPasswordsSyncTestWithCachingSpecificsEnabledAfterRestart + : public SyncTest { + public: + SingleClientPasswordsSyncTestWithCachingSpecificsEnabledAfterRestart() + : SyncTest(SINGLE_CLIENT) { + feature_list_.InitWithFeatureState( + syncer::kCacheBaseEntitySpecificsInMetadata, GetTestPreCount() == 0); + } + ~SingleClientPasswordsSyncTestWithCachingSpecificsEnabledAfterRestart() + override = default; + + private: + base::test::ScopedFeatureList feature_list_; +}; + IN_PROC_BROWSER_TEST_F(SingleClientPasswordsSyncTestWithVerifier, Sanity) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; @@ -761,4 +776,52 @@ } } +IN_PROC_BROWSER_TEST_F( + SingleClientPasswordsSyncTestWithCachingSpecificsEnabledAfterRestart, + PRE_PasswordBridgeIgnoresEntriesWithoutCachedBaseSpecificOnRestart) { + // Disabled by the test fixture. + ASSERT_FALSE(base::FeatureList::IsEnabled( + syncer::kCacheBaseEntitySpecificsInMetadata)); + + // Add password entity with caching entity specifics disabled in the PRE test. + ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; + PasswordForm form = CreateTestPasswordForm(0); + GetProfilePasswordStoreInterface(0)->AddLogin(form); + ASSERT_EQ(1, GetPasswordCount(0)); + + // Setup sync, wait for its completion, and make sure changes were synced. + ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; + ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); +} + +// Regression test for crrev.com/c/3755526. Checks that password bridge ignores +// entries without a password field in entity specifics cache (added by the PRE +// test with `syncer::kCacheBaseEntitySpecificsInMetadata` disabled). +IN_PROC_BROWSER_TEST_F( + SingleClientPasswordsSyncTestWithCachingSpecificsEnabledAfterRestart, + PasswordBridgeIgnoresEntriesWithoutCachedBaseSpecificOnRestart) { + // Enabled by the test fixture. + ASSERT_TRUE(base::FeatureList::IsEnabled( + syncer::kCacheBaseEntitySpecificsInMetadata)); + + base::HistogramTester histogram_tester; + ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; + ASSERT_EQ(1, GetPasswordCount(0)); + ASSERT_TRUE(GetClient(0)->AwaitEngineInitialization()); + + // After restart, the last sync cycle snapshot should be empty. Once a sync + // request happened (e.g. by a poll), that snapshot is populated. We use the + // following checker to simply wait for an non-empty snapshot. + EXPECT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); + + // The original metric is defined in password_sync_bridge.cc. + const int kNone = 0; + // Since the local base entity specifics cache doesn't contain supported + // fields, running into the initial sync flow is not expected. Since the + // bridge is initialized for both account and profile store, the metric is + // expected to be recorded twice. + histogram_tester.ExpectUniqueSample("PasswordManager.SyncMetadataReadError", + kNone, /*expected_bucket_count=*/2); +} + } // namespace
diff --git a/chrome/browser/tab/BUILD.gn b/chrome/browser/tab/BUILD.gn index aba58a5c..ea7adae 100644 --- a/chrome/browser/tab/BUILD.gn +++ b/chrome/browser/tab/BUILD.gn
@@ -137,7 +137,6 @@ proto_path = "java/src/org/chromium/chrome/browser/tab/state/proto" sources = [ "$proto_path/coupon_persisted_tab_data.proto", - "$proto_path/critical_persisted_tab_data.proto", "$proto_path/shopping_persisted_tab_data.proto", "$proto_path/store_persisted_tab_data.proto", ]
diff --git a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/Tab.java b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/Tab.java index d9cdc11..54bfc86 100644 --- a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/Tab.java +++ b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/Tab.java
@@ -212,9 +212,10 @@ * Loads the tab if it's not loaded (e.g. because it was killed in background). * This will trigger a regular load for tabs with pending lazy first load (tabs opened in * background on low-memory devices). + * @param caller The caller of this method. * @return true iff the Tab handled the request. */ - boolean loadIfNeeded(); + boolean loadIfNeeded(int caller); /** * Reloads the current page content.
diff --git a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/TabLifecycle.java b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/TabLifecycle.java index e9e5d46..dab096f8 100644 --- a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/TabLifecycle.java +++ b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/TabLifecycle.java
@@ -26,8 +26,9 @@ * displayed. It restores the ContentView if it is not available after the cold start and * reloads the tab if its renderer has crashed. * @param type Specifies how the tab was selected. + * @param caller The caller of this method. */ - void show(@TabSelectionType int type); + void show(@TabSelectionType int type, int caller); /** * Triggers the hiding logic for the view backing the tab.
diff --git a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/proto/critical_persisted_tab_data.proto b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/proto/critical_persisted_tab_data.proto deleted file mode 100644 index fa30dec..0000000 --- a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/proto/critical_persisted_tab_data.proto +++ /dev/null
@@ -1,70 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -syntax = "proto2"; - -package org.chromium.chrome.browser.tab.proto; - -option java_package = "org.chromium.chrome.browser.tab.proto"; - -message CriticalPersistedTabDataProto { - // Parent Tab identifier. - optional int32 parent_id = 1; - - // Root Tab identifier. - optional int32 root_id = 2; - - // Timestamp when Tab was created. - optional int64 timestamp_millis = 3; - - // WebContentsState. - optional bytes web_contents_state_bytes = 4; - - // Content State version. - optional int32 content_state_version = 5; - - // Identifier for app which opened the Tab. - optional string opener_app_id = 6; - - // Theme color. - optional int32 theme_color = 7; - - // Launch type at creation. - // See TabLaunchType.java for full descriptions - enum LaunchTypeAtCreation { - FROM_LINK = 0; - FROM_EXTERNAL_APP = 1; - FROM_CHROME_UI = 2; - FROM_RESTORE = 3; - FROM_LONGPRESS_FOREGROUND = 4; - FROM_LONGPRESS_BACKGROUND = 5; - FROM_REPARENTING = 6; - FROM_LAUNCHER_SHORTCUT = 7; - FROM_SPECULATIVE_BACKGROUND_CREATION = 8; - FROM_BROWSER_ACTIONS = 9; - FROM_LAUNCH_NEW_INCOGNITO_TAB = 10; - FROM_STARTUP = 11; - FROM_START_SURFACE = 12; - FROM_TAB_GROUP_UI = 13; - FROM_LONGPRESS_BACKGROUND_IN_GROUP = 14; - FROM_APP_WIDGET = 15; - FROM_LONGPRESS_INCOGNITO = 16; - FROM_RECENT_TABS = 17; - FROM_READING_LIST = 18; - SIZE = 19; - UNKNOWN = 20; - } - optional LaunchTypeAtCreation launch_type_at_creation = 8; - - // User agent. - // Cannot define two same enum name in the same proto file. - enum UserAgentType { - DEFAULT = 0; - MOBILE = 1; - DESKTOP = 2; - UNSET = 3; - USER_AGENT_SIZE = 4; - } - optional UserAgentType user_agent = 9; -}
diff --git a/chrome/browser/tabmodel/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelFilter.java b/chrome/browser/tabmodel/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelFilter.java index ccc0c32..2207d93 100644 --- a/chrome/browser/tabmodel/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelFilter.java +++ b/chrome/browser/tabmodel/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelFilter.java
@@ -218,16 +218,16 @@ } @Override - public void didCloseTab(Tab tab) { + public void onFinishingTabClosure(Tab tab) { for (TabModelObserver observer : mFilteredObservers) { - observer.didCloseTab(tab); + observer.onFinishingTabClosure(tab); } } @Override - public void didCloseTabs(List<Tab> tabs) { + public void onFinishingMultipleTabClosure(List<Tab> tabs) { for (TabModelObserver observer : mFilteredObservers) { - observer.didCloseTabs(tabs); + observer.onFinishingMultipleTabClosure(tabs); } }
diff --git a/chrome/browser/tabmodel/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelObserver.java b/chrome/browser/tabmodel/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelObserver.java index 3a523bc2..fb5acd3 100644 --- a/chrome/browser/tabmodel/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelObserver.java +++ b/chrome/browser/tabmodel/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelObserver.java
@@ -41,17 +41,17 @@ * * @param tab The {@link Tab} that was closed. */ - default void didCloseTab(Tab tab) {} + default void onFinishingTabClosure(Tab tab) {} /** * Called right before each of {@code tabs} will be destroyed. Called as each closure event is - * committed. Will be called per closure eventm i.e. {@link TabModel#closeTab()}, + * committed. Will be called per closure event i.e. {@link TabModel#closeTab()}, * {@link TabModel#closeAllTabs()}, and {@link TabModel#closeMultipleTabs()} will all trigger * one event when the tabs associated with a particular closure commit to closing. * * @param tabs The list of {@link Tab} that were closed. */ - default void didCloseTabs(List<Tab> tabs) {} + default void onFinishingMultipleTabClosure(List<Tab> tabs) {} /** * Called before a tab will be added to the {@link TabModel}.
diff --git a/chrome/browser/tabmodel/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorTabObserver.java b/chrome/browser/tabmodel/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorTabObserver.java index 0f086fe3..bce5442 100644 --- a/chrome/browser/tabmodel/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorTabObserver.java +++ b/chrome/browser/tabmodel/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorTabObserver.java
@@ -62,7 +62,7 @@ } @Override - public void didCloseTab(Tab tab) { + public void onFinishingTabClosure(Tab tab) { if (mTabsToClose.get(tab.getId()) != null) { mTabsToClose.remove(tab.getId()); onTabUnregistered(tab);
diff --git a/chrome/browser/task_manager/providers/child_process_task_provider.cc b/chrome/browser/task_manager/providers/child_process_task_provider.cc index 346d2aa..23bb968 100644 --- a/chrome/browser/task_manager/providers/child_process_task_provider.cc +++ b/chrome/browser/task_manager/providers/child_process_task_provider.cc
@@ -38,8 +38,9 @@ void ChildProcessTaskProvider::BrowserChildProcessLaunchedAndConnected( const content::ChildProcessData& data) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (!data.GetProcess().IsValid()) - return; + // TODO(pmonette): Change the following CHECK to a DCHECK after September 1st, + // after confirming that this never gets hit. + CHECK(data.GetProcess().IsValid()); CreateTask(data); } @@ -88,13 +89,8 @@ const content::ChildProcessData& data) { std::unique_ptr<ChildProcessTask>& task = tasks_by_processid_[data.GetProcess().Pid()]; - if (task) { - // This task is already known to us. This case can happen when some of the - // child process data we collect upon StartUpdating() might be of - // BrowserChildProcessHosts whose process hadn't launched yet. So we just - // return. - return; - } + CHECK(!task); // TODO(pmonette): Change to DCHECK after September 1st, after + // confirming that this never gets hit. // Create the task and notify the observer. task = std::make_unique<ChildProcessTask>(
diff --git a/chrome/browser/task_manager/providers/child_process_task_unittest.cc b/chrome/browser/task_manager/providers/child_process_task_unittest.cc index eb68737..b7fb7580 100644 --- a/chrome/browser/task_manager/providers/child_process_task_unittest.cc +++ b/chrome/browser/task_manager/providers/child_process_task_unittest.cc
@@ -101,13 +101,6 @@ content::RunAllPendingInMessageLoop(); ASSERT_TRUE(provided_tasks_.empty()); - // The following process which has handle = base::kNullProcessHandle, won't be - // added. - ChildProcessData data1(0); - ASSERT_FALSE(data1.GetProcess().IsValid()); - provider.BrowserChildProcessLaunchedAndConnected(data1); - EXPECT_TRUE(provided_tasks_.empty()); - const int unique_id = 245; const std::u16string name(u"Test Task"); const std::u16string expected_name(
diff --git a/chrome/browser/ui/android/omnibox/BUILD.gn b/chrome/browser/ui/android/omnibox/BUILD.gn index 64ffc32e..4a15440 100644 --- a/chrome/browser/ui/android/omnibox/BUILD.gn +++ b/chrome/browser/ui/android/omnibox/BUILD.gn
@@ -477,6 +477,7 @@ "//third_party/junit", "//third_party/metrics_proto:metrics_proto_java", "//third_party/mockito:mockito_java", + "//ui/android:ui_java_test_support", "//ui/android:ui_no_recycler_view_java", "//ui/android:ui_recycler_view_java", "//url:gurl_java",
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/styles/OmniboxResourceProviderTest.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/styles/OmniboxResourceProviderTest.java index 0001363..6ae4d09 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/styles/OmniboxResourceProviderTest.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/styles/OmniboxResourceProviderTest.java
@@ -27,6 +27,7 @@ import org.chromium.chrome.browser.ui.theme.BrandedColorScheme; import org.chromium.components.browser_ui.styles.ChromeColors; import org.chromium.components.browser_ui.styles.SemanticColorUtils; +import org.chromium.ui.base.TestActivity; /** Tests for {@link OmniboxResourceProvider}. */ @RunWith(BaseRobolectricTestRunner.class) @@ -40,9 +41,7 @@ @Before public void setUp() { - mActivity = Robolectric.buildActivity(Activity.class).setup().get(); - mActivity.setTheme(R.style.Theme_BrowserUI_DayNight); - + mActivity = Robolectric.buildActivity(TestActivity.class).setup().get(); mDefaultColor = ChromeColors.getDefaultThemeColor(mActivity, false); }
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/FaviconFetcherUnitTest.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/FaviconFetcherUnitTest.java index e7a86091..03925cb 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/FaviconFetcherUnitTest.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/FaviconFetcherUnitTest.java
@@ -35,12 +35,12 @@ import org.robolectric.shadows.ShadowLooper; import org.chromium.base.test.BaseRobolectricTestRunner; -import org.chromium.chrome.R; import org.chromium.chrome.browser.omnibox.suggestions.FaviconFetcher.FaviconFetchCompleteListener; import org.chromium.chrome.browser.omnibox.suggestions.FaviconFetcher.FaviconType; import org.chromium.components.browser_ui.widget.RoundedIconGenerator; import org.chromium.components.favicon.LargeIconBridge; import org.chromium.components.favicon.LargeIconBridge.LargeIconCallback; +import org.chromium.ui.base.TestActivity; import org.chromium.url.GURL; import org.chromium.url.JUnitTestGURLs; @@ -75,8 +75,7 @@ // Enable logs to be printed along with possible test failures. ShadowLog.stream = System.out; - mActivity = Robolectric.buildActivity(Activity.class).setup().get(); - mActivity.setTheme(R.style.Theme_BrowserUI_DayNight); + mActivity = Robolectric.buildActivity(TestActivity.class).setup().get(); mFetcher = new FaviconFetcher(mActivity, () -> mLargeIconBridge); mFetcher.setRoundedIconGeneratorForTesting(mIconGenerator);
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/base/BaseSuggestionViewBinderUnitTest.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/base/BaseSuggestionViewBinderUnitTest.java index b892982..01a9191 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/base/BaseSuggestionViewBinderUnitTest.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/base/BaseSuggestionViewBinderUnitTest.java
@@ -33,6 +33,7 @@ import org.chromium.chrome.browser.omnibox.suggestions.SuggestionCommonProperties; import org.chromium.chrome.browser.omnibox.suggestions.base.BaseSuggestionViewProperties.Action; import org.chromium.chrome.browser.ui.theme.BrandedColorScheme; +import org.chromium.ui.base.TestActivity; import org.chromium.ui.modelutil.PropertyModel; import org.chromium.ui.modelutil.PropertyModelChangeProcessor; @@ -65,9 +66,8 @@ public void setUp() { MockitoAnnotations.initMocks(this); - mActivity = Robolectric.buildActivity(Activity.class).setup().get(); // First set the app theme, then apply the feed theme overlay. - mActivity.setTheme(R.style.Theme_BrowserUI_DayNight); + mActivity = Robolectric.buildActivity(TestActivity.class).setup().get(); mResources = mActivity.getResources(); when(mContentView.getContext()).thenReturn(mActivity);
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderProcessor.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderProcessor.java index 991747a..5b7d5c93 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderProcessor.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderProcessor.java
@@ -22,6 +22,7 @@ private final int mMinimumHeight; private boolean mShouldRemoveSuggestionHeaderChevron; private boolean mAllowGroupCollapsedState; + private boolean mShouldRemoveSuggestionHeaderCapitalization; /** * @param context An Android context. @@ -59,6 +60,8 @@ model.set(HeaderViewProperties.TITLE, headerText); model.set(HeaderViewProperties.IS_COLLAPSED, false); model.set(HeaderViewProperties.SHOULD_REMOVE_CHEVRON, mShouldRemoveSuggestionHeaderChevron); + model.set(HeaderViewProperties.SHOULD_REMOVE_CAPITALIZATION, + mShouldRemoveSuggestionHeaderCapitalization); if (mAllowGroupCollapsedState) { model.set(HeaderViewProperties.DELEGATE, new HeaderViewProperties.Delegate() { @Override @@ -86,7 +89,7 @@ /** * Signals that native initialization has completed. - * And cache the mShouldRemoveSuggestionHeaderChevron value from the flag. + * And cache the feature flag value from the flag. */ @Override public void onNativeInitialized() { @@ -97,5 +100,8 @@ ChromeFeatureList.OMNIBOX_REMOVE_SUGGESTION_HEADER_CHEVRON, "allow_group_collapsed_state", /* default= */ true); + + mShouldRemoveSuggestionHeaderCapitalization = ChromeFeatureList.isEnabled( + ChromeFeatureList.OMNIBOX_REMOVE_SUGGESTION_HEADER_CAPITALIZATION); } }
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderView.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderView.java index c76b015..523430d4 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderView.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderView.java
@@ -54,7 +54,6 @@ mHeaderText.setLayoutParams(LayoutParams.forDynamicView()); mHeaderText.setMaxLines(1); mHeaderText.setEllipsize(TruncateAt.END); - mHeaderText.setAllCaps(true); TextViewCompat.setTextAppearance( mHeaderText, ChromeColors.getTextMediumThickSecondaryStyle(false)); mHeaderText.setMinHeight(context.getResources().getDimensionPixelSize( @@ -142,6 +141,17 @@ mHeaderIcon.setVisibility(shouldRemoveSuggestionHeaderChevron ? GONE : VISIBLE); } + /** + * Specifies whether suggestion header text should be capitalized. + * + * @param shouldRemoveSuggestionHeaderCapitalization true, if capitalization on the suggestion + * header should be removed. + */ + void setShouldRemoveSuggestionHeaderCapitalization( + boolean shouldRemoveSuggestionHeaderCapitalization) { + mHeaderText.setAllCaps(!shouldRemoveSuggestionHeaderCapitalization); + } + @Override public boolean onKeyDown(int keyCode, KeyEvent event) { boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderViewBinder.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderViewBinder.java index 3cb7a31a..4ff7976 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderViewBinder.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderViewBinder.java
@@ -48,6 +48,9 @@ } else if (propertyKey == HeaderViewProperties.SHOULD_REMOVE_CHEVRON) { view.setShouldRemoveSuggestionHeaderChevron( model.get(HeaderViewProperties.SHOULD_REMOVE_CHEVRON)); + } else if (propertyKey == HeaderViewProperties.SHOULD_REMOVE_CAPITALIZATION) { + view.setShouldRemoveSuggestionHeaderCapitalization( + model.get(HeaderViewProperties.SHOULD_REMOVE_CAPITALIZATION)); } } }
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderViewBinderUnitTest.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderViewBinderUnitTest.java index 1aa33da9..2b7a6ba 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderViewBinderUnitTest.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderViewBinderUnitTest.java
@@ -30,6 +30,7 @@ import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.chrome.R; +import org.chromium.ui.base.TestActivity; import org.chromium.ui.modelutil.PropertyModel; import org.chromium.ui.modelutil.PropertyModelChangeProcessor; @@ -50,7 +51,7 @@ @Before public void setUp() { MockitoAnnotations.initMocks(this); - mActivity = Robolectric.buildActivity(Activity.class).setup().get(); + mActivity = Robolectric.buildActivity(TestActivity.class).setup().get(); mActivity.setTheme(R.style.Theme_BrowserUI_DayNight); mHeaderView = mock(HeaderView.class, @@ -153,4 +154,18 @@ mModel.set(HeaderViewProperties.SHOULD_REMOVE_CHEVRON, false); verify(mHeaderView, times(1)).setShouldRemoveSuggestionHeaderChevron(false); } + + @Test + public void headerView_removeSuggestionHeaderCapitalizationTrue() { + // Remove Capitalization. + mModel.set(HeaderViewProperties.SHOULD_REMOVE_CAPITALIZATION, true); + verify(mHeaderView, times(1)).setShouldRemoveSuggestionHeaderCapitalization(true); + } + + @Test + public void headerView_removeSuggestionHeaderCapitalizationFalse() { + // Restore Capitalization. + mModel.set(HeaderViewProperties.SHOULD_REMOVE_CAPITALIZATION, false); + verify(mHeaderView, times(1)).setShouldRemoveSuggestionHeaderCapitalization(false); + } }
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderViewProperties.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderViewProperties.java index f6d089f..6021d04 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderViewProperties.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderViewProperties.java
@@ -31,9 +31,12 @@ /** The flag to state whether to remove the header chevron. */ public static final WritableBooleanPropertyKey SHOULD_REMOVE_CHEVRON = new WritableBooleanPropertyKey(); + /** The flag to state whether to remove the header chevron. */ + public static final WritableBooleanPropertyKey SHOULD_REMOVE_CAPITALIZATION = + new WritableBooleanPropertyKey(); - public static final PropertyKey[] ALL_UNIQUE_KEYS = - new PropertyKey[] {DELEGATE, IS_COLLAPSED, TITLE, SHOULD_REMOVE_CHEVRON}; + public static final PropertyKey[] ALL_UNIQUE_KEYS = new PropertyKey[] { + DELEGATE, IS_COLLAPSED, TITLE, SHOULD_REMOVE_CHEVRON, SHOULD_REMOVE_CAPITALIZATION}; public static final PropertyKey[] ALL_KEYS = PropertyModel.concatKeys(ALL_UNIQUE_KEYS, SuggestionCommonProperties.ALL_KEYS);
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/mostvisited/MostVisitedTilesProcessorUnitTest.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/mostvisited/MostVisitedTilesProcessorUnitTest.java index 44fbaddd..282e7d3 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/mostvisited/MostVisitedTilesProcessorUnitTest.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/mostvisited/MostVisitedTilesProcessorUnitTest.java
@@ -53,6 +53,7 @@ import org.chromium.components.omnibox.AutocompleteMatch; import org.chromium.components.omnibox.AutocompleteMatch.SuggestTile; import org.chromium.components.omnibox.AutocompleteMatchBuilder; +import org.chromium.ui.base.TestActivity; import org.chromium.ui.modelutil.MVCListAdapter.ListItem; import org.chromium.ui.modelutil.PropertyModel; import org.chromium.url.GURL; @@ -95,8 +96,7 @@ // Enable logs to be printed along with possible test failures. ShadowLog.stream = System.out; - mActivity = Robolectric.buildActivity(Activity.class).setup().get(); - mActivity.setTheme(R.style.Theme_BrowserUI_DayNight); + mActivity = Robolectric.buildActivity(TestActivity.class).setup().get(); doNothing() .when(mFaviconFetcher)
diff --git a/chrome/browser/ui/android/overlay/overlay_window_android.cc b/chrome/browser/ui/android/overlay/overlay_window_android.cc index ae7412af..7dcd21f 100644 --- a/chrome/browser/ui/android/overlay/overlay_window_android.cc +++ b/chrome/browser/ui/android/overlay/overlay_window_android.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ui/android/overlay/overlay_window_android.h" #include "base/android/jni_android.h" +#include "base/android/jni_array.h" #include "base/memory/ptr_util.h" #include "cc/layers/surface_layer.h" #include "chrome/android/chrome_jni_headers/PictureInPictureActivity_jni.h" @@ -90,8 +91,9 @@ window_android_ = ui::WindowAndroid::FromJavaWindowAndroid(jwindow_android); window_android_->AddObserver(this); - Java_PictureInPictureActivity_setPlayPauseButtonVisibility( - env, java_ref_.get(env), is_play_pause_button_visible_); + Java_PictureInPictureActivity_setPlaybackState(env, java_ref_.get(env), + is_playing_); + MaybeNotifyVisibleActionsChanged(); if (video_size_.IsEmpty()) return; @@ -125,11 +127,19 @@ controller_->OnWindowDestroyed(/*should_pause_video=*/true); } -void OverlayWindowAndroid::Play(JNIEnv* env) { +void OverlayWindowAndroid::TogglePlayPause(JNIEnv* env) { DCHECK(!controller_->IsPlayerActive()); controller_->TogglePlayPause(); } +void OverlayWindowAndroid::NextTrack(JNIEnv* env) { + controller_->NextTrack(); +} + +void OverlayWindowAndroid::PreviousTrack(JNIEnv* env) { + controller_->PreviousTrack(); +} + void OverlayWindowAndroid::CompositorViewCreated( JNIEnv* env, const base::android::JavaParamRef<jobject>& compositor_view) { @@ -206,14 +216,41 @@ env, java_ref_.get(env), natural_size.width(), natural_size.height()); } -void OverlayWindowAndroid::SetPlayPauseButtonVisibility(bool is_visible) { - is_play_pause_button_visible_ = is_visible; +// TODO(crbug.com/1345953): Handle replay action when video reaches the end. +void OverlayWindowAndroid::SetPlaybackState(PlaybackState playback_state) { + is_playing_ = playback_state == PlaybackState::kPlaying; if (java_ref_.is_uninitialized()) return; JNIEnv* env = base::android::AttachCurrentThread(); - Java_PictureInPictureActivity_setPlayPauseButtonVisibility( - env, java_ref_.get(env), is_visible); + Java_PictureInPictureActivity_setPlaybackState(env, java_ref_.get(env), + is_playing_); +} + +void OverlayWindowAndroid::SetPlayPauseButtonVisibility(bool is_visible) { + if (!MaybeUpdateVisibleAction(media_session::mojom::MediaSessionAction::kPlay, + is_visible)) { + return; + } + + MaybeUpdateVisibleAction(media_session::mojom::MediaSessionAction::kPause, + is_visible); + MaybeNotifyVisibleActionsChanged(); +} + +void OverlayWindowAndroid::SetNextTrackButtonVisibility(bool is_visible) { + if (MaybeUpdateVisibleAction( + media_session::mojom::MediaSessionAction::kNextTrack, is_visible)) { + MaybeNotifyVisibleActionsChanged(); + } +} + +void OverlayWindowAndroid::SetPreviousTrackButtonVisibility(bool is_visible) { + if (MaybeUpdateVisibleAction( + media_session::mojom::MediaSessionAction::kPreviousTrack, + is_visible)) { + MaybeNotifyVisibleActionsChanged(); + } } void OverlayWindowAndroid::SetSurfaceId(const viz::SurfaceId& surface_id) { @@ -237,3 +274,32 @@ cc::Layer* OverlayWindowAndroid::GetLayerForTesting() { return nullptr; } + +void OverlayWindowAndroid::MaybeNotifyVisibleActionsChanged() { + if (java_ref_.is_uninitialized()) + return; + + JNIEnv* env = base::android::AttachCurrentThread(); + Java_PictureInPictureActivity_updateVisibleActions( + env, java_ref_.get(env), + base::android::ToJavaIntArray( + env, + std::vector<int>(visible_actions_.begin(), visible_actions_.end()))); +} + +bool OverlayWindowAndroid::MaybeUpdateVisibleAction( + const media_session::mojom::MediaSessionAction& action, + bool is_visible) { + int action_code = static_cast<int>(action); + if ((visible_actions_.find(action_code) != visible_actions_.end()) == + is_visible) { + return false; + } + + if (is_visible) + visible_actions_.insert(action_code); + else + visible_actions_.erase(action_code); + + return true; +}
diff --git a/chrome/browser/ui/android/overlay/overlay_window_android.h b/chrome/browser/ui/android/overlay/overlay_window_android.h index 2dc31bfd..5c6047bc 100644 --- a/chrome/browser/ui/android/overlay/overlay_window_android.h +++ b/chrome/browser/ui/android/overlay/overlay_window_android.h
@@ -9,6 +9,7 @@ #include "base/android/scoped_java_ref.h" #include "base/memory/raw_ptr.h" #include "content/public/browser/overlay_window.h" +#include "third_party/blink/public/mojom/mediasession/media_session.mojom.h" #include "ui/android/window_android.h" #include "ui/android/window_android_observer.h" #include "ui/gfx/geometry/size.h" @@ -35,7 +36,9 @@ const base::android::JavaParamRef<jobject>& obj, const base::android::JavaParamRef<jobject>& jwindow_android); void Destroy(JNIEnv* env); - void Play(JNIEnv* env); + void TogglePlayPause(JNIEnv* env); + void NextTrack(JNIEnv* env); + void PreviousTrack(JNIEnv* env); void CompositorViewCreated( JNIEnv* env, const base::android::JavaParamRef<jobject>& compositor_view); @@ -62,11 +65,12 @@ void UpdateNaturalSize(const gfx::Size& natural_size) override; // VideoOverlayWindow implementation - void SetPlaybackState(PlaybackState playback_state) override {} + void SetPlaybackState(PlaybackState playback_state) override; void SetPlayPauseButtonVisibility(bool is_visible) override; void SetSkipAdButtonVisibility(bool is_visible) override {} - void SetNextTrackButtonVisibility(bool is_visible) override {} - void SetPreviousTrackButtonVisibility(bool is_visible) override {} + void SetNextTrackButtonVisibility(bool is_visible) override; + void SetPreviousTrackButtonVisibility(bool is_visible) override; + // TODO(crbug.com/1331269): Implement video conferencing actions. void SetMicrophoneMuted(bool muted) override {} void SetCameraState(bool turned_on) override {} void SetToggleMicrophoneButtonVisibility(bool is_visible) override {} @@ -76,6 +80,13 @@ cc::Layer* GetLayerForTesting() override; private: + // Notify PictureInPictureActivity that visible actions have changed. + void MaybeNotifyVisibleActionsChanged(); + + // Maybe update visible actions. Returns true if update happened. + bool MaybeUpdateVisibleAction( + const media_session::mojom::MediaSessionAction& action, + bool is_visible); void CloseInternal(); // A weak reference to Java PictureInPictureActivity object. @@ -86,7 +97,8 @@ gfx::Rect bounds_; gfx::Size video_size_; - bool is_play_pause_button_visible_ = false; + bool is_playing_ = false; + std::unordered_set<int> visible_actions_; raw_ptr<content::VideoPictureInPictureWindowController> controller_; };
diff --git a/chrome/browser/ui/android/tab_model/tab_model_observer.cc b/chrome/browser/ui/android/tab_model/tab_model_observer.cc index e303dba..47b776c8 100644 --- a/chrome/browser/ui/android/tab_model/tab_model_observer.cc +++ b/chrome/browser/ui/android/tab_model/tab_model_observer.cc
@@ -15,9 +15,10 @@ void TabModelObserver::WillCloseTab(TabAndroid* tab, bool animate) {} -void TabModelObserver::DidCloseTab(int tab_id, bool incognito) {} +void TabModelObserver::OnFinishingTabClosure(int tab_id, bool incognito) {} -void TabModelObserver::DidCloseTabs(const std::vector<TabAndroid*>& tabs) {} +void TabModelObserver::OnFinishingMultipleTabClosure( + const std::vector<TabAndroid*>& tabs) {} void TabModelObserver::WillAddTab(TabAndroid* tab, TabModel::TabLaunchType type) {}
diff --git a/chrome/browser/ui/android/tab_model/tab_model_observer.h b/chrome/browser/ui/android/tab_model/tab_model_observer.h index eb55981..1b13a74 100644 --- a/chrome/browser/ui/android/tab_model/tab_model_observer.h +++ b/chrome/browser/ui/android/tab_model/tab_model_observer.h
@@ -30,10 +30,11 @@ virtual void WillCloseTab(TabAndroid* tab, bool animate); // Called right before a |tab| has been destroyed. - virtual void DidCloseTab(int tab_id, bool incognito); + virtual void OnFinishingTabClosure(int tab_id, bool incognito); // Called right before all |tabs| are destroyed. - virtual void DidCloseTabs(const std::vector<TabAndroid*>& tabs); + virtual void OnFinishingMultipleTabClosure( + const std::vector<TabAndroid*>& tabs); // Called before a |tab| is added to the TabModel. virtual void WillAddTab(TabAndroid* tab, TabModel::TabLaunchType type);
diff --git a/chrome/browser/ui/android/tab_model/tab_model_observer_jni_bridge.cc b/chrome/browser/ui/android/tab_model/tab_model_observer_jni_bridge.cc index 8f689a6..2ed32ba5 100644 --- a/chrome/browser/ui/android/tab_model/tab_model_observer_jni_bridge.cc +++ b/chrome/browser/ui/android/tab_model/tab_model_observer_jni_bridge.cc
@@ -67,22 +67,23 @@ observer.WillCloseTab(tab, animate); } -void TabModelObserverJniBridge::DidCloseTab(JNIEnv* env, - const JavaParamRef<jobject>& jobj, - int tab_id, - bool incognito) { +void TabModelObserverJniBridge::OnFinishingTabClosure( + JNIEnv* env, + const JavaParamRef<jobject>& jobj, + int tab_id, + bool incognito) { for (auto& observer : observers_) - observer.DidCloseTab(tab_id, incognito); + observer.OnFinishingTabClosure(tab_id, incognito); } -void TabModelObserverJniBridge::DidCloseTabs( +void TabModelObserverJniBridge::OnFinishingMultipleTabClosure( JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj, const base::android::JavaParamRef<jobjectArray>& jtabs) { std::vector<TabAndroid*> tabs = TabAndroid::GetAllNativeTabs(env, ScopedJavaLocalRef(jtabs)); for (auto& observer : observers_) - observer.DidCloseTabs(tabs); + observer.OnFinishingMultipleTabClosure(tabs); } void TabModelObserverJniBridge::WillAddTab(JNIEnv* env,
diff --git a/chrome/browser/ui/android/tab_model/tab_model_observer_jni_bridge.h b/chrome/browser/ui/android/tab_model/tab_model_observer_jni_bridge.h index 9b9aa3b2..76aa355ea 100644 --- a/chrome/browser/ui/android/tab_model/tab_model_observer_jni_bridge.h +++ b/chrome/browser/ui/android/tab_model/tab_model_observer_jni_bridge.h
@@ -41,14 +41,15 @@ const base::android::JavaParamRef<jobject>& jtab, bool animate); - void DidCloseTab(JNIEnv* env, - const base::android::JavaParamRef<jobject>& jobj, - int tab_id, - bool incognito); + void OnFinishingTabClosure(JNIEnv* env, + const base::android::JavaParamRef<jobject>& jobj, + int tab_id, + bool incognito); - void DidCloseTabs(JNIEnv* env, - const base::android::JavaParamRef<jobject>& jobj, - const base::android::JavaParamRef<jobjectArray>& jtabs); + void OnFinishingMultipleTabClosure( + JNIEnv* env, + const base::android::JavaParamRef<jobject>& jobj, + const base::android::JavaParamRef<jobjectArray>& jtabs); void WillAddTab(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj,
diff --git a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/TabCountProvider.java b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/TabCountProvider.java index 82d8fa1d0..4cc8c21e 100644 --- a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/TabCountProvider.java +++ b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/TabCountProvider.java
@@ -121,7 +121,7 @@ } @Override - public void didCloseTab(Tab tab) { + public void onFinishingTabClosure(Tab tab) { updateTabCount(); }
diff --git a/chrome/browser/ui/cocoa/touchbar/browser_window_touch_bar_controller.mm b/chrome/browser/ui/cocoa/touchbar/browser_window_touch_bar_controller.mm index bbc11a1..f44ad6e 100644 --- a/chrome/browser/ui/cocoa/touchbar/browser_window_touch_bar_controller.mm +++ b/chrome/browser/ui/cocoa/touchbar/browser_window_touch_bar_controller.mm
@@ -49,8 +49,7 @@ } - (void)invalidateTouchBar { - DCHECK([_window respondsToSelector:@selector(setTouchBar:)]); - [_window performSelector:@selector(setTouchBar:) withObject:nil]; + [_window setTouchBar:nil]; } - (NSTouchBar*)makeTouchBar {
diff --git a/chrome/browser/ui/singleton_tabs_unittest.cc b/chrome/browser/ui/singleton_tabs_unittest.cc new file mode 100644 index 0000000..f0aa4db --- /dev/null +++ b/chrome/browser/ui/singleton_tabs_unittest.cc
@@ -0,0 +1,63 @@ +// 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/singleton_tabs.h" +#include "chrome/browser/ui/browser_navigator_params.h" +#include "chrome/test/base/browser_with_test_window_test.h" + +namespace { + +class SingletonTabsTest : public BrowserWithTestWindowTest { + public: + void SetUp() override { + BrowserWithTestWindowTest::SetUp(); + + AddTab(browser(), kUrl3); + AddTab(browser(), kUrl2); + AddTab(browser(), kUrl1); + } + + NavigateParams NavigateParamsForTest( + GURL url, + WindowOpenDisposition disposition = + WindowOpenDisposition::SINGLETON_TAB) { + NavigateParams params(profile(), url, + ui::PageTransition::PAGE_TRANSITION_TYPED); + params.disposition = disposition; + return params; + } + + const GURL kUrl1{"http://1.chromium.org/1"}; + const GURL kUrl2{"http://2.chromium.org/2"}; + const GURL kUrl3{"https://3.chromium.org/3"}; +}; + +} // namespace + +TEST_F(SingletonTabsTest, FindsExactMatch) { + EXPECT_EQ(GetIndexOfExistingTab(browser(), NavigateParamsForTest(kUrl1)), 0); + EXPECT_EQ(GetIndexOfExistingTab(browser(), NavigateParamsForTest(kUrl2)), 1); +} + +TEST_F(SingletonTabsTest, FindsWithDifferentRef) { + auto params = NavigateParamsForTest(kUrl1.Resolve("/1#ref")); + EXPECT_EQ(GetIndexOfExistingTab(browser(), params), 0); +} + +TEST_F(SingletonTabsTest, DoesNotFindNonSingletonDisposition) { + auto params = + NavigateParamsForTest(kUrl1, WindowOpenDisposition::NEW_FOREGROUND_TAB); + EXPECT_EQ(GetIndexOfExistingTab(browser(), params), -1); +} + +TEST_F(SingletonTabsTest, DoesNotFindViewSource) { + auto params = + NavigateParamsForTest(GURL("view-source:http://1.chromium.org")); + EXPECT_EQ(GetIndexOfExistingTab(browser(), params), -1); +} + +TEST_F(SingletonTabsTest, DoesNotFindDifferentPath) { + auto params = NavigateParamsForTest(kUrl1.Resolve("/a")); + EXPECT_EQ(GetIndexOfExistingTab(browser(), params), -1); +}
diff --git a/chrome/browser/ui/views/extensions/extensions_tabbed_menu_view.cc b/chrome/browser/ui/views/extensions/extensions_tabbed_menu_view.cc index fee5164c..9e898813 100644 --- a/chrome/browser/ui/views/extensions/extensions_tabbed_menu_view.cc +++ b/chrome/browser/ui/views/extensions/extensions_tabbed_menu_view.cc
@@ -832,23 +832,13 @@ } void ExtensionsTabbedMenuView::OnSiteSettingSelected( - extensions::PermissionsManager::UserSiteSetting site_settings) { - auto current_origin = - GetActiveWebContents()->GetPrimaryMainFrame()->GetLastCommittedOrigin(); - auto* permissions_manager = - extensions::PermissionsManager::Get(browser_->profile()); - switch (site_settings) { - case UserSiteSetting::kGrantAllExtensions: - permissions_manager->AddUserPermittedSite(current_origin); - break; - case UserSiteSetting::kBlockAllExtensions: - permissions_manager->AddUserRestrictedSite(current_origin); - break; - case UserSiteSetting::kCustomizeByExtension: - permissions_manager->RemoveUserPermittedSite(current_origin); - permissions_manager->RemoveUserRestrictedSite(current_origin); - break; - } + extensions::PermissionsManager::UserSiteSetting site_setting) { + content::WebContents* web_contents = GetActiveWebContents(); + DCHECK(web_contents); + + extensions::SitePermissionsHelper(browser_->profile()) + .UpdateUserSiteSettings(toolbar_model_->action_ids(), web_contents, + site_setting); } void ExtensionsTabbedMenuView::ConsistencyCheck() {
diff --git a/chrome/browser/ui/views/extensions/extensions_toolbar_controls.cc b/chrome/browser/ui/views/extensions/extensions_toolbar_controls.cc index 420c29bc..82c8c79 100644 --- a/chrome/browser/ui/views/extensions/extensions_toolbar_controls.cc +++ b/chrome/browser/ui/views/extensions/extensions_toolbar_controls.cc
@@ -6,12 +6,15 @@ #include <memory> +#include "chrome/browser/ui/color/chrome_color_id.h" #include "chrome/browser/ui/extensions/extension_action_view_controller.h" #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" +#include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/extensions/extensions_request_access_button.h" #include "chrome/browser/ui/views/extensions/extensions_toolbar_button.h" #include "content/public/browser/web_contents.h" #include "ui/base/metadata/metadata_impl_macros.h" +#include "ui/views/background.h" ExtensionsToolbarControls::ExtensionsToolbarControls( std::unique_ptr<ExtensionsToolbarButton> extensions_button, @@ -25,6 +28,12 @@ request_access_button_->SetVisible(false); // TODO(emiliapaz): Consider changing AddMainItem() to receive a unique_ptr. AddMainItem(extensions_button.release()); + + // TODO(emiliapaz): Rename omnibox background name to better reflect its use. + const int radius = ChromeLayoutProvider::Get()->GetCornerRadiusMetric( + views::Emphasis::kMaximum, extensions_button_->GetPreferredSize()); + SetBackground(views::CreateThemedRoundedRectBackground( + kColorOmniboxBackground, radius)); } ExtensionsToolbarControls::~ExtensionsToolbarControls() = default;
diff --git a/chrome/browser/ui/views/sharing_hub/screenshot/screenshot_captured_bubble.cc b/chrome/browser/ui/views/sharing_hub/screenshot/screenshot_captured_bubble.cc index 8476475f..dbcaac5f 100644 --- a/chrome/browser/ui/views/sharing_hub/screenshot/screenshot_captured_bubble.cc +++ b/chrome/browser/ui/views/sharing_hub/screenshot/screenshot_captured_bubble.cc
@@ -26,9 +26,12 @@ #include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/color/chrome_color_id.h" +#include "chrome/browser/ui/tab_contents/core_tab_helper.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/common/webui_url_constants.h" #include "chrome/grit/generated_resources.h" +#include "components/lens/lens_entrypoints.h" +#include "components/lens/lens_features.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/download_request_utils.h" #include "content/public/browser/web_contents.h" @@ -46,6 +49,8 @@ #include "ui/views/layout/table_layout_view.h" #include "ui/views/view.h" +using content::WebContents; + namespace { // Rendered image size, pixels. @@ -75,6 +80,14 @@ ->IsImageEditorAvailable(); } +bool IsSearchImageEnabled() { +#if !BUILDFLAG(IS_ANDROID) && BUILDFLAG(GOOGLE_CHROME_BRANDING) + return lens::features::IsLensInScreenshotSharingEnabled(); +#else + return false; +#endif +} + ScreenshotCapturedBubble::ScreenshotCapturedBubble( views::View* anchor_view, content::WebContents* web_contents, @@ -170,6 +183,15 @@ IDS_BROWSER_SHARING_SCREENSHOT_DIALOG_EDIT_BUTTON_LABEL)) .Build(); + auto search_image_button = + views::Builder<views::MdTextButton>() + .SetCallback(base::BindRepeating( + &ScreenshotCapturedBubble::SearchImageButtonPressed, + weak_factory_.GetWeakPtr())) + .SetText(l10n_util::GetStringUTF16( + IDS_BROWSER_SHARING_SCREENSHOT_DIALOG_SEARCH_IMAGE_BUTTON_LABEL)) + .Build(); + auto download_button = views::Builder<views::MdTextButton>() .SetCallback(base::BindRepeating( @@ -182,16 +204,34 @@ auto download_row = views::Builder<views::TableLayoutView>(); if (IsEditorInstalled()) { - const int kPaddingEditDownloadButtonPx = - kImageWidthPx - edit_button->CalculatePreferredSize().width() - - download_button->CalculatePreferredSize().width(); + download_row.AddColumn( + /* h_align */ views::LayoutAlignment::kStart, + /* v_align */ views::LayoutAlignment::kCenter, + /* horizontal_resize */ 1.0, + /* size_type */ views::TableLayout::ColumnSize::kUsePreferred, + /* fixed_width */ 0, /* min_width */ 0); + } - download_row - .AddColumn(views::LayoutAlignment::kStart, - views::LayoutAlignment::kCenter, 1.0, - views::TableLayout::ColumnSize::kUsePreferred, 0, 0) - .AddPaddingColumn(views::TableLayout::kFixedSize, - kPaddingEditDownloadButtonPx); + if (IsSearchImageEnabled()) { + download_row.AddColumn( + /* h_align */ views::LayoutAlignment::kStart, + /* v_align */ views::LayoutAlignment::kCenter, + /* horizontal_resize */ 1.0, + /* size_type */ views::TableLayout::ColumnSize::kUsePreferred, + /* fixed_width */ 0, /* min_width */ 0); + } + + if (IsEditorInstalled() || IsSearchImageEnabled()) { + const int kPaddingEditSearchDownloadButtonPx = + kImageWidthPx - + (IsEditorInstalled() ? edit_button->CalculatePreferredSize().width() + : 0) - + (IsSearchImageEnabled() + ? search_image_button->CalculatePreferredSize().width() + : 0) - + download_button->CalculatePreferredSize().width(); + download_row.AddPaddingColumn(views::TableLayout::kFixedSize, + kPaddingEditSearchDownloadButtonPx); } // Column for download button @@ -205,6 +245,11 @@ views::Builder<views::MdTextButton>(std::move(edit_button)) .CopyAddressTo(&edit_button_)); } + if (IsSearchImageEnabled()) { + download_row.AddChild( + views::Builder<views::MdTextButton>(std::move(search_image_button)) + .CopyAddressTo(&search_image_button_)); + } download_row.AddChild( views::Builder<views::MdTextButton>(std::move(download_button)) .CopyAddressTo(&download_button_)); @@ -286,6 +331,24 @@ weak_factory_.GetWeakPtr())); } +void ScreenshotCapturedBubble::SearchImageButtonPressed() { + // If EnablePersistentBubble() is true, we do not close the screenshot bubble + set_close_on_deactivate(!lens::features::EnablePersistentBubble()); + + CoreTabHelper::FromWebContents(web_contents_.get()) + ->SearchWithLensInNewTab( + image_, GetImageSize(), lens::EntryPoint::CHROME_SCREENSHOT_SEARCH, + lens::features::UseSidePanelForScreenshotSharing()); + + // Need to manually close the screenshot bubble if side panel is enabled + if (lens::features::UseSidePanelForScreenshotSharing() && + !lens::features::EnablePersistentBubble()) { + CloseBubble(); + } + + set_close_on_deactivate(true); +} + void ScreenshotCapturedBubble::NavigateToImageEditor( const base::FilePath& screenshot_file_path) { auto screenshot_data =
diff --git a/chrome/browser/ui/views/sharing_hub/screenshot/screenshot_captured_bubble.h b/chrome/browser/ui/views/sharing_hub/screenshot/screenshot_captured_bubble.h index 1ea62c0..45490b0 100644 --- a/chrome/browser/ui/views/sharing_hub/screenshot/screenshot_captured_bubble.h +++ b/chrome/browser/ui/views/sharing_hub/screenshot/screenshot_captured_bubble.h
@@ -69,6 +69,8 @@ void EditButtonPressed(); + void SearchImageButtonPressed(); + gfx::Size GetImageSize(); // Requests navigation to the image editor page. @@ -76,7 +78,9 @@ // for use as background, or empty to start with a blank canvas. void NavigateToImageEditor(const base::FilePath& screenshot_file_path); - const gfx::Image& image_; + // Makes a copy of the image to use in button callbacks without worry of + // dereferencing + const gfx::Image image_; base::WeakPtr<content::WebContents> web_contents_; @@ -88,6 +92,7 @@ views::ImageView* image_view_ = nullptr; views::MdTextButton* download_button_ = nullptr; views::LabelButton* edit_button_ = nullptr; + views::LabelButton* search_image_button_ = nullptr; base::WeakPtrFactory<ScreenshotCapturedBubble> weak_factory_{this}; };
diff --git a/chrome/browser/ui/views/toolbar/toolbar_icon_container_view.cc b/chrome/browser/ui/views/toolbar/toolbar_icon_container_view.cc index 9cd31ef4..3c687764 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_icon_container_view.cc +++ b/chrome/browser/ui/views/toolbar/toolbar_icon_container_view.cc
@@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/containers/contains.h" +#include "base/feature_list.h" #include "base/memory/raw_ptr.h" #include "base/observer_list.h" #include "base/scoped_observation.h" @@ -17,6 +18,7 @@ #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/toolbar/toolbar_button.h" #include "chrome/browser/ui/views/toolbar/toolbar_ink_drop_util.h" +#include "extensions/common/extension_features.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/color/color_provider.h" #include "ui/compositor/paint_recorder.h" @@ -261,6 +263,14 @@ } void ToolbarIconContainerView::UpdateHighlight() { + // New feature doesn't have a border around the toolbar icons. + // TODO(crbug.com/1279986): Remove ToolbarIconContainerView once feature is + // rolled out. + if (base::FeatureList::IsEnabled( + extensions_features::kExtensionsMenuAccessControl)) { + return; + } + bool showing_before = border_.layer()->GetTargetOpacity() == 1; {
diff --git a/chrome/browser/ui/webui/app_launcher_page_ui.cc b/chrome/browser/ui/webui/app_launcher_page_ui.cc index a418a33..b87ac3e 100644 --- a/chrome/browser/ui/webui/app_launcher_page_ui.cc +++ b/chrome/browser/ui/webui/app_launcher_page_ui.cc
@@ -132,9 +132,9 @@ bool is_swipe_tracking_from_scroll_events_enabled = false; #if BUILDFLAG(IS_MAC) - // On Mac OS X 10.7+, horizontal scrolling can be treated as a back or - // forward gesture. Pass through a flag that indicates whether or not that - // feature is enabled. + // On the Mac, horizontal scrolling can be treated as a back or forward + // gesture. Pass through a flag that indicates whether or not that feature is + // enabled. is_swipe_tracking_from_scroll_events_enabled = platform_util::IsSwipeTrackingFromScrollEventsEnabled(); #endif
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index 96ad07a..6bf3e92 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1658491057-fe80b523a6a9e1edd4634ac9632ad21b9a4d0713.profdata +chrome-linux-main-1658512676-b6695eba9e88a97d4d2f04e188c7a0ca6614dade.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index a22df75..fcaa60a2 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1658491057-297ad2fd0b2745bd27323a7a1fbf9a95daf2eee0.profdata +chrome-win32-main-1658501847-d9359f678f2fa3ae7b392ca5025565064d5c703e.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 879a0a6..39962a35 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1658491057-140c232c100ea8eea7a30b798a594c64546127c9.profdata +chrome-win64-main-1658512676-ca3c11dcbebd05c9b9635266f02762ad8243a3ec.profdata
diff --git a/chrome/common/extensions/api/autotest_private.idl b/chrome/common/extensions/api/autotest_private.idl index 642c0a76..df3b1e6f 100644 --- a/chrome/common/extensions/api/autotest_private.idl +++ b/chrome/common/extensions/api/autotest_private.idl
@@ -596,6 +596,8 @@ callback DesksCallback = void (boolean success); + callback GetDeskCountCallback = void (long count); + callback GetScrollableShelfInfoForStateCallback = void ( ScrollableShelfInfo info); @@ -1268,6 +1270,13 @@ long index, DesksCallback callback); + // Fetches the number of open desks in the `DesksController` at the time of + // call. + // `callback`: callback that is passed the number of open desks. + [supportsPromises] static void getDeskCount( + GetDeskCountCallback callback + ); + // Create mouse events to cause a mouse click. // |button|: the mouse button for the click event. // |callback|: called after the mouse click finishes.
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index cdb7937..7fdba4b 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -6641,6 +6641,7 @@ "../browser/ui/search/search_ipc_router_policy_unittest.cc", "../browser/ui/search/search_ipc_router_unittest.cc", "../browser/ui/serial/serial_chooser_controller_unittest.cc", + "../browser/ui/singleton_tabs_unittest.cc", "../browser/ui/sync/sync_promo_ui_unittest.cc", "../browser/ui/tab_contents/chrome_web_contents_menu_helper_unittest.cc", "../browser/ui/tab_contents/chrome_web_contents_view_handle_drop_unittest.cc",
diff --git a/chrome/test/base/chromeos/demo_ash_requires_lacros_browsertest.cc b/chrome/test/base/chromeos/demo_ash_requires_lacros_browsertest.cc index f63aa40..d8c2c6d0 100644 --- a/chrome/test/base/chromeos/demo_ash_requires_lacros_browsertest.cc +++ b/chrome/test/base/chromeos/demo_ash_requires_lacros_browsertest.cc
@@ -21,6 +21,11 @@ // --enable-pixel-output-in-tests // You should see there are 2 browser instances, one is ash browser, // another one is Lacros browser and Lacros is in the front. +// IMPORTANT: If you're adding new tests in browser_tests target following this +// example, make sure to add your tests in +// //testing/buildbot/filters/linux-chromeos.browser_tests.require_lacros.filter +// so that it can run with the correct argument on linux-chromeos-rel builder +// with the step name "browser_tests_require_lacros". class DemoAshRequiresLacrosTest : public InProcessBrowserTest { void SetUpInProcessBrowserTestFixture() override { if (ash_starter_.HasLacrosArgument()) {
diff --git a/chrome/test/data/webui/chromeos/personalization_app/personalization_app_test_utils.ts b/chrome/test/data/webui/chromeos/personalization_app/personalization_app_test_utils.ts index 40dccff4..488868f0 100644 --- a/chrome/test/data/webui/chromeos/personalization_app/personalization_app_test_utils.ts +++ b/chrome/test/data/webui/chromeos/personalization_app/personalization_app_test_utils.ts
@@ -7,9 +7,8 @@ * SWA. */ -import {emptyState, IFrameApi, PersonalizationState, setAmbientProviderForTesting, setKeyboardBacklightProviderForTesting, setThemeProviderForTesting, setUserProviderForTesting, setWallpaperProviderForTesting} from 'chrome://personalization/trusted/personalization_app.js'; +import {emptyState, PersonalizationState, setAmbientProviderForTesting, setKeyboardBacklightProviderForTesting, setThemeProviderForTesting, setUserProviderForTesting, setWallpaperProviderForTesting} from 'chrome://personalization/trusted/personalization_app.js'; import {flush, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {TestBrowserProxy} from 'chrome://webui-test/test_browser_proxy.js'; import {flushTasks} from 'chrome://webui-test/test_util.js'; import {TestAmbientProvider} from './test_ambient_interface_provider.js'; @@ -72,12 +71,3 @@ personalizationStore, }; } - -/** - * Helper function to setup a mock `IFrameApi` singleton. - */ -export function setupTestIFrameApi(): IFrameApi&TestBrowserProxy<IFrameApi> { - const testProxy = TestBrowserProxy.fromClass(IFrameApi); - IFrameApi.setInstance(testProxy); - return testProxy; -}
diff --git a/chrome/test/data/webui/chromeos/personalization_app/wallpaper_collections_element_test.ts b/chrome/test/data/webui/chromeos/personalization_app/wallpaper_collections_element_test.ts index 2fdc60b..a303e0d 100644 --- a/chrome/test/data/webui/chromeos/personalization_app/wallpaper_collections_element_test.ts +++ b/chrome/test/data/webui/chromeos/personalization_app/wallpaper_collections_element_test.ts
@@ -5,13 +5,12 @@ import 'chrome://personalization/strings.m.js'; import 'chrome://webui-test/mojo_webui_test_support.js'; -import {emptyState, GooglePhotosEnablementState, IFrameApi, kDefaultImageSymbol, kMaximumLocalImagePreviews, Paths, PersonalizationRouter, WallpaperActionName, WallpaperCollections} from 'chrome://personalization/trusted/personalization_app.js'; +import {emptyState, kDefaultImageSymbol, WallpaperActionName, WallpaperCollections} from 'chrome://personalization/trusted/personalization_app.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; -import {assertDeepEquals, assertEquals, assertFalse, assertNotEquals, assertTrue} from 'chrome://webui-test/chai_assert.js'; -import {TestBrowserProxy} from 'chrome://webui-test/test_browser_proxy.js'; +import {assertDeepEquals, assertEquals, assertTrue} from 'chrome://webui-test/chai_assert.js'; import {waitAfterNextRender} from 'chrome://webui-test/test_util.js'; -import {baseSetup, initElement, setupTestIFrameApi, teardownElement} from './personalization_app_test_utils.js'; +import {baseSetup, initElement, teardownElement} from './personalization_app_test_utils.js'; import {TestPersonalizationStore} from './test_personalization_store.js'; import {TestWallpaperProvider} from './test_wallpaper_interface_provider.js'; @@ -33,244 +32,6 @@ wallpaperCollectionsElement = null; }); - test('sends wallpaper collections when loaded', async () => { - const testProxy = setupTestIFrameApi(); - wallpaperCollectionsElement = initElement(WallpaperCollections); - - personalizationStore.data.wallpaper.loading = { - ...personalizationStore.data.wallpaper.loading, - collections: false, - }; - personalizationStore.data.wallpaper.backdrop.collections = - wallpaperProvider.collections; - personalizationStore.notifyObservers(); - - // Wait for |sendCollections| to be called. - const [target, data] = await testProxy.whenCalled('sendCollections') as - Parameters<IFrameApi['sendCollections']>; - await waitAfterNextRender(wallpaperCollectionsElement); - - const main = wallpaperCollectionsElement.shadowRoot!.querySelector('main'); - assertFalse(main!.hidden); - - assertEquals( - wallpaperCollectionsElement.$.collectionsGrid, target, - 'collections data is sent to collections-grid'); - assertDeepEquals(wallpaperProvider!.collections, data); - }); - - [GooglePhotosEnablementState.kDisabled, GooglePhotosEnablementState.kEnabled, - GooglePhotosEnablementState.kError] - .forEach( - enabled => test( - 'shows managed UI when Google Photos access is disabled', - async () => { - // Use production |IFrameApi|. - IFrameApi.setInstance(new IFrameApi()); - - // Initialize |wallpaperCollectionsElement|. - wallpaperCollectionsElement = initElement(WallpaperCollections); - await waitAfterNextRender(wallpaperCollectionsElement); - - // Set Google Photos enabled. - personalizationStore.data.wallpaper.googlePhotos.enabled = - enabled; - personalizationStore.notifyObservers(); - - // Set Google Photos photos. - personalizationStore.data.wallpaper.googlePhotos.photos = null; - personalizationStore.notifyObservers(); - - // Cache |googlePhotosTile|. - await waitAfterNextRender(wallpaperCollectionsElement); - const googlePhotosTile = - wallpaperCollectionsElement.$.collectionsGrid.shadowRoot! - .querySelector('.google-photos-empty'); - assertNotEquals(googlePhotosTile, null); - - // Verify text expectations. - const text = googlePhotosTile!.querySelectorAll('p'); - assertEquals(text?.[0]?.innerHTML, 'Google Photos'); - assertEquals( - window.getComputedStyle(text?.[1]!).visibility, 'hidden'); - - // Verify icon expectations. - const icon = googlePhotosTile!.querySelector('iron-icon'); - assertEquals(icon?.icon, 'personalization:managed'); - assertEquals( - getComputedStyle(icon!).getPropertyValue('display'), - enabled === GooglePhotosEnablementState.kDisabled ? - 'block' : - 'none'); - - // Mock singleton |PersonalizationRouter|. - const proxy = TestBrowserProxy.fromClass(PersonalizationRouter); - PersonalizationRouter.instance = () => proxy; - - // Verify click expectations. - (googlePhotosTile as HTMLElement).click(); - assertEquals( - proxy.getCallCount('goToRoute'), - enabled === GooglePhotosEnablementState.kDisabled ? 0 : 1); - assertEquals( - proxy.getArgs('goToRoute')[0] ?? - Paths.GOOGLE_PHOTOS_COLLECTION, - Paths.GOOGLE_PHOTOS_COLLECTION); - })); - - test('sends image counts when a collection loads', async () => { - personalizationStore.data.wallpaper.backdrop = { - collections: wallpaperProvider.collections, - images: {}, - }; - personalizationStore.data.wallpaper.loading = { - ...personalizationStore.data.wallpaper.loading, - collections: false, - images: {}, - }; - - const testProxy = setupTestIFrameApi(); - wallpaperCollectionsElement = initElement(WallpaperCollections); - await testProxy.whenCalled('sendImageCounts'); - - testProxy.resetResolver('sendImageCounts'); - personalizationStore.data.wallpaper.backdrop.images = { - 'id_0': [wallpaperProvider.images![0]], - }; - personalizationStore.data.wallpaper.loading.images = {'id_0': false}; - personalizationStore.notifyObservers(); - - let counts = - (await testProxy.whenCalled('sendImageCounts') as - Parameters<IFrameApi['sendImageCounts']>)[1]; - assertDeepEquals({'id_0': 1}, counts); - - // Load two collections in at once, and simulate one failure. - testProxy.resetResolver('sendImageCounts'); - - personalizationStore.data.wallpaper.backdrop.images = { - 'id_0': [wallpaperProvider.images![0]], - 'id_1': [wallpaperProvider.images![0], wallpaperProvider.images![1]], - 'id_2': [], - 'id_3': null, - 'id_4': [wallpaperProvider.images![0], wallpaperProvider.images![2]], - }; - personalizationStore.data.wallpaper.loading.images = { - 'id_0': false, - 'id_1': false, - 'id_2': false, - 'id_3': false, - 'id_4': false, - }; - personalizationStore.notifyObservers(); - - counts = - (await testProxy.whenCalled('sendImageCounts') as - Parameters<IFrameApi['sendImageCounts']>)[1]; - assertDeepEquals( - {'id_0': 1, 'id_1': 2, 'id_2': 0, 'id_3': null, 'id_4': 1}, counts); - }); - - test('sends local images when local and default image loaded', async () => { - const testProxy = setupTestIFrameApi(); - - wallpaperCollectionsElement = initElement(WallpaperCollections); - - personalizationStore.data.wallpaper.loading = { - ...personalizationStore.data.wallpaper.loading, - collections: false, - local: {images: false, data: {[kDefaultImageSymbol]: false}}, - }; - personalizationStore.data.wallpaper.local.images = - wallpaperProvider.localImages; - personalizationStore.data.wallpaper.backdrop.collections = - wallpaperProvider.collections; - personalizationStore.notifyObservers(); - - // Wait for |sendLocalImages| to be called. - const [target, data] = await testProxy.whenCalled('sendLocalImages') as - Parameters<IFrameApi['sendLocalImages']>; - await waitAfterNextRender(wallpaperCollectionsElement); - - const main = wallpaperCollectionsElement.shadowRoot!.querySelector('main'); - assertFalse(main!.hidden); - - assertEquals( - wallpaperCollectionsElement.$.collectionsGrid, target, - 'local image urls are sent to collections-grid'); - assertDeepEquals(wallpaperProvider.localImages, data); - }); - - test('default image is included in local image list', async () => { - const testProxy = setupTestIFrameApi(); - - wallpaperCollectionsElement = initElement(WallpaperCollections); - - personalizationStore.data.wallpaper.loading = { - ...personalizationStore.data.wallpaper.loading, - collections: false, - local: {images: false, data: {[kDefaultImageSymbol]: false}}, - }; - personalizationStore.data.wallpaper.local.images = - [kDefaultImageSymbol, ...wallpaperProvider.localImages!]; - personalizationStore.data.wallpaper.local.data = - {[kDefaultImageSymbol]: wallpaperProvider.defaultImageThumbnail}; - personalizationStore.notifyObservers(); - - const [_, data] = await testProxy.whenCalled('sendLocalImages') as - Parameters<IFrameApi['sendLocalImages']>; - await waitAfterNextRender(wallpaperCollectionsElement); - - assertTrue(Array.isArray(data), 'sent local images array'); - assertEquals( - 1 + wallpaperProvider.localImages!.length, data.length, - 'Sent default image plus local images'); - assertEquals(kDefaultImageSymbol, data[0], 'default image is index 0'); - }); - - test('sends collections and local images when no internet', async () => { - const testProxy = setupTestIFrameApi(); - - wallpaperCollectionsElement = initElement(WallpaperCollections); - - personalizationStore.data.wallpaper.loading = { - ...personalizationStore.data.wallpaper.loading, - collections: false, - local: {images: false, data: {[kDefaultImageSymbol]: false}}, - }; - personalizationStore.data.wallpaper.local.images = - wallpaperProvider.localImages; - // Simulate online collections failed to load when no internet connection. - personalizationStore.data.wallpaper.backdrop.collections = null; - personalizationStore.notifyObservers(); - - // Wait for |sendCollections| to be called. - const [target, data] = await testProxy.whenCalled('sendCollections') as - Parameters<IFrameApi['sendCollections']>; - await waitAfterNextRender(wallpaperCollectionsElement); - - const main = wallpaperCollectionsElement.shadowRoot!.querySelector('main'); - assertFalse(main!.hidden); - - assertEquals( - wallpaperCollectionsElement.$.collectionsGrid, target, - 'null sent to collections-grid when failed to fetch data'); - assertEquals(null, data); - - // Wait for |sendLocalImages| to be called. - const [imageTarget, imageData] = - await testProxy.whenCalled('sendLocalImages') as - Parameters<IFrameApi['sendLocalImages']>; - await waitAfterNextRender(wallpaperCollectionsElement); - - assertFalse(main!.hidden); - - assertEquals( - wallpaperCollectionsElement.$.collectionsGrid, imageTarget, - 'local images still sent to collections-grid when offline'); - assertDeepEquals(wallpaperProvider.localImages, imageData); - }); - test('shows error when fails to load', async () => { wallpaperCollectionsElement = initElement(WallpaperCollections); @@ -305,7 +66,6 @@ personalizationStore.setReducersEnabled(true); personalizationStore.expectAction( WallpaperActionName.SET_IMAGES_FOR_COLLECTION); - setupTestIFrameApi(); wallpaperCollectionsElement = initElement(WallpaperCollections); @@ -340,79 +100,6 @@ ); }); - test( - 'sends the first four local images that successfully load thumbnails', - async () => { - // Set up store data. Local image list is loaded, but thumbnails are - // still loading in. - personalizationStore.data.wallpaper.loading.local.images = false; - personalizationStore.data.wallpaper.local.images = []; - for (let i = 0; i < kMaximumLocalImagePreviews; i++) { - const path = `LocalImage${i}.png`; - personalizationStore.data.wallpaper.local.images.push({path}); - personalizationStore.data.wallpaper.loading.local.data[path] = true; - } - // Collections are finished loading. - personalizationStore.data.wallpaper.backdrop.collections = - wallpaperProvider.collections; - personalizationStore.data.wallpaper.loading.collections = false; - - const testProxy = setupTestIFrameApi(); - - wallpaperCollectionsElement = initElement(WallpaperCollections); - - await testProxy.whenCalled('sendLocalImages'); - - // No thumbnails loaded so none sent. - assertFalse(wallpaperCollectionsElement['didSendLocalImageData_']); - - // First thumbnail loads in. - personalizationStore.data.wallpaper.loading.local.data = { - 'LocalImage0.png': false, - }; - personalizationStore.data.wallpaper.local.data = { - 'LocalImage0.png': 'local_data_0', - }; - personalizationStore.notifyObservers(); - - await waitAfterNextRender(wallpaperCollectionsElement); - - // Should not have sent any image data since more thumbnails are still - // loading. - assertFalse(wallpaperCollectionsElement['didSendLocalImageData_']); - - // Second thumbnail fails loading. Third and fourth succeed. - personalizationStore.data.wallpaper.loading.local.data = { - ...personalizationStore.data.wallpaper.loading.local.data, - 'LocalImage1.png': false, - 'LocalImage2.png': false, - 'LocalImage3.png': false, - }; - personalizationStore.data.wallpaper.local.data = { - ...personalizationStore.data.wallpaper.local.data, - 'LocalImage1.png': '', - 'LocalImage2.png': 'local_data_2', - 'LocalImage3.png': 'local_data_3', - }; - personalizationStore.notifyObservers(); - - // 3 thumbnails have now loaded. 1 failed. But there are no more - // remaining to try loading, should send local image data anyway. - const [_, sentData] = - await testProxy.whenCalled('sendLocalImageData') as - Parameters<IFrameApi['sendLocalImageData']>; - - assertTrue(wallpaperCollectionsElement['didSendLocalImageData_']); - assertDeepEquals( - { - 'LocalImage0.png': 'local_data_0', - 'LocalImage1.png': '', - 'LocalImage2.png': 'local_data_2', - 'LocalImage3.png': 'local_data_3', - }, - sentData); - }); - test('sets aria label on main', async () => { wallpaperCollectionsElement = initElement(WallpaperCollections); await waitAfterNextRender(wallpaperCollectionsElement);
diff --git a/chromecast/base/cast_features.cc b/chromecast/base/cast_features.cc index 725160e4..eb8fff2 100644 --- a/chromecast/base/cast_features.cc +++ b/chromecast/base/cast_features.cc
@@ -40,11 +40,10 @@ return *features_for_test; } -void SetExperimentIds(const base::Value& list) { +void SetExperimentIds(const base::Value::List& list) { DCHECK(!g_experiment_ids_initialized); - DCHECK(list.is_list()); std::unordered_set<int32_t> ids; - for (const auto& it : list.GetListDeprecated()) { + for (const auto& it : list) { if (it.is_int()) { ids.insert(it.GetInt()); } else { @@ -195,15 +194,13 @@ return *features; } -void InitializeFeatureList(const base::Value& dcs_features, - const base::Value& dcs_experiment_ids, +void InitializeFeatureList(const base::Value::Dict& dcs_features, + const base::Value::List& dcs_experiment_ids, const std::string& cmd_line_enable_features, const std::string& cmd_line_disable_features, const std::string& extra_enable_features, const std::string& extra_disable_features) { DCHECK(!base::FeatureList::GetInstance()); - DCHECK(dcs_features.is_dict()); - DCHECK(dcs_experiment_ids.is_list()); // Set the experiments. SetExperimentIds(dcs_experiment_ids); @@ -219,7 +216,7 @@ all_disable_features); // Override defaults from the DCS config. - for (const auto kv : dcs_features.DictItems()) { + for (const auto kv : dcs_features) { // Each feature must have its own FieldTrial object. Since experiments are // controlled server-side for Chromecast, and this class is designed with a // client-side experimentation framework in mind, these parameters are @@ -293,41 +290,37 @@ return base::FeatureList::IsEnabled(feature); } -base::Value GetOverriddenFeaturesForStorage(const base::Value& features) { - base::Value persistent_dict(base::Value::Type::DICTIONARY); +base::Value::Dict GetOverriddenFeaturesForStorage( + const base::Value::Dict& features) { + base::Value::Dict persistent_dict; // |features| maps feature names to either a boolean or a dict of params. - for (const auto feature : features.DictItems()) { + for (const auto feature : features) { if (feature.second.is_bool()) { - persistent_dict.SetBoolKey(feature.first, feature.second.GetBool()); + persistent_dict.Set(feature.first, feature.second.GetBool()); continue; } if (feature.second.is_dict()) { const base::Value* params_dict = &feature.second; - base::Value params(base::Value::Type::DICTIONARY); + base::Value::Dict params; - for (const auto params_kv : params_dict->DictItems()) { - const auto& param_key = params_kv.first; - const auto& param_val = params_kv.second; + for (const auto [param_key, param_val] : params_dict->GetDict()) { if (param_val.is_bool()) { - params.SetStringKey(param_key, - param_val.GetBool() ? "true" : "false"); + params.Set(param_key, param_val.GetBool() ? "true" : "false"); } else if (param_val.is_int()) { - params.SetStringKey(param_key, - base::NumberToString(param_val.GetInt())); + params.Set(param_key, base::NumberToString(param_val.GetInt())); } else if (param_val.is_double()) { - params.SetStringKey(param_key, - base::NumberToString(param_val.GetDouble())); + params.Set(param_key, base::NumberToString(param_val.GetDouble())); } else if (param_val.is_string()) { - params.SetStringKey(param_key, param_val.GetString()); + params.Set(param_key, param_val.GetString()); } else { LOG(ERROR) << "Entry in params dict for \"" << feature.first << "\"" << " is not of a supported type (key: " << param_key << ", type: " << param_val.type(); } } - persistent_dict.SetPath(feature.first, std::move(params)); + persistent_dict.Set(feature.first, std::move(params)); continue; }
diff --git a/chromecast/base/cast_features.h b/chromecast/base/cast_features.h index 44ca608..a281a23 100644 --- a/chromecast/base/cast_features.h +++ b/chromecast/base/cast_features.h
@@ -12,10 +12,7 @@ #include <vector> #include "base/feature_list.h" - -namespace base { -class Value; -} // namespace base +#include "base/values.h" namespace chromecast { @@ -49,8 +46,8 @@ // called, the other functions in this file may be called on any thread. // TODO(juke): Keep type info of params by passing in base::flat_map and // std::vector instead of base::Value. -void InitializeFeatureList(const base::Value& dcs_features, - const base::Value& dcs_experiment_ids, +void InitializeFeatureList(const base::Value::Dict& dcs_features, + const base::Value::List& dcs_experiment_ids, const std::string& cmd_line_enable_features, const std::string& cmd_line_disable_features, const std::string& extra_enable_features, @@ -63,7 +60,8 @@ // Given a dictionary of features, create a copy that is ready to be persisted // to disk. Encodes all values as strings, which is how the FieldTrial // classes expect the param data. -base::Value GetOverriddenFeaturesForStorage(const base::Value& features); +base::Value::Dict GetOverriddenFeaturesForStorage( + const base::Value::Dict& features); // Query the set of experiment ids set for this run. Intended only for metrics // reporting. Must be called after InitializeFeatureList(). May be called on any
diff --git a/chromecast/base/cast_features_unittest.cc b/chromecast/base/cast_features_unittest.cc index f032b232..337d35fb 100644 --- a/chromecast/base/cast_features_unittest.cc +++ b/chromecast/base/cast_features_unittest.cc
@@ -61,12 +61,12 @@ {&bool_feature, &bool_feature_2, &bool_feature_3, &bool_feature_4}); // Override those features with DCS configs. - base::Value experiments(base::Value::Type::LIST); - base::Value features(base::Value::Type::DICTIONARY); - features.SetBoolKey(kTestBooleanFeatureName, false); - features.SetBoolKey(kTestBooleanFeatureName2, false); - features.SetBoolKey(kTestBooleanFeatureName3, true); - features.SetBoolKey(kTestBooleanFeatureName4, true); + base::Value::List experiments; + base::Value::Dict features; + features.Set(kTestBooleanFeatureName, false); + features.Set(kTestBooleanFeatureName2, false); + features.Set(kTestBooleanFeatureName3, true); + features.Set(kTestBooleanFeatureName4, true); InitializeFeatureList(features, experiments, "", "", "", ""); @@ -85,16 +85,16 @@ chromecast::SetFeaturesForTest({&test_feature}); // Pass params via DCS. - base::Value experiments(base::Value::Type::LIST); - base::Value features(base::Value::Type::DICTIONARY); - base::Value params(base::Value::Type::DICTIONARY); - params.SetStringKey("foo_key", "foo"); - params.SetStringKey("bar_key", "bar"); - params.SetStringKey("doub_key", "3.14159"); - params.SetStringKey("long_doub_key", "1.23459999999999999"); - params.SetStringKey("int_key", "4242"); - params.SetStringKey("bool_key", "true"); - features.SetPath(kTestParamsFeatureName, std::move(params)); + base::Value::List experiments; + base::Value::Dict features; + base::Value::Dict params; + params.Set("foo_key", "foo"); + params.Set("bar_key", "bar"); + params.Set("doub_key", "3.14159"); + params.Set("long_doub_key", "1.23459999999999999"); + params.Set("int_key", "4242"); + params.Set("bool_key", "true"); + features.Set(kTestParamsFeatureName, std::move(params)); InitializeFeatureList(features, experiments, "", "", "", ""); @@ -126,12 +126,12 @@ base::FEATURE_ENABLED_BY_DEFAULT}; // Override those features with DCS configs. - base::Value experiments(base::Value::Type::LIST); - base::Value features(base::Value::Type::DICTIONARY); - features.SetBoolKey(kTestBooleanFeatureName, false); - features.SetBoolKey(kTestBooleanFeatureName2, false); - features.SetBoolKey(kTestBooleanFeatureName3, true); - features.SetBoolKey(kTestBooleanFeatureName4, true); + base::Value::List experiments; + base::Value::Dict features; + features.Set(kTestBooleanFeatureName, false); + features.Set(kTestBooleanFeatureName2, false); + features.Set(kTestBooleanFeatureName3, true); + features.Set(kTestBooleanFeatureName4, true); // Also override a param feature with DCS config. base::Feature params_feature{kTestParamsFeatureName, @@ -140,9 +140,9 @@ &bool_feature_3, &bool_feature_4, ¶ms_feature}); - base::Value params(base::Value::Type::DICTIONARY); - params.SetStringKey("foo_key", "foo"); - features.SetPath(kTestParamsFeatureName, std::move(params)); + base::Value::Dict params; + params.Set("foo_key", "foo"); + features.Set(kTestParamsFeatureName, std::move(params)); // Now override with command line flags. Command line flags should have the // final say. @@ -172,8 +172,8 @@ TEST_F(CastFeaturesTest, SetEmptyExperiments) { // Override those features with DCS configs. - base::Value experiments(base::Value::Type::LIST); - base::Value features(base::Value::Type::DICTIONARY); + base::Value::List experiments; + base::Value::Dict features; InitializeFeatureList(features, experiments, "", "", "", ""); ASSERT_EQ(0u, GetDCSExperimentIds().size()); @@ -181,8 +181,8 @@ TEST_F(CastFeaturesTest, SetGoodExperiments) { // Override those features with DCS configs. - base::Value experiments(base::Value::Type::LIST); - base::Value features(base::Value::Type::DICTIONARY); + base::Value::List experiments; + base::Value::Dict features; int32_t ids[] = {12345678, 123, 0, -1}; std::unordered_set<int32_t> expected; @@ -197,8 +197,8 @@ TEST_F(CastFeaturesTest, SetSomeGoodExperiments) { // Override those features with DCS configs. - base::Value experiments(base::Value::Type::LIST); - base::Value features(base::Value::Type::DICTIONARY); + base::Value::List experiments; + base::Value::Dict features; experiments.Append(1234); experiments.Append("foobar"); experiments.Append(true); @@ -215,8 +215,8 @@ TEST_F(CastFeaturesTest, SetAllBadExperiments) { // Override those features with DCS configs. - base::Value experiments(base::Value::Type::LIST); - base::Value features(base::Value::Type::DICTIONARY); + base::Value::List experiments; + base::Value::Dict features; experiments.Append("foobar"); experiments.Append(true); experiments.Append(1.23456); @@ -228,77 +228,77 @@ } TEST_F(CastFeaturesTest, GetOverriddenFeaturesForStorage) { - base::Value features(base::Value::Type::DICTIONARY); - features.SetBoolKey("bool_key", false); - features.SetBoolKey("bool_key_2", true); + base::Value::Dict features; + features.Set("bool_key", false); + features.Set("bool_key_2", true); - base::Value params(base::Value::Type::DICTIONARY); - params.SetStringKey("foo_key", "foo"); - params.SetStringKey("bar_key", "bar"); - params.SetDoubleKey("doub_key", 3.14159); - params.SetDoubleKey("long_doub_key", 1.234599999999999); - params.SetIntKey("int_key", 4242); - params.SetIntKey("negint_key", -273); - params.SetBoolKey("bool_key", true); - features.SetPath("params_key", std::move(params)); + base::Value::Dict params; + params.Set("foo_key", "foo"); + params.Set("bar_key", "bar"); + params.Set("doub_key", 3.14159); + params.Set("long_doub_key", 1.234599999999999); + params.Set("int_key", 4242); + params.Set("negint_key", -273); + params.Set("bool_key", true); + features.Set("params_key", std::move(params)); auto dict = GetOverriddenFeaturesForStorage(features); - ASSERT_EQ(3u, dict.DictSize()); - auto bval = dict.FindBoolKey("bool_key"); + ASSERT_EQ(3u, dict.size()); + auto bval = dict.FindBool("bool_key"); ASSERT_TRUE(bval.has_value()); ASSERT_EQ(false, *bval); - bval = dict.FindBoolKey("bool_key_2"); + bval = dict.FindBool("bool_key_2"); ASSERT_TRUE(bval.has_value()); ASSERT_EQ(true, *bval); - const auto* dval = dict.FindDictKey("params_key"); + const auto* dval = dict.FindDict("params_key"); const std::string* sval = nullptr; ASSERT_TRUE(dval); - ASSERT_EQ(7u, dval->DictSize()); - sval = dval->FindStringKey("foo_key"); + ASSERT_EQ(7u, dval->size()); + sval = dval->FindString("foo_key"); ASSERT_TRUE(sval); ASSERT_EQ("foo", *sval); - sval = dval->FindStringKey("bar_key"); + sval = dval->FindString("bar_key"); ASSERT_TRUE(sval); ASSERT_EQ("bar", *sval); - sval = dval->FindStringKey("doub_key"); + sval = dval->FindString("doub_key"); ASSERT_TRUE(sval); ASSERT_EQ("3.14159", *sval); - sval = dval->FindStringKey("long_doub_key"); + sval = dval->FindString("long_doub_key"); ASSERT_TRUE(sval); ASSERT_EQ("1.234599999999999", *sval); - sval = dval->FindStringKey("int_key"); + sval = dval->FindString("int_key"); ASSERT_TRUE(sval); ASSERT_EQ("4242", *sval); - sval = dval->FindStringKey("negint_key"); + sval = dval->FindString("negint_key"); ASSERT_TRUE(sval); ASSERT_EQ("-273", *sval); - sval = dval->FindStringKey("bool_key"); + sval = dval->FindString("bool_key"); ASSERT_TRUE(sval); ASSERT_EQ("true", *sval); } TEST_F(CastFeaturesTest, GetOverriddenFeaturesForStorage_BadParams) { - base::Value features(base::Value::Type::DICTIONARY); - features.SetBoolKey("bool_key", false); - features.SetStringKey("str_key", "foobar"); - features.SetIntKey("int_key", 12345); - features.SetDoubleKey("doub_key", 4.5678); + base::Value::Dict features; + features.Set("bool_key", false); + features.Set("str_key", "foobar"); + features.Set("int_key", 12345); + features.Set("doub_key", 4.5678); - base::Value params(base::Value::Type::DICTIONARY); - params.SetStringKey("foo_key", "foo"); - features.SetPath("params_key", std::move(params)); + base::Value::Dict params; + params.Set("foo_key", "foo"); + features.Set("params_key", std::move(params)); auto dict = GetOverriddenFeaturesForStorage(features); - ASSERT_EQ(2u, dict.DictSize()); - auto bval = dict.FindBoolKey("bool_key"); + ASSERT_EQ(2u, dict.size()); + auto bval = dict.FindBool("bool_key"); ASSERT_TRUE(bval.has_value()); ASSERT_EQ(false, *bval); - const auto* dval = dict.FindDictKey("params_key"); + const auto* dval = dict.FindDict("params_key"); ASSERT_TRUE(dval); - ASSERT_EQ(1u, dval->DictSize()); - const auto* sval = dval->FindStringKey("foo_key"); + ASSERT_EQ(1u, dval->size()); + const auto* sval = dval->FindString("foo_key"); ASSERT_TRUE(sval); ASSERT_EQ("foo", *sval); }
diff --git a/chromecast/base/metrics/cast_metrics_helper.cc b/chromecast/base/metrics/cast_metrics_helper.cc index 294d6306..bffcf512 100644 --- a/chromecast/base/metrics/cast_metrics_helper.cc +++ b/chromecast/base/metrics/cast_metrics_helper.cc
@@ -286,18 +286,18 @@ 50); } -base::Value CastMetricsHelper::CreateEventBase(const std::string& name) { - base::Value cast_event(base::Value::Type::DICTIONARY); - cast_event.SetKey("name", base::Value(name)); +base::Value::Dict CastMetricsHelper::CreateEventBase(const std::string& name) { + base::Value::Dict cast_event; + cast_event.Set("name", name); const double time = (Now() - base::TimeTicks()).InMicrosecondsF(); - cast_event.SetKey("time", base::Value(time)); + cast_event.Set("time", time); return cast_event; } void CastMetricsHelper::RecordEventWithValue(const std::string& event, int value) { - base::Value cast_event = CreateEventBase(event); - cast_event.SetKey("value", base::Value(value)); + base::Value::Dict cast_event = CreateEventBase(event); + cast_event.Set("value", value); std::string message; base::JSONWriter::Write(cast_event, &message); RecordSimpleAction(message); @@ -311,10 +311,10 @@ const std::string& session_id, const std::string& sdk_version, const std::string& event) { - base::Value cast_event = CreateEventBase(event); - cast_event.SetKey("app_id", base::Value(app_id)); - cast_event.SetKey("session_id", base::Value(session_id)); - cast_event.SetKey("sdk_version", base::Value(sdk_version)); + base::Value::Dict cast_event = CreateEventBase(event); + cast_event.Set("app_id", app_id); + cast_event.Set("session_id", session_id); + cast_event.Set("sdk_version", sdk_version); std::string message; base::JSONWriter::Write(cast_event, &message); RecordSimpleAction(message); @@ -323,11 +323,11 @@ void CastMetricsHelper::RecordApplicationEventWithValue( const std::string& event, int value) { - base::Value cast_event = CreateEventBase(event); - cast_event.SetKey("app_id", base::Value(app_id_)); - cast_event.SetKey("session_id", base::Value(session_id_)); - cast_event.SetKey("sdk_version", base::Value(sdk_version_)); - cast_event.SetKey("value", base::Value(value)); + base::Value::Dict cast_event = CreateEventBase(event); + cast_event.Set("app_id", app_id_); + cast_event.Set("session_id", session_id_); + cast_event.Set("sdk_version", sdk_version_); + cast_event.Set("value", value); std::string message; base::JSONWriter::Write(cast_event, &message); RecordSimpleAction(message); @@ -339,11 +339,11 @@ const std::string& sdk_version, const std::string& event, int value) { - base::Value cast_event = CreateEventBase(event); - cast_event.SetKey("app_id", base::Value(app_id)); - cast_event.SetKey("session_id", base::Value(session_id)); - cast_event.SetKey("sdk_version", base::Value(sdk_version)); - cast_event.SetKey("value", base::Value(value)); + base::Value::Dict cast_event = CreateEventBase(event); + cast_event.Set("app_id", app_id); + cast_event.Set("session_id", session_id); + cast_event.Set("sdk_version", sdk_version); + cast_event.Set("value", value); std::string message; base::JSONWriter::Write(cast_event, &message); RecordSimpleAction(message);
diff --git a/chromecast/base/metrics/cast_metrics_helper.h b/chromecast/base/metrics/cast_metrics_helper.h index 2d54ec4..eae1037e 100644 --- a/chromecast/base/metrics/cast_metrics_helper.h +++ b/chromecast/base/metrics/cast_metrics_helper.h
@@ -164,7 +164,7 @@ int num_buckets); void LogMediumTimeHistogramEvent(const std::string& name, base::TimeDelta value); - base::Value CreateEventBase(const std::string& name); + base::Value::Dict CreateEventBase(const std::string& name); base::TimeTicks Now(); const scoped_refptr<base::SequencedTaskRunner> task_runner_;
diff --git a/chromecast/browser/cast_feature_list_creator.cc b/chromecast/browser/cast_feature_list_creator.cc index d7c80f1..d2d7a6d4 100644 --- a/chromecast/browser/cast_feature_list_creator.cc +++ b/chromecast/browser/cast_feature_list_creator.cc
@@ -7,6 +7,7 @@ #include "base/base_switches.h" #include "base/command_line.h" #include "base/strings/string_util.h" +#include "base/values.h" #include "chromecast/base/cast_features.h" #include "chromecast/base/pref_names.h" #include "chromecast/browser/metrics/cast_metrics_prefs.h" @@ -45,13 +46,13 @@ pref_service_ = shell::PrefServiceHelper::CreatePrefService( pref_registry.get(), process_type); - const auto* features_dict = - pref_service_->GetDictionary(prefs::kLatestDCSFeatures); - const auto* experiment_ids = - pref_service_->GetList(prefs::kActiveDCSExperiments); + const base::Value::Dict& features_dict = + pref_service_->GetValueDict(prefs::kLatestDCSFeatures); + const base::Value::List& experiment_ids = + pref_service_->GetValueList(prefs::kActiveDCSExperiments); auto* command_line = base::CommandLine::ForCurrentProcess(); InitializeFeatureList( - *features_dict, *experiment_ids, + features_dict, experiment_ids, command_line->GetSwitchValueASCII(switches::kEnableFeatures), command_line->GetSwitchValueASCII(switches::kDisableFeatures), extra_enable_features_, extra_disable_features_);
diff --git a/chromecast/browser/test/cast_features_browsertest.cc b/chromecast/browser/test/cast_features_browsertest.cc index 808d2fdf4..aa8cc7c 100644 --- a/chromecast/browser/test/cast_features_browsertest.cc +++ b/chromecast/browser/test/cast_features_browsertest.cc
@@ -122,10 +122,13 @@ // Write |dcs_features| to the pref store. This method is intended to be // overridden in internal test to utilize the real production codepath for // setting features from the server. - virtual void SetFeatures(const base::DictionaryValue& dcs_features) { - auto pref_features = GetOverriddenFeaturesForStorage(dcs_features); + virtual void SetFeatures(const base::Value::Dict& dcs_features) { + base::Value::Dict pref_features = + GetOverriddenFeaturesForStorage(dcs_features); DictionaryPrefUpdate dict(pref_service(), prefs::kLatestDCSFeatures); - dict->MergeDictionary(&pref_features); + for (auto [pref_name, pref_value] : pref_features) { + dict->SetStringKey(pref_name, pref_value.GetString()); + } pref_service()->CommitPendingWrite(); } @@ -173,10 +176,10 @@ ASSERT_TRUE(chromecast::IsFeatureEnabled(kTestFeat4)); // Set the features to be used on next boot. - base::DictionaryValue features; - features.SetBoolean("test_feat_1", true); - features.SetBoolean("test_feat_4", false); - SetFeatures(features); + base::Value::Dict features; + features.Set("test_feat_1", true); + features.Set("test_feat_4", false); + SetFeatures(std::move(features)); // Default values should still be returned until next boot. EXPECT_FALSE(chromecast::IsFeatureEnabled(kTestFeat1)); @@ -208,15 +211,15 @@ ASSERT_FALSE(chromecast::IsFeatureEnabled(kTestFeat11)); // Set the features to be used on next boot. - base::DictionaryValue features; - auto params = std::make_unique<base::DictionaryValue>(); - params->SetBoolean("bool_param", true); - params->SetBoolean("bool_param_2", false); - params->SetString("str_param", "foo"); - params->SetDoubleKey("doub_param", 3.14159); - params->SetInteger("int_param", 76543); + base::Value::Dict features; + base::Value::Dict params; + params.Set("bool_param", true); + params.Set("bool_param_2", false); + params.Set("str_param", "foo"); + params.Set("doub_param", 3.14159); + params.Set("int_param", 76543); features.Set("test_feat_11", std::move(params)); - SetFeatures(features); + SetFeatures(std::move(features)); // Default value should still be returned until next boot. EXPECT_FALSE(chromecast::IsFeatureEnabled(kTestFeat11)); @@ -262,15 +265,16 @@ ASSERT_TRUE(chromecast::IsFeatureEnabled(kTestFeat24)); // Set both good parameters... - base::DictionaryValue features; - features.SetBoolean("test_feat_21", true); - features.SetBoolean("test_feat_24", false); + base::Value::Dict features; + features.Set("test_feat_21", true); + features.Set("test_feat_24", false); // ... and bad parameters. - features.SetString("test_feat_22", "False"); - features.Set("test_feat_23", std::make_unique<base::ListValue>()); + features.Set("test_feat_22", "False"); + base::Value::List empty_list; + features.Set("test_feat_23", std::move(empty_list)); - SetFeatures(features); + SetFeatures(std::move(features)); } // Test that only well-formed features are persisted to disk. Part 2 of 2.
diff --git a/chromeos/ash/components/dbus/authpolicy/DIR_METADATA b/chromeos/ash/components/dbus/authpolicy/DIR_METADATA new file mode 100644 index 0000000..a5b2a3e --- /dev/null +++ b/chromeos/ash/components/dbus/authpolicy/DIR_METADATA
@@ -0,0 +1,3 @@ +monorail: { + component: "OS>Software>Enterprise>ActiveDirectory" +} \ No newline at end of file
diff --git a/chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_probe.mojom b/chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_probe.mojom index 82dd8cc..676a1ed0 100644 --- a/chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_probe.mojom +++ b/chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_probe.mojom
@@ -86,7 +86,7 @@ // An enumeration of states a process can be in. // -// NextMinVersion: 1, NextIndex: 8 +// NextMinVersion: 2, NextIndex: 9 [Stable, Extensible] enum ProcessState { [Default] kUnknown = 7, @@ -104,6 +104,8 @@ kTracingStop = 5, // The process is dead. kDead = 6, + // The process is idle. + [MinVersion=1] kIdle = 8, }; // Process probe result. Can either be populated with the ProcessInfo or an @@ -123,7 +125,7 @@ // Information related to a particular process. // -// NextMinVersion: 1, NextIndex: 16 +// NextMinVersion: 2, NextIndex: 20 [Stable] struct ProcessInfo { // Command which started the process. @@ -170,6 +172,14 @@ // Number of bytes which this process caused to not happen, by truncating // pagecache. uint64 cancelled_bytes_written@15; + // Filename of the executable. + [MinVersion=1] string? name@16; + // PID of the parent of this process. + [MinVersion=1] uint32 parent_process_id@17; + // Process group ID of the group. + [MinVersion=1] uint32 process_group_id@18; + // Number of threads in this process. + [MinVersion=1] uint32 threads@19; }; // Battery probe result. Can either be populated with the BatteryInfo or an
diff --git a/chromeos/profiles/orderfile.newest.txt b/chromeos/profiles/orderfile.newest.txt index 3fd462da..ba1140d 100644 --- a/chromeos/profiles/orderfile.newest.txt +++ b/chromeos/profiles/orderfile.newest.txt
@@ -1 +1 @@ -chromeos-chrome-orderfile-field-105-5161.0-1658138909-benchmark-105.0.5187.0-r1.orderfile.xz +chromeos-chrome-orderfile-field-105-5161.0-1658138909-benchmark-105.0.5190.0-r1.orderfile.xz
diff --git a/components/autofill/content/renderer/form_autofill_util.cc b/components/autofill/content/renderer/form_autofill_util.cc index ad342be..195bd20 100644 --- a/components/autofill/content/renderer/form_autofill_util.cc +++ b/components/autofill/content/renderer/form_autofill_util.cc
@@ -1680,7 +1680,7 @@ bool IsAdIframe(const WebElement& element) { DCHECK(element.HasHTMLTagName("iframe")); WebFrame* iframe = WebFrame::FromFrameOwnerElement(element); - return iframe && iframe->IsAdSubframe(); + return iframe && iframe->IsAdFrame(); } // A necessary condition for an iframe to be added to FormData::child_frames.
diff --git a/components/autofill/core/browser/browser_autofill_manager.cc b/components/autofill/core/browser/browser_autofill_manager.cc index e4078fd7..7df4ae8 100644 --- a/components/autofill/core/browser/browser_autofill_manager.cc +++ b/components/autofill/core/browser/browser_autofill_manager.cc
@@ -1689,7 +1689,7 @@ const TimeTicks& submission_time, bool observed_submission) { if (submitted_form->ShouldRunHeuristics() || - submitted_form->ShouldRunPromoCodeHeuristics() || + submitted_form->ShouldRunHeuristicsForSingleFieldForms() || submitted_form->ShouldBeQueried()) { submitted_form->LogQualityMetrics( submitted_form->form_parsed_timestamp(), interaction_time,
diff --git a/components/autofill/core/browser/form_parsing/form_field.cc b/components/autofill/core/browser/form_parsing/form_field.cc index 10ab3ab..903b72c 100644 --- a/components/autofill/core/browser/form_parsing/form_field.cc +++ b/components/autofill/core/browser/form_parsing/form_field.cc
@@ -18,6 +18,7 @@ #include "components/autofill/core/browser/autofill_field.h" #include "components/autofill/core/browser/autofill_regexes.h" #include "components/autofill/core/browser/autofill_type.h" +#include "components/autofill/core/browser/field_types.h" #include "components/autofill/core/browser/form_parsing/address_field.h" #include "components/autofill/core/browser/form_parsing/autofill_parsing_utils.h" #include "components/autofill/core/browser/form_parsing/autofill_scanner.h" @@ -36,6 +37,7 @@ #include "components/autofill/core/common/autofill_features.h" #include "components/autofill/core/common/autofill_internals/log_message.h" #include "components/autofill/core/common/autofill_internals/logging_scope.h" +#include "components/autofill/core/common/autofill_payments_features.h" #include "components/autofill/core/common/autofill_util.h" namespace autofill { @@ -72,11 +74,10 @@ page_language, pattern_source, log_manager); const size_t email_count = field_candidates.size(); - // Merchant promo code pass. - ParseFormFieldsPass(MerchantPromoCodeField::Parse, processed_fields, - &field_candidates, page_language, pattern_source, - log_manager); - const size_t promo_code_count = field_candidates.size() - email_count; + // Single fields pass. + ParseSingleFieldForms(fields, page_language, is_form_tag, pattern_source, + &field_candidates, log_manager); + const size_t fillable_single_fields = field_candidates.size() - email_count; // Phone pass. ParseFormFieldsPass(PhoneField::Parse, processed_fields, &field_candidates, @@ -128,13 +129,14 @@ // very easy to have false positives. See http://crbug.com/447332 // For <form> tags, make an exception for email fields, which are commonly // the only recognized field on account registration sites. Also make an - // exception for promo code fields, which are often a single field in its own - // form. + // exception for single-field Autofillable types, even when the form contains + // less than kMinRequiredFieldsForHeuristics fields in its form signature. if (fillable_fields < kMinRequiredFieldsForHeuristics) { - if ((is_form_tag && email_count > 0) || promo_code_count > 0) { + if ((is_form_tag && email_count > 0) || fillable_single_fields > 0) { base::EraseIf(field_candidates, [&](const auto& candidate) { return !(candidate.second.BestHeuristicType() == EMAIL_ADDRESS || - candidate.second.BestHeuristicType() == MERCHANT_PROMO_CODE); + FormField::IsSingleFieldParseableType( + candidate.second.BestHeuristicType())); }); } else { LogBuffer table_rows(IsLoggingActive(log_manager)); @@ -164,21 +166,22 @@ return field_candidates; } -FieldCandidatesMap FormField::ParseFormFieldsForPromoCodes( +void FormField::ParseSingleFieldForms( const std::vector<std::unique_ptr<AutofillField>>& fields, const LanguageCode& page_language, bool is_form_tag, PatternSource pattern_source, + FieldCandidatesMap* field_candidates, LogManager* log_manager) { std::vector<AutofillField*> processed_fields = RemoveCheckableFields(fields); - FieldCandidatesMap field_candidates; // Merchant promo code pass. - ParseFormFieldsPass(MerchantPromoCodeField::Parse, processed_fields, - &field_candidates, page_language, pattern_source, - log_manager); - - return field_candidates; + if (base::FeatureList::IsEnabled( + features::kAutofillParseMerchantPromoCodeFields)) { + ParseFormFieldsPass(MerchantPromoCodeField::Parse, processed_fields, + field_candidates, page_language, pattern_source, + log_manager); + } } // static @@ -485,4 +488,9 @@ return false; } +// static +bool FormField::IsSingleFieldParseableType(ServerFieldType field_type) { + return field_type == MERCHANT_PROMO_CODE; +} + } // namespace autofill
diff --git a/components/autofill/core/browser/form_parsing/form_field.h b/components/autofill/core/browser/form_parsing/form_field.h index 1f1f835..fcd90f4 100644 --- a/components/autofill/core/browser/form_parsing/form_field.h +++ b/components/autofill/core/browser/form_parsing/form_field.h
@@ -55,13 +55,15 @@ PatternSource pattern_source, LogManager* log_manager = nullptr); - // Looks for a promo code field in |fields|. Each field has a derived unique - // name that is used as the key into the returned FieldCandidatesMap. - static FieldCandidatesMap ParseFormFieldsForPromoCodes( + // Looks for types that are allowed to appear in solitary (such as merchant + // promo codes) inside |fields|. Each field has a derived unique name that is + // used as the key into the |field_candidates| parameter. + static void ParseSingleFieldForms( const std::vector<std::unique_ptr<AutofillField>>& fields, const LanguageCode& page_language, bool is_form_tag, PatternSource pattern_source, + FieldCandidatesMap* field_candidates, LogManager* log_manager = nullptr); #if defined(UNIT_TEST) @@ -158,6 +160,9 @@ static bool MatchesFormControlType(base::StringPiece type, DenseSet<MatchFieldType> match_type); + // Returns true if |field_type| is a single field parseable type. + static bool IsSingleFieldParseableType(ServerFieldType field_type); + // Derived classes must implement this interface to supply field type // information. |ParseFormFields| coordinates the parsing and extraction // of types from an input vector of |AutofillField| objects and delegates
diff --git a/components/autofill/core/browser/form_parsing/form_field_unittest.cc b/components/autofill/core/browser/form_parsing/form_field_unittest.cc index aa46f70..b9c1673 100644 --- a/components/autofill/core/browser/form_parsing/form_field_unittest.cc +++ b/components/autofill/core/browser/form_parsing/form_field_unittest.cc
@@ -254,8 +254,8 @@ } } -// Test that |ParseFormFieldsForPromoCodes| parses single field promo codes. -TEST_P(FormFieldTest, ParseFormFieldsForPromoCodes) { +// Test to invoke |ParseSingleFieldForms| in the code path of |ParseFormFields|. +TEST_P(FormFieldTest, ParseSingleFieldFormsInsideParseFormField) { base::test::ScopedFeatureList scoped_feature; scoped_feature.InitAndEnableFeature( features::kAutofillParseMerchantPromoCodeFields); @@ -264,15 +264,47 @@ FormFieldData field_data; field_data.form_control_type = "text"; + field_data.label = u"phone"; + field_data.unique_renderer_id = MakeFieldRendererId(); + fields.push_back(std::make_unique<AutofillField>(field_data)); + + field_data.label = u"email"; + field_data.unique_renderer_id = MakeFieldRendererId(); + fields.push_back(std::make_unique<AutofillField>(field_data)); + + field_data.label = u"Promo code"; + field_data.unique_renderer_id = MakeFieldRendererId(); + fields.push_back(std::make_unique<AutofillField>(field_data)); + + // |ParseSingleFieldForms| should also detect promo code. + EXPECT_EQ(3u, + FormField::ParseFormFields(fields, LanguageCode(""), + /*is_form_tag=*/true, pattern_source()) + .size()); +} + +// Test that |ParseSingleFieldForms| parses single field promo codes. +TEST_P(FormFieldTest, ParseSingleFieldFormsPromoCode) { + base::test::ScopedFeatureList scoped_feature; + scoped_feature.InitAndEnableFeature( + features::kAutofillParseMerchantPromoCodeFields); + + std::vector<std::unique_ptr<AutofillField>> fields; + FormFieldData field_data; + field_data.form_control_type = "text"; + FieldCandidatesMap field_candidates; + // Parse single field promo code. field_data.label = u"Promo code"; field_data.unique_renderer_id = MakeFieldRendererId(); fields.push_back(std::make_unique<AutofillField>(field_data)); - EXPECT_EQ( - 1u, FormField::ParseFormFieldsForPromoCodes( - fields, LanguageCode(""), /*is_form_tag=*/true, pattern_source()) - .size()); + FormField::ParseSingleFieldForms(fields, LanguageCode(""), + /*is_form_tag=*/true, pattern_source(), + &field_candidates); + EXPECT_EQ(1u, field_candidates.size()); + + field_candidates.clear(); // Don't parse other fields. field_data.label = u"Address line 1"; @@ -280,10 +312,10 @@ fields.push_back(std::make_unique<AutofillField>(field_data)); // Still only the promo code field should be parsed. - EXPECT_EQ( - 1u, FormField::ParseFormFieldsForPromoCodes( - fields, LanguageCode(""), /*is_form_tag=*/true, pattern_source()) - .size()); + FormField::ParseSingleFieldForms(fields, LanguageCode(""), + /*is_form_tag=*/true, pattern_source(), + &field_candidates); + EXPECT_EQ(1u, field_candidates.size()); } struct ParseInAnyOrderTestcase {
diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc index 8f5fc4ce..d85d199e 100644 --- a/components/autofill/core/browser/form_structure.cc +++ b/components/autofill/core/browser/form_structure.cc
@@ -865,10 +865,8 @@ HasAllowedScheme(source_url_); } -bool FormStructure::ShouldRunPromoCodeHeuristics() const { - return base::FeatureList::IsEnabled( - features::kAutofillParseMerchantPromoCodeFields) && - active_field_count() > 0 && HasAllowedScheme(source_url_); +bool FormStructure::ShouldRunHeuristicsForSingleFieldForms() const { + return active_field_count() > 0 && HasAllowedScheme(source_url_); } bool FormStructure::ShouldBeQueried() const { @@ -1336,10 +1334,10 @@ field_type_map = FormField::ParseFormFields(fields_, current_page_language_, is_form_tag_, pattern_source, log_manager); - } else if (ShouldRunPromoCodeHeuristics()) { - field_type_map = FormField::ParseFormFieldsForPromoCodes( - fields_, current_page_language_, is_form_tag_, pattern_source, - log_manager); + } else if (ShouldRunHeuristicsForSingleFieldForms()) { + FormField::ParseSingleFieldForms(fields_, current_page_language_, + is_form_tag_, pattern_source, + &field_type_map, log_manager); } if (field_type_map.empty()) return;
diff --git a/components/autofill/core/browser/form_structure.h b/components/autofill/core/browser/form_structure.h index ca9a21f1..f126f252 100644 --- a/components/autofill/core/browser/form_structure.h +++ b/components/autofill/core/browser/form_structure.h
@@ -171,9 +171,10 @@ // this form. bool ShouldRunHeuristics() const; - // Returns true if heuristic autofill type detection for promo codes should be - // attempted for this form. - bool ShouldRunPromoCodeHeuristics() const; + // Returns true if autofill's heuristic field type detection should be + // attempted for this form given that |kMinRequiredFieldsForHeuristics| is not + // met. + bool ShouldRunHeuristicsForSingleFieldForms() const; // Returns true if we should query the crowd-sourcing server to determine this // form's field types. If the form includes author-specified types, this will
diff --git a/components/autofill/core/browser/form_structure_unittest.cc b/components/autofill/core/browser/form_structure_unittest.cc index ca346993..c969102 100644 --- a/components/autofill/core/browser/form_structure_unittest.cc +++ b/components/autofill/core/browser/form_structure_unittest.cc
@@ -152,8 +152,8 @@ return FormStructure(form).ShouldRunHeuristics(); } - bool FormShouldRunPromoCodeHeuristics(const FormData& form) { - return FormStructure(form).ShouldRunPromoCodeHeuristics(); + bool FormShouldRunHeuristicsForSingleFieldForms(const FormData& form) { + return FormStructure(form).ShouldRunHeuristicsForSingleFieldForms(); } bool FormShouldBeQueried(const FormData& form) { @@ -1185,7 +1185,8 @@ } } -// Tests that promo code heuristics are run for forms with fewer than 3 fields. +// Tests that heuristics for single field parseable types are run for forms with +// fewer than 3 fields. TEST_F(FormStructureTestImpl, PromoCodeHeuristics_SmallForm) { base::test::ScopedFeatureList scoped_feature; scoped_feature.InitAndEnableFeature( @@ -1201,7 +1202,7 @@ field.unique_renderer_id = MakeFieldRendererId(); form.fields.push_back(field); - EXPECT_TRUE(FormShouldRunPromoCodeHeuristics(form)); + EXPECT_TRUE(FormShouldRunHeuristicsForSingleFieldForms(form)); // Default configuration. {
diff --git a/components/browser_ui/accessibility/android/BUILD.gn b/components/browser_ui/accessibility/android/BUILD.gn index 3fc4dff..1633aa0 100644 --- a/components/browser_ui/accessibility/android/BUILD.gn +++ b/components/browser_ui/accessibility/android/BUILD.gn
@@ -77,7 +77,10 @@ } robolectric_library("junit") { - sources = [ "java/src/org/chromium/components/browser_ui/accessibility/PageZoomMediatorUnitTest.java" ] + sources = [ + "java/src/org/chromium/components/browser_ui/accessibility/PageZoomMediatorUnitTest.java", + "java/src/org/chromium/components/browser_ui/accessibility/PageZoomUtilsUnitTest.java", + ] deps = [ ":java",
diff --git a/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/PageZoomUtils.java b/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/PageZoomUtils.java index 66b9056..474cf05 100644 --- a/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/PageZoomUtils.java +++ b/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/PageZoomUtils.java
@@ -171,17 +171,22 @@ * @param decrease boolean True if the next index should be decreasing from the current, * false otherwise * @param currentZoomFactor double The current zoom factor for which to search + * @throws IllegalArgumentException if current zoom factor is <= the smallest cached zoom factor + * or >= the largest cached zoom factor * @return int The index of the next closest zoom factor */ public static int getNextIndex(boolean decrease, double currentZoomFactor) { // Assert valid current zoom factor - if (decrease) { - assert currentZoomFactor > PageZoomUtils.AVAILABLE_ZOOM_FACTORS[0]; - } else { - assert currentZoomFactor - < PageZoomUtils + if (decrease && currentZoomFactor <= PageZoomUtils.AVAILABLE_ZOOM_FACTORS[0]) { + throw new IllegalArgumentException("currentZoomFactor should be greater than " + + PageZoomUtils.AVAILABLE_ZOOM_FACTORS[0]); + } else if (!decrease + && currentZoomFactor >= PageZoomUtils.AVAILABLE_ZOOM_FACTORS + [PageZoomUtils.AVAILABLE_ZOOM_FACTORS.length - 1]) { + throw new IllegalArgumentException("currentZoomFactor should be less than " + + PageZoomUtils .AVAILABLE_ZOOM_FACTORS[PageZoomUtils.AVAILABLE_ZOOM_FACTORS.length - - 1]; + - 1]); } // BinarySearch will return the index of the first value equal to the given value.
diff --git a/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/PageZoomUtilsUnitTest.java b/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/PageZoomUtilsUnitTest.java new file mode 100644 index 0000000..caa3a0e1 --- /dev/null +++ b/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/PageZoomUtilsUnitTest.java
@@ -0,0 +1,124 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.components.browser_ui.accessibility; + +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.mockito.Mock; +import org.mockito.MockitoAnnotations; + +import org.chromium.base.test.BaseRobolectricTestRunner; +import org.chromium.base.test.util.JniMocker; +import org.chromium.content.browser.HostZoomMapImpl; +import org.chromium.content.browser.HostZoomMapImplJni; +import org.chromium.content_public.browser.WebContents; +import org.chromium.ui.modelutil.PropertyModel; + +/** Unit tests for {@link PageZoomUtils}. */ +@SmallTest +@RunWith(BaseRobolectricTestRunner.class) +public class PageZoomUtilsUnitTest { + // Error messages + private static final String SEEKBAR_VALUE_TO_ZOOM_FACTOR_FAILURE = + "Failure to correctly convert seek bar value to zoom factor."; + private static final String ZOOM_FACTOR_TO_SEEKBAR_VALUE_FAILURE = + "Failure to correctly convert zoom factor to seek bar value."; + private static final String SEEKBAR_VALUE_TO_ZOOM_LEVEL_FAILURE = + "Failure to correctly convert seek bar value to zoom level."; + + private static final String GET_NEXT_INDEX_DECREASE_FAILURE = + "Failure to get next index in decreasing direction."; + private static final String GET_NEXT_INDEX_INCREASE_FAILURE = + "Failure to get next index in increasing direction."; + + private static final String ROUND_FAILURE = + "Failure to correctly round value to two decimal places."; + + @Rule + public JniMocker mJniMocker = new JniMocker(); + + @Mock + private WebContents mWebContentsMock; + + @Mock + private HostZoomMapImpl.Natives mHostZoomMapMock; + + private PropertyModel mModel; + + @Before + public void setUp() { + MockitoAnnotations.initMocks(this); + + mJniMocker.mock(HostZoomMapImplJni.TEST_HOOKS, mHostZoomMapMock); + } + + @Test + public void testConvertSeekBarValueToZoomFactor() { + // Cached zoom factor + Assert.assertEquals(SEEKBAR_VALUE_TO_ZOOM_FACTOR_FAILURE, 2.22, + PageZoomUtils.convertSeekBarValueToZoomFactor(125), 0.0001); + + // Non-cached zoom factor + Assert.assertEquals(SEEKBAR_VALUE_TO_ZOOM_FACTOR_FAILURE, 2.26, + PageZoomUtils.convertSeekBarValueToZoomFactor(126), 0.0001); + } + + @Test + public void testConvertZoomFactorToSeekBarValue() { + // Cached zoom factor + Assert.assertEquals(ZOOM_FACTOR_TO_SEEKBAR_VALUE_FAILURE, 125, + PageZoomUtils.convertZoomFactorToSeekBarValue(2.22)); + + // Non-cached zoom factor + Assert.assertEquals(ZOOM_FACTOR_TO_SEEKBAR_VALUE_FAILURE, 126, + PageZoomUtils.convertZoomFactorToSeekBarValue(2.26)); + } + + @Test + public void testConvertSeekBarValueToZoomLevel() { + // Cached zoom level + Assert.assertEquals(SEEKBAR_VALUE_TO_ZOOM_LEVEL_FAILURE, 1.5, + PageZoomUtils.convertSeekBarValueToZoomLevel(125), 0.0001); + + // Non-cached zoom level + Assert.assertEquals(SEEKBAR_VALUE_TO_ZOOM_FACTOR_FAILURE, 1.51, + PageZoomUtils.convertSeekBarValueToZoomLevel(126), 0.0001); + } + + @Test + public void testGetNextIndexIncrease() { + Assert.assertEquals(GET_NEXT_INDEX_INCREASE_FAILURE, 9, + PageZoomUtils.getNextIndex(false, 1.00), 0.0001); + } + + @Test(expected = IllegalArgumentException.class) + public void testGetNextIndexIncreaseMax() { + PageZoomUtils.getNextIndex(false, 8.83); + } + + @Test + public void testGetNextIndexDecrease() { + Assert.assertEquals( + GET_NEXT_INDEX_DECREASE_FAILURE, 8, PageZoomUtils.getNextIndex(true, 1.00), 0.0001); + } + + @Test(expected = IllegalArgumentException.class) + public void testGetNextIndexDecreaseMin() { + PageZoomUtils.getNextIndex(true, -7.60); + } + + @Test + public void testRoundTwoDecimalPlaces() { + Assert.assertEquals( + ROUND_FAILURE, 2.12, PageZoomUtils.roundTwoDecimalPlaces(2.123), 0.0001); + Assert.assertEquals( + ROUND_FAILURE, 2.13, PageZoomUtils.roundTwoDecimalPlaces(2.127), 0.0001); + } +} \ No newline at end of file
diff --git a/components/crash/android/java/src/org/chromium/components/crash/LogcatCrashExtractor.java b/components/crash/android/java/src/org/chromium/components/crash/LogcatCrashExtractor.java index f2aae40..7407c435 100644 --- a/components/crash/android/java/src/org/chromium/components/crash/LogcatCrashExtractor.java +++ b/components/crash/android/java/src/org/chromium/components/crash/LogcatCrashExtractor.java
@@ -6,7 +6,6 @@ import androidx.annotation.VisibleForTesting; -import org.chromium.base.ContextUtils; import org.chromium.base.Log; import org.chromium.base.PiiElider; import org.chromium.components.minidump_uploader.CrashFileManager; @@ -44,10 +43,9 @@ /** * @param minidump The minidump file that needs logcat output to be attached. */ - public File attachLogcatToMinidump(File minidump) { + public File attachLogcatToMinidump(File minidump, CrashFileManager fileManager) { Log.i(TAG, "Trying to extract logcat for minidump %s.", minidump.getName()); - CrashFileManager fileManager = - new CrashFileManager(ContextUtils.getApplicationContext().getCacheDir()); + File fileToUpload = minidump; try { List<String> logcat = getElidedLogcat();
diff --git a/components/crash/android/java/src/org/chromium/components/crash/PureJavaExceptionReporter.java b/components/crash/android/java/src/org/chromium/components/crash/PureJavaExceptionReporter.java index eab3d578..89ca5c3 100644 --- a/components/crash/android/java/src/org/chromium/components/crash/PureJavaExceptionReporter.java +++ b/components/crash/android/java/src/org/chromium/components/crash/PureJavaExceptionReporter.java
@@ -67,9 +67,11 @@ // The top level directory where all crash related files are stored. protected final File mCrashFilesDirectory; + private boolean mAttachLogcat; - public PureJavaExceptionReporter(File crashFilesDirectory) { + public PureJavaExceptionReporter(File crashFilesDirectory, boolean attachLogcat) { mCrashFilesDirectory = crashFilesDirectory; + mAttachLogcat = attachLogcat; } @Override @@ -185,8 +187,11 @@ private void uploadReport() { if (mMinidumpFile == null || !mUpload) return; - LogcatCrashExtractor logcatExtractor = new LogcatCrashExtractor(); - mMinidumpFile = logcatExtractor.attachLogcatToMinidump(mMinidumpFile); + if (mAttachLogcat) { + LogcatCrashExtractor logcatExtractor = new LogcatCrashExtractor(); + mMinidumpFile = logcatExtractor.attachLogcatToMinidump( + mMinidumpFile, new CrashFileManager(mCrashFilesDirectory)); + } uploadMinidump(mMinidumpFile); }
diff --git a/components/crash/android/junit/src/org/chromium/components/crash/PureJavaExceptionReporterTest.java b/components/crash/android/junit/src/org/chromium/components/crash/PureJavaExceptionReporterTest.java index f425b2c..30c5349 100644 --- a/components/crash/android/junit/src/org/chromium/components/crash/PureJavaExceptionReporterTest.java +++ b/components/crash/android/junit/src/org/chromium/components/crash/PureJavaExceptionReporterTest.java
@@ -35,7 +35,7 @@ private File mMinidump; public TestPureJavaExceptionReporter() { - super(mTestRule.getCacheDir()); + super(mTestRule.getCacheDir(), /*attachLogcat=*/true); } @Override
diff --git a/components/cronet/android/BUILD.gn b/components/cronet/android/BUILD.gn index 0fb077b..61f772a6 100644 --- a/components/cronet/android/BUILD.gn +++ b/components/cronet/android/BUILD.gn
@@ -47,6 +47,9 @@ generate_jni_registration("cronet_jni_registration") { targets = [ ":cronet_impl_native_base_java" ] header_output = _jni_registration_header + + # JNI generated is used for test and non-test apks. + include_testonly = true sources_exclusions = [ "//base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java", "//base/android/java/src/org/chromium/base/library_loader/LibraryPrefetcher.java",
diff --git a/components/cronet/url_request_context_config.cc b/components/cronet/url_request_context_config.cc index 73daeb93..e7766acd 100644 --- a/components/cronet/url_request_context_config.cc +++ b/components/cronet/url_request_context_config.cc
@@ -92,7 +92,7 @@ const char kQuicEnableSocketRecvOptimization[] = "enable_socket_recv_optimization"; const char kQuicVersion[] = "quic_version"; -const char kQuicObsoleteVersionsAllowed[] = "obsolete_versions_allowed"; +const char kQuicObsoleteVersionsAllowed[] = "obsolete_versions_allowed2"; const char kQuicFlags[] = "set_quic_flags"; const char kQuicIOSNetworkServiceType[] = "ios_network_service_type"; const char kRetryWithoutAltSvcOnQuicErrors[] = @@ -432,12 +432,6 @@ quic::ParsedQuicVersionVector obsolete_versions = net::ObsoleteQuicVersions(); for (const quic::ParsedQuicVersion& version : supported_versions) { - if (version == quic::ParsedQuicVersion::Q043()) { - // TODO(dschinazi) Remove this special-casing of Q043 once we no - // longer have cronet applications that require it. - filtered_versions.push_back(version); - continue; - } if (std::find(obsolete_versions.begin(), obsolete_versions.end(), version) == obsolete_versions.end()) { filtered_versions.push_back(version);
diff --git a/components/cronet/url_request_context_config_unittest.cc b/components/cronet/url_request_context_config_unittest.cc index 189250c1..cb3dfd4 100644 --- a/components/cronet/url_request_context_config_unittest.cc +++ b/components/cronet/url_request_context_config_unittest.cc
@@ -321,7 +321,7 @@ std::string experimental_options = "{\"QUIC\":{\"quic_version\":\"" + quic::QuicVersionToString(version.transport_version) + - "\",\"obsolete_versions_allowed\":true}}"; + "\",\"obsolete_versions_allowed2\":true}}"; std::unique_ptr<URLRequestContextConfig> config = URLRequestContextConfig::CreateURLRequestContextConfig( @@ -562,7 +562,7 @@ std::string("{\"QUIC\":{\"quic_version\":\"") + quic::ParsedQuicVersionToString( net::ObsoleteQuicVersions().back()) + - "\",\"obsolete_versions_allowed\":true}}", + "\",\"obsolete_versions_allowed2\":true}}", // MockCertVerifier to use for testing purposes. std::unique_ptr<net::CertVerifier>(), // Enable network quality estimator.
diff --git a/components/exo/wayland/protocol/aura-shell.xml b/components/exo/wayland/protocol/aura-shell.xml index aac0677..bb0c0bc 100644 --- a/components/exo/wayland/protocol/aura-shell.xml +++ b/components/exo/wayland/protocol/aura-shell.xml
@@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. </copyright> - <interface name="zaura_shell" version="37"> + <interface name="zaura_shell" version="38"> <description summary="aura_shell"> The global interface exposing aura shell capabilities is used to instantiate an interface extension for a wl_surface object. @@ -146,9 +146,21 @@ summary="the aura popup interface id"/> <arg name="popup" type="object" interface="xdg_popup"/> </request> + + <request name="release" type="destructor" since="38"> + <description summary="release zaura_shell object"> + Using this request a client can tell the server that it is not going to + use the zaura_shell object anymore. This does not affect any other objects. + + This is named "release" because "destroy" is a special named function used for + freeing wl_proxy objects. Naming it "destroy" will cause marshalling errors + when running on lower versioned hosts. All "release" requests here should be + renamed to "destroy" if we move to aura-shell v2. + </description> + </request> </interface> - <interface name="zaura_surface" version="29"> + <interface name="zaura_surface" version="38"> <description summary="aura shell interface to a wl_surface"> An additional interface to a wl_surface object, which allows the client to access aura shell specific functionality for surface. @@ -512,9 +524,19 @@ Informs the client to end throttling on the surface. </description> </event> + + <!-- Version 38 additions --> + <request name="release" type="destructor" since="38"> + <description summary="destroy zaura_surface"> + Destroy the zaura_surface object. A client should destroy this object when the + role is unmapped from a wl_surface. + + See zaura_shell.release for destructor naming. + </description> + </request> </interface> - <interface name="zaura_output" version="34"> + <interface name="zaura_output" version="38"> <description summary="aura shell interface to a wl_output"> An additional interface to a wl_output object, which allows the client to access aura shell specific functionality for output. @@ -647,9 +669,22 @@ </description> <arg name="transform" type="int" enum="wl_output.transform"/> </event> + + <!-- Version 38 additions --> + <request name="release" type="destructor" since="38"> + <description summary="destroy zaura_output"> + Destroy this zaura_shell object. + + Destroying a bound zaura_shell object while there are zaura_surfaces + still alive created by this zaura_shell object instance is illegal + and will result in a protocol error. + + See zaura_shell.release for destructor naming. + </description> + </request> </interface> - <interface name="zaura_toplevel" version="36"> + <interface name="zaura_toplevel" version="38"> <description summary="aura shell interface to the toplevel shell"> An interface to the toplevel shell, which allows the client to access shell specific functionality. @@ -766,6 +801,7 @@ <arg name="restore_window_id" type="int" summary="restore browser window id"/> </request> + <!-- Version 31 additions --> <request name="set_system_modal" since="31"> <description summary="make window a system modal"> Requests that the toplevel surface should become a system modal. The @@ -807,9 +843,19 @@ <entry name="normal" value="1" summary="caption with shadow"/> <entry name="shadow" value="2" summary="shadow only"/> </enum> + + <!-- Version 38 additions --> + <request name="release" type="destructor" since="38"> + <description summary="destroy zaura_toplevel"> + Destroy this zaura_toplevel object. A client should call destroy when the role + is unmapped from a wl_surface. + + See zaura_shell.release for destructor naming. + </description> + </request> </interface> - <interface name="zaura_popup" version="37"> + <interface name="zaura_popup" version="38"> <description summary="aura shell interface to the popup shell"> An interface to the popup shell, which allows the client to access shell specific functionality. @@ -847,5 +893,15 @@ Set popup type to menu </description> </request> + + <!-- Version 38 additions --> + <request name="release" type="destructor" since="38"> + <description summary="destroy zaura_popup"> + This request destroys the zaura_popup. A client should call destroy when the + role is unmapped from a wl_surface. + + See zaura_shell.release for destructor naming. + </description> + </request> </interface> </protocol>
diff --git a/components/exo/wayland/zaura_shell.cc b/components/exo/wayland/zaura_shell.cc index d31443f..4461375e 100644 --- a/components/exo/wayland/zaura_shell.cc +++ b/components/exo/wayland/zaura_shell.cc
@@ -273,6 +273,10 @@ GetUserDataAs<AuraSurface>(resource)->Unpin(); } +void aura_surface_release(wl_client* client, wl_resource* resource) { + wl_resource_destroy(resource); +} + const struct zaura_surface_interface aura_surface_implementation = { aura_surface_set_frame, aura_surface_set_parent, @@ -301,6 +305,7 @@ aura_surface_set_initial_workspace, aura_surface_set_pin, aura_surface_unset_pin, + aura_surface_release, }; } // namespace @@ -806,6 +811,18 @@ #endif // BUILDFLAG(IS_CHROMEOS_ASH) +namespace { + +void aura_output_release(wl_client* client, wl_resource* resource) { + wl_resource_destroy(resource); +} + +const struct zaura_output_interface aura_output_implementation = { + aura_output_release, +}; + +} // namespace + //////////////////////////////////////////////////////////////////////////////// // aura_output_interface: @@ -1149,6 +1166,10 @@ AuraTopLevelDecorationType(type)); } +void aura_toplevel_release(wl_client* client, wl_resource* resource) { + wl_resource_destroy(resource); +} + const struct zaura_toplevel_interface aura_toplevel_implementation = { aura_toplevel_set_orientation_lock, aura_toplevel_surface_submission_in_pixel_coordinates, @@ -1159,6 +1180,7 @@ aura_toplevel_unset_system_modal, aura_toplevel_set_restore_info_with_window_id_source, aura_toplevel_set_decoration, + aura_toplevel_release, }; void aura_popup_surface_submission_in_pixel_coordinates(wl_client* client, @@ -1192,10 +1214,15 @@ GetUserDataAs<AuraPopup>(resource)->SetMenu(); } +void aura_popup_release(wl_client* client, wl_resource* resource) { + wl_resource_destroy(resource); +} + const struct zaura_popup_interface aura_popup_implementation = { aura_popup_surface_submission_in_pixel_coordinates, aura_popup_set_decoration, aura_popup_set_menu, + aura_popup_release, }; void aura_shell_get_aura_toplevel(wl_client* client, @@ -1277,7 +1304,8 @@ auto aura_output = std::make_unique<AuraOutput>(aura_output_resource); display_handler->AddObserver(aura_output.get()); - SetImplementation(aura_output_resource, nullptr, std::move(aura_output)); + SetImplementation(aura_output_resource, &aura_output_implementation, + std::move(aura_output)); } void aura_shell_surface_submission_in_pixel_coordinates(wl_client* client, @@ -1285,12 +1313,17 @@ LOG(WARNING) << "Deprecated. The server doesn't support this request."; } +void aura_shell_release(wl_client* client, wl_resource* resource) { + // Nothing to do here. +} + const struct zaura_shell_interface aura_shell_implementation = { aura_shell_get_aura_surface, aura_shell_get_aura_output, aura_shell_surface_submission_in_pixel_coordinates, aura_shell_get_aura_toplevel, aura_shell_get_aura_popup, + aura_shell_release, }; } // namespace
diff --git a/components/exo/wayland/zaura_shell.h b/components/exo/wayland/zaura_shell.h index b0ceb9dc..7f7b07d 100644 --- a/components/exo/wayland/zaura_shell.h +++ b/components/exo/wayland/zaura_shell.h
@@ -26,7 +26,7 @@ namespace wayland { class SerialTracker; -constexpr uint32_t kZAuraShellVersion = 37; +constexpr uint32_t kZAuraShellVersion = 38; // Adds bindings to the Aura Shell. Normally this implies Ash on ChromeOS // builds. On non-ChromeOS builds the protocol provides access to Aura windowing
diff --git a/components/history/core/browser/history_database.cc b/components/history/core/browser/history_database.cc index 611e0ff..d96788e 100644 --- a/components/history/core/browser/history_database.cc +++ b/components/history/core/browser/history_database.cc
@@ -17,9 +17,7 @@ #include "base/logging.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" -#include "base/numerics/safe_conversions.h" #include "base/rand_util.h" -#include "base/strings/string_util.h" #include "base/time/time.h" #include "build/build_config.h" #include "components/sync/base/features.h" @@ -173,6 +171,85 @@ UMA_HISTOGRAM_TIMES("History.DatabaseBasicMetricsTime", base::TimeTicks::Now() - start_time); + if (base::FeatureList::IsEnabled(syncer::kSyncEnableHistoryDataType)) { + // Compute metrics about foreign visits (i.e. visits coming from other + // devices) in the DB. + start_time = base::TimeTicks::Now(); + + sql::Statement foreign_visits_sql(db_.GetUniqueStatement( + "SELECT from_visit, opener_visit, originator_cache_guid, " + "originator_visit_id, originator_from_visit, originator_opener_visit " + "FROM visits WHERE originator_cache_guid IS NOT NULL AND " + "originator_cache_guid != ''")); + + size_t total_foreign_visits = 0; + size_t legacy_foreign_visits = 0; + size_t unmapped_foreign_visits = 0; + size_t mappable_from_visits = 0; + size_t mappable_opener_visits = 0; + while (foreign_visits_sql.Step()) { + ++total_foreign_visits; + + VisitID from_visit = foreign_visits_sql.ColumnInt64(0); + VisitID opener_visit = foreign_visits_sql.ColumnInt64(1); + std::string originator_cache_guid = foreign_visits_sql.ColumnString(2); + VisitID originator_visit = foreign_visits_sql.ColumnInt64(3); + VisitID originator_from_visit = foreign_visits_sql.ColumnInt64(4); + VisitID originator_opener_visit = foreign_visits_sql.ColumnInt64(5); + + // Foreign visits that don't have an originator_visit_id must have come + // from a "legacy" client, i.e. one that's using the Sessions integration + // to sync history. + if (originator_visit == 0) { + ++legacy_foreign_visits; + } + + bool missing_from_visit = (from_visit == 0 && originator_from_visit != 0); + bool missing_opener_visit = + (opener_visit == 0 && originator_opener_visit != 0); + if (missing_from_visit || missing_opener_visit) { + // Found a visit that's missing the local from/opener_visit values. + ++unmapped_foreign_visits; + // Check if a matching referrer/opener visits actually exist in the DB. + sql::Statement matching_visit(db_.GetCachedStatement( + SQL_FROM_HERE, + "SELECT id FROM visits WHERE originator_cache_guid=? AND " + "originator_visit_id=?")); + if (missing_from_visit) { + matching_visit.BindString(0, originator_cache_guid); + matching_visit.BindInt64(1, originator_from_visit); + if (matching_visit.Step()) { + ++mappable_from_visits; + } + matching_visit.Reset(/*clear_bound_vars=*/true); + } + if (missing_opener_visit) { + matching_visit.BindString(0, originator_cache_guid); + matching_visit.BindInt64(1, originator_opener_visit); + if (matching_visit.Step()) { + ++mappable_opener_visits; + } + } + } + } + // Only record these metrics if there are any foreign visits in the DB. + if (total_foreign_visits > 0) { + base::UmaHistogramCounts1M("History.ForeignVisitsTotal", + total_foreign_visits); + base::UmaHistogramCounts1M("History.ForeignVisitsLegacy", + legacy_foreign_visits); + base::UmaHistogramCounts1M("History.ForeignVisitsNotRemapped", + unmapped_foreign_visits); + base::UmaHistogramCounts1M("History.ForeignVisitsRemappableFrom", + mappable_from_visits); + base::UmaHistogramCounts1M("History.ForeignVisitsRemappableOpener", + mappable_opener_visits); + } + + base::UmaHistogramTimes("History.DatabaseForeignVisitMetricsTime", + base::TimeTicks::Now() - start_time); + } + // Compute the advanced metrics even less often, pending timing data showing // that's not necessary. if (base::RandInt(1, 3) == 3) {
diff --git a/components/history/core/browser/history_database.h b/components/history/core/browser/history_database.h index f7a4340..bcf7952 100644 --- a/components/history/core/browser/history_database.h +++ b/components/history/core/browser/history_database.h
@@ -7,7 +7,6 @@ #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" -#include "base/memory/raw_ptr.h" #include "base/time/time.h" #include "build/build_config.h" #include "components/history/core/browser/download_database.h" @@ -18,7 +17,6 @@ #include "components/history/core/browser/visit_annotations_database.h" #include "components/history/core/browser/visit_database.h" #include "components/history/core/browser/visitsegment_database.h" -#include "components/sync/model/model_type_store_base.h" #include "sql/database.h" #include "sql/init_status.h" #include "sql/meta_table.h"
diff --git a/components/lens/lens_entrypoints.cc b/components/lens/lens_entrypoints.cc index 8ef27c0..5ed90b5f 100644 --- a/components/lens/lens_entrypoints.cc +++ b/components/lens/lens_entrypoints.cc
@@ -20,6 +20,7 @@ constexpr char kChromeSearchWithGoogleLensContextMenuItem[] = "ccm"; constexpr char kChromeOpenNewTabSidePanel[] = "cnts"; constexpr char kChromeFullscreenSearchMenuItem[] = "cfs"; +constexpr char kChromeScreenshotSearch[] = "css"; constexpr char kSurfaceQueryParameter[] = "s"; constexpr char kStartTimeQueryParameter[] = "st"; @@ -55,6 +56,10 @@ query_parameters.insert( {kEntryPointQueryParameter, kChromeFullscreenSearchMenuItem}); break; + case lens::CHROME_SCREENSHOT_SEARCH: + query_parameters.insert( + {kEntryPointQueryParameter, kChromeScreenshotSearch}); + break; default: // Empty strings are ignored when query parameters are built. break;
diff --git a/components/lens/lens_entrypoints.h b/components/lens/lens_entrypoints.h index c200723..3ec0de0 100644 --- a/components/lens/lens_entrypoints.h +++ b/components/lens/lens_entrypoints.h
@@ -20,6 +20,7 @@ CHROME_REGION_SEARCH_MENU_ITEM, CHROME_SEARCH_WITH_GOOGLE_LENS_CONTEXT_MENU_ITEM, CHROME_FULLSCREEN_SEARCH_MENU_ITEM, + CHROME_SCREENSHOT_SEARCH, UNKNOWN };
diff --git a/components/lens/lens_entrypoints_unittest.cc b/components/lens/lens_entrypoints_unittest.cc index 652af0f..73303f68 100644 --- a/components/lens/lens_entrypoints_unittest.cc +++ b/components/lens/lens_entrypoints_unittest.cc
@@ -62,6 +62,13 @@ EXPECT_THAT(query_param, MatchesRegex("ep=cfs&s=&st=\\d+")); } +TEST(LensEntryPointsTest, GetScreenshotSearchQueryParameterTest) { + lens::EntryPoint lens_ep = lens::EntryPoint::CHROME_SCREENSHOT_SEARCH; + std::string query_param = lens::GetQueryParametersForLensRequest( + lens_ep, /*is_side_panel_request=*/false); + EXPECT_THAT(query_param, MatchesRegex("ep=css&s=&st=\\d+")); +} + TEST(LensEntryPointsTest, GetUnknownEntryPointTest) { std::string query_param = lens::GetQueryParametersForLensRequest( lens::EntryPoint::UNKNOWN, /*is_side_panel_request=*/false); @@ -129,6 +136,14 @@ EXPECT_THAT(url.query(), MatchesRegex("ep=cfs&s=&st=\\d+")); } +TEST(LensEntryPointsTest, AppendScreenshotSearchQueryParameterTest) { + lens::EntryPoint lens_ep = lens::EntryPoint::CHROME_SCREENSHOT_SEARCH; + GURL original_url = GURL("https://lens.google.com/"); + GURL url = lens::AppendOrReplaceQueryParametersForLensRequest( + original_url, lens_ep, /*is_side_panel_request=*/false); + EXPECT_THAT(url.query(), MatchesRegex("ep=css&s=&st=\\d+")); +} + TEST(LensEntryPointsTest, AppendUnknownEntryPointTest) { GURL original_url = GURL("https://lens.google.com/"); GURL url = lens::AppendOrReplaceQueryParametersForLensRequest(
diff --git a/components/lens/lens_features.cc b/components/lens/lens_features.cc index b1762dd..6868fd1 100644 --- a/components/lens/lens_features.cc +++ b/components/lens/lens_features.cc
@@ -22,6 +22,9 @@ const base::Feature kLensTransparentImagesFix{ "LensTransparentImagesFix", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kLensSearchImageInScreenshotSharing{ + "LensSearchImageInScreenshotSharing", base::FEATURE_DISABLED_BY_DEFAULT}; + const base::FeatureParam<bool> kRegionSearchMacCursorFix{ &kLensStandalone, "region-search-mac-cursor-fix", true}; @@ -61,6 +64,13 @@ const base::FeatureParam<bool> kRegionSearchUseMenuItemAltText3{ &kLensSearchOptimizations, "use-menu-item-alt-text-3", false}; +const base::FeatureParam<bool> kUseSidePanelForScreenshotSharing{ + &kLensSearchImageInScreenshotSharing, + "use-side-panel-for-screenshot-sharing", false}; + +const base::FeatureParam<bool> kEnablePersistentBubble{ + &kLensSearchImageInScreenshotSharing, "enable-persistent-bubble", false}; + // Default is set to true but it is only enabled if kLensSearchOptimizations is // enabled. This setup allows us to have fullscreen search as a toggleable // experience in chrome://flags @@ -135,5 +145,22 @@ base::FeatureList::IsEnabled(kLensTransparentImagesFix); } +bool IsLensInScreenshotSharingEnabled() { + return base::FeatureList::IsEnabled(kLensStandalone) && + base::FeatureList::IsEnabled(kLensSearchImageInScreenshotSharing); +} + +// Does not check if kLensSearchImageInScreenshotSharing is enabled because this +// method is not called if kLensSearchImageInScreenshotSharing is false +bool UseSidePanelForScreenshotSharing() { + return kUseSidePanelForScreenshotSharing.Get(); +} + +// Does not check if kLensSearchImageInScreenshotSharing is enabled because this +// method is not called if kLensSearchImageInScreenshotSharing is false +bool EnablePersistentBubble() { + return kEnablePersistentBubble.Get(); +} + } // namespace features } // namespace lens
diff --git a/components/lens/lens_features.h b/components/lens/lens_features.h index 700c1774e..3847e19c6 100644 --- a/components/lens/lens_features.h +++ b/components/lens/lens_features.h
@@ -26,6 +26,10 @@ // Enables a fix to properly handle transparent images in Lens Image Search extern const base::Feature kLensTransparentImagesFix; +// Enables Lens integration into the Chrome screenshot sharing feature by adding +// a "Search Image" button. +extern const base::Feature kLensSearchImageInScreenshotSharing; + // Enables a fix for cursor pointer/crosshair state over overlay on Mac. // TODO(crbug/1266514): make default and remove feature once launched. extern const base::FeatureParam<bool> kRegionSearchMacCursorFix; @@ -58,6 +62,14 @@ // Enables Lens fullscreen search on Desktop platforms. extern const base::FeatureParam<bool> kEnableFullscreenSearch; +// Enables using side panel in the Chrome Screenshot sharing feature integration +// instead of a new tab. +extern const base::FeatureParam<bool> kUseSidePanelForScreenshotSharing; + +// Forces the Chrome Screenshot sharing dialog bubble to stay open after the +// user clicks the Search Image button. +extern const base::FeatureParam<bool> kEnablePersistentBubble; + // Returns whether to enable UKM logging for Lens Region Search feature. extern bool GetEnableUKMLoggingForRegionSearch(); @@ -105,6 +117,18 @@ // Returns whether to send images to Lens Standalone as PNG extern bool GetSendImagesAsPng(); +// Returns whether the Search Image button in the Chrome Screenshot Sharing +// feature is enabled +extern bool IsLensInScreenshotSharingEnabled(); + +// Returns whether to use the Chrome Side Panel for the Lens integration in +// Chrome Screenshot Sharing feature +extern bool UseSidePanelForScreenshotSharing(); + +// Returns whether the Chrome Screenshot Sharing Bubble disappears after the +// user clicks the Search Image button +extern bool EnablePersistentBubble(); + } // namespace features } // namespace lens
diff --git a/components/messages/android/internal/java/src/org/chromium/components/messages/MessageQueueManagerTest.java b/components/messages/android/internal/java/src/org/chromium/components/messages/MessageQueueManagerTest.java index 01ce78a..c30345e 100644 --- a/components/messages/android/internal/java/src/org/chromium/components/messages/MessageQueueManagerTest.java +++ b/components/messages/android/internal/java/src/org/chromium/components/messages/MessageQueueManagerTest.java
@@ -36,7 +36,7 @@ import org.chromium.base.test.util.DisableIf; import org.chromium.components.messages.MessageQueueManager.MessageState; import org.chromium.components.messages.MessageScopeChange.ChangeType; -import org.chromium.content_public.browser.RenderFrameHost; +import org.chromium.content_public.browser.Visibility; import org.chromium.content_public.browser.test.mock.MockWebContents; import org.chromium.ui.base.WindowAndroid; @@ -76,9 +76,15 @@ private static class ActiveMockWebContents extends MockWebContents { @Override - public RenderFrameHost getFocusedFrame() { - RenderFrameHost host = Mockito.mock(RenderFrameHost.class); - return host; + public @Visibility int getVisibility() { + return Visibility.VISIBLE; + } + } + + private static class InactiveMockWebContents extends MockWebContents { + @Override + public @Visibility int getVisibility() { + return Visibility.HIDDEN; } } @@ -348,8 +354,8 @@ MessageQueueDelegate delegate = Mockito.spy(mEmptyDelegate); MessageQueueManager queueManager = new MessageQueueManager(); queueManager.setDelegate(delegate); - final ScopeKey inactiveScopeKey = new ScopeKey(SCOPE_TYPE, new MockWebContents()); - final ScopeKey inactiveScopeKey2 = new ScopeKey(SCOPE_TYPE, new MockWebContents()); + final ScopeKey inactiveScopeKey = new ScopeKey(SCOPE_TYPE, new InactiveMockWebContents()); + final ScopeKey inactiveScopeKey2 = new ScopeKey(SCOPE_TYPE, new InactiveMockWebContents()); MessageStateHandler m1 = Mockito.spy(new EmptyMessageStateHandler()); queueManager.enqueueMessage(m1, m1, inactiveScopeKey2, false);
diff --git a/components/messages/android/internal/java/src/org/chromium/components/messages/ScopeChangeController.java b/components/messages/android/internal/java/src/org/chromium/components/messages/ScopeChangeController.java index 44e8cbd..e0108f5e 100644 --- a/components/messages/android/internal/java/src/org/chromium/components/messages/ScopeChangeController.java +++ b/components/messages/android/internal/java/src/org/chromium/components/messages/ScopeChangeController.java
@@ -9,6 +9,7 @@ import org.chromium.base.ActivityState; import org.chromium.components.messages.MessageScopeChange.ChangeType; import org.chromium.content_public.browser.NavigationHandle; +import org.chromium.content_public.browser.Visibility; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContentsObserver; import org.chromium.ui.base.WindowAndroid; @@ -81,7 +82,8 @@ mDelegate = delegate; mScopeKey = scopeKey; WebContents webContents = scopeKey.webContents; - int changeType = webContents != null && webContents.getFocusedFrame() != null + int changeType = + webContents != null && webContents.getVisibility() == Visibility.VISIBLE ? ChangeType.ACTIVE : ChangeType.INACTIVE; mDelegate.onScopeChange( @@ -89,13 +91,13 @@ } @Override - public void onWebContentsFocused() { + public void wasShown() { mDelegate.onScopeChange( new MessageScopeChange(mScopeKey.scopeType, mScopeKey, ChangeType.ACTIVE)); } @Override - public void onWebContentsLostFocus() { + public void wasHidden() { mDelegate.onScopeChange( new MessageScopeChange(mScopeKey.scopeType, mScopeKey, ChangeType.INACTIVE)); } @@ -120,7 +122,6 @@ } mLastVisitedUrl = navigationHandle.getUrl(); } - destroy(); }
diff --git a/components/messages/android/internal/java/src/org/chromium/components/messages/ScopeChangeControllerTest.java b/components/messages/android/internal/java/src/org/chromium/components/messages/ScopeChangeControllerTest.java index 1f6989e1..cdab1348 100644 --- a/components/messages/android/internal/java/src/org/chromium/components/messages/ScopeChangeControllerTest.java +++ b/components/messages/android/internal/java/src/org/chromium/components/messages/ScopeChangeControllerTest.java
@@ -68,7 +68,7 @@ Assert.assertEquals("Scope type should be inactive when page is hidden", ChangeType.INACTIVE, captor.getValue().changeType); - observer.onWebContentsFocused(); + observer.wasShown(); expectedOnScopeChangeCalls++; verify(delegate, @@ -78,7 +78,7 @@ Assert.assertEquals("Scope type should be active when page is shown", ChangeType.ACTIVE, captor.getValue().changeType); - observer.onWebContentsLostFocus(); + observer.wasHidden(); expectedOnScopeChangeCalls++; verify(delegate, times(expectedOnScopeChangeCalls) @@ -202,7 +202,7 @@ Assert.assertEquals("Scope type should be inactive when page is hidden", ChangeType.INACTIVE, captor.getValue().changeType); - observer.onWebContentsFocused(); + observer.wasShown(); expectedOnScopeChangeCalls++; verify(delegate, @@ -212,7 +212,7 @@ Assert.assertEquals("Scope type should be active when page is shown", ChangeType.ACTIVE, captor.getValue().changeType); - observer.onWebContentsLostFocus(); + observer.wasHidden(); expectedOnScopeChangeCalls++; verify(delegate, times(expectedOnScopeChangeCalls)
diff --git a/components/network_session_configurator/browser/network_session_configurator.cc b/components/network_session_configurator/browser/network_session_configurator.cc index 0e02e89..77653e7 100644 --- a/components/network_session_configurator/browser/network_session_configurator.cc +++ b/components/network_session_configurator/browser/network_session_configurator.cc
@@ -481,7 +481,7 @@ quic::ParsedQuicVersionVector trial_versions = quic::ParseQuicVersionVectorString(trial_versions_str); const bool obsolete_versions_allowed = base::EqualsCaseInsensitiveASCII( - GetVariationParam(quic_trial_params, "obsolete_versions_allowed"), + GetVariationParam(quic_trial_params, "obsolete_versions_allowed2"), "true"); if (!obsolete_versions_allowed) { quic::ParsedQuicVersionVector filtered_versions;
diff --git a/components/network_session_configurator/browser/network_session_configurator_unittest.cc b/components/network_session_configurator/browser/network_session_configurator_unittest.cc index e24bb0a..ef5e7f5 100644 --- a/components/network_session_configurator/browser/network_session_configurator_unittest.cc +++ b/components/network_session_configurator/browser/network_session_configurator_unittest.cc
@@ -581,7 +581,7 @@ std::map<std::string, std::string> field_trial_params; field_trial_params["quic_version"] = quic::QuicVersionToString(version.transport_version); - field_trial_params["obsolete_versions_allowed"] = "true"; + field_trial_params["obsolete_versions_allowed2"] = "true"; variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); @@ -614,7 +614,7 @@ std::map<std::string, std::string> field_trial_params; field_trial_params["quic_version"] = quic_versions; - field_trial_params["obsolete_versions_allowed"] = "true"; + field_trial_params["obsolete_versions_allowed2"] = "true"; variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); @@ -1077,7 +1077,7 @@ std::string quic_versions = quic::ParsedQuicVersionToString(version_); std::map<std::string, std::string> field_trial_params; field_trial_params["quic_version"] = quic_versions; - field_trial_params["obsolete_versions_allowed"] = "true"; + field_trial_params["obsolete_versions_allowed2"] = "true"; variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); ParseFieldTrials(); @@ -1122,7 +1122,7 @@ quic::ParsedQuicVersionToString(good_version); std::map<std::string, std::string> field_trial_params; field_trial_params["quic_version"] = quic_versions; - field_trial_params["obsolete_versions_allowed"] = "true"; + field_trial_params["obsolete_versions_allowed2"] = "true"; variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); ParseFieldTrials();
diff --git a/components/omnibox/browser/autocomplete_controller.cc b/components/omnibox/browser/autocomplete_controller.cc index f6a85f4..69d7d980 100644 --- a/components/omnibox/browser/autocomplete_controller.cc +++ b/components/omnibox/browser/autocomplete_controller.cc
@@ -437,8 +437,7 @@ providers_.push_back(voice_suggest_provider_.get()); } if (provider_types & AutocompleteProvider::TYPE_HISTORY_FUZZY) { - providers_.push_back(new HistoryFuzzyProvider( - provider_client_.get(), history_quick_provider_, bookmark_provider_)); + providers_.push_back(new HistoryFuzzyProvider(provider_client_.get())); } if (provider_types & AutocompleteProvider::TYPE_OPEN_TAB) { open_tab_provider_ = new OpenTabProvider(provider_client_.get());
diff --git a/components/omnibox/browser/history_fuzzy_provider.cc b/components/omnibox/browser/history_fuzzy_provider.cc index 987a61f4..5424fda 100644 --- a/components/omnibox/browser/history_fuzzy_provider.cc +++ b/components/omnibox/browser/history_fuzzy_provider.cc
@@ -16,9 +16,12 @@ #include "base/check.h" #include "base/memory/raw_ptr.h" +#include "base/memory/scoped_refptr.h" #include "base/metrics/histogram_functions.h" +#include "base/metrics/histogram_macros.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" +#include "base/time/time.h" #include "base/trace_event/memory_usage_estimator.h" #include "base/trace_event/trace_event.h" #include "components/history/core/browser/history_database.h" @@ -28,7 +31,8 @@ #include "components/omnibox/browser/autocomplete_match_classification.h" #include "components/omnibox/browser/autocomplete_match_type.h" #include "components/omnibox/browser/autocomplete_provider_client.h" -#include "components/omnibox/browser/autocomplete_result.h" +#include "components/omnibox/browser/bookmark_provider.h" +#include "components/omnibox/browser/history_quick_provider.h" #include "components/omnibox/browser/omnibox_field_trial.h" #include "components/search_engines/omnibox_focus_type.h" #include "components/url_formatter/elide_url.h" @@ -40,9 +44,16 @@ // Reminder in case other sub-providers or metrics are added: update // the `Omnibox.FuzzyMatchConversion` entry in histograms.xml. const char kMetricMatchConversionHistoryQuick[] = - "Omnibox.FuzzyMatchConversion.HistoryQuick"; + "Omnibox.HistoryFuzzy.MatchConversion.HistoryQuick"; const char kMetricMatchConversionBookmark[] = - "Omnibox.FuzzyMatchConversion.Bookmark"; + "Omnibox.HistoryFuzzy.MatchConversion.Bookmark"; + +// Histogram name for time spent on the fuzzy search portion of provider time. +const char kMetricSearchDuration[] = "Omnibox.HistoryFuzzy.SearchDuration"; + +// Histogram name for whether a presented fuzzy match was the one taken by the +// user at the moment a match was opened. +const char kMetricPrecision[] = "Omnibox.HistoryFuzzy.Precision"; // This cap ensures the search trie will not grow without bound. Up to half // the total capacity may be filled at startup from loaded significant URLs. @@ -493,13 +504,23 @@ } // namespace fuzzy -HistoryFuzzyProvider::HistoryFuzzyProvider( - AutocompleteProviderClient* client, - HistoryQuickProvider* history_quick_provider, - BookmarkProvider* bookmark_provider) - : HistoryProvider(AutocompleteProvider::TYPE_HISTORY_FUZZY, client), - history_quick_provider_(history_quick_provider), - bookmark_provider_(bookmark_provider) { +// static +void HistoryFuzzyProvider::RecordOpenMatchMetrics( + const AutocompleteResult& result, + const AutocompleteMatch& match_opened) { + if (std::any_of(result.begin(), result.end(), + [](const AutocompleteMatch& match) { + return match.provider->type() == + AutocompleteProvider::TYPE_HISTORY_FUZZY; + })) { + const bool opened_fuzzy_match = match_opened.provider->type() == + AutocompleteProvider::TYPE_HISTORY_FUZZY; + UMA_HISTOGRAM_BOOLEAN(kMetricPrecision, opened_fuzzy_match); + } +} + +HistoryFuzzyProvider::HistoryFuzzyProvider(AutocompleteProviderClient* client) + : HistoryProvider(AutocompleteProvider::TYPE_HISTORY_FUZZY, client) { history_service_observation_.Observe(client->GetHistoryService()); client->GetHistoryService()->ScheduleDBTask( FROM_HERE, @@ -523,11 +544,6 @@ return; } - // When there are no sub-providers, bypass fuzzy search completely. - if (history_quick_provider_ == nullptr && bookmark_provider_ == nullptr) { - return; - } - autocomplete_input_ = input; // Fuzzy matching intends to correct quick typos, and because it may involve @@ -541,6 +557,15 @@ match.provider = this; } } + + // When in the counterfactual group, we do all the work of finding fuzzy + // matches, but do not provide the benefit. To reduce risk of unintended + // consequences downstream (for example showing fewer suggestions than + // normal), the matches are cleared here instead of at end of result + // processing pipeline so they won't interact or dedupe with other matches. + if (OmniboxFieldTrial::kFuzzyUrlSuggestionsCounterfactual.Get()) { + matches_.clear(); + } } size_t HistoryFuzzyProvider::EstimateMemoryUsage() const { @@ -569,10 +594,18 @@ } std::vector<fuzzy::Correction> corrections; DVLOG(1) << "FindCorrections: <" << text << "> ---> ?{"; + const base::TimeTicks time_start = base::TimeTicks::Now(); if (root_.FindCorrections(text, kToleranceSchedule, corrections)) { DVLOG(1) << "Trie contains input; no fuzzy results needed"; } + const base::TimeTicks time_end = base::TimeTicks::Now(); + UMA_HISTOGRAM_TIMES(kMetricSearchDuration, time_end - time_start); if (!corrections.empty()) { + // Use of `scoped_refptr` is required here because destructor is private. + scoped_refptr<HistoryQuickProvider> history_quick_provider = + new HistoryQuickProvider(client()); + scoped_refptr<BookmarkProvider> bookmark_provider = + new BookmarkProvider(client()); int count_history_quick = 0; int count_bookmark = 0; for (const auto& correction : corrections) { @@ -590,17 +623,14 @@ autocomplete_input_.current_page_classification(), client()->GetSchemeClassifier()); - if (history_quick_provider_) { - history_quick_provider_->Start(corrected_input, false); - DCHECK(history_quick_provider_->done()); - count_history_quick += - AddConvertedMatches(history_quick_provider_->matches()); - } - if (bookmark_provider_) { - bookmark_provider_->Start(corrected_input, false); - DCHECK(bookmark_provider_->done()); - count_bookmark += AddConvertedMatches(bookmark_provider_->matches()); - } + history_quick_provider->Start(corrected_input, false); + DCHECK(history_quick_provider->done()); + bookmark_provider->Start(corrected_input, false); + DCHECK(bookmark_provider->done()); + + count_history_quick += + AddConvertedMatches(history_quick_provider->matches()); + count_bookmark += AddConvertedMatches(bookmark_provider->matches()); } if (matches_.size() > provider_max_matches_) { // When too many matches are generated, take only the most relevant @@ -609,11 +639,10 @@ matches_.begin() + provider_max_matches_, matches_.end(), AutocompleteMatch::MoreRelevant); for (size_t i = provider_max_matches_; i < matches_.size(); i++) { - DCHECK(matches_[i].provider != nullptr && - matches_[i].provider == history_quick_provider_ || - matches_[i].provider == bookmark_provider_) + DCHECK(matches_[i].provider == history_quick_provider || + matches_[i].provider == bookmark_provider) << matches_[i].provider->GetName(); - if (matches_[i].provider == history_quick_provider_) { + if (matches_[i].provider == history_quick_provider) { count_history_quick--; } else { count_bookmark--;
diff --git a/components/omnibox/browser/history_fuzzy_provider.h b/components/omnibox/browser/history_fuzzy_provider.h index c82058c6..9fb6f7ac 100644 --- a/components/omnibox/browser/history_fuzzy_provider.h +++ b/components/omnibox/browser/history_fuzzy_provider.h
@@ -18,9 +18,8 @@ #include "components/history/core/browser/history_types.h" #include "components/omnibox/browser/autocomplete_input.h" #include "components/omnibox/browser/autocomplete_match.h" -#include "components/omnibox/browser/bookmark_provider.h" +#include "components/omnibox/browser/autocomplete_result.h" #include "components/omnibox/browser/history_provider.h" -#include "components/omnibox/browser/history_quick_provider.h" // This namespace encapsulates the implementation details of fuzzy matching and // correction. It is used by the public (non-namespaced) HistoryFuzzyProvider @@ -181,9 +180,11 @@ class HistoryFuzzyProvider : public HistoryProvider, public history::HistoryServiceObserver { public: - explicit HistoryFuzzyProvider(AutocompleteProviderClient* client, - HistoryQuickProvider* history_quick_provider, - BookmarkProvider* bookmark_provider); + // Records fuzzy matching related metrics when user opens a match. + static void RecordOpenMatchMetrics(const AutocompleteResult& result, + const AutocompleteMatch& match_opened); + + explicit HistoryFuzzyProvider(AutocompleteProviderClient* client); HistoryFuzzyProvider(const HistoryFuzzyProvider&) = delete; HistoryFuzzyProvider& operator=(const HistoryFuzzyProvider&) = delete; @@ -225,10 +226,6 @@ AutocompleteInput autocomplete_input_; - // Non-owning pointers to existing sub-providers; may be null. - raw_ptr<HistoryQuickProvider> history_quick_provider_; - raw_ptr<BookmarkProvider> bookmark_provider_; - // This is the trie facilitating search for input alternatives. fuzzy::Node root_;
diff --git a/components/omnibox/browser/omnibox_edit_model.cc b/components/omnibox/browser/omnibox_edit_model.cc index a7a3da6..86fbcf1 100644 --- a/components/omnibox/browser/omnibox_edit_model.cc +++ b/components/omnibox/browser/omnibox_edit_model.cc
@@ -33,6 +33,7 @@ #include "components/omnibox/browser/autocomplete_classifier.h" #include "components/omnibox/browser/autocomplete_match_type.h" #include "components/omnibox/browser/autocomplete_provider.h" +#include "components/omnibox/browser/history_fuzzy_provider.h" #include "components/omnibox/browser/history_url_provider.h" #include "components/omnibox/browser/keyword_provider.h" #include "components/omnibox/browser/location_bar_model.h" @@ -828,6 +829,7 @@ focus_resulted_in_navigation_ = true; RecordActionShownForAllActions(result(), OmniboxPopupSelection::kNoMatch); + HistoryFuzzyProvider::RecordOpenMatchMetrics(result(), match); std::u16string input_text(pasted_text); if (input_text.empty())
diff --git a/components/omnibox/browser/omnibox_field_trial.cc b/components/omnibox/browser/omnibox_field_trial.cc index 94b1eb57..6bdeef1 100644 --- a/components/omnibox/browser/omnibox_field_trial.cc +++ b/components/omnibox/browser/omnibox_field_trial.cc
@@ -595,6 +595,12 @@ return base::FeatureList::IsEnabled(omnibox::kOmniboxFuzzyUrlSuggestions); } +const base::FeatureParam<bool> + OmniboxFieldTrial::kFuzzyUrlSuggestionsCounterfactual( + &omnibox::kOmniboxFuzzyUrlSuggestions, + "FuzzyUrlSuggestionsCounterfactual", + false); + bool OmniboxFieldTrial::IsExperimentalKeywordModeEnabled() { return base::FeatureList::IsEnabled(omnibox::kExperimentalKeywordMode); }
diff --git a/components/omnibox/browser/omnibox_field_trial.h b/components/omnibox/browser/omnibox_field_trial.h index 7b15a6a..45bc53a 100644 --- a/components/omnibox/browser/omnibox_field_trial.h +++ b/components/omnibox/browser/omnibox_field_trial.h
@@ -355,6 +355,8 @@ // Returns true if the fuzzy URL suggestions feature is enabled. bool IsFuzzyUrlSuggestionsEnabled(); +// Indicates whether fuzzy match behavior is counterfactual. +extern const base::FeatureParam<bool> kFuzzyUrlSuggestionsCounterfactual; // Simply a convenient wrapper for testing a flag. Used downstream for an // assortment of keyword mode experiments.
diff --git a/components/omnibox/common/omnibox_features.cc b/components/omnibox/common/omnibox_features.cc index adfd095..c21f5f99 100644 --- a/components/omnibox/common/omnibox_features.cc +++ b/components/omnibox/common/omnibox_features.cc
@@ -250,7 +250,7 @@ // "loss" to represent colors red and green in a way that is appropriate for a // given country/culture const base::Feature kSuggestionAnswersColorReverse = { - "SuggestionAnswersColorReverse", base::FEATURE_DISABLED_BY_DEFAULT}; + "SuggestionAnswersColorReverse", base::FEATURE_ENABLED_BY_DEFAULT}; // If enabled, frequently visited sites are presented in form of a single row // with a carousel of tiles, instead of one URL per row. @@ -286,6 +286,11 @@ const base::Feature kOmniboxFuzzyUrlSuggestions{ "OmniboxFuzzyUrlSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; +// Feature used to remove the capitalization of the suggestion header text. +const base::Feature kOmniboxRemoveSuggestionHeaderCapitalization{ + "OmniboxRemoveSuggestionHeaderCapitalization", + base::FEATURE_DISABLED_BY_DEFAULT}; + // Feature used to remove the chevron on the right side of suggestion list // header under omnibox. const base::Feature kOmniboxRemoveSuggestionHeaderChevron{
diff --git a/components/omnibox/common/omnibox_features.h b/components/omnibox/common/omnibox_features.h index ee905cb..74f2c0329d 100644 --- a/components/omnibox/common/omnibox_features.h +++ b/components/omnibox/common/omnibox_features.h
@@ -80,6 +80,7 @@ extern const base::Feature kNtpRealboxSuggestionAnswers; extern const base::Feature kNtpRealboxTailSuggest; extern const base::Feature kOmniboxFuzzyUrlSuggestions; +extern const base::Feature kOmniboxRemoveSuggestionHeaderCapitalization; extern const base::Feature kOmniboxRemoveSuggestionHeaderChevron; extern const base::Feature kStrippedGurlOptimization;
diff --git a/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc b/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc index 5c305be..f4aaf27b 100644 --- a/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc +++ b/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc
@@ -79,7 +79,7 @@ content::NavigationThrottle::ThrottleCheckResult ActivationStateComputingNavigationThrottle::WillProcessResponse() { - // If no parent activation, this is main frame that was never notified of + // If no parent activation, this is root frame that was never notified of // activation. if (!parent_activation_state_) { DCHECK(IsInSubresourceFilterRoot(navigation_handle())); @@ -144,7 +144,7 @@ } void ActivationStateComputingNavigationThrottle::UpdateWithMoreAccurateState() { - // This method is only needed for main frame navigations that are notified of + // This method is only needed for root frame navigations that are notified of // page activation more than once. Even for those that are updated once, it // should be a no-op. DCHECK(IsInSubresourceFilterRoot(navigation_handle()));
diff --git a/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.h b/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.h index 43d7868..ff5b28a 100644 --- a/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.h +++ b/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.h
@@ -19,14 +19,15 @@ class AsyncDocumentSubresourceFilter; // NavigationThrottle responsible for determining the activation state of -// subresource filtering for a given navigation (either in the main frame or in -// a subframe); and for deferring that navigation at WillProcessResponse until -// the activation state computation on the ruleset's task runner is complete. +// subresource filtering for a given navigation (either in the root frame or in +// a child frame); and for deferring that navigation at WillProcessResponse +// until the activation state computation on the ruleset's task runner is +// complete. // // Interested parties can retrieve the activation state after this point (most // likely in ReadyToCommitNavigation). // -// Note: for performance, activation computation for subframes is done +// Note: for performance, activation computation for child frames is done // speculatively at navigation start and at every redirect. This is to reduce // the wait time (most likely to 0) by WillProcessResponse time. For main // frames, speculation will be done at the next navigation stage after @@ -57,10 +58,10 @@ ~ActivationStateComputingNavigationThrottle() override; - // Notification for main frames when the page level activation is computed. + // Notification for root frames when the page level activation is computed. // Must be called at most once before WillProcessResponse is called on this // throttle. If it is never called, this object will never delay the - // navigation for main frames. + // navigation for root frames. // // Should never be called with DISABLED activation. // @@ -81,8 +82,8 @@ // After the navigation is finished, the client may optionally choose to // continue using the DocumentSubresourceFilter that was used to compute the - // activation state for this frame. The transfered filter can be cached and - // used to calculate load policy for subframe navigations occuring in this + // activation state for this frame. The transferred filter can be cached and + // used to calculate load policy for child frame navigations occurring in this // frame. std::unique_ptr<AsyncDocumentSubresourceFilter> ReleaseFilter(); @@ -94,7 +95,7 @@ void CheckActivationState(); void OnActivationStateComputed(mojom::ActivationState state); - // In the case when main frame navigations get notified of + // In the case when root frame navigations get notified of // mojom::ActivationState multiple times, a method is needed for overriding // previously computed results with a more accurate mojom::ActivationState. // @@ -111,7 +112,7 @@ std::unique_ptr<AsyncDocumentSubresourceFilter> async_filter_; - // Must outlive this class. For main frame navigations, this member will be + // Must outlive this class. For root frame navigations, this member will be // nullptr until NotifyPageActivationWithRuleset is called. raw_ptr<VerifiedRuleset::Handle> ruleset_handle_;
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.cc b/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.cc index e90ab5e..aa0d382e 100644 --- a/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.cc +++ b/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.cc
@@ -174,7 +174,7 @@ // Pull the AsyncDocumentSubresourceFilter and its associated // mojom::ActivationState out of the activation state computing throttle. Store -// it for later filtering of subframe navigations. +// it for later filtering of child frame navigations. void ContentSubresourceFilterThrottleManager::ReadyToCommitInFrameNavigation( content::NavigationHandle* navigation_handle) { ready_to_commit_navigations_.insert(navigation_handle->GetNavigationId()); @@ -197,7 +197,7 @@ ad_evidence.set_is_complete(); ad_evidence_for_navigation = ad_evidence; - SetIsAdFrame(frame_host, ad_evidence.IndicatesAdSubframe()); + SetIsAdFrame(frame_host, ad_evidence.IndicatesAdFrame()); } mojom::ActivationState activation_state = @@ -296,8 +296,8 @@ return; } - // Finish setting FrameAdEvidence fields on initial subframe navigations that - // did not pass through `ReadyToCommitNavigation()`. Note that initial + // Finish setting FrameAdEvidence fields on initial child frame navigations + // that did not pass through `ReadyToCommitNavigation()`. Note that initial // navigations to about:blank commit synchronously. We handle navigations // there where possible to ensure that any messages to the renderer contain // the right ad status. @@ -317,7 +317,7 @@ // update the DCHECK to verify that the evidence doesn't indicate a subframe // (regardless of the URL). DCHECK(!(navigation_handle->GetURL().IsAboutBlank() && - EnsureFrameAdEvidence(navigation_handle).IndicatesAdSubframe())); + EnsureFrameAdEvidence(navigation_handle).IndicatesAdFrame())); } else { DCHECK(navigation_handle->IsInMainFrame() || EnsureFrameAdEvidence(navigation_handle).is_complete()); @@ -377,7 +377,7 @@ navigation_handle->HasCommitted()); blink::mojom::FilterListResult latest_filter_list_result = EnsureFrameAdEvidence(navigation_handle).latest_filter_list_result(); - bool is_same_domain_to_main_frame = + bool is_same_domain_to_outermost_main_frame = net::registry_controlled_domains::SameDomainOrHost( navigation_handle->GetURL(), navigation_handle->GetRenderFrameHost() @@ -389,7 +389,7 @@ blink::mojom::FilterListResult::kMatchedAllowingRule || (latest_filter_list_result == blink::mojom::FilterListResult::kMatchedNoRules && - is_same_domain_to_main_frame); + is_same_domain_to_outermost_main_frame); if (is_restricted_navigation && base::Contains(ad_frames_, navigation_handle->GetFrameTreeNodeId())) { base::UmaHistogramBoolean( @@ -547,7 +547,7 @@ activation_state); } -void ContentSubresourceFilterThrottleManager::OnSubframeNavigationEvaluated( +void ContentSubresourceFilterThrottleManager::OnChildFrameNavigationEvaluated( content::NavigationHandle* navigation_handle, LoadPolicy load_policy) { DCHECK(!IsInSubresourceFilterRoot(navigation_handle)); @@ -749,7 +749,7 @@ } } -void ContentSubresourceFilterThrottleManager::OnFrameIsAdSubframe( +void ContentSubresourceFilterThrottleManager::OnFrameIsAd( content::RenderFrameHost* render_frame_host) { EnsureFrameAdEvidence(render_frame_host).set_is_complete(); @@ -762,7 +762,7 @@ bool is_ad_frame) { int frame_tree_node_id = render_frame_host->GetFrameTreeNodeId(); DCHECK(base::Contains(tracked_ad_evidence_, frame_tree_node_id)); - DCHECK_EQ(tracked_ad_evidence_.at(frame_tree_node_id).IndicatesAdSubframe(), + DCHECK_EQ(tracked_ad_evidence_.at(frame_tree_node_id).IndicatesAdFrame(), is_ad_frame); DCHECK(render_frame_host->GetParentOrOuterDocument()); @@ -778,11 +778,11 @@ // Replicate `is_ad_frame` to this frame's proxies, so that it can be // looked up in any process involved in rendering the current page. - render_frame_host->UpdateIsAdSubframe(is_ad_frame); + render_frame_host->UpdateIsAdFrame(is_ad_frame); SubresourceFilterObserverManager::FromWebContents( content::WebContents::FromRenderFrameHost(render_frame_host)) - ->NotifyIsAdSubframeChanged(render_frame_host, is_ad_frame); + ->NotifyIsAdFrameChanged(render_frame_host, is_ad_frame); } void ContentSubresourceFilterThrottleManager::SetIsAdFrameForTesting( @@ -796,11 +796,11 @@ if (is_ad_frame) { // We mark the frame as matching a blocking rule so that the ad evidence - // indicates an ad subframe. + // indicates an ad frame. EnsureFrameAdEvidence(render_frame_host) .UpdateFilterListResult( blink::mojom::FilterListResult::kMatchedBlockingRule); - OnFrameIsAdSubframe(render_frame_host); + OnFrameIsAd(render_frame_host); } else { // There's currently no legal transition that can untag a frame. Instead, to // mimic future behavior, we simply replace the FrameAdEvidence. @@ -824,10 +824,10 @@ MaybeShowNotification(receiver_.GetCurrentTargetFrame()); } -void ContentSubresourceFilterThrottleManager::FrameIsAdSubframe() { - // `FrameIsAdSubframe()` can only be called for an initial empty document. As - // it won't pass through `ReadyToCommitNavigation()` (and has not yet passed - // through `DidFinishNavigation()`), we know it won't be updated further. +void ContentSubresourceFilterThrottleManager::FrameIsAd() { + // `FrameIsAd()` can only be called for an initial empty document. As it won't + // pass through `ReadyToCommitNavigation()` (and has not yet passed through + // `DidFinishNavigation()`), we know it won't be updated further. // // The fenced frame root will not report this for the initial empty document // as the fenced frame is isolated from the embedder cannot be scripted. In @@ -837,7 +837,7 @@ content::RenderFrameHost* render_frame_host = receiver_.GetCurrentTargetFrame(); DCHECK(!render_frame_host->IsFencedFrameRoot()); - OnFrameIsAdSubframe(receiver_.GetCurrentTargetFrame()); + OnFrameIsAd(receiver_.GetCurrentTargetFrame()); } void ContentSubresourceFilterThrottleManager::SetDocumentLoadStatistics( @@ -856,7 +856,7 @@ OnAdsViolationTriggered(&page_->GetMainDocument(), violation); } -void ContentSubresourceFilterThrottleManager::SubframeWasCreatedByAdScript() { +void ContentSubresourceFilterThrottleManager::FrameWasCreatedByAdScript() { OnChildFrameWasCreatedByAdScript(receiver_.GetCurrentTargetFrame()); } @@ -882,11 +882,11 @@ // // Normal frames compute this when the new RenderFrame initializes since that // happens synchronously during the CreateFrame call. At that time, - // SubresourceFilterAgent calls SubframeWasCreatedByAdScript if needed. - // However, creating an MPArch-based FencedFrame doesn't create a RenderFrame - // in the calling process; it creates a RenderFrame in another renderer via - // IPC at which point we cannot inspect the v8 stack so we use this special - // path for fenced frames. + // SubresourceFilterAgent calls FrameWasCreatedByAdScript if needed. However, + // creating an MPArch-based FencedFrame doesn't create a RenderFrame in the + // calling process; it creates a RenderFrame in another renderer via IPC at + // which point we cannot inspect the v8 stack so we use this special path for + // fenced frames. content::RenderFrameHost* owner_frame = receiver_.GetCurrentTargetFrame(); DCHECK(owner_frame);
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.h b/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.h index ee3fbe5..b551e14 100644 --- a/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.h +++ b/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.h
@@ -71,8 +71,8 @@ }; // The ContentSubresourceFilterThrottleManager manages NavigationThrottles in -// order to calculate frame activation states and subframe navigation filtering, -// within a given Page. It contains a mapping of all activated +// order to calculate frame activation states and child frame navigation +// filtering, within a given Page. It contains a mapping of all activated // RenderFrameHosts, along with their associated DocumentSubresourceFilters. // // This class is created for each Page that is a "subresource filter root". @@ -85,7 +85,10 @@ // Portals also have their own Page but their behavior hasn't been considered // in detail yet; they are currently considered a root. See // IsInSubresourceFilterRoot in -// content_subresource_filter_web_contents_helper.cc. +// content_subresource_filter_web_contents_helper.cc. The term "main frame" is +// avoided in subresource filter code to avoid ambiguity; instead, the main +// frame of a page that is a subresource filter root is called a "root frame" +// while other frames are called "child frames". // // Since this class is associated with a Page, cross document navigation to a // new Page will create a new instance of this class. @@ -169,10 +172,11 @@ // This method inspects `navigation_handle` and attaches navigation throttles // appropriately, based on the current state of frame activation. // - // 1. Subframe navigation filtering throttles are appended if the parent + // 1. Child frame navigation filtering throttles are appended if the parent // frame is activated. // 2. Activation state computing throttles are appended if either the - // navigation is a main frame navigation, or if the parent frame is activated. + // navigation is a subresource filter root frame navigation, or if the parent + // frame is activated. // // Note that there is currently no constraints on the ordering of throttles. void MaybeAppendNavigationThrottles( @@ -250,7 +254,7 @@ // SubresourceFilterObserver. void OnPageActivationComputed(content::NavigationHandle* navigation_handle, const mojom::ActivationState& activation_state); - void OnSubframeNavigationEvaluated( + void OnChildFrameNavigationEvaluated( content::NavigationHandle* navigation_handle, LoadPolicy load_policy); @@ -309,15 +313,15 @@ // Registers `render_frame_host` as an ad frame. If the frame later moves to // a new process its RenderHost will be told that it's an ad. - void OnFrameIsAdSubframe(content::RenderFrameHost* render_frame_host); + void OnFrameIsAd(content::RenderFrameHost* render_frame_host); // Registers `frame_host` as a frame that was created by ad script. void OnChildFrameWasCreatedByAdScript(content::RenderFrameHost* frame_host); // mojom::SubresourceFilterHost: void DidDisallowFirstSubresource() override; - void FrameIsAdSubframe() override; - void SubframeWasCreatedByAdScript() override; + void FrameIsAd() override; + void FrameWasCreatedByAdScript() override; void AdScriptDidCreateFencedFrame( const blink::RemoteFrameToken& placeholder_token) override; void SetDocumentLoadStatistics( @@ -345,8 +349,8 @@ content::NavigationHandle* navigation_handle, bool passed_through_ready_to_commit); - // Sets whether the frame is considered an ad subframe. If the value has - // changed, we also update the replication state and inform observers. + // Sets whether the frame is considered an ad frame. If the value has changed, + // we also update the replication state and inform observers. void SetIsAdFrame(content::RenderFrameHost* render_frame_host, bool is_ad_frame); @@ -369,13 +373,13 @@ base::flat_set<int64_t> ready_to_commit_navigations_; // Set of frames that have been identified as ads, identified by FrameTreeNode - // ID. A RenderFrameHost is an ad subframe iff the FrameAdEvidence + // ID. A RenderFrameHost is an ad frame iff the FrameAdEvidence // corresponding to the frame indicates that it is. base::flat_set<int> ad_frames_; - // Map of subframes, keyed by FrameTreeNode ID, with value being the evidence - // for or against the frames being ads. This evidence is updated whenever a - // navigation's LoadPolicy is calculated. + // Map of child frames, keyed by FrameTreeNode ID, with value being the + // evidence for or against the frames being ads. This evidence is updated + // whenever a navigation's LoadPolicy is calculated. std::map<int, blink::FrameAdEvidence> tracked_ad_evidence_; // Map of frames whose navigations have been identified as ads, keyed by
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager_unittest.cc b/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager_unittest.cc index 4749b13c..524a96e 100644 --- a/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager_unittest.cc +++ b/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager_unittest.cc
@@ -103,15 +103,14 @@ mojom::ActivationStatePtr activation_state, const absl::optional<blink::FrameAdEvidence>& ad_evidence) override { last_activation_ = std::move(activation_state); - is_ad_subframe_ = - ad_evidence.has_value() && ad_evidence->IndicatesAdSubframe(); + is_ad_frame_ = ad_evidence.has_value() && ad_evidence->IndicatesAdFrame(); } // These methods reset state back to default when they are called. - bool LastAdSubframe() { - bool is_ad_subframe = is_ad_subframe_; - is_ad_subframe_ = false; - return is_ad_subframe; + bool LastAdFrame() { + bool is_ad_frame = is_ad_frame_; + is_ad_frame_ = false; + return is_ad_frame; } absl::optional<bool> LastActivated() { if (!last_activation_) @@ -124,7 +123,7 @@ private: mojom::ActivationStatePtr last_activation_; - bool is_ad_subframe_ = false; + bool is_ad_frame_ = false; mojo::AssociatedReceiver<mojom::SubresourceFilterAgent> receiver_{this}; }; @@ -270,7 +269,7 @@ void ExpectActivationSignalForFrame( content::RenderFrameHost* rfh, bool expect_activation, - bool expect_is_ad_subframe = false, + bool expect_is_ad_frame = false, bool expect_activation_sent_to_agent = true) { // In some cases we need to verify that messages were _not_ sent, in which // case using a Wait() idiom would cause hangs. RunUntilIdle instead to @@ -279,7 +278,7 @@ FakeSubresourceFilterAgent* agent = agent_map_[rfh].get(); absl::optional<bool> last_activated = agent->LastActivated(); EXPECT_EQ(expect_activation, last_activated && *last_activated); - EXPECT_EQ(expect_is_ad_subframe, agent->LastAdSubframe()); + EXPECT_EQ(expect_is_ad_frame, agent->LastAdFrame()); EXPECT_EQ(expect_activation_sent_to_agent, last_activated.has_value()); } @@ -533,7 +532,7 @@ navigation_simulator()->GetFinalRenderFrameHost(); // But it should still be activated. ExpectActivationSignalForFrame(child, true /* expect_activation */, - true /* is_ad_subframe */); + true /* is_ad_frame */); EXPECT_FALSE(ads_blocked_in_content_settings()); #if BUILDFLAG(IS_ANDROID) @@ -810,7 +809,7 @@ // The aborted navigation does not pass through ReadyToCommitNavigation so no // ActivateForNextCommittedLoad mojo call is expected. ExpectActivationSignalForFrame(main_rfh(), false /* expect_activation */, - false /* expect_is_ad_subframe */, + false /* expect_is_ad_frame */, false /* expect_activation_sent_to_agent */); // A subframe navigation fail. @@ -1058,7 +1057,7 @@ // Commit a navigation that triggers page level activation. NavigateAndCommitMainFrame(GURL(kTestURLWithActivation)); ExpectActivationSignalForFrame(main_rfh(), true /* expect_activation */, - false /* is_ad_subframe */); + false /* is_ad_frame */); // A disallowed subframe navigation should be successfully filtered. #if BUILDFLAG(IS_ANDROID) @@ -1081,14 +1080,14 @@ SubframeNavigationTaggedAsAdByRenderer) { NavigateAndCommitMainFrame(GURL(kTestURLWithDryRun)); ExpectActivationSignalForFrame(main_rfh(), true /* expect_activation */, - false /* is_ad_subframe */); + false /* is_ad_frame */); content::RenderFrameHost* subframe = CreateSubframeWithTestNavigation( GURL("https://www.example.com/allowed.html"), main_rfh()); EXPECT_FALSE(throttle_manager()->IsRenderFrameHostTaggedAsAd(subframe)); throttle_manager()->OnChildFrameWasCreatedByAdScript(subframe); - throttle_manager()->OnFrameIsAdSubframe(subframe); + throttle_manager()->OnFrameIsAd(subframe); EXPECT_EQ(content::NavigationThrottle::PROCEED, SimulateStartAndGetResult(navigation_simulator())); @@ -1098,7 +1097,7 @@ EXPECT_TRUE(subframe); EXPECT_TRUE(throttle_manager()->IsRenderFrameHostTaggedAsAd(subframe)); ExpectActivationSignalForFrame(subframe, true /* expect_activation */, - true /* is_ad_subframe */); + true /* is_ad_frame */); // A non-ad navigation for the same frame should be considered an ad // subframe as well. @@ -1107,7 +1106,7 @@ SimulateCommitAndGetResult(navigation_simulator())); subframe = navigation_simulator()->GetFinalRenderFrameHost(); ExpectActivationSignalForFrame(subframe, true /* expect_activation */, - true /* is_ad_subframe */); + true /* is_ad_frame */); } // If the RenderFrame determines that the frame is an ad due to creation by ad @@ -1119,7 +1118,7 @@ NavigateAndCommitMainFrame(GURL(kTestURLWithDryRun)); ExpectActivationSignalForFrame(main_rfh(), true /* expect_activation */, - false /* is_ad_subframe */); + false /* is_ad_frame */); // Create a subframe to a different site. It will start as a same-process // frame but transition to a cross-process frame just before commit (after @@ -1130,7 +1129,7 @@ // Simulate the render process telling the manager that the frame is an ad due // to creation by ad script. throttle_manager()->OnChildFrameWasCreatedByAdScript(initial_subframe); - throttle_manager()->OnFrameIsAdSubframe(initial_subframe); + throttle_manager()->OnFrameIsAd(initial_subframe); EXPECT_EQ(content::NavigationThrottle::PROCEED, SimulateStartAndGetResult(navigation_simulator())); @@ -1143,7 +1142,7 @@ EXPECT_TRUE(throttle_manager()->IsRenderFrameHostTaggedAsAd(final_subframe)); ExpectActivationSignalForFrame(final_subframe, true /* expect_activation */, - true /* is_ad_subframe */); + true /* is_ad_frame */); } // If the RenderFrame determines that the frame was created by ad script, it @@ -1152,7 +1151,7 @@ GrandchildNavigationTaggedAsAdByRenderer) { NavigateAndCommitMainFrame(GURL(kTestURLWithDryRun)); ExpectActivationSignalForFrame(main_rfh(), true /* expect_activation */, - false /* is_ad_subframe */); + false /* is_ad_frame */); // Create a subframe that's marked as an ad by the render process. content::RenderFrameHost* subframe = CreateSubframeWithTestNavigation( @@ -1161,7 +1160,7 @@ // Simulate the render process telling the manager that the frame is an ad due // to creation by ad script. throttle_manager()->OnChildFrameWasCreatedByAdScript(subframe); - throttle_manager()->OnFrameIsAdSubframe(subframe); + throttle_manager()->OnFrameIsAd(subframe); EXPECT_EQ(content::NavigationThrottle::PROCEED, SimulateStartAndGetResult(navigation_simulator())); @@ -1169,7 +1168,7 @@ SimulateCommitAndGetResult(navigation_simulator())); subframe = navigation_simulator()->GetFinalRenderFrameHost(); ExpectActivationSignalForFrame(subframe, true /* expect_activation */, - true /* is_ad_subframe */); + true /* is_ad_frame */); // Create a grandchild frame that is marked as an ad because its parent is. content::RenderFrameHost* grandchild_frame = CreateSubframeWithTestNavigation( @@ -1180,7 +1179,7 @@ SimulateCommitAndGetResult(navigation_simulator())); grandchild_frame = navigation_simulator()->GetFinalRenderFrameHost(); ExpectActivationSignalForFrame(grandchild_frame, true /* expect_activation */, - true /* is_ad_subframe */); + true /* is_ad_frame */); EXPECT_TRUE( throttle_manager()->IsRenderFrameHostTaggedAsAd(grandchild_frame)); } @@ -1209,7 +1208,7 @@ // But it should still be activated. ExpectActivationSignalForFrame(child, true /* expect_activation */, - true /* is_ad_subframe */); + true /* is_ad_frame */); EXPECT_TRUE(throttle_manager()->IsRenderFrameHostTaggedAsAd(child)); // Create a subframe which is allowed as per ruleset but should still be @@ -1224,7 +1223,7 @@ navigation_simulator()->GetFinalRenderFrameHost(); EXPECT_TRUE(grandchild); ExpectActivationSignalForFrame(grandchild, true /* expect_activation */, - true /* is_ad_subframe */); + true /* is_ad_frame */); EXPECT_TRUE(throttle_manager()->IsRenderFrameHostTaggedAsAd(grandchild)); // Verify that a 2nd level nested frame should also be tagged. @@ -1242,7 +1241,7 @@ navigation_simulator()->GetFinalRenderFrameHost(); EXPECT_TRUE(greatGrandchild); ExpectActivationSignalForFrame(greatGrandchild, true /* expect_activation */, - true /* is_ad_subframe */); + true /* is_ad_frame */); EXPECT_TRUE(throttle_manager()->IsRenderFrameHostTaggedAsAd(greatGrandchild)); EXPECT_FALSE(ads_blocked_in_content_settings()); @@ -1266,7 +1265,7 @@ navigation_simulator()->GetFinalRenderFrameHost(); EXPECT_TRUE(child); ExpectActivationSignalForFrame(child, true /* expect_activation */, - false /* is_ad_subframe */); + false /* is_ad_frame */); EXPECT_FALSE(throttle_manager()->IsRenderFrameHostTaggedAsAd(child)); // Create a subframe which is allowed as per ruleset and should not be tagged @@ -1284,7 +1283,7 @@ navigation_simulator()->GetFinalRenderFrameHost(); EXPECT_TRUE(grandchild); ExpectActivationSignalForFrame(grandchild, true /* expect_activation */, - false /* is_ad_subframe */); + false /* is_ad_frame */); EXPECT_FALSE(throttle_manager()->IsRenderFrameHostTaggedAsAd(grandchild)); EXPECT_FALSE(ads_blocked_in_content_settings()); @@ -1846,7 +1845,7 @@ // Same-document navigations do not pass through ReadyToCommitNavigation so no // ActivateForNextCommittedLoad mojo call is expected. ExpectActivationSignalForFrame(main_rfh(), false /* expect_activation */, - false /* expect_is_ad_subframe */, + false /* expect_is_ad_frame */, false /* expect_activation_sent_to_agent */); EXPECT_TRUE(ads_blocked_in_content_settings());
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_web_contents_helper.cc b/components/subresource_filter/content/browser/content_subresource_filter_web_contents_helper.cc index 7c354c9..95bb9d0 100644 --- a/components/subresource_filter/content/browser/content_subresource_filter_web_contents_helper.cc +++ b/components/subresource_filter/content/browser/content_subresource_filter_web_contents_helper.cc
@@ -525,14 +525,14 @@ } } -void ContentSubresourceFilterWebContentsHelper::OnSubframeNavigationEvaluated( +void ContentSubresourceFilterWebContentsHelper::OnChildFrameNavigationEvaluated( content::NavigationHandle* navigation_handle, LoadPolicy load_policy) { DCHECK(!IsInSubresourceFilterRoot(navigation_handle)); if (ContentSubresourceFilterThrottleManager* throttle_manager = GetThrottleManager(*navigation_handle)) { - throttle_manager->OnSubframeNavigationEvaluated(navigation_handle, - load_policy); + throttle_manager->OnChildFrameNavigationEvaluated(navigation_handle, + load_policy); } }
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_web_contents_helper.h b/components/subresource_filter/content/browser/content_subresource_filter_web_contents_helper.h index 5ac0f35a..53c422c 100644 --- a/components/subresource_filter/content/browser/content_subresource_filter_web_contents_helper.h +++ b/components/subresource_filter/content/browser/content_subresource_filter_web_contents_helper.h
@@ -167,7 +167,7 @@ void OnPageActivationComputed( content::NavigationHandle* navigation_handle, const mojom::ActivationState& activation_state) override; - void OnSubframeNavigationEvaluated( + void OnChildFrameNavigationEvaluated( content::NavigationHandle* navigation_handle, LoadPolicy load_policy) override;
diff --git a/components/subresource_filter/content/browser/navigation_console_logger.cc b/components/subresource_filter/content/browser/navigation_console_logger.cc index 0e27bee..6a0d6fbb 100644 --- a/components/subresource_filter/content/browser/navigation_console_logger.cc +++ b/components/subresource_filter/content/browser/navigation_console_logger.cc
@@ -48,7 +48,7 @@ if (handle != handle_) return; - // The main frame navigation has finished. + // The root frame navigation has finished. if (handle->HasCommitted() && !handle->IsErrorPage()) { for (const auto& message : commit_messages_) { handle->GetRenderFrameHost()->AddMessageToConsole(message.first,
diff --git a/components/subresource_filter/content/browser/navigation_console_logger.h b/components/subresource_filter/content/browser/navigation_console_logger.h index 6f14ba9..f036b37 100644 --- a/components/subresource_filter/content/browser/navigation_console_logger.h +++ b/components/subresource_filter/content/browser/navigation_console_logger.h
@@ -22,13 +22,13 @@ // This class provides a static API to log console messages when an ongoing // navigation successfully commits. -// - This class only supports main frame navigations. +// - This class only supports root frame navigations. class NavigationConsoleLogger : public content::WebContentsObserver, public content::NavigationHandleUserData<NavigationConsoleLogger> { public: // Creates a NavigationConsoleLogger object if it does not already exist for - // |handle|. It will be scoped until the current main frame navigation commits + // |handle|. It will be scoped until the current root frame navigation commits // its next navigation. If |handle| has already committed, logs the message // immediately. static void LogMessageOnCommit(content::NavigationHandle* handle, @@ -47,7 +47,7 @@ // Creates a new NavigationConsoleLogger scoped to |handle| if one doesn't // exist. Returns the NavigationConsoleLogger associated with |handle|. // - // Note: |handle| must be associated with a main frame navigation. + // Note: |handle| must be associated with a root frame navigation. static NavigationConsoleLogger* CreateIfNeededForNavigation( content::NavigationHandle* handle);
diff --git a/components/subresource_filter/content/browser/subframe_navigation_filtering_throttle.cc b/components/subresource_filter/content/browser/subframe_navigation_filtering_throttle.cc index 4a1fbbc..2371ab3 100644 --- a/components/subresource_filter/content/browser/subframe_navigation_filtering_throttle.cc +++ b/components/subresource_filter/content/browser/subframe_navigation_filtering_throttle.cc
@@ -169,10 +169,10 @@ void SubframeNavigationFilteringThrottle::HandleDisallowedLoad() { if (parent_frame_filter_->activation_state().enable_logging) { std::string console_message = base::StringPrintf( - kDisallowSubframeConsoleMessageFormat, + kDisallowChildFrameConsoleMessageFormat, navigation_handle()->GetURL().possibly_invalid_spec().c_str()); // Use the parent's Page to log a message to the console so that if this - // subframe is the root of a nested frame tree (e.g. fenced frame), the log + // frame is the root of a nested frame tree (e.g. fenced frame), the log // message won't be associated with a to-be-destroyed Page. navigation_handle() ->GetParentFrameOrOuterDocument() @@ -277,8 +277,8 @@ if (!observer_manager) return; - observer_manager->NotifySubframeNavigationEvaluated(navigation_handle(), - load_policy_); + observer_manager->NotifyChildFrameNavigationEvaluated(navigation_handle(), + load_policy_); } void SubframeNavigationFilteringThrottle::UpdateDeferInfo() {
diff --git a/components/subresource_filter/content/browser/subframe_navigation_filtering_throttle.h b/components/subresource_filter/content/browser/subframe_navigation_filtering_throttle.h index 8e61c2c3..b0570e0 100644 --- a/components/subresource_filter/content/browser/subframe_navigation_filtering_throttle.h +++ b/components/subresource_filter/content/browser/subframe_navigation_filtering_throttle.h
@@ -49,6 +49,7 @@ // to logic related to BLOCK_REQUEST_AND_COLLAPSE. However, there may be room // for optimization during AdTagging, or migrating BLOCK_REQUEST_AND_COLLAPSE to // be allowed during WillProcessResponse. +// TODO(bokan): Rename to ChildFrameNavigationFilteringThrottle. class SubframeNavigationFilteringThrottle : public content::NavigationThrottle { public: SubframeNavigationFilteringThrottle(
diff --git a/components/subresource_filter/content/browser/subframe_navigation_filtering_throttle_unittest.cc b/components/subresource_filter/content/browser/subframe_navigation_filtering_throttle_unittest.cc index a37b6e8..d0b0ccb0 100644 --- a/components/subresource_filter/content/browser/subframe_navigation_filtering_throttle_unittest.cc +++ b/components/subresource_filter/content/browser/subframe_navigation_filtering_throttle_unittest.cc
@@ -130,7 +130,7 @@ } std::string GetFilterConsoleMessage(const GURL& filtered_url) { - return base::StringPrintf(kDisallowSubframeConsoleMessageFormat, + return base::StringPrintf(kDisallowChildFrameConsoleMessageFormat, filtered_url.possibly_invalid_spec().c_str()); }
diff --git a/components/subresource_filter/content/browser/subresource_filter_observer.h b/components/subresource_filter/content/browser/subresource_filter_observer.h index 55ada06..2ae2b68 100644 --- a/components/subresource_filter/content/browser/subresource_filter_observer.h +++ b/components/subresource_filter/content/browser/subresource_filter_observer.h
@@ -42,7 +42,7 @@ std::vector<SubresourceFilterSafeBrowsingClient::CheckResult>; // Called when the SubresourceFilter Safe Browsing checks are available for - // this main frame navigation. Will be called at WillProcessResponse time at + // this root frame navigation. Will be called at WillProcessResponse time at // the latest. Right now it will only include phishing and subresource filter // threat types. virtual void OnSafeBrowsingChecksComplete( @@ -57,17 +57,16 @@ // Called before navigation commit, either at the WillStartRequest stage or // WillRedirectRequest stage. - virtual void OnSubframeNavigationEvaluated( + virtual void OnChildFrameNavigationEvaluated( content::NavigationHandle* navigation_handle, LoadPolicy load_policy) {} // Called when a frame is tagged or untagged as an ad, along with the frame's - // current status as an ad subframe and the evidence which resulted in the + // current status as an ad frame and the evidence which resulted in the // change. This will be called prior to commit time in the case of an initial // synchronous load or at ReadyToCommitNavigation otherwise. - virtual void OnIsAdSubframeChanged( - content::RenderFrameHost* render_frame_host, - bool is_ad_subframe) {} + virtual void OnIsAdFrameChanged(content::RenderFrameHost* render_frame_host, + bool is_ad_frame) {} }; } // namespace subresource_filter
diff --git a/components/subresource_filter/content/browser/subresource_filter_observer_manager.cc b/components/subresource_filter/content/browser/subresource_filter_observer_manager.cc index 3736e80..0aea7680 100644 --- a/components/subresource_filter/content/browser/subresource_filter_observer_manager.cc +++ b/components/subresource_filter/content/browser/subresource_filter_observer_manager.cc
@@ -45,18 +45,18 @@ } } -void SubresourceFilterObserverManager::NotifySubframeNavigationEvaluated( +void SubresourceFilterObserverManager::NotifyChildFrameNavigationEvaluated( content::NavigationHandle* navigation_handle, LoadPolicy load_policy) { for (auto& observer : observers_) - observer.OnSubframeNavigationEvaluated(navigation_handle, load_policy); + observer.OnChildFrameNavigationEvaluated(navigation_handle, load_policy); } -void SubresourceFilterObserverManager::NotifyIsAdSubframeChanged( +void SubresourceFilterObserverManager::NotifyIsAdFrameChanged( content::RenderFrameHost* render_frame_host, - bool is_ad_subframe) { + bool is_ad_frame) { for (auto& observer : observers_) - observer.OnIsAdSubframeChanged(render_frame_host, is_ad_subframe); + observer.OnIsAdFrameChanged(render_frame_host, is_ad_frame); } WEB_CONTENTS_USER_DATA_KEY_IMPL(SubresourceFilterObserverManager);
diff --git a/components/subresource_filter/content/browser/subresource_filter_observer_manager.h b/components/subresource_filter/content/browser/subresource_filter_observer_manager.h index 799b87d1..85ef867a 100644 --- a/components/subresource_filter/content/browser/subresource_filter_observer_manager.h +++ b/components/subresource_filter/content/browser/subresource_filter_observer_manager.h
@@ -47,7 +47,7 @@ void RemoveObserver(SubresourceFilterObserver* observer); // Called when the SubresourceFilter Safe Browsing checks are available for - // this main frame navigation. Will be called at WillProcessResponse time at + // this root frame navigation. Will be called at WillProcessResponse time at // the latest. Right now it will only include phishing and subresource filter // threat types. virtual void NotifySafeBrowsingChecksComplete( @@ -63,16 +63,16 @@ // Called in WillStartRequest or WillRedirectRequest stage from a // SubframeNavigationFilteringThrottle. - void NotifySubframeNavigationEvaluated( + void NotifyChildFrameNavigationEvaluated( content::NavigationHandle* navigation_handle, LoadPolicy load_policy); // Called in DidCreateNewDocument or ReadyToCommitNavigation to notify // observers that an frame with the associated RenderFrameHost has either been // detected as an ad or is no longer considered one. The frame's new status is - // passed as `is_ad_subframe`. - void NotifyIsAdSubframeChanged(content::RenderFrameHost* render_frame_host, - bool is_ad_subframe); + // passed as `is_ad_frame`. + void NotifyIsAdFrameChanged(content::RenderFrameHost* render_frame_host, + bool is_ad_frame); private: friend class content::WebContentsUserData<SubresourceFilterObserverManager>;
diff --git a/components/subresource_filter/content/browser/subresource_filter_observer_test_utils.cc b/components/subresource_filter/content/browser/subresource_filter_observer_test_utils.cc index 87dfe65..baa6f0a 100644 --- a/components/subresource_filter/content/browser/subresource_filter_observer_test_utils.cc +++ b/components/subresource_filter/content/browser/subresource_filter_observer_test_utils.cc
@@ -38,16 +38,16 @@ pending_activations_[navigation_handle] = level; } -void TestSubresourceFilterObserver::OnSubframeNavigationEvaluated( +void TestSubresourceFilterObserver::OnChildFrameNavigationEvaluated( content::NavigationHandle* navigation_handle, LoadPolicy load_policy) { - subframe_load_evaluations_[navigation_handle->GetURL()] = load_policy; + child_frame_load_evaluations_[navigation_handle->GetURL()] = load_policy; } -void TestSubresourceFilterObserver::OnIsAdSubframeChanged( +void TestSubresourceFilterObserver::OnIsAdFrameChanged( content::RenderFrameHost* render_frame_host, - bool is_ad_subframe) { - if (is_ad_subframe) + bool is_ad_frame) { + if (is_ad_frame) ad_frames_.insert(render_frame_host->GetFrameTreeNodeId()); else ad_frames_.erase(render_frame_host->GetFrameTreeNodeId()); @@ -80,15 +80,14 @@ return absl::nullopt; } -bool TestSubresourceFilterObserver::GetIsAdSubframe( - int frame_tree_node_id) const { +bool TestSubresourceFilterObserver::GetIsAdFrame(int frame_tree_node_id) const { return base::Contains(ad_frames_, frame_tree_node_id); } -absl::optional<LoadPolicy> TestSubresourceFilterObserver::GetSubframeLoadPolicy( - const GURL& url) const { - auto it = subframe_load_evaluations_.find(url); - if (it != subframe_load_evaluations_.end()) +absl::optional<LoadPolicy> +TestSubresourceFilterObserver::GetChildFrameLoadPolicy(const GURL& url) const { + auto it = child_frame_load_evaluations_.find(url); + if (it != child_frame_load_evaluations_.end()) return it->second; return absl::optional<LoadPolicy>(); }
diff --git a/components/subresource_filter/content/browser/subresource_filter_observer_test_utils.h b/components/subresource_filter/content/browser/subresource_filter_observer_test_utils.h index 353d9f1..ce99d54 100644 --- a/components/subresource_filter/content/browser/subresource_filter_observer_test_utils.h +++ b/components/subresource_filter/content/browser/subresource_filter_observer_test_utils.h
@@ -46,11 +46,11 @@ void OnPageActivationComputed( content::NavigationHandle* navigation_handle, const mojom::ActivationState& activation_state) override; - void OnSubframeNavigationEvaluated( + void OnChildFrameNavigationEvaluated( content::NavigationHandle* navigation_handle, LoadPolicy load_policy) override; - void OnIsAdSubframeChanged(content::RenderFrameHost* render_frame_host, - bool is_ad_subframe) override; + void OnIsAdFrameChanged(content::RenderFrameHost* render_frame_host, + bool is_ad_frame) override; // content::WebContentsObserver void DidFinishNavigation( @@ -58,9 +58,9 @@ absl::optional<mojom::ActivationLevel> GetPageActivation( const GURL& url) const; - absl::optional<LoadPolicy> GetSubframeLoadPolicy(const GURL& url) const; + absl::optional<LoadPolicy> GetChildFrameLoadPolicy(const GURL& url) const; - bool GetIsAdSubframe(int frame_tree_node_id) const; + bool GetIsAdFrame(int frame_tree_node_id) const; absl::optional<mojom::ActivationLevel> GetPageActivationForLastCommittedLoad() const; @@ -71,7 +71,7 @@ const GURL& url) const; private: - std::map<GURL, LoadPolicy> subframe_load_evaluations_; + std::map<GURL, LoadPolicy> child_frame_load_evaluations_; // Set of FrameTreeNode IDs representing frames tagged as ads. std::set<int> ad_frames_;
diff --git a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc index 6bbb82f..82dc61b 100644 --- a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc +++ b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc
@@ -282,7 +282,7 @@ const auto selected_config_itr = std::find_if(decreasing_configs.begin(), decreasing_configs.end(), [matched_list, this](const Configuration& config) { - return DoesMainFrameURLSatisfyActivationConditions( + return DoesRootFrameURLSatisfyActivationConditions( config.activation_conditions, matched_list); }); if (selected_config_itr != decreasing_configs.end()) { @@ -312,7 +312,7 @@ } bool SubresourceFilterSafeBrowsingActivationThrottle:: - DoesMainFrameURLSatisfyActivationConditions( + DoesRootFrameURLSatisfyActivationConditions( const Configuration::ActivationConditions& conditions, ActivationList matched_list) const { // Avoid copies when tracing disabled. @@ -323,7 +323,7 @@ }; TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("loading"), "SubresourceFilterSafeBrowsingActivationThrottle::" - "DoesMainFrameURLSatisfyActivationConditions", + "DoesRootFrameURLSatisfyActivationConditions", "matched_list", list_to_string(matched_list), "conditions", conditions.ToTracedValue()); switch (conditions.activation_scope) {
diff --git a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h index eef424b..c6b10b6 100644 --- a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h +++ b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h
@@ -57,7 +57,7 @@ // Note: |decision| is guaranteed to be non-nullptr, and can be modified by // this method if any decision changes. // - // Precondition: The navigation must be a main frame navigation. + // Precondition: The navigation must be a root frame navigation. virtual mojom::ActivationLevel OnPageActivationComputed( content::NavigationHandle* navigation_handle, mojom::ActivationLevel initial_activation_level, @@ -122,9 +122,9 @@ // Returns it, or ACTIVATION_CONDITIONS_NOT_MET if no Configuration. ActivationDecision GetActivationDecision(const ConfigResult& configs); - // Returns whether a main-frame navigation satisfies the activation + // Returns whether a root-frame navigation satisfies the activation // |conditions| of a given configuration, except for |priority|. - bool DoesMainFrameURLSatisfyActivationConditions( + bool DoesRootFrameURLSatisfyActivationConditions( const Configuration::ActivationConditions& conditions, ActivationList matched_list) const;
diff --git a/components/subresource_filter/content/browser/subresource_filter_unittest.cc b/components/subresource_filter/content/browser/subresource_filter_unittest.cc index 9cad66b..4e6ff0d1 100644 --- a/components/subresource_filter/content/browser/subresource_filter_unittest.cc +++ b/components/subresource_filter/content/browser/subresource_filter_unittest.cc
@@ -129,8 +129,8 @@ auto* subframe = content::RenderFrameHostTester::For(main_rfh())->AppendChild("subframe"); SimulateNavigateAndCommit(GURL(allowed_url), subframe); - EXPECT_EQ(LoadPolicy::ALLOW, *observer.GetSubframeLoadPolicy(allowed_url)); - EXPECT_FALSE(observer.GetIsAdSubframe(subframe->GetFrameTreeNodeId())); + EXPECT_EQ(LoadPolicy::ALLOW, *observer.GetChildFrameLoadPolicy(allowed_url)); + EXPECT_FALSE(observer.GetIsAdFrame(subframe->GetFrameTreeNodeId())); } TEST_F(SubresourceFilterTest, SimpleDisallowedLoad_WithObserver) { @@ -155,8 +155,8 @@ navigation_observer.WaitForNavigationFinished(); EXPECT_EQ(LoadPolicy::DISALLOW, - *observer.GetSubframeLoadPolicy(disallowed_url)); - EXPECT_TRUE(observer.GetIsAdSubframe(subframe->GetFrameTreeNodeId())); + *observer.GetChildFrameLoadPolicy(disallowed_url)); + EXPECT_TRUE(observer.GetIsAdFrame(subframe->GetFrameTreeNodeId())); } TEST_F(SubresourceFilterTest, RefreshMetadataOnActivation) {
diff --git a/components/subresource_filter/content/common/subresource_filter_utils.h b/components/subresource_filter/content/common/subresource_filter_utils.h index 8c88702..634a396e4 100644 --- a/components/subresource_filter/content/common/subresource_filter_utils.h +++ b/components/subresource_filter/content/common/subresource_filter_utils.h
@@ -13,13 +13,14 @@ namespace subresource_filter { -// Subframe navigations and initial mainframe navigations matching these URLs/ -// schemes will not trigger ReadyToCommitNavigation in the browser process, so -// they must be treated specially to maintain activation. Each should inherit -// the activation of its parent in the case of a subframe and its opener in the -// case of a mainframe. This also accounts for the ability of the parent/opener -// to affect the frame's content more directly, e.g. through document.write(), -// even though these URLs won't match a filter list rule by themselves. +// Child frame navigations and initial root frame navigations matching these +// URLs/ schemes will not trigger ReadyToCommitNavigation in the browser +// process, so they must be treated specially to maintain activation. Each +// should inherit the activation of its parent in the case of a child frame and +// its opener in the case of a root frame. This also accounts for the ability of +// the parent/opener to affect the frame's content more directly, e.g. through +// document.write(), even though these URLs won't match a filter list rule by +// themselves. bool ShouldInheritActivation(const GURL& url); // Returns the appropriate FilterListResult, given the result of the most recent
diff --git a/components/subresource_filter/content/mojom/subresource_filter.mojom b/components/subresource_filter/content/mojom/subresource_filter.mojom index 82327237..cab6342 100644 --- a/components/subresource_filter/content/mojom/subresource_filter.mojom +++ b/components/subresource_filter/content/mojom/subresource_filter.mojom
@@ -13,8 +13,9 @@ interface SubresourceFilterAgent { // Instructs the renderer to activate subresource filtering at the specified // |activation_state| for the document load committed next in a frame. Also - // informs the renderer of the frame's ad evidence. If the frame is a main - // frame, `ad_evidence` should be null as only subframes can be tagged. + // informs the renderer of the frame's ad evidence. If the frame is a + // subresource filter root frame, `ad_evidence` should be null as only child + // frames can be tagged. // // Must be called just before mojom::FrameNavigationControl::CommitNavigation, // at ReadyToCommitNavigation time. If not called, the default behavior is @@ -31,16 +32,16 @@ // prompt to inform the user and allow them to turn off filtering. DidDisallowFirstSubresource(); - // Called when a RenderFrame is created and is tagged as an ad subframe. The + // Called when a RenderFrame is created and is tagged as an ad frame. The // browser keeps track of this in case the frame later changes processes, at // which point it will inform the new RenderFrame that it has been tagged as // an ad via SubresourceFilterMsg_ActivateForNextCommittedLoad, at // ReadyToCommitNavigation time. - FrameIsAdSubframe(); + FrameIsAd(); // Called when a RenderFrame is created with ad script on the v8 stack. The - // browser keeps track of this for deciding whether to tag subframes as ads. - SubframeWasCreatedByAdScript(); + // browser keeps track of this for deciding whether to tag frames as ads. + FrameWasCreatedByAdScript(); // Notifies the host that an MPArch-based FencedFrame was created while an ad // script was on the v8 stack. Note that this is called from the owning
diff --git a/components/subresource_filter/content/renderer/subresource_filter_agent.cc b/components/subresource_filter/content/renderer/subresource_filter_agent.cc index 1e6f9b2..4487075 100644 --- a/components/subresource_filter/content/renderer/subresource_filter_agent.cc +++ b/components/subresource_filter/content/renderer/subresource_filter_agent.cc
@@ -69,8 +69,8 @@ // We must check for provisional here because in that case 2 RenderFrames will // be created for the same FrameTreeNode in the browser. The browser service - // only expects us to call SendSubframeWasCreatedByAdScript() and - // SendFrameIsAdSubframe() a single time each for a newly created RenderFrame, + // only expects us to call SendFrameWasCreatedByAdScript() and + // SendFrameIsAd() a single time each for a newly created RenderFrame, // so we must choose one. A provisional frame is created when a navigation is // performed cross-site and the navigation is done there to isolate it from // the previous frame tree. We choose to send this message from the initial @@ -83,13 +83,13 @@ // Note: We intentionally exclude fenced-frame roots here since they do not // create a RenderFrame in the creating renderer. By the time the fenced // frame initializes its RenderFrame in a new process, - // IsSubframeCreatedByAdScript will not see the creating call stack. Fenced + // IsFrameCreatedByAdScript will not see the creating call stack. Fenced // frames compute and send this information to the browser from // DidCreateFencedFrame which is called by the creating RenderFrame. // Additionally, there's no need to set evidence for the initial empty // subframe since the fenced frame is isolated from its embedder. - if (IsSubframeCreatedByAdScript()) - SendSubframeWasCreatedByAdScript(); + if (IsFrameCreatedByAdScript()) + SendFrameWasCreatedByAdScript(); // As this is the initial empty document, we won't have received any message // from the browser and so we must populate the ad evidence here. @@ -141,20 +141,20 @@ render_frame()->IsInFencedFrameTree(); } -bool SubresourceFilterAgent::IsParentAdSubframe() { +bool SubresourceFilterAgent::IsParentAdFrame() { // A fenced frame root should never ask this since it can't see the outer // frame tree. Its AdEvidence is always computed by the browser. DCHECK(!IsMPArchFencedFrameRoot(render_frame())); - return render_frame()->GetWebFrame()->Parent()->IsAdSubframe(); + return render_frame()->GetWebFrame()->Parent()->IsAdFrame(); } bool SubresourceFilterAgent::IsProvisional() { return render_frame()->GetWebFrame()->IsProvisional(); } -bool SubresourceFilterAgent::IsSubframeCreatedByAdScript() { +bool SubresourceFilterAgent::IsFrameCreatedByAdScript() { DCHECK(!IsMPArchFencedFrameRoot(render_frame())); - return render_frame()->GetWebFrame()->IsSubframeCreatedByAdScript(); + return render_frame()->GetWebFrame()->IsFrameCreatedByAdScript(); } void SubresourceFilterAgent::SetSubresourceFilterForCurrentDocument( @@ -174,17 +174,17 @@ GetSubresourceFilterHost()->SetDocumentLoadStatistics(statistics.Clone()); } -void SubresourceFilterAgent::SendFrameIsAdSubframe() { - GetSubresourceFilterHost()->FrameIsAdSubframe(); +void SubresourceFilterAgent::SendFrameIsAd() { + GetSubresourceFilterHost()->FrameIsAd(); } -void SubresourceFilterAgent::SendSubframeWasCreatedByAdScript() { +void SubresourceFilterAgent::SendFrameWasCreatedByAdScript() { DCHECK(!IsMPArchFencedFrameRoot(render_frame())); - GetSubresourceFilterHost()->SubframeWasCreatedByAdScript(); + GetSubresourceFilterHost()->FrameWasCreatedByAdScript(); } -bool SubresourceFilterAgent::IsAdSubframe() { - return render_frame()->GetWebFrame()->IsAdSubframe(); +bool SubresourceFilterAgent::IsAdFrame() { + return render_frame()->GetWebFrame()->IsAdFrame(); } void SubresourceFilterAgent::SetAdEvidence( @@ -289,20 +289,20 @@ } void SubresourceFilterAgent::SetAdEvidenceForInitialEmptySubframe() { - DCHECK(!IsAdSubframe()); + DCHECK(!IsAdFrame()); DCHECK(!AdEvidence().has_value()); DCHECK(!IsMPArchFencedFrameRoot(render_frame())); - blink::FrameAdEvidence ad_evidence(IsParentAdSubframe()); + blink::FrameAdEvidence ad_evidence(IsParentAdFrame()); ad_evidence.set_created_by_ad_script( - IsSubframeCreatedByAdScript() + IsFrameCreatedByAdScript() ? blink::mojom::FrameCreationStackEvidence::kCreatedByAdScript : blink::mojom::FrameCreationStackEvidence::kNotCreatedByAdScript); ad_evidence.set_is_complete(); SetAdEvidence(ad_evidence); - if (ad_evidence.IndicatesAdSubframe()) { - SendFrameIsAdSubframe(); + if (ad_evidence.IndicatesAdFrame()) { + SendFrameIsAd(); } }
diff --git a/components/subresource_filter/content/renderer/subresource_filter_agent.h b/components/subresource_filter/content/renderer/subresource_filter_agent.h index 32b880a..fe7699e 100644 --- a/components/subresource_filter/content/renderer/subresource_filter_agent.h +++ b/components/subresource_filter/content/renderer/subresource_filter_agent.h
@@ -65,12 +65,12 @@ // filter child. See content_subresource_filter_throttle_manager.h for // details. virtual bool IsSubresourceFilterChild(); - virtual bool IsParentAdSubframe(); + virtual bool IsParentAdFrame(); virtual bool IsProvisional(); // This is only called by non-main frames since a child main frames (e.g. // Fenced Frame) will not be initialized on the same stack as the script that // created it. - virtual bool IsSubframeCreatedByAdScript(); + virtual bool IsFrameCreatedByAdScript(); // Injects the provided subresource |filter| into the DocumentLoader // orchestrating the most recently created document. @@ -86,17 +86,17 @@ virtual void SendDocumentLoadStatistics( const mojom::DocumentLoadStatistics& statistics); - // Tells the browser that the renderer tagged the frame as an ad subframe. - // This is not sent for frames tagged by the browser. - virtual void SendFrameIsAdSubframe(); + // Tells the browser that the renderer tagged the frame as an ad frame. This + // is not sent for frames tagged by the browser. + virtual void SendFrameIsAd(); - // Tells the browser that the frame is a subframe that was created by ad - // script. Fenced frame roots do not call this as they're tagged via + // Tells the browser that the frame is a frame that was created by ad script. + // Fenced frame roots do not call this as they're tagged via // DidCreateFencedFrame. - virtual void SendSubframeWasCreatedByAdScript(); + virtual void SendFrameWasCreatedByAdScript(); - // True if the frame has been heuristically determined to be an ad subframe. - virtual bool IsAdSubframe(); + // True if the frame has been heuristically determined to be an ad frame. + virtual bool IsAdFrame(); virtual const absl::optional<blink::FrameAdEvidence>& AdEvidence(); virtual void SetAdEvidence(const blink::FrameAdEvidence& ad_evidence); @@ -114,10 +114,10 @@ const absl::optional<blink::FrameAdEvidence>& ad_evidence) override; private: - // Returns the activation state for the `render_frame` to inherit. Main frames - // inherit from their opener frames, and subframes inherit from their parent - // frames. Assumes that the parent/opener is in a local frame relative to this - // one, upon construction. + // Returns the activation state for the `render_frame` to inherit. Root frames + // inherit from their opener frames, and child frames inherit from their + // parent frames. Assumes that the parent/opener is in a local frame relative + // to this one, upon construction. static mojom::ActivationState GetInheritedActivationState( content::RenderFrame* render_frame);
diff --git a/components/subresource_filter/content/renderer/subresource_filter_agent_unittest.cc b/components/subresource_filter/content/renderer/subresource_filter_agent_unittest.cc index 9ddf6d66..015628ed 100644 --- a/components/subresource_filter/content/renderer/subresource_filter_agent_unittest.cc +++ b/components/subresource_filter/content/renderer/subresource_filter_agent_unittest.cc
@@ -43,15 +43,15 @@ UnverifiedRulesetDealer* ruleset_dealer, bool is_subresource_filter_root, bool is_provisional, - bool is_parent_ad_subframe, - bool is_subframe_created_by_ad_script) + bool is_parent_ad_frame, + bool is_frame_created_by_ad_script) : SubresourceFilterAgent(nullptr /* RenderFrame */, ruleset_dealer, nullptr /* AdResourceTracker */), is_subresource_filter_root_(is_subresource_filter_root), is_provisional_(is_provisional), - is_parent_ad_subframe_(is_parent_ad_subframe), - is_subframe_created_by_ad_script_(is_subframe_created_by_ad_script) {} + is_parent_ad_frame_(is_parent_ad_frame), + is_frame_created_by_ad_script_(is_frame_created_by_ad_script) {} SubresourceFilterAgentUnderTest(const SubresourceFilterAgentUnderTest&) = delete; @@ -65,16 +65,16 @@ MOCK_METHOD0(SignalFirstSubresourceDisallowedForCurrentDocument, void()); MOCK_METHOD1(SendDocumentLoadStatistics, void(const mojom::DocumentLoadStatistics&)); - MOCK_METHOD0(SendFrameIsAdSubframe, void()); - MOCK_METHOD0(SendSubframeWasCreatedByAdScript, void()); + MOCK_METHOD0(SendFrameIsAd, void()); + MOCK_METHOD0(SendFrameWasCreatedByAdScript, void()); bool IsSubresourceFilterChild() override { return !is_subresource_filter_root_; } bool IsProvisional() override { return is_provisional_; } - bool IsParentAdSubframe() override { return is_parent_ad_subframe_; } - bool IsSubframeCreatedByAdScript() override { - return is_subframe_created_by_ad_script_; + bool IsParentAdFrame() override { return is_parent_ad_frame_; } + bool IsFrameCreatedByAdScript() override { + return is_frame_created_by_ad_script_; } void SetSubresourceFilterForCurrentDocument( @@ -83,8 +83,8 @@ OnSetSubresourceFilterForCurrentDocumentCalled(); } - bool IsAdSubframe() override { - return ad_evidence_ && ad_evidence_->IndicatesAdSubframe(); + bool IsAdFrame() override { + return ad_evidence_ && ad_evidence_->IndicatesAdFrame(); } const absl::optional<blink::FrameAdEvidence>& AdEvidence() override { @@ -118,8 +118,8 @@ const bool is_subresource_filter_root_; const bool is_provisional_; - const bool is_parent_ad_subframe_; - const bool is_subframe_created_by_ad_script_; + const bool is_parent_ad_frame_; + const bool is_frame_created_by_ad_script_; // Production can set this on the RenderFrame, which we intercept and store // here. @@ -156,25 +156,25 @@ void SetUp() override { ResetAgent(/*is_subresource_filter_root=*/true, /*is_provisional=*/false, - /*is_parent_ad_subframe=*/false, - /*is_subframe_created_by_ad_script=*/false); + /*is_parent_ad_frame=*/false, + /*is_frame_created_by_ad_script=*/false); } void ResetAgent(bool is_subresource_filter_root, bool is_provisional, - bool is_parent_ad_subframe, - bool is_subframe_created_by_ad_script) { + bool is_parent_ad_frame, + bool is_frame_created_by_ad_script) { ResetAgentWithoutInitialize(is_subresource_filter_root, is_provisional, - is_parent_ad_subframe, - is_subframe_created_by_ad_script); - ExpectSendSubframeWasCreatedByAdScript( + is_parent_ad_frame, + is_frame_created_by_ad_script); + ExpectSendFrameWasCreatedByAdScript(!is_subresource_filter_root && + !is_provisional && + is_frame_created_by_ad_script + ? 1 + : 0); + ExpectSendFrameIsAd( !is_subresource_filter_root && !is_provisional && - is_subframe_created_by_ad_script - ? 1 - : 0); - ExpectSendFrameIsAdSubframe( - !is_subresource_filter_root && !is_provisional && - (is_parent_ad_subframe || is_subframe_created_by_ad_script) + (is_parent_ad_frame || is_frame_created_by_ad_script) ? 1 : 0); agent_->Initialize(); @@ -186,12 +186,12 @@ // behaviour of the initialize step. void ResetAgentWithoutInitialize(bool is_subresource_filter_root, bool is_provisional, - bool is_parent_ad_subframe, - bool is_subframe_created_by_ad_script) { + bool is_parent_ad_frame, + bool is_frame_created_by_ad_script) { agent_ = std::make_unique< ::testing::StrictMock<SubresourceFilterAgentUnderTest>>( &ruleset_dealer_, is_subresource_filter_root, is_provisional, - is_parent_ad_subframe, is_subframe_created_by_ad_script); + is_parent_ad_frame, is_frame_created_by_ad_script); // Initialize() will see about:blank. EXPECT_CALL(*agent(), GetDocumentURL()) .WillRepeatedly(::testing::Return(GURL("about:blank"))); @@ -224,14 +224,14 @@ } void StartLoadAndSetActivationState(mojom::ActivationLevel level, - bool is_ad_subframe = false) { + bool is_ad_frame = false) { mojom::ActivationState state; state.activation_level = level; - StartLoadAndSetActivationState(state, is_ad_subframe); + StartLoadAndSetActivationState(state, is_ad_frame); } void StartLoadAndSetActivationState(mojom::ActivationState state, - bool is_ad_subframe = false) { + bool is_ad_frame = false) { agent_as_rfo()->DidStartNavigation(GURL(), absl::nullopt); agent_as_rfo()->ReadyToCommitNavigation(nullptr); @@ -239,13 +239,13 @@ if (agent()->IsSubresourceFilterChild()) { // Generate an evidence object matching the `ad_type`. ad_evidence = blink::FrameAdEvidence(false /* parent_is_ad */); - if (is_ad_subframe) { + if (is_ad_frame) { ad_evidence->set_created_by_ad_script( blink::mojom::FrameCreationStackEvidence::kCreatedByAdScript); } ad_evidence->set_is_complete(); } else { - ASSERT_FALSE(is_ad_subframe); + ASSERT_FALSE(is_ad_frame); } agent()->ActivateForNextCommittedLoad(state.Clone(), ad_evidence); @@ -278,12 +278,12 @@ EXPECT_CALL(*agent(), SendDocumentLoadStatistics(::testing::_)); } - void ExpectSendFrameIsAdSubframe(int times) { - EXPECT_CALL(*agent(), SendFrameIsAdSubframe()).Times(times); + void ExpectSendFrameIsAd(int times) { + EXPECT_CALL(*agent(), SendFrameIsAd()).Times(times); } - void ExpectSendSubframeWasCreatedByAdScript(int times) { - EXPECT_CALL(*agent(), SendSubframeWasCreatedByAdScript()).Times(times); + void ExpectSendFrameWasCreatedByAdScript(int times) { + EXPECT_CALL(*agent(), SendFrameWasCreatedByAdScript()).Times(times); } void ExpectLoadPolicy( @@ -352,13 +352,13 @@ MemoryMappedRuleset::SetMemoryMapFailuresForTesting(true); ExpectNoSubresourceFilterGetsInjected(); StartLoadAndSetActivationState(mojom::ActivationLevel::kEnabled, - false /* is_ad_subframe */); + false /* is_ad_frame */); ASSERT_TRUE(::testing::Mock::VerifyAndClearExpectations(agent())); MemoryMappedRuleset::SetMemoryMapFailuresForTesting(false); ExpectSubresourceFilterGetsInjected(); StartLoadAndSetActivationState(mojom::ActivationLevel::kEnabled, - false /* is_ad_subframe */); + false /* is_ad_frame */); } TEST_F(SubresourceFilterAgentTest, Disabled_NoFilterIsInjected) { @@ -384,10 +384,10 @@ kMainFrameLoadRulesetIsAvailableAnyActivationLevel, 0, 1); } -// Never inject a filter for main frame about:blank loads, even though we do for -// subframe loads. Those are tested via browser tests. -// TODO(csharrison): Refactor these unit tests so it is easier to test with -// real backing RenderFrames. +// Never inject a filter for root frame about:blank loads, even though we do for +// child frame loads. Those are tested via browser tests. +// TODO(csharrison): Refactor these unit tests so it is easier to test with real +// backing RenderFrames. TEST_F(SubresourceFilterAgentTest, EmptyDocumentLoad_NoFilterIsInjected) { base::HistogramTester histogram_tester; ExpectNoSubresourceFilterGetsInjected(); @@ -567,7 +567,7 @@ histogram_tester.ExpectUniqueSample( kMainFrameLoadRulesetIsAvailableAnyActivationLevel, 1, 1); - EXPECT_FALSE(agent()->IsAdSubframe()); + EXPECT_FALSE(agent()->IsAdFrame()); } TEST_F(SubresourceFilterAgentTest, @@ -610,8 +610,8 @@ auto filter = agent()->TakeFilter(); ResetAgent(/*is_subresource_filter_root=*/true, /*is_provisional=*/false, - /*is_parent_ad_subframe=*/false, - /*is_subframe_created_by_ad_script=*/false); + /*is_parent_ad_frame=*/false, + /*is_frame_created_by_ad_script=*/false); // The filter has been disconnected from the agent, so a call to // reportDisallowedLoad() should not signal a first resource disallowed call @@ -627,8 +627,8 @@ SetTestRulesetToDisallowURLsWithPathSuffix("somethingNotMatched")); ResetAgent(/*is_subresource_filter_root=*/false, /*is_provisional=*/false, - /*is_parent_ad_subframe=*/false, - /*is_subframe_created_by_ad_script=*/false); + /*is_parent_ad_frame=*/false, + /*is_frame_created_by_ad_script=*/false); agent()->SetInheritedActivationStateForNewDocument( mojom::ActivationLevel::kEnabled); @@ -661,160 +661,157 @@ } TEST_F(SubresourceFilterAgentTest, - DryRun_IsAssociatedWithAdSubframeforDocumentOrDedicatedWorker) { + DryRun_IsAssociatedWithAdFrameforDocumentOrDedicatedWorker) { ASSERT_NO_FATAL_FAILURE( SetTestRulesetToDisallowURLsWithPathSuffix(kTestFirstURLPathSuffix)); ResetAgent(/*is_subresource_filter_root=*/false, /*is_provisional=*/false, - /*is_parent_ad_subframe=*/false, - /*is_subframe_created_by_ad_script=*/false); + /*is_parent_ad_frame=*/false, + /*is_frame_created_by_ad_script=*/false); ExpectSubresourceFilterGetsInjected(); StartLoadAndSetActivationState(mojom::ActivationLevel::kDryRun, - true /* is_ad_subframe */); + true /* is_ad_frame */); ASSERT_TRUE(::testing::Mock::VerifyAndClearExpectations(agent())); - // Test the ad subframe value that is set at the filter. - // This also represents the flag passed to a dedicated worker filter created. - // For testing the flag passed to the dedicated worker filter, the unit test - // is not able to test the implementation of WillCreateWorkerFetchContext as - // that will require setup of a WebWorkerFetchContextImpl. - EXPECT_TRUE(agent()->IsAdSubframe()); + // Test the ad frame value that is set at the filter. This also represents + // the flag passed to a dedicated worker filter created. For testing the flag + // passed to the dedicated worker filter, the unit test is not able to test + // the implementation of WillCreateWorkerFetchContext as that will require + // setup of a WebWorkerFetchContextImpl. + EXPECT_TRUE(agent()->IsAdFrame()); } -TEST_F(SubresourceFilterAgentTest, DryRun_AdSubframeIsUntaggedByBrowser) { +TEST_F(SubresourceFilterAgentTest, DryRun_AdFrameIsUntaggedByBrowser) { ASSERT_NO_FATAL_FAILURE( SetTestRulesetToDisallowURLsWithPathSuffix(kTestFirstURLPathSuffix)); ResetAgent(/*is_subresource_filter_root=*/false, /*is_provisional=*/false, - /*is_parent_ad_subframe=*/false, - /*is_subframe_created_by_ad_script=*/false); + /*is_parent_ad_frame=*/false, + /*is_frame_created_by_ad_script=*/false); - // Browser tags the frame as an ad subframe. + // Browser tags the frame as an ad. ExpectSubresourceFilterGetsInjected(); StartLoadAndSetActivationState(mojom::ActivationLevel::kDryRun, - true /* is_ad_subframe */); + true /* is_ad_frame */); ASSERT_TRUE(::testing::Mock::VerifyAndClearExpectations(agent())); - EXPECT_TRUE(agent()->IsAdSubframe()); + EXPECT_TRUE(agent()->IsAdFrame()); ExpectDocumentLoadStatisticsSent(); FinishLoad(); - // Browser then untags the frame as an ad subframe. + // Browser then untags the frame as an ad frame. ExpectSubresourceFilterGetsInjected(); StartLoadAndSetActivationState(mojom::ActivationLevel::kDryRun, - false /* is_ad_subframe */); + false /* is_ad_frame */); ASSERT_TRUE(::testing::Mock::VerifyAndClearExpectations(agent())); - EXPECT_FALSE(agent()->IsAdSubframe()); + EXPECT_FALSE(agent()->IsAdFrame()); ExpectDocumentLoadStatisticsSent(); FinishLoad(); } -TEST_F(SubresourceFilterAgentTest, DryRun_SendsFrameIsAdSubframe) { +TEST_F(SubresourceFilterAgentTest, DryRun_SendsFrameIsAd) { ResetAgentWithoutInitialize(/*is_subresource_filter_root=*/false, /*is_provisional=*/false, - /*is_parent_ad_subframe=*/true, - /*is_subframe_created_by_ad_script=*/false); - ExpectSendFrameIsAdSubframe(1); + /*is_parent_ad_frame=*/true, + /*is_frame_created_by_ad_script=*/false); + ExpectSendFrameIsAd(1); agent()->Initialize(); - // SendFrameIsAdSubframe() is sent from Initialize(); + // SendFrameIsAd() is sent from Initialize(); ::testing::Mock::VerifyAndClearExpectations(agent()); - // Call DidCreateNewDocument verify that SendFrameIsAdSubframe is - // not called again. + // Call DidCreateNewDocument verify that SendFrameIsAd is not called again. EXPECT_CALL(*agent(), GetDocumentURL()) .WillOnce(::testing::Return(GURL("about:blank"))); agent_as_rfo()->DidCreateNewDocument(); } TEST_F(SubresourceFilterAgentTest, - DryRun_SendFrameIsAdSubframeNotSentFromProvisionalFrame) { + DryRun_SendFrameIsAdNotSentFromProvisionalFrame) { ResetAgentWithoutInitialize(/*is_subresource_filter_root=*/false, /*is_provisional=*/true, - /*is_parent_ad_subframe=*/true, - /*is_subframe_created_by_ad_script=*/false); - ExpectSendFrameIsAdSubframe(0); + /*is_parent_ad_frame=*/true, + /*is_frame_created_by_ad_script=*/false); + ExpectSendFrameIsAd(0); agent()->Initialize(); - // SendFrameIsAdSubframe() is not sent from Initialize() since the frame is + // SendFrameIsAd() is not sent from Initialize() since the frame is // provisional. ::testing::Mock::VerifyAndClearExpectations(agent()); - // Call DidCreateNewDocument and verify that SendFrameIsAdSubframe is - // not called from there either. + // Call DidCreateNewDocument and verify that SendFrameIsAd is not called from + // there either. EXPECT_CALL(*agent(), GetDocumentURL()) .WillOnce(::testing::Return(GURL("about:blank"))); agent_as_rfo()->DidCreateNewDocument(); } -TEST_F(SubresourceFilterAgentTest, - DryRun_SendFrameIsAdSubframeNotSentFromNonAdFrame) { +TEST_F(SubresourceFilterAgentTest, DryRun_SendFrameIsAdNotSentFromNonAdFrame) { ResetAgentWithoutInitialize(/*is_subresource_filter_root=*/false, /*is_provisional=*/false, - /*is_parent_ad_subframe=*/false, - /*is_subframe_created_by_ad_script=*/false); - ExpectSendFrameIsAdSubframe(0); + /*is_parent_ad_frame=*/false, + /*is_frame_created_by_ad_script=*/false); + ExpectSendFrameIsAd(0); agent()->Initialize(); - // SendFrameIsAdSubframe() is not sent from Initialize() since the frame is - // not an ad frame. + // SendFrameIsAd() is not sent from Initialize() since the frame is not an ad + // frame. ::testing::Mock::VerifyAndClearExpectations(agent()); - // Call DidCreateNewDocument and verify that SendFrameIsAdSubframe is - // not called from there either. + // Call DidCreateNewDocument and verify that SendFrameIsAd is not called from + // there either. EXPECT_CALL(*agent(), GetDocumentURL()) .WillOnce(::testing::Return(GURL("about:blank"))); agent_as_rfo()->DidCreateNewDocument(); } -TEST_F(SubresourceFilterAgentTest, - DryRun_SendFrameIsAdSubframeNotSentFromMainFrame) { +TEST_F(SubresourceFilterAgentTest, DryRun_SendFrameIsAdNotSentFromRootFrame) { ResetAgentWithoutInitialize(/*is_subresource_filter_root=*/true, /*is_provisional=*/false, - /*is_parent_ad_subframe=*/true, - /*is_subframe_created_by_ad_script=*/false); - ExpectSendFrameIsAdSubframe(0); + /*is_parent_ad_frame=*/true, + /*is_frame_created_by_ad_script=*/false); + ExpectSendFrameIsAd(0); agent()->Initialize(); - // SendFrameIsAdSubframe() is not sent from Initialize() since the frame is - // the main frame, even though it's an ad frame. + // SendFrameIsAd() is not sent from Initialize() since the frame is the root + // frame, even though it's an ad frame. ::testing::Mock::VerifyAndClearExpectations(agent()); - // Call DidCreateNewDocument and verify that SendFrameIsAdSubframe is - // not called from there either. + // Call DidCreateNewDocument and verify that SendFrameIsAd is not called from + // there either. EXPECT_CALL(*agent(), GetDocumentURL()) .WillOnce(::testing::Return(GURL("about:blank"))); agent_as_rfo()->DidCreateNewDocument(); } TEST_F(SubresourceFilterAgentTest, - DryRun_SendFrameIsAdSubframeNotSentFromNonAdSubframe) { + DryRun_SendFrameIsAdNotSentFromNonAdSubFrame) { ResetAgentWithoutInitialize(/*is_subresource_filter_root=*/false, /*is_provisional=*/false, - /*is_parent_ad_subframe=*/false, - /*is_subframe_created_by_ad_script*/ false); - ExpectSendFrameIsAdSubframe(0); + /*is_parent_ad_frame=*/false, + /*is_frame_created_by_ad_script*/ false); + ExpectSendFrameIsAd(0); agent()->Initialize(); - // SendFrameIsAdSubframe() is not sent from Initialize() since the frame is - // the main frame, even though it's an ad frame. + // SendFrameIsAd() is not sent from Initialize() since the frame is the root + // frame, even though it's an ad frame. ::testing::Mock::VerifyAndClearExpectations(agent()); - // Call DidCreateNewDocument and verify that SendFrameIsAdSubframe is - // not called from there either. + // Call DidCreateNewDocument and verify that SendFrameIsAd is not called from + // there either. EXPECT_CALL(*agent(), GetDocumentURL()) .WillOnce(::testing::Return(GURL("about:blank"))); agent_as_rfo()->DidCreateNewDocument(); } -TEST_F(SubresourceFilterAgentTest, DryRun_SendsSubframeWasCreatedByAdScript) { +TEST_F(SubresourceFilterAgentTest, DryRun_SendsFrameWasCreatedByAdScript) { ResetAgentWithoutInitialize(/*is_subresource_filter_root=*/false, /*is_provisional=*/false, - /*is_parent_ad_subframe=*/false, - /*is_subframe_created_by_ad_script=*/true); - ExpectSendSubframeWasCreatedByAdScript(1); - ExpectSendFrameIsAdSubframe(1); + /*is_parent_ad_frame=*/false, + /*is_frame_created_by_ad_script=*/true); + ExpectSendFrameWasCreatedByAdScript(1); + ExpectSendFrameIsAd(1); agent()->Initialize(); // Call DidCreateNewDocument twice and verify that - // SendSubframeWasCreatedByAdScript is only called once. + // SendFrameWasCreatedByAdScript is only called once. EXPECT_CALL(*agent(), GetDocumentURL()) .WillOnce(::testing::Return(GURL("about:blank"))); agent_as_rfo()->DidCreateNewDocument(); @@ -824,19 +821,19 @@ } TEST_F(SubresourceFilterAgentTest, - DryRun_SendSubframeWasCreatedByAdScriptNotSentFromProvisionalFrame) { + DryRun_SendFrameWasCreatedByAdScriptNotSentFromProvisionalFrame) { ResetAgentWithoutInitialize(/*is_subresource_filter_root=*/false, /*is_provisional=*/true, - /*is_parent_ad_subframe=*/false, - /*is_subframe_created_by_ad_script=*/true); - ExpectSendSubframeWasCreatedByAdScript(0); + /*is_parent_ad_frame=*/false, + /*is_frame_created_by_ad_script=*/true); + ExpectSendFrameWasCreatedByAdScript(0); agent()->Initialize(); - // SendSubframeWasCreatedByAdScript() is not sent from Initialize() since the + // SendFrameWasCreatedByAdScript() is not sent from Initialize() since the // frame is provisional, even though it's created by ad script. ::testing::Mock::VerifyAndClearExpectations(agent()); - // Call DidCreateNewDocument and verify that SendSubframeWasCreatedByAdScript - // is not called from there either. + // Call DidCreateNewDocument and verify that SendFrameWasCreatedByAdScript is + // not called from there either. EXPECT_CALL(*agent(), GetDocumentURL()) .WillOnce(::testing::Return(GURL("about:blank"))); agent_as_rfo()->DidCreateNewDocument(); @@ -844,19 +841,19 @@ TEST_F( SubresourceFilterAgentTest, - DryRun_SendSubframeWasCreatedByAdScriptNotSentFromFrameNotCreatedByAdScript) { + DryRun_SendFrameWasCreatedByAdScriptNotSentFromFrameNotCreatedByAdScript) { ResetAgentWithoutInitialize(/*is_subresource_filter_root=*/false, /*is_provisional=*/false, - /*is_parent_ad_subframe=*/false, - /*is_subframe_created_by_ad_script=*/false); - ExpectSendSubframeWasCreatedByAdScript(0); + /*is_parent_ad_frame=*/false, + /*is_frame_created_by_ad_script=*/false); + ExpectSendFrameWasCreatedByAdScript(0); agent()->Initialize(); - // SendSubframeWasCreatedByAdScript() is not sent from Initialize() since the + // SendFrameWasCreatedByAdScript() is not sent from Initialize() since the // frame was not created by ad script. ::testing::Mock::VerifyAndClearExpectations(agent()); - // Call DidCreateNewDocument and verify that SendSubframeWasCreatedByAdScript - // is not called from there either. + // Call DidCreateNewDocument and verify that SendFrameWasCreatedByAdScript is + // not called from there either. EXPECT_CALL(*agent(), GetDocumentURL()) .WillOnce(::testing::Return(GURL("about:blank"))); agent_as_rfo()->DidCreateNewDocument();
diff --git a/components/subresource_filter/core/browser/subresource_filter_constants.h b/components/subresource_filter/core/browser/subresource_filter_constants.h index 8a71877..1887bed 100644 --- a/components/subresource_filter/core/browser/subresource_filter_constants.h +++ b/components/subresource_filter/core/browser/subresource_filter_constants.h
@@ -63,7 +63,7 @@ "https://www.chromestatus.com/feature/5738264052891648"; // Console message to be displayed on disallowing subframe. -constexpr char kDisallowSubframeConsoleMessageFormat[] = +constexpr char kDisallowChildFrameConsoleMessageFormat[] = "Chrome blocked resource %s on this site because this site tends to show " "ads that interrupt, distract, mislead, or prevent user control. Learn " "more at https://www.chromestatus.com/feature/5738264052891648";
diff --git a/components/subresource_filter/core/browser/subresource_filter_features.h b/components/subresource_filter/core/browser/subresource_filter_features.h index 3a37d81..4219277 100644 --- a/components/subresource_filter/core/browser/subresource_filter_features.h +++ b/components/subresource_filter/core/browser/subresource_filter_features.h
@@ -48,7 +48,7 @@ // as needed). struct Configuration { // The conditions that determine whether subresource filtering should be - // activated for a given main frame navigation using this configuration. + // activated for a given root frame navigation using this configuration. struct ActivationConditions { // The activation scope. That is, the subset of page loads where subresource // filtering should be activated according to this configuration. When set @@ -68,7 +68,7 @@ std::unique_ptr<base::trace_event::TracedValue> ToTracedValue() const; }; - // The details of how subresource filtering should operate for a given main + // The details of how subresource filtering should operate for a given root // frame navigation when it is activated using this configuration. struct ActivationOptions { // The maximum degree to which subresource filtering should be activated on
diff --git a/components/subresource_filter/core/common/activation_decision.h b/components/subresource_filter/core/common/activation_decision.h index 6c04a0b..f6df30df 100644 --- a/components/subresource_filter/core/common/activation_decision.h +++ b/components/subresource_filter/core/common/activation_decision.h
@@ -20,10 +20,10 @@ ACTIVATION_DISABLED = 2, // Did not activate because although there was a configuration whose - // activation conditions were met, the main frame URL was allowlisted. + // activation conditions were met, the root frame URL was allowlisted. URL_ALLOWLISTED = 4, - // Did not activate because the main frame document URL did not match the + // Did not activate because the root frame document URL did not match the // activation conditions of any of enabled configurations. ACTIVATION_CONDITIONS_NOT_MET = 5,
diff --git a/components/wifi/wifi_service_mac.mm b/components/wifi/wifi_service_mac.mm index e5f8cde..78249ca 100644 --- a/components/wifi/wifi_service_mac.mm +++ b/components/wifi/wifi_service_mac.mm
@@ -173,13 +173,6 @@ DVLOG(1) << "Failed to initialize default interface."; return; } - - if (![interface_ - respondsToSelector:@selector(associateToNetwork:password:error:)]) { - DVLOG(1) << "CWInterface does not support associateToNetwork."; - interface_.reset(); - return; - } } void WiFiServiceMac::UnInitialize() {
diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm index 77b2058..58c26c9 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
@@ -155,13 +155,6 @@ } // namespace -// These are not documented, so use only after checking -respondsToSelector:. -@interface NSApplication (UndocumentedSpeechMethods) -- (void)speakString:(NSString*)string; -- (void)stopSpeaking:(id)sender; -- (BOOL)isSpeaking; -@end - // RenderWidgetHostViewCocoa --------------------------------------------------- // Private methods:
diff --git a/content/browser/media/cdm_registry_impl_unittest.cc b/content/browser/media/cdm_registry_impl_unittest.cc index e22b81a..4c1c1718a 100644 --- a/content/browser/media/cdm_registry_impl_unittest.cc +++ b/content/browser/media/cdm_registry_impl_unittest.cc
@@ -21,7 +21,6 @@ #include "base/test/gmock_move_support.h" #include "base/test/mock_callback.h" #include "base/test/scoped_feature_list.h" -#include "base/token.h" #include "base/version.h" #include "build/chromeos_buildflags.h" #include "content/browser/gpu/gpu_data_manager_impl.h"
diff --git a/content/browser/media/key_system_support_impl_unittest.cc b/content/browser/media/key_system_support_impl_unittest.cc index 980e408..1731249 100644 --- a/content/browser/media/key_system_support_impl_unittest.cc +++ b/content/browser/media/key_system_support_impl_unittest.cc
@@ -11,11 +11,9 @@ #include "base/logging.h" #include "base/test/gmock_callback_support.h" #include "base/test/mock_callback.h" -#include "base/token.h" #include "content/public/test/browser_task_environment.h" #include "media/base/video_codecs.h" #include "media/cdm/cdm_capability.h" -#include "media/cdm/cdm_type.h" #include "mojo/public/cpp/bindings/equals_traits.h" #include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h"
diff --git a/content/browser/media/media_interface_proxy.h b/content/browser/media/media_interface_proxy.h index a3b9d17..61486af 100644 --- a/content/browser/media/media_interface_proxy.h +++ b/content/browser/media/media_interface_proxy.h
@@ -11,7 +11,6 @@ #include "base/memory/weak_ptr.h" #include "base/threading/thread_checker.h" -#include "base/token.h" #include "base/unguessable_token.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h"
diff --git a/content/browser/media/media_license_manager_unittest.cc b/content/browser/media/media_license_manager_unittest.cc index b16e1f9..1536e562 100644 --- a/content/browser/media/media_license_manager_unittest.cc +++ b/content/browser/media/media_license_manager_unittest.cc
@@ -14,7 +14,6 @@ #include "base/strings/string_piece_forward.h" #include "base/test/task_environment.h" #include "base/test/test_future.h" -#include "base/token.h" #include "components/services/storage/public/cpp/buckets/bucket_locator.h" #include "components/services/storage/public/cpp/constants.h" #include "content/browser/media/media_license_quota_client.h" @@ -33,7 +32,7 @@ namespace { -const media::CdmType kCdmType{base::Token{1234, 5678}}; +const media::CdmType kCdmType{1234, 5678}; const char kExampleOrigin[] = "https://example.com";
diff --git a/content/browser/media/service_factory.cc b/content/browser/media/service_factory.cc index 74f0b89..79564a92 100644 --- a/content/browser/media/service_factory.cc +++ b/content/browser/media/service_factory.cc
@@ -19,6 +19,7 @@ #include "content/public/common/content_client.h" #include "media/base/cdm_context.h" #include "media/base/media_switches.h" +#include "media/cdm/cdm_type.h" #include "media/media_buildflags.h" #include "media/mojo/mojom/cdm_service.mojom.h" @@ -103,7 +104,7 @@ // Services are keyed on CDM type, user profile and site URL. Note that site // is not normal URL nor origin. See chrome/browser/site_isolation for details. -using ServiceKey = std::tuple<base::Token, const BrowserContext*, GURL>; +using ServiceKey = std::tuple<media::CdmType, const BrowserContext*, GURL>; std::ostream& operator<<(std::ostream& os, const ServiceKey& key) { return os << "{" << std::get<0>(key).ToString() << ", " << std::get<1>(key) @@ -172,7 +173,7 @@ // Gets an instance of the service for `cdm_type`, `browser_context` and `site`. // Instances are started lazily as needed. template <typename T> -T& GetService(const base::Token& cdm_type, +T& GetService(const media::CdmType& cdm_type, BrowserContext* browser_context, const GURL& site, const std::string& service_name, @@ -238,7 +239,7 @@ const GURL& site, const base::FilePath& cdm_path) { return GetService<media::mojom::MediaFoundationService>( - base::Token(), browser_context, site, "Media Foundation Service", + media::CdmType(), browser_context, site, "Media Foundation Service", cdm_path); } #endif // BUILDFLAG(IS_WIN)
diff --git a/content/browser/renderer_host/browsing_context_state.cc b/content/browser/renderer_host/browsing_context_state.cc index b7eb73d04..0c6c47d4 100644 --- a/content/browser/renderer_host/browsing_context_state.cc +++ b/content/browser/renderer_host/browsing_context_state.cc
@@ -350,18 +350,18 @@ replication_state_->has_received_user_gesture_before_nav = value; } -void BrowsingContextState::SetIsAdSubframe(bool is_ad_subframe) { - if (is_ad_subframe == replication_state_->is_ad_subframe) +void BrowsingContextState::SetIsAdFrame(bool is_ad_frame) { + if (is_ad_frame == replication_state_->is_ad_frame) return; - replication_state_->is_ad_subframe = is_ad_subframe; + replication_state_->is_ad_frame = is_ad_frame; ExecuteRemoteFramesBroadcastMethod( base::BindRepeating( - [](bool is_ad_subframe, RenderFrameProxyHost* proxy) { - proxy->GetAssociatedRemoteFrame()->SetReplicatedIsAdSubframe( - is_ad_subframe); + [](bool is_ad_frame, RenderFrameProxyHost* proxy) { + proxy->GetAssociatedRemoteFrame()->SetReplicatedIsAdFrame( + is_ad_frame); }, - is_ad_subframe), + is_ad_frame), /*instance_to_skip=*/nullptr, /*outer_delegate_proxy=*/nullptr); }
diff --git a/content/browser/renderer_host/browsing_context_state.h b/content/browser/renderer_host/browsing_context_state.h index 51c1be5..085eee0 100644 --- a/content/browser/renderer_host/browsing_context_state.h +++ b/content/browser/renderer_host/browsing_context_state.h
@@ -177,9 +177,8 @@ // update. void OnSetHadStickyUserActivationBeforeNavigation(bool value); - // Sets whether this is an ad subframe and notifies the proxies about the - // update. - void SetIsAdSubframe(bool is_ad_subframe); + // Sets whether this is an ad frame and notifies the proxies about the update. + void SetIsAdFrame(bool is_ad_frame); // Delete a RenderFrameProxyHost owned by this object. void DeleteRenderFrameProxyHost(
diff --git a/content/browser/renderer_host/input/web_input_event_builders_mac.mm b/content/browser/renderer_host/input/web_input_event_builders_mac.mm index eb7c3a81..8a15dce 100644 --- a/content/browser/renderer_host/input/web_input_event_builders_mac.mm +++ b/content/browser/renderer_host/input/web_input_event_builders_mac.mm
@@ -202,17 +202,11 @@ } blink::WebMouseWheelEvent::Phase PhaseForEvent(NSEvent* event) { - if (![event respondsToSelector:@selector(phase)]) - return blink::WebMouseWheelEvent::kPhaseNone; - NSEventPhase event_phase = [event phase]; return PhaseForNSEventPhase(event_phase); } blink::WebMouseWheelEvent::Phase MomentumPhaseForEvent(NSEvent* event) { - if (![event respondsToSelector:@selector(momentumPhase)]) - return blink::WebMouseWheelEvent::kPhaseNone; - NSEventPhase event_momentum_phase = [event momentumPhase]; return PhaseForNSEventPhase(event_momentum_phase); }
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index f3bfd8a4e..1a64db6 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -13543,8 +13543,8 @@ return document_associated_data_->dom_content_loaded; } -void RenderFrameHostImpl::UpdateIsAdSubframe(bool is_ad_subframe) { - browsing_context_state_->SetIsAdSubframe(is_ad_subframe); +void RenderFrameHostImpl::UpdateIsAdFrame(bool is_ad_frame) { + browsing_context_state_->SetIsAdFrame(is_ad_frame); } #if BUILDFLAG(IS_ANDROID)
diff --git a/content/browser/renderer_host/render_frame_host_impl.h b/content/browser/renderer_host/render_frame_host_impl.h index 4f8144e..1f7bdd7 100644 --- a/content/browser/renderer_host/render_frame_host_impl.h +++ b/content/browser/renderer_host/render_frame_host_impl.h
@@ -447,7 +447,7 @@ blink::mojom::UserActivationNotificationType notification_type) override; bool Reload() override; bool IsDOMContentLoaded() override; - void UpdateIsAdSubframe(bool is_ad_subframe) override; + void UpdateIsAdFrame(bool is_ad_frame) override; void SetIsXrOverlaySetup() override; ukm::SourceId GetPageUkmSourceId() override; StoragePartitionImpl* GetStoragePartition() override;
diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc index a64114d9..5d1de0e 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc
@@ -324,7 +324,7 @@ false /* has_potentially_trustworthy_unique_origin */, false /* has_active_user_gesture */, false /* has_received_user_gesture_before_nav */, - false /* is_ad_subframe */), + false /* is_ad_frame */), frame_tree_node_->parent(), features::GetBrowsingContextMode() == features::BrowsingContextStateImplementationType:: @@ -366,7 +366,7 @@ false /* has_potentially_trustworthy_unique_origin */, false /* has_active_user_gesture */, false /* has_received_user_gesture_before_nav */, - false /* is_ad_subframe */), + false /* is_ad_frame */), frame_tree_node_->parent(), features::GetBrowsingContextMode() == features::BrowsingContextStateImplementationType::
diff --git a/content/browser/renderer_host/render_frame_host_manager_unittest.cc b/content/browser/renderer_host/render_frame_host_manager_unittest.cc index 0d0d4c0..713bc5a 100644 --- a/content/browser/renderer_host/render_frame_host_manager_unittest.cc +++ b/content/browser/renderer_host/render_frame_host_manager_unittest.cc
@@ -3629,13 +3629,11 @@ void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override { auto it = ad_urls_.find(navigation_handle->GetURL()); - navigation_handle->GetRenderFrameHost()->UpdateIsAdSubframe(it != - ad_urls_.end()); + navigation_handle->GetRenderFrameHost()->UpdateIsAdFrame(it != + ad_urls_.end()); } - void SimulateOnFrameIsAdSubframe(RenderFrameHost* rfh) { - rfh->UpdateIsAdSubframe(true); - } + void SimulateOnFrameIsAd(RenderFrameHost* rfh) { rfh->UpdateIsAdFrame(true); } private: std::set<GURL> ad_urls_; @@ -3643,19 +3641,19 @@ class AdStatusInterceptingRemoteFrame : public content::FakeRemoteFrame { public: - void SetReplicatedIsAdSubframe(bool is_ad_subframe) override { - is_ad_subframe_ = is_ad_subframe; + void SetReplicatedIsAdFrame(bool is_ad_frame) override { + is_ad_frame_ = is_ad_frame; } // These methods reset state back to default when they are called. - bool LastAdSubframe() { - bool is_ad_subframe = is_ad_subframe_; - is_ad_subframe_ = false; - return is_ad_subframe; + bool LastAdFrame() { + bool is_ad_frame = is_ad_frame_; + is_ad_frame_ = false; + return is_ad_frame; } private: - bool is_ad_subframe_ = false; + bool is_ad_frame_ = false; }; class RenderFrameHostManagerAdTaggingSignalTest @@ -3681,20 +3679,20 @@ if (proxy_host->frame_tree_node() ->current_replication_state() - .is_ad_subframe) { + .is_ad_frame) { ad_frames_on_proxy_created_.insert(proxy_host); } } void ExpectAdSubframeSignalForFrameProxy(RenderFrameProxyHost* proxy_host, - bool expect_is_ad_subframe) { + bool expect_is_ad_frame) { base::RunLoop().RunUntilIdle(); auto it = proxy_map_.find(proxy_host); EXPECT_TRUE(it != proxy_map_.end()); AdStatusInterceptingRemoteFrame* remote_frame = it->second.get(); - EXPECT_EQ(expect_is_ad_subframe, remote_frame->LastAdSubframe()); + EXPECT_EQ(expect_is_ad_frame, remote_frame->LastAdFrame()); } void ExpectAdStatusOnFrameProxyCreated(RenderFrameProxyHost* proxy_host) { @@ -3754,7 +3752,7 @@ ExpectAdStatusOnFrameProxyCreated( subframe_node->render_manager()->GetProxyToParent()); - EXPECT_TRUE(subframe_node->current_replication_state().is_ad_subframe); + EXPECT_TRUE(subframe_node->current_replication_state().is_ad_frame); } // A page with top frame A that has subframes B and A1. A1 is an ad iframe that @@ -3775,7 +3773,7 @@ ->GetPrimaryFrameTree() .root() ->current_replication_state() - .is_ad_subframe); + .is_ad_frame); AppendChildToFrame("subframe_b", kUrlB, web_contents()->GetPrimaryMainFrame()); @@ -3786,13 +3784,13 @@ FrameTreeNode* subframe_node_b = top_frame_node_a->child_at(0); FrameTreeNode* subframe_node_a1 = top_frame_node_a->child_at(1); - ad_tagging_simulator.SimulateOnFrameIsAdSubframe( + ad_tagging_simulator.SimulateOnFrameIsAd( subframe_node_a1->current_frame_host()); RenderFrameProxyHost* proxy_a1_to_b = GetProxyHost(subframe_node_a1, subframe_node_b); - EXPECT_TRUE(subframe_node_a1->current_replication_state().is_ad_subframe); + EXPECT_TRUE(subframe_node_a1->current_replication_state().is_ad_frame); ExpectAdSubframeSignalForFrameProxy(proxy_a1_to_b, true); } @@ -3818,7 +3816,7 @@ ->GetPrimaryFrameTree() .root() ->current_replication_state() - .is_ad_subframe); + .is_ad_frame); AppendChildToFrame("subframe_b", kUrlB, web_contents()->GetPrimaryMainFrame()); @@ -3829,8 +3827,8 @@ FrameTreeNode* subframe_node_b = top_frame_node_a->child_at(0); FrameTreeNode* subframe_node_c = top_frame_node_a->child_at(1); - EXPECT_FALSE(subframe_node_b->current_replication_state().is_ad_subframe); - EXPECT_FALSE(subframe_node_c->current_replication_state().is_ad_subframe); + EXPECT_FALSE(subframe_node_b->current_replication_state().is_ad_frame); + EXPECT_FALSE(subframe_node_c->current_replication_state().is_ad_frame); RenderFrameProxyHost* proxy_c_to_a = GetProxyHost(subframe_node_c, top_frame_node_a); @@ -3848,7 +3846,7 @@ NavigationSimulator::NavigateAndCommitFromDocument( kUrlD, subframe_node_c->current_frame_host()); - EXPECT_TRUE(subframe_node_c->current_replication_state().is_ad_subframe); + EXPECT_TRUE(subframe_node_c->current_replication_state().is_ad_frame); ExpectAdSubframeSignalForFrameProxy(proxy_c_to_a, true); ExpectAdSubframeSignalForFrameProxy(proxy_c_to_b, true); @@ -3929,8 +3927,8 @@ NavigationSimulator::NavigateAndCommitFromDocument(kUrlC, grandchild_host); - EXPECT_TRUE(subframe_node->current_replication_state().is_ad_subframe); - EXPECT_TRUE(grandchild_node->current_replication_state().is_ad_subframe); + EXPECT_TRUE(subframe_node->current_replication_state().is_ad_frame); + EXPECT_TRUE(grandchild_node->current_replication_state().is_ad_frame); ExpectAdSubframeSignalForFrameProxy(proxy_to_main_frame, true); }
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 26b52c6..8d7c093 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -4441,7 +4441,7 @@ FindReusableProcessHostForSiteInstance(site_instance); const base::TimeTicks reusable_host_lookup_time = base::TimeTicks::Now(); UMA_HISTOGRAM_BOOLEAN( - "SiteIsolation.ReusePendingOrCommittedSite.CouldReuse", + "SiteIsolation.ReusePendingOrCommittedSite.CouldReuse2", render_process_host != nullptr); if (render_process_host) { is_unmatched_service_worker = false;
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc index 261e1dd..5b61200 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -505,9 +505,6 @@ bool is_guest_view = delegate_->IsGuest(); bool is_fenced_frame = frame_tree_->type() == FrameTree::Type::kFencedFrame; - // GuestViews in the same StoragePartition need to find each other's frames. - params->renderer_wide_named_frame_lookup = is_guest_view; - if (is_fenced_frame) { params->type = mojom::ViewWidgetType::kFencedFrame;
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index d4b28a3..28693f48 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2838,6 +2838,9 @@ static_cast<int>(min_width / display.device_scale_factor())); #endif // BUILDFLAG(IS_ANDROID) + // GuestViews in the same StoragePartition need to find each other's frames. + prefs.renderer_wide_named_frame_lookup = IsGuest(); + GetContentClient()->browser()->OverrideWebkitPrefs(this, &prefs); return prefs; }
diff --git a/content/browser/webrtc/webrtc_internals.cc b/content/browser/webrtc/webrtc_internals.cc index f60f90ec..f9e9cf8 100644 --- a/content/browser/webrtc/webrtc_internals.cc +++ b/content/browser/webrtc/webrtc_internals.cc
@@ -50,19 +50,18 @@ // of many getUserMedia() calls. See https://crbug.com/804440. const size_t kMaxGetUserMediaEntries = 1000; -// Makes sure that |dict| has a ListValue under path "log". -base::Value* EnsureLogList(base::Value* dict) { - base::Value* log = dict->FindListKey("log"); - if (!log) { - log = dict->SetKey("log", base::Value(base::Value::Type::LIST)); - } - return log; +// Makes sure that |dict| has a List under path "log". +base::Value::List& EnsureLogList(base::Value::Dict& dict) { + base::Value::List* log = dict.FindList("log"); + if (log) + return *log; + return dict.Set("log", base::Value::List())->GetList(); } // Removes the log entry associated with a given record. void FreeLogList(base::Value* value) { DCHECK(value->is_dict()); - value->RemoveKey("log"); + value->GetDict().Remove("log"); } } // namespace @@ -97,7 +96,8 @@ WebRTCInternals::WebRTCInternals(int aggregate_updates_ms, bool should_block_power_saving) - : selection_type_(SelectionType::kAudioDebugRecordings), + : peer_connection_data_(base::Value::List()), + selection_type_(SelectionType::kAudioDebugRecordings), command_line_derived_logging_path_( base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( switches::kWebRtcLocalEventLogging)), @@ -175,20 +175,20 @@ // TODO(tommi): Consider changing this design so that webrtc-internals has // minimal impact if chrome://webrtc-internals isn't open. - base::Value dict(base::Value::Type::DICTIONARY); - dict.SetIntKey("rid", frame_id.child_id); - dict.SetIntKey("lid", lid); - dict.SetIntKey("pid", static_cast<int>(pid)); - dict.SetStringKey("rtcConfiguration", rtc_configuration); - dict.SetStringKey("constraints", constraints); - dict.SetStringKey("url", url); - dict.SetBoolKey("isOpen", true); - dict.SetBoolKey("connected", false); + base::Value::Dict dict; + dict.Set("rid", frame_id.child_id); + dict.Set("lid", lid); + dict.Set("pid", static_cast<int>(pid)); + dict.Set("rtcConfiguration", rtc_configuration); + dict.Set("constraints", constraints); + dict.Set("url", url); + dict.Set("isOpen", true); + dict.Set("connected", false); if (!observers_.empty()) SendUpdate("add-peer-connection", dict.Clone()); - peer_connection_data_.Append(std::move(dict)); + peer_connection_data().Append(std::move(dict)); if (render_process_id_set_.insert(frame_id.child_id).second) { RenderProcessHost* host = RenderProcessHost::FromID(frame_id.child_id); @@ -202,15 +202,15 @@ DCHECK_CURRENTLY_ON(BrowserThread::UI); auto it = FindRecord(frame_id, lid); - if (it != peer_connection_data_.GetListDeprecated().end()) { + if (it != peer_connection_data().end()) { MaybeClosePeerConnection(*it); - peer_connection_data_.EraseListIter(it); + peer_connection_data().erase(it); } if (!observers_.empty()) { - base::Value id(base::Value::Type::DICTIONARY); - id.SetIntKey("rid", frame_id.child_id); - id.SetIntKey("lid", lid); + base::Value::Dict id; + id.Set("rid", frame_id.child_id); + id.Set("lid", lid); SendUpdate("remove-peer-connection", std::move(id)); } } @@ -222,7 +222,7 @@ DCHECK_CURRENTLY_ON(BrowserThread::UI); auto it = FindRecord(frame_id, lid); - if (it == peer_connection_data_.GetListDeprecated().end()) + if (it == peer_connection_data().end()) return; if (type == "iceconnectionstatechange") { @@ -236,30 +236,30 @@ MaybeClosePeerConnection(*it); } else if (type == "setConfiguration") { // Update the configuration we have for this connection. - it->SetStringKey("rtcConfiguration", value); + it->GetDict().Set("rtcConfiguration", value); } // Don't update entries if there aren't any observers. if (observers_.empty()) return; - base::Value log_entry(base::Value::Type::DICTIONARY); + base::Value::Dict log_entry; double epoch_time = base::Time::Now().ToJsTime(); string time = base::NumberToString(epoch_time); - log_entry.SetStringKey("time", time); - log_entry.SetStringKey("type", type); - log_entry.SetStringKey("value", value); + log_entry.Set("time", time); + log_entry.Set("type", type); + log_entry.Set("value", value); - base::Value update(base::Value::Type::DICTIONARY); - update.SetIntKey("rid", frame_id.child_id); - update.SetIntKey("lid", lid); - update.MergeDictionary(&log_entry); + base::Value::Dict update; + update.Set("rid", frame_id.child_id); + update.Set("lid", lid); + update.Merge(log_entry.Clone()); SendUpdate("update-peer-connection", std::move(update)); // Append the update to the end of the log. - EnsureLogList(&*it)->Append(std::move(log_entry)); + EnsureLogList(it->GetDict()).Append(std::move(log_entry)); } void WebRTCInternals::OnAddStandardStats(GlobalRenderFrameHostId frame_id, @@ -276,7 +276,7 @@ dict.Set("reports", std::move(value)); - SendUpdate("add-standard-stats", base::Value(std::move(dict))); + SendUpdate("add-standard-stats", std::move(dict)); } void WebRTCInternals::OnAddLegacyStats(GlobalRenderFrameHostId frame_id, @@ -293,7 +293,7 @@ dict.Set("reports", std::move(value)); - SendUpdate("add-legacy-stats", base::Value(std::move(dict))); + SendUpdate("add-legacy-stats", std::move(dict)); } void WebRTCInternals::OnGetUserMedia(GlobalRenderFrameHostId frame_id, @@ -305,8 +305,7 @@ const std::string& video_constraints) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (get_user_media_requests_.GetListDeprecated().size() >= - kMaxGetUserMediaEntries) { + if (get_user_media_requests_.size() >= kMaxGetUserMediaEntries) { LOG(WARNING) << "Maximum number of tracked getUserMedia() requests reached " "in webrtc-internals."; return; @@ -316,16 +315,16 @@ // Frame may be gone (and does not exist in tests). std::string origin = host ? host->GetLastCommittedOrigin().Serialize() : ""; - base::Value dict(base::Value::Type::DICTIONARY); - dict.SetIntKey("rid", frame_id.child_id); - dict.SetIntKey("pid", static_cast<int>(pid)); - dict.SetIntKey("request_id", request_id); - dict.SetStringKey("origin", origin); - dict.SetDoubleKey("timestamp", base::Time::Now().ToJsTime()); + base::Value::Dict dict; + dict.Set("rid", frame_id.child_id); + dict.Set("pid", static_cast<int>(pid)); + dict.Set("request_id", request_id); + dict.Set("origin", origin); + dict.Set("timestamp", base::Time::Now().ToJsTime()); if (audio) - dict.SetStringKey("audio", audio_constraints); + dict.Set("audio", audio_constraints); if (video) - dict.SetStringKey("video", video_constraints); + dict.Set("video", video_constraints); if (!observers_.empty()) SendUpdate("add-get-user-media", dict.Clone()); @@ -348,23 +347,22 @@ const std::string& video_track_info) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (get_user_media_requests_.GetListDeprecated().size() >= - kMaxGetUserMediaEntries) { + if (get_user_media_requests_.size() >= kMaxGetUserMediaEntries) { LOG(WARNING) << "Maximum number of tracked getUserMedia() requests reached " "in webrtc-internals."; return; } - base::Value dict(base::Value::Type::DICTIONARY); - dict.SetIntKey("rid", frame_id.child_id); - dict.SetIntKey("pid", static_cast<int>(pid)); - dict.SetIntKey("request_id", request_id); - dict.SetDoubleKey("timestamp", base::Time::Now().ToJsTime()); - dict.SetStringKey("stream_id", stream_id); + base::Value::Dict dict; + dict.Set("rid", frame_id.child_id); + dict.Set("pid", static_cast<int>(pid)); + dict.Set("request_id", request_id); + dict.Set("timestamp", base::Time::Now().ToJsTime()); + dict.Set("stream_id", stream_id); if (!audio_track_info.empty()) - dict.SetStringKey("audio_track_info", audio_track_info); + dict.Set("audio_track_info", audio_track_info); if (!video_track_info.empty()) - dict.SetStringKey("video_track_info", video_track_info); + dict.Set("video_track_info", video_track_info); if (!observers_.empty()) SendUpdate("update-get-user-media", dict.Clone()); @@ -385,20 +383,19 @@ const std::string& error_message) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (get_user_media_requests_.GetListDeprecated().size() >= - kMaxGetUserMediaEntries) { + if (get_user_media_requests_.size() >= kMaxGetUserMediaEntries) { LOG(WARNING) << "Maximum number of tracked getUserMedia() requests reached " "in webrtc-internals."; return; } - base::Value dict(base::Value::Type::DICTIONARY); - dict.SetIntKey("rid", frame_id.child_id); - dict.SetIntKey("pid", static_cast<int>(pid)); - dict.SetIntKey("request_id", request_id); - dict.SetDoubleKey("timestamp", base::Time::Now().ToJsTime()); - dict.SetStringKey("error", error); - dict.SetStringKey("error_message", error_message); + base::Value::Dict dict; + dict.Set("rid", frame_id.child_id); + dict.Set("pid", static_cast<int>(pid)); + dict.Set("request_id", request_id); + dict.Set("timestamp", base::Time::Now().ToJsTime()); + dict.Set("error", error); + dict.Set("error_message", error_message); if (!observers_.empty()) SendUpdate("update-get-user-media", dict.Clone()); @@ -428,8 +425,8 @@ DisableAudioDebugRecordings(); DisableLocalEventLogRecordings(); - // TODO(tommi): Consider removing all the peer_connection_data_. - for (auto& dictionary : peer_connection_data_.GetListDeprecated()) + // TODO(tommi): Consider removing all the peer_connection_data(). + for (auto& dictionary : peer_connection_data()) FreeLogList(&dictionary); } @@ -447,12 +444,13 @@ void WebRTCInternals::UpdateObserver(WebRTCInternalsUIObserver* observer) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (peer_connection_data_.GetListDeprecated().size() > 0) + if (peer_connection_data().size() > 0) observer->OnUpdate("update-all-peer-connections", &peer_connection_data_); - for (const auto& request : get_user_media_requests_.GetListDeprecated()) { + for (const auto& request : get_user_media_requests_) { // If there is a stream_id key or an error key this is an update. - if (request.FindStringKey("stream_id") || request.FindStringKey("error")) { + if (request.GetDict().FindString("stream_id") || + request.GetDict().FindString("error")) { observer->OnUpdate("update-get-user-media", &request); } else { observer->OnUpdate("add-get-user-media", &request); @@ -575,6 +573,11 @@ } } +void WebRTCInternals::SendUpdate(const std::string& event_name, + base::Value::Dict event_data) { + SendUpdate(event_name, base::Value(std::move(event_data))); +} + void WebRTCInternals::RenderProcessExited( RenderProcessHost* host, const ChildProcessTerminationInfo& info) { @@ -629,24 +632,22 @@ // Iterates from the end of the list to remove the PeerConnections created // by the exiting renderer. - base::Value::ListView peer_conn_view = - peer_connection_data_.GetListDeprecated(); - for (int i = peer_conn_view.size() - 1; i >= 0; --i) { - DCHECK(peer_conn_view[i].is_dict()); + for (int i = peer_connection_data().size() - 1; i >= 0; --i) { + DCHECK(peer_connection_data()[i].is_dict()); absl::optional<int> this_rid, this_lid; - this_rid = peer_conn_view[i].FindIntKey("rid"); - this_lid = peer_conn_view[i].FindIntKey("lid"); + this_rid = peer_connection_data()[i].GetDict().FindInt("rid"); + this_lid = peer_connection_data()[i].GetDict().FindInt("lid"); if (this_rid.value_or(0) == render_process_id) { if (!observers_.empty()) { - base::Value update(base::Value::Type::DICTIONARY); - update.SetIntKey("rid", this_rid.value_or(0)); - update.SetIntKey("lid", this_lid.value_or(0)); + base::Value::Dict update; + update.Set("rid", this_rid.value_or(0)); + update.Set("lid", this_lid.value_or(0)); SendUpdate("remove-peer-connection", std::move(update)); } - MaybeClosePeerConnection(peer_conn_view[i]); - peer_connection_data_.EraseListIter(peer_conn_view.begin() + i); + MaybeClosePeerConnection(peer_connection_data()[i]); + peer_connection_data().erase(peer_connection_data().begin() + i); } } UpdateWakeLock(); @@ -654,24 +655,21 @@ bool found_any = false; // Iterates from the end of the list to remove the getUserMedia requests // created by the exiting renderer. - base::Value::ListView get_user_media_requests_view = - get_user_media_requests_.GetListDeprecated(); - for (int i = get_user_media_requests_view.size() - 1; i >= 0; --i) { - DCHECK(get_user_media_requests_view[i].is_dict()); + for (int i = get_user_media_requests_.size() - 1; i >= 0; --i) { + DCHECK(get_user_media_requests_[i].is_dict()); absl::optional<int> this_rid = - get_user_media_requests_view[i].FindIntKey("rid"); + get_user_media_requests_[i].GetDict().FindInt("rid"); if (this_rid.value_or(0) == render_process_id) { - get_user_media_requests_.EraseListIter( - get_user_media_requests_view.begin() + i); + get_user_media_requests_.erase(get_user_media_requests_.begin() + i); found_any = true; } } if (found_any && !observers_.empty()) { - base::Value update(base::Value::Type::DICTIONARY); - update.SetIntKey("rid", render_process_id); + base::Value::Dict update; + update.Set("rid", render_process_id); SendUpdate("remove-get-user-media-for-renderer", std::move(update)); } } @@ -695,21 +693,21 @@ void WebRTCInternals::MaybeClosePeerConnection(base::Value& record) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - absl::optional<bool> is_open = record.FindBoolKey("isOpen"); + absl::optional<bool> is_open = record.GetDict().FindBool("isOpen"); DCHECK(is_open.has_value()); if (!*is_open) return; - record.SetBoolKey("isOpen", false); + record.GetDict().Set("isOpen", false); MaybeMarkPeerConnectionAsNotConnected(record); } void WebRTCInternals::MaybeMarkPeerConnectionAsConnected(base::Value& record) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - bool was_connected = record.FindBoolKey("connected").value_or(true); + bool was_connected = record.GetDict().FindBool("connected").value_or(true); if (!was_connected) { ++num_connected_connections_; - record.SetBoolKey("connected", true); + record.GetDict().Set("connected", true); UpdateWakeLock(); for (auto& observer : connections_observers_) observer.OnConnectionsCountChange(num_connected_connections_); @@ -719,9 +717,9 @@ void WebRTCInternals::MaybeMarkPeerConnectionAsNotConnected( base::Value& record) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - bool was_connected = record.FindBoolKey("connected").value_or(false); + bool was_connected = record.GetDict().FindBool("connected").value_or(false); if (was_connected) { - record.SetBoolKey("connected", false); + record.GetDict().Set("connected", false); --num_connected_connections_; DCHECK_GE(num_connected_connections_, 0); UpdateWakeLock(); @@ -774,22 +772,21 @@ } } -base::CheckedContiguousIterator<base::Value> WebRTCInternals::FindRecord( +base::Value::List::iterator WebRTCInternals::FindRecord( GlobalRenderFrameHostId frame_id, int lid) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - base::Value::ListView peer_conn_view = - peer_connection_data_.GetListDeprecated(); - for (auto it = peer_conn_view.begin(); it != peer_conn_view.end(); ++it) { + for (auto it = peer_connection_data().begin(); + it != peer_connection_data().end(); ++it) { DCHECK(it->is_dict()); - int this_rid = it->FindIntKey("rid").value_or(0); - int this_lid = it->FindIntKey("lid").value_or(0); + int this_rid = it->GetDict().FindInt("rid").value_or(0); + int this_lid = it->GetDict().FindInt("lid").value_or(0); if (this_rid == frame_id.child_id && this_lid == lid) return it; } - return peer_conn_view.end(); + return peer_connection_data().end(); } } // namespace content
diff --git a/content/browser/webrtc/webrtc_internals.h b/content/browser/webrtc/webrtc_internals.h index 19baf56..cd93868 100644 --- a/content/browser/webrtc/webrtc_internals.h +++ b/content/browser/webrtc/webrtc_internals.h
@@ -147,6 +147,7 @@ static WebRTCInternals* g_webrtc_internals; void SendUpdate(const std::string& event_name, base::Value event_data); + void SendUpdate(const std::string& event_name, base::Value::Dict event_data); // RenderProcessHostObserver implementation. void RenderProcessExited(RenderProcessHost* host, @@ -177,6 +178,11 @@ // saving. void UpdateWakeLock(); + // Convenient method to access `peer_connection_data_` as a Value::List. + base::Value::List& peer_connection_data() { + return peer_connection_data_.GetList(); + } + device::mojom::WakeLock* GetWakeLock(); // Called on a timer to deliver updates to javascript. @@ -187,16 +193,17 @@ // Returns an iterator for peer_connection_data_.GetList (an end() iterator // if not found). - base::CheckedContiguousIterator<base::Value> FindRecord( - GlobalRenderFrameHostId frame_id, - int lid); + base::Value::List::iterator FindRecord(GlobalRenderFrameHostId frame_id, + int lid); base::ObserverList<WebRTCInternalsUIObserver>::Unchecked observers_; base::ObserverList<WebRtcInternalsConnectionsObserver> connections_observers_; // |peer_connection_data_| is a list containing all the PeerConnection - // updates. + // updates. Stored as a Value rather than as a List::Value so it can be passed + // as a Value without having to copy it. + // // Each item of the list represents the data for one PeerConnection, which // contains these fields: // "rid" -- the renderer id. @@ -206,11 +213,11 @@ // "rtcConfiguration" -- serialized rtcConfiguration object. // "constraints" -- serialized legacy peerconnection constraints. // used to initialize the PeerConnection respectively. - // "log" -- a ListValue contains all the updates for the PeerConnection. Each + // "log" -- a List contains all the updates for the PeerConnection. Each // list item is a DictionaryValue containing "time", which is the number of // milliseconds since epoch as a string, and "type" and "value", both of which // are strings representing the event. - base::ListValue peer_connection_data_; + base::Value peer_connection_data_; // A list of getUserMedia requests or updates. // Each item is a DictionaryValue that contains some of these fields @@ -224,7 +231,7 @@ // "stream_id" -- the resulting stream id. // "audio_track_info" -- the serialized audio track (track id and label). // "video_track_info" -- the serialized video track (track id and label). - base::ListValue get_user_media_requests_; + base::Value::List get_user_media_requests_; // For managing select file dialog. scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
diff --git a/content/common/frame.mojom b/content/common/frame.mojom index bb431cc..9f82507 100644 --- a/content/common/frame.mojom +++ b/content/common/frame.mojom
@@ -139,11 +139,6 @@ // Whether the window associated with this view was created by another window. bool window_was_opened_by_another_window; - // Whether lookup of frames in the created RenderView (e.g. lookup via - // window.open or via <a target=...>) should be renderer-wide (i.e. going - // beyond the usual opener-relationship-based BrowsingInstance boundaries). - bool renderer_wide_named_frame_lookup; - // Indicates whether the view is a regular top-level widget or some other // nested "main frame" widget type. ViewWidgetType type;
diff --git a/content/public/browser/render_frame_host.h b/content/public/browser/render_frame_host.h index 5b56101..c4123678 100644 --- a/content/public/browser/render_frame_host.h +++ b/content/public/browser/render_frame_host.h
@@ -963,14 +963,14 @@ // Returns true if this frame has fired DOMContentLoaded. virtual bool IsDOMContentLoaded() = 0; - // Update whether the frame is considered an ad subframe by Ad Tagging. + // Update whether the frame is considered an ad frame by Ad Tagging. // // Note: This ad status is currently maintained and updated *outside* content. // This is used to ensure the render frame proxies are in sync (since they // aren't exposed in the public API). Eventually, we might be able to simplify // this somewhat (maybe //content would be responsible for maintaining the // state, with some content client method used to update it). - virtual void UpdateIsAdSubframe(bool is_ad_subframe) = 0; + virtual void UpdateIsAdFrame(bool is_ad_frame) = 0; // Tells the host that this is part of setting up a WebXR DOM Overlay. This // starts a short timer that permits entering fullscreen mode, similar to a
diff --git a/content/public/common/cdm_info.h b/content/public/common/cdm_info.h index 40eb536..a1088ecb 100644 --- a/content/public/common/cdm_info.h +++ b/content/public/common/cdm_info.h
@@ -9,7 +9,6 @@ #include <vector> #include "base/files/file_path.h" -#include "base/token.h" #include "base/version.h" #include "build/build_config.h" #include "content/common/content_export.h"
diff --git a/content/public/test/fake_remote_frame.cc b/content/public/test/fake_remote_frame.cc index 770511e..bd6d381b 100644 --- a/content/public/test/fake_remote_frame.cc +++ b/content/public/test/fake_remote_frame.cc
@@ -32,7 +32,7 @@ const url::Origin& origin, bool is_potentially_trustworthy_unique_origin) {} -void FakeRemoteFrame::SetReplicatedIsAdSubframe(bool is_ad_subframe) {} +void FakeRemoteFrame::SetReplicatedIsAdFrame(bool is_ad_frame) {} void FakeRemoteFrame::SetReplicatedName(const std::string& name, const std::string& unique_name) {}
diff --git a/content/public/test/fake_remote_frame.h b/content/public/test/fake_remote_frame.h index ea71d1e..94c2c4a 100644 --- a/content/public/test/fake_remote_frame.h +++ b/content/public/test/fake_remote_frame.h
@@ -47,7 +47,7 @@ void SetReplicatedOrigin( const url::Origin& origin, bool is_potentially_trustworthy_unique_origin) override; - void SetReplicatedIsAdSubframe(bool is_ad_subframe) override; + void SetReplicatedIsAdFrame(bool is_ad_frame) override; void SetReplicatedName(const std::string& name, const std::string& unique_name) override; void DispatchLoadEventForFrameOwner() override;
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 49bc1c40..6c5caf05 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -1392,17 +1392,15 @@ // static RenderFrameImpl* RenderFrameImpl::Create( AgentSchedulingGroup& agent_scheduling_group, - RenderViewImpl* render_view, int32_t routing_id, mojo::PendingAssociatedReceiver<mojom::Frame> frame_receiver, mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker> browser_interface_broker, const base::UnguessableToken& devtools_frame_token) { DCHECK(routing_id != MSG_ROUTING_NONE); - CreateParams params(agent_scheduling_group, render_view, routing_id, - std::move(frame_receiver), - std::move(browser_interface_broker), - devtools_frame_token); + CreateParams params( + agent_scheduling_group, routing_id, std::move(frame_receiver), + std::move(browser_interface_broker), devtools_frame_token); if (g_create_render_frame_impl) return g_create_render_frame_impl(std::move(params)); @@ -1427,7 +1425,7 @@ // static RenderFrameImpl* RenderFrameImpl::CreateMainFrame( AgentSchedulingGroup& agent_scheduling_group, - RenderViewImpl* render_view, + blink::WebView* web_view, blink::WebFrame* opener, bool is_for_nested_main_frame, bool is_for_scalable_page, @@ -1438,15 +1436,14 @@ DCHECK_NE(MSG_ROUTING_NONE, params->widget_params->routing_id); RenderFrameImpl* render_frame = RenderFrameImpl::Create( - agent_scheduling_group, render_view, params->routing_id, - std::move(params->frame), std::move(params->interface_broker), - devtools_frame_token); + agent_scheduling_group, params->routing_id, std::move(params->frame), + std::move(params->interface_broker), devtools_frame_token); render_frame->InitializeBlameContext(nullptr); WebLocalFrame* web_frame = WebLocalFrame::CreateMainFrame( - render_view->GetWebView(), render_frame, - render_frame->blink_interface_registry_.get(), params->token, - ToWebPolicyContainer(std::move(params->policy_container)), opener, + web_view, render_frame, render_frame->blink_interface_registry_.get(), + params->token, ToWebPolicyContainer(std::move(params->policy_container)), + opener, // This conversion is a little sad, as this often comes from a // WebString... WebString::FromUTF8(replication_state->name), @@ -1535,7 +1532,7 @@ // TODO(danakj): Split this method into two pieces. The first block makes a // WebLocalFrame and collects the RenderView and RenderFrame for it. The // second block uses that to make a RenderWidget, if needed. - RenderViewImpl* render_view = nullptr; + blink::WebView* web_view = nullptr; RenderFrameImpl* render_frame = nullptr; blink::WebLocalFrame* web_frame = nullptr; if (!previous_frame_token) { @@ -1561,12 +1558,11 @@ blink::WebFrame::FromFrameToken(previous_sibling_frame_token.value()); } - render_view = RenderViewImpl::FromWebView(parent_web_frame->View()); + web_view = parent_web_frame->View(); // Create the RenderFrame and WebLocalFrame, linking the two. render_frame = RenderFrameImpl::Create( - agent_scheduling_group, render_view, routing_id, - std::move(frame_receiver), std::move(browser_interface_broker), - devtools_frame_token); + agent_scheduling_group, routing_id, std::move(frame_receiver), + std::move(browser_interface_broker), devtools_frame_token); // Since `parent_web_frame` is remote we do not provide a parent_frame // for initializing the BlameContext. render_frame->InitializeBlameContext(/*parent_frame=*/nullptr); @@ -1596,14 +1592,13 @@ if (!previous_web_frame) return; - render_view = RenderViewImpl::FromWebView(previous_web_frame->View()); + web_view = previous_web_frame->View(); // This path is creating a local frame. It may or may not be a local root, // depending if the frame's parent is local or remote. It may also be the // main frame, as in the case where a navigation to the current process' render_frame = RenderFrameImpl::Create( - agent_scheduling_group, render_view, routing_id, - std::move(frame_receiver), std::move(browser_interface_broker), - devtools_frame_token); + agent_scheduling_group, routing_id, std::move(frame_receiver), + std::move(browser_interface_broker), devtools_frame_token); render_frame->InitializeBlameContext(nullptr); web_frame = blink::WebLocalFrame::CreateProvisional( render_frame, render_frame->blink_interface_registry_.get(), token, @@ -1618,7 +1613,7 @@ GetUniqueNameOfWebFrame(previous_web_frame)); } - CHECK(render_view); + CHECK(web_view); CHECK(render_frame); CHECK(web_frame); @@ -1644,8 +1639,7 @@ // WebViewImpl::SetInsidePortal - can we remove that path? Even better, // could the WebFrameWidget delegate to WebView/Page for this information? // https://crbug.com/1316535. - bool is_for_nested_main_frame = - render_view->GetWebView()->IsFencedFrameRoot(); + bool is_for_nested_main_frame = web_view->IsFencedFrameRoot(); // Non-owning pointer that is self-referencing and destroyed by calling // Close(). The RenderViewImpl has a RenderWidget already, but not a @@ -1762,14 +1756,12 @@ RenderFrameImpl::CreateParams::CreateParams( AgentSchedulingGroup& agent_scheduling_group, - RenderViewImpl* render_view, int32_t routing_id, mojo::PendingAssociatedReceiver<mojom::Frame> frame_receiver, mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker> browser_interface_broker, const base::UnguessableToken& devtools_frame_token) : agent_scheduling_group(&agent_scheduling_group), - render_view(render_view), routing_id(routing_id), frame_receiver(std::move(frame_receiver)), browser_interface_broker(std::move(browser_interface_broker)), @@ -1786,7 +1778,6 @@ unique_name_frame_adapter_(this), unique_name_helper_(&unique_name_frame_adapter_), in_frame_tree_(false), - render_view_(params.render_view), routing_id_(params.routing_id), selection_text_offset_(0), selection_range_(gfx::Range::InvalidRange()), @@ -3437,7 +3428,7 @@ // Create the RenderFrame and WebLocalFrame, linking the two. RenderFrameImpl* child_render_frame = RenderFrameImpl::Create( - agent_scheduling_group_, render_view_, child_routing_id, + agent_scheduling_group_, child_routing_id, std::move(pending_frame_receiver), std::move(browser_interface_broker), devtools_frame_token); child_render_frame->loader_factories_ = CloneLoaderFactories(); @@ -3559,7 +3550,7 @@ } blink::WebFrame* RenderFrameImpl::FindFrame(const blink::WebString& name) { - if (render_view_->renderer_wide_named_frame_lookup()) { + if (GetBlinkPreferences().renderer_wide_named_frame_lookup) { for (const auto& it : g_routing_id_frame_map.Get()) { WebLocalFrame* frame = it.second->GetWebFrame(); if (frame->AssignedName() == name) @@ -4078,7 +4069,7 @@ blink::WebRemoteFrame* remote_frame = blink::WebRemoteFrame::Create( frame_->GetTreeScopeType(), proxy_frame_token); - RenderViewImpl* render_view = render_view_; + blink::WebView* web_view = GetWebView(); bool is_main_frame = is_main_frame_; // The swap call deletes this RenderFrame via FrameDetached. Do not access @@ -4105,7 +4096,7 @@ // The RenderFrameProxy being swapped in here has now been attached to the // Page as its main frame and properly initialized by the WebFrame::Swap() // call, so we can call WebView's DidAttachRemoteMainFrame(). - render_view->GetWebView()->DidAttachRemoteMainFrame( + web_view->DidAttachRemoteMainFrame( std::move(remote_main_frame_interfaces->main_frame_host), std::move(remote_main_frame_interfaces->main_frame)); } @@ -4883,7 +4874,7 @@ DCHECK(!(same_document_params && interface_params)); UpdateStateForCommit(commit_type, transition); - if (render_view_->renderer_wide_named_frame_lookup()) + if (GetBlinkPreferences().renderer_wide_named_frame_lookup) GetWebFrame()->SetAllowsCrossBrowsingInstanceFrameLookup(); // This invocation must precede any calls to allowScripts(), allowImages(), @@ -5500,7 +5491,7 @@ bool has_download_sandbox_flag = info->initiator_frame_has_download_sandbox_flag || current_frame_has_download_sandbox_flag; - bool from_ad = info->initiator_frame_is_ad || frame_->IsAdSubframe(); + bool from_ad = info->initiator_frame_is_ad || frame_->IsAdFrame(); params->download_policy.ApplyDownloadFramePolicy( info->is_opener_navigation, info->url_request.HasUserGesture(), @@ -5809,7 +5800,7 @@ bool has_download_sandbox_flag = info->initiator_frame_has_download_sandbox_flag || current_frame_has_download_sandbox_flag; - bool from_ad = info->initiator_frame_is_ad || frame_->IsAdSubframe(); + bool from_ad = info->initiator_frame_is_ad || frame_->IsAdFrame(); mojo::PendingRemote<blink::mojom::PolicyContainerHostKeepAliveHandle> initiator_policy_container_keep_alive_handle =
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index 81d84828..056e256 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h
@@ -162,7 +162,6 @@ class RendererPpapiHost; class RenderAccessibilityManager; class RenderFrameObserver; -class RenderViewImpl; class CONTENT_EXPORT RenderFrameImpl : public RenderFrame, @@ -174,10 +173,10 @@ public blink::WebLocalFrameClient, service_manager::mojom::InterfaceProvider { public: - // Creates a new RenderFrame as the main frame of |render_view|. + // Creates a new RenderFrame as the main frame of `web_view`. static RenderFrameImpl* CreateMainFrame( AgentSchedulingGroup& agent_scheduling_group, - RenderViewImpl* render_view, + blink::WebView* web_view, blink::WebFrame* opener, bool is_for_nested_main_frame, bool is_for_scalable_page, @@ -235,7 +234,6 @@ // Constructor parameters are bundled into a struct. struct CONTENT_EXPORT CreateParams { CreateParams(AgentSchedulingGroup& agent_scheduling_group, - RenderViewImpl* render_view, int32_t routing_id, mojo::PendingAssociatedReceiver<mojom::Frame> frame_receiver, mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker> @@ -247,7 +245,6 @@ CreateParams& operator=(CreateParams&&); AgentSchedulingGroup* agent_scheduling_group; - RenderViewImpl* render_view; int32_t routing_id; mojo::PendingAssociatedReceiver<mojom::Frame> frame_receiver; mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker> @@ -272,10 +269,6 @@ // Returns the unique name of the RenderFrame. const std::string& unique_name() const { return unique_name_helper_.value(); } - // TODO(jam): this is a temporary getter until all the code is transitioned - // to using RenderFrame instead of RenderView. - RenderViewImpl* render_view() { return render_view_; } - // Returns the blink::WebFrameWidget attached to the local root of this // frame. blink::WebFrameWidget* GetLocalRootWebFrameWidget(); @@ -815,13 +808,11 @@ class FrameURLLoaderFactory; - // Creates a new RenderFrame. |render_view| is the RenderView object that this - // frame belongs to, and |browser_interface_broker| is the RenderFrameHost's - // BrowserInterfaceBroker through which services are exposed to the - // RenderFrame. + // Creates a new RenderFrame. |browser_interface_broker| is the + // RenderFrameHost's BrowserInterfaceBroker through which services are exposed + // to the RenderFrame. static RenderFrameImpl* Create( AgentSchedulingGroup& agent_scheduling_group, - RenderViewImpl* render_view, int32_t routing_id, mojo::PendingAssociatedReceiver<mojom::Frame> frame_receiver, mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker> @@ -1177,7 +1168,6 @@ // Blink Web* layer to check for provisional frames. bool in_frame_tree_; - RenderViewImpl* render_view_; const int routing_id_; // Keeps track of which future subframes the browser process has history items
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index cf09f4a..204ec3e 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc
@@ -102,8 +102,6 @@ RenderViewImpl::RenderViewImpl(AgentSchedulingGroup& agent_scheduling_group, const mojom::CreateViewParams& params) : routing_id_(params.view_id), - renderer_wide_named_frame_lookup_( - params.renderer_wide_named_frame_lookup), agent_scheduling_group_(agent_scheduling_group) { // Please put all logic in RenderViewImpl::Initialize(). } @@ -142,7 +140,7 @@ if (local_main_frame) { RenderFrameImpl::CreateMainFrame( - agent_scheduling_group_, this, opener_frame, + agent_scheduling_group_, webview_, opener_frame, /*is_for_nested_main_frame=*/params->type != mojom::ViewWidgetType::kTopLevel, /*is_for_scalable_page=*/params->type != @@ -311,7 +309,7 @@ // `openee_can_access_opener_origin` only matters for opener navigations, // so its value here is irrelevant. /*openee_can_access_opener_origin=*/true, !creator->IsAllowedToDownload(), - creator->IsAdSubframe()); + creator->IsAdFrame()); // We preserve this information before sending the message since |params| is // moved on send. @@ -375,7 +373,7 @@ mojom::CreateViewParamsPtr view_params = mojom::CreateViewParams::New(); view_params->opener_frame_token = creator->GetFrameToken(); - DCHECK_EQ(routing_id_, creator_frame->render_view()->routing_id_); + DCHECK_EQ(GetWebView(), creator->View()); view_params->window_was_opened_by_another_window = true; view_params->renderer_preferences = webview_->GetRendererPreferences();
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index 2887102..da701a2 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h
@@ -120,10 +120,6 @@ // appropriate section, add it there. If not, there are some random functions // nearer to the top you can add it to. - bool renderer_wide_named_frame_lookup() { - return renderer_wide_named_frame_lookup_; - } - protected: RenderViewImpl(AgentSchedulingGroup& agent_scheduling_group, const mojom::CreateViewParams& params); @@ -165,13 +161,6 @@ // RenderViewHost in the parent browser process. const int32_t routing_id_; - // Whether lookup of frames in the created RenderViewImpl (e.g. lookup via - // window.open or via <a target=...>) should be renderer-wide (i.e. going - // beyond the usual opener-relationship-based BrowsingInstance boundaries). - const bool renderer_wide_named_frame_lookup_; - - // Settings ------------------------------------------------------------------ - // View ---------------------------------------------------------------------- // This class owns this member, and is responsible for calling
diff --git a/content/test/data/attribution_reporting/interop/aggregatable_budget.json b/content/test/data/attribution_reporting/interop/aggregatable_budget.json new file mode 100644 index 0000000..2ab61774 --- /dev/null +++ b/content/test/data/attribution_reporting/interop/aggregatable_budget.json
@@ -0,0 +1,214 @@ +{ + "description": "Max aggregatable budget per source", + "input": { + "sources": [ + { + "timestamp": "1643235573000", + "registration_request": { + "source_origin": "https://source.test", + "attribution_src_url": "https://reporter.test/register-source", + "source_type": "navigation" + }, + "responses": [{ + "url": "https://reporter.test/register-source", + "response": { + "Attribution-Reporting-Register-Source": { + "destination": "https://destination.test", + "source_event_id": "123", + "aggregation_keys": { + "a": "0x159", + "b": "0x5" + } + } + } + }] + }, + { + "timestamp": "1643235583000", + "registration_request": { + "source_origin": "https://source.test", + "attribution_src_url": "https://reporter.test/register-source", + "source_type": "navigation" + }, + "responses": [{ + "url": "https://reporter.test/register-source", + "response": { + "Attribution-Reporting-Register-Source": { + "destination": "https://destination.test", + "source_event_id": "123", + "aggregation_keys": { + "a": "0x159", + "b": "0x5" + } + } + } + }] + } + ], + "triggers": [ + { + "timestamp": "1643235574000", + "registration_request": { + "attribution_src_url": "https://reporter.test/register-trigger", + "destination_origin": "https://destination.test" + }, + "responses": [{ + "url": "https://reporter.test/register-trigger", + "response": { + "Attribution-Reporting-Register-Trigger": { + "aggregatable_trigger_data": [ + { + "source_keys": ["a"], + "key_piece": "0x400" + }, + { + "source_keys": ["b"], + "key_piece": "0xA80" + } + ], + "aggregatable_values": { + "a": 65530, + "b": 7 + } + } + } + }] + }, + { + "timestamp": "1643235575000", + "registration_request": { + "attribution_src_url": "https://reporter.test/register-trigger", + "destination_origin": "https://destination.test" + }, + "responses": [{ + "url": "https://reporter.test/register-trigger", + "response": { + "Attribution-Reporting-Register-Trigger": { + "aggregatable_trigger_data": [ + { + "source_keys": ["a"], + "key_piece": "0x400" + } + ], + "aggregatable_values": { + "a": 65535 + } + } + } + }] + }, + { + "timestamp": "1643235576000", + "registration_request": { + "attribution_src_url": "https://reporter.test/register-trigger", + "destination_origin": "https://destination.test" + }, + "responses": [{ + "url": "https://reporter.test/register-trigger", + "response": { + "Attribution-Reporting-Register-Trigger": { + "aggregatable_trigger_data": [ + { + "source_keys": ["b"], + "key_piece": "0xa80" + } + ], + "aggregatable_values": { + "a": 2 + } + } + } + }] + }, + { + "timestamp": "1643235577000", + "registration_request": { + "attribution_src_url": "https://reporter.test/register-trigger", + "destination_origin": "https://destination.test" + }, + "responses": [{ + "url": "https://reporter.test/register-trigger", + "response": { + "Attribution-Reporting-Register-Trigger": { + "aggregatable_trigger_data": [ + { + "source_keys": ["b"], + "key_piece": "0xa80" + } + ], + "aggregatable_values": { + "b": 1 + } + } + } + }] + }, + { + "timestamp": "1643235584000", + "registration_request": { + "attribution_src_url": "https://reporter.test/register-trigger", + "destination_origin": "https://destination.test" + }, + "responses": [{ + "url": "https://reporter.test/register-trigger", + "response": { + "Attribution-Reporting-Register-Trigger": { + "aggregatable_trigger_data": [ + { + "source_keys": ["b"], + "key_piece": "0xa80" + } + ], + "aggregatable_values": { + "b": 65536 + } + } + } + }] + } + ] + }, + "output": { + "aggregatable_results": [ + { + "payload": { + "attribution_destination": "https://destination.test", + "histograms": [ + { + "key": "0x559", + "value": 65535 + } + ] + }, + "report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution", + "report_time": "1643239175000" + }, + { + "payload": { + "attribution_destination": "https://destination.test", + "histograms": [ + { + "key": "0xa85", + "value": 1 + } + ] + }, + "report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution", + "report_time": "1643239177000" + }, + { + "payload": { + "attribution_destination": "https://destination.test", + "histograms": [ + { + "key": "0xa85", + "value": 65536 + } + ] + }, + "report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution", + "report_time": "1643239184000" + } + ] + } +}
diff --git a/content/test/data/attribution_reporting/interop/aggregatable_contributions_creation.json b/content/test/data/attribution_reporting/interop/aggregatable_contributions_creation.json new file mode 100644 index 0000000..04d20243 --- /dev/null +++ b/content/test/data/attribution_reporting/interop/aggregatable_contributions_creation.json
@@ -0,0 +1,233 @@ +{ + "description": "Aggregatable contributions creation", + "input": { + "sources": [ + { + "timestamp": "1643235573000", + "registration_request": { + "source_origin": "https://source.test", + "attribution_src_url": "https://reporter.test/register-source", + "source_type": "navigation" + }, + "responses": [{ + "url": "https://reporter.test/register-source", + "response": { + "Attribution-Reporting-Register-Source": { + "destination": "https://destination.test", + "source_event_id": "123", + "aggregation_keys": { + "a": "0x1", + "b": "0x2", + "c": "0x4" + }, + "filter_data": { + "product": ["123", "456"], + "geo": [] + } + } + } + }] + } + ], + "triggers": [ + { + "timestamp": "1643235574000", + "registration_request": { + "attribution_src_url": "https://reporter.test/register-trigger", + "destination_origin": "https://destination.test" + }, + "responses": [{ + "url": "https://reporter.test/register-trigger", + "response": { + "Attribution-Reporting-Register-Trigger": { + "aggregatable_trigger_data": [ + { + "source_keys": ["a", "b","c"], + "key_piece": "0x8", + "filters": { + "product": [], + "source_type": ["navigation"] + } + }, + { + "source_keys": ["a", "b", "c"], + "key_piece": "0x8", + "filters": { + "geo": [], + "source_type": ["event"] + } + }, + { + "source_keys": ["a", "b", "c'"], + "key_piece": "0x10", + "filters": { + "product": ["123"], + "geo": [], + "source_type": ["navigation"], + "campaign": ["example"] + } + } + ], + "aggregatable_values": { + "a": 123, + "b": 456 + } + } + } + }] + }, + { + "timestamp": "1643235575000", + "registration_request": { + "attribution_src_url": "https://reporter.test/register-trigger", + "destination_origin": "https://destination.test" + }, + "responses": [{ + "url": "https://reporter.test/register-trigger", + "response": { + "Attribution-Reporting-Register-Trigger": { + "aggregatable_trigger_data": [ + { + "source_keys": ["a"], + "key_piece": "0x8", + "not_filters": { + "geo": [], + "source_type": ["event"] + } + }, + { + "source_keys": ["a"], + "key_piece": "0x8", + "not_filters": { + "product": [], + "source_type": ["navigation"] + } + }, + { + "source_keys": ["a"], + "key_piece": "0x10", + "not_filters": { + "product": [], + "geo": ["US"], + "source_type": ["event"], + "campaign": [] + } + } + ], + "aggregatable_values": { + "a": 321, + "b": 654 + } + } + } + }] + }, + { + "timestamp": "1643235576000", + "registration_request": { + "attribution_src_url": "https://reporter.test/register-trigger", + "destination_origin": "https://destination.test" + }, + "responses": [{ + "url": "https://reporter.test/register-trigger", + "response": { + "Attribution-Reporting-Register-Trigger": { + "aggregatable_trigger_data": [ + { + "source_keys": ["b", "d"], + "key_piece": "0x8", + "filters": { + "source_type": ["navigation"] + }, + "not_filters": { + "product": ["123"] + } + }, + { + "source_keys": ["b", "d"], + "key_piece": "0x8", + "filters": { + "source_type": ["event"] + }, + "not_filters": { + "product": ["789"] + } + }, + { + "source_keys": ["b", "d"], + "key_piece": "0x20", + "filters": { + "source_type": ["navigation"] + }, + "not_filters": { + "product": ["789"] + } + } + ], + "aggregatable_values": { + "a": 456, + "b": 789, + "d": 123 + } + } + } + }] + } + ] + }, + "output": { + "aggregatable_results": [ + { + "payload": { + "attribution_destination": "https://destination.test", + "histograms": [ + { + "key": "0x11", + "value": 123 + }, + { + "key": "0x12", + "value": 456 + } + ] + }, + "report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution", + "report_time": "1643239174000" + }, + { + "payload": { + "attribution_destination": "https://destination.test", + "histograms": [ + { + "key": "0x11", + "value": 321 + }, + { + "key": "0x2", + "value": 654 + } + ] + }, + "report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution", + "report_time": "1643239175000" + }, + { + "payload": { + "attribution_destination": "https://destination.test", + "histograms": [ + { + "key": "0x1", + "value": 456 + }, + { + "key": "0x22", + "value": 789 + } + ] + }, + "report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution", + "report_time": "1643239176000" + } + ] + } +}
diff --git a/device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm b/device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm index 283b010..bfb9bfba 100644 --- a/device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm +++ b/device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm
@@ -202,8 +202,6 @@ } - (void)didModifyServices:(NSArray*)invalidatedServices { - DCHECK( - [_delegate respondsToSelector:@selector(peripheral:didModifyServices:)]); [_delegate peripheral:self.peripheral didModifyServices:invalidatedServices]; }
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h index 897e41dbe..23f9ba1 100644 --- a/extensions/browser/extension_function_histogram_value.h +++ b/extensions/browser/extension_function_histogram_value.h
@@ -1751,6 +1751,7 @@ ENTERPRISEREPORTINGPRIVATE_GETFILESYSTEMINFO = 1688, FILEMANAGERPRIVATE_GETDRIVEQUOTAMETADATA = 1689, DOWNLOADS_SETUIOPTIONS = 1690, + AUTOTESTPRIVATE_GETDESKCOUNT = 1691, // Last entry: Add new entries above, then run: // tools/metrics/histograms/update_extension_histograms.py ENUM_BOUNDARY
diff --git a/extensions/browser/permissions_manager.cc b/extensions/browser/permissions_manager.cc index 6dd493a3..2bbdfe4 100644 --- a/extensions/browser/permissions_manager.cc +++ b/extensions/browser/permissions_manager.cc
@@ -189,6 +189,23 @@ registry->RegisterDictionaryPref(kUserPermissions.name); } +void PermissionsManager::UpdateUserSiteSetting( + const url::Origin& origin, + PermissionsManager::UserSiteSetting site_setting) { + switch (site_setting) { + case UserSiteSetting::kGrantAllExtensions: + AddUserPermittedSite(origin); + break; + case UserSiteSetting::kBlockAllExtensions: + AddUserRestrictedSite(origin); + break; + case UserSiteSetting::kCustomizeByExtension: + RemoveUserPermittedSite(origin); + RemoveUserRestrictedSite(origin); + break; + } +} + void PermissionsManager::AddUserRestrictedSite(const url::Origin& origin) { if (base::Contains(user_permissions_.restricted_sites, origin)) return;
diff --git a/extensions/browser/permissions_manager.h b/extensions/browser/permissions_manager.h index fc548289..6dba24cb 100644 --- a/extensions/browser/permissions_manager.h +++ b/extensions/browser/permissions_manager.h
@@ -130,6 +130,11 @@ // Registers the user preference that stores user permissions. static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); + // Updates the user site settings for the given `origin` to be + // `site_settings`. + void UpdateUserSiteSetting(const url::Origin& origin, + PermissionsManager::UserSiteSetting site_setting); + // Adds `origin` to the list of sites the user has blocked all // extensions from running on. If `origin` is in permitted_sites, it will // remove it from such list.
diff --git a/extensions/browser/permissions_manager_unittest.cc b/extensions/browser/permissions_manager_unittest.cc index 20d8bcf3..03adfac 100644 --- a/extensions/browser/permissions_manager_unittest.cc +++ b/extensions/browser/permissions_manager_unittest.cc
@@ -231,7 +231,6 @@ TEST_F(PermissionsManagerUnittest, RestrictedAndPermittedSitesAreMutuallyExclusive) { const url::Origin url = url::Origin::Create(GURL("http://a.example.com")); - const std::string expected_url_pattern = "http://a.example.com/*"; std::set<url::Origin> empty_set; std::set<url::Origin> set_with_url; set_with_url.insert(url); @@ -273,6 +272,46 @@ } } +TEST_F(PermissionsManagerUnittest, UpdateUserSiteSetting) { + const url::Origin url = url::Origin::Create(GURL("http://a.example.com")); + std::set<url::Origin> empty_set; + std::set<url::Origin> set_with_url; + set_with_url.insert(url); + + { + manager_->UpdateUserSiteSetting( + url, PermissionsManager::UserSiteSetting::kGrantAllExtensions); + const PermissionsManager::UserPermissionsSettings& actual_permissions = + manager_->GetUserPermissionsSettings(); + EXPECT_EQ(actual_permissions.restricted_sites, empty_set); + EXPECT_EQ(actual_permissions.permitted_sites, set_with_url); + EXPECT_EQ(manager_->GetUserSiteSetting(url), + PermissionsManager::UserSiteSetting::kGrantAllExtensions); + } + + { + manager_->UpdateUserSiteSetting( + url, PermissionsManager::UserSiteSetting::kBlockAllExtensions); + const PermissionsManager::UserPermissionsSettings& actual_permissions = + manager_->GetUserPermissionsSettings(); + EXPECT_EQ(actual_permissions.restricted_sites, set_with_url); + EXPECT_EQ(actual_permissions.permitted_sites, empty_set); + EXPECT_EQ(manager_->GetUserSiteSetting(url), + PermissionsManager::UserSiteSetting::kBlockAllExtensions); + } + + { + manager_->UpdateUserSiteSetting( + url, PermissionsManager::UserSiteSetting::kCustomizeByExtension); + const PermissionsManager::UserPermissionsSettings& actual_permissions = + manager_->GetUserPermissionsSettings(); + EXPECT_EQ(actual_permissions.restricted_sites, empty_set); + EXPECT_EQ(actual_permissions.permitted_sites, empty_set); + EXPECT_EQ(manager_->GetUserSiteSetting(url), + PermissionsManager::UserSiteSetting::kCustomizeByExtension); + } +} + TEST_F(PermissionsManagerUnittest, GetSiteAccess_AllUrls) { auto extension = AddExtensionWithHostPermission("AllUrls Extension", "<all_urls>");
diff --git a/gin/test/v8_test.cc b/gin/test/v8_test.cc index d6445f6..8090808 100644 --- a/gin/test/v8_test.cc +++ b/gin/test/v8_test.cc
@@ -9,6 +9,7 @@ #include "gin/public/isolate_holder.h" #include "gin/v8_initializer.h" #include "v8/include/v8-context.h" +#include "v8/include/v8-initialization.h" using v8::Context; using v8::Local; @@ -22,6 +23,11 @@ V8Test::~V8Test() = default; void V8Test::SetUp() { + // Multiple gin unittests are by default run in the same process. Since some + // tests set non-default V8 flags, we thus cannot freeze flags after V8 + // initialization. + v8::V8::SetFlagsFromString("--no-freeze-flags-after-init"); + #ifdef V8_USE_EXTERNAL_STARTUP_DATA gin::V8Initializer::LoadV8Snapshot(); #endif
diff --git a/infra/config/generated/builders/ci/Dawn Linux x64 Builder/properties.json b/infra/config/generated/builders/ci/Dawn Linux x64 Builder/properties.json index 5a76ddf8..392860581 100644 --- a/infra/config/generated/builders/ci/Dawn Linux x64 Builder/properties.json +++ b/infra/config/generated/builders/ci/Dawn Linux x64 Builder/properties.json
@@ -35,36 +35,6 @@ { "builder_id": { "bucket": "ci", - "builder": "Dawn Linux x64 Release (Intel HD 630)", - "project": "chromium" - }, - "builder_spec": { - "build_gs_bucket": "chromium-dawn-archive", - "builder_group": "chromium.dawn", - "execution_mode": "TEST", - "legacy_chromium_config": { - "apply_configs": [ - "mb" - ], - "build_config": "Release", - "config": "chromium", - "target_bits": 64, - "target_platform": "linux" - }, - "legacy_gclient_config": { - "config": "chromium" - }, - "parent": { - "bucket": "ci", - "builder": "Dawn Linux x64 Builder", - "project": "chromium" - }, - "run_tests_serially": true - } - }, - { - "builder_id": { - "bucket": "ci", "builder": "Dawn Linux x64 Release (Intel UHD 630)", "project": "chromium" }, @@ -134,11 +104,6 @@ "builder_ids_in_scope_for_testing": [ { "bucket": "ci", - "builder": "Dawn Linux x64 Release (Intel HD 630)", - "project": "chromium" - }, - { - "bucket": "ci", "builder": "Dawn Linux x64 Release (Intel UHD 630)", "project": "chromium" },
diff --git a/infra/config/generated/builders/ci/Dawn Linux x64 DEPS Builder/properties.json b/infra/config/generated/builders/ci/Dawn Linux x64 DEPS Builder/properties.json index 3d94de38..13b7fbf 100644 --- a/infra/config/generated/builders/ci/Dawn Linux x64 DEPS Builder/properties.json +++ b/infra/config/generated/builders/ci/Dawn Linux x64 DEPS Builder/properties.json
@@ -34,7 +34,7 @@ { "builder_id": { "bucket": "ci", - "builder": "Dawn Linux x64 DEPS Release (Intel HD 630)", + "builder": "Dawn Linux x64 DEPS Release (Intel UHD 630)", "project": "chromium" }, "builder_spec": { @@ -103,7 +103,7 @@ "builder_ids_in_scope_for_testing": [ { "bucket": "ci", - "builder": "Dawn Linux x64 DEPS Release (Intel HD 630)", + "builder": "Dawn Linux x64 DEPS Release (Intel UHD 630)", "project": "chromium" }, {
diff --git "a/infra/config/generated/builders/ci/Dawn Linux x64 DEPS Release \050Intel HD 630\051/properties.json" "b/infra/config/generated/builders/ci/Dawn Linux x64 DEPS Release \050Intel UHD 630\051/properties.json" similarity index 94% rename from "infra/config/generated/builders/ci/Dawn Linux x64 DEPS Release \050Intel HD 630\051/properties.json" rename to "infra/config/generated/builders/ci/Dawn Linux x64 DEPS Release \050Intel UHD 630\051/properties.json" index feff955a..f63293a 100644 --- "a/infra/config/generated/builders/ci/Dawn Linux x64 DEPS Release \050Intel HD 630\051/properties.json" +++ "b/infra/config/generated/builders/ci/Dawn Linux x64 DEPS Release \050Intel UHD 630\051/properties.json"
@@ -34,7 +34,7 @@ { "builder_id": { "bucket": "ci", - "builder": "Dawn Linux x64 DEPS Release (Intel HD 630)", + "builder": "Dawn Linux x64 DEPS Release (Intel UHD 630)", "project": "chromium" }, "builder_spec": { @@ -66,7 +66,7 @@ "builder_ids": [ { "bucket": "ci", - "builder": "Dawn Linux x64 DEPS Release (Intel HD 630)", + "builder": "Dawn Linux x64 DEPS Release (Intel UHD 630)", "project": "chromium" } ],
diff --git "a/infra/config/generated/builders/ci/Dawn Linux x64 Release \050Intel HD 630\051/properties.json" "b/infra/config/generated/builders/ci/Dawn Linux x64 Release \050Intel HD 630\051/properties.json" deleted file mode 100644 index b3a9af01..0000000 --- "a/infra/config/generated/builders/ci/Dawn Linux x64 Release \050Intel HD 630\051/properties.json" +++ /dev/null
@@ -1,91 +0,0 @@ -{ - "$build/chromium_tests_builder_config": { - "builder_config": { - "builder_db": { - "entries": [ - { - "builder_id": { - "bucket": "ci", - "builder": "Dawn Linux x64 Builder", - "project": "chromium" - }, - "builder_spec": { - "build_gs_bucket": "chromium-dawn-archive", - "builder_group": "chromium.dawn", - "execution_mode": "COMPILE_AND_TEST", - "legacy_chromium_config": { - "apply_configs": [ - "mb" - ], - "build_config": "Release", - "config": "chromium", - "target_bits": 64, - "target_platform": "linux" - }, - "legacy_gclient_config": { - "apply_configs": [ - "dawn_top_of_tree", - "enable_reclient" - ], - "config": "chromium" - }, - "run_tests_serially": true - } - }, - { - "builder_id": { - "bucket": "ci", - "builder": "Dawn Linux x64 Release (Intel HD 630)", - "project": "chromium" - }, - "builder_spec": { - "build_gs_bucket": "chromium-dawn-archive", - "builder_group": "chromium.dawn", - "execution_mode": "TEST", - "legacy_chromium_config": { - "apply_configs": [ - "mb" - ], - "build_config": "Release", - "config": "chromium", - "target_bits": 64, - "target_platform": "linux" - }, - "legacy_gclient_config": { - "config": "chromium" - }, - "parent": { - "bucket": "ci", - "builder": "Dawn Linux x64 Builder", - "project": "chromium" - }, - "run_tests_serially": true - } - } - ] - }, - "builder_ids": [ - { - "bucket": "ci", - "builder": "Dawn Linux x64 Release (Intel HD 630)", - "project": "chromium" - } - ], - "mirroring_builder_group_and_names": [ - { - "builder": "linux-dawn-rel", - "group": "tryserver.chromium.dawn" - } - ] - } - }, - "$recipe_engine/resultdb/test_presentation": { - "column_keys": [], - "grouping_keys": [ - "status", - "v.test_suite" - ] - }, - "builder_group": "chromium.dawn", - "recipe": "chromium" -} \ No newline at end of file
diff --git "a/infra/config/generated/builders/ci/Dawn Linux x64 Release \050Intel UHD 630\051/properties.json" "b/infra/config/generated/builders/ci/Dawn Linux x64 Release \050Intel UHD 630\051/properties.json" index 991d416..d4807c82 100644 --- "a/infra/config/generated/builders/ci/Dawn Linux x64 Release \050Intel UHD 630\051/properties.json" +++ "b/infra/config/generated/builders/ci/Dawn Linux x64 Release \050Intel UHD 630\051/properties.json"
@@ -70,6 +70,12 @@ "builder": "Dawn Linux x64 Release (Intel UHD 630)", "project": "chromium" } + ], + "mirroring_builder_group_and_names": [ + { + "builder": "linux-dawn-rel", + "group": "tryserver.chromium.dawn" + } ] } },
diff --git a/infra/config/generated/builders/ci/GPU FYI Linux Builder/properties.json b/infra/config/generated/builders/ci/GPU FYI Linux Builder/properties.json index 7a8a1da..c66734f 100644 --- a/infra/config/generated/builders/ci/GPU FYI Linux Builder/properties.json +++ b/infra/config/generated/builders/ci/GPU FYI Linux Builder/properties.json
@@ -31,7 +31,7 @@ { "builder_id": { "bucket": "ci", - "builder": "Linux FYI Experimental Release (Intel HD 630)", + "builder": "Linux FYI Experimental Release (Intel UHD 630)", "project": "chromium" }, "builder_spec": { @@ -115,34 +115,6 @@ { "builder_id": { "bucket": "ci", - "builder": "Linux FYI Release (Intel HD 630)", - "project": "chromium" - }, - "builder_spec": { - "builder_group": "chromium.gpu.fyi", - "execution_mode": "TEST", - "legacy_chromium_config": { - "apply_configs": [ - "mb" - ], - "build_config": "Release", - "config": "chromium", - "target_bits": 64 - }, - "legacy_gclient_config": { - "config": "chromium" - }, - "parent": { - "bucket": "ci", - "builder": "GPU FYI Linux Builder", - "project": "chromium" - }, - "run_tests_serially": true - } - }, - { - "builder_id": { - "bucket": "ci", "builder": "Linux FYI Release (Intel UHD 630)", "project": "chromium" }, @@ -208,7 +180,7 @@ "builder_ids_in_scope_for_testing": [ { "bucket": "ci", - "builder": "Linux FYI Experimental Release (Intel HD 630)", + "builder": "Linux FYI Experimental Release (Intel UHD 630)", "project": "chromium" }, { @@ -223,11 +195,6 @@ }, { "bucket": "ci", - "builder": "Linux FYI Release (Intel HD 630)", - "project": "chromium" - }, - { - "bucket": "ci", "builder": "Linux FYI Release (Intel UHD 630)", "project": "chromium" },
diff --git "a/infra/config/generated/builders/ci/Linux FYI Experimental Release \050Intel HD 630\051/properties.json" "b/infra/config/generated/builders/ci/Linux FYI Experimental Release \050Intel UHD 630\051/properties.json" similarity index 96% rename from "infra/config/generated/builders/ci/Linux FYI Experimental Release \050Intel HD 630\051/properties.json" rename to "infra/config/generated/builders/ci/Linux FYI Experimental Release \050Intel UHD 630\051/properties.json" index ff91035e..42c0195 100644 --- "a/infra/config/generated/builders/ci/Linux FYI Experimental Release \050Intel HD 630\051/properties.json" +++ "b/infra/config/generated/builders/ci/Linux FYI Experimental Release \050Intel UHD 630\051/properties.json"
@@ -31,7 +31,7 @@ { "builder_id": { "bucket": "ci", - "builder": "Linux FYI Experimental Release (Intel HD 630)", + "builder": "Linux FYI Experimental Release (Intel UHD 630)", "project": "chromium" }, "builder_spec": { @@ -61,7 +61,7 @@ "builder_ids": [ { "bucket": "ci", - "builder": "Linux FYI Experimental Release (Intel HD 630)", + "builder": "Linux FYI Experimental Release (Intel UHD 630)", "project": "chromium" } ],
diff --git "a/infra/config/generated/builders/ci/Linux FYI Release \050Intel HD 630\051/properties.json" "b/infra/config/generated/builders/ci/Linux FYI Release \050Intel HD 630\051/properties.json" deleted file mode 100644 index 9f1f6c9..0000000 --- "a/infra/config/generated/builders/ci/Linux FYI Release \050Intel HD 630\051/properties.json" +++ /dev/null
@@ -1,89 +0,0 @@ -{ - "$build/chromium_tests_builder_config": { - "builder_config": { - "builder_db": { - "entries": [ - { - "builder_id": { - "bucket": "ci", - "builder": "GPU FYI Linux Builder", - "project": "chromium" - }, - "builder_spec": { - "builder_group": "chromium.gpu.fyi", - "execution_mode": "COMPILE_AND_TEST", - "legacy_chromium_config": { - "apply_configs": [ - "mb" - ], - "build_config": "Release", - "config": "chromium", - "target_bits": 64 - }, - "legacy_gclient_config": { - "apply_configs": [ - "enable_reclient" - ], - "config": "chromium" - } - } - }, - { - "builder_id": { - "bucket": "ci", - "builder": "Linux FYI Release (Intel HD 630)", - "project": "chromium" - }, - "builder_spec": { - "builder_group": "chromium.gpu.fyi", - "execution_mode": "TEST", - "legacy_chromium_config": { - "apply_configs": [ - "mb" - ], - "build_config": "Release", - "config": "chromium", - "target_bits": 64 - }, - "legacy_gclient_config": { - "config": "chromium" - }, - "parent": { - "bucket": "ci", - "builder": "GPU FYI Linux Builder", - "project": "chromium" - }, - "run_tests_serially": true - } - } - ] - }, - "builder_ids": [ - { - "bucket": "ci", - "builder": "Linux FYI Release (Intel HD 630)", - "project": "chromium" - } - ], - "mirroring_builder_group_and_names": [ - { - "builder": "gpu-fyi-try-linux-intel-rel", - "group": "tryserver.chromium.linux" - } - ] - } - }, - "$recipe_engine/resultdb/test_presentation": { - "column_keys": [], - "grouping_keys": [ - "status", - "v.test_suite" - ] - }, - "builder_group": "chromium.gpu.fyi", - "perf_dashboard_machine_group": "ChromiumGPUFYI", - "recipe": "chromium", - "sheriff_rotations": [ - "chromium.gpu" - ] -} \ No newline at end of file
diff --git "a/infra/config/generated/builders/ci/Linux FYI Release \050Intel UHD 630\051/properties.json" "b/infra/config/generated/builders/ci/Linux FYI Release \050Intel UHD 630\051/properties.json" index b2f0919..e26f3e03 100644 --- "a/infra/config/generated/builders/ci/Linux FYI Release \050Intel UHD 630\051/properties.json" +++ "b/infra/config/generated/builders/ci/Linux FYI Release \050Intel UHD 630\051/properties.json"
@@ -64,6 +64,12 @@ "builder": "Linux FYI Release (Intel UHD 630)", "project": "chromium" } + ], + "mirroring_builder_group_and_names": [ + { + "builder": "gpu-fyi-try-linux-intel-rel", + "group": "tryserver.chromium.linux" + } ] } },
diff --git a/infra/config/generated/builders/try/dawn-linux-x64-deps-rel/properties.json b/infra/config/generated/builders/try/dawn-linux-x64-deps-rel/properties.json index 7be04f6a..9ae6a28b 100644 --- a/infra/config/generated/builders/try/dawn-linux-x64-deps-rel/properties.json +++ b/infra/config/generated/builders/try/dawn-linux-x64-deps-rel/properties.json
@@ -34,7 +34,7 @@ { "builder_id": { "bucket": "ci", - "builder": "Dawn Linux x64 DEPS Release (Intel HD 630)", + "builder": "Dawn Linux x64 DEPS Release (Intel UHD 630)", "project": "chromium" }, "builder_spec": { @@ -103,7 +103,7 @@ "builder_ids_in_scope_for_testing": [ { "bucket": "ci", - "builder": "Dawn Linux x64 DEPS Release (Intel HD 630)", + "builder": "Dawn Linux x64 DEPS Release (Intel UHD 630)", "project": "chromium" }, {
diff --git a/infra/config/generated/builders/try/gpu-fyi-try-linux-intel-exp/properties.json b/infra/config/generated/builders/try/gpu-fyi-try-linux-intel-exp/properties.json index 9a48edcd..3a7604a5 100644 --- a/infra/config/generated/builders/try/gpu-fyi-try-linux-intel-exp/properties.json +++ b/infra/config/generated/builders/try/gpu-fyi-try-linux-intel-exp/properties.json
@@ -31,7 +31,7 @@ { "builder_id": { "bucket": "ci", - "builder": "Linux FYI Experimental Release (Intel HD 630)", + "builder": "Linux FYI Experimental Release (Intel UHD 630)", "project": "chromium" }, "builder_spec": { @@ -68,7 +68,7 @@ "builder_ids_in_scope_for_testing": [ { "bucket": "ci", - "builder": "Linux FYI Experimental Release (Intel HD 630)", + "builder": "Linux FYI Experimental Release (Intel UHD 630)", "project": "chromium" } ]
diff --git a/infra/config/generated/builders/try/gpu-fyi-try-linux-intel-rel/properties.json b/infra/config/generated/builders/try/gpu-fyi-try-linux-intel-rel/properties.json index fde876c..82fe35a4 100644 --- a/infra/config/generated/builders/try/gpu-fyi-try-linux-intel-rel/properties.json +++ b/infra/config/generated/builders/try/gpu-fyi-try-linux-intel-rel/properties.json
@@ -31,7 +31,7 @@ { "builder_id": { "bucket": "ci", - "builder": "Linux FYI Release (Intel HD 630)", + "builder": "Linux FYI Release (Intel UHD 630)", "project": "chromium" }, "builder_spec": { @@ -68,7 +68,7 @@ "builder_ids_in_scope_for_testing": [ { "bucket": "ci", - "builder": "Linux FYI Release (Intel HD 630)", + "builder": "Linux FYI Release (Intel UHD 630)", "project": "chromium" } ]
diff --git a/infra/config/generated/builders/try/linux-dawn-rel/properties.json b/infra/config/generated/builders/try/linux-dawn-rel/properties.json index 0c389e10..3cfb577 100644 --- a/infra/config/generated/builders/try/linux-dawn-rel/properties.json +++ b/infra/config/generated/builders/try/linux-dawn-rel/properties.json
@@ -35,7 +35,7 @@ { "builder_id": { "bucket": "ci", - "builder": "Dawn Linux x64 Release (Intel HD 630)", + "builder": "Dawn Linux x64 Release (Intel UHD 630)", "project": "chromium" }, "builder_spec": { @@ -104,7 +104,7 @@ "builder_ids_in_scope_for_testing": [ { "bucket": "ci", - "builder": "Dawn Linux x64 Release (Intel HD 630)", + "builder": "Dawn Linux x64 Release (Intel UHD 630)", "project": "chromium" }, {
diff --git a/infra/config/generated/luci/cr-buildbucket.cfg b/infra/config/generated/luci/cr-buildbucket.cfg index 968bb11..0e1ac6f5 100644 --- a/infra/config/generated/luci/cr-buildbucket.cfg +++ b/infra/config/generated/luci/cr-buildbucket.cfg
@@ -4560,7 +4560,7 @@ } } builders { - name: "Dawn Linux x64 DEPS Release (Intel HD 630)" + name: "Dawn Linux x64 DEPS Release (Intel UHD 630)" swarming_host: "chromium-swarm.appspot.com" dimensions: "builderless:1" dimensions: "cores:2" @@ -4586,7 +4586,7 @@ ' }' ' },' ' "$bootstrap/properties": {' - ' "properties_file": "infra/config/generated/builders/ci/Dawn Linux x64 DEPS Release (Intel HD 630)/properties.json",' + ' "properties_file": "infra/config/generated/builders/ci/Dawn Linux x64 DEPS Release (Intel UHD 630)/properties.json",' ' "top_level_project": {' ' "ref": "refs/heads/main",' ' "repo": {' @@ -4720,86 +4720,6 @@ } } builders { - name: "Dawn Linux x64 Release (Intel HD 630)" - swarming_host: "chromium-swarm.appspot.com" - dimensions: "builderless:1" - dimensions: "cores:2" - dimensions: "cpu:x86-64" - dimensions: "free_space:standard" - dimensions: "os:Ubuntu-18.04" - dimensions: "pool:luci.chromium.gpu.ci" - dimensions: "ssd:0" - exe { - cipd_package: "infra/chromium/bootstrapper/${platform}" - cipd_version: "latest" - cmd: "bootstrapper" - } - properties: - '{' - ' "$bootstrap/exe": {' - ' "exe": {' - ' "cipd_package": "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build",' - ' "cipd_version": "refs/heads/main",' - ' "cmd": [' - ' "luciexe"' - ' ]' - ' }' - ' },' - ' "$bootstrap/properties": {' - ' "properties_file": "infra/config/generated/builders/ci/Dawn Linux x64 Release (Intel HD 630)/properties.json",' - ' "top_level_project": {' - ' "ref": "refs/heads/main",' - ' "repo": {' - ' "host": "chromium.googlesource.com",' - ' "project": "chromium/src"' - ' }' - ' }' - ' },' - ' "builder_group": "chromium.dawn",' - ' "led_builder_is_bootstrapped": true,' - ' "recipe": "chromium"' - '}' - execution_timeout_secs: 10800 - build_numbers: YES - service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" - experiments { - key: "luci.recipes.use_python3" - value: 100 - } - resultdb { - enable: true - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "ci_test_results" - test_results {} - } - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "gpu_ci_test_results" - test_results { - predicate { - test_id_regexp: "ninja://chrome/test:telemetry_gpu_integration_test[^/]*/.+" - } - } - } - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "blink_web_tests_ci_test_results" - test_results { - predicate { - test_id_regexp: "ninja://[^/]*blink_web_tests/.+" - } - } - } - history_options { - use_invocation_timestamp: true - } - } - } - builders { name: "Dawn Linux x64 Release (Intel UHD 630)" swarming_host: "chromium-swarm.appspot.com" dimensions: "builderless:1" @@ -11868,7 +11788,7 @@ } } builders { - name: "Linux FYI Experimental Release (Intel HD 630)" + name: "Linux FYI Experimental Release (Intel UHD 630)" swarming_host: "chromium-swarm.appspot.com" dimensions: "builderless:1" dimensions: "cores:2" @@ -11894,7 +11814,7 @@ ' }' ' },' ' "$bootstrap/properties": {' - ' "properties_file": "infra/config/generated/builders/ci/Linux FYI Experimental Release (Intel HD 630)/properties.json",' + ' "properties_file": "infra/config/generated/builders/ci/Linux FYI Experimental Release (Intel UHD 630)/properties.json",' ' "top_level_project": {' ' "ref": "refs/heads/main",' ' "repo": {' @@ -12200,89 +12120,6 @@ } } builders { - name: "Linux FYI Release (Intel HD 630)" - swarming_host: "chromium-swarm.appspot.com" - dimensions: "builderless:1" - dimensions: "cores:2" - dimensions: "cpu:x86-64" - dimensions: "free_space:standard" - dimensions: "os:Ubuntu-18.04" - dimensions: "pool:luci.chromium.gpu.ci" - dimensions: "ssd:0" - exe { - cipd_package: "infra/chromium/bootstrapper/${platform}" - cipd_version: "latest" - cmd: "bootstrapper" - } - properties: - '{' - ' "$bootstrap/exe": {' - ' "exe": {' - ' "cipd_package": "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build",' - ' "cipd_version": "refs/heads/main",' - ' "cmd": [' - ' "luciexe"' - ' ]' - ' }' - ' },' - ' "$bootstrap/properties": {' - ' "properties_file": "infra/config/generated/builders/ci/Linux FYI Release (Intel HD 630)/properties.json",' - ' "top_level_project": {' - ' "ref": "refs/heads/main",' - ' "repo": {' - ' "host": "chromium.googlesource.com",' - ' "project": "chromium/src"' - ' }' - ' }' - ' },' - ' "builder_group": "chromium.gpu.fyi",' - ' "led_builder_is_bootstrapped": true,' - ' "recipe": "chromium",' - ' "sheriff_rotations": [' - ' "chromium.gpu"' - ' ]' - '}' - execution_timeout_secs: 21600 - build_numbers: YES - service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" - experiments { - key: "luci.recipes.use_python3" - value: 100 - } - resultdb { - enable: true - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "ci_test_results" - test_results {} - } - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "gpu_ci_test_results" - test_results { - predicate { - test_id_regexp: "ninja://chrome/test:telemetry_gpu_integration_test[^/]*/.+" - } - } - } - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "blink_web_tests_ci_test_results" - test_results { - predicate { - test_id_regexp: "ninja://[^/]*blink_web_tests/.+" - } - } - } - history_options { - use_invocation_timestamp: true - } - } - } - builders { name: "Linux FYI Release (Intel UHD 630)" swarming_host: "chromium-swarm.appspot.com" dimensions: "builderless:1" @@ -12325,7 +12162,7 @@ ' "chromium.gpu"' ' ]' '}' - execution_timeout_secs: 64800 + execution_timeout_secs: 21600 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" experiments { @@ -15868,8 +15705,9 @@ builders { name: "Mac deterministic (reclient shadow)" swarming_host: "chromium-swarm.appspot.com" - dimensions: "builder:Mac deterministic (reclient shadow)" + dimensions: "builderless:1" dimensions: "cpu:x86-64" + dimensions: "free_space:standard" dimensions: "os:Mac-12" dimensions: "pool:luci.chromium.ci" exe { @@ -39558,8 +39396,9 @@ builders { name: "mac-arm64-rel (reclient shadow)" swarming_host: "chromium-swarm.appspot.com" - dimensions: "builder:mac-arm64-rel (reclient shadow)" + dimensions: "builderless:1" dimensions: "cpu:x86-64" + dimensions: "free_space:standard" dimensions: "os:Mac-12" dimensions: "pool:luci.chromium.ci" exe {
diff --git a/infra/config/generated/luci/luci-milo.cfg b/infra/config/generated/luci/luci-milo.cfg index 142f822..9e456f8 100644 --- a/infra/config/generated/luci/luci-milo.cfg +++ b/infra/config/generated/luci/luci-milo.cfg
@@ -1303,7 +1303,7 @@ short_name: "x64" } builders { - name: "buildbucket/luci.chromium.ci/Dawn Linux x64 DEPS Release (Intel HD 630)" + name: "buildbucket/luci.chromium.ci/Dawn Linux x64 DEPS Release (Intel UHD 630)" category: "chromium.dawn|DEPS|Linux|Intel" short_name: "x64" } @@ -6050,11 +6050,6 @@ builders { name: "buildbucket/luci.chromium.ci/Dawn Linux x64 Release (Intel UHD 630)" category: "ToT|Linux|Intel" - short_name: "exp" - } - builders { - name: "buildbucket/luci.chromium.ci/Dawn Linux x64 Release (Intel HD 630)" - category: "ToT|Linux|Intel" short_name: "x64" } builders { @@ -6128,7 +6123,7 @@ short_name: "x64" } builders { - name: "buildbucket/luci.chromium.ci/Dawn Linux x64 DEPS Release (Intel HD 630)" + name: "buildbucket/luci.chromium.ci/Dawn Linux x64 DEPS Release (Intel UHD 630)" category: "DEPS|Linux|Intel" short_name: "x64" } @@ -9843,7 +9838,7 @@ name: "buildbucket/luci.chromium.ci/Dawn Mac x64 Experimental Release (Intel)" } builders { - name: "buildbucket/luci.chromium.ci/Linux FYI Experimental Release (Intel HD 630)" + name: "buildbucket/luci.chromium.ci/Linux FYI Experimental Release (Intel UHD 630)" } builders { name: "buildbucket/luci.chromium.ci/Linux FYI Experimental Release (NVIDIA)" @@ -10054,19 +10049,9 @@ short_name: "rel" } builders { - name: "buildbucket/luci.chromium.ci/Linux FYI Release (Intel HD 630)" - category: "Linux|Intel" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux FYI Experimental Release (Intel HD 630)" - category: "Linux|Intel" - short_name: "exp" - } - builders { name: "buildbucket/luci.chromium.ci/Linux FYI Release (Intel UHD 630)" category: "Linux|Intel" - short_name: "uhd" + short_name: "rel" } builders { name: "buildbucket/luci.chromium.ci/Linux FYI Release (NVIDIA)"
diff --git a/infra/config/generated/luci/luci-scheduler.cfg b/infra/config/generated/luci/luci-scheduler.cfg index 02cf342..28c80b88 100644 --- a/infra/config/generated/luci/luci-scheduler.cfg +++ b/infra/config/generated/luci/luci-scheduler.cfg
@@ -840,7 +840,7 @@ } } job { - id: "Dawn Linux x64 DEPS Release (Intel HD 630)" + id: "Dawn Linux x64 DEPS Release (Intel UHD 630)" realm: "ci" acls { role: TRIGGERER @@ -850,7 +850,7 @@ buildbucket { server: "cr-buildbucket.appspot.com" bucket: "ci" - builder: "Dawn Linux x64 DEPS Release (Intel HD 630)" + builder: "Dawn Linux x64 DEPS Release (Intel UHD 630)" } } job { @@ -868,20 +868,6 @@ } } job { - id: "Dawn Linux x64 Release (Intel HD 630)" - realm: "ci" - acls { - role: TRIGGERER - granted_to: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" - } - acl_sets: "ci" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "ci" - builder: "Dawn Linux x64 Release (Intel HD 630)" - } -} -job { id: "Dawn Linux x64 Release (Intel UHD 630)" realm: "ci" acls { @@ -1981,7 +1967,7 @@ } } job { - id: "Linux FYI Experimental Release (Intel HD 630)" + id: "Linux FYI Experimental Release (Intel UHD 630)" realm: "ci" acls { role: TRIGGERER @@ -1991,7 +1977,7 @@ buildbucket { server: "cr-buildbucket.appspot.com" bucket: "ci" - builder: "Linux FYI Experimental Release (Intel HD 630)" + builder: "Linux FYI Experimental Release (Intel UHD 630)" } } job { @@ -2033,20 +2019,6 @@ } } job { - id: "Linux FYI Release (Intel HD 630)" - realm: "ci" - acls { - role: TRIGGERER - granted_to: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" - } - acl_sets: "ci" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "ci" - builder: "Linux FYI Release (Intel HD 630)" - } -} -job { id: "Linux FYI Release (Intel UHD 630)" realm: "ci" acls {
diff --git a/infra/config/generated/luci/realms.cfg b/infra/config/generated/luci/realms.cfg index b376a1f1..17109b2 100644 --- a/infra/config/generated/luci/realms.cfg +++ b/infra/config/generated/luci/realms.cfg
@@ -187,9 +187,8 @@ values: "Android FYI Release (Pixel 2)" values: "Android FYI Release (Pixel 4)" values: "Android FYI Release (Pixel 6)" - values: "Dawn Linux x64 DEPS Release (Intel HD 630)" + values: "Dawn Linux x64 DEPS Release (Intel UHD 630)" values: "Dawn Linux x64 DEPS Release (NVIDIA)" - values: "Dawn Linux x64 Release (Intel HD 630)" values: "Dawn Linux x64 Release (Intel UHD 630)" values: "Dawn Linux x64 Release (NVIDIA)" values: "Dawn Mac x64 DEPS Release (AMD)" @@ -209,10 +208,9 @@ values: "Lacros FYI x64 Release (AMD)" values: "Lacros FYI x64 Release (Intel)" values: "Linux FYI Debug (NVIDIA)" - values: "Linux FYI Experimental Release (Intel HD 630)" + values: "Linux FYI Experimental Release (Intel UHD 630)" values: "Linux FYI Experimental Release (NVIDIA)" values: "Linux FYI Release (AMD RX 5500 XT)" - values: "Linux FYI Release (Intel HD 630)" values: "Linux FYI Release (Intel UHD 630)" values: "Linux FYI Release (NVIDIA)" values: "Mac FYI ASAN (Intel)"
diff --git a/infra/config/generated/sheriff-rotations/chromium.gpu.txt b/infra/config/generated/sheriff-rotations/chromium.gpu.txt index b4c774d..1d944470 100644 --- a/infra/config/generated/sheriff-rotations/chromium.gpu.txt +++ b/infra/config/generated/sheriff-rotations/chromium.gpu.txt
@@ -28,11 +28,10 @@ ci/Lacros FYI x64 Release (AMD) ci/Lacros FYI x64 Release (Intel) ci/Linux FYI Debug (NVIDIA) -ci/Linux FYI Experimental Release (Intel HD 630) +ci/Linux FYI Experimental Release (Intel UHD 630) ci/Linux FYI Experimental Release (NVIDIA) ci/Linux FYI GPU TSAN Release ci/Linux FYI Release (AMD RX 5500 XT) -ci/Linux FYI Release (Intel HD 630) ci/Linux FYI Release (Intel UHD 630) ci/Linux FYI Release (NVIDIA) ci/Linux Release (NVIDIA)
diff --git a/infra/config/subprojects/chromium/ci/chromium.dawn.star b/infra/config/subprojects/chromium/ci/chromium.dawn.star index 2688839..b24a986b 100644 --- a/infra/config/subprojects/chromium/ci/chromium.dawn.star +++ b/infra/config/subprojects/chromium/ci/chromium.dawn.star
@@ -96,7 +96,7 @@ ) ci.thin_tester( - name = "Dawn Linux x64 DEPS Release (Intel HD 630)", + name = "Dawn Linux x64 DEPS Release (Intel UHD 630)", branch_selector = branches.STANDARD_MILESTONE, builder_spec = builder_config.builder_spec( execution_mode = builder_config.execution_mode.TEST, @@ -152,32 +152,6 @@ ) ci.thin_tester( - name = "Dawn Linux x64 Release (Intel HD 630)", - builder_spec = builder_config.builder_spec( - execution_mode = builder_config.execution_mode.TEST, - gclient_config = builder_config.gclient_config( - config = "chromium", - ), - chromium_config = builder_config.chromium_config( - config = "chromium", - apply_configs = [ - "mb", - ], - build_config = builder_config.build_config.RELEASE, - target_bits = 64, - target_platform = builder_config.target_platform.LINUX, - ), - build_gs_bucket = "chromium-dawn-archive", - run_tests_serially = True, - ), - console_view_entry = consoles.console_view_entry( - category = "ToT|Linux|Intel", - short_name = "x64", - ), - triggered_by = ["Dawn Linux x64 Builder"], -) - -ci.thin_tester( name = "Dawn Linux x64 Release (Intel UHD 630)", builder_spec = builder_config.builder_spec( execution_mode = builder_config.execution_mode.TEST, @@ -198,7 +172,7 @@ ), console_view_entry = consoles.console_view_entry( category = "ToT|Linux|Intel", - short_name = "exp", + short_name = "x64", ), triggered_by = ["Dawn Linux x64 Builder"], )
diff --git a/infra/config/subprojects/chromium/ci/chromium.fyi.star b/infra/config/subprojects/chromium/ci/chromium.fyi.star index 5133aac7..fe06650 100644 --- a/infra/config/subprojects/chromium/ci/chromium.fyi.star +++ b/infra/config/subprojects/chromium/ci/chromium.fyi.star
@@ -1972,6 +1972,7 @@ cores = None, executable = "recipe:swarming/deterministic_build", execution_timeout = 6 * time.hour, + builderless = True, goma_backend = None, reclient_instance = rbe_instance.DEFAULT, reclient_jobs = 40,
diff --git a/infra/config/subprojects/chromium/ci/chromium.gpu.fyi.star b/infra/config/subprojects/chromium/ci/chromium.gpu.fyi.star index 895de85..baa167d 100644 --- a/infra/config/subprojects/chromium/ci/chromium.gpu.fyi.star +++ b/infra/config/subprojects/chromium/ci/chromium.gpu.fyi.star
@@ -336,7 +336,7 @@ ) ci.thin_tester( - name = "Linux FYI Experimental Release (Intel HD 630)", + name = "Linux FYI Experimental Release (Intel UHD 630)", builder_spec = builder_config.builder_spec( execution_mode = builder_config.execution_mode.TEST, gclient_config = builder_config.gclient_config( @@ -352,10 +352,11 @@ ), run_tests_serially = True, ), - console_view_entry = consoles.console_view_entry( - category = "Linux|Intel", - short_name = "exp", - ), + # Uncomment this entry when this experimental tester is actually in use. + # console_view_entry = consoles.console_view_entry( + # category = "Linux|Intel", + # short_name = "exp", + # ), list_view = "chromium.gpu.experimental", triggered_by = ["GPU FYI Linux Builder"], ) @@ -435,7 +436,7 @@ ) ci.thin_tester( - name = "Linux FYI Release (Intel HD 630)", + name = "Linux FYI Release (Intel UHD 630)", builder_spec = builder_config.builder_spec( execution_mode = builder_config.execution_mode.TEST, gclient_config = builder_config.gclient_config( @@ -459,33 +460,6 @@ ) ci.thin_tester( - name = "Linux FYI Release (Intel UHD 630)", - builder_spec = builder_config.builder_spec( - execution_mode = builder_config.execution_mode.TEST, - gclient_config = builder_config.gclient_config( - config = "chromium", - ), - chromium_config = builder_config.chromium_config( - config = "chromium", - apply_configs = [ - "mb", - ], - build_config = builder_config.build_config.RELEASE, - target_bits = 64, - ), - run_tests_serially = True, - ), - console_view_entry = consoles.console_view_entry( - category = "Linux|Intel", - short_name = "uhd", - ), - # TODO(https://crbug.com/986939): Remove this increased timeout once more - # devices are added. - execution_timeout = 18 * time.hour, - triggered_by = ["GPU FYI Linux Builder"], -) - -ci.thin_tester( name = "Mac FYI Debug (Intel)", console_view_entry = consoles.console_view_entry( category = "Mac|Intel",
diff --git a/infra/config/subprojects/chromium/ci/chromium.mac.star b/infra/config/subprojects/chromium/ci/chromium.mac.star index 4943025..7a4873a 100644 --- a/infra/config/subprojects/chromium/ci/chromium.mac.star +++ b/infra/config/subprojects/chromium/ci/chromium.mac.star
@@ -171,6 +171,8 @@ ), os = os.MAC_DEFAULT, sheriff_rotations = args.ignore_default(None), + builderless = True, + cores = None, goma_backend = None, reclient_instance = rbe_instance.DEFAULT, reclient_jobs = 40,
diff --git a/infra/config/subprojects/chromium/gpu.try.star b/infra/config/subprojects/chromium/gpu.try.star index c25d203..bfb999c 100644 --- a/infra/config/subprojects/chromium/gpu.try.star +++ b/infra/config/subprojects/chromium/gpu.try.star
@@ -158,7 +158,7 @@ name = "gpu-fyi-try-linux-intel-exp", mirrors = [ "ci/GPU FYI Linux Builder", - "ci/Linux FYI Experimental Release (Intel HD 630)", + "ci/Linux FYI Experimental Release (Intel UHD 630)", ], pool = "luci.chromium.gpu.linux.intel.try", ) @@ -167,7 +167,7 @@ name = "gpu-fyi-try-linux-intel-rel", mirrors = [ "ci/GPU FYI Linux Builder", - "ci/Linux FYI Release (Intel HD 630)", + "ci/Linux FYI Release (Intel UHD 630)", ], pool = "luci.chromium.gpu.linux.intel.try", )
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.dawn.star b/infra/config/subprojects/chromium/try/tryserver.chromium.dawn.star index 0a2fd211..b8e878b 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.dawn.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.dawn.star
@@ -29,7 +29,7 @@ branch_selector = branches.STANDARD_MILESTONE, mirrors = [ "ci/Dawn Linux x64 DEPS Builder", - "ci/Dawn Linux x64 DEPS Release (Intel HD 630)", + "ci/Dawn Linux x64 DEPS Release (Intel UHD 630)", "ci/Dawn Linux x64 DEPS Release (NVIDIA)", ], main_list_view = "try", @@ -147,7 +147,7 @@ name = "linux-dawn-rel", mirrors = [ "ci/Dawn Linux x64 Builder", - "ci/Dawn Linux x64 Release (Intel HD 630)", + "ci/Dawn Linux x64 Release (Intel UHD 630)", "ci/Dawn Linux x64 Release (NVIDIA)", ], test_presentation = resultdb.test_presentation(
diff --git a/ios/chrome/browser/ui/authentication/signed_in_accounts/BUILD.gn b/ios/chrome/browser/ui/authentication/signed_in_accounts/BUILD.gn index 0a2ebcf..fc9ba7be 100644 --- a/ios/chrome/browser/ui/authentication/signed_in_accounts/BUILD.gn +++ b/ios/chrome/browser/ui/authentication/signed_in_accounts/BUILD.gn
@@ -21,7 +21,6 @@ "//ios/chrome/browser/browser_state", "//ios/chrome/browser/signin", "//ios/chrome/browser/ui/authentication/cells", - "//ios/chrome/browser/ui/colors", "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/image_util", "//ios/chrome/browser/ui/table_view",
diff --git a/ios/chrome/browser/ui/authentication/signed_in_accounts/signed_in_accounts_view_controller.mm b/ios/chrome/browser/ui/authentication/signed_in_accounts/signed_in_accounts_view_controller.mm index c1acb4d..07630ae 100644 --- a/ios/chrome/browser/ui/authentication/signed_in_accounts/signed_in_accounts_view_controller.mm +++ b/ios/chrome/browser/ui/authentication/signed_in_accounts/signed_in_accounts_view_controller.mm
@@ -12,7 +12,6 @@ #import "ios/chrome/browser/signin/identity_manager_factory.h" #import "ios/chrome/browser/ui/authentication/signed_in_accounts/signed_in_accounts_presentation_controller.h" #import "ios/chrome/browser/ui/authentication/signed_in_accounts/signed_in_accounts_table_view_controller.h" -#import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" #import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/common/ui/colors/semantic_color_names.h" #import "ios/chrome/common/ui/util/button_util.h"
diff --git a/ios/chrome/browser/ui/colors/BUILD.gn b/ios/chrome/browser/ui/colors/BUILD.gn deleted file mode 100644 index 42e057fbe..0000000 --- a/ios/chrome/browser/ui/colors/BUILD.gn +++ /dev/null
@@ -1,13 +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. - -source_set("colors") { - configs += [ "//build/config/compiler:enable_arc" ] - sources = [ - "MDCPalette+CrAdditions.h", - "MDCPalette+CrAdditions.mm", - ] - deps = [ "//ios/web" ] - public_deps = [ "//ios/third_party/material_components_ios" ] -}
diff --git a/ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h b/ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h deleted file mode 100644 index 6634d182..0000000 --- a/ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h +++ /dev/null
@@ -1,36 +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 IOS_CHROME_BROWSER_UI_COLORS_MDCPALETTE_CRADDITIONS_H_ -#define IOS_CHROME_BROWSER_UI_COLORS_MDCPALETTE_CRADDITIONS_H_ - -#import <MaterialComponents/MaterialPalettes.h> - -// Access to overridable palettes. -@interface MDCPalette (CrAdditions) - -// Red palette. -+ (MDCPalette*)cr_redPalette; - -// Blue palette. -+ (MDCPalette*)cr_bluePalette; - -// Green palette. -+ (MDCPalette*)cr_greenPalette; - -// Yellow palette. -+ (MDCPalette*)cr_yellowPalette; - -// Grey palette. -+ (MDCPalette*)cr_greyPalette; - -+ (void)cr_setBluePalette:(MDCPalette*)palette; -+ (void)cr_setRedPalette:(MDCPalette*)palette; -+ (void)cr_setGreenPalette:(MDCPalette*)palette; -+ (void)cr_setYellowPalette:(MDCPalette*)palette; -+ (void)cr_setGreyPalette:(MDCPalette*)palette; - -@end - -#endif // IOS_CHROME_BROWSER_UI_COLORS_MDCPALETTE_CRADDITIONS_H_
diff --git a/ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.mm b/ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.mm deleted file mode 100644 index 93340d44..0000000 --- a/ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.mm +++ /dev/null
@@ -1,93 +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. - -#import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" - -#include "ios/web/public/thread/web_thread.h" - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -@implementation MDCPalette (CrAdditions) - -namespace { -static MDCPalette* g_bluePalette = nil; -static MDCPalette* g_redPalette = nil; -static MDCPalette* g_greenPalette = nil; -static MDCPalette* g_yellowPalette = nil; -static MDCPalette* g_greyPalette = nil; -} - -+ (MDCPalette*)cr_bluePalette { - DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) || - web::WebThread::CurrentlyOn(web::WebThread::UI)); - if (!g_bluePalette) - return [MDCPalette bluePalette]; - return g_bluePalette; -} - -+ (MDCPalette*)cr_redPalette { - DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) || - web::WebThread::CurrentlyOn(web::WebThread::UI)); - if (!g_redPalette) - return [MDCPalette redPalette]; - return g_redPalette; -} - -+ (MDCPalette*)cr_greenPalette { - DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) || - web::WebThread::CurrentlyOn(web::WebThread::UI)); - if (!g_greenPalette) - return [MDCPalette greenPalette]; - return g_greenPalette; -} - -+ (MDCPalette*)cr_yellowPalette { - DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) || - web::WebThread::CurrentlyOn(web::WebThread::UI)); - if (!g_yellowPalette) - return [MDCPalette yellowPalette]; - return g_yellowPalette; -} - -+ (MDCPalette*)cr_greyPalette { - DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) || - web::WebThread::CurrentlyOn(web::WebThread::UI)); - if (!g_greyPalette) - return [MDCPalette greyPalette]; - return g_greyPalette; -} - -+ (void)cr_setBluePalette:(MDCPalette*)palette { - DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) || - web::WebThread::CurrentlyOn(web::WebThread::UI)); - g_bluePalette = palette; -} - -+ (void)cr_setRedPalette:(MDCPalette*)palette { - DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) || - web::WebThread::CurrentlyOn(web::WebThread::UI)); - g_redPalette = palette; -} - -+ (void)cr_setGreenPalette:(MDCPalette*)palette { - DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) || - web::WebThread::CurrentlyOn(web::WebThread::UI)); - g_greenPalette = palette; -} - -+ (void)cr_setYellowPalette:(MDCPalette*)palette { - DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) || - web::WebThread::CurrentlyOn(web::WebThread::UI)); - g_yellowPalette = palette; -} - -+ (void)cr_setGreyPalette:(MDCPalette*)palette { - DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) || - web::WebThread::CurrentlyOn(web::WebThread::UI)); - g_greyPalette = palette; -} - -@end
diff --git a/ios/public/provider/chrome/browser/follow/follow_provider.h b/ios/public/provider/chrome/browser/follow/follow_provider.h index 87c0c1c00c..370b92b3 100644 --- a/ios/public/provider/chrome/browser/follow/follow_provider.h +++ b/ios/public/provider/chrome/browser/follow/follow_provider.h
@@ -27,10 +27,6 @@ // followed. virtual bool GetFollowStatus(FollowWebPageURLs* follow_web_page_urls); - // Returns true if the web channel with |follow_web_page_urls| has been - // recommended. - virtual bool GetRecommendedStatus(FollowWebPageURLs* follow_web_page_urls); - // Returns the URL identifier if the web channel with |follow_web_page_urls| // has been recommended. virtual NSURL* GetRecommendedSiteURL(FollowWebPageURLs* follow_web_page_urls);
diff --git a/ios/public/provider/chrome/browser/follow/follow_provider.mm b/ios/public/provider/chrome/browser/follow/follow_provider.mm index 834d848..91b2eee 100644 --- a/ios/public/provider/chrome/browser/follow/follow_provider.mm +++ b/ios/public/provider/chrome/browser/follow/follow_provider.mm
@@ -12,11 +12,6 @@ return false; } -bool FollowProvider::GetRecommendedStatus( - FollowWebPageURLs* follow_web_page_urls) { - return false; -} - NSURL* FollowProvider::GetRecommendedSiteURL( FollowWebPageURLs* follow_web_page_urls) { return nil;
diff --git a/media/capture/video/mac/video_capture_device_avfoundation_mac.mm b/media/capture/video/mac/video_capture_device_avfoundation_mac.mm index 54dfe1d3..428caf0d 100644 --- a/media/capture/video/mac/video_capture_device_avfoundation_mac.mm +++ b/media/capture/video/mac/video_capture_device_avfoundation_mac.mm
@@ -335,20 +335,14 @@ AVCaptureConnection* captureConnection = [_captureVideoDataOutput connectionWithMediaType:AVMediaTypeVideo]; - // Check selector existence, related to bugs http://crbug.com/327532 and - // http://crbug.com/328096. - // CMTimeMake accepts integer argumenst but |frameRate| is float, round it. - if ([captureConnection - respondsToSelector:@selector(isVideoMinFrameDurationSupported)] && - [captureConnection isVideoMinFrameDurationSupported]) { + // CMTimeMake accepts integer arguments but |frameRate| is float, so round it. + if ([captureConnection isVideoMinFrameDurationSupported]) { [captureConnection setVideoMinFrameDuration:CMTimeMake(media::kFrameRatePrecision, (int)(frameRate * media::kFrameRatePrecision))]; } - if ([captureConnection - respondsToSelector:@selector(isVideoMaxFrameDurationSupported)] && - [captureConnection isVideoMaxFrameDurationSupported]) { + if ([captureConnection isVideoMaxFrameDurationSupported]) { [captureConnection setVideoMaxFrameDuration:CMTimeMake(media::kFrameRatePrecision, (int)(frameRate *
diff --git a/media/cdm/cdm_paths.h b/media/cdm/cdm_paths.h index f704921..d406d6a2 100644 --- a/media/cdm/cdm_paths.h +++ b/media/cdm/cdm_paths.h
@@ -8,7 +8,6 @@ #include <string> #include "base/files/file_path.h" -#include "base/token.h" #include "base/unguessable_token.h" #include "build/build_config.h" #include "media/cdm/cdm_type.h"
diff --git a/media/device_monitors/device_monitor_mac.mm b/media/device_monitors/device_monitor_mac.mm index 4610ff9..e36a0c6 100644 --- a/media/device_monitors/device_monitor_mac.mm +++ b/media/device_monitors/device_monitor_mac.mm
@@ -253,8 +253,7 @@ base::scoped_nsobject<AVCaptureDevice> device_ptr([device retain]); [suspend_observer_ startObserving:device_ptr]; - BOOL suspended = [device respondsToSelector:@selector(isSuspended)] && - [device isSuspended]; + BOOL suspended = [device isSuspended]; DeviceInfo::DeviceType device_type = DeviceInfo::kUnknown; if ([device hasMediaType:AVMediaTypeVideo]) { if (suspended)
diff --git a/net/cert/pki/cert_errors.cc b/net/cert/pki/cert_errors.cc index 6038ff8..833fb1d3 100644 --- a/net/cert/pki/cert_errors.cc +++ b/net/cert/pki/cert_errors.cc
@@ -4,13 +4,12 @@ #include "net/cert/pki/cert_errors.h" -#include "base/strings/strcat.h" -#include "base/strings/string_split.h" -#include "base/strings/stringprintf.h" #include "net/cert/pki/cert_error_params.h" #include "net/cert/pki/parse_name.h" #include "net/cert/pki/parsed_certificate.h" +#include <sstream> + namespace net { namespace { @@ -18,11 +17,11 @@ void AppendLinesWithIndentation(const std::string& text, const std::string& indentation, std::string* out) { - std::vector<base::StringPiece> lines = base::SplitStringPieceUsingSubstr( - text, "\n", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); - - for (const auto& line : lines) { - base::StrAppend(out, {indentation, line, "\n"}); + std::istringstream stream(text); + for (std::string line; std::getline(stream, line, '\n');) { + out->append(indentation); + out->append(line); + out->append("\n"); } } @@ -164,7 +163,7 @@ std::string CertPathErrors::ToDebugString( const ParsedCertificateList& certs) const { - std::string result; + std::ostringstream result; for (size_t i = 0; i < cert_errors_.size(); ++i) { // Pretty print the current CertErrors. If there were no errors/warnings, @@ -184,25 +183,19 @@ cert_name_debug_str = " (" + cert_name_debug_str + ")"; } } - - result += - base::StringPrintf("----- Certificate i=%d%s -----\n", - static_cast<int>(i), cert_name_debug_str.c_str()); - - result += cert_errors_string; - result += "\n"; + result << "----- Certificate i=" << i << cert_name_debug_str << " -----\n"; + result << cert_errors_string << "\n"; } // Print any other errors that aren't associated with a particular certificate // in the chain. std::string other_errors = other_errors_.ToDebugString(); if (!other_errors.empty()) { - result += "----- Other errors (not certificate specific) -----\n"; - result += other_errors; - result += "\n"; + result << "----- Other errors (not certificate specific) -----\n"; + result << other_errors << "\n"; } - return result; + return result.str(); } } // namespace net
diff --git a/net/cert/pki/nist_pkits_unittest.cc b/net/cert/pki/nist_pkits_unittest.cc index 4956714..f2309349 100644 --- a/net/cert/pki/nist_pkits_unittest.cc +++ b/net/cert/pki/nist_pkits_unittest.cc
@@ -4,9 +4,10 @@ #include "net/cert/pki/nist_pkits_unittest.h" -#include "base/strings/string_split.h" #include "net/cert/pki/certificate_policies.h" +#include <sstream> + namespace net { namespace { @@ -30,9 +31,21 @@ void SetPolicySetFromString(const char* const policy_names, std::set<der::Input>* out) { out->clear(); - std::vector<std::string> names = base::SplitString( - policy_names, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); - for (const std::string& policy_name : names) { + std::istringstream stream(policy_names); + for (std::string line; std::getline(stream, line, ',');) { + size_t start = line.find_first_not_of(" \n\t\r\f\v"); + if (start == std::string::npos) { + continue; + } + size_t end = line.find_last_not_of(" \n\t\r\f\v"); + if (end == std::string::npos) { + continue; + } + std::string policy_name = line.substr(start, end + 1); + if (policy_name.empty()) { + continue; + } + if (policy_name == "anyPolicy") { out->insert(der::Input(kAnyPolicyOid)); } else if (policy_name == "NIST-test-policy-1") {
diff --git a/net/cert/pki/parse_certificate_unittest.cc b/net/cert/pki/parse_certificate_unittest.cc index 8a4bd92..7f5c48ef 100644 --- a/net/cert/pki/parse_certificate_unittest.cc +++ b/net/cert/pki/parse_certificate_unittest.cc
@@ -4,7 +4,6 @@ #include "net/cert/pki/parse_certificate.h" -#include "base/strings/stringprintf.h" #include "net/cert/pki/cert_errors.h" #include "net/cert/pki/general_names.h" #include "net/cert/pki/parsed_certificate.h" @@ -21,9 +20,12 @@ // expectations (it is more readable to specify the expected results as a // string). std::string ToString(const der::GeneralizedTime& time) { - return base::StringPrintf( - "year=%d, month=%d, day=%d, hours=%d, minutes=%d, seconds=%d", time.year, - time.month, time.day, time.hours, time.minutes, time.seconds); + std::ostringstream pretty_time; + pretty_time << "year=" << int{time.year} << ", month=" << int{time.month} + << ", day=" << int{time.day} << ", hours=" << int{time.hours} + << ", minutes=" << int{time.minutes} + << ", seconds=" << int{time.seconds}; + return pretty_time.str(); } std::string GetFilePath(const std::string& file_name) {
diff --git a/net/cert/pki/test_helpers.cc b/net/cert/pki/test_helpers.cc index e88bad85..914b6a3 100644 --- a/net/cert/pki/test_helpers.cc +++ b/net/cert/pki/test_helpers.cc
@@ -9,7 +9,6 @@ #include "base/files/file_util.h" #include "base/path_service.h" #include "base/strings/string_piece.h" -#include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "net/cert/pem.h" #include "net/cert/pki/cert_error_params.h" @@ -18,6 +17,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/boringssl/src/include/openssl/pool.h" +#include <sstream> + namespace net { namespace { @@ -195,9 +196,6 @@ if (file_data.empty()) return false; - std::vector<std::string> lines = base::SplitString( - file_data, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); - bool has_chain = false; bool has_trust = false; bool has_time = false; @@ -206,7 +204,20 @@ base::StringPiece kExpectedErrors = "expected_errors:"; - for (const std::string& line : lines) { + std::istringstream stream(file_data); + for (std::string line; std::getline(stream, line, '\n');) { + size_t start = line.find_first_not_of(" \n\t\r\f\v"); + if (start == std::string::npos) { + continue; + } + size_t end = line.find_last_not_of(" \n\t\r\f\v"); + if (end == std::string::npos) { + continue; + } + line = line.substr(start, end + 1); + if (line.empty()) { + continue; + } base::StringPiece line_piece(line); std::string value;
diff --git a/net/test/android/javatests/src/org/chromium/net/AndroidNetworkLibraryTestUtil.java b/net/test/android/javatests/src/org/chromium/net/AndroidNetworkLibraryTestUtil.java index 5523373..77f5b4a 100644 --- a/net/test/android/javatests/src/org/chromium/net/AndroidNetworkLibraryTestUtil.java +++ b/net/test/android/javatests/src/org/chromium/net/AndroidNetworkLibraryTestUtil.java
@@ -4,7 +4,7 @@ package org.chromium.net; -import org.chromium.base.annotations.CalledByNative; +import org.chromium.base.annotations.CalledByNativeForTesting; /** * Utility functions for testing features implemented in AndroidNetworkLibrary. @@ -15,7 +15,7 @@ /** * Helper for tests that simulates an app controlling cleartext traffic on M and newer. */ - @CalledByNative + @CalledByNativeForTesting public static void setUpSecurityPolicyForTesting(boolean cleartextPermitted) { sDefaultCleartextCheckCount = 0; sPerHostCleartextCheckCount = 0; @@ -37,12 +37,12 @@ }); } - @CalledByNative + @CalledByNativeForTesting private static int getPerHostCleartextCheckCount() { return sPerHostCleartextCheckCount; } - @CalledByNative + @CalledByNativeForTesting private static int getDefaultCleartextCheckCount() { return sDefaultCleartextCheckCount; }
diff --git a/remoting/host/desktop_display_info_loader_mac.mm b/remoting/host/desktop_display_info_loader_mac.mm index 8548a62f..d84fa7a18 100644 --- a/remoting/host/desktop_display_info_loader_mac.mm +++ b/remoting/host/desktop_display_info_loader_mac.mm
@@ -39,10 +39,6 @@ CGDirectDisplayID id = static_cast<CGDirectDisplayID>([device[@"NSScreenNumber"] intValue]); - float dsf = 1.0f; - if ([screen respondsToSelector:@selector(backingScaleFactor)]) - dsf = [screen backingScaleFactor]; - NSRect bounds = [screen frame]; int x = bounds.origin.x; int y = bounds.origin.y; @@ -63,7 +59,7 @@ info.y = main_display_height - y - height; info.width = bounds.size.width; info.height = height; - info.dpi = (int)(kDefaultScreenDpi * dsf); + info.dpi = (int)(kDefaultScreenDpi * [screen backingScaleFactor]); info.bpp = 24; info.is_default = is_default; result.AddDisplay(info);
diff --git a/sandbox/policy/win/sandbox_win_unittest.cc b/sandbox/policy/win/sandbox_win_unittest.cc index ee6dd95e..6bdd710 100644 --- a/sandbox/policy/win/sandbox_win_unittest.cc +++ b/sandbox/policy/win/sandbox_win_unittest.cc
@@ -43,9 +43,18 @@ namespace policy { namespace { + +class TestTargetConfig : public TargetConfig { + public: + ~TestTargetConfig() override {} + bool IsConfigured() const override { return false; } +}; + class TestTargetPolicy : public TargetPolicy { public: ~TestTargetPolicy() override {} + // TargetPolicy: + TargetConfig* GetConfig() override { return &config_; } ResultCode SetTokenLevel(sandbox::TokenLevel initial, TokenLevel lockdown) override { return SBOX_ALL_OK; @@ -138,6 +147,7 @@ bool GetAllowNoSandboxJob() override { return false; } private: + TestTargetConfig config_; std::vector<std::wstring> blocklisted_dlls_; scoped_refptr<AppContainerBase> app_container_; };
diff --git a/sandbox/win/fuzzer/sandbox_policy_rule_fuzzer.cc b/sandbox/win/fuzzer/sandbox_policy_rule_fuzzer.cc index 6a7d2499..c348263 100644 --- a/sandbox/win/fuzzer/sandbox_policy_rule_fuzzer.cc +++ b/sandbox/win/fuzzer/sandbox_policy_rule_fuzzer.cc
@@ -7,6 +7,7 @@ #include <fuzzer/FuzzedDataProvider.h> +#include "sandbox/win/src/broker_services.h" #include "sandbox/win/src/ipc_tags.h" #include "sandbox/win/src/policy_engine_params.h" #include "sandbox/win/src/sandbox_policy.h" @@ -19,7 +20,7 @@ // This fills policies with rules based on the current // renderer sandbox in Chrome. std::unique_ptr<sandbox::PolicyBase> InitPolicy() { - auto policy = std::make_unique<sandbox::PolicyBase>(); + auto policy = std::make_unique<sandbox::PolicyBase>(""); policy->AddRule(sandbox::SubSystem::kWin32kLockdown, sandbox::Semantics::kFakeGdiInit, nullptr); @@ -35,6 +36,8 @@ sandbox::Semantics::kNamedPipesAllowAny, L"\\\\.\\pipe\\chrome.sync.*"); + sandbox::BrokerServicesBase::FreezeTargetConfigForTesting( + policy->GetConfig()); return policy; }
diff --git a/sandbox/win/src/broker_services.cc b/sandbox/win/src/broker_services.cc index 38ec01d..1ad297e 100644 --- a/sandbox/win/src/broker_services.cc +++ b/sandbox/win/src/broker_services.cc
@@ -418,9 +418,30 @@ } std::unique_ptr<TargetPolicy> BrokerServicesBase::CreatePolicy() { + return CreatePolicy(""); +} + +std::unique_ptr<TargetPolicy> BrokerServicesBase::CreatePolicy( + base::StringPiece tag) { // If you change the type of the object being created here you must also // change the downcast to it in SpawnTarget(). - return std::make_unique<PolicyBase>(); + auto policy = std::make_unique<PolicyBase>(tag); + // Empty key implies we will not use the store. The policy will need + // to look after its config. + if (!tag.empty()) { + // Otherwise the broker owns the memory, not the policy. + auto found = config_cache_.find(tag); + ConfigBase* shared_config = nullptr; + if (found == config_cache_.end()) { + auto new_config = std::make_unique<ConfigBase>(); + shared_config = new_config.get(); + config_cache_[std::string(tag)] = std::move(new_config); + policy->SetConfig(shared_config); + } else { + policy->SetConfig(found->second.get()); + } + } + return policy; } // SpawnTarget does all the interesting sandbox setup and creates the target @@ -449,6 +470,12 @@ policy_base.reset(static_cast<PolicyBase*>(policy.release())); // |policy| cannot be used from here onwards. + ConfigBase* config_base = static_cast<ConfigBase*>(policy_base->GetConfig()); + if (!config_base->IsConfigured()) { + if (!config_base->Freeze()) + return SBOX_ERROR_FAILED_TO_FREEZE_CONFIG; + } + // Even though the resources touched by SpawnTarget can be accessed in // multiple threads, the method itself cannot be called from more than one // thread. This is to protect the global variables used while setting up the @@ -633,4 +660,10 @@ return SBOX_ALL_OK; } +// static +void BrokerServicesBase::FreezeTargetConfigForTesting(TargetConfig* config) { + CHECK(!config->IsConfigured()); + static_cast<ConfigBase*>(config)->Freeze(); +} + } // namespace sandbox
diff --git a/sandbox/win/src/broker_services.h b/sandbox/win/src/broker_services.h index 5d2054a4..41e6a82 100644 --- a/sandbox/win/src/broker_services.h +++ b/sandbox/win/src/broker_services.h
@@ -11,12 +11,14 @@ #include <utility> #include "base/compiler_specific.h" +#include "base/containers/flat_map.h" #include "base/memory/raw_ptr.h" #include "base/memory/scoped_refptr.h" #include "base/win/scoped_handle.h" #include "sandbox/win/src/crosscall_server.h" #include "sandbox/win/src/job.h" #include "sandbox/win/src/sandbox.h" +#include "sandbox/win/src/sandbox_policy_base.h" #include "sandbox/win/src/sharedmem_ipc_server.h" #include "sandbox/win/src/threadpool.h" #include "sandbox/win/src/win_utils.h" @@ -43,6 +45,8 @@ // BrokerServices interface. ResultCode Init() override; std::unique_ptr<TargetPolicy> CreatePolicy() override; + std::unique_ptr<TargetPolicy> CreatePolicy(base::StringPiece key) override; + ResultCode SpawnTarget(const wchar_t* exe_path, const wchar_t* command_line, std::unique_ptr<TargetPolicy> policy, @@ -53,6 +57,8 @@ ResultCode GetPolicyDiagnostics( std::unique_ptr<PolicyDiagnosticsReceiver> receiver) override; + static void FreezeTargetConfigForTesting(TargetConfig* config); + private: // The completion port used by the job objects to communicate events to // the worker thread. @@ -68,6 +74,10 @@ // Provides a pool of threads that are used to wait on the IPC calls. // Owned by TargetEventsThread which is alive until our destructor. raw_ptr<ThreadPool> thread_pool_ = nullptr; + + // Cache of configs backing policies. Entries are retained until shutdown and + // used to prime policies created by CreatePolicy() with the same `tag`. + base::flat_map<std::string, std::unique_ptr<TargetConfig>> config_cache_; }; } // namespace sandbox
diff --git a/sandbox/win/src/policy_target_test.cc b/sandbox/win/src/policy_target_test.cc index f400ebc..039b820d 100644 --- a/sandbox/win/src/policy_target_test.cc +++ b/sandbox/win/src/policy_target_test.cc
@@ -10,8 +10,10 @@ #include "base/win/scoped_process_information.h" #include "base/win/windows_version.h" #include "build/build_config.h" +#include "sandbox/win/src/broker_services.h" #include "sandbox/win/src/sandbox.h" #include "sandbox/win/src/sandbox_factory.h" +#include "sandbox/win/src/sandbox_policy.h" #include "sandbox/win/src/sandbox_utils.h" #include "sandbox/win/src/target_services.h" #include "sandbox/win/tests/common/controller.h" @@ -549,4 +551,46 @@ runner.RunTest(L"PolicyTargetTest_SetEffectiveToken")); } +// Test if shared policies can be created by the broker. +TEST(SharedTargetConfig, BrokerConfigManagement) { + BrokerServices* broker = GetBroker(); + ASSERT_TRUE(broker); + // Policies with empty names should not be fixed. + auto policy = broker->CreatePolicy(""); + EXPECT_FALSE(policy->GetConfig()->IsConfigured()); + // Normally a policy is frozen (if necessary) by the broker when it is passed + // to SpawnTarget. + BrokerServicesBase::FreezeTargetConfigForTesting(policy->GetConfig()); + EXPECT_TRUE(policy->GetConfig()->IsConfigured()); + auto policy_two = broker->CreatePolicy(""); + EXPECT_FALSE(policy_two->GetConfig()->IsConfigured()); + + // Policies with no name should not be fixed. + policy = broker->CreatePolicy(); + EXPECT_FALSE(policy->GetConfig()->IsConfigured()); + BrokerServicesBase::FreezeTargetConfigForTesting(policy->GetConfig()); + policy_two = broker->CreatePolicy(); + EXPECT_FALSE(policy_two->GetConfig()->IsConfigured()); + + // Named policy should not be fixed the first time. + policy = broker->CreatePolicy("key-one"); + EXPECT_FALSE(policy->GetConfig()->IsConfigured()); + BrokerServicesBase::FreezeTargetConfigForTesting(policy->GetConfig()); + // Policy should be fixed the second time. + policy = broker->CreatePolicy("key-one"); + EXPECT_TRUE(policy->GetConfig()->IsConfigured()); + // Even if all policies with the same key are deleted. + policy.reset(); + policy = broker->CreatePolicy("key-one"); + EXPECT_TRUE(policy->GetConfig()->IsConfigured()); + + // A different name should not be fixed the first time. + policy_two = broker->CreatePolicy("key-two"); + EXPECT_FALSE(policy_two->GetConfig()->IsConfigured()); + BrokerServicesBase::FreezeTargetConfigForTesting(policy_two->GetConfig()); + // But should be the second time. + policy_two = broker->CreatePolicy("key-two"); + EXPECT_TRUE(policy_two->GetConfig()->IsConfigured()); +} + } // namespace sandbox
diff --git a/sandbox/win/src/sandbox.h b/sandbox/win/src/sandbox.h index dea1b5a6..6c166d67 100644 --- a/sandbox/win/src/sandbox.h +++ b/sandbox/win/src/sandbox.h
@@ -24,6 +24,7 @@ #include <vector> #include "base/memory/ref_counted.h" +#include "base/strings/string_piece.h" #if !defined(SANDBOX_FUZZ_TARGET) #include "base/win/windows_types.h" #else @@ -66,9 +67,30 @@ // Returns the interface pointer to a new, empty policy object. Use this // interface to specify the sandbox policy for new processes created by - // SpawnTarget() + // SpawnTarget(). virtual std::unique_ptr<TargetPolicy> CreatePolicy() = 0; + // Returns the interface pointer to a new, empty policy object. Use this + // interface to specify the sandbox policy for new processes created by + // SpawnTarget(). + // + // The first time a specific value of `tag` is provided an empty policy will + // be returned, and both TargetConfig and TargetPolicy methods should be + // called to populate the object before passing it to SpawnTarget(). + // + // The second and subsequent times a given `tag` is provided, the object will + // share the backing data for state configured by TargetConfig methods (with + // the first instance) and those methods should not be called for this policy. + // TargetConfig::IsConfigured() will return `true` for the second and + // subsequent objects created with a given `tag`. Methods on TargetPolicy + // should continue to be called to populate the per-instance configuration. + // + // Provide an empty `tag` (or call CreatePolicy() with no tag) to create a + // policy which never shares its TargetConfig state with another policy + // object. For such an object both its TargetConfig and TargetPolicy methods + // must be called every time. + virtual std::unique_ptr<TargetPolicy> CreatePolicy(base::StringPiece tag) = 0; + // Creates a new target (child process) in a suspended state and takes // ownership of |policy|. // Parameters:
diff --git a/sandbox/win/src/sandbox_policy.h b/sandbox/win/src/sandbox_policy.h index 40ba0e51..7036c8c 100644 --- a/sandbox/win/src/sandbox_policy.h +++ b/sandbox/win/src/sandbox_policy.h
@@ -45,6 +45,26 @@ kSocketAllowBroker // Allows brokering of sockets. }; +// Policy configuration that can be shared over multiple targets of the same tag +// (see BrokerServicesBase::CreatePolicy(tag)). Methods in TargetConfig will +// only need to be called the first time a TargetPolicy object with a given tag +// is configured. +// +// We need [[clang::lto_visibility_public]] because instances of this class are +// passed across module boundaries. This means different modules must have +// compatible definitions of the class even when LTO is enabled. +class [[clang::lto_visibility_public]] TargetConfig { + public: + virtual ~TargetConfig() {} + + // Returns `true` when the TargetConfig of this policy object has been + // populated. Methods in TargetConfig should not be called. + // + // Returns `false` if TargetConfig methods do need to be called to configure + // this policy object. + virtual bool IsConfigured() const = 0; +}; + // We need [[clang::lto_visibility_public]] because instances of this class are // passed across module boundaries. This means different modules must have // compatible definitions of the class even when LTO is enabled. @@ -52,6 +72,9 @@ public: virtual ~TargetPolicy() {} + // Fetches the backing TargetConfig for this policy. + virtual TargetConfig* GetConfig() = 0; + // Sets the security level for the target process' two tokens. // This setting is permanent and cannot be changed once the target process is // spawned.
diff --git a/sandbox/win/src/sandbox_policy_base.cc b/sandbox/win/src/sandbox_policy_base.cc index 11e9c3b..c41c766 100644 --- a/sandbox/win/src/sandbox_policy_base.cc +++ b/sandbox/win/src/sandbox_policy_base.cc
@@ -88,8 +88,38 @@ PolicyBase::alternate_desktop_local_winstation_integrity_level_label_ = INTEGRITY_LEVEL_SYSTEM; -PolicyBase::PolicyBase() - : lockdown_level_(USER_LOCKDOWN), +ConfigBase::ConfigBase() noexcept + : +#if DCHECK_IS_ON() + creating_thread_id_(GetCurrentThreadId()), +#endif // DCHECK_IS_ON() + configured_(false) { +} + +bool ConfigBase::IsOnCreatingThread() const { +#if DCHECK_IS_ON() + return GetCurrentThreadId() == creating_thread_id_; +#else // DCHECK_IS_ON() + return true; +#endif +} + +bool ConfigBase::IsConfigured() const { + return configured_; +} + +bool ConfigBase::Freeze() { + DCHECK(IsOnCreatingThread()); + DCHECK(!configured_); + configured_ = true; + return true; +} + +PolicyBase::PolicyBase(base::StringPiece tag) + : tag_(tag), + config_(), + config_ptr_(nullptr), + lockdown_level_(USER_LOCKDOWN), initial_level_(USER_LOCKDOWN), job_level_(JobLevel::kLockdown), ui_exceptions_(0), @@ -119,6 +149,37 @@ delete policy_; } +TargetConfig* PolicyBase::GetConfig() { + return config(); +} + +ConfigBase* PolicyBase::config() { + if (config_ptr_) { + DCHECK(!config_); + // Should have a tag if we are sharing backing configuration. + DCHECK(!tag_.empty()); + return config_ptr_; + } + if (!config_) { + DCHECK(tag_.empty()); + config_ = std::make_unique<ConfigBase>(); + } + return config_.get(); +} + +bool PolicyBase::SetConfig(TargetConfig* config) { + // Cannot call this method if we already own our memory. + DCHECK(!config_); + // Cannot call this method twice. + DCHECK(!config_ptr_); + // Must provide valid shared data region. + DCHECK(config); + // Should have a tag. + DCHECK(!tag_.empty()); + config_ptr_ = static_cast<ConfigBase*>(config); + return true; +} + ResultCode PolicyBase::SetTokenLevel(TokenLevel initial, TokenLevel lockdown) { if (initial < lockdown) { return SBOX_ERROR_BAD_PARAMS;
diff --git a/sandbox/win/src/sandbox_policy_base.h b/sandbox/win/src/sandbox_policy_base.h index 1388684e..e61ab44 100644 --- a/sandbox/win/src/sandbox_policy_base.h +++ b/sandbox/win/src/sandbox_policy_base.h
@@ -14,9 +14,11 @@ #include <vector> #include "base/compiler_specific.h" +#include "base/dcheck_is_on.h" #include "base/memory/raw_ptr.h" #include "base/memory/scoped_refptr.h" #include "base/process/launch.h" +#include "base/strings/string_piece.h" #include "base/synchronization/lock.h" #include "base/win/scoped_handle.h" #include "base/win/windows_types.h" @@ -30,21 +32,56 @@ namespace sandbox { +class BrokerServicesBase; class Dispatcher; class LowLevelPolicy; class PolicyDiagnostic; class TargetProcess; struct PolicyGlobal; +// The members of this class are shared between multiple sandbox::PolicyBase +// objects and must be safe for access from multiple threads once created. +// When shared members will not be destroyed until BrokerServicesBase is +// destroyed at process shutdown. +class ConfigBase final : public TargetConfig { + public: + ConfigBase() noexcept; + ~ConfigBase() override = default; + + ConfigBase(const ConfigBase&) = delete; + ConfigBase& operator=(const ConfigBase&) = delete; + + bool IsConfigured() const override; + + private: + // Can call Freeze() + friend class BrokerServicesBase; + // Promise that no further changes will be made to the configuration, and + // this object can be reused by multiple policies. + bool Freeze(); + + // Use in DCHECK only - returns `true` in non-DCHECK builds. + bool IsOnCreatingThread() const; + +#if DCHECK_IS_ON() + // Used to sequence-check in DCHECK builds. + uint32_t creating_thread_id_; +#endif // DCHECK_IS_ON() + + // Once true the configuration is frozen and can be applied to later policies. + bool configured_ = false; +}; + class PolicyBase final : public TargetPolicy { public: - PolicyBase(); + PolicyBase(base::StringPiece key); ~PolicyBase() override; PolicyBase(const PolicyBase&) = delete; PolicyBase& operator=(const PolicyBase&) = delete; // TargetPolicy: + TargetConfig* GetConfig() override; ResultCode SetTokenLevel(TokenLevel initial, TokenLevel lockdown) override; TokenLevel GetInitialTokenLevel() const override; TokenLevel GetLockdownTokenLevel() const override; @@ -126,6 +163,8 @@ const base::HandlesToInheritVector& GetHandlesBeingShared(); private: + // BrokerServicesBase is allowed to set shared backing fields for FixedPolicy. + friend class sandbox::BrokerServicesBase; // Allow PolicyDiagnostic to snapshot PolicyBase for diagnostics. friend class PolicyDiagnostic; @@ -139,6 +178,21 @@ Semantics semantics, const wchar_t* pattern); + // TargetConfig will really be a ConfigBase. + bool SetConfig(TargetConfig* config); + + // Gets possibly shared data or allocates if it did not already exist. + ConfigBase* config(); + // Tag provided when this policy was created - mainly for debugging. + std::string tag_; + // Backing data if this object was created with an empty tag_. + std::unique_ptr<ConfigBase> config_; + // Shared backing data if this object will share fields with other policies. + raw_ptr<ConfigBase> config_ptr_; + + // Remaining members are unique to this instance and will be configured every + // time. + // The policy takes ownership of a target as it is applied to it. std::unique_ptr<TargetProcess> target_; // The user-defined global policy settings.
diff --git a/sandbox/win/src/sandbox_policy_diagnostic.cc b/sandbox/win/src/sandbox_policy_diagnostic.cc index e59a1dc..c4e76339 100644 --- a/sandbox/win/src/sandbox_policy_diagnostic.cc +++ b/sandbox/win/src/sandbox_policy_diagnostic.cc
@@ -46,6 +46,7 @@ const char kPlatformMitigations[] = "platformMitigations"; const char kPolicyRules[] = "policyRules"; const char kProcessId[] = "processId"; +const char kTag[] = "tag"; // Values in snapshots of Policies. const char kDisabled[] = "disabled"; @@ -373,6 +374,7 @@ process_id_ = base::strict_cast<uint32_t>(policy->target_->ProcessId()); lockdown_level_ = policy->lockdown_level_; job_level_ = policy->job_level_; + tag_ = policy->tag_; // Select the final integrity level. if (policy->delayed_integrity_level_ == INTEGRITY_LEVEL_LAST) @@ -426,6 +428,7 @@ base::Value::Dict dict; dict.Set(kProcessId, base::strict_cast<double>(process_id_)); + dict.Set(kTag, base::Value(tag_)); dict.Set(kLockdownLevel, GetTokenLevelInEnglish(lockdown_level_)); dict.Set(kJobLevel, GetJobLevelInEnglish(job_level_)); dict.Set(kDesiredIntegrityLevel,
diff --git a/sandbox/win/src/sandbox_policy_diagnostic.h b/sandbox/win/src/sandbox_policy_diagnostic.h index 6bbe5e0..c159eff7 100644 --- a/sandbox/win/src/sandbox_policy_diagnostic.h +++ b/sandbox/win/src/sandbox_policy_diagnostic.h
@@ -55,6 +55,7 @@ std::unique_ptr<PolicyGlobal> policy_rules_; bool is_csrss_connected_ = false; HandleMap handles_to_close_; + std::string tag_; }; } // namespace sandbox
diff --git a/sandbox/win/src/sandbox_types.h b/sandbox/win/src/sandbox_types.h index 8651aac..eb43beb1 100644 --- a/sandbox/win/src/sandbox_types.h +++ b/sandbox/win/src/sandbox_types.h
@@ -162,6 +162,8 @@ SBOX_ERROR_INVALID_READ_SENTINEL_SIZE = 67, // The target process sentinel value did not match the sentinel in the broker. SBOX_ERROR_MISMATCH_SENTINEL_VALUE = 68, + // The process of consolidating the ConfigBase for a policy failed. + SBOX_ERROR_FAILED_TO_FREEZE_CONFIG = 69, // Placeholder for last item of the enum. SBOX_ERROR_LAST };
diff --git a/testing/android/proguard_for_test.flags b/testing/android/proguard_for_test.flags index 8c5707a..80eb4f9 100644 --- a/testing/android/proguard_for_test.flags +++ b/testing/android/proguard_for_test.flags
@@ -24,6 +24,12 @@ *; } +# This matches how we keep @CalledByNative. +-keep @interface org.chromium.base.annotations.CalledByNativeForTesting +-keepclasseswithmembers,includedescriptorclasses,allowaccessmodification class ** { + @org.chromium.base.annotations.CalledByNativeForTesting <methods>; +} + # Keep all classes that are in test packages. There is no benefit in testing # Proguarding of test classes, but this is as close as we can get to selecting # all classes from the test apk.
diff --git a/testing/buildbot/chromium.angle.json b/testing/buildbot/chromium.angle.json index 5771f8a..4054f85 100644 --- a/testing/buildbot/chromium.angle.json +++ b/testing/buildbot/chromium.angle.json
@@ -406,8 +406,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -431,8 +431,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -454,7 +454,7 @@ "--expected-vendor-id", "8086", "--expected-device-id", - "5912" + "9bc5" ], "isolate_name": "telemetry_gpu_integration_test", "merge": { @@ -472,8 +472,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -507,8 +507,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -545,8 +545,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -583,8 +583,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -822,8 +822,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -849,8 +849,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -874,8 +874,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -899,8 +899,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ],
diff --git a/testing/buildbot/chromium.dawn.json b/testing/buildbot/chromium.dawn.json index 3038b45..73402f6 100644 --- a/testing/buildbot/chromium.dawn.json +++ b/testing/buildbot/chromium.dawn.json
@@ -3,7 +3,7 @@ "AAAAA2 See generate_buildbot_json.py to make changes": {}, "Dawn Linux x64 Builder": {}, "Dawn Linux x64 DEPS Builder": {}, - "Dawn Linux x64 DEPS Release (Intel HD 630)": { + "Dawn Linux x64 DEPS Release (Intel UHD 630)": { "gtest_tests": [ { "args": [ @@ -20,8 +20,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -47,8 +47,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -74,8 +74,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -101,8 +101,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -127,8 +127,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -151,8 +151,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -181,8 +181,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -204,8 +204,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -243,8 +243,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -281,8 +281,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -316,8 +316,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -355,8 +355,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -393,8 +393,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -430,8 +430,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -961,446 +961,6 @@ } ] }, - "Dawn Linux x64 Release (Intel HD 630)": { - "gtest_tests": [ - { - "args": [ - "--no-xvfb", - "--use-gpu-in-tests", - "--test-launcher-retry-limit=0", - "--exclusive-device-type-preference=discrete,integrated" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "dawn_end2end_tests", - "test_id_prefix": "ninja://third_party/dawn/src/dawn/tests:dawn_end2end_tests/" - }, - { - "args": [ - "--enable-toggles=skip_validation", - "--no-xvfb", - "--use-gpu-in-tests", - "--test-launcher-retry-limit=0", - "--exclusive-device-type-preference=discrete,integrated" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "name": "dawn_end2end_skip_validation_tests", - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "dawn_end2end_tests", - "test_id_prefix": "ninja://third_party/dawn/src/dawn/tests:dawn_end2end_tests/" - }, - { - "args": [ - "--enable-backend-validation", - "--no-xvfb", - "--use-gpu-in-tests", - "--test-launcher-retry-limit=0", - "--exclusive-device-type-preference=discrete,integrated" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "name": "dawn_end2end_validation_layers_tests", - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "dawn_end2end_tests", - "test_id_prefix": "ninja://third_party/dawn/src/dawn/tests:dawn_end2end_tests/" - }, - { - "args": [ - "--use-wire", - "--no-xvfb", - "--use-gpu-in-tests", - "--test-launcher-retry-limit=0", - "--exclusive-device-type-preference=discrete,integrated" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "name": "dawn_end2end_wire_tests", - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "dawn_end2end_tests", - "test_id_prefix": "ninja://third_party/dawn/src/dawn/tests:dawn_end2end_tests/" - }, - { - "args": [ - "--use-cmd-decoder=passthrough", - "--use-gl=angle", - "--use-gpu-in-tests", - "--no-xvfb" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "name": "gl_tests_passthrough", - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test": "gl_tests", - "test_id_prefix": "ninja://gpu:gl_tests/" - }, - { - "args": [ - "--use-gpu-in-tests", - "--no-xvfb" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "gl_unittests", - "test_id_prefix": "ninja://ui/gl:gl_unittests/" - } - ], - "isolated_scripts": [ - { - "args": [ - "--override-steps=1", - "--gtest-benchmark-name=dawn_perf_tests", - "-v" - ], - "isolate_name": "dawn_perf_tests", - "merge": { - "args": [ - "--smoke-test-mode" - ], - "script": "//tools/perf/process_perf_results.py" - }, - "name": "dawn_perf_tests", - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://third_party/dawn/src/dawn/tests:dawn_perf_tests/" - }, - { - "isolate_name": "telemetry_gpu_unittests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "telemetry_gpu_unittests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_unittests/" - }, - { - "args": [ - "--flag-specific=webgpu", - "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", - "--no-xvfb", - "--additional-driver-flag=--enable-features=Vulkan", - "--git-revision=${got_revision}" - ], - "check_flakiness_for_new_tests": false, - "isolate_name": "webgpu_blink_web_tests", - "merge": { - "args": [ - "--verbose" - ], - "script": "//third_party/blink/tools/merge_web_test_results.py" - }, - "name": "webgpu_blink_web_tests", - "precommit_args": [ - "--gerrit-issue=${patch_issue}", - "--gerrit-patchset=${patch_set}", - "--buildbucket-id=${buildbucket_build_id}" - ], - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://:webgpu_blink_web_tests/" - }, - { - "args": [ - "--flag-specific=webgpu-with-backend-validation", - "--timeout-ms=30000", - "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", - "--no-xvfb", - "--additional-driver-flag=--enable-features=Vulkan", - "--git-revision=${got_revision}" - ], - "isolate_name": "webgpu_blink_web_tests", - "merge": { - "args": [ - "--verbose" - ], - "script": "//third_party/blink/tools/merge_web_test_results.py" - }, - "name": "webgpu_blink_web_tests_with_backend_validation", - "precommit_args": [ - "--gerrit-issue=${patch_issue}", - "--gerrit-patchset=${patch_set}", - "--buildbucket-id=${buildbucket_build_id}" - ], - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://:webgpu_blink_web_tests/" - }, - { - "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu --enable-features=Vulkan", - "--retry-limit=3", - "--jobs=4" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_cts_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 14 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "--flag-specific=webgpu-swiftshader", - "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", - "--no-xvfb", - "--additional-driver-flag=--enable-features=Vulkan", - "--git-revision=${got_revision}" - ], - "isolate_name": "webgpu_blink_web_tests", - "merge": { - "args": [ - "--verbose" - ], - "script": "//third_party/blink/tools/merge_web_test_results.py" - }, - "name": "webgpu_swiftshader_blink_web_tests", - "precommit_args": [ - "--gerrit-issue=${patch_issue}", - "--gerrit-patchset=${patch_set}", - "--buildbucket-id=${buildbucket_build_id}" - ], - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://:webgpu_blink_web_tests/" - }, - { - "args": [ - "--flag-specific=webgpu-swiftshader-with-backend-validation", - "--timeout-ms=30000", - "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", - "--no-xvfb", - "--additional-driver-flag=--enable-features=Vulkan", - "--git-revision=${got_revision}" - ], - "isolate_name": "webgpu_blink_web_tests", - "merge": { - "args": [ - "--verbose" - ], - "script": "//third_party/blink/tools/merge_web_test_results.py" - }, - "name": "webgpu_swiftshader_blink_web_tests_with_backend_validation", - "precommit_args": [ - "--gerrit-issue=${patch_issue}", - "--gerrit-patchset=${patch_set}", - "--buildbucket-id=${buildbucket_build_id}" - ], - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://:webgpu_blink_web_tests/" - }, - { - "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu --enable-features=Vulkan", - "--use-webgpu-adapter=swiftshader", - "--test-filter=*web_platform*", - "--retry-limit=3", - "--jobs=4" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_swiftshader_web_platform_cts_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - } - ] - }, "Dawn Linux x64 Release (Intel UHD 630)": { "gtest_tests": [ {
diff --git a/testing/buildbot/chromium.gpu.fyi.json b/testing/buildbot/chromium.gpu.fyi.json index cf425a1..5fff6cf8 100644 --- a/testing/buildbot/chromium.gpu.fyi.json +++ b/testing/buildbot/chromium.gpu.fyi.json
@@ -5366,8 +5366,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -5405,8 +5405,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -5444,8 +5444,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -5465,7 +5465,7 @@ "--expected-vendor-id", "8086", "--expected-device-id", - "5912", + "9bc5", "--xvfb", "--no-xvfb", "--use-weston", @@ -5487,8 +5487,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -5535,8 +5535,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -5574,8 +5574,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -5622,8 +5622,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -5662,8 +5662,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -5701,8 +5701,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -5732,8 +5732,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -5774,8 +5774,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -5816,8 +5816,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -6251,181 +6251,11 @@ } ] }, - "Linux FYI Experimental Release (Intel HD 630)": { - "gtest_tests": [ - { - "args": [ - "angle_unittests" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "angle_unittests", - "test_id_prefix": "ninja://third_party/angle/src/tests:angle_unittests/", - "use_isolated_scripts_api": true - }, - { - "args": [ - "--enable-gpu", - "--test-launcher-bot-mode", - "--test-launcher-jobs=1", - "--gtest_filter=TabCaptureApiPixelTest.EndToEnd*", - "--no-xvfb" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "name": "tab_capture_end2end_tests", - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "browser_tests", - "test_id_prefix": "ninja://chrome/test:browser_tests/" - }, - { - "args": [ - "--use-cmd-decoder=passthrough", - "--use-gl=angle", - "--use-gpu-in-tests", - "--no-xvfb" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "name": "gl_tests_passthrough", - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test": "gl_tests", - "test_id_prefix": "ninja://gpu:gl_tests/" - }, - { - "args": [ - "--use-gpu-in-tests", - "--no-xvfb" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "gl_unittests", - "test_id_prefix": "ninja://ui/gl:gl_unittests/" - }, - { - "args": [ - "--use-gpu-in-tests" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "gles2_conform_test", - "test_id_prefix": "ninja://gpu/gles2_conform_support:gles2_conform_test/" - } - ], + "Linux FYI Experimental Release (Intel UHD 630)": { "isolated_scripts": [ { "args": [ - "context_lost", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-cmd-decoder=passthrough --use-gl=angle" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "context_lost_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "gpu_process", + "noop_sleep", "--show-stdout", "--browser=release", "--passthrough", @@ -6437,19 +6267,15 @@ "args": [], "script": "//testing/merge_scripts/standard_isolated_script_merge.py" }, - "name": "gpu_process_launch_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, + "name": "noop_sleep_tests", "should_retry_with_patch": false, "swarming": { "can_use_on_swarming_builders": true, "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -6458,360 +6284,6 @@ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "hardware_accelerated_feature", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "hardware_accelerated_feature_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "info_collection", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu", - "--expected-vendor-id", - "8086", - "--expected-device-id", - "5912" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "info_collection_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "maps", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-cmd-decoder=passthrough --use-gl=angle", - "--dont-restore-color-profile-after-test", - "--test-machine-name", - "${buildername}", - "--git-revision=${got_revision}" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "maps_pixel_passthrough_test", - "precommit_args": [ - "--gerrit-issue=${patch_issue}", - "--gerrit-patchset=${patch_set}", - "--buildbucket-id=${buildbucket_build_id}" - ], - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "mediapipe", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_higher_performance_gpu --use-cmd-decoder=passthrough --use-gl=angle" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "mediapipe_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "pixel", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-cmd-decoder=passthrough --use-gl=angle", - "--dont-restore-color-profile-after-test", - "--test-machine-name", - "${buildername}", - "--git-revision=${got_revision}" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "pixel_skia_gold_passthrough_test", - "precommit_args": [ - "--gerrit-issue=${patch_issue}", - "--gerrit-patchset=${patch_set}", - "--buildbucket-id=${buildbucket_build_id}" - ], - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "screenshot_sync", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-cmd-decoder=passthrough --use-gl=angle", - "--dont-restore-color-profile-after-test" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "screenshot_sync_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "trace_test", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "trace_test", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgl_conformance", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-gl=angle --use-angle=gl --use-cmd-decoder=passthrough --force_high_performance_gpu", - "--webgl-conformance-version=2.0.1", - "--read-abbreviated-json-results-from=../../content/test/data/gpu/webgl2_conformance_tests_output.json", - "--jobs=4" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgl2_conformance_gl_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 20 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgl_conformance", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-gl=angle --use-angle=gl --use-cmd-decoder=passthrough --force_high_performance_gpu", - "--read-abbreviated-json-results-from=../../content/test/data/gpu/webgl_conformance_tests_output.json", - "--jobs=4" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgl_conformance_gl_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" } ] }, @@ -7494,570 +6966,6 @@ } ] }, - "Linux FYI Release (Intel HD 630)": { - "gtest_tests": [ - { - "args": [ - "angle_unittests" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "angle_unittests", - "test_id_prefix": "ninja://third_party/angle/src/tests:angle_unittests/", - "use_isolated_scripts_api": true - }, - { - "args": [ - "--use-cmd-decoder=passthrough", - "--use-gl=angle", - "--use-gpu-in-tests", - "--no-xvfb" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "name": "gl_tests_passthrough", - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test": "gl_tests", - "test_id_prefix": "ninja://gpu:gl_tests/" - }, - { - "args": [ - "--use-gpu-in-tests", - "--no-xvfb" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "gl_unittests", - "test_id_prefix": "ninja://ui/gl:gl_unittests/" - }, - { - "args": [ - "--use-gpu-in-tests" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "gles2_conform_test", - "test_id_prefix": "ninja://gpu/gles2_conform_support:gles2_conform_test/" - } - ], - "isolated_scripts": [ - { - "args": [ - "context_lost", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-cmd-decoder=passthrough --use-gl=angle" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "context_lost_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "gpu_process", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gpu_process_launch_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "hardware_accelerated_feature", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "hardware_accelerated_feature_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "info_collection", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu", - "--expected-vendor-id", - "8086", - "--expected-device-id", - "5912" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "info_collection_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "maps", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-cmd-decoder=passthrough --use-gl=angle", - "--dont-restore-color-profile-after-test", - "--test-machine-name", - "${buildername}", - "--git-revision=${got_revision}" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "maps_pixel_passthrough_test", - "precommit_args": [ - "--gerrit-issue=${patch_issue}", - "--gerrit-patchset=${patch_set}", - "--buildbucket-id=${buildbucket_build_id}" - ], - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "mediapipe", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_higher_performance_gpu --use-cmd-decoder=passthrough --use-gl=angle" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "mediapipe_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "pixel", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-cmd-decoder=passthrough --use-gl=angle", - "--dont-restore-color-profile-after-test", - "--test-machine-name", - "${buildername}", - "--git-revision=${got_revision}" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "pixel_skia_gold_passthrough_test", - "precommit_args": [ - "--gerrit-issue=${patch_issue}", - "--gerrit-patchset=${patch_set}", - "--buildbucket-id=${buildbucket_build_id}" - ], - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "screenshot_sync", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-cmd-decoder=passthrough --use-gl=angle", - "--dont-restore-color-profile-after-test" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "screenshot_sync_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "trace_test", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "trace_test", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "pixel", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-vulkan=native --disable-vulkan-fallback-to-gl-for-testing --enable-features=Vulkan --use-gl=angle --use-angle=gl --use-cmd-decoder=passthrough", - "--dont-restore-color-profile-after-test", - "--test-machine-name", - "${buildername}", - "--git-revision=${got_revision}" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "vulkan_pixel_skia_gold_test", - "precommit_args": [ - "--gerrit-issue=${patch_issue}", - "--gerrit-patchset=${patch_set}", - "--buildbucket-id=${buildbucket_build_id}" - ], - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgl_conformance", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-gl=angle --use-angle=gl --use-cmd-decoder=passthrough --force_high_performance_gpu", - "--webgl-conformance-version=2.0.1", - "--read-abbreviated-json-results-from=../../content/test/data/gpu/webgl2_conformance_tests_output.json", - "--jobs=4" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgl2_conformance_gl_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 20 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgl_conformance", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-gl=angle --use-angle=gl --use-cmd-decoder=passthrough --force_high_performance_gpu", - "--read-abbreviated-json-results-from=../../content/test/data/gpu/webgl_conformance_tests_output.json", - "--jobs=4" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgl_conformance_gl_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - } - ] - }, "Linux FYI Release (Intel UHD 630)": { "gtest_tests": [ { @@ -8086,34 +6994,6 @@ }, { "args": [ - "--enable-gpu", - "--test-launcher-bot-mode", - "--test-launcher-jobs=1", - "--gtest_filter=TabCaptureApiPixelTest.EndToEnd*", - "--no-xvfb" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "name": "tab_capture_end2end_tests", - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:9bc5-20.0.8", - "os": "Ubuntu-18.04.6", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "browser_tests", - "test_id_prefix": "ninja://chrome/test:browser_tests/" - }, - { - "args": [ "--use-cmd-decoder=passthrough", "--use-gl=angle", "--use-gpu-in-tests",
diff --git a/testing/buildbot/mixins.pyl b/testing/buildbot/mixins.pyl index 74e0a36..c9a6565 100644 --- a/testing/buildbot/mixins.pyl +++ b/testing/buildbot/mixins.pyl
@@ -693,23 +693,13 @@ }, }, }, - 'linux_intel_hd_630_experimental': { - # Similar to stable, but with a newer Mesa version. + 'linux_intel_uhd_630_experimental': { 'swarming': { 'dimensions': { - 'gpu': '8086:5912-20.0.8', - 'os': 'Ubuntu-18.04.5', + 'gpu': '8086:9bc5-20.0.8', + 'os': 'Ubuntu-18.04.6', 'pool': 'chromium.tests.gpu', }, - }, - }, - 'linux_intel_hd_630_stable': { - 'swarming': { - 'dimensions': { - 'gpu': '8086:5912-19.0.2', - 'os': 'Ubuntu-19.04', - 'pool': 'chromium.tests.gpu', - } } }, 'linux_intel_uhd_630_stable': {
diff --git a/testing/buildbot/test_suite_exceptions.pyl b/testing/buildbot/test_suite_exceptions.pyl index 4d00666..c57fba36 100644 --- a/testing/buildbot/test_suite_exceptions.pyl +++ b/testing/buildbot/test_suite_exceptions.pyl
@@ -3274,7 +3274,7 @@ 'Mac Retina Debug (AMD)', 'Win10 FYI x64 Debug (NVIDIA)', # Disabled due to dbus crashes crbug.com/927465 - 'Linux FYI Release (Intel HD 630)', + 'Linux FYI Release (Intel UHD 630)', 'Linux FYI Release (NVIDIA)', 'Linux Release (NVIDIA)', ],
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index 1f1d3487..224d905e 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -7647,31 +7647,31 @@ 'linux_optional_gpu_tests_rel_gpu_telemetry_tests': { 'gpu_common_and_optional_telemetry_tests': { 'variants': [ - 'LINUX_INTEL_HD_630_STABLE', + 'LINUX_INTEL_UHD_630_STABLE', 'LINUX_NVIDIA_GTX_1660_STABLE', ], }, 'gpu_mediapipe_passthrough_telemetry_tests': { 'variants': [ - 'LINUX_INTEL_HD_630_STABLE', + 'LINUX_INTEL_UHD_630_STABLE', 'LINUX_NVIDIA_GTX_1660_STABLE', ], }, 'gpu_webcodecs_telemetry_test': { 'variants': [ - 'LINUX_INTEL_HD_630_STABLE', + 'LINUX_INTEL_UHD_630_STABLE', 'LINUX_NVIDIA_GTX_1660_STABLE', ], }, 'gpu_webgl2_conformance_gl_passthrough_telemetry_tests': { 'variants': [ - 'LINUX_INTEL_HD_630_STABLE', + 'LINUX_INTEL_UHD_630_STABLE', 'LINUX_NVIDIA_GTX_1660_STABLE', ], }, 'gpu_webgl_conformance_gl_passthrough_telemetry_tests': { 'variants': [ - 'LINUX_INTEL_HD_630_STABLE', + 'LINUX_INTEL_UHD_630_STABLE', 'LINUX_NVIDIA_GTX_1660_STABLE', ], }, @@ -7680,7 +7680,7 @@ 'linux_optional_gpu_tests_rel_gtests': { 'gpu_gles2_conform_gtests': { 'variants': [ - 'LINUX_INTEL_HD_630_STABLE', + 'LINUX_INTEL_UHD_630_STABLE', 'LINUX_NVIDIA_GTX_1660_STABLE', ], },
diff --git a/testing/buildbot/tryserver.chromium.linux.json b/testing/buildbot/tryserver.chromium.linux.json index a83ac96..25ec78e 100644 --- a/testing/buildbot/tryserver.chromium.linux.json +++ b/testing/buildbot/tryserver.chromium.linux.json
@@ -224,13 +224,13 @@ "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "gles2_conform_test HD 630", + "name": "gles2_conform_test UHD 630", "swarming": { "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -238,7 +238,7 @@ }, "test": "gles2_conform_test", "test_id_prefix": "ninja://gpu/gles2_conform_support:gles2_conform_test/", - "variant_id": "HD 630" + "variant_id": "UHD 630" } ], "isolated_scripts": [ @@ -292,14 +292,14 @@ "--expected-vendor-id", "8086", "--expected-device-id", - "5912" + "9bc5" ], "isolate_name": "telemetry_gpu_integration_test", "merge": { "args": [], "script": "//testing/merge_scripts/standard_isolated_script_merge.py" }, - "name": "info_collection_tests HD 630", + "name": "info_collection_tests UHD 630", "resultdb": { "enable": true, "has_native_resultdb_integration": true @@ -309,8 +309,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -318,7 +318,7 @@ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/", - "variant_id": "HD 630" + "variant_id": "UHD 630" }, { "args": [ @@ -369,7 +369,7 @@ "args": [], "script": "//testing/merge_scripts/standard_isolated_script_merge.py" }, - "name": "mediapipe_passthrough_tests HD 630", + "name": "mediapipe_passthrough_tests UHD 630", "resultdb": { "enable": true, "has_native_resultdb_integration": true @@ -379,8 +379,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -388,7 +388,7 @@ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/", - "variant_id": "HD 630" + "variant_id": "UHD 630" }, { "args": [ @@ -439,7 +439,7 @@ "args": [], "script": "//testing/merge_scripts/standard_isolated_script_merge.py" }, - "name": "trace_test HD 630", + "name": "trace_test UHD 630", "resultdb": { "enable": true, "has_native_resultdb_integration": true @@ -449,8 +449,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -458,7 +458,7 @@ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/", - "variant_id": "HD 630" + "variant_id": "UHD 630" }, { "args": [ @@ -505,14 +505,14 @@ "args": [], "script": "//testing/merge_scripts/standard_isolated_script_merge.py" }, - "name": "webcodecs_tests HD 630", + "name": "webcodecs_tests UHD 630", "should_retry_with_patch": false, "swarming": { "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -520,7 +520,7 @@ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/", - "variant_id": "HD 630" + "variant_id": "UHD 630" }, { "args": [ @@ -578,7 +578,7 @@ "args": [], "script": "//testing/merge_scripts/standard_isolated_script_merge.py" }, - "name": "webgl2_conformance_gl_passthrough_tests HD 630", + "name": "webgl2_conformance_gl_passthrough_tests UHD 630", "resultdb": { "enable": true, "has_native_resultdb_integration": true @@ -588,8 +588,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -598,7 +598,7 @@ "shards": 20 }, "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/", - "variant_id": "HD 630" + "variant_id": "UHD 630" }, { "args": [ @@ -654,7 +654,7 @@ "args": [], "script": "//testing/merge_scripts/standard_isolated_script_merge.py" }, - "name": "webgl_conformance_gl_passthrough_tests HD 630", + "name": "webgl_conformance_gl_passthrough_tests UHD 630", "resultdb": { "enable": true, "has_native_resultdb_integration": true @@ -664,8 +664,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", + "gpu": "8086:9bc5-20.0.8", + "os": "Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -674,7 +674,7 @@ "shards": 2 }, "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/", - "variant_id": "HD 630" + "variant_id": "UHD 630" } ] }
diff --git a/testing/buildbot/variants.pyl b/testing/buildbot/variants.pyl index 2fb73c5..52732a30 100644 --- a/testing/buildbot/variants.pyl +++ b/testing/buildbot/variants.pyl
@@ -80,10 +80,10 @@ ], }, }, - 'LINUX_INTEL_HD_630_STABLE': { - 'identifier': 'HD 630', + 'LINUX_INTEL_UHD_630_STABLE': { + 'identifier': 'UHD 630', 'mixins': [ - 'linux_intel_hd_630_stable', + 'linux_intel_uhd_630_stable', ], }, 'LINUX_NVIDIA_GTX_1660_STABLE': { @@ -1253,4 +1253,4 @@ 'win10_nvidia_gtx_1660_stable', ], }, -} \ No newline at end of file +}
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index 9ccab1fb..b822a35 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -1356,7 +1356,7 @@ 'os_type': 'linux', 'browser_config': 'release', 'mixins': [ - 'linux_intel_hd_630_stable', + 'linux_intel_uhd_630_stable', ], 'test_suites': { 'gtest_tests': 'gpu_common_gtests_passthrough', @@ -1377,7 +1377,7 @@ 'linux-angle-intel': { 'os_type': 'linux', 'mixins': [ - 'linux_intel_hd_630_stable', + 'linux_intel_uhd_630_stable', ], 'test_suites': { 'gtest_tests': 'gpu_angle_linux_intel_gtests', @@ -2197,11 +2197,11 @@ 'machines': { 'Dawn Linux x64 Builder' : {}, 'Dawn Linux x64 DEPS Builder' : {}, - 'Dawn Linux x64 DEPS Release (Intel HD 630)': { + 'Dawn Linux x64 DEPS Release (Intel UHD 630)': { 'os_type': 'linux', 'browser_config': 'release', 'mixins': [ - 'linux_intel_hd_630_stable', + 'linux_intel_uhd_630_stable', ], 'test_suites': { 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular', @@ -2221,18 +2221,6 @@ 'isolated_scripts': 'gpu_dawn_isolated_scripts', }, }, - 'Dawn Linux x64 Release (Intel HD 630)': { - 'os_type': 'linux', - 'browser_config': 'release', - 'mixins': [ - 'linux_intel_hd_630_stable', - ], - 'test_suites': { - 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular', - 'gtest_tests': 'gpu_dawn_integration_gtests_passthrough', - 'isolated_scripts': 'gpu_dawn_isolated_scripts', - }, - }, 'Dawn Linux x64 Release (Intel UHD 630)': { 'os_type': 'linux', 'browser_config': 'release', @@ -4476,10 +4464,7 @@ 'os_type': 'lacros', 'browser_config': 'release', 'mixins': [ - # Weston does not work on Mesa 19, but works on Mesa 20. - # TODO(crbug.com/1153159): Switch to the stable mixin once 20 becomes - # the standard version. - 'linux_intel_hd_630_experimental', + 'linux_intel_uhd_630_stable', ], 'test_suites': { 'gpu_telemetry_tests': 'gpu_fyi_chromeos_release_telemetry_tests', @@ -4496,16 +4481,18 @@ 'gpu_telemetry_tests': 'gpu_fyi_linux_debug_telemetry_tests', }, }, - 'Linux FYI Experimental Release (Intel HD 630)': { + 'Linux FYI Experimental Release (Intel UHD 630)': { 'os_type': 'linux', 'browser_config': 'release', 'mixins': [ 'limited_capacity_bot', - 'linux_intel_hd_630_experimental', + 'linux_intel_uhd_630_experimental', ], + # If the experimental configuration is the same as stable, this should + # only be running 'gpu_noop_sleep_telemetry_test'. Otherwise, this + # should be running the same tests as 'Linux FYI Release (Intel UHD 630)'. 'test_suites': { - 'gtest_tests': 'gpu_fyi_linux_release_gtests', - 'gpu_telemetry_tests': 'gpu_fyi_linux_release_telemetry_tests', + 'gpu_telemetry_tests': 'gpu_noop_sleep_telemetry_test', }, }, 'Linux FYI Experimental Release (NVIDIA)': { @@ -4550,17 +4537,6 @@ 'gpu_telemetry_tests': 'gpu_fyi_linux_release_telemetry_tests', }, }, - 'Linux FYI Release (Intel HD 630)': { - 'os_type': 'linux', - 'browser_config': 'release', - 'mixins': [ - 'linux_intel_hd_630_stable', - ], - 'test_suites': { - 'gtest_tests': 'gpu_fyi_linux_release_gtests', - 'gpu_telemetry_tests': 'gpu_fyi_linux_release_vulkan_telemetry_tests', - }, - }, 'Linux FYI Release (Intel UHD 630)': { 'os_type': 'linux', 'browser_config': 'release',
diff --git a/third_party/abseil-cpp/symbols_arm64_dbg.def b/third_party/abseil-cpp/symbols_arm64_dbg.def index 865d993e..082322c 100644 --- a/third_party/abseil-cpp/symbols_arm64_dbg.def +++ b/third_party/abseil-cpp/symbols_arm64_dbg.def
@@ -518,6 +518,7 @@ ??$__do_rehash@$00@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@23@@Cr@std@@AEAAX_K@Z ??$__emplace_back_slow_path@AEAVstring_view@absl@@AEBV12@AEA_K@?$vector@UViableSubstitution@strings_internal@absl@@V?$allocator@UViableSubstitution@strings_internal@absl@@@Cr@std@@@Cr@std@@AEAAXAEAVstring_view@absl@@AEBV34@AEA_K@Z ??$__emplace_unique_key_args@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@AEBUpiecewise_construct_t@23@V?$tuple@AEBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@V?$tuple@$$V@23@@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@23@@Cr@std@@QEAA?AU?$pair@V?$__hash_iterator@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PEAX@Cr@std@@@Cr@std@@_N@12@AEBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@12@AEBUpiecewise_construct_t@12@$$QEAV?$tuple@AEBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@12@$$QEAV?$tuple@$$V@12@@Z + ??$__invoke@AEAUByCivilTime@Transition@cctz@time_internal@absl@@AEBU2345@AEBU2345@@Cr@std@@YA_NAEAUByCivilTime@Transition@cctz@time_internal@absl@@AEBU3456@1@Z ??$__invoke@AEAUByUnixTime@Transition@cctz@time_internal@absl@@AEBU2345@AEBU2345@@Cr@std@@YA_NAEAUByUnixTime@Transition@cctz@time_internal@absl@@AEBU3456@1@Z ??$__invoke@AEAU__identity@Cr@std@@AEBUTransition@cctz@time_internal@absl@@@Cr@std@@YAAEBUTransition@cctz@time_internal@absl@@AEAU__identity@01@AEBU2345@@Z ??$__launder@$$CBU?$pair@$$CBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@Cr@std@@YAPEBU?$pair@$$CBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@01@PEBU201@@Z @@ -556,8 +557,8 @@ ??$__unwrap_iter@PEAUTransitionType@cctz@time_internal@absl@@U?$__unwrap_iter_impl@PEAUTransitionType@cctz@time_internal@absl@@$00@Cr@std@@$0A@@Cr@std@@YAPEAUTransitionType@cctz@time_internal@absl@@PEAU2345@@Z ??$__unwrap_iter@PEAVFormatArgImpl@str_format_internal@absl@@U?$__unwrap_iter_impl@PEAVFormatArgImpl@str_format_internal@absl@@$00@Cr@std@@$0A@@Cr@std@@YAPEAVFormatArgImpl@str_format_internal@absl@@PEAV234@@Z ??$__unwrap_iter@PEBVFormatArgImpl@str_format_internal@absl@@U?$__unwrap_iter_impl@PEBVFormatArgImpl@str_format_internal@absl@@$00@Cr@std@@$0A@@Cr@std@@YAPEBVFormatArgImpl@str_format_internal@absl@@PEBV234@@Z - ??$__upper_bound@AEAUByCivilTime@Transition@cctz@time_internal@absl@@PEBU2345@U2345@@Cr@std@@YAPEBUTransition@cctz@time_internal@absl@@PEBU2345@0AEBU2345@AEAUByCivilTime@2345@@Z - ??$__upper_bound@AEAUByUnixTime@Transition@cctz@time_internal@absl@@PEBU2345@U2345@@Cr@std@@YAPEBUTransition@cctz@time_internal@absl@@PEBU2345@0AEBU2345@AEAUByUnixTime@2345@@Z + ??$__upper_bound@U_ClassicAlgPolicy@Cr@std@@UByCivilTime@Transition@cctz@time_internal@absl@@PEBU5678@PEBU5678@U5678@U__identity@23@@Cr@std@@YAPEBUTransition@cctz@time_internal@absl@@PEBU2345@0AEBU2345@$$QEAUByCivilTime@2345@$$QEAU__identity@01@@Z + ??$__upper_bound@U_ClassicAlgPolicy@Cr@std@@UByUnixTime@Transition@cctz@time_internal@absl@@PEBU5678@PEBU5678@U5678@U__identity@23@@Cr@std@@YAPEBUTransition@cctz@time_internal@absl@@PEBU2345@0AEBU2345@$$QEAUByUnixTime@2345@$$QEAU__identity@01@@Z ??$advance@PEBUTransition@cctz@time_internal@absl@@_J@?$_IterOps@U_ClassicAlgPolicy@Cr@std@@@Cr@std@@SAXAEAPEBUTransition@cctz@time_internal@absl@@_J@Z ??$advance@PEBUTransition@cctz@time_internal@absl@@_J_JX@Cr@std@@YAXAEAPEBUTransition@cctz@time_internal@absl@@_J@Z ??$advance@PEBVFormatArgImpl@str_format_internal@absl@@_K_KX@Cr@std@@YAXAEAPEBVFormatArgImpl@str_format_internal@absl@@_K@Z @@ -695,6 +696,8 @@ ??$move_backward@PEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@PEAPEAPEBV12345@@Cr@std@@YAPEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@PEAPEAPEBV23456@00@Z ??$move_backward@PEAUTransition@cctz@time_internal@absl@@PEAU1234@@Cr@std@@YAPEAUTransition@cctz@time_internal@absl@@PEAU2345@00@Z ??$move_backward@PEAUTransitionType@cctz@time_internal@absl@@PEAU1234@@Cr@std@@YAPEAUTransitionType@cctz@time_internal@absl@@PEAU2345@00@Z + ??$next@AEAPEBUTransition@cctz@time_internal@absl@@@?$_IterOps@U_ClassicAlgPolicy@Cr@std@@@Cr@std@@SAPEBUTransition@cctz@time_internal@absl@@AEAPEBU3456@_J@Z + ??$next@PEBUTransition@cctz@time_internal@absl@@@Cr@std@@YAPEBUTransition@cctz@time_internal@absl@@PEBU2345@_J@Z ??$reset@PEAPEAU?$__hash_node_base@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PEAX@Cr@std@@@Cr@std@@@?$unique_ptr@$$BY0A@PEAU?$__hash_node_base@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PEAX@Cr@std@@@Cr@std@@V?$__bucket_list_deallocator@V?$allocator@PEAU?$__hash_node_base@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PEAX@Cr@std@@@Cr@std@@@Cr@std@@@23@@Cr@std@@QEAAXPEAPEAU?$__hash_node_base@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PEAX@Cr@std@@@12@@Z ??$rotl@_K@absl@@YA_K_KH@Z ??$swap@PEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@YAXAEAPEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@0@Z
diff --git a/third_party/abseil-cpp/symbols_arm64_rel.def b/third_party/abseil-cpp/symbols_arm64_rel.def index a820b33..6331b56 100644 --- a/third_party/abseil-cpp/symbols_arm64_rel.def +++ b/third_party/abseil-cpp/symbols_arm64_rel.def
@@ -91,7 +91,7 @@ ??$__do_rehash@$00@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@23@@Cr@std@@AEAAX_K@Z ??$__emplace_unique_key_args@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@AEBUpiecewise_construct_t@23@V?$tuple@AEBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@V?$tuple@$$V@23@@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@23@@Cr@std@@QEAA?AU?$pair@V?$__hash_iterator@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PEAX@Cr@std@@@Cr@std@@_N@12@AEBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@12@AEBUpiecewise_construct_t@12@$$QEAV?$tuple@AEBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@12@$$QEAV?$tuple@$$V@12@@Z ??$__rehash@$00@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@23@@Cr@std@@AEAAX_K@Z - ??$__upper_bound@AEAUByCivilTime@Transition@cctz@time_internal@absl@@PEBU2345@U2345@@Cr@std@@YAPEBUTransition@cctz@time_internal@absl@@PEBU2345@0AEBU2345@AEAUByCivilTime@2345@@Z + ??$__upper_bound@U_ClassicAlgPolicy@Cr@std@@UByCivilTime@Transition@cctz@time_internal@absl@@PEBU5678@PEBU5678@U5678@U__identity@23@@Cr@std@@YAPEBUTransition@cctz@time_internal@absl@@PEBU2345@0AEBU2345@$$QEAUByCivilTime@2345@$$QEAU__identity@01@@Z ??$assign@PEBVFormatArgImpl@str_format_internal@absl@@@?$vector@VFormatArgImpl@str_format_internal@absl@@V?$allocator@VFormatArgImpl@str_format_internal@absl@@@Cr@std@@@Cr@std@@QEAAXPEBVFormatArgImpl@str_format_internal@absl@@0@Z ??$assign@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@?$optional_data_base@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@optional_internal@absl@@IEAAX$$QEAV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@Z ??$construct@UPayload@status_internal@absl@@AEBU123@@?$allocator@UPayload@status_internal@absl@@@Cr@std@@QEAAXPEAUPayload@status_internal@absl@@AEBU345@@Z
diff --git a/third_party/abseil-cpp/symbols_x64_dbg.def b/third_party/abseil-cpp/symbols_x64_dbg.def index 02d0409..4240880 100644 --- a/third_party/abseil-cpp/symbols_x64_dbg.def +++ b/third_party/abseil-cpp/symbols_x64_dbg.def
@@ -518,6 +518,7 @@ ??$__do_rehash@$00@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@23@@Cr@std@@AEAAX_K@Z ??$__emplace_back_slow_path@AEAVstring_view@absl@@AEBV12@AEA_K@?$vector@UViableSubstitution@strings_internal@absl@@V?$allocator@UViableSubstitution@strings_internal@absl@@@Cr@std@@@Cr@std@@AEAAXAEAVstring_view@absl@@AEBV34@AEA_K@Z ??$__emplace_unique_key_args@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@AEBUpiecewise_construct_t@23@V?$tuple@AEBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@V?$tuple@$$V@23@@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@23@@Cr@std@@QEAA?AU?$pair@V?$__hash_iterator@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PEAX@Cr@std@@@Cr@std@@_N@12@AEBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@12@AEBUpiecewise_construct_t@12@$$QEAV?$tuple@AEBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@12@$$QEAV?$tuple@$$V@12@@Z + ??$__invoke@AEAUByCivilTime@Transition@cctz@time_internal@absl@@AEBU2345@AEBU2345@@Cr@std@@YA_NAEAUByCivilTime@Transition@cctz@time_internal@absl@@AEBU3456@1@Z ??$__invoke@AEAUByUnixTime@Transition@cctz@time_internal@absl@@AEBU2345@AEBU2345@@Cr@std@@YA_NAEAUByUnixTime@Transition@cctz@time_internal@absl@@AEBU3456@1@Z ??$__invoke@AEAU__identity@Cr@std@@AEBUTransition@cctz@time_internal@absl@@@Cr@std@@YAAEBUTransition@cctz@time_internal@absl@@AEAU__identity@01@AEBU2345@@Z ??$__launder@$$CBU?$pair@$$CBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@Cr@std@@YAPEBU?$pair@$$CBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@01@PEBU201@@Z @@ -556,8 +557,8 @@ ??$__unwrap_iter@PEAUTransitionType@cctz@time_internal@absl@@U?$__unwrap_iter_impl@PEAUTransitionType@cctz@time_internal@absl@@$00@Cr@std@@$0A@@Cr@std@@YAPEAUTransitionType@cctz@time_internal@absl@@PEAU2345@@Z ??$__unwrap_iter@PEAVFormatArgImpl@str_format_internal@absl@@U?$__unwrap_iter_impl@PEAVFormatArgImpl@str_format_internal@absl@@$00@Cr@std@@$0A@@Cr@std@@YAPEAVFormatArgImpl@str_format_internal@absl@@PEAV234@@Z ??$__unwrap_iter@PEBVFormatArgImpl@str_format_internal@absl@@U?$__unwrap_iter_impl@PEBVFormatArgImpl@str_format_internal@absl@@$00@Cr@std@@$0A@@Cr@std@@YAPEBVFormatArgImpl@str_format_internal@absl@@PEBV234@@Z - ??$__upper_bound@AEAUByCivilTime@Transition@cctz@time_internal@absl@@PEBU2345@U2345@@Cr@std@@YAPEBUTransition@cctz@time_internal@absl@@PEBU2345@0AEBU2345@AEAUByCivilTime@2345@@Z - ??$__upper_bound@AEAUByUnixTime@Transition@cctz@time_internal@absl@@PEBU2345@U2345@@Cr@std@@YAPEBUTransition@cctz@time_internal@absl@@PEBU2345@0AEBU2345@AEAUByUnixTime@2345@@Z + ??$__upper_bound@U_ClassicAlgPolicy@Cr@std@@UByCivilTime@Transition@cctz@time_internal@absl@@PEBU5678@PEBU5678@U5678@U__identity@23@@Cr@std@@YAPEBUTransition@cctz@time_internal@absl@@PEBU2345@0AEBU2345@$$QEAUByCivilTime@2345@$$QEAU__identity@01@@Z + ??$__upper_bound@U_ClassicAlgPolicy@Cr@std@@UByUnixTime@Transition@cctz@time_internal@absl@@PEBU5678@PEBU5678@U5678@U__identity@23@@Cr@std@@YAPEBUTransition@cctz@time_internal@absl@@PEBU2345@0AEBU2345@$$QEAUByUnixTime@2345@$$QEAU__identity@01@@Z ??$advance@PEBUTransition@cctz@time_internal@absl@@_J@?$_IterOps@U_ClassicAlgPolicy@Cr@std@@@Cr@std@@SAXAEAPEBUTransition@cctz@time_internal@absl@@_J@Z ??$advance@PEBUTransition@cctz@time_internal@absl@@_J_JX@Cr@std@@YAXAEAPEBUTransition@cctz@time_internal@absl@@_J@Z ??$advance@PEBVFormatArgImpl@str_format_internal@absl@@_K_KX@Cr@std@@YAXAEAPEBVFormatArgImpl@str_format_internal@absl@@_K@Z @@ -699,6 +700,8 @@ ??$move_backward@PEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@PEAPEAPEBV12345@@Cr@std@@YAPEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@PEAPEAPEBV23456@00@Z ??$move_backward@PEAUTransition@cctz@time_internal@absl@@PEAU1234@@Cr@std@@YAPEAUTransition@cctz@time_internal@absl@@PEAU2345@00@Z ??$move_backward@PEAUTransitionType@cctz@time_internal@absl@@PEAU1234@@Cr@std@@YAPEAUTransitionType@cctz@time_internal@absl@@PEAU2345@00@Z + ??$next@AEAPEBUTransition@cctz@time_internal@absl@@@?$_IterOps@U_ClassicAlgPolicy@Cr@std@@@Cr@std@@SAPEBUTransition@cctz@time_internal@absl@@AEAPEBU3456@_J@Z + ??$next@PEBUTransition@cctz@time_internal@absl@@@Cr@std@@YAPEBUTransition@cctz@time_internal@absl@@PEBU2345@_J@Z ??$reset@PEAPEAU?$__hash_node_base@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PEAX@Cr@std@@@Cr@std@@@?$unique_ptr@$$BY0A@PEAU?$__hash_node_base@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PEAX@Cr@std@@@Cr@std@@V?$__bucket_list_deallocator@V?$allocator@PEAU?$__hash_node_base@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PEAX@Cr@std@@@Cr@std@@@Cr@std@@@23@@Cr@std@@QEAAXPEAPEAU?$__hash_node_base@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PEAX@Cr@std@@@12@@Z ??$swap@PEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@YAXAEAPEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@0@Z ??$swap@PEAPEAVCordzHandle@cord_internal@absl@@@Cr@std@@YAXAEAPEAPEAVCordzHandle@cord_internal@absl@@0@Z
diff --git a/third_party/abseil-cpp/symbols_x64_rel.def b/third_party/abseil-cpp/symbols_x64_rel.def index a974eaa4..f262bd6 100644 --- a/third_party/abseil-cpp/symbols_x64_rel.def +++ b/third_party/abseil-cpp/symbols_x64_rel.def
@@ -84,7 +84,7 @@ ??$__push_back_slow_path@AEBUTransition@cctz@time_internal@absl@@@?$vector@UTransition@cctz@time_internal@absl@@V?$allocator@UTransition@cctz@time_internal@absl@@@Cr@std@@@Cr@std@@AEAAXAEBUTransition@cctz@time_internal@absl@@@Z ??$__push_back_slow_path@UConversionItem@ParsedFormatBase@str_format_internal@absl@@@?$vector@UConversionItem@ParsedFormatBase@str_format_internal@absl@@V?$allocator@UConversionItem@ParsedFormatBase@str_format_internal@absl@@@Cr@std@@@Cr@std@@AEAAX$$QEAUConversionItem@ParsedFormatBase@str_format_internal@absl@@@Z ??$__rehash@$00@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@23@@Cr@std@@AEAAX_K@Z - ??$__upper_bound@AEAUByCivilTime@Transition@cctz@time_internal@absl@@PEBU2345@U2345@@Cr@std@@YAPEBUTransition@cctz@time_internal@absl@@PEBU2345@0AEBU2345@AEAUByCivilTime@2345@@Z + ??$__upper_bound@U_ClassicAlgPolicy@Cr@std@@UByCivilTime@Transition@cctz@time_internal@absl@@PEBU5678@PEBU5678@U5678@U__identity@23@@Cr@std@@YAPEBUTransition@cctz@time_internal@absl@@PEBU2345@0AEBU2345@$$QEAUByCivilTime@2345@$$QEAU__identity@01@@Z ??$assign@PEBVFormatArgImpl@str_format_internal@absl@@@?$vector@VFormatArgImpl@str_format_internal@absl@@V?$allocator@VFormatArgImpl@str_format_internal@absl@@@Cr@std@@@Cr@std@@QEAAXPEBVFormatArgImpl@str_format_internal@absl@@0@Z ??$assign@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@?$optional_data_base@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@optional_internal@absl@@IEAAX$$QEAV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@Z ??$construct@UPayload@status_internal@absl@@AEBU123@@?$allocator@UPayload@status_internal@absl@@@Cr@std@@QEAAXPEAUPayload@status_internal@absl@@AEBU345@@Z
diff --git a/third_party/abseil-cpp/symbols_x64_rel_asan.def b/third_party/abseil-cpp/symbols_x64_rel_asan.def index 283f463..77c099f 100644 --- a/third_party/abseil-cpp/symbols_x64_rel_asan.def +++ b/third_party/abseil-cpp/symbols_x64_rel_asan.def
@@ -81,7 +81,7 @@ ??$__do_rehash@$00@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@23@@Cr@std@@AEAAX_K@Z ??$__emplace_unique_key_args@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@AEBUpiecewise_construct_t@23@V?$tuple@AEBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@V?$tuple@$$V@23@@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@23@@Cr@std@@QEAA?AU?$pair@V?$__hash_iterator@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PEAX@Cr@std@@@Cr@std@@_N@12@AEBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@12@AEBUpiecewise_construct_t@12@$$QEAV?$tuple@AEBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@12@$$QEAV?$tuple@$$V@12@@Z ??$__rehash@$00@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@23@@Cr@std@@AEAAX_K@Z - ??$__upper_bound@AEAUByCivilTime@Transition@cctz@time_internal@absl@@PEBU2345@U2345@@Cr@std@@YAPEBUTransition@cctz@time_internal@absl@@PEBU2345@0AEBU2345@AEAUByCivilTime@2345@@Z + ??$__upper_bound@U_ClassicAlgPolicy@Cr@std@@UByCivilTime@Transition@cctz@time_internal@absl@@PEBU5678@PEBU5678@U5678@U__identity@23@@Cr@std@@YAPEBUTransition@cctz@time_internal@absl@@PEBU2345@0AEBU2345@$$QEAUByCivilTime@2345@$$QEAU__identity@01@@Z ??$assign@PEBVFormatArgImpl@str_format_internal@absl@@@?$vector@VFormatArgImpl@str_format_internal@absl@@V?$allocator@VFormatArgImpl@str_format_internal@absl@@@Cr@std@@@Cr@std@@QEAAXPEBVFormatArgImpl@str_format_internal@absl@@0@Z ??$assign@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@?$optional_data_base@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@optional_internal@absl@@IEAAX$$QEAV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@Z ??$construct@UPayload@status_internal@absl@@AEBU123@@?$allocator@UPayload@status_internal@absl@@@Cr@std@@QEAAXPEAUPayload@status_internal@absl@@AEBU345@@Z
diff --git a/third_party/abseil-cpp/symbols_x86_dbg.def b/third_party/abseil-cpp/symbols_x86_dbg.def index 1baebba..5cdaa20 100644 --- a/third_party/abseil-cpp/symbols_x86_dbg.def +++ b/third_party/abseil-cpp/symbols_x86_dbg.def
@@ -516,6 +516,7 @@ ??$__do_rehash@$00@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@23@@Cr@std@@AAEXI@Z ??$__emplace_back_slow_path@AAVstring_view@absl@@ABV12@AAI@?$vector@UViableSubstitution@strings_internal@absl@@V?$allocator@UViableSubstitution@strings_internal@absl@@@Cr@std@@@Cr@std@@AAEXAAVstring_view@absl@@ABV34@AAI@Z ??$__emplace_unique_key_args@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@ABUpiecewise_construct_t@23@V?$tuple@ABV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@V?$tuple@$$V@23@@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@23@@Cr@std@@QAE?AU?$pair@V?$__hash_iterator@PAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PAX@Cr@std@@@Cr@std@@_N@12@ABV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@12@ABUpiecewise_construct_t@12@$$QAV?$tuple@ABV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@12@$$QAV?$tuple@$$V@12@@Z + ??$__invoke@AAUByCivilTime@Transition@cctz@time_internal@absl@@ABU2345@ABU2345@@Cr@std@@YA_NAAUByCivilTime@Transition@cctz@time_internal@absl@@ABU3456@1@Z ??$__invoke@AAUByUnixTime@Transition@cctz@time_internal@absl@@ABU2345@ABU2345@@Cr@std@@YA_NAAUByUnixTime@Transition@cctz@time_internal@absl@@ABU3456@1@Z ??$__invoke@AAU__identity@Cr@std@@ABUTransition@cctz@time_internal@absl@@@Cr@std@@YAABUTransition@cctz@time_internal@absl@@AAU__identity@01@ABU2345@@Z ??$__launder@$$CBU?$pair@$$CBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@Cr@std@@YAPBU?$pair@$$CBV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@01@PBU201@@Z @@ -554,8 +555,8 @@ ??$__unwrap_iter@PAUTransitionType@cctz@time_internal@absl@@U?$__unwrap_iter_impl@PAUTransitionType@cctz@time_internal@absl@@$00@Cr@std@@$0A@@Cr@std@@YAPAUTransitionType@cctz@time_internal@absl@@PAU2345@@Z ??$__unwrap_iter@PAVFormatArgImpl@str_format_internal@absl@@U?$__unwrap_iter_impl@PAVFormatArgImpl@str_format_internal@absl@@$00@Cr@std@@$0A@@Cr@std@@YAPAVFormatArgImpl@str_format_internal@absl@@PAV234@@Z ??$__unwrap_iter@PBVFormatArgImpl@str_format_internal@absl@@U?$__unwrap_iter_impl@PBVFormatArgImpl@str_format_internal@absl@@$00@Cr@std@@$0A@@Cr@std@@YAPBVFormatArgImpl@str_format_internal@absl@@PBV234@@Z - ??$__upper_bound@AAUByCivilTime@Transition@cctz@time_internal@absl@@PBU2345@U2345@@Cr@std@@YAPBUTransition@cctz@time_internal@absl@@PBU2345@0ABU2345@AAUByCivilTime@2345@@Z - ??$__upper_bound@AAUByUnixTime@Transition@cctz@time_internal@absl@@PBU2345@U2345@@Cr@std@@YAPBUTransition@cctz@time_internal@absl@@PBU2345@0ABU2345@AAUByUnixTime@2345@@Z + ??$__upper_bound@U_ClassicAlgPolicy@Cr@std@@UByCivilTime@Transition@cctz@time_internal@absl@@PBU5678@PBU5678@U5678@U__identity@23@@Cr@std@@YAPBUTransition@cctz@time_internal@absl@@PBU2345@0ABU2345@$$QAUByCivilTime@2345@$$QAU__identity@01@@Z + ??$__upper_bound@U_ClassicAlgPolicy@Cr@std@@UByUnixTime@Transition@cctz@time_internal@absl@@PBU5678@PBU5678@U5678@U__identity@23@@Cr@std@@YAPBUTransition@cctz@time_internal@absl@@PBU2345@0ABU2345@$$QAUByUnixTime@2345@$$QAU__identity@01@@Z ??$advance@PBUTransition@cctz@time_internal@absl@@H@?$_IterOps@U_ClassicAlgPolicy@Cr@std@@@Cr@std@@SAXAAPBUTransition@cctz@time_internal@absl@@H@Z ??$advance@PBUTransition@cctz@time_internal@absl@@HHX@Cr@std@@YAXAAPBUTransition@cctz@time_internal@absl@@H@Z ??$advance@PBVFormatArgImpl@str_format_internal@absl@@IIX@Cr@std@@YAXAAPBVFormatArgImpl@str_format_internal@absl@@I@Z @@ -694,6 +695,8 @@ ??$move_backward@PAPAPBVImpl@time_zone@cctz@time_internal@absl@@PAPAPBV12345@@Cr@std@@YAPAPAPBVImpl@time_zone@cctz@time_internal@absl@@PAPAPBV23456@00@Z ??$move_backward@PAUTransition@cctz@time_internal@absl@@PAU1234@@Cr@std@@YAPAUTransition@cctz@time_internal@absl@@PAU2345@00@Z ??$move_backward@PAUTransitionType@cctz@time_internal@absl@@PAU1234@@Cr@std@@YAPAUTransitionType@cctz@time_internal@absl@@PAU2345@00@Z + ??$next@AAPBUTransition@cctz@time_internal@absl@@@?$_IterOps@U_ClassicAlgPolicy@Cr@std@@@Cr@std@@SAPBUTransition@cctz@time_internal@absl@@AAPBU3456@H@Z + ??$next@PBUTransition@cctz@time_internal@absl@@@Cr@std@@YAPBUTransition@cctz@time_internal@absl@@PBU2345@H@Z ??$reset@PAPAU?$__hash_node_base@PAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PAX@Cr@std@@@Cr@std@@@?$unique_ptr@$$BY0A@PAU?$__hash_node_base@PAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PAX@Cr@std@@@Cr@std@@V?$__bucket_list_deallocator@V?$allocator@PAU?$__hash_node_base@PAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PAX@Cr@std@@@Cr@std@@@Cr@std@@@23@@Cr@std@@QAEXPAPAU?$__hash_node_base@PAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PAX@Cr@std@@@12@@Z ??$swap@PAPAPBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@YAXAAPAPAPBVImpl@time_zone@cctz@time_internal@absl@@0@Z ??$swap@PAPAVCordzHandle@cord_internal@absl@@@Cr@std@@YAXAAPAPAVCordzHandle@cord_internal@absl@@0@Z
diff --git a/third_party/abseil-cpp/symbols_x86_rel.def b/third_party/abseil-cpp/symbols_x86_rel.def index 588b493..899f441 100644 --- a/third_party/abseil-cpp/symbols_x86_rel.def +++ b/third_party/abseil-cpp/symbols_x86_rel.def
@@ -89,7 +89,7 @@ ??$__do_rehash@$00@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@23@@Cr@std@@AAEXI@Z ??$__emplace_unique_key_args@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@ABUpiecewise_construct_t@23@V?$tuple@ABV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@V?$tuple@$$V@23@@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@23@@Cr@std@@QAE?AU?$pair@V?$__hash_iterator@PAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@PAX@Cr@std@@@Cr@std@@_N@12@ABV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@12@ABUpiecewise_construct_t@12@$$QAV?$tuple@ABV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@12@$$QAV?$tuple@$$V@12@@Z ??$__rehash@$00@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@23@@Cr@std@@AAEXI@Z - ??$__upper_bound@AAUByCivilTime@Transition@cctz@time_internal@absl@@PBU2345@U2345@@Cr@std@@YAPBUTransition@cctz@time_internal@absl@@PBU2345@0ABU2345@AAUByCivilTime@2345@@Z + ??$__upper_bound@U_ClassicAlgPolicy@Cr@std@@UByCivilTime@Transition@cctz@time_internal@absl@@PBU5678@PBU5678@U5678@U__identity@23@@Cr@std@@YAPBUTransition@cctz@time_internal@absl@@PBU2345@0ABU2345@$$QAUByCivilTime@2345@$$QAU__identity@01@@Z ??$assign@PBVFormatArgImpl@str_format_internal@absl@@@?$vector@VFormatArgImpl@str_format_internal@absl@@V?$allocator@VFormatArgImpl@str_format_internal@absl@@@Cr@std@@@Cr@std@@QAEXPBVFormatArgImpl@str_format_internal@absl@@0@Z ??$assign@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@?$optional_data_base@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@optional_internal@absl@@IAEX$$QAV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@Z ??$construct@UPayload@status_internal@absl@@ABU123@@?$allocator@UPayload@status_internal@absl@@@Cr@std@@QAEXPAUPayload@status_internal@absl@@ABU345@@Z
diff --git a/third_party/blink/common/frame/frame_ad_evidence.cc b/third_party/blink/common/frame/frame_ad_evidence.cc index cc19fe5..d7a55549 100644 --- a/third_party/blink/common/frame/frame_ad_evidence.cc +++ b/third_party/blink/common/frame/frame_ad_evidence.cc
@@ -21,7 +21,7 @@ FrameAdEvidence::~FrameAdEvidence() = default; -bool FrameAdEvidence::IndicatesAdSubframe() const { +bool FrameAdEvidence::IndicatesAdFrame() const { DCHECK(is_complete_); // We tag a frame as an ad if its parent is one, it was created by ad script
diff --git a/third_party/blink/common/frame/from_ad_state.cc b/third_party/blink/common/frame/from_ad_state.cc index a6337ab..899807de 100644 --- a/third_party/blink/common/frame/from_ad_state.cc +++ b/third_party/blink/common/frame/from_ad_state.cc
@@ -6,12 +6,14 @@ namespace blink { -FromAdState GetFromAdState(bool is_ad_subframe, bool is_ad_script_in_stack) { - return is_ad_subframe +FromAdState GetFromAdState(bool is_ad_frame, bool is_ad_script_in_stack) { + // clang-format off + return is_ad_frame ? is_ad_script_in_stack ? FromAdState::kAdScriptAndAdFrame : FromAdState::kNonAdScriptAndAdFrame : is_ad_script_in_stack ? FromAdState::kAdScriptAndNonAdFrame : FromAdState::kNonAdScriptAndNonAdFrame; + // clang-format on } } // namespace blink
diff --git a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc index 5678f23..a910d7b 100644 --- a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc +++ b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
@@ -217,6 +217,8 @@ out->always_show_focus = data.always_show_focus(); out->touch_drag_drop_enabled = data.touch_drag_drop_enabled(); out->webxr_immersive_ar_allowed = data.webxr_immersive_ar_allowed(); + out->renderer_wide_named_frame_lookup = + data.renderer_wide_named_frame_lookup(); return true; }
diff --git a/third_party/blink/public/common/frame/frame_ad_evidence.h b/third_party/blink/public/common/frame/frame_ad_evidence.h index 57412d2..3aaca254 100644 --- a/third_party/blink/public/common/frame/frame_ad_evidence.h +++ b/third_party/blink/public/common/frame/frame_ad_evidence.h
@@ -18,7 +18,7 @@ mojom::FilterListResult a, mojom::FilterListResult b); -// Enumeration of evidence for or against a subframe being an ad. +// Enumeration of evidence for or against a frame being an ad. class BLINK_COMMON_EXPORT FrameAdEvidence { public: explicit FrameAdEvidence(bool parent_is_ad = false); @@ -27,9 +27,9 @@ ~FrameAdEvidence(); - // Returns whether the fields indicate that the corresponding subframe is an - // ad or not. Should only be called once `is_complete()`. - bool IndicatesAdSubframe() const; + // Returns whether the fields indicate that the corresponding frame is an ad + // or not. Should only be called once `is_complete()`. + bool IndicatesAdFrame() const; // Indicates whether the fields on the class are ready to be used for // calculation. If false, some fields might represent defaults rather than the
diff --git a/third_party/blink/public/common/frame/from_ad_state.h b/third_party/blink/public/common/frame/from_ad_state.h index 4fbd474..27c39be 100644 --- a/third_party/blink/public/common/frame/from_ad_state.h +++ b/third_party/blink/public/common/frame/from_ad_state.h
@@ -22,9 +22,9 @@ kMaxValue = kNonAdScriptAndNonAdFrame, }; -// Returns the FromAdState corresponded to the cross product of |is_ad_subframe| +// Returns the FromAdState corresponded to the cross product of |is_ad_frame| // and |is_ad_script_in_stack|. -FromAdState BLINK_COMMON_EXPORT GetFromAdState(bool is_ad_subframe, +FromAdState BLINK_COMMON_EXPORT GetFromAdState(bool is_ad_frame, bool is_ad_script_in_stack); } // namespace blink
diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h index 31d17a20..33ca0140 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences.h +++ b/third_party/blink/public/common/web_preferences/web_preferences.h
@@ -352,6 +352,11 @@ // change depending on the enterprise policy if the platform supports it. bool webxr_immersive_ar_allowed = true; + // Whether lookup of frames in the associated WebView (e.g. lookup via + // window.open or via <a target=...>) should be renderer-wide (i.e. going + // beyond the usual opener-relationship-based BrowsingInstance boundaries). + bool renderer_wide_named_frame_lookup = false; + // We try to keep the default values the same as the default values in // chrome, except for the cases where it would require lots of extra work for // the embedder to use the same default value.
diff --git a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h index bbe2e8f..d4c86ca 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h +++ b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
@@ -758,6 +758,11 @@ return r.webxr_immersive_ar_allowed; } + static bool renderer_wide_named_frame_lookup( + const blink::web_pref::WebPreferences& r) { + return r.renderer_wide_named_frame_lookup; + } + static bool Read(blink::mojom::WebPreferencesDataView r, blink::web_pref::WebPreferences* out); };
diff --git a/third_party/blink/public/mojom/frame/frame.mojom b/third_party/blink/public/mojom/frame/frame.mojom index 904c9c4..dcb3e2b 100644 --- a/third_party/blink/public/mojom/frame/frame.mojom +++ b/third_party/blink/public/mojom/frame/frame.mojom
@@ -1061,7 +1061,7 @@ // Update the replicated ad status. Used when the frame is tagged or untagged // as an ad frame by Ad Tagging. - SetReplicatedIsAdSubframe(bool is_ad_subframe); + SetReplicatedIsAdFrame(bool is_ad_frame); // Sets the replicated name and unique name for the frame. Used when the // name of a frame changes.
diff --git a/third_party/blink/public/mojom/frame/frame_replication_state.mojom b/third_party/blink/public/mojom/frame/frame_replication_state.mojom index 774781d..b319285a 100644 --- a/third_party/blink/public/mojom/frame/frame_replication_state.mojom +++ b/third_party/blink/public/mojom/frame/frame_replication_state.mojom
@@ -103,5 +103,5 @@ bool has_received_user_gesture_before_nav = false; // Whether this frame is an ad frame. - bool is_ad_subframe = false; + bool is_ad_frame = false; };
diff --git a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom index 973e7f9..4638c6cf 100644 --- a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom +++ b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
@@ -437,4 +437,9 @@ // Controls whether WebXR's immersive-ar is allowed. bool webxr_immersive_ar_allowed; + + // Whether lookup of frames in the associated WebView (e.g. lookup via + // window.open or via <a target=...>) should be renderer-wide (i.e. going + // beyond the usual opener-relationship-based BrowsingInstance boundaries). + bool renderer_wide_named_frame_lookup; };
diff --git a/third_party/blink/public/web/web_frame.h b/third_party/blink/public/web/web_frame.h index 10a8a957..4c01b392 100644 --- a/third_party/blink/public/web/web_frame.h +++ b/third_party/blink/public/web/web_frame.h
@@ -170,7 +170,7 @@ // True if the frame is thought (heuristically) to be created for // advertising purposes. - virtual bool IsAdSubframe() const = 0; + virtual bool IsAdFrame() const = 0; // Utility -------------------------------------------------------------
diff --git a/third_party/blink/public/web/web_local_frame.h b/third_party/blink/public/web/web_local_frame.h index 3e225e11f..8c82414 100644 --- a/third_party/blink/public/web/web_local_frame.h +++ b/third_party/blink/public/web/web_local_frame.h
@@ -803,7 +803,7 @@ // True if the frame is thought (heuristically) to be created for // advertising purposes. - bool IsAdSubframe() const override = 0; + bool IsAdFrame() const override = 0; // See blink::LocalFrame::SetAdEvidence() virtual void SetAdEvidence(const blink::FrameAdEvidence& ad_evidence) = 0; @@ -817,9 +817,9 @@ virtual bool IsAdScriptInStack() const = 0; // True iff a script tagged as an ad was on the v8 stack when the frame was - // created and the frame is a subframe. This is not currently propagated when - // a frame navigates cross-origin. - virtual bool IsSubframeCreatedByAdScript() = 0; + // created. This is not currently propagated when a frame navigates + // cross-origin. + virtual bool IsFrameCreatedByAdScript() = 0; // User activation -----------------------------------------------------------
diff --git a/third_party/blink/public/web/web_remote_frame.h b/third_party/blink/public/web/web_remote_frame.h index 26f65b0e..4203d629 100644 --- a/third_party/blink/public/web/web_remote_frame.h +++ b/third_party/blink/public/web/web_remote_frame.h
@@ -118,7 +118,7 @@ // True if the frame is thought (heuristically) to be created for // advertising purposes. - bool IsAdSubframe() const override = 0; + bool IsAdFrame() const override = 0; protected: explicit WebRemoteFrame(mojom::TreeScopeType scope,
diff --git a/third_party/blink/renderer/controller/oom_intervention_impl.cc b/third_party/blink/renderer/controller/oom_intervention_impl.cc index 32fde92c..b91df565 100644 --- a/third_party/blink/renderer/controller/oom_intervention_impl.cc +++ b/third_party/blink/renderer/controller/oom_intervention_impl.cc
@@ -68,7 +68,7 @@ for (Frame* child = frame->Tree().FirstChild(); child; child = child->Tree().TraverseNext(frame)) { if (auto* child_local_frame = DynamicTo<LocalFrame>(child)) { - if (child_local_frame->IsAdSubframe()) { + if (child_local_frame->IsAdFrame()) { FrameLoadRequest request(frame->DomWindow(), ResourceRequest(BlankURL())); child_local_frame->Navigate(request, WebFrameLoadType::kStandard);
diff --git a/third_party/blink/renderer/controller/oom_intervention_impl_test.cc b/third_party/blink/renderer/controller/oom_intervention_impl_test.cc index 0933dedd..8142d92 100644 --- a/third_party/blink/renderer/controller/oom_intervention_impl_test.cc +++ b/third_party/blink/renderer/controller/oom_intervention_impl_test.cc
@@ -311,8 +311,8 @@ auto* local_non_adframe = To<LocalFrame>(WebFrame::ToCoreFrame(*non_ad_iframe)); - EXPECT_TRUE(local_adframe->IsAdSubframe()); - EXPECT_FALSE(local_non_adframe->IsAdSubframe()); + EXPECT_TRUE(local_adframe->IsAdFrame()); + EXPECT_FALSE(local_non_adframe->IsAdFrame()); EXPECT_EQ(local_adframe->GetDocument()->Url().GetString(), "data:text/html,"); EXPECT_EQ(local_non_adframe->GetDocument()->Url().GetString(), "data:text/html,");
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index 7cb69046..5cea268 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc
@@ -8153,7 +8153,7 @@ WebFeature uma_type; bool sandboxed = dom_window_->IsSandboxed( network::mojom::blink::WebSandboxFlags::kNavigation); - bool ad = GetFrame()->IsAdSubframe(); + bool ad = GetFrame()->IsAdFrame(); if (sandboxed) { uma_type = ad ? WebFeature::kFocusWithoutUserActivationSandboxedAdFrame : WebFeature::kFocusWithoutUserActivationSandboxedNotAdFrame;
diff --git a/third_party/blink/renderer/core/dom/events/event_dispatcher.cc b/third_party/blink/renderer/core/dom/events/event_dispatcher.cc index 1e87c33f..f68d422 100644 --- a/third_party/blink/renderer/core/dom/events/event_dispatcher.cc +++ b/third_party/blink/renderer/core/dom/events/event_dispatcher.cc
@@ -217,7 +217,7 @@ // there are any script in the stack. DCHECK(!frame->GetAdTracker() || !frame->GetAdTracker()->IsAdScriptInStack( AdTracker::StackType::kBottomAndTop)); - if (frame->IsAdSubframe()) { + if (frame->IsAdFrame()) { UseCounter::Count(node_->GetDocument(), WebFeature::kAdClick); } }
diff --git a/third_party/blink/renderer/core/frame/ad_tracker.cc b/third_party/blink/renderer/core/frame/ad_tracker.cc index f637eff..0a066ec 100644 --- a/third_party/blink/renderer/core/frame/ad_tracker.cc +++ b/third_party/blink/renderer/core/frame/ad_tracker.cc
@@ -33,7 +33,7 @@ // TODO(jkarlin): Do the same check for worker contexts. if (auto* window = DynamicTo<LocalDOMWindow>(execution_context)) { LocalFrame* frame = window->GetFrame(); - if (frame && frame->IsAdSubframe()) + if (frame && frame->IsAdFrame()) return true; } return false;
diff --git a/third_party/blink/renderer/core/frame/ad_tracker_test.cc b/third_party/blink/renderer/core/frame/ad_tracker_test.cc index e47e224..bea2b68c 100644 --- a/third_party/blink/renderer/core/frame/ad_tracker_test.cc +++ b/third_party/blink/renderer/core/frame/ad_tracker_test.cc
@@ -173,10 +173,10 @@ String url_to_wait_for_; }; -void SetIsAdSubframe(LocalFrame* frame) { +void SetIsAdFrame(LocalFrame* frame) { DCHECK(frame); blink::FrameAdEvidence ad_evidence(frame->Parent() && - frame->Parent()->IsAdSubframe()); + frame->Parent()->IsAdFrame()); ad_evidence.set_created_by_ad_script( mojom::FrameCreationStackEvidence::kCreatedByAdScript); ad_evidence.set_is_complete(); @@ -582,7 +582,7 @@ main_resource_->Complete("<body><iframe></iframe></body>"); auto* child_frame = To<LocalFrame>(GetDocument().GetFrame()->Tree().FirstChild()); - SetIsAdSubframe(child_frame); + SetIsAdFrame(child_frame); // Now run unknown script in the child's context. It should be considered an // ad based on context alone. @@ -670,7 +670,7 @@ "<body><iframe src='ad_frame.html'></iframe></body>"); auto* child_frame = To<LocalFrame>(GetDocument().GetFrame()->Tree().FirstChild()); - SetIsAdSubframe(child_frame); + SetIsAdFrame(child_frame); // Load a resource from the frame. It should be detected as an ad resource due // to its context. @@ -708,8 +708,8 @@ // Verify that the new frame is considered created by ad script then set it // as an ad subframe. This emulates the embedder tagging a frame as an ad. - EXPECT_TRUE(child_frame->IsSubframeCreatedByAdScript()); - SetIsAdSubframe(child_frame); + EXPECT_TRUE(child_frame->IsFrameCreatedByAdScript()); + SetIsAdFrame(child_frame); // Create a new sibling frame to the ad frame. The ad context calls the non-ad // context's (top frame) appendChild. @@ -724,7 +724,7 @@ // The new sibling frame should also be identified as created by ad script. EXPECT_TRUE( To<LocalFrame>(GetDocument().GetFrame()->Tree().ScopedChild("ad_sibling")) - ->IsSubframeCreatedByAdScript()); + ->IsFrameCreatedByAdScript()); } // Image loaded by ad script is tagged as ad. @@ -903,8 +903,8 @@ // Verify that the new frame is considered created by ad script then set it // as an ad subframe. This emulates the SubresourceFilterAgent's tagging. - EXPECT_TRUE(child_frame->IsSubframeCreatedByAdScript()); - SetIsAdSubframe(child_frame); + EXPECT_TRUE(child_frame->IsFrameCreatedByAdScript()); + SetIsAdFrame(child_frame); vanilla_page.Complete("<img src=vanilla_img.jpg></img>"); vanilla_image.Complete(""); @@ -978,7 +978,7 @@ auto* subframe = To<LocalFrame>(GetDocument().GetFrame()->Tree().FirstChild()); - EXPECT_TRUE(subframe->IsSubframeCreatedByAdScript()); + EXPECT_TRUE(subframe->IsFrameCreatedByAdScript()); } TEST_F(AdTrackerSimTest, SameOriginDocWrittenSubframeFromAdScript) { @@ -1003,7 +1003,7 @@ auto* subframe = To<LocalFrame>(GetDocument().GetFrame()->Tree().FirstChild()); - EXPECT_TRUE(subframe->IsSubframeCreatedByAdScript()); + EXPECT_TRUE(subframe->IsFrameCreatedByAdScript()); } // This test class allows easy running of tests that only differ by whether @@ -1126,7 +1126,7 @@ if (IsAdRun()) { auto* subframe = To<LocalFrame>(GetDocument().GetFrame()->Tree().FirstChild()); - SetIsAdSubframe(subframe); + SetIsAdFrame(subframe); } frame.Complete(kPageWithVanillaExternalStylesheet); @@ -1209,7 +1209,7 @@ if (IsAdRun()) { auto* subframe = To<LocalFrame>(GetDocument().GetFrame()->Tree().FirstChild()); - SetIsAdSubframe(subframe); + SetIsAdFrame(subframe); } frame.Complete(kPageWithStyleTagLoadingVanillaResources); @@ -1674,7 +1674,7 @@ TEST_F(AdTrackerDisabledSimTest, VerifyAdTrackingDisabled) { main_resource_->Complete("<body></body>"); EXPECT_FALSE(GetDocument().GetFrame()->GetAdTracker()); - EXPECT_FALSE(GetDocument().GetFrame()->IsAdSubframe()); + EXPECT_FALSE(GetDocument().GetFrame()->IsAdFrame()); } INSTANTIATE_TEST_SUITE_P(All,
diff --git a/third_party/blink/renderer/core/frame/frame.h b/third_party/blink/renderer/core/frame/frame.h index 109c963..fb54732 100644 --- a/third_party/blink/renderer/core/frame/frame.h +++ b/third_party/blink/renderer/core/frame/frame.h
@@ -270,9 +270,9 @@ return lifecycle_.GetState() == FrameLifecycle::kDetached; } - // Whether the frame is considered to be an ad subframe by Ad Tagging. Returns - // true for both root and child ad subframes. - virtual bool IsAdSubframe() const = 0; + // Whether the frame is considered to be an ad frame by Ad Tagging. Returns + // true for both root and child ad frames. + virtual bool IsAdFrame() const = 0; // Called to make a frame inert or non-inert. A frame is inert when there // is a modal dialog displayed within an ancestor frame, and this frame
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc index 2af8ade..71d0779 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -379,7 +379,7 @@ // the frame owner. DCHECK(!view_); DCHECK(!frame_color_overlay_); - if (IsAdSubframe()) + if (IsAdFrame()) InstanceCounters::DecrementCounter(InstanceCounters::kAdSubframeCounter); } @@ -1568,7 +1568,7 @@ absl::optional<AdScriptIdentifier> ad_script_on_stack; // See SubresourceFilterAgent::Initialize for why we don't set this here for // fenced frames. - is_subframe_created_by_ad_script_ = + is_frame_created_by_ad_script_ = !IsMainFrame() && ad_tracker_ && ad_tracker_->IsAdScriptInStack(AdTracker::StackType::kBottomAndTop, /*out_ad_script=*/&ad_script_on_stack); @@ -2249,23 +2249,23 @@ return Owner()->ContentFrame() != this; } -bool LocalFrame::IsAdSubframe() const { - return ad_evidence_ && ad_evidence_->IndicatesAdSubframe(); +bool LocalFrame::IsAdFrame() const { + return ad_evidence_ && ad_evidence_->IndicatesAdFrame(); } bool LocalFrame::IsAdRoot() const { - return IsAdSubframe() && !ad_evidence_->parent_is_ad(); + return IsAdFrame() && !ad_evidence_->parent_is_ad(); } void LocalFrame::SetAdEvidence(const blink::FrameAdEvidence& ad_evidence) { DCHECK(!IsMainFrame() || IsInFencedFrameTree()); DCHECK(ad_evidence.is_complete()); - // Once set, `is_subframe_created_by_ad_script_` should not be unset. - DCHECK(!is_subframe_created_by_ad_script_ || + // Once set, `is_frame_created_by_ad_script_` should not be unset. + DCHECK(!is_frame_created_by_ad_script_ || ad_evidence.created_by_ad_script() == blink::mojom::FrameCreationStackEvidence::kCreatedByAdScript); - is_subframe_created_by_ad_script_ = + is_frame_created_by_ad_script_ = ad_evidence.created_by_ad_script() == blink::mojom::FrameCreationStackEvidence::kCreatedByAdScript; @@ -2281,11 +2281,11 @@ ad_evidence.most_restrictive_filter_list_result()); } - bool was_ad_subframe = IsAdSubframe(); - bool is_ad_subframe = ad_evidence.IndicatesAdSubframe(); + bool was_ad_frame = IsAdFrame(); + bool is_ad_frame = ad_evidence.IndicatesAdFrame(); ad_evidence_ = ad_evidence; - if (was_ad_subframe == is_ad_subframe) + if (was_ad_frame == is_ad_frame) return; if (auto* document = GetDocument()) { @@ -2294,13 +2294,13 @@ // of sending an IPC. auto* document_resource_coordinator = document->GetResourceCoordinator(); if (document_resource_coordinator) - document_resource_coordinator->SetIsAdFrame(is_ad_subframe); + document_resource_coordinator->SetIsAdFrame(is_ad_frame); } UpdateAdHighlight(); - frame_scheduler_->SetIsAdFrame(is_ad_subframe); + frame_scheduler_->SetIsAdFrame(is_ad_frame); - if (is_ad_subframe) { + if (is_ad_frame) { UseCounter::Count(DomWindow(), WebFeature::kAdFrameDetected); InstanceCounters::IncrementCounter(InstanceCounters::kAdSubframeCounter); } else { @@ -2649,7 +2649,7 @@ } void LocalFrame::MaybeLogAdClickNavigation() { - if (HasTransientUserActivation(this) && IsAdSubframe()) + if (HasTransientUserActivation(this) && IsAdFrame()) UseCounter::Count(GetDocument(), WebFeature::kAdClickNavigation); }
diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h index e247e08..640c1da 100644 --- a/third_party/blink/renderer/core/frame/local_frame.h +++ b/third_party/blink/renderer/core/frame/local_frame.h
@@ -216,7 +216,7 @@ void SetIsInert(bool) override; void SetInheritedEffectiveTouchAction(TouchAction) override; void DidFocus() override; - bool IsAdSubframe() const override; + bool IsAdFrame() const override; // BackForwardCacheLoaderHelperImpl::Delegate: void EvictFromBackForwardCache( @@ -536,7 +536,7 @@ // be removed. bool IsProvisional() const; - // Whether the frame is considered to be a root ad subframe by Ad Tagging. + // Whether the frame is considered to be a root ad frame by Ad Tagging. bool IsAdRoot() const; // Called by the embedder on creation of the initial empty document and, for @@ -548,14 +548,14 @@ bool IsAdScriptInStack() const; // The evidence for or against a frame being an ad. `absl::nullopt` if not yet - // set or if the frame is a top-level frame as only subframes can be tagged as - // ads. + // set or if the frame is a subfiltering root frame (outermost main frame or + // portal) as only child frames can be tagged as ads. const absl::optional<blink::FrameAdEvidence>& AdEvidence() const { return ad_evidence_; } - bool IsSubframeCreatedByAdScript() const { - return is_subframe_created_by_ad_script_; + bool IsFrameCreatedByAdScript() const { + return is_frame_created_by_ad_script_; } // Updates the frame color overlay to match the highlight ad setting. @@ -968,22 +968,22 @@ #endif // The evidence for or against a frame being an ad frame. `absl::nullopt` if - // not yet set or if the frame is a top-level frame. (Only subframes can be - // tagged as ad frames.) This is per-frame (as opposed to per-document) as we - // want to decide whether a frame is an ad or not before commit, while the - // document has not yet been created. + // not yet set or if the frame is a subfiltering root frame. (Only non-root + // frames can be tagged as ad frames.) This is per-frame (as opposed to + // per-document) as we want to decide whether a frame is an ad or not before + // commit, while the document has not yet been created. // // This is constructed directly in the renderer in the case of an initial // synchronous commit and otherwise is signaled from the browser process at // ready-to-commit time. absl::optional<blink::FrameAdEvidence> ad_evidence_; - // True if this frame is a subframe that had a script tagged as an ad on the - // v8 stack at the time of creation. This is updated in `SetAdEvidence()`, + // True if this frame is a frame that had a script tagged as an ad on the v8 + // stack at the time of creation. This is updated in `SetAdEvidence()`, // allowing the bit to be propagated when a frame navigates cross-origin. // Fenced frames do not set this bit for the initial empty document, see // SubresourceFilterAgent::Initialize. - bool is_subframe_created_by_ad_script_ = false; + bool is_frame_created_by_ad_script_ = false; bool evict_cached_session_storage_on_freeze_or_unload_ = false;
diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc index 7cbb31dd..d6684c3e 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc +++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
@@ -593,7 +593,7 @@ navigation_info->initiator_frame_has_download_sandbox_flag = origin_window->IsSandboxed( network::mojom::blink::WebSandboxFlags::kDownloads); - navigation_info->initiator_frame_is_ad = frame->IsAdSubframe(); + navigation_info->initiator_frame_is_ad = frame->IsAdFrame(); } // The frame has navigated either by itself or by the action of the
diff --git a/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.h b/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.h index 399bb6e..c78c4fd2 100644 --- a/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.h +++ b/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.h
@@ -28,7 +28,7 @@ enum class DocumentUpdateReason; -// This class aggregaties and records time based UKM and UMA metrics +// This class aggregates and records time based UKM and UMA metrics // for LocalFrameView. The simplest way to use it is via the // SCOPED_UMA_AND_UKM_TIMER macro combined with // LocalFrameView::RecordEndOfFrameMetrics.
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.cc b/third_party/blink/renderer/core/frame/local_frame_view.cc index d22a8596..6e074c3 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.cc +++ b/third_party/blink/renderer/core/frame/local_frame_view.cc
@@ -2865,6 +2865,10 @@ DCHECK(GetFrame().IsLocalRoot()); + absl::optional<MobileFriendlinessChecker::PaintScope> mf_scope; + if (mobile_friendliness_checker_) + mf_scope.emplace(*mobile_friendliness_checker_); + auto* layout_view = GetLayoutView(); DCHECK(layout_view);
diff --git a/third_party/blink/renderer/core/frame/remote_frame.cc b/third_party/blink/renderer/core/frame/remote_frame.cc index 5d1ef16..ec69891 100644 --- a/third_party/blink/renderer/core/frame/remote_frame.cc +++ b/third_party/blink/renderer/core/frame/remote_frame.cc
@@ -228,7 +228,7 @@ window->IsSandboxed(network::mojom::blink::WebSandboxFlags::kDownloads); if (window->GetFrame()) { is_opener_navigation = window->GetFrame()->Opener() == this; - initiator_frame_is_ad = window->GetFrame()->IsAdSubframe(); + initiator_frame_is_ad = window->GetFrame()->IsAdFrame(); if (frame_request.ClientRedirectReason() != ClientNavigationReason::kNone) { probe::FrameRequestedNavigation(window->GetFrame(), this, url, frame_request.ClientRedirectReason(), @@ -592,12 +592,12 @@ } } -bool RemoteFrame::IsAdSubframe() const { - return is_ad_subframe_; +bool RemoteFrame::IsAdFrame() const { + return is_ad_frame_; } -void RemoteFrame::SetReplicatedIsAdSubframe(bool is_ad_subframe) { - is_ad_subframe_ = is_ad_subframe; +void RemoteFrame::SetReplicatedIsAdFrame(bool is_ad_frame) { + is_ad_frame_ = is_ad_frame; } void RemoteFrame::SetReplicatedName(const String& name,
diff --git a/third_party/blink/renderer/core/frame/remote_frame.h b/third_party/blink/renderer/core/frame/remote_frame.h index 47da0d6b..8884647c 100644 --- a/third_party/blink/renderer/core/frame/remote_frame.h +++ b/third_party/blink/renderer/core/frame/remote_frame.h
@@ -82,7 +82,7 @@ void DidFocus() override; void AddResourceTimingFromChild( mojom::blink::ResourceTimingInfoPtr timing) override; - bool IsAdSubframe() const override; + bool IsAdFrame() const override; // ChildFrameCompositor: const scoped_refptr<cc::Layer>& GetCcLayer() override; @@ -155,7 +155,7 @@ void SetReplicatedOrigin( const scoped_refptr<const SecurityOrigin>& origin, bool is_potentially_trustworthy_unique_origin) override; - void SetReplicatedIsAdSubframe(bool is_ad_subframe) override; + void SetReplicatedIsAdFrame(bool is_ad_frame) override; void SetReplicatedName(const String& name, const String& unique_name) override; void DispatchLoadEventForFrameOwner() override; @@ -278,8 +278,8 @@ // Will be nullptr when this RemoteFrame's parent is not a LocalFrame. std::unique_ptr<ChildFrameCompositingHelper> compositing_helper_; - // Whether the frame is considered to be an ad subframe by Ad Tagging. - bool is_ad_subframe_; + // Whether the frame is considered to be an ad frame by Ad Tagging. + bool is_ad_frame_; mojo::AssociatedRemote<mojom::blink::RemoteFrameHost> remote_frame_host_remote_;
diff --git a/third_party/blink/renderer/core/frame/visual_viewport.cc b/third_party/blink/renderer/core/frame/visual_viewport.cc index b33fc5b..34ed2aa 100644 --- a/third_party/blink/renderer/core/frame/visual_viewport.cc +++ b/third_party/blink/renderer/core/frame/visual_viewport.cc
@@ -817,6 +817,10 @@ } ScrollOffset VisualViewport::MaximumScrollOffset() const { + return MaximumScrollOffsetAtScale(scale_); +} + +ScrollOffset VisualViewport::MaximumScrollOffsetAtScale(float scale) const { if (!IsActiveViewport()) return ScrollOffset(); @@ -830,14 +834,14 @@ frame_view_size.Enlarge(0, browser_controls_adjustment_ / min_scale); } - frame_view_size.Scale(scale_); + frame_view_size.Scale(scale); frame_view_size = gfx::SizeF(ToFlooredSize(frame_view_size)); gfx::SizeF viewport_size(size_); viewport_size.Enlarge(0, ceilf(browser_controls_adjustment_)); gfx::SizeF max_position = frame_view_size - viewport_size; - max_position.Scale(1 / scale_); + max_position.Scale(1 / scale); return ScrollOffset(max_position.width(), max_position.height()); }
diff --git a/third_party/blink/renderer/core/frame/visual_viewport.h b/third_party/blink/renderer/core/frame/visual_viewport.h index c3c2a09..49ef3647 100644 --- a/third_party/blink/renderer/core/frame/visual_viewport.h +++ b/third_party/blink/renderer/core/frame/visual_viewport.h
@@ -212,6 +212,7 @@ gfx::Vector2d MinimumScrollOffsetInt() const override; gfx::Vector2d MaximumScrollOffsetInt() const override; ScrollOffset MaximumScrollOffset() const override; + ScrollOffset MaximumScrollOffsetAtScale(float scale) const; // Note: Because scrollbars are conceptually owned by the LayoutView, // ContentsSize includes the main frame's scrollbars. This is necessary for // correct cc Layer sizing.
diff --git a/third_party/blink/renderer/core/frame/visual_viewport_test.cc b/third_party/blink/renderer/core/frame/visual_viewport_test.cc index 5f7a6369f..dc9db2aa 100644 --- a/third_party/blink/renderer/core/frame/visual_viewport_test.cc +++ b/third_party/blink/renderer/core/frame/visual_viewport_test.cc
@@ -1836,6 +1836,28 @@ scrollable_area->MaximumScrollOffset()); } +// Tests that the scroll offset is consistent when scale specified. +TEST_P(VisualViewportTest, MaxScrollOffsetAtScale) { + InitializeWithDesktopSettings(); + WebView()->MainFrameViewWidget()->Resize(gfx::Size(101, 201)); + NavigateTo("about:blank"); + + VisualViewport& visual_viewport = GetFrame()->GetPage()->GetVisualViewport(); + + WebView()->SetPageScaleFactor(0.1); + EXPECT_EQ(ScrollOffset(), visual_viewport.MaximumScrollOffsetAtScale(1.0)); + + WebView()->SetPageScaleFactor(2); + EXPECT_EQ(ScrollOffset(), visual_viewport.MaximumScrollOffsetAtScale(1.0)); + + WebView()->SetPageScaleFactor(5); + EXPECT_EQ(ScrollOffset(), visual_viewport.MaximumScrollOffsetAtScale(1.0)); + + WebView()->SetPageScaleFactor(10); + EXPECT_EQ(ScrollOffset(101. / 2., 201. / 2.), + visual_viewport.MaximumScrollOffsetAtScale(2.0)); +} + // Tests that the slow scrolling after an impl scroll on the visual viewport is // continuous. crbug.com/453460 was caused by the impl-path not updating the // ScrollAnimatorBase class.
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 3d2468f..0a60fc7 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
@@ -917,9 +917,9 @@ DOMWindowPerformance::performance(*(GetFrame()->DomWindow()))); } -bool WebLocalFrameImpl::IsAdSubframe() const { +bool WebLocalFrameImpl::IsAdFrame() const { DCHECK(GetFrame()); - return GetFrame()->IsAdSubframe(); + return GetFrame()->IsAdFrame(); } bool WebLocalFrameImpl::IsAdScriptInStack() const { @@ -938,9 +938,9 @@ return GetFrame()->AdEvidence(); } -bool WebLocalFrameImpl::IsSubframeCreatedByAdScript() { +bool WebLocalFrameImpl::IsFrameCreatedByAdScript() { DCHECK(GetFrame()); - return GetFrame()->IsSubframeCreatedByAdScript(); + return GetFrame()->IsFrameCreatedByAdScript(); } void WebLocalFrameImpl::ExecuteScript(const WebScriptSource& source) {
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.h b/third_party/blink/renderer/core/frame/web_local_frame_impl.h index c7c0c74..34aa9f59 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
@@ -309,11 +309,11 @@ bool skip_accelerated_content) override; bool ShouldSuppressKeyboardForFocusedElement() override; WebPerformance Performance() const override; - bool IsAdSubframe() const override; + bool IsAdFrame() const override; bool IsAdScriptInStack() const override; void SetAdEvidence(const blink::FrameAdEvidence& ad_evidence) override; const absl::optional<blink::FrameAdEvidence>& AdEvidence() override; - bool IsSubframeCreatedByAdScript() override; + bool IsFrameCreatedByAdScript() override; gfx::Size SpoolSizeInPixelsForTesting(const gfx::Size& page_size_in_pixels, uint32_t page_count) override; void PrintPagesForTesting(cc::PaintCanvas*,
diff --git a/third_party/blink/renderer/core/frame/web_remote_frame_impl.cc b/third_party/blink/renderer/core/frame/web_remote_frame_impl.cc index 4ba4269..19b8e29c 100644 --- a/third_party/blink/renderer/core/frame/web_remote_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_remote_frame_impl.cc
@@ -380,8 +380,8 @@ return GetFrame()->GetPendingVisualPropertiesForTesting(); } -bool WebRemoteFrameImpl::IsAdSubframe() const { - return GetFrame()->IsAdSubframe(); +bool WebRemoteFrameImpl::IsAdFrame() const { + return GetFrame()->IsAdFrame(); } WebRemoteFrameImpl::WebRemoteFrameImpl(mojom::blink::TreeScopeType scope, @@ -424,7 +424,7 @@ blink::WebString::FromUTF8(state->unique_name)); remote_frame->SetInsecureRequestPolicy(state->insecure_request_policy); remote_frame->SetInsecureNavigationsSet(state->insecure_navigations_set); - remote_frame->SetReplicatedIsAdSubframe(state->is_ad_subframe); + remote_frame->SetReplicatedIsAdFrame(state->is_ad_frame); remote_frame->SetReplicatedPermissionsPolicyHeader( state->permissions_policy_header); if (state->has_active_user_gesture) {
diff --git a/third_party/blink/renderer/core/frame/web_remote_frame_impl.h b/third_party/blink/renderer/core/frame/web_remote_frame_impl.h index f905ba73..1d717cc1 100644 --- a/third_party/blink/renderer/core/frame/web_remote_frame_impl.h +++ b/third_party/blink/renderer/core/frame/web_remote_frame_impl.h
@@ -88,7 +88,7 @@ WebString UniqueName() const override; const FrameVisualProperties& GetPendingVisualPropertiesForTesting() const override; - bool IsAdSubframe() const override; + bool IsAdFrame() const override; void InitializeCoreFrame( Page&, FrameOwner*,
diff --git a/third_party/blink/renderer/core/html/html_anchor_element.cc b/third_party/blink/renderer/core/html/html_anchor_element.cc index 5e2dc06..9541f96 100644 --- a/third_party/blink/renderer/core/html/html_anchor_element.cc +++ b/third_party/blink/renderer/core/html/html_anchor_element.cc
@@ -83,7 +83,7 @@ if (!has_gesture) { UseCounter::Count(document, WebFeature::kDownloadWithoutUserGesture); } - if (frame->IsAdSubframe()) { + if (frame->IsAdFrame()) { UseCounter::Count(document, WebFeature::kDownloadInAdFrame); if (!has_gesture) { UseCounter::Count(document,
diff --git a/third_party/blink/renderer/core/html/html_frame_owner_element.cc b/third_party/blink/renderer/core/html/html_frame_owner_element.cc index 936ce2c..2a73c32d 100644 --- a/third_party/blink/renderer/core/html/html_frame_owner_element.cc +++ b/third_party/blink/renderer/core/html/html_frame_owner_element.cc
@@ -910,7 +910,7 @@ if (!content_frame_) return false; - return content_frame_->IsAdSubframe(); + return content_frame_->IsAdFrame(); } bool HTMLFrameOwnerElement::IsEligibleForLazyAds(const KURL& url) {
diff --git a/third_party/blink/renderer/core/html/parser/html_document_parser.cc b/third_party/blink/renderer/core/html/parser/html_document_parser.cc index fc55208..509be3d6 100644 --- a/third_party/blink/renderer/core/html/parser/html_document_parser.cc +++ b/third_party/blink/renderer/core/html/parser/html_document_parser.cc
@@ -747,7 +747,8 @@ CheckIfBlockingStylesheetAdded(); } -HTMLDocumentParser::NextTokenStatus HTMLDocumentParser::CanTakeNextToken() { +HTMLDocumentParser::NextTokenStatus HTMLDocumentParser::CanTakeNextToken( + base::TimeDelta& time_executing_script) { if (IsStopped()) return kNoTokens; @@ -755,8 +756,10 @@ // continuing. auto ret = kHaveTokens; if (tree_builder_->HasParserBlockingScript()) { + base::ElapsedTimer timer; RunScriptsForPausedTreeBuilder(); ret = kHaveTokensAfterScript; + time_executing_script += timer.Elapsed(); } if (IsStopped() || IsPaused()) return kNoTokens; @@ -812,13 +815,14 @@ if (TimedParserBudgetEnabled()) timed_budget = GetTimedBudget(task_runner_state_->TimesYielded()); - base::ElapsedTimer chunk_parsing_timer_; + base::ElapsedTimer chunk_parsing_timer; unsigned tokens_parsed = 0; + base::TimeDelta time_executing_script; while (!should_yield) { if (task_runner_state_->ShouldProcessPreloads()) FlushPendingPreloads(); - const auto next_token_status = CanTakeNextToken(); + const auto next_token_status = CanTakeNextToken(time_executing_script); if (next_token_status == kNoTokens) { // No tokens left to process in this pump, so break break; @@ -829,7 +833,7 @@ // mode. So reduce the budget back to at most the default. budget = std::min(budget, kDefaultMaxTokenizationBudget); if (TimedParserBudgetEnabled()) { - timed_budget = std::min(timed_budget, chunk_parsing_timer_.Elapsed() + + timed_budget = std::min(timed_budget, chunk_parsing_timer.Elapsed() + GetDefaultTimedBudget()); } } @@ -849,7 +853,7 @@ if (!should_run_until_completion && !IsPaused()) { DCHECK_EQ(task_runner_state_->GetMode(), kAllowDeferredParsing); if (TimedParserBudgetEnabled()) - should_yield = chunk_parsing_timer_.Elapsed() >= timed_budget; + should_yield = chunk_parsing_timer.Elapsed() >= timed_budget; else should_yield = budget <= 0; should_yield |= scheduler_->ShouldYieldForHighPriorityWork(); @@ -871,18 +875,24 @@ starting_bytes - input_.length()); } - if (IsStopped() || IsParsingFragment()) { - if (metrics_reporter_ && tokens_parsed) { - metrics_reporter_->AddChunk(chunk_parsing_timer_.Elapsed(), - tokens_parsed); - } - return false; + const bool is_stopped_or_parsing_fragment = + IsStopped() || IsParsingFragment(); + + if (!is_stopped_or_parsing_fragment) { + // There should only be PendingText left since the tree-builder always + // flushes the task queue before returning. In case that ever changes, + // crash. + tree_builder_->Flush(kFlushAlways); + CHECK(!IsStopped()); } - // There should only be PendingText left since the tree-builder always flushes - // the task queue before returning. In case that ever changes, crash. - tree_builder_->Flush(kFlushAlways); - CHECK(!IsStopped()); + if (tokens_parsed && metrics_reporter_) { + metrics_reporter_->AddChunk( + chunk_parsing_timer.Elapsed() - time_executing_script, tokens_parsed); + } + + if (is_stopped_or_parsing_fragment) + return false; if (IsPaused()) { DCHECK_EQ(tokenizer_->GetState(), HTMLTokenizer::kDataState); @@ -897,10 +907,6 @@ } } - if (metrics_reporter_ && tokens_parsed) { - metrics_reporter_->AddChunk(chunk_parsing_timer_.Elapsed(), tokens_parsed); - } - // should_run_until_completion implies that we should not yield CHECK(!should_run_until_completion || !should_yield); if (should_yield)
diff --git a/third_party/blink/renderer/core/html/parser/html_document_parser.h b/third_party/blink/renderer/core/html/parser/html_document_parser.h index 04b14d56..66deb72 100644 --- a/third_party/blink/renderer/core/html/parser/html_document_parser.h +++ b/third_party/blink/renderer/core/html/parser/html_document_parser.h
@@ -169,7 +169,10 @@ } void AppendCurrentInputStreamToPreloadScannerAndScan() final; - NextTokenStatus CanTakeNextToken(); + // This function may end up running script. If it does, + // `time_executing_script` is incremented by the amount of time it takes to + // execute script. + NextTokenStatus CanTakeNextToken(base::TimeDelta& time_executing_script); bool PumpTokenizer(); void PumpTokenizerIfPossible(); void DeferredPumpTokenizerIfPossible();
diff --git a/third_party/blink/renderer/core/html/parser/html_parser_metrics.cc b/third_party/blink/renderer/core/html/parser/html_parser_metrics.cc index d98b3b6..30583d7 100644 --- a/third_party/blink/renderer/core/html/parser/html_parser_metrics.cc +++ b/third_party/blink/renderer/core/html/parser/html_parser_metrics.cc
@@ -45,19 +45,19 @@ } void HTMLParserMetrics::AddInput(unsigned length) { - input_character_count += length; + input_character_count_ += length; } void HTMLParserMetrics::ReportUMAs() { UMA_HISTOGRAM_COUNTS_1000("Blink.HTMLParsing.ChunkCount2", chunk_count_); UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES( - "Blink.HTMLParsing.ParsingTimeMax2", max_parsing_time_, + "Blink.HTMLParsing.ParsingTimeMax3", max_parsing_time_, base::Microseconds(1), base::Seconds(100), 1000); UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES( - "Blink.HTMLParsing.ParsingTimeMin2", min_parsing_time_, + "Blink.HTMLParsing.ParsingTimeMin3", min_parsing_time_, base::Microseconds(1), base::Seconds(1), 100); UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES( - "Blink.HTMLParsing.ParsingTimeTotal2", accumulated_parsing_time_, + "Blink.HTMLParsing.ParsingTimeTotal3", accumulated_parsing_time_, base::Microseconds(1), base::Seconds(100), 1000); UMA_HISTOGRAM_COUNTS_1M("Blink.HTMLParsing.TokensParsedMax2", max_tokens_parsed_); @@ -83,7 +83,7 @@ } UMA_HISTOGRAM_COUNTS_10M("Blink.HTMLParsing.InputCharacterCount", - input_character_count); + input_character_count_); } void HTMLParserMetrics::ReportMetricsAtParseEnd() {
diff --git a/third_party/blink/renderer/core/html/parser/html_parser_metrics.h b/third_party/blink/renderer/core/html/parser/html_parser_metrics.h index a8297dc..93a6fbc 100644 --- a/third_party/blink/renderer/core/html/parser/html_parser_metrics.h +++ b/third_party/blink/renderer/core/html/parser/html_parser_metrics.h
@@ -56,7 +56,7 @@ // Track total number of characters parsed in one instantiation of the // parser. - unsigned input_character_count = 0; + unsigned input_character_count_ = 0; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/html/parser/html_parser_metrics_test.cc b/third_party/blink/renderer/core/html/parser/html_parser_metrics_test.cc index 3e0400b..a6d9457 100644 --- a/third_party/blink/renderer/core/html/parser/html_parser_metrics_test.cc +++ b/third_party/blink/renderer/core/html/parser/html_parser_metrics_test.cc
@@ -67,9 +67,9 @@ // Should have one of each metric, except the yield times because with // a single chunk they should not report. histogram_tester.ExpectTotalCount("Blink.HTMLParsing.ChunkCount2", 1); - histogram_tester.ExpectTotalCount("Blink.HTMLParsing.ParsingTimeMax2", 1); - histogram_tester.ExpectTotalCount("Blink.HTMLParsing.ParsingTimeMin2", 1); - histogram_tester.ExpectTotalCount("Blink.HTMLParsing.ParsingTimeTotal2", 1); + histogram_tester.ExpectTotalCount("Blink.HTMLParsing.ParsingTimeMax3", 1); + histogram_tester.ExpectTotalCount("Blink.HTMLParsing.ParsingTimeMin3", 1); + histogram_tester.ExpectTotalCount("Blink.HTMLParsing.ParsingTimeTotal3", 1); histogram_tester.ExpectTotalCount("Blink.HTMLParsing.TokensParsedMax2", 1); histogram_tester.ExpectTotalCount("Blink.HTMLParsing.TokensParsedMin2", 1); histogram_tester.ExpectTotalCount("Blink.HTMLParsing.TokensParsedAverage2", @@ -93,11 +93,11 @@ // Expect that the times have moved from the default and the max and min // and total are all the same (within the same bucket) std::vector<base::Bucket> parsing_time_max_buckets = - histogram_tester.GetAllSamples("Blink.HTMLParsing.ParsingTimeMax2"); + histogram_tester.GetAllSamples("Blink.HTMLParsing.ParsingTimeMax3"); std::vector<base::Bucket> parsing_time_min_buckets = - histogram_tester.GetAllSamples("Blink.HTMLParsing.ParsingTimeMin2"); + histogram_tester.GetAllSamples("Blink.HTMLParsing.ParsingTimeMin3"); std::vector<base::Bucket> parsing_time_total_buckets = - histogram_tester.GetAllSamples("Blink.HTMLParsing.ParsingTimeTotal2"); + histogram_tester.GetAllSamples("Blink.HTMLParsing.ParsingTimeTotal3"); EXPECT_EQ(parsing_time_max_buckets.size(), 1u); EXPECT_EQ(parsing_time_min_buckets.size(), 1u); EXPECT_EQ(parsing_time_total_buckets.size(), 1u); @@ -159,9 +159,9 @@ // Should have one of each metric. histogram_tester.ExpectTotalCount("Blink.HTMLParsing.ChunkCount2", 1); - histogram_tester.ExpectTotalCount("Blink.HTMLParsing.ParsingTimeMax2", 1); - histogram_tester.ExpectTotalCount("Blink.HTMLParsing.ParsingTimeMin2", 1); - histogram_tester.ExpectTotalCount("Blink.HTMLParsing.ParsingTimeTotal2", 1); + histogram_tester.ExpectTotalCount("Blink.HTMLParsing.ParsingTimeMax3", 1); + histogram_tester.ExpectTotalCount("Blink.HTMLParsing.ParsingTimeMin3", 1); + histogram_tester.ExpectTotalCount("Blink.HTMLParsing.ParsingTimeTotal3", 1); histogram_tester.ExpectTotalCount("Blink.HTMLParsing.TokensParsedMax2", 1); histogram_tester.ExpectTotalCount("Blink.HTMLParsing.TokensParsedMin2", 1); histogram_tester.ExpectTotalCount("Blink.HTMLParsing.TokensParsedAverage2", @@ -184,11 +184,11 @@ // For parse times, expect that the times have moved from the default. std::vector<base::Bucket> parsing_time_max_buckets = - histogram_tester.GetAllSamples("Blink.HTMLParsing.ParsingTimeMax2"); + histogram_tester.GetAllSamples("Blink.HTMLParsing.ParsingTimeMax3"); std::vector<base::Bucket> parsing_time_min_buckets = - histogram_tester.GetAllSamples("Blink.HTMLParsing.ParsingTimeMin2"); + histogram_tester.GetAllSamples("Blink.HTMLParsing.ParsingTimeMin3"); std::vector<base::Bucket> parsing_time_total_buckets = - histogram_tester.GetAllSamples("Blink.HTMLParsing.ParsingTimeTotal2"); + histogram_tester.GetAllSamples("Blink.HTMLParsing.ParsingTimeTotal3"); EXPECT_EQ(parsing_time_max_buckets.size(), 1u); EXPECT_EQ(parsing_time_min_buckets.size(), 1u); EXPECT_EQ(parsing_time_total_buckets.size(), 1u);
diff --git a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc index 707c297..8d54254c 100644 --- a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc
@@ -1340,7 +1340,7 @@ protocol::Page::AdFrameType BuildAdFrameType(LocalFrame* frame) { if (frame->IsAdRoot()) return protocol::Page::AdFrameTypeEnum::Root; - if (frame->IsAdSubframe()) + if (frame->IsAdFrame()) return protocol::Page::AdFrameTypeEnum::Child; return protocol::Page::AdFrameTypeEnum::None; }
diff --git a/third_party/blink/renderer/core/layout/layout_text.cc b/third_party/blink/renderer/core/layout/layout_text.cc index 5c33864..dafcef15 100644 --- a/third_party/blink/renderer/core/layout/layout_text.cc +++ b/third_party/blink/renderer/core/layout/layout_text.cc
@@ -1856,57 +1856,6 @@ } } -LayoutUnit LayoutText::PhysicalAreaSize() const { - NOT_DESTROYED(); - // This is not accurate when |this| starts or ends at the middle of a line, - // but we prefer performance over accuracy. - if (IsInLayoutNGInlineFormattingContext()) { - NGInlineCursor cursor; - cursor.MoveTo(*this); - if (!cursor) - return LayoutUnit(0); - PhysicalRect rect = cursor.Current().RectInContainerFragment(); - cursor.MoveToLastForSameLayoutObject(); - rect.Unite(cursor.Current().RectInContainerFragment()); - return rect.Width() * rect.Height(); - } - - if (const auto* first_text_box = FirstTextBox()) { - if (const auto* last_text_box = LastTextBox()) { - LayoutUnit width = - std::max(first_text_box->LogicalRight(), - last_text_box->LogicalRight()) - - std::min(first_text_box->LogicalLeft(), last_text_box->LogicalLeft()); - LayoutUnit height = - last_text_box->LogicalBottom() - first_text_box->LogicalTop(); - return width * height; - } - } - return LayoutUnit(0); -} - -LayoutUnit LayoutText::PhysicalRightOffset() const { - NOT_DESTROYED(); - // This is not accurate when |this| starts or ends at the middle of a line, - // but we prefer performance over accuracy. - if (IsInLayoutNGInlineFormattingContext()) { - NGInlineCursor cursor; - cursor.MoveTo(*this); - if (!cursor) - return LayoutUnit(0); - PhysicalRect rect = cursor.Current().RectInContainerFragment(); - return rect.offset.left + rect.size.width; - } - - if (const auto* first_text_box = FirstTextBox()) { - if (const auto* last_text_box = LastTextBox()) { - return std::max(first_text_box->FrameRect().MaxX(), - last_text_box->FrameRect().MaxX()); - } - } - return LayoutUnit(0); -} - bool LayoutText::CanOptimizeSetText() const { NOT_DESTROYED(); // If we have only one line of text and "contain: layout size" we can avoid
diff --git a/third_party/blink/renderer/core/layout/layout_text.h b/third_party/blink/renderer/core/layout/layout_text.h index e345f6941..33c0afe 100644 --- a/third_party/blink/renderer/core/layout/layout_text.h +++ b/third_party/blink/renderer/core/layout/layout_text.h
@@ -420,12 +420,6 @@ void LogicalStartingPointAndHeight(LogicalOffset& logical_starting_point, LayoutUnit& logical_height) const; - // Returns the size of area occupied by this LayoutText. - LayoutUnit PhysicalAreaSize() const; - - // Returns the rightmost offset occupied by this LayoutText. - LayoutUnit PhysicalRightOffset() const; - // For LayoutShiftTracker. Saves the value of LogicalStartingPoint() value // during the previous paint invalidation. LogicalOffset PreviousLogicalStartingPoint() const {
diff --git a/third_party/blink/renderer/core/loader/document_loader.cc b/third_party/blink/renderer/core/loader/document_loader.cc index a64f523..bc69428 100644 --- a/third_party/blink/renderer/core/loader/document_loader.cc +++ b/third_party/blink/renderer/core/loader/document_loader.cc
@@ -1861,7 +1861,7 @@ if (response_.IsLegacyTLSVersion()) { GetFrameLoader().ReportLegacyTLSVersion(response_.CurrentRequestUrl(), false /* is_subresource */, - frame_->IsAdSubframe()); + frame_->IsAdFrame()); } }
diff --git a/third_party/blink/renderer/core/loader/subresource_filter.cc b/third_party/blink/renderer/core/loader/subresource_filter.cc index 01ed0bd8..4e062be5 100644 --- a/third_party/blink/renderer/core/loader/subresource_filter.cc +++ b/third_party/blink/renderer/core/loader/subresource_filter.cc
@@ -47,7 +47,7 @@ // associated with an ad subframe. if (auto* window = DynamicTo<LocalDOMWindow>(execution_context_.Get())) { auto* frame = window->GetFrame(); - if (frame->IsAdSubframe()) { + if (frame->IsAdFrame()) { ReportAdRequestId( frame->Loader().GetDocumentLoader()->GetResponse().RequestId()); }
diff --git a/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.cc b/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.cc index 65a92618..82e93a9 100644 --- a/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.cc +++ b/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.cc
@@ -20,6 +20,9 @@ #include "third_party/blink/renderer/core/html/html_anchor_element.h" #include "third_party/blink/renderer/core/html/html_image_element.h" #include "third_party/blink/renderer/core/layout/adjust_for_absolute_zoom.h" +#include "third_party/blink/renderer/core/layout/geometry/physical_offset.h" +#include "third_party/blink/renderer/core/layout/geometry/physical_rect.h" +#include "third_party/blink/renderer/core/layout/geometry/physical_size.h" #include "third_party/blink/renderer/core/layout/layout_image.h" #include "third_party/blink/renderer/core/layout/layout_object.h" #include "third_party/blink/renderer/core/layout/layout_view.h" @@ -64,9 +67,18 @@ MobileFriendlinessChecker::~MobileFriendlinessChecker() = default; -void MobileFriendlinessChecker::NotifyPaint() { +void MobileFriendlinessChecker::NotifyPaintBegin() { DCHECK(frame_view_->GetFrame().Client()->IsLocalFrameClientImpl()); DCHECK(frame_view_->GetFrame().IsOutermostMainFrame()); + + ignore_beyond_viewport_scope_count_ = + frame_view_->LayoutViewport()->MaximumScrollOffset().x() == 0 && + frame_view_->GetPage() + ->GetVisualViewport() + .MaximumScrollOffsetAtScale(initial_scale_) + .x() == 0; + is_painting_ = true; + if (timer_.IsActive() || base::TimeTicks::Now() - last_evaluated_ < kEvaluationInterval) { return; @@ -75,6 +87,13 @@ timer_.StartOneShot(kEvaluationDelay, FROM_HERE); } +void MobileFriendlinessChecker::NotifyPaintEnd() { + DCHECK(frame_view_->GetFrame().Client()->IsLocalFrameClientImpl()); + DCHECK(frame_view_->GetFrame().IsOutermostMainFrame()); + ignore_beyond_viewport_scope_count_ = 0; + is_painting_ = false; +} + void MobileFriendlinessChecker::WillBeRemovedFromFrame() { timer_.Stop(); } @@ -380,6 +399,24 @@ } // namespace +MobileFriendlinessChecker* MobileFriendlinessChecker::From( + const Document& document) { + DCHECK(document.GetFrame()); + + auto* local_frame = DynamicTo<LocalFrame>(document.GetFrame()->Top()); + if (local_frame == nullptr) + return nullptr; + + MobileFriendlinessChecker* mfc = + local_frame->View()->GetMobileFriendlinessChecker(); + if (!mfc || !mfc->is_painting_) + return nullptr; + + DCHECK_EQ(DocumentLifecycle::kInPaint, document.Lifecycle().GetState()); + DCHECK(!document.IsPrintingOrPaintingPreview()); + return mfc; +} + // Counts and calculate ration of bad tap targets. The process is a surface scan // with region tracking by Fenwick tree. The detail of the algorithm is // go/bad-tap-target-ukm @@ -472,10 +509,12 @@ .viewport_initial_scale_x10 = viewport_initial_scale_x10_, .viewport_hardcoded_width = viewport_hardcoded_width_, .allow_user_zoom = allow_user_zoom_, - .small_text_ratio = text_area_sizes_.SmallTextRatio(), + .small_text_ratio = area_sizes_.SmallTextRatio(), .text_content_outside_viewport_percentage = - ComputeContentOutsideViewport(), + area_sizes_.TextContentsOutsideViewportPercentage( + frame_view_->GetPage()->GetVisualViewport().Size().GetArea()), .bad_tap_targets_ratio = ComputeBadTapTargetsRatio()}); + last_evaluated_ = base::TimeTicks::Now(); } @@ -513,61 +552,68 @@ } } -int MobileFriendlinessChecker::TextAreaWithFontSize::SmallTextRatio() const { +int MobileFriendlinessChecker::AreaSizes::SmallTextRatio() const { if (total_text_area == 0) return 0; return small_font_area * 100 / total_text_area; } -void MobileFriendlinessChecker::NotifyInvalidatePaint( - const LayoutObject& object) { +int MobileFriendlinessChecker::AreaSizes::TextContentsOutsideViewportPercentage( + int viewport_area) const { + return std::ceil(content_beyond_viewport_area * 100 / viewport_area); +} + +void MobileFriendlinessChecker::UpdateTextAreaSizes( + const PhysicalRect& text_rect, + int font_size) { + double actual_font_size = font_size * initial_scale_ / viewport_scalar_; + double area = text_rect.Width() * text_rect.Height(); + if (std::round(actual_font_size) < kSmallFontThresholdInDips) + area_sizes_.small_font_area += area; + + area_sizes_.total_text_area += area; +} + +void MobileFriendlinessChecker::UpdateBeyondViewportAreaSizes( + const PhysicalRect& paint_rect) { + DCHECK(is_painting_); + if (ignore_beyond_viewport_scope_count_ != 0) + return; + + int frame_width = frame_view_->GetPage()->GetVisualViewport().Size().width(); + + // TODO(kumagi): Map paint_rect from the local transform space to the viewport + // space. + PhysicalRect viewport_rect( + LayoutUnit(), LayoutUnit(), + LayoutUnit(frame_width * viewport_scalar_ / initial_scale_), + LayoutUnit(kIntMaxForLayoutUnit)); + int original_size = + ClampTo<int>((paint_rect.Width() * paint_rect.Height()).ToInt()); + viewport_rect.Intersect(paint_rect); + + area_sizes_.content_beyond_viewport_area += + original_size - + ClampTo<int>((viewport_rect.Width() * viewport_rect.Height()).ToInt()); +} + +void MobileFriendlinessChecker::NotifyPaintTextFragment( + const PhysicalRect& paint_rect, + int font_size) { DCHECK(frame_view_->GetFrame().Client()->IsLocalFrameClientImpl()); DCHECK(frame_view_->GetFrame().IsOutermostMainFrame()); - // Compute small text ratio. - if (const auto* text = DynamicTo<LayoutText>(object)) { - const auto& style = text->StyleRef(); - - // Ignore elements that users cannot see. - if (style.Visibility() != EVisibility::kVisible) - return; - - // Ignore elements intended only for screen readers. - if (style.HasOutOfFlowPosition() && style.ClipLeft().IsZero() && - style.ClipRight().IsZero() && style.ClipTop().IsZero() && - style.ClipBottom().IsZero()) - return; - - double actual_font_size = - style.FontSize() * initial_scale_ / viewport_scalar_; - double area = text->PhysicalAreaSize(); - if (std::round(actual_font_size) < kSmallFontThresholdInDips) - text_area_sizes_.small_font_area += area; - - text_area_sizes_.total_text_area += area; - } + UpdateTextAreaSizes(paint_rect, font_size); + UpdateBeyondViewportAreaSizes(paint_rect); } -int MobileFriendlinessChecker::ComputeContentOutsideViewport() { - int frame_width = frame_view_->GetPage()->GetVisualViewport().Size().width(); - if (frame_width == 0) { - return 0; - } +void MobileFriendlinessChecker::NotifyPaintReplaced( + const PhysicalRect& paint_rect) { + DCHECK(frame_view_->GetFrame().Client()->IsLocalFrameClientImpl()); + DCHECK(frame_view_->GetFrame().IsLocalRoot()); - const auto* root_frame_viewport = frame_view_->GetRootFrameViewport(); - if (root_frame_viewport == nullptr) { - return 0; - } - - int content_width = - root_frame_viewport->LayoutViewport().ContentsSize().width() * - initial_scale_; - int max_scroll_offset = content_width - frame_width; - - // We use ceil function here because we want to treat 100.1% as 101 which - // requires a scroll bar. - return std::ceil(max_scroll_offset * 100.0 / frame_width); + UpdateBeyondViewportAreaSizes(paint_rect); } void MobileFriendlinessChecker::Trace(Visitor* visitor) const {
diff --git a/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.h b/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.h index a1a2921..dd03c576 100644 --- a/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.h +++ b/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.h
@@ -16,9 +16,8 @@ namespace blink { +class Document; class LocalFrameView; -class LayoutObject; - struct ViewportDescription; // Calculates the mobile usability of current page, especially friendliness on @@ -30,46 +29,79 @@ public: explicit MobileFriendlinessChecker(LocalFrameView& frame_view); virtual ~MobileFriendlinessChecker(); + static MobileFriendlinessChecker* From(const Document&); // LocalFrameView::LifecycleNotificationObserver implementation void DidFinishLifecycleUpdate(const LocalFrameView&) override; void NotifyInitialScaleUpdated(); - void NotifyPaint(); + void NotifyPaintBegin(); + void NotifyPaintEnd(); void WillBeRemovedFromFrame(); void NotifyViewportUpdated(const ViewportDescription&); - void NotifyInvalidatePaint(const LayoutObject& object); + void NotifyPaintTextFragment(const PhysicalRect& paint_rect, int font_size); + void NotifyPaintReplaced(const PhysicalRect& paint_rect); void Trace(Visitor* visitor) const override; - struct TextAreaWithFontSize { + + struct AreaSizes { double small_font_area = 0; double total_text_area = 0; + double content_beyond_viewport_area = 0; + int TextContentsOutsideViewportPercentage(int viewport_area) const; int SmallTextRatio() const; }; + class PaintScope final { + STACK_ALLOCATED(); + + public: + explicit PaintScope(MobileFriendlinessChecker& mfc) : mfc_(mfc) { + mfc_.NotifyPaintBegin(); + } + ~PaintScope() { mfc_.NotifyPaintEnd(); } + + private: + MobileFriendlinessChecker& mfc_; + }; + + class IgnoreBeyondViewportScope final { + STACK_ALLOCATED(); + + public: + explicit IgnoreBeyondViewportScope(MobileFriendlinessChecker& mfc) + : mfc_(mfc) { + mfc_.ignore_beyond_viewport_scope_count_++; + } + ~IgnoreBeyondViewportScope() { mfc_.ignore_beyond_viewport_scope_count_--; } + + private: + MobileFriendlinessChecker& mfc_; + }; + private: void Activate(TimerBase*); - // Returns the percentage of the width of the content that overflows the - // viewport. - // Returns 0 if all content fits in the viewport. - int ComputeContentOutsideViewport(); - // Returns percentage value [0-100] of bad tap targets in the area of the // first page. Returns kTimeBudgetExceeded if the time limit is exceeded. int ComputeBadTapTargetsRatio(); + void UpdateTextAreaSizes(const PhysicalRect& text_rect, int font_size); + void UpdateBeyondViewportAreaSizes(const PhysicalRect& paint_rect); + private: Member<LocalFrameView> frame_view_; HeapTaskRunnerTimer<MobileFriendlinessChecker> timer_; double viewport_scalar_; double initial_scale_ = 1.0; base::TimeTicks last_evaluated_; - TextAreaWithFontSize text_area_sizes_; + AreaSizes area_sizes_; bool viewport_device_width_ = false; bool allow_user_zoom_ = true; int viewport_initial_scale_x10_ = -1; int viewport_hardcoded_width_ = -1; + int ignore_beyond_viewport_scope_count_ = 0; + bool is_painting_ = false; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker_test.cc b/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker_test.cc index 35d338d..5fe3d46 100644 --- a/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker_test.cc +++ b/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker_test.cc
@@ -110,6 +110,7 @@ .SetShrinksViewportContentToFit(true); helper->GetWebView()->GetPage()->GetSettings().SetViewportStyle( mojom::blink::ViewportStyle::kMobile); + helper->LoadAhem(); return helper; } @@ -547,6 +548,28 @@ )"); // Automatic zoom-out makes text small and image fits in display. EXPECT_EQ(actual_mf.small_text_ratio, 100); + EXPECT_GE(actual_mf.text_content_outside_viewport_percentage, 10); +} + +TEST_F(MobileFriendlinessCheckerTest, ZIndex) { + MobileFriendliness actual_mf = CalculateMetricsForHTMLString(R"( +<html> + <head> + <meta name="viewport" content="width=device-width,initial-scale=1.0"> + </head> + <body style="margin:240px;font-size: 12pt"> + <div style="z-index: 1"> + hello + <div style="z-index: 10"> + foo + <img style="width:5000px; height:380px"> + <p>Normal font text.</p> + </div> + </div> + </body> +</html> +)"); + EXPECT_EQ(actual_mf.small_text_ratio, 0); EXPECT_GE(actual_mf.text_content_outside_viewport_percentage, 50); } @@ -557,14 +580,14 @@ <head> <meta name="viewport" content="initial-scale=1.0"> </head> - <body> - <img style="width:3000px; height:50px"> + <body style="margin: 0px"> + <img style="width:3000px; height:240px"> <p style="font-size: 9pt">Normal font text.</p> </body> </html> )"); EXPECT_EQ(actual_mf.small_text_ratio, 0); - EXPECT_GE(actual_mf.text_content_outside_viewport_percentage, 100); + EXPECT_GE(actual_mf.text_content_outside_viewport_percentage, 50); } TEST_F(MobileFriendlinessCheckerTest, @@ -575,8 +598,8 @@ <head> <meta name="viewport" content="initial-scale=1.0"> </head> - <body> - <img style="width:3000px; height:50px"> + <body style="margin: 0px"> + <img style="width:3000px; height:240px"> <p style="font-size: 6pt">Illegible font text.</p> </body> </html> @@ -645,31 +668,77 @@ R"( <html> <head> + <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> <meta name="viewport" content="initial-scale=1.0"> </head> <body> - <pre>)" + + <pre style="font: 30px Ahem; line-height: 1">)" + std::string(10000, 'a') + R"(</pre> </body> </html> )"); - EXPECT_NE(actual_mf.text_content_outside_viewport_percentage, 0); + EXPECT_GT(actual_mf.text_content_outside_viewport_percentage, 20); } -TEST_F(MobileFriendlinessCheckerTest, TextTooWideAbsolutePositioning) { +TEST_F(MobileFriendlinessCheckerTest, TextAbsolutePositioning) { MobileFriendliness actual_mf = CalculateMetricsForHTMLString( R"( <html> <head> <meta name="viewport" content="initial-scale=1.0"> </head> - <body> - <pre style="position:absolute; left:2000px">a</pre> + <body style="font-size: 12px"> + <pre style="position:absolute; left:2000px">)" + + std::string(10000, 'a') + + R"(</pre> </body> </html> )"); - EXPECT_EQ(actual_mf.text_content_outside_viewport_percentage, 317); + EXPECT_GE(actual_mf.text_content_outside_viewport_percentage, 15); +} + +TEST_F(MobileFriendlinessCheckerTest, ImageAbsolutePositioning) { + MobileFriendliness actual_mf_full_out = CalculateMetricsForHTMLString( + R"( +<html> + <head> + <meta name="viewport" content="initial-scale=1.0"> + </head> + <body style="margin: 0px"> + <img style="width:480px; height:800px; position:absolute; left:480px"> + </body> +</html> +)"); + EXPECT_EQ(actual_mf_full_out.text_content_outside_viewport_percentage, 100); + + MobileFriendliness actual_mf_half_out = CalculateMetricsForHTMLString( + R"( +<html> + <head> + <meta name="viewport" content="initial-scale=1.0"> + </head> + <body style="margin: 0px"> + <img style="width:480px; height:800px; position:absolute; left:240px"> + </body> +</html> +)"); + EXPECT_EQ(actual_mf_half_out.text_content_outside_viewport_percentage, 50); +} + +TEST_F(MobileFriendlinessCheckerTest, SmallTextOutsideViewportCeiling) { + MobileFriendliness actual_mf = CalculateMetricsForHTMLString( + R"( +<html> + <head> + <meta name="viewport" content="initial-scale=1.0"> + </head> + <body style="font-size: 12px"> + <pre style="position:absolute; left:2000px">x</pre> + </body> +</html> +)"); + EXPECT_EQ(actual_mf.text_content_outside_viewport_percentage, 1); } TEST_F(MobileFriendlinessCheckerTest, TextTooWideOverflowXHidden) { @@ -680,7 +749,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> - <pre style="overflow-x:hidden">)" + + <pre style="overflow-x:hidden; font-size:12px">)" + std::string(10000, 'a') + R"(</pre> </body> </html> @@ -713,7 +782,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> - <div style="overflow:hidden"> + <div style="overflow:hidden; font-size: 12px"> <pre>)" + std::string(10000, 'a') + R"( @@ -729,6 +798,9 @@ MobileFriendliness actual_mf = CalculateMetricsForHTMLString( R"( <html> + <head> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + </head> <body> <div style="overflow:hidden"> <div> @@ -766,7 +838,37 @@ </body> </html> )"); - EXPECT_EQ(actual_mf.text_content_outside_viewport_percentage, 319); + EXPECT_EQ(actual_mf.text_content_outside_viewport_percentage, 20); +} + +TEST_F(MobileFriendlinessCheckerTest, ImageTooWide100) { + MobileFriendliness actual_mf = CalculateMetricsForHTMLString(R"( +<html> + <head> + <meta name="viewport" content="initial-scale=1.0"> + </head> + <body style="margin:0px;"> + <img style="width:960px; height:800px"> + </body> +</html> +)"); + EXPECT_EQ(actual_mf.text_content_outside_viewport_percentage, 100); +} + +TEST_F(MobileFriendlinessCheckerTest, WideImageClipped) { + MobileFriendliness actual_mf = CalculateMetricsForHTMLString(R"( +<html> + <head> + <meta name="viewport" content="initial-scale=1.0"> + </head> + <body> + <div style="overflow: hidden"> + <img style="width:2000px; height:50px"> + </div> + </body> +</html> +)"); + EXPECT_EQ(actual_mf.text_content_outside_viewport_percentage, 0); } TEST_F(MobileFriendlinessCheckerTest, ImageTooWideTwoImages) { @@ -775,13 +877,13 @@ <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> - <body style="width:4000px"> + <body style="width:4036px"> <img style="width:2000px; height:50px"> <img style="width:2000px; height:50px"> </body> </html> )"); - EXPECT_EQ(actual_mf.text_content_outside_viewport_percentage, 735); + EXPECT_EQ(actual_mf.text_content_outside_viewport_percentage, 46); } TEST_F(MobileFriendlinessCheckerTest, ImageTooWideAbsolutePosition) { @@ -795,7 +897,7 @@ </body> </html> )"); - EXPECT_EQ(actual_mf.text_content_outside_viewport_percentage, 417); + EXPECT_EQ(actual_mf.text_content_outside_viewport_percentage, 100); } TEST_F(MobileFriendlinessCheckerTest, ImageTooWideDisplayNone) { @@ -813,9 +915,10 @@ MobileFriendliness actual_mf = CalculateMetricsForHTMLString(R"( <html> <head> + <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> <meta name="viewport" content="minimum-scale=1, initial-scale=3"> </head> - <body style="font-size: 76px; width: 480"> + <body style="font: 76px Ahem; width: 480"> foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo @@ -830,17 +933,20 @@ </html> )"); EXPECT_EQ(actual_mf.viewport_initial_scale_x10, 30); - EXPECT_GE(actual_mf.text_content_outside_viewport_percentage, 100.0); + EXPECT_GT(actual_mf.text_content_outside_viewport_percentage, 90); } TEST_F(MobileFriendlinessCheckerTest, ScrollerOutsideViewport) { MobileFriendliness actual_mf = CalculateMetricsForHTMLString(R"( <html> <head> + <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> <style> + body { + margin: 0px; + } div.scrollmenu { background-color: #333; - overflow: auto; white-space: nowrap; } div.scrollmenu a { @@ -849,9 +955,9 @@ padding: 14px; } </style> - <meta name="viewport" content="width=device-width, initial-scale=1.0 minimum-scale=1.0"> + <meta name="viewport" content="width=480px, initial-scale=1.0 minimum-scale=1.0">f </head> - <body style="font-size: 18px"> + <body style="font: 40px/1 Ahem; line-height: 1"> <div class="scrollmenu"> <a href="#1">First text</a> <a href="#2">Second text</a> @@ -863,12 +969,59 @@ <a href="#8">Eighth text</a> <a href="#9">Ninth text</a> <a href="#10">Tenth text</a> + <a href="#11">Eleventh text</a> + <a href="#12">Twelveth text</a> </div> </body> </html> )"); // the viewport - EXPECT_EQ(actual_mf.text_content_outside_viewport_percentage, 0.0); + EXPECT_GT(actual_mf.text_content_outside_viewport_percentage, 10); +} + +TEST_F(MobileFriendlinessCheckerTest, SubScroller) { + MobileFriendliness actual_mf = CalculateMetricsForHTMLString(R"( +<html> + <head> + <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> + <style> + body { + margin: 0px; + } + div.scrollmenu { + width: 480px; + background-color: #333; + overflow: scroll; + white-space: nowrap; + } + div.scrollmenu a { + display: inline-block; + color: white; + padding: 14px; + } + </style> + <meta name="viewport" content="width=480px, initial-scale=1.0 minimum-scale=1.0"> + </head> + <body style="font: 40px/1 Ahem; line-height: 1"> + <div class="scrollmenu"> + <a href="#1">First text</a> + <a href="#2">Second text</a> + <a href="#3">Third text</a> + <a href="#4">Fourth text</a> + <a href="#5">Fifth text</a> + <a href="#6">Sixth text</a> + <a href="#7">Seventh text</a> + <a href="#8">Eighth text</a> + <a href="#9">Ninth text</a> + <a href="#10">Tenth text</a> + <a href="#11">Eleventh text</a> + <a href="#12">Twelveth text</a> + </div> + </body> +</html> +)"); + // Fits within the viewport by scrollbar. + EXPECT_EQ(actual_mf.text_content_outside_viewport_percentage, 0); } TEST_F(MobileFriendlinessCheckerTest, SingleTapTarget) { @@ -1497,7 +1650,7 @@ EXPECT_EQ(actual_mf.bad_tap_targets_ratio, 100); } -TEST_F(MobileFriendlinessCheckerTest, IFrameTest) { +TEST_F(MobileFriendlinessCheckerTest, IFrame) { url_test_helpers::RegisterMockedURLLoadFromBase( WebString::FromUTF8(kBaseUrl), blink::test::CoreTestDataPath(), WebString::FromUTF8("visible_iframe.html"));
diff --git a/third_party/blink/renderer/core/page/create_window.cc b/third_party/blink/renderer/core/page/create_window.cc index 09ad56296..76b7c5e 100644 --- a/third_party/blink/renderer/core/page/create_window.cc +++ b/third_party/blink/renderer/core/page/create_window.cc
@@ -262,7 +262,7 @@ if (!ad_tracker) return; - bool is_ad_subframe = opener_frame.IsAdSubframe(); + bool is_ad_frame = opener_frame.IsAdFrame(); bool is_ad_script_in_stack = ad_tracker->IsAdScriptInStack(AdTracker::StackType::kBottomAndTop); @@ -271,7 +271,7 @@ ukm::SourceId source_id = opener_frame.GetDocument()->UkmSourceID(); if (source_id != ukm::kInvalidSourceId) { ukm::builders::AbusiveExperienceHeuristic_WindowOpen(source_id) - .SetFromAdSubframe(is_ad_subframe) + .SetFromAdSubframe(is_ad_frame) .SetFromAdScript(is_ad_script_in_stack) .Record(ukm_recorder); }
diff --git a/third_party/blink/renderer/core/paint/inline_text_box_painter.cc b/third_party/blink/renderer/core/paint/inline_text_box_painter.cc index 49260bc..b1086ee 100644 --- a/third_party/blink/renderer/core/paint/inline_text_box_painter.cc +++ b/third_party/blink/renderer/core/paint/inline_text_box_painter.cc
@@ -19,6 +19,7 @@ #include "third_party/blink/renderer/core/layout/layout_theme.h" #include "third_party/blink/renderer/core/layout/line/inline_text_box.h" #include "third_party/blink/renderer/core/layout/text_decoration_offset.h" +#include "third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.h" #include "third_party/blink/renderer/core/paint/applied_decoration_painter.h" #include "third_party/blink/renderer/core/paint/document_marker_painter.h" #include "third_party/blink/renderer/core/paint/highlight_painting_utils.h" @@ -160,6 +161,18 @@ physical_overflow.Move(paint_offset); gfx::Rect visual_rect = ToEnclosingRect(physical_overflow); + if (paint_info.phase == PaintPhase::kForeground) { + if (auto* mf_checker = MobileFriendlinessChecker::From( + inline_text_box_.GetLineLayoutItem().GetDocument())) { + if (const auto* text = DynamicTo<LayoutText>(InlineLayoutObject())) { + PhysicalRect clipped_rect = PhysicalRect(visual_rect); + clipped_rect.Intersect(PhysicalRect(paint_info.GetCullRect().Rect())); + mf_checker->NotifyPaintTextFragment(clipped_rect, + text->StyleRef().FontSize()); + } + } + } + GraphicsContext& context = paint_info.context; PhysicalOffset box_origin = inline_text_box_.PhysicalLocation() + paint_offset;
diff --git a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc index 5c9eed7..1178a3d 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc
@@ -218,7 +218,7 @@ // // TODO(kojii): This may become more complicated when we use // |NGBoxFragmentPainter| for all fragments, and we still want this -// oprimization. +// optimization. bool FragmentRequiresLegacyFallback(const NGPhysicalFragment& fragment) { // If |fragment| is |IsFormattingContextRoot|, it may be legacy. // Avoid falling back to |LayoutObject| if |CanTraverse|, because it
diff --git a/third_party/blink/renderer/core/paint/ng/ng_text_fragment_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_text_fragment_painter.cc index 9ae20f2..1c179c60 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_text_fragment_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_text_fragment_painter.cc
@@ -20,6 +20,7 @@ #include "third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h" #include "third_party/blink/renderer/core/layout/ng/ng_text_decoration_offset.h" #include "third_party/blink/renderer/core/layout/svg/layout_svg_inline_text.h" +#include "third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.h" #include "third_party/blink/renderer/core/paint/document_marker_painter.h" #include "third_party/blink/renderer/core/paint/highlight_painting_utils.h" #include "third_party/blink/renderer/core/paint/inline_text_box_painter.h" @@ -335,6 +336,16 @@ fragment_paint_info, text_painter, decoration_painter, paint_info, cursor_, *cursor_.CurrentItem(), rotation, rotated_box, physical_box.offset, style, text_style, selection, is_printing); + if (paint_info.phase == PaintPhase::kForeground) { + if (auto* mf_checker = MobileFriendlinessChecker::From(document)) { + if (auto* text = DynamicTo<LayoutText>(*layout_object)) { + PhysicalRect clipped_rect = PhysicalRect(visual_rect); + clipped_rect.Intersect(PhysicalRect(paint_info.GetCullRect().Rect())); + mf_checker->NotifyPaintTextFragment(clipped_rect, + text->StyleRef().FontSize()); + } + } + } if (svg_inline_text) { NGTextPainter::SvgTextPaintState& svg_state = text_painter.SetSvgState(
diff --git a/third_party/blink/renderer/core/paint/paint_invalidator.cc b/third_party/blink/renderer/core/paint/paint_invalidator.cc index 7dece503..190ece2 100644 --- a/third_party/blink/renderer/core/paint/paint_invalidator.cc +++ b/third_party/blink/renderer/core/paint/paint_invalidator.cc
@@ -319,15 +319,6 @@ reason == PaintInvalidationReason::kJustCreated)) pending_delayed_paint_invalidations_.push_back(&object); - if (auto* local_frame = DynamicTo<LocalFrame>(object.GetFrame()->Top())) { - if (auto* mf_checker = - local_frame->View()->GetMobileFriendlinessChecker()) { - if (tree_builder_context && - (!pre_paint_info || pre_paint_info->is_last_for_node)) - mf_checker->NotifyInvalidatePaint(object); - } - } - return reason != PaintInvalidationReason::kNone; }
diff --git a/third_party/blink/renderer/core/paint/paint_timing.cc b/third_party/blink/renderer/core/paint/paint_timing.cc index 7c819a9..d900d127 100644 --- a/third_party/blink/renderer/core/paint/paint_timing.cc +++ b/third_party/blink/renderer/core/paint/paint_timing.cc
@@ -17,7 +17,6 @@ #include "third_party/blink/renderer/core/loader/document_loader.h" #include "third_party/blink/renderer/core/loader/interactive_detector.h" #include "third_party/blink/renderer/core/loader/progress_tracker.h" -#include "third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.h" #include "third_party/blink/renderer/core/page/chrome_client.h" #include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/probe/core_probes.h" @@ -190,10 +189,6 @@ if (image_painted) MarkFirstImagePaint(); fmp_detector_->NotifyPaint(); - if (auto* local_frame = DynamicTo<LocalFrame>(GetFrame()->Top())) { - if (auto* mf_checker = local_frame->View()->GetMobileFriendlinessChecker()) - mf_checker->NotifyPaint(); - } if (is_first_paint) GetFrame()->OnFirstPaint(text_painted, image_painted);
diff --git a/third_party/blink/renderer/core/paint/replaced_painter.cc b/third_party/blink/renderer/core/paint/replaced_painter.cc index 0f1cc456..33c0e0f 100644 --- a/third_party/blink/renderer/core/paint/replaced_painter.cc +++ b/third_party/blink/renderer/core/paint/replaced_painter.cc
@@ -10,6 +10,7 @@ #include "third_party/blink/renderer/core/frame/web_feature.h" #include "third_party/blink/renderer/core/layout/layout_replaced.h" #include "third_party/blink/renderer/core/layout/svg/layout_svg_root.h" +#include "third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.h" #include "third_party/blink/renderer/core/paint/box_painter.h" #include "third_party/blink/renderer/core/paint/highlight_painting_utils.h" #include "third_party/blink/renderer/core/paint/object_painter.h" @@ -35,6 +36,10 @@ public: ScopedReplacedContentPaintState(const ScopedPaintState& input, const LayoutReplaced& replaced); + + private: + absl::optional<MobileFriendlinessChecker::IgnoreBeyondViewportScope> + mf_ignore_scope_; }; ScopedReplacedContentPaintState::ScopedReplacedContentPaintState( @@ -70,6 +75,18 @@ new_properties, replaced, input_paint_info_.DisplayItemTypeForClipping()); } + + if (input_paint_info_.phase == PaintPhase::kForeground) { + if (auto* mf_checker = + MobileFriendlinessChecker::From(replaced.GetDocument())) { + PhysicalRect content_rect = replaced.ReplacedContentRect(); + content_rect.Move(paint_offset_); + content_rect.Intersect(PhysicalRect(GetPaintInfo().GetCullRect().Rect())); + mf_checker->NotifyPaintReplaced(content_rect); + + mf_ignore_scope_.emplace(*mf_checker); + } + } } } // anonymous namespace
diff --git a/third_party/blink/renderer/core/paint/scoped_paint_state.cc b/third_party/blink/renderer/core/paint/scoped_paint_state.cc index a6cc50d..8d151d8a 100644 --- a/third_party/blink/renderer/core/paint/scoped_paint_state.cc +++ b/third_party/blink/renderer/core/paint/scoped_paint_state.cc
@@ -141,6 +141,23 @@ box.Layer()->SetPreviousPaintResult(kMayBeClippedByCullRect); } } + + if (input_paint_info_.phase == PaintPhase::kForeground) { + // We treat horizontal-scrollable scrollers like replaced objects. + if (auto* scrollable_area = box.GetScrollableArea()) { + if (scrollable_area->HasHorizontalScrollbar()) { + if (auto* mf_checker = + MobileFriendlinessChecker::From(box.GetDocument())) { + PhysicalRect content_rect = box.LocalVisualRect(); + content_rect.Move(paint_offset_); + content_rect.Intersect( + PhysicalRect(input_paint_info_.GetCullRect().Rect())); + mf_checker->NotifyPaintReplaced(content_rect); + mf_ignore_scope_.emplace(*mf_checker); + } + } + } + } } } // namespace blink
diff --git a/third_party/blink/renderer/core/paint/scoped_paint_state.h b/third_party/blink/renderer/core/paint/scoped_paint_state.h index ac3ebb6b..d3a4df9 100644 --- a/third_party/blink/renderer/core/paint/scoped_paint_state.h +++ b/third_party/blink/renderer/core/paint/scoped_paint_state.h
@@ -8,6 +8,7 @@ #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/renderer/core/layout/layout_box.h" #include "third_party/blink/renderer/core/layout/ng/ng_physical_fragment.h" +#include "third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/platform/graphics/paint/scoped_paint_chunk_properties.h" @@ -121,6 +122,8 @@ private: void AdjustForBoxContents(const LayoutBox&); + absl::optional<MobileFriendlinessChecker::IgnoreBeyondViewportScope> + mf_ignore_scope_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/testing/internals.cc b/third_party/blink/renderer/core/testing/internals.cc index 77f361a..71633d0 100644 --- a/third_party/blink/renderer/core/testing/internals.cc +++ b/third_party/blink/renderer/core/testing/internals.cc
@@ -3847,8 +3847,8 @@ ReportingContext::From(document_->domWindow())->QueueReport(report); } -void Internals::setIsAdSubframe(HTMLIFrameElement* iframe, - ExceptionState& exception_state) { +void Internals::setIsAdFrame(HTMLIFrameElement* iframe, + ExceptionState& exception_state) { if (!iframe->ContentFrame() || !iframe->ContentFrame()->IsLocalFrame()) { exception_state.ThrowDOMException(DOMExceptionCode::kNotSupportedError, "Frame cannot be accessed."); @@ -3856,8 +3856,7 @@ } LocalFrame* parent_frame = iframe->GetDocument().GetFrame(); LocalFrame* child_frame = To<LocalFrame>(iframe->ContentFrame()); - blink::FrameAdEvidence ad_evidence(parent_frame && - parent_frame->IsAdSubframe()); + blink::FrameAdEvidence ad_evidence(parent_frame && parent_frame->IsAdFrame()); ad_evidence.set_created_by_ad_script( mojom::FrameCreationStackEvidence::kCreatedByAdScript); ad_evidence.set_is_complete();
diff --git a/third_party/blink/renderer/core/testing/internals.h b/third_party/blink/renderer/core/testing/internals.h index 6106d9c..21a8e7a 100644 --- a/third_party/blink/renderer/core/testing/internals.h +++ b/third_party/blink/renderer/core/testing/internals.h
@@ -614,8 +614,7 @@ void generateTestReport(const String& message); - void setIsAdSubframe(HTMLIFrameElement* iframe, - ExceptionState& exception_state); + void setIsAdFrame(HTMLIFrameElement* iframe, ExceptionState& exception_state); ReadableStream* createReadableStream(ScriptState* script_state, int32_t queueSize,
diff --git a/third_party/blink/renderer/core/testing/internals.idl b/third_party/blink/renderer/core/testing/internals.idl index 1118ff9..27b799a 100644 --- a/third_party/blink/renderer/core/testing/internals.idl +++ b/third_party/blink/renderer/core/testing/internals.idl
@@ -443,7 +443,7 @@ // Request generation of a Reporting report. void generateTestReport(DOMString message); - [RaisesException] void setIsAdSubframe(HTMLIFrameElement iframe); + [RaisesException] void setIsAdFrame(HTMLIFrameElement iframe); [RaisesException, CallWith=ScriptState] ReadableStream createReadableStream(long queueSize, DOMString optimizer); // The return value consists of a WritableStream (.stream) and a promise of
diff --git a/third_party/blink/renderer/modules/encryptedmedia/media_key_system_access.cc b/third_party/blink/renderer/modules/encryptedmedia/media_key_system_access.cc index fe10c86..e1ddeb9 100644 --- a/third_party/blink/renderer/modules/encryptedmedia/media_key_system_access.cc +++ b/third_party/blink/renderer/modules/encryptedmedia/media_key_system_access.cc
@@ -157,7 +157,7 @@ ukm::builders::Media_EME_CreateMediaKeys builder(document->UkmSourceID()); builder.SetKeySystem(KeySystemForUkmLegacy::kWidevine); - builder.SetIsAdFrame(static_cast<int>(frame->IsAdSubframe())); + builder.SetIsAdFrame(static_cast<int>(frame->IsAdFrame())); builder.SetIsCrossOrigin( static_cast<int>(frame->IsCrossOriginToOutermostMainFrame())); builder.SetIsTopFrame(static_cast<int>(frame->IsOutermostMainFrame()));
diff --git a/third_party/blink/renderer/modules/encryptedmedia/media_key_system_access_initializer_base.cc b/third_party/blink/renderer/modules/encryptedmedia/media_key_system_access_initializer_base.cc index 1010c37..54472ab 100644 --- a/third_party/blink/renderer/modules/encryptedmedia/media_key_system_access_initializer_base.cc +++ b/third_party/blink/renderer/modules/encryptedmedia/media_key_system_access_initializer_base.cc
@@ -220,7 +220,7 @@ ukm::builders::Media_EME_RequestMediaKeySystemAccess builder( DomWindow()->UkmSourceID()); builder.SetKeySystem(KeySystemForUkmLegacy::kWidevine); - builder.SetIsAdFrame(static_cast<int>(frame->IsAdSubframe())); + builder.SetIsAdFrame(static_cast<int>(frame->IsAdFrame())); builder.SetIsCrossOrigin( static_cast<int>(frame->IsCrossOriginToOutermostMainFrame())); builder.SetIsTopFrame(static_cast<int>(frame->IsOutermostMainFrame()));
diff --git a/third_party/blink/renderer/modules/media/webmediaplayer_util.cc b/third_party/blink/renderer/modules/media/webmediaplayer_util.cc index b3385221..ea699e6c 100644 --- a/third_party/blink/renderer/modules/media/webmediaplayer_util.cc +++ b/third_party/blink/renderer/modules/media/webmediaplayer_util.cc
@@ -139,7 +139,7 @@ WebMediaPlayer::kLoadTypeMax + 1); // Report load type separately for ad frames. - if (frame.IsAdSubframe()) { + if (frame.IsAdFrame()) { UMA_HISTOGRAM_ENUMERATION("Ads.Media.LoadType", load_type, WebMediaPlayer::kLoadTypeMax + 1); }
diff --git a/third_party/blink/renderer/modules/xr/xr_plane.h b/third_party/blink/renderer/modules/xr/xr_plane.h index a7c1f835..19975b8b 100644 --- a/third_party/blink/renderer/modules/xr/xr_plane.h +++ b/third_party/blink/renderer/modules/xr/xr_plane.h
@@ -22,7 +22,7 @@ DEFINE_WRAPPERTYPEINFO(); public: - enum Orientation { kHorizontal, kVertical }; + enum class Orientation { kHorizontal, kVertical }; XRPlane(uint64_t id, XRSession* session,
diff --git a/third_party/blink/renderer/platform/graphics/compositing/adjust_mask_layer_geometry.cc b/third_party/blink/renderer/platform/graphics/compositing/adjust_mask_layer_geometry.cc index 4abe1d9..b5b43da 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/adjust_mask_layer_geometry.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/adjust_mask_layer_geometry.cc
@@ -4,8 +4,9 @@ #include "third_party/blink/renderer/platform/graphics/compositing/adjust_mask_layer_geometry.h" +#include <math.h> #include <algorithm> -#include <cmath> + #include "third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h" #include "third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h" #include "ui/gfx/geometry/size.h" @@ -29,8 +30,7 @@ // Map a screen pixel into the layer. GeometryMapper::SourceToDestinationRect(TransformPaintPropertyNode::Root(), transform, pixel_rect); - int outset = - std::ceilf(std::max(pixel_rect.width(), pixel_rect.height()) * 2); + int outset = ceilf(std::max(pixel_rect.width(), pixel_rect.height()) * 2); // Don't expand too far in extreme cases. constexpr int kMaxOutset = 1000; outset = std::min(kMaxOutset, outset);
diff --git a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc index 0fc517c..0965def 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc
@@ -579,7 +579,7 @@ // Populate the output mailbox and callback. { - bool is_overlay_candidate = color_buffer_for_mailbox->has_usage_scanout; + bool is_overlay_candidate = !!color_buffer_for_mailbox->gpu_memory_buffer; *out_resource = viz::TransferableResource::MakeGL( color_buffer_for_mailbox->mailbox, GL_LINEAR, texture_target_, color_buffer_for_mailbox->produce_sync_token, size_, @@ -826,7 +826,6 @@ const gfx::ColorSpace& color_space, viz::ResourceFormat format, GLuint texture_id, - bool has_usage_scanout, std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer, gpu::Mailbox mailbox) : owning_thread_ref(base::PlatformThread::CurrentRef()), @@ -835,7 +834,6 @@ color_space(color_space), format(format), texture_id(texture_id), - has_usage_scanout(has_usage_scanout), gpu_memory_buffer(std::move(gpu_memory_buffer)), mailbox(mailbox) {} @@ -1830,7 +1828,6 @@ uint32_t usage = gpu::SHARED_IMAGE_USAGE_GLES2 | gpu::SHARED_IMAGE_USAGE_GLES2_FRAMEBUFFER_HINT | gpu::SHARED_IMAGE_USAGE_DISPLAY; - bool has_usage_scanout = false; GrSurfaceOrigin origin = opengl_flip_y_extension_ ? kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin; @@ -1851,47 +1848,39 @@ front_buffer_mailbox = mailboxes.front_buffer; } else { if (ShouldUseChromiumImage()) { - if (!allocate_alpha_channel_ && have_alpha_channel_) { - // TODO(crbug.com/911176): RGB emulation is only used by the - // validating command decoder (for the passthrough command decoder, - // its implementation is pushed into ANGLE). In this path, and only - // this path, explicitly allocate a GpuMemoryBuffer and bind it to a - // SharedImage. - gfx::BufferFormat buffer_format = gfx::BufferFormat::RGBX_8888; + gfx::BufferFormat buffer_format; + if (allocate_alpha_channel_) { + buffer_format = use_half_float_storage_ ? gfx::BufferFormat::RGBA_F16 + : gfx::BufferFormat::RGBA_8888; + } else { + DCHECK(!use_half_float_storage_); + buffer_format = gfx::BufferFormat::RGBX_8888; if (gpu::IsImageFromGpuMemoryBufferFormatSupported( gfx::BufferFormat::BGRX_8888, ContextProvider()->GetCapabilities())) { buffer_format = gfx::BufferFormat::BGRX_8888; } - gfx::BufferUsage buffer_usage = gfx::BufferUsage::SCANOUT; - uint32_t additional_usage_flags = gpu::SHARED_IMAGE_USAGE_SCANOUT; - if (low_latency_enabled()) { - buffer_usage = gfx::BufferUsage::SCANOUT_FRONT_RENDERING; - additional_usage_flags = - gpu::SHARED_IMAGE_USAGE_CONCURRENT_READ_WRITE; - } - if (gpu::IsImageFromGpuMemoryBufferFormatSupported( - buffer_format, ContextProvider()->GetCapabilities())) { - gpu_memory_buffer = gpu_memory_buffer_manager->CreateGpuMemoryBuffer( - size, buffer_format, buffer_usage, gpu::kNullSurfaceHandle, - nullptr); - if (gpu_memory_buffer) { - has_usage_scanout = true; - back_buffer_mailbox = sii->CreateSharedImage( - gpu_memory_buffer.get(), gpu_memory_buffer_manager, - color_space_, origin, kPremul_SkAlphaType, - usage | additional_usage_flags); - } - } - } else { - if (gpu::IsImageFromGpuMemoryBufferFormatSupported( - viz::BufferFormat(format), - ContextProvider()->GetCapabilities())) { - usage |= gpu::SHARED_IMAGE_USAGE_SCANOUT; - has_usage_scanout = true; - if (low_latency_enabled()) { - usage |= gpu::SHARED_IMAGE_USAGE_CONCURRENT_READ_WRITE; - } + } + // TODO(crbug.com/911176): When RGB emulation is not needed, we should use + // the non-GMB CreateSharedImage with gpu::SHARED_IMAGE_USAGE_SCANOUT in + // order to allocate the GMB service-side and avoid a synchronous + // round-trip to the browser process here. + gfx::BufferUsage buffer_usage = gfx::BufferUsage::SCANOUT; + uint32_t additional_usage_flags = gpu::SHARED_IMAGE_USAGE_SCANOUT; + if (low_latency_enabled()) { + buffer_usage = gfx::BufferUsage::SCANOUT_FRONT_RENDERING; + additional_usage_flags = gpu::SHARED_IMAGE_USAGE_CONCURRENT_READ_WRITE; + } + + if (gpu::IsImageFromGpuMemoryBufferFormatSupported( + buffer_format, ContextProvider()->GetCapabilities())) { + gpu_memory_buffer = gpu_memory_buffer_manager->CreateGpuMemoryBuffer( + size, buffer_format, buffer_usage, gpu::kNullSurfaceHandle, + nullptr); + if (gpu_memory_buffer) { + back_buffer_mailbox = sii->CreateSharedImage( + gpu_memory_buffer.get(), gpu_memory_buffer_manager, color_space_, + origin, kPremul_SkAlphaType, usage | additional_usage_flags); } } } @@ -1922,7 +1911,7 @@ front_buffer_mailbox.name); front_color_buffer_ = base::MakeRefCounted<ColorBuffer>( weak_factory_.GetWeakPtr(), size, color_space_, format, texture_id, - /*has_usage_scanout=*/false, nullptr, front_buffer_mailbox); + nullptr, front_buffer_mailbox); } // Import the backbuffer of swap chain or allocated SharedImage into GL. texture_id = @@ -1951,7 +1940,7 @@ return base::MakeRefCounted<ColorBuffer>( weak_factory_.GetWeakPtr(), size, color_space_, format, texture_id, - has_usage_scanout, std::move(gpu_memory_buffer), back_buffer_mailbox); + std::move(gpu_memory_buffer), back_buffer_mailbox); } void DrawingBuffer::AttachColorBufferToReadFramebuffer() {
diff --git a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h index 890b0f10..f4e6c8d 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h +++ b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h
@@ -414,7 +414,6 @@ const gfx::ColorSpace& color_space, viz::ResourceFormat, GLuint texture_id, - bool has_usage_scanout, std::unique_ptr<gfx::GpuMemoryBuffer>, gpu::Mailbox mailbox); ColorBuffer(const ColorBuffer&) = delete; @@ -433,7 +432,6 @@ const gfx::ColorSpace color_space; const viz::ResourceFormat format; const GLuint texture_id = 0; - const bool has_usage_scanout; std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer; // If we're emulating an RGB back buffer using an RGBA Chromium
diff --git a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test.cc b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test.cc index c154bc84..300a7a6 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test.cc
@@ -510,6 +510,71 @@ EXPECT_EQ(0u, sii->shared_image_count()); } +TEST_F(DrawingBufferImageChromiumTest, AllocationFailure) { + GLES2InterfaceForTests* gl_ = drawing_buffer_->ContextGLForTests(); + viz::TestGpuMemoryBufferManager* gmb_manager = + static_cast<viz::TestGpuMemoryBufferManager*>( + Platform::Current()->GetGpuMemoryBufferManager()); + viz::TestSharedImageInterface* sii = + drawing_buffer_->SharedImageInterfaceForTests(); + + viz::TransferableResource resource1; + viz::ReleaseCallback release_callback1; + viz::TransferableResource resource2; + viz::ReleaseCallback release_callback2; + viz::TransferableResource resource3; + viz::ReleaseCallback release_callback3; + + // Request a resource. A SharedImage should already be created. Everything + // works as expected. + EXPECT_CALL(*gl_, CreateAndTexStorage2DSharedImageCHROMIUMMock(_)).Times(1); + EXPECT_FALSE(drawing_buffer_->MarkContentsChanged()); + EXPECT_TRUE(drawing_buffer_->PrepareTransferableResource(nullptr, &resource1, + &release_callback1)); + EXPECT_TRUE(resource1.is_overlay_candidate); + gpu::Mailbox mailbox1; + mailbox1.SetName(gl_->last_imported_shared_image()->name); + EXPECT_TRUE(sii->CheckSharedImageExists(mailbox1)); + testing::Mock::VerifyAndClearExpectations(gl_); + VerifyStateWasRestored(); + + // Force GpuMemoryBuffer creation failure. Request another resource. It should + // still be provided, but this time with allowOverlay = false. + EXPECT_CALL(*gl_, CreateAndTexStorage2DSharedImageCHROMIUMMock(_)).Times(1); + gmb_manager->SetFailOnCreate(true); + EXPECT_TRUE(drawing_buffer_->MarkContentsChanged()); + EXPECT_TRUE(drawing_buffer_->PrepareTransferableResource(nullptr, &resource2, + &release_callback2)); + EXPECT_FALSE(resource2.is_overlay_candidate); + gpu::Mailbox mailbox2; + mailbox2.SetName(gl_->last_imported_shared_image()->name); + EXPECT_TRUE(sii->CheckSharedImageExists(mailbox2)); + VerifyStateWasRestored(); + + // Check that if GpuMemoryBuffer allocation starts working again, resources + // are correctly created with allowOverlay = true. + EXPECT_CALL(*gl_, CreateAndTexStorage2DSharedImageCHROMIUMMock(_)).Times(1); + gmb_manager->SetFailOnCreate(false); + EXPECT_TRUE(drawing_buffer_->MarkContentsChanged()); + EXPECT_TRUE(drawing_buffer_->PrepareTransferableResource(nullptr, &resource3, + &release_callback3)); + EXPECT_TRUE(resource3.is_overlay_candidate); + gpu::Mailbox mailbox3; + mailbox3.SetName(gl_->last_imported_shared_image()->name); + EXPECT_TRUE(sii->CheckSharedImageExists(mailbox3)); + testing::Mock::VerifyAndClearExpectations(gl_); + VerifyStateWasRestored(); + + std::move(release_callback1).Run(gpu::SyncToken(), false /* lostResource */); + std::move(release_callback2).Run(gpu::SyncToken(), false /* lostResource */); + std::move(release_callback3).Run(gpu::SyncToken(), false /* lostResource */); + + drawing_buffer_->BeginDestruction(); + EXPECT_FALSE(sii->CheckSharedImageExists(mailbox1)); + EXPECT_FALSE(sii->CheckSharedImageExists(mailbox2)); + EXPECT_FALSE(sii->CheckSharedImageExists(mailbox3)); +} + class DepthStencilTrackingGLES2Interface : public gpu::gles2::GLES2InterfaceStub { public:
diff --git a/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.cc b/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.cc index b10f599..dacb264d 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.cc
@@ -229,6 +229,10 @@ return nullptr; } + if (size.IsEmpty()) { + return nullptr; + } + gpu::webgpu::WebGPUInterface* webgpu = context_provider->ContextProvider()->WebGPUInterface();
diff --git a/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider_test.cc b/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider_test.cc index 7fc11cb..de417139 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider_test.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider_test.cc
@@ -548,4 +548,19 @@ std::move(release_callback).Run(gpu::SyncToken(), false /* lostResource */); } +// Ensures that requests for zero size textures (width == 0 or height == 0) do +// not attempt to reserve a texture. +TEST_F(WebGPUSwapBufferProviderTest, VerifyZeroSizeRejects) { + const gfx::Size kZeroSize(0, 0); + const gfx::Size kZeroWidth(0, 10); + const gfx::Size kZeroHeight(10, 0); + + // None of these calls should result in ReserveTexture being called + EXPECT_CALL(*webgpu_, ReserveTexture(fake_device_, _)).Times(0); + + EXPECT_EQ(nullptr, provider_->GetNewTexture(kZeroSize)); + EXPECT_EQ(nullptr, provider_->GetNewTexture(kZeroWidth)); + EXPECT_EQ(nullptr, provider_->GetNewTexture(kZeroHeight)); +} + } // namespace blink
diff --git a/third_party/blink/renderer/platform/media/web_media_player_impl.cc b/third_party/blink/renderer/platform/media/web_media_player_impl.cc index 5c269b3..860fd858 100644 --- a/third_party/blink/renderer/platform/media/web_media_player_impl.cc +++ b/third_party/blink/renderer/platform/media/web_media_player_impl.cc
@@ -2348,7 +2348,7 @@ void WebMediaPlayerImpl::OnDurationChange() { DCHECK(main_task_runner_->BelongsToCurrentThread()); - if (frame_->IsAdSubframe()) { + if (frame_->IsAdFrame()) { UMA_HISTOGRAM_CUSTOM_TIMES("Ads.Media.Duration", GetPipelineMediaDuration(), base::Milliseconds(1), base::Days(1), 50 /* bucket_count */);
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index e9e2e72a..d8eb69c 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -7106,7 +7106,7 @@ # Sheriff 2022-07-12 crbug.com/1343674 [ Linux ] editing/deleting/460938.html [ Failure Pass ] crbug.com/1343664 external/wpt/dom/events/non-cancelable-when-passive/non-passive-mousewheel-event-listener-on-document.html [ Failure Pass ] -crbug.com/1343651 external/wpt/credential-management/fedcm-network-requests.sub.https.html [ Failure Crash Pass ] +crbug.com/1343651 external/wpt/credential-management/fedcm-network-requests.sub.https.html [ Crash Failure Pass ] crbug.com/1343698 [ Mac Release ] external/wpt/webmessaging/postMessage_asterisk_xorigin.sub.htm [ Failure Pass ] crbug.com/1343698 [ Release Win10.20h2 ] external/wpt/webmessaging/postMessage_asterisk_xorigin.sub.htm [ Failure Pass ]
diff --git a/third_party/blink/web_tests/external/Version b/third_party/blink/web_tests/external/Version index ca72b32d..53f8ddc 100644 --- a/third_party/blink/web_tests/external/Version +++ b/third_party/blink/web_tests/external/Version
@@ -1 +1 @@ -Version: 907be0e72eef2687b3c320c1cb1acebf525648b2 +Version: 7d1c8152baa7c04ab1d72f88046b6dd2edcb11ed
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 a3466ea..8678113 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
@@ -237012,6 +237012,60 @@ {} ] ] + }, + "the-textarea-element": { + "textarea-padding-bend-overlaps-content-001.tentative.html": [ + "d99ca1956f36cacca26874fc35a7b879952dd60b", + [ + null, + [ + [ + "/html/rendering/replaced-elements/the-textarea-element/textarea-padding-bend-overlaps-content-001-ref.html", + "==" + ] + ], + {} + ] + ], + "textarea-padding-bstart-moves-content-001.tentative.html": [ + "f4643af132841c80c26ed045571530b4ace93754", + [ + null, + [ + [ + "/html/rendering/replaced-elements/the-textarea-element/textarea-padding-bstart-moves-content-001-ref.html", + "==" + ] + ], + {} + ] + ], + "textarea-padding-iend-overlaps-content-001.tentative.html": [ + "80cbbe3c1e4e4d364aff3c97703984a4b8c83a99", + [ + null, + [ + [ + "/html/rendering/replaced-elements/the-textarea-element/textarea-padding-iend-overlaps-content-001-ref.html", + "==" + ] + ], + {} + ] + ], + "textarea-padding-istart-moves-content-001.tentative.html": [ + "f5abf84c122cbd80d76ae218095de0abe4636ce2", + [ + null, + [ + [ + "/html/rendering/replaced-elements/the-textarea-element/textarea-padding-istart-moves-content-001-ref.html", + "==" + ] + ], + {} + ] + ] } }, "the-css-user-agent-style-sheet-and-presentational-hints": { @@ -303055,7 +303109,7 @@ }, "private-network-access": { "META.yml": [ - "50fab067a4364e4aa64ecabfaa7e70387e049160", + "944ce6f14a1204f048e00db3b7ea21da93037709", [] ], "README.md": [ @@ -313739,6 +313793,24 @@ [] ] }, + "the-textarea-element": { + "textarea-padding-bend-overlaps-content-001-ref.html": [ + "2f479dd72a0ec0456eec947c3e49b50983209c32", + [] + ], + "textarea-padding-bstart-moves-content-001-ref.html": [ + "5144f186604eb2a3e80ad036903c4d708c3b61de", + [] + ], + "textarea-padding-iend-overlaps-content-001-ref.html": [ + "94473c08733930427dfc571d934f96f84d9338de", + [] + ], + "textarea-padding-istart-moves-content-001-ref.html": [ + "eb88858b87a1b1755f94df28ca1740a86bd04a07", + [] + ] + }, "tools": { "gen-svgsizing-tests.py": [ "5ba69f8ab5ba0a74810c570d9a4f3d7ddd90a3ba", @@ -372031,7 +372103,7 @@ ] ], "fedcm-logout-rps.https.html": [ - "6e97239dfa848b822933cf5eaf294ee00ce17437", + "9c8d2c16031034f7cd5c3d57e24ed3a963d3ae92", [ null, {} @@ -435251,6 +435323,102 @@ } ] ], + "mixed-content-fetch.tentative.https.window.js": [ + "a5cddf49f1f4f923c79850e084bd4f66c1f6ca0c", + [ + "fetch/private-network-access/mixed-content-fetch.tentative.https.window.html?include=from-private", + { + "script_metadata": [ + [ + "script", + "/common/subset-tests-by-key.js" + ], + [ + "script", + "/common/utils.js" + ], + [ + "script", + "resources/support.sub.js" + ], + [ + "variant", + "?include=from-private" + ], + [ + "variant", + "?include=from-public" + ], + [ + "variant", + "?include=from-treat-as-public" + ] + ] + } + ], + [ + "fetch/private-network-access/mixed-content-fetch.tentative.https.window.html?include=from-public", + { + "script_metadata": [ + [ + "script", + "/common/subset-tests-by-key.js" + ], + [ + "script", + "/common/utils.js" + ], + [ + "script", + "resources/support.sub.js" + ], + [ + "variant", + "?include=from-private" + ], + [ + "variant", + "?include=from-public" + ], + [ + "variant", + "?include=from-treat-as-public" + ] + ] + } + ], + [ + "fetch/private-network-access/mixed-content-fetch.tentative.https.window.html?include=from-treat-as-public", + { + "script_metadata": [ + [ + "script", + "/common/subset-tests-by-key.js" + ], + [ + "script", + "/common/utils.js" + ], + [ + "script", + "resources/support.sub.js" + ], + [ + "variant", + "?include=from-private" + ], + [ + "variant", + "?include=from-public" + ], + [ + "variant", + "?include=from-treat-as-public" + ] + ] + } + ] + ], "nested-worker.https.window.js": [ "3eeb435badb2d00404e0e214e1d42c4be2817f8a", [
diff --git a/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-bend-overlaps-content-001-ref.html b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-bend-overlaps-content-001-ref.html new file mode 100644 index 0000000..2f479dd7 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-bend-overlaps-content-001-ref.html
@@ -0,0 +1,32 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Reference Case</title> + +<link rel="stylesheet" href="/fonts/ahem.css"> +<style> +textarea { + font: 10px/1 Ahem; + + block-size: 8em; + inline-size: 10em; + + padding-block-end: 0; +} +.rtl { direction: rtl; } +.vlr { writing-mode: vertical-lr; } +.vrl { writing-mode: vertical-rl; } +.slr { writing-mode: sideways-lr; } +.srl { writing-mode: sideways-rl; } +</style> +<textarea>X</textarea> +<textarea class="rtl">X</textarea> +<br> +<textarea class="vlr">X</textarea> +<textarea class="vrl">X</textarea> +<textarea class="slr">X</textarea> +<textarea class="srl">X</textarea> +<br> +<textarea class="vlr rtl">X</textarea> +<textarea class="vrl rtl">X</textarea> +<textarea class="slr rtl">X</textarea> +<textarea class="srl rtl">X</textarea>
diff --git a/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-bend-overlaps-content-001.tentative.html b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-bend-overlaps-content-001.tentative.html new file mode 100644 index 0000000..d99ca195 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-bend-overlaps-content-001.tentative.html
@@ -0,0 +1,43 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Test: padding-block-end on a textarea creates space that content can render into</title> +<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#the-textarea-element-2"> +<link rel="match" href="textarea-padding-bend-overlaps-content-001-ref.html"> + +<link rel="stylesheet" href="/fonts/ahem.css"> +<style> +textarea { + font: 10px/1 Ahem; + + /* Zero out the content-box, leaving the padding area as the only + place where the contents might get rendered. */ + block-size: 0; + inline-size: 10em; + + padding-block-end: 8em; + + /* The textarea's padding-block-end may create overflow in the block axis, + and hence generate a scrollbar in the testcase that's not present in the + reference case (and might be hard to properly mock up there). We avoid + this problem by suppressing scrollbars using "overflow:hidden": */ + overflow: hidden; +} +.rtl { direction: rtl; } +.vlr { writing-mode: vertical-lr; } +.vrl { writing-mode: vertical-rl; } +.slr { writing-mode: sideways-lr; } +.srl { writing-mode: sideways-rl; } +</style> + +<textarea>X</textarea> +<textarea class="rtl">X</textarea> +<br> +<textarea class="vlr">X</textarea> +<textarea class="vrl">X</textarea> +<textarea class="slr">X</textarea> +<textarea class="srl">X</textarea> +<br> +<textarea class="vlr rtl">X</textarea> +<textarea class="vrl rtl">X</textarea> +<textarea class="slr rtl">X</textarea> +<textarea class="srl rtl">X</textarea>
diff --git a/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-bstart-moves-content-001-ref.html b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-bstart-moves-content-001-ref.html new file mode 100644 index 0000000..5144f186 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-bstart-moves-content-001-ref.html
@@ -0,0 +1,34 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Reference Case</title> + +<link rel="stylesheet" href="/fonts/ahem.css"> +<style> +textarea { + font: 10px/1 Ahem; + + block-size: 8em; + inline-size: 10em; + + padding-block-start: 0; + padding-block-end: 0; +} +.rtl { direction: rtl; } +.vlr { writing-mode: vertical-lr; } +.vrl { writing-mode: vertical-rl; } +.slr { writing-mode: sideways-lr; } +.srl { writing-mode: sideways-rl; } +</style> + +<textarea></textarea> +<textarea class="rtl"></textarea> +<br> +<textarea class="vlr"></textarea> +<textarea class="vrl"></textarea> +<textarea class="slr"></textarea> +<textarea class="srl"></textarea> +<br> +<textarea class="vlr rtl"></textarea> +<textarea class="vrl rtl"></textarea> +<textarea class="slr rtl"></textarea> +<textarea class="srl rtl"></textarea>
diff --git a/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-bstart-moves-content-001.tentative.html b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-bstart-moves-content-001.tentative.html new file mode 100644 index 0000000..f4643af1 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-bstart-moves-content-001.tentative.html
@@ -0,0 +1,46 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Test: padding-block-start on a textarea moves the textarea content over, potentially out of the textarea's scrollport</title> +<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#the-textarea-element-2"> +<link rel="match" href="textarea-padding-bstart-moves-content-001-ref.html"> + +<link rel="stylesheet" href="/fonts/ahem.css"> +<style> +textarea { + font: 10px/1 Ahem; + + /* Zero out the content-box, leaving the padding area as the only + place where the contents might get rendered. */ + block-size: 0; + inline-size: 10em; + + padding-block-start: 8em; + padding-block-end: 0; + + /* We expect the textarea's content to overflow in the block direction, + which makes the textarea blank, aside from any scrollbars that might get + created by this overflow. We use overflow:hidden here to suppress these + scrollbars, so that the reference case can just use a trivial empty + textarea (without needing to worry about mocking up scrollbars of + precisely the right size). */ + overflow: hidden; +} +.rtl { direction: rtl; } +.vlr { writing-mode: vertical-lr; } +.vrl { writing-mode: vertical-rl; } +.slr { writing-mode: sideways-lr; } +.srl { writing-mode: sideways-rl; } +</style> + +<textarea>X</textarea> +<textarea class="rtl">X</textarea> +<br> +<textarea class="vlr">X</textarea> +<textarea class="vrl">X</textarea> +<textarea class="slr">X</textarea> +<textarea class="srl">X</textarea> +<br> +<textarea class="vlr rtl">X</textarea> +<textarea class="vrl rtl">X</textarea> +<textarea class="slr rtl">X</textarea> +<textarea class="srl rtl">X</textarea>
diff --git a/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-iend-overlaps-content-001-ref.html b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-iend-overlaps-content-001-ref.html new file mode 100644 index 0000000..94473c0 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-iend-overlaps-content-001-ref.html
@@ -0,0 +1,32 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Reference Case</title> + +<link rel="stylesheet" href="/fonts/ahem.css"> +<style> +textarea { + font: 10px/1 Ahem; + + inline-size: 8em; + block-size: 10em; + + padding-inline-end: 0; +} +.rtl { direction: rtl; } +.vlr { writing-mode: vertical-lr; } +.vrl { writing-mode: vertical-rl; } +.slr { writing-mode: sideways-lr; } +.srl { writing-mode: sideways-rl; } +</style> +<textarea>X</textarea> +<textarea class="rtl">X</textarea> +<br> +<textarea class="vlr">X</textarea> +<textarea class="vrl">X</textarea> +<textarea class="slr">X</textarea> +<textarea class="srl">X</textarea> +<br> +<textarea class="vlr rtl">X</textarea> +<textarea class="vrl rtl">X</textarea> +<textarea class="slr rtl">X</textarea> +<textarea class="srl rtl">X</textarea>
diff --git a/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-iend-overlaps-content-001.tentative.html b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-iend-overlaps-content-001.tentative.html new file mode 100644 index 0000000..80cbbe3c --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-iend-overlaps-content-001.tentative.html
@@ -0,0 +1,37 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Test: padding-inline-end on a textarea creates space that content can render into</title> +<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#the-textarea-element-2"> +<link rel="match" href="textarea-padding-iend-overlaps-content-001-ref.html"> + +<link rel="stylesheet" href="/fonts/ahem.css"> +<style> +textarea { + font: 10px/1 Ahem; + + /* Zero out the content-box, leaving the padding area as the only + place where the contents might get rendered. */ + inline-size: 0; + block-size: 10em; + + padding-inline-end: 8em; +} +.rtl { direction: rtl; } +.vlr { writing-mode: vertical-lr; } +.vrl { writing-mode: vertical-rl; } +.slr { writing-mode: sideways-lr; } +.srl { writing-mode: sideways-rl; } +</style> + +<textarea>X</textarea> +<textarea class="rtl">X</textarea> +<br> +<textarea class="vlr">X</textarea> +<textarea class="vrl">X</textarea> +<textarea class="slr">X</textarea> +<textarea class="srl">X</textarea> +<br> +<textarea class="vlr rtl">X</textarea> +<textarea class="vrl rtl">X</textarea> +<textarea class="slr rtl">X</textarea> +<textarea class="srl rtl">X</textarea>
diff --git a/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-istart-moves-content-001-ref.html b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-istart-moves-content-001-ref.html new file mode 100644 index 0000000..eb88858 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-istart-moves-content-001-ref.html
@@ -0,0 +1,34 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Reference Case</title> + +<link rel="stylesheet" href="/fonts/ahem.css"> +<style> +textarea { + font: 10px/1 Ahem; + + inline-size: 8em; + block-size: 10em; + + padding-inline-start: 0; + padding-inline-end: 0; +} +.rtl { direction: rtl; } +.vlr { writing-mode: vertical-lr; } +.vrl { writing-mode: vertical-rl; } +.slr { writing-mode: sideways-lr; } +.srl { writing-mode: sideways-rl; } +</style> + +<textarea></textarea> +<textarea class="rtl"></textarea> +<br> +<textarea class="vlr"></textarea> +<textarea class="vrl"></textarea> +<textarea class="slr"></textarea> +<textarea class="srl"></textarea> +<br> +<textarea class="vlr rtl"></textarea> +<textarea class="vrl rtl"></textarea> +<textarea class="slr rtl"></textarea> +<textarea class="srl rtl"></textarea>
diff --git a/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-istart-moves-content-001.tentative.html b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-istart-moves-content-001.tentative.html new file mode 100644 index 0000000..f5abf84 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-textarea-element/textarea-padding-istart-moves-content-001.tentative.html
@@ -0,0 +1,46 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Test: padding-inline-start on a textarea moves the textarea content over, potentially out of the textarea's scrollport</title> +<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#the-textarea-element-2"> +<link rel="match" href="textarea-padding-istart-moves-content-001-ref.html"> + +<link rel="stylesheet" href="/fonts/ahem.css"> +<style> +textarea { + font: 10px/1 Ahem; + + /* Zero out the content-box, leaving the padding area as the only + place where the contents might get rendered. */ + inline-size: 0; + block-size: 10em; + + padding-inline-start: 8em; + padding-inline-end: 0; + + /* We expect the textarea's content to overflow in the inline direction, + which makes the textarea blank, aside from any scrollbars that might get + created by this overflow. We use overflow:hidden here to suppress these + scrollbars, so that the reference case can just use a trivial empty + textarea (without needing to worry about mocking up scrollbars of + precisely the right size). */ + overflow: hidden; +} +.rtl { direction: rtl; } +.vlr { writing-mode: vertical-lr; } +.vrl { writing-mode: vertical-rl; } +.slr { writing-mode: sideways-lr; } +.srl { writing-mode: sideways-rl; } +</style> + +<textarea>X</textarea> +<textarea class="rtl">X</textarea> +<br> +<textarea class="vlr">X</textarea> +<textarea class="vrl">X</textarea> +<textarea class="slr">X</textarea> +<textarea class="srl">X</textarea> +<br> +<textarea class="vlr rtl">X</textarea> +<textarea class="vrl rtl">X</textarea> +<textarea class="slr rtl">X</textarea> +<textarea class="srl rtl">X</textarea>
diff --git a/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-001-ref.html b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-001-ref.html new file mode 100644 index 0000000..5161f0d --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-001-ref.html
@@ -0,0 +1,12 @@ +<!DOCTYPE html> +<meta charset="utf-8" > +<meta name="author" title="Di Zhang" href="mailto:dizhangg@chromium.org"> +<meta name="assert" content="Child node in host are default assigned to unnamed slot, when dynamically created."> +<title>Shadow DOM: Slots and fallback contents</title> + +<p>Test passes if there are two lines of text "A", "B" below.</p> + +<div> + <div>A</div> + <div>B</div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-001.html b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-001.html new file mode 100644 index 0000000..e6e8747c --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-001.html
@@ -0,0 +1,21 @@ +<!DOCTYPE html> +<meta charset="utf-8" > +<meta name="author" title="Di Zhang" href="mailto:dizhangg@chromium.org"> +<meta name="assert" content="Child nodes in host are default assigned to unnamed slot, when dynamically created."> +<title>Shadow DOM: Slots and fallback contents</title> +<link rel="match" href="slot-fallback-content-001-ref.html"> + +<p>Test passes if there are two lines of text "A", "B" below.</p> + +<div id="host"> + <slot id="slot1">FAIL</slot> + <div id="A">A</div> + <div id="A">B</div> +</div> + +<script> +// Both divs A and B overwrite fallback contents of default slot +const shadowRoot = host.attachShadow({ mode: "open" }); +shadowRoot.appendChild(slot1); + +</script>
diff --git a/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-002-ref.html b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-002-ref.html new file mode 100644 index 0000000..2940bceb --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-002-ref.html
@@ -0,0 +1,12 @@ +<!DOCTYPE html> +<meta charset="utf-8" > +<meta name="author" title="Di Zhang" href="mailto:dizhangg@chromium.org"> +<meta name="assert" content="Assigned nodes overwrite fallback contents of slots, when dynamically created."> +<title>Shadow DOM: Slots and fallback contents</title> + +<p>Test passes if there are two lines of text "A", "B" below.</p> + +<div> + <div>A</div> + <div>B</div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-002.html b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-002.html new file mode 100644 index 0000000..16f2dea --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-002.html
@@ -0,0 +1,22 @@ +<!DOCTYPE html> +<meta charset="utf-8" > +<meta name="author" title="Di Zhang" href="mailto:dizhangg@chromium.org"> +<meta name="assert" content="Assigned nodes overwrite fallback contents of slots, when dynamically created."> +<title>Shadow DOM: Slots and fallback contents</title> +<link rel="match" href="slot-fallback-content-002-ref.html"> + +<p>Test passes if there are two lines of text "A", "B" below.</p> + +<div id="host"> + <slot id="slot1" name="slot1">FAIL</slot> + <slot id="slot2" name="slot2">FAIL</slot> + <div id="A" slot="slot1">A</div> + <div id="B" slot="slot2">B</div> +</div> + +<script> +const shadowRoot = host.attachShadow({ mode: "open" }); +shadowRoot.appendChild(slot1); +shadowRoot.appendChild(slot2); + +</script>
diff --git a/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-003-ref.html b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-003-ref.html new file mode 100644 index 0000000..ad735ec --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-003-ref.html
@@ -0,0 +1,20 @@ +<!DOCTYPE html> +<meta charset="utf-8" > +<meta name="author" title="Di Zhang" href="mailto:dizhangg@chromium.org"> +<meta name="assert" content="Modify slot fallback contents, when dynamically created."> +<title>Shadow DOM: Slots and fallback contents</title> + +<p>Test passes if there are two lines of text "SLOT1", "A" below.</p> + +<div> + <div>SLOT1</div> + <div>A</div> +</div> + +<p>Test passes if there is one line of text "C" below.</p> + +<div> + <div>C</div> +</div> + +<p>Test passes if empty.</p>
diff --git a/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-003.html b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-003.html new file mode 100644 index 0000000..ab7b2af0 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-003.html
@@ -0,0 +1,47 @@ +<!DOCTYPE html> +<meta charset="utf-8" > +<meta name="author" title="Di Zhang" href="mailto:dizhangg@chromium.org"> +<meta name="assert" content="Modify slot fallback contents, when dynamically created."> +<title>Shadow DOM: Slots and fallback contents</title> +<link rel="match" href="slot-fallback-content-003-ref.html"> + +<p>Test passes if there are two lines of text "SLOT1", "A" below.</p> + +<div id="host1"><slot id="slot1">SLOT1</slot></div> + +<p>Test passes if there is one line of text "C" below.</p> + +<div id="host2"><slot id="slot2"> + <div id="B">FAIL</div> + <div id="C">C</div> +</slot></div> + +<p>Test passes if empty.</p> + +<div id="host3"> + <slot id="slot3"> + <div id="D">FAIL</div> + </slot> +</div> + +<script> +// Content added to existing fallback content will be rendered +const shadowRoot1 = host1.attachShadow({ mode: "open" }); +shadowRoot1.appendChild(slot1); +const A = document.createElement('div'); +A.innerText = 'A'; +shadowRoot1.getElementById('slot1').appendChild(A); + +// Remove some content from existing slot fallback will render the leftover fallback +const shadowRoot2 = host2.attachShadow({ mode: "open" }); +shadowRoot2.appendChild(slot2); +const B = shadowRoot2.getElementById('B'); +B.remove(); + +// // Remove all content from existing slot fallback will render no fallback +const shadowRoot3 = host3.attachShadow({ mode: "open" }); +shadowRoot3.appendChild(slot3); +const D = shadowRoot3.getElementById('D'); +D.remove(); + +</script>
diff --git a/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-004-ref.html b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-004-ref.html new file mode 100644 index 0000000..85d8f6ef --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-004-ref.html
@@ -0,0 +1,25 @@ +<!DOCTYPE html> +<meta charset="utf-8" > +<meta name="author" title="Di Zhang" href="mailto:dizhangg@chromium.org"> +<meta name="assert" content="Remove assigned light nodes of a slot, when dynamically created."> +<title>Shadow DOM: Slots and fallback contents</title> + +<p>Test passes if there is one line of text "SLOT1" below.</p> + +<div> + <div>SLOT1</div> +</div> + +<p>Test passes if empty.</p> + +<p>Test passes if there is one line of text "SLOT3" below.</p> + +<div> + <div>SLOT3</div> +</div> + +<p>Test passes if there is one line of text "SLOT4" below.</p> + +<div> + <div>SLOT4</div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-004.html b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-004.html new file mode 100644 index 0000000..b7ca714 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-004.html
@@ -0,0 +1,58 @@ +<!DOCTYPE html> +<meta charset="utf-8" > +<meta name="author" title="Di Zhang" href="mailto:dizhangg@chromium.org"> +<meta name="assert" content="Remove assigned light nodes of a slot, when dynamically created."> +<title>Shadow DOM: Slots and fallback contents</title> +<link rel="match" href="slot-fallback-content-004-ref.html"> + +<p>Test passes if there is one line of text "SLOT1" below.</p> + +<div id="host1"> + <slot id="slot1" name="slot1">SLOT1</slot> + <div id="A" slot="slot1">FAIL</div> +</div> + +<p>Test passes if empty.</p> + +<div id="host2"> + <slot id="slot2" name="slot2"></slot> + <div id="B" slot="slot2">FAIL</div> +</div> + +<p>Test passes if there is one line of text "SLOT3" below.</p> + +<div id="host3"> + <slot id="slot3" name="slot3">SLOT3</slot> + <div id="C" slot="slot3">FAIL</div> +</div> + +<p>Test passes if there is one line of text "SLOT4" below.</p> + +<div id="host4"> + <slot id="slot4" name="slot4">SLOT4</slot> + <div id="D" slot="slot4">FAIL</div> +</div> + +<script> +// Remove a slot's assigned node should show fallback content +const shadowRoot1 = host1.attachShadow({ mode: "open" }); +shadowRoot1.appendChild(slot1); +A.remove(); + +// Remove a slot's assigned node with no fallback should show nothing +const shadowRoot2 = host2.attachShadow({ mode: "open" }); +shadowRoot2.appendChild(slot2); +B.remove(); + +// Remove the slot attribute to an assigned node should show fallback content +const shadowRoot3 = host3.attachShadow({ mode: "open" }); +shadowRoot3.appendChild(slot3); +C.removeAttribute('slot'); + +// Change the slot attribute to an assigned node to an unknown slot +// should show fallback content +const shadowRoot4 = host4.attachShadow({ mode: "open" }); +shadowRoot4.appendChild(slot4); +D.setAttribute('slot', 'invalid'); + +</script>
diff --git a/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-005-ref.html b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-005-ref.html new file mode 100644 index 0000000..23bfc2c --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-005-ref.html
@@ -0,0 +1,7 @@ +<!DOCTYPE html> +<meta charset="utf-8" > +<meta name="author" title="Di Zhang" href="mailto:dizhangg@chromium.org"> +<meta name="assert" content="Remove slot with assigned node, when dynamically created."> +<title>Shadow DOM: Slots and fallback contents</title> + +<p>Test passes if empty.</p>
diff --git a/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-005.html b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-005.html new file mode 100644 index 0000000..37e383a --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-005.html
@@ -0,0 +1,21 @@ +<!DOCTYPE html> +<meta charset="utf-8" > +<meta name="author" title="Di Zhang" href="mailto:dizhangg@chromium.org"> +<meta name="assert" content="Remove slot with assigned node, when dynamically created."> +<title>Shadow DOM: Slots and fallback contents</title> +<link rel="match" href="slot-fallback-content-005-ref.html"> + +<p>Test passes if empty.</p> + +<div id="host"> + <slot id="slot1" name="slot1">FAIL</slot> + <div id="A" slot="slot1">FAIL</div> +</div> + +<script> +const shadowRoot = host.attachShadow({ mode: "open" }); +shadowRoot.appendChild(slot1); +const s1 = shadowRoot.getElementById('slot1'); +s1.remove(); + +</script>
diff --git a/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-006-ref.html b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-006-ref.html new file mode 100644 index 0000000..85d53bf --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-006-ref.html
@@ -0,0 +1,38 @@ +<!DOCTYPE html> +<meta charset="utf-8" > +<meta name="author" title="Di Zhang" href="mailto:dizhangg@chromium.org"> +<meta name="assert" content="Imperatively assigned node overwrites fallback contents, when dynamically created."> +<title>Shadow DOM: Slots and fallback contents</title> + +<p>Test passes if there are two lines of text "B", "A" below.</p> + +<div> + <div>B</div> + <div>A</div> +</div> + +<p>Test passes if there are two lines of text "D", "C" below.</p> + +<div> + <div>D</div> + <div>C</div> +</div> + +<p>Test passes if there are two lines of text "F", "E" below.</p> + +<div> + <div>F</div> + <div>E</div> +</div> + +<p>Test passes if there is one line of text "SLOT4" below.</p> + +<div> + <div>SLOT4</div> +</div> + +<p>Test passes if there is one line of text "SLOT5" below.</p> + +<div> + <div>SLOT5</div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-006.html b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-006.html new file mode 100644 index 0000000..4708ee7 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-006.html
@@ -0,0 +1,109 @@ +<!DOCTYPE html> +<meta charset="utf-8" > +<meta name="author" title="Di Zhang" href="mailto:dizhangg@chromium.org"> +<meta name="assert" content="Imperatively assigned node overwrites fallback contents, when dynamically created."> +<title>Shadow DOM: Slots and fallback contents</title> +<link rel="match" href="slot-fallback-content-006-ref.html"> + +<p>Test passes if there are two lines of text "B", "A" below.</p> + +<div id="host1"> + <slot id="slot1" name="slot1">FAIL</slot> +</div> +<div id="A">A</div> +<div id="B">B</div> + +<p>Test passes if there are two lines of text "D", "C" below.</p> + +<div id="host2"> + <slot id="slot2" name="slot2">FAIL</slot> +</div> +<div id="C">C</div> +<div id="D">D</div> + +<p>Test passes if there are two lines of text "F", "E" below.</p> + +<div id="host3"> + <slot id="slot3" name="slot3">FAIL</slot> +</div> +<div id="E">E</div> +<div id="F">F</div> + +<p>Test passes if there is one line of text "SLOT4" below.</p> + +<div id="host4"> + <slot id="slot4" name="slot4">SLOT4</slot> +</div> +<div id="G">FAIL</div> +<div id="H">FAIL</div> + +<p>Test passes if there is one line of text "SLOT5" below.</p> + +<div id="host5"> + <slot id="slot5" name="slot5">FAIL</slot> +</div> +<div id="I">FAIL</div> +<div id="J">FAIL</div> + +<script> +/* +1. Append nodes to document. +2. Assign nodes to slot. +*/ +const shadowRoot1 = host1.attachShadow({ mode: "open", slotAssignment: 'manual' }); +shadowRoot1.appendChild(slot1); +const s1 = shadowRoot1.getElementById('slot1'); +host1.append(A, B); +s1.assign(B, A); + +/* +1. Assign nodes to slot. +2. Append nodes to document. +*/ +const shadowRoot2 = host2.attachShadow({ mode: "open", slotAssignment: 'manual' }); +shadowRoot2.appendChild(slot2); +const s2 = shadowRoot2.getElementById('slot2'); +s2.assign(D, C); +host2.append(C, D); + +/* +1. Assign nodes to slot. +2. Change the fallback content. +3. Append nodes to document. +*/ +const shadowRoot3 = host3.attachShadow({ mode: "open", slotAssignment: 'manual' }); +shadowRoot3.appendChild(slot3); +const s3 = shadowRoot3.getElementById('slot3'); +s3.assign(F, E); +s3.innerText = 'FAIL'; +host3.append(E, F); + +/* +1. Append nodes to document. +2. Assign nodes to slot. +3. Remove nodes from document. +*/ +const shadowRoot4 = host4.attachShadow({ mode: "open", slotAssignment: 'manual' }); +shadowRoot4.appendChild(slot4); +const s4 = shadowRoot4.getElementById('slot4'); +host4.append(G, H); +s4.assign(H, G); +G.remove(); +H.remove(); + +/* +1. Append nodes to document. +2. Assign nodes to slot. +3. Change the fallback content. +4. Remove nodes from document. +*/ +const shadowRoot5 = host5.attachShadow({ mode: "open", slotAssignment: 'manual' }); +shadowRoot5.appendChild(slot5); +const s5 = shadowRoot5.getElementById('slot5'); +host5.append(I, J); +s5.assign(J, I); +s5.innerText = 'SLOT5'; +I.remove(); +J.remove(); + +</script>
diff --git a/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-007-ref.html b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-007-ref.html new file mode 100644 index 0000000..992b495 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-007-ref.html
@@ -0,0 +1,12 @@ +<!DOCTYPE html> +<meta charset="utf-8" > +<meta name="author" title="Di Zhang" href="mailto:dizhangg@chromium.org"> +<meta name="assert" content="Basic slot fallback content, when dynamically created"> +<title>Shadow DOM: Slots and fallback contents</title> + +<div> + <div>B</div> + <div>E</div> + <div>SLOT2</div> + <div>C</div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-007.html b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-007.html new file mode 100644 index 0000000..1647111 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-007.html
@@ -0,0 +1,29 @@ +<!DOCTYPE html> +<meta charset="utf-8" > +<meta name="author" title="Di Zhang" href="mailto:dizhangg@chromium.org"> +<meta name="assert" content="Basic slot fallback content, when dynamically created"> +<title>Shadow DOM: Slots and fallback contents</title> +<link rel="match" href="slot-fallback-content-007-ref.html"> + +<div id="host">FAIL + <slot id="slot1" name="slot1">FAIL</slot> + <slot id="slot2" name="slot2">SLOT2</slot> + <slot id="slot3" name="slot3"></slot> + <slot id="slot4" name="slot4"></slot> + + <div id="A">FAIL</div> + <div id="B" slot="slot1">B</div> + <div id="C" slot="slot3">C</div> + <div id="D" slot="slot-DNE">FAIL</div> + <div id="E" slot="slot1">E</div> + <div id="F">FAIL</div> +</div> + +<script> +const shadowRoot = host.attachShadow({ mode: "open" }); +shadowRoot.appendChild(slot1); +shadowRoot.appendChild(slot2); +shadowRoot.appendChild(slot3); +shadowRoot.appendChild(slot4); + +</script>
diff --git a/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-008-ref.html b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-008-ref.html new file mode 100644 index 0000000..13a3d6b --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-008-ref.html
@@ -0,0 +1,12 @@ +<!DOCTYPE html> +<meta charset="utf-8" > +<meta name="author" title="Di Zhang" href="mailto:dizhangg@chromium.org"> +<meta name="assert" content="Complex slot fallback content, when dynamically created"> +<title>Shadow DOM: Slots and fallback contents</title> + +<div> + <div>A</div> + <div>D</div> + <div>B SLOT2 SLOT5</div> + <div>C</div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-008.html b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-008.html new file mode 100644 index 0000000..3f93620 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/shadow-dom/slot-fallback-content-008.html
@@ -0,0 +1,34 @@ +<!DOCTYPE html> +<meta charset="utf-8" > +<meta name="author" title="Di Zhang" href="mailto:dizhangg@chromium.org"> +<meta name="assert" content="Complex slot fallback content, when dynamically created"> +<title>Shadow DOM: Slots and fallback contents</title> +<link rel="match" href="slot-fallback-content-008-ref.html"> + +<div id="host">FAIL + <div id="host2">FAIL + <div id="A">A + <slot id="slot1" name="slot1">FAIL</slot> + </div> + <div id="B">B + <slot id="slot2" name="slot2">SLOT2 + <slot id="slot3" name="slot3">SLOT3</slot> + </slot> + </div> + <slot id="slot4" name="slot4" slot="slot1">FAIL</slot> + <slot id="slot5" name="slot5" slot="slot3">SLOT5 + <div id="C">C</div> + </slot> + </div> + <div id="D" slot="slot4">D</div> +</div> + +<script> +const shadowRoot2 = host2.attachShadow({ mode: "open" }); +shadowRoot2.appendChild(A); +shadowRoot2.appendChild(B); + +const shadowRoot = host.attachShadow({ mode: "open" }); +shadowRoot.appendChild(host2); + +</script>
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/attached-heavy-ad.js b/third_party/blink/web_tests/http/tests/inspector-protocol/page/attached-heavy-ad.js index badd932..99f6a82 100644 --- a/third_party/blink/web_tests/http/tests/inspector-protocol/page/attached-heavy-ad.js +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/attached-heavy-ad.js
@@ -6,7 +6,7 @@ session.evaluate(` ad_frame = document.createElement('iframe'); document.body.appendChild(ad_frame); - internals.setIsAdSubframe(ad_frame); + internals.setIsAdFrame(ad_frame); `); await firstFrameAttached;
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/navigated-heavy-ad.js b/third_party/blink/web_tests/http/tests/inspector-protocol/page/navigated-heavy-ad.js index de93bfd..65651d2 100644 --- a/third_party/blink/web_tests/http/tests/inspector-protocol/page/navigated-heavy-ad.js +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/navigated-heavy-ad.js
@@ -9,13 +9,13 @@ let ad_frame = document.createElement('iframe'); document.body.appendChild(ad_frame); - internals.setIsAdSubframe(ad_frame); + internals.setIsAdFrame(ad_frame); ad_frame.width = 100; ad_frame.height = 200; ad_frame.src = "about:blank"; `); - // The first navigation will occur before the frame is set as an ad subframe. + // The first navigation will occur before the frame is set as an ad frame. // So, we wait for the second navigation before logging the adFrameType. await dp.Page.onceFrameNavigated(); const { params } = await dp.Page.onceFrameNavigated();
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/resources/ad-iframe-writer.js b/third_party/blink/web_tests/http/tests/subresource_filter/resources/ad-iframe-writer.js index 58432b9a..3b8fee4 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/resources/ad-iframe-writer.js +++ b/third_party/blink/web_tests/http/tests/subresource_filter/resources/ad-iframe-writer.js
@@ -3,6 +3,6 @@ function createAdFrame() { let ad_frame = document.createElement('iframe'); document.body.appendChild(ad_frame); - internals.setIsAdSubframe(ad_frame); + internals.setIsAdFrame(ad_frame); return ad_frame; }
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/resources/large-sticky-ad-testharness.js b/third_party/blink/web_tests/http/tests/subresource_filter/resources/large-sticky-ad-testharness.js index 7003ffb..4403edf9 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/resources/large-sticky-ad-testharness.js +++ b/third_party/blink/web_tests/http/tests/subresource_filter/resources/large-sticky-ad-testharness.js
@@ -12,5 +12,5 @@ function appendAdFrameTo(parent) { let ad_frame = document.createElement('iframe'); parent.appendChild(ad_frame); - internals.setIsAdSubframe(ad_frame); + internals.setIsAdFrame(ad_frame); }
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/resources/overlay-interstitial-ad-testharness.js b/third_party/blink/web_tests/http/tests/subresource_filter/resources/overlay-interstitial-ad-testharness.js index d17ea73..f1328d8 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/resources/overlay-interstitial-ad-testharness.js +++ b/third_party/blink/web_tests/http/tests/subresource_filter/resources/overlay-interstitial-ad-testharness.js
@@ -15,6 +15,6 @@ function appendAdFrameTo(parent) { let ad_frame = document.createElement('iframe'); parent.appendChild(ad_frame); - internals.setIsAdSubframe(ad_frame); + internals.setIsAdFrame(ad_frame); return ad_frame; }
diff --git a/third_party/blink/web_tests/virtual/automatic-lazy-frame-loading-ads/http/tests/subresource_filter/resources/lazyload-helper.js b/third_party/blink/web_tests/virtual/automatic-lazy-frame-loading-ads/http/tests/subresource_filter/resources/lazyload-helper.js index 02204838..ff1f1dd 100644 --- a/third_party/blink/web_tests/virtual/automatic-lazy-frame-loading-ads/http/tests/subresource_filter/resources/lazyload-helper.js +++ b/third_party/blink/web_tests/virtual/automatic-lazy-frame-loading-ads/http/tests/subresource_filter/resources/lazyload-helper.js
@@ -14,7 +14,7 @@ } elm.appendChild(frame); - internals.setIsAdSubframe(frame); + internals.setIsAdFrame(frame); // Simulate 3P domain const third_pary_origin = get_host_info().HTTPS_REMOTE_ORIGIN;
diff --git a/third_party/blink/web_tests/wpt_internal/lazyembed/automatic-lazy-frame-loading.sub.html b/third_party/blink/web_tests/wpt_internal/lazyembed/automatic-lazy-frame-loading.sub.html index d70288d3..f87c058 100644 --- a/third_party/blink/web_tests/wpt_internal/lazyembed/automatic-lazy-frame-loading.sub.html +++ b/third_party/blink/web_tests/wpt_internal/lazyembed/automatic-lazy-frame-loading.sub.html
@@ -36,7 +36,7 @@ const iframe = _createSimpleFrame(); // In order to mark the frame as ad, we need to append it in advance. parentElement.appendChild(iframe); - internals.setIsAdSubframe(iframe); + internals.setIsAdFrame(iframe); // After the ad tagging, set other attributes including src. _setAttributes(iframe, id, src); };
diff --git a/third_party/ipcz/src/BUILD.gn b/third_party/ipcz/src/BUILD.gn index 155fa292..f434cab 100644 --- a/third_party/ipcz/src/BUILD.gn +++ b/third_party/ipcz/src/BUILD.gn
@@ -234,6 +234,7 @@ "ipcz/portal.h", "ipcz/ref_counted_fragment.h", "ipcz/remote_router_link.h", + "ipcz/route_edge.h", "ipcz/router.h", "ipcz/router_link.h", "ipcz/router_link_state.h", @@ -282,6 +283,7 @@ "ipcz/portal.cc", "ipcz/ref_counted_fragment.cc", "ipcz/remote_router_link.cc", + "ipcz/route_edge.cc", "ipcz/router.cc", "ipcz/router_descriptor.cc", "ipcz/router_descriptor.h", @@ -375,6 +377,7 @@ "ipcz/node_test.cc", "ipcz/parcel_queue_test.cc", "ipcz/ref_counted_fragment_test.cc", + "ipcz/route_edge_test.cc", "ipcz/router_link_test.cc", "ipcz/sequenced_queue_test.cc", "reference_drivers/sync_reference_driver_test.cc",
diff --git a/third_party/ipcz/src/ipcz/node_name.cc b/third_party/ipcz/src/ipcz/node_name.cc index 6dd7ac134..892ea909 100644 --- a/third_party/ipcz/src/ipcz/node_name.cc +++ b/third_party/ipcz/src/ipcz/node_name.cc
@@ -4,24 +4,19 @@ #include "ipcz/node_name.h" -#include <cinttypes> -#include <cstdint> -#include <cstdio> #include <string> #include <type_traits> #include "third_party/abseil-cpp/absl/base/macros.h" +#include "third_party/abseil-cpp/absl/strings/str_cat.h" namespace ipcz { static_assert(std::is_standard_layout<NodeName>::value, "Invalid NodeName"); std::string NodeName::ToString() const { - std::string name(33, 0); - int length = snprintf(name.data(), name.size(), "%016" PRIx64 "%016" PRIx64, - high_, low_); - ABSL_ASSERT(length == 32); - return name; + return absl::StrCat(absl::Hex(high_, absl::kZeroPad16), + absl::Hex(low_, absl::kZeroPad16)); } } // namespace ipcz
diff --git a/third_party/ipcz/src/ipcz/route_edge.cc b/third_party/ipcz/src/ipcz/route_edge.cc new file mode 100644 index 0000000..5c702a5 --- /dev/null +++ b/third_party/ipcz/src/ipcz/route_edge.cc
@@ -0,0 +1,99 @@ +// 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 "ipcz/route_edge.h" + +#include <utility> + +#include "ipcz/router.h" +#include "ipcz/router_link.h" +#include "util/log.h" + +namespace ipcz { + +RouteEdge::RouteEdge() = default; + +RouteEdge::~RouteEdge() = default; + +void RouteEdge::SetPrimaryLink(Ref<RouterLink> link) { + ABSL_ASSERT(!primary_link_); + if (is_decay_deferred_) { + // This edge was set to decay its primary link before it had a primary link, + // so this primary link must be immediately set to decay. + is_decay_deferred_ = false; + decaying_link_ = std::move(link); + if (decaying_link_) { + DVLOG(4) << "Edge adopted decaying " << decaying_link_->Describe(); + } + } else { + primary_link_ = std::move(link); + if (primary_link_) { + DVLOG(4) << "Edge adopted " << primary_link_->Describe(); + } + } +} + +Ref<RouterLink> RouteEdge::ReleasePrimaryLink() { + return std::move(primary_link_); +} + +Ref<RouterLink> RouteEdge::ReleaseDecayingLink() { + return std::move(decaying_link_); +} + +bool RouteEdge::BeginPrimaryLinkDecay() { + if (decaying_link_ || is_decay_deferred_) { + return false; + } + + decaying_link_ = std::move(primary_link_); + is_decay_deferred_ = !decaying_link_; + return true; +} + +bool RouteEdge::ShouldTransmitOnDecayingLink(SequenceNumber n) const { + return (decaying_link_ || is_decay_deferred_) && + (!length_to_decaying_link_ || n < *length_to_decaying_link_); +} + +bool RouteEdge::MaybeFinishDecay(SequenceNumber length_sent, + SequenceNumber length_received) { + if (!decaying_link_) { + return false; + } + + if (!length_to_decaying_link_) { + DVLOG(4) << "Cannot decay yet with no known sequence length to " + << decaying_link_->Describe(); + return false; + } + + if (!length_from_decaying_link_) { + DVLOG(4) << "Cannot decay yet with no known sequence length to " + << decaying_link_->Describe(); + return false; + } + + if (length_sent < *length_to_decaying_link_) { + DVLOG(4) << "Cannot decay yet without sending full sequence up to " + << *length_to_decaying_link_ << " on " + << decaying_link_->Describe(); + return false; + } + + if (length_received < *length_from_decaying_link_) { + DVLOG(4) << "Cannot decay yet without receiving full sequence up to " + << *length_from_decaying_link_ << " on " + << decaying_link_->Describe(); + return false; + } + + ABSL_ASSERT(!is_decay_deferred_); + decaying_link_.reset(); + length_to_decaying_link_.reset(); + length_from_decaying_link_.reset(); + return true; +} + +} // namespace ipcz
diff --git a/third_party/ipcz/src/ipcz/route_edge.h b/third_party/ipcz/src/ipcz/route_edge.h new file mode 100644 index 0000000..01079af --- /dev/null +++ b/third_party/ipcz/src/ipcz/route_edge.h
@@ -0,0 +1,150 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IPCZ_SRC_IPCZ_ROUTE_EDGE_H_ +#define IPCZ_SRC_IPCZ_ROUTE_EDGE_H_ + +#include "ipcz/router_link.h" +#include "ipcz/sequence_number.h" +#include "ipcz/sublink_id.h" +#include "third_party/abseil-cpp/absl/base/macros.h" +#include "third_party/abseil-cpp/absl/types/optional.h" +#include "util/ref_counted.h" + +namespace ipcz { + +class NodeLink; +class Router; +class RouterLink; + +// A RouteEdge is responsible for message ingress and egress on one +// (inward-facing or outward-facing) side of a router. Every functioning router +// has one outward edge and (if proxying) one inward edge. +// +// Over the course of its lifetime a RouteEdge may utilize many different +// RouterLinks, but at any moment it has at most two: one "primary" link and one +// "decaying" link. +// +// The decaying link's usage is restricted to transmission and receipt of a +// limited range of parcels based on SequenceNumber, and once all expected +// parcels are sent and received, the link is dropped from the edge. +// +// When a RouteEdge has no decaying link, it may be able to transition its +// primary link to a decaying link, while adopting a new primary link to take +// its place. This process of incremental link replacement is the basis for ipcz +// route reduction. +// +// This object is not thread-safe. +class RouteEdge { + public: + RouteEdge(); + RouteEdge(const RouteEdge&) = delete; + RouteEdge& operator=(const RouteEdge&) = delete; + ~RouteEdge(); + + const Ref<RouterLink>& primary_link() const { return primary_link_; } + const Ref<RouterLink>& decaying_link() const { return decaying_link_; } + + // Indicates whether this edge is stable, meaning it has no decaying link and + // it is not set to decay the next primary link it adopts. + bool is_stable() const { return !decaying_link_ && !is_decay_deferred_; } + + // These accessors set the limits on the current (or deferred) decaying link. + // Once both of these values are set, the decaying link will be dropped from + // this edge as soon as the link transmits all messages up to (but not + // including) the SequenceNumber in `length_to_decaying_link_` AND the link + // receives all messages up to (but not including) the SequenceNumber in + // `length_from_decaying_link_`. + void set_length_to_decaying_link(SequenceNumber length) { + ABSL_ASSERT(!is_stable()); + ABSL_ASSERT(!length_to_decaying_link_); + length_to_decaying_link_ = length; + } + + void set_length_from_decaying_link(SequenceNumber length) { + ABSL_ASSERT(!is_stable()); + ABSL_ASSERT(!length_from_decaying_link_); + length_from_decaying_link_ = length; + } + + absl::optional<SequenceNumber> length_to_decaying_link() const { + return length_to_decaying_link_; + } + + absl::optional<SequenceNumber> length_from_decaying_link() const { + return length_from_decaying_link_; + } + + // Sets the primary link for this edge. Only valid to call if the edge does + // not currently have a primary link. + void SetPrimaryLink(Ref<RouterLink> link); + + // Releases this edge's primary link and returns a reference to it. + Ref<RouterLink> ReleasePrimaryLink(); + + // Releases this edge's decaying link and returns a reference to it. + Ref<RouterLink> ReleaseDecayingLink(); + + // Sets the current primary link to begin decay; or if there is no primary + // link yet, marks this edge for deferred decay. In the latter case, the next + // primary link adopted by this edge will immediately begin to decay. This may + // only be called while the edge has no decaying link. + bool BeginPrimaryLinkDecay(); + + // Indicates whether a parcel with the given SequenceNumber should be + // transmitted over this edge's decaying link. If not, the parcel should be + // transmitted over this edge's primary link. + bool ShouldTransmitOnDecayingLink(SequenceNumber sequence_number) const; + + // Attempts to drop this edge's decaying link, given that it has already + // transmitted a parcel sequence up to `length_sent` and received a parcel + // sequence up to `length_received`. Returns true if the decaying link was + // dropped, and false otherwise. + bool MaybeFinishDecay(SequenceNumber length_sent, + SequenceNumber length_received); + + private: + // The primary link over which this edge transmits and accepts parcels and + // other messages. If a decaying link is also present, then the decaying link + // is preferred for transmission of all parcels with a SequenceNumber up to + // (but not including) `length_to_decaying_link_`. If that value is not set, + // the decaying link is always preferred when set. + Ref<RouterLink> primary_link_; + + // If true, this edge was marked to decay its primary link before it actually + // acquired a primary link. In that case the next primary link adopted by + // this edge will be demoted immediately to a decaying link. + bool is_decay_deferred_ = false; + + // If non-null, this is a link which used to be the edge's primary link but + // which is being phased out. The decaying link may continue to receive + // parcels, but once `length_from_decaying_link_` is set, it will only expect + // to receive parcels with a SequenceNumber up to (but not including) that + // value. Similarly, the decaying link will be preferred for message + // transmission as long as `length_to_decaying_link_` remains unknown, but as + // soon as that value is set, only parcels with a SequenceNumber up to + // (but not including) that value will be transmitted over this link. Once + // both sequence lengths are known and surpassed, the edge will drop this + // link. + Ref<RouterLink> decaying_link_; + + // If present, the length of the parcel sequence after which this edge must + // stop using `decaying_link_` to transmit parcels. If this is 5, then the + // decaying link must be used to transmit any new parcels with a + // SequenceNumber in the range [0, 4] inclusive. Beyond that point the primary + // link must be used. + absl::optional<SequenceNumber> length_to_decaying_link_; + + // If present, the length of the parcel sequence after which this edge can + // stop expecting to receive parcels over `decaying_link_`. If this is 7, then + // the Router using this edge should still expect to receive parcels from the + // decaying link as long as it is missing any parcel in the range [0, 6] + // inclusive. Beyond that point parcels should only be expected from the + // primary link. + absl::optional<SequenceNumber> length_from_decaying_link_; +}; + +} // namespace ipcz + +#endif // IPCZ_SRC_IPCZ_ROUTE_EDGE_H_
diff --git a/third_party/ipcz/src/ipcz/route_edge_test.cc b/third_party/ipcz/src/ipcz/route_edge_test.cc new file mode 100644 index 0000000..53134e4 --- /dev/null +++ b/third_party/ipcz/src/ipcz/route_edge_test.cc
@@ -0,0 +1,129 @@ +// 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 "ipcz/route_edge.h" + +#include <tuple> + +#include "ipcz/ipcz.h" +#include "ipcz/link_type.h" +#include "ipcz/local_router_link.h" +#include "ipcz/router.h" +#include "ipcz/sequence_number.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "util/ref_counted.h" + +namespace ipcz { +namespace { + +class RouteEdgeTest : public testing::Test { + public: + Ref<RouterLink> CreateLink() { + // This link does not need to be usable, it just needs to be unique. Hence + // we create and link two throwaway routers. and return one of their links. + auto a = MakeRefCounted<Router>(); + auto b = MakeRefCounted<Router>(); + auto [a_link, b_blink] = + LocalRouterLink::ConnectRouters(LinkType::kCentral, {a, b}); + a->CloseRoute(); + b->CloseRoute(); + return a_link; + } +}; + +TEST_F(RouteEdgeTest, Stability) { + RouteEdge edge; + + // Fresh edges are stable. + EXPECT_TRUE(edge.is_stable()); + + // Edges with only a primary link are stable. + auto link = CreateLink(); + edge.SetPrimaryLink(link); + EXPECT_TRUE(edge.is_stable()); + edge.ReleasePrimaryLink(); + + // Edges with a deferred decaying link are not stable. + edge.BeginPrimaryLinkDecay(); + EXPECT_FALSE(edge.is_stable()); + + // Edges with only a decaying link are not stable. This link will be set to + // decay immediately due to the deferred decay from above. + edge.SetPrimaryLink(link); + EXPECT_FALSE(edge.is_stable()); + + // Edges with both a primary and decaying link are still not stable. + auto new_link = CreateLink(); + edge.SetPrimaryLink(new_link); + EXPECT_FALSE(edge.is_stable()); + + // But once the decaying link is dropped, the edge is stable again. + edge.ReleaseDecayingLink(); + EXPECT_TRUE(edge.is_stable()); +} + +TEST_F(RouteEdgeTest, LinkSelection) { + RouteEdge edge; + auto first_link = CreateLink(); + auto second_link = CreateLink(); + + // With no primary or decaying link, the primary link is the default choice. + EXPECT_FALSE(edge.ShouldTransmitOnDecayingLink(SequenceNumber(0))); + + // Now with only a primary link, that link is always selected. + edge.SetPrimaryLink(first_link); + EXPECT_FALSE(edge.ShouldTransmitOnDecayingLink(SequenceNumber(0))); + EXPECT_FALSE(edge.ShouldTransmitOnDecayingLink(SequenceNumber(5))); + EXPECT_FALSE(edge.ShouldTransmitOnDecayingLink(SequenceNumber(10))); + + // With a decaying link but no outgoing sequence length limit, the decaying + // link is always selected. + edge.BeginPrimaryLinkDecay(); + edge.SetPrimaryLink(second_link); + EXPECT_EQ(second_link, edge.primary_link()); + EXPECT_EQ(first_link, edge.decaying_link()); + EXPECT_TRUE(edge.ShouldTransmitOnDecayingLink(SequenceNumber(0))); + EXPECT_TRUE(edge.ShouldTransmitOnDecayingLink(SequenceNumber(5))); + EXPECT_TRUE(edge.ShouldTransmitOnDecayingLink(SequenceNumber(10))); + + // Finally, with a limit on the decaying link's sequence length, selection now + // depends on the specific SequenceNumber being transmitted. + edge.set_length_to_decaying_link(SequenceNumber(5)); + EXPECT_TRUE(edge.ShouldTransmitOnDecayingLink(SequenceNumber(0))); + EXPECT_TRUE(edge.ShouldTransmitOnDecayingLink(SequenceNumber(4))); + EXPECT_FALSE(edge.ShouldTransmitOnDecayingLink(SequenceNumber(5))); + EXPECT_FALSE(edge.ShouldTransmitOnDecayingLink(SequenceNumber(10))); +} + +TEST_F(RouteEdgeTest, FinishDecay) { + RouteEdge edge; + auto link = CreateLink(); + edge.SetPrimaryLink(link); + edge.BeginPrimaryLinkDecay(); + + // Decay cannot finish until inbound and outbound sequence length limits are + // set. + EXPECT_FALSE(edge.MaybeFinishDecay(SequenceNumber(0), SequenceNumber(0))); + edge.set_length_to_decaying_link(SequenceNumber(0)); + EXPECT_FALSE(edge.MaybeFinishDecay(SequenceNumber(0), SequenceNumber(0))); + edge.set_length_from_decaying_link(SequenceNumber(0)); + EXPECT_TRUE(edge.decaying_link()); + EXPECT_TRUE(edge.MaybeFinishDecay(SequenceNumber(0), SequenceNumber(0))); + EXPECT_FALSE(edge.decaying_link()); + + // Decay also cannot finish while the sequence length limits have not yet + // been met by messages transmitted and received over the decaying link. + edge.SetPrimaryLink(link); + edge.BeginPrimaryLinkDecay(); + edge.set_length_to_decaying_link(SequenceNumber(2)); + edge.set_length_from_decaying_link(SequenceNumber(4)); + EXPECT_FALSE(edge.MaybeFinishDecay(SequenceNumber(1), SequenceNumber(3))); + EXPECT_FALSE(edge.MaybeFinishDecay(SequenceNumber(1), SequenceNumber(4))); + EXPECT_TRUE(edge.decaying_link()); + EXPECT_TRUE(edge.MaybeFinishDecay(SequenceNumber(2), SequenceNumber(4))); + EXPECT_FALSE(edge.decaying_link()); +} + +} // namespace +} // namespace ipcz
diff --git a/third_party/ipcz/src/ipcz/router.cc b/third_party/ipcz/src/ipcz/router.cc index afb2585..62e5c49 100644 --- a/third_party/ipcz/src/ipcz/router.cc +++ b/third_party/ipcz/src/ipcz/router.cc
@@ -21,6 +21,48 @@ namespace ipcz { +namespace { + +// Helper structure used to accumulate individual parcel flushing operations +// within Router::Flush(), via CollectParcelsToFlush() below. +struct ParcelToFlush { + // The link over which to flush this parcel. + RouterLink* link; + + // The parcel to be flushed. + Parcel parcel; +}; + +using ParcelsToFlush = absl::InlinedVector<ParcelToFlush, 8>; + +// Helper which attempts to pop elements from `queue` for transmission along +// `edge`. This terminates either when `queue` is exhausted, or the next parcel +// in `queue` is to be transmitted over a link that is not yet known to `edge`. +// Any successfully popped elements are accumulated at the end of `parcels`. +void CollectParcelsToFlush(ParcelQueue& queue, + const RouteEdge& edge, + ParcelsToFlush& parcels) { + RouterLink* decaying_link = edge.decaying_link().get(); + RouterLink* primary_link = edge.primary_link().get(); + while (queue.HasNextElement()) { + const SequenceNumber n = queue.current_sequence_number(); + RouterLink* link = nullptr; + if (decaying_link && edge.ShouldTransmitOnDecayingLink(n)) { + link = decaying_link; + } else if (primary_link && !edge.ShouldTransmitOnDecayingLink(n)) { + link = primary_link; + } else { + return; + } + + ParcelToFlush& parcel = parcels.emplace_back(ParcelToFlush{.link = link}); + const bool popped = queue.Pop(parcel.parcel); + ABSL_ASSERT(popped); + } +} + +} // namespace + Router::Router() = default; Router::~Router() { @@ -49,10 +91,8 @@ bool Router::HasLocalPeer(Router& router) { absl::MutexLock lock(&mutex_); - if (!outward_link_) { - return false; - } - return outward_link_->HasLocalPeer(router); + return outward_edge_.primary_link() && + outward_edge_.primary_link()->HasLocalPeer(router); } IpczResult Router::SendOutboundParcel(Parcel& parcel) { @@ -67,14 +107,15 @@ const SequenceNumber sequence_number = outbound_parcels_.GetCurrentSequenceLength(); parcel.set_sequence_number(sequence_number); - if (outward_link_ && + if (outward_edge_.primary_link() && outbound_parcels_.MaybeSkipSequenceNumber(sequence_number)) { + link = outward_edge_.primary_link(); + } else { // If there are no unsent parcels ahead of this one in the outbound // sequence, and we have an active outward link, we can immediately - // transmit the parcel without any intermediate queueing step. This is the - // most common case. - link = outward_link_; - } else { + // transmit the parcel without any intermediate queueing step. That is the + // most common case, but otherwise we have to queue the parcel here and it + // will be flushed out ASAP. DVLOG(4) << "Queuing outbound " << parcel.Describe(); const bool push_ok = outbound_parcels_.Push(sequence_number, std::move(parcel)); @@ -108,10 +149,8 @@ { absl::MutexLock lock(&mutex_); - ABSL_ASSERT(!outward_link_); - if (!is_disconnected_) { - outward_link_ = std::move(link); + outward_edge_.SetPrimaryLink(std::move(link)); } } @@ -136,10 +175,13 @@ return true; } - status_.num_local_parcels = inbound_parcels_.GetNumAvailableElements(); - status_.num_local_bytes = inbound_parcels_.GetTotalAvailableElementSize(); - traps_.UpdatePortalStatus(status_, TrapSet::UpdateReason::kNewLocalParcel, - dispatcher); + if (!inward_edge_) { + // If this is a terminal router, we may have trap events to fire. + status_.num_local_parcels = inbound_parcels_.GetNumAvailableElements(); + status_.num_local_bytes = inbound_parcels_.GetTotalAvailableElementSize(); + traps_.UpdatePortalStatus(status_, TrapSet::UpdateReason::kNewLocalParcel, + dispatcher); + } } Flush(); @@ -184,7 +226,7 @@ *inbound_parcels_.final_sequence_length() <= sequence_length; } - if (!inward_link_) { + if (!inward_edge_) { status_.flags |= IPCZ_PORTAL_STATUS_PEER_CLOSED; if (inbound_parcels_.IsSequenceFullyConsumed()) { status_.flags |= IPCZ_PORTAL_STATUS_DEAD; @@ -223,10 +265,12 @@ } // Wipe out all remaining links and propagate the disconnection over them. - forwarding_links.push_back(std::move(outward_link_)); - forwarding_links.push_back(std::move(inward_link_)); - - if (!inward_link_) { + forwarding_links.push_back(outward_edge_.ReleasePrimaryLink()); + forwarding_links.push_back(outward_edge_.ReleaseDecayingLink()); + if (inward_edge_) { + forwarding_links.push_back(inward_edge_->ReleasePrimaryLink()); + forwarding_links.push_back(inward_edge_->ReleaseDecayingLink()); + } else { // Terminal routers may have trap events to fire. status_.flags |= IPCZ_PORTAL_STATUS_PEER_CLOSED; if (inbound_parcels_.IsSequenceFullyConsumed()) { @@ -336,7 +380,7 @@ descriptor.new_sublink, nullptr, LinkType::kPeripheralOutward, LinkSide::kB, router); if (new_link) { - router->outward_link_ = std::move(new_link); + router->outward_edge_.SetPrimaryLink(std::move(new_link)); DVLOG(4) << "Route extended from " << from_node_link.remote_node_name().ToString() << " to " @@ -362,6 +406,8 @@ void Router::SerializeNewRouter(NodeLink& to_node_link, RouterDescriptor& descriptor) { TrapEventDispatcher dispatcher; + const SublinkId new_sublink = to_node_link.memory().AllocateSublinkIds(1); + descriptor.new_sublink = new_sublink; { absl::MutexLock lock(&mutex_); traps_.RemoveAll(dispatcher); @@ -371,34 +417,42 @@ descriptor.next_incoming_sequence_number = inbound_parcels_.current_sequence_number(); - DVLOG(4) << "Extending route to new router with outbound sequence length " - << descriptor.next_outgoing_sequence_number - << " and current inbound sequence number " - << descriptor.next_incoming_sequence_number; + // Initialize an inward edge but with no link yet. This ensures that we + // don't look like a terminal router while waiting for a link to be set, + // which can only happen after `descriptor` is transmitted. + inward_edge_.emplace(); if (status_.flags & IPCZ_PORTAL_STATUS_PEER_CLOSED) { descriptor.peer_closed = true; descriptor.closed_peer_sequence_length = *inbound_parcels_.final_sequence_length(); + + // Ensure that the new edge decays its link as soon as it has one, since + // we know the link will not be used. + inward_edge_->BeginPrimaryLinkDecay(); + inward_edge_->set_length_to_decaying_link( + *inbound_parcels_.final_sequence_length()); + inward_edge_->set_length_from_decaying_link( + outbound_parcels_.current_sequence_number()); } + + // Once `descriptor` is transmitted to the destination node and the new + // Router is created there, it may immediately begin transmitting messages + // back to this node regarding `new_sublink`. We establish a new + // RemoteRouterLink now and register it to `new_sublink` on `to_node_link`, + // so that any such incoming messages are routed to `this`. + // + // NOTE: We do not yet provide `this` itself with a reference to the new + // RemoteRouterLink, because it's not yet safe for us to send messages to + // the remote node regarding `new_sublink`. `descriptor` must be transmitted + // first. + Ref<RemoteRouterLink> new_link = to_node_link.AddRemoteRouterLink( + new_sublink, nullptr, LinkType::kPeripheralInward, LinkSide::kA, + WrapRefCounted(this)); + + DVLOG(4) << "Router " << this << " extending route with tentative new " + << new_link->Describe(); } - - const SublinkId new_sublink = to_node_link.memory().AllocateSublinkIds(1); - descriptor.new_sublink = new_sublink; - - // Once `descriptor` is transmitted to the destination node and the new Router - // is created there, it may immediately begin transmitting messages back to - // this node regarding `new_sublink`. We establish a new RemoteRouterLink now - // and register it to `new_sublink` on `to_node_link`, so that any such - // incoming messages are routed to `this`. - // - // NOTE: We do not yet provide `this` itself with a reference to the new - // RemoteRouterLink, because it's not yet safe for us to send messages to the - // remote node regarding `new_sublink`. `descriptor` must be transmitted - // first. - to_node_link.AddRemoteRouterLink(new_sublink, nullptr, - LinkType::kPeripheralInward, LinkSide::kA, - WrapRefCounted(this)); } void Router::BeginProxyingToNewRouter(NodeLink& to_node_link, @@ -410,13 +464,21 @@ Ref<RemoteRouterLink> new_router_link = new_sublink->router_link; { absl::MutexLock lock(&mutex_); - ABSL_ASSERT(!inward_link_); + ABSL_ASSERT(inward_edge_); // If the new router has already been closed or disconnected, we will // discard the new link to it. if (!outbound_parcels_.final_sequence_length() && !is_disconnected_) { - // TODO: Initiate proxy removal ASAP now that we're proxying. - inward_link_ = std::move(new_router_link); + DVLOG(4) << "Router " << this << " will proxy to new router over " + << new_router_link->Describe(); + + inward_edge_->SetPrimaryLink(std::move(new_router_link)); + + Ref<RouterLink> outward_link = outward_edge_.primary_link(); + if (outward_link && outward_edge_.is_stable() && + inward_edge_->is_stable()) { + outward_link->MarkSideStable(); + } } } @@ -437,10 +499,18 @@ void Router::NotifyLinkDisconnected(RemoteRouterLink& link) { { absl::MutexLock lock(&mutex_); - if (outward_link_ == &link) { - outward_link_.reset(); - } else if (inward_link_ == &link) { - inward_link_.reset(); + if (outward_edge_.primary_link() == &link) { + DVLOG(4) << "Primary " << link.Describe() << " disconnected"; + outward_edge_.ReleasePrimaryLink(); + } else if (outward_edge_.decaying_link() == &link) { + DVLOG(4) << "Decaying " << link.Describe() << " disconnected"; + outward_edge_.ReleaseDecayingLink(); + } else if (inward_edge_ && inward_edge_->primary_link() == &link) { + DVLOG(4) << "Primary " << link.Describe() << " disconnected"; + inward_edge_->ReleasePrimaryLink(); + } else if (inward_edge_ && inward_edge_->decaying_link() == &link) { + DVLOG(4) << "Decaying " << link.Describe() << " disconnected"; + inward_edge_->ReleaseDecayingLink(); } } @@ -454,37 +524,35 @@ void Router::Flush() { Ref<RouterLink> outward_link; Ref<RouterLink> inward_link; + Ref<RouterLink> decaying_outward_link; + Ref<RouterLink> decaying_inward_link; Ref<RouterLink> dead_inward_link; Ref<RouterLink> dead_outward_link; - absl::InlinedVector<Parcel, 2> inbound_parcels; - absl::InlinedVector<Parcel, 2> outbound_parcels; absl::optional<SequenceNumber> final_inward_sequence_length; absl::optional<SequenceNumber> final_outward_sequence_length; + ParcelsToFlush parcels_to_flush; { absl::MutexLock lock(&mutex_); - outward_link = outward_link_; - inward_link = inward_link_; - // Collect any outbound parcels which are safe to transmit now. Note that we - // do not transmit anything or generally call into any RouterLinks while - // `mutex_` is held, because such calls may ultimately re-enter this Router + // Acquire stack references to all links we might want to use, so it's safe + // to acquire additional (unmanaged) references per ParcelToFlush. + outward_link = outward_edge_.primary_link(); + inward_link = inward_edge_ ? inward_edge_->primary_link() : nullptr; + decaying_outward_link = outward_edge_.decaying_link(); + decaying_inward_link = + inward_edge_ ? inward_edge_->decaying_link() : nullptr; + + // Collect any parcels which are safe to transmit now. Note that we do not + // transmit anything or generally call into any RouterLinks while `mutex_` + // is held, because such calls may ultimately re-enter this Router // (e.g. if a link is a LocalRouterLink, or even a RemoteRouterLink with a // fully synchronous driver.) Instead we accumulate work within this block, // and then perform any transmissions or link deactivations after the mutex // is released further below. - Parcel parcel; - while (outbound_parcels_.HasNextElement() && outward_link) { - bool ok = outbound_parcels_.Pop(parcel); - ABSL_ASSERT(ok); - outbound_parcels.push_back(std::move(parcel)); - } - // If we have an inward link, then we're a proxy. Collect any queued inbound - // parcels to forward over that link. - while (inbound_parcels_.HasNextElement() && inward_link) { - bool ok = inbound_parcels_.Pop(parcel); - ABSL_ASSERT(ok); - inbound_parcels.push_back(std::move(parcel)); + CollectParcelsToFlush(outbound_parcels_, outward_edge_, parcels_to_flush); + if (inward_edge_) { + CollectParcelsToFlush(inbound_parcels_, *inward_edge_, parcels_to_flush); } if (outward_link && outbound_parcels_.IsSequenceFullyConsumed()) { @@ -497,11 +565,11 @@ // there are no more outbound parcels to send outward, and there no longer // exists an ultimate destination for any forwarded inbound parcels. So we // drop both links now. - dead_outward_link = std::move(outward_link_); + dead_outward_link = outward_edge_.ReleasePrimaryLink(); } else if (!inbound_parcels_.ExpectsMoreElements()) { // If the other end of the route is gone and we've received all its // parcels, we can simply drop the outward link in that case. - dead_outward_link = std::move(outward_link_); + dead_outward_link = outward_edge_.ReleasePrimaryLink(); } if (inbound_parcels_.IsSequenceFullyConsumed()) { @@ -509,18 +577,14 @@ // then we've also forwarded everything already. We can propagate closure // inward and drop the inward link, if applicable. final_inward_sequence_length = inbound_parcels_.final_sequence_length(); - if (inward_link_) { - dead_inward_link = std::move(inward_link_); + if (inward_edge_) { + dead_inward_link = inward_edge_->ReleasePrimaryLink(); } } } - for (Parcel& parcel : outbound_parcels) { - outward_link->AcceptParcel(parcel); - } - - for (Parcel& parcel : inbound_parcels) { - inward_link->AcceptParcel(parcel); + for (ParcelToFlush& parcel : parcels_to_flush) { + parcel.link->AcceptParcel(parcel.parcel); } if (dead_outward_link) {
diff --git a/third_party/ipcz/src/ipcz/router.h b/third_party/ipcz/src/ipcz/router.h index cd98e30..54b9037 100644 --- a/third_party/ipcz/src/ipcz/router.h +++ b/third_party/ipcz/src/ipcz/router.h
@@ -10,6 +10,7 @@ #include "ipcz/ipcz.h" #include "ipcz/parcel_queue.h" +#include "ipcz/route_edge.h" #include "ipcz/router_descriptor.h" #include "ipcz/router_link.h" #include "ipcz/sequence_number.h" @@ -169,27 +170,25 @@ // traps are notified about any interesting state changes within the router. TrapSet traps_ ABSL_GUARDED_BY(mutex_); + // The edge connecting this router outward to another, toward the portal on + // the other side of the route. + RouteEdge outward_edge_ ABSL_GUARDED_BY(mutex_); + + // The edge connecting this router inward to another, closer to the portal on + // our own side of the route. Only present for proxying routers: terminal + // routers by definition can have no inward edge. + absl::optional<RouteEdge> inward_edge_ ABSL_GUARDED_BY(mutex_); + // Parcels received from the other end of the route. If this is a terminal - // router, these may be retrieved by the application via a controlling portal. + // router, these may be retrieved by the application via a controlling portal; + // otherwise they will be forwarded along `inward_edge_` as soon as possible. ParcelQueue inbound_parcels_ ABSL_GUARDED_BY(mutex_); - // A link to this router's outward peer. - // - // TODO(rockot): Replace this with a dynamic link that can be incrementally - // decayed and replaced. - Ref<RouterLink> outward_link_ ABSL_GUARDED_BY(mutex_); - - // A link to this router's inward peer. Present only for proxying Routers. - // - // TODO(rockot): Replace this with a dynamic link that can be incrementally - // decayed and replaced. - Ref<RouterLink> inward_link_ ABSL_GUARDED_BY(mutex_); - // Parcels transmitted directly from this router (if sent by a controlling // portal) or received from an inward peer which sent them outward toward this // Router. These parcels generally only accumulate if there is no outward link - // present when received, and they are forwarded along `outward_link_` as soon - // as possible. + // present when attempting to transmit them, and they are forwarded along + // `outward_edge_` as soon as possible. ParcelQueue outbound_parcels_ ABSL_GUARDED_BY(mutex_); // Tracks whether this router has been unexpectedly disconnected from its
diff --git a/third_party/robolectric/3pp/fetch.py b/third_party/robolectric/3pp/fetch.py index eb203ce..9a83357 100755 --- a/third_party/robolectric/3pp/fetch.py +++ b/third_party/robolectric/3pp/fetch.py
@@ -7,32 +7,38 @@ import json import os -_PATCH = 'cr2' -_LATEST_VERSION = '12-robolectric-7732740.' + _PATCH +_PATCH = 'cr0' +_LATEST_VERSION = '12.1-robolectric-8229987.' + _PATCH # All instrumented jars + latest non-instrumented one. _ROBO_URL_FILES = { - 'android-all-instrumented-12-robolectric-7732740-i3.jar': - 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/12-robolectric-7732740-i3/android-all-instrumented-12-robolectric-7732740-i3.jar', - 'android-all-instrumented-11-robolectric-6757853-i3.jar': - 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/11-robolectric-6757853-i3/android-all-instrumented-11-robolectric-6757853-i3.jar', - 'android-all-instrumented-10-robolectric-5803371-i3.jar': - 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/10-robolectric-5803371-i3/android-all-instrumented-10-robolectric-5803371-i3.jar', - 'android-all-instrumented-9-robolectric-4913185-2-i3.jar': - 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/9-robolectric-4913185-2-i3/android-all-instrumented-9-robolectric-4913185-2-i3.jar', - 'android-all-instrumented-8.1.0-robolectric-4611349-i3.jar': - 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/8.1.0-robolectric-4611349-i3/android-all-instrumented-8.1.0-robolectric-4611349-i3.jar', - 'android-all-instrumented-8.0.0_r4-robolectric-r1-i3.jar': - 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/8.0.0_r4-robolectric-r1-i3/android-all-instrumented-8.0.0_r4-robolectric-r1-i3.jar', - 'android-all-instrumented-7.1.0_r7-robolectric-r1-i3.jar': - 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/7.1.0_r7-robolectric-r1-i3/android-all-instrumented-7.1.0_r7-robolectric-r1-i3.jar', - 'android-all-instrumented-6.0.1_r3-robolectric-r1-i3.jar': - 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/6.0.1_r3-robolectric-r1-i3/android-all-instrumented-6.0.1_r3-robolectric-r1-i3.jar', - 'android-all-instrumented-5.0.2_r3-robolectric-r0-i3.jar': - 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/5.0.2_r3-robolectric-r0-i3/android-all-instrumented-5.0.2_r3-robolectric-r0-i3.jar', - 'android-all-instrumented-4.4_r1-robolectric-r2-i3.jar': - 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/4.4_r1-robolectric-r2-i3/android-all-instrumented-4.4_r1-robolectric-r2-i3.jar', + 'android-all-instrumented-12.1-robolectric-8229987-i4.jar': + 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/12.1-robolectric-8229987-i4/android-all-instrumented-12.1-robolectric-8229987-i4.jar', + 'android-all-instrumented-12-robolectric-7732740-i4.jar': + 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/12-robolectric-7732740-i4/android-all-instrumented-12-robolectric-7732740-i4.jar', + 'android-all-instrumented-11-robolectric-6757853-i4.jar': + 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/11-robolectric-6757853-i4/android-all-instrumented-11-robolectric-6757853-i4.jar', + 'android-all-instrumented-10-robolectric-5803371-i4.jar': + 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/10-robolectric-5803371-i4/android-all-instrumented-10-robolectric-5803371-i4.jar', + 'android-all-instrumented-9-robolectric-4913185-2-i4.jar': + 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/9-robolectric-4913185-2-i4/android-all-instrumented-9-robolectric-4913185-2-i4.jar', + 'android-all-instrumented-8.1.0-robolectric-4611349-i4.jar': + 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/8.1.0-robolectric-4611349-i4/android-all-instrumented-8.1.0-robolectric-4611349-i4.jar', + 'android-all-instrumented-8.0.0_r4-robolectric-r1-i4.jar': + 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/8.0.0_r4-robolectric-r1-i4/android-all-instrumented-8.0.0_r4-robolectric-r1-i4.jar', + 'android-all-instrumented-7.1.0_r7-robolectric-r1-i4.jar': + 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/7.1.0_r7-robolectric-r1-i4/android-all-instrumented-7.1.0_r7-robolectric-r1-i4.jar', + 'android-all-instrumented-7.0.0_r1-robolectric-r1-i4.jar': + 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/7.0.0_r1-robolectric-r1-i4/android-all-instrumented-7.0.0_r1-robolectric-r1-i4.jar', + 'android-all-instrumented-6.0.1_r3-robolectric-r1-i4.jar': + 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/6.0.1_r3-robolectric-r1-i4/android-all-instrumented-6.0.1_r3-robolectric-r1-i4.jar', + 'android-all-instrumented-5.0.2_r3-robolectric-r0-i4.jar': + 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/5.0.2_r3-robolectric-r0-i4/android-all-instrumented-5.0.2_r3-robolectric-r0-i4.jar', + 'android-all-instrumented-4.4_r1-robolectric-r2-i4.jar': + 'https://repo1.maven.org/maven2/org/robolectric/android-all-instrumented/4.4_r1-robolectric-r2-i4/android-all-instrumented-4.4_r1-robolectric-r2-i4.jar', 'android-all-12-robolectric-7732740.jar': 'https://repo1.maven.org/maven2/org/robolectric/android-all/12-robolectric-7732740/android-all-12-robolectric-7732740.jar', + 'android-all-12.1-robolectric-8229987.jar': + 'https://repo1.maven.org/maven2/org/robolectric/android-all/12.1-robolectric-8229987/android-all-12.1-robolectric-8229987.jar' } def do_latest():
diff --git a/third_party/robolectric/README.chromium b/third_party/robolectric/README.chromium index 0801a964a..29ccaa6 100644 --- a/third_party/robolectric/README.chromium +++ b/third_party/robolectric/README.chromium
@@ -1,6 +1,6 @@ Name: Robolectric URL: http://robolectric.org -Version: 12-robolectric-7732740 +Version: 12.1-robolectric-8229987 License: Apache 2.0 License File: NOT_SHIPPED Security Critical: no
diff --git a/third_party/widevine/cdm/widevine_cdm_common.h b/third_party/widevine/cdm/widevine_cdm_common.h index 2f026df..08771ba 100644 --- a/third_party/widevine/cdm/widevine_cdm_common.h +++ b/third_party/widevine/cdm/widevine_cdm_common.h
@@ -5,7 +5,6 @@ #ifndef WIDEVINE_CDM_WIDEVINE_CDM_COMMON_H_ #define WIDEVINE_CDM_WIDEVINE_CDM_COMMON_H_ -#include "base/token.h" #include "build/build_config.h" #include "media/cdm/cdm_type.h" // nogncheck
diff --git a/tools/browserbench-webdriver/browserbench.py b/tools/browserbench-webdriver/browserbench.py index 62959b8..c06a9f9 100644 --- a/tools/browserbench-webdriver/browserbench.py +++ b/tools/browserbench-webdriver/browserbench.py
@@ -29,6 +29,7 @@ self._output = None self._githash = None self._browser = None + self._driver = None @staticmethod def _CreateChromeDriver(optargs): @@ -67,6 +68,30 @@ params['executable_path'] = DEFAULT_STP_DRIVER_PATH return webdriver.Safari(**params) + def _GetBrowserVersion(self, optargs): + ''' + Returns the version of the browser. + ''' + if optargs.browser == 'safari' or optargs.browser == 'stp': + return BrowserBench._GetSafariVersion(optargs) + # Selenium provides the full version for chrome. + return self._driver.capabilities['browserVersion'] + + @staticmethod + def _GetSafariVersion(optargs): + # selenium does not report the build id of stp (e.g. 149), so this uses safaridriver, + # which is able to report the version. + safaridriver_executable = 'safaridriver' + if optargs.executable: + safaridriver_executable = optargs.executable + if optargs.browser == 'stp' and not optargs.executable: + safaridriver_executable = DEFAULT_STP_DRIVER_PATH + results = subprocess.run([safaridriver_executable, '--version'], + capture_output=True).stdout.decode('utf-8') + start_index = results.find('Safari') + version = results[start_index:] if start_index != -1 else results + return version.strip() + @staticmethod def _CreateDriver(optargs): if optargs.browser == 'chrome': @@ -110,12 +135,12 @@ def _CreateDriverAndRun(self, optargs): logging.info('Creating Driver') - driver = BrowserBench._CreateDriver(optargs) - if not driver: + self._driver = BrowserBench._CreateDriver(optargs) + if not self._driver: raise Exception('failed to create driver') - driver.set_window_size(900, 780) + self._driver.set_window_size(900, 780) logging.info('About to run test') - return self.RunAndExtractMeasurements(driver, optargs) + return self.RunAndExtractMeasurements(self._driver, optargs) def _ConvertMeasurementsToSkiaFormat(self, measurements): ''' @@ -145,7 +170,7 @@ all_results.append(converted_result) return all_results - def _ProduceOutput(self, measurements, extra_key_values): + def _ProduceOutput(self, measurements, extra_key_values, optargs): ''' extra_key_values is a dictionary of arbitrary key/value pairs added to the results. @@ -157,6 +182,7 @@ 'test': self._name, 'version': self._version, 'browser': self._browser, + 'browser-version': self._GetBrowserVersion(optargs), }, 'results': self._ConvertMeasurementsToSkiaFormat(measurements) } @@ -258,7 +284,7 @@ BrowserBench._KillBrowser(optargs) logging.info('Test completed') - self._ProduceOutput(measurements, extra_key_values) + self._ProduceOutput(measurements, extra_key_values, optargs) if caffeinate_process: caffeinate_process.kill()
diff --git a/tools/cast3p/cast_core.version b/tools/cast3p/cast_core.version index b76706d..bd5a9c9 100644 --- a/tools/cast3p/cast_core.version +++ b/tools/cast3p/cast_core.version
@@ -1 +1 @@ -cast_20220708_2200_RC01 +cast_20220722_1034_RC00
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index c9998b00..e309f9ed 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -33168,7 +33168,8 @@ <int value="279" label="VPN_PROVIDER_ON_PACKET_RECEIVED"/> <int value="280" label="VPN_PROVIDER_ON_PLATFORM_MESSAGE"/> <int value="281" label="VPN_PROVIDER_ON_UI_EVENT"/> - <int value="282" label="WALLPAPER_PRIVATE_ON_WALLPAPER_CHANGED_BY_3RD_PARTY"/> + <int value="282" + label="DELETED_WALLPAPER_PRIVATE_ON_WALLPAPER_CHANGED_BY_3RD_PARTY"/> <int value="283" label="WEB_NAVIGATION_ON_BEFORE_NAVIGATE"/> <int value="284" label="WEB_NAVIGATION_ON_COMMITTED"/> <int value="285" label="WEB_NAVIGATION_ON_COMPLETED"/> @@ -33367,7 +33368,8 @@ label="CERTIFICATEPROVIDER_ON_CERTIFICATES_UPDATE_REQUESTED"/> <int value="460" label="CERTIFICATEPROVIDER_ON_SIGNATURE_REQUESTED"/> <int value="461" label="WINDOWS_ON_BOUNDS_CHANGED"/> - <int value="462" label="WALLPAPER_PRIVATE_ON_CLOSE_PREVIEW_WALLPAPER"/> + <int value="462" + label="DELETED_WALLPAPER_PRIVATE_ON_CLOSE_PREVIEW_WALLPAPER"/> <int value="463" label="PASSWORDS_PRIVATE_ON_WEAK_CREDENTIALS_CHANGED"/> <int value="464" label="ACCESSIBILITY_PRIVATE_ON_MAGNIFIER_BOUNDS_CHANGED"/> <int value="465" label="FILE_MANAGER_PRIVATE_ON_PIN_TRANSFERS_UPDATED"/> @@ -34950,8 +34952,8 @@ <int value="1473" label="TERMINALPRIVATE_OPENWINDOW"/> <int value="1474" label="AUTOTESTPRIVATE_SETPLUGINVMPOLICY"/> <int value="1475" label="AUTOTESTPRIVATE_SHOWPLUGINVMINSTALLER"/> - <int value="1476" label="PASSWORDSPRIVATE_REMOVESAVEDPASSWORDS"/> - <int value="1477" label="PASSWORDSPRIVATE_REMOVEPASSWORDEXCEPTIONS"/> + <int value="1476" label="DELETED_PASSWORDSPRIVATE_REMOVESAVEDPASSWORDS"/> + <int value="1477" label="DELETED_PASSWORDSPRIVATE_REMOVEPASSWORDEXCEPTIONS"/> <int value="1478" label="AUTOTESTPRIVATE_WAITFORAMBIENTPHOTOANIMATION"/> <int value="1479" label="INPUT_IME_SETASSISTIVEWINDOWPROPERTIES"/> <int value="1480" label="PASSWORDSPRIVATE_MOVEPASSWORDSTOACCOUNT"/> @@ -35174,6 +35176,7 @@ <int value="1688" label="ENTERPRISEREPORTINGPRIVATE_GETFILESYSTEMINFO"/> <int value="1689" label="FILEMANAGERPRIVATE_GETDRIVEQUOTAMETADATA"/> <int value="1690" label="DOWNLOADS_SETUIOPTIONS"/> + <int value="1691" label="AUTOTESTPRIVATE_GETDESKCOUNT"/> </enum> <enum name="ExtensionIconState"> @@ -53817,6 +53820,7 @@ <int value="66" label="SBOX_ERROR_CANNOT_READ_SENTINEL_VALUE"/> <int value="67" label="SBOX_ERROR_INVALID_READ_SENTINEL_SIZE"/> <int value="68" label="SBOX_ERROR_MISMATCH_SENTINEL_VALUE"/> + <int value="69" label="SBOX_ERROR_FAILED_TO_FREEZE_CONFIG"/> <int value="1002" label="LAUNCH_RESULT_SUCCESS"/> <int value="1003" label="LAUNCH_RESULT_FAILURE"/> </enum> @@ -56597,6 +56601,8 @@ <int value="-1408696172" label="CompositeBGColorAnimation:enabled"/> <int value="-1408370474" label="AssistantRoutines:enabled"/> <int value="-1408288176" label="enable-account-consistency"/> + <int value="-1407904527" + label="OmniboxRemoveSuggestionHeaderCapitalization:disabled"/> <int value="-1407568904" label="CrOSLabsFloatWindow:enabled"/> <int value="-1405349891" label="PictureInPictureAPI:enabled"/> <int value="-1405048637" label="OfflinePagesResourceBasedSnapshot:enabled"/> @@ -59054,6 +59060,8 @@ <int value="168887810" label="ReadLaterReminderNotification:disabled"/> <int value="170101645" label="PageInfoAboutThisSiteMoreInfo:disabled"/> <int value="171273307" label="SystemEmojiPickerClipboard:disabled"/> + <int value="172878751" + label="OmniboxRemoveSuggestionHeaderCapitalization:enabled"/> <int value="173288154" label="PrintPdfAsImage:enabled"/> <int value="173339199" label="SmsReceiverCrossDevice:disabled"/> <int value="174759256" label="LockScreenMediaControls:enabled"/>
diff --git a/tools/metrics/histograms/metadata/blink/histograms.xml b/tools/metrics/histograms/metadata/blink/histograms.xml index 11d8d62..b07e2fa8 100644 --- a/tools/metrics/histograms/metadata/blink/histograms.xml +++ b/tools/metrics/histograms/metadata/blink/histograms.xml
@@ -1423,26 +1423,28 @@ </summary> </histogram> -<histogram name="Blink.HTMLParsing.ParsingTimeMax2" units="microseconds" +<histogram name="Blink.HTMLParsing.ParsingTimeMax3" units="microseconds" expires_after="2023-06-30"> <owner>masonf@chromium.org</owner> <owner>dom-dev@chromium.org</owner> <summary> While parsing a page, the maximum time used to parse a single chunk before - being blocked, yielding or completing, in microseconds. + being blocked, yielding or completing, in microseconds. This does not + include time spent executing script. This histogram does not record metrics on machines with low-resolution clocks. </summary> </histogram> -<histogram name="Blink.HTMLParsing.ParsingTimeMin2" units="microseconds" +<histogram name="Blink.HTMLParsing.ParsingTimeMin3" units="microseconds" expires_after="2023-06-30"> <owner>masonf@chromium.org</owner> <owner>dom-dev@chromium.org</owner> <summary> While parsing a page, the minimum time used to parse a single chunk before - being blocked, yielding or completing, in microseconds. + being blocked, yielding or completing, in microseconds. This does not + include time spent executing script. This histogram does not record metrics on machines with low-resolution clocks. @@ -1455,7 +1457,8 @@ <owner>dom-dev@chromium.org</owner> <summary> While parsing a page, the total amount of time spent in the - HTMLDocumentParser performing parsing, in microseconds. + HTMLDocumentParser performing parsing, in microseconds. This does not + include time spent executing script. This histogram does not record metrics on machines with low-resolution clocks.
diff --git a/tools/metrics/histograms/metadata/history/histograms.xml b/tools/metrics/histograms/metadata/history/histograms.xml index 135aa1c..bcd8b67 100644 --- a/tools/metrics/histograms/metadata/history/histograms.xml +++ b/tools/metrics/histograms/metadata/history/histograms.xml
@@ -1084,8 +1084,10 @@ </histogram> <histogram name="History.DatabaseAdvancedMetricsTime" units="ms" - expires_after="M77"> - <owner>shess@chromium.org</owner> + expires_after="2023-07-01"> + <owner>sophiechang@chromium.org</owner> + <owner>tommycli@chromium.org</owner> + <owner>treib@chromium.org</owner> <component>UI>Browser>History</component> <summary> Time spent on advanced History DB metrics calculation (weekly and monthly @@ -1095,8 +1097,10 @@ </histogram> <histogram name="History.DatabaseBasicMetricsTime" units="ms" - expires_after="M77"> - <owner>shess@chromium.org</owner> + expires_after="2023-07-01"> + <owner>sophiechang@chromium.org</owner> + <owner>tommycli@chromium.org</owner> + <owner>treib@chromium.org</owner> <component>UI>Browser>History</component> <summary> Time spent on basic History DB metrics calculation (file size and table @@ -1117,6 +1121,21 @@ </summary> </histogram> +<histogram name="History.DatabaseForeignVisitMetricsTime" units="ms" + expires_after="2023-07-01"> + <owner>sophiechang@chromium.org</owner> + <owner>tommycli@chromium.org</owner> + <owner>treib@chromium.org</owner> + <component>UI>Browser>History</component> + <summary> + Time spent on foreign-visit-related History DB metrics calculation. These + metrics are logged on initialization of the History DB on 1% of starts. Note + that the actual metrics (History.ForeignVisits*) are only recorded if any + such visits were actually found, so the total counts will not match this + histogram's. + </summary> +</histogram> + <histogram name="History.DatabaseMonthlyHostCountTime" units="ms" expires_after="2020-03-01"> <owner>dimich@chromium.org</owner> @@ -1343,6 +1362,74 @@ </summary> </histogram> +<histogram name="History.ForeignVisitsLegacy" units="visits" + expires_after="2023-07-01"> + <owner>tommycli@chromium.org</owner> + <owner>treib@chromium.org</owner> + <component>UI>Browser>History</component> + <summary> + The number of foreign visits (i.e. visits coming from another device) in the + DB table which came from "legacy" clients, i.e. those still using + the Sessions sync integration. Recorded on initialization of the History DB + on 1% of starts, only if any foreign visits exist (i.e. basically for users + with History Sync on). + </summary> +</histogram> + +<histogram name="History.ForeignVisitsNotRemapped" units="visits" + expires_after="2023-07-01"> + <owner>tommycli@chromium.org</owner> + <owner>treib@chromium.org</owner> + <component>UI>Browser>History</component> + <summary> + The number of foreign visits (i.e. visits coming from another device) in the + DB table which have an originator_from|opener_visit but are missing a + corresponding local from|opener_visit. Recorded on initialization of the + History DB on 1% of starts, only if any foreign visits exist (i.e. basically + for users with History Sync on). + </summary> +</histogram> + +<histogram name="History.ForeignVisitsRemappableFrom" units="visits" + expires_after="2023-07-01"> + <owner>tommycli@chromium.org</owner> + <owner>treib@chromium.org</owner> + <component>UI>Browser>History</component> + <summary> + The number of foreign visits (i.e. visits coming from another device) in the + DB table which have an originator_from_visit but are missing a corresponding + local from_visit, and a matching visit actually exists in the DB. Recorded + on initialization of the History DB on 1% of starts, only if any foreign + visits exist (i.e. basically for users with History Sync on). + </summary> +</histogram> + +<histogram name="History.ForeignVisitsRemappableOpener" units="visits" + expires_after="2023-07-01"> + <owner>tommycli@chromium.org</owner> + <owner>treib@chromium.org</owner> + <component>UI>Browser>History</component> + <summary> + The number of foreign visits (i.e. visits coming from another device) in the + DB table which have an originator_opener_visit but are missing a + corresponding local opener_visit, and a matching visit actually exists in + the DB. Recorded on initialization of the History DB on 1% of starts, only + if any foreign visits exist (i.e. basically for users with History Sync on). + </summary> +</histogram> + +<histogram name="History.ForeignVisitsTotal" units="visits" + expires_after="2023-07-01"> + <owner>tommycli@chromium.org</owner> + <owner>treib@chromium.org</owner> + <component>UI>Browser>History</component> + <summary> + The number of foreign visits (i.e. visits coming from another device) in the + DB table. Recorded on initialization of the History DB on 1% of starts, only + if any foreign visits exist (i.e. basically for users with History Sync on). + </summary> +</histogram> + <histogram name="History.GetFavIconFromDB" units="ms" expires_after="M79"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <component>UI>Browser>History</component>
diff --git a/tools/metrics/histograms/metadata/omnibox/histograms.xml b/tools/metrics/histograms/metadata/omnibox/histograms.xml index f1ceb97..226ba6b9 100644 --- a/tools/metrics/histograms/metadata/omnibox/histograms.xml +++ b/tools/metrics/histograms/metadata/omnibox/histograms.xml
@@ -729,8 +729,8 @@ </summary> </histogram> -<histogram name="Omnibox.FuzzyMatchConversion.{SubProvider}" units="counts" - expires_after="M115"> +<histogram name="Omnibox.HistoryFuzzy.MatchConversion.{SubProvider}" + units="counts" expires_after="M115"> <owner>orinj@chromium.org</owner> <owner>jdonnelly-team@google.com</owner> <summary> @@ -754,6 +754,46 @@ </token> </histogram> +<histogram name="Omnibox.HistoryFuzzy.Precision" enum="Boolean" + expires_after="M115"> + <owner>orinj@chromium.org</owner> + <owner>jdonnelly-team@google.com</owner> + <summary> + When a fuzzy match was offered at the moment the user opened a match, this + measures whether a fuzzy suggestion was taken. This is only recorded when at + least one fuzzy match is in the result set, so it is useful to measure total + presence and engagement with fuzzy URL suggestions. It can be interpreted as + a click through rate for fuzzy match presentation as a whole: given that any + fuzzy matches were presented at the moment a match was selected by the user, + how often was the selected match a fuzzy URL suggestion? + + Context: Fuzzy match conversion produces modified matches from other + synchronous autocomplete providers (sub-providers) using alternative inputs: + what the user might have typed, the automatic corrections. + </summary> +</histogram> + +<histogram name="Omnibox.HistoryFuzzy.SearchDuration" units="ms" + expires_after="M115"> + <owner>orinj@chromium.org</owner> + <owner>jdonnelly-team@google.com</owner> + <summary> + The time taken by HistoryFuzzyProvider to search for fuzzy input + corrections. This is measured if and only if a search is performed, so many + input states will not result in recording this metric (for example if the + input contains a space, that's taken as a hint that the user may be + searching instead of typing a domain name so no fuzzy search is performed). + It is useful to distinguish portions of the total time taken by the + provider, particularly as separate from sub-provider match gathering, so + that if there are any pathological cases in the search algorithm then they + will be apparent here. + + Context: Fuzzy match conversion produces modified matches from other + synchronous autocomplete providers (sub-providers) using alternative inputs: + what the user might have typed, the automatic corrections. + </summary> +</histogram> + <histogram name="Omnibox.HoverTime" units="ms" expires_after="2021-10-31"> <owner>estark@chromium.org</owner> <owner>carlosil@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/security/histograms.xml b/tools/metrics/histograms/metadata/security/histograms.xml index 1face80..0dcc1a26 100644 --- a/tools/metrics/histograms/metadata/security/histograms.xml +++ b/tools/metrics/histograms/metadata/security/histograms.xml
@@ -936,14 +936,16 @@ </summary> </histogram> -<histogram name="SiteIsolation.ReusePendingOrCommittedSite.CouldReuse" - enum="ReusePendingOrCommittedSiteEnum" expires_after="M77"> +<histogram name="SiteIsolation.ReusePendingOrCommittedSite.CouldReuse2" + enum="ReusePendingOrCommittedSiteEnum" expires_after="2023-01-20"> <owner>clamy@chromium.org</owner> <summary> Whether SiteInstances with a ProcessReusePolicy of REUSE_PENDING_OR_COMMITTED_SITE could reuse an existing RenderProcessHost or they had to create a new one. True when they reused an existing process, false when they created a new one. + + (Was expired between M77 and M105 before moving on to V2.) </summary> </histogram>
diff --git a/tools/metrics/histograms/metadata/segmentation_platform/histograms.xml b/tools/metrics/histograms/metadata/segmentation_platform/histograms.xml index 5b6cf1d0..3f31270c 100644 --- a/tools/metrics/histograms/metadata/segmentation_platform/histograms.xml +++ b/tools/metrics/histograms/metadata/segmentation_platform/histograms.xml
@@ -70,7 +70,7 @@ </variants> <histogram name="SegmentationPlatform.AdaptiveToolbar.ModelScore.{SegmentID}" - units="%" expires_after="2022-08-01"> + units="%" expires_after="2023-03-21"> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> <summary> @@ -82,7 +82,7 @@ </histogram> <histogram name="SegmentationPlatform.AdaptiveToolbar.SegmentSelected.Startup" - enum="AdaptiveToolbarButtonVariant" expires_after="2023-01-01"> + enum="AdaptiveToolbarButtonVariant" expires_after="2023-03-21"> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> <summary> @@ -93,7 +93,7 @@ <histogram name="SegmentationPlatform.AdaptiveToolbar.SegmentSelection.Computed" - enum="AdaptiveToolbarButtonVariant" expires_after="2022-12-11"> + enum="AdaptiveToolbarButtonVariant" expires_after="2023-03-21"> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> <summary> @@ -103,7 +103,7 @@ </histogram> <histogram name="SegmentationPlatform.AdaptiveToolbar.SegmentSwitched" - enum="AdaptiveToolbarSegmentSwitch" expires_after="2022-12-18"> + enum="AdaptiveToolbarSegmentSwitch" expires_after="2023-03-21"> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> <summary> @@ -116,7 +116,7 @@ <histogram name="SegmentationPlatform.FeatureProcessing.Error.{SegmentationModel}" enum="SegmentationPlatformFeatureProcessingError" - expires_after="2022-12-01"> + expires_after="2023-03-21"> <owner>haileywang@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> <summary> @@ -129,7 +129,7 @@ </histogram> <histogram name="SegmentationPlatform.Init.CreationToInitializationLatency" - units="ms" expires_after="M104"> + units="ms" expires_after="2023-03-21"> <owner>ssid@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> <summary> @@ -140,7 +140,7 @@ <histogram name="SegmentationPlatform.Init.ModelUpdatedTimeDifferenceInDays.{SegmentID}" - units="days" expires_after="M107"> + units="days" expires_after="2023-03-21"> <owner>haileywang@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> <summary> @@ -154,7 +154,7 @@ <histogram name="SegmentationPlatform.Init.ProcessCreationToServiceCreationLatency" - units="ms" expires_after="M104"> + units="ms" expires_after="2023-03-21"> <owner>ssid@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> <summary> @@ -164,7 +164,7 @@ </histogram> <histogram name="SegmentationPlatform.Maintenance.CleanupSignalSuccessCount" - units="signals" expires_after="2022-08-01"> + units="signals" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -178,7 +178,7 @@ <histogram name="SegmentationPlatform.Maintenance.CompactionResult.{SignalType}" - enum="BooleanSuccess" expires_after="2022-08-01"> + enum="BooleanSuccess" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -192,7 +192,7 @@ </histogram> <histogram name="SegmentationPlatform.Maintenance.SignalIdentifierCount" - units="ids" expires_after="2022-12-26"> + units="ids" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -205,7 +205,7 @@ </histogram> <histogram name="SegmentationPlatform.ModelAvailability.{SegmentationModel}" - enum="SegmentationModelAvailability" expires_after="2022-08-01"> + enum="SegmentationModelAvailability" expires_after="2023-03-21"> <owner>ssid@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> <summary> @@ -219,7 +219,7 @@ <histogram name="SegmentationPlatform.ModelDelivery.HasMetadata.{SegmentationModel}" - enum="BooleanYesNo" expires_after="2022-08-01"> + enum="BooleanYesNo" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -235,7 +235,7 @@ <histogram name="SegmentationPlatform.ModelDelivery.Metadata.FeatureCount.{SegmentationModel}" - units="features" expires_after="2022-08-01"> + units="features" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -251,7 +251,7 @@ <histogram name="SegmentationPlatform.ModelDelivery.Metadata.Validation.{ValidationPhase}.{SegmentationModel}" - enum="SegmentationPlatformValidationResult" expires_after="2022-08-01"> + enum="SegmentationPlatformValidationResult" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -267,7 +267,7 @@ </histogram> <histogram name="SegmentationPlatform.ModelDelivery.Received" - enum="SegmentationPlatformSegmentationModel" expires_after="2022-10-16"> + enum="SegmentationPlatformSegmentationModel" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -281,7 +281,7 @@ <histogram name="SegmentationPlatform.ModelDelivery.SaveResult.{SegmentationModel}" - enum="BooleanSuccess" expires_after="2022-08-01"> + enum="BooleanSuccess" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -297,7 +297,7 @@ <histogram name="SegmentationPlatform.ModelDelivery.SegmentIdMatches.{SegmentationModel}" - enum="BooleanYesNo" expires_after="2022-08-01"> + enum="BooleanYesNo" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -313,7 +313,7 @@ <histogram name="SegmentationPlatform.ModelExecution.DefaultProvider.Status.{SegmentationModel}" - enum="SegmentationPlatformModelExecutionStatus" expires_after="2022-08-01"> + enum="SegmentationPlatformModelExecutionStatus" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -327,7 +327,7 @@ <histogram name="SegmentationPlatform.ModelExecution.Duration.FeatureProcessing.{SegmentationModel}" - units="ms" expires_after="2022-08-01"> + units="ms" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -342,7 +342,7 @@ <histogram name="SegmentationPlatform.ModelExecution.Duration.Model.{SegmentationModel}.{ModelExecutionStatus}" - units="ms" expires_after="2022-08-01"> + units="ms" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -359,7 +359,7 @@ <histogram name="SegmentationPlatform.ModelExecution.Duration.Total.{SegmentationModel}.{ModelExecutionStatus}" - units="ms" expires_after="2022-08-01"> + units="ms" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -378,7 +378,7 @@ <histogram name="SegmentationPlatform.ModelExecution.Result.{SegmentationModel}" - units="%" expires_after="2022-08-01"> + units="%" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -394,7 +394,7 @@ <histogram name="SegmentationPlatform.ModelExecution.SaveResult.{SegmentationModel}" - enum="BooleanSuccess" expires_after="2022-08-01"> + enum="BooleanSuccess" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -410,7 +410,7 @@ <histogram name="SegmentationPlatform.ModelExecution.Status.{SegmentationModel}" - enum="SegmentationPlatformModelExecutionStatus" expires_after="2022-08-01"> + enum="SegmentationPlatformModelExecutionStatus" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -437,7 +437,7 @@ <histogram name="SegmentationPlatform.ModelExecution.ZeroValuePercent.{SegmentationModel}" - units="%" expires_after="2022-08-01"> + units="%" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -451,7 +451,7 @@ </histogram> <histogram name="SegmentationPlatform.ModelScore.{SegmentID}" units="%" - expires_after="2022-08-01"> + expires_after="2023-03-21"> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> <summary> @@ -464,7 +464,7 @@ <histogram name="SegmentationPlatform.SegmentSelectionOnDemand.Duration.{SegmentationKey}.{SelectedSegment}" - units="ms" expires_after="2022-12-01"> + units="ms" expires_after="2023-03-21"> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> <summary> @@ -484,7 +484,7 @@ </histogram> <histogram name="SegmentationPlatform.SelectionFailedReason" - enum="SegmentationSelectionFailureReason" expires_after="2022-12-11"> + enum="SegmentationSelectionFailureReason" expires_after="2023-03-21"> <owner>ssid@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> <summary> @@ -495,7 +495,7 @@ </histogram> <histogram name="SegmentationPlatform.SelectionFailedReason.{SegmentationKey}" - enum="SegmentationSelectionFailureReason" expires_after="2022-07-31"> + enum="SegmentationSelectionFailureReason" expires_after="2023-03-21"> <owner>ssid@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> <summary> @@ -509,7 +509,7 @@ <histogram name="SegmentationPlatform.SignalDatabase.GetSamples.DatabaseEntryCount" - units="entries" expires_after="2022-08-28"> + units="entries" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -524,7 +524,7 @@ </histogram> <histogram name="SegmentationPlatform.SignalDatabase.GetSamples.Result" - enum="BooleanSuccess" expires_after="2022-08-01"> + enum="BooleanSuccess" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -537,7 +537,7 @@ </histogram> <histogram name="SegmentationPlatform.SignalDatabase.GetSamples.SampleCount" - units="samples" expires_after="2022-07-03"> + units="samples" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -552,7 +552,7 @@ </histogram> <histogram name="SegmentationPlatform.Signals.ListeningCount.{SignalType}" - units="signals" expires_after="2022-08-01"> + units="signals" expires_after="2023-03-21"> <owner>nyquist@chromium.org</owner> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> @@ -565,7 +565,7 @@ </histogram> <histogram name="SegmentationPlatform.StructuredMetrics.TooManyTensors.Count" - units="tensors" expires_after="2022-10-01"> + units="tensors" expires_after="2023-03-21"> <owner>qinmin@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> <summary> @@ -591,7 +591,7 @@ </histogram> <histogram name="SegmentationPlatform.{BooleanModel}.SegmentSwitched" - enum="SegmentationBooleanSegmentSwitch" expires_after="2022-08-01"> + enum="SegmentationBooleanSegmentSwitch" expires_after="2023-03-21"> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> <summary> @@ -604,7 +604,7 @@ <histogram name="SegmentationPlatform.{SegmentationKey}.SegmentSelection.Computed2" - enum="SegmentationPlatformSegmentationModel" expires_after="2022-08-01"> + enum="SegmentationPlatformSegmentationModel" expires_after="2023-03-21"> <owner>shaktisahu@chromium.org</owner> <owner>chrome-segmentation-platform@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/subresource/histograms.xml b/tools/metrics/histograms/metadata/subresource/histograms.xml index ca7b301e..227bbef 100644 --- a/tools/metrics/histograms/metadata/subresource/histograms.xml +++ b/tools/metrics/histograms/metadata/subresource/histograms.xml
@@ -228,8 +228,8 @@ enum="SubresourceFilterActivationState" expires_after="2020-10-04"> <owner>engedy@chromium.org</owner> <summary> - Whenever a document load is committed in a main frame or subframe, records - whether subresource filtering should be activated for that load. + Whenever a document load is committed in any frame, records whether + subresource filtering should be activated for that load. </summary> </histogram> @@ -237,9 +237,8 @@ enum="BooleanAvailable" expires_after="M77"> <owner>engedy@chromium.org</owner> <summary> - Whenever a document load is committed in a main frame or subframe and - subresource filtering should be activated, records whether the filtering - rules are available. + Whenever a document load is committed in any frame and subresource filtering + should be activated, records whether the filtering rules are available. </summary> </histogram> @@ -248,9 +247,9 @@ <owner>alexmt@chromium.org</owner> <owner>chrome-ads-histograms@google.com</owner> <summary> - Records the total time a subframe navigation was delayed while calculating - whether it should be disallowed or not. Logged for all navigations that were - allowed. + Records the total time a child frame navigation was delayed while + calculating whether it should be disallowed or not. Logged for all + navigations that were allowed. This metric uses UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES to acccount for clients with low-resolution clocks. @@ -263,9 +262,9 @@ <owner>alexmt@chromium.org</owner> <owner>chrome-ads-histograms@google.com</owner> <summary> - Records the total time a subframe navigation was delayed while calculating - whether it should be disallowed or not. Logged for all navigations with the - disallowed load policy. + Records the total time a child frame navigation was delayed while + calculating whether it should be disallowed or not. Logged for all + navigations with the disallowed load policy. This metric uses UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES to acccount for clients with low-resolution clocks. @@ -278,9 +277,9 @@ <owner>alexmt@chromium.org</owner> <owner>chrome-ads-histograms@google.com</owner> <summary> - Records the total time a subframe navigation was delayed while calculating - whether it should be disallowed or not. Logged for all navigations with the - would_disallow load policy. + Records the total time a child frame navigation was delayed while + calculating whether it should be disallowed or not. Logged for all + navigations with the would_disallow load policy. This metric uses UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES to acccount for clients with low-resolution clocks. @@ -395,7 +394,7 @@ <owner>alexmt@chromium.org</owner> <owner>jkarlin@chromium.org</owner> <summary> - Whenever a document load is committed in the main frame, records whether the + Whenever a document load is committed in the root frame, records whether the filtering rules are available. This is independent of whether or not subresource filtering should be activated. </summary> @@ -417,8 +416,8 @@ <owner>alexmt@chromium.org</owner> <owner>chrome-ads-histograms@google.com</owner> <summary> - The ActivationList or NONE that the main frame navigation matched with. - Recorded at WillProcessResponse time for a main frame navigation. + The ActivationList or NONE that the root frame's navigation matched with. + Recorded at WillProcessResponse time for an outermost main frame navigation. </summary> </histogram> @@ -427,7 +426,7 @@ <owner>alexmt@chromium.org</owner> <owner>chrome-ads-histograms@google.com</owner> <summary> - Whenever a document load is committed in a main frame, records whether + Whenever a document load is committed in a root frame, records whether subresource filtering should be activated for that load. Also records the same for the initial document load, even if it was not committed. </summary> @@ -438,7 +437,7 @@ <owner>alexmt@chromium.org</owner> <owner>chrome-ads-histograms@google.com</owner> <summary> - Whenever a document load is committed in a main frame that inherits from its + Whenever a document load is committed in a root frame that inherits from its same-origin opener, records whether subresource filtering should be activated for that load. Also records the same for the initial document load (if it inherits its activation) even if it was not committed.
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index e60beab..dda11a2 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -5,8 +5,8 @@ "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux_arm64/49b4b5dcbc312d8d2c3751cf29238b8efeb4e494/trace_processor_shell" }, "win": { - "hash": "f438948d0367b33e3ce4a580cb00f9b1540ae548", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/361efbf9aab595e4dfa79ec48f242d9e722393c9/trace_processor_shell.exe" + "hash": "4e48210501240e4874296fa74880b889e1a45118", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/209791f79d097387b721b2121ae5b54c4d4facb3/trace_processor_shell.exe" }, "linux_arm": { "hash": "58893933be305d3bfe0a72ebebcacde2ac3ca893",
diff --git a/ui/accelerated_widget_mac/ca_layer_tree_unittest_mac.mm b/ui/accelerated_widget_mac/ca_layer_tree_unittest_mac.mm index efbe821b..48f59fd 100644 --- a/ui/accelerated_widget_mac/ca_layer_tree_unittest_mac.mm +++ b/ui/accelerated_widget_mac/ca_layer_tree_unittest_mac.mm
@@ -194,8 +194,7 @@ EXPECT_EQ(properties.opacity, [content_layer opacity]); EXPECT_NSEQ(kCAFilterLinear, [content_layer minificationFilter]); EXPECT_NSEQ(kCAFilterLinear, [content_layer magnificationFilter]); - if ([content_layer respondsToSelector:(@selector(contentsScale))]) - EXPECT_EQ(properties.scale_factor, [content_layer contentsScale]); + EXPECT_EQ(properties.scale_factor, [content_layer contentsScale]); } // Update just the clip rect and re-commit. @@ -493,8 +492,7 @@ gfx::Rect([content_layer bounds])); EXPECT_EQ(kCALayerBottomEdge, [content_layer edgeAntialiasingMask]); EXPECT_EQ(properties.opacity, [content_layer opacity]); - if ([content_layer respondsToSelector:(@selector(contentsScale))]) - EXPECT_EQ(properties.scale_factor, [content_layer contentsScale]); + EXPECT_EQ(properties.scale_factor, [content_layer contentsScale]); } // Remove the rounded corners. This should result in the rounded corners
diff --git a/ui/accelerated_widget_mac/ca_renderer_layer_tree.mm b/ui/accelerated_widget_mac/ca_renderer_layer_tree.mm index 5b6bb4d..5020097 100644 --- a/ui/accelerated_widget_mac/ca_renderer_layer_tree.mm +++ b/ui/accelerated_widget_mac/ca_renderer_layer_tree.mm
@@ -1256,8 +1256,7 @@ } else { [ca_layer_ setContents:nil]; } - if ([ca_layer_ respondsToSelector:(@selector(setContentsScale:))]) - [ca_layer_ setContentsScale:tree()->scale_factor_]; + [ca_layer_ setContentsScale:tree()->scale_factor_]; } else { // Used for UMA if (io_surface_)
diff --git a/ui/android/java/src/org/chromium/ui/base/Clipboard.java b/ui/android/java/src/org/chromium/ui/base/Clipboard.java index cc34522d..ef4572a 100644 --- a/ui/android/java/src/org/chromium/ui/base/Clipboard.java +++ b/ui/android/java/src/org/chromium/ui/base/Clipboard.java
@@ -111,6 +111,13 @@ } /** + * Cleans up clipboard on native side. + */ + public static void cleanupNativeForTesting() { + ClipboardJni.get().cleanupForTesting(); + } + + /** * Emulates the behavior of the now-deprecated * {@link android.text.ClipboardManager#getText()} by invoking * {@link android.content.ClipData.Item#coerceToText(Context)} on the first @@ -365,5 +372,6 @@ void onPrimaryClipTimestampInvalidated( long nativeClipboardAndroid, Clipboard caller, long timestamp); long getLastModifiedTimeToJavaTime(long nativeClipboardAndroid); + void cleanupForTesting(); } }
diff --git a/ui/android/java/src/org/chromium/ui/resources/dynamics/HardwareDrawTest.java b/ui/android/java/src/org/chromium/ui/resources/dynamics/HardwareDrawTest.java index 10cb676..3c1e0e8 100644 --- a/ui/android/java/src/org/chromium/ui/resources/dynamics/HardwareDrawTest.java +++ b/ui/android/java/src/org/chromium/ui/resources/dynamics/HardwareDrawTest.java
@@ -90,32 +90,41 @@ TestThreadUtils.runOnUiThreadBlocking(() -> { mHardwareDraw.onViewSizeChange(mView, 1); }); + final int minCompletedCaptures = 2; + final int minRequestCaptures = 100; + // Running this loop over 256 times will cause histograms default w/o native to blow up. + final int maxRequestCaptures = 250; int captureTakenCount = 0; - // Setting this to over 256 will cause histograms default w/o native to blow up. - for (int i = 0; i < 100; i++) { + for (int i = 0; true; i++) { + if (i >= minRequestCaptures && captureTakenCount >= minCompletedCaptures + || i >= maxRequestCaptures) { + break; + } + if (startBitmapCapture()) { captureTakenCount++; } + // Pause on some of the iterations to give the various threads a chance to do things. // A captures goes from UI -> TaskRunner -> Handler -> TaskRunner -> UI. Each step takes // 3-6ms, the whole cycle takes ~20ms. Though some devices will be faster and slower. // The race we're targeting is between the last TaskRunner -> UI jump. - if (i % 20 == 0) { - Thread.sleep(20); - } else if (i % 10 == 0) { - Thread.sleep(5); - } else if (i % 3 == 0) { - Thread.sleep(1); + if (i % 2 == 0) { + Thread.sleep(i / 10); } } final int finalExpectedCount = captureTakenCount; CriteriaHelper.pollUiThread(() -> { - Criteria.checkThat(mCapturedBitmaps.size(), Matchers.equalTo(finalExpectedCount)); + Criteria.checkThat("Not all captures completed.", mCapturedBitmaps.size(), + Matchers.equalTo(finalExpectedCount)); }); - // With the above waits, a typical device will see ~10 captures. All devices should see at - // least 2 captures 100% of the time. - Assert.assertTrue(mCapturedBitmaps.size() >= 2); + // With the above waits, a typical device will see ~20 captures before hitting + // minRequestCaptures. And if it continues to until maxRequestCaptures, we see ~90 captures. + // We need all devices to see at least 2 captures 100% of the time to avoid flakes. + Assert.assertTrue("Only " + mCapturedBitmaps.size() + + " successful captures. Expected at least " + minCompletedCaptures + ".", + mCapturedBitmaps.size() >= minCompletedCaptures); } } \ No newline at end of file
diff --git a/ui/android/javatests/src/org/chromium/ui/base/ClipboardAndroidTest.java b/ui/android/javatests/src/org/chromium/ui/base/ClipboardAndroidTest.java index 374d2d3..868862f9 100644 --- a/ui/android/javatests/src/org/chromium/ui/base/ClipboardAndroidTest.java +++ b/ui/android/javatests/src/org/chromium/ui/base/ClipboardAndroidTest.java
@@ -53,7 +53,7 @@ @Override public void tearDownTest() throws Exception { - ClipboardAndroidTestSupport.cleanup(); + Clipboard.cleanupNativeForTesting(); // Clear the clipboard to avoid leaving any state. TestThreadUtils.runOnUiThreadBlocking(() -> {
diff --git a/ui/android/javatests/src/org/chromium/ui/base/ClipboardAndroidTestSupport.java b/ui/android/javatests/src/org/chromium/ui/base/ClipboardAndroidTestSupport.java index cd45a37..17ebdbe 100644 --- a/ui/android/javatests/src/org/chromium/ui/base/ClipboardAndroidTestSupport.java +++ b/ui/android/javatests/src/org/chromium/ui/base/ClipboardAndroidTestSupport.java
@@ -13,13 +13,6 @@ @JNINamespace("ui") public class ClipboardAndroidTestSupport { /** - * Cleans up clipboard on native side. - */ - public static void cleanup() { - ClipboardAndroidTestSupportJni.get().cleanup(); - } - - /** * Writes HTML to the native side clipboard. * @param htmlText the htmlText to write. */ @@ -37,7 +30,6 @@ @NativeMethods interface Natives { - void cleanup(); boolean nativeWriteHtml(String htmlText); boolean nativeClipboardContains(String text); }
diff --git a/ui/base/clipboard/clipboard_android.cc b/ui/base/clipboard/clipboard_android.cc index 8996b66..26d58a8 100644 --- a/ui/base/clipboard/clipboard_android.cc +++ b/ui/base/clipboard/clipboard_android.cc
@@ -420,6 +420,11 @@ return new ClipboardAndroid; } +// Static method for testing. +void JNI_Clipboard_CleanupForTesting(JNIEnv* env) { + Clipboard::DestroyClipboardForCurrentThread(); +} + // ClipboardAndroid implementation. void ClipboardAndroid::OnPrimaryClipChanged(
diff --git a/ui/base/clipboard/clipboard_android_test_support.cc b/ui/base/clipboard/clipboard_android_test_support.cc index d821fdd..db3cfb86 100644 --- a/ui/base/clipboard/clipboard_android_test_support.cc +++ b/ui/base/clipboard/clipboard_android_test_support.cc
@@ -15,10 +15,6 @@ namespace ui { -void JNI_ClipboardAndroidTestSupport_Cleanup(JNIEnv* env) { - Clipboard::DestroyClipboardForCurrentThread(); -} - jboolean JNI_ClipboardAndroidTestSupport_NativeWriteHtml( JNIEnv* env, const base::android::JavaParamRef<jstring>& j_html_text) {
diff --git a/ui/base/l10n/l10n_util_win.cc b/ui/base/l10n/l10n_util_win.cc index 9e70280..17f66a0 100644 --- a/ui/base/l10n/l10n_util_win.cc +++ b/ui/base/l10n/l10n_util_win.cc
@@ -46,8 +46,8 @@ return !base::i18n::IsRTL() ? 0 : WS_EX_LAYOUTRTL | WS_EX_RTLREADING; } -int GetExtendedTooltipStyles() { - return !base::i18n::IsRTL() ? 0 : WS_EX_LAYOUTRTL; +DWORD GetExtendedTooltipStyles() { + return base::i18n::IsRTL() ? WS_EX_LAYOUTRTL : 0; } void HWNDSetRTLLayout(HWND hwnd) {
diff --git a/ui/base/l10n/l10n_util_win.h b/ui/base/l10n/l10n_util_win.h index 380bba0..c282fa6 100644 --- a/ui/base/l10n/l10n_util_win.h +++ b/ui/base/l10n/l10n_util_win.h
@@ -22,7 +22,7 @@ // TODO(xji): // This is a temporary name, it will eventually replace GetExtendedStyles -COMPONENT_EXPORT(UI_BASE) int GetExtendedTooltipStyles(); +COMPONENT_EXPORT(UI_BASE) DWORD GetExtendedTooltipStyles(); // Give an HWND, this function sets the WS_EX_LAYOUTRTL extended style for the // underlying window. When this style is set, the UI for the window is going to
diff --git a/ui/ozone/platform/wayland/BUILD.gn b/ui/ozone/platform/wayland/BUILD.gn index e25c24e..3963fbd 100644 --- a/ui/ozone/platform/wayland/BUILD.gn +++ b/ui/ozone/platform/wayland/BUILD.gn
@@ -497,6 +497,12 @@ "test/test_xdg_popup.h", "test/test_zaura_output.cc", "test/test_zaura_output.h", + "test/test_zaura_popup.cc", + "test/test_zaura_popup.h", + "test/test_zaura_surface.cc", + "test/test_zaura_surface.h", + "test/test_zaura_toplevel.cc", + "test/test_zaura_toplevel.h", "test/test_zcr_stylus.cc", "test/test_zcr_stylus.h", "test/test_zcr_text_input_extension.cc",
diff --git a/ui/ozone/platform/wayland/common/wayland_object.cc b/ui/ozone/platform/wayland/common/wayland_object.cc index 4ae5ee8..052da983 100644 --- a/ui/ozone/platform/wayland/common/wayland_object.cc +++ b/ui/ozone/platform/wayland/common/wayland_object.cc
@@ -89,6 +89,42 @@ wl_touch_destroy(touch); } +void delete_zaura_shell(zaura_shell* shell) { + if (wl::get_version_of_object(shell) >= ZAURA_SHELL_RELEASE_SINCE_VERSION) + zaura_shell_release(shell); + else + zaura_shell_destroy(shell); +} + +void delete_zaura_surface(zaura_surface* surface) { + if (wl::get_version_of_object(surface) >= ZAURA_SURFACE_RELEASE_SINCE_VERSION) + zaura_surface_release(surface); + else + zaura_surface_destroy(surface); +} + +void delete_zaura_output(zaura_output* output) { + if (wl::get_version_of_object(output) >= ZAURA_OUTPUT_RELEASE_SINCE_VERSION) + zaura_output_release(output); + else + zaura_output_destroy(output); +} + +void delete_zaura_toplevel(zaura_toplevel* toplevel) { + if (wl::get_version_of_object(toplevel) >= + ZAURA_TOPLEVEL_RELEASE_SINCE_VERSION) + zaura_toplevel_release(toplevel); + else + zaura_toplevel_destroy(toplevel); +} + +void delete_zaura_popup(zaura_popup* popup) { + if (wl::get_version_of_object(popup) >= ZAURA_POPUP_RELEASE_SINCE_VERSION) + zaura_popup_release(popup); + else + zaura_popup_destroy(popup); +} + } // namespace bool CanBind(const std::string& interface, @@ -178,11 +214,13 @@ IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_surface) IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_toplevel) IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_wm_base) -IMPLEMENT_WAYLAND_OBJECT_TRAITS(zaura_output) -IMPLEMENT_WAYLAND_OBJECT_TRAITS(zaura_shell) -IMPLEMENT_WAYLAND_OBJECT_TRAITS(zaura_surface) -IMPLEMENT_WAYLAND_OBJECT_TRAITS(zaura_toplevel) -IMPLEMENT_WAYLAND_OBJECT_TRAITS(zaura_popup) +IMPLEMENT_WAYLAND_OBJECT_TRAITS_WITH_DELETER(zaura_shell, delete_zaura_shell) +IMPLEMENT_WAYLAND_OBJECT_TRAITS_WITH_DELETER(zaura_surface, + delete_zaura_surface) +IMPLEMENT_WAYLAND_OBJECT_TRAITS_WITH_DELETER(zaura_output, delete_zaura_output) +IMPLEMENT_WAYLAND_OBJECT_TRAITS_WITH_DELETER(zaura_toplevel, + delete_zaura_toplevel) +IMPLEMENT_WAYLAND_OBJECT_TRAITS_WITH_DELETER(zaura_popup, delete_zaura_popup) IMPLEMENT_WAYLAND_OBJECT_TRAITS(zcr_cursor_shapes_v1) IMPLEMENT_WAYLAND_OBJECT_TRAITS(zcr_color_manager_v1) IMPLEMENT_WAYLAND_OBJECT_TRAITS(zcr_color_management_output_v1)
diff --git a/ui/ozone/platform/wayland/host/wayland_popup.cc b/ui/ozone/platform/wayland/host/wayland_popup.cc index ef51aa8..c6fb166 100644 --- a/ui/ozone/platform/wayland/host/wayland_popup.cc +++ b/ui/ozone/platform/wayland/host/wayland_popup.cc
@@ -94,10 +94,8 @@ DCHECK(shell_popup_); // If the surface is already decorated early return. - if (!connection()->zaura_shell() || aura_surface_ || - decorated_via_aura_popup_) { + if (!connection()->zaura_shell() || decorated_via_aura_popup_) return; - } // Decorate the surface using the newer protocol. Relies on Ash >= M105. if (shell_popup_->SupportsDecoration()) { @@ -107,9 +105,13 @@ } // Decorate the frame using the older protocol. Can be removed once Lacros >= - // M107. - aura_surface_.reset(zaura_shell_get_aura_surface( - connection()->zaura_shell()->wl_object(), root_surface()->surface())); + // M107. Reshown popups will not be decorated if |aura_surface_| isn't reset + // when server implements the older protocol. + if (!aura_surface_) { + aura_surface_.reset(zaura_shell_get_aura_surface( + connection()->zaura_shell()->wl_object(), root_surface()->surface())); + } + if (shadow_type_ == PlatformWindowShadowType::kDrop) { zaura_surface_set_frame(aura_surface_.get(), ZAURA_SURFACE_FRAME_TYPE_SHADOW); @@ -143,11 +145,17 @@ child_window()->Hide(); WaylandWindow::Hide(); + if (aura_surface_ && wl::get_version_of_object(aura_surface_.get()) >= + ZAURA_SURFACE_RELEASE_SINCE_VERSION) { + aura_surface_.reset(); + } + if (shell_popup_) { parent_window()->set_child_window(nullptr); shell_popup_.reset(); decorated_via_aura_popup_ = false; } + connection()->ScheduleFlush(); }
diff --git a/ui/ozone/platform/wayland/host/wayland_screen_unittest.cc b/ui/ozone/platform/wayland/host/wayland_screen_unittest.cc index ad6d84d4..51c49c67 100644 --- a/ui/ozone/platform/wayland/host/wayland_screen_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_screen_unittest.cc
@@ -93,11 +93,6 @@ WaylandTest::SetUp(); - // Initializing the MockZAuraShell gives ownership to the wl_display. - // TODO(fangzhoug): Investigate resulting memory leak. - mock_zaura_shell_ = new wl::MockZAuraShell(); - mock_zaura_shell_->Initialize(server_.display()); - output_->SetRect({kOutputWidth, kOutputHeight}); output_->SetScale(1); output_->Flush(); @@ -132,7 +127,6 @@ EXPECT_EQ(display_for_widget.id(), expected_display_id); } - raw_ptr<wl::MockZAuraShell> mock_zaura_shell_ = nullptr; raw_ptr<wl::TestOutput> output_ = nullptr; raw_ptr<WaylandOutputManager> output_manager_ = nullptr; @@ -300,178 +294,6 @@ platform_screen_->RemoveObserver(&observer); } -TEST_P(WaylandScreenTest, OutputPropertyChanges) { - TestDisplayObserver observer; - platform_screen_->AddObserver(&observer); - - const gfx::Rect physical_bounds{800, 600}; - output_->SetRect(physical_bounds); - output_->Flush(); - - Sync(); - - uint32_t changed_values = display::DisplayObserver::DISPLAY_METRIC_BOUNDS | - display::DisplayObserver::DISPLAY_METRIC_WORK_AREA; - EXPECT_EQ(observer.GetAndClearChangedMetrics(), changed_values); - const gfx::Rect expected_bounds{800, 600}; - EXPECT_EQ(observer.GetDisplay().bounds(), expected_bounds); - const gfx::Size expected_size_in_pixels{800, 600}; - EXPECT_EQ(observer.GetDisplay().GetSizeInPixel(), expected_size_in_pixels); - EXPECT_EQ(observer.GetDisplay().work_area(), expected_bounds); - - // Test work area. - const gfx::Rect new_work_area{10, 20, 700, 500}; - const gfx::Insets expected_inset = expected_bounds.InsetsFrom(new_work_area); - ASSERT_TRUE(output_->GetAuraOutput()); - output_->GetAuraOutput()->SetInsets(expected_inset); - output_->Flush(); - - Sync(); - - changed_values = display::DisplayObserver::DISPLAY_METRIC_WORK_AREA; - EXPECT_EQ(observer.GetAndClearChangedMetrics(), changed_values); - // Bounds should be unchanged. - EXPECT_EQ(observer.GetDisplay().bounds(), expected_bounds); - EXPECT_EQ(observer.GetDisplay().GetSizeInPixel(), expected_size_in_pixels); - // Work area should have new value. - EXPECT_EQ(observer.GetDisplay().work_area(), new_work_area); - - // Test scaling. - const int32_t new_scale_value = 2; - output_->SetScale(new_scale_value); - output_->Flush(); - - Sync(); - - changed_values = - display::DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR | - display::DisplayObserver::DISPLAY_METRIC_WORK_AREA | - display::DisplayObserver::DISPLAY_METRIC_BOUNDS; - EXPECT_EQ(observer.GetAndClearChangedMetrics(), changed_values); - EXPECT_EQ(observer.GetDisplay().device_scale_factor(), new_scale_value); - // Logical bounds should shrink due to scaling. - const gfx::Rect scaled_bounds{400, 300}; - EXPECT_EQ(observer.GetDisplay().bounds(), scaled_bounds); - // Size in pixel should stay unscaled. - EXPECT_EQ(observer.GetDisplay().GetSizeInPixel(), expected_size_in_pixels); - gfx::Rect scaled_work_area(scaled_bounds); - scaled_work_area.Inset(expected_inset); - EXPECT_EQ(observer.GetDisplay().work_area(), scaled_work_area); - - // Test rotation. - output_->SetTransform(WL_OUTPUT_TRANSFORM_90); - output_->Flush(); - - Sync(); - - changed_values = display::DisplayObserver::DISPLAY_METRIC_WORK_AREA | - display::DisplayObserver::DISPLAY_METRIC_BOUNDS | - display::DisplayObserver::DISPLAY_METRIC_ROTATION; - EXPECT_EQ(observer.GetAndClearChangedMetrics(), changed_values); - // Logical bounds should now be rotated to portrait. - const gfx::Rect rotated_bounds{300, 400}; - EXPECT_EQ(observer.GetDisplay().bounds(), rotated_bounds); - // Size in pixel gets rotated too, but stays unscaled. - const gfx::Size rotated_size_in_pixels{600, 800}; - EXPECT_EQ(observer.GetDisplay().GetSizeInPixel(), rotated_size_in_pixels); - gfx::Rect rotated_work_area(rotated_bounds); - rotated_work_area.Inset(expected_inset); - EXPECT_EQ(observer.GetDisplay().work_area(), rotated_work_area); - EXPECT_EQ(observer.GetDisplay().panel_rotation(), - display::Display::Rotation::ROTATE_270); - EXPECT_EQ(observer.GetDisplay().rotation(), - display::Display::Rotation::ROTATE_270); - - platform_screen_->RemoveObserver(&observer); -} - -// Regression test for crbug.com/1310981. -// Some devices use display panels built in portrait orientation, but are used -// in landscape orientation. Thus their physical bounds are in portrait -// orientation along with an offset transform, which differs from the usual -// landscape oriented bounds. -TEST_P(WaylandScreenTest, OutputPropertyChangesWithPortraitPanelRotation) { - TestDisplayObserver observer; - platform_screen_->AddObserver(&observer); - - // wl_output.geometry origin is set in DIP screen coordinates. - const gfx::Point origin(50, 70); - // wl_output.mode size is sent in physical coordinates, so it has portrait - // dimensions for a display panel with portrait natural orientation. - const gfx::Size physical_size(1200, 1600); - output_->SetRect({origin, physical_size}); - - // Inset is sent in logical coordinates. - const gfx::Insets insets = gfx::Insets::TLBR(10, 20, 30, 40); - ASSERT_TRUE(output_->GetAuraOutput()); - output_->GetAuraOutput()->SetInsets(insets); - - // Display panel's natural orientation is in portrait, so it needs a transform - // of 90 degrees to be in landscape. - output_->SetTransform(WL_OUTPUT_TRANSFORM_90); - // Begin with the logical transform at 0 degrees. - output_->GetAuraOutput()->SetLogicalTransform(WL_OUTPUT_TRANSFORM_NORMAL); - - output_->SetScale(2); - output_->Flush(); - - Sync(); - - uint32_t changed_values = - display::DisplayObserver::DISPLAY_METRIC_BOUNDS | - display::DisplayObserver::DISPLAY_METRIC_WORK_AREA | - display::DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR | - display::DisplayObserver::DISPLAY_METRIC_ROTATION; - EXPECT_EQ(observer.GetAndClearChangedMetrics(), changed_values); - - // Logical bounds should be in landscape. - const gfx::Rect expected_bounds(origin, gfx::Size(800, 600)); - EXPECT_EQ(observer.GetDisplay().bounds(), expected_bounds); - const gfx::Size expected_size_in_pixels(1600, 1200); - EXPECT_EQ(observer.GetDisplay().GetSizeInPixel(), expected_size_in_pixels); - - gfx::Rect expected_work_area(expected_bounds); - expected_work_area.Inset(insets); - EXPECT_EQ(observer.GetDisplay().work_area(), expected_work_area); - - // Panel rotation and display rotation should have an offset. - EXPECT_EQ(observer.GetDisplay().panel_rotation(), - display::Display::Rotation::ROTATE_270); - EXPECT_EQ(observer.GetDisplay().rotation(), - display::Display::Rotation::ROTATE_0); - - // Further rotate the display to logical portrait orientation, which is 180 - // with the natural orientation offset. - output_->SetTransform(WL_OUTPUT_TRANSFORM_180); - output_->GetAuraOutput()->SetLogicalTransform(WL_OUTPUT_TRANSFORM_90); - output_->Flush(); - - Sync(); - - changed_values = display::DisplayObserver::DISPLAY_METRIC_BOUNDS | - display::DisplayObserver::DISPLAY_METRIC_WORK_AREA | - display::DisplayObserver::DISPLAY_METRIC_ROTATION; - EXPECT_EQ(observer.GetAndClearChangedMetrics(), changed_values); - - // Logical bounds should now be portrait. - const gfx::Rect portrait_bounds(origin, gfx::Size(600, 800)); - EXPECT_EQ(observer.GetDisplay().bounds(), portrait_bounds); - const gfx::Size portrait_size_in_pixels(1200, 1600); - EXPECT_EQ(observer.GetDisplay().GetSizeInPixel(), portrait_size_in_pixels); - - gfx::Rect portrait_work_area(portrait_bounds); - portrait_work_area.Inset(insets); - EXPECT_EQ(observer.GetDisplay().work_area(), portrait_work_area); - - // Panel rotation and display rotation should still have an offset. - EXPECT_EQ(observer.GetDisplay().panel_rotation(), - display::Display::Rotation::ROTATE_180); - EXPECT_EQ(observer.GetDisplay().rotation(), - display::Display::Rotation::ROTATE_270); - - platform_screen_->RemoveObserver(&observer); -} - TEST_P(WaylandScreenTest, OutputPropertyChangesMissingLogicalSize) { TestDisplayObserver observer; platform_screen_->AddObserver(&observer); @@ -1086,10 +908,202 @@ EXPECT_EQ(2u, screen_->GetAllDisplays().size()); } +// Tests that use aura-shell extension should use wl::ShellVersion::kStable. +class WaylandAuraShellScreenTest : public WaylandScreenTest { + public: + WaylandAuraShellScreenTest() = default; + WaylandAuraShellScreenTest(const WaylandAuraShellScreenTest&) = delete; + WaylandAuraShellScreenTest& operator=(const WaylandAuraShellScreenTest&) = + delete; + ~WaylandAuraShellScreenTest() override = default; + + void SetUp() override { + ASSERT_EQ(GetParam().shell_version, wl::ShellVersion::kStable); + WaylandScreenTest::SetUp(); + } +}; + +TEST_P(WaylandAuraShellScreenTest, OutputPropertyChanges) { + TestDisplayObserver observer; + platform_screen_->AddObserver(&observer); + + const gfx::Rect physical_bounds{800, 600}; + output_->SetRect(physical_bounds); + output_->Flush(); + + Sync(); + + uint32_t changed_values = display::DisplayObserver::DISPLAY_METRIC_BOUNDS | + display::DisplayObserver::DISPLAY_METRIC_WORK_AREA; + EXPECT_EQ(observer.GetAndClearChangedMetrics(), changed_values); + const gfx::Rect expected_bounds{800, 600}; + EXPECT_EQ(observer.GetDisplay().bounds(), expected_bounds); + const gfx::Size expected_size_in_pixels{800, 600}; + EXPECT_EQ(observer.GetDisplay().GetSizeInPixel(), expected_size_in_pixels); + EXPECT_EQ(observer.GetDisplay().work_area(), expected_bounds); + + // Test work area. + const gfx::Rect new_work_area{10, 20, 700, 500}; + const gfx::Insets expected_inset = expected_bounds.InsetsFrom(new_work_area); + ASSERT_TRUE(output_->GetAuraOutput()); + output_->GetAuraOutput()->SetInsets(expected_inset); + output_->Flush(); + + Sync(); + + changed_values = display::DisplayObserver::DISPLAY_METRIC_WORK_AREA; + EXPECT_EQ(observer.GetAndClearChangedMetrics(), changed_values); + // Bounds should be unchanged. + EXPECT_EQ(observer.GetDisplay().bounds(), expected_bounds); + EXPECT_EQ(observer.GetDisplay().GetSizeInPixel(), expected_size_in_pixels); + // Work area should have new value. + EXPECT_EQ(observer.GetDisplay().work_area(), new_work_area); + + // Test scaling. + const int32_t new_scale_value = 2; + output_->SetScale(new_scale_value); + output_->Flush(); + + Sync(); + + changed_values = + display::DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR | + display::DisplayObserver::DISPLAY_METRIC_WORK_AREA | + display::DisplayObserver::DISPLAY_METRIC_BOUNDS; + EXPECT_EQ(observer.GetAndClearChangedMetrics(), changed_values); + EXPECT_EQ(observer.GetDisplay().device_scale_factor(), new_scale_value); + // Logical bounds should shrink due to scaling. + const gfx::Rect scaled_bounds{400, 300}; + EXPECT_EQ(observer.GetDisplay().bounds(), scaled_bounds); + // Size in pixel should stay unscaled. + EXPECT_EQ(observer.GetDisplay().GetSizeInPixel(), expected_size_in_pixels); + gfx::Rect scaled_work_area(scaled_bounds); + scaled_work_area.Inset(expected_inset); + EXPECT_EQ(observer.GetDisplay().work_area(), scaled_work_area); + + // Test rotation. + output_->SetTransform(WL_OUTPUT_TRANSFORM_90); + output_->Flush(); + + Sync(); + + changed_values = display::DisplayObserver::DISPLAY_METRIC_WORK_AREA | + display::DisplayObserver::DISPLAY_METRIC_BOUNDS | + display::DisplayObserver::DISPLAY_METRIC_ROTATION; + EXPECT_EQ(observer.GetAndClearChangedMetrics(), changed_values); + // Logical bounds should now be rotated to portrait. + const gfx::Rect rotated_bounds{300, 400}; + EXPECT_EQ(observer.GetDisplay().bounds(), rotated_bounds); + // Size in pixel gets rotated too, but stays unscaled. + const gfx::Size rotated_size_in_pixels{600, 800}; + EXPECT_EQ(observer.GetDisplay().GetSizeInPixel(), rotated_size_in_pixels); + gfx::Rect rotated_work_area(rotated_bounds); + rotated_work_area.Inset(expected_inset); + EXPECT_EQ(observer.GetDisplay().work_area(), rotated_work_area); + EXPECT_EQ(observer.GetDisplay().panel_rotation(), + display::Display::Rotation::ROTATE_270); + EXPECT_EQ(observer.GetDisplay().rotation(), + display::Display::Rotation::ROTATE_270); + + platform_screen_->RemoveObserver(&observer); +} + +// Regression test for crbug.com/1310981. +// Some devices use display panels built in portrait orientation, but are used +// in landscape orientation. Thus their physical bounds are in portrait +// orientation along with an offset transform, which differs from the usual +// landscape oriented bounds. +TEST_P(WaylandAuraShellScreenTest, + OutputPropertyChangesWithPortraitPanelRotation) { + TestDisplayObserver observer; + platform_screen_->AddObserver(&observer); + + // wl_output.geometry origin is set in DIP screen coordinates. + const gfx::Point origin(50, 70); + // wl_output.mode size is sent in physical coordinates, so it has portrait + // dimensions for a display panel with portrait natural orientation. + const gfx::Size physical_size(1200, 1600); + output_->SetRect({origin, physical_size}); + + // Inset is sent in logical coordinates. + const gfx::Insets insets = gfx::Insets::TLBR(10, 20, 30, 40); + ASSERT_TRUE(output_->GetAuraOutput()); + output_->GetAuraOutput()->SetInsets(insets); + + // Display panel's natural orientation is in portrait, so it needs a transform + // of 90 degrees to be in landscape. + output_->SetTransform(WL_OUTPUT_TRANSFORM_90); + // Begin with the logical transform at 0 degrees. + output_->GetAuraOutput()->SetLogicalTransform(WL_OUTPUT_TRANSFORM_NORMAL); + + output_->SetScale(2); + output_->Flush(); + + Sync(); + + uint32_t changed_values = + display::DisplayObserver::DISPLAY_METRIC_BOUNDS | + display::DisplayObserver::DISPLAY_METRIC_WORK_AREA | + display::DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR | + display::DisplayObserver::DISPLAY_METRIC_ROTATION; + EXPECT_EQ(observer.GetAndClearChangedMetrics(), changed_values); + + // Logical bounds should be in landscape. + const gfx::Rect expected_bounds(origin, gfx::Size(800, 600)); + EXPECT_EQ(observer.GetDisplay().bounds(), expected_bounds); + const gfx::Size expected_size_in_pixels(1600, 1200); + EXPECT_EQ(observer.GetDisplay().GetSizeInPixel(), expected_size_in_pixels); + + gfx::Rect expected_work_area(expected_bounds); + expected_work_area.Inset(insets); + EXPECT_EQ(observer.GetDisplay().work_area(), expected_work_area); + + // Panel rotation and display rotation should have an offset. + EXPECT_EQ(observer.GetDisplay().panel_rotation(), + display::Display::Rotation::ROTATE_270); + EXPECT_EQ(observer.GetDisplay().rotation(), + display::Display::Rotation::ROTATE_0); + + // Further rotate the display to logical portrait orientation, which is 180 + // with the natural orientation offset. + output_->SetTransform(WL_OUTPUT_TRANSFORM_180); + output_->GetAuraOutput()->SetLogicalTransform(WL_OUTPUT_TRANSFORM_90); + output_->Flush(); + + Sync(); + + changed_values = display::DisplayObserver::DISPLAY_METRIC_BOUNDS | + display::DisplayObserver::DISPLAY_METRIC_WORK_AREA | + display::DisplayObserver::DISPLAY_METRIC_ROTATION; + EXPECT_EQ(observer.GetAndClearChangedMetrics(), changed_values); + + // Logical bounds should now be portrait. + const gfx::Rect portrait_bounds(origin, gfx::Size(600, 800)); + EXPECT_EQ(observer.GetDisplay().bounds(), portrait_bounds); + const gfx::Size portrait_size_in_pixels(1200, 1600); + EXPECT_EQ(observer.GetDisplay().GetSizeInPixel(), portrait_size_in_pixels); + + gfx::Rect portrait_work_area(portrait_bounds); + portrait_work_area.Inset(insets); + EXPECT_EQ(observer.GetDisplay().work_area(), portrait_work_area); + + // Panel rotation and display rotation should still have an offset. + EXPECT_EQ(observer.GetDisplay().panel_rotation(), + display::Display::Rotation::ROTATE_180); + EXPECT_EQ(observer.GetDisplay().rotation(), + display::Display::Rotation::ROTATE_270); + + platform_screen_->RemoveObserver(&observer); +} + INSTANTIATE_TEST_SUITE_P(XdgVersionStableTest, WaylandScreenTest, Values(wl::ServerConfig{ .shell_version = wl::ShellVersion::kStable})); +INSTANTIATE_TEST_SUITE_P(XdgVersionStableTest, + WaylandAuraShellScreenTest, + Values(wl::ServerConfig{ + .shell_version = wl::ShellVersion::kStable})); INSTANTIATE_TEST_SUITE_P(XdgVersionV6Test, WaylandScreenTest, Values(wl::ServerConfig{
diff --git a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc index 7b9abb66..63ea86e 100644 --- a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc +++ b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
@@ -153,6 +153,10 @@ } WaylandWindow::Hide(); + if (aura_surface_ && wl::get_version_of_object(aura_surface_.get()) >= + ZAURA_SURFACE_RELEASE_SINCE_VERSION) { + aura_surface_.reset(); + } shell_toplevel_.reset(); connection()->ScheduleFlush(); } @@ -874,15 +878,18 @@ void WaylandToplevelWindow::SetUpShellIntegration() { // This method should be called after the XDG surface is initialized. DCHECK(shell_toplevel_); - if (connection()->zaura_shell() && !aura_surface_) { - static constexpr zaura_surface_listener zaura_surface_listener = { - &OcclusionChanged, &LockFrame, &UnlockFrame, &OcclusionStateChanged, - &DeskChanged, &StartThrottle, &EndThrottle, - }; - aura_surface_.reset(zaura_shell_get_aura_surface( - connection()->zaura_shell()->wl_object(), root_surface()->surface())); - zaura_surface_add_listener(aura_surface_.get(), &zaura_surface_listener, - this); + if (connection()->zaura_shell()) { + if (!aura_surface_) { + static constexpr zaura_surface_listener zaura_surface_listener = { + &OcclusionChanged, &LockFrame, &UnlockFrame, + &OcclusionStateChanged, &DeskChanged, &StartThrottle, + &EndThrottle, + }; + aura_surface_.reset(zaura_shell_get_aura_surface( + connection()->zaura_shell()->wl_object(), root_surface()->surface())); + zaura_surface_add_listener(aura_surface_.get(), &zaura_surface_listener, + this); + } zaura_surface_set_occlusion_tracking(aura_surface_.get()); SetImmersiveFullscreenStatus(false); SetInitialWorkspace();
diff --git a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc index 89a37a2a..03d7454 100644 --- a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc
@@ -156,9 +156,6 @@ WaylandWindowTest& operator=(const WaylandWindowTest&) = delete; void SetUp() override { - disabled_features_.push_back( - ui::kWaylandSurfaceSubmissionInPixelCoordinates); - WaylandTest::SetUp(); xdg_surface_ = surface_->xdg_surface();
diff --git a/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc b/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc index 59baec5..3a787e7 100644 --- a/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc +++ b/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc
@@ -20,7 +20,7 @@ namespace { constexpr uint32_t kMinVersion = 1; -constexpr uint32_t kMaxVersion = 37; +constexpr uint32_t kMaxVersion = 38; } // static
diff --git a/ui/ozone/platform/wayland/host/wayland_zaura_shell_unittest.cc b/ui/ozone/platform/wayland/host/wayland_zaura_shell_unittest.cc index 676086ac..93e77bd 100644 --- a/ui/ozone/platform/wayland/host/wayland_zaura_shell_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_zaura_shell_unittest.cc
@@ -22,8 +22,7 @@ base::test::SingleThreadTaskEnvironment::MainThreadType::UI); wl::TestWaylandServerThread server; ASSERT_TRUE(server.Start({.shell_version = wl::ShellVersion::kStable})); - wl::MockZAuraShell zaura_shell_obj; - zaura_shell_obj.Initialize(server.display()); + wl::MockZAuraShell* zaura_shell = server.zaura_shell(); WaylandConnection connection; ASSERT_TRUE(connection.Initialize()); @@ -32,8 +31,9 @@ base::RunLoop().RunUntilIdle(); server.Pause(); - zaura_shell_send_bug_fix(zaura_shell_obj.resource(), 1); - zaura_shell_send_bug_fix(zaura_shell_obj.resource(), 3); + ASSERT_TRUE(server.zaura_shell()->resource()); + zaura_shell_send_bug_fix(zaura_shell->resource(), 1); + zaura_shell_send_bug_fix(zaura_shell->resource(), 3); server.Resume(); base::RunLoop().RunUntilIdle();
diff --git a/ui/ozone/platform/wayland/test/mock_zaura_shell.cc b/ui/ozone/platform/wayland/test/mock_zaura_shell.cc index 9253534..f8a0b44 100644 --- a/ui/ozone/platform/wayland/test/mock_zaura_shell.cc +++ b/ui/ozone/platform/wayland/test/mock_zaura_shell.cc
@@ -4,37 +4,74 @@ #include "ui/ozone/platform/wayland/test/mock_zaura_shell.h" +#include "base/notreached.h" #include "ui/ozone/platform/wayland/test/server_object.h" #include "ui/ozone/platform/wayland/test/test_output.h" #include "ui/ozone/platform/wayland/test/test_zaura_output.h" +#include "ui/ozone/platform/wayland/test/test_zaura_popup.h" +#include "ui/ozone/platform/wayland/test/test_zaura_surface.h" +#include "ui/ozone/platform/wayland/test/test_zaura_toplevel.h" namespace wl { namespace { -constexpr uint32_t kZAuraShellVersion = 35; -constexpr uint32_t kZAuraOutputVersion = 34; +constexpr uint32_t kZAuraShellVersion = 38; +constexpr uint32_t kZAuraOutputVersion = 38; void GetAuraSurface(wl_client* client, wl_resource* resource, uint32_t id, - wl_resource* surface_resource) {} + wl_resource* surface_resource) { + CreateResourceWithImpl<TestZAuraSurface>(client, &zaura_surface_interface, + kZAuraShellVersion, + &kTestZAuraSurfaceImpl, id); +} void GetAuraOutput(wl_client* client, wl_resource* resource, uint32_t id, wl_resource* output_resource) { wl_resource* zaura_output_resource = CreateResourceWithImpl<TestZAuraOutput>( - client, &zaura_output_interface, kZAuraOutputVersion, nullptr, id); + client, &zaura_output_interface, kZAuraOutputVersion, + &kTestZAuraToplevelImpl, id); auto* output = GetUserDataAs<TestOutput>(output_resource); output->SetAuraOutput(GetUserDataAs<TestZAuraOutput>(zaura_output_resource)); } void SurfaceSubmissionInPixelCoordinates(wl_client* client, - wl_resource* resource) {} + wl_resource* resource) { + // TODO(crbug.com/1346347): Implement zaura-shell protocol requests and test + // their usage. + NOTIMPLEMENTED_LOG_ONCE(); +} + +void GetAuraToplevelForXdgToplevel(wl_client* client, + wl_resource* resource, + uint32_t id, + wl_resource* toplevel) { + CreateResourceWithImpl<TestZAuraToplevel>(client, &zaura_toplevel_interface, + kZAuraShellVersion, + &kTestZAuraToplevelImpl, id); +} + +void GetAuraPopupForXdgPopup(wl_client* client, + wl_resource* resource, + uint32_t id, + wl_resource* popup) { + CreateResourceWithImpl<TestZAuraPopup>(client, &zaura_popup_interface, + kZAuraShellVersion, + &kTestZAuraPopupImpl, id); +} const struct zaura_shell_interface kMockZAuraShellImpl = { - &GetAuraSurface, &GetAuraOutput, &SurfaceSubmissionInPixelCoordinates}; + &GetAuraSurface, + &GetAuraOutput, + &SurfaceSubmissionInPixelCoordinates, + &GetAuraToplevelForXdgToplevel, + &GetAuraPopupForXdgPopup, + &DestroyResource, +}; } // namespace
diff --git a/ui/ozone/platform/wayland/test/test_wayland_server_thread.cc b/ui/ozone/platform/wayland/test/test_wayland_server_thread.cc index 00860dd7..e1e729ba 100644 --- a/ui/ozone/platform/wayland/test/test_wayland_server_thread.cc +++ b/ui/ozone/platform/wayland/test/test_wayland_server_thread.cc
@@ -92,6 +92,8 @@ } else { if (!xdg_shell_.Initialize(display_.get())) return false; + if (!zaura_shell_.Initialize(display_.get())) + return false; } if (!zcr_stylus_.Initialize(display_.get())) return false;
diff --git a/ui/ozone/platform/wayland/test/test_wayland_server_thread.h b/ui/ozone/platform/wayland/test/test_wayland_server_thread.h index 83d24ec2..3583d5d 100644 --- a/ui/ozone/platform/wayland/test/test_wayland_server_thread.h +++ b/ui/ozone/platform/wayland/test/test_wayland_server_thread.h
@@ -18,6 +18,7 @@ #include "ui/ozone/platform/wayland/test/global_object.h" #include "ui/ozone/platform/wayland/test/mock_wp_presentation.h" #include "ui/ozone/platform/wayland/test/mock_xdg_shell.h" +#include "ui/ozone/platform/wayland/test/mock_zaura_shell.h" #include "ui/ozone/platform/wayland/test/mock_zwp_linux_dmabuf.h" #include "ui/ozone/platform/wayland/test/test_alpha_compositing.h" #include "ui/ozone/platform/wayland/test/test_compositor.h" @@ -112,6 +113,7 @@ TestDataDeviceManager* data_device_manager() { return &data_device_manager_; } TestSeat* seat() { return &seat_; } MockXdgShell* xdg_shell() { return &xdg_shell_; } + MockZAuraShell* zaura_shell() { return &zaura_shell_; } TestOutput* output() { return &output_; } TestZcrTextInputExtensionV1* text_input_extension_v1() { return &zcr_text_input_extension_v1_; @@ -176,6 +178,7 @@ TestSeat seat_; MockXdgShell xdg_shell_; MockZxdgShellV6 zxdg_shell_v6_; + MockZAuraShell zaura_shell_; TestZcrStylus zcr_stylus_; TestZcrTextInputExtensionV1 zcr_text_input_extension_v1_; TestZwpTextInputManagerV1 zwp_text_input_manager_v1_;
diff --git a/ui/ozone/platform/wayland/test/test_zaura_popup.cc b/ui/ozone/platform/wayland/test/test_zaura_popup.cc new file mode 100644 index 0000000..7aec205 --- /dev/null +++ b/ui/ozone/platform/wayland/test/test_zaura_popup.cc
@@ -0,0 +1,46 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/ozone/platform/wayland/test/test_zaura_popup.h" + +#include <aura-shell-server-protocol.h> + +#include "base/notreached.h" + +namespace wl { + +namespace { + +void SurfaceSubmissionInPixelCoordinates(struct wl_client* client, + struct wl_resource* resource) { + // TODO(crbug.com/1346347): Implement zaura-shell protocol requests and test + // their usage. + NOTIMPLEMENTED_LOG_ONCE(); +} + +void SetDecoration(struct wl_client* client, + struct wl_resource* resource, + uint32_t type) { + NOTIMPLEMENTED_LOG_ONCE(); +} + +void SetMenu(struct wl_client* client, struct wl_resource* resource) { + NOTIMPLEMENTED_LOG_ONCE(); +} + +} // namespace + +TestZAuraPopup::TestZAuraPopup(wl_resource* resource) + : ServerObject(resource) {} + +TestZAuraPopup::~TestZAuraPopup() = default; + +const struct zaura_popup_interface kTestZAuraPopupImpl = { + &SurfaceSubmissionInPixelCoordinates, + &SetDecoration, + &SetMenu, + &DestroyResource, +}; + +} // namespace wl
diff --git a/ui/ozone/platform/wayland/test/test_zaura_popup.h b/ui/ozone/platform/wayland/test/test_zaura_popup.h new file mode 100644 index 0000000..3398dc5f --- /dev/null +++ b/ui/ozone/platform/wayland/test/test_zaura_popup.h
@@ -0,0 +1,29 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_OZONE_PLATFORM_WAYLAND_TEST_TEST_ZAURA_POPUP_H_ +#define UI_OZONE_PLATFORM_WAYLAND_TEST_TEST_ZAURA_POPUP_H_ + +#include <aura-shell-server-protocol.h> + +#include "ui/ozone/platform/wayland/test/server_object.h" + +namespace wl { + +extern const struct zaura_popup_interface kTestZAuraPopupImpl; + +// Manages zaura_popup object. +class TestZAuraPopup : public ServerObject { + public: + explicit TestZAuraPopup(wl_resource* resource); + + TestZAuraPopup(const TestZAuraPopup&) = delete; + TestZAuraPopup& operator=(const TestZAuraPopup&) = delete; + + ~TestZAuraPopup() override; +}; + +} // namespace wl + +#endif // UI_OZONE_PLATFORM_WAYLAND_TEST_TEST_ZAURA_POPUP_H_
diff --git a/ui/ozone/platform/wayland/test/test_zaura_surface.cc b/ui/ozone/platform/wayland/test/test_zaura_surface.cc new file mode 100644 index 0000000..f5dff2bd --- /dev/null +++ b/ui/ozone/platform/wayland/test/test_zaura_surface.cc
@@ -0,0 +1,170 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/ozone/platform/wayland/test/test_zaura_surface.h" + +#include <aura-shell-server-protocol.h> + +#include "base/notreached.h" +#include "ui/ozone/platform/wayland/test/server_object.h" + +namespace wl { + +namespace { + +void set_frame(struct wl_client* client, + struct wl_resource* resource, + uint32_t type) { + NOTREACHED(); +} +void set_parent(struct wl_client* client, + struct wl_resource* resource, + struct wl_resource* parent, + int32_t x, + int32_t y) { + NOTREACHED(); +} +void set_frame_colors(struct wl_client* client, + struct wl_resource* resource, + uint32_t active_color, + uint32_t inactive_color) { + NOTREACHED(); +} +void set_startup_id(struct wl_client* client, + struct wl_resource* resource, + const char* startup_id) { + NOTREACHED(); +} +void set_application_id(struct wl_client* client, + struct wl_resource* resource, + const char* application_id) { + NOTREACHED(); +} +void set_client_surface_id(struct wl_client* client, + struct wl_resource* resource, + int32_t client_surface_id) { + NOTREACHED(); +} +void set_occlusion_tracking(struct wl_client* client, + struct wl_resource* resource) { + NOTIMPLEMENTED_LOG_ONCE(); +} +void unset_occlusion_tracking(struct wl_client* client, + struct wl_resource* resource) { + NOTREACHED(); +} +void activate(struct wl_client* client, struct wl_resource* resource) { + NOTREACHED(); +} +void draw_attention(struct wl_client* client, struct wl_resource* resource) { + NOTREACHED(); +} +void set_fullscreen_mode(struct wl_client* client, + struct wl_resource* resource, + uint32_t mode) { + NOTIMPLEMENTED_LOG_ONCE(); +} +void set_client_surface_str_id(struct wl_client* client, + struct wl_resource* resource, + const char* client_surface_id) { + NOTREACHED(); +} +void set_server_start_resize(struct wl_client* client, + struct wl_resource* resource) { + NOTIMPLEMENTED_LOG_ONCE(); +} +void intent_to_snap(struct wl_client* client, + struct wl_resource* resource, + uint32_t direction) { + NOTREACHED(); +} +void set_snap_left(struct wl_client* client, struct wl_resource* resource) { + NOTREACHED(); +} +void set_snap_right(struct wl_client* client, struct wl_resource* resource) { + NOTREACHED(); +} +void unset_snap(struct wl_client* client, struct wl_resource* resource) { + NOTREACHED(); +} +void set_window_session_id(struct wl_client* client, + struct wl_resource* resource, + int32_t id) { + NOTREACHED(); +} +void set_can_go_back(struct wl_client* client, struct wl_resource* resource) { + NOTREACHED(); +} +void unset_can_go_back(struct wl_client* client, struct wl_resource* resource) { + NOTREACHED(); +} +void set_pip(struct wl_client* client, struct wl_resource* resource) { + NOTREACHED(); +} +void unset_pip(struct wl_client* client, struct wl_resource* resource) { + NOTREACHED(); +} +void set_aspect_ratio(struct wl_client* client, + struct wl_resource* resource, + int32_t width, + int32_t height) { + NOTREACHED(); +} +void move_to_desk(struct wl_client* client, + struct wl_resource* resource, + int32_t index) { + NOTREACHED(); +} +void set_initial_workspace(struct wl_client* client, + struct wl_resource* resource, + const char* initial_workspace) { + NOTREACHED(); +} +void set_pin(struct wl_client* client, + struct wl_resource* resource, + int32_t trusted) { + NOTREACHED(); +} +void unset_pin(struct wl_client* client, struct wl_resource* resource) { + NOTREACHED(); +} +} // namespace + +TestZAuraSurface::TestZAuraSurface(wl_resource* resource) + : ServerObject(resource) {} + +TestZAuraSurface::~TestZAuraSurface() = default; + +const struct zaura_surface_interface kTestZAuraSurfaceImpl = { + &set_frame, + &set_parent, + &set_frame_colors, + &set_startup_id, + &set_application_id, + &set_client_surface_id, + &set_occlusion_tracking, + &unset_occlusion_tracking, + &activate, + &draw_attention, + &set_fullscreen_mode, + &set_client_surface_str_id, + &set_server_start_resize, + &intent_to_snap, + &set_snap_left, + &set_snap_right, + &unset_snap, + &set_window_session_id, + &set_can_go_back, + &unset_can_go_back, + &set_pip, + &unset_pip, + &set_aspect_ratio, + &move_to_desk, + &set_initial_workspace, + &set_pin, + &unset_pin, + &DestroyResource, +}; + +} // namespace wl
diff --git a/ui/ozone/platform/wayland/test/test_zaura_surface.h b/ui/ozone/platform/wayland/test/test_zaura_surface.h new file mode 100644 index 0000000..773bf02 --- /dev/null +++ b/ui/ozone/platform/wayland/test/test_zaura_surface.h
@@ -0,0 +1,29 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_OZONE_PLATFORM_WAYLAND_TEST_TEST_ZAURA_SURFACE_H_ +#define UI_OZONE_PLATFORM_WAYLAND_TEST_TEST_ZAURA_SURFACE_H_ + +#include <aura-shell-server-protocol.h> + +#include "ui/ozone/platform/wayland/test/server_object.h" + +namespace wl { + +extern const struct zaura_surface_interface kTestZAuraSurfaceImpl; + +// Manages zaura_surface object. +class TestZAuraSurface : public ServerObject { + public: + explicit TestZAuraSurface(wl_resource* resource); + + TestZAuraSurface(const TestZAuraSurface&) = delete; + TestZAuraSurface& operator=(const TestZAuraSurface&) = delete; + + ~TestZAuraSurface() override; +}; + +} // namespace wl + +#endif // UI_OZONE_PLATFORM_WAYLAND_TEST_TEST_ZAURA_SURFACE_H_
diff --git a/ui/ozone/platform/wayland/test/test_zaura_toplevel.cc b/ui/ozone/platform/wayland/test/test_zaura_toplevel.cc new file mode 100644 index 0000000..f353bce --- /dev/null +++ b/ui/ozone/platform/wayland/test/test_zaura_toplevel.cc
@@ -0,0 +1,91 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/ozone/platform/wayland/test/test_zaura_toplevel.h" + +#include <aura-shell-server-protocol.h> + +#include "base/notreached.h" + +namespace wl { + +namespace { + +void SetOrientationLock(struct wl_client* client, + struct wl_resource* resource, + uint32_t orientation_lock) { + NOTIMPLEMENTED_LOG_ONCE(); +} + +void SurfaceSubmissionInPixelCoordinates(struct wl_client* client, + struct wl_resource* resource) { + // TODO(crbug.com/1346347): Implement zaura-shell protocol requests and test + // their usage. + NOTIMPLEMENTED_LOG_ONCE(); +} + +void SetSupportsScreenCoordinates(struct wl_client* client, + struct wl_resource* resource) { + NOTIMPLEMENTED_LOG_ONCE(); +} + +void SetWindowBounds(struct wl_client* client, + struct wl_resource* resource, + int32_t x, + int32_t y, + int32_t width, + int32_t height, + struct wl_resource* output) { + NOTIMPLEMENTED_LOG_ONCE(); +} + +void SetRestoreInfo(struct wl_client* client, + struct wl_resource* resource, + int32_t restore_session_id, + int32_t restore_window_id) { + NOTREACHED(); +} + +void SetSystemModal(struct wl_client* client, struct wl_resource* resource) { + NOTREACHED(); +} + +void UnsetSystemModal(struct wl_client* client, struct wl_resource* resource) { + NOTIMPLEMENTED_LOG_ONCE(); +} + +void SetRestoreInfoWithWindowIdSource(struct wl_client* client, + struct wl_resource* resource, + int32_t restore_session_id, + const char* restore_window_id_source) { + NOTREACHED(); +} + +void SetDecoration(struct wl_client* client, + struct wl_resource* resource, + uint32_t type) { + NOTREACHED(); +} + +} // namespace + +TestZAuraToplevel::TestZAuraToplevel(wl_resource* resource) + : ServerObject(resource) {} + +TestZAuraToplevel::~TestZAuraToplevel() = default; + +const struct zaura_toplevel_interface kTestZAuraToplevelImpl = { + &SetOrientationLock, + &SurfaceSubmissionInPixelCoordinates, + &SetSupportsScreenCoordinates, + &SetWindowBounds, + &SetRestoreInfo, + &SetSystemModal, + &UnsetSystemModal, + &SetRestoreInfoWithWindowIdSource, + &SetDecoration, + &DestroyResource, +}; + +} // namespace wl
diff --git a/ui/ozone/platform/wayland/test/test_zaura_toplevel.h b/ui/ozone/platform/wayland/test/test_zaura_toplevel.h new file mode 100644 index 0000000..86a023a --- /dev/null +++ b/ui/ozone/platform/wayland/test/test_zaura_toplevel.h
@@ -0,0 +1,29 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_OZONE_PLATFORM_WAYLAND_TEST_TEST_ZAURA_TOPLEVEL_H_ +#define UI_OZONE_PLATFORM_WAYLAND_TEST_TEST_ZAURA_TOPLEVEL_H_ + +#include <aura-shell-server-protocol.h> + +#include "ui/ozone/platform/wayland/test/server_object.h" + +namespace wl { + +extern const struct zaura_toplevel_interface kTestZAuraToplevelImpl; + +// Manages zaura_toplevel object. +class TestZAuraToplevel : public ServerObject { + public: + explicit TestZAuraToplevel(wl_resource* resource); + + TestZAuraToplevel(const TestZAuraToplevel&) = delete; + TestZAuraToplevel& operator=(const TestZAuraToplevel&) = delete; + + ~TestZAuraToplevel() override; +}; + +} // namespace wl + +#endif // UI_OZONE_PLATFORM_WAYLAND_TEST_TEST_ZAURA_TOPLEVEL_H_
diff --git a/ui/ozone/platform/wayland/test/wayland_test.cc b/ui/ozone/platform/wayland/test/wayland_test.cc index 46f1c25..bf06105 100644 --- a/ui/ozone/platform/wayland/test/wayland_test.cc +++ b/ui/ozone/platform/wayland/test/wayland_test.cc
@@ -50,6 +50,9 @@ WaylandTest::~WaylandTest() {} void WaylandTest::SetUp() { + disabled_features_.push_back(ui::kWaylandSurfaceSubmissionInPixelCoordinates); + disabled_features_.push_back(features::kWaylandScreenCoordinatesEnabled); + feature_list_.InitWithFeatures(enabled_features_, disabled_features_); if (DeviceDataManager::HasInstance()) {
diff --git a/ui/snapshot/snapshot_mac_unittest.mm b/ui/snapshot/snapshot_mac_unittest.mm index 9feeb03..ef8d88d 100644 --- a/ui/snapshot/snapshot_mac_unittest.mm +++ b/ui/snapshot/snapshot_mac_unittest.mm
@@ -39,9 +39,7 @@ base::scoped_nsobject<NSBitmapImageRep> rep( [[NSBitmapImageRep alloc] initWithCGImage:cgImage]); EXPECT_TRUE([rep isKindOfClass:[NSBitmapImageRep class]]); - CGFloat scaleFactor = 1.0f; - if ([window respondsToSelector:@selector(backingScaleFactor)]) - scaleFactor = [window backingScaleFactor]; + CGFloat scaleFactor = [window backingScaleFactor]; EXPECT_EQ(400 * scaleFactor, CGImageGetWidth([rep CGImage])); NSColor* color = [rep colorAtX:200 * scaleFactor y:200 * scaleFactor]; CGFloat red = 0, green = 0, blue = 0, alpha = 0;
diff --git a/ui/views/corewm/cursor_height_provider_win.cc b/ui/views/corewm/cursor_height_provider_win.cc index 461d225..cc93ffd7 100644 --- a/ui/views/corewm/cursor_height_provider_win.cc +++ b/ui/views/corewm/cursor_height_provider_win.cc
@@ -12,6 +12,7 @@ #include <map> #include <memory> +#include "base/numerics/safe_conversions.h" #include "base/win/scoped_hdc.h" namespace { @@ -46,9 +47,9 @@ data = std::make_unique<uint32_t[]>(info.bmiHeader.biSizeImage / sizeof(uint32_t)); - int result = - GetDIBits(hdc, handle, 0, info.bmiHeader.biHeight, data.get(), - reinterpret_cast<BITMAPINFO*>(header.get()), DIB_RGB_COLORS); + int result = GetDIBits( + hdc, handle, 0, static_cast<UINT>(info.bmiHeader.biHeight), data.get(), + reinterpret_cast<BITMAPINFO*>(header.get()), DIB_RGB_COLORS); if (result == 0) data.reset(); @@ -70,10 +71,10 @@ return true; } -// Gets the vertical offset between specified cursor's hotpoint and it's bottom. +// Gets the vertical offset between specified cursor's hotpoint and its bottom. // // Gets the cursor image data and extract cursor's visible height. -// Based on that get's what should be the vertical offset between cursor's +// Based on that gets what should be the vertical offset between cursor's // hot point and the tooltip. int CalculateCursorHeight(HCURSOR cursor_handle) { base::win::ScopedGetDC hdc(nullptr); @@ -90,16 +91,15 @@ // Rows are padded to full DWORDs. OR with this mask will set them to 1 // to simplify matching with |transparent_mask|. uint32_t last_byte_mask = 0xFFFFFFFF; + const auto width = static_cast<uint32_t>(bitmap_info.bmiHeader.biWidth); const unsigned char bits_to_shift = - sizeof(last_byte_mask) * 8 - - (bitmap_info.bmiHeader.biWidth % kBitsPeruint32); + sizeof(last_byte_mask) * 8 - (width % kBitsPeruint32); if (bits_to_shift != kBitsPeruint32) last_byte_mask = (last_byte_mask << bits_to_shift); else last_byte_mask = 0; - const uint32_t row_size = - (bitmap_info.bmiHeader.biWidth + kBitsPeruint32 - 1) / kBitsPeruint32; + const uint32_t row_size = (width + kBitsPeruint32 - 1) / kBitsPeruint32; PixelData data(GetBitmapData(icon.hbmMask, bitmap_info, hdc)); if (data == nullptr) return kDefaultHeight; @@ -111,10 +111,9 @@ // of each other (xor mask and and mask). const bool has_xor_mask = bitmap_info.bmiHeader.biHeight == 2 * bitmap_info.bmiHeader.biWidth; - const int cursor_height = - has_xor_mask ? static_cast<int>(bitmap_info.bmiHeader.biHeight / 2) - : static_cast<int>(bitmap_info.bmiHeader.biHeight); - int xor_offset; + const auto height = static_cast<uint32_t>(bitmap_info.bmiHeader.biHeight); + const uint32_t cursor_height = has_xor_mask ? height / 2 : height; + uint32_t xor_offset; if (has_xor_mask) { for (xor_offset = 0; xor_offset < cursor_height; ++xor_offset) { const uint32_t row_start = row_size * xor_offset; @@ -129,10 +128,10 @@ xor_offset = cursor_height; } - int and_offset; + uint32_t and_offset; - for (and_offset = has_xor_mask ? cursor_height : 0; - and_offset < bitmap_info.bmiHeader.biHeight; ++and_offset) { + for (and_offset = has_xor_mask ? cursor_height : 0; and_offset < height; + ++and_offset) { if (!IsRowTransparent(data, row_size, last_byte_mask, and_offset)) { break; } @@ -140,12 +139,12 @@ if (has_xor_mask) { and_offset -= cursor_height; } - const int offset = std::min(xor_offset, and_offset); + const uint32_t offset = std::min(xor_offset, and_offset); DeleteObject(icon.hbmColor); DeleteObject(icon.hbmMask); - return cursor_height - offset - icon.yHotspot + 1; + return base::checked_cast<int>(cursor_height - offset - icon.yHotspot + 1); } } // namespace
diff --git a/ui/views/corewm/tooltip_win.cc b/ui/views/corewm/tooltip_win.cc index 5eb4cae..3f8045d 100644 --- a/ui/views/corewm/tooltip_win.cc +++ b/ui/views/corewm/tooltip_win.cc
@@ -81,8 +81,8 @@ const int cursoroffset = GetCurrentCursorVisibleHeight(); screen_point.Offset(0, cursoroffset); - DWORD tooltip_size = SendMessage(tooltip_hwnd_, TTM_GETBUBBLESIZE, 0, - reinterpret_cast<LPARAM>(&toolinfo_)); + LRESULT tooltip_size = SendMessage(tooltip_hwnd_, TTM_GETBUBBLESIZE, 0, + reinterpret_cast<LPARAM>(&toolinfo_)); const gfx::Size size(LOWORD(tooltip_size), HIWORD(tooltip_size)); const display::Display display(
diff --git a/ui/views/widget/desktop_aura/desktop_native_cursor_manager_win.cc b/ui/views/widget/desktop_aura/desktop_native_cursor_manager_win.cc index 80b626a..e3885265 100644 --- a/ui/views/widget/desktop_aura/desktop_native_cursor_manager_win.cc +++ b/ui/views/widget/desktop_aura/desktop_native_cursor_manager_win.cc
@@ -24,7 +24,8 @@ if (hkcu_cursor_regkey_.Valid() && hkcu_cursor_regkey_.ReadValueDW(L"CursorBaseSize", &cursor_base_size) == ERROR_SUCCESS) { - system_cursor_size_ = gfx::Size(cursor_base_size, cursor_base_size); + int size = base::checked_cast<int>(cursor_base_size); + system_cursor_size_ = gfx::Size(size, size); } // Report cursor size.
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc index d7260950..10cdc6c 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
@@ -378,7 +378,7 @@ scaled_rect.roundOut(&rounded_scaled_rect); sk_rects.push_back(rounded_scaled_rect); } - shape.setRects(&sk_rects[0], sk_rects.size()); + shape.setRects(&sk_rects[0], static_cast<int>(sk_rects.size())); } else { for (const gfx::Rect& rect : *native_shape) shape.op(gfx::RectToSkIRect(rect), SkRegion::kUnion_Op);
diff --git a/ui/views/widget/widget_hwnd_utils.cc b/ui/views/widget/widget_hwnd_utils.cc index b3a3efd..89b4b5e 100644 --- a/ui/views/widget/widget_hwnd_utils.cc +++ b/ui/views/widget/widget_hwnd_utils.cc
@@ -61,13 +61,13 @@ // WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX *style |= WS_OVERLAPPEDWINDOW; if (!widget_delegate->CanMaximize()) - *style &= ~WS_MAXIMIZEBOX; + *style &= static_cast<DWORD>(~WS_MAXIMIZEBOX); if (!widget_delegate->CanMinimize()) - *style &= ~WS_MINIMIZEBOX; + *style &= static_cast<DWORD>(~WS_MINIMIZEBOX); if (!widget_delegate->CanResize()) - *style &= ~(WS_THICKFRAME | WS_MAXIMIZEBOX); + *style &= static_cast<DWORD>(~(WS_THICKFRAME | WS_MAXIMIZEBOX)); if (params.remove_standard_frame) - *style &= ~(WS_MINIMIZEBOX | WS_MAXIMIZEBOX); + *style &= static_cast<DWORD>(~(WS_MINIMIZEBOX | WS_MAXIMIZEBOX)); if (native_widget_delegate->IsDialogBox()) { *style |= DS_MODALFRAME; @@ -87,7 +87,7 @@ // See layered window comment below. if (is_translucent) - *style &= ~(WS_THICKFRAME | WS_CAPTION); + *style &= static_cast<DWORD>(~(WS_THICKFRAME | WS_CAPTION)); break; } case Widget::InitParams::TYPE_CONTROL:
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc index 1208238..95b38bf 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc
@@ -191,7 +191,7 @@ BOOL CALLBACK EnumChildWindowsForRedraw(HWND hwnd, LPARAM lparam) { DWORD process_id; GetWindowThreadProcessId(hwnd, &process_id); - int flags = RDW_INVALIDATE | RDW_NOCHILDREN | RDW_FRAME; + UINT flags = RDW_INVALIDATE | RDW_NOCHILDREN | RDW_FRAME; if (process_id == GetCurrentProcessId()) flags |= RDW_UPDATENOW; RedrawWindow(hwnd, nullptr, nullptr, flags); @@ -671,7 +671,7 @@ return; } - DWORD native_show_state; + int native_show_state; if (show_state == ui::SHOW_STATE_MAXIMIZED && !pixel_restore_bounds.IsEmpty()) { WINDOWPLACEMENT placement = {0}; @@ -919,7 +919,7 @@ bool HWNDMessageHandler::SetTitle(const std::u16string& title) { std::wstring current_title; - size_t len_with_null = GetWindowTextLength(hwnd()) + 1; + auto len_with_null = static_cast<size_t>(GetWindowTextLength(hwnd())) + 1; if (len_with_null == 1 && title.length() == 0) return false; if (len_with_null - 1 == title.length() && @@ -1015,7 +1015,7 @@ void HWNDMessageHandler::SizeConstraintsChanged() { LONG style = GetWindowLong(hwnd(), GWL_STYLE); // Ignore if this is not a standard window. - if (style & (WS_POPUP | WS_CHILD)) + if (style & static_cast<LONG>(WS_POPUP | WS_CHILD)) return; // Windows cannot have WS_THICKFRAME set if translucent. @@ -1463,7 +1463,7 @@ void HWNDMessageHandler::ExecuteSystemMenuCommand(int command) { if (command) - SendMessage(hwnd(), WM_SYSCOMMAND, command, 0); + SendMessage(hwnd(), WM_SYSCOMMAND, static_cast<WPARAM>(command), 0); } void HWNDMessageHandler::TrackMouseEvents(DWORD mouse_tracking_flags) { @@ -2746,7 +2746,7 @@ return; } - if (delegate_->HandleCommand(notification_code)) + if (delegate_->HandleCommand(static_cast<int>(notification_code))) return; bool is_mouse_menu = (notification_code & sc_mask) == SC_MOUSEMENU; @@ -2786,7 +2786,7 @@ } // Handle touch events only on Aura for now. - size_t num_points = LOWORD(w_param); + WORD num_points = LOWORD(w_param); std::unique_ptr<TOUCHINPUT[]> input(new TOUCHINPUT[num_points]); if (ui::GetTouchInputInfoWrapper(reinterpret_cast<HTOUCHINPUT>(l_param), num_points, input.get(), @@ -2819,7 +2819,8 @@ last_touch_or_pen_message_time_ = ::GetMessageTime(); gfx::Point touch_point(point.x, point.y); - size_t touch_id = id_generator_.GetGeneratedID(input[i].dwID); + auto touch_id = static_cast<ui::PointerId>( + id_generator_.GetGeneratedID(input[i].dwID)); if (input[i].dwFlags & TOUCHEVENTF_DOWN) { touch_ids_.insert(input[i].dwID); @@ -2857,7 +2858,8 @@ // Log that we've hit this code. When usage drops off, we can remove // this "workaround". See https://crbug.com/811273 UMA_HISTOGRAM_BOOLEAN("TouchScreen.MissedTOUCHEVENTF_UP", true); - size_t touch_id = id_generator_.GetGeneratedID(touch_number); + auto touch_id = static_cast<ui::PointerId>( + id_generator_.GetGeneratedID(touch_number)); touch_ids_.erase(touch_number); GenerateTouchEvent(ui::ET_TOUCH_RELEASED, gfx::Point(0, 0), touch_id, event_time, &touch_events); @@ -2888,7 +2890,8 @@ (window_pos->flags & (SWP_NOZORDER | SWP_NOACTIVATE))) { // Just sizing/moving the window; ignore. window_pos->flags |= SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW; - window_pos->flags &= ~(SWP_SHOWWINDOW | SWP_HIDEWINDOW); + window_pos->flags &= + static_cast<unsigned int>(~(SWP_SHOWWINDOW | SWP_HIDEWINDOW)); } } else if (!GetParent(hwnd())) { RECT window_rect; @@ -2971,7 +2974,8 @@ window_pos->cy = new_window_rect.height(); // WARNING! Don't set SWP_FRAMECHANGED here, it breaks moving the child // HWNDs for some reason. - window_pos->flags &= ~(SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW); + window_pos->flags &= static_cast<unsigned int>( + ~(SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW)); window_pos->flags |= SWP_NOCOPYBITS; // Now ignore all immediately-following SetWindowPos() changes. Windows @@ -3020,7 +3024,7 @@ if (ScopedFullscreenVisibility::IsHiddenForFullscreen(hwnd())) { // Prevent the window from being made visible if we've been asked to do so. // See comment in header as to why we might want this. - window_pos->flags &= ~SWP_SHOWWINDOW; + window_pos->flags &= static_cast<unsigned int>(~SWP_SHOWWINDOW); } if (window_pos->flags & SWP_HIDEWINDOW) @@ -3150,8 +3154,8 @@ // expect screen coordinates. POINT screen_point = CR_POINT_INITIALIZER_FROM_LPARAM(l_param); MapWindowPoints(hwnd(), HWND_DESKTOP, &screen_point, 1); - w_param = SendMessage(hwnd(), WM_NCHITTEST, 0, - MAKELPARAM(screen_point.x, screen_point.y)); + w_param = static_cast<WPARAM>(SendMessage( + hwnd(), WM_NCHITTEST, 0, MAKELPARAM(screen_point.x, screen_point.y))); if (w_param == HTCAPTION || w_param == HTSYSMENU) { ShowSystemMenuAtScreenPixelLocation(hwnd(), gfx::Point(screen_point)); return 0; @@ -3348,7 +3352,8 @@ gfx::Point touch_point = gfx::Point(client_point.x, client_point.y); ui::EventType event_type = GetTouchEventType(pointer_flags); const base::TimeTicks event_time = ui::EventTimeForNow(); - size_t mapped_pointer_id = id_generator_.GetGeneratedID(pointer_id); + auto mapped_pointer_id = + static_cast<ui::PointerId>(id_generator_.GetGeneratedID(pointer_id)); // The pressure from POINTER_TOUCH_INFO is normalized to a range between 0 // and 1024, but we define the pressure of the range of [0,1]. @@ -3359,7 +3364,7 @@ float radius_y = (pointer_touch_info.rcContact.bottom - pointer_touch_info.rcContact.top) / 2.0; - int rotation_angle = pointer_touch_info.orientation; + auto rotation_angle = static_cast<int>(pointer_touch_info.orientation); rotation_angle %= 180; if (rotation_angle < 0) rotation_angle += 180; @@ -3520,7 +3525,7 @@ void HWNDMessageHandler::GenerateTouchEvent(ui::EventType event_type, const gfx::Point& point, - size_t id, + ui::PointerId id, base::TimeTicks time_stamp, TouchEvents* touch_events) { ui::TouchEvent event(event_type, point, time_stamp,
diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h index 65bf924..cdc283b 100644 --- a/ui/views/win/hwnd_message_handler.h +++ b/ui/views/win/hwnd_message_handler.h
@@ -579,7 +579,7 @@ // |time_stamp| is the time stamp associated with the message. void GenerateTouchEvent(ui::EventType event_type, const gfx::Point& point, - size_t id, + ui::PointerId id, base::TimeTicks time_stamp, TouchEvents* touch_events);
diff --git a/ui/views/win/hwnd_util_aurawin.cc b/ui/views/win/hwnd_util_aurawin.cc index e01c37d62..f235774d 100644 --- a/ui/views/win/hwnd_util_aurawin.cc +++ b/ui/views/win/hwnd_util_aurawin.cc
@@ -40,8 +40,8 @@ if (host) { HWND hwnd = host->GetAcceleratedWidget(); RECT rect = client_bounds.ToRECT(); - DWORD style = ::GetWindowLong(hwnd, GWL_STYLE); - DWORD ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE); + auto style = static_cast<DWORD>(::GetWindowLong(hwnd, GWL_STYLE)); + auto ex_style = static_cast<DWORD>(::GetWindowLong(hwnd, GWL_EXSTYLE)); ::AdjustWindowRectEx(&rect, style, FALSE, ex_style); return gfx::Rect(rect); } @@ -60,7 +60,7 @@ ::TrackPopupMenu(menu, flags, point.x(), point.y(), 0, window, nullptr); if (command) - ::SendMessage(window, WM_SYSCOMMAND, command, 0); + ::SendMessage(window, WM_SYSCOMMAND, static_cast<WPARAM>(command), 0); } } // namespace views
diff --git a/ui/views/win/pen_event_processor.cc b/ui/views/win/pen_event_processor.cc index 0970a037..2361c5f 100644 --- a/ui/views/win/pen_event_processor.cc +++ b/ui/views/win/pen_event_processor.cc
@@ -37,7 +37,8 @@ UINT32 pointer_id, const POINTER_PEN_INFO& pointer_pen_info, const gfx::Point& point) { - unsigned int mapped_pointer_id = id_generator_->GetGeneratedID(pointer_id); + auto mapped_pointer_id = + static_cast<ui::PointerId>(id_generator_->GetGeneratedID(pointer_id)); // We are now creating a fake mouse event with pointer type of pen from // the WM_POINTER message and then setting up an associated pointer
diff --git a/ui/views/win/pen_event_processor.h b/ui/views/win/pen_event_processor.h index f4a261c..c9112736 100644 --- a/ui/views/win/pen_event_processor.h +++ b/ui/views/win/pen_event_processor.h
@@ -63,7 +63,7 @@ base::flat_map<UINT32, bool> sent_mouse_down_; base::flat_map<UINT32, bool> sent_touch_start_; - absl::optional<unsigned int> eraser_pointer_id_; + absl::optional<ui::PointerId> eraser_pointer_id_; }; } // namespace views
diff --git a/ui/webui/resources/BUILD.gn b/ui/webui/resources/BUILD.gn index 483defef..1f61f4d 100644 --- a/ui/webui/resources/BUILD.gn +++ b/ui/webui/resources/BUILD.gn
@@ -9,6 +9,7 @@ import("//tools/typescript/ts_library.gni") import("//ui/webui/resources/include_polymer.gni") import("//ui/webui/resources/tools/generate_grd.gni") +import("./cr_elements/cr_elements.gni") generate_grd("build_grd") { grd_prefix = "webui_generated" @@ -321,87 +322,25 @@ composite = true tsconfig_base = "tsconfig_base.json" - in_files = [ - "cr_elements/cr_splitter/cr_splitter.ts", - "cr_elements/cr_tab_box/cr_tab_box.ts", - "cr_elements/cr_tab_box/cr_tab_box.html.ts", - "cr_elements/cr_tree/cr_tree.ts", - "cr_elements/cr_tree/cr_tree.html.ts", - "cr_elements/cr_tree/cr_tree_base.ts", - "cr_elements/cr_tree/cr_tree_item.ts", - "cr_elements/cr_tree/cr_tree_item.html.ts", - "js/assert_ts.ts", - "js/custom_element.ts", - "js/cr/ui/focus_grid.ts", - "js/cr/ui/drag_wrapper.ts", - ] + in_files = cr_elements_files + [ + "js/assert_ts.ts", + "js/custom_element.ts", + "js/cr/ui/focus_grid.ts", + "js/cr/ui/drag_wrapper.ts", + ] if (include_polymer) { in_files += [ "cr_components/localized_link/localized_link.html.ts", "cr_components/localized_link/localized_link.ts", - "cr_components/managed_footnote/managed_footnote.html.ts", - "cr_components/managed_footnote/managed_footnote.ts", "cr_components/managed_dialog/managed_dialog.html.ts", "cr_components/managed_dialog/managed_dialog.ts", - "cr_elements/cr_auto_img/cr_auto_img.ts", - "cr_elements/cr_grid/cr_grid.html.ts", - "cr_elements/cr_grid/cr_grid.ts", - "cr_elements/cr_a11y_announcer/cr_a11y_announcer.html.ts", - "cr_elements/cr_a11y_announcer/cr_a11y_announcer.ts", - "cr_elements/cr_action_menu/cr_action_menu.html.ts", - "cr_elements/cr_action_menu/cr_action_menu.ts", - "cr_elements/cr_container_shadow_mixin.ts", - "cr_elements/cr_drawer/cr_drawer.html.ts", - "cr_elements/cr_drawer/cr_drawer.ts", - "cr_elements/cr_link_row/cr_link_row.html.ts", - "cr_elements/cr_link_row/cr_link_row.ts", - "cr_elements/cr_menu_selector/cr_menu_selector.ts", - "cr_elements/cr_nav_menu_item_style.css.ts", - "cr_elements/cr_page_host_style.css.ts", - "cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector_grid.html.ts", - "cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector_grid.ts", - "cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.html.ts", - "cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.ts", - "cr_elements/cr_search_field/cr_search_field_mixin.ts", - "cr_elements/cr_search_field/cr_search_field.html.ts", - "cr_elements/cr_search_field/cr_search_field.ts", - "cr_elements/cr_slider/cr_slider.html.ts", - "cr_elements/cr_slider/cr_slider.ts", - "cr_elements/cr_tabs/cr_tabs.html.ts", - "cr_elements/cr_tabs/cr_tabs.ts", - "cr_elements/cr_toast/cr_toast_manager.html.ts", - "cr_elements/cr_toast/cr_toast_manager.ts", - "cr_elements/cr_toast/cr_toast.html.ts", - "cr_elements/cr_toast/cr_toast.ts", - "cr_elements/cr_toolbar/cr_toolbar_search_field.html.ts", - "cr_elements/cr_toolbar/cr_toolbar_search_field.ts", - "cr_elements/cr_toolbar/cr_toolbar_selection_overlay.html.ts", - "cr_elements/cr_toolbar/cr_toolbar_selection_overlay.ts", - "cr_elements/cr_toolbar/cr_toolbar.html.ts", - "cr_elements/cr_toolbar/cr_toolbar.ts", - "cr_elements/cr_view_manager/cr_view_manager.html.ts", - "cr_elements/cr_view_manager/cr_view_manager.ts", - "cr_elements/find_shortcut_mixin.ts", - "cr_elements/mouse_hoverable_mixin.ts", - "cr_elements/mwb_element_shared_style.css.ts", - "cr_elements/mwb_shared_icons.html.ts", - "cr_elements/mwb_shared_style.css.ts", - "cr_elements/mwb_shared_vars.css.ts", - "cr_elements/search_highlight_style.css.ts", + "cr_components/managed_footnote/managed_footnote.html.ts", + "cr_components/managed_footnote/managed_footnote.ts", "js/i18n_mixin.ts", "js/list_property_update_mixin.ts", "js/web_ui_listener_mixin.ts", ] - - if (is_chromeos) { - # cr-searchable-drop-down is only used in smb and cups dialogs, both of - # which are chromeos only. - in_files += [ - "cr_elements/cr_searchable_drop_down/cr_searchable_drop_down.html.ts", - "cr_elements/cr_searchable_drop_down/cr_searchable_drop_down.ts", - ] - } } definitions = [
diff --git a/ui/webui/resources/cr_elements/BUILD.gn b/ui/webui/resources/cr_elements/BUILD.gn index cb8f7cb..7c9330c 100644 --- a/ui/webui/resources/cr_elements/BUILD.gn +++ b/ui/webui/resources/cr_elements/BUILD.gn
@@ -11,6 +11,7 @@ import("//ui/webui/resources/include_polymer.gni") import("//ui/webui/resources/tools/generate_grd.gni") import("//ui/webui/resources/tools/js_modulizer.gni") +import("./cr_elements.gni") preprocess_folder = "$root_gen_dir/ui/webui/resources/preprocessed/cr_elements" if (include_polymer) { @@ -81,42 +82,9 @@ preprocess_if_expr("preprocess_src_ts") { in_folder = "." out_folder = preprocess_folder - in_files = [ - "cr_splitter/cr_splitter.ts", - "cr_tab_box/cr_tab_box.ts", - "cr_tree/cr_tree_base.ts", - "cr_tree/cr_tree_item.ts", - "cr_tree/cr_tree.ts", - ] + in_files = web_component_files_native_ts + non_web_component_files_ts if (include_polymer) { - in_files += [ - "cr_a11y_announcer/cr_a11y_announcer.ts", - "cr_action_menu/cr_action_menu.ts", - "cr_auto_img/cr_auto_img.ts", - "cr_container_shadow_mixin.ts", - "cr_drawer/cr_drawer.ts", - "cr_grid/cr_grid.ts", - "cr_link_row/cr_link_row.ts", - "cr_menu_selector/cr_menu_selector.ts", - "cr_profile_avatar_selector/cr_profile_avatar_selector_grid.ts", - "cr_profile_avatar_selector/cr_profile_avatar_selector.ts", - "cr_search_field/cr_search_field_mixin.ts", - "cr_search_field/cr_search_field.ts", - "cr_slider/cr_slider.ts", - "cr_tabs/cr_tabs.ts", - "cr_toast/cr_toast_manager.ts", - "cr_toast/cr_toast.ts", - "cr_toolbar/cr_toolbar_search_field.ts", - "cr_toolbar/cr_toolbar_selection_overlay.ts", - "cr_toolbar/cr_toolbar.ts", - "cr_view_manager/cr_view_manager.ts", - "find_shortcut_mixin.ts", - "mouse_hoverable_mixin.ts", - ] - - if (is_chromeos) { - in_files += [ "cr_searchable_drop_down/cr_searchable_drop_down.ts" ] - } + in_files += web_component_files_polymer_ts } } @@ -241,45 +209,13 @@ deps = [ ":html_wrapper_files_native" ] in_folder = target_gen_dir out_folder = preprocess_folder - in_files = [ - "cr_tab_box/cr_tab_box.html.ts", - "cr_tree/cr_tree.html.ts", - "cr_tree/cr_tree_item.html.ts", - ] + in_files = native_html_wrapper_files if (include_polymer) { deps += [ ":css_wrapper_files", ":html_wrapper_files", ] - in_files += [ - "cr_a11y_announcer/cr_a11y_announcer.html.ts", - "cr_action_menu/cr_action_menu.html.ts", - "cr_drawer/cr_drawer.html.ts", - "cr_grid/cr_grid.html.ts", - "cr_link_row/cr_link_row.html.ts", - "cr_nav_menu_item_style.css.ts", - "cr_page_host_style.css.ts", - "cr_profile_avatar_selector/cr_profile_avatar_selector_grid.html.ts", - "cr_profile_avatar_selector/cr_profile_avatar_selector.html.ts", - "cr_search_field/cr_search_field.html.ts", - "cr_slider/cr_slider.html.ts", - "cr_tabs/cr_tabs.html.ts", - "cr_toast/cr_toast.html.ts", - "cr_toast/cr_toast_manager.html.ts", - "cr_toolbar/cr_toolbar.html.ts", - "cr_toolbar/cr_toolbar_search_field.html.ts", - "cr_toolbar/cr_toolbar_selection_overlay.html.ts", - "cr_view_manager/cr_view_manager.html.ts", - "mwb_element_shared_style.css.ts", - "mwb_shared_icons.html.ts", - "mwb_shared_style.css.ts", - "mwb_shared_vars.css.ts", - "search_highlight_style.css.ts", - ] - - if (is_chromeos) { - in_files += [ "cr_searchable_drop_down/cr_searchable_drop_down.html.ts" ] - } + in_files += polymer_html_wrapper_files + css_wrapper_files } } @@ -473,49 +409,16 @@ } html_to_wrapper("html_wrapper_files_native") { - in_files = [ - "cr_tab_box/cr_tab_box.html", - "cr_tree/cr_tree.html", - "cr_tree/cr_tree_item.html", - ] + in_files = native_html_files template = "native" } if (include_polymer) { html_to_wrapper("html_wrapper_files") { - in_files = [ - "cr_a11y_announcer/cr_a11y_announcer.html", - "cr_action_menu/cr_action_menu.html", - "cr_drawer/cr_drawer.html", - "cr_grid/cr_grid.html", - "cr_link_row/cr_link_row.html", - "cr_profile_avatar_selector/cr_profile_avatar_selector_grid.html", - "cr_profile_avatar_selector/cr_profile_avatar_selector.html", - "cr_search_field/cr_search_field.html", - "cr_slider/cr_slider.html", - "cr_tabs/cr_tabs.html", - "cr_toast/cr_toast.html", - "cr_toast/cr_toast_manager.html", - "cr_toolbar/cr_toolbar.html", - "cr_toolbar/cr_toolbar_search_field.html", - "cr_toolbar/cr_toolbar_selection_overlay.html", - "cr_view_manager/cr_view_manager.html", - "mwb_shared_icons.html", - ] - - if (is_chromeos) { - in_files += [ "cr_searchable_drop_down/cr_searchable_drop_down.html" ] - } + in_files = polymer_html_files + icons_html_files } css_to_wrapper("css_wrapper_files") { - in_files = [ - "cr_nav_menu_item_style.css", - "mwb_element_shared_style.css", - "mwb_shared_style.css", - "mwb_shared_vars.css", - "search_highlight_style.css", - "cr_page_host_style.css", - ] + in_files = css_files } }
diff --git a/ui/webui/resources/cr_elements/cr_elements.gni b/ui/webui/resources/cr_elements/cr_elements.gni new file mode 100644 index 0000000..87034e4 --- /dev/null +++ b/ui/webui/resources/cr_elements/cr_elements.gni
@@ -0,0 +1,120 @@ +# 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("//ui/webui/resources/include_polymer.gni") + +# TS files holding a non-Polymer element definition and have an equivalent .html +# file. +web_component_files_native_ts = [ + "cr_tab_box/cr_tab_box.ts", + "cr_tree/cr_tree.ts", + "cr_tree/cr_tree_item.ts", +] + +# Files that are passed as input to html_to_wrapper(). +native_html_files = [] +foreach(f, web_component_files_native_ts) { + native_html_files += [ string_replace(f, ".ts", ".html") ] +} + +# Files that are generated by html_to_wrapper(). +native_html_wrapper_files = [] +foreach(f, native_html_files) { + native_html_wrapper_files += [ f + ".ts" ] +} + +if (include_polymer) { + # TS files holding a Polymer element definition and have an equivalent .html + # file. + web_component_files_polymer_ts = [ + "cr_a11y_announcer/cr_a11y_announcer.ts", + "cr_action_menu/cr_action_menu.ts", + "cr_drawer/cr_drawer.ts", + "cr_grid/cr_grid.ts", + "cr_link_row/cr_link_row.ts", + "cr_profile_avatar_selector/cr_profile_avatar_selector_grid.ts", + "cr_profile_avatar_selector/cr_profile_avatar_selector.ts", + "cr_search_field/cr_search_field.ts", + "cr_slider/cr_slider.ts", + "cr_tabs/cr_tabs.ts", + "cr_toast/cr_toast_manager.ts", + "cr_toast/cr_toast.ts", + "cr_toolbar/cr_toolbar.ts", + "cr_toolbar/cr_toolbar_search_field.ts", + "cr_toolbar/cr_toolbar_selection_overlay.ts", + "cr_view_manager/cr_view_manager.ts", + ] + + if (is_chromeos) { + web_component_files_polymer_ts += [ + # cr-searchable-drop-down is only used in smb and cups dialogs, both of + # which are chromeos only. + "cr_searchable_drop_down/cr_searchable_drop_down.ts", + ] + } + + icons_html_files = [ "mwb_shared_icons.html" ] + + # Polymer HTML files that are passed as input to html_to_wrapper(). + polymer_html_files = [] + foreach(f, web_component_files_polymer_ts) { + polymer_html_files += [ string_replace(f, ".ts", ".html") ] + } + + # Files that are generated by html_to_wrapper(). + polymer_html_wrapper_files = [] + foreach(f, polymer_html_files + icons_html_files) { + polymer_html_wrapper_files += [ f + ".ts" ] + } +} + +# Files that either dont hold a custom element definition or the custom element +# does not have an equivalent .html file. +non_web_component_files_ts = [ + "cr_splitter/cr_splitter.ts", + "cr_tree/cr_tree_base.ts", +] + +if (include_polymer) { + non_web_component_files_ts += [ + "cr_auto_img/cr_auto_img.ts", + "cr_container_shadow_mixin.ts", + "cr_menu_selector/cr_menu_selector.ts", + "cr_search_field/cr_search_field_mixin.ts", + "find_shortcut_mixin.ts", + "mouse_hoverable_mixin.ts", + ] + + # Files that are passed as input to css_to_wrapper(). + css_files = [ + "cr_nav_menu_item_style.css", + "cr_page_host_style.css", + "mwb_element_shared_style.css", + "mwb_shared_style.css", + "mwb_shared_vars.css", + "search_highlight_style.css", + ] + + # Files that are generated by css_to_wrapper(). + css_wrapper_files = [] + foreach(f, css_files) { + css_wrapper_files += [ f + ".ts" ] + } +} + +# List of all files above with the "cr_elements/" prefix to be used in a parent BUILD.gn file. +cr_elements_files = [] +foreach(f, + web_component_files_native_ts + native_html_wrapper_files + + non_web_component_files_ts) { + cr_elements_files += [ "cr_elements/" + f ] +} + +if (include_polymer) { + foreach(f, + web_component_files_polymer_ts + polymer_html_wrapper_files + + css_wrapper_files) { + cr_elements_files += [ "cr_elements/" + f ] + } +}
diff --git a/weblayer/browser/ad_tagging_browsertest.cc b/weblayer/browser/ad_tagging_browsertest.cc index 3994d265..2e4cbc84 100644 --- a/weblayer/browser/ad_tagging_browsertest.cc +++ b/weblayer/browser/ad_tagging_browsertest.cc
@@ -55,8 +55,8 @@ subresource_filter::CreateSrcFrame(web_contents(), ad_url); // Verify that we are not evaluating subframe loads. - EXPECT_FALSE(observer.GetSubframeLoadPolicy(ad_url).has_value()); - EXPECT_FALSE(observer.GetIsAdSubframe(ad_frame->GetFrameTreeNodeId())); + EXPECT_FALSE(observer.GetChildFrameLoadPolicy(ad_url).has_value()); + EXPECT_FALSE(observer.GetIsAdFrame(ad_frame->GetFrameTreeNodeId())); // Child frame created by ad script. content::RenderFrameHost* ad_frame_tagged_by_script = @@ -64,8 +64,8 @@ web_contents(), GetURL("frame_factory.html?1")); // No frames should be detected by script heuristics. - EXPECT_FALSE(observer.GetIsAdSubframe( - ad_frame_tagged_by_script->GetFrameTreeNodeId())); + EXPECT_FALSE( + observer.GetIsAdFrame(ad_frame_tagged_by_script->GetFrameTreeNodeId())); } // TODO(crbug.com/1210190): This test is flaky. @@ -85,8 +85,8 @@ subresource_filter::CreateSrcFrame(web_contents(), ad_url); // Verify that we are evaluating subframe loads. - EXPECT_TRUE(observer.GetSubframeLoadPolicy(ad_url).has_value()); - EXPECT_TRUE(observer.GetIsAdSubframe(ad_frame->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetChildFrameLoadPolicy(ad_url).has_value()); + EXPECT_TRUE(observer.GetIsAdFrame(ad_frame->GetFrameTreeNodeId())); // Child frame created by ad script. content::RenderFrameHost* ad_frame_tagged_by_script = @@ -94,8 +94,8 @@ web_contents(), GetURL("frame_factory.html?1")); // Frames should be detected by script heuristics. - EXPECT_TRUE(observer.GetIsAdSubframe( - ad_frame_tagged_by_script->GetFrameTreeNodeId())); + EXPECT_TRUE( + observer.GetIsAdFrame(ad_frame_tagged_by_script->GetFrameTreeNodeId())); } // TODO(crbug.com/1210190): This test is flaky. @@ -104,18 +104,18 @@ // Main frame. NavigateAndWaitForCompletion(GetURL("frame_factory.html"), shell()); - EXPECT_FALSE(observer.GetIsAdSubframe( + EXPECT_FALSE(observer.GetIsAdFrame( web_contents()->GetPrimaryMainFrame()->GetFrameTreeNodeId())); // (1) Vanilla child. content::RenderFrameHost* vanilla_child = subresource_filter::CreateSrcFrame( web_contents(), GetURL("frame_factory.html?1")); - EXPECT_FALSE(observer.GetIsAdSubframe(vanilla_child->GetFrameTreeNodeId())); + EXPECT_FALSE(observer.GetIsAdFrame(vanilla_child->GetFrameTreeNodeId())); // (2) Ad child. content::RenderFrameHost* ad_child = subresource_filter::CreateSrcFrame( web_contents(), GetURL("frame_factory.html?2&ad=true")); - EXPECT_TRUE(observer.GetIsAdSubframe(ad_child->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(ad_child->GetFrameTreeNodeId())); EXPECT_TRUE(subresource_filter::EvidenceForFrameComprises( ad_child, /*parent_is_ad=*/false, blink::mojom::FilterListResult::kMatchedBlockingRule, @@ -124,7 +124,7 @@ // (3) Ad child of 2. content::RenderFrameHost* ad_child_2 = subresource_filter::CreateSrcFrame( ad_child, GetURL("frame_factory.html?sub=1&3&ad=true")); - EXPECT_TRUE(observer.GetIsAdSubframe(ad_child_2->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(ad_child_2->GetFrameTreeNodeId())); EXPECT_TRUE(subresource_filter::EvidenceForFrameComprises( ad_child_2, /*parent_is_ad=*/true, blink::mojom::FilterListResult::kMatchedBlockingRule, @@ -134,7 +134,7 @@ content::RenderFrameHost* vanilla_child_2 = subresource_filter::CreateSrcFrame(ad_child, GetURL("frame_factory.html?4")); - EXPECT_TRUE(observer.GetIsAdSubframe(vanilla_child_2->GetFrameTreeNodeId())); + EXPECT_TRUE(observer.GetIsAdFrame(vanilla_child_2->GetFrameTreeNodeId())); EXPECT_TRUE(subresource_filter::EvidenceForFrameComprises( vanilla_child_2, /*parent_is_ad=*/true, blink::mojom::FilterListResult::kMatchedNoRules, @@ -148,7 +148,7 @@ content::RenderFrameHost* vanilla_child_3 = subresource_filter::CreateSrcFrame(vanilla_child, GetURL("frame_factory.html?5")); - EXPECT_FALSE(observer.GetIsAdSubframe(vanilla_child_3->GetFrameTreeNodeId())); + EXPECT_FALSE(observer.GetIsAdFrame(vanilla_child_3->GetFrameTreeNodeId())); } } // namespace weblayer