diff --git a/.gn b/.gn index 3ad0100c..c894baf 100644 --- a/.gn +++ b/.gn
@@ -63,8 +63,30 @@ # their includes checked for proper dependencies when you run either # "gn check" or "gn gen --check". no_check_targets = [ - # //chrome/*, https://crbug.com/949535 - "//chrome/test:*", # 2682 errors + "//chrome/test:android_browsertests__library", + "//chrome/test:android_sync_integration_tests__library", + "//chrome/test:accessibility_live_site_tests", + "//chrome/test:browser_tests", + "//chrome/test:browser_tests_runner", + "//chrome/test:captured_sites_interactive_tests", + "//chrome/test:chrome_app_unittests", + "//chrome/test:chrome_app_unittests__library", + "//chrome/test:credential_provider_test_utils", + "//chrome/test:interactive_ui_tests", + "//chrome/test:lacros_chrome_browsertests", + "//chrome/test:load_library_perf_tests", + "//chrome/test:pixel_browser_tests", + "//chrome/test:safe_browsing_binary_feature_extractor_fuzzer", + "//chrome/test:sync_integration_tests", + "//chrome/test:sync_integration_test_support", + "//chrome/test:sync_performance_tests", + "//chrome/test:test_support_ui", + "//chrome/test:test_support_ui_android", + "//chrome/test:test_support_unit", + "//chrome/test:unit_tests", + "//chrome/test:unit_tests__library", + "//chrome/test:usage_time_limit_unittests", + "//chrome/test:xr_browser_tests_common", "//extensions/browser/api:*", # 7 errors "//extensions/browser:*", # 20 errors "//extensions:*", # 75 errors
diff --git a/DEPS b/DEPS index 0fa6172..54090e1 100644 --- a/DEPS +++ b/DEPS
@@ -209,11 +209,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '04e643e4625743139b6c75a33048c1d6e591bdfd', + 'skia_revision': '703f68e660ab05db9a14b4a9b67f7146a39d75ca', # 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': '2f4fa28d3c7308bd059a10d1edb987201210abff', + 'v8_revision': '1f85f125ecdfee8f8e69f616a9dad385b4ecba69', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -288,7 +288,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': '353ed8bf5fdeaddd336cba0702b67d066ba3c973', + 'devtools_frontend_revision': '1484a2e537da537ecb4e53e61d85b477e465ed17', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libprotobuf-mutator # and whatever else without interference from each other. @@ -328,7 +328,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': 'd0ebcbac7a71be1d1cdf02fe71904d3d32e5a5ad', + 'dawn_revision': '09a458f94e1d514a64048cd698e8485809885230', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -395,7 +395,7 @@ 'libcxx_revision': '8fa87946779682841e21e2da977eccfb6cb3bded', # GN CIPD package version. - 'gn_version': 'git_revision:dfd036f3be5422c7b61cf16369bde28b3a8cccc8', + 'gn_version': 'git_revision:7b23bd91f996722e5e55e0ccf0c80c0a984efca5', } # Only these hosts are allowed for dependencies in this DEPS file. @@ -961,12 +961,12 @@ # For Linux and Chromium OS. 'src/third_party/cros_system_api': { - 'url': Var('chromium_git') + '/chromiumos/platform2/system_api.git' + '@' + '25122d4def51426b0fe4ebd45fe5d7d3ee8cba12', + 'url': Var('chromium_git') + '/chromiumos/platform2/system_api.git' + '@' + 'a174dc2a7a92856ad39ae3c0e2890e856151d7ab', 'condition': 'checkout_linux', }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'e77e3c879a3f795161d3efa096c9caa33c7a0c2b', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'f9be70c9e6d8c602479323c12f6bc2d1797faf4f', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), @@ -1416,7 +1416,7 @@ 'packages': [ { 'package': 'fuchsia/third_party/aemu/linux-amd64', - 'version': 'IFKk3HKRVi_NvWa_9abMZahaAGY7hGQ0MzuloLf6TkgC' + 'version': 'UJM-8JuP3RR55BXmMADjW1ym0ak_RyS4QYOpqVcZp9gC' }, ], 'condition': 'host_os == "linux" and checkout_fuchsia', @@ -1525,7 +1525,7 @@ 'src/third_party/usrsctp/usrsctplib': Var('chromium_git') + '/external/github.com/sctplab/usrsctp' + '@' + '0bd8b8110bc1a388649e504de1e673114e91013f', - 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@42d8716d02941f47870776a9c273de1effc51b1a', + 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@69094b7855b5b314f6af08c10bea65934f3385d0', 'src/third_party/vulkan_memory_allocator': Var('chromium_git') + '/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git' + '@' + '732a76d9d3c70d6aa487216495eeb28518349c3a', @@ -1579,7 +1579,7 @@ 'packages': [ { 'package': 'skia/tools/goldctl/linux-amd64', - 'version': 'qFSgTPN6Qn1vdxIOe4gDnS7rsfvJpQ63e0fEOHdwwK8C', + 'version': 'UV02xIZDvNaCcrummY2Hd5zNO4S7F3pl_ZatqFmeRboC', }, ], 'dep_type': 'cipd', @@ -1589,7 +1589,7 @@ 'packages': [ { 'package': 'skia/tools/goldctl/windows-amd64', - 'version': 'kT3OqAqb0i8bSfls2rf77GfIiw0YSfqm97knAwMxkCcC', + 'version': 'OB_O_MOYSLYScAVrzlIsc9a0JIf54AiYzG1WNNSCtyIC', }, ], 'dep_type': 'cipd', @@ -1613,7 +1613,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@6781c008693620ac6c19a0328f84da9dbdd42de9', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@92d7f56527ca9051316c46c35f2654ce0d668482', 'condition': 'checkout_src_internal', },
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index d7c50e9..a3d7ce8c 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -2616,6 +2616,7 @@ ":*", "//ash/app_list:*", "//ash/shortcut_viewer:*", + "//chrome/test:test_support", "//components/exo:*", "//components/exo/wayland:*", "//ash/public/cpp/external_arc:*",
diff --git a/ash/accessibility/chromevox/touch_accessibility_enabler.h b/ash/accessibility/chromevox/touch_accessibility_enabler.h index 3a64399..7e0b814 100644 --- a/ash/accessibility/chromevox/touch_accessibility_enabler.h +++ b/ash/accessibility/chromevox/touch_accessibility_enabler.h
@@ -10,7 +10,6 @@ #include "base/memory/weak_ptr.h" #include "base/time/tick_clock.h" #include "base/timer/timer.h" -#include "base/values.h" #include "ui/events/event.h" #include "ui/events/event_handler.h" #include "ui/events/gesture_detection/gesture_detector.h"
diff --git a/ash/accessibility/chromevox/touch_exploration_controller.h b/ash/accessibility/chromevox/touch_exploration_controller.h index fbe43434..6fbd4e4 100644 --- a/ash/accessibility/chromevox/touch_exploration_controller.h +++ b/ash/accessibility/chromevox/touch_exploration_controller.h
@@ -13,7 +13,6 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" -#include "base/values.h" #include "ui/accessibility/ax_enums.mojom-forward.h" #include "ui/events/event.h" #include "ui/events/event_rewriter.h"
diff --git a/ash/app_list/BUILD.gn b/ash/app_list/BUILD.gn index 2281567..bcb10c6 100644 --- a/ash/app_list/BUILD.gn +++ b/ash/app_list/BUILD.gn
@@ -27,6 +27,8 @@ "bubble/app_list_bubble.h", "bubble/app_list_bubble_view.cc", "bubble/app_list_bubble_view.h", + "bubble/bubble_event_filter.cc", + "bubble/bubble_event_filter.h", "home_launcher_animation_info.h", "paged_view_structure.cc", "paged_view_structure.h", @@ -211,6 +213,7 @@ "app_list_presenter_impl_unittest.cc", "app_list_unittest.cc", "bubble/app_list_bubble_unittest.cc", + "bubble/bubble_event_filter_unittest.cc", "folder_image_unittest.cc", "model/app_list_item_list_unittest.cc", "model/app_list_model_unittest.cc",
diff --git a/ash/app_list/bubble/app_list_bubble.cc b/ash/app_list/bubble/app_list_bubble.cc index 49b7fa0a..390e851 100644 --- a/ash/app_list/bubble/app_list_bubble.cc +++ b/ash/app_list/bubble/app_list_bubble.cc
@@ -7,7 +7,13 @@ #include <memory> #include "ash/app_list/bubble/app_list_bubble_view.h" +#include "ash/app_list/bubble/bubble_event_filter.h" +#include "ash/shelf/home_button.h" +#include "ash/shelf/shelf.h" +#include "ash/shelf/shelf_navigation_widget.h" +#include "ash/shell.h" #include "base/logging.h" +#include "ui/views/view.h" #include "ui/views/widget/widget.h" namespace ash { @@ -20,11 +26,22 @@ DVLOG(1) << __PRETTY_FUNCTION__; if (bubble_widget_) return; + + aura::Window* root_window = Shell::GetRootWindowForDisplayId(display_id); bubble_widget_ = base::WrapUnique(views::BubbleDialogDelegateView::CreateBubble( - std::make_unique<AppListBubbleView>())); + std::make_unique<AppListBubbleView>(root_window))); bubble_widget_->Show(); // TODO(https://crbug.com/1205494): Focus search box. + + // Set up event filter to close the bubble for clicks outside the bubble that + // don't cause window activation changes (e.g. clicks on wallpaper or blank + // areas of shelf). + Shelf* shelf = Shelf::ForWindow(root_window); + HomeButton* home_button = shelf->navigation_widget()->GetHomeButton(); + bubble_event_filter_ = std::make_unique<BubbleEventFilter>( + bubble_widget_.get(), home_button, + base::BindRepeating(&AppListBubble::Dismiss, base::Unretained(this))); } void AppListBubble::Toggle(int64_t display_id) { @@ -38,6 +55,7 @@ void AppListBubble::Dismiss() { DVLOG(1) << __PRETTY_FUNCTION__; + bubble_event_filter_.reset(); bubble_widget_.reset(); // Triggers asynchronous close. }
diff --git a/ash/app_list/bubble/app_list_bubble.h b/ash/app_list/bubble/app_list_bubble.h index 933a8375..702968d1 100644 --- a/ash/app_list/bubble/app_list_bubble.h +++ b/ash/app_list/bubble/app_list_bubble.h
@@ -7,11 +7,15 @@ #include <stdint.h> +#include <memory> + #include "ash/ash_export.h" #include "ui/views/widget/unique_widget_ptr.h" namespace ash { +class BubbleEventFilter; + // Manages the UI for the bubble launcher used in clamshell mode. Handles // showing and hiding the UI. Only one bubble can be visible at a time, across // all displays. @@ -36,6 +40,9 @@ private: views::UniqueWidgetPtr bubble_widget_; + + // Closes the widget when the user clicks outside of it. + std::unique_ptr<BubbleEventFilter> bubble_event_filter_; }; } // namespace ash
diff --git a/ash/app_list/bubble/app_list_bubble_unittest.cc b/ash/app_list/bubble/app_list_bubble_unittest.cc index 65c4bd3..fa7a4026 100644 --- a/ash/app_list/bubble/app_list_bubble_unittest.cc +++ b/ash/app_list/bubble/app_list_bubble_unittest.cc
@@ -6,15 +6,21 @@ #include <set> +#include "ash/app_list/app_list_controller_impl.h" +#include "ash/constants/ash_features.h" #include "ash/public/cpp/shell_window_ids.h" +#include "ash/shelf/home_button.h" +#include "ash/shelf/shelf.h" +#include "ash/shelf/shelf_navigation_widget.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" -#include "base/run_loop.h" +#include "base/test/scoped_feature_list.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/display/display.h" #include "ui/views/test/widget_test.h" #include "ui/views/widget/widget.h" +using views::Widget; using views::test::WidgetDestroyedWaiter; namespace ash { @@ -30,68 +36,83 @@ return widgets.size(); } -using AppListBubbleTest = AshTestBase; +class AppListBubbleTest : public AshTestBase { + public: + AppListBubbleTest() { + scoped_features_.InitAndEnableFeature(features::kAppListBubble); + } + ~AppListBubbleTest() override = default; + + // Returns the AppListBubble instance. Use this instead of creating a new + // AppListBubble instance in each test to avoid situations where two bubbles + // exist at the same time (the per-test one and the "production" one). + AppListBubble* GetAppListBubble() { + return Shell::Get()->app_list_controller()->app_list_bubble_for_test(); + } + + base::test::ScopedFeatureList scoped_features_; +}; TEST_F(AppListBubbleTest, ShowOpensOneWidgetInAppListContainer) { - AppListBubble bubble; - bubble.Show(GetPrimaryDisplay().id()); + AppListBubble* bubble = GetAppListBubble(); + bubble->Show(GetPrimaryDisplay().id()); EXPECT_EQ(1u, NumberOfWidgetsInAppListContainer()); } TEST_F(AppListBubbleTest, DismissClosesWidget) { - AppListBubble bubble; - bubble.Show(GetPrimaryDisplay().id()); + AppListBubble* bubble = GetAppListBubble(); + bubble->Show(GetPrimaryDisplay().id()); - WidgetDestroyedWaiter waiter(bubble.bubble_widget_for_test()); - bubble.Dismiss(); + WidgetDestroyedWaiter waiter(bubble->bubble_widget_for_test()); + bubble->Dismiss(); waiter.Wait(); EXPECT_EQ(0u, NumberOfWidgetsInAppListContainer()); } TEST_F(AppListBubbleTest, ToggleOpensOneWidgetInAppListContainer) { - AppListBubble bubble; - bubble.Toggle(GetPrimaryDisplay().id()); + AppListBubble* bubble = GetAppListBubble(); + bubble->Toggle(GetPrimaryDisplay().id()); EXPECT_EQ(1u, NumberOfWidgetsInAppListContainer()); } TEST_F(AppListBubbleTest, ToggleClosesWidgetInAppListContainer) { - AppListBubble bubble; - bubble.Toggle(GetPrimaryDisplay().id()); + AppListBubble* bubble = GetAppListBubble(); + bubble->Toggle(GetPrimaryDisplay().id()); - WidgetDestroyedWaiter waiter(bubble.bubble_widget_for_test()); - bubble.Toggle(GetPrimaryDisplay().id()); + WidgetDestroyedWaiter waiter(bubble->bubble_widget_for_test()); + bubble->Toggle(GetPrimaryDisplay().id()); waiter.Wait(); EXPECT_EQ(0u, NumberOfWidgetsInAppListContainer()); } TEST_F(AppListBubbleTest, BubbleIsNotShowingByDefault) { - AppListBubble bubble; + AppListBubble* bubble = GetAppListBubble(); - EXPECT_FALSE(bubble.IsShowing()); + EXPECT_FALSE(bubble->IsShowing()); } TEST_F(AppListBubbleTest, BubbleIsShowingAfterShow) { - AppListBubble bubble; - bubble.Show(GetPrimaryDisplay().id()); + AppListBubble* bubble = GetAppListBubble(); + bubble->Show(GetPrimaryDisplay().id()); - EXPECT_TRUE(bubble.IsShowing()); + EXPECT_TRUE(bubble->IsShowing()); } TEST_F(AppListBubbleTest, BubbleIsNotShowingAfterDismiss) { - AppListBubble bubble; - bubble.Show(GetPrimaryDisplay().id()); - bubble.Dismiss(); + AppListBubble* bubble = GetAppListBubble(); + bubble->Show(GetPrimaryDisplay().id()); + bubble->Dismiss(); - EXPECT_FALSE(bubble.IsShowing()); + EXPECT_FALSE(bubble->IsShowing()); } TEST_F(AppListBubbleTest, DoesNotCrashWhenNativeWidgetDestroyed) { - AppListBubble bubble; - bubble.Show(GetPrimaryDisplay().id()); + AppListBubble* bubble = GetAppListBubble(); + bubble->Show(GetPrimaryDisplay().id()); aura::Window* container = Shell::GetContainer( Shell::GetPrimaryRootWindow(), kShellWindowId_AppListContainer); @@ -102,5 +123,35 @@ // No crash. } +TEST_F(AppListBubbleTest, ClickInTopLeftOfScreenClosesBubble) { + AppListBubble* bubble = GetAppListBubble(); + bubble->Show(GetPrimaryDisplay().id()); + + Widget* widget = bubble->bubble_widget_for_test(); + WidgetDestroyedWaiter waiter(widget); + ASSERT_FALSE(widget->GetWindowBoundsInScreen().Contains(0, 0)); + GetEventGenerator()->MoveMouseTo(0, 0); + GetEventGenerator()->ClickLeftButton(); + waiter.Wait(); + + EXPECT_EQ(0u, NumberOfWidgetsInAppListContainer()); +} + +// Verifies that the launcher does not reopen when it's closed by a click on the +// home button. +TEST_F(AppListBubbleTest, ClickOnHomeButtonClosesBubble) { + AppListBubble* bubble = GetAppListBubble(); + bubble->Show(GetPrimaryDisplay().id()); + + // Click the home button. + WidgetDestroyedWaiter waiter(bubble->bubble_widget_for_test()); + HomeButton* button = GetPrimaryShelf()->navigation_widget()->GetHomeButton(); + GetEventGenerator()->MoveMouseTo(button->GetBoundsInScreen().CenterPoint()); + GetEventGenerator()->ClickLeftButton(); + waiter.Wait(); + + EXPECT_EQ(0u, NumberOfWidgetsInAppListContainer()); +} + } // namespace } // namespace ash
diff --git a/ash/app_list/bubble/app_list_bubble_view.cc b/ash/app_list/bubble/app_list_bubble_view.cc index 1baa5fb..0a4ae9f5 100644 --- a/ash/app_list/bubble/app_list_bubble_view.cc +++ b/ash/app_list/bubble/app_list_bubble_view.cc
@@ -13,22 +13,20 @@ #include "ui/gfx/geometry/rect.h" #include "ui/views/bubble/bubble_border.h" #include "ui/views/controls/label.h" +#include "ui/views/controls/textfield/textfield.h" #include "ui/views/layout/box_layout.h" using views::BoxLayout; namespace ash { -AppListBubbleView::AppListBubbleView() - : views::BubbleDialogDelegateView(/*anchor_view=*/nullptr, - views::BubbleBorder::BOTTOM_LEFT) { +AppListBubbleView::AppListBubbleView(aura::Window* root_window) { + DCHECK(root_window); // TODO(https://crbug.com/1204554): Support BubbleBorder::TOP_LEFT and // TOP_RIGHT for side-aligned shelf. + SetArrow(views::BubbleBorder::BOTTOM_LEFT); SetButtons(ui::DIALOG_BUTTON_NONE); - - // TODO(https://crbug.com/1204554): Multi-display support. - aura::Window* root_window = Shell::GetPrimaryRootWindow(); set_parent_window( Shell::GetContainer(root_window, kShellWindowId_AppListContainer)); @@ -41,6 +39,8 @@ // TODO(https://crbug.com/1204551): Create real contents. AddChildView(std::make_unique<views::Label>(u"Placeholder")); + auto* textfield = AddChildView(std::make_unique<views::Textfield>()); + SetInitiallyFocusedView(textfield); } AppListBubbleView::~AppListBubbleView() = default;
diff --git a/ash/app_list/bubble/app_list_bubble_view.h b/ash/app_list/bubble/app_list_bubble_view.h index 250d46099..2369801 100644 --- a/ash/app_list/bubble/app_list_bubble_view.h +++ b/ash/app_list/bubble/app_list_bubble_view.h
@@ -8,12 +8,17 @@ #include "ash/ash_export.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h" +namespace aura { +class Window; +} // namespace aura + namespace ash { // Contains the views for the bubble version of the launcher. class ASH_EXPORT AppListBubbleView : public views::BubbleDialogDelegateView { public: - AppListBubbleView(); + // Creates the bubble on the display for `root_window`. + explicit AppListBubbleView(aura::Window* root_window); AppListBubbleView(const AppListBubbleView&) = delete; AppListBubbleView& operator=(const AppListBubbleView&) = delete; ~AppListBubbleView() override;
diff --git a/ash/app_list/bubble/bubble_event_filter.cc b/ash/app_list/bubble/bubble_event_filter.cc new file mode 100644 index 0000000..9636fd0 --- /dev/null +++ b/ash/app_list/bubble/bubble_event_filter.cc
@@ -0,0 +1,62 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/app_list/bubble/bubble_event_filter.h" + +#include "ash/shell.h" +#include "base/callback.h" +#include "base/check.h" +#include "ui/events/event.h" +#include "ui/gfx/geometry/point.h" +#include "ui/gfx/geometry/rect.h" +#include "ui/views/widget/widget.h" + +namespace ash { + +BubbleEventFilter::BubbleEventFilter( + views::Widget* widget, + views::View* button, + base::RepeatingCallback<void()> on_click_outside) + : widget_(widget), button_(button), on_click_outside_(on_click_outside) { + DCHECK(widget_); + DCHECK(button_); + DCHECK(on_click_outside_); + Shell::Get()->AddPreTargetHandler(this); +} + +BubbleEventFilter::~BubbleEventFilter() { + Shell::Get()->RemovePreTargetHandler(this); +} + +void BubbleEventFilter::OnMouseEvent(ui::MouseEvent* event) { + if (event->type() == ui::ET_MOUSE_PRESSED) + ProcessPressedEvent(*event); +} + +void BubbleEventFilter::OnTouchEvent(ui::TouchEvent* event) { + if (event->type() == ui::ET_TOUCH_PRESSED) + ProcessPressedEvent(*event); +} + +void BubbleEventFilter::ProcessPressedEvent(const ui::LocatedEvent& event) { + // TODO(https://crbug.com/1204554): Exclude events during capture mode. + // TODO(https://crbug.com/1204554): Exclude accessibility autoclick bubble. + // TODO(https://crbug.com/1204554): Exclude events that shouldn't close the + // bubble, like tap-typing on virtual keyboard. + + gfx::Point event_location = event.target() + ? event.target()->GetScreenLocation(event) + : event.root_location(); + // Ignore clicks inside the widget. + if (widget_->GetWindowBoundsInScreen().Contains(event_location)) + return; + + // Ignore clicks inside the button (which usually spawned the widget). + if (button_->GetBoundsInScreen().Contains(event_location)) + return; + + on_click_outside_.Run(); +} + +} // namespace ash
diff --git a/ash/app_list/bubble/bubble_event_filter.h b/ash/app_list/bubble/bubble_event_filter.h new file mode 100644 index 0000000..28646ed --- /dev/null +++ b/ash/app_list/bubble/bubble_event_filter.h
@@ -0,0 +1,54 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_APP_LIST_BUBBLE_BUBBLE_EVENT_FILTER_H_ +#define ASH_APP_LIST_BUBBLE_BUBBLE_EVENT_FILTER_H_ + +#include "ash/ash_export.h" +#include "base/callback.h" +#include "ui/events/event_handler.h" + +namespace ui { +class LocatedEvent; +} // namespace ui + +namespace views { +class View; +class Widget; +} // namespace views + +namespace ash { + +// Observes mouse and touch events. Invokes a callback when a press event +// happens outside the bubble widget's bounds and also outside the button that +// spawned the bubble. Tests the button bounds because otherwise a click on the +// button will result in the bubble being closed then immediately reopened. +// Similar to TrayEventFilter, but only deals with a single widget, and is not +// coupled to system tray details. +class ASH_EXPORT BubbleEventFilter : public ui::EventHandler { + public: + // See class comment. Runs `on_click_outside` when a click or tap occurs + // outside the bounds of `widget` and `button`. + BubbleEventFilter(views::Widget* widget, + views::View* button, + base::RepeatingClosure on_click_outside); + BubbleEventFilter(const BubbleEventFilter&) = delete; + BubbleEventFilter& operator=(const BubbleEventFilter&) = delete; + ~BubbleEventFilter() override; + + // ui::EventHandler: + void OnMouseEvent(ui::MouseEvent* event) override; + void OnTouchEvent(ui::TouchEvent* event) override; + + private: + void ProcessPressedEvent(const ui::LocatedEvent& event); + + views::Widget* const widget_; + views::View* const button_; + base::RepeatingClosure on_click_outside_; +}; + +} // namespace ash + +#endif // ASH_APP_LIST_BUBBLE_BUBBLE_EVENT_FILTER_H_
diff --git a/ash/app_list/bubble/bubble_event_filter_unittest.cc b/ash/app_list/bubble/bubble_event_filter_unittest.cc new file mode 100644 index 0000000..94b4cc5 --- /dev/null +++ b/ash/app_list/bubble/bubble_event_filter_unittest.cc
@@ -0,0 +1,99 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/app_list/bubble/bubble_event_filter.h" + +#include <memory> + +#include "ash/test/ash_test_base.h" +#include "ash/test/test_widget_builder.h" +#include "base/run_loop.h" +#include "base/test/bind.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace ash { +namespace { + +// Parameterized by mouse events vs. touch events. +class BubbleEventFilterTest : public AshTestBase, + public testing::WithParamInterface<bool> { + public: + BubbleEventFilterTest() = default; + BubbleEventFilterTest(const BubbleEventFilterTest&) = delete; + BubbleEventFilterTest& operator=(const BubbleEventFilterTest&) = delete; + ~BubbleEventFilterTest() override = default; + + // testing::Test: + void SetUp() override { + AshTestBase::SetUp(); + widget_ = TestWidgetBuilder() + .SetBounds({10, 10, 100, 100}) + .SetShow(true) + .BuildOwnsNativeWidget(); + // Create a separate Widget to host the View. A View must live in a Widget + // to have valid screen coordinates. + view_holder_widget_ = TestWidgetBuilder() + .SetBounds({500, 500, 100, 100}) + .SetShow(true) + .BuildOwnsNativeWidget(); + view_ = view_holder_widget_->client_view()->AddChildView( + std::make_unique<views::View>()); + view_->SetBoundsRect({0, 0, 32, 32}); + } + + // Generates a click or a tap based on test parameterization. + void ClickOrTapAt(gfx::Point point_in_screen) { + auto* generator = GetEventGenerator(); + if (GetParam()) { + generator->MoveMouseTo(point_in_screen); + generator->ClickLeftButton(); + } else { + generator->GestureTapAt(point_in_screen); + } + } + + std::unique_ptr<views::Widget> widget_; + std::unique_ptr<views::Widget> view_holder_widget_; + views::View* view_ = nullptr; +}; + +INSTANTIATE_TEST_SUITE_P(MouseOrTouch, BubbleEventFilterTest, testing::Bool()); + +TEST_P(BubbleEventFilterTest, ClickOutsideWidgetRunsCallback) { + int callback_count = 0; + auto callback = base::BindLambdaForTesting([&]() { ++callback_count; }); + BubbleEventFilter filter(widget_.get(), view_, callback); + + // Click outside the widget. + gfx::Point point_outside_widget = widget_->GetWindowBoundsInScreen().origin(); + point_outside_widget.Offset(-1, -1); + ClickOrTapAt(point_outside_widget); + + EXPECT_EQ(callback_count, 1); +} + +TEST_P(BubbleEventFilterTest, ClickInsideWidgetDoesNotRunCallback) { + bool callback_ran = false; + auto callback = base::BindLambdaForTesting([&]() { callback_ran = true; }); + BubbleEventFilter filter(widget_.get(), view_, callback); + + // Click inside the widget. + ClickOrTapAt(widget_->GetWindowBoundsInScreen().CenterPoint()); + + EXPECT_FALSE(callback_ran); +} + +TEST_P(BubbleEventFilterTest, ClickInsideViewDoesNotRunCallback) { + bool callback_ran = false; + auto callback = base::BindLambdaForTesting([&]() { callback_ran = true; }); + BubbleEventFilter filter(widget_.get(), view_, callback); + + // Click inside the view. + ClickOrTapAt(view_->GetBoundsInScreen().CenterPoint()); + + EXPECT_FALSE(callback_ran); +} + +} // namespace +} // namespace ash
diff --git a/ash/system/network/sms_observer.cc b/ash/system/network/sms_observer.cc index acb99edf..6023f4a 100644 --- a/ash/system/network/sms_observer.cc +++ b/ash/system/network/sms_observer.cc
@@ -11,6 +11,7 @@ #include "ash/system/tray/tray_constants.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/values.h" #include "chromeos/network/network_event_log.h" #include "chromeos/network/network_handler.h" #include "ui/gfx/paint_vector_icon.h"
diff --git a/base/BUILD.gn b/base/BUILD.gn index 1f68eef3..7ff21a5 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -102,10 +102,11 @@ "Do not enable PI mutexes without consulting the security team") # Prevent using BackupRefPtr when PartitionAlloc-Everywhere isn't used. -# In theory, such a configuration is possible, but its scope would be limited +# In theory, such a configuration is possible, but its scope would be limited to # only Blink partitions, which is currently not tested. Better to trigger an # error, than have BackupRefPtr silently disabled while believing it is enabled. -if (!is_nacl) { +# TODO(1206505): Temporarily don't trigger on Linux. +if (!is_nacl && !is_linux) { assert(!use_backup_ref_ptr || use_allocator == "partition", "Can't use BackupRefPtr without PartitionAlloc-Everywhere") }
diff --git a/base/android/java/src/org/chromium/base/PathUtils.java b/base/android/java/src/org/chromium/base/PathUtils.java index 28c6e546..6c0db46 100644 --- a/base/android/java/src/org/chromium/base/PathUtils.java +++ b/base/android/java/src/org/chromium/base/PathUtils.java
@@ -201,8 +201,8 @@ /** * Returns the downloads directory. Before Android Q, this returns the public download directory * for Chrome app. On Q+, this returns the first private download directory for the app, since Q - * will block public directory access. May return null when there is no external storage volumes - * mounted. + * will block public directory access. May return empty string when there are no external + * storage volumes mounted. */ @SuppressWarnings("unused") @CalledByNative @@ -217,7 +217,7 @@ // storage for which no additional permissions are required. String[] dirs = getAllPrivateDownloadsDirectories(); assert dirs != null; - return dirs[0]; + return dirs.length == 0 ? "" : dirs[0]; } return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) .getPath();
diff --git a/base/i18n/break_iterator_unittest.cc b/base/i18n/break_iterator_unittest.cc index a2364512..f91ea69b 100644 --- a/base/i18n/break_iterator_unittest.cc +++ b/base/i18n/break_iterator_unittest.cc
@@ -95,10 +95,7 @@ } TEST(BreakIteratorTest, BreakWordWide32) { - // U+1D49C MATHEMATICAL SCRIPT CAPITAL A - const char very_wide_char[] = "\xF0\x9D\x92\x9C"; - const std::u16string str( - UTF8ToUTF16(base::StringPrintf("%s a", very_wide_char))); + const std::u16string str = u"\U0001d49c a"; const std::u16string very_wide_word(str.substr(0, 2)); BreakIterator iter(str, BreakIterator::BREAK_WORD); @@ -120,23 +117,22 @@ TEST(BreakIteratorTest, BreakWordThai) { // Terms in Thai, without spaces in between. - const char term1[] = "พิมพ์"; - const char term2[] = "น้อย"; - const char term3[] = "ลง"; - const std::u16string str( - UTF8ToUTF16(base::JoinString({term1, term2, term3}, ""))); + const char16_t term1[] = u"พิมพ์"; + const char16_t term2[] = u"น้อย"; + const char16_t term3[] = u"ลง"; + const std::u16string str(base::JoinString({term1, term2, term3}, u"")); BreakIterator iter(str, BreakIterator::BREAK_WORD); ASSERT_TRUE(iter.Init()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(term1), iter.GetString()); + EXPECT_EQ(term1, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(term2), iter.GetString()); + EXPECT_EQ(term2, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(term3), iter.GetString()); + EXPECT_EQ(term3, iter.GetString()); EXPECT_FALSE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); } @@ -149,41 +145,40 @@ TEST(BreakIteratorTest, BreakWordChinese) { // Terms in Traditional Chinese, without spaces in between. - const char term1[] = "瀏覽"; - const char term2[] = "速度"; - const char term3[] = "飛快"; - const std::u16string str( - UTF8ToUTF16(base::JoinString({term1, term2, term3}, ""))); + const char16_t term1[] = u"瀏覽"; + const char16_t term2[] = u"速度"; + const char16_t term3[] = u"飛快"; + const std::u16string str(base::JoinString({term1, term2, term3}, u"")); BreakIterator iter(str, BreakIterator::BREAK_WORD); ASSERT_TRUE(iter.Init()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(term1), iter.GetString()); + EXPECT_EQ(term1, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(term2), iter.GetString()); + EXPECT_EQ(term2, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(term3), iter.GetString()); + EXPECT_EQ(term3, iter.GetString()); EXPECT_FALSE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); } TEST(BreakIteratorTest, BreakWordJapanese) { // Terms in Japanese, without spaces in between. - const char term1[] = "モバイル"; - const char term2[] = "でも"; - const std::u16string str(UTF8ToUTF16(base::JoinString({term1, term2}, ""))); + const char16_t term1[] = u"モバイル"; + const char16_t term2[] = u"でも"; + const std::u16string str(base::JoinString({term1, term2}, u"")); BreakIterator iter(str, BreakIterator::BREAK_WORD); ASSERT_TRUE(iter.Init()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(term1), iter.GetString()); + EXPECT_EQ(term1, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(term2), iter.GetString()); + EXPECT_EQ(term2, iter.GetString()); EXPECT_FALSE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); } @@ -191,21 +186,21 @@ TEST(BreakIteratorTest, BreakWordChineseEnglish) { // Terms in Simplified Chinese mixed with English and wide punctuations. std::u16string space(u" "); - const char token1[] = "下载"; - const char token2[] = "Chrome"; - const char token3[] = "("; - const char token4[] = "Mac"; - const char token5[] = "版"; - const char token6[] = ")"; - const std::u16string str(UTF8ToUTF16(base::JoinString( - {token1, " ", token2, token3, token4, " ", token5, token6}, ""))); + const char16_t token1[] = u"下载"; + const char16_t token2[] = u"Chrome"; + const char16_t token3[] = u"("; + const char16_t token4[] = u"Mac"; + const char16_t token5[] = u"版"; + const char16_t token6[] = u")"; + const std::u16string str(base::JoinString( + {token1, u" ", token2, token3, token4, u" ", token5, token6}, u"")); BreakIterator iter(str, BreakIterator::BREAK_WORD); ASSERT_TRUE(iter.Init()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(token1), iter.GetString()); + EXPECT_EQ(token1, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); @@ -213,15 +208,15 @@ EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(token2), iter.GetString()); + EXPECT_EQ(token2, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(token3), iter.GetString()); + EXPECT_EQ(token3, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(token4), iter.GetString()); + EXPECT_EQ(token4, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); @@ -229,11 +224,11 @@ EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(token5), iter.GetString()); + EXPECT_EQ(token5, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(token6), iter.GetString()); + EXPECT_EQ(token6, iter.GetString()); EXPECT_FALSE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); @@ -323,10 +318,7 @@ } TEST(BreakIteratorTest, BreakSpaceWide32) { - // U+1D49C MATHEMATICAL SCRIPT CAPITAL A - const char very_wide_char[] = "\xF0\x9D\x92\x9C"; - const std::u16string str( - UTF8ToUTF16(base::StringPrintf("%s a", very_wide_char))); + const std::u16string str = u"\U0001d49c a"; const std::u16string very_wide_word(str.substr(0, 3)); BreakIterator iter(str, BreakIterator::BREAK_SPACE); @@ -378,8 +370,8 @@ TEST(BreakIteratorTest, BreakSentence) { std::u16string nl(u"\n"); - std::u16string str(UTF8ToUTF16( - "\nFoo bar!\nOne sentence.\n\n\tAnother sentence?One more thing")); + std::u16string str( + u"\nFoo bar!\nOne sentence.\n\n\tAnother sentence?One more thing"); BreakIterator iter(str, BreakIterator::BREAK_SENTENCE); ASSERT_TRUE(iter.Init()); EXPECT_TRUE(iter.Advance()); @@ -405,8 +397,8 @@ } TEST(BreakIteratorTest, IsSentenceBoundary) { - std::u16string str(UTF8ToUTF16( - "Foo bar!\nOne sentence.\n\n\tAnother sentence?One more thing")); + std::u16string str( + u"Foo bar!\nOne sentence.\n\n\tAnother sentence?One more thing"); BreakIterator iter(str, BreakIterator::BREAK_SENTENCE); ASSERT_TRUE(iter.Init()); @@ -470,10 +462,7 @@ } TEST(BreakIteratorTest, BreakLineWide32) { - // U+1D49C MATHEMATICAL SCRIPT CAPITAL A - const char very_wide_char[] = "\xF0\x9D\x92\x9C"; - const std::u16string str( - UTF8ToUTF16(base::StringPrintf("%s\na", very_wide_char))); + const std::u16string str = u"\U0001d49c\na"; const std::u16string very_wide_line(str.substr(0, 3)); BreakIterator iter(str, BreakIterator::BREAK_NEWLINE); ASSERT_TRUE(iter.Init()); @@ -490,29 +479,29 @@ } TEST(BreakIteratorTest, BreakCharacter) { - static const char* kCharacters[] = { + static const char16_t* const kCharacters[] = { // An English word consisting of four ASCII characters. - "w", - "o", - "r", - "d", - " ", + u"w", + u"o", + u"r", + u"d", + u" ", // A Hindi word (which means "Hindi") consisting of two Devanagari // grapheme clusters. - "\u0939\u093F", - "\u0928\u094D\u0926\u0940", - " ", + u"हि", + u"न्दी", + u" ", // A Thai word (which means "feel") consisting of three Thai grapheme // clusters. - "\u0E23\u0E39\u0E49", - "\u0E2A\u0E36", - "\u0E01", - " ", + u"รู้", + u"สึ", + u"ก", + u" ", }; std::vector<std::u16string> characters; std::u16string text; - for (auto*& i : kCharacters) { - characters.push_back(base::UTF8ToUTF16(i)); + for (const auto* i : kCharacters) { + characters.push_back(i); text.append(characters.back()); } BreakIterator iter(text, BreakIterator::BREAK_CHARACTER);
diff --git a/base/strings/string_piece_unittest.cc b/base/strings/string_piece_unittest.cc index 5cb60aa..e7d46413 100644 --- a/base/strings/string_piece_unittest.cc +++ b/base/strings/string_piece_unittest.cc
@@ -633,12 +633,11 @@ ASSERT_EQ(f.size(), 6U); } - - TEST(StringPiece16Test, CheckConversion) { - // Make sure that we can convert from UTF8 to UTF16 and back. We use a two - // byte character (G clef) to test this. - ASSERT_EQ(UTF16ToUTF8(UTF8ToUTF16("\xf0\x9d\x84\x9e")), "\xf0\x9d\x84\x9e"); + // Make sure that we can convert from UTF8 to UTF16 and back. We use a + // character (G clef) outside the BMP to test this. + const char kTest[] = "\U0001D11E"; + ASSERT_EQ(UTF16ToUTF8(UTF8ToUTF16(kTest)), kTest); } TYPED_TEST(CommonStringPieceTest, CheckConstructors) {
diff --git a/base/values.h b/base/values.h index 0903e82..255c064 100644 --- a/base/values.h +++ b/base/values.h
@@ -653,6 +653,7 @@ bool HasKey(StringPiece key) const; // Returns the number of Values in this dictionary. + // DEPRECATED, use `Value::DictSize()` instead. size_t size() const { return dict().size(); } // Returns whether the dictionary is empty.
diff --git a/base/values_unittest.cc b/base/values_unittest.cc index 9fbe25e..c86980e 100644 --- a/base/values_unittest.cc +++ b/base/values_unittest.cc
@@ -1641,7 +1641,7 @@ DictionaryValue* value2; ASSERT_TRUE(dict.GetDictionaryWithoutPathExpansion("this", &value2)); EXPECT_EQ(value1, value2); - EXPECT_EQ(1U, value2->size()); + EXPECT_EQ(1U, value2->DictSize()); EXPECT_TRUE(dict.HasKey("this.isnt.expanded")); Value* value3; @@ -1665,7 +1665,7 @@ DictionaryValue* value2; ASSERT_TRUE(dict.GetDictionaryWithoutPathExpansion("this", &value2)); EXPECT_EQ(value1, value2); - EXPECT_EQ(1U, value2->size()); + EXPECT_EQ(1U, value2->DictSize()); EXPECT_TRUE(dict.HasKey("this.isnt.expanded")); Value* value3; @@ -2051,18 +2051,18 @@ root->Set("empty_dict", std::make_unique<DictionaryValue>()); root->SetStringKey("empty_string", std::string()); root = root->DeepCopyWithoutEmptyChildren(); - EXPECT_EQ(2U, root->size()); + EXPECT_EQ(2U, root->DictSize()); // Should do nothing. root = root->DeepCopyWithoutEmptyChildren(); - EXPECT_EQ(2U, root->size()); + EXPECT_EQ(2U, root->DictSize()); // Nested test cases. These should all reduce back to the bool and string // set above. { root->Set("a.b.c.d.e", std::make_unique<DictionaryValue>()); root = root->DeepCopyWithoutEmptyChildren(); - EXPECT_EQ(2U, root->size()); + EXPECT_EQ(2U, root->DictSize()); } { auto inner = std::make_unique<DictionaryValue>(); @@ -2070,7 +2070,7 @@ inner->Set("empty_list", std::make_unique<ListValue>()); root->Set("dict_with_empty_children", std::move(inner)); root = root->DeepCopyWithoutEmptyChildren(); - EXPECT_EQ(2U, root->size()); + EXPECT_EQ(2U, root->DictSize()); } { auto inner = std::make_unique<ListValue>(); @@ -2078,7 +2078,7 @@ inner->Append(std::make_unique<ListValue>()); root->Set("list_with_empty_children", std::move(inner)); root = root->DeepCopyWithoutEmptyChildren(); - EXPECT_EQ(2U, root->size()); + EXPECT_EQ(2U, root->DictSize()); } // Nested with siblings. @@ -2092,7 +2092,7 @@ inner2->Set("empty_list", std::make_unique<ListValue>()); root->Set("dict_with_empty_children", std::move(inner2)); root = root->DeepCopyWithoutEmptyChildren(); - EXPECT_EQ(2U, root->size()); + EXPECT_EQ(2U, root->DictSize()); } // Make sure nested values don't get pruned. @@ -2104,7 +2104,7 @@ inner->Append(std::move(inner2)); root->Set("list_with_empty_children", std::move(inner)); root = root->DeepCopyWithoutEmptyChildren(); - EXPECT_EQ(3U, root->size()); + EXPECT_EQ(3U, root->DictSize()); ListValue *inner_value, *inner_value2; EXPECT_TRUE(root->GetList("list_with_empty_children", &inner_value)); @@ -2134,7 +2134,7 @@ base->MergeDictionary(merge.get()); - EXPECT_EQ(4U, base->size()); + EXPECT_EQ(4U, base->DictSize()); std::string base_key_value; EXPECT_TRUE(base->GetString("base_key", &base_key_value)); EXPECT_EQ("base_key_value_base", base_key_value); // Base value preserved. @@ -2147,7 +2147,7 @@ DictionaryValue* res_sub_dict; EXPECT_TRUE(base->GetDictionary("sub_dict_key", &res_sub_dict)); - EXPECT_EQ(3U, res_sub_dict->size()); + EXPECT_EQ(3U, res_sub_dict->DictSize()); std::string sub_base_key_value; EXPECT_TRUE(res_sub_dict->GetString("sub_base_key", &sub_base_key_value)); EXPECT_EQ("sub_base_key_value_base", sub_base_key_value); // Preserved. @@ -2164,7 +2164,7 @@ std::unique_ptr<DictionaryValue> child(new DictionaryValue); DictionaryValue* original_child = child.get(); child->SetStringKey("test", "value"); - EXPECT_EQ(1U, child->size()); + EXPECT_EQ(1U, child->DictSize()); std::string value; EXPECT_TRUE(child->GetString("test", &value)); @@ -2172,7 +2172,7 @@ std::unique_ptr<DictionaryValue> base(new DictionaryValue); base->Set("dict", std::move(child)); - EXPECT_EQ(1U, base->size()); + EXPECT_EQ(1U, base->DictSize()); DictionaryValue* ptr; EXPECT_TRUE(base->GetDictionary("dict", &ptr)); @@ -2180,7 +2180,7 @@ std::unique_ptr<DictionaryValue> merged(new DictionaryValue); merged->MergeDictionary(base.get()); - EXPECT_EQ(1U, merged->size()); + EXPECT_EQ(1U, merged->DictSize()); EXPECT_TRUE(merged->GetDictionary("dict", &ptr)); EXPECT_NE(original_child, ptr); EXPECT_TRUE(ptr->GetString("test", &value));
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 9e610da1..c3fcd9d 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -4.20210506.2.1 +4.20210506.3.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 9e610da1..c3fcd9d 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -4.20210506.2.1 +4.20210506.3.1
diff --git a/cc/debug/rendering_stats.h b/cc/debug/rendering_stats.h index 4fe3f553..7ea273f 100644 --- a/cc/debug/rendering_stats.h +++ b/cc/debug/rendering_stats.h
@@ -12,7 +12,6 @@ #include "base/time/time.h" #include "base/trace_event/traced_value.h" -#include "base/values.h" #include "cc/debug/debug_export.h" namespace cc {
diff --git a/cc/raster/bitmap_raster_buffer_provider.h b/cc/raster/bitmap_raster_buffer_provider.h index 88a1837..a2a14fc 100644 --- a/cc/raster/bitmap_raster_buffer_provider.h +++ b/cc/raster/bitmap_raster_buffer_provider.h
@@ -10,7 +10,6 @@ #include <memory> #include <vector> -#include "base/values.h" #include "cc/raster/raster_buffer_provider.h" namespace base {
diff --git a/cc/raster/zero_copy_raster_buffer_provider.h b/cc/raster/zero_copy_raster_buffer_provider.h index 02dc9ad..78d680f8 100644 --- a/cc/raster/zero_copy_raster_buffer_provider.h +++ b/cc/raster/zero_copy_raster_buffer_provider.h
@@ -11,7 +11,6 @@ #include <vector> #include "base/memory/weak_ptr.h" -#include "base/values.h" #include "cc/raster/raster_buffer_provider.h" namespace base {
diff --git a/cc/scheduler/scheduler_settings.h b/cc/scheduler/scheduler_settings.h index a91508f..60ae45b 100644 --- a/cc/scheduler/scheduler_settings.h +++ b/cc/scheduler/scheduler_settings.h
@@ -9,7 +9,6 @@ #include "base/memory/ref_counted.h" #include "base/time/time.h" -#include "base/values.h" #include "cc/cc_export.h" namespace base {
diff --git a/cc/tiles/tile_manager.h b/cc/tiles/tile_manager.h index 460c492e..f243af2 100644 --- a/cc/tiles/tile_manager.h +++ b/cc/tiles/tile_manager.h
@@ -17,7 +17,6 @@ #include "base/sequenced_task_runner.h" #include "base/synchronization/waitable_event.h" -#include "base/values.h" #include "cc/base/unique_notifier.h" #include "cc/raster/raster_buffer_provider.h" #include "cc/raster/raster_query_queue.h"
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h index 550bd78..106c1035 100644 --- a/cc/trees/layer_tree_impl.h +++ b/cc/trees/layer_tree_impl.h
@@ -15,7 +15,6 @@ #include "base/containers/flat_set.h" #include "base/time/time.h" -#include "base/values.h" #include "cc/base/synced_property.h" #include "cc/input/browser_controls_offset_manager.h" #include "cc/input/event_listener_properties.h"
diff --git a/cc/trees/proxy.h b/cc/trees/proxy.h index 44c4024..c927579 100644 --- a/cc/trees/proxy.h +++ b/cc/trees/proxy.h
@@ -11,7 +11,6 @@ #include "base/memory/ref_counted.h" #include "base/threading/platform_thread.h" #include "base/time/time.h" -#include "base/values.h" #include "cc/cc_export.h" #include "cc/input/browser_controls_state.h" #include "cc/trees/paint_holding_commit_trigger.h"
diff --git a/cc/trees/task_runner_provider.h b/cc/trees/task_runner_provider.h index 232bc6da..94cce609 100644 --- a/cc/trees/task_runner_provider.h +++ b/cc/trees/task_runner_provider.h
@@ -14,7 +14,6 @@ #include "base/single_thread_task_runner.h" #include "base/threading/platform_thread.h" #include "base/time/time.h" -#include "base/values.h" #include "cc/cc_export.h" namespace base {
diff --git a/chrome/VERSION b/chrome/VERSION index 8f7ef9a..f21e3ab5 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=92 MINOR=0 -BUILD=4500 +BUILD=4501 PATCH=0
diff --git a/chrome/android/java/res/layout/autofill_save_address_profile_prompt.xml b/chrome/android/java/res/layout/autofill_save_address_profile_prompt.xml index aec3414..9091c7c 100644 --- a/chrome/android/java/res/layout/autofill_save_address_profile_prompt.xml +++ b/chrome/android/java/res/layout/autofill_save_address_profile_prompt.xml
@@ -2,53 +2,60 @@ <!-- 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. --> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +<org.chromium.components.browser_ui.widget.FadingEdgeScrollView + xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="wrap_content"> + android:layout_height="match_parent" + android:fadeScrollbars="false"> - <org.chromium.ui.widget.ChromeImageButton - android:id="@+id/edit_button" - android:layout_width="48dp" - android:layout_height="48dp" - android:layout_alignParentEnd="true" - android:layout_marginEnd="8dp" - android:padding="12dp" - android:background="?attr/selectableItemBackground" - android:contentDescription="@string/payments_edit_address" - android:scaleType="fitCenter" - app:srcCompat="@drawable/edit_icon" - app:tint="@color/default_icon_color_tint_list" - tools:src="@drawable/edit_icon" /> - - <LinearLayout + <RelativeLayout android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_toStartOf="@id/edit_button" - android:paddingTop="@dimen/dialog_padding_top" - android:paddingStart="@dimen/dialog_padding_sides" - android:orientation="vertical" - tools:ignore="RtlSymmetry"> + android:layout_height="wrap_content"> - <org.chromium.ui.widget.TextViewWithLeading - android:id="@+id/address" + <org.chromium.ui.widget.ChromeImageButton + android:id="@+id/edit_button" + android:layout_width="48dp" + android:layout_height="48dp" + android:layout_alignParentEnd="true" + android:layout_marginEnd="8dp" + android:padding="12dp" + android:background="?attr/selectableItemBackground" + android:contentDescription="@string/payments_edit_address" + android:scaleType="fitCenter" + app:srcCompat="@drawable/edit_icon" + app:tint="@color/default_icon_color_tint_list" + tools:src="@drawable/edit_icon" /> + + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="12dp" - app:leading="@dimen/text_size_medium_leading" - tools:text="Alex Park\n345 High Street\nSan Francisco, CA, 94105\nUnited States" /> + android:layout_toStartOf="@id/edit_button" + android:paddingTop="@dimen/dialog_padding_top" + android:paddingStart="@dimen/dialog_padding_sides" + android:orientation="vertical" + tools:ignore="RtlSymmetry"> - <TextView - android:id="@+id/email" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:text="alex.park@gmail.com" /> + <org.chromium.ui.widget.TextViewWithLeading + android:id="@+id/address" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp" + app:leading="@dimen/text_size_medium_leading" + tools:text="Alex Park\n345 High Street\nSan Francisco, CA, 94105\nUnited States" /> - <TextView - android:id="@+id/phone" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:text="+1 858 230 4000" /> - </LinearLayout> -</RelativeLayout> + <TextView + android:id="@+id/email" + android:layout_width="match_parent" + android:layout_height="wrap_content" + tools:text="alex.park@gmail.com" /> + + <TextView + android:id="@+id/phone" + android:layout_width="match_parent" + android:layout_height="wrap_content" + tools:text="+1 858 230 4000" /> + </LinearLayout> + </RelativeLayout> +</org.chromium.components.browser_ui.widget.FadingEdgeScrollView>
diff --git a/chrome/android/java/res/layout/autofill_update_address_profile_prompt.xml b/chrome/android/java/res/layout/autofill_update_address_profile_prompt.xml index 6d1b634..e6e1549 100644 --- a/chrome/android/java/res/layout/autofill_update_address_profile_prompt.xml +++ b/chrome/android/java/res/layout/autofill_update_address_profile_prompt.xml
@@ -6,92 +6,106 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingBottom="12dp"> + android:layout_height="match_parent" + android:orientation="vertical"> <TextView android:id="@+id/subtitle" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginBottom="4dp" android:paddingStart="@dimen/dialog_padding_sides" android:paddingEnd="@dimen/dialog_padding_sides" android:ellipsize="end" android:maxLines="1" tools:text="For Alex Park — 345 Spear street" /> - <RelativeLayout + <org.chromium.components.browser_ui.widget.FadingEdgeScrollView android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingStart="@dimen/dialog_padding_sides" - tools:ignore="RtlSymmetry"> + android:layout_height="0dp" + android:layout_weight="1" + android:fadeScrollbars="false"> - <Space - android:id="@+id/no_header_space" - android:layout_width="match_parent" - android:layout_height="25dp" - tools:visibility="gone" /> - - <!-- TODO(crbug.com/1167061): Replace with proper localized string. --> - <TextView - android:id="@+id/header_new" + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="16dp" - android:layout_below="@id/no_header_space" - android:layout_toStartOf="@id/edit_button" - android:text="New" - android:textAppearance="@style/TextAppearance.TextMedium.Blue" - tools:ignore="HardcodedText" /> + android:orientation="vertical" + android:paddingBottom="12dp"> - <org.chromium.ui.widget.TextViewWithLeading - android:id="@+id/details_new" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="12dp" - android:layout_marginTop="3dp" - android:layout_below="@id/header_new" - android:layout_toStartOf="@id/edit_button" - android:textAppearance="@style/TextAppearance.TextLarge.Primary" - app:leading="@dimen/text_size_large_leading" - tools:text="Alex Johnson Park\n+1 858 230 4000" /> + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingStart="@dimen/dialog_padding_sides" + tools:ignore="RtlSymmetry"> - <org.chromium.ui.widget.ChromeImageButton - android:id="@+id/edit_button" - android:layout_width="48dp" - android:layout_height="48dp" - android:layout_alignBaseline="@id/details_new" - android:layout_alignParentEnd="true" - android:layout_marginEnd="8dp" - android:baseline="32dp" - android:padding="12dp" - android:background="?attr/selectableItemBackground" - android:contentDescription="@string/payments_edit_address" - android:scaleType="fitCenter" - app:srcCompat="@drawable/edit_icon" - app:tint="@color/default_icon_color_tint_list" - tools:src="@drawable/edit_icon" /> - </RelativeLayout> + <Space + android:id="@+id/no_header_space" + android:layout_width="match_parent" + android:layout_height="20dp" + tools:visibility="gone" /> - <!-- TODO(crbug.com/1167061): Replace with proper localized string. --> - <TextView - android:id="@+id/header_old" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="12dp" - android:paddingStart="@dimen/dialog_padding_sides" - android:paddingEnd="@dimen/dialog_padding_sides" - android:text="Old" - tools:ignore="HardcodedText" /> + <!-- TODO(crbug.com/1167061): Replace with proper localized string. --> + <TextView + android:id="@+id/header_new" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="12dp" + android:layout_below="@id/no_header_space" + android:layout_toStartOf="@id/edit_button" + android:text="New" + android:textAppearance="@style/TextAppearance.TextMedium.Blue" + tools:ignore="HardcodedText" /> - <org.chromium.ui.widget.TextViewWithLeading - android:id="@+id/details_old" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="3dp" - android:paddingStart="@dimen/dialog_padding_sides" - android:paddingEnd="@dimen/dialog_padding_sides" - android:textAppearance="@style/TextAppearance.TextLarge.Primary" - app:leading="@dimen/text_size_large_leading" - tools:text="Alex Park" /> -</LinearLayout> + <org.chromium.ui.widget.TextViewWithLeading + android:id="@+id/details_new" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp" + android:layout_marginTop="3dp" + android:layout_below="@id/header_new" + android:layout_toStartOf="@id/edit_button" + android:textAppearance="@style/TextAppearance.TextLarge.Primary" + app:leading="@dimen/text_size_large_leading" + tools:text="Alex Johnson Park\n+1 858 230 4000" /> + + <org.chromium.ui.widget.ChromeImageButton + android:id="@+id/edit_button" + android:layout_width="48dp" + android:layout_height="48dp" + android:layout_alignBaseline="@id/details_new" + android:layout_alignParentEnd="true" + android:layout_marginEnd="8dp" + android:baseline="32dp" + android:padding="12dp" + android:background="?attr/selectableItemBackground" + android:contentDescription="@string/payments_edit_address" + android:scaleType="fitCenter" + app:srcCompat="@drawable/edit_icon" + app:tint="@color/default_icon_color_tint_list" + tools:src="@drawable/edit_icon" /> + </RelativeLayout> + + <!-- TODO(crbug.com/1167061): Replace with proper localized string. --> + <TextView + android:id="@+id/header_old" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="12dp" + android:paddingStart="@dimen/dialog_padding_sides" + android:paddingEnd="@dimen/dialog_padding_sides" + android:text="Old" + tools:ignore="HardcodedText" /> + + <org.chromium.ui.widget.TextViewWithLeading + android:id="@+id/details_old" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="3dp" + android:paddingStart="@dimen/dialog_padding_sides" + android:paddingEnd="@dimen/dialog_padding_sides" + android:textAppearance="@style/TextAppearance.TextLarge.Primary" + app:leading="@dimen/text_size_large_leading" + tools:text="Alex Park" /> + </LinearLayout> + </org.chromium.components.browser_ui.widget.FadingEdgeScrollView> +</LinearLayout> \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 9ee1ea9..665d772 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -3430,6 +3430,8 @@ "apps/app_service/publishers/web_apps.h", "apps/app_service/publishers/web_apps_base.cc", "apps/app_service/publishers/web_apps_base.h", + "apps/app_service/web_apps_utils.cc", + "apps/app_service/web_apps_utils.h", "apps/intent_helper/apps_navigation_throttle.cc", "apps/intent_helper/apps_navigation_throttle.h", "apps/intent_helper/apps_navigation_types.cc",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 5ae5f0d..c77e67f 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -2653,10 +2653,6 @@ flag_descriptions::kExtensionsOnChromeUrlsName, flag_descriptions::kExtensionsOnChromeUrlsDescription, kOsAll, SINGLE_VALUE_TYPE(extensions::switches::kExtensionsOnChromeURLs)}, - {"default-chrome-app-uninstall-sync", - flag_descriptions::kDefaultChromeAppUninstallSyncName, - flag_descriptions::kDefaultChromeAppUninstallSyncDescription, kOsCrOS, - FEATURE_VALUE_TYPE(extensions_features::kDefaultChromeAppUninstallSync)}, #endif // ENABLE_EXTENSIONS {"enable-history-manipulation-intervention", flag_descriptions::kHistoryManipulationIntervention,
diff --git a/chrome/browser/android/contextualsearch/contextual_search_field_trial.h b/chrome/browser/android/contextualsearch/contextual_search_field_trial.h index 28eda679..4fadae696 100644 --- a/chrome/browser/android/contextualsearch/contextual_search_field_trial.h +++ b/chrome/browser/android/contextualsearch/contextual_search_field_trial.h
@@ -7,12 +7,15 @@ #include <stddef.h> -#include "base/values.h" +#include <string> // Manages the Contextual Search field trials for native classes. class ContextualSearchFieldTrial { public: ContextualSearchFieldTrial(); + ContextualSearchFieldTrial(const ContextualSearchFieldTrial&) = delete; + ContextualSearchFieldTrial& operator=(const ContextualSearchFieldTrial&) = + delete; virtual ~ContextualSearchFieldTrial(); // Returns a partial URL to use for a Contextual Search Resolve request, or @@ -83,8 +86,6 @@ bool is_contextual_cards_version_cached_; int contextual_cards_version_; - - DISALLOW_COPY_AND_ASSIGN(ContextualSearchFieldTrial); }; #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_FIELD_TRIAL_H_
diff --git a/chrome/browser/android/vr/autocomplete_controller.h b/chrome/browser/android/vr/autocomplete_controller.h index fbe52d4..0b99c2f 100644 --- a/chrome/browser/android/vr/autocomplete_controller.h +++ b/chrome/browser/android/vr/autocomplete_controller.h
@@ -10,7 +10,6 @@ #include "base/cancelable_callback.h" #include "base/macros.h" -#include "base/values.h" #include "chrome/browser/vr/model/omnibox_suggestions.h" #include "components/omnibox/browser/autocomplete_controller.h" #include "url/gurl.h"
diff --git a/chrome/browser/apps/app_service/app_platform_metrics.cc b/chrome/browser/apps/app_service/app_platform_metrics.cc index ebb002c..beb90bb 100644 --- a/chrome/browser/apps/app_service/app_platform_metrics.cc +++ b/chrome/browser/apps/app_service/app_platform_metrics.cc
@@ -79,6 +79,10 @@ const extensions::Extension* extension = registry->GetInstalledExtension(app_id); + if (!extension || !extension->is_app()) { + return apps::AppTypeName::kUnknown; + } + if (CanLaunchViaEvent(extension)) { return apps::AppTypeName::kChromeApp; }
diff --git a/chrome/browser/apps/app_service/file_utils_unittest.cc b/chrome/browser/apps/app_service/file_utils_unittest.cc index 169555de..571151c 100644 --- a/chrome/browser/apps/app_service/file_utils_unittest.cc +++ b/chrome/browser/apps/app_service/file_utils_unittest.cc
@@ -19,14 +19,13 @@ #include "chrome/test/base/testing_profile_manager.h" #include "content/public/test/browser_task_environment.h" #include "extensions/common/extension.h" +#include "storage/browser/file_system/external_mount_points.h" #include "storage/browser/file_system/file_system_url.h" #include "storage/common/file_system/file_system_util.h" #include "url/gurl.h" #include "url/origin.h" #include "url/url_constants.h" -#include "storage/browser/file_system/external_mount_points.h" - namespace apps { namespace { @@ -125,6 +124,15 @@ url_list, ElementsAre(ToGURL( base::FilePath(storage::kExternalDir).Append(mount_name_), path))); + + // Case 3: paths not originating in a known root are ignored. + fp_list.push_back(base::FilePath("/not/a/known/root").Append(path)); + url_list = GetFileUrls(GetProfile(), fp_list); + // Still just one path corresponding to foo.jpg under a known root. + EXPECT_THAT( + url_list, + ElementsAre(ToGURL( + base::FilePath(storage::kExternalDir).Append(mount_name_), path))); } } // namespace
diff --git a/chrome/browser/apps/app_service/publishers/crostini_apps.cc b/chrome/browser/apps/app_service/publishers/crostini_apps.cc index ea9518f..35429eef 100644 --- a/chrome/browser/apps/app_service/publishers/crostini_apps.cc +++ b/chrome/browser/apps/app_service/publishers/crostini_apps.cc
@@ -9,10 +9,10 @@ #include "ash/public/cpp/app_menu_constants.h" #include "chrome/browser/apps/app_service/dip_px_util.h" #include "chrome/browser/apps/app_service/menu_util.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_package_service.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_package_service.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_shelf_utils.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/apps/app_service/publishers/web_apps.cc b/chrome/browser/apps/app_service/publishers/web_apps.cc index 805f67d..a89912e4 100644 --- a/chrome/browser/apps/app_service/publishers/web_apps.cc +++ b/chrome/browser/apps/app_service/publishers/web_apps.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/apps/app_service/publishers/web_apps.h" #include "base/callback_helpers.h" +#include "chrome/browser/apps/app_service/web_apps_utils.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/web_applications/web_app_dialog_manager.h" #include "chrome/browser/ui/web_applications/web_app_ui_manager_impl.h" @@ -36,7 +37,7 @@ web_app_ui_manager->dialog_manager(); if (web_app_dialog_manager.CanUserUninstallWebApp(app_id)) { webapps::WebappUninstallSource webapp_uninstall_source = - WebAppsBase::ConvertUninstallSourceToWebAppUninstallSource( + apps_util::ConvertUninstallSourceToWebAppUninstallSource( uninstall_source); web_app_dialog_manager.UninstallWebApp(app_id, webapp_uninstall_source, parent_window, base::DoNothing()); @@ -45,7 +46,8 @@ apps::mojom::AppPtr WebApps::Convert(const web_app::WebApp* web_app, apps::mojom::Readiness readiness) { - apps::mojom::AppPtr app = ConvertImpl(web_app, readiness); + apps::mojom::AppPtr app = + apps_util::ConvertWebApp(profile(), web_app, app_type(), readiness); app->icon_key = icon_key_factory().MakeIconKey(GetIconEffects(web_app));
diff --git a/chrome/browser/apps/app_service/publishers/web_apps_base.cc b/chrome/browser/apps/app_service/publishers/web_apps_base.cc index 80b4740..24082e3 100644 --- a/chrome/browser/apps/app_service/publishers/web_apps_base.cc +++ b/chrome/browser/apps/app_service/publishers/web_apps_base.cc
@@ -8,10 +8,13 @@ #include <vector> #include "base/callback.h" +#include "base/feature_list.h" #include "base/metrics/histogram_macros.h" +#include "build/chromeos_buildflags.h" #include "chrome/browser/apps/app_service/app_launch_params.h" #include "chrome/browser/apps/app_service/intent_util.h" #include "chrome/browser/apps/app_service/launch_utils.h" +#include "chrome/browser/apps/app_service/web_apps_utils.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/chrome_pages.h" @@ -31,41 +34,11 @@ #include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/content_settings_pattern.h" #include "components/content_settings/core/common/content_settings_types.h" -#include "components/services/app_service/public/cpp/share_target.h" -#include "content/public/browser/web_contents.h" #if BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/browser/ash/crosapi/browser_util.h" #endif -namespace { - -// Only supporting important permissions for now. -const ContentSettingsType kSupportedPermissionTypes[] = { - ContentSettingsType::MEDIASTREAM_MIC, - ContentSettingsType::MEDIASTREAM_CAMERA, - ContentSettingsType::GEOLOCATION, - ContentSettingsType::NOTIFICATIONS, -}; - -apps::mojom::InstallSource GetHighestPriorityInstallSource( - const web_app::WebApp* web_app) { - switch (web_app->GetHighestPrioritySource()) { - case web_app::Source::kSystem: - return apps::mojom::InstallSource::kSystem; - case web_app::Source::kPolicy: - return apps::mojom::InstallSource::kPolicy; - case web_app::Source::kWebAppStore: - return apps::mojom::InstallSource::kUser; - case web_app::Source::kSync: - return apps::mojom::InstallSource::kUser; - case web_app::Source::kDefault: - return apps::mojom::InstallSource::kDefault; - } -} - -} // namespace - namespace apps { WebAppsBase::WebAppsBase( @@ -125,35 +98,10 @@ // TODO(loyso): Plumb uninstall source (reason) here. app->readiness = apps::mojom::Readiness::kUninstalledByUser; - SetShowInFields(app, web_app); + apps_util::SetWebAppShowInFields(app, web_app); Publish(std::move(app), subscribers_); } -apps::mojom::AppPtr WebAppsBase::ConvertImpl(const web_app::WebApp* web_app, - apps::mojom::Readiness readiness) { - apps::mojom::AppPtr app = PublisherBase::MakeApp( - app_type_, web_app->app_id(), readiness, web_app->name(), - GetHighestPriorityInstallSource(web_app)); - - app->description = web_app->description(); - app->additional_search_terms = web_app->additional_search_terms(); - app->last_launch_time = web_app->last_launch_time(); - app->install_time = web_app->install_time(); - - // Web App's publisher_id the start url. - app->publisher_id = web_app->start_url().spec(); - - // app->version is left empty here. - PopulatePermissions(web_app, &app->permissions); - - SetShowInFields(app, web_app); - - // Get the intent filters for PWAs. - apps_util::PopulateWebAppIntentFilters(*web_app, app->intent_filters); - - return app; -} - IconEffects WebAppsBase::GetIconEffects(const web_app::WebApp* web_app) { IconEffects icon_effects = IconEffects::kNone; if (!web_app->is_locally_installed()) { @@ -361,7 +309,7 @@ ContentSettingsType permission_type = static_cast<ContentSettingsType>(permission->permission_id); - if (!base::Contains(kSupportedPermissionTypes, permission_type)) { + if (!apps_util::IsSupportedWebAppPermissionType(permission_type)) { return; } @@ -404,7 +352,7 @@ const ContentSettingsPattern& secondary_pattern, ContentSettingsType content_type) { // If content_type is not one of the supported permissions, do nothing. - if (!base::Contains(kSupportedPermissionTypes, content_type)) { + if (!apps_util::IsSupportedWebAppPermissionType(content_type)) { return; } @@ -424,7 +372,8 @@ apps::mojom::AppPtr app = apps::mojom::App::New(); app->app_type = app_type_; app->app_id = web_app.app_id(); - PopulatePermissions(&web_app, &app->permissions); + apps_util::PopulateWebAppPermissions(profile_, &web_app, + &app->permissions); Publish(std::move(app), subscribers_); } @@ -469,73 +418,6 @@ Publish(std::move(app), subscribers_); } -void WebAppsBase::SetShowInFields(apps::mojom::AppPtr& app, - const web_app::WebApp* web_app) { - if (web_app->chromeos_data().has_value()) { - auto& chromeos_data = web_app->chromeos_data().value(); - app->show_in_launcher = chromeos_data.show_in_launcher - ? apps::mojom::OptionalBool::kTrue - : apps::mojom::OptionalBool::kFalse; - app->show_in_shelf = app->show_in_search = - chromeos_data.show_in_search ? apps::mojom::OptionalBool::kTrue - : apps::mojom::OptionalBool::kFalse; - app->show_in_management = chromeos_data.show_in_management - ? apps::mojom::OptionalBool::kTrue - : apps::mojom::OptionalBool::kFalse; - return; - } - - // Show the app everywhere by default. - auto show = apps::mojom::OptionalBool::kTrue; - app->show_in_launcher = show; - app->show_in_shelf = show; - app->show_in_search = show; - app->show_in_management = show; -} - -void WebAppsBase::PopulatePermissions( - const web_app::WebApp* web_app, - std::vector<mojom::PermissionPtr>* target) { - const GURL url = web_app->start_url(); - - auto* host_content_settings_map = - HostContentSettingsMapFactory::GetForProfile(profile_); - DCHECK(host_content_settings_map); - - for (ContentSettingsType type : kSupportedPermissionTypes) { - ContentSetting setting = - host_content_settings_map->GetContentSetting(url, url, type); - - // Map ContentSettingsType to an apps::mojom::TriState value - apps::mojom::TriState setting_val; - switch (setting) { - case CONTENT_SETTING_ALLOW: - setting_val = apps::mojom::TriState::kAllow; - break; - case CONTENT_SETTING_ASK: - setting_val = apps::mojom::TriState::kAsk; - break; - case CONTENT_SETTING_BLOCK: - setting_val = apps::mojom::TriState::kBlock; - break; - default: - setting_val = apps::mojom::TriState::kAsk; - } - - content_settings::SettingInfo setting_info; - host_content_settings_map->GetWebsiteSetting(url, url, type, &setting_info); - - auto permission = apps::mojom::Permission::New(); - permission->permission_id = static_cast<uint32_t>(type); - permission->value_type = apps::mojom::PermissionValueType::kTriState; - permission->value = static_cast<uint32_t>(setting_val); - permission->is_managed = - setting_info.source == content_settings::SETTING_SOURCE_POLICY; - - target->push_back(std::move(permission)); - } -} - void WebAppsBase::ConvertWebApps(apps::mojom::Readiness readiness, std::vector<apps::mojom::AppPtr>* apps_out) { const web_app::WebAppRegistrar* registrar = GetRegistrar(); @@ -563,22 +445,4 @@ subscribers_.Add(std::move(subscriber)); } -// static. -webapps::WebappUninstallSource -WebAppsBase::ConvertUninstallSourceToWebAppUninstallSource( - apps::mojom::UninstallSource uninstall_source) { - switch (uninstall_source) { - case apps::mojom::UninstallSource::kAppList: - return webapps::WebappUninstallSource::kAppList; - case apps::mojom::UninstallSource::kAppManagement: - return webapps::WebappUninstallSource::kAppManagement; - case apps::mojom::UninstallSource::kShelf: - return webapps::WebappUninstallSource::kShelf; - case apps::mojom::UninstallSource::kMigration: - return webapps::WebappUninstallSource::kMigration; - case apps::mojom::UninstallSource::kUnknown: - return webapps::WebappUninstallSource::kUnknown; - } -} - } // namespace apps
diff --git a/chrome/browser/apps/app_service/publishers/web_apps_base.h b/chrome/browser/apps/app_service/publishers/web_apps_base.h index 75eed22..96d5fcc 100644 --- a/chrome/browser/apps/app_service/publishers/web_apps_base.h +++ b/chrome/browser/apps/app_service/publishers/web_apps_base.h
@@ -70,9 +70,6 @@ const std::string& app_id, const base::Time& last_launch_time) override; - apps::mojom::AppPtr ConvertImpl(const web_app::WebApp* web_app, - apps::mojom::Readiness readiness); - IconEffects GetIconEffects(const web_app::WebApp* web_app); content::WebContents* LaunchAppWithIntentImpl( @@ -100,10 +97,6 @@ apps::mojom::AppType app_type() { return app_type_; } - static webapps::WebappUninstallSource - ConvertUninstallSourceToWebAppUninstallSource( - apps::mojom::UninstallSource uninstall_source); - private: void Initialize(const mojo::Remote<apps::mojom::AppService>& app_service); @@ -146,10 +139,6 @@ void OnWebAppLocallyInstalledStateChanged(const web_app::AppId& app_id, bool is_locally_installed) override; - void SetShowInFields(apps::mojom::AppPtr& app, - const web_app::WebApp* web_app); - void PopulatePermissions(const web_app::WebApp* web_app, - std::vector<mojom::PermissionPtr>* target); virtual apps::mojom::AppPtr Convert(const web_app::WebApp* web_app, apps::mojom::Readiness readiness) = 0; void ConvertWebApps(apps::mojom::Readiness readiness,
diff --git a/chrome/browser/apps/app_service/publishers/web_apps_base_browsertest.cc b/chrome/browser/apps/app_service/publishers/web_apps_base_browsertest.cc index 775178e0..3cf89a44 100644 --- a/chrome/browser/apps/app_service/publishers/web_apps_base_browsertest.cc +++ b/chrome/browser/apps/app_service/publishers/web_apps_base_browsertest.cc
@@ -32,10 +32,6 @@ #include "ui/display/types/display_constants.h" #include "url/gurl.h" -using apps::mojom::Condition; -using apps::mojom::ConditionType; -using apps::mojom::PatternMatchType; - namespace apps { class WebAppsBaseBrowserTest : public InProcessBrowserTest {
diff --git a/chrome/browser/apps/app_service/publishers/web_apps_chromeos.cc b/chrome/browser/apps/app_service/publishers/web_apps_chromeos.cc index 0cf42c8..ef33050 100644 --- a/chrome/browser/apps/app_service/publishers/web_apps_chromeos.cc +++ b/chrome/browser/apps/app_service/publishers/web_apps_chromeos.cc
@@ -22,6 +22,7 @@ #include "chrome/browser/apps/app_service/app_service_metrics.h" #include "chrome/browser/apps/app_service/launch_utils.h" #include "chrome/browser/apps/app_service/menu_util.h" +#include "chrome/browser/apps/app_service/web_apps_utils.h" #include "chrome/browser/ash/arc/arc_util.h" #include "chrome/browser/ash/arc/arc_web_contents_data.h" #include "chrome/browser/badging/badge_manager_factory.h" @@ -180,7 +181,7 @@ DCHECK(provider()); DCHECK(provider()->install_finalizer().CanUserUninstallWebApp(app_id)); webapps::WebappUninstallSource webapp_uninstall_source = - WebAppsBase::ConvertUninstallSourceToWebAppUninstallSource( + apps_util::ConvertUninstallSourceToWebAppUninstallSource( uninstall_source); provider()->install_finalizer().UninstallWebApp( app_id, webapp_uninstall_source, base::DoNothing()); @@ -419,9 +420,11 @@ // Sometimes OnWebAppDisabledStateChanged is called but // WebApp::chromos_data().is_disabled isn't updated yet, that's why here we // depend only on |is_disabled|. - apps::mojom::AppPtr app = WebAppsBase::ConvertImpl( - web_app, is_disabled ? apps::mojom::Readiness::kDisabledByPolicy - : apps::mojom::Readiness::kReady); + apps::mojom::Readiness readiness = + is_disabled ? apps::mojom::Readiness::kDisabledByPolicy + : apps::mojom::Readiness::kReady; + apps::mojom::AppPtr app = + apps_util::ConvertWebApp(profile(), web_app, app_type(), readiness); app->icon_key = icon_key_factory().MakeIconKey( GetIconEffects(web_app, paused_apps_.IsPaused(app_id), is_disabled)); @@ -669,8 +672,8 @@ apps::mojom::Readiness readiness) { DCHECK(web_app->chromeos_data().has_value()); bool is_disabled = web_app->chromeos_data()->is_disabled; - apps::mojom::AppPtr app = WebAppsBase::ConvertImpl( - web_app, + apps::mojom::AppPtr app = apps_util::ConvertWebApp( + profile(), web_app, app_type(), is_disabled ? apps::mojom::Readiness::kDisabledByPolicy : readiness); if (is_disabled) { UpdateAppDisabledMode(app);
diff --git a/chrome/browser/apps/app_service/web_apps_utils.cc b/chrome/browser/apps/app_service/web_apps_utils.cc new file mode 100644 index 0000000..267bf35 --- /dev/null +++ b/chrome/browser/apps/app_service/web_apps_utils.cc
@@ -0,0 +1,163 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/apps/app_service/web_apps_utils.h" + +#include "base/containers/contains.h" +#include "base/feature_list.h" +#include "chrome/browser/apps/app_service/intent_util.h" +#include "chrome/browser/content_settings/host_content_settings_map_factory.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/web_applications/web_app.h" +#include "chrome/common/chrome_features.h" +#include "components/content_settings/core/browser/host_content_settings_map.h" +#include "components/content_settings/core/common/content_settings.h" +#include "components/services/app_service/public/cpp/publisher_base.h" + +namespace apps_util { + +namespace { + +// Only supporting important permissions for now. +const ContentSettingsType kSupportedPermissionTypes[] = { + ContentSettingsType::MEDIASTREAM_MIC, + ContentSettingsType::MEDIASTREAM_CAMERA, + ContentSettingsType::GEOLOCATION, + ContentSettingsType::NOTIFICATIONS, +}; + +apps::mojom::InstallSource GetHighestPriorityInstallSource( + const web_app::WebApp* web_app) { + switch (web_app->GetHighestPrioritySource()) { + case web_app::Source::kSystem: + return apps::mojom::InstallSource::kSystem; + case web_app::Source::kPolicy: + return apps::mojom::InstallSource::kPolicy; + case web_app::Source::kWebAppStore: + return apps::mojom::InstallSource::kUser; + case web_app::Source::kSync: + return apps::mojom::InstallSource::kUser; + case web_app::Source::kDefault: + return apps::mojom::InstallSource::kDefault; + } +} + +} // namespace + +bool IsSupportedWebAppPermissionType(ContentSettingsType permission_type) { + return base::Contains(kSupportedPermissionTypes, permission_type); +} + +void SetWebAppShowInFields(apps::mojom::AppPtr& app, + const web_app::WebApp* web_app) { + if (web_app->chromeos_data().has_value()) { + auto& chromeos_data = web_app->chromeos_data().value(); + app->show_in_launcher = chromeos_data.show_in_launcher + ? apps::mojom::OptionalBool::kTrue + : apps::mojom::OptionalBool::kFalse; + app->show_in_shelf = app->show_in_search = + chromeos_data.show_in_search ? apps::mojom::OptionalBool::kTrue + : apps::mojom::OptionalBool::kFalse; + app->show_in_management = chromeos_data.show_in_management + ? apps::mojom::OptionalBool::kTrue + : apps::mojom::OptionalBool::kFalse; + return; + } + + // Show the app everywhere by default. + auto show = apps::mojom::OptionalBool::kTrue; + app->show_in_launcher = show; + app->show_in_shelf = show; + app->show_in_search = show; + app->show_in_management = show; +} + +void PopulateWebAppPermissions( + Profile* profile, + const web_app::WebApp* web_app, + std::vector<apps::mojom::PermissionPtr>* target) { + const GURL url = web_app->start_url(); + + auto* host_content_settings_map = + HostContentSettingsMapFactory::GetForProfile(profile); + DCHECK(host_content_settings_map); + + for (ContentSettingsType type : kSupportedPermissionTypes) { + ContentSetting setting = + host_content_settings_map->GetContentSetting(url, url, type); + + // Map ContentSettingsType to an apps::mojom::TriState value + apps::mojom::TriState setting_val; + switch (setting) { + case CONTENT_SETTING_ALLOW: + setting_val = apps::mojom::TriState::kAllow; + break; + case CONTENT_SETTING_ASK: + setting_val = apps::mojom::TriState::kAsk; + break; + case CONTENT_SETTING_BLOCK: + setting_val = apps::mojom::TriState::kBlock; + break; + default: + setting_val = apps::mojom::TriState::kAsk; + } + + content_settings::SettingInfo setting_info; + host_content_settings_map->GetWebsiteSetting(url, url, type, &setting_info); + + auto permission = apps::mojom::Permission::New(); + permission->permission_id = static_cast<uint32_t>(type); + permission->value_type = apps::mojom::PermissionValueType::kTriState; + permission->value = static_cast<uint32_t>(setting_val); + permission->is_managed = + setting_info.source == content_settings::SETTING_SOURCE_POLICY; + + target->push_back(std::move(permission)); + } +} + +apps::mojom::AppPtr ConvertWebApp(Profile* profile, + const web_app::WebApp* web_app, + apps::mojom::AppType app_type, + apps::mojom::Readiness readiness) { + apps::mojom::AppPtr app = apps::PublisherBase::MakeApp( + app_type, web_app->app_id(), readiness, web_app->name(), + GetHighestPriorityInstallSource(web_app)); + + app->description = web_app->description(); + app->additional_search_terms = web_app->additional_search_terms(); + app->last_launch_time = web_app->last_launch_time(); + app->install_time = web_app->install_time(); + + // Web App's publisher_id the start url. + app->publisher_id = web_app->start_url().spec(); + + // app->version is left empty here. + PopulateWebAppPermissions(profile, web_app, &app->permissions); + + SetWebAppShowInFields(app, web_app); + + // Get the intent filters for PWAs. + PopulateWebAppIntentFilters(*web_app, app->intent_filters); + + return app; +} + +webapps::WebappUninstallSource ConvertUninstallSourceToWebAppUninstallSource( + apps::mojom::UninstallSource uninstall_source) { + switch (uninstall_source) { + case apps::mojom::UninstallSource::kAppList: + return webapps::WebappUninstallSource::kAppList; + case apps::mojom::UninstallSource::kAppManagement: + return webapps::WebappUninstallSource::kAppManagement; + case apps::mojom::UninstallSource::kShelf: + return webapps::WebappUninstallSource::kShelf; + case apps::mojom::UninstallSource::kMigration: + return webapps::WebappUninstallSource::kMigration; + case apps::mojom::UninstallSource::kUnknown: + return webapps::WebappUninstallSource::kUnknown; + } +} + +} // namespace apps_util
diff --git a/chrome/browser/apps/app_service/web_apps_utils.h b/chrome/browser/apps/app_service/web_apps_utils.h new file mode 100644 index 0000000..df18567 --- /dev/null +++ b/chrome/browser/apps/app_service/web_apps_utils.h
@@ -0,0 +1,46 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_APPS_APP_SERVICE_WEB_APPS_UTILS_H_ +#define CHROME_BROWSER_APPS_APP_SERVICE_WEB_APPS_UTILS_H_ + +#include <vector> + +#include "components/content_settings/core/common/content_settings_types.h" +#include "components/services/app_service/public/mojom/types.mojom.h" +#include "components/webapps/browser/installable/installable_metrics.h" + +class Profile; + +namespace web_app { +class WebApp; +} // namespace web_app + +namespace apps_util { + +// Indicates if |permission_type| is supported by Web Applications. +bool IsSupportedWebAppPermissionType(ContentSettingsType permission_type); + +// Populates the various show_in_* fields of |app|. +void SetWebAppShowInFields(apps::mojom::AppPtr& app, + const web_app::WebApp* web_app); + +// Appends |web_app| permissions to |target|. +void PopulateWebAppPermissions(Profile* profile, + const web_app::WebApp* web_app, + std::vector<apps::mojom::PermissionPtr>* target); + +// Creates an |apps::mojom::App| describing |web_app|. +apps::mojom::AppPtr ConvertWebApp(Profile* profile, + const web_app::WebApp* web_app, + apps::mojom::AppType app_type, + apps::mojom::Readiness readiness); + +// Converts |uninstall_source| to a |WebappUninstallSource|. +webapps::WebappUninstallSource ConvertUninstallSourceToWebAppUninstallSource( + apps::mojom::UninstallSource uninstall_source); + +} // namespace apps_util + +#endif // CHROME_BROWSER_APPS_APP_SERVICE_WEB_APPS_UTILS_H_
diff --git a/chrome/browser/apps/app_shim/web_app_shim_manager_delegate_mac_unittest.cc b/chrome/browser/apps/app_shim/web_app_shim_manager_delegate_mac_unittest.cc index c3e0654..363690f 100644 --- a/chrome/browser/apps/app_shim/web_app_shim_manager_delegate_mac_unittest.cc +++ b/chrome/browser/apps/app_shim/web_app_shim_manager_delegate_mac_unittest.cc
@@ -15,7 +15,6 @@ #include "chrome/browser/web_applications/test/web_app_install_test_utils.h" #include "chrome/browser/web_applications/test/web_app_test.h" #include "chrome/browser/web_applications/web_app.h" -#include "chrome/browser/web_applications/web_app_migration_manager.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -86,9 +85,9 @@ auto* provider = web_app::TestWebAppProvider::Get(profile()); - // Migration manager won't complete initialization due to using a test - // extensions system that is never started. Not needed so just disable it. - provider->SetMigrationManager(nullptr); + // TestWebAppProvider should not wait for a test extension system, that is + // never started, to be ready. + provider->SkipAwaitingExtensionSystem(); web_app::test::AwaitStartWebAppProviderAndSubsystems(profile()); // Install a dummy app
diff --git a/chrome/browser/ash/arc/session/adb_sideloading_availability_delegate_impl.cc b/chrome/browser/ash/arc/session/adb_sideloading_availability_delegate_impl.cc index b26018c9..b34d57e5 100644 --- a/chrome/browser/ash/arc/session/adb_sideloading_availability_delegate_impl.cc +++ b/chrome/browser/ash/arc/session/adb_sideloading_availability_delegate_impl.cc
@@ -4,7 +4,7 @@ #include "chrome/browser/ash/arc/session/adb_sideloading_availability_delegate_impl.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_features.h" namespace arc {
diff --git a/chrome/browser/ash/arc/tracing/arc_value_event_trimmer.h b/chrome/browser/ash/arc/tracing/arc_value_event_trimmer.h index cd10b06..6954fed 100644 --- a/chrome/browser/ash/arc/tracing/arc_value_event_trimmer.h +++ b/chrome/browser/ash/arc/tracing/arc_value_event_trimmer.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_ASH_ARC_TRACING_ARC_VALUE_EVENT_TRIMMER_H_ #define CHROME_BROWSER_ASH_ARC_TRACING_ARC_VALUE_EVENT_TRIMMER_H_ -#include "base/values.h" #include "chrome/browser/ash/arc/tracing/arc_value_event.h" namespace arc {
diff --git a/chrome/browser/ash/borealis/borealis_app_launcher_unittest.cc b/chrome/browser/ash/borealis/borealis_app_launcher_unittest.cc index 0b05d93..3fd8e47 100644 --- a/chrome/browser/ash/borealis/borealis_app_launcher_unittest.cc +++ b/chrome/browser/ash/borealis/borealis_app_launcher_unittest.cc
@@ -15,6 +15,7 @@ #include "chrome/test/base/testing_profile.h" #include "chromeos/dbus/cicerone/fake_cicerone_client.h" #include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/dbus/vm_applications/apps.pb.h" #include "content/public/test/browser_task_environment.h" #include "testing/gmock/include/gmock/gmock.h" @@ -34,9 +35,15 @@ class ScopedCiceroneFake { public: - ScopedCiceroneFake() { chromeos::DBusThreadManager::Initialize(); } + ScopedCiceroneFake() { + chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); + } - ~ScopedCiceroneFake() { chromeos::DBusThreadManager::Shutdown(); } + ~ScopedCiceroneFake() { + chromeos::SeneschalClient::Shutdown(); + chromeos::DBusThreadManager::Shutdown(); + } chromeos::FakeCiceroneClient* Get() { return reinterpret_cast<chromeos::FakeCiceroneClient*>(
diff --git a/chrome/browser/ash/borealis/borealis_context_manager_unittest.cc b/chrome/browser/ash/borealis/borealis_context_manager_unittest.cc index 480b324..a6267df 100644 --- a/chrome/browser/ash/borealis/borealis_context_manager_unittest.cc +++ b/chrome/browser/ash/borealis/borealis_context_manager_unittest.cc
@@ -21,6 +21,7 @@ #include "chromeos/dbus/concierge/concierge_service.pb.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/fake_concierge_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "components/user_manager/scoped_user_manager.h" #include "content/public/test/browser_task_environment.h" #include "testing/gmock/include/gmock/gmock.h" @@ -102,10 +103,12 @@ void SetUp() override { CreateProfile(); chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); histogram_tester_ = std::make_unique<base::HistogramTester>(); } void TearDown() override { + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); profile_.reset(); histogram_tester_.reset();
diff --git a/chrome/browser/ash/borealis/borealis_context_unittest.cc b/chrome/browser/ash/borealis/borealis_context_unittest.cc index a3c471d8..d1a207b 100644 --- a/chrome/browser/ash/borealis/borealis_context_unittest.cc +++ b/chrome/browser/ash/borealis/borealis_context_unittest.cc
@@ -20,6 +20,7 @@ #include "chromeos/dbus/fake_chunneld_client.h" #include "chromeos/dbus/fake_concierge_client.h" #include "chromeos/dbus/seneschal/fake_seneschal_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "content/public/test/browser_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" @@ -29,6 +30,7 @@ public: BorealisContextTest() { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); profile_ = std::make_unique<TestingProfile>(); borealis_shutdown_monitor_ = @@ -55,6 +57,7 @@ ~BorealisContextTest() override { borealis_context_.reset(); // must destroy before DBusThreadManager + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); } @@ -110,8 +113,7 @@ } TEST_F(BorealisContextTest, SeneschalFailure) { - auto* seneschal_client = static_cast<chromeos::FakeSeneschalClient*>( - chromeos::DBusThreadManager::Get()->GetSeneschalClient()); + auto* seneschal_client = chromeos::FakeSeneschalClient::Get(); seneschal_client->NotifySeneschalStopped(); histogram_tester_.ExpectUniqueSample(
diff --git a/chrome/browser/ash/borealis/borealis_task_unittest.cc b/chrome/browser/ash/borealis/borealis_task_unittest.cc index 3a4d59ab..e37d81c 100644 --- a/chrome/browser/ash/borealis/borealis_task_unittest.cc +++ b/chrome/browser/ash/borealis/borealis_task_unittest.cc
@@ -15,6 +15,7 @@ #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/dlcservice/fake_dlcservice_client.h" #include "chromeos/dbus/fake_concierge_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "content/public/test/browser_task_environment.h" #include "testing/gmock/include/gmock/gmock.h" @@ -47,6 +48,7 @@ protected: void SetUp() override { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); fake_concierge_client_ = static_cast<chromeos::FakeConciergeClient*>( chromeos::DBusThreadManager::Get()->GetConciergeClient()); fake_cicerone_client_ = static_cast<chromeos::FakeCiceroneClient*>( @@ -65,6 +67,7 @@ profile_.reset(); chromeos::DlcserviceClient::Shutdown(); + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); }
diff --git a/chrome/browser/ash/borealis/borealis_window_manager.cc b/chrome/browser/ash/borealis/borealis_window_manager.cc index 3a0eaf3..23b0026 100644 --- a/chrome/browser/ash/borealis/borealis_window_manager.cc +++ b/chrome/browser/ash/borealis/borealis_window_manager.cc
@@ -52,12 +52,6 @@ return kBorealisAnonymousPrefix + *GetWindowId(window); } -// Returns a name for the app with the given |anon_id|. -std::string AnonymousIdentifierToName(const std::string& anon_id) { - return anon_id.substr(anon_id.find(kBorealisWindowPrefix) + - sizeof(kBorealisWindowPrefix) - 1); -} - bool IsAnonymousAppId(const std::string& app_id) { return base::StartsWith(app_id, kBorealisAnonymousPrefix, base::CompareCase::SENSITIVE); @@ -184,9 +178,9 @@ for (auto& observer : lifetime_observers_) observer.OnAppStarted(app_id); if (IsAnonymousAppId(app_id)) { - std::string anon_name = AnonymousIdentifierToName(app_id); for (auto& observer : anon_observers_) - observer.OnAnonymousAppAdded(app_id, anon_name); + observer.OnAnonymousAppAdded(app_id, + base::UTF16ToUTF8(window->GetTitle())); } } // If this window was not already in the set, notify our observers about it.
diff --git a/chrome/browser/ash/crostini/ansible/ansible_management_service.cc b/chrome/browser/ash/crostini/ansible/ansible_management_service.cc index a28007e..2b2827d 100644 --- a/chrome/browser/ash/crostini/ansible/ansible_management_service.cc +++ b/chrome/browser/ash/crostini/ansible/ansible_management_service.cc
@@ -11,8 +11,8 @@ #include "base/task/task_traits.h" #include "base/task/thread_pool.h" #include "chrome/browser/ash/crostini/ansible/ansible_management_service_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_manager_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" +#include "chrome/browser/ash/crostini/crostini_manager_factory.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/profiles/profile.h" #include "chromeos/dbus/dbus_thread_manager.h"
diff --git a/chrome/browser/ash/crostini/ansible/ansible_management_service.h b/chrome/browser/ash/crostini/ansible/ansible_management_service.h index e16fb5c4..6a9cac8 100644 --- a/chrome/browser/ash/crostini/ansible/ansible_management_service.h +++ b/chrome/browser/ash/crostini/ansible/ansible_management_service.h
@@ -8,7 +8,7 @@ #include <string> #include "base/callback.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "components/keyed_service/core/keyed_service.h" class Profile;
diff --git a/chrome/browser/ash/crostini/ansible/ansible_management_service_unittest.cc b/chrome/browser/ash/crostini/ansible/ansible_management_service_unittest.cc index a939e045..73373aa 100644 --- a/chrome/browser/ash/crostini/ansible/ansible_management_service_unittest.cc +++ b/chrome/browser/ash/crostini/ansible/ansible_management_service_unittest.cc
@@ -9,6 +9,7 @@ #include "chrome/browser/chromeos/crostini/crostini_test_util.h" #include "chrome/test/base/testing_profile.h" #include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "content/public/test/browser_task_environment.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -19,6 +20,7 @@ public: AnsibleManagementServiceTest() { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); profile_ = std::make_unique<TestingProfile>(); crostini_manager_ = CrostiniManager::GetForProfile(profile_.get()); ansible_management_service_ = @@ -40,6 +42,7 @@ ansible_management_service_->Shutdown(); crostini_manager_->Shutdown(); profile_.reset(); + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); }
diff --git a/chrome/browser/ash/crostini/ansible/ansible_management_test_helper.cc b/chrome/browser/ash/crostini/ansible/ansible_management_test_helper.cc index 90638f9..c29a5d6 100644 --- a/chrome/browser/ash/crostini/ansible/ansible_management_test_helper.cc +++ b/chrome/browser/ash/crostini/ansible/ansible_management_test_helper.cc
@@ -5,7 +5,7 @@ #include "chrome/browser/ash/crostini/ansible/ansible_management_test_helper.h" #include "base/files/file_util.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_features.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_browser_test_util.cc b/chrome/browser/ash/crostini/crostini_browser_test_util.cc similarity index 97% rename from chrome/browser/chromeos/crostini/crostini_browser_test_util.cc rename to chrome/browser/ash/crostini/crostini_browser_test_util.cc index 716a945..79aaf96 100644 --- a/chrome/browser/chromeos/crostini/crostini_browser_test_util.cc +++ b/chrome/browser/ash/crostini/crostini_browser_test_util.cc
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_browser_test_util.h" +#include "chrome/browser/ash/crostini/crostini_browser_test_util.h" #include <utility> #include "base/memory/ptr_util.h" #include "base/path_service.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_browser_main.h" #include "chrome/browser/chrome_browser_main_extra_parts.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/crostini/fake_crostini_features.h" #include "chrome/browser/component_updater/fake_cros_component_manager.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_browser_test_util.h b/chrome/browser/ash/crostini/crostini_browser_test_util.h similarity index 89% rename from chrome/browser/chromeos/crostini/crostini_browser_test_util.h rename to chrome/browser/ash/crostini/crostini_browser_test_util.h index 7bd1b49..606b6aa 100644 --- a/chrome/browser/chromeos/crostini/crostini_browser_test_util.h +++ b/chrome/browser/ash/crostini/crostini_browser_test_util.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_BROWSER_TEST_UTIL_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_BROWSER_TEST_UTIL_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_BROWSER_TEST_UTIL_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_BROWSER_TEST_UTIL_H_ #include <memory> @@ -55,4 +55,4 @@ DISALLOW_COPY_AND_ASSIGN(CrostiniBrowserTestBase); }; -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_BROWSER_TEST_UTIL_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_BROWSER_TEST_UTIL_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_browsertest.cc b/chrome/browser/ash/crostini/crostini_browsertest.cc similarity index 97% rename from chrome/browser/chromeos/crostini/crostini_browsertest.cc rename to chrome/browser/ash/crostini/crostini_browsertest.cc index f0186eec..21ce399c 100644 --- a/chrome/browser/chromeos/crostini/crostini_browsertest.cc +++ b/chrome/browser/ash/crostini/crostini_browsertest.cc
@@ -6,9 +6,9 @@ #include "base/callback.h" #include "base/run_loop.h" #include "base/test/scoped_feature_list.h" +#include "chrome/browser/ash/crostini/crostini_browser_test_util.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_browser_test_util.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/crostini/fake_crostini_features.h" #include "chrome/browser/ui/browser.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_disk.cc b/chrome/browser/ash/crostini/crostini_disk.cc similarity index 98% rename from chrome/browser/chromeos/crostini/crostini_disk.cc rename to chrome/browser/ash/crostini/crostini_disk.cc index 1165666c..877270e551 100644 --- a/chrome/browser/chromeos/crostini/crostini_disk.cc +++ b/chrome/browser/ash/crostini/crostini_disk.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_disk.h" +#include "chrome/browser/ash/crostini/crostini_disk.h" #include <algorithm> #include <cmath> @@ -14,8 +14,8 @@ #include "base/system/sys_info.h" #include "base/task/post_task.h" #include "base/task/thread_pool.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_simple_types.h" #include "chrome/browser/chromeos/crostini/crostini_types.mojom.h" #include "chromeos/dbus/concierge/concierge_service.pb.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_disk.h b/chrome/browser/ash/crostini/crostini_disk.h similarity index 96% rename from chrome/browser/chromeos/crostini/crostini_disk.h rename to chrome/browser/ash/crostini/crostini_disk.h index 1316111..fc21b07 100644 --- a/chrome/browser/chromeos/crostini/crostini_disk.h +++ b/chrome/browser/ash/crostini/crostini_disk.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_DISK_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_DISK_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_DISK_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_DISK_H_ #include <memory> #include <string> @@ -129,4 +129,4 @@ } // namespace disk } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_DISK_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_DISK_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_disk_unittest.cc b/chrome/browser/ash/crostini/crostini_disk_unittest.cc similarity index 97% rename from chrome/browser/chromeos/crostini/crostini_disk_unittest.cc rename to chrome/browser/ash/crostini/crostini_disk_unittest.cc index 26c5b3a6..4311a23 100644 --- a/chrome/browser/chromeos/crostini/crostini_disk_unittest.cc +++ b/chrome/browser/ash/crostini/crostini_disk_unittest.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_disk.h" +#include "chrome/browser/ash/crostini/crostini_disk.h" #include <memory> #include <utility> #include "base/test/bind.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_test_helper.h" #include "chrome/browser/chromeos/crostini/crostini_types.mojom.h" #include "chrome/test/base/testing_browser_process.h" @@ -16,6 +16,7 @@ #include "chromeos/dbus/concierge/concierge_service.pb.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/fake_concierge_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "content/public/test/browser_task_environment.h" #include "testing/gmock/include/gmock/gmock-matchers.h" #include "testing/gtest/include/gtest/gtest.h" @@ -52,6 +53,7 @@ public: CrostiniDiskTestDbus() { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); fake_concierge_client_ = static_cast<chromeos::FakeConciergeClient*>( chromeos::DBusThreadManager::Get()->GetConciergeClient()); } @@ -66,6 +68,7 @@ void TearDown() override { test_helper_.reset(); profile_.reset(); + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); }
diff --git a/chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.cc b/chrome/browser/ash/crostini/crostini_engagement_metrics_service.cc similarity index 92% rename from chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.cc rename to chrome/browser/ash/crostini/crostini_engagement_metrics_service.cc index fb6fee20..800424b 100644 --- a/chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.cc +++ b/chrome/browser/ash/crostini/crostini_engagement_metrics_service.cc
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.h" +#include "chrome/browser/ash/crostini/crostini_engagement_metrics_service.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.h b/chrome/browser/ash/crostini/crostini_engagement_metrics_service.h similarity index 87% rename from chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.h rename to chrome/browser/ash/crostini/crostini_engagement_metrics_service.h index 7878d5e..ebc10e4e 100644 --- a/chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.h +++ b/chrome/browser/ash/crostini/crostini_engagement_metrics_service.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_ENGAGEMENT_METRICS_SERVICE_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_ENGAGEMENT_METRICS_SERVICE_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_ENGAGEMENT_METRICS_SERVICE_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_ENGAGEMENT_METRICS_SERVICE_H_ #include "base/macros.h" #include "base/no_destructor.h" @@ -53,4 +53,4 @@ } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_ENGAGEMENT_METRICS_SERVICE_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_ENGAGEMENT_METRICS_SERVICE_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_export_import.cc b/chrome/browser/ash/crostini/crostini_export_import.cc similarity index 98% rename from chrome/browser/chromeos/crostini/crostini_export_import.cc rename to chrome/browser/ash/crostini/crostini_export_import.cc index 2bc11b75..02f8dec 100644 --- a/chrome/browser/chromeos/crostini/crostini_export_import.cc +++ b/chrome/browser/ash/crostini/crostini_export_import.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_export_import.h" +#include "chrome/browser/ash/crostini/crostini_export_import.h" #include <utility> @@ -15,10 +15,10 @@ #include "base/task/post_task.h" #include "base/task/thread_pool.h" #include "base/time/time.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_manager_factory.h" #include "chrome/browser/ash/guest_os/guest_os_share_path.h" #include "chrome/browser/ash/guest_os/guest_os_share_path_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_manager_factory.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/file_manager/path_util.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_export_import.h b/chrome/browser/ash/crostini/crostini_export_import.h similarity index 96% rename from chrome/browser/chromeos/crostini/crostini_export_import.h rename to chrome/browser/ash/crostini/crostini_export_import.h index a442663..7e7dcdf 100644 --- a/chrome/browser/chromeos/crostini/crostini_export_import.h +++ b/chrome/browser/ash/crostini/crostini_export_import.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_EXPORT_IMPORT_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_EXPORT_IMPORT_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_EXPORT_IMPORT_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_EXPORT_IMPORT_H_ #include <map> #include <memory> @@ -13,8 +13,8 @@ #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" -#include "chrome/browser/chromeos/crostini/crostini_export_import_notification_controller.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_export_import_notification_controller.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "components/keyed_service/core/keyed_service.h" class Profile; @@ -255,4 +255,4 @@ } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_EXPORT_IMPORT_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_EXPORT_IMPORT_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_export_import_notification_controller.cc b/chrome/browser/ash/crostini/crostini_export_import_notification_controller.cc similarity index 97% rename from chrome/browser/chromeos/crostini/crostini_export_import_notification_controller.cc rename to chrome/browser/ash/crostini/crostini_export_import_notification_controller.cc index c12c321..5cdea04 100644 --- a/chrome/browser/chromeos/crostini/crostini_export_import_notification_controller.cc +++ b/chrome/browser/ash/crostini/crostini_export_import_notification_controller.cc
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_export_import_notification_controller.h" +#include "chrome/browser/ash/crostini/crostini_export_import_notification_controller.h" #include "ash/public/cpp/notification_utils.h" #include "base/strings/utf_string_conversions.h" #include "chrome/app/vector_icons/vector_icons.h" -#include "chrome/browser/chromeos/crostini/crostini_export_import.h" +#include "chrome/browser/ash/crostini/crostini_export_import.h" #include "chrome/browser/notifications/notification_display_service.h" #include "chrome/browser/platform_util.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_export_import_notification_controller.h b/chrome/browser/ash/crostini/crostini_export_import_notification_controller.h similarity index 90% rename from chrome/browser/chromeos/crostini/crostini_export_import_notification_controller.h rename to chrome/browser/ash/crostini/crostini_export_import_notification_controller.h index 22c3a93f..9a66d6d 100644 --- a/chrome/browser/chromeos/crostini/crostini_export_import_notification_controller.h +++ b/chrome/browser/ash/crostini/crostini_export_import_notification_controller.h
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_EXPORT_IMPORT_NOTIFICATION_CONTROLLER_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_EXPORT_IMPORT_NOTIFICATION_CONTROLLER_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_EXPORT_IMPORT_NOTIFICATION_CONTROLLER_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_EXPORT_IMPORT_NOTIFICATION_CONTROLLER_H_ #include <memory> #include <string> #include "base/memory/weak_ptr.h" #include "base/time/time.h" -#include "chrome/browser/chromeos/crostini/crostini_export_import_status_tracker.h" +#include "chrome/browser/ash/crostini/crostini_export_import_status_tracker.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "ui/message_center/public/cpp/notification_delegate.h" @@ -105,4 +105,4 @@ } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_EXPORT_IMPORT_NOTIFICATION_CONTROLLER_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_EXPORT_IMPORT_NOTIFICATION_CONTROLLER_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_export_import_status_tracker.cc b/chrome/browser/ash/crostini/crostini_export_import_status_tracker.cc similarity index 95% rename from chrome/browser/chromeos/crostini/crostini_export_import_status_tracker.cc rename to chrome/browser/ash/crostini/crostini_export_import_status_tracker.cc index 9ef2d8bc..665f2a11 100644 --- a/chrome/browser/chromeos/crostini/crostini_export_import_status_tracker.cc +++ b/chrome/browser/ash/crostini/crostini_export_import_status_tracker.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_export_import_status_tracker.h" +#include "chrome/browser/ash/crostini/crostini_export_import_status_tracker.h" #include "base/check.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chromeos/crostini/crostini_export_import.h" +#include "chrome/browser/ash/crostini/crostini_export_import.h" #include "chrome/grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/text/bytes_formatting.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_export_import_status_tracker.h b/chrome/browser/ash/crostini/crostini_export_import_status_tracker.h similarity index 89% rename from chrome/browser/chromeos/crostini/crostini_export_import_status_tracker.h rename to chrome/browser/ash/crostini/crostini_export_import_status_tracker.h index 13e1b64a..28e1665a 100644 --- a/chrome/browser/chromeos/crostini/crostini_export_import_status_tracker.h +++ b/chrome/browser/ash/crostini/crostini_export_import_status_tracker.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_EXPORT_IMPORT_STATUS_TRACKER_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_EXPORT_IMPORT_STATUS_TRACKER_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_EXPORT_IMPORT_STATUS_TRACKER_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_EXPORT_IMPORT_STATUS_TRACKER_H_ #include <memory> #include <string> @@ -59,6 +59,7 @@ void SetStatusFailedInsufficientSpace(uint64_t additional_required_space); void SetStatusFailedConcurrentOperation( ExportImportType in_progress_operation_type); + private: void SetStatusFailedWithMessage(Status status, const std::u16string& message); @@ -69,4 +70,4 @@ } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_EXPORT_IMPORT_STATUS_TRACKER_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_EXPORT_IMPORT_STATUS_TRACKER_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_export_import_unittest.cc b/chrome/browser/ash/crostini/crostini_export_import_unittest.cc similarity index 98% rename from chrome/browser/chromeos/crostini/crostini_export_import_unittest.cc rename to chrome/browser/ash/crostini/crostini_export_import_unittest.cc index 6a227f01..814d381 100644 --- a/chrome/browser/chromeos/crostini/crostini_export_import_unittest.cc +++ b/chrome/browser/ash/crostini/crostini_export_import_unittest.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_export_import.h" +#include "chrome/browser/ash/crostini/crostini_export_import.h" #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/guest_os/guest_os_share_path.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_test_helper.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/file_manager/path_util.h" @@ -18,6 +18,7 @@ #include "chromeos/dbus/cicerone/fake_cicerone_client.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/seneschal/fake_seneschal_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/dbus/seneschal/seneschal_service.pb.h" #include "components/prefs/pref_service.h" #include "content/public/test/browser_task_environment.h" @@ -120,13 +121,14 @@ CrostiniExportImportTest() : container_id_(kCrostiniDefaultVmName, kCrostiniDefaultContainerName) { chromeos::DBusThreadManager::Initialize(); - fake_seneschal_client_ = static_cast<chromeos::FakeSeneschalClient*>( - chromeos::DBusThreadManager::Get()->GetSeneschalClient()); + chromeos::SeneschalClient::InitializeFake(); + fake_seneschal_client_ = chromeos::FakeSeneschalClient::Get(); fake_cicerone_client_ = static_cast<chromeos::FakeCiceroneClient*>( chromeos::DBusThreadManager::Get()->GetCiceroneClient()); } ~CrostiniExportImportTest() override { + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); }
diff --git a/chrome/browser/chromeos/crostini/crostini_features.cc b/chrome/browser/ash/crostini/crostini_features.cc similarity index 98% rename from chrome/browser/chromeos/crostini/crostini_features.cc rename to chrome/browser/ash/crostini/crostini_features.cc index 739df15..bd81fea 100644 --- a/chrome/browser/chromeos/crostini/crostini_features.cc +++ b/chrome/browser/ash/crostini/crostini_features.cc
@@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_features.h" #include "ash/constants/ash_features.h" #include "ash/constants/ash_switches.h" #include "base/feature_list.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/guest_os/virtual_machines/virtual_machines_util.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/ash/settings/cros_settings.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/policy/profile_policy_connector.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_features.h b/chrome/browser/ash/crostini/crostini_features.h similarity index 94% rename from chrome/browser/chromeos/crostini/crostini_features.h rename to chrome/browser/ash/crostini/crostini_features.h index 5c43d71..769671f 100644 --- a/chrome/browser/chromeos/crostini/crostini_features.h +++ b/chrome/browser/ash/crostini/crostini_features.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_FEATURES_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_FEATURES_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_FEATURES_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_FEATURES_H_ #include <string> @@ -94,4 +94,4 @@ } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_FEATURES_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_FEATURES_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_features_unittest.cc b/chrome/browser/ash/crostini/crostini_features_unittest.cc similarity index 98% rename from chrome/browser/chromeos/crostini/crostini_features_unittest.cc rename to chrome/browser/ash/crostini/crostini_features_unittest.cc index 242c10f3..5a351575 100644 --- a/chrome/browser/chromeos/crostini/crostini_features_unittest.cc +++ b/chrome/browser/ash/crostini/crostini_features_unittest.cc
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_features.h" #include "ash/constants/ash_features.h" #include "base/callback.h" #include "base/test/bind.h" #include "base/test/scoped_feature_list.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/login/users/fake_chrome_user_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/fake_crostini_features.h" #include "chrome/browser/policy/profile_policy_connector.h" #include "chrome/common/chrome_features.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_force_close_watcher.cc b/chrome/browser/ash/crostini/crostini_force_close_watcher.cc similarity index 97% rename from chrome/browser/chromeos/crostini/crostini_force_close_watcher.cc rename to chrome/browser/ash/crostini/crostini_force_close_watcher.cc index f0ffbf0..9e836d9 100644 --- a/chrome/browser/chromeos/crostini/crostini_force_close_watcher.cc +++ b/chrome/browser/ash/crostini/crostini_force_close_watcher.cc
@@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_force_close_watcher.h" +#include "chrome/browser/ash/crostini/crostini_force_close_watcher.h" + #include <memory> #include "base/bind.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_force_close_watcher.h b/chrome/browser/ash/crostini/crostini_force_close_watcher.h similarity index 95% rename from chrome/browser/chromeos/crostini/crostini_force_close_watcher.h rename to chrome/browser/ash/crostini/crostini_force_close_watcher.h index f7d8c5cc..4cff5d1 100644 --- a/chrome/browser/chromeos/crostini/crostini_force_close_watcher.h +++ b/chrome/browser/ash/crostini/crostini_force_close_watcher.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_FORCE_CLOSE_WATCHER_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_FORCE_CLOSE_WATCHER_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_FORCE_CLOSE_WATCHER_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_FORCE_CLOSE_WATCHER_H_ #include <memory> #include <string> @@ -135,4 +135,4 @@ } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_FORCE_CLOSE_WATCHER_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_FORCE_CLOSE_WATCHER_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_force_close_watcher_unittest.cc b/chrome/browser/ash/crostini/crostini_force_close_watcher_unittest.cc similarity index 97% rename from chrome/browser/chromeos/crostini/crostini_force_close_watcher_unittest.cc rename to chrome/browser/ash/crostini/crostini_force_close_watcher_unittest.cc index 0090bde..5edf59f 100644 --- a/chrome/browser/chromeos/crostini/crostini_force_close_watcher_unittest.cc +++ b/chrome/browser/ash/crostini/crostini_force_close_watcher_unittest.cc
@@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_force_close_watcher.h" +#include "chrome/browser/ash/crostini/crostini_force_close_watcher.h" + #include <memory> #include <type_traits>
diff --git a/chrome/browser/chromeos/crostini/crostini_installer.cc b/chrome/browser/ash/crostini/crostini_installer.cc similarity index 98% rename from chrome/browser/chromeos/crostini/crostini_installer.cc rename to chrome/browser/ash/crostini/crostini_installer.cc index fc3c73a..04223486 100644 --- a/chrome/browser/chromeos/crostini/crostini_installer.cc +++ b/chrome/browser/ash/crostini/crostini_installer.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_installer.h" +#include "chrome/browser/ash/crostini/crostini_installer.h" #include <string> @@ -16,11 +16,11 @@ #include "base/task/thread_pool.h" #include "base/time/time.h" #include "chrome/browser/ash/crostini/ansible/ansible_management_service_factory.h" +#include "chrome/browser/ash/crostini/crostini_disk.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_manager_factory.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/login/startup_utils.h" -#include "chrome/browser/chromeos/crostini/crostini_disk.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_manager_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_terminal.h" #include "chrome/browser/chromeos/crostini/crostini_types.mojom.h" #include "chrome/browser/chromeos/crostini/crostini_util.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_installer.h b/chrome/browser/ash/crostini/crostini_installer.h similarity index 94% rename from chrome/browser/chromeos/crostini/crostini_installer.h rename to chrome/browser/ash/crostini/crostini_installer.h index 853f5c9..2028f93 100644 --- a/chrome/browser/chromeos/crostini/crostini_installer.h +++ b/chrome/browser/ash/crostini/crostini_installer.h
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_INSTALLER_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_INSTALLER_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_INSTALLER_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_INSTALLER_H_ #include "base/callback_forward.h" #include "base/macros.h" #include "base/scoped_observation.h" #include "chrome/browser/ash/crostini/ansible/ansible_management_service.h" -#include "chrome/browser/chromeos/crostini/crostini_installer_ui_delegate.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_installer_ui_delegate.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_types.mojom-forward.h" #include "components/keyed_service/core/keyed_service.h" @@ -174,4 +174,4 @@ } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_INSTALLER_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_INSTALLER_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_installer_ui_delegate.h b/chrome/browser/ash/crostini/crostini_installer_ui_delegate.h similarity index 83% rename from chrome/browser/chromeos/crostini/crostini_installer_ui_delegate.h rename to chrome/browser/ash/crostini/crostini_installer_ui_delegate.h index cb7d09b..79b66231 100644 --- a/chrome/browser/chromeos/crostini/crostini_installer_ui_delegate.h +++ b/chrome/browser/ash/crostini/crostini_installer_ui_delegate.h
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_INSTALLER_UI_DELEGATE_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_INSTALLER_UI_DELEGATE_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_INSTALLER_UI_DELEGATE_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_INSTALLER_UI_DELEGATE_H_ #include "base/callback_forward.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_types.mojom-forward.h" namespace crostini { @@ -39,4 +39,4 @@ } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_INSTALLER_UI_DELEGATE_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_INSTALLER_UI_DELEGATE_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_installer_unittest.cc b/chrome/browser/ash/crostini/crostini_installer_unittest.cc similarity index 97% rename from chrome/browser/chromeos/crostini/crostini_installer_unittest.cc rename to chrome/browser/ash/crostini/crostini_installer_unittest.cc index 2e0d5aa3..b8b49aef 100644 --- a/chrome/browser/chromeos/crostini/crostini_installer_unittest.cc +++ b/chrome/browser/ash/crostini/crostini_installer_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_installer.h" +#include "chrome/browser/ash/crostini/crostini_installer.h" #include "base/bind.h" #include "base/callback_helpers.h" @@ -14,7 +14,7 @@ #include "base/test/metrics/histogram_tester.h" #include "base/test/task_environment.h" #include "chrome/browser/ash/crostini/ansible/ansible_management_test_helper.h" -#include "chrome/browser/chromeos/crostini/crostini_installer_ui_delegate.h" +#include "chrome/browser/ash/crostini/crostini_installer_ui_delegate.h" #include "chrome/browser/chromeos/crostini/crostini_test_helper.h" #include "chrome/browser/chromeos/crostini/crostini_types.mojom.h" #include "chrome/browser/component_updater/fake_cros_component_manager.h" @@ -26,6 +26,7 @@ #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/dlcservice/dlcservice_client.h" #include "chromeos/dbus/fake_concierge_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/disks/disk_mount_manager.h" #include "chromeos/disks/mock_disk_mount_manager.h" #include "content/public/test/browser_task_environment.h" @@ -104,6 +105,7 @@ waiting_fake_concierge_client_ = new WaitingFakeConciergeClient; chromeos::DBusThreadManager::GetSetterForTesting()->SetConciergeClient( base::WrapUnique(waiting_fake_concierge_client_)); + chromeos::SeneschalClient::InitializeFake(); disk_mount_manager_mock_ = new chromeos::disks::MockDiskMountManager; chromeos::disks::DiskMountManager::InitializeForTesting( @@ -130,6 +132,7 @@ profile_.reset(); chromeos::disks::MockDiskMountManager::Shutdown(); + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); chromeos::DlcserviceClient::Shutdown();
diff --git a/chrome/browser/chromeos/crostini/crostini_low_disk_notification.cc b/chrome/browser/ash/crostini/crostini_low_disk_notification.cc similarity index 98% rename from chrome/browser/chromeos/crostini/crostini_low_disk_notification.cc rename to chrome/browser/ash/crostini/crostini_low_disk_notification.cc index 4782ec6..38a1284 100644 --- a/chrome/browser/chromeos/crostini/crostini_low_disk_notification.cc +++ b/chrome/browser/ash/crostini/crostini_low_disk_notification.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_low_disk_notification.h" +#include "chrome/browser/ash/crostini/crostini_low_disk_notification.h" #include <stdint.h>
diff --git a/chrome/browser/chromeos/crostini/crostini_low_disk_notification.h b/chrome/browser/ash/crostini/crostini_low_disk_notification.h similarity index 91% rename from chrome/browser/chromeos/crostini/crostini_low_disk_notification.h rename to chrome/browser/ash/crostini/crostini_low_disk_notification.h index 9928de16..cc08e69 100644 --- a/chrome/browser/chromeos/crostini/crostini_low_disk_notification.h +++ b/chrome/browser/ash/crostini/crostini_low_disk_notification.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_LOW_DISK_NOTIFICATION_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_LOW_DISK_NOTIFICATION_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_LOW_DISK_NOTIFICATION_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_LOW_DISK_NOTIFICATION_H_ #include <stdint.h> @@ -72,4 +72,4 @@ } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_LOW_DISK_NOTIFICATION_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_LOW_DISK_NOTIFICATION_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_low_disk_notification_unittest.cc b/chrome/browser/ash/crostini/crostini_low_disk_notification_unittest.cc similarity index 96% rename from chrome/browser/chromeos/crostini/crostini_low_disk_notification_unittest.cc rename to chrome/browser/ash/crostini/crostini_low_disk_notification_unittest.cc index 0223976..1f153c4f 100644 --- a/chrome/browser/chromeos/crostini/crostini_low_disk_notification_unittest.cc +++ b/chrome/browser/ash/crostini/crostini_low_disk_notification_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_low_disk_notification.h" +#include "chrome/browser/ash/crostini/crostini_low_disk_notification.h" #include <stdint.h> @@ -20,6 +20,7 @@ #include "chrome/test/base/testing_profile_manager.h" #include "chromeos/dbus/cicerone/fake_cicerone_client.h" #include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/settings/cros_settings_names.h" #include "components/user_manager/fake_user_manager.h" #include "components/user_manager/scoped_user_manager.h" @@ -37,6 +38,7 @@ void SetUp() override { BrowserWithTestWindowTest::SetUp(); chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); GetCrosSettingsHelper()->ReplaceDeviceSettingsProviderWithStub(); GetCrosSettingsHelper()->SetBoolean( @@ -64,6 +66,7 @@ void TearDown() override { low_disk_notification_.reset(); + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); BrowserWithTestWindowTest::TearDown(); }
diff --git a/chrome/browser/chromeos/crostini/crostini_manager.cc b/chrome/browser/ash/crostini/crostini_manager.cc similarity index 99% rename from chrome/browser/chromeos/crostini/crostini_manager.cc rename to chrome/browser/ash/crostini/crostini_manager.cc index 28997a7..935cd41 100644 --- a/chrome/browser/chromeos/crostini/crostini_manager.cc +++ b/chrome/browser/ash/crostini/crostini_manager.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include <algorithm> #include <map> @@ -27,17 +27,17 @@ #include "base/time/time.h" #include "base/timer/timer.h" #include "chrome/browser/ash/crostini/ansible/ansible_management_service.h" +#include "chrome/browser/ash/crostini/crostini_engagement_metrics_service.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_manager_factory.h" +#include "chrome/browser/ash/crostini/crostini_port_forwarder.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/crostini/throttle/crostini_throttle.h" #include "chrome/browser/ash/guest_os/guest_os_share_path.h" #include "chrome/browser/ash/guest_os/guest_os_stability_monitor.h" #include "chrome/browser/ash/usb/cros_usb_detector.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" -#include "chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_manager_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_port_forwarder.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_remover.h" #include "chrome/browser/chromeos/crostini/crostini_reporting_util.h" #include "chrome/browser/chromeos/crostini/crostini_sshfs.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_manager.h b/chrome/browser/ash/crostini/crostini_manager.h similarity index 99% rename from chrome/browser/chromeos/crostini/crostini_manager.h rename to chrome/browser/ash/crostini/crostini_manager.h index b96c16f..c575ddb 100644 --- a/chrome/browser/chromeos/crostini/crostini_manager.h +++ b/chrome/browser/ash/crostini/crostini_manager.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_MANAGER_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_MANAGER_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_MANAGER_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_MANAGER_H_ #include <map> #include <string> @@ -16,7 +16,7 @@ #include "base/observer_list.h" #include "base/optional.h" #include "base/unguessable_token.h" -#include "chrome/browser/chromeos/crostini/crostini_low_disk_notification.h" +#include "chrome/browser/ash/crostini/crostini_low_disk_notification.h" #include "chrome/browser/chromeos/crostini/crostini_simple_types.h" #include "chrome/browser/chromeos/crostini/crostini_types.mojom-forward.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" @@ -936,4 +936,4 @@ } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_MANAGER_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_MANAGER_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_manager_factory.cc b/chrome/browser/ash/crostini/crostini_manager_factory.cc similarity index 89% rename from chrome/browser/chromeos/crostini/crostini_manager_factory.cc rename to chrome/browser/ash/crostini/crostini_manager_factory.cc index 238acf9..d670a174 100644 --- a/chrome/browser/chromeos/crostini/crostini_manager_factory.cc +++ b/chrome/browser/ash/crostini/crostini_manager_factory.cc
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_manager_factory.h" +#include "chrome/browser/ash/crostini/crostini_manager_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_manager_factory.h b/chrome/browser/ash/crostini/crostini_manager_factory.h similarity index 81% rename from chrome/browser/chromeos/crostini/crostini_manager_factory.h rename to chrome/browser/ash/crostini/crostini_manager_factory.h index 533b3a7..90a40ec 100644 --- a/chrome/browser/chromeos/crostini/crostini_manager_factory.h +++ b/chrome/browser/ash/crostini/crostini_manager_factory.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_MANAGER_FACTORY_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_MANAGER_FACTORY_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_MANAGER_FACTORY_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_MANAGER_FACTORY_H_ #include "base/macros.h" #include "base/no_destructor.h" @@ -35,4 +35,4 @@ } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_MANAGER_FACTORY_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_MANAGER_FACTORY_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_manager_unittest.cc b/chrome/browser/ash/crostini/crostini_manager_unittest.cc similarity index 99% rename from chrome/browser/chromeos/crostini/crostini_manager_unittest.cc rename to chrome/browser/ash/crostini/crostini_manager_unittest.cc index 005ac50..53691bf 100644 --- a/chrome/browser/chromeos/crostini/crostini_manager_unittest.cc +++ b/chrome/browser/ash/crostini/crostini_manager_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include <memory> @@ -19,9 +19,9 @@ #include "base/test/scoped_feature_list.h" #include "base/time/time.h" #include "chrome/browser/ash/crostini/ansible/ansible_management_test_helper.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/login/users/fake_chrome_user_manager.h" #include "chrome/browser/ash/settings/scoped_cros_settings_test_helper.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_test_util.h" #include "chrome/browser/chromeos/crostini/crostini_types.mojom-shared.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" @@ -41,6 +41,7 @@ #include "chromeos/dbus/dlcservice/dlcservice_client.h" #include "chromeos/dbus/fake_anomaly_detector_client.h" #include "chromeos/dbus/fake_concierge_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/dbus/session_manager/fake_session_manager_client.h" #include "chromeos/dbus/userdataauth/fake_cryptohome_misc_client.h" #include "chromeos/disks/mock_disk_mount_manager.h" @@ -188,6 +189,7 @@ TestingBrowserProcess::GetGlobal())), browser_part_(g_browser_process->platform_part()) { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); fake_cicerone_client_ = static_cast<chromeos::FakeCiceroneClient*>( chromeos::DBusThreadManager::Get()->GetCiceroneClient()); fake_concierge_client_ = static_cast<chromeos::FakeConciergeClient*>( @@ -197,7 +199,10 @@ chromeos::DBusThreadManager::Get()->GetAnomalyDetectorClient()); } - ~CrostiniManagerTest() override { chromeos::DBusThreadManager::Shutdown(); } + ~CrostiniManagerTest() override { + chromeos::SeneschalClient::Shutdown(); + chromeos::DBusThreadManager::Shutdown(); + } void SetUp() override { component_manager_ =
diff --git a/chrome/browser/chromeos/crostini/crostini_mime_types_service.cc b/chrome/browser/ash/crostini/crostini_mime_types_service.cc similarity index 97% rename from chrome/browser/chromeos/crostini/crostini_mime_types_service.cc rename to chrome/browser/ash/crostini/crostini_mime_types_service.cc index 44a8645..4a84657 100644 --- a/chrome/browser/chromeos/crostini/crostini_mime_types_service.cc +++ b/chrome/browser/ash/crostini/crostini_mime_types_service.cc
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_mime_types_service.h" +#include "chrome/browser/ash/crostini/crostini_mime_types_service.h" #include <map> #include <string> #include <vector> #include "base/logging.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/profiles/profile.h" #include "chromeos/dbus/vm_applications/apps.pb.h" #include "components/prefs/pref_registry_simple.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_mime_types_service.h b/chrome/browser/ash/crostini/crostini_mime_types_service.h similarity index 88% rename from chrome/browser/chromeos/crostini/crostini_mime_types_service.h rename to chrome/browser/ash/crostini/crostini_mime_types_service.h index 552e7c7e..39e74da 100644 --- a/chrome/browser/chromeos/crostini/crostini_mime_types_service.h +++ b/chrome/browser/ash/crostini/crostini_mime_types_service.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_MIME_TYPES_SERVICE_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_MIME_TYPES_SERVICE_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_MIME_TYPES_SERVICE_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_MIME_TYPES_SERVICE_H_ #include <string> @@ -55,4 +55,4 @@ } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_MIME_TYPES_SERVICE_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_MIME_TYPES_SERVICE_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_mime_types_service_factory.cc b/chrome/browser/ash/crostini/crostini_mime_types_service_factory.cc similarity index 88% rename from chrome/browser/chromeos/crostini/crostini_mime_types_service_factory.cc rename to chrome/browser/ash/crostini/crostini_mime_types_service_factory.cc index a8f16d8c..dfe47f98 100644 --- a/chrome/browser/chromeos/crostini/crostini_mime_types_service_factory.cc +++ b/chrome/browser/ash/crostini/crostini_mime_types_service_factory.cc
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_mime_types_service_factory.h" +#include "chrome/browser/ash/crostini/crostini_mime_types_service_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_mime_types_service.h" +#include "chrome/browser/ash/crostini/crostini_mime_types_service.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_mime_types_service_factory.h b/chrome/browser/ash/crostini/crostini_mime_types_service_factory.h similarity index 80% rename from chrome/browser/chromeos/crostini/crostini_mime_types_service_factory.h rename to chrome/browser/ash/crostini/crostini_mime_types_service_factory.h index 2c496e0..5956aaa 100644 --- a/chrome/browser/chromeos/crostini/crostini_mime_types_service_factory.h +++ b/chrome/browser/ash/crostini/crostini_mime_types_service_factory.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_MIME_TYPES_SERVICE_FACTORY_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_MIME_TYPES_SERVICE_FACTORY_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_MIME_TYPES_SERVICE_FACTORY_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_MIME_TYPES_SERVICE_FACTORY_H_ #include "base/macros.h" #include "base/no_destructor.h" @@ -36,4 +36,4 @@ } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_MIME_TYPES_SERVICE_FACTORY_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_MIME_TYPES_SERVICE_FACTORY_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_mime_types_service_unittest.cc b/chrome/browser/ash/crostini/crostini_mime_types_service_unittest.cc similarity index 98% rename from chrome/browser/chromeos/crostini/crostini_mime_types_service_unittest.cc rename to chrome/browser/ash/crostini/crostini_mime_types_service_unittest.cc index df4940f..fe21121 100644 --- a/chrome/browser/chromeos/crostini/crostini_mime_types_service_unittest.cc +++ b/chrome/browser/ash/crostini/crostini_mime_types_service_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_mime_types_service.h" +#include "chrome/browser/ash/crostini/crostini_mime_types_service.h" #include <stddef.h>
diff --git a/chrome/browser/chromeos/crostini/crostini_package_notification.cc b/chrome/browser/ash/crostini/crostini_package_notification.cc similarity index 98% rename from chrome/browser/chromeos/crostini/crostini_package_notification.cc rename to chrome/browser/ash/crostini/crostini_package_notification.cc index 18443fc1..cb6876ef 100644 --- a/chrome/browser/chromeos/crostini/crostini_package_notification.cc +++ b/chrome/browser/ash/crostini/crostini_package_notification.cc
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_package_notification.h" +#include "chrome/browser/ash/crostini/crostini_package_notification.h" #include "ash/public/cpp/notification_utils.h" #include "chrome/app/vector_icons/vector_icons.h" +#include "chrome/browser/ash/crostini/crostini_package_service.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_package_service.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/notifications/notification_display_service.h" #include "chrome/browser/ui/app_list/app_list_client_impl.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_package_notification.h b/chrome/browser/ash/crostini/crostini_package_notification.h similarity index 92% rename from chrome/browser/chromeos/crostini/crostini_package_notification.h rename to chrome/browser/ash/crostini/crostini_package_notification.h index ec8e5180..a721879 100644 --- a/chrome/browser/chromeos/crostini/crostini_package_notification.h +++ b/chrome/browser/ash/crostini/crostini_package_notification.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_PACKAGE_NOTIFICATION_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_PACKAGE_NOTIFICATION_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_PACKAGE_NOTIFICATION_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_PACKAGE_NOTIFICATION_H_ #include <memory> #include <ostream> @@ -11,9 +11,9 @@ #include "base/memory/weak_ptr.h" #include "base/time/time.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_package_operation_status.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_package_operation_status.h" #include "ui/message_center/public/cpp/notification_delegate.h" namespace message_center { @@ -133,4 +133,4 @@ } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_PACKAGE_NOTIFICATION_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_PACKAGE_NOTIFICATION_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_package_notification_unittest.cc b/chrome/browser/ash/crostini/crostini_package_notification_unittest.cc similarity index 94% rename from chrome/browser/chromeos/crostini/crostini_package_notification_unittest.cc rename to chrome/browser/ash/crostini/crostini_package_notification_unittest.cc index 9c4c39bb..04d7237 100644 --- a/chrome/browser/chromeos/crostini/crostini_package_notification_unittest.cc +++ b/chrome/browser/ash/crostini/crostini_package_notification_unittest.cc
@@ -2,16 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_package_notification.h" +#include "chrome/browser/ash/crostini/crostini_package_notification.h" #include <memory> #include <string> -#include "chrome/browser/chromeos/crostini/crostini_package_service.h" +#include "chrome/browser/ash/crostini/crostini_package_service.h" #include "chrome/browser/chromeos/crostini/crostini_test_helper.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/test/base/testing_profile.h" #include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "content/public/test/browser_task_environment.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -32,6 +33,7 @@ void SetUp() override { DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); task_environment_ = std::make_unique<content::BrowserTaskEnvironment>( base::test::TaskEnvironment::MainThreadType::UI, base::test::TaskEnvironment::ThreadPoolExecutionMode::ASYNC, @@ -48,6 +50,7 @@ crostini_test_helper_.reset(); profile_.reset(); task_environment_.reset(); + chromeos::SeneschalClient::Shutdown(); DBusThreadManager::Shutdown(); }
diff --git a/chrome/browser/chromeos/crostini/crostini_package_operation_status.h b/chrome/browser/ash/crostini/crostini_package_operation_status.h similarity index 64% rename from chrome/browser/chromeos/crostini/crostini_package_operation_status.h rename to chrome/browser/ash/crostini/crostini_package_operation_status.h index f880462..4e3d82e2 100644 --- a/chrome/browser/chromeos/crostini/crostini_package_operation_status.h +++ b/chrome/browser/ash/crostini/crostini_package_operation_status.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_PACKAGE_OPERATION_STATUS_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_PACKAGE_OPERATION_STATUS_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_PACKAGE_OPERATION_STATUS_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_PACKAGE_OPERATION_STATUS_H_ #include <ostream> @@ -21,4 +21,4 @@ } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_PACKAGE_OPERATION_STATUS_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_PACKAGE_OPERATION_STATUS_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_package_service.cc b/chrome/browser/ash/crostini/crostini_package_service.cc similarity index 98% rename from chrome/browser/chromeos/crostini/crostini_package_service.cc rename to chrome/browser/ash/crostini/crostini_package_service.cc index 2737b1f..490bf4d 100644 --- a/chrome/browser/chromeos/crostini/crostini_package_service.cc +++ b/chrome/browser/ash/crostini/crostini_package_service.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_package_service.h" +#include "chrome/browser/ash/crostini/crostini_package_service.h" #include "base/bind.h" #include "base/containers/contains.h" @@ -10,10 +10,10 @@ #include "base/no_destructor.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_manager_factory.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" #include "chrome/browser/ash/guest_os/guest_os_share_path.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_manager_factory.h" #include "chrome/browser/chromeos/file_manager/path_util.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_package_service.h b/chrome/browser/ash/crostini/crostini_package_service.h similarity index 94% rename from chrome/browser/chromeos/crostini/crostini_package_service.h rename to chrome/browser/ash/crostini/crostini_package_service.h index 36bb9f44..ba20680 100644 --- a/chrome/browser/chromeos/crostini/crostini_package_service.h +++ b/chrome/browser/ash/crostini/crostini_package_service.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_PACKAGE_SERVICE_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_PACKAGE_SERVICE_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_PACKAGE_SERVICE_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_PACKAGE_SERVICE_H_ #include <map> #include <memory> @@ -16,10 +16,10 @@ #include "base/callback_forward.h" #include "base/memory/weak_ptr.h" #include "base/optional.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_package_notification.h" +#include "chrome/browser/ash/crostini/crostini_package_operation_status.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_package_notification.h" -#include "chrome/browser/chromeos/crostini/crostini_package_operation_status.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "components/keyed_service/core/keyed_service.h" #include "storage/browser/file_system/file_system_url.h" @@ -202,4 +202,4 @@ } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_PACKAGE_SERVICE_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_PACKAGE_SERVICE_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_package_service_unittest.cc b/chrome/browser/ash/crostini/crostini_package_service_unittest.cc similarity index 99% rename from chrome/browser/chromeos/crostini/crostini_package_service_unittest.cc rename to chrome/browser/ash/crostini/crostini_package_service_unittest.cc index 6f79c71..14418e60 100644 --- a/chrome/browser/chromeos/crostini/crostini_package_service_unittest.cc +++ b/chrome/browser/ash/crostini/crostini_package_service_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_package_service.h" +#include "chrome/browser/ash/crostini/crostini_package_service.h" #include <memory> #include <string> @@ -27,6 +27,7 @@ #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/fake_concierge_client.h" #include "chromeos/dbus/seneschal/fake_seneschal_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/dbus/vm_applications/apps.pb.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" @@ -172,11 +173,11 @@ void SetUp() override { DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); fake_cicerone_client_ = static_cast<FakeCiceroneClient*>( DBusThreadManager::Get()->GetCiceroneClient()); ASSERT_TRUE(fake_cicerone_client_); - fake_seneschal_client_ = static_cast<FakeSeneschalClient*>( - DBusThreadManager::Get()->GetSeneschalClient()); + fake_seneschal_client_ = chromeos::FakeSeneschalClient::Get(); ASSERT_TRUE(fake_seneschal_client_); task_environment_ = std::make_unique<content::BrowserTaskEnvironment>( @@ -228,6 +229,7 @@ crostini_test_helper_.reset(); profile_.reset(); task_environment_.reset(); + chromeos::SeneschalClient::Shutdown(); DBusThreadManager::Shutdown(); }
diff --git a/chrome/browser/chromeos/crostini/crostini_port_forwarder.cc b/chrome/browser/ash/crostini/crostini_port_forwarder.cc similarity index 97% rename from chrome/browser/chromeos/crostini/crostini_port_forwarder.cc rename to chrome/browser/ash/crostini/crostini_port_forwarder.cc index c2b8272..7bb2af9c 100644 --- a/chrome/browser/chromeos/crostini/crostini_port_forwarder.cc +++ b/chrome/browser/ash/crostini/crostini_port_forwarder.cc
@@ -4,13 +4,13 @@ #include <fcntl.h> -#include "chrome/browser/chromeos/crostini/crostini_port_forwarder.h" +#include "chrome/browser/ash/crostini/crostini_port_forwarder.h" #include "base/bind.h" #include "base/callback_helpers.h" #include "base/no_destructor.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/profiles/profile.h" #include "chromeos/dbus/permission_broker/permission_broker_client.h" @@ -128,12 +128,12 @@ base::Optional<base::Value> CrostiniPortForwarder::ReadPortPreference( const PortRuleKey& key) { PrefService* pref_service = profile_->GetPrefs(); - const base::ListValue* all_ports = + const base::Value* all_ports = pref_service->GetList(crostini::prefs::kCrostiniPortForwarding); auto it = std::find_if( - all_ports->begin(), all_ports->end(), + all_ports->GetList().begin(), all_ports->GetList().end(), [&key, this](const auto& dict) { return MatchPortRuleDict(dict, key); }); - if (it == all_ports->end()) { + if (it == all_ports->GetList().end()) { return base::nullopt; } return base::Optional<base::Value>(it->Clone());
diff --git a/chrome/browser/chromeos/crostini/crostini_port_forwarder.h b/chrome/browser/ash/crostini/crostini_port_forwarder.h similarity index 96% rename from chrome/browser/chromeos/crostini/crostini_port_forwarder.h rename to chrome/browser/ash/crostini/crostini_port_forwarder.h index a074a493e..9547a30 100644 --- a/chrome/browser/chromeos/crostini/crostini_port_forwarder.h +++ b/chrome/browser/ash/crostini/crostini_port_forwarder.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_PORT_FORWARDER_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_PORT_FORWARDER_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_PORT_FORWARDER_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_PORT_FORWARDER_H_ #include <string> #include <unordered_map> @@ -162,4 +162,4 @@ } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_PORT_FORWARDER_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_PORT_FORWARDER_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_port_forwarder_unittest.cc b/chrome/browser/ash/crostini/crostini_port_forwarder_unittest.cc similarity index 98% rename from chrome/browser/chromeos/crostini/crostini_port_forwarder_unittest.cc rename to chrome/browser/ash/crostini/crostini_port_forwarder_unittest.cc index 75838eb..96ca878e 100644 --- a/chrome/browser/chromeos/crostini/crostini_port_forwarder_unittest.cc +++ b/chrome/browser/ash/crostini/crostini_port_forwarder_unittest.cc
@@ -2,15 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_port_forwarder.h" +#include "chrome/browser/ash/crostini/crostini_port_forwarder.h" #include "base/callback_helpers.h" #include "base/run_loop.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_test_helper.h" #include "chrome/test/base/testing_profile.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/permission_broker/fake_permission_broker_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "content/public/test/browser_task_environment.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -37,6 +38,7 @@ void SetUp() override { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); chromeos::PermissionBrokerClient::InitializeFake(); profile_ = std::make_unique<TestingProfile>(); CrostiniManager::GetForProfile(profile())->AddRunningVmForTesting( @@ -57,6 +59,7 @@ crostini_port_forwarder_.reset(); test_helper_.reset(); profile_.reset(); + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); }
diff --git a/chrome/browser/chromeos/crostini/crostini_pref_names.cc b/chrome/browser/ash/crostini/crostini_pref_names.cc similarity index 98% rename from chrome/browser/chromeos/crostini/crostini_pref_names.cc rename to chrome/browser/ash/crostini/crostini_pref_names.cc index ac4f93b..ab39480 100644 --- a/chrome/browser/chromeos/crostini/crostini_pref_names.cc +++ b/chrome/browser/ash/crostini/crostini_pref_names.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include <memory> #include <utility>
diff --git a/chrome/browser/chromeos/crostini/crostini_pref_names.h b/chrome/browser/ash/crostini/crostini_pref_names.h similarity index 89% rename from chrome/browser/chromeos/crostini/crostini_pref_names.h rename to chrome/browser/ash/crostini/crostini_pref_names.h index a8ac55f..b110db18 100644 --- a/chrome/browser/chromeos/crostini/crostini_pref_names.h +++ b/chrome/browser/ash/crostini/crostini_pref_names.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_PREF_NAMES_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_PREF_NAMES_H_ +#ifndef CHROME_BROWSER_ASH_CROSTINI_CROSTINI_PREF_NAMES_H_ +#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_PREF_NAMES_H_ class PrefRegistrySimple; @@ -50,4 +50,4 @@ } // namespace prefs } // namespace crostini -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_PREF_NAMES_H_ +#endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_PREF_NAMES_H_
diff --git a/chrome/browser/ash/guest_os/guest_os_registry_service.cc b/chrome/browser/ash/guest_os/guest_os_registry_service.cc index f5b8790d..4c79c33 100644 --- a/chrome/browser/ash/guest_os/guest_os_registry_service.cc +++ b/chrome/browser/ash/guest_os/guest_os_registry_service.cc
@@ -22,12 +22,12 @@ #include "chrome/browser/apps/app_service/dip_px_util.h" #include "chrome/browser/ash/borealis/borealis_features.h" #include "chrome/browser/ash/borealis/borealis_service.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/guest_os/guest_os_pref_names.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_features.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_util.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_shelf_utils.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/app_list_syncable_service.h"
diff --git a/chrome/browser/ash/guest_os/guest_os_registry_service_unittest.cc b/chrome/browser/ash/guest_os/guest_os_registry_service_unittest.cc index c3aaffe..d395a18 100644 --- a/chrome/browser/ash/guest_os/guest_os_registry_service_unittest.cc +++ b/chrome/browser/ash/guest_os/guest_os_registry_service_unittest.cc
@@ -9,11 +9,11 @@ #include "base/macros.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/simple_test_clock.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/guest_os/guest_os_pref_names.h" #include "chrome/browser/ash/plugin_vm/fake_plugin_vm_features.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_test_helper.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_test_helper.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/crostini/fake_crostini_features.h"
diff --git a/chrome/browser/ash/guest_os/guest_os_share_path.cc b/chrome/browser/ash/guest_os/guest_os_share_path.cc index ae0c6fb..3419e37 100644 --- a/chrome/browser/ash/guest_os/guest_os_share_path.cc +++ b/chrome/browser/ash/guest_os/guest_os_share_path.cc
@@ -68,7 +68,7 @@ return; } request.set_handle(vm_info->info.seneschal_server_handle()); - chromeos::DBusThreadManager::Get()->GetSeneschalClient()->SharePath( + chromeos::SeneschalClient::Get()->SharePath( request, base::BindOnce(&OnSeneschalSharePathResponse, std::move(callback))); } @@ -387,7 +387,7 @@ request.set_handle(vm_info->info.seneschal_server_handle()); } - chromeos::DBusThreadManager::Get()->GetSeneschalClient()->SharePath( + chromeos::SeneschalClient::Get()->SharePath( request, base::BindOnce(&OnSeneschalSharePathResponse, std::move(callback))); } @@ -451,7 +451,7 @@ } request.set_path(unshare_path.value()); - chromeos::DBusThreadManager::Get()->GetSeneschalClient()->UnsharePath( + chromeos::SeneschalClient::Get()->UnsharePath( request, base::BindOnce(&OnSeneschalUnsharePathResponse, std::move(callback))); }
diff --git a/chrome/browser/ash/guest_os/guest_os_share_path.h b/chrome/browser/ash/guest_os/guest_os_share_path.h index 45fea60..efa6fe2 100644 --- a/chrome/browser/ash/guest_os/guest_os_share_path.h +++ b/chrome/browser/ash/guest_os/guest_os_share_path.h
@@ -16,7 +16,7 @@ #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/sequenced_task_runner.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/file_manager/volume_manager_observer.h" #include "chrome/browser/profiles/profile.h" #include "chromeos/components/drivefs/drivefs_host_observer.h"
diff --git a/chrome/browser/ash/guest_os/guest_os_share_path_factory.cc b/chrome/browser/ash/guest_os/guest_os_share_path_factory.cc index 744eb2a7..5a33af9b 100644 --- a/chrome/browser/ash/guest_os/guest_os_share_path_factory.cc +++ b/chrome/browser/ash/guest_os/guest_os_share_path_factory.cc
@@ -4,8 +4,8 @@ #include "chrome/browser/ash/guest_os/guest_os_share_path_factory.h" +#include "chrome/browser/ash/crostini/crostini_manager_factory.h" #include "chrome/browser/ash/guest_os/guest_os_share_path.h" -#include "chrome/browser/chromeos/crostini/crostini_manager_factory.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/ash/guest_os/guest_os_share_path_unittest.cc b/chrome/browser/ash/guest_os/guest_os_share_path_unittest.cc index f937ca2..bcab2f1f 100644 --- a/chrome/browser/ash/guest_os/guest_os_share_path_unittest.cc +++ b/chrome/browser/ash/guest_os/guest_os_share_path_unittest.cc
@@ -11,10 +11,10 @@ #include "base/test/scoped_feature_list.h" #include "chrome/browser/ash/arc/session/arc_session_manager.h" #include "chrome/browser/ash/arc/test/test_arc_session_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/guest_os/guest_os_pref_names.h" #include "chrome/browser/ash/login/users/fake_chrome_user_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h" #include "chrome/browser/chromeos/file_manager/path_util.h" @@ -32,6 +32,7 @@ #include "chromeos/dbus/dlcservice/dlcservice_client.h" #include "chromeos/dbus/fake_concierge_client.h" #include "chromeos/dbus/seneschal/fake_seneschal_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/dbus/seneschal/seneschal_service.pb.h" #include "chromeos/disks/disk_mount_manager.h" #include "components/account_id/account_id.h" @@ -214,13 +215,16 @@ TestingBrowserProcess::GetGlobal())), browser_part_(g_browser_process->platform_part()) { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); fake_concierge_client_ = static_cast<chromeos::FakeConciergeClient*>( chromeos::DBusThreadManager::Get()->GetConciergeClient()); - fake_seneschal_client_ = static_cast<chromeos::FakeSeneschalClient*>( - chromeos::DBusThreadManager::Get()->GetSeneschalClient()); + fake_seneschal_client_ = chromeos::FakeSeneschalClient::Get(); } - ~GuestOsSharePathTest() override { chromeos::DBusThreadManager::Shutdown(); } + ~GuestOsSharePathTest() override { + chromeos::SeneschalClient::Shutdown(); + chromeos::DBusThreadManager::Shutdown(); + } void SetUpVolume() { // Setup Downloads and path to share, which depend on MyFilesVolume flag,
diff --git a/chrome/browser/ash/guest_os/guest_os_stability_monitor.cc b/chrome/browser/ash/guest_os/guest_os_stability_monitor.cc index 2aa7b51..d26cc29 100644 --- a/chrome/browser/ash/guest_os/guest_os_stability_monitor.cc +++ b/chrome/browser/ash/guest_os/guest_os_stability_monitor.cc
@@ -29,8 +29,7 @@ base::BindOnce(&GuestOsStabilityMonitor::CiceroneStarted, weak_ptr_factory_.GetWeakPtr())); - auto* seneschal_client = - chromeos::DBusThreadManager::Get()->GetSeneschalClient(); + auto* seneschal_client = chromeos::SeneschalClient::Get(); DCHECK(seneschal_client); seneschal_client->WaitForServiceToBeAvailable( base::BindOnce(&GuestOsStabilityMonitor::SeneschalStarted, @@ -67,8 +66,7 @@ void GuestOsStabilityMonitor::SeneschalStarted(bool is_available) { DCHECK(is_available); - auto* seneschal_client = - chromeos::DBusThreadManager::Get()->GetSeneschalClient(); + auto* seneschal_client = chromeos::SeneschalClient::Get(); DCHECK(seneschal_client); seneschal_observer_.Observe(seneschal_client); }
diff --git a/chrome/browser/ash/guest_os/guest_os_stability_monitor_unittest.cc b/chrome/browser/ash/guest_os/guest_os_stability_monitor_unittest.cc index c16cc78..a898197 100644 --- a/chrome/browser/ash/guest_os/guest_os_stability_monitor_unittest.cc +++ b/chrome/browser/ash/guest_os/guest_os_stability_monitor_unittest.cc
@@ -9,7 +9,7 @@ #include "base/barrier_closure.h" #include "base/run_loop.h" #include "base/test/metrics/histogram_tester.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_simple_types.h" #include "chrome/browser/chromeos/crostini/crostini_test_helper.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" @@ -19,6 +19,7 @@ #include "chromeos/dbus/fake_chunneld_client.h" #include "chromeos/dbus/fake_concierge_client.h" #include "chromeos/dbus/seneschal/fake_seneschal_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "content/public/test/browser_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" @@ -28,6 +29,7 @@ public: GuestOsStabilityMonitorTest() : task_env_() { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); // CrostiniManager will create a GuestOsStabilityMonitor for us. profile_ = std::make_unique<TestingProfile>(); @@ -49,6 +51,7 @@ crostini::CrostiniTestHelper::DisableCrostini(profile_.get()); crostini_manager_.reset(); profile_.reset(); + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); } @@ -108,8 +111,7 @@ } TEST_F(GuestOsStabilityMonitorTest, SeneschalFailure) { - auto* seneschal_client = static_cast<chromeos::FakeSeneschalClient*>( - chromeos::DBusThreadManager::Get()->GetSeneschalClient()); + auto* seneschal_client = chromeos::FakeSeneschalClient::Get(); seneschal_client->NotifySeneschalStopped(); histogram_tester_.ExpectUniqueSample(crostini::kCrostiniStabilityHistogram,
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_types.h b/chrome/browser/ash/login/easy_unlock/easy_unlock_types.h index 51b40d7..9bd197e8 100644 --- a/chrome/browser/ash/login/easy_unlock/easy_unlock_types.h +++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_types.h
@@ -7,7 +7,6 @@ #include <string> #include <vector> -#include "base/values.h" namespace chromeos {
diff --git a/chrome/browser/ash/login/enrollment/enrollment_screen_view.h b/chrome/browser/ash/login/enrollment/enrollment_screen_view.h index 88bb53d4..c861de5 100644 --- a/chrome/browser/ash/login/enrollment/enrollment_screen_view.h +++ b/chrome/browser/ash/login/enrollment/enrollment_screen_view.h
@@ -7,7 +7,6 @@ #include <string> -#include "base/values.h" #include "chrome/browser/ash/login/enrollment/enterprise_enrollment_helper.h" #include "chrome/browser/ash/login/oobe_screen.h" #include "chromeos/dbus/authpolicy/active_directory_info.pb.h"
diff --git a/chrome/browser/ash/login/screens/recommend_apps/fake_recommend_apps_fetcher.cc b/chrome/browser/ash/login/screens/recommend_apps/fake_recommend_apps_fetcher.cc index e6ac2c0..68277d1 100644 --- a/chrome/browser/ash/login/screens/recommend_apps/fake_recommend_apps_fetcher.cc +++ b/chrome/browser/ash/login/screens/recommend_apps/fake_recommend_apps_fetcher.cc
@@ -6,6 +6,7 @@ #include "base/strings/stringprintf.h" #include "base/timer/timer.h" +#include "base/values.h" #include "chrome/browser/ash/login/screens/recommend_apps/recommend_apps_fetcher_delegate.h" namespace chromeos {
diff --git a/chrome/browser/ash/login/screens/recommend_apps/fake_recommend_apps_fetcher.h b/chrome/browser/ash/login/screens/recommend_apps/fake_recommend_apps_fetcher.h index 7626f90..cb1dddc 100644 --- a/chrome/browser/ash/login/screens/recommend_apps/fake_recommend_apps_fetcher.h +++ b/chrome/browser/ash/login/screens/recommend_apps/fake_recommend_apps_fetcher.h
@@ -7,7 +7,6 @@ #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" -#include "base/values.h" #include "chrome/browser/ash/login/screens/recommend_apps/recommend_apps_fetcher.h" namespace chromeos {
diff --git a/chrome/browser/ash/login/screens/user_selection_screen.h b/chrome/browser/ash/login/screens/user_selection_screen.h index ec223212..172838b3 100644 --- a/chrome/browser/ash/login/screens/user_selection_screen.h +++ b/chrome/browser/ash/login/screens/user_selection_screen.h
@@ -16,7 +16,6 @@ #include "base/scoped_observation.h" #include "base/time/time.h" #include "base/timer/timer.h" -#include "base/values.h" #include "chrome/browser/ash/login/saml/password_sync_token_checkers_collection.h" #include "chrome/browser/ash/login/signin/token_handle_util.h" #include "chrome/browser/ash/login/ui/login_display.h"
diff --git a/chrome/browser/ash/login/session/chrome_session_manager.cc b/chrome/browser/ash/login/session/chrome_session_manager.cc index 2c92d7b3..b304e1bc 100644 --- a/chrome/browser/ash/login/session/chrome_session_manager.cc +++ b/chrome/browser/ash/login/session/chrome_session_manager.cc
@@ -20,6 +20,7 @@ #include "chrome/browser/ash/child_accounts/child_status_reporting_service_factory.h" #include "chrome/browser/ash/child_accounts/child_user_service_factory.h" #include "chrome/browser/ash/child_accounts/screen_time_controller_factory.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/lock_screen_apps/state_controller.h" #include "chrome/browser/ash/login/demo_mode/demo_resources.h" #include "chrome/browser/ash/login/demo_mode/demo_session.h" @@ -35,7 +36,6 @@ #include "chrome/browser/browser_process_platform_part_chromeos.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/boot_times_recorder.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chrome/browser/chromeos/policy/app_install_event_log_manager_wrapper.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/chromeos/policy/tpm_auto_update_mode_policy_handler.h"
diff --git a/chrome/browser/ash/login/session/user_session_initializer.cc b/chrome/browser/ash/login/session/user_session_initializer.cc index 07326db..0c633f9 100644 --- a/chrome/browser/ash/login/session/user_session_initializer.cc +++ b/chrome/browser/ash/login/session/user_session_initializer.cc
@@ -17,6 +17,7 @@ #include "chrome/browser/ash/child_accounts/child_user_service_factory.h" #include "chrome/browser/ash/child_accounts/family_user_metrics_service_factory.h" #include "chrome/browser/ash/child_accounts/screen_time_controller_factory.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/lock_screen_apps/state_controller.h" #include "chrome/browser/ash/login/startup_utils.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_manager.h" @@ -25,7 +26,6 @@ #include "chrome/browser/ash/settings/cros_settings.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part_chromeos.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chrome/browser/chromeos/eche_app/eche_app_manager_factory.h" #include "chrome/browser/chromeos/phonehub/phone_hub_manager_factory.h" #include "chrome/browser/chromeos/policy/app_install_event_log_manager_wrapper.h"
diff --git a/chrome/browser/ash/login/startup_utils.h b/chrome/browser/ash/login/startup_utils.h index a55e8185..7491882d 100644 --- a/chrome/browser/ash/login/startup_utils.h +++ b/chrome/browser/ash/login/startup_utils.h
@@ -8,7 +8,6 @@ #include <string> #include "base/callback_forward.h" -#include "base/values.h" class PrefRegistrySimple;
diff --git a/chrome/browser/ash/login/test/active_directory_login_mixin.h b/chrome/browser/ash/login/test/active_directory_login_mixin.h index 10fe4ab..1a5f6b3 100644 --- a/chrome/browser/ash/login/test/active_directory_login_mixin.h +++ b/chrome/browser/ash/login/test/active_directory_login_mixin.h
@@ -9,7 +9,6 @@ #include <string> #include "base/macros.h" -#include "base/values.h" #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" #include "chrome/test/base/mixin_based_in_process_browser_test.h" #include "components/policy/proto/chrome_device_policy.pb.h"
diff --git a/chrome/browser/ash/login/test/device_state_mixin.h b/chrome/browser/ash/login/test/device_state_mixin.h index c1a8864..8e4c529 100644 --- a/chrome/browser/ash/login/test/device_state_mixin.h +++ b/chrome/browser/ash/login/test/device_state_mixin.h
@@ -11,7 +11,6 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "base/values.h" #include "chrome/browser/ash/login/demo_mode/demo_session.h" #include "chrome/browser/ash/login/test/local_state_mixin.h" #include "chrome/browser/ash/login/test/scoped_policy_update.h"
diff --git a/chrome/browser/ash/login/users/avatar/user_image_manager_impl.h b/chrome/browser/ash/login/users/avatar/user_image_manager_impl.h index 8563626..95402800 100644 --- a/chrome/browser/ash/login/users/avatar/user_image_manager_impl.h +++ b/chrome/browser/ash/login/users/avatar/user_image_manager_impl.h
@@ -16,7 +16,6 @@ #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "base/timer/timer.h" -#include "base/values.h" #include "chrome/browser/ash/login/users/avatar/user_image_manager.h" #include "chrome/browser/profiles/profile_downloader_delegate.h" #include "components/user_manager/user.h"
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_files_unittest.cc b/chrome/browser/ash/plugin_vm/plugin_vm_files_unittest.cc index 13de937..3e2be8b8 100644 --- a/chrome/browser/ash/plugin_vm/plugin_vm_files_unittest.cc +++ b/chrome/browser/ash/plugin_vm/plugin_vm_files_unittest.cc
@@ -24,6 +24,7 @@ #include "chrome/test/base/testing_profile.h" #include "chromeos/dbus/cicerone/fake_cicerone_client.h" #include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/dbus/vm_applications/apps.pb.h" #include "content/public/test/browser_task_environment.h" #include "storage/browser/file_system/external_mount_points.h" @@ -92,8 +93,14 @@ } struct ScopedDBusThreadManager { - ScopedDBusThreadManager() { chromeos::DBusThreadManager::Initialize(); } - ~ScopedDBusThreadManager() { chromeos::DBusThreadManager::Shutdown(); } + ScopedDBusThreadManager() { + chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); + } + ~ScopedDBusThreadManager() { + chromeos::SeneschalClient::Shutdown(); + chromeos::DBusThreadManager::Shutdown(); + } } dbus_thread_manager_; content::BrowserTaskEnvironment task_environment_; TestingProfile profile_;
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl_unittest.cc b/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl_unittest.cc index 617fc1e..3c7b0e4 100644 --- a/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl_unittest.cc +++ b/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl_unittest.cc
@@ -28,6 +28,7 @@ #include "chromeos/dbus/fake_concierge_client.h" #include "chromeos/dbus/fake_vm_plugin_dispatcher_client.h" #include "chromeos/dbus/seneschal/fake_seneschal_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "components/prefs/pref_service.h" #include "content/public/test/browser_task_environment.h" #include "testing/gmock/include/gmock/gmock.h" @@ -46,6 +47,7 @@ public: PluginVmManagerImplTest() { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); testing_profile_ = std::make_unique<TestingProfile>(); test_helper_ = std::make_unique<PluginVmTestHelper>(testing_profile_.get()); plugin_vm_manager_ = static_cast<PluginVmManagerImpl*>( @@ -70,7 +72,9 @@ display_service_.reset(); test_helper_.reset(); testing_profile_.reset(); + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); + // TODO(yusukes): Fix the shutdown order. chromeos::DlcserviceClient::Shutdown(); } @@ -84,8 +88,7 @@ chromeos::DBusThreadManager::Get()->GetConciergeClient()); } chromeos::FakeSeneschalClient& SeneschalClient() { - return *static_cast<chromeos::FakeSeneschalClient*>( - chromeos::DBusThreadManager::Get()->GetSeneschalClient()); + return *chromeos::FakeSeneschalClient::Get(); } ShelfSpinnerController* SpinnerController() {
diff --git a/chrome/browser/ash/usb/cros_usb_detector.cc b/chrome/browser/ash/usb/cros_usb_detector.cc index e832ccf6..f9c028f 100644 --- a/chrome/browser/ash/usb/cros_usb_detector.cc +++ b/chrome/browser/ash/usb/cros_usb_detector.cc
@@ -15,11 +15,11 @@ #include "base/files/file_util.h" #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_features.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_util.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/notifications/system_notification_helper.h" #include "chrome/browser/profiles/profile_manager.h"
diff --git a/chrome/browser/ash/usb/cros_usb_detector_unittest.cc b/chrome/browser/ash/usb/cros_usb_detector_unittest.cc index 40af7ff2..a34f40c7 100644 --- a/chrome/browser/ash/usb/cros_usb_detector_unittest.cc +++ b/chrome/browser/ash/usb/cros_usb_detector_unittest.cc
@@ -14,10 +14,10 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/test/gmock_move_support.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/plugin_vm/fake_plugin_vm_features.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_test_helper.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_test_helper.h" #include "chrome/browser/chromeos/crostini/fake_crostini_features.h" #include "chrome/browser/notifications/notification_display_service.h" @@ -32,6 +32,7 @@ #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/fake_concierge_client.h" #include "chromeos/dbus/fake_vm_plugin_dispatcher_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/disks/disk.h" #include "chromeos/disks/disk_mount_manager.h" #include "chromeos/disks/mock_disk_mount_manager.h" @@ -128,6 +129,7 @@ public: CrosUsbDetectorTest() { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); fake_cicerone_client_ = static_cast<chromeos::FakeCiceroneClient*>( chromeos::DBusThreadManager::Get()->GetCiceroneClient()); fake_concierge_client_ = static_cast<chromeos::FakeConciergeClient*>( @@ -144,6 +146,7 @@ ~CrosUsbDetectorTest() override { chromeos::disks::DiskMountManager::Shutdown(); + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); }
diff --git a/chrome/browser/ash/web_applications/help_app/help_app_notification_controller.cc b/chrome/browser/ash/web_applications/help_app/help_app_notification_controller.cc index 511dac0..860f40b2 100644 --- a/chrome/browser/ash/web_applications/help_app/help_app_notification_controller.cc +++ b/chrome/browser/ash/web_applications/help_app/help_app_notification_controller.cc
@@ -56,6 +56,8 @@ PrefRegistrySimple* registry) { registry->RegisterIntegerPref( prefs::kDiscoverTabNotificationLastShownMilestone, -10); + registry->RegisterIntegerPref( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow, 0); } HelpAppNotificationController::HelpAppNotificationController(Profile* profile) @@ -73,6 +75,10 @@ // Update milestone when notification is shown. profile_->GetPrefs()->SetInteger( prefs::kDiscoverTabNotificationLastShownMilestone, CurrentMilestone()); + // When this notification has been shown, start showing the Discover tab + // suggestion chip in the launcher. + profile_->GetPrefs()->SetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow, 3); } else if (!release_notes_notification_) { release_notes_notification_ = std::make_unique<ash::ReleaseNotesNotification>(profile_);
diff --git a/chrome/browser/ash/web_applications/help_app/help_app_notification_controller_unittest.cc b/chrome/browser/ash/web_applications/help_app/help_app_notification_controller_unittest.cc index a1516b0..65b4ba7 100644 --- a/chrome/browser/ash/web_applications/help_app/help_app_notification_controller_unittest.cc +++ b/chrome/browser/ash/web_applications/help_app/help_app_notification_controller_unittest.cc
@@ -242,4 +242,46 @@ EXPECT_EQ(false, HasReleaseNotesNotification()); } +// Tests for suggestion chips. +TEST_F(HelpAppNotificationControllerTest, + UpdatesReleaseNotesChipPrefWhenReleaseNotesNotificationShown) { + std::unique_ptr<Profile> profile = CreateRegularProfile(); + profile->GetPrefs()->SetInteger(prefs::kReleaseNotesLastShownMilestone, 20); + std::unique_ptr<HelpAppNotificationController> controller = + std::make_unique<HelpAppNotificationController>(profile.get()); + + EXPECT_EQ(0, profile->GetPrefs()->GetInteger( + prefs::kReleaseNotesSuggestionChipTimesLeftToShow)); + EXPECT_EQ(0, profile->GetPrefs()->GetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow)); + + controller->MaybeShowNotification(); + + EXPECT_EQ(3, profile->GetPrefs()->GetInteger( + prefs::kReleaseNotesSuggestionChipTimesLeftToShow)); + EXPECT_EQ(0, profile->GetPrefs()->GetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow)); +} + +TEST_F(HelpAppNotificationControllerTest, + UpdatesDiscoverTabChipPrefWhenDiscoverTabNotificationShown) { + std::unique_ptr<Profile> profile = CreateChildProfile(); + profile->GetPrefs()->SetInteger( + prefs::kDiscoverTabNotificationLastShownMilestone, 20); + std::unique_ptr<HelpAppNotificationController> controller = + std::make_unique<HelpAppNotificationController>(profile.get()); + + EXPECT_EQ(0, profile->GetPrefs()->GetInteger( + prefs::kReleaseNotesSuggestionChipTimesLeftToShow)); + EXPECT_EQ(0, profile->GetPrefs()->GetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow)); + + controller->MaybeShowNotification(); + + EXPECT_EQ(0, profile->GetPrefs()->GetInteger( + prefs::kReleaseNotesSuggestionChipTimesLeftToShow)); + EXPECT_EQ(3, profile->GetPrefs()->GetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow)); +} + } // namespace chromeos
diff --git a/chrome/browser/ash/web_applications/help_app/help_app_ui_delegate.cc b/chrome/browser/ash/web_applications/help_app/help_app_ui_delegate.cc index d9d8f0d94..3908778 100644 --- a/chrome/browser/ash/web_applications/help_app/help_app_ui_delegate.cc +++ b/chrome/browser/ash/web_applications/help_app/help_app_ui_delegate.cc
@@ -62,6 +62,7 @@ accessibility_manager->IsSwitchAccessEnabled()); source->AddString("appLocale", g_browser_process->GetApplicationLocale()); + source->AddBoolean("isLowEndDevice", base::SysInfo::IsLowEndDevice()); // Add strings that can be pulled in. source->AddString("boardName", base::SysInfo::GetLsbReleaseBoard()); source->AddString("chromeOSVersion", base::SysInfo::OperatingSystemVersion());
diff --git a/chrome/browser/ash/web_applications/media_app/media_app_integration_browsertest.cc b/chrome/browser/ash/web_applications/media_app/media_app_integration_browsertest.cc index fa138f7..c736634 100644 --- a/chrome/browser/ash/web_applications/media_app/media_app_integration_browsertest.cc +++ b/chrome/browser/ash/web_applications/media_app/media_app_integration_browsertest.cc
@@ -673,15 +673,79 @@ EXPECT_EQ(expected_contents, renamed_contents); } +// Integration test for deleting a file using the WritableFiles API. +IN_PROC_BROWSER_TEST_P(MediaAppIntegrationWithFilesAppTest, DeleteFile) { + WaitForTestSystemAppInstall(); + + file_manager::test::FolderInMyFiles folder(profile()); + folder.Add({ + TestFile(kFileJpeg640x480), + TestFile(kFilePng800x600), + }); + folder.Open(TestFile(kFileJpeg640x480)); + content::WebContents* web_ui = PrepareActiveBrowserForTest(); + content::RenderFrameHost* app = MediaAppUiBrowserTest::GetAppFrame(web_ui); + + EXPECT_EQ("640x480", WaitForImageAlt(web_ui, kFileJpeg640x480)); + + int result = 0; + constexpr char kScript[] = + "lastLoadedReceivedFileList().item(0).deleteOriginalFile()" + ".then(() => domAutomationController.send(42));"; + EXPECT_EQ(true, content::ExecuteScriptAndExtractInt(app, kScript, &result)); + EXPECT_EQ(42, result); // Magic success (no exception thrown). + + // Ensure the file *not* deleted is the only one that remains. + folder.Refresh(); + EXPECT_EQ(1u, folder.files().size()); + EXPECT_EQ(kFilePng800x600, folder.files()[0].BaseName().value()); +} + +// Integration test for deleting a special file using the WritableFiles API. +IN_PROC_BROWSER_TEST_P(MediaAppIntegrationWithFilesAppTest, + FailToDeleteReservedFile) { + WaitForTestSystemAppInstall(); + + file_manager::test::FolderInMyFiles folder(profile()); + + // Files like "thumbs.db" can't be accessed by filename using WritableFiles. + const base::FilePath reserved_file = + base::FilePath().AppendASCII("thumbs.db"); + folder.AddWithName(TestFile(kFileJpeg640x480), reserved_file); + + // Even though the file doesn't have a ".jpg" extension, MIME sniffing in the + // files app should still direct the file at the image/jpeg handler of the + // media app. + folder.Open(reserved_file); + + content::WebContents* web_ui = PrepareActiveBrowserForTest(); + content::RenderFrameHost* app = MediaAppUiBrowserTest::GetAppFrame(web_ui); + + EXPECT_EQ("640x480", WaitForImageAlt(web_ui, "thumbs.db")); + + std::string result; + constexpr char kScript[] = + "lastLoadedReceivedFileList().item(0).deleteOriginalFile()" + ".then(() => domAutomationController.send('bad-success'))" + ".catch(e => domAutomationController.send(e.name));"; + EXPECT_EQ(true, + content::ExecuteScriptAndExtractString(app, kScript, &result)); + EXPECT_EQ("InvalidModificationError", result); + + // The file should still be there. + folder.Refresh(); + EXPECT_EQ(1u, folder.files().size()); + EXPECT_EQ("thumbs.db", folder.files()[0].BaseName().value()); +} + INSTANTIATE_SYSTEM_WEB_APP_MANAGER_TEST_SUITE_REGULAR_PROFILE_P( MediaAppIntegrationTest); INSTANTIATE_SYSTEM_WEB_APP_MANAGER_TEST_SUITE_ALL_PROFILE_TYPES_P( MediaAppIntegrationAllProfilesTest); -// Note: All MediaAppIntegrationWithFilesAppTest cases above currently want -// coverage for all profile types, so the "less" prarameterized prefix is not -// instantiated to avoid a gtest warning. +INSTANTIATE_SYSTEM_WEB_APP_MANAGER_TEST_SUITE_REGULAR_PROFILE_P( + MediaAppIntegrationWithFilesAppTest); INSTANTIATE_SYSTEM_WEB_APP_MANAGER_TEST_SUITE_ALL_PROFILE_TYPES_P( MediaAppIntegrationWithFilesAppAllProfilesTest);
diff --git a/chrome/browser/browser_switcher/alternative_browser_driver.h b/chrome/browser/browser_switcher/alternative_browser_driver.h index 3454c07..a0f08dbbf 100644 --- a/chrome/browser/browser_switcher/alternative_browser_driver.h +++ b/chrome/browser/browser_switcher/alternative_browser_driver.h
@@ -12,7 +12,6 @@ #include "base/files/file_path.h" #include "base/macros.h" #include "base/strings/string_piece_forward.h" -#include "base/values.h" #include "build/build_config.h" class GURL;
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 2af5c0c..bd46e60d 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -1142,6 +1142,42 @@ "../ash/crostini/ansible/ansible_management_service.h", "../ash/crostini/ansible/ansible_management_service_factory.cc", "../ash/crostini/ansible/ansible_management_service_factory.h", + "../ash/crostini/crostini_disk.cc", + "../ash/crostini/crostini_disk.h", + "../ash/crostini/crostini_engagement_metrics_service.cc", + "../ash/crostini/crostini_engagement_metrics_service.h", + "../ash/crostini/crostini_export_import.cc", + "../ash/crostini/crostini_export_import.h", + "../ash/crostini/crostini_export_import_notification_controller.cc", + "../ash/crostini/crostini_export_import_notification_controller.h", + "../ash/crostini/crostini_export_import_status_tracker.cc", + "../ash/crostini/crostini_export_import_status_tracker.h", + "../ash/crostini/crostini_features.cc", + "../ash/crostini/crostini_features.h", + "../ash/crostini/crostini_force_close_watcher.cc", + "../ash/crostini/crostini_force_close_watcher.h", + "../ash/crostini/crostini_installer.cc", + "../ash/crostini/crostini_installer.h", + "../ash/crostini/crostini_installer_ui_delegate.h", + "../ash/crostini/crostini_low_disk_notification.cc", + "../ash/crostini/crostini_low_disk_notification.h", + "../ash/crostini/crostini_manager.cc", + "../ash/crostini/crostini_manager.h", + "../ash/crostini/crostini_manager_factory.cc", + "../ash/crostini/crostini_manager_factory.h", + "../ash/crostini/crostini_mime_types_service.cc", + "../ash/crostini/crostini_mime_types_service.h", + "../ash/crostini/crostini_mime_types_service_factory.cc", + "../ash/crostini/crostini_mime_types_service_factory.h", + "../ash/crostini/crostini_package_notification.cc", + "../ash/crostini/crostini_package_notification.h", + "../ash/crostini/crostini_package_operation_status.h", + "../ash/crostini/crostini_package_service.cc", + "../ash/crostini/crostini_package_service.h", + "../ash/crostini/crostini_port_forwarder.cc", + "../ash/crostini/crostini_port_forwarder.h", + "../ash/crostini/crostini_pref_names.cc", + "../ash/crostini/crostini_pref_names.h", "../ash/crostini/throttle/crostini_active_window_throttle_observer.cc", "../ash/crostini/throttle/crostini_active_window_throttle_observer.h", "../ash/crostini/throttle/crostini_throttle.cc", @@ -1936,42 +1972,6 @@ "chrome_content_browser_client_chromeos_part.h", "concierge_helper_service.cc", "concierge_helper_service.h", - "crostini/crostini_disk.cc", - "crostini/crostini_disk.h", - "crostini/crostini_engagement_metrics_service.cc", - "crostini/crostini_engagement_metrics_service.h", - "crostini/crostini_export_import.cc", - "crostini/crostini_export_import.h", - "crostini/crostini_export_import_notification_controller.cc", - "crostini/crostini_export_import_notification_controller.h", - "crostini/crostini_export_import_status_tracker.cc", - "crostini/crostini_export_import_status_tracker.h", - "crostini/crostini_features.cc", - "crostini/crostini_features.h", - "crostini/crostini_force_close_watcher.cc", - "crostini/crostini_force_close_watcher.h", - "crostini/crostini_installer.cc", - "crostini/crostini_installer.h", - "crostini/crostini_installer_ui_delegate.h", - "crostini/crostini_low_disk_notification.cc", - "crostini/crostini_low_disk_notification.h", - "crostini/crostini_manager.cc", - "crostini/crostini_manager.h", - "crostini/crostini_manager_factory.cc", - "crostini/crostini_manager_factory.h", - "crostini/crostini_mime_types_service.cc", - "crostini/crostini_mime_types_service.h", - "crostini/crostini_mime_types_service_factory.cc", - "crostini/crostini_mime_types_service_factory.h", - "crostini/crostini_package_notification.cc", - "crostini/crostini_package_notification.h", - "crostini/crostini_package_operation_status.h", - "crostini/crostini_package_service.cc", - "crostini/crostini_package_service.h", - "crostini/crostini_port_forwarder.cc", - "crostini/crostini_port_forwarder.h", - "crostini/crostini_pref_names.cc", - "crostini/crostini_pref_names.h", "crostini/crostini_remover.cc", "crostini/crostini_remover.h", "crostini/crostini_reporting_util.cc", @@ -3748,6 +3748,17 @@ "../ash/crosapi/prefs_ash_unittest.cc", "../ash/crosapi/test_mojo_connection_manager_unittest.cc", "../ash/crostini/ansible/ansible_management_service_unittest.cc", + "../ash/crostini/crostini_disk_unittest.cc", + "../ash/crostini/crostini_export_import_unittest.cc", + "../ash/crostini/crostini_features_unittest.cc", + "../ash/crostini/crostini_force_close_watcher_unittest.cc", + "../ash/crostini/crostini_installer_unittest.cc", + "../ash/crostini/crostini_low_disk_notification_unittest.cc", + "../ash/crostini/crostini_manager_unittest.cc", + "../ash/crostini/crostini_mime_types_service_unittest.cc", + "../ash/crostini/crostini_package_notification_unittest.cc", + "../ash/crostini/crostini_package_service_unittest.cc", + "../ash/crostini/crostini_port_forwarder_unittest.cc", "../ash/crostini/throttle/crostini_active_window_throttle_observer_unittest.cc", "../ash/crostini/throttle/crostini_throttle_unittest.cc", "../ash/customization/customization_document_unittest.cc", @@ -3899,17 +3910,6 @@ "android_sms/pairing_lost_notifier_unittest.cc", "chrome_content_browser_client_chromeos_part_unittest.cc", "concierge_helper_service_unittest.cc", - "crostini/crostini_disk_unittest.cc", - "crostini/crostini_export_import_unittest.cc", - "crostini/crostini_features_unittest.cc", - "crostini/crostini_force_close_watcher_unittest.cc", - "crostini/crostini_installer_unittest.cc", - "crostini/crostini_low_disk_notification_unittest.cc", - "crostini/crostini_manager_unittest.cc", - "crostini/crostini_mime_types_service_unittest.cc", - "crostini/crostini_package_notification_unittest.cc", - "crostini/crostini_package_service_unittest.cc", - "crostini/crostini_port_forwarder_unittest.cc", "crostini/crostini_reporting_util_unittest.cc", "crostini/crostini_shelf_utils_unittest.cc", "crostini/crostini_sshfs_unittest.cc",
diff --git a/chrome/browser/chromeos/browser_context_keyed_service_factories.cc b/chrome/browser/chromeos/browser_context_keyed_service_factories.cc index c75dd65..36c449a 100644 --- a/chrome/browser/chromeos/browser_context_keyed_service_factories.cc +++ b/chrome/browser/chromeos/browser_context_keyed_service_factories.cc
@@ -10,6 +10,7 @@ #include "chrome/browser/ash/bluetooth/debug_logs_manager_factory.h" #include "chrome/browser/ash/borealis/borealis_service_factory.h" #include "chrome/browser/ash/cert_provisioning/cert_provisioning_scheduler_user_service.h" +#include "chrome/browser/ash/crostini/crostini_engagement_metrics_service.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" #include "chrome/browser/ash/kerberos/kerberos_credentials_manager_factory.h" #include "chrome/browser/ash/login/easy_unlock/easy_unlock_service_factory.h" @@ -17,7 +18,6 @@ #include "chrome/browser/ash/plugin_vm/plugin_vm_engagement_metrics_service.h" #include "chrome/browser/ash/web_applications/crosh_loader_factory.h" #include "chrome/browser/chromeos/android_sms/android_sms_service_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.h" #include "chrome/browser/chromeos/eche_app/eche_app_manager_factory.h" #include "chrome/browser/chromeos/extensions/file_manager/event_router_factory.h" #include "chrome/browser/chromeos/extensions/input_method_api.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_remover.cc b/chrome/browser/chromeos/crostini/crostini_remover.cc index 164ee3f..b1f4b7d9 100644 --- a/chrome/browser/chromeos/crostini/crostini_remover.cc +++ b/chrome/browser/chromeos/crostini/crostini_remover.cc
@@ -8,12 +8,12 @@ #include <utility> #include "base/bind.h" +#include "chrome/browser/ash/crostini/crostini_mime_types_service.h" +#include "chrome/browser/ash/crostini/crostini_mime_types_service_factory.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chromeos/crostini/crostini_mime_types_service.h" -#include "chrome/browser/chromeos/crostini/crostini_mime_types_service_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/component_updater/cros_component_installer_chromeos.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_remover.h b/chrome/browser/chromeos/crostini/crostini_remover.h index 89c92c5..c671e14 100644 --- a/chrome/browser/chromeos/crostini/crostini_remover.h +++ b/chrome/browser/chromeos/crostini/crostini_remover.h
@@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_REMOVER_H_ #define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_REMOVER_H_ -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" namespace crostini {
diff --git a/chrome/browser/chromeos/crostini/crostini_reporting_util.cc b/chrome/browser/chromeos/crostini/crostini_reporting_util.cc index 7f2cdca..2ce52ddb 100644 --- a/chrome/browser/chromeos/crostini/crostini_reporting_util.cc +++ b/chrome/browser/chromeos/crostini/crostini_reporting_util.cc
@@ -11,7 +11,7 @@ #include "base/ranges/algorithm.h" #include "base/time/clock.h" #include "base/time/time.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "components/component_updater/component_updater_service.h" #include "components/prefs/pref_service.h" #include "third_party/cros_system_api/dbus/service_constants.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_reporting_util_unittest.cc b/chrome/browser/chromeos/crostini/crostini_reporting_util_unittest.cc index dcff4394..6aa5478 100644 --- a/chrome/browser/chromeos/crostini/crostini_reporting_util_unittest.cc +++ b/chrome/browser/chromeos/crostini/crostini_reporting_util_unittest.cc
@@ -11,7 +11,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/test/simple_test_clock.h" #include "base/time/time.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/test/base/testing_profile.h" #include "components/component_updater/component_updater_service.h" #include "components/component_updater/mock_component_updater_service.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_sshfs.cc b/chrome/browser/chromeos/crostini/crostini_sshfs.cc index f1122ecf..5ecf55a9 100644 --- a/chrome/browser/chromeos/crostini/crostini_sshfs.cc +++ b/chrome/browser/chromeos/crostini/crostini_sshfs.cc
@@ -9,8 +9,8 @@ #include "base/logging.h" #include "base/scoped_observation.h" #include "base/strings/stringprintf.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_manager_factory.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager_factory.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/file_manager/path_util.h" #include "chrome/browser/chromeos/file_manager/volume_manager.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_sshfs.h b/chrome/browser/chromeos/crostini/crostini_sshfs.h index 3bb851e..d1f37674 100644 --- a/chrome/browser/chromeos/crostini/crostini_sshfs.h +++ b/chrome/browser/chromeos/crostini/crostini_sshfs.h
@@ -12,9 +12,10 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/scoped_observation.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/file_manager/volume_manager.h" #include "chromeos/disks/disk_mount_manager.h" + namespace crostini { class CrostiniSshfs : chromeos::disks::DiskMountManager::Observer,
diff --git a/chrome/browser/chromeos/crostini/crostini_sshfs_unittest.cc b/chrome/browser/chromeos/crostini/crostini_sshfs_unittest.cc index e044988c..0f70c4db 100644 --- a/chrome/browser/chromeos/crostini/crostini_sshfs_unittest.cc +++ b/chrome/browser/chromeos/crostini/crostini_sshfs_unittest.cc
@@ -15,8 +15,8 @@ #include "base/test/bind.h" #include "base/test/task_environment.h" #include "base/test/test_timeouts.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_manager_factory.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager_factory.h" #include "chrome/browser/chromeos/crostini/crostini_test_helper.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h" @@ -27,6 +27,7 @@ #include "chromeos/dbus/cros_disks_client.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/fake_concierge_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/dbus/vm_applications/apps.pb.h" #include "chromeos/disks/disk_mount_manager.h" #include "chromeos/disks/mock_disk_mount_manager.h" @@ -60,6 +61,7 @@ public: CrostiniSshfsHelperTest() { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); profile_ = std::make_unique<TestingProfile>(); crostini_test_helper_ = std::make_unique<CrostiniTestHelper>(profile_.get()); @@ -91,6 +93,7 @@ crostini_sshfs_.reset(); crostini_test_helper_.reset(); profile_.reset(); + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); }
diff --git a/chrome/browser/chromeos/crostini/crostini_terminal.cc b/chrome/browser/chromeos/crostini/crostini_terminal.cc index 2e6d14a..146d6bc 100644 --- a/chrome/browser/chromeos/crostini/crostini_terminal.cc +++ b/chrome/browser/chromeos/crostini/crostini_terminal.cc
@@ -12,7 +12,7 @@ #include "base/strings/stringprintf.h" #include "base/values.h" #include "chrome/browser/apps/app_service/app_launch_params.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/ash/window_properties.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_test_helper.cc b/chrome/browser/chromeos/crostini/crostini_test_helper.cc index 011bddf..07da84ae 100644 --- a/chrome/browser/chromeos/crostini/crostini_test_helper.cc +++ b/chrome/browser/chromeos/crostini/crostini_test_helper.cc
@@ -7,12 +7,12 @@ #include "base/feature_list.h" #include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" #include "chrome/browser/ash/login/users/fake_chrome_user_manager.h" #include "chrome/browser/ash/profiles/profile_helper.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_features.h" #include "chrome/test/base/testing_profile.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_upgrade_available_notification.cc b/chrome/browser/chromeos/crostini/crostini_upgrade_available_notification.cc index b796a6b..3241b3b0 100644 --- a/chrome/browser/chromeos/crostini/crostini_upgrade_available_notification.cc +++ b/chrome/browser/chromeos/crostini/crostini_upgrade_available_notification.cc
@@ -7,7 +7,7 @@ #include "base/callback.h" #include "base/callback_helpers.h" #include "base/metrics/histogram_functions.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/notifications/notification_display_service.h" #include "chrome/browser/ui/settings_window_manager_chromeos.h" #include "chrome/browser/ui/webui/chromeos/crostini_upgrader/crostini_upgrader_dialog.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_upgrade_available_notification_unittest.cc b/chrome/browser/chromeos/crostini/crostini_upgrade_available_notification_unittest.cc index 6d9c1819..ace97a6b 100644 --- a/chrome/browser/chromeos/crostini/crostini_upgrade_available_notification_unittest.cc +++ b/chrome/browser/chromeos/crostini/crostini_upgrade_available_notification_unittest.cc
@@ -8,7 +8,7 @@ #include "base/run_loop.h" #include "base/test/metrics/histogram_tester.h" #include "build/branding_buildflags.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_test_helper.h" #include "chrome/browser/chromeos/crostini/crostini_upgrade_available_notification.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" @@ -23,6 +23,7 @@ #include "chrome/test/base/testing_browser_process.h" #include "chromeos/dbus/cicerone/cicerone_service.pb.h" #include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "components/session_manager/core/session_manager.h" #include "content/public/browser/web_ui.h" #include "content/public/test/browser_task_environment.h" @@ -44,6 +45,7 @@ void SetUp() override { BrowserWithTestWindowTest::SetUp(); chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); TestingBrowserProcess::GetGlobal()->SetSystemNotificationHelper( std::make_unique<SystemNotificationHelper>()); @@ -55,6 +57,7 @@ RunUntilIdle(); display_service_.reset(); BrowserWithTestWindowTest::TearDown(); + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); }
diff --git a/chrome/browser/chromeos/crostini/crostini_upgrader.cc b/chrome/browser/chromeos/crostini/crostini_upgrader.cc index 93dd898..44dc76e 100644 --- a/chrome/browser/chromeos/crostini/crostini_upgrader.cc +++ b/chrome/browser/chromeos/crostini/crostini_upgrader.cc
@@ -11,10 +11,10 @@ #include "base/system/sys_info.h" #include "base/task/post_task.h" #include "base/task/thread_pool.h" -#include "chrome/browser/chromeos/crostini/crostini_export_import.h" -#include "chrome/browser/chromeos/crostini/crostini_export_import_status_tracker.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_manager_factory.h" +#include "chrome/browser/ash/crostini/crostini_export_import.h" +#include "chrome/browser/ash/crostini/crostini_export_import_status_tracker.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager_factory.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_upgrader.h b/chrome/browser/chromeos/crostini/crostini_upgrader.h index 69e1322..80b32fd 100644 --- a/chrome/browser/chromeos/crostini/crostini_upgrader.h +++ b/chrome/browser/chromeos/crostini/crostini_upgrader.h
@@ -8,9 +8,9 @@ #include "base/callback_forward.h" #include "base/optional.h" #include "base/scoped_observation.h" -#include "chrome/browser/chromeos/crostini/crostini_export_import.h" -#include "chrome/browser/chromeos/crostini/crostini_export_import_status_tracker.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_export_import.h" +#include "chrome/browser/ash/crostini/crostini_export_import_status_tracker.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_upgrader_ui_delegate.h" #include "chromeos/dbus/power/power_manager_client.h" #include "components/keyed_service/core/keyed_service.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_util.cc b/chrome/browser/chromeos/crostini/crostini_util.cc index 37f2a26..4ea0dceb2 100644 --- a/chrome/browser/chromeos/crostini/crostini_util.cc +++ b/chrome/browser/chromeos/crostini/crostini_util.cc
@@ -18,17 +18,17 @@ #include "base/strings/stringprintf.h" #include "base/task/post_task.h" #include "base/timer/timer.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_installer.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_mime_types_service.h" +#include "chrome/browser/ash/crostini/crostini_mime_types_service_factory.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" #include "chrome/browser/ash/guest_os/guest_os_share_path.h" #include "chrome/browser/ash/guest_os/virtual_machines/virtual_machines_util.h" #include "chrome/browser/ash/profiles/profile_helper.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_installer.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_mime_types_service.h" -#include "chrome/browser/chromeos/crostini/crostini_mime_types_service_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_terminal.h" #include "chrome/browser/chromeos/file_manager/path_util.h" #include "chrome/browser/profiles/profile.h" @@ -493,18 +493,16 @@ const base::Value* GetContainerPrefValue(Profile* profile, const ContainerId& container_id, const std::string& key) { - const base::ListValue* containers = + const base::Value* containers = profile->GetPrefs()->GetList(crostini::prefs::kCrostiniContainers); if (!containers) { return nullptr; } - auto it = std::find_if( - containers->begin(), containers->end(), - [&](const auto& dict) { return MatchContainerDict(dict, container_id); }); - if (it == containers->end()) { - return nullptr; + for (const auto& dict : containers->GetList()) { + if (MatchContainerDict(dict, container_id)) + return dict.FindKey(key); } - return it->FindKey(key); + return nullptr; } void UpdateContainerPref(Profile* profile,
diff --git a/chrome/browser/chromeos/crostini/crostini_util_unittest.cc b/chrome/browser/chromeos/crostini/crostini_util_unittest.cc index bacc9b5..9351a1d 100644 --- a/chrome/browser/chromeos/crostini/crostini_util_unittest.cc +++ b/chrome/browser/chromeos/crostini/crostini_util_unittest.cc
@@ -16,6 +16,7 @@ #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/dlcservice/dlcservice_client.h" #include "chromeos/dbus/fake_concierge_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "content/public/test/browser_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" @@ -42,11 +43,15 @@ TestingBrowserProcess::GetGlobal())), browser_part_(g_browser_process->platform_part()) { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); fake_concierge_client_ = static_cast<chromeos::FakeConciergeClient*>( chromeos::DBusThreadManager::Get()->GetConciergeClient()); } - ~CrostiniUtilTest() override { chromeos::DBusThreadManager::Shutdown(); } + ~CrostiniUtilTest() override { + chromeos::SeneschalClient::Shutdown(); + chromeos::DBusThreadManager::Shutdown(); + } CrostiniUtilTest(const CrostiniUtilTest&) = delete; CrostiniUtilTest& operator=(const CrostiniUtilTest&) = delete;
diff --git a/chrome/browser/chromeos/crostini/fake_crostini_features.h b/chrome/browser/chromeos/crostini/fake_crostini_features.h index 2611691..4f1da32e 100644 --- a/chrome/browser/chromeos/crostini/fake_crostini_features.h +++ b/chrome/browser/chromeos/crostini/fake_crostini_features.h
@@ -7,7 +7,7 @@ #include "base/macros.h" #include "base/optional.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_features.h" class Profile;
diff --git a/chrome/browser/chromeos/crostini/fake_crostini_installer_ui_delegate.h b/chrome/browser/chromeos/crostini/fake_crostini_installer_ui_delegate.h index 127e04a2..57b7952c 100644 --- a/chrome/browser/chromeos/crostini/fake_crostini_installer_ui_delegate.h +++ b/chrome/browser/chromeos/crostini/fake_crostini_installer_ui_delegate.h
@@ -6,8 +6,8 @@ #define CHROME_BROWSER_CHROMEOS_CROSTINI_FAKE_CROSTINI_INSTALLER_UI_DELEGATE_H_ #include "base/callback.h" -#include "chrome/browser/chromeos/crostini/crostini_installer_ui_delegate.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_installer_ui_delegate.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" namespace crostini {
diff --git a/chrome/browser/chromeos/dbus/chrome_features_service_provider.cc b/chrome/browser/chromeos/dbus/chrome_features_service_provider.cc index 0b149bf..18f938d 100644 --- a/chrome/browser/chromeos/dbus/chrome_features_service_provider.cc +++ b/chrome/browser/chromeos/dbus/chrome_features_service_provider.cc
@@ -13,12 +13,12 @@ #include "ash/constants/ash_features.h" #include "base/bind.h" #include "base/feature_list.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_features.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/ash/settings/cros_settings.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/chrome_features.h" #include "chromeos/settings/cros_settings_names.h"
diff --git a/chrome/browser/chromeos/dbus/dbus_helper.cc b/chrome/browser/chromeos/dbus/dbus_helper.cc index 93a8bc431..1416dff 100644 --- a/chrome/browser/chromeos/dbus/dbus_helper.cc +++ b/chrome/browser/chromeos/dbus/dbus_helper.cc
@@ -38,6 +38,7 @@ #include "chromeos/dbus/power/power_manager_client.h" #include "chromeos/dbus/resourced/resourced_client.h" #include "chromeos/dbus/rmad/rmad_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/dbus/session_manager/session_manager_client.h" #include "chromeos/dbus/system_clock/system_clock_client.h" #include "chromeos/dbus/system_proxy/system_proxy_client.h" @@ -111,6 +112,7 @@ InitializeDBusClient<PermissionBrokerClient>(bus); InitializeDBusClient<PowerManagerClient>(bus); InitializeDBusClient<ResourcedClient>(bus); + InitializeDBusClient<SeneschalClient>(bus); InitializeDBusClient<SessionManagerClient>(bus); InitializeDBusClient<SystemClockClient>(bus); InitializeDBusClient<SystemProxyClient>(bus); @@ -161,6 +163,7 @@ SystemProxyClient::Shutdown(); SystemClockClient::Shutdown(); SessionManagerClient::Shutdown(); + SeneschalClient::Shutdown(); ResourcedClient::Shutdown(); if (ash::features::IsShimlessRMAFlowEnabled()) { RmadClient::Shutdown();
diff --git a/chrome/browser/chromeos/dbus/vm_applications_service_provider.cc b/chrome/browser/chromeos/dbus/vm_applications_service_provider.cc index 302ef89..f66f683 100644 --- a/chrome/browser/chromeos/dbus/vm_applications_service_provider.cc +++ b/chrome/browser/chromeos/dbus/vm_applications_service_provider.cc
@@ -10,13 +10,13 @@ #include "base/bind.h" #include "chrome/browser/ash/borealis/borealis_features.h" #include "chrome/browser/ash/borealis/borealis_service.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_mime_types_service.h" +#include "chrome/browser/ash/crostini/crostini_mime_types_service_factory.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_features.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_util.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_mime_types_service.h" -#include "chrome/browser/chromeos/crostini/crostini_mime_types_service_factory.h" #include "chrome/browser/chromeos/crostini/crostini_terminal.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/profiles/profile_manager.h"
diff --git a/chrome/browser/chromeos/exo/chrome_data_exchange_delegate_unittest.cc b/chrome/browser/chromeos/exo/chrome_data_exchange_delegate_unittest.cc index 61abf54..16b3e432 100644 --- a/chrome/browser/chromeos/exo/chrome_data_exchange_delegate_unittest.cc +++ b/chrome/browser/chromeos/exo/chrome_data_exchange_delegate_unittest.cc
@@ -11,15 +11,16 @@ #include "base/memory/scoped_refptr.h" #include "base/pickle.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/guest_os/guest_os_share_path.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_util.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_test_helper.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/file_manager/path_util.h" #include "chrome/test/base/testing_profile.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/seneschal/fake_seneschal_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "components/exo/shell_surface_util.h" #include "content/public/common/drop_data.h" #include "content/public/test/browser_task_environment.h" @@ -63,6 +64,7 @@ public: void SetUp() override { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); profile_ = std::make_unique<TestingProfile>(); test_helper_ = std::make_unique<crostini::CrostiniTestHelper>(profile_.get()); @@ -95,8 +97,7 @@ storage::FileSystemMountOption(), crostini_dir_); // DBus seneschal client. - fake_seneschal_client_ = static_cast<chromeos::FakeSeneschalClient*>( - chromeos::DBusThreadManager::Get()->GetSeneschalClient()); + fake_seneschal_client_ = chromeos::FakeSeneschalClient::Get(); ASSERT_TRUE(fake_seneschal_client_); } @@ -104,6 +105,7 @@ mount_points_->RevokeAllFileSystems(); test_helper_.reset(); profile_.reset(); + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); }
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 59fe29a..deacd10 100644 --- a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc +++ b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc
@@ -68,6 +68,11 @@ #include "chrome/browser/ash/borealis/borealis_installer.h" #include "chrome/browser/ash/borealis/borealis_metrics.h" #include "chrome/browser/ash/borealis/borealis_service.h" +#include "chrome/browser/ash/crostini/crostini_export_import.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_installer.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" #include "chrome/browser/ash/login/lock/screen_locker.h" @@ -81,11 +86,6 @@ #include "chrome/browser/banners/app_banner_manager_desktop.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" -#include "chrome/browser/chromeos/crostini/crostini_export_import.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_installer.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/file_manager/path_util.h" #include "chrome/browser/chromeos/printing/cups_printers_manager.h"
diff --git a/chrome/browser/chromeos/extensions/default_app_order.cc b/chrome/browser/chromeos/extensions/default_app_order.cc index 3e1f850..b6648e1 100644 --- a/chrome/browser/chromeos/extensions/default_app_order.cc +++ b/chrome/browser/chromeos/extensions/default_app_order.cc
@@ -49,6 +49,10 @@ extension_misc::kGmailAppId, web_app::kGmailAppId, + web_app::kGoogleMeetAppId, + + web_app::kGoogleChatAppId, + extension_misc::kGoogleDocAppId, web_app::kGoogleDocsAppId,
diff --git a/chrome/browser/chromeos/extensions/external_cache_impl_unittest.cc b/chrome/browser/chromeos/extensions/external_cache_impl_unittest.cc index a6bdd9a..b7a4573 100644 --- a/chrome/browser/chromeos/extensions/external_cache_impl_unittest.cc +++ b/chrome/browser/chromeos/extensions/external_cache_impl_unittest.cc
@@ -161,7 +161,7 @@ content::RunAllTasksUntilIdle(); ASSERT_TRUE(provided_prefs()); - EXPECT_EQ(provided_prefs()->size(), 2ul); + EXPECT_EQ(provided_prefs()->DictSize(), 2ul); // File in cache from Webstore. const base::DictionaryValue* entry1 = NULL; @@ -201,7 +201,7 @@ extensions::ExtensionDownloaderDelegate::InstallCallback()); content::RunAllTasksUntilIdle(); - EXPECT_EQ(provided_prefs()->size(), 3ul); + EXPECT_EQ(provided_prefs()->DictSize(), 3ul); const base::DictionaryValue* entry2 = NULL; ASSERT_TRUE(provided_prefs()->GetDictionary(kTestExtensionId2, &entry2)); @@ -232,7 +232,7 @@ } content::RunAllTasksUntilIdle(); - EXPECT_EQ(provided_prefs()->size(), 4ul); + EXPECT_EQ(provided_prefs()->DictSize(), 4ul); const base::DictionaryValue* entry4 = NULL; ASSERT_TRUE(provided_prefs()->GetDictionary(kTestExtensionId4, &entry4)); @@ -251,7 +251,7 @@ external_cache.OnDamagedFileDetected( GetExtensionFile(cache_dir, kTestExtensionId2, "2")); content::RunAllTasksUntilIdle(); - EXPECT_EQ(3ul, provided_prefs()->size()); + EXPECT_EQ(3ul, provided_prefs()->DictSize()); EXPECT_FALSE( base::PathExists(GetExtensionFile(cache_dir, kTestExtensionId2, "2"))); EXPECT_EQ(1ul, deleted_extension_files().size()); @@ -263,7 +263,7 @@ base::BindOnce(&ExternalCacheImplTest::OnExtensionListsUpdated, base::Unretained(this), base::Unretained(empty.get()))); content::RunAllTasksUntilIdle(); - EXPECT_EQ(provided_prefs()->size(), 0ul); + EXPECT_EQ(provided_prefs()->DictSize(), 0ul); // After Shutdown directory shouldn't be touched. external_cache.OnDamagedFileDetected( @@ -288,7 +288,7 @@ content::RunAllTasksUntilIdle(); ASSERT_TRUE(provided_prefs()); - EXPECT_EQ(provided_prefs()->size(), 1ul); + EXPECT_EQ(provided_prefs()->DictSize(), 1ul); // Extensions downloaded from update url will only be visible in the provided // prefs once the download of the .crx has finished. Extensions that are
diff --git a/chrome/browser/chromeos/extensions/file_manager/event_router.cc b/chrome/browser/chromeos/extensions/file_manager/event_router.cc index bc208d9..4b1fc38 100644 --- a/chrome/browser/chromeos/extensions/file_manager/event_router.cc +++ b/chrome/browser/chromeos/extensions/file_manager/event_router.cc
@@ -19,12 +19,12 @@ #include "base/values.h" #include "chrome/browser/app_mode/app_mode_utils.h" #include "chrome/browser/ash/arc/arc_util.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/drive/drive_integration_service.h" #include "chrome/browser/ash/drive/file_system_util.h" #include "chrome/browser/ash/login/lock/screen_locker.h" #include "chrome/browser/ash/login/ui/login_display_host.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_util.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" #include "chrome/browser/chromeos/file_manager/app_id.h" #include "chrome/browser/chromeos/file_manager/fileapi_util.h"
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc b/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc index 14f3e2b..5e1d4c8d 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc
@@ -13,9 +13,9 @@ #include "base/path_service.h" #include "base/run_loop.h" #include "base/stl_util.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/drive/drivefs_test_support.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/fake_crostini_features.h" #include "chrome/browser/chromeos/extensions/file_manager/event_router.h" #include "chrome/browser/chromeos/extensions/file_manager/event_router_factory.h"
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc index ed08c7aa..c8f9514a 100644 --- a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc +++ b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
@@ -734,7 +734,7 @@ } auto results_list = std::make_unique<base::ListValue>(); - for (auto& entry : *results) { + for (auto& entry : results->GetList()) { base::DictionaryValue dict; std::string highlight; base::Value* value = entry.FindKey("fileFullPath");
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc index 29affe9..e65ed9a 100644 --- a/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc +++ b/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc
@@ -21,14 +21,14 @@ #include "base/strings/strcat.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/ash/crostini/crostini_export_import.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_package_service.h" #include "chrome/browser/ash/drive/drive_integration_service.h" #include "chrome/browser/ash/drive/file_system_util.h" #include "chrome/browser/ash/guest_os/guest_os_share_path.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chromeos/crostini/crostini_export_import.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_package_service.h" #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" #include "chrome/browser/chromeos/file_manager/fileapi_util.h" #include "chrome/browser/chromeos/file_manager/path_util.h"
diff --git a/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider.cc b/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider.cc index 6480f14..8f96361 100644 --- a/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider.cc +++ b/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider.cc
@@ -29,7 +29,8 @@ printing::PrintBackend::CreateInstance( g_browser_process->GetApplicationLocale())); printing::PrinterSemanticCapsAndDefaults capabilities; - if (!backend->GetPrinterSemanticCapsAndDefaults(printer_id, &capabilities)) { + if (backend->GetPrinterSemanticCapsAndDefaults(printer_id, &capabilities) != + printing::mojom::ResultCode::kSuccess) { LOG(WARNING) << "Failed to get capabilities for " << printer_id; return base::nullopt; }
diff --git a/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider_unittest.cc b/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider_unittest.cc index 8fe2e50..3088381 100644 --- a/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider_unittest.cc +++ b/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider_unittest.cc
@@ -23,7 +23,7 @@ PrinterCapabilitiesProviderPrintBackend() = default; // PrintBackend: - bool GetPrinterSemanticCapsAndDefaults( + printing::mojom::ResultCode GetPrinterSemanticCapsAndDefaults( const std::string& printer_name, printing::PrinterSemanticCapsAndDefaults* printer_info) override { capabilities_requests_counter_++;
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc index 223802a0..c64bc79 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc
@@ -40,11 +40,11 @@ #include "chrome/browser/ash/arc/fileapi/arc_documents_provider_util.h" #include "chrome/browser/ash/arc/fileapi/arc_media_view_util.h" #include "chrome/browser/ash/base/locale_util.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/drive/drivefs_test_support.h" #include "chrome/browser/ash/drive/file_system_util.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/extensions/file_manager/event_router.h" #include "chrome/browser/chromeos/extensions/file_manager/event_router_factory.h" #include "chrome/browser/chromeos/file_manager/app_id.h"
diff --git a/chrome/browser/chromeos/file_manager/file_manager_string_util.cc b/chrome/browser/chromeos/file_manager/file_manager_string_util.cc index 7a1e68e..67c1f0b7 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_string_util.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_string_util.cc
@@ -9,10 +9,10 @@ #include "base/logging.h" #include "base/strings/stringprintf.h" #include "base/values.h" +#include "chrome/browser/ash/crostini/crostini_features.h" #include "chrome/browser/ash/login/demo_mode/demo_session.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_features.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_features.h" #include "chrome/grit/generated_resources.h"
diff --git a/chrome/browser/chromeos/file_manager/file_manager_test_util.cc b/chrome/browser/chromeos/file_manager/file_manager_test_util.cc index ccead47c..b9112ce 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_test_util.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_test_util.cc
@@ -49,6 +49,13 @@ } } +void FolderInMyFiles::AddWithName(const base::FilePath& file, + const base::FilePath& new_base_name) { + base::ScopedAllowBlockingForTesting allow_blocking; + files_.push_back(folder_.Append(new_base_name)); + base::CopyFile(file, files_.back()); +} + OpenOperationResult FolderInMyFiles::Open(const base::FilePath& file) { const auto& it = std::find_if(files_.begin(), files_.end(), [file](const base::FilePath& i) {
diff --git a/chrome/browser/chromeos/file_manager/file_manager_test_util.h b/chrome/browser/chromeos/file_manager/file_manager_test_util.h index 71de6da..727d3d4 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_test_util.h +++ b/chrome/browser/chromeos/file_manager/file_manager_test_util.h
@@ -27,6 +27,10 @@ // Copies additional files into |folder_|, appending to |files_|. void Add(const std::vector<base::FilePath>& files); + // Copies the contents of |file| to |folder_| with the given |new_base_name|. + void AddWithName(const base::FilePath& file, + const base::FilePath& new_base_name); + // Use platform_util::OpenItem() on the file with basename matching |path| to // simulate a user request to open that path, e.g., from the Files app or // chrome://downloads.
diff --git a/chrome/browser/chromeos/file_manager/file_tasks.cc b/chrome/browser/chromeos/file_manager/file_tasks.cc index 087e380..d3585b8 100644 --- a/chrome/browser/chromeos/file_manager/file_tasks.cc +++ b/chrome/browser/chromeos/file_manager/file_tasks.cc
@@ -24,8 +24,8 @@ #include "chrome/browser/apps/app_service/app_service_metrics.h" #include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" +#include "chrome/browser/ash/crostini/crostini_features.h" #include "chrome/browser/ash/drive/file_system_util.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" #include "chrome/browser/chromeos/file_manager/app_id.h" #include "chrome/browser/chromeos/file_manager/app_service_file_tasks.h" #include "chrome/browser/chromeos/file_manager/arc_file_tasks.h"
diff --git a/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc b/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc index 80736790..4c0c7cf 100644 --- a/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc +++ b/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc
@@ -12,12 +12,12 @@ #include "base/command_line.h" #include "base/run_loop.h" #include "base/values.h" +#include "chrome/browser/ash/crostini/crostini_mime_types_service.h" +#include "chrome/browser/ash/crostini/crostini_mime_types_service_factory.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/drive/file_system_util.h" #include "chrome/browser/ash/login/users/scoped_test_user_manager.h" #include "chrome/browser/ash/settings/scoped_cros_settings_test_helper.h" -#include "chrome/browser/chromeos/crostini/crostini_mime_types_service.h" -#include "chrome/browser/chromeos/crostini/crostini_mime_types_service_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_test_helper.h" #include "chrome/browser/chromeos/crostini/fake_crostini_features.h" #include "chrome/browser/chromeos/file_manager/app_id.h"
diff --git a/chrome/browser/chromeos/file_manager/file_watcher.cc b/chrome/browser/chromeos/file_manager/file_watcher.cc index 47b10b2..5620bac 100644 --- a/chrome/browser/chromeos/file_manager/file_watcher.cc +++ b/chrome/browser/chromeos/file_manager/file_watcher.cc
@@ -11,7 +11,7 @@ #include "base/task/post_task.h" #include "base/task/thread_pool.h" #include "base/task_runner_util.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/file_manager/path_util.h" #include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc b/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc index 0052bae..d084faf7 100644 --- a/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc +++ b/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc
@@ -18,6 +18,7 @@ #include "chromeos/dbus/cicerone/cicerone_service.pb.h" #include "chromeos/dbus/cicerone/fake_cicerone_client.h" #include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "content/public/test/browser_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" @@ -31,9 +32,11 @@ FileManagerFileWatcherTest() : task_environment_(content::BrowserTaskEnvironment::IO_MAINLOOP) { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); } ~FileManagerFileWatcherTest() override { + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); }
diff --git a/chrome/browser/chromeos/file_manager/guest_os_file_tasks.cc b/chrome/browser/chromeos/file_manager/guest_os_file_tasks.cc index f02521b..23db2f99 100644 --- a/chrome/browser/chromeos/file_manager/guest_os_file_tasks.cc +++ b/chrome/browser/chromeos/file_manager/guest_os_file_tasks.cc
@@ -16,14 +16,14 @@ #include "base/strings/strcat.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_mime_types_service.h" +#include "chrome/browser/ash/crostini/crostini_mime_types_service_factory.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_features.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_files.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_util.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_mime_types_service.h" -#include "chrome/browser/chromeos/crostini/crostini_mime_types_service_factory.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/file_manager/app_id.h" #include "chrome/browser/chromeos/file_manager/fileapi_util.h"
diff --git a/chrome/browser/chromeos/file_manager/guest_os_file_tasks_unittest.cc b/chrome/browser/chromeos/file_manager/guest_os_file_tasks_unittest.cc index 1e0c7e84..9ebf0af 100644 --- a/chrome/browser/chromeos/file_manager/guest_os_file_tasks_unittest.cc +++ b/chrome/browser/chromeos/file_manager/guest_os_file_tasks_unittest.cc
@@ -6,10 +6,10 @@ #include "base/files/file_path.h" #include "base/values.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/guest_os/guest_os_pref_names.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/ash/plugin_vm/fake_plugin_vm_features.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/fake_crostini_features.h" #include "chrome/browser/chromeos/file_manager/path_util.h" #include "chrome/test/base/testing_profile.h"
diff --git a/chrome/browser/chromeos/file_manager/path_util.cc b/chrome/browser/chromeos/file_manager/path_util.cc index 6049a9b..e0cbf5d 100644 --- a/chrome/browser/chromeos/file_manager/path_util.cc +++ b/chrome/browser/chromeos/file_manager/path_util.cc
@@ -19,10 +19,10 @@ #include "chrome/browser/ash/arc/fileapi/arc_documents_provider_root.h" #include "chrome/browser/ash/arc/fileapi/arc_documents_provider_root_map.h" #include "chrome/browser/ash/arc/fileapi/chrome_content_provider_url_util.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/drive/drive_integration_service.h" #include "chrome/browser/ash/drive/file_system_util.h" #include "chrome/browser/ash/profiles/profile_helper.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/file_manager/app_id.h" #include "chrome/browser/chromeos/fileapi/external_file_url_util.h"
diff --git a/chrome/browser/chromeos/file_manager/path_util_unittest.cc b/chrome/browser/chromeos/file_manager/path_util_unittest.cc index f9639c7..9ed875b3 100644 --- a/chrome/browser/chromeos/file_manager/path_util_unittest.cc +++ b/chrome/browser/chromeos/file_manager/path_util_unittest.cc
@@ -14,11 +14,11 @@ #include "base/test/scoped_running_on_chromeos.h" #include "chrome/browser/ash/arc/fileapi/arc_documents_provider_util.h" #include "chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/drive/drive_integration_service.h" #include "chrome/browser/ash/drive/file_system_util.h" #include "chrome/browser/ash/login/users/fake_chrome_user_manager.h" #include "chrome/browser/ash/profiles/profile_helper.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h" #include "chrome/browser/chromeos/fileapi/file_system_backend.h" @@ -28,6 +28,7 @@ #include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile_manager.h" #include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/disks/disk.h" #include "components/account_id/account_id.h" #include "components/arc/arc_service_manager.h" @@ -321,6 +322,8 @@ // Initialize DBUS and running container. chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); + crostini::CrostiniManager* crostini_manager = crostini::CrostiniManager::GetForProfile(profile_.get()); crostini_manager->AddRunningVmForTesting(crostini::kCrostiniDefaultVmName); @@ -763,6 +766,8 @@ TEST_F(FileManagerPathUtilConvertUrlTest, ConvertPathToArcUrl_MyDriveArcvm) { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); + auto* command_line = base::CommandLine::ForCurrentProcess(); command_line->InitFromArgv({"", "--enable-arcvm"}); EXPECT_TRUE(arc::IsArcVmEnabled());
diff --git a/chrome/browser/chromeos/file_manager/volume_manager.cc b/chrome/browser/chromeos/file_manager/volume_manager.cc index f18331c..766ef7e5 100644 --- a/chrome/browser/chromeos/file_manager/volume_manager.cc +++ b/chrome/browser/chromeos/file_manager/volume_manager.cc
@@ -31,10 +31,10 @@ #include "chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.h" #include "chrome/browser/ash/arc/fileapi/arc_media_view_util.h" #include "chrome/browser/ash/arc/session/arc_session_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/drive/drive_integration_service.h" #include "chrome/browser/ash/drive/file_system_util.h" #include "chrome/browser/ash/profiles/profile_helper.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/file_manager/path_util.h" #include "chrome/browser/chromeos/file_manager/snapshot_manager.h"
diff --git a/chrome/browser/chromeos/file_system_provider/service.h b/chrome/browser/chromeos/file_system_provider/service.h index da78758..cee8f65 100644 --- a/chrome/browser/chromeos/file_system_provider/service.h +++ b/chrome/browser/chromeos/file_system_provider/service.h
@@ -18,7 +18,6 @@ #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/threading/thread_checker.h" -#include "base/values.h" #include "chrome/browser/chromeos/file_system_provider/extension_provider.h" #include "chrome/browser/chromeos/file_system_provider/observer.h" #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
diff --git a/chrome/browser/chromeos/note_taking_helper_unittest.cc b/chrome/browser/chromeos/note_taking_helper_unittest.cc index 232f9d5a..f9a970c 100644 --- a/chrome/browser/chromeos/note_taking_helper_unittest.cc +++ b/chrome/browser/chromeos/note_taking_helper_unittest.cc
@@ -30,7 +30,6 @@ #include "chrome/browser/web_applications/components/web_application_info.h" #include "chrome/browser/web_applications/test/test_web_app_provider.h" #include "chrome/browser/web_applications/test/web_app_install_test_utils.h" -#include "chrome/browser/web_applications/web_app_migration_manager.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/browser_with_test_window_test.h" @@ -289,9 +288,9 @@ void InitWebAppProvider() { auto* provider = web_app::TestWebAppProvider::Get(profile()); - // Migration manager won't complete initialization due to using a test - // extensions system that is never started. Not needed so just disable it. - provider->SetMigrationManager(nullptr); + // TestWebAppProvider should not wait for a test extension system, that is + // never started, to be ready. + provider->SkipAwaitingExtensionSystem(); web_app::test::AwaitStartWebAppProviderAndSubsystems(profile()); }
diff --git a/chrome/browser/chromeos/platform_keys/key_permissions/extension_key_permissions_service.cc b/chrome/browser/chromeos/platform_keys/key_permissions/extension_key_permissions_service.cc index b272aabf..b1b4d4d 100644 --- a/chrome/browser/chromeos/platform_keys/key_permissions/extension_key_permissions_service.cc +++ b/chrome/browser/chromeos/platform_keys/key_permissions/extension_key_permissions_service.cc
@@ -269,7 +269,7 @@ LOG(ERROR) << "Found a state store of wrong type."; return; } - for (const auto& entry : *entries) { + for (const auto& entry : entries->GetList()) { std::string spki_b64; const base::DictionaryValue* dict_entry = nullptr; if (entry.GetAsString(&spki_b64)) {
diff --git a/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_browsertest.cc b/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_browsertest.cc index 2582d178..5960420e 100644 --- a/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_browsertest.cc +++ b/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_browsertest.cc
@@ -8,8 +8,8 @@ #include "ash/shell.h" #include "base/json/json_writer.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/crostini/fake_crostini_features.h" #include "chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller.h"
diff --git a/chrome/browser/chromeos/policy/external_data_handlers/crostini_ansible_playbook_external_data_handler.cc b/chrome/browser/chromeos/policy/external_data_handlers/crostini_ansible_playbook_external_data_handler.cc index d34fdb3..9128b0b 100644 --- a/chrome/browser/chromeos/policy/external_data_handlers/crostini_ansible_playbook_external_data_handler.cc +++ b/chrome/browser/chromeos/policy/external_data_handlers/crostini_ansible_playbook_external_data_handler.cc
@@ -4,9 +4,9 @@ #include "chrome/browser/chromeos/policy/external_data_handlers/crostini_ansible_playbook_external_data_handler.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/ash/settings/cros_settings.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" #include "chrome/browser/profiles/profile.h" #include "components/policy/policy_constants.h"
diff --git a/chrome/browser/chromeos/policy/lock_to_single_user_manager.cc b/chrome/browser/chromeos/policy/lock_to_single_user_manager.cc index 80cc418b..620c095 100644 --- a/chrome/browser/chromeos/policy/lock_to_single_user_manager.cc +++ b/chrome/browser/chromeos/policy/lock_to_single_user_manager.cc
@@ -7,11 +7,11 @@ #include "base/bind.h" #include "base/logging.h" #include "base/metrics/histogram_functions.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_manager.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_manager_factory.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/ash/settings/cros_settings.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chrome/browser/lifetime/application_lifetime.h" #include "chromeos/cryptohome/cryptohome_parameters.h" #include "chromeos/dbus/dbus_thread_manager.h"
diff --git a/chrome/browser/chromeos/policy/lock_to_single_user_manager_unittest.cc b/chrome/browser/chromeos/policy/lock_to_single_user_manager_unittest.cc index 18a17c9..fe82f90 100644 --- a/chrome/browser/chromeos/policy/lock_to_single_user_manager_unittest.cc +++ b/chrome/browser/chromeos/policy/lock_to_single_user_manager_unittest.cc
@@ -16,6 +16,7 @@ #include "chrome/test/base/browser_with_test_window_test.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/fake_concierge_client.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/dbus/userdataauth/fake_cryptohome_misc_client.h" #include "chromeos/login/session/session_termination_manager.h" #include "chromeos/settings/cros_settings_names.h" @@ -39,6 +40,7 @@ // DBusThreadManager::Get(). auto dbus_thread_manager_setter = chromeos::DBusThreadManager::GetSetterForTesting(); + chromeos::SeneschalClient::InitializeFake(); arc::SetArcAvailableCommandLineForTesting( base::CommandLine::ForCurrentProcess()); @@ -72,6 +74,7 @@ arc_service_manager_.reset(); BrowserWithTestWindowTest::TearDown(); chromeos::CryptohomeMiscClient::Shutdown(); + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); }
diff --git a/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_job.h b/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_job.h index 75d75fd9..6dc8ac88 100644 --- a/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_job.h +++ b/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_job.h
@@ -11,7 +11,6 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" -#include "base/values.h" #include "components/policy/core/common/remote_commands/remote_command_job.h" namespace policy {
diff --git a/chrome/browser/chromeos/policy/status_collector/child_status_collector_browsertest.cc b/chrome/browser/chromeos/policy/status_collector/child_status_collector_browsertest.cc index 093fb5c..d29f779 100644 --- a/chrome/browser/chromeos/policy/status_collector/child_status_collector_browsertest.cc +++ b/chrome/browser/chromeos/policy/status_collector/child_status_collector_browsertest.cc
@@ -46,6 +46,7 @@ #include "chromeos/dbus/fake_update_engine_client.h" #include "chromeos/dbus/power/fake_power_manager_client.h" #include "chromeos/dbus/power_manager/idle.pb.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/login/login_state/login_state.h" #include "chromeos/settings/cros_settings_names.h" #include "chromeos/settings/timezone_settings.h" @@ -207,6 +208,7 @@ dbus_setter->SetUpdateEngineClient( base::WrapUnique<chromeos::UpdateEngineClient>(update_engine_client_)); + chromeos::SeneschalClient::InitializeFake(); chromeos::PowerManagerClient::InitializeFake(); chromeos::LoginState::Initialize(); @@ -216,6 +218,7 @@ ~ChildStatusCollectorTest() override { chromeos::LoginState::Shutdown(); chromeos::PowerManagerClient::Shutdown(); + chromeos::SeneschalClient::Shutdown(); TestingBrowserProcess::GetGlobal()->SetLocalState(nullptr); // Finish pending tasks.
diff --git a/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc b/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc index c32c15f..e186206 100644 --- a/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc +++ b/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc
@@ -43,13 +43,13 @@ #include "base/version.h" #include "chrome/browser/ash/app_mode/arc/arc_kiosk_app_manager.h" #include "chrome/browser/ash/app_mode/kiosk_app_manager.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" #include "chrome/browser/ash/login/users/chrome_user_manager.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/ash/settings/cros_settings.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_reporting_util.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
diff --git a/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc b/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc index 18d6f6f..34ccafc 100644 --- a/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc +++ b/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc
@@ -38,6 +38,7 @@ #include "chrome/browser/ash/app_mode/kiosk_app_manager.h" #include "chrome/browser/ash/app_mode/kiosk_cryptohome_remover.h" #include "chrome/browser/ash/app_mode/web_app/web_kiosk_app_manager.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" #include "chrome/browser/ash/login/users/mock_user_manager.h" @@ -45,7 +46,6 @@ #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/ash/settings/scoped_testing_cros_settings.h" #include "chrome/browser/chrome_content_browser_client.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_test_helper.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/chromeos/policy/device_local_account.h" @@ -62,6 +62,7 @@ #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/fake_update_engine_client.h" #include "chromeos/dbus/power_manager/idle.pb.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/dbus/shill/shill_device_client.h" #include "chromeos/dbus/shill/shill_ipconfig_client.h" #include "chromeos/dbus/shill/shill_profile_client.h" @@ -857,9 +858,11 @@ chromeos::AttestationClient::InitializeFake(); chromeos::TpmManagerClient::InitializeFake(); chromeos::LoginState::Initialize(); + chromeos::SeneschalClient::InitializeFake(); } ~DeviceStatusCollectorTest() override { + chromeos::SeneschalClient::Shutdown(); chromeos::LoginState::Shutdown(); chromeos::TpmManagerClient::Shutdown(); chromeos::AttestationClient::Shutdown();
diff --git a/chrome/browser/chromeos/printing/printer_setup_util.cc b/chrome/browser/chromeos/printing/printer_setup_util.cc index 351354e..ea2239a 100644 --- a/chrome/browser/chromeos/printing/printer_setup_util.cc +++ b/chrome/browser/chromeos/printing/printer_setup_util.cc
@@ -97,7 +97,8 @@ print_backend->GetPrinterDriverInfo(device_name)); auto caps = base::make_optional<PrinterSemanticCapsAndDefaults>(); - if (!print_backend->GetPrinterSemanticCapsAndDefaults(device_name, &*caps)) { + if (print_backend->GetPrinterSemanticCapsAndDefaults(device_name, &*caps) != + mojom::ResultCode::kSuccess) { // Failed to get capabilities, but proceed to assemble the settings to // return what information we do have. LOG(WARNING) << "Failed to get capabilities for " << device_name;
diff --git a/chrome/browser/enterprise/connectors/file_system/box_upload_file_chunks_handler.h b/chrome/browser/enterprise/connectors/file_system/box_upload_file_chunks_handler.h index 54262fb..3891a32 100644 --- a/chrome/browser/enterprise/connectors/file_system/box_upload_file_chunks_handler.h +++ b/chrome/browser/enterprise/connectors/file_system/box_upload_file_chunks_handler.h
@@ -12,7 +12,6 @@ #include "base/files/file_path.h" #include "base/hash/sha1.h" #include "base/threading/sequence_bound.h" -#include "base/values.h" #include "chrome/browser/enterprise/connectors/file_system/box_api_call_flow.h" namespace enterprise_connectors {
diff --git a/chrome/browser/enterprise/connectors/file_system/box_uploader.h b/chrome/browser/enterprise/connectors/file_system/box_uploader.h index 05f97e9..a97baf7 100644 --- a/chrome/browser/enterprise/connectors/file_system/box_uploader.h +++ b/chrome/browser/enterprise/connectors/file_system/box_uploader.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_ENTERPRISE_CONNECTORS_FILE_SYSTEM_BOX_UPLOADER_H_ #include "base/files/file_path.h" -#include "base/values.h" #include "components/download/public/common/download_item_impl.h" #include "components/prefs/pref_service.h" #include "google_apis/gaia/oauth2_api_call_flow.h"
diff --git a/chrome/browser/enterprise/reporting/profile_report_generator_unittest.cc b/chrome/browser/enterprise/reporting/profile_report_generator_unittest.cc index 80c547dc..7ac9ec0 100644 --- a/chrome/browser/enterprise/reporting/profile_report_generator_unittest.cc +++ b/chrome/browser/enterprise/reporting/profile_report_generator_unittest.cc
@@ -35,6 +35,7 @@ const int kMaxNumberOfExtensionRequest = 1000; constexpr char kProfile[] = "Profile"; +constexpr char16_t kProfile16[] = u"Profile"; constexpr char kIdleProfile[] = "IdleProfile"; constexpr char16_t kIdleProfile16[] = u"IdleProfile"; constexpr char kExtensionId[] = "abcdefghijklmnopabcdefghijklmnop"; @@ -68,7 +69,7 @@ InitPolicyMap(); profile_ = profile_manager_.CreateTestingProfile( - kProfile, {}, base::UTF8ToUTF16(kProfile), 0, {}, + kProfile, {}, kProfile16, 0, {}, IdentityTestEnvironmentProfileAdaptor:: GetIdentityTestEnvironmentFactories(), base::nullopt, std::move(policy_service_));
diff --git a/chrome/browser/extensions/api/braille_display_private/braille_controller.h b/chrome/browser/extensions/api/braille_display_private/braille_controller.h index 330d307..dd63c9e 100644 --- a/chrome/browser/extensions/api/braille_display_private/braille_controller.h +++ b/chrome/browser/extensions/api/braille_display_private/braille_controller.h
@@ -8,7 +8,6 @@ #include <memory> #include <vector> -#include "base/values.h" #include "chrome/common/extensions/api/braille_display_private.h" namespace extensions {
diff --git a/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.h b/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.h index e0ae4a8..eae0cfa 100644 --- a/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.h +++ b/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_EXTENSIONS_API_CRYPTOTOKEN_PRIVATE_CRYPTOTOKEN_PRIVATE_API_H_ #define CHROME_BROWSER_EXTENSIONS_API_CRYPTOTOKEN_PRIVATE_CRYPTOTOKEN_PRIVATE_API_H_ -#include "base/values.h" #include "chrome/browser/extensions/chrome_extension_function_details.h" #include "chrome/common/extensions/api/cryptotoken_private.h" #include "extensions/browser/extension_function.h"
diff --git a/chrome/browser/extensions/api/management/management_apitest.cc b/chrome/browser/extensions/api/management/management_apitest.cc index 5d21956d..2adf98c3 100644 --- a/chrome/browser/extensions/api/management/management_apitest.cc +++ b/chrome/browser/extensions/api/management/management_apitest.cc
@@ -17,7 +17,6 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/web_applications/components/app_registrar.h" -#include "chrome/browser/web_applications/components/install_finalizer.h" #include "chrome/browser/web_applications/components/os_integration_manager.h" #include "chrome/browser/web_applications/components/web_app_helpers.h" #include "chrome/browser/web_applications/components/web_app_provider_base.h" @@ -212,10 +211,6 @@ web_app::AppId web_app_id = web_app::GenerateAppIdFromURL(start_url); auto* provider = web_app::WebAppProviderBase::GetProviderBase(browser()->profile()); - // Async legacy finalizer install was causing this test to be flaky (see - // crbug.com/1094616). - provider->install_finalizer().RemoveLegacyInstallFinalizerForTesting(); - EXPECT_FALSE(provider->registrar().IsLocallyInstalled(start_url)); EXPECT_EQ(0, static_cast<int>( provider->ui_manager().GetNumWindowsForApp(web_app_id)));
diff --git a/chrome/browser/extensions/api/settings_private/prefs_util.cc b/chrome/browser/extensions/api/settings_private/prefs_util.cc index f723fbe..4a7cc87 100644 --- a/chrome/browser/extensions/api/settings_private/prefs_util.cc +++ b/chrome/browser/extensions/api/settings_private/prefs_util.cc
@@ -60,6 +60,7 @@ #include "ash/constants/ash_pref_names.h" #include "ash/public/cpp/ambient/ambient_prefs.h" #include "ash/public/cpp/ash_pref_names.h" // nogncheck +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/guest_os/guest_os_pref_names.h" #include "chrome/browser/ash/ownership/owner_settings_service_ash.h" #include "chrome/browser/ash/ownership/owner_settings_service_ash_factory.h" @@ -68,7 +69,6 @@ #include "chrome/browser/ash/settings/cros_settings.h" #include "chrome/browser/ash/settings/supervised_user_cros_settings_provider.h" #include "chrome/browser/ash/system/timezone_util.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/full_restore/full_restore_prefs.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/extensions/api/settings_private/chromeos_resolve_time_zone_by_geolocation_method_short.h"
diff --git a/chrome/browser/extensions/api/terminal/crostini_startup_status.h b/chrome/browser/extensions/api/terminal/crostini_startup_status.h index f8052503..2d17ea28 100644 --- a/chrome/browser/extensions/api/terminal/crostini_startup_status.h +++ b/chrome/browser/extensions/api/terminal/crostini_startup_status.h
@@ -10,7 +10,7 @@ #include "base/bind.h" #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_simple_types.h" #include "chrome/browser/chromeos/crostini/crostini_types.mojom.h"
diff --git a/chrome/browser/extensions/api/terminal/terminal_private_api.cc b/chrome/browser/extensions/api/terminal/terminal_private_api.cc index 682b4a21..d01567e 100644 --- a/chrome/browser/extensions/api/terminal/terminal_private_api.cc +++ b/chrome/browser/extensions/api/terminal/terminal_private_api.cc
@@ -22,9 +22,9 @@ #include "base/strings/stringprintf.h" #include "base/system/sys_info.h" #include "base/values.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_terminal.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/extensions/api/terminal/crostini_startup_status.h"
diff --git a/chrome/browser/extensions/crx_installer_browsertest.cc b/chrome/browser/extensions/crx_installer_browsertest.cc index 7d05f18..bcaceda 100644 --- a/chrome/browser/extensions/crx_installer_browsertest.cc +++ b/chrome/browser/extensions/crx_installer_browsertest.cc
@@ -82,9 +82,9 @@ namespace { const char kAppUrl[] = "http://www.google.com"; -const char kAppTitle[] = "Test title"; -const char kAppDescription[] = "Test description"; -const char kShortcutItemName[] = "shortcut"; +const char16_t kAppTitle[] = u"Test title"; +const char16_t kAppDescription[] = u"Test description"; +const char16_t kShortcutItemName[] = u"shortcut"; const char kShortcutUrl[] = "http://www.google.com/shortcut"; const char kShortcutIconUrl[] = "http://www.google.com/shortcut/icon.png"; @@ -140,14 +140,14 @@ return bitmap; } -WebApplicationInfo CreateWebAppInfo(const char* title, - const char* description, +WebApplicationInfo CreateWebAppInfo(const char16_t* title, + const char16_t* description, const char* start_url, int size, bool create_with_shortcuts) { WebApplicationInfo web_app_info; - web_app_info.title = base::UTF8ToUTF16(title); - web_app_info.description = base::UTF8ToUTF16(description); + web_app_info.title = title; + web_app_info.description = description; web_app_info.start_url = GURL(start_url); web_app_info.scope = GURL(start_url); web_app_info.icon_bitmaps.any[size] = CreateSquareBitmap(size); @@ -155,7 +155,7 @@ WebApplicationShortcutsMenuItemInfo shortcut_item; WebApplicationShortcutsMenuItemInfo::Icon icon; IconBitmaps shortcut_icon_bitmaps; - shortcut_item.name = base::UTF8ToUTF16(kShortcutItemName); + shortcut_item.name = kShortcutItemName; shortcut_item.url = GURL(kShortcutUrl); icon.url = GURL(kShortcutIconUrl); icon.square_size_px = size;
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index d6b55ad..91fdf018 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -938,11 +938,6 @@ "expiry_milestone": 92 }, { - "name": "default-chrome-app-uninstall-sync", - "owners": [ "alancutter", "desktop-pwas-team@google.com" ], - "expiry_milestone": 92 - }, - { "name": "deprecate-alt-click", "owners": [ "zentaro@google.com", "jimmyxgong@google.com", "cros-peripherals@google.com"],
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index aa89c3bd..cd752e2 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -105,12 +105,6 @@ "reporting delays and noise. Only works if the Conversion Measurement API " "is already enabled."; -const char kDefaultChromeAppUninstallSyncName[] = - "Default Chrome app uninstall sync"; -const char kDefaultChromeAppUninstallSyncDescription[] = - "Synchronizes uninstallation of default Chrome apps across Chrome OS " - "devices."; - const char kDeprecateMenagerieAPIName[] = "Deprecate Menagerie API on Android"; const char kDeprecateMenagerieAPIDescription[] = "If enabled, the legacy Menagerie API for profile data will be replaced by "
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 5ee4bc4d..a146c850 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -96,9 +96,6 @@ extern const char kConversionMeasurementDebugModeName[]; extern const char kConversionMeasurementDebugModeDescription[]; -extern const char kDefaultChromeAppUninstallSyncName[]; -extern const char kDefaultChromeAppUninstallSyncDescription[]; - extern const char kDeprecateMenagerieAPIName[]; extern const char kDeprecateMenagerieAPIDescription[];
diff --git a/chrome/browser/interstitials/security_interstitial_idn_test.cc b/chrome/browser/interstitials/security_interstitial_idn_test.cc index 37147f69..7009e4c 100644 --- a/chrome/browser/interstitials/security_interstitial_idn_test.cc +++ b/chrome/browser/interstitials/security_interstitial_idn_test.cc
@@ -20,7 +20,7 @@ testing::AssertionResult SecurityInterstitialIDNTest::VerifyIDNDecoded() const { const char kHostname[] = "xn--d1abbgf6aiiy.xn--p1ai"; - const char kHostnameUnicode[] = "президент.рф"; + const char16_t kHostnameUnicode[] = u"президент.рф"; std::string request_url_spec = base::StringPrintf("https://%s/", kHostname); GURL request_url(request_url_spec); @@ -35,9 +35,9 @@ net::ERR_BLOCKED_BY_CLIENT); observer.Wait(); delete blocking_page; - if (ui_test_utils::FindInPage(contents, base::UTF8ToUTF16(kHostnameUnicode), - true /*forward*/, true /*case_sensitive*/, - nullptr, nullptr) == 1) { + if (ui_test_utils::FindInPage(contents, kHostnameUnicode, true /*forward*/, + true /*case_sensitive*/, nullptr, + nullptr) == 1) { return testing::AssertionSuccess(); } return testing::AssertionFailure() << "Interstitial not displaying text";
diff --git a/chrome/browser/media/media_engagement_service.h b/chrome/browser/media/media_engagement_service.h index 9323dada..3fcfad8 100644 --- a/chrome/browser/media/media_engagement_service.h +++ b/chrome/browser/media/media_engagement_service.h
@@ -11,7 +11,6 @@ #include "base/macros.h" #include "base/scoped_observation.h" -#include "base/values.h" #include "chrome/browser/media/media_engagement_score.h" #include "chrome/browser/media/media_engagement_score_details.mojom.h" #include "components/history/core/browser/history_service.h"
diff --git a/chrome/browser/media/router/discovery/dial/dial_device_data.h b/chrome/browser/media/router/discovery/dial/dial_device_data.h index 76d31da5..1506934 100644 --- a/chrome/browser/media/router/discovery/dial/dial_device_data.h +++ b/chrome/browser/media/router/discovery/dial/dial_device_data.h
@@ -9,7 +9,6 @@ #include <vector> #include "base/time/time.h" -#include "base/values.h" #include "url/gurl.h" namespace net {
diff --git a/chrome/browser/media/router/discovery/dial/safe_dial_app_info_parser.h b/chrome/browser/media/router/discovery/dial/safe_dial_app_info_parser.h index 0f2e081..7044fda 100644 --- a/chrome/browser/media/router/discovery/dial/safe_dial_app_info_parser.h +++ b/chrome/browser/media/router/discovery/dial/safe_dial_app_info_parser.h
@@ -12,7 +12,6 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/optional.h" -#include "base/values.h" #include "chrome/browser/media/router/discovery/dial/parsed_dial_app_info.h" #include "services/data_decoder/public/cpp/data_decoder.h"
diff --git a/chrome/browser/media/router/discovery/dial/safe_dial_device_description_parser.h b/chrome/browser/media/router/discovery/dial/safe_dial_device_description_parser.h index 0a17b18..bdf4eec 100644 --- a/chrome/browser/media/router/discovery/dial/safe_dial_device_description_parser.h +++ b/chrome/browser/media/router/discovery/dial/safe_dial_device_description_parser.h
@@ -12,7 +12,6 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/optional.h" -#include "base/values.h" #include "chrome/browser/media/router/discovery/dial/parsed_dial_device_description.h" #include "services/data_decoder/public/cpp/data_decoder.h"
diff --git a/chrome/browser/metrics/testing/metrics_reporting_pref_helper.h b/chrome/browser/metrics/testing/metrics_reporting_pref_helper.h index 2a56779..ab0f9181 100644 --- a/chrome/browser/metrics/testing/metrics_reporting_pref_helper.h +++ b/chrome/browser/metrics/testing/metrics_reporting_pref_helper.h
@@ -8,7 +8,6 @@ #include "base/files/file_path.h" #include "base/macros.h" #include "base/path_service.h" -#include "base/values.h" namespace metrics {
diff --git a/chrome/browser/notifications/scheduler/internal/notification_scheduler_unittest.cc b/chrome/browser/notifications/scheduler/internal/notification_scheduler_unittest.cc index 0e821bb..96fc8c94 100644 --- a/chrome/browser/notifications/scheduler/internal/notification_scheduler_unittest.cc +++ b/chrome/browser/notifications/scheduler/internal/notification_scheduler_unittest.cc
@@ -38,7 +38,7 @@ namespace { const char kGuid[] = "guid"; -const char kTitle[] = "title"; +const char16_t kTitle[] = u"title"; class NotificationSchedulerTest : public testing::Test { public: @@ -293,8 +293,8 @@ OnStartTask(); } -MATCHER_P(NotifcationDataEq, title, "Verify notification data.") { - EXPECT_EQ(arg->title, base::UTF8ToUTF16(title)); +MATCHER_P(NotificationDataEq, title, "Verify notification data.") { + EXPECT_EQ(arg->title, title); return true; } @@ -313,7 +313,7 @@ std::make_unique<NotificationEntry>(SchedulerClientType::kTest1, kGuid); EXPECT_CALL( *display_agent(), - ShowNotification(NotifcationDataEq(kTitle), + ShowNotification(NotificationDataEq(kTitle), SystemDataEq(SchedulerClientType::kTest1, kGuid))); DisplayDecider::Results result({kGuid}); EXPECT_CALL(*display_decider(), FindNotificationsToShow(_, _, _)) @@ -333,7 +333,7 @@ [&](std::unique_ptr<NotificationData> notification_data, NotificationSchedulerClient::NotificationDataCallback callback) { // The client updates the notification data here. - notification_data->title = base::UTF8ToUTF16(kTitle); + notification_data->title = kTitle; std::move(callback).Run(std::move(notification_data)); }));
diff --git a/chrome/browser/notifications/scheduler/internal/scheduled_notification_manager_unittest.cc b/chrome/browser/notifications/scheduler/internal/scheduled_notification_manager_unittest.cc index 921c364..a1de226 100644 --- a/chrome/browser/notifications/scheduler/internal/scheduled_notification_manager_unittest.cc +++ b/chrome/browser/notifications/scheduler/internal/scheduled_notification_manager_unittest.cc
@@ -30,7 +30,7 @@ const char kGuid[] = "test_guid_1234"; const char kNonExistentGuid[] = "guid_non_existent"; -const char kTitle[] = "test_title"; +const char16_t kTitle[] = u"test_title"; const char kSmallIconUuid[] = "test_small_icon_uuid"; const char kLargeIconUuid[] = "test_large_icon_uuid"; @@ -298,7 +298,7 @@ TEST_F(ScheduledNotificationManagerTest, ScheduleNotification) { InitWithData(std::vector<NotificationEntry>()); NotificationData notification_data; - notification_data.title = base::UTF8ToUTF16(kTitle); + notification_data.title = kTitle; ScheduleParams schedule_params; schedule_params.priority = ScheduleParams::Priority::kLow; auto params = std::make_unique<NotificationParams>( @@ -333,7 +333,7 @@ EXPECT_NE(entry->create_time, base::Time()); // TODO(xingliu): change these to compare with operator==. - EXPECT_EQ(base::UTF16ToUTF8(entry->notification_data.title), kTitle); + EXPECT_EQ(entry->notification_data.title, kTitle); EXPECT_EQ(entry->schedule_params.priority, ScheduleParams::Priority::kLow); // Verify that |enable_ihnr_buttons| will add the helpful/unhelpful buttons. @@ -349,7 +349,7 @@ TEST_F(ScheduledNotificationManagerTest, ScheduleInvalidNotification) { InitWithData(std::vector<NotificationEntry>()); NotificationData notification_data; - notification_data.title = base::UTF8ToUTF16(kTitle); + notification_data.title = kTitle; ScheduleParams schedule_params; // Client type kTest3 is not registered. auto params = std::make_unique<NotificationParams>( @@ -367,7 +367,7 @@ InitWithData(std::vector<NotificationEntry>({entry})); NotificationData notification_data; - notification_data.title = base::UTF8ToUTF16(kTitle); + notification_data.title = kTitle; ScheduleParams schedule_params; auto params = std::make_unique<NotificationParams>( SchedulerClientType::kTest1, notification_data, schedule_params);
diff --git a/chrome/browser/notifications/win/notification_template_builder_unittest.cc b/chrome/browser/notifications/win/notification_template_builder_unittest.cc index 35c129c..991acaa 100644 --- a/chrome/browser/notifications/win/notification_template_builder_unittest.cc +++ b/chrome/browser/notifications/win/notification_template_builder_unittest.cc
@@ -29,8 +29,8 @@ const char kContextMenuLabel[] = "settings"; const char kEncodedId[] = "0|0|Default|0|https://example.com/|notification_id"; const char kNotificationId[] = "notification_id"; -const char kNotificationTitle[] = "My Title"; -const char kNotificationMessage[] = "My Message"; +const char16_t kNotificationTitle[] = u"My Title"; +const char16_t kNotificationMessage[] = u"My Message"; const char kNotificationOrigin[] = "https://example.com"; base::Time FixedTime() { @@ -67,8 +67,7 @@ GURL origin_url(kNotificationOrigin); message_center::Notification notification( message_center::NOTIFICATION_TYPE_SIMPLE, kNotificationId, - base::UTF8ToUTF16(kNotificationTitle), - base::UTF8ToUTF16(kNotificationMessage), gfx::Image() /* icon */, + kNotificationTitle, kNotificationMessage, gfx::Image() /* icon */, std::u16string() /* display_source */, origin_url, NotifierId(origin_url), RichNotificationData(), nullptr /* delegate */); // Set a fixed timestamp, to avoid having to test against current timestamp.
diff --git a/chrome/browser/optimization_guide/optimization_guide_top_host_provider.h b/chrome/browser/optimization_guide/optimization_guide_top_host_provider.h index c856757..7574064 100644 --- a/chrome/browser/optimization_guide/optimization_guide_top_host_provider.h +++ b/chrome/browser/optimization_guide/optimization_guide_top_host_provider.h
@@ -12,7 +12,6 @@ #include "base/macros.h" #include "base/sequence_checker.h" #include "base/time/clock.h" -#include "base/values.h" #include "components/optimization_guide/core/top_host_provider.h" class PrefService;
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc index a04983d9..2ef3ebc 100644 --- a/chrome/browser/password_manager/chrome_password_manager_client.cc +++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
@@ -927,9 +927,9 @@ void ChromePasswordManagerClient::AutomaticGenerationAvailable( const autofill::password_generation::PasswordGenerationUIData& ui_data) { - if (!password_manager::bad_message::CheckChildProcessSecurityPolicyForURL( + if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( password_generation_driver_receivers_.GetCurrentTargetFrame(), - ui_data.form_data.url, + base::make_span(&ui_data.form_data, 1), BadMessageReason:: CPMD_BAD_ORIGIN_AUTOMATIC_GENERATION_STATUS_CHANGED)) return; @@ -975,9 +975,9 @@ const autofill::FormData& form_data, autofill::FieldRendererId field_renderer_id, const std::u16string& password_value) { - if (!password_manager::bad_message::CheckChildProcessSecurityPolicyForURL( + if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( password_generation_driver_receivers_.GetCurrentTargetFrame(), - form_data.url, + base::make_span(&form_data, 1), BadMessageReason::CPMD_BAD_ORIGIN_SHOW_PASSWORD_EDITING_POPUP)) return; auto* driver = driver_factory_->GetDriverForFrame( @@ -1008,9 +1008,9 @@ void ChromePasswordManagerClient::PresaveGeneratedPassword( const autofill::FormData& form_data, const std::u16string& password_value) { - if (!password_manager::bad_message::CheckChildProcessSecurityPolicyForURL( + if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( password_generation_driver_receivers_.GetCurrentTargetFrame(), - form_data.url, + base::make_span(&form_data, 1), BadMessageReason::CPMD_BAD_ORIGIN_PRESAVE_GENERATED_PASSWORD)) { return; } @@ -1025,9 +1025,9 @@ void ChromePasswordManagerClient::PasswordNoLongerGenerated( const autofill::FormData& form_data) { - if (!password_manager::bad_message::CheckChildProcessSecurityPolicyForURL( + if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( password_generation_driver_receivers_.GetCurrentTargetFrame(), - form_data.url, + base::make_span(&form_data, 1), BadMessageReason::CPMD_BAD_ORIGIN_PASSWORD_NO_LONGER_GENERATED)) { return; } @@ -1209,7 +1209,7 @@ void ChromePasswordManagerClient::DidFinishNavigation( content::NavigationHandle* navigation_handle) { - if (!navigation_handle->IsInMainFrame() || + if (!navigation_handle->IsInPrimaryMainFrame() || navigation_handle->IsSameDocument() || !navigation_handle->HasCommitted()) { return;
diff --git a/chrome/browser/password_manager/password_manager_browsertest.cc b/chrome/browser/password_manager/password_manager_browsertest.cc index 404be84..c0240ede 100644 --- a/chrome/browser/password_manager/password_manager_browsertest.cc +++ b/chrome/browser/password_manager/password_manager_browsertest.cc
@@ -71,6 +71,7 @@ #include "content/public/common/content_switches.h" #include "content/public/test/back_forward_cache_util.h" #include "content/public/test/browser_test.h" +#include "content/public/test/prerender_test_util.h" #include "content/public/test/test_utils.h" #include "net/base/filename_util.h" #include "net/dns/mock_host_resolver.h" @@ -4099,7 +4100,6 @@ PasswordManagerSigninInterceptTestHelper helper_; }; - // Checks that password update suppresses signin interception. IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestWithSigninInterception, InterceptionBubbleSuppressedByPasswordUpdate) { @@ -4231,5 +4231,91 @@ } #endif // ENABLE_DICE_SUPPORT +class PasswordManagerPrerenderBrowserTest : public PasswordManagerBrowserTest { + public: + PasswordManagerPrerenderBrowserTest() + : prerender_helper_(base::BindRepeating( + &PasswordManagerPrerenderBrowserTest::WebContents, + base::Unretained(this))) {} + ~PasswordManagerPrerenderBrowserTest() override = default; + + void SetUpOnMainThread() override { + prerender_helper_.SetUpOnMainThread(embedded_test_server()); + + // Register requests handler before the server is started. + embedded_test_server()->RegisterRequestHandler( + base::BindRepeating(&HandleTestAuthRequest)); + + PasswordManagerBrowserTest::SetUpOnMainThread(); + } + + content::test::PrerenderTestHelper* prerender_helper() { + return &prerender_helper_; + } + + private: + content::test::PrerenderTestHelper prerender_helper_; +}; + +// Tests that the prerender doesn't proceed HTTP auth login and once the page +// is loaded as the primary page the prompt is shown. As the page is +// not loaded from the prerender, it also checks if it's not activated from the +// prerender. +IN_PROC_BROWSER_TEST_F(PasswordManagerPrerenderBrowserTest, + ChromePasswordManagerClientInPrerender) { + content::NavigationController* nav_controller = + &WebContents()->GetController(); + LoginPromptBrowserTestObserver login_observer; + login_observer.Register( + content::Source<content::NavigationController>(nav_controller)); + + GURL url = embedded_test_server()->GetURL("/prerender/add_prerender.html"); + ui_test_utils::NavigateToURL(browser(), url); + + content::test::PrerenderHostRegistryObserver registry_observer( + *WebContents()); + auto prerender_url = embedded_test_server()->GetURL("/basic_auth"); + + // Loads a page requiring HTTP auth in the prerender. + prerender_helper()->AddPrerenderAsync(prerender_url); + + // Ensure that the prerender has started. + registry_observer.WaitForTrigger(prerender_url); + auto prerender_id = prerender_helper()->GetHostForUrl(prerender_url); + EXPECT_NE(content::RenderFrameHost::kNoFrameTreeNodeId, prerender_id); + content::test::PrerenderHostObserver host_observer(*WebContents(), + prerender_id); + // PrerenderHost is destroyed by net::INVALID_AUTH_CREDENTIALS and it stops + // prerendering. + host_observer.WaitForDestroyed(); + + BubbleObserver bubble_observer(WebContents()); + EXPECT_FALSE(bubble_observer.IsSavePromptShownAutomatically()); + + WindowedAuthNeededObserver auth_needed_observer(nav_controller); + // Navigates the primary page to the URL. + prerender_helper()->NavigatePrimaryPage(prerender_url); + auth_needed_observer.Wait(); + + NavigationObserver nav_observer(WebContents()); + WindowedAuthSuppliedObserver auth_supplied_observer(nav_controller); + // Offer valid credentials on the auth challenge. + EXPECT_EQ(1u, login_observer.handlers().size()); + LoginHandler* handler = *login_observer.handlers().begin(); + EXPECT_TRUE(handler); + // Any username/password will work. + handler->SetAuth(u"user", u"pwd"); + auth_supplied_observer.Wait(); + + // The password manager should be working correctly. + nav_observer.Wait(); + WaitForPasswordStore(); + EXPECT_TRUE(bubble_observer.IsSavePromptShownAutomatically()); + + // Make sure that the prerender was not activated. + EXPECT_FALSE(host_observer.was_activated()); +} + } // namespace + } // namespace password_manager
diff --git a/chrome/browser/password_manager/password_manager_signin_intercept_test_helper.cc b/chrome/browser/password_manager/password_manager_signin_intercept_test_helper.cc index 53fa1b63..27186a3 100644 --- a/chrome/browser/password_manager/password_manager_signin_intercept_test_helper.cc +++ b/chrome/browser/password_manager/password_manager_signin_intercept_test_helper.cc
@@ -37,6 +37,7 @@ constexpr char kGaiaUsername[] = "username"; constexpr char16_t kGaiaUsername16[] = u"username"; constexpr char kGaiaEmail[] = "username@gmail.com"; +constexpr char16_t kGaiaEmail16[] = u"username@gmail.com"; constexpr char kGaiaId[] = "test_gaia_id"; } // namespace @@ -102,7 +103,7 @@ params.profile_path = profile_path; params.profile_name = u"TestProfileName"; params.gaia_id = kGaiaId; - params.user_name = base::UTF8ToUTF16(kGaiaEmail); + params.user_name = kGaiaEmail16; profile_storage->AddProfile(std::move(params)); // Check that the signin qualifies for interception.
diff --git a/chrome/browser/policy/boolean_disabling_policy_handler.h b/chrome/browser/policy/boolean_disabling_policy_handler.h index bc0c145..777a2c7 100644 --- a/chrome/browser/policy/boolean_disabling_policy_handler.h +++ b/chrome/browser/policy/boolean_disabling_policy_handler.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_POLICY_BOOLEAN_DISABLING_POLICY_HANDLER_H_ #define CHROME_BROWSER_POLICY_BOOLEAN_DISABLING_POLICY_HANDLER_H_ -#include "base/values.h" #include "components/policy/core/browser/configuration_policy_handler.h" class PrefValueMap;
diff --git a/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc b/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc index a337f8f..99dc646 100644 --- a/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc +++ b/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc
@@ -51,6 +51,10 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#if BUILDFLAG(IS_CHROMEOS_LACROS) +#include "chromeos/lacros/lacros_test_helper.h" +#endif + #if defined(OS_ANDROID) #include "chrome/browser/policy/cloud/user_policy_signin_service_mobile.h" #else @@ -297,6 +301,9 @@ std::unique_ptr<TestingPrefServiceSimple> local_state_; network::TestURLLoaderFactory test_url_loader_factory_; +#if BUILDFLAG(IS_CHROMEOS_LACROS) + chromeos::ScopedLacrosServiceTestHelper test_helper; +#endif }; class UserPolicySigninServiceSignedInTest : public UserPolicySigninServiceTest {
diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc index eac00a1..9cc50b1 100644 --- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc +++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
@@ -125,8 +125,8 @@ #include "ash/public/cpp/ash_pref_names.h" #include "chrome/browser/ash/accessibility/magnifier_type.h" #include "chrome/browser/ash/borealis/borealis_prefs.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_pref_names.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_policy_handler.h" #include "chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h" #include "chrome/browser/chromeos/policy/lacros_availability_policy_handler.h"
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 0c37c3e..568392c0 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc
@@ -274,9 +274,9 @@ #include "chrome/browser/ash/child_accounts/screen_time_controller.h" #include "chrome/browser/ash/child_accounts/time_limits/app_activity_registry.h" #include "chrome/browser/ash/child_accounts/time_limits/app_time_controller.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/customization/customization_document.h" #include "chrome/browser/ash/scanning/chrome_scanning_app_delegate.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/cryptauth/client_app_metadata_provider_service.h" #include "chrome/browser/chromeos/cryptauth/cryptauth_device_id_provider_impl.h" #include "chrome/browser/chromeos/extensions/echo_private_api.h"
diff --git a/chrome/browser/prefs/chrome_command_line_pref_store.h b/chrome/browser/prefs/chrome_command_line_pref_store.h index 63210902..aa42b5a 100644 --- a/chrome/browser/prefs/chrome_command_line_pref_store.h +++ b/chrome/browser/prefs/chrome_command_line_pref_store.h
@@ -7,7 +7,6 @@ #include "base/command_line.h" #include "base/macros.h" -#include "base/values.h" #include "components/prefs/command_line_pref_store.h" // This PrefStore keeps track of preferences set by command-line switches,
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc index 6c70ed5..cc9aaff 100644 --- a/chrome/browser/printing/print_job_worker.cc +++ b/chrome/browser/printing/print_job_worker.cc
@@ -47,6 +47,10 @@ #include "printing/printing_features.h" #endif +#if (defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && defined(USE_CUPS) +#include "printing/mojom/print.mojom.h" +#endif + using content::BrowserThread; namespace printing { @@ -226,7 +230,8 @@ #if (defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && defined(USE_CUPS) PrinterBasicInfo basic_info; - if (print_backend->GetPrinterBasicInfo(printer_name, &basic_info)) { + if (print_backend->GetPrinterBasicInfo(printer_name, &basic_info) == + mojom::ResultCode::kSuccess) { base::Value advanced_settings(base::Value::Type::DICTIONARY); for (const auto& pair : basic_info.options) advanced_settings.SetStringKey(pair.first, pair.second);
diff --git a/chrome/browser/profile_resetter/profile_resetter_unittest.cc b/chrome/browser/profile_resetter/profile_resetter_unittest.cc index 978f2f7..547a86c 100644 --- a/chrome/browser/profile_resetter/profile_resetter_unittest.cc +++ b/chrome/browser/profile_resetter/profile_resetter_unittest.cc
@@ -795,9 +795,9 @@ settings->GetUrlsToRestoreOnStartup()); EXPECT_TRUE(startup_list); std::vector<std::string> startup_pages; - for (auto i = startup_list->begin(); i != startup_list->end(); ++i) { + for (const auto& entry : startup_list->GetList()) { std::string url; - EXPECT_TRUE(i->GetAsString(&url)); + EXPECT_TRUE(entry.GetAsString(&url)); startup_pages.push_back(url); } ASSERT_EQ(2u, startup_pages.size());
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc index 76379733..d3ddfb74 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc
@@ -215,9 +215,8 @@ auto web_app_info = std::make_unique<WebApplicationInfo>(); web_app_info->start_url = start_url; web_app_info->scope = start_url; - web_app_info->title = base::UTF8ToUTF16("Test app \xF0\x9F\x90\x90"); - web_app_info->description = - base::UTF8ToUTF16("Test description \xF0\x9F\x90\x90"); + web_app_info->title = u"Test app 🐐"; + web_app_info->description = u"Test description 🐐"; web_app_info->open_as_window = open_as_window; return web_app::test::InstallWebApp(browser()->profile(),
diff --git a/chrome/browser/resources/bookmarks/BUILD.gn b/chrome/browser/resources/bookmarks/BUILD.gn index db1a81ee..dd8bd076 100644 --- a/chrome/browser/resources/bookmarks/BUILD.gn +++ b/chrome/browser/resources/bookmarks/BUILD.gn
@@ -285,6 +285,7 @@ ":types", ":util", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", + "//ui/webui/resources/js:util.m", ] }
diff --git a/chrome/browser/resources/bookmarks/app.js b/chrome/browser/resources/bookmarks/app.js index f889786..9204c8c 100644 --- a/chrome/browser/resources/bookmarks/app.js +++ b/chrome/browser/resources/bookmarks/app.js
@@ -12,59 +12,74 @@ import './router.js'; import './shared_vars.js'; import './strings.m.js'; -import './toolbar.js'; +import './command_manager.js'; -import {FindShortcutBehavior} from 'chrome://resources/cr_elements/find_shortcut_behavior.js'; +import {FindShortcutBehavior, FindShortcutBehaviorInterface} from 'chrome://resources/cr_elements/find_shortcut_behavior.js'; +import {StoreObserver} from 'chrome://resources/js/cr/ui/store.m.js'; +import {StoreClientInterface as CrUiStoreClientInterface} from 'chrome://resources/js/cr/ui/store_client.m.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; -import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {setSearchResults} from './actions.js'; import {destroy as destroyApiListener, init as initApiListener} from './api_listener.js'; -import {CommandManager} from './command_manager.js'; import {LOCAL_STORAGE_FOLDER_STATE_KEY, LOCAL_STORAGE_TREE_WIDTH_KEY, ROOT_NODE_ID} from './constants.js'; import {DNDManager} from './dnd_manager.js'; import {MouseFocusBehavior} from './mouse_focus_behavior.js'; import {Store} from './store.js'; -import {StoreClient} from './store_client.js'; -import {FolderOpenState} from './types.js'; +import {BookmarksStoreClientInterface, StoreClient} from './store_client.js'; +import {BookmarksToolbarElement} from './toolbar.js'; +import {BookmarksPageState, FolderOpenState} from './types.js'; import {createEmptyState, normalizeNodes} from './util.js'; -Polymer({ - is: 'bookmarks-app', +/** + * @constructor + * @extends {PolymerElement} + * @implements {BookmarksStoreClientInterface} + * @implements {CrUiStoreClientInterface} + * @implements {StoreObserver<BookmarksPageState>} + * @implements {FindShortcutBehaviorInterface} + */ +const BookmarksAppElementBase = mixinBehaviors( + [StoreClient, MouseFocusBehavior, FindShortcutBehavior], PolymerElement); - _template: html`{__html_template__}`, +/** @polymer */ +export class BookmarksAppElement extends BookmarksAppElementBase { + static get is() { + return 'bookmarks-app'; + } - behaviors: [ - MouseFocusBehavior, - StoreClient, - FindShortcutBehavior, - ], + static get template() { + return html`{__html_template__}`; + } - properties: { - /** @private */ - searchTerm_: { - type: String, - observer: 'searchTermChanged_', - }, + static get properties() { + return { + /** @private */ + searchTerm_: { + type: String, + observer: 'searchTermChanged_', + }, - /** @type {FolderOpenState} */ - folderOpenState_: { - type: Object, - observer: 'folderOpenStateChanged_', - }, + /** @type {FolderOpenState} */ + folderOpenState_: { + type: Object, + observer: 'folderOpenStateChanged_', + }, - /** @private */ - sidebarWidth_: String, - }, + /** @private */ + sidebarWidth_: String, + }; + } - /** @private{?function(!Event)} */ - boundUpdateSidebarWidth_: null, + constructor() { + super(); - /** @private {DNDManager} */ - dndManager_: null, + /** @private{?function(!Event)} */ + this.boundUpdateSidebarWidth_ = null; - /** @override */ - created() { + /** @private {DNDManager} */ + this.dndManager_ = null; + // Regular expression that captures the leading slash, the content and the // trailing slash in three different groups. const CANONICAL_PATH_REGEX = /(^\/)([\/-\w]+)(\/$)/; @@ -72,10 +87,12 @@ if (path !== '/') { // Only queries are supported, not subpages. window.history.replaceState(undefined /* stateObject */, '', '/'); } - }, + } /** @override */ - attached() { + connectedCallback() { + super.connectedCallback(); + document.documentElement.classList.remove('loading'); this.watch('searchTerm_', function(state) { @@ -115,13 +132,15 @@ this.dndManager_ = new DNDManager(); this.dndManager_.init(); - }, + } - detached() { + disconnectedCallback() { + super.disconnectedCallback(); + window.removeEventListener('resize', this.boundUpdateSidebarWidth_); this.dndManager_.destroy(); destroyApiListener(); - }, + } /** * Set up the splitter and set the initial width from localStorage. @@ -147,19 +166,22 @@ splitter.addEventListener('dragmove', this.boundUpdateSidebarWidth_); window.addEventListener('resize', this.boundUpdateSidebarWidth_); - }, + } /** @private */ updateSidebarWidth_() { this.sidebarWidth_ = /** @type {string} */ (getComputedStyle(this.$.sidebar).width); - }, + } /** @private */ searchTermChanged_(newValue, oldValue) { if (oldValue !== undefined && !newValue) { - this.fire( - 'iron-announce', {text: loadTimeData.getString('searchCleared')}); + this.dispatchEvent(new CustomEvent('iron-announce', { + bubbles: true, + composed: true, + detail: {text: loadTimeData.getString('searchCleared')} + })); } if (!this.searchTerm_) { @@ -171,36 +193,49 @@ return node.id; }); this.dispatch(setSearchResults(ids)); - this.fire('iron-announce', { - text: ids.length > 0 ? - loadTimeData.getStringF('searchResults', this.searchTerm_) : - loadTimeData.getString('noSearchResults') - }); + this.dispatchEvent(new CustomEvent('iron-announce', { + bubbles: true, + composed: true, + detail: { + text: ids.length > 0 ? + loadTimeData.getStringF('searchResults', this.searchTerm_) : + loadTimeData.getString('noSearchResults') + } + })); }); - }, + } /** @private */ folderOpenStateChanged_() { window.localStorage[LOCAL_STORAGE_FOLDER_STATE_KEY] = JSON.stringify(Array.from(this.folderOpenState_)); - }, + } // Override FindShortcutBehavior methods. + /** @override */ handleFindShortcut(modalContextOpen) { if (modalContextOpen) { return false; } - this.$$('bookmarks-toolbar').searchField.showAndFocus(); + /** @type {!BookmarksToolbarElement} */ ( + this.shadowRoot.querySelector('bookmarks-toolbar')) + .searchField.showAndFocus(); return true; - }, + } // Override FindShortcutBehavior methods. + /** @override */ searchInputHasFocus() { - return this.$$('bookmarks-toolbar').searchField.isSearchFocused(); - }, + return /** @type {!BookmarksToolbarElement} */ ( + this.shadowRoot.querySelector('bookmarks-toolbar')) + .searchField.isSearchFocused(); + } /** @private */ onUndoClick_() { - this.fire('command-undo'); - }, -}); + this.dispatchEvent( + new CustomEvent('command-undo', {bubbles: true, composed: true})); + } +} + +customElements.define(BookmarksAppElement.is, BookmarksAppElement);
diff --git a/chrome/browser/resources/bookmarks/bookmarks.js b/chrome/browser/resources/bookmarks/bookmarks.js index e05fd88..8fe70be 100644 --- a/chrome/browser/resources/bookmarks/bookmarks.js +++ b/chrome/browser/resources/bookmarks/bookmarks.js
@@ -6,7 +6,7 @@ export {changeFolderOpen, clearSearch, createBookmark, deselectItems, editBookmark, moveBookmark, removeBookmark, reorderChildren, selectFolder, selectItem, setSearchResults, setSearchTerm, updateAnchor} from './actions.js'; export {BrowserProxy} from './browser_proxy.js'; -export {CommandManager} from './command_manager.js'; +export {BookmarksCommandManagerElement} from './command_manager.js'; export {Command, DropPosition, IncognitoAvailability, LOCAL_STORAGE_FOLDER_STATE_KEY, LOCAL_STORAGE_TREE_WIDTH_KEY, MenuSource, ROOT_NODE_ID} from './constants.js'; export {DialogFocusManager} from './dialog_focus_manager.js'; export {DragInfo} from './dnd_manager.js';
diff --git a/chrome/browser/resources/bookmarks/browser_proxy.js b/chrome/browser/resources/bookmarks/browser_proxy.js index 521120b..8d615c99 100644 --- a/chrome/browser/resources/bookmarks/browser_proxy.js +++ b/chrome/browser/resources/bookmarks/browser_proxy.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js'; +import {sendWithPromise} from 'chrome://resources/js/cr.m.js'; import {IncognitoAvailability} from './constants.js'; @@ -33,6 +33,17 @@ chrome.send( 'metricsHandler:recordInHistogram', [histogram, bucket, maxBucket]); } + + /** @return {!BrowserProxy} */ + static getInstance() { + return instance || (instance = new BrowserProxy()); + } + + /** @param {!BrowserProxy} obj */ + static setInstance(obj) { + instance = obj; + } } -addSingletonGetter(BrowserProxy); +/** @type {?BrowserProxy} */ +let instance = null;
diff --git a/chrome/browser/resources/bookmarks/command_manager.js b/chrome/browser/resources/bookmarks/command_manager.js index 11e79ac..f47e1c0 100644 --- a/chrome/browser/resources/bookmarks/command_manager.js +++ b/chrome/browser/resources/bookmarks/command_manager.js
@@ -19,63 +19,87 @@ import {assert, assertNotReached} from 'chrome://resources/js/assert.m.js'; import {isMac} from 'chrome://resources/js/cr.m.js'; import {KeyboardShortcutList} from 'chrome://resources/js/cr/ui/keyboard_shortcut_list.m.js'; +import {StoreObserver} from 'chrome://resources/js/cr/ui/store.m.js'; +import {StoreClientInterface as CrUiStoreClientInterface} from 'chrome://resources/js/cr/ui/store_client.m.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {PluralStringProxyImpl} from 'chrome://resources/js/plural_string_proxy.js'; import {IronA11yAnnouncer} from 'chrome://resources/polymer/v3_0/iron-a11y-announcer/iron-a11y-announcer.js'; -import {afterNextRender, flush, html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {afterNextRender, flush, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {deselectItems, selectAll, selectFolder} from './actions.js'; import {highlightUpdatedItems, trackUpdatedItems} from './api_listener.js'; import {BrowserProxy} from './browser_proxy.js'; import {Command, IncognitoAvailability, MenuSource, OPEN_CONFIRMATION_LIMIT, ROOT_NODE_ID} from './constants.js'; import {DialogFocusManager} from './dialog_focus_manager.js'; -import {StoreClient} from './store_client.js'; -import {BookmarkNode} from './types.js'; +import {BookmarksEditDialogElement} from './edit_dialog.js'; +import {BookmarksStoreClientInterface, StoreClient} from './store_client.js'; +import {BookmarkNode, BookmarksPageState} from './types.js'; import {canEditNode, canReorderChildren, getDisplayedList} from './util.js'; -export const CommandManager = Polymer({ - is: 'bookmarks-command-manager', +/** + * @constructor + * @extends {PolymerElement} + * @implements {BookmarksStoreClientInterface} + * @implements {CrUiStoreClientInterface} + * @implements {StoreObserver<BookmarksPageState>} + */ +const BookmarksCommandManagerElementBase = + mixinBehaviors([StoreClient], PolymerElement); - _template: html`{__html_template__}`, +/** @type {?BookmarksCommandManagerElement} */ +let instance = null; - behaviors: [ - StoreClient, - ], +/** @polymer */ +export class BookmarksCommandManagerElement extends + BookmarksCommandManagerElementBase { + static get is() { + return 'bookmarks-command-manager'; + } - properties: { - /** @private {!Array<Command>} */ - menuCommands_: { - type: Array, - computed: 'computeMenuCommands_(menuSource_)', - }, + static get template() { + return html`{__html_template__}`; + } - /** @private {Set<string>} */ - menuIds_: Object, + static get properties() { + return { + /** @private {!Array<Command>} */ + menuCommands_: { + type: Array, + computed: 'computeMenuCommands_(menuSource_)', + }, - /** - * Indicates where the context menu was opened from. Will be NONE if - * menu is not open, indicating that commands are from keyboard shortcuts - * or elsewhere in the UI. - * @private {MenuSource} - */ - menuSource_: { - type: Number, - value: MenuSource.NONE, - }, + /** @private {Set<string>} */ + menuIds_: Object, - /** @private */ - canPaste_: Boolean, + /** + * Indicates where the context menu was opened from. Will be NONE if + * menu is not open, indicating that commands are from keyboard shortcuts + * or elsewhere in the UI. + * @private {MenuSource} + */ + menuSource_: { + type: Number, + value: MenuSource.NONE, + }, - /** @private */ - globalCanEdit_: Boolean, - }, + /** @private */ + canPaste_: Boolean, - /** @private {?Function} */ - confirmOpenCallback_: null, + /** @private */ + globalCanEdit_: Boolean, + }; + } - attached() { - assert(CommandManager.instance_ === null); - CommandManager.instance_ = this; + constructor() { + super(); + /** @private {?Function} */ + this.confirmOpenCallback_ = null; + } + + connectedCallback() { + super.connectedCallback(); + assert(instance === null); + instance = this; /** @private {!BrowserProxy} */ this.browserProxy_ = BrowserProxy.getInstance(); @@ -138,14 +162,15 @@ afterNextRender(this, function() { IronA11yAnnouncer.requestAvailability(); }); - }, + } - detached() { - CommandManager.instance_ = null; + disconnectedCallback() { + super.disconnectedCallback(); + instance = null; this.boundListeners_.forEach( (handler, eventName) => document.removeEventListener(eventName, handler)); - }, + } /** * Display the command context menu at (|x|, |y|) in window coordinates. @@ -168,7 +193,7 @@ dropdown.getDialog(), function() { dropdown.showAtPosition({top: y, left: x}); }); - }, + } /** * Display the command context menu positioned to cover the |target| @@ -188,13 +213,13 @@ dropdown.getDialog(), function() { dropdown.showAt(target); }); - }, + } closeCommandMenu() { this.menuIds_ = new Set(); this.menuSource_ = MenuSource.NONE; /** @type {!CrActionMenuElement} */ (this.$.dropdown.get()).close(); - }, + } //////////////////////////////////////////////////////////////////////////// // Command handlers: @@ -232,7 +257,7 @@ return this.isCommandVisible_(command, itemIds) && this.isCommandEnabled_(command, itemIds); } - }, + } /** * @param {Command} command @@ -272,7 +297,7 @@ return true; } return assert(false); - }, + } /** * @param {Command} command @@ -308,7 +333,7 @@ default: return true; } - }, + } /** * Returns whether the currently displayed bookmarks list can be changed. @@ -319,7 +344,7 @@ const state = this.getState(); return state.search.term === '' && canReorderChildren(state, state.selectedFolder); - }, + } /** * @param {Command} command @@ -360,7 +385,8 @@ this.dispatch( selectFolder(assert(state.nodes[id].parentId), state.nodes)); DialogFocusManager.getInstance().clearFocus(); - this.fire('highlight-items', [id]); + this.dispatchEvent(new CustomEvent( + 'highlight-items', {bubbles: true, composed: true, detail: [id]})); break; } case Command.DELETE: { @@ -408,9 +434,11 @@ case Command.DESELECT_ALL: this.dispatch(deselectItems()); IronA11yAnnouncer.requestAvailability(); - this.fire('iron-announce', { - text: loadTimeData.getString('itemsUnselected'), - }); + this.dispatchEvent(new CustomEvent('iron-announce', { + bubbles: true, + composed: true, + detail: {text: loadTimeData.getString('itemsUnselected')} + })); break; case Command.CUT: chrome.bookmarkManagerPrivate.cut(Array.from(itemIds)); @@ -450,7 +478,7 @@ } this.recordCommandHistogram_( itemIds, 'BookmarkManager.CommandExecuted', command); - }, + } /** * @param {!Event} e @@ -473,7 +501,7 @@ } return false; - }, + } //////////////////////////////////////////////////////////////////////////// // Private functions: @@ -489,7 +517,7 @@ addShortcut_(command, shortcut, macShortcut) { shortcut = (isMac && macShortcut) ? macShortcut : shortcut; this.shortcuts_.set(command, new KeyboardShortcutList(shortcut)); - }, + } /** * Minimize the set of |itemIds| by removing any node which has an ancestor @@ -514,7 +542,7 @@ minimizedSet.add(itemId); }); return minimizedSet; - }, + } /** * Open the given |urls| in response to a |command|. May show a confirmation @@ -558,7 +586,7 @@ loadTimeData.getStringF('openDialogBody', urls.length); DialogFocusManager.getInstance().showDialog(this.$.openDialog.get()); - }, + } /** * Returns all URLs in the given set of nodes and their immediate children. @@ -588,7 +616,7 @@ }); return urls; - }, + } /** * @param {!Set<string>} itemIds @@ -602,7 +630,7 @@ return Array.from(itemIds).some(function(id) { return predicate(nodes[id]); }); - }, + } /** * @param {!Set<string>} itemIds @@ -615,7 +643,7 @@ this.containsMatchingNode_(itemIds, function(node) { return !!node.url; }); - }, + } /** * @param {!Set<string>} itemIds @@ -625,7 +653,7 @@ isFolder_(itemIds) { return itemIds.size === 1 && this.containsMatchingNode_(itemIds, node => !node.url); - }, + } /** * @param {Command} command @@ -704,7 +732,7 @@ assertNotReached(); return ''; - }, + } /** * @param {string} case0 String ID for the case of zero URLs. @@ -727,7 +755,7 @@ } return loadTimeData.getStringF(caseOther, urls.length); - }, + } /** * @param {Command} command @@ -746,7 +774,7 @@ default: return ''; } - }, + } /** @private */ computeMenuCommands_() { @@ -788,7 +816,7 @@ return []; } assert(false); - }, + } /** * @param {Command} command @@ -808,7 +836,7 @@ return this.globalCanEdit_ || this.isSingleBookmark_(itemIds); } return false; - }, + } /** * @param {!Set<string>} itemIds @@ -823,7 +851,7 @@ } this.browserProxy_.recordInHistogram(histogram, command, Command.MAX_VALUE); - }, + } /** * Show a toast with a bookmark |title| inserted into a label, with the @@ -834,7 +862,7 @@ * @param {boolean} canUndo If true, shows an undo button in the toast. * @private */ - showTitleToast_: async function(labelPromise, title, canUndo) { + async showTitleToast_(labelPromise, title, canUndo) { const label = await labelPromise; const pieces = loadTimeData.getSubstitutedStringPieces(label, title).map(function(p) { @@ -844,7 +872,7 @@ }); getToastManager().querySelector('dom-if').if = canUndo; getToastManager().showForStringPieces(pieces); - }, + } /** * @param {number} targetId @@ -857,7 +885,7 @@ resolve(); }); }); - }, + } //////////////////////////////////////////////////////////////////////////// // Event handlers: @@ -866,7 +894,7 @@ * @param {Event} e * @private */ - onOpenCommandMenu_: async function(e) { + async onOpenCommandMenu_(e) { if (e.detail.targetId) { await this.updateCanPaste_(e.detail.targetId); } @@ -878,7 +906,7 @@ this.browserProxy_.recordInHistogram( 'BookmarkManager.CommandMenuOpened', e.detail.source, MenuSource.NUM_VALUES); - }, + } /** * @param {Event} e @@ -890,7 +918,7 @@ Number(e.currentTarget.getAttribute('command'))), assert(this.menuIds_)); this.closeCommandMenu(); - }, + } /** * @param {!Event} e @@ -906,7 +934,7 @@ !DialogFocusManager.getInstance().hasOpenDialog()) { this.handleKeyEvent(e, this.getState().selection.items); } - }, + } /** * Close the menu on mousedown so clicks can propagate to the underlying UI. @@ -921,24 +949,24 @@ } this.closeCommandMenu(); - }, + } /** @private */ onOpenCancelTap_() { this.$.openDialog.get().cancel(); - }, + } /** @private */ onOpenConfirmTap_() { this.confirmOpenCallback_(); this.$.openDialog.get().close(); - }, -}); + } -/** @private {CommandManager} */ -CommandManager.instance_ = null; + /** @return {!BookmarksCommandManagerElement} */ + static getInstance() { + return assert(instance); + } +} -/** @return {!CommandManager} */ -CommandManager.getInstance = function() { - return assert(CommandManager.instance_); -}; +customElements.define( + BookmarksCommandManagerElement.is, BookmarksCommandManagerElement);
diff --git a/chrome/browser/resources/bookmarks/dialog_focus_manager.js b/chrome/browser/resources/bookmarks/dialog_focus_manager.js index e099f93..7fcc53dc 100644 --- a/chrome/browser/resources/bookmarks/dialog_focus_manager.js +++ b/chrome/browser/resources/bookmarks/dialog_focus_manager.js
@@ -3,7 +3,6 @@ // found in the LICENSE file. import {assert} from 'chrome://resources/js/assert.m.js'; -import {addSingletonGetter} from 'chrome://resources/js/cr.m.js'; /** * Manages focus restoration for modal dialogs. After the final dialog in a @@ -102,6 +101,17 @@ return closeListener; } + + /** @return {!DialogFocusManager} */ + static getInstance() { + return instance || (instance = new DialogFocusManager()); + } + + /** @param {?DialogFocusManager} obj */ + static setInstance(obj) { + instance = obj; + } } -addSingletonGetter(DialogFocusManager); +/** @type {?DialogFocusManager} */ +let instance = null;
diff --git a/chrome/browser/resources/bookmarks/dnd_manager.js b/chrome/browser/resources/bookmarks/dnd_manager.js index d6dbdd38..336b933 100644 --- a/chrome/browser/resources/bookmarks/dnd_manager.js +++ b/chrome/browser/resources/bookmarks/dnd_manager.js
@@ -9,6 +9,7 @@ import {highlightUpdatedItems, trackUpdatedItems} from './api_listener.js'; import {DropPosition, ROOT_NODE_ID} from './constants.js'; import {Debouncer} from './debouncer.js'; +import {BookmarksFolderNodeElement} from './folder_node.js'; import {Store} from './store.js'; import {BookmarkElement, BookmarkNode, DragData, DropDestination} from './types.js'; import {canEditNode, canReorderChildren, getDisplayedList, hasChildFolders, isShowingSearch, normalizeNode} from './util.js';
diff --git a/chrome/browser/resources/bookmarks/edit_dialog.js b/chrome/browser/resources/bookmarks/edit_dialog.js index 28ba59b..70c3c2b8 100644 --- a/chrome/browser/resources/bookmarks/edit_dialog.js +++ b/chrome/browser/resources/bookmarks/edit_dialog.js
@@ -10,42 +10,49 @@ import {assert} from 'chrome://resources/js/assert.m.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; -import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {highlightUpdatedItems, trackUpdatedItems} from './api_listener.js'; import {DialogFocusManager} from './dialog_focus_manager.js'; import {BookmarkNode} from './types.js'; -Polymer({ - is: 'bookmarks-edit-dialog', +/** @polymer */ +export class BookmarksEditDialogElement extends PolymerElement { + static get is() { + return 'bookmarks-edit-dialog'; + } - _template: html`{__html_template__}`, + static get template() { + return html`{__html_template__}`; + } - properties: { - /** @private */ - isFolder_: Boolean, + static get properties() { + return { + /** @private */ + isFolder_: Boolean, - /** @private */ - isEdit_: Boolean, + /** @private */ + isEdit_: Boolean, - /** - * Item that is being edited, or null when adding. - * @private {?BookmarkNode} - */ - editItem_: Object, + /** + * Item that is being edited, or null when adding. + * @private {?BookmarkNode} + */ + editItem_: Object, - /** - * Parent node for the item being added, or null when editing. - * @private {?string} - */ - parentId_: String, + /** + * Parent node for the item being added, or null when editing. + * @private {?string} + */ + parentId_: String, - /** @private */ - titleValue_: String, + /** @private */ + titleValue_: String, - /** @private */ - urlValue_: String, - }, + /** @private */ + urlValue_: String, + }; + } /** * Show the dialog to add a new folder (if |isFolder|) or item, which will be @@ -59,8 +66,9 @@ this.isFolder_ = isFolder; this.parentId_ = parentId; - DialogFocusManager.getInstance().showDialog(this.$.dialog); - }, + DialogFocusManager.getInstance().showDialog( + /** @type {!HTMLDialogElement} */ (this.$.dialog)); + } /** * Show the edit dialog for |editItem|. @@ -77,8 +85,9 @@ this.urlValue_ = assert(editItem.url); } - DialogFocusManager.getInstance().showDialog(this.$.dialog); - }, + DialogFocusManager.getInstance().showDialog( + /** @type {!HTMLDialogElement} */ (this.$.dialog)); + } /** * Clear out existing values from the dialog, allowing it to be reused. @@ -90,7 +99,7 @@ this.$.url.invalid = false; this.titleValue_ = ''; this.urlValue_ = ''; - }, + } /** * @param {boolean} isFolder @@ -107,7 +116,7 @@ } return loadTimeData.getString(title); - }, + } /** * Validates the value of the URL field, returning true if it is a valid URL. @@ -131,7 +140,7 @@ this.urlValue_ = originalValue; return false; - }, + } /** @private */ onSaveButtonTap_() { @@ -152,10 +161,13 @@ chrome.bookmarks.create(edit, highlightUpdatedItems); } this.$.dialog.close(); - }, + } /** @private */ onCancelButtonTap_() { this.$.dialog.cancel(); - }, -}); + } +} + +customElements.define( + BookmarksEditDialogElement.is, BookmarksEditDialogElement);
diff --git a/chrome/browser/resources/bookmarks/folder_node.js b/chrome/browser/resources/bookmarks/folder_node.js index 649cb32..d8dbec9a 100644 --- a/chrome/browser/resources/bookmarks/folder_node.js +++ b/chrome/browser/resources/bookmarks/folder_node.js
@@ -9,78 +9,99 @@ import './strings.m.js'; import {assert} from 'chrome://resources/js/assert.m.js'; -import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {StoreObserver} from 'chrome://resources/js/cr/ui/store.m.js'; +import {StoreClientInterface as CrUiStoreClientInterface} from 'chrome://resources/js/cr/ui/store_client.m.js'; +import {isRTL} from 'chrome://resources/js/util.m.js'; +import {html, microTask, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {changeFolderOpen, selectFolder} from './actions.js'; -import {CommandManager} from './command_manager.js'; +import {BookmarksCommandManagerElement} from './command_manager.js'; import {FOLDER_OPEN_BY_DEFAULT_DEPTH, MenuSource, ROOT_NODE_ID} from './constants.js'; -import {StoreClient} from './store_client.js'; +import {BookmarksStoreClientInterface, StoreClient} from './store_client.js'; import {BookmarkNode, BookmarksPageState} from './types.js'; import {hasChildFolders, isShowingSearch} from './util.js'; -Polymer({ - is: 'bookmarks-folder-node', +/** + * @constructor + * @extends {PolymerElement} + * @implements {BookmarksStoreClientInterface} + * @implements {CrUiStoreClientInterface} + * @implements {StoreObserver<BookmarksPageState>} + */ +const BookmarksFolderNodeElementBase = + mixinBehaviors(StoreClient, PolymerElement); - _template: html`{__html_template__}`, +/** @polymer */ +export class BookmarksFolderNodeElement extends BookmarksFolderNodeElementBase { + static get is() { + return 'bookmarks-folder-node'; + } - behaviors: [ - StoreClient, - ], + static get template() { + return html`{__html_template__}`; + } - properties: { - itemId: { - type: String, - observer: 'updateFromStore', - }, + static get properties() { + return { + itemId: { + type: String, + observer: 'updateFromStore', + }, - depth: { - type: Number, - observer: 'depthChanged_', - }, + depth: { + type: Number, + observer: 'depthChanged_', + }, - isOpen: { - type: Boolean, - computed: 'computeIsOpen_(openState_, depth)', - }, + isOpen: { + type: Boolean, + computed: 'computeIsOpen_(openState_, depth)', + }, - /** @type {BookmarkNode} */ - item_: Object, + /** @type {BookmarkNode} */ + item_: Object, - /** @private {?boolean} */ - openState_: Boolean, + /** @private {?boolean} */ + openState_: Boolean, - /** @private */ - selectedFolder_: String, + /** @private */ + selectedFolder_: String, - /** @private */ - searchActive_: Boolean, + /** @private */ + searchActive_: Boolean, - /** @private */ - isSelectedFolder_: { - type: Boolean, - value: false, - reflectToAttribute: true, - computed: 'computeIsSelected_(itemId, selectedFolder_, searchActive_)' - }, + /** @private */ + isSelectedFolder_: { + type: Boolean, + value: false, + reflectToAttribute: true, + computed: 'computeIsSelected_(itemId, selectedFolder_, searchActive_)' + }, - /** @private */ - hasChildFolder_: { - type: Boolean, - computed: 'computeHasChildFolder_(item_.children)', - }, - }, + /** @private */ + hasChildFolder_: { + type: Boolean, + computed: 'computeHasChildFolder_(item_.children)', + }, + }; + } - listeners: { - 'keydown': 'onKeydown_', - }, + static get observers() { + return [ + 'updateAriaExpanded_(hasChildFolder_, isOpen)', + 'scrollIntoViewIfNeeded_(isSelectedFolder_)', + ]; + } - observers: [ - 'updateAriaExpanded_(hasChildFolder_, isOpen)', - 'scrollIntoViewIfNeeded_(isSelectedFolder_)', - ], + ready() { + super.ready(); + + this.addEventListener('keydown', e => this.onKeydown_(e)); + } /** @override */ - attached() { + connectedCallback() { + super.connectedCallback(); this.watch('item_', state => { return /** @type {!BookmarksPageState} */ (state).nodes[this.itemId]; }); @@ -98,7 +119,7 @@ }); this.updateFromStore(); - }, + } /** * @param {boolean} isSelectedFolder @@ -107,17 +128,17 @@ */ getContainerClass_(isSelectedFolder) { return isSelectedFolder ? 'selected' : ''; - }, + } /** @return {!HTMLElement} */ getFocusTarget() { return /** @type {!HTMLDivElement} */ (this.$.container); - }, + } /** @return {HTMLElement} */ getDropTarget() { return /** @type {!HTMLDivElement} */ (this.$.container); - }, + } /** * @private @@ -141,7 +162,7 @@ handled = false; } - if (this.getComputedStyleValue('direction') === 'rtl') { + if (isRTL()) { xDirection *= -1; } @@ -149,7 +170,7 @@ xDirection, yDirection, this.root.activeElement); if (!handled) { - handled = CommandManager.getInstance().handleKeyEvent( + handled = BookmarksCommandManagerElement.getInstance().handleKeyEvent( e, new Set([this.itemId])); } @@ -159,7 +180,7 @@ e.preventDefault(); e.stopPropagation(); - }, + } /** * @private @@ -235,7 +256,7 @@ if (newFocusFolderNode.itemId !== ROOT_NODE_ID) { newFocusFolderNode.getFocusTarget().focus(); } - }, + } /** * Returns the next or previous visible bookmark node relative to |child|. @@ -262,7 +283,7 @@ } return newFocus; - }, + } /** * Returns the immediate parent folder node, or null if there is none. @@ -276,7 +297,7 @@ parentFolderNode = parentFolderNode.parentNode || parentFolderNode.host; } return parentFolderNode || null; - }, + } /** * @private @@ -289,14 +310,14 @@ } return children.pop().getLastVisibleDescendant_(); - }, + } /** @private */ selectFolder_() { if (!this.isSelectedFolder_) { this.dispatch(selectFolder(this.itemId, this.getState().nodes)); } - }, + } /** * @param {!Event} e @@ -305,9 +326,9 @@ onContextMenu_(e) { e.preventDefault(); this.selectFolder_(); - CommandManager.getInstance().openCommandMenuAtPosition( + BookmarksCommandManagerElement.getInstance().openCommandMenuAtPosition( e.clientX, e.clientY, MenuSource.TREE, new Set([this.itemId])); - }, + } /** * @private @@ -315,7 +336,7 @@ */ getChildFolderNodes_() { return Array.from(this.root.querySelectorAll('bookmarks-folder-node')); - }, + } /** * Toggles whether the folder is open. @@ -325,7 +346,7 @@ toggleFolder_(e) { this.dispatch(changeFolderOpen(this.itemId, !this.isOpen)); e.stopPropagation(); - }, + } /** * @private @@ -333,7 +354,7 @@ */ preventDefault_(e) { e.preventDefault(); - }, + } /** * @private @@ -343,7 +364,7 @@ */ computeIsSelected_(itemId, selectedFolder, searchActive) { return itemId === selectedFolder && !searchActive; - }, + } /** * @private @@ -351,7 +372,7 @@ */ computeHasChildFolder_() { return hasChildFolders(this.itemId, this.getState().nodes); - }, + } /** @private */ depthChanged_() { @@ -359,7 +380,7 @@ if (this.depth === -1) { this.$.descendants.removeAttribute('role'); } - }, + } /** * @private @@ -367,7 +388,7 @@ */ getChildDepth_() { return this.depth + 1; - }, + } /** * @param {string} itemId @@ -376,7 +397,7 @@ */ isFolder_(itemId) { return !this.getState().nodes[itemId].url; - }, + } /** * @private @@ -384,7 +405,7 @@ */ isRootFolder_() { return this.itemId === ROOT_NODE_ID; - }, + } /** * @private @@ -395,7 +416,7 @@ // search is active, even though this node is not technically selected. This // allows the sidebar to be focusable during a search. return this.selectedFolder_ === this.itemId ? '0' : '-1'; - }, + } /** * Sets the 'aria-expanded' accessibility on nodes which need it. Note that @@ -410,7 +431,7 @@ } else { this.getFocusTarget().removeAttribute('aria-expanded'); } - }, + } /** * Scrolls the folder node into view when the folder is selected. @@ -421,8 +442,8 @@ return; } - this.async(() => this.$.container.scrollIntoViewIfNeeded()); - }, + microTask.run(() => this.$.container.scrollIntoViewIfNeeded()); + } /** * @param {?boolean} openState @@ -432,5 +453,8 @@ computeIsOpen_(openState, depth) { return openState != null ? openState : depth <= FOLDER_OPEN_BY_DEFAULT_DEPTH; - }, -}); + } +} + +customElements.define( + BookmarksFolderNodeElement.is, BookmarksFolderNodeElement);
diff --git a/chrome/browser/resources/bookmarks/item.js b/chrome/browser/resources/bookmarks/item.js index e7072b6..2a0ee7e 100644 --- a/chrome/browser/resources/bookmarks/item.js +++ b/chrome/browser/resources/bookmarks/item.js
@@ -11,88 +11,127 @@ import {assert} from 'chrome://resources/js/assert.m.js'; import {isMac} from 'chrome://resources/js/cr.m.js'; import {focusWithoutInk} from 'chrome://resources/js/cr/ui/focus_without_ink.m.js'; +import {StoreObserver} from 'chrome://resources/js/cr/ui/store.m.js'; +import {StoreClientInterface as CrUiStoreClientInterface} from 'chrome://resources/js/cr/ui/store_client.m.js'; import {getFaviconForPageURL} from 'chrome://resources/js/icon.m.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; -import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {selectItem} from './actions.js'; -import {CommandManager} from './command_manager.js'; +import {BookmarksCommandManagerElement} from './command_manager.js'; import {Command, MenuSource} from './constants.js'; -import {StoreClient} from './store_client.js'; -import {BookmarkNode} from './types.js'; +import {BookmarksStoreClientInterface, StoreClient} from './store_client.js'; +import {BookmarkNode, BookmarksPageState} from './types.js'; -Polymer({ - is: 'bookmarks-item', +/** + * @constructor + * @extends {PolymerElement} + * @implements {BookmarksStoreClientInterface} + * @implements {CrUiStoreClientInterface} + * @implements {StoreObserver<BookmarksPageState>} + */ +const BookmarksItemElementBase = mixinBehaviors(StoreClient, PolymerElement); - _template: html`{__html_template__}`, +/** @polymer */ +export class BookmarksItemElement extends BookmarksItemElementBase { + static get is() { + return 'bookmarks-item'; + } - behaviors: [ - StoreClient, - ], + static get template() { + return html`{__html_template__}`; + } - properties: { - itemId: { - type: String, - observer: 'onItemIdChanged_', - }, + static get properties() { + return { + itemId: { + type: String, + observer: 'onItemIdChanged_', + }, - ironListTabIndex: Number, + ironListTabIndex: Number, - /** @private {BookmarkNode} */ - item_: { - type: Object, - observer: 'onItemChanged_', - }, + /** @private {BookmarkNode} */ + item_: { + type: Object, + observer: 'onItemChanged_', + }, - /** @private */ - isSelectedItem_: { - type: Boolean, - reflectToAttribute: true, - }, + /** @private */ + isSelectedItem_: { + type: Boolean, + reflectToAttribute: true, + }, - /** @private */ - isMultiSelect_: Boolean, + /** @private */ + isMultiSelect_: Boolean, - /** @private */ - isFolder_: Boolean, + /** @private */ + isFolder_: Boolean, - /** @private */ - lastTouchPoints_: Number, - }, + /** @private */ + lastTouchPoints_: Number, + }; + } - observers: [ - 'updateFavicon_(item_.url)', - ], + static get observers() { + return [ + 'updateFavicon_(item_.url)', + ]; + } - listeners: { - 'click': 'onClick_', - 'dblclick': 'onDblClick_', - 'contextmenu': 'onContextMenu_', - 'keydown': 'onKeydown_', - 'auxclick': 'onMiddleClick_', - 'mousedown': 'cancelMiddleMouseBehavior_', - 'mouseup': 'cancelMiddleMouseBehavior_', - 'touchstart': 'onTouchStart_', - }, + ready() { + super.ready(); - /** @override */ - attached() { + this.addEventListener( + 'click', + e => this.onClick_( + /** @type {!MouseEvent} */ (e))); + this.addEventListener( + 'dblclick', + e => this.onDblClick_( + /** @type {!MouseEvent} */ (e))); + this.addEventListener('contextmenu', e => this.onContextMenu_(e)); + this.addEventListener( + 'keydown', + e => this.onKeydown_( + /** @type {!KeyboardEvent} */ (e))); + this.addEventListener( + 'auxclick', + e => this.onMiddleClick_( + /** @type {!MouseEvent} */ (e))); + this.addEventListener( + 'mousedown', + e => this.cancelMiddleMouseBehavior_( + /** @type {!MouseEvent} */ (e))); + this.addEventListener( + 'mouseup', + e => this.cancelMiddleMouseBehavior_( + /** @type {!MouseEvent} */ (e))); + this.addEventListener( + 'touchstart', + e => this.onTouchStart_( + /** @type {!TouchEvent} */ (e))); + } + + connectedCallback() { + super.connectedCallback(); this.watch('item_', store => store.nodes[this.itemId]); this.watch( 'isSelectedItem_', store => store.selection.items.has(this.itemId)); this.watch('isMultiSelect_', store => store.selection.items.size > 1); this.updateFromStore(); - }, + } focusMenuButton() { focusWithoutInk(this.$.menuButton); - }, + } /** @return {BookmarksItemElement} */ getDropTarget() { return this; - }, + } /** * @param {Event} e @@ -114,13 +153,17 @@ this.selectThisItem_(); } - this.fire('open-command-menu', { - x: e.clientX, - y: e.clientY, - source: MenuSource.ITEM, - targetId: this.itemId, - }); - }, + this.dispatchEvent(new CustomEvent('open-command-menu', { + bubbles: true, + composed: true, + detail: { + x: e.clientX, + y: e.clientY, + source: MenuSource.ITEM, + targetId: this.itemId, + } + })); + } /** * @param {Event} e @@ -135,12 +178,16 @@ this.selectThisItem_(); } - this.fire('open-command-menu', { - targetElement: e.target, - source: MenuSource.ITEM, - targetId: this.itemId, - }); - }, + this.dispatchEvent(new CustomEvent('open-command-menu', { + bubbles: true, + composed: true, + detail: { + targetElement: e.target, + source: MenuSource.ITEM, + targetId: this.itemId, + } + })); + } /** @private */ selectThisItem_() { @@ -149,7 +196,7 @@ range: false, toggle: false, })); - }, + } /** @private */ onItemIdChanged_() { @@ -157,7 +204,7 @@ // for real users. assert(this.getState().nodes[this.itemId]); this.updateFromStore(); - }, + } /** @private */ onItemChanged_() { @@ -166,7 +213,7 @@ 'aria-label', this.item_.title || this.item_.url || loadTimeData.getString('folderLabel')); - }, + } /** * @param {MouseEvent} e @@ -185,7 +232,7 @@ } e.stopPropagation(); e.preventDefault(); - }, + } /** * @private @@ -203,7 +250,7 @@ toggle: true, })); } - }, + } /** * @param {MouseEvent} e @@ -214,12 +261,12 @@ this.selectThisItem_(); } - const commandManager = CommandManager.getInstance(); + const commandManager = BookmarksCommandManagerElement.getInstance(); const itemSet = this.getState().selection.items; if (commandManager.canExecute(Command.OPEN, itemSet)) { commandManager.handle(Command.OPEN, itemSet); } - }, + } /** * @param {MouseEvent} e @@ -235,13 +282,13 @@ return; } - const commandManager = CommandManager.getInstance(); + const commandManager = BookmarksCommandManagerElement.getInstance(); const itemSet = this.getState().selection.items; const command = e.shiftKey ? Command.OPEN : Command.OPEN_NEW_TAB; if (commandManager.canExecute(command, itemSet)) { commandManager.handle(command, itemSet); } - }, + } /** * @param {TouchEvent} e @@ -249,7 +296,7 @@ */ onTouchStart_(e) { this.lastTouchPoints_ = e.touches.length; - }, + } /** * Prevent default middle-mouse behavior. On Windows, this prevents autoscroll @@ -261,7 +308,7 @@ if (e.button === 1) { e.preventDefault(); } - }, + } /** * @param {string} url @@ -271,7 +318,7 @@ this.$.icon.className = url ? 'website-icon' : 'folder-icon'; this.$.icon.style.backgroundImage = url ? getFaviconForPageURL(url, false) : ''; - }, + } /** * @return {string} @@ -288,7 +335,7 @@ return loadTimeData.getStringF( 'moreActionsButtonAxLabel', this.item_.title); - }, + } /** * This item is part of a group selection. @@ -297,5 +344,7 @@ */ isMultiSelectMenu_() { return this.isSelectedItem_ && this.isMultiSelect_; - }, -}); + } +} + +customElements.define(BookmarksItemElement.is, BookmarksItemElement);
diff --git a/chrome/browser/resources/bookmarks/list.js b/chrome/browser/resources/bookmarks/list.js index eadf8e9..8f3603e 100644 --- a/chrome/browser/resources/bookmarks/list.js +++ b/chrome/browser/resources/bookmarks/list.js
@@ -4,81 +4,102 @@ import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import 'chrome://resources/polymer/v3_0/iron-list/iron-list.js'; -import './item.js'; import './shared_style.js'; import './strings.m.js'; import {assert} from 'chrome://resources/js/assert.m.js'; import {isMac} from 'chrome://resources/js/cr.m.js'; -import {ListPropertyUpdateBehavior} from 'chrome://resources/js/list_property_update_behavior.m.js'; +import {StoreObserver} from 'chrome://resources/js/cr/ui/store.m.js'; +import {StoreClientInterface as CrUiStoreClientInterface} from 'chrome://resources/js/cr/ui/store_client.m.js'; +import {ListPropertyUpdateBehavior, ListPropertyUpdateBehaviorInterface} from 'chrome://resources/js/list_property_update_behavior.m.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {PluralStringProxyImpl} from 'chrome://resources/js/plural_string_proxy.js'; import {getDeepActiveElement} from 'chrome://resources/js/util.m.js'; import {IronA11yAnnouncer} from 'chrome://resources/polymer/v3_0/iron-a11y-announcer/iron-a11y-announcer.js'; -import {afterNextRender, html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {afterNextRender, html, microTask, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {deselectItems, selectAll, selectItem, updateAnchor} from './actions.js'; -import {CommandManager} from './command_manager.js'; +import {BookmarksCommandManagerElement} from './command_manager.js'; import {MenuSource} from './constants.js'; -import {StoreClient} from './store_client.js'; +import {BookmarksItemElement} from './item.js'; +import {BookmarksStoreClientInterface, StoreClient} from './store_client.js'; import {BookmarksPageState} from './types.js'; import {canReorderChildren, getDisplayedList} from './util.js'; -Polymer({ - is: 'bookmarks-list', +/** + * @constructor + * @extends {PolymerElement} + * @implements {BookmarksStoreClientInterface} + * @implements {CrUiStoreClientInterface} + * @implements {StoreObserver<BookmarksPageState>} + * @implements {ListPropertyUpdateBehaviorInterface} + */ +const BookmarksListElementBase = + mixinBehaviors([StoreClient, ListPropertyUpdateBehavior], PolymerElement); - _template: html`{__html_template__}`, +/** @polymer */ +export class BookmarksListElement extends BookmarksListElementBase { + static get is() { + return 'bookmarks-list'; + } - behaviors: [ - StoreClient, - ListPropertyUpdateBehavior, - ], + static get template() { + return html`{__html_template__}`; + } - properties: { - /** - * A list of item ids wrapped in an Object. This is necessary because - * iron-list is unable to distinguish focusing index 6 from focusing id '6' - * so the item we supply to iron-list needs to be non-index-like. - * @private {Array<{id: string}>} - */ - displayedList_: { - type: Array, - value() { - // Use an empty list during initialization so that the databinding to - // hide #list takes effect. - return []; + static get properties() { + return { + /** + * A list of item ids wrapped in an Object. This is necessary because + * iron-list is unable to distinguish focusing index 6 from focusing id + * '6' so the item we supply to iron-list needs to be non-index-like. + * @private {Array<{id: string}>} + */ + displayedList_: { + type: Array, + value() { + // Use an empty list during initialization so that the databinding to + // hide #list takes effect. + return []; + }, }, - }, - /** @private {Array<string>} */ - displayedIds_: { - type: Array, - observer: 'onDisplayedIdsChanged_', - }, + /** @private {Array<string>} */ + displayedIds_: { + type: Array, + observer: 'onDisplayedIdsChanged_', + }, - /** @private */ - searchTerm_: { - type: String, - observer: 'onDisplayedListSourceChange_', - }, + /** @private */ + searchTerm_: { + type: String, + observer: 'onDisplayedListSourceChange_', + }, - /** @private */ - selectedFolder_: { - type: String, - observer: 'onDisplayedListSourceChange_', - }, + /** @private */ + selectedFolder_: { + type: String, + observer: 'onDisplayedListSourceChange_', + }, - /** @private {Set<string>} */ - selectedItems_: Object, - }, + /** @private {Set<string>} */ + selectedItems_: Object, + }; + } - listeners: { - 'click': 'deselectItems_', - 'contextmenu': 'onContextMenu_', - 'open-command-menu': 'onOpenCommandMenu_', - }, + ready() { + super.ready(); + this.addEventListener('click', () => this.deselectItems_()); + this.addEventListener('contextmenu', e => this.onContextMenu_(e)); + this.addEventListener( + 'open-command-menu', + e => this.onOpenCommandMenu_( + /** @type {!CustomEvent<{source: !MenuSource}>} */ (e))); + } - attached() { + connectedCallback() { + super.connectedCallback(); + const list = /** @type {IronListElement} */ (this.$.list); list.scrollTarget = this; @@ -104,17 +125,19 @@ afterNextRender(this, function() { IronA11yAnnouncer.requestAvailability(); }); - }, + } - detached() { + disconnectedCallback() { + super.disconnectedCallback(); + document.removeEventListener( 'highlight-items', this.boundOnHighlightItems_); - }, + } /** @return {HTMLElement} */ getDropTarget() { return /** @type {!HTMLDivElement} */ (this.$.message); - }, + } /** * Updates `displayedList_` using splices to be equivalent to `newValue`. This @@ -123,7 +146,7 @@ * @param {Array<string>} newValue * @param {Array<string>} oldValue */ - onDisplayedIdsChanged_: async function(newValue, oldValue) { + async onDisplayedIdsChanged_(newValue, oldValue) { const updatedList = newValue.map(id => ({id: id})); let skipFocus = false; let selectIndex = -1; @@ -143,10 +166,13 @@ this.updateList('displayedList_', item => item.id, updatedList); // Trigger a layout of the iron list. Otherwise some elements may render // as blank entries. See https://crbug.com/848683 - this.$.list.fire('iron-resize'); + this.$.list.dispatchEvent( + new CustomEvent('iron-resize', {bubbles: true, composed: true})); const label = await PluralStringProxyImpl.getInstance().getPluralString( 'listChanged', this.displayedList_.length); - this.fire('iron-announce', {text: label}); + this.dispatchEvent(new CustomEvent( + 'iron-announce', + {bubbles: true, composed: true, detail: {text: label}})); if (!skipFocus && selectIndex > -1) { setTimeout(() => { @@ -158,12 +184,12 @@ } }); } - }, + } /** @private */ onDisplayedListSourceChange_() { this.scrollTop = 0; - }, + } /** * Scroll the list so that |itemId| is visible, if it is not already. @@ -177,7 +203,7 @@ index > list.lastVisibleIndex) { list.scrollToIndex(index); } - }, + } /** @private */ emptyListMessage_() { @@ -189,17 +215,17 @@ 'emptyUnmodifiableList'; } return loadTimeData.getString(emptyListMessage); - }, + } /** @private */ isEmptyList_() { return this.displayedList_.length === 0; - }, + } /** @private */ deselectItems_() { this.dispatch(deselectItems()); - }, + } /** * @param{HTMLElement} el @@ -207,7 +233,7 @@ */ getIndexForItemElement_(el) { return this.$.list.modelForElement(el).index; - }, + } /** * @param {!CustomEvent<{source: !MenuSource}>} e @@ -219,7 +245,7 @@ this.scrollToId_( /** @type {BookmarksItemElement} */ (e.composedPath()[0]).itemId); } - }, + } /** * Highlight a list of items by selecting them, scrolling them into view and @@ -242,13 +268,13 @@ this.dispatch(selectAll(toHighlight, this.getState(), leadId)); // Allow iron-list time to render additions to the list. - this.async(function() { + microTask.run(() => { this.scrollToId_(leadId); const leadIndex = this.displayedIds_.indexOf(leadId); assert(leadIndex !== -1); this.$.list.focusItem(leadIndex); }); - }, + } /** * @param {Event} e @@ -322,14 +348,14 @@ } if (!handled) { - handled = CommandManager.getInstance().handleKeyEvent( + handled = BookmarksCommandManagerElement.getInstance().handleKeyEvent( e, this.getState().selection.items); } if (handled) { e.stopPropagation(); } - }, + } /** * @param {Event} e @@ -339,12 +365,16 @@ e.preventDefault(); this.deselectItems_(); - this.fire('open-command-menu', { - x: e.clientX, - y: e.clientY, - source: MenuSource.LIST, - }); - }, + this.dispatchEvent(new CustomEvent('open-command-menu', { + bubbles: true, + composed: true, + detail: { + x: e.clientX, + y: e.clientY, + source: MenuSource.LIST, + } + })); + } /** * Returns a 1-based index for aria-rowindex. @@ -354,7 +384,7 @@ */ getAriaRowindex_(index) { return index + 1; - }, + } /** * @param {string} id @@ -362,5 +392,7 @@ */ getAriaSelected_(id) { return this.selectedItems_.has(id); - }, -}); + } +} + +customElements.define(BookmarksListElement.is, BookmarksListElement);
diff --git a/chrome/browser/resources/bookmarks/router.js b/chrome/browser/resources/bookmarks/router.js index 08f44cb64..6f90ca2e0 100644 --- a/chrome/browser/resources/bookmarks/router.js +++ b/chrome/browser/resources/bookmarks/router.js
@@ -5,62 +5,86 @@ import 'chrome://resources/polymer/v3_0/iron-location/iron-location.js'; import 'chrome://resources/polymer/v3_0/iron-location/iron-query-params.js'; -import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {StoreObserver} from 'chrome://resources/js/cr/ui/store.m.js'; +import {StoreClientInterface as CrUiStoreClientInterface} from 'chrome://resources/js/cr/ui/store_client.m.js'; +import {Debouncer, html, microTask, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {selectFolder, setSearchTerm} from './actions.js'; import {BOOKMARKS_BAR_ID} from './constants.js'; -import {StoreClient} from './store_client.js'; +import {BookmarksStoreClientInterface, StoreClient} from './store_client.js'; +import {BookmarksPageState} from './types.js'; -Polymer({ - /** - * This element is a one way bound interface that routes the page URL to - * the searchTerm and selectedId. Clients must initialize themselves by - * reading the router's fields after attach. - */ - is: 'bookmarks-router', +/** + * @constructor + * @extends {PolymerElement} + * @implements {BookmarksStoreClientInterface} + * @implements {CrUiStoreClientInterface} + * @implements {StoreObserver<BookmarksPageState>} + */ +const BookmarksRouterElementBase = mixinBehaviors(StoreClient, PolymerElement); - _template: html`{__html_template__}`, +/** + * This element is a one way bound interface that routes the page URL to + * the searchTerm and selectedId. Clients must initialize themselves by + * reading the router's fields after attach. + * @polymer + */ +export class BookmarksRouterElement extends BookmarksRouterElementBase { + static get is() { + return 'bookmarks-router'; + } - behaviors: [ - StoreClient, - ], + static get template() { + return html`{__html_template__}`; + } - properties: { - /** - * Parameter q is routed to the searchTerm. - * Parameter id is routed to the selectedId. - * @private - */ - queryParams_: Object, + static get properties() { + return { + /** + * Parameter q is routed to the searchTerm. + * Parameter id is routed to the selectedId. + * @private + */ + queryParams_: Object, - /** @private {string} */ - query_: { - type: String, - observer: 'onQueryChanged_', - }, + /** @private {string} */ + query_: { + type: String, + observer: 'onQueryChanged_', + }, - /** @private {string} */ - urlQuery_: { - type: String, - observer: 'onUrlQueryChanged_', - }, + /** @private {string} */ + urlQuery_: { + type: String, + observer: 'onUrlQueryChanged_', + }, - /** @private */ - searchTerm_: { - type: String, - value: '', - }, + /** @private */ + searchTerm_: { + type: String, + value: '', + }, - /** @private {?string} */ - selectedId_: String, - }, + /** @private {?string} */ + selectedId_: String, + }; + } - observers: [ - 'onQueryParamsChanged_(queryParams_)', - 'onStateChanged_(searchTerm_, selectedId_)', - ], + static get observers() { + return [ + 'onQueryParamsChanged_(queryParams_)', + 'onStateChanged_(searchTerm_, selectedId_)', + ]; + } - attached() { + constructor() { + super(); + /** @private {Debouncer} */ + this.debounceJob_; + } + + connectedCallback() { + super.connectedCallback(); this.watch('selectedId_', function(state) { return state.selectedFolder; }); @@ -68,7 +92,7 @@ return state.search.term; }); this.updateFromStore(); - }, + } /** @private */ onQueryParamsChanged_() { @@ -91,7 +115,7 @@ dispatch(selectFolder(selectedId, this.getState().nodes)); }); } - }, + } /** * @param {?string} current Current value of the query. @@ -102,17 +126,18 @@ if (previous !== undefined) { this.urlQuery_ = this.query_; } - }, + } /** @private */ onUrlQueryChanged_() { this.query_ = this.urlQuery_; - }, + } /** @private */ onStateChanged_() { - this.debounce('updateQueryParams', this.updateQueryParams_.bind(this)); - }, + this.debounceJob_ = Debouncer.debounce( + this.debounceJob_, microTask, () => this.updateQueryParams_()); + } /** @private */ updateQueryParams_() { @@ -123,5 +148,7 @@ } else { this.queryParams_ = {}; } - }, -}); + } +} + +customElements.define(BookmarksRouterElement.is, BookmarksRouterElement);
diff --git a/chrome/browser/resources/bookmarks/store.js b/chrome/browser/resources/bookmarks/store.js index a1b3f220..d13064d 100644 --- a/chrome/browser/resources/bookmarks/store.js +++ b/chrome/browser/resources/bookmarks/store.js
@@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {addSingletonGetter} from 'chrome://resources/js/cr.m.js'; import {Store as CrUiStore} from 'chrome://resources/js/cr/ui/store.m.js'; import {reduceAction} from './reducers.js'; import {BookmarksPageState} from './types.js'; @@ -19,6 +18,17 @@ constructor() { super(createEmptyState(), reduceAction); } + + /** @return {!Store} */ + static getInstance() { + return instance || (instance = new Store()); + } + + /** @param {Store} obj */ + static setInstance(obj) { + instance = obj; + } } -addSingletonGetter(Store); +/** @type {?Store} */ +let instance = null;
diff --git a/chrome/browser/resources/bookmarks/store_client.js b/chrome/browser/resources/bookmarks/store_client.js index a53697c..cf0e3b3 100644 --- a/chrome/browser/resources/bookmarks/store_client.js +++ b/chrome/browser/resources/bookmarks/store_client.js
@@ -3,7 +3,7 @@ // found in the LICENSE file. import {StoreObserver} from 'chrome://resources/js/cr/ui/store.m.js'; -import {StoreClient as CrUiStoreClient} from 'chrome://resources/js/cr/ui/store_client.m.js'; +import {StoreClient as CrUiStoreClient, StoreClientInterface as CrUiStoreClientInterface} from 'chrome://resources/js/cr/ui/store_client.m.js'; import {Store} from './store.js'; import {BookmarksPageState} from './types.js'; @@ -40,8 +40,24 @@ }, }; +export class BookmarksStoreClientInterface { + /** + * @param {string} localProperty + * @param {function(Object)} valueGetter + */ + watch(localProperty, valueGetter) {} + + /** @return {BookmarksPageState} */ + getState() {} + + /** @return {Store} */ + getStore() {} +} + /** * @polymerBehavior + * @implements {BookmarksStoreClientInterface} + * @implements {CrUiStoreClientInterface} * @implements {StoreObserver<BookmarksPageState>} */ export const StoreClient = [CrUiStoreClient, BookmarksStoreClientImpl];
diff --git a/chrome/browser/resources/bookmarks/toolbar.js b/chrome/browser/resources/bookmarks/toolbar.js index 8bcc656..9b603b5 100644 --- a/chrome/browser/resources/bookmarks/toolbar.js +++ b/chrome/browser/resources/bookmarks/toolbar.js
@@ -11,55 +11,71 @@ import './strings.m.js'; import {assert} from 'chrome://resources/js/assert.m.js'; +import {StoreObserver} from 'chrome://resources/js/cr/ui/store.m.js'; +import {StoreClientInterface as CrUiStoreClientInterface} from 'chrome://resources/js/cr/ui/store_client.m.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; -import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {deselectItems, setSearchTerm} from './actions.js'; -import {CommandManager} from './command_manager.js'; +import {BookmarksCommandManagerElement} from './command_manager.js'; import {Command, MenuSource} from './constants.js'; -import {StoreClient} from './store_client.js'; +import {BookmarksStoreClientInterface, StoreClient} from './store_client.js'; +import {BookmarksPageState} from './types.js'; -Polymer({ - is: 'bookmarks-toolbar', +/** + * @constructor + * @extends {PolymerElement} + * @implements {BookmarksStoreClientInterface} + * @implements {CrUiStoreClientInterface} + * @implements {StoreObserver<BookmarksPageState>} + */ +const BookmarksToolbarElementBase = mixinBehaviors(StoreClient, PolymerElement); - _template: html`{__html_template__}`, +/** @polymer */ +export class BookmarksToolbarElement extends BookmarksToolbarElementBase { + static get is() { + return 'bookmarks-toolbar'; + } - behaviors: [ - StoreClient, - ], + static get template() { + return html`{__html_template__}`; + } - properties: { - sidebarWidth: { - type: String, - observer: 'onSidebarWidthChanged_', - }, + static get properties() { + return { + sidebarWidth: { + type: String, + observer: 'onSidebarWidthChanged_', + }, - showSelectionOverlay: { - type: Boolean, - computed: 'shouldShowSelectionOverlay_(selectedItems_, globalCanEdit_)', - readOnly: true, - }, + showSelectionOverlay: { + type: Boolean, + computed: 'shouldShowSelectionOverlay_(selectedItems_, globalCanEdit_)', + readOnly: true, + }, - /** @private */ - narrow_: { - type: Boolean, - reflectToAttribute: true, - }, + /** @private */ + narrow_: { + type: Boolean, + reflectToAttribute: true, + }, - /** @private */ - searchTerm_: { - type: String, - observer: 'onSearchTermChanged_', - }, + /** @private */ + searchTerm_: { + type: String, + observer: 'onSearchTermChanged_', + }, - /** @private {!Set<string>} */ - selectedItems_: Object, + /** @private {!Set<string>} */ + selectedItems_: Object, - /** @private */ - globalCanEdit_: Boolean, - }, + /** @private */ + globalCanEdit_: Boolean, + }; + } - attached() { + connectedCallback() { + super.connectedCallback(); this.watch('searchTerm_', function(state) { return state.search.term; }); @@ -70,40 +86,45 @@ return state.prefs.canEdit; }); this.updateFromStore(); - }, + } /** @return {CrToolbarSearchFieldElement} */ get searchField() { - return /** @type {CrToolbarElement} */ (this.$$('cr-toolbar')) + return /** @type {CrToolbarElement} */ ( + this.shadowRoot.querySelector('cr-toolbar')) .getSearchField(); - }, + } /** * @param {Event} e * @private */ onMenuButtonOpenTap_(e) { - this.fire('open-command-menu', { - targetElement: e.target, - source: MenuSource.TOOLBAR, - }); - }, + this.dispatchEvent(new CustomEvent('open-command-menu', { + bubbles: true, + composed: true, + detail: { + targetElement: e.target, + source: MenuSource.TOOLBAR, + } + })); + } /** @private */ onDeleteSelectionTap_() { const selection = this.selectedItems_; - const commandManager = CommandManager.getInstance(); + const commandManager = BookmarksCommandManagerElement.getInstance(); assert(commandManager.canExecute(Command.DELETE, selection)); commandManager.handle(Command.DELETE, selection); - }, + } /** @private */ onClearSelectionTap_() { - const commandManager = CommandManager.getInstance(); + const commandManager = BookmarksCommandManagerElement.getInstance(); assert( commandManager.canExecute(Command.DESELECT_ALL, this.selectedItems_)); commandManager.handle(Command.DESELECT_ALL, this.selectedItems_); - }, + } /** * @param {!CustomEvent<string>} e @@ -113,17 +134,17 @@ if (e.detail !== this.searchTerm_) { this.dispatch(setSearchTerm(e.detail)); } - }, + } /** @private */ onSidebarWidthChanged_() { this.style.setProperty('--sidebar-width', this.sidebarWidth); - }, + } /** @private */ onSearchTermChanged_() { this.searchField.setValue(this.searchTerm_ || ''); - }, + } /** * @return {boolean} @@ -131,7 +152,7 @@ */ shouldShowSelectionOverlay_() { return this.selectedItems_.size > 1 && this.globalCanEdit_; - }, + } /** * @return {boolean} @@ -139,9 +160,9 @@ */ canDeleteSelection_() { return this.showSelectionOverlay && - CommandManager.getInstance().canExecute( + BookmarksCommandManagerElement.getInstance().canExecute( Command.DELETE, this.selectedItems_); - }, + } /** * @return {string} @@ -149,5 +170,7 @@ */ getItemsSelectedString_() { return loadTimeData.getStringF('itemsSelected', this.selectedItems_.size); - }, -}); + } +} + +customElements.define(BookmarksToolbarElement.is, BookmarksToolbarElement);
diff --git a/chrome/browser/resources/chromeos/arc_support/recommend_app_list_view_new.css b/chrome/browser/resources/chromeos/arc_support/recommend_app_list_view_new.css deleted file mode 100644 index cb28758..0000000 --- a/chrome/browser/resources/chromeos/arc_support/recommend_app_list_view_new.css +++ /dev/null
@@ -1,127 +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. */ - - :root { - color: #333; - font-family: 'Google Sans', Roboto, sans-serif; - font-size: 13px; - font-weight: 400; /* roboto-regular */ -} - -body { - margin: 0; -} - -#recommend-apps-container { - box-sizing: border-box; - display: flex; - flex-flow: row wrap; - gap: 16px; - justify-content: center; - overflow: hidden; - padding: 2px; -} - -#recommend-apps-container .item { - display: flex; - flex: 0 0 calc((100% - 32px) / 3); /* This size allows <= 3 items in a row */ - flex-flow: row nowrap; - float: left; - max-width: 280px; - min-width: 156px; - position: relative; - user-select: none; -} - -#recommend-apps-container .item .image-picker { - background: url(images/ic_checkmark.svg) no-repeat; - display: none; - flex-shrink: 0; - transform: translate(-32px, 8px); - width: 24px; -} - -#recommend-apps-container .item.checked .image-picker { - display: block; -} - -#recommend-apps-container .item .chip { - border-radius: 8px; - box-shadow: - 1px 1px 4px rgba(60, 64, 67, 0.30), - 1px 2px 4px 1px rgba(60, 64, 67, 0.15); - flex-shrink: 0; - height: 160px; - position: relative; - width: 100%; - --x: 0; - --y: 0; -} - -#recommend-apps-container .item .chip .chip-content-container { - display: flex; - flex-direction: column; - height: 100%; - overflow: hidden; - position: relative; - text-align: center; -} - -#recommend-apps-container .item .chip:focus, -#recommend-apps-container .item .chip .chip-content-container:focus { - outline: none; -} - -#recommend-apps-container .item .chip:focus > .chip-content-container { - outline: 2px solid rgba(26, 115, 232, 0.5); -} - -@keyframes ripple { - 30% { - transform: scale(7); - } - 100% { - opacity: 0; - } -} - -#recommend-apps-container .item .chip .chip-content-container .ripple { - animation: ripple 1s forwards; - background: rgba(32, 33, 36, 0.14); - border-radius: 50%; - height: 100px; - margin-inline-start: calc(var(--x) * 1px); - margin-top: calc(var(--y) * 1px); - position: absolute; - transform: translate(-50%, -50%); - width: 100px; -} - -#recommend-apps-container .item .chip:active { - box-shadow: - 0 1px 2px 0 rgba(60, 64, 67, 0.30), - 0 3px 6px 2px rgba(60, 64, 67, 0.15); -} - -img.app-icon { - height: 48px; - margin-bottom: 20px; - margin-inline: auto; - margin-top: 32px; - vertical-align: middle; - width: 48px; -} - -span.app-title { - color: rgb(32, 33, 36); - display: inline-block; - font-size: 13px; - line-height: 20px; - margin-bottom: 20px; - margin-inline: 8px; - overflow: hidden; - text-overflow: ellipsis; - vertical-align: middle; - white-space: nowrap; -}
diff --git a/chrome/browser/resources/chromeos/arc_support/recommend_app_list_view_new.html b/chrome/browser/resources/chromeos/arc_support/recommend_app_list_view_new.html index 2429553..0dbf8bb 100644 --- a/chrome/browser/resources/chromeos/arc_support/recommend_app_list_view_new.html +++ b/chrome/browser/resources/chromeos/arc_support/recommend_app_list_view_new.html
@@ -1,7 +1,130 @@ <!DOCTYPE html> <html> <head> - <link rel="stylesheet" type="text/css" href="recommend_app_list_view_new.css"> + <style> + :root { + color: #333; + font-family: 'Google Sans', Roboto, sans-serif; + font-size: 13px; + font-weight: 400; /* roboto-regular */ + } + + body { + margin: 0; + } + + #recommend-apps-container { + box-sizing: border-box; + display: flex; + flex-flow: row wrap; + gap: 16px; + overflow: hidden; + padding: 2px; + } + + #recommend-apps-container .item { + display: flex; + flex: 0 0 calc((100% - 32px) / 3); /* This size allows <= 3 items in a row */ + flex-flow: row nowrap; + float: left; + max-width: 280px; + min-width: 156px; + position: relative; + user-select: none; + } + + #recommend-apps-container .item .image-picker { + background: url(images/ic_checkmark.svg) no-repeat; + display: none; + flex-shrink: 0; + transform: translate(-32px, 8px); + width: 24px; + } + + #recommend-apps-container .item.checked .image-picker { + display: block; + } + + #recommend-apps-container .item .chip { + border-radius: 8px; + box-shadow: + 1px 1px 4px rgba(60, 64, 67, 0.30), + 1px 2px 4px 1px rgba(60, 64, 67, 0.15); + flex-shrink: 0; + height: 160px; + position: relative; + width: 100%; + --x: 0; + --y: 0; + } + + #recommend-apps-container .item .chip .chip-content-container { + display: flex; + flex-direction: column; + height: 100%; + overflow: hidden; + position: relative; + text-align: center; + } + + #recommend-apps-container .item .chip:focus, + #recommend-apps-container .item .chip .chip-content-container:focus { + outline: none; + } + + #recommend-apps-container .item .chip:focus > .chip-content-container { + outline: 2px solid rgba(26, 115, 232, 0.5); + } + + @keyframes ripple { + 30% { + transform: scale(7); + } + 100% { + opacity: 0; + } + } + + #recommend-apps-container .item .chip .chip-content-container .ripple { + animation: ripple 1s forwards; + background: rgba(32, 33, 36, 0.14); + border-radius: 50%; + height: 100px; + margin-inline-start: calc(var(--x) * 1px); + margin-top: calc(var(--y) * 1px); + position: absolute; + transform: translate(-50%, -50%); + width: 100px; + } + + #recommend-apps-container .item .chip:active { + box-shadow: + 0 1px 2px 0 rgba(60, 64, 67, 0.30), + 0 3px 6px 2px rgba(60, 64, 67, 0.15); + } + + img.app-icon { + height: 48px; + margin-bottom: 20px; + margin-inline: auto; + margin-top: 32px; + vertical-align: middle; + width: 48px; + } + + span.app-title { + color: rgb(32, 33, 36); + display: inline-block; + font-size: 13px; + line-height: 20px; + margin-bottom: 20px; + margin-inline: 8px; + overflow: hidden; + text-overflow: ellipsis; + vertical-align: middle; + white-space: nowrap; + } + </style> </head> <body> <div id="scroll-top"></div>
diff --git a/chrome/browser/resources/chromeos/emoji_picker/emoji_group.html b/chrome/browser/resources/chromeos/emoji_picker/emoji_group.html index 65f5667e..3a0a5a5 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/emoji_group.html +++ b/chrome/browser/resources/chromeos/emoji_picker/emoji_group.html
@@ -48,16 +48,12 @@ font-size: 12px; margin: auto 0 auto auto; outline: none; - padding: 4px 8px 4px 8px; + padding: 0; position: absolute; right: var(--emoji-picker-side-padding); width: fit-content; } - #clear-recents:hover { - background-color: rgba(var(--google-blue-refresh-500-rgb), .04); - } - #clear-recents:focus, #clear-recents:active { border: 2px solid var(--cr-toggle-color); @@ -67,6 +63,15 @@ position: absolute; } + #clear-recents-hover { + border: 2px solid transparent; + margin: -2px; + padding: 6px 10px 6px 10px; + } + #clear-recents-hover:hover { + background-color: rgba(var(--google-blue-refresh-500-rgb), .04); + border: 2px solid rgba(var(--google-blue-refresh-500-rgb), .04); + } </style> <div id="heading" role="heading" aria-level="2" tabindex="0"> @@ -79,7 +84,9 @@ </div> <template is = "dom-if" if="[[showClearRecents]]"> <button id="clear-recents" on-click="onClearRecentsClick"> + <div id="clear-recents-hover"> Clear recently used emojis + </div> </button> </template> <div id="emoji">
diff --git a/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.js b/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.js index 816c085d..0305ed8 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.js +++ b/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.js
@@ -190,7 +190,7 @@ } // Make highlight bar visible (now we know where it should be) and // add smooth sliding. - this.updateActiveGroup(); + this.updateActiveGroup(/*updateTabsScroll=*/ true); this.$.bar.style.display = 'block'; this.$.bar.style.transition = 'left 200ms'; } @@ -248,7 +248,8 @@ clearRecentEmoji() { this.set(['history', 'emoji'], makeRecentlyUsed([])); this.recentEmojiStore.clearRecents(); - afterNextRender(this, () => this.updateActiveGroup()); + afterNextRender( + this, () => this.updateActiveGroup(/*updateTabsScroll=*/ true)); } /** @@ -264,14 +265,15 @@ group.scrollIntoView(); } - onEmojiScroll(ev) { + onEmojiScroll() { // the scroll event is fired very frequently while scrolling. // only update active tab 100ms after last scroll event by setting // a timeout. if (this.scrollTimeout) { clearTimeout(this.scrollTimeout); } - this.scrollTimeout = setTimeout(this.updateActiveGroup.bind(this), 100); + this.scrollTimeout = setTimeout( + () => this.updateActiveGroup(/*updateTabsScroll=*/ true), 100); } onRightChevronClick() { @@ -321,7 +323,7 @@ */ groupTabScrollFinished() { this.groupTabsMoving = false; - this.updateActiveGroup(); + this.updateActiveGroup(/*updateTabsScroll=*/ false); } /** @@ -342,12 +344,17 @@ } } - - updateActiveGroup() { + /** + * + * @param {boolean} updateTabsScroll + */ + updateActiveGroup(updateTabsScroll) { // no need to update scroll state if search is showing. if (this.search) return; + this.updateChevrons(); + // get bounding rect of scrollable emoji region. const thisRect = this.$.groups.getBoundingClientRect(); @@ -394,9 +401,14 @@ tabscrollLeft = GROUP_ICON_SIZE * (5); } - this.$.tabs.scrollLeft = tabscrollLeft; - this.$.bar.style.left = - ((index * GROUP_ICON_SIZE - tabscrollLeft)) + 'px'; + if (updateTabsScroll) { + this.$.tabs.scrollLeft = tabscrollLeft; + this.$.bar.style.left = + ((index * GROUP_ICON_SIZE - tabscrollLeft)) + 'px'; + } else { + this.$.bar.style.left = + ((index * GROUP_ICON_SIZE - this.$.tabs.scrollLeft)) + 'px'; + } } } @@ -477,7 +489,7 @@ afterNextRender(this, () => { this.apiProxy_.showUI(); this.emojiData = emojidata; - this.updateActiveGroup(); + this.updateActiveGroup(/*updateTabsScroll=*/ true); }); }
diff --git a/chrome/browser/resources/component_extension_resources.grd b/chrome/browser/resources/component_extension_resources.grd index 7cf8d38..33fcd16 100644 --- a/chrome/browser/resources/component_extension_resources.grd +++ b/chrome/browser/resources/component_extension_resources.grd
@@ -95,8 +95,7 @@ <include name="IDR_ARC_SUPPORT_ICON_HEADER" file="chromeos/arc_support/images/header.png" type="BINDATA" /> <include name="IDR_ARC_SUPPORT_RECOMMEND_APP_LIST_VIEW_JS" file="chromeos/arc_support/recommend_app_list_view.js" type="BINDATA" /> <include name="IDR_ARC_SUPPORT_RECOMMEND_APP_LIST_VIEW_HTML" file="chromeos/arc_support/recommend_app_list_view.html" type="chrome_html" flattenhtml="true" /> - <include name="IDR_ARC_SUPPORT_RECOMMEND_APP_LIST_VIEW_NEW_CSS" file="chromeos/arc_support/recommend_app_list_view_new.css" type="chrome_html" /> - <include name="IDR_ARC_SUPPORT_RECOMMEND_APP_LIST_VIEW_NEW_HTML" file="chromeos/arc_support/recommend_app_list_view_new.html" type="chrome_html" /> + <include name="IDR_ARC_SUPPORT_RECOMMEND_APP_LIST_VIEW_NEW_HTML" file="chromeos/arc_support/recommend_app_list_view_new.html" type="chrome_html" flattenhtml="true" /> </if> <include name="IDR_CRYPTOTOKEN_UTIL_JS" file="cryptotoken/util.js" type="BINDATA" /> <include name="IDR_CRYPTOTOKEN_B64_JS" file="cryptotoken/b64.js" type="BINDATA" />
diff --git a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_browser_proxy.js b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_browser_proxy.js index 83d8c15..febe0bd1 100644 --- a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_browser_proxy.js +++ b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_browser_proxy.js
@@ -14,7 +14,7 @@ /** * These values should remain consistent with their C++ counterpart - * (chrome/browser/chromeos/crostini/crostini_port_forwarder.h). + * (chrome/browser/ash/crostini/crostini_port_forwarder.h). * @enum {number} */ /* #export */ const CrostiniPortProtocol = {
diff --git a/chrome/browser/safe_browsing/chrome_password_protection_service_browsertest.cc b/chrome/browser/safe_browsing/chrome_password_protection_service_browsertest.cc index e95e5b0..74c24d97 100644 --- a/chrome/browser/safe_browsing/chrome_password_protection_service_browsertest.cc +++ b/chrome/browser/safe_browsing/chrome_password_protection_service_browsertest.cc
@@ -511,7 +511,7 @@ EXPECT_EQ(1u, profile->GetPrefs() ->GetDictionary(prefs::kSafeBrowsingUnhandledGaiaPasswordReuses) - ->size()); + ->DictSize()); // Opens a new browser window. Browser* browser2 = CreateBrowser(profile); @@ -529,7 +529,7 @@ EXPECT_EQ(2u, profile->GetPrefs() ->GetDictionary(prefs::kSafeBrowsingUnhandledGaiaPasswordReuses) - ->size()); + ->DictSize()); // Simulates a Gaia password change. SimulateGaiaPasswordChanged(service, user_manager::kStubUserEmail, @@ -538,7 +538,7 @@ EXPECT_EQ(0u, profile->GetPrefs() ->GetDictionary(prefs::kSafeBrowsingUnhandledGaiaPasswordReuses) - ->size()); + ->DictSize()); EXPECT_THAT(histograms.GetAllSamples(kGaiaPasswordChangeHistogramName), testing::ElementsAre(base::Bucket(2, 1))); } @@ -576,7 +576,7 @@ EXPECT_EQ(1u, profile->GetPrefs() ->GetDictionary(prefs::kSafeBrowsingUnhandledGaiaPasswordReuses) - ->size()); + ->DictSize()); // Save the same password will not trigger OnGaiaPasswordChanged(), thus no // change to size of unhandled_password_reuses(). @@ -585,14 +585,14 @@ EXPECT_EQ(1u, profile->GetPrefs() ->GetDictionary(prefs::kSafeBrowsingUnhandledGaiaPasswordReuses) - ->size()); + ->DictSize()); // Save a different password will clear unhandled_password_reuses(). SimulateGaiaPasswordChange("password_2"); base::RunLoop().RunUntilIdle(); EXPECT_EQ(0u, profile->GetPrefs() ->GetDictionary(prefs::kSafeBrowsingUnhandledGaiaPasswordReuses) - ->size()); + ->DictSize()); } IN_PROC_BROWSER_TEST_F(ChromePasswordProtectionServiceBrowserTest,
diff --git a/chrome/browser/search_engines/template_url_fetcher_unittest.cc b/chrome/browser/search_engines/template_url_fetcher_unittest.cc index 134c466..f48bc5e6 100644 --- a/chrome/browser/search_engines/template_url_fetcher_unittest.cc +++ b/chrome/browser/search_engines/template_url_fetcher_unittest.cc
@@ -31,8 +31,6 @@ namespace { -using base::ASCIIToUTF16; - constexpr int32_t kRequestID = 10; bool GetTestFilePath(const std::string& file_name, base::FilePath* path) { @@ -299,8 +297,7 @@ WaitForDownloadToFinish(); const TemplateURL* t_url = test_util()->model()->GetTemplateURLForKeyword(keyword); - EXPECT_EQ(base::UTF8ToUTF16("\xd1\x82\xd0\xb5\xd1\x81\xd1\x82"), - t_url->short_name()); + EXPECT_EQ(u"тест", t_url->short_name()); } } // namespace
diff --git a/chrome/browser/search_engines/template_url_service_sync_unittest.cc b/chrome/browser/search_engines/template_url_service_sync_unittest.cc index fff3861..9442e9a0 100644 --- a/chrome/browser/search_engines/template_url_service_sync_unittest.cc +++ b/chrome/browser/search_engines/template_url_service_sync_unittest.cc
@@ -34,10 +34,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using base::ASCIIToUTF16; using base::Time; using base::TimeDelta; -using base::UTF8ToUTF16; using testing::NotNull; namespace { @@ -971,9 +969,8 @@ GURL google_url(model()->search_terms_data().GoogleBaseURLValue()); TemplateURL* guid2 = model()->GetTemplateURLForHost(google_url.host()); ASSERT_THAT(guid2, NotNull()); - std::u16string google_keyword( - base::ASCIIToUTF16(url_formatter::StripWWW(google_url.host()))); - EXPECT_EQ(google_keyword, guid2->keyword()); + std::string google_keyword(url_formatter::StripWWW(google_url.host())); + EXPECT_EQ(base::ASCIIToUTF16(google_keyword), guid2->keyword()); // We should also have gotten some corresponding UPDATEs pushed upstream. EXPECT_GE(processor()->change_list_size(), 2U); @@ -984,18 +981,19 @@ ASSERT_TRUE(processor()->contains_guid("guid2")); syncer::SyncChange guid2_change = processor()->change_for_guid("guid2"); EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE, guid2_change.change_type()); - EXPECT_EQ(google_keyword, UTF8ToUTF16(GetKeyword(guid2_change.sync_data()))); + EXPECT_EQ(google_keyword, GetKeyword(guid2_change.sync_data())); } TEST_F(TemplateURLServiceSyncTest, AutogeneratedKeywordConflicts) { // Sync brings in some autogenerated keywords, but the generated keywords we // try to create conflict with ones in the model. - std::u16string google_keyword(base::ASCIIToUTF16(url_formatter::StripWWW( - GURL(model()->search_terms_data().GoogleBaseURLValue()).host()))); + std::string google_keyword(url_formatter::StripWWW( + GURL(model()->search_terms_data().GoogleBaseURLValue()).host())); + std::u16string google_keyword16(base::ASCIIToUTF16(google_keyword)); const std::string local_google_url = "{google:baseURL}1/search?q={searchTerms}"; TemplateURL* google = - model()->Add(CreateTestTemplateURL(google_keyword, local_google_url)); + model()->Add(CreateTestTemplateURL(google_keyword16, local_google_url)); TemplateURL* other = model()->Add(CreateTestTemplateURL(u"other.com", "http://other.com/foo")); syncer::SyncDataList initial_data; @@ -1024,7 +1022,8 @@ // the sync TemplateURLs (GUIDs transferred over). EXPECT_FALSE(model()->GetTemplateURLForGUID(local_google_guid)); ASSERT_TRUE(model()->GetTemplateURLForGUID("sync1")); - EXPECT_EQ(google_keyword, model()->GetTemplateURLForGUID("sync1")->keyword()); + EXPECT_EQ(google_keyword16, + model()->GetTemplateURLForGUID("sync1")->keyword()); EXPECT_FALSE(model()->GetTemplateURLForGUID(local_other_guid)); ASSERT_TRUE(model()->GetTemplateURLForGUID("sync2")); EXPECT_EQ(u"other.com", model()->GetTemplateURLForGUID("sync2")->keyword()); @@ -1035,7 +1034,7 @@ ASSERT_TRUE(processor()->contains_guid("sync1")); syncer::SyncChange sync1_change = processor()->change_for_guid("sync1"); EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE, sync1_change.change_type()); - EXPECT_EQ(google_keyword, UTF8ToUTF16(GetKeyword(sync1_change.sync_data()))); + EXPECT_EQ(google_keyword, GetKeyword(sync1_change.sync_data())); EXPECT_EQ(local_google_url, GetURL(sync1_change.sync_data())); ASSERT_TRUE(processor()->contains_guid("sync2")); syncer::SyncChange sync2_change = processor()->change_for_guid("sync2"); @@ -1765,7 +1764,8 @@ } TEST_F(TemplateURLServiceSyncTest, PreSyncUpdates) { - const char* kNewKeyword = "somethingnew"; + const char kNewKeyword[] = "somethingnew"; + const char16_t kNewKeyword16[] = u"somethingnew"; // Fetch the prepopulate search engines so we know what they are. std::vector<std::unique_ptr<TemplateURLData>> prepop_turls = TemplateURLPrepopulateData::GetPrepopulatedEngines( @@ -1780,7 +1780,7 @@ TemplateURLData data_copy(*prepop_turls[0]); data_copy.last_modified = Time::FromTimeT(10); std::u16string original_keyword = data_copy.keyword(); - data_copy.SetKeyword(ASCIIToUTF16(kNewKeyword)); + data_copy.SetKeyword(kNewKeyword16); // Set safe_for_autoreplace to false so our keyword survives. data_copy.safe_for_autoreplace = false; model()->Add(std::make_unique<TemplateURL>(data_copy)); @@ -1792,8 +1792,7 @@ // The newly added search engine should have been safely merged, with an // updated time. - TemplateURL* added_turl = model()->GetTemplateURLForKeyword( - ASCIIToUTF16(kNewKeyword)); + TemplateURL* added_turl = model()->GetTemplateURLForKeyword(kNewKeyword16); ASSERT_TRUE(added_turl); base::Time new_timestamp = added_turl->last_modified(); EXPECT_GE(new_timestamp, pre_merge_time); @@ -1818,8 +1817,7 @@ EXPECT_EQ(prepop_turls.size(), model()->GetAllSyncData(syncer::SEARCH_ENGINES).size()); - ASSERT_EQ(added_turl, model()->GetTemplateURLForKeyword( - ASCIIToUTF16(kNewKeyword))); + ASSERT_EQ(added_turl, model()->GetTemplateURLForKeyword(kNewKeyword16)); EXPECT_EQ(new_timestamp, added_turl->last_modified()); syncer::SyncChange change = processor()->change_for_guid(sync_guid); EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE, change.change_type()); @@ -2548,7 +2546,6 @@ } TEST_F(TemplateURLServiceSyncTest, NonAsciiKeywordDoesNotCrash) { - model()->Add(CreateTestTemplateURL(UTF8ToUTF16("\xf0\xaf\xa6\x8d"), - "http://key1.com")); + model()->Add(CreateTestTemplateURL(u"\U0002f98d", "http://key1.com")); MergeAndExpectNotify(CreateInitialSyncData(), 1); }
diff --git a/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller_unittest.cc b/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller_unittest.cc index 4cea4de..ecc05b5 100644 --- a/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller_unittest.cc +++ b/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller_unittest.cc
@@ -33,7 +33,7 @@ namespace { -const char kText[] = "Text to be copied"; +const char16_t kText[] = u"Text to be copied"; const char kExpectedText[] = "Text to be copied"; const char kReceiverGuid[] = "test_receiver_guid"; const char kReceiverName[] = "test_receiver_name"; @@ -54,7 +54,7 @@ CreateFakeDeviceInfo(kReceiverGuid, kReceiverName); controller_ = SharedClipboardUiController::GetOrCreateFromWebContents( web_contents_.get()); - controller_->OnDeviceSelected(base::UTF8ToUTF16(kText), *device_info.get()); + controller_->OnDeviceSelected(kText, *device_info.get()); } protected:
diff --git a/chrome/browser/sharing/sharing_sync_preference.h b/chrome/browser/sharing/sharing_sync_preference.h index 121d596..108e329 100644 --- a/chrome/browser/sharing/sharing_sync_preference.h +++ b/chrome/browser/sharing/sharing_sync_preference.h
@@ -14,7 +14,6 @@ #include "base/macros.h" #include "base/optional.h" #include "base/time/time.h" -#include "base/values.h" #include "components/prefs/pref_change_registrar.h" #include "components/sync_device_info/device_info.h"
diff --git a/chrome/browser/signin/dice_signed_in_profile_creator_unittest.cc b/chrome/browser/signin/dice_signed_in_profile_creator_unittest.cc index af43e3c..35974468 100644 --- a/chrome/browser/signin/dice_signed_in_profile_creator_unittest.cc +++ b/chrome/browser/signin/dice_signed_in_profile_creator_unittest.cc
@@ -29,7 +29,7 @@ namespace { -const char kProfileTestName[] = "profile_test_name"; +const char16_t kProfileTestName[] = u"profile_test_name"; std::unique_ptr<TestingProfile> BuildTestingProfile(const base::FilePath& path, Profile::Delegate* delegate, @@ -165,12 +165,11 @@ AccountInfo account_info = identity_test_env()->MakeAccountAvailable("bob@example.com"); size_t kTestIcon = profiles::GetModernAvatarIconStartIndex(); - std::u16string kProfileTestName16 = base::UTF8ToUTF16(kProfileTestName); base::RunLoop loop; std::unique_ptr<DiceSignedInProfileCreator> creator = std::make_unique<DiceSignedInProfileCreator>( - profile(), account_info.account_id, kProfileTestName16, kTestIcon, + profile(), account_info.account_id, kProfileTestName, kTestIcon, use_guest_profile(), base::BindOnce(&DiceSignedInProfileCreatorTest::OnProfileCreated, base::Unretained(this), loop.QuitClosure())); @@ -201,7 +200,7 @@ ASSERT_TRUE(entry); ASSERT_EQ(entry->IsGuest(), use_guest_profile()); if (!use_guest_profile()) { - EXPECT_EQ(kProfileTestName16, entry->GetLocalProfileName()); + EXPECT_EQ(kProfileTestName, entry->GetLocalProfileName()); EXPECT_EQ(kTestIcon, entry->GetAvatarIconIndex()); } }
diff --git a/chrome/browser/signin/signin_global_error_unittest.cc b/chrome/browser/signin/signin_global_error_unittest.cc index 36746f5..ff400754 100644 --- a/chrome/browser/signin/signin_global_error_unittest.cc +++ b/chrome/browser/signin/signin_global_error_unittest.cc
@@ -35,6 +35,7 @@ #include "testing/gtest/include/gtest/gtest.h" static const char kTestEmail[] = "testuser@test.com"; +static const char16_t kTestEmail16[] = u"testuser@test.com"; class SigninGlobalErrorTest : public testing::Test { public: @@ -64,7 +65,7 @@ ->GetProfileAttributesWithPath(profile()->GetPath()); ASSERT_NE(entry, nullptr); - entry->SetAuthInfo(account_info.gaia, base::UTF8ToUTF16(kTestEmail), + entry->SetAuthInfo(account_info.gaia, kTestEmail16, /*is_consented_primary_account=*/true); global_error_ = SigninGlobalErrorFactory::GetForProfile(profile());
diff --git a/chrome/browser/speech/extension_api/tts_extension_api_constants.h b/chrome/browser/speech/extension_api/tts_extension_api_constants.h index bec43e8..56cb326 100644 --- a/chrome/browser/speech/extension_api/tts_extension_api_constants.h +++ b/chrome/browser/speech/extension_api/tts_extension_api_constants.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_EXTENSION_API_CONSTANTS_H_ #define CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_EXTENSION_API_CONSTANTS_H_ -#include "base/values.h" namespace tts_extension_api_constants {
diff --git a/chrome/browser/ssl/security_state_tab_helper_browsertest.cc b/chrome/browser/ssl/security_state_tab_helper_browsertest.cc index 7f3c78a1..2867ba5c 100644 --- a/chrome/browser/ssl/security_state_tab_helper_browsertest.cc +++ b/chrome/browser/ssl/security_state_tab_helper_browsertest.cc
@@ -139,6 +139,7 @@ enum CertificateStatus { VALID_CERTIFICATE, INVALID_CERTIFICATE }; const char kTestCertificateIssuerName[] = "Test Root CA"; +const char16_t kTestCertificateIssuerName16[] = u"Test Root CA"; bool IsShowingInterstitial(content::WebContents* tab) { security_interstitials::SecurityInterstitialTabHelper* helper = @@ -294,10 +295,9 @@ expected_cert->issuer().GetDisplayName()); EXPECT_EQ(l10n_util::GetStringUTF8(IDS_VALID_SERVER_CERTIFICATE), explanation.summary); - EXPECT_EQ( - l10n_util::GetStringFUTF8(IDS_VALID_SERVER_CERTIFICATE_DESCRIPTION, - base::UTF8ToUTF16(kTestCertificateIssuerName)), - explanation.description); + EXPECT_EQ(l10n_util::GetStringFUTF8(IDS_VALID_SERVER_CERTIFICATE_DESCRIPTION, + kTestCertificateIssuerName16), + explanation.description); net::X509Certificate* cert = browser->tab_strip_model() ->GetActiveWebContents() ->GetController()
diff --git a/chrome/browser/ssl/ssl_browsertest.cc b/chrome/browser/ssl/ssl_browsertest.cc index 7a0c71b..847bc32 100644 --- a/chrome/browser/ssl/ssl_browsertest.cc +++ b/chrome/browser/ssl/ssl_browsertest.cc
@@ -7278,6 +7278,7 @@ namespace { char kTestMITMSoftwareName[] = "Misconfigured Firewall"; +char16_t kTestMITMSoftwareName16[] = u"Misconfigured Firewall"; class SSLUIMITMSoftwareTest : public CertVerifierBrowserTest { public: @@ -7671,12 +7672,12 @@ SetUpMITMSoftwareCertList(kLargeVersionId); TestMITMSoftwareInterstitial(); - const std::string expected_primary_paragraph = l10n_util::GetStringFUTF8( - IDS_MITM_SOFTWARE_PRIMARY_PARAGRAPH_ENTERPRISE, - net::EscapeForHTML(base::UTF8ToUTF16(kTestMITMSoftwareName))); + const std::string expected_primary_paragraph = + l10n_util::GetStringFUTF8(IDS_MITM_SOFTWARE_PRIMARY_PARAGRAPH_ENTERPRISE, + net::EscapeForHTML(kTestMITMSoftwareName16)); const std::string expected_explanation = l10n_util::GetStringFUTF8( IDS_MITM_SOFTWARE_EXPLANATION_ENTERPRISE, - net::EscapeForHTML(base::UTF8ToUTF16(kTestMITMSoftwareName)), + net::EscapeForHTML(kTestMITMSoftwareName16), l10n_util::GetStringUTF16(IDS_MITM_SOFTWARE_EXPLANATION)); WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); @@ -7699,7 +7700,7 @@ // has escaped HTML characters which throw an error. const std::string expected_explanation = l10n_util::GetStringFUTF8( IDS_MITM_SOFTWARE_EXPLANATION_NONENTERPRISE, - net::EscapeForHTML(base::UTF8ToUTF16(kTestMITMSoftwareName)), + net::EscapeForHTML(kTestMITMSoftwareName16), l10n_util::GetStringUTF16(IDS_MITM_SOFTWARE_EXPLANATION)); WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
diff --git a/chrome/browser/ssl/ssl_config_service_manager_pref.cc b/chrome/browser/ssl/ssl_config_service_manager_pref.cc index ff27331..804dde0 100644 --- a/chrome/browser/ssl/ssl_config_service_manager_pref.cc +++ b/chrome/browser/ssl/ssl_config_service_manager_pref.cc
@@ -54,10 +54,9 @@ std::vector<std::string> results; results.reserve(value->GetSize()); std::string s; - for (auto it = value->begin(); it != value->end(); ++it) { - if (!it->GetAsString(&s)) - continue; - results.push_back(s); + for (const auto& entry : value->GetList()) { + if (entry.GetAsString(&s)) + results.push_back(s); } return results; }
diff --git a/chrome/browser/ssl/stateful_ssl_host_state_delegate_factory.h b/chrome/browser/ssl/stateful_ssl_host_state_delegate_factory.h index 9f28088..188730d 100644 --- a/chrome/browser/ssl/stateful_ssl_host_state_delegate_factory.h +++ b/chrome/browser/ssl/stateful_ssl_host_state_delegate_factory.h
@@ -7,7 +7,6 @@ #include "base/macros.h" #include "base/memory/singleton.h" -#include "base/values.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "components/prefs/pref_service.h"
diff --git a/chrome/browser/supervised_user/supervised_user_url_filter.h b/chrome/browser/supervised_user/supervised_user_url_filter.h index 5c56b61..0cbbf5c8 100644 --- a/chrome/browser/supervised_user/supervised_user_url_filter.h +++ b/chrome/browser/supervised_user/supervised_user_url_filter.h
@@ -14,7 +14,6 @@ #include "base/macros.h" #include "base/observer_list.h" #include "base/sequence_checker.h" -#include "base/values.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/supervised_user/supervised_user_error_page/supervised_user_error_page.h" #include "chrome/browser/supervised_user/supervised_user_site_list.h"
diff --git a/chrome/browser/sync/test/integration/two_client_web_apps_bmo_sync_test.cc b/chrome/browser/sync/test/integration/two_client_web_apps_bmo_sync_test.cc index fd23be6..f15f0e1e 100644 --- a/chrome/browser/sync/test/integration/two_client_web_apps_bmo_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_web_apps_bmo_sync_test.cc
@@ -18,7 +18,6 @@ #include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h" #include "chrome/browser/web_applications/components/app_registry_controller.h" #include "chrome/browser/web_applications/components/app_shortcut_manager.h" -#include "chrome/browser/web_applications/components/install_finalizer.h" #include "chrome/browser/web_applications/components/install_manager.h" #include "chrome/browser/web_applications/components/os_integration_manager.h" #include "chrome/browser/web_applications/components/web_application_info.h" @@ -68,8 +67,6 @@ return result; for (Profile* profile : GetAllProfiles()) { auto* web_app_provider = WebAppProvider::Get(profile); - web_app_provider->install_finalizer() - .RemoveLegacyInstallFinalizerForTesting(); base::RunLoop loop; web_app_provider->on_registry_ready().Post(FROM_HERE, loop.QuitClosure()); loop.Run();
diff --git a/chrome/browser/sync/test/integration/wallet_helper.cc b/chrome/browser/sync/test/integration/wallet_helper.cc index a22613a..a95b7602 100644 --- a/chrome/browser/sync/test/integration/wallet_helper.cc +++ b/chrome/browser/sync/test/integration/wallet_helper.cc
@@ -40,7 +40,9 @@ const int kDefaultCardExpMonth = 8; const int kDefaultCardExpYear = 2087; const char kDefaultCardLastFour[] = "1234"; +const char16_t kDefaultCardLastFour16[] = u"1234"; const char kDefaultCardName[] = "Patrick Valenzuela"; +const char16_t kDefaultCardName16[] = u"Patrick Valenzuela"; const sync_pb::WalletMaskedCreditCard_WalletCardType kDefaultCardType = sync_pb::WalletMaskedCreditCard::AMEX; @@ -405,17 +407,11 @@ } CreditCard GetDefaultCreditCard() { - return GetCreditCard(kDefaultCardID, kDefaultCardLastFour); -} - -autofill::CreditCard GetCreditCard(const std::string& name, - const std::string& last_four) { - CreditCard card(CreditCard::MASKED_SERVER_CARD, name); + CreditCard card(CreditCard::MASKED_SERVER_CARD, kDefaultCardID); card.SetExpirationMonth(kDefaultCardExpMonth); card.SetExpirationYear(kDefaultCardExpYear); - card.SetNumber(base::UTF8ToUTF16(last_four)); - card.SetRawInfo(autofill::CREDIT_CARD_NAME_FULL, - base::UTF8ToUTF16(kDefaultCardName)); + card.SetNumber(kDefaultCardLastFour16); + card.SetRawInfo(autofill::CREDIT_CARD_NAME_FULL, kDefaultCardName16); card.SetServerStatus(CreditCard::OK); card.SetNetworkForMaskedCard(autofill::kAmericanExpressCard); card.set_billing_address_id(kDefaultBillingAddressID); @@ -489,11 +485,11 @@ void ExpectDefaultCreditCardValues(const CreditCard& card) { EXPECT_EQ(CreditCard::MASKED_SERVER_CARD, card.record_type()); EXPECT_EQ(kDefaultCardID, card.server_id()); - EXPECT_EQ(base::UTF8ToUTF16(kDefaultCardLastFour), card.LastFourDigits()); + EXPECT_EQ(kDefaultCardLastFour16, card.LastFourDigits()); EXPECT_EQ(autofill::kAmericanExpressCard, card.network()); EXPECT_EQ(kDefaultCardExpMonth, card.expiration_month()); EXPECT_EQ(kDefaultCardExpYear, card.expiration_year()); - EXPECT_EQ(base::UTF8ToUTF16(kDefaultCardName), + EXPECT_EQ(kDefaultCardName16, card.GetRawInfo(autofill::ServerFieldType::CREDIT_CARD_NAME_FULL)); EXPECT_EQ(kDefaultBillingAddressID, card.billing_address_id()); }
diff --git a/chrome/browser/sync_file_system/drive_backend/fake_drive_uploader.h b/chrome/browser/sync_file_system/drive_backend/fake_drive_uploader.h index 09f355e..fa4de92 100644 --- a/chrome/browser/sync_file_system/drive_backend/fake_drive_uploader.h +++ b/chrome/browser/sync_file_system/drive_backend/fake_drive_uploader.h
@@ -9,7 +9,6 @@ #include "base/files/file_util.h" #include "base/macros.h" -#include "base/values.h" #include "chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.h" #include "components/drive/drive_uploader.h" #include "components/drive/service/fake_drive_service.h"
diff --git a/chrome/browser/sync_file_system/mock_remote_file_sync_service.cc b/chrome/browser/sync_file_system/mock_remote_file_sync_service.cc index f58a6a3..68e7fcd 100644 --- a/chrome/browser/sync_file_system/mock_remote_file_sync_service.cc +++ b/chrome/browser/sync_file_system/mock_remote_file_sync_service.cc
@@ -10,6 +10,7 @@ #include "base/location.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" +#include "base/values.h" #include "storage/browser/file_system/file_system_url.h" #include "url/gurl.h"
diff --git a/chrome/browser/sync_file_system/mock_remote_file_sync_service.h b/chrome/browser/sync_file_system/mock_remote_file_sync_service.h index 192fafe..45f759d 100644 --- a/chrome/browser/sync_file_system/mock_remote_file_sync_service.h +++ b/chrome/browser/sync_file_system/mock_remote_file_sync_service.h
@@ -13,7 +13,6 @@ #include "base/callback.h" #include "base/macros.h" #include "base/observer_list.h" -#include "base/values.h" #include "chrome/browser/sync_file_system/file_status_observer.h" #include "chrome/browser/sync_file_system/mock_local_change_processor.h" #include "chrome/browser/sync_file_system/remote_change_processor.h"
diff --git a/chrome/browser/task_manager/providers/vm/crostini_process_task.cc b/chrome/browser/task_manager/providers/vm/crostini_process_task.cc index c845a32..1b6bb72 100644 --- a/chrome/browser/task_manager/providers/vm/crostini_process_task.cc +++ b/chrome/browser/task_manager/providers/vm/crostini_process_task.cc
@@ -5,7 +5,7 @@ #include "chrome/browser/task_manager/providers/vm/crostini_process_task.h" #include "base/callback_helpers.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/grit/chrome_unscaled_resources.h" #include "chrome/grit/generated_resources.h"
diff --git a/chrome/browser/task_manager/providers/vm/vm_process_task.cc b/chrome/browser/task_manager/providers/vm/vm_process_task.cc index 5c25cdd..1686712 100644 --- a/chrome/browser/task_manager/providers/vm/vm_process_task.cc +++ b/chrome/browser/task_manager/providers/vm/vm_process_task.cc
@@ -7,7 +7,7 @@ #include "base/callback_helpers.h" #include "base/i18n/rtl.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/grit/chrome_unscaled_resources.h"
diff --git a/chrome/browser/tracing/background_tracing_metrics_provider.cc b/chrome/browser/tracing/background_tracing_metrics_provider.cc index dbe5db7..b12ad6b9 100644 --- a/chrome/browser/tracing/background_tracing_metrics_provider.cc +++ b/chrome/browser/tracing/background_tracing_metrics_provider.cc
@@ -9,9 +9,11 @@ #include "base/strings/string_piece.h" #include "base/time/time.h" +#include "chrome/browser/browser_process.h" #include "components/metrics/content/gpu_metrics_provider.h" #include "components/metrics/cpu_metrics_provider.h" #include "components/metrics/field_trials_provider.h" +#include "components/metrics/metrics_service.h" #include "content/public/browser/background_tracing_manager.h" #include "third_party/metrics_proto/chrome_user_metrics_extension.pb.h" #include "third_party/metrics_proto/trace_log.pb.h" @@ -22,7 +24,11 @@ namespace tracing { -BackgroundTracingMetricsProvider::BackgroundTracingMetricsProvider() { +BackgroundTracingMetricsProvider::BackgroundTracingMetricsProvider() = default; +BackgroundTracingMetricsProvider::~BackgroundTracingMetricsProvider() = default; + +void BackgroundTracingMetricsProvider::Init() { + // TODO(ssid): SetupBackgroundTracingFieldTrial() should be called here. #if defined(OS_WIN) // AV metrics provider is initialized asynchronously. It might not be // initialized when reporting metrics, in which case it'll just not add any AV @@ -31,19 +37,18 @@ std::make_unique<AntiVirusMetricsProvider>()); av_metrics_provider_ = system_profile_providers_.back().get(); #endif // defined(OS_WIN) + variations::SyntheticTrialRegistry* registry = nullptr; + if (g_browser_process->metrics_service() != nullptr) { + registry = g_browser_process->metrics_service()->synthetic_trial_registry(); + } system_profile_providers_.emplace_back( - std::make_unique<variations::FieldTrialsProvider>(nullptr, + std::make_unique<variations::FieldTrialsProvider>(registry, base::StringPiece())); system_profile_providers_.emplace_back( std::make_unique<metrics::CPUMetricsProvider>()); system_profile_providers_.emplace_back( std::make_unique<metrics::GPUMetricsProvider>()); } -BackgroundTracingMetricsProvider::~BackgroundTracingMetricsProvider() {} - -void BackgroundTracingMetricsProvider::Init() { - // TODO(ssid): SetupBackgroundTracingFieldTrial() should be called here. -} #if defined(OS_WIN) void BackgroundTracingMetricsProvider::AsyncInit(
diff --git a/chrome/browser/translate/language_detection_service_browsertest.cc b/chrome/browser/translate/language_detection_service_browsertest.cc index a85aac7..83204345 100644 --- a/chrome/browser/translate/language_detection_service_browsertest.cc +++ b/chrome/browser/translate/language_detection_service_browsertest.cc
@@ -18,10 +18,10 @@ DetermineLanguageReliable) { mojo::Remote<language_detection::mojom::LanguageDetectionService> service = language_detection::LaunchLanguageDetectionService(); - std::u16string text = base::UTF8ToUTF16( - "El niño atrapó un dorado muy grande con cebo vivo. Fileteó el " - "pescado y lo asó a la parrilla. Sabía excelente. Espera pescar otro " - "buen pescado mañana."); + std::u16string text = + u"El niño atrapó un dorado muy grande con cebo vivo. Fileteó el " + u"pescado y lo asó a la parrilla. Sabía excelente. Espera pescar otro " + u"buen pescado mañana."; base::RunLoop run_loop; service->DetermineLanguage(
diff --git a/chrome/browser/ui/android/infobars/save_password_infobar.h b/chrome/browser/ui/android/infobars/save_password_infobar.h index 042f5ad..6fbff42 100644 --- a/chrome/browser/ui/android/infobars/save_password_infobar.h +++ b/chrome/browser/ui/android/infobars/save_password_infobar.h
@@ -7,7 +7,6 @@ #include "base/android/scoped_java_ref.h" #include "base/macros.h" -#include "base/values.h" #include "chrome/browser/profiles/profile.h" #include "components/infobars/android/confirm_infobar.h" #include "components/signin/public/identity_manager/account_info.h"
diff --git a/chrome/browser/ui/app_list/app_list_syncable_service.cc b/chrome/browser/ui/app_list/app_list_syncable_service.cc index 6128ffe..30cbc5f 100644 --- a/chrome/browser/ui/app_list/app_list_syncable_service.cc +++ b/chrome/browser/ui/app_list/app_list_syncable_service.cc
@@ -21,7 +21,7 @@ #include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/ash/arc/arc_util.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_features.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/file_manager/app_id.h" #include "chrome/browser/extensions/extension_service.h"
diff --git a/chrome/browser/ui/app_list/app_service/app_service_app_model_builder.cc b/chrome/browser/ui/app_list/app_service/app_service_app_model_builder.cc index 2d3fcb98..fecd234 100644 --- a/chrome/browser/ui/app_list/app_service/app_service_app_model_builder.cc +++ b/chrome/browser/ui/app_list/app_service/app_service_app_model_builder.cc
@@ -10,10 +10,8 @@ #include "chrome/browser/ash/arc/arc_util.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/ui/app_list/app_service/app_service_app_item.h" -#include "chrome/browser/web_applications/components/preinstalled_app_install_features.h" #include "chrome/grit/generated_resources.h" #include "components/sync/protocol/sync.pb.h" -#include "extensions/common/extension_features.h" #include "ui/base/l10n/l10n_util.h" namespace { @@ -122,19 +120,10 @@ // Play Store. unsynced_change = !arc::IsArcPlayStoreEnabledForProfile(profile()); } - bool default_chrome_apps_migrating = - base::FeatureList::IsEnabled( - web_app::kMigrateDefaultChromeAppToWebAppsGSuite) || - base::FeatureList::IsEnabled( - web_app::kMigrateDefaultChromeAppToWebAppsNonGSuite); - if (!base::FeatureList::IsEnabled( - extensions_features::kDefaultChromeAppUninstallSync) || - default_chrome_apps_migrating) { - if (update.InstalledInternally() == apps::mojom::OptionalBool::kTrue) { - // Don't sync default app removal as default installed apps are not - // synced. - unsynced_change = true; - } + if (update.InstalledInternally() == apps::mojom::OptionalBool::kTrue) { + // Don't sync default app removal as default installed apps are not + // synced. + unsynced_change = true; } RemoveApp(update.AppId(), unsynced_change); }
diff --git a/chrome/browser/ui/app_list/app_service/app_service_app_model_builder_unittest.cc b/chrome/browser/ui/app_list/app_service/app_service_app_model_builder_unittest.cc index 8257c82a..5b5415fc 100644 --- a/chrome/browser/ui/app_list/app_service/app_service_app_model_builder_unittest.cc +++ b/chrome/browser/ui/app_list/app_service/app_service_app_model_builder_unittest.cc
@@ -54,6 +54,7 @@ #include "chrome/grit/generated_resources.h" #include "chrome/test/base/testing_profile.h" #include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/settings/cros_settings_names.h" #include "components/prefs/pref_service.h" #include "components/services/app_service/public/mojom/types.mojom-shared.h" @@ -665,6 +666,7 @@ void SetUp() override { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); AppServiceAppModelBuilderTest::SetUp(); test_helper_ = std::make_unique<CrostiniTestHelper>(testing_profile()); test_helper_->ReInitializeAppServiceIntegration(); @@ -681,6 +683,7 @@ // DBusThreadManager to ensure all keyed services that might rely on DBus // clients are destroyed. profile_.reset(); + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); } @@ -910,8 +913,14 @@ // Required to ensure that the Plugin VM manager can be accessed in order to // retrieve permissions. struct ScopedDBusThreadManager { - ScopedDBusThreadManager() { chromeos::DBusThreadManager::Initialize(); } - ~ScopedDBusThreadManager() { chromeos::DBusThreadManager::Shutdown(); } + ScopedDBusThreadManager() { + chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); + } + ~ScopedDBusThreadManager() { + chromeos::SeneschalClient::Shutdown(); + chromeos::DBusThreadManager::Shutdown(); + } } dbus_thread_manager_; // Destroys any existing builder in the correct order.
diff --git a/chrome/browser/ui/app_list/app_service/app_service_context_menu.cc b/chrome/browser/ui/app_list/app_service/app_service_context_menu.cc index 357078e..c376ffdb 100644 --- a/chrome/browser/ui/app_list/app_service/app_service_context_menu.cc +++ b/chrome/browser/ui/app_list/app_service/app_service_context_menu.cc
@@ -12,10 +12,10 @@ #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/apps/app_service/menu_util.h" #include "chrome/browser/ash/crosapi/browser_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_manager.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_manager_factory.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_util.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_terminal.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/extensions/context_menu_matcher.h"
diff --git a/chrome/browser/ui/app_list/search/app_list_search_browsertest.cc b/chrome/browser/ui/app_list/search/app_list_search_browsertest.cc index b9fdea4..9253eb6 100644 --- a/chrome/browser/ui/app_list/search/app_list_search_browsertest.cc +++ b/chrome/browser/ui/app_list/search/app_list_search_browsertest.cc
@@ -58,7 +58,9 @@ AppListSearchBrowserTest() { scoped_feature_list_.InitWithFeatures( - {chromeos::features::kHelpAppLauncherSearch}, {}); + {chromeos::features::kHelpAppLauncherSearch, + chromeos::features::kHelpAppDiscoverTab}, + {}); } ~AppListSearchBrowserTest() override = default; @@ -160,6 +162,47 @@ "some query", {ResultType::kInstalledApp, ResultType::kFileSearch}); } +// Test that clicking the Discover tab suggestion chip launches the Help app on +// the Discover page. +IN_PROC_BROWSER_TEST_F(AppListSearchBrowserTest, + ClickingDiscoverTabSuggestionChipLaunchesHelpApp) { + web_app::WebAppProvider::Get(GetProfile()) + ->system_web_app_manager() + .InstallSystemAppsForTesting(); + GetProfile()->GetPrefs()->SetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow, 3); + + SearchAndWaitForProviders("", {ResultType::kHelpApp}); + + ChromeSearchResult* result = FindResult("help-app://discover"); + ASSERT_TRUE(result); + EXPECT_EQ(base::UTF16ToASCII(result->title()), "Build a game"); + + // Open the search result. This should open the help app at the expected url. + size_t num_browsers = chrome::GetTotalBrowserCount(); + const GURL expected_url("chrome://help-app/discover"); + content::TestNavigationObserver navigation_observer(expected_url); + navigation_observer.StartWatchingNewWebContents(); + + GetClient()->OpenSearchResult( + result->id(), /*event_flags=*/0, + ash::AppListLaunchedFrom::kLaunchedFromSuggestionChip, + ash::AppListLaunchType::kAppSearchResult, /*suggestion_index=*/0, + /*launch_as_default=*/false); + + navigation_observer.Wait(); + + EXPECT_EQ(num_browsers + 1, chrome::GetTotalBrowserCount()); + EXPECT_EQ(expected_url, chrome::FindLastActive() + ->tab_strip_model() + ->GetActiveWebContents() + ->GetVisibleURL()); + + // Clicking on the chip should stop showing it in the future. + EXPECT_EQ(0, GetProfile()->GetPrefs()->GetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow)); +} + // Test that Help App shows up as Release notes if pref shows we have some times // left to show it. IN_PROC_BROWSER_TEST_F(AppListSearchBrowserTest, @@ -200,6 +243,46 @@ EXPECT_EQ(times_left_to_show, 2); } +// Test that clicking the Release Notes suggestion chip launches the Help app on +// the What's New page. +IN_PROC_BROWSER_TEST_F(AppListSearchBrowserTest, + ClickingReleaseNotesSuggestionChipLaunchesHelpApp) { + web_app::WebAppProvider::Get(GetProfile()) + ->system_web_app_manager() + .InstallSystemAppsForTesting(); + GetProfile()->GetPrefs()->SetInteger( + prefs::kReleaseNotesSuggestionChipTimesLeftToShow, 3); + + SearchAndWaitForProviders("", {ResultType::kHelpApp}); + + ChromeSearchResult* result = FindResult("help-app://updates"); + + // Open the search result. This should open the help app at the expected url. + size_t num_browsers = chrome::GetTotalBrowserCount(); + const GURL expected_url("chrome://help-app/updates"); + content::TestNavigationObserver navigation_observer(expected_url); + navigation_observer.StartWatchingNewWebContents(); + + GetClient()->OpenSearchResult( + result->id(), /*event_flags=*/0, + ash::AppListLaunchedFrom::kLaunchedFromSuggestionChip, + ash::AppListLaunchType::kAppSearchResult, /*suggestion_index=*/0, + /*launch_as_default=*/false); + + navigation_observer.Wait(); + + EXPECT_EQ(num_browsers + 1, chrome::GetTotalBrowserCount()); + EXPECT_EQ(expected_url, chrome::FindLastActive() + ->tab_strip_model() + ->GetActiveWebContents() + ->GetVisibleURL()); + + // Clicking on the chip should stop showing it in the future. + const int times_left_to_show = GetProfile()->GetPrefs()->GetInteger( + prefs::kReleaseNotesSuggestionChipTimesLeftToShow); + EXPECT_EQ(times_left_to_show, 0); +} + // Test that the help app provider provides list search results. IN_PROC_BROWSER_TEST_F(AppListSearchBrowserTest, HelpAppProviderProvidesListResults) {
diff --git a/chrome/browser/ui/app_list/search/app_search_provider.cc b/chrome/browser/ui/app_list/search/app_search_provider.cc index b4f0b7a..48cdb725 100644 --- a/chrome/browser/ui/app_list/search/app_search_provider.cc +++ b/chrome/browser/ui/app_list/search/app_search_provider.cc
@@ -28,8 +28,8 @@ #include "base/time/clock.h" #include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/extensions/gfx_utils.h" #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/ui/app_list/search/app_search_provider_unittest.cc b/chrome/browser/ui/app_list/search/app_search_provider_unittest.cc index 75b12355..5d4562f 100644 --- a/chrome/browser/ui/app_list/search/app_search_provider_unittest.cc +++ b/chrome/browser/ui/app_list/search/app_search_provider_unittest.cc
@@ -40,6 +40,7 @@ #include "chrome/common/chrome_constants.h" #include "chrome/test/base/testing_profile.h" #include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "components/arc/test/fake_app_instance.h" #include "components/crx_file/id_util.h" #include "components/services/app_service/public/cpp/stub_icon_loader.h" @@ -744,6 +745,7 @@ public: void SetUp() override { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); AppSearchProviderTest::SetUp(); } @@ -756,6 +758,7 @@ // DBusThreadManager to ensure all keyed services that might rely on DBus // clients are destroyed. profile_.reset(); + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); } };
diff --git a/chrome/browser/ui/app_list/search/help_app_provider.cc b/chrome/browser/ui/app_list/search/help_app_provider.cc index 55c5e32e..32bfefa 100644 --- a/chrome/browser/ui/app_list/search/help_app_provider.cc +++ b/chrome/browser/ui/app_list/search/help_app_provider.cc
@@ -10,6 +10,7 @@ #include "ash/public/cpp/app_list/app_list_config.h" #include "ash/public/cpp/app_list/app_list_features.h" #include "base/bind.h" +#include "base/feature_list.h" #include "base/macros.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/user_metrics.h" @@ -24,12 +25,14 @@ #include "chrome/browser/web_applications/components/web_app_id_constants.h" #include "chrome/browser/web_applications/system_web_apps/system_web_app_types.h" #include "chrome/common/chrome_features.h" +#include "chrome/common/pref_names.h" #include "chrome/grit/generated_resources.h" #include "chromeos/components/help_app_ui/help_app_manager.h" #include "chromeos/components/help_app_ui/help_app_manager_factory.h" #include "chromeos/components/help_app_ui/search/search_handler.h" #include "chromeos/components/help_app_ui/url_constants.h" #include "chromeos/strings/grit/chromeos_strings.h" +#include "components/prefs/pref_service.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/image/image_skia.h" #include "url/gurl.h" @@ -37,6 +40,7 @@ namespace app_list { namespace { +constexpr char kHelpAppDiscoverResult[] = "help-app://discover"; constexpr char kHelpAppUpdatesResult[] = "help-app://updates"; constexpr float kScoreEps = 1e-5f; @@ -45,6 +49,32 @@ constexpr size_t kNumRequestedResults = 5u; constexpr size_t kMaxShownResults = 2u; +// Whether we should show the Discover Tab suggestion chip. +bool ShouldShowDiscoverTabSuggestionChip(Profile* profile) { + if (!base::FeatureList::IsEnabled(ash::features::kHelpAppDiscoverTab)) { + return false; + } + const int times_left_to_show = profile->GetPrefs()->GetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow); + return times_left_to_show > 0; +} + +// Decrements the times left to show the Discover Tab suggestion chip in +// PrefService. +void DecreaseTimesLeftToShowDiscoverTabSuggestionChip(Profile* profile) { + const int times_left_to_show = profile->GetPrefs()->GetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow); + profile->GetPrefs()->SetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow, times_left_to_show - 1); +} + +// Sets the times left to show the Discover Tab suggestion chip to 0 in +// PrefService. +void StopShowingDiscoverTabSuggestionChip(Profile* profile) { + profile->GetPrefs()->SetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow, 0); +} + // Filter out results below the min score threshold and limit the number of // shown results. std::vector<chromeos::help_app::mojom::SearchResultPtr> FilterAndLimitResults( @@ -86,11 +116,14 @@ } // namespace -HelpAppResult::HelpAppResult(Profile* profile, const gfx::ImageSkia& icon) - : profile_(profile), url_path_(""), help_app_content_id_("") { +HelpAppResult::HelpAppResult(Profile* profile, + const std::string& id, + const std::u16string& title, + const gfx::ImageSkia& icon) + : profile_(profile) { DCHECK(profile_); - set_id(kHelpAppUpdatesResult); - SetTitle(l10n_util::GetStringUTF16(IDS_HELP_APP_WHATS_NEW_SUGGESTION_CHIP)); + set_id(id); + SetTitle(title); // Show this in the first position, in front of any other chips that may be // also claiming the first slot. SetDisplayIndex(DisplayIndex::kFirstIndex); @@ -127,7 +160,19 @@ void HelpAppResult::Open(int event_flags) { // Note: event_flags is ignored, LaunchSWA doesn't need it. - if (id() == kHelpAppUpdatesResult) { + if (id() == kHelpAppDiscoverResult) { + // Launch discover tab suggestion chip. + web_app::SystemAppLaunchParams params; + params.url = GURL("chrome://help-app/discover"); + params.launch_source = + apps::mojom::LaunchSource::kFromAppListRecommendation; + web_app::LaunchSystemWebAppAsync( + profile_, web_app::SystemAppType::HELP, params, + apps::MakeWindowInfo(display::kDefaultDisplayId)); + + StopShowingDiscoverTabSuggestionChip(profile_); + return; + } else if (id() == kHelpAppUpdatesResult) { // Launch release notes suggestion chip. base::RecordAction( base::UserMetricsAction("ReleaseNotes.SuggestionChipLaunched")); @@ -186,9 +231,17 @@ if (query.empty()) { // Zero state suggestion chip. SearchProvider::Results search_results; - if (ash::ReleaseNotesStorage(profile_).ShouldShowSuggestionChip()) { - search_results.emplace_back( - std::make_unique<HelpAppResult>(profile_, icon_)); + + if (ShouldShowDiscoverTabSuggestionChip(profile_)) { + search_results.emplace_back(std::make_unique<HelpAppResult>( + profile_, kHelpAppDiscoverResult, + l10n_util::GetStringUTF16(IDS_HELP_APP_DISCOVER_TAB_SUGGESTION_CHIP), + icon_)); + } else if (ash::ReleaseNotesStorage(profile_).ShouldShowSuggestionChip()) { + search_results.emplace_back(std::make_unique<HelpAppResult>( + profile_, kHelpAppUpdatesResult, + l10n_util::GetStringUTF16(IDS_HELP_APP_WHATS_NEW_SUGGESTION_CHIP), + icon_)); } SwapResults(&search_results); } else { @@ -265,7 +318,14 @@ // TODO(b/171828539): Consider using AppListNotifier for better proxy of // impressions. void HelpAppProvider::AppListShown() { - ash::ReleaseNotesStorage(profile_).DecreaseTimesLeftToShowSuggestionChip(); + for (auto& result : results()) { + if (result->id() == kHelpAppDiscoverResult) { + DecreaseTimesLeftToShowDiscoverTabSuggestionChip(profile_); + } else if (result->id() == kHelpAppUpdatesResult) { + ash::ReleaseNotesStorage(profile_) + .DecreaseTimesLeftToShowSuggestionChip(); + } + } } ash::AppListSearchResultType HelpAppProvider::ResultType() {
diff --git a/chrome/browser/ui/app_list/search/help_app_provider.h b/chrome/browser/ui/app_list/search/help_app_provider.h index 720639a..7908f0a2 100644 --- a/chrome/browser/ui/app_list/search/help_app_provider.h +++ b/chrome/browser/ui/app_list/search/help_app_provider.h
@@ -41,7 +41,10 @@ class HelpAppResult : public ChromeSearchResult { public: // Constructor for the What's new chip. - HelpAppResult(Profile* profile, const gfx::ImageSkia& icon); + HelpAppResult(Profile* profile, + const std::string& id, + const std::u16string& title, + const gfx::ImageSkia& icon); // Constructor for a list result. HelpAppResult(const float& relevance, Profile* profile,
diff --git a/chrome/browser/ui/app_list/search/help_app_provider_unittest.cc b/chrome/browser/ui/app_list/search/help_app_provider_unittest.cc new file mode 100644 index 0000000..a28c0ad9 --- /dev/null +++ b/chrome/browser/ui/app_list/search/help_app_provider_unittest.cc
@@ -0,0 +1,193 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/app_list/search/help_app_provider.h" + +#include <memory> +#include <string> + +#include "ash/constants/ash_features.h" +#include "base/feature_list.h" +#include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_feature_list.h" +#include "chrome/browser/ui/app_list/app_list_test_util.h" +#include "chrome/browser/ui/app_list/search/chrome_search_result.h" +#include "chrome/common/pref_names.h" +#include "chrome/test/base/testing_profile.h" +#include "components/prefs/pref_service.h" + +namespace app_list { +namespace test { + +namespace { +void ExpectDiscoverTabChip(ChromeSearchResult* result) { + EXPECT_EQ("help-app://discover", result->id()); + EXPECT_EQ("Build a game", base::UTF16ToASCII(result->title())); + EXPECT_EQ(ash::AppListSearchResultType::kHelpApp, result->result_type()); + EXPECT_EQ(ash::SearchResultDisplayType::kChip, result->display_type()); +} + +void ExpectReleaseNotesChip(ChromeSearchResult* result) { + EXPECT_EQ("help-app://updates", result->id()); + EXPECT_EQ("What's new with Chrome OS", base::UTF16ToASCII(result->title())); + EXPECT_EQ(ash::AppListSearchResultType::kHelpApp, result->result_type()); + EXPECT_EQ(ash::SearchResultDisplayType::kChip, result->display_type()); +} +} // namespace + +class HelpAppProviderTest : public AppListTestBase { + public: + HelpAppProviderTest() {} + ~HelpAppProviderTest() override = default; + + void SetUp() override { + AppListTestBase::SetUp(); + + provider_ = std::make_unique<HelpAppProvider>(profile()); + scoped_feature_list_.InitWithFeatures( + /*enabled_features=*/{chromeos::features::kHelpAppDiscoverTab, + chromeos::features::kReleaseNotesSuggestionChip}, + /*disabled_features=*/{}); + } + + HelpAppProvider* provider() { return provider_.get(); } + + private: + std::unique_ptr<HelpAppProvider> provider_; + base::test::ScopedFeatureList scoped_feature_list_; +}; + +// Test for empty query. +TEST_F(HelpAppProviderTest, HasNoResultsForEmptyQueryIfTimesLeftToShowIsZero) { + profile()->GetPrefs()->SetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow, 0); + profile()->GetPrefs()->SetInteger( + prefs::kReleaseNotesSuggestionChipTimesLeftToShow, 0); + + provider()->Start(u""); + + EXPECT_TRUE(provider()->results().empty()); +} + +TEST_F(HelpAppProviderTest, + ReturnsDiscoverTabChipForEmptyQueryIfTimesLeftIsPositive) { + profile()->GetPrefs()->SetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow, 1); + profile()->GetPrefs()->SetInteger( + prefs::kReleaseNotesSuggestionChipTimesLeftToShow, 0); + + provider()->Start(u""); + + EXPECT_EQ(1, provider()->results().size()); + ChromeSearchResult* result = provider()->results().at(0).get(); + ExpectDiscoverTabChip(result); +} + +TEST_F(HelpAppProviderTest, + ReturnsReleaseNotesChipForEmptyQueryIfTimesLeftIsPositive) { + profile()->GetPrefs()->SetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow, 0); + profile()->GetPrefs()->SetInteger( + prefs::kReleaseNotesSuggestionChipTimesLeftToShow, 1); + + provider()->Start(u""); + + EXPECT_EQ(1, provider()->results().size()); + ChromeSearchResult* result = provider()->results().at(0).get(); + ExpectReleaseNotesChip(result); +} + +TEST_F(HelpAppProviderTest, PrioritizesDiscoverTabChipForEmptyQuery) { + profile()->GetPrefs()->SetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow, 1); + profile()->GetPrefs()->SetInteger( + prefs::kReleaseNotesSuggestionChipTimesLeftToShow, 1); + + provider()->Start(u""); + + EXPECT_EQ(1, provider()->results().size()); + ChromeSearchResult* result = provider()->results().at(0).get(); + ExpectDiscoverTabChip(result); +} + +TEST_F(HelpAppProviderTest, + DecrementsTimesLeftToShowDiscoverTabChipUponShowing) { + profile()->GetPrefs()->SetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow, 3); + + provider()->Start(u""); + provider()->AppListShown(); + + EXPECT_EQ(2, profile()->GetPrefs()->GetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow)); +} + +TEST_F(HelpAppProviderTest, + DecrementsTimesLeftToShowReleaseNotesChipUponShowing) { + profile()->GetPrefs()->SetInteger( + prefs::kReleaseNotesSuggestionChipTimesLeftToShow, 3); + + provider()->Start(u""); + provider()->AppListShown(); + + EXPECT_EQ(2, profile()->GetPrefs()->GetInteger( + prefs::kReleaseNotesSuggestionChipTimesLeftToShow)); +} + +TEST_F(HelpAppProviderTest, ClickingDiscoverTabChipStopsItFromShowing) { + profile()->GetPrefs()->SetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow, 3); + + provider()->Start(u""); + + ChromeSearchResult* result = provider()->results().at(0).get(); + result->Open(/*event_flags=*/0); + + EXPECT_EQ(0, profile()->GetPrefs()->GetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow)); +} + +TEST_F(HelpAppProviderTest, ClickingReleaseNotesChipStopsItFromShowing) { + profile()->GetPrefs()->SetInteger( + prefs::kReleaseNotesSuggestionChipTimesLeftToShow, 3); + + provider()->Start(u""); + + ChromeSearchResult* result = provider()->results().at(0).get(); + result->Open(/*event_flags=*/0); + + EXPECT_EQ(0, profile()->GetPrefs()->GetInteger( + prefs::kReleaseNotesSuggestionChipTimesLeftToShow)); +} + +class HelpAppProviderWithDiscoverTabDisabledTest : public HelpAppProviderTest { + public: + HelpAppProviderWithDiscoverTabDisabledTest() {} + ~HelpAppProviderWithDiscoverTabDisabledTest() override = default; + + void SetUp() override { + HelpAppProviderTest::SetUp(); + scoped_feature_list_.InitWithFeatures( + /*enabled_features=*/{chromeos::features::kReleaseNotesSuggestionChip}, + /*disabled_features=*/{chromeos::features::kHelpAppDiscoverTab}); + } + + private: + base::test::ScopedFeatureList scoped_feature_list_; +}; + +TEST_F(HelpAppProviderWithDiscoverTabDisabledTest, + DoesNotReturnDiscoverTabChipForEmptyQuery) { + profile()->GetPrefs()->SetInteger( + prefs::kDiscoverTabSuggestionChipTimesLeftToShow, 1); + profile()->GetPrefs()->SetInteger( + prefs::kReleaseNotesSuggestionChipTimesLeftToShow, 0); + + provider()->Start(u""); + + EXPECT_TRUE(provider()->results().empty()); +} + +} // namespace test +} // namespace app_list
diff --git a/chrome/browser/ui/ash/default_pinned_apps.cc b/chrome/browser/ui/ash/default_pinned_apps.cc index 893f22c..90a01df 100644 --- a/chrome/browser/ui/ash/default_pinned_apps.cc +++ b/chrome/browser/ui/ash/default_pinned_apps.cc
@@ -41,6 +41,8 @@ web_app::kMessagesAppId, + web_app::kGoogleMeetAppId, + arc::kPlayStoreAppId, extension_misc::kYoutubeAppId,
diff --git a/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_browsertest.cc b/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_browsertest.cc index 8018985e..12ca2ac5 100644 --- a/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_browsertest.cc +++ b/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_browsertest.cc
@@ -130,6 +130,7 @@ params.context = ash::Shell::GetPrimaryRootWindow(); views::Widget* widget = new views::Widget(); widget->Init(std::move(params)); + widget->GetNativeWindow()->SetTitle(u"foo"); // Set app id before showing the window to be recognized in // AppServiceAppWindowShelfController. exo::SetShellApplicationId(widget->GetNativeWindow(), window_app_id); @@ -420,9 +421,9 @@ // window appearing and its app being published. app_service_proxy_->FlushMojoCallsForTesting(); - // Now that the app is published, it will have a name based on the app_id + // Now that the app is published, it will have a name based on the window title EXPECT_EQ( - "wmclass.bar", + "foo", base::UTF16ToUTF8(shelf_model() ->items()[shelf_model()->ItemIndexByAppID(app_id)] .title));
diff --git a/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_crostini_tracker.cc b/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_crostini_tracker.cc index 17582ef..5d0a249 100644 --- a/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_crostini_tracker.cc +++ b/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_crostini_tracker.cc
@@ -12,12 +12,12 @@ #include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/ash/crosapi/browser_util.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_force_close_watcher.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_util.h" #include "chrome/browser/ash/profiles/profile_helper.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_force_close_watcher.h" #include "chrome/browser/chromeos/crostini/crostini_shelf_utils.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_shelf_controller.cc b/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_shelf_controller.cc index 156b03a..98f3115 100644 --- a/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_shelf_controller.cc +++ b/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_shelf_controller.cc
@@ -19,8 +19,8 @@ #include "chrome/browser/ash/borealis/borealis_service.h" #include "chrome/browser/ash/borealis/borealis_window_manager.h" #include "chrome/browser/ash/crosapi/browser_util.h" +#include "chrome/browser/ash/crostini/crostini_features.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_util.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" #include "chrome/browser/chromeos/crostini/crostini_shelf_utils.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
diff --git a/chrome/browser/ui/ash/shelf/app_service/app_service_shelf_context_menu.cc b/chrome/browser/ui/ash/shelf/app_service/app_service_shelf_context_menu.cc index 06bb5ed..a7f699a 100644 --- a/chrome/browser/ui/ash/shelf/app_service/app_service_shelf_context_menu.cc +++ b/chrome/browser/ui/ash/shelf/app_service/app_service_shelf_context_menu.cc
@@ -14,12 +14,12 @@ #include "chrome/browser/apps/app_service/menu_util.h" #include "chrome/browser/ash/arc/app_shortcuts/arc_app_shortcuts_menu_builder.h" #include "chrome/browser/ash/crosapi/browser_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_manager.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_manager_factory.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_util.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_shelf_utils.h" #include "chrome/browser/chromeos/crostini/crostini_terminal.h" #include "chrome/browser/chromeos/crostini/crostini_util.h"
diff --git a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc index 7b6ab8a4..d3e9d41 100644 --- a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc +++ b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc
@@ -1292,9 +1292,6 @@ profile_manager()->CreateTestingProfile(account_id.GetUserEmail()); EXPECT_TRUE(profile); - // We don't have Extensions set up in these profiles so migration will wait - // forever for it to start. Disable it to avoid waiting forever. - web_app::TestWebAppProvider::Get(profile)->DisableMigrationManager(); StartWebAppProvider(profile); // Remember the profile name so that we can destroy it upon destruction.
diff --git a/chrome/browser/ui/ash/shelf/shelf_context_menu_unittest.cc b/chrome/browser/ui/ash/shelf/shelf_context_menu_unittest.cc index fe7b67a..daaed586 100644 --- a/chrome/browser/ui/ash/shelf/shelf_context_menu_unittest.cc +++ b/chrome/browser/ui/ash/shelf/shelf_context_menu_unittest.cc
@@ -21,9 +21,9 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/apps/app_service/app_service_test.h" #include "chrome/browser/ash/arc/icon_decode_request.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_shelf_utils.h" #include "chrome/browser/chromeos/crostini/crostini_test_helper.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" @@ -48,6 +48,7 @@ #include "chrome/test/base/chrome_ash_test_base.h" #include "chrome/test/base/testing_profile.h" #include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/seneschal/seneschal_client.h" #include "components/arc/metrics/arc_metrics_constants.h" #include "components/arc/mojom/app.mojom.h" #include "components/arc/test/fake_app_instance.h" @@ -96,6 +97,7 @@ void SetUp() override { chromeos::DBusThreadManager::Initialize(); + chromeos::SeneschalClient::InitializeFake(); ChromeAshTestBase::SetUp(); @@ -193,6 +195,7 @@ ChromeAshTestBase::TearDown(); + chromeos::SeneschalClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); }
diff --git a/chrome/browser/ui/ash/shelf/shelf_controller_helper.cc b/chrome/browser/ui/ash/shelf/shelf_controller_helper.cc index f226d0a..bf79851 100644 --- a/chrome/browser/ui/ash/shelf/shelf_controller_helper.cc +++ b/chrome/browser/ui/ash/shelf/shelf_controller_helper.cc
@@ -12,9 +12,9 @@ #include "chrome/browser/apps/app_service/launch_utils.h" #include "chrome/browser/ash/arc/arc_util.h" #include "chrome/browser/ash/arc/session/arc_session_manager.h" +#include "chrome/browser/ash/crostini/crostini_features.h" #include "chrome/browser/ash/login/demo_mode/demo_session.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" #include "chrome/browser/chromeos/crostini/crostini_shelf_utils.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/extensions/extension_service.h"
diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc index b14570f..9cc964d 100644 --- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc +++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
@@ -1220,7 +1220,7 @@ // Insert text: ダ. This is two, 3-byte UTF-8 characters: // U+FF80 "HALFWIDTH KATAKANA LETTER TA" and // U+FF9E "HALFWIDTH KATAKANA VOICED SOUND MARK". - omnibox_view->SetUserText(base::UTF8ToUTF16("\357\276\200\357\276\236")); + omnibox_view->SetUserText(u"\uFF80\uFF9E"); EXPECT_FALSE(omnibox_view->GetText().empty()); // Move the cursor to the end. @@ -1236,7 +1236,7 @@ EXPECT_TRUE(omnibox_view->GetText().empty()); #else // Toolkit-views text fields delete just the sound mark. - EXPECT_EQ(base::UTF8ToUTF16("\357\276\200"), omnibox_view->GetText()); + EXPECT_EQ(u"\uFF80", omnibox_view->GetText()); #endif }
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc index dc0d71e..c29d1a2 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -149,7 +149,7 @@ #if !BUILDFLAG(IS_CHROMEOS_ASH) const char kAppId[] = "dofnemchnjfeendjmdhaldenaiabpiad"; -const char kAppName[] = "Test App"; +const char16_t kAppName[] = u"Test App"; const char kStartUrl[] = "https://test.com"; // Check that there are two browsers. Find the one that is not |browser|. @@ -1338,12 +1338,10 @@ // Install web app set to open as a tab. { - web_app_finalizer.RemoveLegacyInstallFinalizerForTesting(); - base::RunLoop run_loop; WebApplicationInfo info; info.start_url = GURL(kStartUrl); - info.title = base::UTF8ToUTF16(kAppName); + info.title = kAppName; info.open_as_window = true; web_app_finalizer.FinalizeInstall( info, options, @@ -1447,7 +1445,7 @@ std::unique_ptr<WebApplicationInfo> info = std::make_unique<WebApplicationInfo>(); info->start_url = GURL(kStartUrl); - info->title = base::UTF8ToUTF16(kAppName); + info->title = kAppName; info->open_as_window = true; info->url_handlers = url_handlers; web_app::AppId app_id = @@ -1588,7 +1586,7 @@ std::unique_ptr<WebApplicationInfo> info = std::make_unique<WebApplicationInfo>(); info->start_url = GURL(kStartUrl); - info->title = base::UTF8ToUTF16(kAppName); + info->title = kAppName; info->open_as_window = true; info->protocol_handlers = protocol_handlers; web_app::AppId app_id =
diff --git a/chrome/browser/ui/views/autofill/update_address_profile_view.cc b/chrome/browser/ui/views/autofill/update_address_profile_view.cc index 1db963fa..2a4c9d4 100644 --- a/chrome/browser/ui/views/autofill/update_address_profile_view.cc +++ b/chrome/browser/ui/views/autofill/update_address_profile_view.cc
@@ -20,6 +20,7 @@ #include "ui/views/controls/image_view.h" #include "ui/views/layout/flex_layout.h" #include "ui/views/layout/grid_layout.h" +#include "ui/views/style/typography.h" namespace autofill { @@ -43,23 +44,13 @@ } } -std::unique_ptr<views::ImageView> CreateIconViewForType(ServerFieldType type, - bool for_new_value) { - auto icon_view = std::make_unique<views::ImageView>(); - icon_view->SetImage(ui::ImageModel::FromVectorIcon( - GetVectorIconForType(type), - for_new_value ? ui::NativeTheme::kColorId_ProminentButtonColor - : ui::NativeTheme::kColorId_DefaultIconColor, - kIconSize)); - return icon_view; -} - // Creates a view that displays all values in `diff_map`. `are_new_values` // decides which set of values from `diff_map` are displayed. std::unique_ptr<views::View> CreateValuesView( const base::flat_map<ServerFieldType, std::pair<std::u16string, std::u16string>>& diff_map, - bool are_new_values) { + bool are_new_values, + ui::NativeTheme::ColorId icon_color) { auto view = std::make_unique<views::View>(); view->SetLayoutManager(std::make_unique<views::FlexLayout>()) ->SetOrientation(views::LayoutOrientation::kVertical) @@ -87,15 +78,20 @@ value_row->SetLayoutManager(std::make_unique<views::FlexLayout>()) ->SetOrientation(views::LayoutOrientation::kHorizontal) .SetCrossAxisAlignment(views::LayoutAlignment::kCenter) + .SetIgnoreDefaultMainAxisMargins(true) .SetCollapseMargins(true) .SetDefault( views::kMarginsKey, gfx::Insets( /*vertical=*/0, /*horizontal=*/ChromeLayoutProvider::Get()->GetDistanceMetric( - views::DISTANCE_RELATED_CONTROL_HORIZONTAL))); + views::DISTANCE_RELATED_LABEL_HORIZONTAL))); - value_row->AddChildView(CreateIconViewForType(type, are_new_values)); + auto icon_view = std::make_unique<views::ImageView>(); + icon_view->SetImage(ui::ImageModel::FromVectorIcon( + GetVectorIconForType(type), icon_color, kIconSize)); + + value_row->AddChildView(std::move(icon_view)); value_row->AddChildView( std::make_unique<views::Label>(value, views::style::CONTEXT_LABEL)); } @@ -118,12 +114,16 @@ if (show_row_label) { std::unique_ptr<views::Label> label(new views::Label( are_new_values ? u"New" : u"Old", views::style::CONTEXT_LABEL, - views::style::STYLE_PRIMARY)); + views::style::STYLE_SECONDARY)); layout->AddView(std::move(label), /*col_span=*/1, /*row_span=*/1, /*h_align=*/views::GridLayout::LEADING, /*v_align=*/views::GridLayout::LEADING); } - layout->AddView(CreateValuesView(diff_map, are_new_values), + ui::NativeTheme::ColorId icon_color = + show_row_label && are_new_values + ? ui::NativeTheme::kColorId_ProminentButtonColor + : ui::NativeTheme::kColorId_SecondaryIconColor; + layout->AddView(CreateValuesView(diff_map, are_new_values, icon_color), /*col_span=*/1, /*row_span=*/1, /*h_align=*/views::GridLayout::FILL,
diff --git a/chrome/browser/ui/views/bubble_anchor_util_views.cc b/chrome/browser/ui/views/bubble_anchor_util_views.cc index 111e67b3..0545ce2 100644 --- a/chrome/browser/ui/views/bubble_anchor_util_views.cc +++ b/chrome/browser/ui/views/bubble_anchor_util_views.cc
@@ -50,7 +50,8 @@ AnchorConfiguration GetPermissionPromptBubbleAnchorConfiguration( Browser* browser) { BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); - if (browser_view->GetLocationBarView()->chip()) { + if (base::FeatureList::IsEnabled(permissions::features::kPermissionChip) && + browser_view->GetLocationBarView()->IsDrawn()) { return {browser_view->GetLocationBarView(), browser_view->GetLocationBarView()->chip()->button(), views::BubbleBorder::TOP_LEFT};
diff --git a/chrome/browser/ui/views/crostini/crostini_dialogue_browser_test_util.cc b/chrome/browser/ui/views/crostini/crostini_dialogue_browser_test_util.cc index 3994ece..44a14e9 100644 --- a/chrome/browser/ui/views/crostini/crostini_dialogue_browser_test_util.cc +++ b/chrome/browser/ui/views/crostini/crostini_dialogue_browser_test_util.cc
@@ -8,10 +8,10 @@ #include "base/memory/ptr_util.h" #include "base/path_service.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_browser_main.h" #include "chrome/browser/chrome_browser_main_extra_parts.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/crostini/fake_crostini_features.h" #include "chrome/browser/component_updater/fake_cros_component_manager.h"
diff --git a/chrome/browser/ui/views/crostini/crostini_dialogue_browser_test_util.h b/chrome/browser/ui/views/crostini/crostini_dialogue_browser_test_util.h index 62e91c8..8215326d 100644 --- a/chrome/browser/ui/views/crostini/crostini_dialogue_browser_test_util.h +++ b/chrome/browser/ui/views/crostini/crostini_dialogue_browser_test_util.h
@@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_DIALOGUE_BROWSER_TEST_UTIL_H_ #define CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_DIALOGUE_BROWSER_TEST_UTIL_H_ -#include "chrome/browser/chromeos/crostini/crostini_browser_test_util.h" +#include "chrome/browser/ash/crostini/crostini_browser_test_util.h" #include "chrome/browser/ui/test/test_browser_dialog.h" namespace content {
diff --git a/chrome/browser/ui/views/crostini/crostini_recovery_view.cc b/chrome/browser/ui/views/crostini/crostini_recovery_view.cc index eb6452f..3087b1b8 100644 --- a/chrome/browser/ui/views/crostini/crostini_recovery_view.cc +++ b/chrome/browser/ui/views/crostini/crostini_recovery_view.cc
@@ -6,8 +6,8 @@ #include "base/metrics/histogram_functions.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_terminal.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_dialogs.h"
diff --git a/chrome/browser/ui/views/crostini/crostini_recovery_view_browsertest.cc b/chrome/browser/ui/views/crostini/crostini_recovery_view_browsertest.cc index 1e3637d8..6eb8352b 100644 --- a/chrome/browser/ui/views/crostini/crostini_recovery_view_browsertest.cc +++ b/chrome/browser/ui/views/crostini/crostini_recovery_view_browsertest.cc
@@ -9,9 +9,9 @@ #include "base/metrics/histogram_base.h" #include "base/run_loop.h" #include "base/test/metrics/histogram_tester.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_test_helper.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/ui/views/crostini/crostini_uninstaller_view.cc b/chrome/browser/ui/views/crostini/crostini_uninstaller_view.cc index 4f96b6a..153c9a5 100644 --- a/chrome/browser/ui/views/crostini/crostini_uninstaller_view.cc +++ b/chrome/browser/ui/views/crostini/crostini_uninstaller_view.cc
@@ -7,8 +7,8 @@ #include "base/bind.h" #include "base/metrics/histogram_functions.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/views/chrome_layout_provider.h"
diff --git a/chrome/browser/ui/views/crostini/crostini_uninstaller_view_browsertest.cc b/chrome/browser/ui/views/crostini/crostini_uninstaller_view_browsertest.cc index 3d12078..b747ec2 100644 --- a/chrome/browser/ui/views/crostini/crostini_uninstaller_view_browsertest.cc +++ b/chrome/browser/ui/views/crostini/crostini_uninstaller_view_browsertest.cc
@@ -8,8 +8,8 @@ #include "base/metrics/histogram_base.h" #include "base/run_loop.h" #include "base/test/metrics/histogram_tester.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/app_list_client_impl.h"
diff --git a/chrome/browser/ui/views/crostini/crostini_update_component_view.cc b/chrome/browser/ui/views/crostini/crostini_update_component_view.cc index 5898771..79d922a 100644 --- a/chrome/browser/ui/views/crostini/crostini_update_component_view.cc +++ b/chrome/browser/ui/views/crostini/crostini_update_component_view.cc
@@ -6,8 +6,8 @@ #include "base/metrics/histogram_functions.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/views/chrome_layout_provider.h"
diff --git a/chrome/browser/ui/views/crostini/crostini_update_component_view_browsertest.cc b/chrome/browser/ui/views/crostini/crostini_update_component_view_browsertest.cc index 29c20a8..d33ad85c9 100644 --- a/chrome/browser/ui/views/crostini/crostini_update_component_view_browsertest.cc +++ b/chrome/browser/ui/views/crostini/crostini_update_component_view_browsertest.cc
@@ -9,7 +9,7 @@ #include "base/run_loop.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h"
diff --git a/chrome/browser/ui/views/crostini/crostini_update_filesystem_view.cc b/chrome/browser/ui/views/crostini/crostini_update_filesystem_view.cc index 37c12c9..f564940 100644 --- a/chrome/browser/ui/views/crostini/crostini_update_filesystem_view.cc +++ b/chrome/browser/ui/views/crostini/crostini_update_filesystem_view.cc
@@ -7,8 +7,8 @@ #include "base/bind.h" #include "base/metrics/histogram_functions.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/views/chrome_layout_provider.h"
diff --git a/chrome/browser/ui/views/crostini/crostini_update_filesystem_view_browsertest.cc b/chrome/browser/ui/views/crostini/crostini_update_filesystem_view_browsertest.cc index 85a96b1..a3053f2 100644 --- a/chrome/browser/ui/views/crostini/crostini_update_filesystem_view_browsertest.cc +++ b/chrome/browser/ui/views/crostini/crostini_update_filesystem_view_browsertest.cc
@@ -8,7 +8,7 @@ #include "base/metrics/histogram_base.h" #include "base/run_loop.h" #include "base/test/metrics/histogram_tester.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h"
diff --git a/chrome/browser/ui/views/extensions/extensions_side_panel_controller.cc b/chrome/browser/ui/views/extensions/extensions_side_panel_controller.cc index a782370d..e11895ed 100644 --- a/chrome/browser/ui/views/extensions/extensions_side_panel_controller.cc +++ b/chrome/browser/ui/views/extensions/extensions_side_panel_controller.cc
@@ -6,14 +6,19 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/extensions/api/extension_action/extension_action_api.h" #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/ui/ui_features.h" +#include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/side_panel.h" +#include "chrome/browser/ui/views/toolbar/toolbar_button.h" +#include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "content/public/browser/navigation_details.h" #include "content/public/browser/navigation_entry.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/view_type_utils.h" +#include "extensions/common/api/extension_action/action_info.h" #include "extensions/common/extension_id.h" #include "net/base/url_util.h" #include "ui/base/metadata/metadata_impl_macros.h" @@ -25,18 +30,21 @@ constexpr int kDefaultWidth = 450; const char kPanelActiveKey[] = "active"; -const char kPanelActiveValue[] = "true"; - +const char kPanelActivatableKey[] = "activatable"; const char kPanelWidth[] = "width"; +const char kPanelTrueValue[] = "true"; + } // namespace ExtensionsSidePanelController::ExtensionsSidePanelController( SidePanel* side_panel, - content::BrowserContext* browser_context) - : side_panel_(side_panel), + BrowserView* browser_view) + : extension_id_(features::kExtensionsSidePanelId.Get()), + side_panel_(side_panel), + browser_view_(browser_view), web_view_(side_panel_->AddChildView( - std::make_unique<views::WebView>(browser_context))) { + std::make_unique<views::WebView>(browser_view_->GetProfile()))) { DCHECK(base::FeatureList::IsEnabled(features::kExtensionsSidePanel)); side_panel_->SetVisible(false); @@ -54,18 +62,23 @@ extensions::SetViewType(web_view_->GetWebContents(), extensions::mojom::ViewType::kExtensionPopup); - const extensions::ExtensionId& extension_id = - features::kExtensionsSidePanelId.Get(); - if (const extensions::Extension* extension = - extensions::ExtensionRegistry::Get(browser_context) - ->enabled_extensions() - .GetByID(extension_id)) { + if (const extensions::Extension* extension = GetExtension()) web_view_->LoadInitialURL(extension->GetResourceURL("side_panel.html")); - } } ExtensionsSidePanelController::~ExtensionsSidePanelController() = default; +std::unique_ptr<ToolbarButton> +ExtensionsSidePanelController::CreateToolbarButton() { + auto toolbar_button = std::make_unique<ToolbarButton>(); + // TODO(tluk): Update this to use the icon from the extension. + toolbar_button->SetVectorIcon(kWebIcon); + toolbar_button->SetCallback(base::BindRepeating( + &ExtensionsSidePanelController::SidePanelButtonPressed, + base::Unretained(this))); + return toolbar_button; +} + // The extension host uses URL params to control various properties of the side // panel such as visibility and width. Check for these params and adjust the // side panel accordingly. @@ -79,11 +92,34 @@ // and resource consumption. Remove or fix this after the experiment has // concluded. if (net::GetValueForKeyInQuery(url, kPanelActiveKey, &value)) - side_panel_->SetVisible(value == kPanelActiveValue); + side_panel_->SetVisible(value == kPanelTrueValue); if (net::GetValueForKeyInQuery(url, kPanelWidth, &value)) { unsigned int width = 0; base::StringToUint(value, &width); side_panel_->SetPanelWidth(width); } + + if (net::GetValueForKeyInQuery(url, kPanelActivatableKey, &value)) { + auto* left_side_panel_button = + browser_view_->toolbar()->left_side_panel_button(); + DCHECK(left_side_panel_button); + left_side_panel_button->SetEnabled(value == kPanelTrueValue); + } +} + +const extensions::Extension* ExtensionsSidePanelController::GetExtension() { + return extensions::ExtensionRegistry::Get(browser_view_->GetProfile()) + ->enabled_extensions() + .GetByID(extension_id_); +} + +void ExtensionsSidePanelController::SidePanelButtonPressed() { + const auto* extension = GetExtension(); + extensions::ExtensionAction action( + *extension, extensions::ActionInfo(extensions::ActionInfo::TYPE_BROWSER)); + auto* web_contents = + browser_view_->browser()->tab_strip_model()->GetActiveWebContents(); + extensions::ExtensionActionAPI::Get(browser_view_->GetProfile()) + ->DispatchExtensionActionClicked(action, web_contents, extension); }
diff --git a/chrome/browser/ui/views/extensions/extensions_side_panel_controller.h b/chrome/browser/ui/views/extensions/extensions_side_panel_controller.h index ed87cd1..3341517 100644 --- a/chrome/browser/ui/views/extensions/extensions_side_panel_controller.h +++ b/chrome/browser/ui/views/extensions/extensions_side_panel_controller.h
@@ -5,17 +5,22 @@ #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSIONS_SIDE_PANEL_CONTROLLER_H_ #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSIONS_SIDE_PANEL_CONTROLLER_H_ -#include "content/public/browser/web_contents_observer.h" +#include <memory> -namespace content { -class BrowserContext; -} // namespace content +#include "content/public/browser/web_contents_observer.h" +#include "extensions/common/extension_id.h" + +namespace extensions { +class Extension; +} namespace views { class WebView; } // namespace views +class BrowserView; class SidePanel; +class ToolbarButton; // A class that manages hosting the extension WebContents in the left aligned // side panel of the browser window. @@ -23,18 +28,26 @@ class ExtensionsSidePanelController : public content::WebContentsObserver { public: ExtensionsSidePanelController(SidePanel* side_panel, - content::BrowserContext* browser_context); + BrowserView* browser_view); ExtensionsSidePanelController(const ExtensionsSidePanelController&) = delete; ExtensionsSidePanelController& operator=( const ExtensionsSidePanelController&) = delete; ~ExtensionsSidePanelController() override; + std::unique_ptr<ToolbarButton> CreateToolbarButton(); + private: // content::WebContentsObserver: void NavigationEntryCommitted( const content::LoadCommittedDetails& load_details) override; + const extensions::Extension* GetExtension(); + + void SidePanelButtonPressed(); + + const extensions::ExtensionId extension_id_; SidePanel* side_panel_; + BrowserView* browser_view_; views::WebView* web_view_; };
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 0c51ee6..5641dfa 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -663,13 +663,14 @@ AddChildView(std::make_unique<ContentsSeparator>()); } - if (base::FeatureList::IsEnabled(features::kExtensionsSidePanel)) { + if (browser_->is_type_normal() && + base::FeatureList::IsEnabled(features::kExtensionsSidePanel)) { left_aligned_side_panel_ = AddChildView(std::make_unique<SidePanel>()); left_aligned_side_panel_separator_ = AddChildView(std::make_unique<ContentsSeparator>()); extensions_side_panel_controller_ = std::make_unique<ExtensionsSidePanelController>( - left_aligned_side_panel_, browser_->profile()); + left_aligned_side_panel_, this); } // InfoBarContainer needs to be added as a child here for drop-shadow, but @@ -2348,7 +2349,7 @@ // Tab has a pending permission request. if (toolbar_ && toolbar_->location_bar() && - toolbar_->location_bar()->chip()) { + toolbar_->location_bar()->chip()->GetVisible()) { return l10n_util::GetStringFUTF16( IDS_TAB_AX_LABEL_PERMISSION_REQUESTED_FORMAT, title); } @@ -2776,8 +2777,7 @@ #endif // When permission is requested, permission chip must be first pane in the // pane traversal order to be easily accessible for keyboard users. - if (toolbar_ && toolbar_->location_bar() && - toolbar_->location_bar()->chip()) { + if (toolbar_ && toolbar_->location_bar()) { panes->push_back(toolbar_->location_bar()->chip()); } panes->push_back(toolbar_button_provider_->GetAsAccessiblePaneView());
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index 111cc15..2175c25 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -178,6 +178,10 @@ SidePanel* right_aligned_side_panel() { return right_aligned_side_panel_; } + ExtensionsSidePanelController* extensions_side_panel_controller() { + return extensions_side_panel_controller_.get(); + } + void set_contents_border_widget(views::Widget* contents_border_widget) { GetBrowserViewLayout()->set_contents_border_widget(contents_border_widget); }
diff --git a/chrome/browser/ui/views/frame/immersive_mode_controller_chromeos_browsertest.cc b/chrome/browser/ui/views/frame/immersive_mode_controller_chromeos_browsertest.cc index b4999d7..a64dd44a 100644 --- a/chrome/browser/ui/views/frame/immersive_mode_controller_chromeos_browsertest.cc +++ b/chrome/browser/ui/views/frame/immersive_mode_controller_chromeos_browsertest.cc
@@ -369,7 +369,7 @@ // on the chip to trigger showing the prompt. BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); PermissionChip* chip = browser_view->toolbar()->location_bar()->chip(); - if (chip) { + if (chip->GetVisible()) { views::test::ButtonTestApi(chip->button()) .NotifyClick(ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
diff --git a/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view_unittest.cc b/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view_unittest.cc index e4934a8..c1691fb 100644 --- a/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view_unittest.cc +++ b/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view_unittest.cc
@@ -34,11 +34,12 @@ constexpr char kSinkId[] = "sink_id"; constexpr char kSinkFriendlyName[] = "Nest Hub"; +constexpr char16_t kSinkFriendlyName16[] = u"Nest Hub"; UIMediaSink CreateMediaSink( UIMediaSinkState state = UIMediaSinkState::AVAILABLE) { UIMediaSink sink; - sink.friendly_name = base::UTF8ToUTF16(kSinkFriendlyName); + sink.friendly_name = kSinkFriendlyName16; sink.id = kSinkId; sink.state = state; sink.cast_modes = {media_router::MediaCastMode::PRESENTATION};
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index 4edca684..09ff427 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -192,6 +192,8 @@ const gfx::FontList& font_list = views::style::GetFont( CONTEXT_OMNIBOX_PRIMARY, views::style::STYLE_PRIMARY); + chip_ = AddChildView(std::make_unique<PermissionRequestChip>(browser())); + auto location_icon_view = std::make_unique<LocationIconView>(font_list, this, this); location_icon_view->set_drag_controller(this); @@ -536,7 +538,7 @@ // label/chip. const double kLeadingDecorationMaxFraction = 0.5; - if (chip_ && !ShouldShowKeywordBubble()) { + if (chip_->GetVisible() && !ShouldShowKeywordBubble()) { leading_decorations.AddDecoration(vertical_padding, location_height, false, 0, edge_padding, chip_); } @@ -760,22 +762,6 @@ ->ActivateFirstInactiveBubbleForAccessibility(); } -PermissionChip* LocationBarView::DisplayChip( - permissions::PermissionPrompt::Delegate* delegate) { - DCHECK(!chip_); - DCHECK(delegate); - // `chip_` must come first so it's in the correct place in the focus order. - chip_ = AddChildViewAt( - std::make_unique<PermissionRequestChip>(browser(), delegate), 0); - return chip_; -} - -void LocationBarView::FinalizeChip() { - DCHECK(chip_); - RemoveChildViewT(chip_); - chip_ = nullptr; -} - void LocationBarView::UpdateWithoutTabRestore() { Update(nullptr); } @@ -1193,11 +1179,6 @@ AnimationProgressed(animation); } -void LocationBarView::OnChildViewRemoved(View* observed_view, View* child) { - views::AnimationDelegateViews::OnChildViewRemoved(observed_view, child); - PreferredSizeChanged(); -} - void LocationBarView::OnChanged() { location_icon_view_->Update(/*suppress_animations=*/false); clear_all_button_->SetVisible( @@ -1344,14 +1325,15 @@ } void LocationBarView::UpdateChipVisibility() { - if (!chip_) { + if (!chip()->GetActiveRequest()) { + DCHECK(!chip()->GetVisible()); return; } if (IsEditingOrEmpty()) { - chip_->Hide(); + chip()->Hide(); } else { - chip_->Reshow(); + chip()->Reshow(); } }
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h index f460e9b..6be252e 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chrome/browser/ui/views/location_bar/location_bar_view.h
@@ -177,13 +177,6 @@ PermissionChip* chip() { return chip_; } - // Creates and displays an instance of PermissionRequestChip. - PermissionChip* DisplayChip( - permissions::PermissionPrompt::Delegate* delegate); - - // Removes previously displayed PermissionChip. - void FinalizeChip(); - // LocationBar: void FocusLocation(bool is_user_initiated) override; void Revert() override; @@ -357,7 +350,6 @@ void AnimationProgressed(const gfx::Animation* animation) override; void AnimationEnded(const gfx::Animation* animation) override; void AnimationCanceled(const gfx::Animation* animation) override; - void OnChildViewRemoved(View* observed_view, View* child) override; // ChromeOmniboxEditController: void OnChanged() override;
diff --git a/chrome/browser/ui/views/location_bar/omnibox_chip_button.cc b/chrome/browser/ui/views/location_bar/omnibox_chip_button.cc index 6d59cbf..3d347f15 100644 --- a/chrome/browser/ui/views/location_bar/omnibox_chip_button.cc +++ b/chrome/browser/ui/views/location_bar/omnibox_chip_button.cc
@@ -15,16 +15,9 @@ #include "ui/views/controls/highlight_path_generator.h" OmniboxChipButton::OmniboxChipButton(PressedCallback callback, - const gfx::VectorIcon& icon, - std::u16string message, - bool is_prominent) - : MdTextButton(std::move(callback), - std::u16string(), - views::style::CONTEXT_BUTTON_MD), - icon_(icon) { + int button_context) + : MdTextButton(std::move(callback), std::u16string(), button_context) { views::InstallPillHighlightPathGenerator(this); - SetProminent(is_prominent); - SetText(message); SetCornerRadius(GetIconSize()); SetHorizontalAlignment(gfx::ALIGN_LEFT); SetElideBehavior(gfx::ElideBehavior::FADE_TAIL); @@ -39,8 +32,6 @@ constexpr auto kAnimationDuration = base::TimeDelta::FromMilliseconds(350); animation_ = std::make_unique<gfx::SlideAnimation>(this); animation_->SetSlideDuration(kAnimationDuration); - - UpdateColors(); } OmniboxChipButton::~OmniboxChipButton() = default; @@ -61,6 +52,11 @@ animation_->Reset(value); } +void OmniboxChipButton::SetIcon(const gfx::VectorIcon* icon) { + icon_ = icon; + UpdateColors(); +} + void OmniboxChipButton::SetExpandAnimationEndedCallback( base::RepeatingCallback<void()> callback) { expand_animation_ended_callback_ = callback; @@ -78,7 +74,7 @@ } void OmniboxChipButton::OnThemeChanged() { - MdTextButton::OnThemeChanged(); + View::OnThemeChanged(); UpdateColors(); } @@ -101,14 +97,22 @@ UpdateColors(); } +void OmniboxChipButton::SetProminent(bool is_prominent) { + views::MdTextButton::SetProminent(is_prominent); + UpdateColors(); +} + int OmniboxChipButton::GetIconSize() const { return GetLayoutConstant(LOCATION_BAR_ICON_SIZE); } void OmniboxChipButton::UpdateColors() { + if (!icon_) + return; + SetEnabledTextColors(GetForegroundColor()); SetImageModel(views::Button::STATE_NORMAL, - ui::ImageModel::FromVectorIcon(icon_, GetForegroundColor(), + ui::ImageModel::FromVectorIcon(*icon_, GetForegroundColor(), GetIconSize())); SetBgColorOverride(GetBackgroundColor()); }
diff --git a/chrome/browser/ui/views/location_bar/omnibox_chip_button.h b/chrome/browser/ui/views/location_bar/omnibox_chip_button.h index 1b37b8e8..3c5a1bb 100644 --- a/chrome/browser/ui/views/location_bar/omnibox_chip_button.h +++ b/chrome/browser/ui/views/location_bar/omnibox_chip_button.h
@@ -14,10 +14,9 @@ class OmniboxChipButton : public views::MdTextButton { public: METADATA_HEADER(OmniboxChipButton); - explicit OmniboxChipButton(PressedCallback callback, - const gfx::VectorIcon& icon, - std::u16string message, - bool is_prominent); + explicit OmniboxChipButton( + PressedCallback callback, + int button_context = views::style::CONTEXT_BUTTON_MD); OmniboxChipButton(const OmniboxChipButton& button) = delete; OmniboxChipButton& operator=(const OmniboxChipButton& button) = delete; ~OmniboxChipButton() override; @@ -32,8 +31,11 @@ void AnimateCollapse(); void AnimateExpand(); void ResetAnimation(double value = 0); + + void SetIcon(const gfx::VectorIcon* icon); void SetExpandAnimationEndedCallback( base::RepeatingCallback<void()> callback); + bool is_fully_collapsed() const { return fully_collapsed_; } bool is_animating() const { return animation_->is_animating(); } @@ -47,6 +49,11 @@ // Set the button theme. void SetTheme(Theme theme); + + // Set whether the button uses prominent styling, equivalent to + // MdTextButton::SetProminent. + void SetProminent(bool is_prominent); + void SetForceExpandedForTesting(bool force_expanded_for_testing); private: @@ -80,7 +87,7 @@ // without text. bool fully_collapsed_ = false; - const gfx::VectorIcon& icon_; + const gfx::VectorIcon* icon_ = nullptr; base::RepeatingCallback<void()> expand_animation_ended_callback_;
diff --git a/chrome/browser/ui/views/location_bar/permission_chip.cc b/chrome/browser/ui/views/location_bar/permission_chip.cc index 0ebd7a4..37550a54 100644 --- a/chrome/browser/ui/views/location_bar/permission_chip.cc +++ b/chrome/browser/ui/views/location_bar/permission_chip.cc
@@ -10,6 +10,7 @@ #include "base/time/time.h" #include "chrome/browser/ui/views/permission_bubble/permission_prompt_style.h" #include "chrome/grit/generated_resources.h" +#include "components/permissions/features.h" #include "components/permissions/permission_request.h" #include "components/permissions/request_type.h" #include "components/strings/grit/components_strings.h" @@ -21,6 +22,13 @@ #include "ui/views/controls/button/button_controller.h" #include "ui/views/widget/widget.h" +namespace { +bool IsCameraOrMicPermission(permissions::RequestType type) { + return type == permissions::RequestType::kCameraStream || + type == permissions::RequestType::kMicStream; +} +} // namespace + // ButtonController that NotifyClick from being called when the // BubbleOwnerDelegate's bubble is showing. Otherwise the bubble will show again // immediately after being closed via losing focus. @@ -52,19 +60,13 @@ BubbleOwnerDelegate* bubble_owner_ = nullptr; }; -PermissionChip::PermissionChip( - permissions::PermissionPrompt::Delegate* delegate, - const gfx::VectorIcon& icon, - std::u16string message, - bool should_start_open) - : delegate_(delegate), should_start_open_(should_start_open) { - DCHECK(delegate); +PermissionChip::PermissionChip() { SetUseDefaultFillLayout(true); + SetVisible(false); - chip_button_ = AddChildView(std::make_unique<OmniboxChipButton>( - base::BindRepeating(&PermissionChip::ChipButtonPressed, - base::Unretained(this)), - icon, message, true)); + chip_button_ = + AddChildView(std::make_unique<OmniboxChipButton>(base::BindRepeating( + &PermissionChip::ChipButtonPressed, base::Unretained(this)))); chip_button_->SetButtonController(std::make_unique<BubbleButtonController>( chip_button_, this, @@ -75,14 +77,48 @@ &PermissionChip::ExpandAnimationEnded, base::Unretained(this))); chip_button_->SetTheme(OmniboxChipButton::Theme::kBlue); - - Show(should_start_open_); + chip_button_->SetProminent(true); } PermissionChip::~PermissionChip() { CHECK(!IsInObserverList()); +} + +void PermissionChip::DisplayRequest( + permissions::PermissionPrompt::Delegate* delegate) { + DCHECK(delegate); + delegate_ = delegate; + + const std::vector<permissions::PermissionRequest*>& requests = + delegate_->Requests(); + + // TODO(olesiamarukhno): Add combined camera & microphone permission and + // update delegate to contain only one request at a time. + DCHECK(requests.size() == 1u || requests.size() == 2u); + if (requests.size() == 2) { + DCHECK(IsCameraOrMicPermission(requests[0]->GetRequestType())); + DCHECK(IsCameraOrMicPermission(requests[1]->GetRequestType())); + DCHECK_NE(requests[0]->GetRequestType(), requests[1]->GetRequestType()); + } + + chip_button_->SetText(GetPermissionMessage()); + chip_button_->SetIcon(&GetPermissionIconId()); + + Show(ShouldBubbleStartOpen()); + + if (!ShouldBubbleStartOpen()) { + GetViewAccessibility().AnnounceText(l10n_util::GetStringUTF16( + IDS_PERMISSIONS_REQUESTED_SCREENREADER_ANNOUNCEMENT)); + } +} + +void PermissionChip::FinalizeRequest() { + SetVisible(false); + chip_button_->ResetAnimation(); collapse_timer_.AbandonAndStop(); dismiss_timer_.AbandonAndStop(); + delegate_ = nullptr; + PreferredSizeChanged(); } void PermissionChip::Hide() { @@ -92,36 +128,62 @@ void PermissionChip::Reshow() { if (GetVisible()) return; - SetVisible(true); Show(/*always_open_bubble=*/false); } +bool PermissionChip::GetActiveRequest() const { + return !!delegate_; +} + void PermissionChip::OnMouseEntered(const ui::MouseEvent& event) { if (!chip_button_->is_animating()) RestartTimersOnInteraction(); } -void PermissionChip::AddedToWidget() { - views::AccessiblePaneView::AddedToWidget(); - - if (!should_start_open_) { - GetViewAccessibility().AnnounceText(l10n_util::GetStringUTF16( - IDS_PERMISSIONS_REQUESTED_SCREENREADER_ANNOUNCEMENT)); - } -} - -void PermissionChip::OnWidgetClosing(views::Widget* widget) { +void PermissionChip::OnWidgetDestroying(views::Widget* widget) { widget->RemoveObserver(this); // If permission request is still active after the prompt was closed, // collapse the chip. - Collapse(/*allow_restart=*/false); + if (delegate_) + Collapse(/*allow_restart=*/false); } bool PermissionChip::IsBubbleShowing() const { return false; } +bool PermissionChip::ShouldBubbleStartOpen() const { + if (base::FeatureList::IsEnabled( + permissions::features::kPermissionChipGestureSensitive)) { + auto requests = delegate_->Requests(); + const bool has_gesture = + std::any_of(requests.begin(), requests.end(), [](auto* request) { + return request->GetGestureType() == + permissions::PermissionRequestGestureType::GESTURE; + }); + if (has_gesture) + return true; + } + if (base::FeatureList::IsEnabled( + permissions::features::kPermissionChipRequestTypeSensitive)) { + // Notifications and geolocation are targeted here because they are usually + // not necessary for the website to function correctly, so they can safely + // be given less prominence. + auto requests = delegate_->Requests(); + const bool is_geolocation_or_notifications = + std::any_of(requests.begin(), requests.end(), [](auto* request) { + auto request_type = request->GetRequestType(); + return request_type == permissions::RequestType::kNotifications || + request_type == permissions::RequestType::kGeolocation; + }); + if (!is_geolocation_or_notifications) + return true; + } + return false; +} + void PermissionChip::Show(bool always_open_bubble) { + SetVisible(true); // TODO(olesiamarukhno): Add tests for animation logic. chip_button_->ResetAnimation(); if (!delegate_->WasCurrentRequestAlreadyDisplayed() || always_open_bubble) { @@ -134,7 +196,7 @@ void PermissionChip::ExpandAnimationEnded() { StartCollapseTimer(); - if (should_start_open_) + if (ShouldBubbleStartOpen()) OpenBubble(); } @@ -176,13 +238,14 @@ } void PermissionChip::Dismiss() { + if (delegate_) { + delegate_->Closing(); + } GetViewAccessibility().AnnounceText(l10n_util::GetStringUTF16( IDS_PERMISSIONS_EXPIRED_SCREENREADER_ANNOUNCEMENT)); - - // `delegate_->Closing()` will destroy `this`. It's not safe to run any code - // afterwards. - delegate_->Closing(); } BEGIN_METADATA(PermissionChip, views::View) +ADD_READONLY_PROPERTY_METADATA(bool, ActiveRequest) +ADD_READONLY_PROPERTY_METADATA(std::u16string, PermissionMessage) END_METADATA
diff --git a/chrome/browser/ui/views/location_bar/permission_chip.h b/chrome/browser/ui/views/location_bar/permission_chip.h index 1b9532e8..bfdb34b 100644 --- a/chrome/browser/ui/views/location_bar/permission_chip.h +++ b/chrome/browser/ui/views/location_bar/permission_chip.h
@@ -30,29 +30,33 @@ public BubbleOwnerDelegate { public: METADATA_HEADER(PermissionChip); - PermissionChip(permissions::PermissionPrompt::Delegate* delegate, - const gfx::VectorIcon& icon, - std::u16string message, - bool should_start_open); + PermissionChip(); PermissionChip(const PermissionChip& chip) = delete; PermissionChip& operator=(const PermissionChip& chip) = delete; ~PermissionChip() override; + // Displays a request as a chip. + virtual void DisplayRequest( + permissions::PermissionPrompt::Delegate* delegate); + + // Stops displaying the current request. + virtual void FinalizeRequest(); + // Opens the permission prompt bubble. virtual void OpenBubble() = 0; void Hide(); void Reshow(); + bool GetActiveRequest() const; views::Button* button() { return chip_button_; } bool is_fully_collapsed() const { return chip_button_->is_fully_collapsed(); } // views::View: void OnMouseEntered(const ui::MouseEvent& event) override; - void AddedToWidget() override; // views::WidgetObserver: - void OnWidgetClosing(views::Widget* widget) override; + void OnWidgetDestroying(views::Widget* widget) override; // BubbleOwnerDelegate: bool IsBubbleShowing() const override; @@ -66,6 +70,14 @@ } private: + // Returns the chip's label. + virtual std::u16string GetPermissionMessage() const = 0; + + // Returns the chip's icon. + virtual const gfx::VectorIcon& GetPermissionIconId() const = 0; + + virtual bool ShouldBubbleStartOpen() const; + void Show(bool always_open_bubble); void ExpandAnimationEnded(); void ChipButtonPressed(); @@ -74,10 +86,11 @@ void Collapse(bool allow_restart); void StartDismissTimer(); void Dismiss(); + void AnimateCollapse(); void AnimateExpand(); - permissions::PermissionPrompt::Delegate* const delegate_; + permissions::PermissionPrompt::Delegate* delegate_ = nullptr; // A timer used to collapse the chip after a delay. base::OneShotTimer collapse_timer_; @@ -88,8 +101,6 @@ // The button that displays the icon and text. OmniboxChipButton* chip_button_ = nullptr; - - bool should_start_open_ = false; }; #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PERMISSION_CHIP_H_
diff --git a/chrome/browser/ui/views/location_bar/permission_request_chip.cc b/chrome/browser/ui/views/location_bar/permission_request_chip.cc index 8da0740..f096e814d 100644 --- a/chrome/browser/ui/views/location_bar/permission_request_chip.cc +++ b/chrome/browser/ui/views/location_bar/permission_request_chip.cc
@@ -11,7 +11,6 @@ #include "chrome/browser/ui/views/permission_bubble/permission_prompt_bubble_view.h" #include "chrome/browser/ui/views/permission_bubble/permission_prompt_style.h" #include "chrome/grit/generated_resources.h" -#include "components/permissions/features.h" #include "components/permissions/permission_request.h" #include "components/permissions/request_type.h" #include "components/strings/grit/components_strings.h" @@ -28,104 +27,29 @@ bool IsCameraPermission(permissions::RequestType type) { return type == permissions::RequestType::kCameraStream; } - -bool IsCameraOrMicPermission(permissions::RequestType type) { - return type == permissions::RequestType::kCameraStream || - type == permissions::RequestType::kMicStream; -} - -const gfx::VectorIcon& GetPermissionIconId( - permissions::PermissionPrompt::Delegate* delegate) { - DCHECK(delegate); - auto requests = delegate->Requests(); - if (requests.size() == 1) - return permissions::GetIconId(requests[0]->GetRequestType()); - - // When we have two requests, it must be microphone & camera. Then we need to - // use the icon from the camera request. - return IsCameraPermission(requests[0]->GetRequestType()) - ? permissions::GetIconId(requests[0]->GetRequestType()) - : permissions::GetIconId(requests[1]->GetRequestType()); -} - -std::u16string GetPermissionMessage( - permissions::PermissionPrompt::Delegate* delegate) { - DCHECK(delegate); - - auto requests = delegate->Requests(); - - return requests.size() == 1 - ? requests[0]->GetChipText().value() - : l10n_util::GetStringUTF16( - IDS_MEDIA_CAPTURE_VIDEO_AND_AUDIO_PERMISSION_CHIP); -} - -void VerifyCameraAndMicRequest( - permissions::PermissionPrompt::Delegate* delegate) { - DCHECK(delegate); - - const std::vector<permissions::PermissionRequest*>& requests = - delegate->Requests(); - - // TODO(olesiamarukhno): Add combined camera & microphone permission and - // update delegate to contain only one request at a time. - DCHECK(requests.size() == 1u || requests.size() == 2u); - if (requests.size() == 2) { - DCHECK(IsCameraOrMicPermission(requests[0]->GetRequestType())); - DCHECK(IsCameraOrMicPermission(requests[1]->GetRequestType())); - DCHECK_NE(requests[0]->GetRequestType(), requests[1]->GetRequestType()); - } -} - -bool ShouldBubbleStartOpen(permissions::PermissionPrompt::Delegate* delegate) { - if (base::FeatureList::IsEnabled( - permissions::features::kPermissionChipGestureSensitive)) { - auto requests = delegate->Requests(); - const bool has_gesture = - std::any_of(requests.begin(), requests.end(), [](auto* request) { - return request->GetGestureType() == - permissions::PermissionRequestGestureType::GESTURE; - }); - if (has_gesture) - return true; - } - if (base::FeatureList::IsEnabled( - permissions::features::kPermissionChipRequestTypeSensitive)) { - // Notifications and geolocation are targeted here because they are usually - // not necessary for the website to function correctly, so they can safely - // be given less prominence. - auto requests = delegate->Requests(); - const bool is_geolocation_or_notifications = - std::any_of(requests.begin(), requests.end(), [](auto* request) { - auto request_type = request->GetRequestType(); - return request_type == permissions::RequestType::kNotifications || - request_type == permissions::RequestType::kGeolocation; - }); - if (!is_geolocation_or_notifications) - return true; - } - return false; -} - } // namespace -PermissionRequestChip::PermissionRequestChip( - Browser* browser, - permissions::PermissionPrompt::Delegate* delegate) - : PermissionChip(delegate, - GetPermissionIconId(delegate), - GetPermissionMessage(delegate), - ShouldBubbleStartOpen(delegate)), - browser_(browser) { - chip_shown_time_ = base::TimeTicks::Now(); - VerifyCameraAndMicRequest(delegate); -} +PermissionRequestChip::PermissionRequestChip(Browser* browser) + : browser_(browser) {} PermissionRequestChip::~PermissionRequestChip() { if (prompt_bubble_) prompt_bubble_->GetWidget()->Close(); } +void PermissionRequestChip::DisplayRequest( + permissions::PermissionPrompt::Delegate* delegate) { + chip_shown_time_ = base::TimeTicks::Now(); + PermissionChip::DisplayRequest(delegate); +} + +void PermissionRequestChip::FinalizeRequest() { + PermissionChip::FinalizeRequest(); + already_recorded_interaction_ = false; + if (prompt_bubble_) + prompt_bubble_->GetWidget()->Close(); +} + void PermissionRequestChip::OpenBubble() { // The prompt bubble is either not opened yet or already closed on // deactivation. @@ -140,24 +64,50 @@ RecordChipButtonPressed(); } +void PermissionRequestChip::OnWidgetDestroying(views::Widget* widget) { + DCHECK_EQ(widget, prompt_bubble_->GetWidget()); + PermissionChip::OnWidgetDestroying(widget); + prompt_bubble_ = nullptr; +} + views::BubbleDialogDelegateView* PermissionRequestChip::GetPermissionPromptBubbleForTest() { return prompt_bubble_; } -void PermissionRequestChip::OnWidgetClosing(views::Widget* widget) { - DCHECK_EQ(widget, prompt_bubble_->GetWidget()); - PermissionChip::OnWidgetClosing(widget); - prompt_bubble_ = nullptr; -} - bool PermissionRequestChip::IsBubbleShowing() const { return prompt_bubble_; } +const gfx::VectorIcon& PermissionRequestChip::GetPermissionIconId() const { + auto requests = delegate()->Requests(); + if (requests.size() == 1) + return permissions::GetIconId(requests[0]->GetRequestType()); + + // When we have two requests, it must be microphone & camera. Then we need to + // use the icon from the camera request. + return IsCameraPermission(requests[0]->GetRequestType()) + ? permissions::GetIconId(requests[0]->GetRequestType()) + : permissions::GetIconId(requests[1]->GetRequestType()); +} + +std::u16string PermissionRequestChip::GetPermissionMessage() const { + if (!delegate()) + return std::u16string(); + auto requests = delegate()->Requests(); + + return requests.size() == 1 + ? requests[0]->GetChipText().value() + : l10n_util::GetStringUTF16( + IDS_MEDIA_CAPTURE_VIDEO_AND_AUDIO_PERMISSION_CHIP); +} + void PermissionRequestChip::RecordChipButtonPressed() { + if (!already_recorded_interaction_) { base::UmaHistogramLongTimes("Permissions.Chip.TimeToInteraction", base::TimeTicks::Now() - chip_shown_time_); + already_recorded_interaction_ = true; + } } BEGIN_METADATA(PermissionRequestChip, views::View)
diff --git a/chrome/browser/ui/views/location_bar/permission_request_chip.h b/chrome/browser/ui/views/location_bar/permission_request_chip.h index bcbce6d..5280780 100644 --- a/chrome/browser/ui/views/location_bar/permission_request_chip.h +++ b/chrome/browser/ui/views/location_bar/permission_request_chip.h
@@ -14,26 +14,42 @@ class PermissionRequestChip : public PermissionChip { public: METADATA_HEADER(PermissionRequestChip); - explicit PermissionRequestChip( - Browser* browser, - permissions::PermissionPrompt::Delegate* delegate); + explicit PermissionRequestChip(Browser* browser); PermissionRequestChip(const PermissionRequestChip& chip) = delete; PermissionRequestChip& operator=(const PermissionRequestChip& chip) = delete; ~PermissionRequestChip() override; // PermissionChip: + void DisplayRequest( + permissions::PermissionPrompt::Delegate* delegate) override; + + // PermissionChip: + void FinalizeRequest() override; + + // PermissionChip: void OpenBubble() override; - views::BubbleDialogDelegateView* GetPermissionPromptBubbleForTest() override; // views::WidgetObserver: - void OnWidgetClosing(views::Widget* widget) override; + void OnWidgetDestroying(views::Widget* widget) override; + + // PermissionChip: + views::BubbleDialogDelegateView* GetPermissionPromptBubbleForTest() override; // BubbleOwnerDelegate: bool IsBubbleShowing() const override; private: + // PermissionChip: + const gfx::VectorIcon& GetPermissionIconId() const override; + + // PermissionChip: + std::u16string GetPermissionMessage() const override; + void RecordChipButtonPressed(); + // If uma metric was already recorded on the button click. + bool already_recorded_interaction_ = false; + Browser* browser_ = nullptr; // The time when the chip was displayed.
diff --git a/chrome/browser/ui/views/permission_bubble/permission_prompt_bubble_view_browsertest.cc b/chrome/browser/ui/views/permission_bubble/permission_prompt_bubble_view_browsertest.cc index 893ab2c..05501f81 100644 --- a/chrome/browser/ui/views/permission_bubble/permission_prompt_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/permission_bubble/permission_prompt_bubble_view_browsertest.cc
@@ -73,7 +73,7 @@ base::RunLoop().RunUntilIdle(); PermissionChip* chip = GetPermissionRequestChipView(); - if (chip) { + if (chip->GetVisible()) { views::test::ButtonTestApi(chip->button()) .NotifyClick(ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), @@ -83,7 +83,8 @@ } bool VerifyUi() override { - const bool should_close_on_deactivate = GetPermissionRequestChipView(); + const bool should_close_on_deactivate = + GetPermissionRequestChipView()->GetVisible(); views::Widget* prompt_widget = test_api_->GetPromptWindow(); views::BubbleDialogDelegate* bubble_dialog = prompt_widget->widget_delegate()->AsBubbleDialogDelegate(); @@ -197,11 +198,10 @@ PermissionChip* chip = GetPermissionRequestChipView(); // If chip UI is used, two notifications will be announced: one that // permission was requested and second when bubble is opened. - if (chip) { + if (chip->GetVisible()) EXPECT_EQ(2, counter.GetCount(ax::mojom::Event::kAlert)); - } else { + else EXPECT_EQ(1, counter.GetCount(ax::mojom::Event::kAlert)); - } #else EXPECT_EQ(1, counter.GetCount(ax::mojom::Event::kAlert)); #endif
diff --git a/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc b/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc index 3865080..b4d9cf7b 100644 --- a/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc +++ b/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc
@@ -72,7 +72,8 @@ case PermissionPromptStyle::kChip: DCHECK(!prompt_bubble_); DCHECK(chip_); - FinalizeChip(); + chip_->FinalizeRequest(); + chip_ = nullptr; break; case PermissionPromptStyle::kQuiet: DCHECK(!prompt_bubble_); @@ -124,14 +125,15 @@ break; case PermissionPromptStyle::kChip: DCHECK(!prompt_bubble_); - - if (!lbv->chip()) { - chip_ = lbv->DisplayChip(delegate_); - } + DCHECK(chip_); + chip_ = lbv->chip(); + if (!chip_->GetActiveRequest()) + chip_->DisplayRequest(delegate_); // If there is fresh pending request shown as chip UI and location bar // isn't visible anymore, show bubble UI instead. if (!chip_->is_fully_collapsed() && !is_location_bar_drawn) { - FinalizeChip(); + chip_->FinalizeRequest(); + chip_ = nullptr; ShowBubble(); } break; @@ -149,7 +151,8 @@ LocationBarView* lbv = GetLocationBarView(); DCHECK(lbv); - chip_ = lbv->DisplayChip(delegate_); + chip_ = lbv->chip(); + chip_->DisplayRequest(delegate_); prompt_style_ = PermissionPromptStyle::kChip; } @@ -171,11 +174,6 @@ }); } -void PermissionPromptImpl::FinalizeChip() { - GetLocationBarView()->FinalizeChip(); - chip_ = nullptr; -} - permissions::PermissionPrompt::TabSwitchingBehavior PermissionPromptImpl::GetTabSwitchingBehavior() { return permissions::PermissionPrompt::TabSwitchingBehavior::
diff --git a/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.h b/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.h index a7e8586..eb4ef04 100644 --- a/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.h +++ b/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.h
@@ -50,10 +50,12 @@ private: LocationBarView* GetLocationBarView(); + void ShowBubble(); + void ShowChipUI(); + bool ShouldCurrentRequestUseChipUI(); - void FinalizeChip(); // The popup bubble. Not owned by this class; it will delete itself when a // decision is made.
diff --git a/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc index 55d4261b..8ae7a001 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc +++ b/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc
@@ -75,8 +75,8 @@ enum class ForceEphemeralProfilesPolicy { kUnset, kEnabled, kDisabled }; const SkColor kProfileColor = SK_ColorRED; -const char kWork[] = "Work"; -const char kOriginalProfileName[] = "OriginalProfile"; +const char16_t kWork[] = u"Work"; +const char16_t kOriginalProfileName[] = u"OriginalProfile"; AccountInfo FillAccountInfo( const CoreAccountInfo& core_info, @@ -654,7 +654,7 @@ ASSERT_NE(entry, nullptr); EXPECT_FALSE(entry->IsEphemeral()); EXPECT_FALSE(entry->IsAuthenticated()); - EXPECT_EQ(entry->GetLocalProfileName(), base::UTF8ToUTF16(kWork)); + EXPECT_EQ(entry->GetLocalProfileName(), kWork); // The color is not applied if the user enters the SAML flow. EXPECT_FALSE(ThemeServiceFactory::GetForProfile(profile_being_created) ->UsingAutogeneratedTheme()); @@ -1444,11 +1444,11 @@ } // Checks if a profile matching `name` exists in the profile manager. - bool ProfileWithNameExists(const std::string& name) { + bool ProfileWithNameExists(const std::u16string& name) { for (const auto* entry : profile_manager() ->GetProfileAttributesStorage() .GetAllProfilesAttributes()) { - if (entry->GetLocalProfileName() == base::UTF8ToUTF16(name)) + if (entry->GetLocalProfileName() == name) return true; } return false; @@ -1491,7 +1491,7 @@ ->GetProfileAttributesStorage() .GetProfileAttributesWithPath(browser()->profile()->GetPath()); ASSERT_NE(entry, nullptr); - entry->SetLocalProfileName(base::UTF8ToUTF16(kOriginalProfileName), + entry->SetLocalProfileName(kOriginalProfileName, entry->IsUsingDefaultName()); } CheckPolicyApplied(browser()->profile()); @@ -1549,14 +1549,14 @@ // If the policy is set, all profiles should have been deleted. EXPECT_EQ(1u, profile_manager()->GetNumberOfProfiles()); // The current profile is not the one that was created in the previous run. - EXPECT_FALSE(ProfileWithNameExists("Joe")); + EXPECT_FALSE(ProfileWithNameExists(u"Joe")); EXPECT_FALSE(OriginalProfileExists()); return; } // If the policy is disabled or unset, the two profiles are still here. EXPECT_EQ(2u, profile_manager()->GetNumberOfProfiles()); - EXPECT_TRUE(ProfileWithNameExists("Joe")); + EXPECT_TRUE(ProfileWithNameExists(u"Joe")); EXPECT_TRUE(OriginalProfileExists()); }
diff --git a/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view.cc b/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view.cc index ec6ae0b..f965eaca 100644 --- a/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view.cc +++ b/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view.cc
@@ -10,6 +10,8 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/flag_descriptions.h" #include "chrome/browser/lifetime/application_lifetime.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/webui/flags/flags_ui.h" #include "chrome/common/channel_info.h" #include "chrome/grit/generated_resources.h" @@ -28,6 +30,17 @@ #include "ui/views/layout/flex_layout_types.h" #include "ui/views/layout/layout_provider.h" +#if BUILDFLAG(IS_CHROMEOS_ASH) +#include "chrome/browser/ash/login/session/user_session_manager.h" +#include "chrome/browser/ash/ownership/owner_settings_service_ash.h" +#include "chrome/browser/ash/ownership/owner_settings_service_ash_factory.h" +#include "chrome/browser/ash/settings/owner_flags_storage.h" +#include "chromeos/cryptohome/cryptohome_parameters.h" +#include "chromeos/dbus/session_manager/session_manager_client.h" +#include "components/account_id/account_id.h" +#include "components/user_manager/user.h" +#endif + namespace { // These values are persisted to logs. Entries should not be renumbered and @@ -78,7 +91,7 @@ class ChromeLabsFooter : public views::View { public: METADATA_HEADER(ChromeLabsFooter); - ChromeLabsFooter() { + explicit ChromeLabsFooter(ChromeLabsBubbleView* bubble) { SetLayoutManager(std::make_unique<views::FlexLayout>()) ->SetOrientation(views::LayoutOrientation::kVertical) .SetCrossAxisAlignment(views::LayoutAlignment::kStart); @@ -101,7 +114,11 @@ .Build()); AddChildView(views::Builder<views::MdTextButton>() .CopyAddressTo(&restart_button_) - .SetCallback(base::BindRepeating(&chrome::AttemptRestart)) + .SetCallback(base::BindRepeating( + [](ChromeLabsBubbleView* bubble_view) { + bubble_view->RestartToApplyFlags(); + }, + bubble)) .SetText(l10n_util::GetStringUTF16( IDS_CHROMELABS_RELAUNCH_BUTTON_LABEL)) .SetProminent(true) @@ -115,6 +132,7 @@ views::FlexSpecification(views::MinimumFlexSizeRule::kScaleToZero, views::MaximumFlexSizeRule::kPreferred, true)); } + private: views::MdTextButton* restart_button_; views::Label* restart_label_; @@ -128,8 +146,10 @@ // static void ChromeLabsBubbleView::Show(views::View* anchor_view, Browser* browser, - const ChromeLabsBubbleViewModel* model) { - g_chrome_labs_bubble = new ChromeLabsBubbleView(anchor_view, browser, model); + const ChromeLabsBubbleViewModel* model, + bool user_is_chromeos_owner) { + g_chrome_labs_bubble = new ChromeLabsBubbleView(anchor_view, browser, model, + user_is_chromeos_owner); views::Widget* const widget = BubbleDialogDelegateView::CreateBubble(g_chrome_labs_bubble); widget->Show(); @@ -154,7 +174,8 @@ ChromeLabsBubbleView::ChromeLabsBubbleView( views::View* anchor_view, Browser* browser, - const ChromeLabsBubbleViewModel* model) + const ChromeLabsBubbleViewModel* model, + bool user_is_chromeos_owner) : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::Arrow::TOP_RIGHT), model_(model) { @@ -168,9 +189,23 @@ set_margins(gfx::Insets(0)); SetEnableArrowKeyTraversal(true); - // TODO(elainechien): ChromeOS specific logic for creating FlagsStorage +// TODO(elainechien): Take care of additional cases 1) kSafeMode switch is +// present 2) user is secondary user. +#if BUILDFLAG(IS_CHROMEOS_ASH) + profile_ = browser->profile()->GetOriginalProfile(); + if (user_is_chromeos_owner) { + ash::OwnerSettingsServiceAsh* service = + ash::OwnerSettingsServiceAshFactory::GetForBrowserContext(profile_); + flags_storage_ = std::make_unique<ash::about_flags::OwnerFlagsStorage>( + profile_->GetPrefs(), service); + } else { + flags_storage_ = std::make_unique<flags_ui::PrefServiceFlagsStorage>( + profile_->GetPrefs()); + } +#else flags_storage_ = std::make_unique<flags_ui::PrefServiceFlagsStorage>( g_browser_process->local_state()); +#endif flags_state_ = about_flags::GetCurrentFlagsState(); menu_item_container_ = AddChildView( @@ -207,7 +242,7 @@ // experiments to show. Therefore ChromeLabsBubble should not be created. DCHECK(menu_item_container_->children().size() >= 1); - restart_prompt_ = AddChildView(std::make_unique<ChromeLabsFooter>()); + restart_prompt_ = AddChildView(std::make_unique<ChromeLabsFooter>(this)); restart_prompt_->SetVisible(about_flags::IsRestartNeededToCommitChanges()); } @@ -261,13 +296,33 @@ return chrome::GetChannel() <= lab.allowed_channel; } -// TODO(elainechien): ChromeOS specific logic for owner access only flags. bool ChromeLabsBubbleView::IsFeatureSupportedOnPlatform( const flags_ui::FeatureEntry* entry) { return (entry && (entry->supported_platforms & flags_ui::FlagsState::GetCurrentPlatform()) != 0); } +void ChromeLabsBubbleView::RestartToApplyFlags() { +#if BUILDFLAG(IS_CHROMEOS_ASH) + // On Chrome OS be less intrusive and restart inside the user session after + // we apply the newly selected flags. + VLOG(1) << "Restarting to apply per-session flags..."; + + // On Chrome OS, Chrome asks session_manager to apply feature flags on + // restart. Adhere to policy-enforced command-line switch handling when + // applying modified flags. + auto flags = flags_storage_->GetFlags(); + ash::UserSessionManager::ApplyUserPolicyToFlags(profile_->GetPrefs(), &flags); + + AccountId account_id = + user_manager::UserManager::Get()->GetActiveUser()->GetAccountId(); + ash::SessionManagerClient::Get()->SetFeatureFlagsForUser( + cryptohome::CreateAccountIdentifierFromAccountId(account_id), + {flags.begin(), flags.end()}); +#endif + chrome::AttemptRestart(); +} + void ChromeLabsBubbleView::ShowRelaunchPrompt() { restart_prompt_->SetVisible(about_flags::IsRestartNeededToCommitChanges()); @@ -294,10 +349,6 @@ return flags_state_; } -flags_ui::FlagsStorage* ChromeLabsBubbleView::GetFlagsStorageForTesting() { - return flags_storage_.get(); -} - views::View* ChromeLabsBubbleView::GetMenuItemContainerForTesting() { return menu_item_container_; }
diff --git a/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view.h b/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view.h index b80a6e2..bb24525b 100644 --- a/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view.h +++ b/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view.h
@@ -15,6 +15,9 @@ #include "ui/views/layout/flex_layout_view.h" class Browser; +#if BUILDFLAG(IS_CHROMEOS_ASH) +class Profile; +#endif // TODO(elainechien): Use composition instead of inheritance. class ChromeLabsBubbleView : public views::BubbleDialogDelegateView { @@ -22,25 +25,28 @@ METADATA_HEADER(ChromeLabsBubbleView); static void Show(views::View* anchor_view, Browser* browser, - const ChromeLabsBubbleViewModel* model); + const ChromeLabsBubbleViewModel* model, + bool user_is_chromeos_owner); static bool IsShowing(); static void Hide(); + void RestartToApplyFlags(); + ~ChromeLabsBubbleView() override; // Getter functions for testing. static ChromeLabsBubbleView* GetChromeLabsBubbleViewForTesting(); flags_ui::FlagsState* GetFlagsStateForTesting(); - flags_ui::FlagsStorage* GetFlagsStorageForTesting(); views::View* GetMenuItemContainerForTesting(); bool IsRestartPromptVisibleForTesting(); private: ChromeLabsBubbleView(views::View* anchor_view, Browser* browser, - const ChromeLabsBubbleViewModel* model); + const ChromeLabsBubbleViewModel* model, + bool user_is_chromeos_owner); std::unique_ptr<ChromeLabsItemView> CreateLabItem( const LabInfo& lab, @@ -66,6 +72,9 @@ const ChromeLabsBubbleViewModel* model_; views::View* restart_prompt_; -}; +#if BUILDFLAG(IS_CHROMEOS_ASH) + Profile* profile_ = nullptr; +#endif +}; #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_CHROME_LABS_BUBBLE_VIEW_H_
diff --git a/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view_unittest.cc b/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view_unittest.cc index 40ba8dcf..f39b2aa 100644 --- a/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view_unittest.cc +++ b/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view_unittest.cc
@@ -15,8 +15,10 @@ #include "chrome/browser/ui/views/toolbar/chrome_labs_button.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/browser/unexpire_flags.h" +#include "chrome/test/base/testing_browser_process.h" #include "components/flags_ui/feature_entry_macros.h" #include "components/flags_ui/flags_state.h" +#include "components/flags_ui/pref_service_flags_storage.h" #include "components/version_info/channel.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/events/event_utils.h" @@ -24,7 +26,25 @@ #include "ui/views/test/combobox_test_api.h" #include "ui/views/test/widget_test.h" +#if BUILDFLAG(IS_CHROMEOS_ASH) +#include "base/memory/ptr_util.h" +#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h" +#include "chrome/browser/ash/ownership/owner_settings_service_ash.h" +#include "chrome/browser/ash/ownership/owner_settings_service_ash_factory.h" +#include "chrome/browser/ash/settings/owner_flags_storage.h" +#include "chromeos/cryptohome/cryptohome_parameters.h" +#include "chromeos/dbus/session_manager/fake_session_manager_client.h" +#include "components/user_manager/scoped_user_manager.h" +#include "components/user_manager/user_manager.h" +#endif + namespace { + +#if BUILDFLAG(IS_CHROMEOS_ASH) +constexpr char kFakeUserName[] = "test@example.com"; +constexpr char kFakeGaiaId[] = "1234567890"; +#endif + const char kFirstTestFeatureId[] = "feature-1"; const char kTestFeatureWithVariationId[] = "feature-2"; const char kThirdTestFeatureId[] = "feature-3"; @@ -82,7 +102,8 @@ ChromeLabsButton* button = chrome_labs_button(); ChromeLabsBubbleView::Show(button, browser_view()->browser(), - chrome_labs_model()); + chrome_labs_model(), + /*user_is_chromeos_owner=*/false); } void TearDown() override { @@ -112,11 +133,6 @@ ->GetFlagsStateForTesting(); } - flags_ui::FlagsStorage* flags_storage() { - return ChromeLabsBubbleView::GetChromeLabsBubbleViewForTesting() - ->GetFlagsStorageForTesting(); - } - ChromeLabsItemView* first_lab_item() { views::View* menu_items = chrome_labs_menu_item_container(); return static_cast<ChromeLabsItemView*>(menu_items->children().front()); @@ -129,12 +145,15 @@ } // Returns true if the option at index |option_index| is the enabled feature - // state. - bool IsSelected(int option_index, const flags_ui::FeatureEntry* entry) { + // state in the FlagsStorage we expect the entry to be in. + bool IsSelected(int option_index, + const flags_ui::FeatureEntry* entry, + flags_ui::FlagsStorage* expected_flags_storage) { std::string internal_name = std::string(entry->internal_name) + "@" + base::NumberToString(option_index); std::set<std::string> enabled_entries; - flags_state()->GetSanitizedEnabledFlags(flags_storage(), &enabled_entries); + flags_state()->GetSanitizedEnabledFlags(expected_flags_storage, + &enabled_entries); for (int i = 0; i < entry->NumOptions(); i++) { const std::string name = entry->NameForOption(i); if (internal_name == name && enabled_entries.count(name) > 0) { @@ -145,9 +164,11 @@ } // Returns true if none of the entry's options have been enabled. - bool IsDefault(const flags_ui::FeatureEntry* entry) { + bool IsDefault(const flags_ui::FeatureEntry* entry, + flags_ui::FlagsStorage* expected_flags_storage) { std::set<std::string> enabled_entries; - flags_state()->GetSanitizedEnabledFlags(flags_storage(), &enabled_entries); + flags_state()->GetSanitizedEnabledFlags(expected_flags_storage, + &enabled_entries); for (int i = 0; i < entry->NumOptions(); i++) { const std::string name = entry->NameForOption(i); if (enabled_entries.count(name) > 0) { @@ -190,10 +211,7 @@ ChromeLabsFeatureTest() = default; }; -// TODO(elainechien): Some logic is still needed for ChromeOS and tests may not -// behave as expected yet. #if !BUILDFLAG(IS_CHROMEOS_ASH) - // This test checks that selecting an option through the combobox on a lab will // enable the corresponding option on the feature. TEST_P(ChromeLabsFeatureTest, ChangeSelectedOption) { @@ -207,7 +225,10 @@ lab_item_combobox->SetSelectedRow(row); const flags_ui::FeatureEntry* feature_entry = lab_item->GetFeatureEntry(); - EXPECT_TRUE(IsSelected(row, feature_entry)); + std::unique_ptr<flags_ui::PrefServiceFlagsStorage> flags_storage = + std::make_unique<flags_ui::PrefServiceFlagsStorage>( + TestingBrowserProcess::GetGlobal()->local_state()); + EXPECT_TRUE(IsSelected(row, feature_entry, flags_storage.get())); // FeatureEntry of type FEATURE_WITH_PARAMS_VALUE ChromeLabsItemView* lab_item_with_params = second_lab_item(); @@ -217,7 +238,7 @@ const flags_ui::FeatureEntry* feature_entry_with_params = lab_item_with_params->GetFeatureEntry(); - EXPECT_TRUE(IsSelected(row, feature_entry_with_params)); + EXPECT_TRUE(IsSelected(row, feature_entry_with_params, flags_storage.get())); } // For FeatureEntries of type FEATURE_VALUE, the option at index 1 corresponds @@ -227,12 +248,6 @@ // additional parameter. INSTANTIATE_TEST_SUITE_P(All, ChromeLabsFeatureTest, testing::Values(1, 2)); -// This test checks that only the two features that are supported on the current -// platform and do not have expired flags are added to the bubble. -TEST_F(ChromeLabsBubbleTest, OnlyCompatibleFeaturesShow) { - EXPECT_TRUE(chrome_labs_menu_item_container()->children().size() == 2); -} - // This test checks that selecting row 0 will reset the feature to it's Default // state. TEST_F(ChromeLabsBubbleTest, ResetToDefault) { @@ -244,9 +259,116 @@ // selecting 0. const flags_ui::FeatureEntry* feature_entry = lab_item->GetFeatureEntry(); lab_item_combobox->SetSelectedRow(1); - EXPECT_FALSE(IsDefault(feature_entry)); + std::unique_ptr<flags_ui::PrefServiceFlagsStorage> flags_storage = + std::make_unique<flags_ui::PrefServiceFlagsStorage>( + TestingBrowserProcess::GetGlobal()->local_state()); + EXPECT_FALSE(IsDefault(feature_entry, flags_storage.get())); lab_item_combobox->SetSelectedRow(0); - EXPECT_TRUE(IsDefault(feature_entry)); + EXPECT_TRUE(IsDefault(feature_entry, flags_storage.get())); +} +#endif // !BUILDFLAG(IS_CHROMEOS_ASH) + +// Ash versions of the above tests. +#if BUILDFLAG(IS_CHROMEOS_ASH) + +namespace ash { + +class ChromeLabsAshFeatureTest : public ChromeLabsFeatureTest { + public: + ChromeLabsAshFeatureTest() + : ChromeLabsFeatureTest(), + user_manager_(new FakeChromeUserManager()), + user_manager_enabler_(base::WrapUnique(user_manager_)) { + SessionManagerClient::InitializeFakeInMemory(); + FakeSessionManagerClient::Get()->set_supports_browser_restart(true); + const AccountId account_id( + AccountId::FromUserEmailGaiaId(kFakeUserName, kFakeGaiaId)); + user_manager_->AddUser(account_id); + user_manager_->LoginUser(account_id); + } + + private: + FakeChromeUserManager* user_manager_; + user_manager::ScopedUserManager user_manager_enabler_; +}; + +TEST_P(ChromeLabsAshFeatureTest, ChangeSelectedOption) { + int row = GetParam(); + + // FeatureEntry of type FEATURE_VALUE + ChromeLabsItemView* lab_item = first_lab_item(); + views::Combobox* lab_item_combobox = + lab_item->GetLabStateComboboxForTesting(); + + lab_item_combobox->SetSelectedRow(row); + + const flags_ui::FeatureEntry* feature_entry = lab_item->GetFeatureEntry(); + // On ash-chrome we expect the PrefService from the profile to be used. + std::unique_ptr<flags_ui::PrefServiceFlagsStorage> flags_storage = + std::make_unique<flags_ui::PrefServiceFlagsStorage>( + profile()->GetPrefs()); + EXPECT_TRUE(IsSelected(row, feature_entry, flags_storage.get())); + + // FeatureEntry of type FEATURE_WITH_PARAMS_VALUE + ChromeLabsItemView* lab_item_with_params = second_lab_item(); + views::Combobox* lab_item_with_params_combobox = + lab_item_with_params->GetLabStateComboboxForTesting(); + lab_item_with_params_combobox->SetSelectedRow(row); + + const flags_ui::FeatureEntry* feature_entry_with_params = + lab_item_with_params->GetFeatureEntry(); + EXPECT_TRUE(IsSelected(row, feature_entry_with_params, flags_storage.get())); + + // Make sure flags have been set since ChromeOS should apply flags through + // the session manager. + AccountId user_id = + user_manager::UserManager::Get()->GetActiveUser()->GetAccountId(); + std::vector<std::string> raw_flags; + FakeSessionManagerClient* session_manager = FakeSessionManagerClient::Get(); + chrome_labs_bubble()->RestartToApplyFlags(); + const bool has_user_flags = session_manager->GetFlagsForUser( + cryptohome::CreateAccountIdentifierFromAccountId(user_id), &raw_flags); + EXPECT_TRUE(has_user_flags); +} + +INSTANTIATE_TEST_SUITE_P(All, ChromeLabsAshFeatureTest, testing::Values(1, 2)); + +// OwnerFlagsStorage on build bots works the same way as the non-owner version +// since we don't have the session manager daemon to write and sign the proto +// blob. This test just opens the bubble to make sure there are no crashes. +TEST_F(ChromeLabsBubbleTest, ShowBubbleWhenUserIsOwner) { + ChromeLabsBubbleView::Hide(); + ChromeLabsBubbleView::Show(chrome_labs_button(), browser_view()->browser(), + chrome_labs_model(), + /*user_is_chromeos_owner=*/true); +} + +TEST_F(ChromeLabsBubbleTest, ResetToDefault) { + ChromeLabsItemView* lab_item = first_lab_item(); + views::Combobox* lab_item_combobox = + lab_item->GetLabStateComboboxForTesting(); + + // Selects an option and then attempts to reset the lab to Default by + // selecting 0. + const flags_ui::FeatureEntry* feature_entry = lab_item->GetFeatureEntry(); + lab_item_combobox->SetSelectedRow(1); + // On ash-chrome we expect the PrefService from the profile to be used. + std::unique_ptr<flags_ui::PrefServiceFlagsStorage> flags_storage = + std::make_unique<flags_ui::PrefServiceFlagsStorage>( + profile()->GetPrefs()); + EXPECT_FALSE(IsDefault(feature_entry, flags_storage.get())); + lab_item_combobox->SetSelectedRow(0); + EXPECT_TRUE(IsDefault(feature_entry, flags_storage.get())); +} + +} // namespace ash + +#endif // BUILDFLAG(IS_CHROMEOS_ASH) + +// This test checks that only the two features that are supported on the current +// platform and do not have expired flags are added to the bubble. +TEST_F(ChromeLabsBubbleTest, OnlyCompatibleFeaturesShow) { + EXPECT_TRUE(chrome_labs_menu_item_container()->children().size() == 2); } // This test checks that the restart prompt becomes visible when a lab state is @@ -263,7 +385,8 @@ ChromeLabsBubbleView::Hide(); destroyed_waiter.Wait(); ChromeLabsBubbleView::Show(chrome_labs_button(), browser_view()->browser(), - chrome_labs_model()); + chrome_labs_model(), + /*user_is_chromeos_owner=*/false); ChromeLabsBubbleView* bubble_view_after_restart = chrome_labs_bubble(); EXPECT_TRUE(bubble_view_after_restart->IsRestartPromptVisibleForTesting()); } @@ -298,5 +421,3 @@ histogram_tester.ExpectTotalCount("Feedback.RequestSource", 1); } #endif - -#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chrome/browser/ui/views/toolbar/chrome_labs_button.cc b/chrome/browser/ui/views/toolbar/chrome_labs_button.cc index f662d78..1dd537e 100644 --- a/chrome/browser/ui/views/toolbar/chrome_labs_button.cc +++ b/chrome/browser/ui/views/toolbar/chrome_labs_button.cc
@@ -5,6 +5,8 @@ #include "chrome/browser/ui/views/toolbar/chrome_labs_button.h" #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/about_flags.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/views/toolbar/chrome_labs_bubble_view.h" #include "chrome/browser/ui/webui/flags/flags_ui.h" #include "chrome/common/channel_info.h" @@ -14,6 +16,13 @@ #include "ui/views/accessibility/view_accessibility.h" #include "ui/views/controls/button/button_controller.h" +#if BUILDFLAG(IS_CHROMEOS_ASH) +#include "base/system/sys_info.h" +#include "chrome/browser/ash/ownership/owner_settings_service_ash.h" +#include "chrome/browser/ash/ownership/owner_settings_service_ash_factory.h" +#include "chrome/browser/ash/settings/owner_flags_storage.h" +#endif + ChromeLabsButton::ChromeLabsButton(Browser* browser, const ChromeLabsBubbleViewModel* model) : ToolbarButton(base::BindRepeating(&ChromeLabsButton::ButtonPressed, @@ -39,7 +48,26 @@ ChromeLabsBubbleView::Hide(); return; } - ChromeLabsBubbleView::Show(this, browser_, model_); + // Ash-chrome uses a different FlagsStorage if the user is the owner. On + // ChromeOS verifying if the owner is signed in is async operation. + // Asynchronously check if the user is the owner and show the Chrome Labs + // bubble only after we have this information. +#if BUILDFLAG(IS_CHROMEOS_ASH) + // Bypass possible incognito profile same as chrome://flags does. + Profile* original_profile = browser_->profile()->GetOriginalProfile(); + if (base::SysInfo::IsRunningOnChromeOS() && + ash::OwnerSettingsServiceAshFactory::GetForBrowserContext( + original_profile)) { + ash::OwnerSettingsServiceAsh* service = + ash::OwnerSettingsServiceAshFactory::GetForBrowserContext( + original_profile); + service->IsOwnerAsync( + base::BindOnce(&ChromeLabsBubbleView::Show, this, browser_, model_)); + return; + } +#endif + ChromeLabsBubbleView::Show(this, browser_, model_, + /*user_is_chromeos_owner=*/false); } // static
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc index acfc14c3..6ded8eb5 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc
@@ -39,6 +39,7 @@ #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" #include "chrome/browser/ui/views/extensions/extension_popup.h" +#include "chrome/browser/ui/views/extensions/extensions_side_panel_controller.h" #include "chrome/browser/ui/views/extensions/extensions_toolbar_button.h" #include "chrome/browser/ui/views/extensions/extensions_toolbar_container.h" #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" @@ -218,6 +219,7 @@ chrome::ExecuteCommandWithDisposition( browser, command, ui::DispositionFromEventFlags(event.flags())); }; + std::unique_ptr<ToolbarButton> back = std::make_unique<BackForwardButton>( BackForwardButton::Direction::kBack, base::BindRepeating(callback, browser_, IDC_BACK), browser_); @@ -275,6 +277,11 @@ } // Always add children in order from left to right, for accessibility. + if (browser_view_->extensions_side_panel_controller()) { + left_side_panel_button_ = + AddChildView(browser_view_->extensions_side_panel_controller() + ->CreateToolbarButton()); + } back_ = AddChildView(std::move(back)); forward_ = AddChildView(std::move(forward)); reload_ = AddChildView(std::move(reload));
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.h b/chrome/browser/ui/views/toolbar/toolbar_view.h index 03bd572..a672a86 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_view.h +++ b/chrome/browser/ui/views/toolbar/toolbar_view.h
@@ -144,6 +144,7 @@ } ExtensionsToolbarButton* GetExtensionsButton() const; ReloadButton* reload_button() const { return reload_; } + ToolbarButton* left_side_panel_button() { return left_side_panel_button_; } LocationBarView* location_bar() const { return location_bar_; } CustomTabBarView* custom_tab_bar() { return custom_tab_bar_; } media_router::CastToolbarButton* cast_button() const { return cast_; } @@ -256,6 +257,7 @@ // Controls. Most of these can be null, e.g. in popup windows. Only // |location_bar_| is guaranteed to exist. These pointers are owned by the // view hierarchy. + ToolbarButton* left_side_panel_button_ = nullptr; ToolbarButton* back_ = nullptr; ToolbarButton* forward_ = nullptr; ReloadButton* reload_ = nullptr;
diff --git a/chrome/browser/ui/views/webauthn/webauthn_bubble_view.cc b/chrome/browser/ui/views/webauthn/webauthn_bubble_view.cc index b0c00de..0af0304 100644 --- a/chrome/browser/ui/views/webauthn/webauthn_bubble_view.cc +++ b/chrome/browser/ui/views/webauthn/webauthn_bubble_view.cc
@@ -65,8 +65,8 @@ std::u16string WebAuthnBubbleView::GetWindowTitle() const { // TODO(crbug.com/1179014): go through ux review and i18n this string. - return base::UTF8ToUTF16(users_.empty() ? "Sign in with your security key" - : "Choose an account to sign in"); + return users_.empty() ? u"Sign in with your security key" + : u"Choose an account to sign in"; } void WebAuthnBubbleView::Init() { @@ -75,8 +75,7 @@ if (users_.empty()) { // TODO(crbug.com/1179014): go through ux review and i18n this string. std::u16string label_text = base::ReplaceStringPlaceholders( - base::UTF8ToUTF16( - "To sign in to $1 with your security key, insert it and tap it"), + u"To sign in to $1 with your security key, insert it and tap it", webauthn_ui_helpers::RpIdToElidedHost(relying_party_id_, fixed_width()), /*offset=*/nullptr); auto label = std::make_unique<views::Label>(
diff --git a/chrome/browser/ui/web_applications/test/ssl_test_utils.cc b/chrome/browser/ui/web_applications/test/ssl_test_utils.cc index e027590..afe8f4ef 100644 --- a/chrome/browser/ui/web_applications/test/ssl_test_utils.cc +++ b/chrome/browser/ui/web_applications/test/ssl_test_utils.cc
@@ -4,41 +4,11 @@ #include "chrome/browser/ui/web_applications/test/ssl_test_utils.h" -#include "base/atomic_sequence_num.h" -#include "base/time/time.h" #include "chrome/browser/ssl/ssl_browsertest_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "components/security_state/core/features.h" #include "components/security_state/core/security_state.h" -#include "crypto/rsa_private_key.h" -#include "net/cert/x509_certificate.h" -#include "net/cert/x509_util.h" -#include "net/ssl/ssl_info.h" - -namespace { - -// NSS requires that serial numbers be unique even for the same issuer; -// as all fake certificates will contain the same issuer name, it's -// necessary to ensure the serial number is unique, as otherwise -// NSS will fail to parse. -base::AtomicSequenceNumber g_serial_number; - -scoped_refptr<net::X509Certificate> CreateFakeCert() { - std::unique_ptr<crypto::RSAPrivateKey> unused_key; - std::string cert_der; - if (!net::x509_util::CreateKeyAndSelfSignedCert( - "CN=Error", static_cast<uint32_t>(g_serial_number.GetNext()), - base::Time::Now() - base::TimeDelta::FromMinutes(5), - base::Time::Now() + base::TimeDelta::FromMinutes(5), &unused_key, - &cert_der)) { - return nullptr; - } - return net::X509Certificate::CreateFromBytes(cert_der.data(), - cert_der.size()); -} - -} // namespace namespace web_app { @@ -58,8 +28,4 @@ ssl_test_util::AuthState::NONE); } -void CreateFakeSslInfoCertificate(net::SSLInfo* ssl_info) { - ssl_info->cert = ssl_info->unverified_cert = CreateFakeCert(); -} - } // namespace web_app
diff --git a/chrome/browser/ui/web_applications/test/ssl_test_utils.h b/chrome/browser/ui/web_applications/test/ssl_test_utils.h index 58cbdca..fe335db 100644 --- a/chrome/browser/ui/web_applications/test/ssl_test_utils.h +++ b/chrome/browser/ui/web_applications/test/ssl_test_utils.h
@@ -7,10 +7,6 @@ class Browser; -namespace net { -class SSLInfo; -} - namespace web_app { // Checks that the active tab's authentication state indicates insecure content. @@ -19,9 +15,6 @@ // Checks that the active tab's authentication state indicates only secure // content is shown. void CheckMixedContentFailedToLoad(Browser* browser); - -void CreateFakeSslInfoCertificate(net::SSLInfo* ssl_info); - } // namespace web_app #endif // CHROME_BROWSER_UI_WEB_APPLICATIONS_TEST_SSL_TEST_UTILS_H_
diff --git a/chrome/browser/ui/web_applications/web_app_browsertest.cc b/chrome/browser/ui/web_applications/web_app_browsertest.cc index 278a1168..4bd0581 100644 --- a/chrome/browser/ui/web_applications/web_app_browsertest.cc +++ b/chrome/browser/ui/web_applications/web_app_browsertest.cc
@@ -85,6 +85,7 @@ namespace { constexpr const char kExampleURL[] = "http://example.org/"; +constexpr const char16_t kExampleURL16[] = u"http://example.org/"; constexpr const char kExampleManifestURL[] = "http://example.org/manifest"; constexpr char kLaunchWebAppDisplayModeHistogram[] = "Launch.WebAppDisplayMode"; @@ -672,7 +673,7 @@ std::u16string result; clipboard->ReadText(ui::ClipboardBuffer::kCopyPaste, /* data_dst = */ nullptr, &result); - EXPECT_EQ(result, base::UTF8ToUTF16(kExampleURL)); + EXPECT_EQ(result, kExampleURL16); } // Tests that the command for popping a tab out to a PWA window is disabled in @@ -985,8 +986,7 @@ EXPECT_TRUE(app_menu_model->GetModelAndIndexForCommandId(IDC_INSTALL_PWA, &model, &index)); EXPECT_EQ(app_menu_model.get(), model); - EXPECT_EQ(model->GetLabelAt(index), - base::UTF8ToUTF16("Install Manifest test app\xE2\x80\xA6")); + EXPECT_EQ(model->GetLabelAt(index), u"Install Manifest test app…"); } // Check that no assertions are hit when showing a permission request bubble.
diff --git a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.cc b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.cc index 56475b0d..bc0494d6 100644 --- a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.cc +++ b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.cc
@@ -8,8 +8,8 @@ #include "ash/public/cpp/window_properties.h" #include "base/callback_helpers.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_shelf_utils.h" #include "chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.h" #include "chrome/common/webui_url_constants.h"
diff --git a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.cc b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.cc index 1d2ff7aa..771bcb0 100644 --- a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.cc +++ b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.cc
@@ -16,8 +16,8 @@ #include "base/task/post_task.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h" -#include "chrome/browser/chromeos/crostini/crostini_disk.h" -#include "chrome/browser/chromeos/crostini/crostini_installer_ui_delegate.h" +#include "chrome/browser/ash/crostini/crostini_disk.h" +#include "chrome/browser/ash/crostini/crostini_installer_ui_delegate.h" #include "chrome/browser/chromeos/crostini/crostini_types.mojom.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "ui/base/text/bytes_formatting.h"
diff --git a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.cc b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.cc index f5f60f1..4b9b932 100644 --- a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.cc +++ b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.cc
@@ -12,8 +12,8 @@ #include "base/callback_helpers.h" #include "base/strings/utf_string_conversions.h" #include "base/system/sys_info.h" -#include "chrome/browser/chromeos/crostini/crostini_disk.h" -#include "chrome/browser/chromeos/crostini/crostini_installer.h" +#include "chrome/browser/ash/crostini/crostini_disk.h" +#include "chrome/browser/ash/crostini/crostini_installer.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.h" #include "chrome/browser/ui/webui/webui_util.h"
diff --git a/chrome/browser/ui/webui/chromeos/crostini_upgrader/crostini_upgrader_dialog.cc b/chrome/browser/ui/webui/chromeos/crostini_upgrader/crostini_upgrader_dialog.cc index 3ce24bc..4a8b695 100644 --- a/chrome/browser/ui/webui/chromeos/crostini_upgrader/crostini_upgrader_dialog.cc +++ b/chrome/browser/ui/webui/chromeos/crostini_upgrader/crostini_upgrader_dialog.cc
@@ -7,7 +7,7 @@ #include "ash/public/cpp/shelf_types.h" #include "ash/public/cpp/window_properties.h" #include "base/metrics/histogram_functions.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_shelf_utils.h" #include "chrome/browser/chromeos/crostini/crostini_simple_types.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/ui/webui/chromeos/crostini_upgrader/crostini_upgrader_dialog_browsertest.cc b/chrome/browser/ui/webui/chromeos/crostini_upgrader/crostini_upgrader_dialog_browsertest.cc index 81da54f..a95bce5 100644 --- a/chrome/browser/ui/webui/chromeos/crostini_upgrader/crostini_upgrader_dialog_browsertest.cc +++ b/chrome/browser/ui/webui/chromeos/crostini_upgrader/crostini_upgrader_dialog_browsertest.cc
@@ -9,9 +9,9 @@ #include "base/metrics/histogram_base.h" #include "base/run_loop.h" #include "base/test/metrics/histogram_tester.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_test_helper.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h index f9e875b..f5b2489 100644 --- a/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h
@@ -9,7 +9,6 @@ #include "base/compiler_specific.h" #include "base/macros.h" -#include "base/values.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" #include "components/prefs/pref_registry_simple.h"
diff --git a/chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.h b/chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.h index 1b460c9f07..61e1564 100644 --- a/chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.h +++ b/chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.h
@@ -10,7 +10,6 @@ #include "base/compiler_specific.h" #include "base/macros.h" -#include "base/values.h" #include "chrome/browser/chromeos/input_method/mock_input_method_manager_impl.h" #include "ui/base/ime/chromeos/input_method_descriptor.h"
diff --git a/chrome/browser/ui/webui/downloads/downloads_list_tracker.h b/chrome/browser/ui/webui/downloads/downloads_list_tracker.h index f4ba687..dd68ee36d 100644 --- a/chrome/browser/ui/webui/downloads/downloads_list_tracker.h +++ b/chrome/browser/ui/webui/downloads/downloads_list_tracker.h
@@ -14,7 +14,6 @@ #include "base/callback_forward.h" #include "base/macros.h" #include "base/time/time.h" -#include "base/values.h" #include "chrome/browser/ui/webui/downloads/downloads.mojom.h" #include "components/download/content/public/all_download_item_notifier.h" #include "components/download/public/common/download_item.h"
diff --git a/chrome/browser/ui/webui/management/management_ui_handler.cc b/chrome/browser/ui/webui/management/management_ui_handler.cc index 8fb6d50..0df8e1d 100644 --- a/chrome/browser/ui/webui/management/management_ui_handler.cc +++ b/chrome/browser/ui/webui/management/management_ui_handler.cc
@@ -43,11 +43,11 @@ #include "ui/base/webui/web_ui_util.h" #if BUILDFLAG(IS_CHROMEOS_ASH) +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_pref_names.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/ash/settings/cros_settings.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" #include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager.h"
diff --git a/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc b/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc index edab546..b063ce2 100644 --- a/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc +++ b/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc
@@ -42,10 +42,10 @@ #include "base/test/scoped_feature_list.h" #include "base/test/test_simple_task_runner.h" #include "base/time/time.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/settings/device_settings_test_helper.h" #include "chrome/browser/ash/settings/scoped_testing_cros_settings.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/fake_crostini_features.h" #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
diff --git a/chrome/browser/ui/webui/media_router/cast_feedback_ui.cc b/chrome/browser/ui/webui/media_router/cast_feedback_ui.cc index 20bb8cd9..f5d47e1 100644 --- a/chrome/browser/ui/webui/media_router/cast_feedback_ui.cc +++ b/chrome/browser/ui/webui/media_router/cast_feedback_ui.cc
@@ -92,14 +92,12 @@ "formDescription", l10n_util::GetStringFUTF8( IDS_MEDIA_ROUTER_FEEDBACK_FORM_DESCRIPTION, - base::UTF8ToUTF16("https://support.google.com/" - "chromecast?p=troubleshoot_chromecast"))); + u"https://support.google.com/chromecast?p=troubleshoot_chromecast")); source->AddString( "setupVisibilityQuestion", l10n_util::GetStringFUTF8( IDS_MEDIA_ROUTER_FEEDBACK_SETUP_VISIBILITY_QUESTION, - base::UTF8ToUTF16( - "https://support.google.com/chromecast?p=set_up_chromecast"))); + u"https://support.google.com/chromecast?p=set_up_chromecast")); // TODO(jrw): Attach real log data. source->AddString("logData", "dummy log data");
diff --git a/chrome/browser/ui/webui/print_preview/local_printer_handler_default.cc b/chrome/browser/ui/webui/print_preview/local_printer_handler_default.cc index f0f170c4..254a93a3 100644 --- a/chrome/browser/ui/webui/print_preview/local_printer_handler_default.cc +++ b/chrome/browser/ui/webui/print_preview/local_printer_handler_default.cc
@@ -21,6 +21,7 @@ #include "chrome/common/printing/printer_capabilities.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" +#include "printing/mojom/print.mojom.h" #include "printing/printing_features.h" #if defined(OS_MAC) @@ -148,7 +149,8 @@ VLOG(1) << "Get printer capabilities start for " << device_name; PrinterBasicInfo basic_info; - if (!print_backend->GetPrinterBasicInfo(device_name, &basic_info)) { + if (print_backend->GetPrinterBasicInfo(device_name, &basic_info) != + mojom::ResultCode::kSuccess) { LOG(WARNING) << "Invalid printer " << device_name; return base::Value(); }
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc index c8307a0e5..c7981a5 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
@@ -91,10 +91,9 @@ namespace { #if defined(OS_MAC) -// U+0028 U+21E7 U+2318 U+0050 U+0029 in UTF8 -const char kBasicPrintShortcut[] = "\x28\xE2\x8c\xA5\xE2\x8C\x98\x50\x29"; +const char16_t kBasicPrintShortcut[] = u"\u0028\u21e7\u2318\u0050\u0029"; #elif !BUILDFLAG(IS_CHROMEOS_ASH) -const char kBasicPrintShortcut[] = "(Ctrl+Shift+P)"; +const char16_t kBasicPrintShortcut[] = u"(Ctrl+Shift+P)"; #endif constexpr char kInvalidArgsForDidStartPreview[] = @@ -380,7 +379,7 @@ chrome::kCloudPrintCertificateErrorLearnMoreURL); #if !BUILDFLAG(IS_CHROMEOS_ASH) - const std::u16string shortcut_text(base::UTF8ToUTF16(kBasicPrintShortcut)); + const std::u16string shortcut_text(kBasicPrintShortcut); source->AddString("systemDialogOption", l10n_util::GetStringFUTF16( IDS_PRINT_PREVIEW_SYSTEM_DIALOG_OPTION, shortcut_text));
diff --git a/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.cc b/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.cc index cee7265..b7ab2d8 100644 --- a/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.cc +++ b/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.cc
@@ -11,8 +11,8 @@ #include "base/task/post_task.h" #include "base/task/thread_pool.h" #include "base/values.h" +#include "chrome/browser/ash/crostini/crostini_features.h" #include "chrome/browser/browsing_data/browsing_data_file_system_util.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" #include "chrome/browser/chromeos/file_manager/path_util.h" #include "chrome/browser/profiles/profile.h" #include "chromeos/cryptohome/cryptohome_util.h"
diff --git a/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.h b/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.h index 0dd5ae4..be713fe 100644 --- a/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.h +++ b/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.h
@@ -14,9 +14,8 @@ #include "base/files/file_util.h" #include "base/memory/weak_ptr.h" #include "base/observer_list_types.h" -#include "base/values.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/browsing_data/site_data_size_collector.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chromeos/dbus/cryptohome/UserDataAuth.pb.h" #include "chromeos/dbus/cryptohome/rpc.pb.h" #include "components/arc/mojom/storage_manager.mojom.h"
diff --git a/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc b/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc index 0359fe2dc6..6710b5f9 100644 --- a/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc +++ b/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc
@@ -10,12 +10,12 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/metrics/histogram_functions.h" +#include "chrome/browser/ash/crostini/crostini_disk.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_installer.h" +#include "chrome/browser/ash/crostini/crostini_port_forwarder.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chromeos/crostini/crostini_disk.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_installer.h" -#include "chrome/browser/chromeos/crostini/crostini_port_forwarder.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_types.mojom.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/file_manager/path_util.h"
diff --git a/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h b/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h index 9287ae6..4935da2 100644 --- a/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h +++ b/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h
@@ -8,10 +8,10 @@ #include <vector> #include "base/memory/weak_ptr.h" +#include "chrome/browser/ash/crostini/crostini_export_import.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" +#include "chrome/browser/ash/crostini/crostini_port_forwarder.h" #include "chrome/browser/ash/settings/cros_settings.h" -#include "chrome/browser/chromeos/crostini/crostini_export_import.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "chrome/browser/chromeos/crostini/crostini_port_forwarder.h" #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" #include "chromeos/dbus/session_manager/session_manager_client.h" #include "components/prefs/pref_change_registrar.h"
diff --git a/chrome/browser/ui/webui/settings/chromeos/crostini_section.cc b/chrome/browser/ui/webui/settings/chromeos/crostini_section.cc index def3354..bb87280 100644 --- a/chrome/browser/ui/webui/settings/chromeos/crostini_section.cc +++ b/chrome/browser/ui/webui/settings/chromeos/crostini_section.cc
@@ -8,10 +8,10 @@ #include "base/feature_list.h" #include "base/no_destructor.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/ash/crostini/crostini_disk.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/profiles/profile_helper.h" -#include "chrome/browser/chromeos/crostini/crostini_disk.h" -#include "chrome/browser/chromeos/crostini/crostini_features.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/policy/profile_policy_connector.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/ui/webui/settings/settings_page_ui_handler.h b/chrome/browser/ui/webui/settings/settings_page_ui_handler.h index 7007a75..835a5c3a 100644 --- a/chrome/browser/ui/webui/settings/settings_page_ui_handler.h +++ b/chrome/browser/ui/webui/settings/settings_page_ui_handler.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_PAGE_UI_HANDLER_H_ #include "base/macros.h" -#include "base/values.h" #include "content/public/browser/web_ui_message_handler.h" namespace settings {
diff --git a/chrome/browser/web_applications/BUILD.gn b/chrome/browser/web_applications/BUILD.gn index 0840901..d5e2766 100644 --- a/chrome/browser/web_applications/BUILD.gn +++ b/chrome/browser/web_applications/BUILD.gn
@@ -57,7 +57,6 @@ "web_app_install_task.h", "web_app_installation_utils.cc", "web_app_installation_utils.h", - "web_app_migration_manager.h", "web_app_mover.cc", "web_app_mover.h", "web_app_proto_utils.cc", @@ -300,7 +299,6 @@ "system_web_apps/test/system_web_app_manager_browsertest.cc", "web_app_audio_focus_browsertest.cc", "web_app_icon_manager_browsertest.cc", - "web_app_migration_manager_browsertest.cc", "web_app_mover_browsertest.cc", ]
diff --git a/chrome/browser/web_applications/components/external_install_options.h b/chrome/browser/web_applications/components/external_install_options.h index 00452417..672edbc 100644 --- a/chrome/browser/web_applications/components/external_install_options.h +++ b/chrome/browser/web_applications/components/external_install_options.h
@@ -106,8 +106,10 @@ // programmatically. bool bypass_service_worker_check = false; - // This should be used for installing all default apps so that good metadata - // is ensured. + // When set to true this will fail installation with + // |kNotValidManifestForWebApp| if the |install_url| doesn't have a manifest + // that passes basic validity checks. This is ignored when |app_info_factory| + // is used. bool require_manifest = false; // Whether the app should be reinstalled even if it is already installed.
diff --git a/chrome/browser/web_applications/components/install_finalizer.h b/chrome/browser/web_applications/components/install_finalizer.h index c315a99..8b3a914 100644 --- a/chrome/browser/web_applications/components/install_finalizer.h +++ b/chrome/browser/web_applications/components/install_finalizer.h
@@ -105,8 +105,6 @@ bool shortcut_created, content::WebContents* web_contents); - virtual void RemoveLegacyInstallFinalizerForTesting() {} - virtual void Start() {} virtual void Shutdown() {}
diff --git a/chrome/browser/web_applications/components/install_finalizer_unittest.cc b/chrome/browser/web_applications/components/install_finalizer_unittest.cc index 7982e33..3182041 100644 --- a/chrome/browser/web_applications/components/install_finalizer_unittest.cc +++ b/chrome/browser/web_applications/components/install_finalizer_unittest.cc
@@ -54,8 +54,8 @@ icon_manager_ = std::make_unique<WebAppIconManager>(profile(), registrar(), std::move(file_utils)); ui_manager_ = std::make_unique<TestWebAppUiManager>(); - finalizer_ = std::make_unique<WebAppInstallFinalizer>( - profile(), icon_manager_.get(), /*legacy_finalizer=*/nullptr); + finalizer_ = std::make_unique<WebAppInstallFinalizer>(profile(), + icon_manager_.get()); finalizer_->SetSubsystems( ®istrar(), ui_manager_.get(),
diff --git a/chrome/browser/web_applications/components/preinstalled_app_install_features.cc b/chrome/browser/web_applications/components/preinstalled_app_install_features.cc index 072e4a47..dfbe114 100644 --- a/chrome/browser/web_applications/components/preinstalled_app_install_features.cc +++ b/chrome/browser/web_applications/components/preinstalled_app_install_features.cc
@@ -66,11 +66,11 @@ // Enables default installing the Chat web app. const base::Feature kDefaultChatWebApp{"DefaultChatWebApp", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; // Enables default installing the Meet web app. const base::Feature kDefaultMeetWebApp{"DefaultMeetWebApp", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; #endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) bool IsPreinstalledAppInstallFeatureEnabled(base::StringPiece feature_name,
diff --git a/chrome/browser/web_applications/components/web_app_data_retriever_unittest.cc b/chrome/browser/web_applications/components/web_app_data_retriever_unittest.cc index 5fe8399..8235153 100644 --- a/chrome/browser/web_applications/components/web_app_data_retriever_unittest.cc +++ b/chrome/browser/web_applications/components/web_app_data_retriever_unittest.cc
@@ -37,7 +37,7 @@ namespace { -const char kFooTitle[] = "Foo Title"; +const char16_t kFooTitle[] = u"Foo Title"; } // namespace @@ -130,23 +130,6 @@ std::move(quit_closure).Run(); } - std::unique_ptr<WebApplicationInfo> CreateWebApplicationInfo( - const GURL& url, - const std::string name, - const std::string description, - const GURL& scope, - base::Optional<SkColor> theme_color) { - auto web_app_info = std::make_unique<WebApplicationInfo>(); - - web_app_info->start_url = url; - web_app_info->title = base::UTF8ToUTF16(name); - web_app_info->description = base::UTF8ToUTF16(description); - web_app_info->scope = scope; - web_app_info->theme_color = theme_color; - - return web_app_info; - } - protected: content::WebContentsTester* web_contents_tester() { return content::WebContentsTester::For(web_contents()); @@ -228,8 +211,7 @@ web_contents_tester()->NavigateAndCommit(GURL("https://foo.example")); - const auto web_contents_title = base::UTF8ToUTF16(kFooTitle); - web_contents_tester()->SetTitle(web_contents_title); + web_contents_tester()->SetTitle(kFooTitle); WebApplicationInfo original_web_app_info; original_web_app_info.title = u""; @@ -246,7 +228,7 @@ // If the WebApplicationInfo has no title, we fallback to the WebContents // title. - EXPECT_EQ(web_contents_title, web_app_info()->title); + EXPECT_EQ(kFooTitle, web_app_info()->title); } TEST_F(WebAppDataRetrieverTest, @@ -362,8 +344,7 @@ TEST_F(WebAppDataRetrieverTest, GetWebApplicationInfo_FrameNavigated) { SetFakeWebPageMetadataAgent(); - const auto web_contents_title = base::UTF8ToUTF16(kFooTitle); - web_contents_tester()->SetTitle(web_contents_title); + web_contents_tester()->SetTitle(kFooTitle); const GURL kFooUrl("https://foo.example/bar"); web_contents_tester()->NavigateAndCommit(kFooUrl.GetOrigin()); @@ -378,7 +359,7 @@ run_loop.Run(); EXPECT_EQ(kFooUrl.GetOrigin(), web_app_info()->start_url); - EXPECT_EQ(web_contents_title, web_app_info()->title); + EXPECT_EQ(kFooTitle, web_app_info()->title); } TEST_F(WebAppDataRetrieverTest, CheckInstallabilityAndRetrieveManifest) {
diff --git a/chrome/browser/web_applications/components/web_app_id_constants.cc b/chrome/browser/web_applications/components/web_app_id_constants.cc index 47bbe59d..8e7dbe8 100644 --- a/chrome/browser/web_applications/components/web_app_id_constants.cc +++ b/chrome/browser/web_applications/components/web_app_id_constants.cc
@@ -33,6 +33,10 @@ const char kGoogleCalendarAppId[] = "kjbdgfilnfhdoflbpgamdcdgpehopbep"; // Generated as: web_app::GenerateAppIdFromURL(GURL( +// "https://mail.google.com/chat/")) +const char kGoogleChatAppId[] = "mdpkiolbdkhdjpekfbkbmhigcaggjagi"; + +// Generated as: web_app::GenerateAppIdFromURL(GURL( // "https://docs.google.com/document/?usp=installed_webapp")) const char kGoogleDocsAppId[] = "mpnpojknpmmopombnjdcgaaiekajbnjb"; @@ -49,6 +53,10 @@ const char kGoogleMapsAppId[] = "mnhkaebcjjhencmpkapnbdaogjamfbcj"; // Generated as: web_app::GenerateAppIdFromURL(GURL( +// "https://meet.google.com/landing")) +const char kGoogleMeetAppId[] = "bajlehempfanmhccpdneohefomicoklp"; + +// Generated as: web_app::GenerateAppIdFromURL(GURL( // "https://news.google.com/?lfhs=2")) const char kGoogleNewsAppId[] = "kfgapjallbhpciobgmlhlhokknljkgho";
diff --git a/chrome/browser/web_applications/components/web_app_id_constants.h b/chrome/browser/web_applications/components/web_app_id_constants.h index 10e6ec62..b2caab7 100644 --- a/chrome/browser/web_applications/components/web_app_id_constants.h +++ b/chrome/browser/web_applications/components/web_app_id_constants.h
@@ -13,10 +13,12 @@ extern const char kDiagnosticsAppId[]; extern const char kGmailAppId[]; extern const char kGoogleCalendarAppId[]; +extern const char kGoogleChatAppId[]; extern const char kGoogleDocsAppId[]; extern const char kGoogleDriveAppId[]; extern const char kGoogleKeepAppId[]; extern const char kGoogleMapsAppId[]; +extern const char kGoogleMeetAppId[]; extern const char kGoogleNewsAppId[]; extern const char kGoogleSheetsAppId[]; extern const char kGoogleSlidesAppId[];
diff --git a/chrome/browser/web_applications/components/web_app_install_utils_unittest.cc b/chrome/browser/web_applications/components/web_app_install_utils_unittest.cc index 06cee0c..9f76acb 100644 --- a/chrome/browser/web_applications/components/web_app_install_utils_unittest.cc +++ b/chrome/browser/web_applications/components/web_app_install_utils_unittest.cc
@@ -28,8 +28,8 @@ const char16_t kAppShortName[] = u"Test short name"; const char16_t kAppTitle[] = u"Test title"; -const char kAlternativeAppTitle[] = "Different test title"; -const char kShortcutItemName[] = "shortcut item "; +const char16_t kAlternativeAppTitle[] = u"Different test title"; +const char16_t kShortcutItemName[] = u"shortcut item "; constexpr SquareSizePx kIconSize = 64; @@ -51,7 +51,7 @@ TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifest) { WebApplicationInfo web_app_info; - web_app_info.title = base::UTF8ToUTF16(kAlternativeAppTitle); + web_app_info.title = kAlternativeAppTitle; web_app_info.start_url = GURL("http://www.notchromium.org"); WebApplicationIconInfo info; const GURL kAppIcon1("fav1.png"); @@ -289,7 +289,7 @@ TEST_F(WebAppInstallUtilsWithShortcutsMenu, UpdateWebAppInfoFromManifestWithShortcuts) { WebApplicationInfo web_app_info; - web_app_info.title = base::UTF8ToUTF16(kAlternativeAppTitle); + web_app_info.title = kAlternativeAppTitle; web_app_info.start_url = GURL("http://www.notchromium.org"); WebApplicationIconInfo info; const GURL kAppIcon1("fav1.png"); @@ -300,9 +300,8 @@ for (int i = 0; i < 3; ++i) { WebApplicationShortcutsMenuItemInfo shortcuts_menu_item_info; WebApplicationShortcutsMenuItemInfo::Icon icon; - std::string shortcut_name = kShortcutItemName; - shortcut_name += base::NumberToString(i + 1); - shortcuts_menu_item_info.name = base::UTF8ToUTF16(shortcut_name); + shortcuts_menu_item_info.name = + kShortcutItemName + base::NumberToString16(i + 1); shortcuts_menu_item_info.url = kShortcutItemUrl; icon.url = GURL("http://www.chromium.org/shortcuts/icon1.png"); @@ -386,9 +385,7 @@ // Test that shortcuts in the manifest replace those in |web_app_info|. blink::Manifest::ShortcutItem shortcut_item; - std::string shortcut_name = kShortcutItemName; - shortcut_name += base::NumberToString(4); - shortcut_item.name = base::UTF8ToUTF16(shortcut_name); + shortcut_item.name = std::u16string(kShortcutItemName) + u"4"; shortcut_item.url = kShortcutItemUrl; const GURL kIconUrl2("http://www.chromium.org/shortcuts/icon2.png"); @@ -399,9 +396,7 @@ manifest.shortcuts.push_back(shortcut_item); - shortcut_name = kShortcutItemName; - shortcut_name += base::NumberToString(5); - shortcut_item.name = base::UTF8ToUTF16(shortcut_name); + shortcut_item.name = std::u16string(kShortcutItemName) + u"5"; const GURL kIconUrl3("http://www.chromium.org/shortcuts/icon3.png"); icon.src = kIconUrl3; @@ -480,9 +475,7 @@ blink::Manifest manifest; for (unsigned int i = 0; i < kNumTestIcons; ++i) { blink::Manifest::ShortcutItem shortcut_item; - std::string shortcut_name = kShortcutItemName; - shortcut_name += base::NumberToString(i); - shortcut_item.name = base::UTF8ToUTF16(shortcut_name); + shortcut_item.name = kShortcutItemName + base::NumberToString16(i); shortcut_item.url = GURL("http://www.chromium.org/shortcuts/action"); blink::Manifest::ImageResource icon; @@ -536,9 +529,7 @@ blink::Manifest manifest; for (int i = 1; i <= 20; ++i) { blink::Manifest::ShortcutItem shortcut_item; - std::string shortcut_name = kShortcutItemName; - shortcut_name += base::NumberToString(i); - shortcut_item.name = base::UTF8ToUTF16(shortcut_name); + shortcut_item.name = kShortcutItemName + base::NumberToString16(i); shortcut_item.url = GURL("http://www.chromium.org/shortcuts/action"); blink::Manifest::ImageResource icon; @@ -574,9 +565,7 @@ { WebApplicationShortcutsMenuItemInfo shortcut_item; std::vector<WebApplicationShortcutsMenuItemInfo::Icon> shortcut_icon_infos; - std::string shortcut_name = kShortcutItemName; - shortcut_name += base::NumberToString(1); - shortcut_item.name = base::UTF8ToUTF16(shortcut_name); + shortcut_item.name = std::u16string(kShortcutItemName) + u"1"; shortcut_item.url = GURL("http://www.chromium.org/shortcuts/action"); icon.url = kIconUrl1; icon.square_size_px = kIconSize; @@ -590,9 +579,7 @@ { WebApplicationShortcutsMenuItemInfo shortcut_item; std::vector<WebApplicationShortcutsMenuItemInfo::Icon> shortcut_icon_infos; - std::string shortcut_name = kShortcutItemName; - shortcut_name += base::NumberToString(2); - shortcut_item.name = base::UTF8ToUTF16(shortcut_name); + shortcut_item.name = std::u16string(kShortcutItemName) + u"2"; icon.url = kIconUrl1; icon.square_size_px = kIconSize; shortcut_icon_infos.push_back(icon); @@ -773,7 +760,7 @@ // Construct |shortcuts_menu_item_info| to add to // |web_app_info.shortcuts_menu_item_infos|. WebApplicationShortcutsMenuItemInfo shortcuts_menu_item_info; - shortcuts_menu_item_info.name = base::UTF8ToUTF16(kShortcutItemName); + shortcuts_menu_item_info.name = kShortcutItemName; shortcuts_menu_item_info.url = GURL("http://www.chromium.org/shortcuts/action"); // Construct |icon| to add to |shortcuts_menu_item_info.shortcut_icon_infos|.
diff --git a/chrome/browser/web_applications/components/web_app_run_on_os_login_win_unittest.cc b/chrome/browser/web_applications/components/web_app_run_on_os_login_win_unittest.cc index 4ae49adc..49eb540b 100644 --- a/chrome/browser/web_applications/components/web_app_run_on_os_login_win_unittest.cc +++ b/chrome/browser/web_applications/components/web_app_run_on_os_login_win_unittest.cc
@@ -25,7 +25,7 @@ namespace { -constexpr char kAppTitle[] = {"app"}; +constexpr char16_t kAppTitle[] = u"app"; } // namespace class WebAppRunOnOsLoginWinTest : public WebAppTest { @@ -42,7 +42,7 @@ std::unique_ptr<ShortcutInfo> GetShortcutInfo() { auto shortcut_info = std::make_unique<ShortcutInfo>(); shortcut_info->extension_id = "app-id"; - shortcut_info->title = base::UTF8ToUTF16(kAppTitle); + shortcut_info->title = kAppTitle; shortcut_info->profile_path = profile()->GetPath(); gfx::ImageFamily image_family; @@ -64,7 +64,7 @@ std::vector<base::FilePath> GetShortcuts() { return internals::FindAppShortcutsByProfileAndTitle( - GetStartupFolder(), profile()->GetPath(), base::UTF8ToUTF16(kAppTitle)); + GetStartupFolder(), profile()->GetPath(), kAppTitle); } void VerifyShortcutCreated() { @@ -116,8 +116,7 @@ VerifyShortcutCreated(); internals::UnregisterRunOnOsLogin(shortcut_info->extension_id, - profile()->GetPath(), - base::UTF8ToUTF16(kAppTitle)); + profile()->GetPath(), kAppTitle); VerifyShortcutDeleted(); }
diff --git a/chrome/browser/web_applications/extensions/BUILD.gn b/chrome/browser/web_applications/extensions/BUILD.gn index 382ad65..8951b662 100644 --- a/chrome/browser/web_applications/extensions/BUILD.gn +++ b/chrome/browser/web_applications/extensions/BUILD.gn
@@ -10,8 +10,6 @@ # TODO(crbug.com/1065748): Delete web_applications/extensions/ directory. source_set("extensions") { sources = [ - # TODO(crbug.com/1199918): Delete WebAppMigrationManager class. - "../web_app_migration_manager.cc", "bookmark_app_file_handler_manager.cc", "bookmark_app_file_handler_manager.h", "bookmark_app_finalizer_utils.cc",
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_file_handler_manager.h b/chrome/browser/web_applications/extensions/bookmark_app_file_handler_manager.h index eeb8ddc8..2a6204d2 100644 --- a/chrome/browser/web_applications/extensions/bookmark_app_file_handler_manager.h +++ b/chrome/browser/web_applications/extensions/bookmark_app_file_handler_manager.h
@@ -7,10 +7,6 @@ #include "chrome/browser/web_applications/components/file_handler_manager.h" -namespace web_app { -class WebAppMigrationManager; -} // namespace web_app - namespace extensions { class BookmarkAppFileHandlerManager : public web_app::FileHandlerManager { @@ -21,8 +17,6 @@ protected: const apps::FileHandlers* GetAllFileHandlers( const web_app::AppId& app_id) override; - - friend class web_app::WebAppMigrationManager; }; } // namespace extensions
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_provider.cc b/chrome/browser/web_applications/extensions/bookmark_app_provider.cc index 8ab80d1..bf1165aa 100644 --- a/chrome/browser/web_applications/extensions/bookmark_app_provider.cc +++ b/chrome/browser/web_applications/extensions/bookmark_app_provider.cc
@@ -13,6 +13,7 @@ #include "chrome/browser/web_applications/extensions/bookmark_app_shortcut_manager.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_provider_factory.h" +#include "extensions/browser/extension_system.h" #include "extensions/browser/extension_system_provider.h" #include "extensions/browser/extensions_browser_client.h" @@ -42,9 +43,10 @@ registry_controller_ = std::move(registry_controller); } -std::unique_ptr<InstallFinalizer> -WebAppProvider::CreateBookmarkAppInstallFinalizer(Profile* profile) { - return std::make_unique<extensions::BookmarkAppInstallFinalizer>(profile); +void WebAppProvider::WaitForExtensionSystemReady() { + extensions::ExtensionSystem::Get(profile_)->ready().Post( + FROM_HERE, base::BindOnce(&WebAppProvider::OnExtensionSystemReady, + weak_ptr_factory_.GetWeakPtr())); } void WebAppProviderFactory::DependsOnExtensionsSystem() {
diff --git a/chrome/browser/web_applications/manifest_update_manager_browsertest.cc b/chrome/browser/web_applications/manifest_update_manager_browsertest.cc index 590f3a0..ebd1690 100644 --- a/chrome/browser/web_applications/manifest_update_manager_browsertest.cc +++ b/chrome/browser/web_applications/manifest_update_manager_browsertest.cc
@@ -97,6 +97,7 @@ )"; constexpr char kAnotherShortcutsItemName[] = "Timeline"; +constexpr char16_t kAnotherShortcutsItemName16[] = u"Timeline"; constexpr char kAnotherShortcutsItemUrl[] = "/shortcut"; constexpr char kAnotherShortcutsItemShortName[] = "H"; constexpr char kAnotherShortcutsItemDescription[] = "Navigate home"; @@ -1765,7 +1766,7 @@ ManifestUpdateResult::kAppUpdated, 1); EXPECT_EQ( GetProvider().registrar().GetAppShortcutsMenuItemInfos(app_id)[0].name, - base::UTF8ToUTF16(kAnotherShortcutsItemName)); + kAnotherShortcutsItemName16); } IN_PROC_BROWSER_TEST_F(ManifestUpdateManagerBrowserTestWithShortcutsMenu,
diff --git a/chrome/browser/web_applications/preinstalled_web_app_manager.cc b/chrome/browser/web_applications/preinstalled_web_app_manager.cc index 66ca1779..208a2c6 100644 --- a/chrome/browser/web_applications/preinstalled_web_app_manager.cc +++ b/chrome/browser/web_applications/preinstalled_web_app_manager.cc
@@ -421,6 +421,8 @@ ALLOW_UNUSED_LOCAL(options); DCHECK_EQ(options.install_source, ExternalInstallSource::kExternalDefault); + options.require_manifest = true; + #if !BUILDFLAG(IS_CHROMEOS_ASH) if (!g_bypass_offline_manifest_requirement_for_testing_) { // Non-Chrome OS platforms are not permitted to fetch the web app install @@ -436,7 +438,7 @@ options.add_to_management = false; options.add_to_desktop = false; options.add_to_quick_launch_bar = false; -#endif // BUILDFLAG(IS_CHROMEOS_ASH) +#endif // !BUILDFLAG(IS_CHROMEOS_ASH) } // TODO(crbug.com/1175196): Move this constant into some shared constants.h
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/BUILD.gn b/chrome/browser/web_applications/preinstalled_web_apps/BUILD.gn index 053e3cf..a816327 100644 --- a/chrome/browser/web_applications/preinstalled_web_apps/BUILD.gn +++ b/chrome/browser/web_applications/preinstalled_web_apps/BUILD.gn
@@ -46,6 +46,8 @@ "google_calendar.h", "google_chat.cc", "google_chat.h", + "google_meet.cc", + "google_meet.h", ] }
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/google_chat.cc b/chrome/browser/web_applications/preinstalled_web_apps/google_chat.cc index 78ec1b67..e64d1a46 100644 --- a/chrome/browser/web_applications/preinstalled_web_apps/google_chat.cc +++ b/chrome/browser/web_applications/preinstalled_web_apps/google_chat.cc
@@ -17,9 +17,8 @@ options.user_type_allowlist = {"unmanaged", "managed", "child"}; options.gate_on_feature = kDefaultChatWebApp.name; - options.add_to_quick_launch_bar = false; - options.add_to_desktop = false; options.only_for_new_users = true; + options.add_to_quick_launch_bar = false; return options; }
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/google_meet.cc b/chrome/browser/web_applications/preinstalled_web_apps/google_meet.cc new file mode 100644 index 0000000..d27f207 --- /dev/null +++ b/chrome/browser/web_applications/preinstalled_web_apps/google_meet.cc
@@ -0,0 +1,26 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/web_applications/preinstalled_web_apps/google_meet.h" + +#include "chrome/browser/web_applications/components/preinstalled_app_install_features.h" + +namespace web_app { + +ExternalInstallOptions GetConfigForGoogleMeet() { + ExternalInstallOptions options( + /*install_url=*/GURL( + "https://meet.google.com/download/webapp?usp=chrome_default"), + /*user_display_mode=*/DisplayMode::kStandalone, + /*install_source=*/ExternalInstallSource::kExternalDefault); + + options.user_type_allowlist = {"unmanaged", "managed", "child"}; + options.gate_on_feature = kDefaultMeetWebApp.name; + options.only_for_new_users = true; + options.add_to_quick_launch_bar = false; + + return options; +} + +} // namespace web_app
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/google_meet.h b/chrome/browser/web_applications/preinstalled_web_apps/google_meet.h new file mode 100644 index 0000000..e4bdbd1 --- /dev/null +++ b/chrome/browser/web_applications/preinstalled_web_apps/google_meet.h
@@ -0,0 +1,16 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_GOOGLE_MEET_H_ +#define CHROME_BROWSER_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_GOOGLE_MEET_H_ + +#include "chrome/browser/web_applications/components/external_install_options.h" + +namespace web_app { + +ExternalInstallOptions GetConfigForGoogleMeet(); + +} // namespace web_app + +#endif // CHROME_BROWSER_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_GOOGLE_MEET_H_
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.cc b/chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.cc index d8c5e6e..3af851b3 100644 --- a/chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.cc +++ b/chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.cc
@@ -24,6 +24,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/browser/web_applications/preinstalled_web_apps/google_calendar.h" #include "chrome/browser/web_applications/preinstalled_web_apps/google_chat.h" +#include "chrome/browser/web_applications/preinstalled_web_apps/google_meet.h" #endif // BUILDFLAG(IS_CHROMEOS_ASH) #endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) @@ -69,6 +70,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) GetConfigForGoogleCalendar(), GetConfigForGoogleChat(), + GetConfigForGoogleMeet(), #endif // BUILDFLAG(IS_CHROMEOS_ASH) // clang-format on };
diff --git a/chrome/browser/web_applications/preinstalled_web_apps_browsertest.cc b/chrome/browser/web_applications/preinstalled_web_apps_browsertest.cc index 2bb8d17d..8ab718a 100644 --- a/chrome/browser/web_applications/preinstalled_web_apps_browsertest.cc +++ b/chrome/browser/web_applications/preinstalled_web_apps_browsertest.cc
@@ -97,6 +97,9 @@ { "https://mail.google.com/chat/download?usp=chrome_default", }, + { + "https://meet.google.com/download/webapp?usp=chrome_default", + }, #endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) #endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) };
diff --git a/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_unittest.cc b/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_unittest.cc index 2b5ed6e..9bcab0e 100644 --- a/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_unittest.cc +++ b/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_unittest.cc
@@ -132,8 +132,8 @@ std::make_unique<ExternallyInstalledWebAppPrefs>(profile()->GetPrefs()); icon_manager_ = std::make_unique<WebAppIconManager>( profile(), controller().registrar(), std::make_unique<TestFileUtils>()); - install_finalizer_ = std::make_unique<WebAppInstallFinalizer>( - profile(), &icon_manager(), /*legacy_finalizer=*/nullptr); + install_finalizer_ = + std::make_unique<WebAppInstallFinalizer>(profile(), &icon_manager()); install_manager_ = std::make_unique<WebAppInstallManager>(profile()); test_externally_managed_app_manager_impl_ = std::make_unique<TestExternallyManagedAppManagerImpl>(profile());
diff --git a/chrome/browser/web_applications/test/test_web_app_provider.cc b/chrome/browser/web_applications/test/test_web_app_provider.cc index 030b1ed..6890c84 100644 --- a/chrome/browser/web_applications/test/test_web_app_provider.cc +++ b/chrome/browser/web_applications/test/test_web_app_provider.cc
@@ -18,7 +18,6 @@ #include "chrome/browser/web_applications/system_web_apps/system_web_app_manager.h" #include "chrome/browser/web_applications/system_web_apps/test/test_system_web_app_manager.h" #include "chrome/browser/web_applications/web_app_install_manager.h" -#include "chrome/browser/web_applications/web_app_migration_manager.h" #include "chrome/browser/web_applications/web_app_provider_factory.h" namespace web_app { @@ -62,12 +61,6 @@ run_subsystem_startup_tasks_ = run_subsystem_startup_tasks; } -void TestWebAppProvider::SetMigrationManager( - std::unique_ptr<WebAppMigrationManager> migration_manager) { - CheckNotStarted(); - migration_manager_ = std::move(migration_manager); -} - void TestWebAppProvider::SetRegistrar(std::unique_ptr<AppRegistrar> registrar) { CheckNotStarted(); registrar_ = std::move(registrar); @@ -122,9 +115,9 @@ os_integration_manager_ = std::move(os_integration_manager); } -void TestWebAppProvider::DisableMigrationManager() { +void TestWebAppProvider::SkipAwaitingExtensionSystem() { CheckNotStarted(); - migration_manager_ = nullptr; + skip_awaiting_extension_system_ = true; } void TestWebAppProvider::CheckNotStarted() const {
diff --git a/chrome/browser/web_applications/test/test_web_app_provider.h b/chrome/browser/web_applications/test/test_web_app_provider.h index 0d30fe8..638d9e5 100644 --- a/chrome/browser/web_applications/test/test_web_app_provider.h +++ b/chrome/browser/web_applications/test/test_web_app_provider.h
@@ -20,7 +20,6 @@ namespace web_app { -class WebAppMigrationManager; class AppRegistrar; class OsIntegrationManager; class InstallFinalizer; @@ -53,8 +52,6 @@ // if it's a part of TestingProfile (see BuildDefault() method above). void SetRunSubsystemStartupTasks(bool run_subsystem_startup_tasks); - void SetMigrationManager( - std::unique_ptr<WebAppMigrationManager> migration_manager); void SetRegistrar(std::unique_ptr<AppRegistrar> registrar); void SetRegistryController(std::unique_ptr<AppRegistryController> controller); void SetOsIntegrationManager( @@ -69,7 +66,7 @@ std::unique_ptr<SystemWebAppManager> system_web_app_manager); void SetWebAppPolicyManager( std::unique_ptr<WebAppPolicyManager> web_app_policy_manager); - void DisableMigrationManager(); + void SkipAwaitingExtensionSystem(); private: void CheckNotStarted() const;
diff --git a/chrome/browser/web_applications/web_app_install_finalizer.cc b/chrome/browser/web_applications/web_app_install_finalizer.cc index e88d7ac..47c3bd9 100644 --- a/chrome/browser/web_applications/web_app_install_finalizer.cc +++ b/chrome/browser/web_applications/web_app_install_finalizer.cc
@@ -139,13 +139,9 @@ } // namespace -WebAppInstallFinalizer::WebAppInstallFinalizer( - Profile* profile, - WebAppIconManager* icon_manager, - std::unique_ptr<InstallFinalizer> legacy_finalizer) - : legacy_finalizer_(std::move(legacy_finalizer)), - profile_(profile), - icon_manager_(icon_manager) {} +WebAppInstallFinalizer::WebAppInstallFinalizer(Profile* profile, + WebAppIconManager* icon_manager) + : profile_(profile), icon_manager_(icon_manager) {} WebAppInstallFinalizer::~WebAppInstallFinalizer() = default; @@ -313,7 +309,6 @@ const WebApp* app = GetWebAppRegistrar().GetAppById(app_id); DCHECK(app); DCHECK(app->CanUserUninstallWebApp()); - const bool is_synced = app->IsSynced(); if (app->IsPreinstalledApp()) { UpdateBoolWebAppPref(profile_->GetPrefs(), app_id, @@ -328,11 +323,6 @@ // should separate UninstallWebAppFromSyncByUser from // UninstallWebApp. UninstallWebAppInternal(app_id, webapp_uninstall_source, std::move(callback)); - - // Uninstall shadow bookmark app from this device and from the sync server. - if (legacy_finalizer_ && is_synced) - legacy_finalizer_->UninstallWebApp(app_id, webapp_uninstall_source, - base::DoNothing()); } bool WebAppInstallFinalizer::WasPreinstalledWebAppUninstalled( @@ -371,10 +361,6 @@ web_app_info)); } -void WebAppInstallFinalizer::RemoveLegacyInstallFinalizerForTesting() { - legacy_finalizer_ = nullptr; -} - void WebAppInstallFinalizer::Start() { DCHECK(!started_); started_ = true;
diff --git a/chrome/browser/web_applications/web_app_install_finalizer.h b/chrome/browser/web_applications/web_app_install_finalizer.h index 9ae54b8..5a57c8c 100644 --- a/chrome/browser/web_applications/web_app_install_finalizer.h +++ b/chrome/browser/web_applications/web_app_install_finalizer.h
@@ -30,10 +30,7 @@ class WebAppInstallFinalizer final : public InstallFinalizer { public: - // |legacy_finalizer| can be nullptr (optional argument). - WebAppInstallFinalizer(Profile* profile, - WebAppIconManager* icon_manager, - std::unique_ptr<InstallFinalizer> legacy_finalizer); + WebAppInstallFinalizer(Profile* profile, WebAppIconManager* icon_manager); WebAppInstallFinalizer(const WebAppInstallFinalizer&) = delete; WebAppInstallFinalizer& operator=(const WebAppInstallFinalizer&) = delete; ~WebAppInstallFinalizer() override; @@ -58,7 +55,6 @@ UninstallWebAppCallback callback) override; bool CanUserUninstallWebApp(const AppId& app_id) const override; bool WasPreinstalledWebAppUninstalled(const AppId& app_id) const override; - void RemoveLegacyInstallFinalizerForTesting() override; void Start() override; void Shutdown() override; @@ -129,9 +125,6 @@ WebAppRegistrar& GetWebAppRegistrar() const; - // Used for legacy Bookmark Apps. - std::unique_ptr<InstallFinalizer> legacy_finalizer_; - Profile* const profile_; WebAppIconManager* const icon_manager_; bool started_ = false;
diff --git a/chrome/browser/web_applications/web_app_install_manager_unittest.cc b/chrome/browser/web_applications/web_app_install_manager_unittest.cc index 94926de..1af667b 100644 --- a/chrome/browser/web_applications/web_app_install_manager_unittest.cc +++ b/chrome/browser/web_applications/web_app_install_manager_unittest.cc
@@ -152,7 +152,7 @@ std::move(file_utils)); install_finalizer_ = std::make_unique<WebAppInstallFinalizer>( - profile(), icon_manager_.get(), /*legacy_finalizer=*/nullptr); + profile(), icon_manager_.get()); install_manager_ = std::make_unique<WebAppInstallManager>(profile()); install_manager_->SetSubsystems(®istrar(),
diff --git a/chrome/browser/web_applications/web_app_install_task_unittest.cc b/chrome/browser/web_applications/web_app_install_task_unittest.cc index 656e0109..ce1024c9d 100644 --- a/chrome/browser/web_applications/web_app_install_task_unittest.cc +++ b/chrome/browser/web_applications/web_app_install_task_unittest.cc
@@ -103,9 +103,8 @@ ui_manager_ = std::make_unique<TestWebAppUiManager>(); - install_finalizer_ = - std::make_unique<WebAppInstallFinalizer>(profile(), icon_manager_.get(), - /*legacy_finalizer=*/nullptr); + install_finalizer_ = std::make_unique<WebAppInstallFinalizer>( + profile(), icon_manager_.get()); install_finalizer_->SetSubsystems(®istrar(), ui_manager_.get(), &test_registry_controller_->sync_bridge(),
diff --git a/chrome/browser/web_applications/web_app_migration_manager.cc b/chrome/browser/web_applications/web_app_migration_manager.cc deleted file mode 100644 index f27efe6..0000000 --- a/chrome/browser/web_applications/web_app_migration_manager.cc +++ /dev/null
@@ -1,348 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/web_applications/web_app_migration_manager.h" - -#include <map> -#include <utility> - -#include "base/bind.h" -#include "base/callback.h" -#include "base/containers/contains.h" -#include "base/feature_list.h" -#include "base/logging.h" -#include "base/stl_util.h" -#include "base/threading/sequenced_task_runner_handle.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/web_applications/components/web_app_chromeos_data.h" -#include "chrome/browser/web_applications/components/web_app_constants.h" -#include "chrome/browser/web_applications/components/web_app_helpers.h" -#include "chrome/browser/web_applications/components/web_app_ui_manager.h" -#include "chrome/browser/web_applications/components/web_app_utils.h" -#include "chrome/browser/web_applications/extensions/bookmark_app_file_handler_manager.h" -#include "chrome/browser/web_applications/extensions/bookmark_app_icon_manager.h" -#include "chrome/browser/web_applications/extensions/bookmark_app_registrar.h" -#include "chrome/browser/web_applications/extensions/bookmark_app_registry_controller.h" -#include "chrome/browser/web_applications/web_app.h" -#include "chrome/browser/web_applications/web_app_database.h" -#include "chrome/browser/web_applications/web_app_database_factory.h" -#include "chrome/browser/web_applications/web_app_icon_manager.h" -#include "chrome/browser/web_applications/web_app_registry_update.h" -#include "chrome/common/chrome_features.h" -#include "components/services/app_service/public/cpp/file_handler.h" -#include "components/sync/model/metadata_batch.h" -#include "components/sync/model/metadata_change_list.h" -#include "components/sync/model/model_error.h" -#include "components/sync/model/model_type_store.h" - -namespace web_app { - -WebAppMigrationManager::WebAppMigrationManager( - Profile* profile, - AbstractWebAppDatabaseFactory* database_factory, - WebAppIconManager* web_app_icon_manager, - OsIntegrationManager* os_integration_manager) - : bookmark_app_registrar_( - std::make_unique<extensions::BookmarkAppRegistrar>(profile)), - bookmark_app_registry_controller_( - std::make_unique<extensions::BookmarkAppRegistryController>( - profile, - bookmark_app_registrar_.get())), - bookmark_app_icon_manager_( - std::make_unique<extensions::BookmarkAppIconManager>(profile)), - bookmark_app_file_handler_manager_( - std::make_unique<extensions::BookmarkAppFileHandlerManager>(profile)), - database_factory_(database_factory), - web_app_icon_manager_(web_app_icon_manager) { - database_ = std::make_unique<WebAppDatabase>( - database_factory_, - base::BindRepeating(&WebAppMigrationManager::ReportDatabaseError, - base::Unretained(this))); - bookmark_app_file_handler_manager_->SetSubsystems( - bookmark_app_registrar_.get()); - bookmark_app_registrar_->SetSubsystems(os_integration_manager); -} - -WebAppMigrationManager::~WebAppMigrationManager() = default; - -void WebAppMigrationManager::StartDatabaseMigration( - MigrationCompletedCallback migration_completed_callback) { - DCHECK(database_); - migration_completed_callback_ = std::move(migration_completed_callback); - - // Open LevelDB first. The extension system behind - // BookmarkAppRegistryController is already started in parallel. - database_->OpenDatabase( - base::BindOnce(&WebAppMigrationManager::OnWebAppDatabaseOpened, - weak_ptr_factory_.GetWeakPtr())); -} - -void WebAppMigrationManager::OnWebAppDatabaseOpened( - Registry web_app_registry, - std::unique_ptr<syncer::MetadataBatch> metadata_batch) { - if (metadata_batch->GetModelTypeState().initial_sync_done()) { - // If initial sync is done, then WebAppSyncBridge::MergeSyncData was already - // called once. All the migrated entities are already listed in sync - // metadata. Any additional apps from this point in time should be installed - // via WebAppSyncBridge::CommitUpdate() "as if" a user installs them. - ScheduleDestructDatabaseAndCallCallback(/*success=*/true); - return; - } - - // Wait for the Extensions System to be ready. - bookmark_app_registry_controller_->Init(base::BindOnce( - &WebAppMigrationManager::OnBookmarkAppRegistryReady, - weak_ptr_factory_.GetWeakPtr(), std::move(web_app_registry))); -} - -void WebAppMigrationManager::OnBookmarkAppRegistryReady( - Registry web_app_registry) { - bookmark_app_ids_ = bookmark_app_registrar_->GetAppIds(); - - // Remove bookmark app ids already listed in the web app registry. - base::EraseIf(bookmark_app_ids_, [&web_app_registry](const AppId& app_id) { - return base::Contains(web_app_registry, app_id); - }); - - // Migrate icons first, the registry data (the LevelDB transaction) last. - next_app_id_iterator_ = bookmark_app_ids_.begin(); - MigrateNextBookmarkAppIcons(); -} - -void WebAppMigrationManager::MigrateNextBookmarkAppIcons() { - AppId app_id; - do { - if (next_app_id_iterator_ == bookmark_app_ids_.end()) { - MigrateBookmarkAppsRegistry(); - return; - } - - app_id = *next_app_id_iterator_; - ++next_app_id_iterator_; - } while (!CanMigrateBookmarkApp(app_id)); - - bookmark_app_icon_manager_->ReadAllIcons( - app_id, base::BindOnce(&WebAppMigrationManager::OnBookmarkAppIconsRead, - weak_ptr_factory_.GetWeakPtr(), app_id)); -} - -void WebAppMigrationManager::OnBookmarkAppIconsRead(const AppId& app_id, - IconBitmaps icon_bitmaps) { - if (icon_bitmaps.empty()) { - DLOG(ERROR) << "Read bookmark app icons failed."; - MigrateNextBookmarkAppIcons(); - return; - } - - web_app_icon_manager_->WriteData( - app_id, std::move(icon_bitmaps), - base::BindOnce(&WebAppMigrationManager::OnWebAppIconsWritten, - weak_ptr_factory_.GetWeakPtr(), app_id)); -} - -void WebAppMigrationManager::OnWebAppIconsWritten(const AppId& app_id, - bool success) { - if (!success) - DLOG(ERROR) << "Write web app icons failed."; - if (base::FeatureList::IsEnabled( - features::kDesktopPWAsAppIconShortcutsMenu)) { - bookmark_app_icon_manager_->ReadAllShortcutsMenuIcons( - app_id, - base::BindOnce( - &WebAppMigrationManager::OnBookmarkAppShortcutsMenuIconsRead, - weak_ptr_factory_.GetWeakPtr(), app_id)); - } else { - MigrateNextBookmarkAppIcons(); - } -} - -void WebAppMigrationManager::OnBookmarkAppShortcutsMenuIconsRead( - const AppId& app_id, - ShortcutsMenuIconBitmaps shortcuts_menu_icon_bitmaps) { - web_app_icon_manager_->WriteShortcutsMenuIconsData( - app_id, std::move(shortcuts_menu_icon_bitmaps), - base::BindOnce(&WebAppMigrationManager::OnWebAppShortcutsMenuIconsWritten, - weak_ptr_factory_.GetWeakPtr())); -} - -void WebAppMigrationManager::OnWebAppShortcutsMenuIconsWritten(bool success) { - if (!success) - DLOG(ERROR) << "Write web app shortcuts menu icons failed."; - MigrateNextBookmarkAppIcons(); -} - -void WebAppMigrationManager::MigrateBookmarkAppInstallSource( - const AppId& app_id, - WebApp* web_app) { - bool is_arc = bookmark_app_registrar_->HasExternalAppWithInstallSource( - app_id, ExternalInstallSource::kArc); - - bool is_policy = bookmark_app_registrar_->HasExternalAppWithInstallSource( - app_id, ExternalInstallSource::kExternalPolicy); - - bool is_default = bookmark_app_registrar_->HasExternalAppWithInstallSource( - app_id, ExternalInstallSource::kInternalDefault) || - bookmark_app_registrar_->HasExternalAppWithInstallSource( - app_id, ExternalInstallSource::kExternalDefault); - - bool is_system = bookmark_app_registrar_->HasExternalAppWithInstallSource( - app_id, ExternalInstallSource::kSystemInstalled); - - if (is_default) - web_app->AddSource(Source::kDefault); - - if (is_policy) - web_app->AddSource(Source::kPolicy); - - if (is_system) - web_app->AddSource(Source::kSystem); - - if (is_arc) - web_app->AddSource(Source::kWebAppStore); - - if (!bookmark_app_registrar_->HasExternalApp(app_id)) - web_app->AddSource(Source::kSync); - - DCHECK(web_app->HasAnySources()); -} - -bool WebAppMigrationManager::CanMigrateBookmarkApp(const AppId& app_id) const { - if (!bookmark_app_registrar_->IsInstalled(app_id)) - return false; - - // SystemWebAppManager will re-install these. - if (bookmark_app_registrar_->HasExternalAppWithInstallSource( - app_id, ExternalInstallSource::kSystemInstalled)) { - return false; - } - - GURL start_url = bookmark_app_registrar_->GetAppStartUrl(app_id); - return GenerateAppIdFromURL(start_url) == app_id; -} - -std::unique_ptr<WebApp> WebAppMigrationManager::MigrateBookmarkApp( - const AppId& app_id) { - DCHECK(CanMigrateBookmarkApp(app_id)); - - auto web_app = std::make_unique<WebApp>(app_id); - - web_app->SetName(bookmark_app_registrar_->GetAppShortName(app_id)); - web_app->SetDescription(bookmark_app_registrar_->GetAppDescription(app_id)); - web_app->SetStartUrl(bookmark_app_registrar_->GetAppStartUrl(app_id)); - web_app->SetLastLaunchTime( - bookmark_app_registrar_->GetAppLastLaunchTime(app_id)); - web_app->SetInstallTime(bookmark_app_registrar_->GetAppInstallTime(app_id)); - base::Optional<GURL> scope = bookmark_app_registrar_->GetAppScope(app_id); - if (scope) - web_app->SetScope(*scope); - - web_app->SetThemeColor(bookmark_app_registrar_->GetAppThemeColor(app_id)); - web_app->SetDisplayMode(bookmark_app_registrar_->GetAppDisplayMode(app_id)); - - DisplayMode user_display_mode = - bookmark_app_registrar_->GetAppUserDisplayModeForMigration(app_id); - if (user_display_mode != DisplayMode::kUndefined) - web_app->SetUserDisplayMode(user_display_mode); - - web_app->SetIsLocallyInstalled( - bookmark_app_registrar_->IsLocallyInstalled(app_id)); - web_app->SetIconInfos(bookmark_app_registrar_->GetAppIconInfos(app_id)); - web_app->SetDownloadedIconSizes( - IconPurpose::ANY, - bookmark_app_registrar_->GetAppDownloadedIconSizesAny(app_id)); - // Migrated bookmark apps will have no IconPurpose::MASKABLE icons downloaded. - - if (base::FeatureList::IsEnabled( - features::kDesktopPWAsAppIconShortcutsMenu)) { - web_app->SetShortcutsMenuItemInfos( - bookmark_app_registrar_->GetAppShortcutsMenuItemInfos(app_id)); - web_app->SetDownloadedShortcutsMenuIconsSizes( - bookmark_app_registrar_->GetAppDownloadedShortcutsMenuIconsSizes( - app_id)); - } - - web_app->SetUserPageOrdinal( - bookmark_app_registrar_->GetUserPageOrdinal(app_id)); - web_app->SetUserLaunchOrdinal( - bookmark_app_registrar_->GetUserLaunchOrdinal(app_id)); - - WebApp::SyncFallbackData sync_fallback_data; - sync_fallback_data.name = bookmark_app_registrar_->GetAppShortName(app_id); - sync_fallback_data.theme_color = - bookmark_app_registrar_->GetAppThemeColor(app_id); - // Avoid using derived scope as we are transferring raw data. - sync_fallback_data.scope = - bookmark_app_registrar_->GetAppScopeInternal(app_id).value_or(GURL()); - sync_fallback_data.icon_infos = - bookmark_app_registrar_->GetAppIconInfos(app_id); - web_app->SetSyncFallbackData(std::move(sync_fallback_data)); - - const apps::FileHandlers* file_handlers = - bookmark_app_file_handler_manager_->GetAllFileHandlers(app_id); - if (file_handlers) - web_app->SetFileHandlers(*file_handlers); - - MigrateBookmarkAppInstallSource(app_id, web_app.get()); - - return web_app; -} - -void WebAppMigrationManager::MigrateBookmarkAppsRegistry() { - DCHECK(database_); - - if (bookmark_app_ids_.empty()) { - ScheduleDestructDatabaseAndCallCallback(/*success=*/true); - return; - } - - std::unique_ptr<syncer::MetadataChangeList> metadata_change_list = - syncer::ModelTypeStore::WriteBatch::CreateMetadataChangeList(); - - RegistryUpdateData update_data; - update_data.apps_to_create.reserve(bookmark_app_ids_.size()); - - for (const AppId& app_id : bookmark_app_ids_) { - if (CanMigrateBookmarkApp(app_id)) { - std::unique_ptr<WebApp> web_app = MigrateBookmarkApp(app_id); - update_data.apps_to_create.push_back(std::move(web_app)); - } - } - - database_->Write( - update_data, std::move(metadata_change_list), - base::BindOnce(&WebAppMigrationManager::OnWebAppRegistryWritten, - weak_ptr_factory_.GetWeakPtr())); -} - -void WebAppMigrationManager::OnWebAppRegistryWritten(bool success) { - if (!success) - DLOG(ERROR) << "Web app registry commit failed."; - - ScheduleDestructDatabaseAndCallCallback(success); -} - -void WebAppMigrationManager::ReportDatabaseError( - const syncer::ModelError& error) { - DLOG(ERROR) << "Web app database error. " << error.ToString(); - - ScheduleDestructDatabaseAndCallCallback(/*success=*/false); -} - -void WebAppMigrationManager::ScheduleDestructDatabaseAndCallCallback( - bool success) { - base::SequencedTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::BindOnce(&WebAppMigrationManager::DestructDatabaseAndCallCallback, - weak_ptr_factory_.GetWeakPtr(), success)); -} - -void WebAppMigrationManager::DestructDatabaseAndCallCallback(bool success) { - // Close the database. - database_ = nullptr; - - if (migration_completed_callback_) - std::move(migration_completed_callback_).Run(success); -} - -} // namespace web_app
diff --git a/chrome/browser/web_applications/web_app_migration_manager.h b/chrome/browser/web_applications/web_app_migration_manager.h deleted file mode 100644 index 90fab35..0000000 --- a/chrome/browser/web_applications/web_app_migration_manager.h +++ /dev/null
@@ -1,108 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MIGRATION_MANAGER_H_ -#define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MIGRATION_MANAGER_H_ - -#include <map> -#include <memory> -#include <vector> - -#include "base/callback_forward.h" -#include "base/memory/weak_ptr.h" -#include "chrome/browser/web_applications/components/app_icon_manager.h" -#include "chrome/browser/web_applications/components/os_integration_manager.h" -#include "chrome/browser/web_applications/components/web_app_id.h" -#include "chrome/browser/web_applications/components/web_application_info.h" -#include "chrome/browser/web_applications/web_app_registrar.h" - -namespace syncer { -class ModelError; -class MetadataBatch; -} // namespace syncer - -namespace extensions { -class BookmarkAppRegistrar; -class BookmarkAppRegistryController; -class BookmarkAppIconManager; -class BookmarkAppFileHandlerManager; -} // namespace extensions - -namespace web_app { - -class AbstractWebAppDatabaseFactory; -class WebAppDatabase; -class WebAppIconManager; - -// Migrates all bookmark apps to new web apps registry. -class WebAppMigrationManager { - public: - WebAppMigrationManager(Profile* profile, - AbstractWebAppDatabaseFactory* database_factory, - WebAppIconManager* web_app_icon_manager, - OsIntegrationManager* os_integration_manager); - WebAppMigrationManager(const WebAppMigrationManager&) = delete; - WebAppMigrationManager& operator=(const WebAppMigrationManager&) = delete; - ~WebAppMigrationManager(); - - using MigrationCompletedCallback = base::OnceCallback<void(bool success)>; - void StartDatabaseMigration( - MigrationCompletedCallback migration_completed_callback); - - private: - void OnWebAppDatabaseOpened( - Registry web_app_registry, - std::unique_ptr<syncer::MetadataBatch> metadata_batch); - void OnBookmarkAppRegistryReady(Registry web_app_registry); - - // Migrates next bookmark app in |bookmark_app_ids_| queue or starts - // the registry migration if the queue is empty. - void MigrateNextBookmarkAppIcons(); - void OnBookmarkAppIconsRead(const AppId& app_id, IconBitmaps icon_bitmaps); - void OnWebAppIconsWritten(const AppId& app_id, bool success); - void OnBookmarkAppShortcutsMenuIconsRead( - const AppId& app_id, - ShortcutsMenuIconBitmaps shortcuts_menu_icon_bitmaps); - void OnWebAppShortcutsMenuIconsWritten(bool success); - - void MigrateBookmarkAppInstallSource(const AppId& app_id, WebApp* web_app); - bool CanMigrateBookmarkApp(const AppId& app_id) const; - std::unique_ptr<WebApp> MigrateBookmarkApp(const AppId& app_id); - void MigrateBookmarkAppsRegistry(); - - void OnWebAppRegistryWritten(bool success); - - void ReportDatabaseError(const syncer::ModelError& error); - - // We don't want to destruct database_ object immediately in callbacks from - // WebAppDatabase. This would be a violation of the caller/callee contract. - // We should use PostTask instead. - void ScheduleDestructDatabaseAndCallCallback(bool success); - void DestructDatabaseAndCallCallback(bool success); - - std::unique_ptr<extensions::BookmarkAppRegistrar> bookmark_app_registrar_; - std::unique_ptr<extensions::BookmarkAppRegistryController> - bookmark_app_registry_controller_; - std::unique_ptr<extensions::BookmarkAppIconManager> - bookmark_app_icon_manager_; - std::unique_ptr<extensions::BookmarkAppFileHandlerManager> - bookmark_app_file_handler_manager_; - - AbstractWebAppDatabaseFactory* const database_factory_; - WebAppIconManager* const web_app_icon_manager_; - std::unique_ptr<WebAppDatabase> database_; - - // A queue of bookmark app ids to be migrated. - std::vector<AppId> bookmark_app_ids_; - // Current bookmark app id which icons are being migrated. - std::vector<AppId>::const_iterator next_app_id_iterator_; - - MigrationCompletedCallback migration_completed_callback_; - - base::WeakPtrFactory<WebAppMigrationManager> weak_ptr_factory_{this}; -}; - -} // namespace web_app - -#endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MIGRATION_MANAGER_H_
diff --git a/chrome/browser/web_applications/web_app_migration_manager_browsertest.cc b/chrome/browser/web_applications/web_app_migration_manager_browsertest.cc deleted file mode 100644 index 0a71a81..0000000 --- a/chrome/browser/web_applications/web_app_migration_manager_browsertest.cc +++ /dev/null
@@ -1,388 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/web_applications/web_app_migration_manager.h" - -#include "base/containers/contains.h" -#include "base/files/file_util.h" -#include "base/memory/scoped_refptr.h" -#include "base/path_service.h" -#include "base/run_loop.h" -#include "base/strings/strcat.h" -#include "base/strings/utf_string_conversions.h" -#include "base/test/bind.h" -#include "base/threading/thread_restrictions.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_dialogs.h" -#include "chrome/browser/ui/tabs/tab_strip_model.h" -#include "chrome/browser/ui/web_applications/test/ssl_test_utils.h" -#include "chrome/browser/ui/web_applications/web_app_dialog_manager.h" -#include "chrome/browser/ui/web_applications/web_app_dialog_utils.h" -#include "chrome/browser/ui/web_applications/web_app_ui_manager_impl.h" -#include "chrome/browser/web_applications/components/app_icon_manager.h" -#include "chrome/browser/web_applications/components/app_registrar.h" -#include "chrome/browser/web_applications/components/os_integration_manager.h" -#include "chrome/browser/web_applications/components/web_app_chromeos_data.h" -#include "chrome/browser/web_applications/components/web_app_constants.h" -#include "chrome/browser/web_applications/components/web_app_helpers.h" -#include "chrome/browser/web_applications/components/web_app_id.h" -#include "chrome/browser/web_applications/components/web_app_utils.h" -#include "chrome/browser/web_applications/web_app.h" -#include "chrome/browser/web_applications/web_app_provider.h" -#include "chrome/common/chrome_features.h" -#include "chrome/common/chrome_switches.h" -#include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/ui_test_utils.h" -#include "components/webapps/browser/installable/installable_metrics.h" -#include "content/public/test/browser_test.h" -#include "content/public/test/test_launcher.h" -#include "content/public/test/url_loader_interceptor.h" -#include "extensions/browser/extension_dialog_auto_confirm.h" -#include "extensions/browser/extension_registry.h" -#include "extensions/browser/test_extension_registry_observer.h" -#include "extensions/common/extension.h" -#include "net/ssl/ssl_info.h" - -namespace web_app { - -namespace { - -constexpr char kBaseDataDir[] = "chrome/test/data/banners"; - -// start_url in manifest.json matches navigation url for the simple -// manifest_test_page.html. -constexpr char kSimpleManifestStartUrl[] = - "https://example.org/manifest_test_page.html"; - -constexpr char kManifestWithShortcutsMenuInstallUrl[] = - "https://example.org/manifest_test_page.html" - "?manifest=manifest_with_shortcuts.json"; - -constexpr char kManifestWithShortcutsMenuStartUrl[] = - "https://example.org/start"; - -// Performs blocking IO operations. -base::FilePath GetDataFilePath(const base::FilePath& relative_path, - bool* path_exists) { - base::ScopedAllowBlockingForTesting allow_io; - - base::FilePath root_path; - CHECK(base::PathService::Get(base::DIR_SOURCE_ROOT, &root_path)); - base::FilePath path = root_path.Append(relative_path); - *path_exists = base::PathExists(path); - return path; -} - -} // namespace - -class WebAppMigrationManagerBrowserTest : public InProcessBrowserTest { - public: - WebAppMigrationManagerBrowserTest() { - if (content::IsPreTest()) { - scoped_feature_list_.InitAndDisableFeature( - features::kDesktopPWAsWithoutExtensions); - } else { - scoped_feature_list_.InitAndEnableFeature( - features::kDesktopPWAsWithoutExtensions); - } - } - - ~WebAppMigrationManagerBrowserTest() override = default; - - WebAppMigrationManagerBrowserTest(const WebAppMigrationManagerBrowserTest&) = - delete; - WebAppMigrationManagerBrowserTest& operator=( - const WebAppMigrationManagerBrowserTest&) = delete; - - void SetUpOnMainThread() override { - InProcessBrowserTest::SetUpOnMainThread(); - os_hooks_suppress_ = - OsIntegrationManager::ScopedSuppressOsHooksForTesting(); - - // We use a URLLoaderInterceptor, rather than the EmbeddedTestServer, since - // a stable app_id across tests requires stable origin, whereas - // EmbeddedTestServer serves content on a random port. - url_loader_interceptor_ = - std::make_unique<content::URLLoaderInterceptor>(base::BindRepeating( - [](content::URLLoaderInterceptor::RequestParams* params) -> bool { - std::string relative_request = base::StrCat( - {kBaseDataDir, params->url_request.url.path_piece()}); - base::FilePath relative_path = - base::FilePath().AppendASCII(relative_request); - - bool path_exists = false; - base::FilePath path = - GetDataFilePath(relative_path, &path_exists); - if (!path_exists) - return /*intercepted=*/false; - - // Provide fake SSLInfo to avoid NOT_FROM_SECURE_ORIGIN error in - // InstallableManager::GetData(). - net::SSLInfo ssl_info; - CreateFakeSslInfoCertificate(&ssl_info); - - content::URLLoaderInterceptor::WriteResponse( - path, params->client.get(), /*headers=*/nullptr, ssl_info); - - return /*intercepted=*/true; - })); - } - - void TearDownOnMainThread() override { - url_loader_interceptor_.reset(); - InProcessBrowserTest::TearDownOnMainThread(); - } - - AppId InstallWebAppAsUserViaOmnibox() { - chrome::SetAutoAcceptPWAInstallConfirmationForTesting(true); - chrome::SetAutoAcceptWebAppDialogForTesting( - /*auto_accept=*/true, - /*auto_open_in_window=*/true); - - AppId app_id; - base::RunLoop run_loop; - bool started = CreateWebAppFromManifest( - browser()->tab_strip_model()->GetActiveWebContents(), - /*bypass_service_worker_check=*/false, - webapps::WebappInstallSource::OMNIBOX_INSTALL_ICON, - base::BindLambdaForTesting( - [&](const AppId& installed_app_id, InstallResultCode code) { - EXPECT_EQ(code, InstallResultCode::kSuccessNewInstall); - app_id = installed_app_id; - run_loop.Quit(); - })); - EXPECT_TRUE(started); - run_loop.Run(); - return app_id; - } - - void UninstallWebAppAsUserViaMenu(const AppId& app_id) { - extensions::ScopedTestDialogAutoConfirm confirm{ - extensions::ScopedTestDialogAutoConfirm::ACCEPT}; - - base::RunLoop run_loop; - ui_manager().dialog_manager().UninstallWebApp( - app_id, webapps::WebappUninstallSource::kAppMenu, browser()->window(), - base::BindLambdaForTesting([&](bool success) { - EXPECT_TRUE(success); - run_loop.Quit(); - })); - run_loop.Run(); - } - - WebAppProvider& provider() { - WebAppProvider* provider = WebAppProvider::Get(browser()->profile()); - DCHECK(provider); - return *provider; - } - - WebAppUiManagerImpl& ui_manager() { - auto* ui_manager = WebAppUiManagerImpl::Get(browser()->profile()); - DCHECK(ui_manager); - return *ui_manager; - } - - void AwaitRegistryReady() { - base::RunLoop run_loop; - provider().on_registry_ready().Post(FROM_HERE, run_loop.QuitClosure()); - run_loop.Run(); - } - - private: - std::unique_ptr<content::URLLoaderInterceptor> url_loader_interceptor_; - base::test::ScopedFeatureList scoped_feature_list_; - ScopedOsHooksSuppress os_hooks_suppress_; -}; - -IN_PROC_BROWSER_TEST_F(WebAppMigrationManagerBrowserTest, - PRE_DatabaseMigration_SimpleManifest) { - ui_test_utils::NavigateToURL(browser(), GURL{kSimpleManifestStartUrl}); - AppId app_id = InstallWebAppAsUserViaOmnibox(); - EXPECT_EQ(GenerateAppIdFromURL(GURL{kSimpleManifestStartUrl}), app_id); - - EXPECT_TRUE(provider().registrar().AsBookmarkAppRegistrar()); - EXPECT_FALSE(provider().registrar().AsWebAppRegistrar()); - - EXPECT_TRUE(provider().registrar().IsInstalled(app_id)); -} - -IN_PROC_BROWSER_TEST_F(WebAppMigrationManagerBrowserTest, - DatabaseMigration_SimpleManifest) { - AwaitRegistryReady(); - - AppId app_id = GenerateAppIdFromURL(GURL{kSimpleManifestStartUrl}); - EXPECT_TRUE(provider().registrar().IsInstalled(app_id)); - - WebAppRegistrar* registrar = provider().registrar().AsWebAppRegistrar(); - ASSERT_TRUE(registrar); - EXPECT_FALSE(provider().registrar().AsBookmarkAppRegistrar()); - - const WebApp* web_app = registrar->GetAppById(app_id); - ASSERT_TRUE(web_app); - - EXPECT_EQ("Manifest test app", web_app->name()); - EXPECT_EQ(DisplayMode::kStandalone, web_app->display_mode()); - - const std::vector<SquareSizePx> icon_sizes_in_px = {32, 48, 64, 96, 128, - 144, 192, 256, 512}; - EXPECT_EQ(icon_sizes_in_px, web_app->downloaded_icon_sizes(IconPurpose::ANY)); - - base::RunLoop run_loop; - provider().icon_manager().ReadIcons( - app_id, IconPurpose::ANY, - web_app->downloaded_icon_sizes(IconPurpose::ANY), - base::BindLambdaForTesting( - [&](std::map<SquareSizePx, SkBitmap> icon_bitmaps) { - EXPECT_EQ(9u, icon_bitmaps.size()); - for (auto& size_px_and_bitmap : icon_bitmaps) { - SquareSizePx size_px = size_px_and_bitmap.first; - EXPECT_TRUE(base::Contains(icon_sizes_in_px, size_px)); - - SkBitmap bitmap = size_px_and_bitmap.second; - EXPECT_FALSE(bitmap.empty()); - EXPECT_EQ(size_px, bitmap.width()); - EXPECT_EQ(size_px, bitmap.height()); - } - run_loop.Quit(); - })); - run_loop.Run(); -} - -// TODO(crbug.com/1020037): Test policy installed bookmark apps with an external -// install source to cover -// WebAppMigrationManager::MigrateBookmarkAppInstallSource() logic. - -class WebAppMigrationManagerBrowserTestWithShortcutsMenu - : public WebAppMigrationManagerBrowserTest { - public: - WebAppMigrationManagerBrowserTestWithShortcutsMenu() { - scoped_feature_list_.InitAndEnableFeature( - features::kDesktopPWAsAppIconShortcutsMenu); - } - - void ReadAndVerifyDownloadedShortcutsMenuIcons( - const AppId& app_id, - std::vector<IconSizes> shortcuts_menu_icons_sizes) { - EXPECT_EQ( - provider().registrar().GetAppDownloadedShortcutsMenuIconsSizes(app_id), - shortcuts_menu_icons_sizes); - - base::RunLoop run_loop; - provider().icon_manager().ReadAllShortcutsMenuIcons( - app_id, - base::BindLambdaForTesting( - [&](ShortcutsMenuIconBitmaps shortcuts_menu_icon_bitmaps) { - EXPECT_EQ(2u, shortcuts_menu_icon_bitmaps.size()); - for (size_t i = 0; i < shortcuts_menu_icon_bitmaps.size(); ++i) { - EXPECT_EQ(shortcuts_menu_icons_sizes[i].any.size(), - shortcuts_menu_icon_bitmaps[i].any.size()); - EXPECT_EQ(0u, shortcuts_menu_icon_bitmaps[i].maskable.size()); - const std::vector<SquareSizePx>& icon_sizes = - shortcuts_menu_icons_sizes[i].any; - const IconBitmaps& icon_maps = shortcuts_menu_icon_bitmaps[i]; - for (const auto& icon_map : icon_maps.any) { - const SquareSizePx& size_px = icon_map.first; - EXPECT_TRUE(base::Contains(icon_sizes, size_px)); - - const SkBitmap& bitmap = icon_map.second; - EXPECT_FALSE(bitmap.empty()); - EXPECT_EQ(size_px, bitmap.width()); - EXPECT_EQ(size_px, bitmap.height()); - } - } - run_loop.Quit(); - })); - run_loop.Run(); - } - - private: - base::test::ScopedFeatureList scoped_feature_list_; -}; - -IN_PROC_BROWSER_TEST_F(WebAppMigrationManagerBrowserTestWithShortcutsMenu, - PRE_DatabaseMigration_ManifestWithShortcutsMenu) { - ui_test_utils::NavigateToURL(browser(), - GURL{kManifestWithShortcutsMenuInstallUrl}); - AppId app_id = InstallWebAppAsUserViaOmnibox(); - EXPECT_EQ(GenerateAppIdFromURL(GURL{kManifestWithShortcutsMenuStartUrl}), - app_id); - - EXPECT_TRUE(provider().registrar().AsBookmarkAppRegistrar()); - EXPECT_FALSE(provider().registrar().AsWebAppRegistrar()); - - EXPECT_TRUE(provider().registrar().IsInstalled(app_id)); - - std::vector<WebApplicationShortcutsMenuItemInfo> shortcuts_menu_item_infos = - provider().registrar().GetAppShortcutsMenuItemInfos(app_id); - EXPECT_EQ(shortcuts_menu_item_infos.size(), 2u); - EXPECT_EQ(shortcuts_menu_item_infos[0].name, u"shortcut1"); - EXPECT_EQ(shortcuts_menu_item_infos[0] - .GetShortcutIconInfosForPurpose(IconPurpose::ANY) - .size(), - 1u); - EXPECT_EQ(shortcuts_menu_item_infos[1].name, u"shortcut2"); - EXPECT_EQ(shortcuts_menu_item_infos[1] - .GetShortcutIconInfosForPurpose(IconPurpose::ANY) - .size(), - 2u); - - std::vector<IconSizes> shortcuts_menu_icons_sizes; - { - IconSizes icon_sizes; - icon_sizes.SetSizesForPurpose(IconPurpose::ANY, {48}); - shortcuts_menu_icons_sizes.push_back(std::move(icon_sizes)); - } - { - IconSizes icon_sizes; - icon_sizes.SetSizesForPurpose(IconPurpose::ANY, {96, 144}); - shortcuts_menu_icons_sizes.push_back(std::move(icon_sizes)); - } - ReadAndVerifyDownloadedShortcutsMenuIcons(app_id, shortcuts_menu_icons_sizes); -} - -IN_PROC_BROWSER_TEST_F(WebAppMigrationManagerBrowserTestWithShortcutsMenu, - DatabaseMigration_ManifestWithShortcutsMenu) { - AwaitRegistryReady(); - - AppId app_id = GenerateAppIdFromURL(GURL{kManifestWithShortcutsMenuStartUrl}); - EXPECT_TRUE(provider().registrar().IsInstalled(app_id)); - - EXPECT_FALSE(provider().registrar().AsBookmarkAppRegistrar()); - WebAppRegistrar* registrar = provider().registrar().AsWebAppRegistrar(); - ASSERT_TRUE(registrar); - - const WebApp* web_app = registrar->GetAppById(app_id); - ASSERT_TRUE(web_app); - - EXPECT_EQ("Manifest test app with Shortcuts", web_app->name()); - EXPECT_EQ(DisplayMode::kStandalone, web_app->display_mode()); - - EXPECT_EQ(web_app->shortcuts_menu_item_infos().size(), 2u); - EXPECT_EQ(web_app->shortcuts_menu_item_infos()[0].name, u"shortcut1"); - EXPECT_EQ(web_app->shortcuts_menu_item_infos()[0] - .GetShortcutIconInfosForPurpose(IconPurpose::ANY) - .size(), - 1u); - EXPECT_EQ(web_app->shortcuts_menu_item_infos()[1].name, u"shortcut2"); - EXPECT_EQ(web_app->shortcuts_menu_item_infos()[1] - .GetShortcutIconInfosForPurpose(IconPurpose::ANY) - .size(), - 2u); - - std::vector<IconSizes> shortcuts_menu_icons_sizes; - { - IconSizes icon_sizes; - icon_sizes.SetSizesForPurpose(IconPurpose::ANY, {48}); - shortcuts_menu_icons_sizes.push_back(std::move(icon_sizes)); - } - { - IconSizes icon_sizes; - icon_sizes.SetSizesForPurpose(IconPurpose::ANY, {96, 144}); - shortcuts_menu_icons_sizes.push_back(std::move(icon_sizes)); - } - ReadAndVerifyDownloadedShortcutsMenuIcons(app_id, shortcuts_menu_icons_sizes); -} - -} // namespace web_app
diff --git a/chrome/browser/web_applications/web_app_provider.cc b/chrome/browser/web_applications/web_app_provider.cc index 9c3c4b2..a4eff90 100644 --- a/chrome/browser/web_applications/web_app_provider.cc +++ b/chrome/browser/web_applications/web_app_provider.cc
@@ -31,7 +31,6 @@ #include "chrome/browser/web_applications/web_app_icon_manager.h" #include "chrome/browser/web_applications/web_app_install_finalizer.h" #include "chrome/browser/web_applications/web_app_install_manager.h" -#include "chrome/browser/web_applications/web_app_migration_manager.h" #include "chrome/browser/web_applications/web_app_mover.h" #include "chrome/browser/web_applications/web_app_protocol_handler_manager.h" #include "chrome/browser/web_applications/web_app_provider_factory.h" @@ -170,16 +169,18 @@ } void WebAppProvider::StartImpl() { - if (migration_manager_) { - migration_manager_->StartDatabaseMigration( - base::BindOnce(&WebAppProvider::OnDatabaseMigrationCompleted, - weak_ptr_factory_.GetWeakPtr())); + if (!skip_awaiting_extension_system_) { + // Basically the WebAppUiManagerImpl is dependent on ExtensionSystem + // initialization. + // TODO(crbug.com/1201878): Make WebAppUiManagerImpl lazily check + // ExtensionSystem readiness. + WaitForExtensionSystemReady(); } else { - OnDatabaseMigrationCompleted(/*success=*/true); + OnExtensionSystemReady(); } } -void WebAppProvider::OnDatabaseMigrationCompleted(bool success) { +void WebAppProvider::OnExtensionSystemReady() { StartRegistryController(); } @@ -214,16 +215,10 @@ registrar = std::move(mutable_registrar); } - auto legacy_finalizer = CreateBookmarkAppInstallFinalizer(profile); - legacy_finalizer->SetSubsystems(/*registrar=*/nullptr, - /*ui_manager=*/nullptr, - /*registry_controller=*/nullptr, - /*os_integration_manager=*/nullptr); - auto icon_manager = std::make_unique<WebAppIconManager>( profile, *registrar, std::make_unique<FileUtilsWrapper>()); - install_finalizer_ = std::make_unique<WebAppInstallFinalizer>( - profile, icon_manager.get(), std::move(legacy_finalizer)); + install_finalizer_ = + std::make_unique<WebAppInstallFinalizer>(profile, icon_manager.get()); if (g_os_integration_manager_factory_for_testing) { os_integration_manager_ = @@ -248,9 +243,6 @@ std::move(protocol_handler_manager), std::move(url_handler_manager)); } - migration_manager_ = std::make_unique<WebAppMigrationManager>( - profile, database_factory_.get(), icon_manager.get(), - os_integration_manager_.get()); web_app_mover_ = WebAppMover::CreateIfNeeded( profile, registrar.get(), install_finalizer_.get(), install_manager_.get(), sync_bridge.get());
diff --git a/chrome/browser/web_applications/web_app_provider.h b/chrome/browser/web_applications/web_app_provider.h index 0f2e66b..412f1fee 100644 --- a/chrome/browser/web_applications/web_app_provider.h +++ b/chrome/browser/web_applications/web_app_provider.h
@@ -42,7 +42,6 @@ // Forward declarations for new extension-independent subsystems. class WebAppDatabaseFactory; -class WebAppMigrationManager; class WebAppMover; // Connects Web App features, such as the installation of default and @@ -103,7 +102,8 @@ protected: virtual void StartImpl(); - void OnDatabaseMigrationCompleted(bool success); + void WaitForExtensionSystemReady(); + void OnExtensionSystemReady(); // Create subsystems that work with either BMO and Extension backends. void CreateCommonSubsystems(Profile* profile); @@ -126,8 +126,6 @@ // New extension-independent subsystems: std::unique_ptr<WebAppDatabaseFactory> database_factory_; - // migration_manager_ can be nullptr if no migration needed. - std::unique_ptr<WebAppMigrationManager> migration_manager_; std::unique_ptr<WebAppMover> web_app_mover_; // Generalized subsystems: @@ -153,6 +151,8 @@ bool started_ = false; bool connected_ = false; + bool skip_awaiting_extension_system_ = false; + base::WeakPtrFactory<WebAppProvider> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/webauthn/authenticator_request_dialog_model.h b/chrome/browser/webauthn/authenticator_request_dialog_model.h index f1d6138d..cae07fa 100644 --- a/chrome/browser/webauthn/authenticator_request_dialog_model.h +++ b/chrome/browser/webauthn/authenticator_request_dialog_model.h
@@ -15,7 +15,6 @@ #include "base/observer_list.h" #include "base/optional.h" #include "base/strings/string_piece.h" -#include "base/values.h" #include "build/build_config.h" #include "chrome/browser/webauthn/authenticator_reference.h" #include "chrome/browser/webauthn/authenticator_transport.h"
diff --git a/chrome/browser/webauthn/chrome_authenticator_request_delegate.h b/chrome/browser/webauthn/chrome_authenticator_request_delegate.h index 9465cff..a9a3206b 100644 --- a/chrome/browser/webauthn/chrome_authenticator_request_delegate.h +++ b/chrome/browser/webauthn/chrome_authenticator_request_delegate.h
@@ -13,7 +13,6 @@ #include "base/memory/weak_ptr.h" #include "base/optional.h" #include "base/strings/string_piece.h" -#include "base/values.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/webauthn/authenticator_request_dialog_model.h"
diff --git a/chrome/chrome_cleaner/logging/cleaner_logging_service.h b/chrome/chrome_cleaner/logging/cleaner_logging_service.h index 0de9569..1f04f217 100644 --- a/chrome/chrome_cleaner/logging/cleaner_logging_service.h +++ b/chrome/chrome_cleaner/logging/cleaner_logging_service.h
@@ -18,7 +18,6 @@ #include "base/memory/weak_ptr.h" #include "base/synchronization/lock.h" #include "base/threading/thread_checker.h" -#include "base/values.h" #include "chrome/chrome_cleaner/logging/detailed_info_sampler.h" #include "chrome/chrome_cleaner/logging/logging_service_api.h" #include "chrome/chrome_cleaner/logging/message_builder.h"
diff --git a/chrome/chrome_cleaner/logging/logging_service_api.h b/chrome/chrome_cleaner/logging/logging_service_api.h index 9a22d8ba..59e803f0 100644 --- a/chrome/chrome_cleaner/logging/logging_service_api.h +++ b/chrome/chrome_cleaner/logging/logging_service_api.h
@@ -9,7 +9,6 @@ #include <vector> #include "base/callback_forward.h" -#include "base/values.h" #include "chrome/chrome_cleaner/logging/utils.h" #include "chrome/chrome_cleaner/os/disk_util_types.h" #include "chrome/chrome_cleaner/os/process.h"
diff --git a/chrome/chrome_cleaner/logging/mock_logging_service.h b/chrome/chrome_cleaner/logging/mock_logging_service.h index f0494b5f..c13b3ea 100644 --- a/chrome/chrome_cleaner/logging/mock_logging_service.h +++ b/chrome/chrome_cleaner/logging/mock_logging_service.h
@@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "base/values.h" #include "chrome/chrome_cleaner/logging/logging_service_api.h" #include "chrome/chrome_cleaner/logging/proto/shared_data.pb.h" #include "chrome/chrome_cleaner/logging/utils.h"
diff --git a/chrome/chrome_cleaner/logging/noop_logging_service.h b/chrome/chrome_cleaner/logging/noop_logging_service.h index 10b22a2a..2b1e3d9 100644 --- a/chrome/chrome_cleaner/logging/noop_logging_service.h +++ b/chrome/chrome_cleaner/logging/noop_logging_service.h
@@ -10,7 +10,6 @@ #include "base/callback_forward.h" #include "base/macros.h" -#include "base/values.h" #include "chrome/chrome_cleaner/logging/logging_service_api.h" #include "chrome/chrome_cleaner/logging/proto/shared_data.pb.h" #include "chrome/chrome_cleaner/pup_data/pup_data.h"
diff --git a/chrome/chrome_cleaner/logging/reporter_logging_service.h b/chrome/chrome_cleaner/logging/reporter_logging_service.h index 504f785..7bccfae 100644 --- a/chrome/chrome_cleaner/logging/reporter_logging_service.h +++ b/chrome/chrome_cleaner/logging/reporter_logging_service.h
@@ -14,7 +14,6 @@ #include "base/memory/singleton.h" #include "base/synchronization/lock.h" #include "base/threading/thread_checker.h" -#include "base/values.h" #include "chrome/chrome_cleaner/logging/detailed_info_sampler.h" #include "chrome/chrome_cleaner/logging/logging_service_api.h" #include "chrome/chrome_cleaner/logging/proto/reporter_logs.pb.h"
diff --git a/chrome/common/importer/profile_import_process_param_traits_macros.h b/chrome/common/importer/profile_import_process_param_traits_macros.h index ddf81e6..5278624a 100644 --- a/chrome/common/importer/profile_import_process_param_traits_macros.h +++ b/chrome/common/importer/profile_import_process_param_traits_macros.h
@@ -8,7 +8,6 @@ #ifndef CHROME_COMMON_IMPORTER_PROFILE_IMPORT_PROCESS_PARAM_TRAITS_MACROS_H_ #define CHROME_COMMON_IMPORTER_PROFILE_IMPORT_PROCESS_PARAM_TRAITS_MACROS_H_ -#include "base/values.h" #include "build/build_config.h" #include "chrome/common/importer/imported_bookmark_entry.h" #include "chrome/common/importer/importer_autofill_form_data_entry.h"
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index b824369c..00d76864 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc
@@ -955,6 +955,11 @@ const char kDiscoverTabNotificationLastShownMilestone[] = "discover_tab_notification_last_shown_milestone"; +// Amount of times the discover tab suggestion chip should be shown before it +// disappears. +const char kDiscoverTabSuggestionChipTimesLeftToShow[] = + "times_left_to_show_discover_tab_suggestion_chip"; + // Boolean pref indicating whether the NTLM authentication protocol should be // enabled when mounting an SMB share with a user credential by the Network File // Shares for Chrome OS feature.
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 74b26db..be01981 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h
@@ -328,6 +328,7 @@ extern const char kReleaseNotesLastShownMilestone[]; extern const char kReleaseNotesSuggestionChipTimesLeftToShow[]; extern const char kDiscoverTabNotificationLastShownMilestone[]; +extern const char kDiscoverTabSuggestionChipTimesLeftToShow[]; extern const char kNTLMShareAuthenticationEnabled[]; extern const char kNetworkFileSharesPreconfiguredShares[]; extern const char kMostRecentlyUsedNetworkFileShareURL[];
diff --git a/chrome/common/printing/BUILD.gn b/chrome/common/printing/BUILD.gn index 34f9583..c3c17d2 100644 --- a/chrome/common/printing/BUILD.gn +++ b/chrome/common/printing/BUILD.gn
@@ -46,6 +46,7 @@ "//components/printing/common", "//components/strings:components_strings_grit", "//printing", + "//printing/mojom", "//ui/base", ]
diff --git a/chrome/common/printing/printer_capabilities.cc b/chrome/common/printing/printer_capabilities.cc index 9460f1a..7054cd8 100644 --- a/chrome/common/printing/printer_capabilities.cc +++ b/chrome/common/printing/printer_capabilities.cc
@@ -23,6 +23,7 @@ #include "components/printing/common/cloud_print_cdd_conversion.h" #include "printing/backend/print_backend.h" #include "printing/backend/print_backend_consts.h" +#include "printing/mojom/print.mojom.h" #include "printing/print_job_constants.h" #if defined(OS_WIN) @@ -197,7 +198,8 @@ print_backend->GetPrinterDriverInfo(device_name)); auto caps = base::make_optional<PrinterSemanticCapsAndDefaults>(); - if (!print_backend->GetPrinterSemanticCapsAndDefaults(device_name, &*caps)) { + if (print_backend->GetPrinterSemanticCapsAndDefaults(device_name, &*caps) != + mojom::ResultCode::kSuccess) { // Failed to get capabilities, but proceed to assemble the settings to // return what information we do have. LOG(WARNING) << "Failed to get capabilities for " << device_name;
diff --git a/chrome/service/cloud_print/print_system_cups.cc b/chrome/service/cloud_print/print_system_cups.cc index bb9c90c0..995c7d90 100644 --- a/chrome/service/cloud_print/print_system_cups.cc +++ b/chrome/service/cloud_print/print_system_cups.cc
@@ -479,7 +479,8 @@ void PrintSystemCUPS::UpdatePrinters() { printer_enum_succeeded_ = true; for (auto& print_server : print_servers_) { - if (!print_server.backend->EnumeratePrinters(&print_server.printers)) + if (print_server.backend->EnumeratePrinters(&print_server.printers) != + printing::mojom::ResultCode::kSuccess) printer_enum_succeeded_ = false; print_server.caps_cache.clear(); for (auto& printer : print_server.printers) { @@ -573,8 +574,9 @@ // TODO(gene): Retry multiple times in case of error. crash_keys::ScopedPrinterInfo crash_key( server_info->backend->GetPrinterDriverInfo(short_printer_name)); - if (!server_info->backend->GetPrinterCapsAndDefaults(short_printer_name, - printer_info) ) { + if (server_info->backend->GetPrinterCapsAndDefaults(short_printer_name, + printer_info) != + printing::mojom::ResultCode::kSuccess) { return false; }
diff --git a/chrome/service/cloud_print/print_system_win.cc b/chrome/service/cloud_print/print_system_win.cc index 77c7ec607..432e1d8c 100644 --- a/chrome/service/cloud_print/print_system_win.cc +++ b/chrome/service/cloud_print/print_system_win.cc
@@ -30,6 +30,7 @@ #include "components/printing/common/cloud_print_cdd_conversion.h" #include "printing/backend/win_helper.h" #include "printing/emf_win.h" +#include "printing/mojom/print.mojom.h" #include "printing/page_range.h" #include "printing/pdf_render_settings.h" #include "printing/printing_utils.h" @@ -650,8 +651,10 @@ PrintSystem::PrintSystemResult PrintSystemWin::EnumeratePrinters( printing::PrinterList* printer_list) { - bool ret = print_backend_->EnumeratePrinters(printer_list); - return PrintSystemResult(ret, std::string()); + printing::mojom::ResultCode result = + print_backend_->EnumeratePrinters(printer_list); + return PrintSystemResult(result == printing::mojom::ResultCode::kSuccess, + std::string()); } void PrintSystemWin::GetPrinterCapsAndDefaults(
diff --git a/chrome/services/printing/print_backend_service_impl.cc b/chrome/services/printing/print_backend_service_impl.cc index 135a369..87242c0 100644 --- a/chrome/services/printing/print_backend_service_impl.cc +++ b/chrome/services/printing/print_backend_service_impl.cc
@@ -14,6 +14,7 @@ #include "chrome/services/printing/public/mojom/print_backend_service.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "printing/backend/print_backend.h" +#include "printing/mojom/print.mojom.h" #if defined(OS_MAC) #include "base/threading/thread_restrictions.h" @@ -42,7 +43,8 @@ } PrinterList printer_list; - if (!print_backend_->EnumeratePrinters(&printer_list)) { + if (print_backend_->EnumeratePrinters(&printer_list) != + mojom::ResultCode::kSuccess) { DLOG(ERROR) << "EnumeratePrinters failed, last error is " << logging::GetLastSystemErrorCode(); std::move(callback).Run(base::nullopt); @@ -74,9 +76,10 @@ } PrinterSemanticCapsAndDefaults printer_caps; - const bool result = print_backend_->GetPrinterSemanticCapsAndDefaults( - printer_name, &printer_caps); - if (!result) { + const mojom::ResultCode result = + print_backend_->GetPrinterSemanticCapsAndDefaults(printer_name, + &printer_caps); + if (result != mojom::ResultCode::kSuccess) { DLOG(ERROR) << "GetPrinterSemanticCapsAndDefaults failed, last error is " << logging::GetLastSystemErrorCode(); std::move(callback).Run(base::nullopt); @@ -114,9 +117,9 @@ #endif PrinterBasicInfo printer_info; - bool result = + mojom::ResultCode result = print_backend_->GetPrinterBasicInfo(printer_name, &printer_info); - if (!result) { + if (result != mojom::ResultCode::kSuccess) { DLOG(ERROR) << "GetPrinterBasicInfo failed, last error is " << logging::GetLastSystemErrorCode(); std::move(callback).Run(base::nullopt, base::nullopt, base::nullopt); @@ -125,7 +128,7 @@ PrinterSemanticCapsAndDefaults caps; result = print_backend_->GetPrinterSemanticCapsAndDefaults(printer_name, &caps); - if (!result) { + if (result != mojom::ResultCode::kSuccess) { DLOG(ERROR) << "GetPrinterSemanticCapsAndDefaults failed, last error is " << logging::GetLastSystemErrorCode(); std::move(callback).Run(base::nullopt, base::nullopt, base::nullopt);
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index c0c4371..4d3f798 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -226,7 +226,9 @@ "//chrome:strings", #"//chrome/app/theme:theme_resources", + "//chrome/browser:browser_process", "//chrome/browser:test_support", + "//chrome/browser/safe_browsing", "//chrome/child", "//chrome/common:non_code_constants", "//chrome/common:test_support", @@ -236,6 +238,11 @@ "//components/bookmarks/test", "//components/captive_portal/core:test_support", "//components/consent_auditor:test_support", + "//components/content_settings/core/browser", + "//components/crash/core/app", + "//components/domain_reliability", + "//components/federated_learning", + "//components/find_in_page", "//components/gcm_driver:test_support", "//components/gcm_driver/crypto:test_support", "//components/gcm_driver/instance_id:test_support", @@ -243,26 +250,38 @@ "//components/infobars/core", "//components/metrics:test_support", "//components/network_session_configurator/common", + "//components/network_time", "//components/network_time:network_time_test_support", "//components/omnibox/browser:test_support", + "//components/os_crypt", "//components/password_manager/core/browser:test_support", "//components/payments/core:test_support", "//components/performance_manager/test_support", + "//components/permissions", "//components/permissions:test_support", + "//components/policy/core/browser", + "//components/policy/core/common:test_support", "//components/prefs:test_support", + "//components/profile_metrics", + "//components/safe_browsing/core/db:database_manager", "//components/safe_browsing/core/db:v4_test_util", "//components/search_engines:test_support", "//components/sessions:test_support", "//components/signin/public/base:test_support", + "//components/startup_metric_utils/browser", + "//components/subresource_filter/content/browser", "//components/subresource_filter/content/browser:test_support", "//components/subresource_filter/core/common", "//components/sync:test_support", + "//components/sync_preferences", "//components/sync_preferences:test_support", "//components/sync_sessions:test_support", "//components/sync_user_events:test_support", "//components/update_client:test_support", + "//components/user_prefs", "//components/variations:test_support", "//components/web_resource:test_support", + "//components/webdata_services", "//content/public/app", "//content/public/child", "//content/public/common", @@ -280,6 +299,9 @@ "//ppapi/buildflags", "//printing/buildflags", "//services/cert_verifier:test_support", + "//services/data_decoder/public/cpp:test_support", + "//services/device/public/cpp:test_support", + "//services/device/public/cpp/geolocation", "//skia", "//sql", "//sql:test_support", @@ -287,12 +309,17 @@ "//testing/gtest", "//third_party/leveldatabase", "//ui/base", + "//ui/base:test_support", "//ui/events:events_base", "//ui/gfx:test_support", "//ui/gl", ] if (is_android) { + public_deps += [ + ":test_support_ui_android", + "//chrome:chrome_android_core", + ] if (enable_vr) { public_deps += [ "//chrome/browser/android/vr:test_support" ] @@ -303,10 +330,23 @@ public_deps += [ # Android uses //chrome:chrome_android_core instead of the //chrome/app # target. + ":test_support_ui", "//chrome/app:test_support", + "//chrome/browser/web_applications", + "//chrome/browser/web_applications/components", + "//components/crx_file", + "//components/keep_alive_registry", + "//components/pref_registry", + "//components/storage_monitor", + "//components/storage_monitor:test_support", "//components/ukm:test_support", "//components/ukm:ukm_test_helper", + "//components/web_modal", + "//components/zoom", "//components/zoom:test_support", + "//extensions/browser:test_support", + "//extensions/common:test_support", + "//ui/snapshot", ] sources += [ "../browser/enterprise/reporting/extension_request/extension_request_report_throttler_test.cc", @@ -329,7 +369,11 @@ "//chrome/app/chrome_crash_reporter_client.cc", "//chrome/app/chrome_crash_reporter_client_mac.mm", ] - deps += [ "//build:branding_buildflags" ] + deps += [ + "//build:branding_buildflags", + "//chrome/app_shim", + "//components/upload_list", + ] public_deps += [ "//components/crash/core/app", "//third_party/breakpad", @@ -360,6 +404,7 @@ "//chrome/app/chrome_crash_reporter_client_win.cc", ] public_deps += [ + "//chrome/chrome_elf:crash", "//chrome/install_static/test:test_support", "//components/crash/core/app", "//third_party/wtl", @@ -403,11 +448,23 @@ public_deps += [ "//ash", "//ash:test_support", + "//ash/components/account_manager", + "//ash/constants", + "//chrome/browser/chromeos", + "//chromeos/dbus/session_manager", + "//chromeos/dbus/tpm_manager", + "//chromeos/dbus/userdataauth", + "//chromeos/login/login_state", + "//chromeos/settings", + "//chromeos/tpm", + "//chromeos/tpm:test_support", + "//components/exo", "//components/ownership", "//components/user_manager:test_support", "//ui/aura", "//ui/aura:test_support", "//ui/base/ime/init", + "//ui/chromeos/resources:resources_grit", ] deps += [ "//chromeos/cryptohome", @@ -417,7 +474,11 @@ } if (is_chromeos_lacros) { - deps += [ "//chromeos/services/machine_learning/public/cpp:stub" ] + deps += [ + "//chromeos/lacros", + "//chromeos/lacros:test_support", + "//chromeos/services/machine_learning/public/cpp:stub", + ] } if (is_win || is_mac || (is_linux || is_chromeos_lacros)) { @@ -433,6 +494,11 @@ "base/test_browser_window_aura.cc", "base/test_browser_window_aura.h", ] + deps += [ + "//ui/aura:test_support", + "//ui/wm", + "//ui/wm/public", + ] } if (toolkit_views) { @@ -2530,6 +2596,9 @@ "../browser/ash/child_accounts/time_limits/app_time_limits_policy_builder.h", "../browser/ash/child_accounts/time_limits/web_time_calculation_browsertest.cc", "../browser/ash/child_accounts/time_limits/web_time_limit_enforcer_browsertest.cc", + "../browser/ash/crostini/crostini_browser_test_util.cc", + "../browser/ash/crostini/crostini_browser_test_util.h", + "../browser/ash/crostini/crostini_browsertest.cc", "../browser/ash/customization/customization_document_browsertest.cc", "../browser/ash/customization/customization_wallpaper_downloader_browsertest.cc", "../browser/ash/display/display_prefs_browsertest.cc", @@ -2705,9 +2774,6 @@ "../browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_web_request_service_browsertest.cc", "../browser/chrome_main_browsertest.cc", "../browser/chromeos/chrome_content_browser_client_chromeos_part_browsertest.cc", - "../browser/chromeos/crostini/crostini_browser_test_util.cc", - "../browser/chromeos/crostini/crostini_browser_test_util.h", - "../browser/chromeos/crostini/crostini_browsertest.cc", "../browser/chromeos/dbus/cryptohome_key_delegate_service_provider_browsertest.cc", "../browser/chromeos/dbus/proxy_resolution_service_provider_browsertest.cc", "../browser/chromeos/extensions/accessibility_features_apitest.cc", @@ -5161,6 +5227,7 @@ "../browser/ui/app_list/search/files/file_search_provider_unittest.cc", "../browser/ui/app_list/search/files/item_suggest_cache_unittest.cc", "../browser/ui/app_list/search/files/zero_state_file_provider_unittest.cc", + "../browser/ui/app_list/search/help_app_provider_unittest.cc", "../browser/ui/app_list/search/launcher_search/launcher_search_icon_image_loader_unittest.cc", "../browser/ui/app_list/search/mixer_unittest.cc", "../browser/ui/app_list/search/omnibox_result_unittest.cc",
diff --git a/chrome/test/chromedriver/capabilities.cc b/chrome/test/chromedriver/capabilities.cc index f9c74ac..9cd7352 100644 --- a/chrome/test/chromedriver/capabilities.cc +++ b/chrome/test/chromedriver/capabilities.cc
@@ -142,7 +142,7 @@ if (mobile_emulation->HasKey("deviceName")) { // Cannot use any other options with deviceName. - if (mobile_emulation->size() > 1) + if (mobile_emulation->DictSize() > 1) return Status(kInvalidArgument, "'deviceName' must be used alone"); std::string device_name;
diff --git a/chrome/test/chromedriver/chrome/log.cc b/chrome/test/chromedriver/chrome/log.cc index 97e6c3b..f37bdfd57 100644 --- a/chrome/test/chromedriver/chrome/log.cc +++ b/chrome/test/chromedriver/chrome/log.cc
@@ -48,7 +48,7 @@ new base::DictionaryValue()); for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { - if (dict_copy->size() >= kMaxChildren - 1) { + if (dict_copy->DictSize() >= kMaxChildren - 1) { dict_copy->SetKey("~~~", base::Value("...")); break; }
diff --git a/chrome/test/chromedriver/commands_unittest.cc b/chrome/test/chromedriver/commands_unittest.cc index ca0480a..8d4519e 100644 --- a/chrome/test/chromedriver/commands_unittest.cc +++ b/chrome/test/chromedriver/commands_unittest.cc
@@ -97,8 +97,8 @@ ASSERT_TRUE(sessions->GetDictionary(0, &session1)); ASSERT_TRUE(sessions->GetDictionary(1, &session2)); - ASSERT_EQ(static_cast<size_t>(2), session1->size()); - ASSERT_EQ(static_cast<size_t>(2), session2->size()); + ASSERT_EQ(static_cast<size_t>(2), session1->DictSize()); + ASSERT_EQ(static_cast<size_t>(2), session2->DictSize()); std::string session1_id; std::string session2_id; @@ -110,8 +110,8 @@ ASSERT_TRUE(session1->GetDictionary("capabilities", &session1_capabilities)); ASSERT_TRUE(session2->GetDictionary("capabilities", &session2_capabilities)); - ASSERT_EQ((size_t) 2, session1_capabilities->size()); - ASSERT_EQ((size_t) 2, session2_capabilities->size()); + ASSERT_EQ((size_t)2, session1_capabilities->DictSize()); + ASSERT_EQ((size_t)2, session2_capabilities->DictSize()); ASSERT_EQ("id", session1_id); ASSERT_EQ("id2", session2_id);
diff --git a/chrome/test/chromedriver/server/http_handler_unittest.cc b/chrome/test/chromedriver/server/http_handler_unittest.cc index cbdd811..dd4f000b 100644 --- a/chrome/test/chromedriver/server/http_handler_unittest.cc +++ b/chrome/test/chromedriver/server/http_handler_unittest.cc
@@ -140,7 +140,7 @@ ASSERT_FALSE(internal::MatchesCommand( "get", "path", command, &session_id, ¶ms)); ASSERT_TRUE(session_id.empty()); - ASSERT_EQ(0u, params.size()); + ASSERT_EQ(0u, params.DictSize()); } TEST(MatchesCommandTest, DiffPathLength) { @@ -175,7 +175,7 @@ ASSERT_TRUE(internal::MatchesCommand( "post", "path/1/space/2/3", command, &session_id, ¶ms)); ASSERT_EQ("1", session_id); - ASSERT_EQ(2u, params.size()); + ASSERT_EQ(2u, params.DictSize()); std::string param; ASSERT_TRUE(params.GetString("a", ¶m)); ASSERT_EQ("2", param);
diff --git a/chrome/test/chromedriver/session_commands_unittest.cc b/chrome/test/chromedriver/session_commands_unittest.cc index 48489a2..05f59e4 100644 --- a/chrome/test/chromedriver/session_commands_unittest.cc +++ b/chrome/test/chromedriver/session_commands_unittest.cc
@@ -151,7 +151,7 @@ params.SetString("capabilities.alwaysMatch.browserName", "chrome"); status = ProcessCapabilities(params, &result); ASSERT_EQ(kOk, status.code()) << status.message(); - ASSERT_EQ(result.size(), 1u); + ASSERT_EQ(result.DictSize(), 1u); std::string result_string; ASSERT_TRUE(result.GetString("browserName", &result_string)); ASSERT_EQ(result_string, "chrome"); @@ -203,7 +203,7 @@ entry_ptr->SetString("pageLoadStrategy", "eager"); status = ProcessCapabilities(params, &result); ASSERT_EQ(kOk, status.code()) << status.message(); - ASSERT_EQ(result.size(), 1u); + ASSERT_EQ(result.DictSize(), 1u); std::string result_string; ASSERT_TRUE(result.GetString("pageLoadStrategy", &result_string)); ASSERT_EQ(result_string, "eager"); @@ -215,7 +215,7 @@ entry_ptr->SetString("browserName", "chrome"); status = ProcessCapabilities(params, &result); ASSERT_EQ(kOk, status.code()) << status.message(); - ASSERT_EQ(result.size(), 1u); + ASSERT_EQ(result.DictSize(), 1u); ASSERT_TRUE(result.GetString("pageLoadStrategy", &result_string)); ASSERT_EQ(result_string, "eager"); } @@ -266,7 +266,7 @@ })", &result); ASSERT_EQ(kOk, status.code()) << status.message(); - ASSERT_EQ(result.size(), 2u); + ASSERT_EQ(result.DictSize(), 2u); ASSERT_TRUE(result.HasKey("timeouts")); ASSERT_TRUE(result.HasKey("unhandledPromptBehavior")); ASSERT_FALSE(result.HasKey("pageLoadStrategy")); @@ -304,7 +304,7 @@ })", &result); ASSERT_EQ(kOk, status.code()) << status.message(); - ASSERT_EQ(result.size(), 3u); + ASSERT_EQ(result.DictSize(), 3u); ASSERT_TRUE(result.HasKey("timeouts")); ASSERT_EQ(result.FindKey("browserName")->GetString(), "chrome"); ASSERT_FALSE(result.HasKey("unhandledPromptBehavior"));
diff --git a/chrome/test/data/webui/bookmarks/command_manager_test.js b/chrome/test/data/webui/bookmarks/command_manager_test.js index 4d83e544..c2e82f02 100644 --- a/chrome/test/data/webui/bookmarks/command_manager_test.js +++ b/chrome/test/data/webui/bookmarks/command_manager_test.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {Command, CommandManager, createBookmark, DialogFocusManager, getDisplayedList, MenuSource, selectFolder} from 'chrome://bookmarks/bookmarks.js'; +import {BookmarksCommandManagerElement, Command, createBookmark, DialogFocusManager, getDisplayedList, MenuSource, selectFolder} from 'chrome://bookmarks/bookmarks.js'; import {isMac} from 'chrome://resources/js/cr.m.js'; import {pressAndReleaseKeyOn} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; @@ -87,7 +87,7 @@ commandManager = testCommandManager.getCommandManager(); replaceBody(commandManager); document.body.appendChild(document.createElement('cr-toast-manager')); - DialogFocusManager.instance_ = null; + DialogFocusManager.setInstance(null); }); test('Copy URL is only active for single URL items', function() {
diff --git a/chrome/test/data/webui/bookmarks/dialog_focus_manager_test.js b/chrome/test/data/webui/bookmarks/dialog_focus_manager_test.js index 5522e5e..b8317ae 100644 --- a/chrome/test/data/webui/bookmarks/dialog_focus_manager_test.js +++ b/chrome/test/data/webui/bookmarks/dialog_focus_manager_test.js
@@ -50,7 +50,7 @@ document.body.appendChild(commandManager); dialogFocusManager = new DialogFocusManager(); - DialogFocusManager.instance_ = dialogFocusManager; + DialogFocusManager.setInstance(dialogFocusManager); }); test('restores focus on dialog dismissal', async function() {
diff --git a/chrome/test/data/webui/bookmarks/dnd_manager_test.js b/chrome/test/data/webui/bookmarks/dnd_manager_test.js index aaaba98..598ae49d 100644 --- a/chrome/test/data/webui/bookmarks/dnd_manager_test.js +++ b/chrome/test/data/webui/bookmarks/dnd_manager_test.js
@@ -124,7 +124,7 @@ }; const testBrowserProxy = new TestBookmarksBrowserProxy(); - BrowserProxy.instance_ = testBrowserProxy; + BrowserProxy.setInstance(testBrowserProxy); app = document.createElement('bookmarks-app'); replaceBody(app); list = app.$$('bookmarks-list');
diff --git a/chrome/test/data/webui/bookmarks/list_test.js b/chrome/test/data/webui/bookmarks/list_test.js index ed7b8db..bb9ffed 100644 --- a/chrome/test/data/webui/bookmarks/list_test.js +++ b/chrome/test/data/webui/bookmarks/list_test.js
@@ -183,7 +183,7 @@ store.setReducersEnabled(true); proxy = new TestBookmarksBrowserProxy(); - BrowserProxy.instance_ = proxy; + BrowserProxy.setInstance(proxy); app = document.createElement('bookmarks-app'); app.style.height = '100%';
diff --git a/chrome/test/data/webui/bookmarks/policy_test.js b/chrome/test/data/webui/bookmarks/policy_test.js index 9c6f88e..206d1882 100644 --- a/chrome/test/data/webui/bookmarks/policy_test.js +++ b/chrome/test/data/webui/bookmarks/policy_test.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {BrowserProxy, Command, CommandManager, IncognitoAvailability} from 'chrome://bookmarks/bookmarks.js'; +import {BookmarksCommandManagerElement, BrowserProxy, Command, IncognitoAvailability} from 'chrome://bookmarks/bookmarks.js'; import {webUIListenerCallback} from 'chrome://resources/js/cr.m.js'; import {TestBookmarksBrowserProxy} from 'chrome://test/bookmarks/test_browser_proxy.js'; import {TestStore} from 'chrome://test/bookmarks/test_store.js'; @@ -29,13 +29,13 @@ store.replaceSingleton(); testBrowserProxy = new TestBookmarksBrowserProxy(); - BrowserProxy.instance_ = testBrowserProxy; + BrowserProxy.setInstance(testBrowserProxy); app = document.createElement('bookmarks-app'); replaceBody(app); }); test('incognito availability updates when changed', async function() { - const commandManager = CommandManager.getInstance(); + const commandManager = BookmarksCommandManagerElement.getInstance(); // Incognito is disabled during testGenPreamble(). Wait for the front-end to // load the config. const whenIncognitoSet = await Promise.all([ @@ -57,7 +57,7 @@ }); test('canEdit updates when changed', async function() { - const commandManager = CommandManager.getInstance(); + const commandManager = BookmarksCommandManagerElement.getInstance(); const whenCanEditSet = await Promise.all([ testBrowserProxy.whenCalled('getCanEditBookmarks'), store.waitForAction('set-can-edit')
diff --git a/chrome/test/data/webui/bookmarks/router_test.js b/chrome/test/data/webui/bookmarks/router_test.js index d744861..4c319bd7 100644 --- a/chrome/test/data/webui/bookmarks/router_test.js +++ b/chrome/test/data/webui/bookmarks/router_test.js
@@ -86,7 +86,7 @@ */ function setupWithUrl(url) { document.body.innerHTML = ''; - Store.instance_ = undefined; + Store.setInstance(undefined); window.history.replaceState({}, '', url); chrome.bookmarks.getTree = function(callback) {
diff --git a/chrome/test/data/webui/bookmarks/store_test.js b/chrome/test/data/webui/bookmarks/store_test.js index f0eddc2..120e128 100644 --- a/chrome/test/data/webui/bookmarks/store_test.js +++ b/chrome/test/data/webui/bookmarks/store_test.js
@@ -98,7 +98,7 @@ document.body.innerHTML = ''; // Reset store instance: - Store.instance_ = new Store(); + Store.setInstance(new Store()); store = Store.getInstance(); store.init({ items: ['apple', 'banana', 'cantaloupe'],
diff --git a/chrome/test/data/webui/bookmarks/test_store.js b/chrome/test/data/webui/bookmarks/test_store.js index 74a90f3..e638ef2d 100644 --- a/chrome/test/data/webui/bookmarks/test_store.js +++ b/chrome/test/data/webui/bookmarks/test_store.js
@@ -9,4 +9,9 @@ constructor(data) { super(data, Store, createEmptyState(), reduceAction); } + + /** @override */ + replaceSingleton() { + Store.setInstance(this); + } }
diff --git a/chrome/test/data/webui/settings/chromeos/a11y/v3_os_a11y_browsertest.js b/chrome/test/data/webui/settings/chromeos/a11y/v3_os_a11y_browsertest.js index 7da456d..a860e7f 100644 --- a/chrome/test/data/webui/settings/chromeos/a11y/v3_os_a11y_browsertest.js +++ b/chrome/test/data/webui/settings/chromeos/a11y/v3_os_a11y_browsertest.js
@@ -8,7 +8,7 @@ ]); GEN('#include "build/branding_buildflags.h"'); -GEN('#include "chrome/browser/chromeos/crostini/crostini_pref_names.h"'); +GEN('#include "chrome/browser/ash/crostini/crostini_pref_names.h"'); GEN('#include "chrome/browser/chromeos/crostini/fake_crostini_features.h"'); GEN('#include "chrome/browser/profiles/profile.h"'); GEN('#include "chrome/browser/ui/browser.h"');
diff --git a/chrome/updater/installer.cc b/chrome/updater/installer.cc index 0c721dd9..b58b8e9 100644 --- a/chrome/updater/installer.cc +++ b/chrome/updater/installer.cc
@@ -15,6 +15,7 @@ #include "base/task/post_task.h" #include "base/task/thread_pool.h" #include "base/threading/scoped_blocking_call.h" +#include "base/values.h" #include "build/build_config.h" #include "chrome/updater/action_handler.h" #include "chrome/updater/constants.h"
diff --git a/chrome/updater/installer.h b/chrome/updater/installer.h index ee8cb7e..fa09107 100644 --- a/chrome/updater/installer.h +++ b/chrome/updater/installer.h
@@ -13,7 +13,6 @@ #include "base/memory/scoped_refptr.h" #include "base/optional.h" #include "base/sequence_checker.h" -#include "base/values.h" #include "base/version.h" #include "build/build_config.h" #include "chrome/updater/persisted_data.h"
diff --git a/chrome/utility/printing_handler.cc b/chrome/utility/printing_handler.cc index c050cc5e..b863592 100644 --- a/chrome/utility/printing_handler.cc +++ b/chrome/utility/printing_handler.cc
@@ -11,6 +11,7 @@ #include "ipc/ipc_message.h" #include "printing/backend/print_backend.h" #include "printing/buildflags/buildflags.h" +#include "printing/mojom/print.mojom.h" namespace printing { @@ -51,10 +52,11 @@ crash_keys::ScopedPrinterInfo crash_key( print_backend->GetPrinterDriverInfo(printer_name)); - if (print_backend->GetPrinterCapsAndDefaults(printer_name, &printer_info)) { + if (print_backend->GetPrinterCapsAndDefaults(printer_name, &printer_info) == + mojom::ResultCode::kSuccess) { Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded( printer_name, printer_info)); - } else { + } else { Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed( printer_name)); } @@ -70,8 +72,8 @@ crash_keys::ScopedPrinterInfo crash_key( print_backend->GetPrinterDriverInfo(printer_name)); - if (print_backend->GetPrinterSemanticCapsAndDefaults(printer_name, - &printer_info)) { + if (print_backend->GetPrinterSemanticCapsAndDefaults( + printer_name, &printer_info) == mojom::ResultCode::kSuccess) { Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Succeeded( printer_name, printer_info)); } else {
diff --git a/chromecast/browser/accessibility/touch_exploration_controller.h b/chromecast/browser/accessibility/touch_exploration_controller.h index 3d4f1e9..2bb9750 100644 --- a/chromecast/browser/accessibility/touch_exploration_controller.h +++ b/chromecast/browser/accessibility/touch_exploration_controller.h
@@ -15,7 +15,6 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" -#include "base/values.h" #include "chromecast/browser/accessibility/accessibility_sound_player.h" #include "ui/accessibility/ax_enums.mojom.h" #include "ui/events/event.h"
diff --git a/chromecast/browser/extensions/api/tts/tts_extension_api_constants.h b/chromecast/browser/extensions/api/tts/tts_extension_api_constants.h index 74652ea..6e964a8 100644 --- a/chromecast/browser/extensions/api/tts/tts_extension_api_constants.h +++ b/chromecast/browser/extensions/api/tts/tts_extension_api_constants.h
@@ -7,7 +7,6 @@ #include <string> -#include "base/values.h" namespace tts_extension_api_constants {
diff --git a/chromecast/common/identification_settings_manager.h b/chromecast/common/identification_settings_manager.h index 2aa5379..234bab4 100644 --- a/chromecast/common/identification_settings_manager.h +++ b/chromecast/common/identification_settings_manager.h
@@ -14,7 +14,6 @@ #include "base/synchronization/lock.h" #include "base/time/clock.h" #include "base/time/time.h" -#include "base/values.h" #include "chromecast/common/cast_url_loader_throttle.h" #include "chromecast/common/mojom/identification_settings.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h"
diff --git a/chromecast/graphics/gestures/multiple_tap_detector.h b/chromecast/graphics/gestures/multiple_tap_detector.h index 59879f3..585db944 100644 --- a/chromecast/graphics/gestures/multiple_tap_detector.h +++ b/chromecast/graphics/gestures/multiple_tap_detector.h
@@ -10,7 +10,6 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" -#include "base/values.h" #include "ui/events/event.h" #include "ui/events/event_rewriter.h" #include "ui/events/gesture_detection/gesture_detector.h"
diff --git a/chromecast/media/cma/backend/android/volume_control_android.h b/chromecast/media/cma/backend/android/volume_control_android.h index b218d47..1a20032 100644 --- a/chromecast/media/cma/backend/android/volume_control_android.h +++ b/chromecast/media/cma/backend/android/volume_control_android.h
@@ -13,7 +13,6 @@ #include "base/synchronization/lock.h" #include "base/synchronization/waitable_event.h" #include "base/threading/thread.h" -#include "base/values.h" #include "chromecast/media/cma/backend/android/audio_sink_manager.h" #include "chromecast/media/cma/backend/android/volume_cache.h"
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index c6470ba..9d9f2a04 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -13953.0.0 \ No newline at end of file +13955.0.0 \ No newline at end of file
diff --git a/chromeos/chromeos_strings.grd b/chromeos/chromeos_strings.grd index 3c6e799..c7760a2 100644 --- a/chromeos/chromeos_strings.grd +++ b/chromeos/chromeos_strings.grd
@@ -317,6 +317,9 @@ <message name="IDS_HELP_APP_PERKS" desc="Name of a tab in the Help app that offers users additional perks like apps or drive storage space."> Perks </message> + <message name="IDS_HELP_APP_DISCOVER_TAB_SUGGESTION_CHIP" desc="Text for the suggestion chip to view a magazine showing the user how they could build/code/develop a game. [CHAR_LIMIT=24]"> + Build a game + </message> <message name="IDS_HELP_APP_WHATS_NEW_SUGGESTION_CHIP" desc="Text for the suggestion chip to view updated patch notes are available. [CHAR_LIMIT=24]"> What's new with Chrome OS </message>
diff --git a/chromeos/chromeos_strings_grd/IDS_HELP_APP_DISCOVER_TAB_SUGGESTION_CHIP.png.sha1 b/chromeos/chromeos_strings_grd/IDS_HELP_APP_DISCOVER_TAB_SUGGESTION_CHIP.png.sha1 new file mode 100644 index 0000000..da7f35d --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_HELP_APP_DISCOVER_TAB_SUGGESTION_CHIP.png.sha1
@@ -0,0 +1 @@ +0170c58d5c9c99dac9c32850b99a2819589d1a49 \ No newline at end of file
diff --git a/chromeos/components/media_app_ui/resources/js/launch.js b/chromeos/components/media_app_ui/resources/js/launch.js index fd92b72..95bbac10 100644 --- a/chromeos/components/media_app_ui/resources/js/launch.js +++ b/chromeos/components/media_app_ui/resources/js/launch.js
@@ -336,9 +336,11 @@ // Strip non-alphnumeric characters: showSaveFilePicker() will reject them if // they appear in the extension. See b/175625372. This regex should be // consistent with IsValidSuffixCodePoint() in global_file_system_access.cc. - // The extension also can not be empty, so provide a dummy backup since we'd - // be renaming anyway if all characters are stripped. - const extension = '.' + (suffix.replaceAll(/[^A-Za-z0-9.+]+/g, '') || 'ext'); + // The extension also cannot be empty, so provide a dummy backup since we'd + // be renaming anyway if all characters are stripped. showSaveFilePicker() + // also rejects extensions longer than 16 characters (including the .). + let extension = '.' + (suffix.replaceAll(/[^A-Za-z0-9.+]+/g, '') || 'ext'); + extension = extension.substr(0, 16); // TODO(b/161087799): Add a default filename when it's supported by the // File System Access API. /** @type {!FilePickerOptions} */ @@ -714,8 +716,17 @@ try { return ( await currentDirectoryHandle.getFileHandle(filename, {create: false})); - } catch (/** @type {?Object} */ e) { + } catch (/** @type {!DOMException|!Error} */ e) { if (!suppressError) { + // Some filenames (e.g. "thumbs.db") can't be opened (or deleted) by + // filename. TypeError doesn't give a good error message in the app, so + // convert to a new Error. + if (e.name === 'TypeError' && e.message === 'Name is not allowed.') { + console.warn(e); // Warn so a crash report is not generated. + throw new DOMException( + 'File has a reserved name and can not be opened', + 'InvalidModificationError'); + } console.error(e); } return null;
diff --git a/chromeos/components/media_app_ui/test/media_app_ui_browsertest.js b/chromeos/components/media_app_ui/test/media_app_ui_browsertest.js index f57c3c27..5e7006a 100644 --- a/chromeos/components/media_app_ui/test/media_app_ui_browsertest.js +++ b/chromeos/components/media_app_ui/test/media_app_ui_browsertest.js
@@ -625,6 +625,8 @@ assertDeepEquals(await pick('foo.bar.jpg (1) - _baz'), [[['.jpg1baz']]]); assertDeepEquals(await pick('foo.svg+xml'), [[['.svg+xml']]]); assertDeepEquals(await pick('foo.___'), [[['.ext']]]); + assertDeepEquals( + await pick('foo.01234567890123456'), [[['.012345678901234']]]); // Ideally, double-barrelled extensions like this would be handled better. But // the only way to do that is with a hardcoded list of exceptions.
diff --git a/chromeos/components/tether/persistent_host_scan_cache_impl.h b/chromeos/components/tether/persistent_host_scan_cache_impl.h index 4c11cca..1ac580a 100644 --- a/chromeos/components/tether/persistent_host_scan_cache_impl.h +++ b/chromeos/components/tether/persistent_host_scan_cache_impl.h
@@ -10,7 +10,6 @@ #include <unordered_set> #include "base/macros.h" -#include "base/values.h" #include "chromeos/components/tether/persistent_host_scan_cache.h" class PrefRegistrySimple;
diff --git a/chromeos/dbus/dbus_clients_browser.cc b/chromeos/dbus/dbus_clients_browser.cc index 755f73c..b543f81 100644 --- a/chromeos/dbus/dbus_clients_browser.cc +++ b/chromeos/dbus/dbus_clients_browser.cc
@@ -48,8 +48,6 @@ #include "chromeos/dbus/lorgnette_manager/lorgnette_manager_client.h" #include "chromeos/dbus/oobe_configuration_client.h" #include "chromeos/dbus/runtime_probe_client.h" -#include "chromeos/dbus/seneschal/fake_seneschal_client.h" -#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/dbus/smb_provider_client.h" #include "chromeos/dbus/update_engine_client.h" #include "chromeos/dbus/virtual_file_provider_client.h" @@ -107,7 +105,6 @@ CREATE_DBUS_CLIENT(OobeConfigurationClient, use_real_clients); runtime_probe_client_ = CREATE_DBUS_CLIENT(RuntimeProbeClient, use_real_clients); - seneschal_client_ = CREATE_DBUS_CLIENT(SeneschalClient, use_real_clients); smb_provider_client_ = CREATE_DBUS_CLIENT(SmbProviderClient, use_real_clients); update_engine_client_.reset(UpdateEngineClient::Create(client_impl_type)); @@ -141,7 +138,6 @@ lorgnette_manager_client_->Init(system_bus); oobe_configuration_client_->Init(system_bus); runtime_probe_client_->Init(system_bus); - seneschal_client_->Init(system_bus); smb_provider_client_->Init(system_bus); update_engine_client_->Init(system_bus); virtual_file_provider_client_->Init(system_bus);
diff --git a/chromeos/dbus/dbus_clients_browser.h b/chromeos/dbus/dbus_clients_browser.h index 63af2e2..29e9644 100644 --- a/chromeos/dbus/dbus_clients_browser.h +++ b/chromeos/dbus/dbus_clients_browser.h
@@ -35,7 +35,6 @@ class LorgnetteManagerClient; class OobeConfigurationClient; class RuntimeProbeClient; -class SeneschalClient; class SmbProviderClient; class UpdateEngineClient; class VirtualFileProviderClient; @@ -75,7 +74,6 @@ std::unique_ptr<LorgnetteManagerClient> lorgnette_manager_client_; std::unique_ptr<OobeConfigurationClient> oobe_configuration_client_; std::unique_ptr<RuntimeProbeClient> runtime_probe_client_; - std::unique_ptr<SeneschalClient> seneschal_client_; std::unique_ptr<SmbProviderClient> smb_provider_client_; std::unique_ptr<UpdateEngineClient> update_engine_client_; std::unique_ptr<VirtualFileProviderClient> virtual_file_provider_client_;
diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc index bf20e69..a6d5c69 100644 --- a/chromeos/dbus/dbus_thread_manager.cc +++ b/chromeos/dbus/dbus_thread_manager.cc
@@ -33,7 +33,6 @@ #include "chromeos/dbus/image_loader_client.h" #include "chromeos/dbus/lorgnette_manager/lorgnette_manager_client.h" #include "chromeos/dbus/runtime_probe_client.h" -#include "chromeos/dbus/seneschal/seneschal_client.h" #include "chromeos/dbus/shill/modem_messaging_client.h" #include "chromeos/dbus/shill/shill_clients.h" #include "chromeos/dbus/shill/shill_device_client.h" @@ -229,10 +228,6 @@ : nullptr; } -SeneschalClient* DBusThreadManager::GetSeneschalClient() { - return clients_browser_ ? clients_browser_->seneschal_client_.get() : nullptr; -} - SmbProviderClient* DBusThreadManager::GetSmbProviderClient() { return clients_browser_ ? clients_browser_->smb_provider_client_.get() : nullptr; @@ -394,12 +389,6 @@ std::move(client); } -void DBusThreadManagerSetter::SetSeneschalClient( - std::unique_ptr<SeneschalClient> client) { - DBusThreadManager::Get()->clients_browser_->seneschal_client_ = - std::move(client); -} - void DBusThreadManagerSetter::SetImageBurnerClient( std::unique_ptr<ImageBurnerClient> client) { DBusThreadManager::Get()->clients_browser_->image_burner_client_ =
diff --git a/chromeos/dbus/dbus_thread_manager.h b/chromeos/dbus/dbus_thread_manager.h index b6239ea..0e6462d 100644 --- a/chromeos/dbus/dbus_thread_manager.h +++ b/chromeos/dbus/dbus_thread_manager.h
@@ -46,7 +46,6 @@ class ModemMessagingClient; class OobeConfigurationClient; class RuntimeProbeClient; -class SeneschalClient; class ShillDeviceClient; class ShillIPConfigClient; class ShillManagerClient; @@ -136,7 +135,6 @@ LorgnetteManagerClient* GetLorgnetteManagerClient(); OobeConfigurationClient* GetOobeConfigurationClient(); RuntimeProbeClient* GetRuntimeProbeClient(); - SeneschalClient* GetSeneschalClient(); SmbProviderClient* GetSmbProviderClient(); UpdateEngineClient* GetUpdateEngineClient(); VirtualFileProviderClient* GetVirtualFileProviderClient(); @@ -190,7 +188,6 @@ void SetGnubbyClient(std::unique_ptr<GnubbyClient> client); void SetImageBurnerClient(std::unique_ptr<ImageBurnerClient> client); void SetImageLoaderClient(std::unique_ptr<ImageLoaderClient> client); - void SetSeneschalClient(std::unique_ptr<SeneschalClient> client); void SetRuntimeProbeClient(std::unique_ptr<RuntimeProbeClient> client); void SetSmbProviderClient(std::unique_ptr<SmbProviderClient> client); void SetUpdateEngineClient(std::unique_ptr<UpdateEngineClient> client);
diff --git a/chromeos/dbus/dbus_thread_manager_unittest.cc b/chromeos/dbus/dbus_thread_manager_unittest.cc index f7831db..2c1b295 100644 --- a/chromeos/dbus/dbus_thread_manager_unittest.cc +++ b/chromeos/dbus/dbus_thread_manager_unittest.cc
@@ -31,7 +31,6 @@ EXPECT_TRUE(manager->GetImageBurnerClient()); EXPECT_TRUE(manager->GetLorgnetteManagerClient()); EXPECT_TRUE(manager->GetModemMessagingClient()); - EXPECT_TRUE(manager->GetSeneschalClient()); EXPECT_TRUE(manager->GetShillDeviceClient()); EXPECT_TRUE(manager->GetShillIPConfigClient()); EXPECT_TRUE(manager->GetShillManagerClient()); @@ -73,7 +72,6 @@ EXPECT_TRUE(manager->GetEasyUnlockClient()); EXPECT_TRUE(manager->GetImageBurnerClient()); EXPECT_TRUE(manager->GetLorgnetteManagerClient()); - EXPECT_TRUE(manager->GetSeneschalClient()); DBusThreadManager::Shutdown(); } @@ -105,7 +103,6 @@ EXPECT_FALSE(manager->GetEasyUnlockClient()); EXPECT_FALSE(manager->GetImageBurnerClient()); EXPECT_FALSE(manager->GetLorgnetteManagerClient()); - EXPECT_FALSE(manager->GetSeneschalClient()); EXPECT_FALSE(manager->GetUpdateEngineClient()); DBusThreadManager::Shutdown();
diff --git a/chromeos/dbus/seneschal/fake_seneschal_client.cc b/chromeos/dbus/seneschal/fake_seneschal_client.cc index 7636eebc..c52840ce 100644 --- a/chromeos/dbus/seneschal/fake_seneschal_client.cc +++ b/chromeos/dbus/seneschal/fake_seneschal_client.cc
@@ -7,17 +7,35 @@ #include <utility> #include "base/bind.h" +#include "base/check_op.h" #include "base/threading/thread_task_runner_handle.h" namespace chromeos { +namespace { + +FakeSeneschalClient* g_instance = nullptr; + +} // namespace + +// static +FakeSeneschalClient* FakeSeneschalClient::Get() { + return g_instance; +} + FakeSeneschalClient::FakeSeneschalClient() { + DCHECK(!g_instance); + g_instance = this; + share_path_response_.set_success(true); share_path_response_.set_path("foo"); unshare_path_response_.set_success(true); } -FakeSeneschalClient::~FakeSeneschalClient() = default; +FakeSeneschalClient::~FakeSeneschalClient() { + DCHECK_EQ(this, g_instance); + g_instance = nullptr; +} void FakeSeneschalClient::AddObserver(Observer* observer) { observer_list_.AddObserver(observer);
diff --git a/chromeos/dbus/seneschal/fake_seneschal_client.h b/chromeos/dbus/seneschal/fake_seneschal_client.h index a027554..7d702bd 100644 --- a/chromeos/dbus/seneschal/fake_seneschal_client.h +++ b/chromeos/dbus/seneschal/fake_seneschal_client.h
@@ -15,8 +15,8 @@ class COMPONENT_EXPORT(CHROMEOS_DBUS) FakeSeneschalClient : public SeneschalClient { public: - FakeSeneschalClient(); - ~FakeSeneschalClient() override; + // Returns the fake global instance if initialized. May return null. + static FakeSeneschalClient* Get(); // SeneschalClient: void AddObserver(Observer* observer) override; @@ -56,6 +56,11 @@ void NotifySeneschalStarted(); protected: + friend class SeneschalClient; + + FakeSeneschalClient(); + ~FakeSeneschalClient() override; + void Init(dbus::Bus* bus) override {} private:
diff --git a/chromeos/dbus/seneschal/seneschal_client.cc b/chromeos/dbus/seneschal/seneschal_client.cc index ce3d8d8f..3ae58a53 100644 --- a/chromeos/dbus/seneschal/seneschal_client.cc +++ b/chromeos/dbus/seneschal/seneschal_client.cc
@@ -7,19 +7,27 @@ #include <memory> #include "base/bind.h" +#include "base/check_op.h" #include "base/location.h" #include "base/logging.h" #include "base/memory/weak_ptr.h" #include "base/threading/thread_task_runner_handle.h" +#include "chromeos/dbus/seneschal/fake_seneschal_client.h" #include "dbus/bus.h" #include "dbus/message.h" #include "third_party/cros_system_api/dbus/seneschal/dbus-constants.h" namespace chromeos { +namespace { + +SeneschalClient* g_instance = nullptr; + +} // namespace + class SeneschalClientImpl : public SeneschalClient { public: - SeneschalClientImpl() {} + SeneschalClientImpl() = default; ~SeneschalClientImpl() override = default; @@ -79,7 +87,6 @@ weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } - protected: void Init(dbus::Bus* bus) override { seneschal_proxy_ = bus->GetObjectProxy( vm_tools::seneschal::kSeneschalServiceName, @@ -132,12 +139,38 @@ DISALLOW_COPY_AND_ASSIGN(SeneschalClientImpl); }; -SeneschalClient::SeneschalClient() = default; +SeneschalClient::SeneschalClient() { + DCHECK(!g_instance); + g_instance = this; +} -SeneschalClient::~SeneschalClient() = default; +SeneschalClient::~SeneschalClient() { + DCHECK_EQ(this, g_instance); + g_instance = nullptr; +} -std::unique_ptr<SeneschalClient> SeneschalClient::Create() { - return std::make_unique<SeneschalClientImpl>(); +// static +void SeneschalClient::Initialize(dbus::Bus* bus) { + DCHECK(bus); + (new SeneschalClientImpl())->Init(bus); +} + +// static +void SeneschalClient::InitializeFake() { + // Do not create a new fake if it was initialized early in a browser test to + // allow the test to set its own client. + if (!FakeSeneschalClient::Get()) + new FakeSeneschalClient(); +} + +// static +void SeneschalClient::Shutdown() { + delete g_instance; +} + +// static +SeneschalClient* SeneschalClient::Get() { + return g_instance; } } // namespace chromeos
diff --git a/chromeos/dbus/seneschal/seneschal_client.h b/chromeos/dbus/seneschal/seneschal_client.h index 725949cd..f14f55f 100644 --- a/chromeos/dbus/seneschal/seneschal_client.h +++ b/chromeos/dbus/seneschal/seneschal_client.h
@@ -59,8 +59,20 @@ DBusMethodCallback<vm_tools::seneschal::UnsharePathResponse> callback) = 0; + // Creates and initializes the global instance. |bus| must not be null. + static void Initialize(dbus::Bus* bus); + + // Creates and initializes a fake global instance if not already created. + static void InitializeFake(); + + // Destroys the global instance which must have been initialized. + static void Shutdown(); + + // Returns the global instance if initialized. May return null. + static SeneschalClient* Get(); + protected: - // Create() should be used instead. + // Initialize() should be used instead. SeneschalClient(); private:
diff --git a/chromeos/network/network_connection_handler.h b/chromeos/network/network_connection_handler.h index 1ec8d0b..810b03a 100644 --- a/chromeos/network/network_connection_handler.h +++ b/chromeos/network/network_connection_handler.h
@@ -14,7 +14,6 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" -#include "base/values.h" #include "chromeos/network/network_connection_observer.h" #include "chromeos/network/network_handler.h" #include "chromeos/network/network_handler_callbacks.h"
diff --git a/chromeos/printing/ppd_metadata_manager.h b/chromeos/printing/ppd_metadata_manager.h index 9293858..d0f04f3 100644 --- a/chromeos/printing/ppd_metadata_manager.h +++ b/chromeos/printing/ppd_metadata_manager.h
@@ -13,7 +13,6 @@ #include "base/optional.h" #include "base/strings/string_piece.h" #include "base/time/time.h" -#include "base/values.h" #include "chromeos/chromeos_export.h" #include "chromeos/printing/ppd_metadata_parser.h" #include "chromeos/printing/ppd_provider.h"
diff --git a/chromeos/services/cellular_setup/euicc.h b/chromeos/services/cellular_setup/euicc.h index be3b20c..ad3a8e3 100644 --- a/chromeos/services/cellular_setup/euicc.h +++ b/chromeos/services/cellular_setup/euicc.h
@@ -5,7 +5,6 @@ #ifndef CHROMEOS_SERVICES_CELLULAR_SETUP_EUICC_H_ #define CHROMEOS_SERVICES_CELLULAR_SETUP_EUICC_H_ -#include "base/values.h" #include "chromeos/dbus/hermes/hermes_euicc_client.h" #include "chromeos/dbus/hermes/hermes_profile_client.h" #include "chromeos/network/cellular_inhibitor.h" @@ -127,4 +126,4 @@ } // namespace cellular_setup } // namespace chromeos -#endif // CHROMEOS_SERVICES_CELLULAR_SETUP_EUICC_H_ \ No newline at end of file +#endif // CHROMEOS_SERVICES_CELLULAR_SETUP_EUICC_H_
diff --git a/chromeos/services/device_sync/cryptauth_key_registry.h b/chromeos/services/device_sync/cryptauth_key_registry.h index 6e1c1bb..7f06b72 100644 --- a/chromeos/services/device_sync/cryptauth_key_registry.h +++ b/chromeos/services/device_sync/cryptauth_key_registry.h
@@ -6,7 +6,6 @@ #define CHROMEOS_SERVICES_DEVICE_SYNC_CRYPTAUTH_KEY_REGISTRY_H_ #include "base/containers/flat_map.h" -#include "base/values.h" #include "chromeos/services/device_sync/cryptauth_key_bundle.h" #include "chromeos/services/device_sync/proto/cryptauth_enrollment.pb.h"
diff --git a/chromeos/system/statistics_provider.cc b/chromeos/system/statistics_provider.cc index 170ebf40..af67015 100644 --- a/chromeos/system/statistics_provider.cc +++ b/chromeos/system/statistics_provider.cc
@@ -122,7 +122,7 @@ std::string buffer; bool first = true; - for (const auto& v : *list) { + for (const auto& v : list->GetList()) { std::string value; if (!v.GetAsString(&value)) return false;
diff --git a/components/arc/compat_mode/resize_confirmation_dialog.cc b/components/arc/compat_mode/resize_confirmation_dialog.cc index 7e6e00a..09403ceb 100644 --- a/components/arc/compat_mode/resize_confirmation_dialog.cc +++ b/components/arc/compat_mode/resize_confirmation_dialog.cc
@@ -42,7 +42,8 @@ }; std::unique_ptr<views::DialogDelegate> MakeDialogDelegate( - ResizeConfirmationCallback callback) { + ResizeConfirmationCallback callback, + int parent_width) { // Setup contents. views::LayoutProvider* provider = views::LayoutProvider::Get(); auto contents = std::make_unique<views::BoxLayoutView>(); @@ -74,8 +75,13 @@ ui::DIALOG_BUTTON_OK, l10n_util::GetStringUTF16(IDS_ASH_ARC_APP_COMPAT_RESIZE_CONFIRM_ACCEPT)); delegate->SetModalType(ui::MODAL_TYPE_WINDOW); - delegate->set_fixed_width(views::LayoutProvider::Get()->GetDistanceMetric( - views::DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH)); + + int width = + provider->GetDistanceMetric(views::DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH); + if (parent_width < width) + width = provider->GetDistanceMetric(views::DISTANCE_BUBBLE_PREFERRED_WIDTH); + + delegate->set_fixed_width(width); // Safe to set "Unretained" as |delegate| is owned by widget, so keeps // alive within the life-time of the widget. @@ -96,7 +102,8 @@ ResizeConfirmationCallback callback) { // TOOD(b/183664767): Switch dialog to use exo's overlay. auto* widget = views::DialogDelegate::CreateDialogWidget( - MakeDialogDelegate(std::move(callback)), + MakeDialogDelegate(std::move(callback), + parent ? parent->bounds().width() : 0), exo::WMHelper::GetInstance()->GetRootWindowForNewWindows(), parent); widget->Show(); return widget;
diff --git a/components/arc/metrics/arc_metrics_service.cc b/components/arc/metrics/arc_metrics_service.cc index 282e2968..7bde9a1 100644 --- a/components/arc/metrics/arc_metrics_service.cc +++ b/components/arc/metrics/arc_metrics_service.cc
@@ -16,7 +16,6 @@ #include "base/strings/string_util.h" #include "chromeos/dbus/power_manager/idle.pb.h" #include "chromeos/dbus/session_manager/session_manager_client.h" -#include "components/arc/arc_browser_context_keyed_service_factory_base.h" #include "components/arc/arc_prefs.h" #include "components/arc/arc_util.h" #include "components/arc/metrics/stability_metrics_manager.h" @@ -60,28 +59,14 @@ return ""; } -// Singleton factory for ArcMetricsService. -class ArcMetricsServiceFactory - : public internal::ArcBrowserContextKeyedServiceFactoryBase< - ArcMetricsService, - ArcMetricsServiceFactory> { - public: - // Factory name used by ArcBrowserContextKeyedServiceFactoryBase. - static constexpr const char* kName = "ArcMetricsServiceFactory"; - - static ArcMetricsServiceFactory* GetInstance() { - return base::Singleton<ArcMetricsServiceFactory>::get(); - } - - private: - friend base::DefaultSingletonTraits<ArcMetricsServiceFactory>; - ArcMetricsServiceFactory() = default; - ~ArcMetricsServiceFactory() override = default; -}; - } // namespace // static +ArcMetricsServiceFactory* ArcMetricsServiceFactory::GetInstance() { + return base::Singleton<ArcMetricsServiceFactory>::get(); +} + +// static ArcMetricsService* ArcMetricsService::GetForBrowserContext( content::BrowserContext* context) { return ArcMetricsServiceFactory::GetForBrowserContext(context);
diff --git a/components/arc/metrics/arc_metrics_service.h b/components/arc/metrics/arc_metrics_service.h index c3e6f4f2..0c7383e 100644 --- a/components/arc/metrics/arc_metrics_service.h +++ b/components/arc/metrics/arc_metrics_service.h
@@ -18,6 +18,7 @@ #include "base/threading/thread_checker.h" #include "base/time/time.h" #include "base/timer/timer.h" +#include "components/arc/arc_browser_context_keyed_service_factory_base.h" #include "components/arc/metrics/arc_metrics_constants.h" #include "components/arc/mojom/metrics.mojom.h" #include "components/arc/mojom/process.mojom.h" @@ -255,6 +256,23 @@ DISALLOW_COPY_AND_ASSIGN(ArcMetricsService); }; +// Singleton factory for ArcMetricsService. +class ArcMetricsServiceFactory + : public internal::ArcBrowserContextKeyedServiceFactoryBase< + ArcMetricsService, + ArcMetricsServiceFactory> { + public: + // Factory name used by ArcBrowserContextKeyedServiceFactoryBase. + static constexpr const char* kName = "ArcMetricsServiceFactory"; + + static ArcMetricsServiceFactory* GetInstance(); + + private: + friend base::DefaultSingletonTraits<ArcMetricsServiceFactory>; + ArcMetricsServiceFactory() = default; + ~ArcMetricsServiceFactory() override = default; +}; + } // namespace arc #endif // COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H_
diff --git a/components/autofill/content/renderer/form_autofill_util_browsertest.cc b/components/autofill/content/renderer/form_autofill_util_browsertest.cc index c19c9049..0b613eb9 100644 --- a/components/autofill/content/renderer/form_autofill_util_browsertest.cc +++ b/components/autofill/content/renderer/form_autofill_util_browsertest.cc
@@ -50,7 +50,7 @@ struct AutofillFieldUtilCase { const char* description; const char* html; - const char* expected_label; + const char16_t* expected_label; }; const char kElevenChildren[] = @@ -67,8 +67,8 @@ "<div>child9</div>" "<div>child10</div>" "</div>"; -const char kElevenChildrenExpected[] = - "child0child1child2child3child4child5child6child7child8"; +const char16_t kElevenChildrenExpected[] = + u"child0child1child2child3child4child5child6child7child8"; const char kElevenChildrenNested[] = "<div id='target'>" @@ -85,7 +85,8 @@ "<div>child10" "</div></div></div></div></div></div></div></div></div></div></div></div>"; // Take 10 elements -1 for target element, -1 as text is a leaf element. -const char kElevenChildrenNestedExpected[] = "child0child1child2child3child4"; +const char16_t kElevenChildrenNestedExpected[] = + u"child0child1child2child3child4"; const char kSkipElement[] = "<div id='target'>" @@ -94,13 +95,13 @@ "<div>child2</div>" "</div>"; // TODO(crbug.com/796918): Should be child0child2 -const char kSkipElementExpected[] = "child0"; +const char16_t kSkipElementExpected[] = u"child0"; const char kDivTableExample1[] = "<div>" "<div>label</div><div><input id='target'/></div>" "</div>"; -const char kDivTableExample1Expected[] = "label"; +const char16_t kDivTableExample1Expected[] = u"label"; const char kDivTableExample2[] = "<div>" @@ -108,7 +109,7 @@ "<div>should be skipped<input/></div>" "<div><input id='target'/></div>" "</div>"; -const char kDivTableExample2Expected[] = "label"; +const char16_t kDivTableExample2Expected[] = u"label"; const char kDivTableExample3[] = "<div>" @@ -116,7 +117,7 @@ "<div>label</div>" "<div><input id='target'/></div>" "</div>"; -const char kDivTableExample3Expected[] = "label"; +const char16_t kDivTableExample3Expected[] = u"label"; const char kDivTableExample4[] = "<div>" @@ -125,21 +126,21 @@ "<div><input id='target'/></div>" "</div>"; // TODO(crbug.com/796918): Should be label -const char kDivTableExample4Expected[] = ""; +const char16_t kDivTableExample4Expected[] = u""; const char kDivTableExample5[] = "<div>" "<div>label<div><input id='target'/></div>behind</div>" "</div>"; // TODO(crbug.com/796918): Should be label -const char kDivTableExample5Expected[] = "labelbehind"; +const char16_t kDivTableExample5Expected[] = u"labelbehind"; const char kDivTableExample6[] = "<div>" "<div>label<div><div>-<div><input id='target'/></div></div>" "</div>"; // TODO(crbug.com/796918): Should be "label" or "label-" -const char kDivTableExample6Expected[] = ""; +const char16_t kDivTableExample6Expected[] = u""; void VerifyButtonTitleCache(const WebFormElement& form_target, const ButtonTitleList& expected_button_titles, @@ -163,13 +164,13 @@ TEST_F(FormAutofillUtilsTest, FindChildTextTest) { static const AutofillFieldUtilCase test_cases[] = { - {"simple test", "<div id='target'>test</div>", "test"}, + {"simple test", "<div id='target'>test</div>", u"test"}, {"Concatenate test", "<div id='target'><span>one</span>two</div>", - "onetwo"}, + u"onetwo"}, // TODO(crbug.com/796918): should be "onetwo" {"Ignore input", "<div id='target'>one<input value='test'/>two</div>", - "one"}, - {"Trim", "<div id='target'> one<span>two </span></div>", "onetwo"}, + u"one"}, + {"Trim", "<div id='target'> one<span>two </span></div>", u"onetwo"}, {"eleven children", kElevenChildren, kElevenChildrenExpected}, // TODO(crbug.com/796918): Depth is only 5 elements {"eleven children nested", kElevenChildrenNested, @@ -182,8 +183,7 @@ ASSERT_NE(nullptr, web_frame); WebElement target = web_frame->GetDocument().GetElementById("target"); ASSERT_FALSE(target.IsNull()); - EXPECT_EQ(base::UTF8ToUTF16(test_case.expected_label), - FindChildText(target)); + EXPECT_EQ(test_case.expected_label, FindChildText(target)); } } @@ -205,7 +205,7 @@ to_skip.insert(web_to_skip[i]); } - EXPECT_EQ(base::UTF8ToUTF16(test_case.expected_label), + EXPECT_EQ(test_case.expected_label, FindChildTextWithIgnoreListForTesting(target, to_skip)); } } @@ -234,12 +234,12 @@ FormFieldData::LabelSource::kUnknown; std::u16string label; InferLabelForElementForTesting(form_target, &label, &label_source); - EXPECT_EQ(base::UTF8ToUTF16(test_case.expected_label), label); + EXPECT_EQ(test_case.expected_label, label); } } TEST_F(FormAutofillUtilsTest, InferLabelSourceTest) { - const char kLabelSourceExpectedLabel[] = "label"; + const char16_t kLabelSourceExpectedLabel[] = u"label"; static const AutofillFieldLabelSourceCase test_cases[] = { {"<div><div>label</div><div><input id='target'/></div></div>", FormFieldData::LabelSource::kDivTable}, @@ -279,7 +279,7 @@ std::u16string label; EXPECT_TRUE(autofill::form_util::InferLabelForElementForTesting( form_target, &label, &label_source)); - EXPECT_EQ(base::UTF8ToUTF16(kLabelSourceExpectedLabel), label); + EXPECT_EQ(kLabelSourceExpectedLabel, label); EXPECT_EQ(test_case.label_source, label_source); } } @@ -441,19 +441,18 @@ dummy_fieldsets, control_elements, nullptr, web_frame->GetDocument(), nullptr, EXTRACT_NONE, &target, nullptr)); const struct { - const char* const name; + const char16_t* const name; bool enabled; } kExpectedFields[] = { - {"name1", true}, - {"name2", false}, - {"name3", true}, - {"name4", false}, + {u"name1", true}, + {u"name2", false}, + {u"name3", true}, + {u"name4", false}, }; const size_t number_of_cases = base::size(kExpectedFields); ASSERT_EQ(number_of_cases, target.fields.size()); for (size_t i = 0; i < number_of_cases; ++i) { - EXPECT_EQ(base::UTF8ToUTF16(kExpectedFields[i].name), - target.fields[i].name); + EXPECT_EQ(kExpectedFields[i].name, target.fields[i].name); EXPECT_EQ(kExpectedFields[i].enabled, target.fields[i].is_enabled); } } @@ -482,19 +481,18 @@ dummy_fieldsets, control_elements, nullptr, web_frame->GetDocument(), nullptr, EXTRACT_NONE, &target, nullptr)); const struct { - const char* const name; + const char16_t* const name; bool readonly; } kExpectedFields[] = { - {"name1", false}, - {"name2", true}, - {"name3", false}, - {"name4", true}, + {u"name1", false}, + {u"name2", true}, + {u"name3", false}, + {u"name4", true}, }; const size_t number_of_cases = base::size(kExpectedFields); ASSERT_EQ(number_of_cases, target.fields.size()); for (size_t i = 0; i < number_of_cases; ++i) { - EXPECT_EQ(base::UTF8ToUTF16(kExpectedFields[i].name), - target.fields[i].name); + EXPECT_EQ(kExpectedFields[i].name, target.fields[i].name); EXPECT_EQ(kExpectedFields[i].readonly, target.fields[i].is_readonly); } }
diff --git a/components/autofill/core/browser/address_rewriter_unittest.cc b/components/autofill/core/browser/address_rewriter_unittest.cc index 327a1b7c..35df50d6 100644 --- a/components/autofill/core/browser/address_rewriter_unittest.cc +++ b/components/autofill/core/browser/address_rewriter_unittest.cc
@@ -7,7 +7,6 @@ #include "base/strings/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" -using base::UTF8ToUTF16; using autofill::AddressRewriter; TEST(AddressRewriterTest, InvalidCountryCode) { @@ -41,8 +40,7 @@ TEST(AddressRewriterTest, AR) { AddressRewriter ar = AddressRewriter::ForCountryCode(u"ar"); - EXPECT_EQ(ar.Rewrite(UTF8ToUTF16( - "tierra del fuego antartida e islas del atlantico sur")), + EXPECT_EQ(ar.Rewrite(u"tierra del fuego antartida e islas del atlantico sur"), ar.Rewrite(u"tierra del fuego")); EXPECT_EQ(ar.Rewrite(u"ciudad autonoma de buenos aires"), ar.Rewrite(u"capital federal"));
diff --git a/components/autofill/core/browser/autofill_client.h b/components/autofill/core/browser/autofill_client.h index a92b661..13a88a4 100644 --- a/components/autofill/core/browser/autofill_client.h +++ b/components/autofill/core/browser/autofill_client.h
@@ -15,7 +15,6 @@ #include "base/i18n/rtl.h" #include "base/memory/weak_ptr.h" #include "base/types/strong_alias.h" -#include "base/values.h" #include "build/build_config.h" #include "components/autofill/core/browser/payments/legal_message_line.h" #include "components/autofill/core/browser/payments/risk_data_loader.h"
diff --git a/components/autofill/core/browser/data_model/autofill_profile_comparator_unittest.cc b/components/autofill/core/browser/data_model/autofill_profile_comparator_unittest.cc index 28e56cb..f301c95 100644 --- a/components/autofill/core/browser/data_model/autofill_profile_comparator_unittest.cc +++ b/components/autofill/core/browser/data_model/autofill_profile_comparator_unittest.cc
@@ -56,7 +56,6 @@ using autofill::NameInfo; using autofill::PhoneNumber; using autofill::ServerFieldType; -using base::UTF8ToUTF16; namespace autofill { @@ -102,22 +101,22 @@ autofill::CountryNames::SetLocaleString(kLocale); } - NameInfo CreateNameInfo(const char* first, - const char* middle, - const char* last, - const char* full) { + NameInfo CreateNameInfo(const char16_t* first, + const char16_t* middle, + const char16_t* last, + const char16_t* full) { NameInfo name; name.SetRawInfoWithVerificationStatus( - NAME_FIRST, base::UTF8ToUTF16(first), + NAME_FIRST, first, autofill::structured_address::VerificationStatus::kObserved); name.SetRawInfoWithVerificationStatus( - NAME_MIDDLE, base::UTF8ToUTF16(middle), + NAME_MIDDLE, middle, autofill::structured_address::VerificationStatus::kObserved); name.SetRawInfoWithVerificationStatus( - NAME_LAST, base::UTF8ToUTF16(last), + NAME_LAST, last, autofill::structured_address::VerificationStatus::kObserved); name.SetRawInfoWithVerificationStatus( - NAME_FULL, base::UTF8ToUTF16(full), + NAME_FULL, full, autofill::structured_address::VerificationStatus::kObserved); return name; } @@ -190,10 +189,10 @@ AutofillProfile CopyAndModify( const AutofillProfile& profile, - const std::vector<std::pair<ServerFieldType, const char*>>& updates) { + const std::vector<std::pair<ServerFieldType, const char16_t*>>& updates) { AutofillProfile new_profile = profile; for (const auto& update : updates) { - new_profile.SetRawInfo(update.first, UTF8ToUTF16(update.second)); + new_profile.SetRawInfo(update.first, update.second); } new_profile.FinalizeAfterImport(); return new_profile; @@ -242,7 +241,7 @@ void MergePhoneNumbersAndExpect(const AutofillProfile& a, const AutofillProfile& b, - const std::string& expected_str) { + const std::u16string& expected_str) { AutofillProfile dummy; // Merge the phone numbers. @@ -251,7 +250,7 @@ // Construct the expected value. PhoneNumber expected(&dummy); - expected.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, UTF8ToUTF16(expected_str)); + expected.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, expected_str); // Validate that we get what we expect. EXPECT_EQ(expected.GetRawInfo(PHONE_HOME_WHOLE_NUMBER), @@ -712,20 +711,20 @@ "Carver City", "ca", "", "us"); AutofillProfile differentCountry = - CopyAndModify(p1, {{ADDRESS_HOME_COUNTRY, "CA"}}); + CopyAndModify(p1, {{ADDRESS_HOME_COUNTRY, u"CA"}}); AutofillProfile differentZip = - CopyAndModify(p1, {{ADDRESS_HOME_ZIP, "32145"}}); + CopyAndModify(p1, {{ADDRESS_HOME_ZIP, u"32145"}}); AutofillProfile differentState = CopyAndModify( - p1, {{ADDRESS_HOME_ZIP, ""}, {ADDRESS_HOME_STATE, "Florida"}}); + p1, {{ADDRESS_HOME_ZIP, u""}, {ADDRESS_HOME_STATE, u"Florida"}}); AutofillProfile differentCity = CopyAndModify( - p1, {{ADDRESS_HOME_ZIP, ""}, {ADDRESS_HOME_CITY, "Metropolis"}}); + p1, {{ADDRESS_HOME_ZIP, u""}, {ADDRESS_HOME_CITY, u"Metropolis"}}); AutofillProfile differentAddress = - CopyAndModify(p1, {{ADDRESS_HOME_LINE1, "17 Park Lane"}, - {ADDRESS_HOME_LINE2, "Suite 150"}}); + CopyAndModify(p1, {{ADDRESS_HOME_LINE1, u"17 Park Lane"}, + {ADDRESS_HOME_LINE2, u"Suite 150"}}); AutofillProfile differentLocality = - CopyAndModify(p1, {{ADDRESS_HOME_DEPENDENT_LOCALITY, "Funky Chicken"}}); + CopyAndModify(p1, {{ADDRESS_HOME_DEPENDENT_LOCALITY, u"Funky Chicken"}}); AutofillProfile differentSortingCode = - CopyAndModify(p1, {{ADDRESS_HOME_SORTING_CODE, "98000 Monaco"}}); + CopyAndModify(p1, {{ADDRESS_HOME_SORTING_CODE, u"98000 Monaco"}}); EXPECT_TRUE(comparator_.HaveMergeableAddresses(p1, empty)); EXPECT_TRUE(comparator_.HaveMergeableAddresses(empty, p2)); @@ -758,26 +757,26 @@ "+1 (234) 567-8910", /*finalize=*/false); AutofillProfile mergeable = - CopyAndModify(p, {{NAME_FIRST, "MÁRÍÕÑ"}, - {NAME_MIDDLE, "M."}, - {EMAIL_ADDRESS, "MARION@ME.XYZ"}, - {COMPANY_NAME, "Fox Industries Inc."}, - {ADDRESS_HOME_LINE1, "123 zoo st. w., #5"}, - {ADDRESS_HOME_LINE1, ""}, - {ADDRESS_HOME_STATE, "california"}, - {PHONE_HOME_WHOLE_NUMBER, "5678910 ext. 77"}}); + CopyAndModify(p, {{NAME_FIRST, u"MÁRÍÕÑ"}, + {NAME_MIDDLE, u"M."}, + {EMAIL_ADDRESS, u"MARION@ME.XYZ"}, + {COMPANY_NAME, u"Fox Industries Inc."}, + {ADDRESS_HOME_LINE1, u"123 zoo st. w., #5"}, + {ADDRESS_HOME_LINE1, u""}, + {ADDRESS_HOME_STATE, u"california"}, + {PHONE_HOME_WHOLE_NUMBER, u"5678910 ext. 77"}}); AutofillProfile not_mergeable_by_name = - CopyAndModify(p, {{NAME_FIRST, "Steven"}, - {NAME_FULL, ""}, - {autofill::NAME_LAST_SECOND, ""}}); + CopyAndModify(p, {{NAME_FIRST, u"Steven"}, + {NAME_FULL, u""}, + {autofill::NAME_LAST_SECOND, u""}}); AutofillProfile not_mergeable_by_email_address = - CopyAndModify(p, {{EMAIL_ADDRESS, "marion.morrision@me.xyz"}}); + CopyAndModify(p, {{EMAIL_ADDRESS, u"marion.morrision@me.xyz"}}); AutofillProfile not_mergeable_by_company_name = - CopyAndModify(p, {{COMPANY_NAME, "Hound Corp"}}); + CopyAndModify(p, {{COMPANY_NAME, u"Hound Corp"}}); AutofillProfile not_mergeable_by_address = - CopyAndModify(p, {{ADDRESS_HOME_LINE2, "Unit 7"}}); + CopyAndModify(p, {{ADDRESS_HOME_LINE2, u"Unit 7"}}); AutofillProfile not_mergeable_by_phone_number = - CopyAndModify(p, {{PHONE_HOME_WHOLE_NUMBER, "555-1234"}}); + CopyAndModify(p, {{PHONE_HOME_WHOLE_NUMBER, u"555-1234"}}); // Finalize the initial profile. // Note, all other profiles are already finalized. @@ -921,15 +920,15 @@ TEST_P(AutofillProfileComparatorTest, MergeCJKNames) { // Korean names that are all mergeable, but constructed differently. - NameInfo name1 = CreateNameInfo("호", "", "이영", "이영 호"); - NameInfo name2 = CreateNameInfo("이영호", "", "", "이영호"); - NameInfo name3 = CreateNameInfo("영호", "", "이", "이영호"); - NameInfo name4 = CreateNameInfo("영호", "", "이", ""); - NameInfo name5 = CreateNameInfo("영호", "", "이", "이 영호"); + NameInfo name1 = CreateNameInfo(u"호", u"", u"이영", u"이영 호"); + NameInfo name2 = CreateNameInfo(u"이영호", u"", u"", u"이영호"); + NameInfo name3 = CreateNameInfo(u"영호", u"", u"이", u"이영호"); + NameInfo name4 = CreateNameInfo(u"영호", u"", u"이", u""); + NameInfo name5 = CreateNameInfo(u"영호", u"", u"이", u"이 영호"); // Mergeable foreign name in Japanese with a 'KATAKANA MIDDLE DOT'. - NameInfo name6 = CreateNameInfo("", "", "", "ゲイツ・ビル"); - NameInfo name7 = CreateNameInfo("ビル", "", "ゲイツ", ""); + NameInfo name6 = CreateNameInfo(u"", u"", u"", u"ゲイツ・ビル"); + NameInfo name7 = CreateNameInfo(u"ビル", u"", u"ゲイツ", u""); // Set the use dates for the profiles, because |MergeCJKNames()| tries to use // the most recent profile if there is a conflict. The ordering is @@ -949,10 +948,10 @@ AutofillProfile p7 = CreateProfileWithName(name7); // Because |p1| is the most recent, it always wins over others. - MergeNamesAndExpect(p1, p2, CreateNameInfo("호", "", "이영", "이영 호")); - MergeNamesAndExpect(p1, p3, CreateNameInfo("호", "", "이영", "이영 호")); - MergeNamesAndExpect(p1, p4, CreateNameInfo("호", "", "이영", "이영 호")); - MergeNamesAndExpect(p1, p5, CreateNameInfo("호", "", "이영", "이영 호")); + MergeNamesAndExpect(p1, p2, CreateNameInfo(u"호", u"", u"이영", u"이영 호")); + MergeNamesAndExpect(p1, p3, CreateNameInfo(u"호", u"", u"이영", u"이영 호")); + MergeNamesAndExpect(p1, p4, CreateNameInfo(u"호", u"", u"이영", u"이영 호")); + MergeNamesAndExpect(p1, p5, CreateNameInfo(u"호", u"", u"이영", u"이영 호")); // The following tests are not applicable to the logic of the new structured // name. Because we consider not having a surname a valid option for the user. @@ -963,34 +962,36 @@ // |p2| is more recent than |p3|, |p4|, and |p5|. However, it does not // have a surname entry (it was probably parsed with the old logic), so // the other profiles are used as the source for given/surname. - MergeNamesAndExpect(p2, p3, CreateNameInfo("영호", "", "이", "이영호")); - MergeNamesAndExpect(p2, p4, CreateNameInfo("영호", "", "이", "이영호")); - MergeNamesAndExpect(p2, p5, CreateNameInfo("영호", "", "이", "이영호")); + MergeNamesAndExpect(p2, p3, CreateNameInfo(u"영호", u"", u"이", u"이영호")); + MergeNamesAndExpect(p2, p4, CreateNameInfo(u"영호", u"", u"이", u"이영호")); + MergeNamesAndExpect(p2, p5, CreateNameInfo(u"영호", u"", u"이", u"이영호")); } // |p3| is more recent than |p4| and |p5|. - MergeNamesAndExpect(p3, p4, CreateNameInfo("영호", "", "이", "이영호")); - MergeNamesAndExpect(p3, p5, CreateNameInfo("영호", "", "이", "이영호")); + MergeNamesAndExpect(p3, p4, CreateNameInfo(u"영호", u"", u"이", u"이영호")); + MergeNamesAndExpect(p3, p5, CreateNameInfo(u"영호", u"", u"이", u"이영호")); // |p4| is more recent than |p5|. However, it does not have an explicit // full name, so use the one from |p5|. - MergeNamesAndExpect(p4, p5, CreateNameInfo("영호", "", "이", "이 영호")); + MergeNamesAndExpect(p4, p5, CreateNameInfo(u"영호", u"", u"이", u"이 영호")); // There is no conflict between |p6| and |p7|, so use the parts from both. MergeNamesAndExpect(p6, p7, - CreateNameInfo("ビル", "", "ゲイツ", "ゲイツ・ビル")); + CreateNameInfo(u"ビル", u"", u"ゲイツ", u"ゲイツ・ビル")); } TEST_P(AutofillProfileComparatorTest, MergeEmailAddresses) { static const char kEmailA[] = "testaccount@domain.net"; + static const char16_t kEmailA16[] = u"testaccount@domain.net"; static const char kEmailB[] = "TestAccount@Domain.Net"; + static const char16_t kEmailB16[] = u"TestAccount@Domain.Net"; EmailInfo email_a; - email_a.SetRawInfo(EMAIL_ADDRESS, UTF8ToUTF16(kEmailA)); + email_a.SetRawInfo(EMAIL_ADDRESS, kEmailA16); AutofillProfile profile_a = CreateProfileWithEmail(kEmailA); profile_a.set_use_date(AutofillClock::Now()); EmailInfo email_b; - email_b.SetRawInfo(EMAIL_ADDRESS, UTF8ToUTF16(kEmailB)); + email_b.SetRawInfo(EMAIL_ADDRESS, kEmailB16); AutofillProfile profile_b = CreateProfileWithEmail(kEmailB); profile_b.set_use_date(profile_a.use_date() + base::TimeDelta::FromDays(1)); @@ -1002,32 +1003,36 @@ TEST_P(AutofillProfileComparatorTest, MergeCompanyNames) { static const char kCompanyA[] = "Some Company"; + static const char16_t kCompanyA16[] = u"Some Company"; static const char kCompanyB[] = "SÔMÈ ÇÖMPÁÑÝ"; + static const char16_t kCompanyB16[] = u"SÔMÈ ÇÖMPÁÑÝ"; static const char kCompanyC[] = "SÔMÈ ÇÖMPÁÑÝ A.G."; + static const char16_t kCompanyC16[] = u"SÔMÈ ÇÖMPÁÑÝ A.G."; static const char kCompanyD[] = "1987"; + static const char16_t kCompanyD16[] = u"1987"; CompanyInfo company_a; - company_a.SetRawInfo(COMPANY_NAME, UTF8ToUTF16(kCompanyA)); + company_a.SetRawInfo(COMPANY_NAME, kCompanyA16); AutofillProfile profile_a = CreateProfileWithCompanyName(kCompanyA); profile_a.set_use_date(AutofillClock::Now()); // Company Name B is post_normalization identical to Company Name A. The use // date will be used to choose between them. CompanyInfo company_b; - company_b.SetRawInfo(COMPANY_NAME, UTF8ToUTF16(kCompanyB)); + company_b.SetRawInfo(COMPANY_NAME, kCompanyB16); AutofillProfile profile_b = CreateProfileWithCompanyName(kCompanyB); profile_b.set_use_date(profile_a.use_date() + base::TimeDelta::FromDays(1)); // Company Name C is the most complete. Even though it has the earliest use // date, it will be preferred to the other two. CompanyInfo company_c; - company_c.SetRawInfo(COMPANY_NAME, UTF8ToUTF16(kCompanyC)); + company_c.SetRawInfo(COMPANY_NAME, kCompanyC16); AutofillProfile profile_c = CreateProfileWithCompanyName(kCompanyC); profile_c.set_use_date(profile_a.use_date() - base::TimeDelta::FromDays(1)); // Company Name D is in the format of a birthyear, invalid and non-verified. CompanyInfo company_d; - company_d.SetRawInfo(COMPANY_NAME, UTF8ToUTF16(kCompanyD)); + company_d.SetRawInfo(COMPANY_NAME, kCompanyD16); AutofillProfile profile_d = CreateProfileWithCompanyName(kCompanyD); profile_a.set_use_date(AutofillClock::Now()); @@ -1054,16 +1059,23 @@ TEST_P(AutofillProfileComparatorTest, MergePhoneNumbers_NA) { static const char kPhoneA[] = "5550199"; + static const char16_t kPhoneA16[] = u"5550199"; static const char kPhoneB[] = "555.0199"; + static const char16_t kPhoneB16[] = u"555.0199"; static const char kPhoneC[] = "555-0199 ext321"; + static const char16_t kPhoneC16[] = u"555-0199 ext321"; static const char kPhoneD[] = "8005550199"; + static const char16_t kPhoneD16[] = u"8005550199"; static const char kPhoneE[] = "800-555-0199 #321"; + static const char16_t kPhoneE16[] = u"800-555-0199 #321"; static const char kPhoneF[] = "1-800-555-0199 #321"; + static const char16_t kPhoneF16[] = u"1-800-555-0199 #321"; static const char kPhoneG[] = "+1 (800) 555.0199;ext=321"; - static const char kMergedShortNumber[] = "5550199"; - static const char kMergedShortNumberExt[] = "5550199 ext. 321"; - static const char kMergedFullNumber[] = "+1 800-555-0199"; - static const char kMergedFullNumberExt[] = "+1 800-555-0199 ext. 321"; + static const char16_t kPhoneG16[] = u"+1 (800) 555.0199;ext=321"; + static const char16_t kMergedShortNumber[] = u"5550199"; + static const char16_t kMergedShortNumberExt[] = u"5550199 ext. 321"; + static const char16_t kMergedFullNumber[] = u"+1 800-555-0199"; + static const char16_t kMergedFullNumberExt[] = u"+1 800-555-0199 ext. 321"; AutofillProfile profile_a = CreateProfileWithPhoneNumber(kPhoneA); AutofillProfile profile_b = CreateProfileWithPhoneNumber(kPhoneB); @@ -1074,7 +1086,7 @@ AutofillProfile profile_g = CreateProfileWithPhoneNumber(kPhoneG); // Profile A - MergePhoneNumbersAndExpect(profile_a, profile_a, kPhoneA); + MergePhoneNumbersAndExpect(profile_a, profile_a, kPhoneA16); MergePhoneNumbersAndExpect(profile_a, profile_b, kMergedShortNumber); MergePhoneNumbersAndExpect(profile_a, profile_c, kMergedShortNumberExt); MergePhoneNumbersAndExpect(profile_a, profile_d, kMergedFullNumber); @@ -1084,7 +1096,7 @@ // Profile B MergePhoneNumbersAndExpect(profile_b, profile_a, kMergedShortNumber); - MergePhoneNumbersAndExpect(profile_b, profile_b, kPhoneB); + MergePhoneNumbersAndExpect(profile_b, profile_b, kPhoneB16); MergePhoneNumbersAndExpect(profile_b, profile_c, kMergedShortNumberExt); MergePhoneNumbersAndExpect(profile_b, profile_d, kMergedFullNumber); MergePhoneNumbersAndExpect(profile_b, profile_e, kMergedFullNumberExt); @@ -1094,7 +1106,7 @@ // Profile C MergePhoneNumbersAndExpect(profile_c, profile_a, kMergedShortNumberExt); MergePhoneNumbersAndExpect(profile_c, profile_b, kMergedShortNumberExt); - MergePhoneNumbersAndExpect(profile_c, profile_c, kPhoneC); + MergePhoneNumbersAndExpect(profile_c, profile_c, kPhoneC16); MergePhoneNumbersAndExpect(profile_c, profile_d, kMergedFullNumberExt); MergePhoneNumbersAndExpect(profile_c, profile_e, kMergedFullNumberExt); MergePhoneNumbersAndExpect(profile_c, profile_f, kMergedFullNumberExt); @@ -1104,7 +1116,7 @@ MergePhoneNumbersAndExpect(profile_d, profile_a, kMergedFullNumber); MergePhoneNumbersAndExpect(profile_d, profile_b, kMergedFullNumber); MergePhoneNumbersAndExpect(profile_d, profile_c, kMergedFullNumberExt); - MergePhoneNumbersAndExpect(profile_d, profile_d, kPhoneD); + MergePhoneNumbersAndExpect(profile_d, profile_d, kPhoneD16); MergePhoneNumbersAndExpect(profile_d, profile_e, kMergedFullNumberExt); MergePhoneNumbersAndExpect(profile_d, profile_f, kMergedFullNumberExt); MergePhoneNumbersAndExpect(profile_d, profile_g, kMergedFullNumberExt); @@ -1114,7 +1126,7 @@ MergePhoneNumbersAndExpect(profile_e, profile_b, kMergedFullNumberExt); MergePhoneNumbersAndExpect(profile_e, profile_c, kMergedFullNumberExt); MergePhoneNumbersAndExpect(profile_e, profile_d, kMergedFullNumberExt); - MergePhoneNumbersAndExpect(profile_e, profile_e, kPhoneE); + MergePhoneNumbersAndExpect(profile_e, profile_e, kPhoneE16); MergePhoneNumbersAndExpect(profile_e, profile_f, kMergedFullNumberExt); MergePhoneNumbersAndExpect(profile_e, profile_g, kMergedFullNumberExt); @@ -1124,7 +1136,7 @@ MergePhoneNumbersAndExpect(profile_f, profile_c, kMergedFullNumberExt); MergePhoneNumbersAndExpect(profile_f, profile_d, kMergedFullNumberExt); MergePhoneNumbersAndExpect(profile_f, profile_e, kMergedFullNumberExt); - MergePhoneNumbersAndExpect(profile_f, profile_f, kPhoneF); + MergePhoneNumbersAndExpect(profile_f, profile_f, kPhoneF16); MergePhoneNumbersAndExpect(profile_f, profile_g, kMergedFullNumberExt); // Profile G @@ -1134,7 +1146,7 @@ MergePhoneNumbersAndExpect(profile_g, profile_d, kMergedFullNumberExt); MergePhoneNumbersAndExpect(profile_g, profile_e, kMergedFullNumberExt); MergePhoneNumbersAndExpect(profile_g, profile_f, kMergedFullNumberExt); - MergePhoneNumbersAndExpect(profile_g, profile_g, kPhoneG); + MergePhoneNumbersAndExpect(profile_g, profile_g, kPhoneG16); } TEST_P(AutofillProfileComparatorTest, MergePhoneNumbers_Intl) { @@ -1142,11 +1154,15 @@ const AutofillType kCountry(ADDRESS_HOME_COUNTRY); static const char kPhoneA[] = "+49492180185611"; + static const char16_t kPhoneA16[] = u"+49492180185611"; static const char kPhoneB[] = "+49 4921 801 856-11"; + static const char16_t kPhoneB16[] = u"+49 4921 801 856-11"; static const char kPhoneC[] = "+49 4921 8018 5611;ext=22"; + static const char16_t kPhoneC16[] = u"+49 4921 8018 5611;ext=22"; static const char kPhoneD[] = "04921 80185611"; // National Format. - static const char kMergedFullNumber[] = "+49 4921 80185611"; - static const char kMergedFullNumberExt[] = "+49 4921 80185611 ext. 22"; + static const char16_t kPhoneD16[] = u"04921 80185611"; // National Format. + static const char16_t kMergedFullNumber[] = u"+49 4921 80185611"; + static const char16_t kMergedFullNumberExt[] = u"+49 4921 80185611 ext. 22"; AutofillProfile profile_a = CreateProfileWithPhoneNumber(kPhoneA); AutofillProfile profile_b = CreateProfileWithPhoneNumber(kPhoneB); @@ -1159,25 +1175,25 @@ profile_d.SetInfo(kCountry, kGermany, kLocale); // Profile A - MergePhoneNumbersAndExpect(profile_a, profile_a, kPhoneA); + MergePhoneNumbersAndExpect(profile_a, profile_a, kPhoneA16); MergePhoneNumbersAndExpect(profile_a, profile_b, kMergedFullNumber); MergePhoneNumbersAndExpect(profile_a, profile_c, kMergedFullNumberExt); // Profile B MergePhoneNumbersAndExpect(profile_b, profile_a, kMergedFullNumber); - MergePhoneNumbersAndExpect(profile_b, profile_b, kPhoneB); + MergePhoneNumbersAndExpect(profile_b, profile_b, kPhoneB16); MergePhoneNumbersAndExpect(profile_b, profile_c, kMergedFullNumberExt); // Profile C MergePhoneNumbersAndExpect(profile_c, profile_a, kMergedFullNumberExt); MergePhoneNumbersAndExpect(profile_c, profile_b, kMergedFullNumberExt); - MergePhoneNumbersAndExpect(profile_c, profile_c, kPhoneC); + MergePhoneNumbersAndExpect(profile_c, profile_c, kPhoneC16); // Profile D MergePhoneNumbersAndExpect(profile_d, profile_a, kMergedFullNumber); MergePhoneNumbersAndExpect(profile_d, profile_b, kMergedFullNumber); MergePhoneNumbersAndExpect(profile_d, profile_c, kMergedFullNumberExt); - MergePhoneNumbersAndExpect(profile_d, profile_d, kPhoneD); + MergePhoneNumbersAndExpect(profile_d, profile_d, kPhoneD16); } TEST_P(AutofillProfileComparatorTest, MergeAddresses) {
diff --git a/components/autofill/core/browser/data_model/autofill_structured_address.cc b/components/autofill/core/browser/data_model/autofill_structured_address.cc index 0a92649..0fbedb8 100644 --- a/components/autofill/core/browser/data_model/autofill_structured_address.cc +++ b/components/autofill/core/browser/data_model/autofill_structured_address.cc
@@ -150,9 +150,8 @@ base::UTF16ToUTF8(GetRootNode().GetValueForType(ADDRESS_HOME_COUNTRY)); if (country_code == "BR") { - return base::UTF8ToUTF16( - "${ADDRESS_HOME_STREET_NAME}${ADDRESS_HOME_HOUSE_NUMBER;, }" - "${ADDRESS_HOME_FLOOR;, ;º andar}${ADDRESS_HOME_APT_NUM;, apto ;}"); + return u"${ADDRESS_HOME_STREET_NAME}${ADDRESS_HOME_HOUSE_NUMBER;, }" + u"${ADDRESS_HOME_FLOOR;, ;º andar}${ADDRESS_HOME_APT_NUM;, apto ;}"; } if (country_code == "DE") {
diff --git a/components/autofill/core/browser/field_filler_unittest.cc b/components/autofill/core/browser/field_filler_unittest.cc index e4eebbee..b359e402 100644 --- a/components/autofill/core/browser/field_filler_unittest.cc +++ b/components/autofill/core/browser/field_filler_unittest.cc
@@ -36,9 +36,7 @@ #include "third_party/libaddressinput/src/cpp/include/libaddressinput/storage.h" #include "third_party/libaddressinput/src/cpp/test/testdata_source.h" -using base::ASCIIToUTF16; using base::StringToInt; -using base::UTF8ToUTF16; namespace autofill { @@ -136,10 +134,10 @@ } struct CreditCardTestCase { - std::string card_number_; + std::u16string card_number_; size_t total_splits_; std::vector<int> splits_; - std::vector<std::string> expected_results_; + std::vector<std::u16string> expected_results_; }; // Returns the offset to be set within the credit card number field. @@ -539,23 +537,23 @@ struct AutofillFieldFillerTestCase { HtmlFieldType field_type; size_t field_max_length; - std::string expected_value; + std::u16string expected_value; AutofillFieldFillerTestCase(HtmlFieldType field_type, size_t field_max_length, - std::string expected_value) + std::u16string expected_value) : field_type(field_type), field_max_length(field_max_length), expected_value(expected_value) {} }; struct AutofillPhoneFieldFillerTestCase : public AutofillFieldFillerTestCase { - std::string phone_home_whole_number_value; + std::u16string phone_home_whole_number_value; AutofillPhoneFieldFillerTestCase(HtmlFieldType field_type, size_t field_max_length, - std::string expected_value, - std::string phone_home_whole_number_value) + std::u16string expected_value, + std::u16string phone_home_whole_number_value) : AutofillFieldFillerTestCase(field_type, field_max_length, expected_value), @@ -576,10 +574,10 @@ AutofillProfile address; address.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, - ASCIIToUTF16(test_case.phone_home_whole_number_value)); + test_case.phone_home_whole_number_value); FieldFiller filler(/*app_locale=*/"en-US", /*address_normalizer=*/nullptr); filler.FillFormField(field, &address, &field, /*cvc=*/std::u16string()); - EXPECT_EQ(ASCIIToUTF16(test_case.expected_value), field.value); + EXPECT_EQ(test_case.expected_value, field.value); } INSTANTIATE_TEST_SUITE_P( @@ -588,43 +586,43 @@ testing::Values( // Filling a prefix type field should just fill the prefix. AutofillPhoneFieldFillerTestCase{HTML_TYPE_TEL_LOCAL_PREFIX, - /*field_max_length=*/0, "555", - "+15145554578"}, + /*field_max_length=*/0, u"555", + u"+15145554578"}, // Filling a suffix type field with a phone number of 7 digits should // just fill the suffix. AutofillPhoneFieldFillerTestCase{HTML_TYPE_TEL_LOCAL_SUFFIX, - /*field_max_length=*/0, "4578", - "+15145554578"}, + /*field_max_length=*/0, u"4578", + u"+15145554578"}, // Filling a phone type field with a max length of 3 should fill only // the prefix. AutofillPhoneFieldFillerTestCase{HTML_TYPE_TEL_LOCAL, - /*field_max_length=*/3, "555", - "+15145554578"}, + /*field_max_length=*/3, u"555", + u"+15145554578"}, // TODO(crbug.com/581485): There should be a test case where the full // number is requested (HTML_TYPE_TEL) but a field_max_length of 3 would // fill the prefix. // Filling a phone type field with a max length of 4 should fill only // the suffix. AutofillPhoneFieldFillerTestCase{HTML_TYPE_TEL, - /*field_max_length=*/4, "4578", - "+15145554578"}, + /*field_max_length=*/4, u"4578", + u"+15145554578"}, // Filling a phone type field with a max length of 10 with a phone // number including the country code should fill the phone number // without the country code. AutofillPhoneFieldFillerTestCase{HTML_TYPE_TEL, - /*field_max_length=*/10, "5145554578", - "+15145554578"}, + /*field_max_length=*/10, u"5145554578", + u"+15145554578"}, // Filling a phone type field with a max length of 5 with a phone number // should fill with the last 5 digits of that phone number. AutofillPhoneFieldFillerTestCase{HTML_TYPE_TEL, - /*field_max_length=*/5, "54578", - "+15145554578"}, + /*field_max_length=*/5, u"54578", + u"+15145554578"}, // Filling a phone type field with a max length of 10 with a phone // number including the country code should fill the phone number // without the country code. AutofillPhoneFieldFillerTestCase{HTML_TYPE_TEL, - /*field_max_length=*/10, "123456789", - "+886123456789"})); + /*field_max_length=*/10, u"123456789", + u"+886123456789"})); class ExpirationYearTest : public testing::TestWithParam<AutofillFieldFillerTestCase> { @@ -643,7 +641,7 @@ card.SetExpirationDateFromString(u"12/2023"); FieldFiller filler(/*app_locale=*/"en-US", /*address_normalizer=*/nullptr); filler.FillFormField(field, &card, &field, /*cvc=*/std::u16string()); - EXPECT_EQ(ASCIIToUTF16(test_case.expected_value), field.value); + EXPECT_EQ(test_case.expected_value, field.value); } INSTANTIATE_TEST_SUITE_P( @@ -654,37 +652,37 @@ // 2 digits of the expiration year if the field has an unspecified max // length (0) or if it's greater than 1. AutofillFieldFillerTestCase{HTML_TYPE_CREDIT_CARD_EXP_2_DIGIT_YEAR, - /* default value */ 0, "23"}, + /* default value */ 0, u"23"}, AutofillFieldFillerTestCase{HTML_TYPE_CREDIT_CARD_EXP_2_DIGIT_YEAR, 2, - "23"}, + u"23"}, AutofillFieldFillerTestCase{HTML_TYPE_CREDIT_CARD_EXP_2_DIGIT_YEAR, 12, - "23"}, + u"23"}, // A field predicted as a 2 digit expiration year should fill the last // digit of the expiration year if the field has a max length of 1. AutofillFieldFillerTestCase{HTML_TYPE_CREDIT_CARD_EXP_2_DIGIT_YEAR, 1, - "3"}, + u"3"}, // A field predicted as a 4 digit expiration year should fill the 4 // digits of the expiration year if the field has an unspecified max // length (0) or if it's greater than 3 . AutofillFieldFillerTestCase{HTML_TYPE_CREDIT_CARD_EXP_4_DIGIT_YEAR, - /* default value */ 0, "2023"}, + /* default value */ 0, u"2023"}, AutofillFieldFillerTestCase{HTML_TYPE_CREDIT_CARD_EXP_4_DIGIT_YEAR, 4, - "2023"}, + u"2023"}, AutofillFieldFillerTestCase{HTML_TYPE_CREDIT_CARD_EXP_4_DIGIT_YEAR, 12, - "2023"}, + u"2023"}, // A field predicted as a 4 digits expiration year should fill the last // 2 digits of the expiration year if the field has a max length of 2. AutofillFieldFillerTestCase{HTML_TYPE_CREDIT_CARD_EXP_4_DIGIT_YEAR, 2, - "23"}, + u"23"}, // A field predicted as a 4 digits expiration year should fill the last // digit of the expiration year if the field has a max length of 1. AutofillFieldFillerTestCase{HTML_TYPE_CREDIT_CARD_EXP_4_DIGIT_YEAR, 1, - "3"})); + u"3"})); struct FillUtilExpirationDateTestCase { HtmlFieldType field_type; size_t field_max_length; - std::string expected_value; + std::u16string expected_value; bool expected_response; }; @@ -706,7 +704,7 @@ FieldFiller filler(/*app_locale=*/"en-US", /*address_normalizer=*/nullptr); bool response = filler.FillFormField(field, &card, &field, /*cvc=*/std::u16string()); - EXPECT_EQ(ASCIIToUTF16(test_case.expected_value), field.value); + EXPECT_EQ(test_case.expected_value, field.value); EXPECT_EQ(response, test_case.expected_response); } @@ -721,30 +719,30 @@ // 7: Use format MM/YYYY FillUtilExpirationDateTestCase{ HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, - /* default value */ 0, "03/22", true}, + /* default value */ 0, u"03/22", true}, // Unsupported max lengths of 1-3, fail FillUtilExpirationDateTestCase{ - HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, 1, "", false}, + HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, 1, u"", false}, FillUtilExpirationDateTestCase{ - HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, 2, "", false}, + HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, 2, u"", false}, FillUtilExpirationDateTestCase{ - HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, 3, "", false}, + HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, 3, u"", false}, // A max length of 4 indicates a format of MMYY. FillUtilExpirationDateTestCase{ - HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, 4, "0322", true}, + HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, 4, u"0322", true}, // A max length of 6 indicates a format of MMYYYY, the 21st century is // assumed. // Desired case of proper max length >= 5 FillUtilExpirationDateTestCase{ - HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, 5, "03/22", true}, + HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, 5, u"03/22", true}, FillUtilExpirationDateTestCase{ - HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, 6, "032022", true}, + HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, 6, u"032022", true}, // A max length of 7 indicates a format of MM/YYYY, the 21st century is // assumed. FillUtilExpirationDateTestCase{ - HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, 7, "03/2022", true}, + HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, 7, u"03/2022", true}, FillUtilExpirationDateTestCase{ - HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, 12, "03/22", true}, + HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, 12, u"03/22", true}, // A field predicted as a expiration date w/ 4 digit year should fill // with a format of MM/YYYY unless it has max-length of: @@ -753,28 +751,29 @@ // 6: Use format MMYYYY FillUtilExpirationDateTestCase{ HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, - /* default value */ 0, "03/2022", true}, + /* default value */ 0, u"03/2022", true}, // Unsupported max lengths of 1-3, fail FillUtilExpirationDateTestCase{ - HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, 1, "", false}, + HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, 1, u"", false}, FillUtilExpirationDateTestCase{ - HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, 2, "", false}, + HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, 2, u"", false}, FillUtilExpirationDateTestCase{ - HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, 3, "", false}, + HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, 3, u"", false}, // A max length of 4 indicates a format of MMYY. FillUtilExpirationDateTestCase{ - HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, 4, "0322", true}, + HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, 4, u"0322", true}, // A max length of 5 indicates a format of MM/YY. FillUtilExpirationDateTestCase{ - HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, 5, "03/22", true}, + HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, 5, u"03/22", true}, // A max length of 6 indicates a format of MMYYYY. FillUtilExpirationDateTestCase{ - HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, 6, "032022", true}, + HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, 6, u"032022", true}, // Desired case of proper max length >= 7 FillUtilExpirationDateTestCase{ - HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, 7, "03/2022", true}, + HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, 7, u"03/2022", true}, FillUtilExpirationDateTestCase{ - HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, 12, "03/2022", true})); + HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, 12, u"03/2022", + true})); TEST_F(AutofillFieldFillerTest, FillSelectControlByValue) { std::vector<const char*> kOptions = { @@ -823,9 +822,9 @@ struct FillSelectTestCase { std::vector<const char*> select_values; - const char* input_value; - const char* expected_value_without_normalization; - const char* expected_value_with_normalization = nullptr; + const char16_t* input_value; + const char16_t* expected_value_without_normalization; + const char16_t* expected_value_with_normalization = nullptr; }; class AutofillSelectWithStatesTest @@ -880,19 +879,17 @@ // Without a normalizer. AutofillProfile address = test::GetFullProfile(); - address.SetRawInfo(ADDRESS_HOME_STATE, UTF8ToUTF16(test_case.input_value)); + address.SetRawInfo(ADDRESS_HOME_STATE, test_case.input_value); FieldFiller filler(/*app_locale=*/"en-US", /*address_normalizer=*/nullptr); filler.FillFormField(field, &address, &field, /*cvc=*/std::u16string()); // nullptr means we expect them not to match without normalization. if (test_case.expected_value_without_normalization != nullptr) { - EXPECT_EQ(UTF8ToUTF16(test_case.expected_value_without_normalization), - field.value); + EXPECT_EQ(test_case.expected_value_without_normalization, field.value); } // With a normalizer. AutofillProfile canadian_address = test::GetFullCanadianProfile(); - canadian_address.SetRawInfo(ADDRESS_HOME_STATE, - UTF8ToUTF16(test_case.input_value)); + canadian_address.SetRawInfo(ADDRESS_HOME_STATE, test_case.input_value); // Fill a first time without loading the rules for the region. FieldFiller canadian_filler(/*app_locale=*/"en-US", normalizer()); canadian_filler.FillFormField(field, &canadian_address, &field, @@ -900,20 +897,17 @@ // If the expectation with normalization is nullptr, this means that the same // result than without a normalizer is expected. if (test_case.expected_value_with_normalization == nullptr) { - EXPECT_EQ(UTF8ToUTF16(test_case.expected_value_without_normalization), - field.value); + EXPECT_EQ(test_case.expected_value_without_normalization, field.value); } else { // We needed a normalizer with loaded rules. The first fill should have // failed. - EXPECT_NE(UTF8ToUTF16(test_case.expected_value_with_normalization), - field.value); + EXPECT_NE(test_case.expected_value_with_normalization, field.value); // Load the rules and try again. normalizer()->LoadRulesForRegion("CA"); canadian_filler.FillFormField(field, &canadian_address, &field, /*cvc=*/std::u16string()); - EXPECT_EQ(UTF8ToUTF16(test_case.expected_value_with_normalization), - field.value); + EXPECT_EQ(test_case.expected_value_with_normalization, field.value); } } @@ -922,54 +916,54 @@ AutofillSelectWithStatesTest, testing::Values( // Filling the abbreviation. - FillSelectTestCase{{"Alabama", "California"}, "CA", "California"}, + FillSelectTestCase{{"Alabama", "California"}, u"CA", u"California"}, // Attempting to fill the full name in a select full of abbreviations. - FillSelectTestCase{{"AL", "CA"}, "California", "CA"}, + FillSelectTestCase{{"AL", "CA"}, u"California", u"CA"}, // Different case and diacritics. - FillSelectTestCase{{"QUÉBEC", "ALBERTA"}, "Quebec", "QUÉBEC"}, + FillSelectTestCase{{"QUÉBEC", "ALBERTA"}, u"Quebec", u"QUÉBEC"}, // The value and the field options are different but normalize to the // same (NB). FillSelectTestCase{{"Nouveau-Brunswick", "Alberta"}, - "New Brunswick", + u"New Brunswick", nullptr, - "Nouveau-Brunswick"}, - FillSelectTestCase{{"NB", "AB"}, "New Brunswick", nullptr, "NB"}, - FillSelectTestCase{{"NB", "AB"}, "Nouveau-Brunswick", nullptr, "NB"}, + u"Nouveau-Brunswick"}, + FillSelectTestCase{{"NB", "AB"}, u"New Brunswick", nullptr, u"NB"}, + FillSelectTestCase{{"NB", "AB"}, u"Nouveau-Brunswick", nullptr, u"NB"}, FillSelectTestCase{{"Nouveau-Brunswick", "Alberta"}, - "NB", + u"NB", nullptr, - "Nouveau-Brunswick"}, + u"Nouveau-Brunswick"}, FillSelectTestCase{{"New Brunswick", "Alberta"}, - "NB", + u"NB", nullptr, - "New Brunswick"}, + u"New Brunswick"}, // Inexact state names. FillSelectTestCase{ {"SC - South Carolina", "CA - California", "NC - North Carolina"}, - "California", - "CA - California"}, + u"California", + u"CA - California"}, // Don't accidentally match "Virginia" to "West Virginia". FillSelectTestCase{ {"WV - West Virginia", "VA - Virginia", "NV - North Virginia"}, - "Virginia", - "VA - Virginia"}, + u"Virginia", + u"VA - Virginia"}, // Do accidentally match "Virginia" to "West Virginia". // TODO(crbug.com/624770): This test should not pass, but it does // because "Virginia" is a substring of "West Virginia". FillSelectTestCase{{"WV - West Virginia", "TX - Texas"}, - "Virginia", - "WV - West Virginia"}, + u"Virginia", + u"WV - West Virginia"}, // Tests that substring matches work for full state names (a full token // match isn't required). Also tests that matches work for states with // whitespace in the middle. FillSelectTestCase{{"California.", "North Carolina."}, - "North Carolina", - "North Carolina."}, + u"North Carolina", + u"North Carolina."}, FillSelectTestCase{{"NC - North Carolina", "CA - California"}, - "CA", - "CA - California"}, + u"CA", + u"CA - California"}, // These are not states. - FillSelectTestCase{{"NCNCA", "SCNCA"}, "NC", ""})); + FillSelectTestCase{{"NCNCA", "SCNCA"}, u"NC", u""})); TEST_F(AutofillFieldFillerTest, FillSelectWithCountries) { AutofillField field; @@ -1278,16 +1272,12 @@ FieldFiller filler(/*app_locale=*/"en-US", /*address_normalizer=*/nullptr); field.set_heuristic_type(ADDRESS_HOME_STREET_ADDRESS); - std::u16string value = - u"123 Fake St.\n" - u"Apt. 42"; + std::u16string value = u"123 Fake St.\nApt. 42"; address()->SetInfo(AutofillType(ADDRESS_HOME_STREET_ADDRESS), value, "en-US"); filler.FillFormField(field, address(), &field, /*cvc=*/std::u16string()); EXPECT_EQ(value, field.value); - std::u16string ja_value = UTF8ToUTF16( - "桜丘町26-1\n" - "セルリアンタワー6階"); + std::u16string ja_value = u"桜丘町26-1\nセルリアンタワー6階"; address()->SetInfo(AutofillType(ADDRESS_HOME_STREET_ADDRESS), ja_value, "ja-JP"); address()->set_language_code("ja-JP"); @@ -1301,16 +1291,12 @@ field.set_server_type(ADDRESS_HOME_STREET_ADDRESS); FieldFiller filler(/*app_locale=*/"en-US", /*address_normalizer=*/nullptr); - std::u16string value = - u"123 Fake St.\n" - u"Apt. 42"; + std::u16string value = u"123 Fake St.\nApt. 42"; address()->SetInfo(AutofillType(ADDRESS_HOME_STREET_ADDRESS), value, "en-US"); filler.FillFormField(field, address(), &field, /*cvc=*/std::u16string()); EXPECT_EQ(u"123 Fake St., Apt. 42", field.value); - std::u16string ja_value = UTF8ToUTF16( - "桜丘町26-1\n" - "セルリアンタワー6階"); + std::u16string ja_value = u"桜丘町26-1\nセルリアンタワー6階"; address()->SetInfo(AutofillType(ADDRESS_HOME_STREET_ADDRESS), ja_value, "ja-JP"); address()->set_language_code("ja-JP"); @@ -1336,13 +1322,11 @@ TEST_F(AutofillFieldFillerTest, FillCreditCardNumberWithEqualSizeSplits) { // Case 2: card number broken up into four equal groups, of length 4. CreditCardTestCase test; - test.card_number_ = "5187654321098765"; + test.card_number_ = u"5187654321098765"; test.total_splits_ = 4; int splits[] = {4, 4, 4, 4}; test.splits_ = std::vector<int>(splits, splits + base::size(splits)); - std::string results[] = {"5187", "6543", "2109", "8765"}; - test.expected_results_ = - std::vector<std::string>(results, results + base::size(results)); + test.expected_results_ = {u"5187", u"6543", u"2109", u"8765"}; FieldFiller filler(/*app_locale=*/"en-US", /*address_normalizer=*/nullptr); for (size_t i = 0; i < test.total_splits_; ++i) { @@ -1352,12 +1336,12 @@ cc_number_part.set_credit_card_number_offset(4 * i); // Fill with a card-number; should fill just the card_number_part. - credit_card()->SetNumber(ASCIIToUTF16(test.card_number_)); + credit_card()->SetNumber(test.card_number_); filler.FillFormField(cc_number_part, credit_card(), &cc_number_part, /*cvc=*/std::u16string()); // Verify for expected results. - EXPECT_EQ(ASCIIToUTF16(test.expected_results_[i]), + EXPECT_EQ(test.expected_results_[i], cc_number_part.value.substr(0, cc_number_part.max_length)); EXPECT_EQ(4 * i, cc_number_part.credit_card_number_offset()); } @@ -1366,25 +1350,23 @@ AutofillField cc_number_full; cc_number_full.set_heuristic_type(CREDIT_CARD_NUMBER); - credit_card()->SetNumber(ASCIIToUTF16(test.card_number_)); + credit_card()->SetNumber(test.card_number_); filler.FillFormField(cc_number_full, credit_card(), &cc_number_full, /*cvc=*/std::u16string()); // Verify for expected results. - EXPECT_EQ(ASCIIToUTF16(test.card_number_), cc_number_full.value); + EXPECT_EQ(test.card_number_, cc_number_full.value); } TEST_F(AutofillFieldFillerTest, FillCreditCardNumberWithUnequalSizeSplits) { // Case 3: card with 15 digits number, broken up into three unequal groups, of // lengths 4, 6, and 5. CreditCardTestCase test; - test.card_number_ = "423456789012345"; + test.card_number_ = u"423456789012345"; test.total_splits_ = 3; int splits[] = {4, 6, 5}; test.splits_ = std::vector<int>(splits, splits + base::size(splits)); - std::string results[] = {"4234", "567890", "12345"}; - test.expected_results_ = - std::vector<std::string>(results, results + base::size(results)); + test.expected_results_ = {u"4234", u"567890", u"12345"}; FieldFiller filler(/*app_locale=*/"en-US", /*address_normalizer=*/nullptr); // Start executing test cases to verify parts and full credit card number. @@ -1395,12 +1377,12 @@ cc_number_part.set_credit_card_number_offset(GetNumberOffset(i, test)); // Fill with a card-number; should fill just the card_number_part. - credit_card()->SetNumber(ASCIIToUTF16(test.card_number_)); + credit_card()->SetNumber(test.card_number_); filler.FillFormField(cc_number_part, credit_card(), &cc_number_part, /*cvc=*/std::u16string()); // Verify for expected results. - EXPECT_EQ(ASCIIToUTF16(test.expected_results_[i]), + EXPECT_EQ(test.expected_results_[i], cc_number_part.value.substr(0, cc_number_part.max_length)); EXPECT_EQ(GetNumberOffset(i, test), cc_number_part.credit_card_number_offset()); @@ -1409,12 +1391,12 @@ // Verify that full card-number shall get fill properly as well. AutofillField cc_number_full; cc_number_full.set_heuristic_type(CREDIT_CARD_NUMBER); - credit_card()->SetNumber(ASCIIToUTF16(test.card_number_)); + credit_card()->SetNumber(test.card_number_); filler.FillFormField(cc_number_full, credit_card(), &cc_number_full, /*cvc=*/std::u16string()); // Verify for expected results. - EXPECT_EQ(ASCIIToUTF16(test.card_number_), cc_number_full.value); + EXPECT_EQ(test.card_number_, cc_number_full.value); } TEST_F(AutofillFieldFillerTest, FindShortestSubstringMatchInSelect) { @@ -1464,8 +1446,8 @@ struct FillStateTextTestCase { HtmlFieldType field_type; size_t field_max_length; - std::string value_to_fill; - std::string expected_value; + std::u16string value_to_fill; + std::u16string expected_value; bool should_fill; }; @@ -1483,12 +1465,12 @@ FieldFiller filler(/*app_locale=*/"en-US", /*address_normalizer=*/nullptr); AutofillProfile address = test::GetFullProfile(); - address.SetRawInfo(ADDRESS_HOME_STATE, UTF8ToUTF16(test_case.value_to_fill)); + address.SetRawInfo(ADDRESS_HOME_STATE, test_case.value_to_fill); bool has_filled = filler.FillFormField(field, &address, &field, /*cvc=*/std::u16string()); EXPECT_EQ(test_case.should_fill, has_filled); - EXPECT_EQ(ASCIIToUTF16(test_case.expected_value), field.value); + EXPECT_EQ(test_case.expected_value, field.value); } INSTANTIATE_TEST_SUITE_P( @@ -1499,28 +1481,28 @@ // should // fill the state value as is. FillStateTextTestCase{HTML_TYPE_ADDRESS_LEVEL1, /* default value */ 0, - "New York", "New York", true}, + u"New York", u"New York", true}, FillStateTextTestCase{HTML_TYPE_ADDRESS_LEVEL1, /* default value */ 0, - "NY", "NY", true}, + u"NY", u"NY", true}, // Filling a state to a text field with a maxlength value equal to the // value's length should fill the state value as is. - FillStateTextTestCase{HTML_TYPE_ADDRESS_LEVEL1, 8, "New York", - "New York", true}, + FillStateTextTestCase{HTML_TYPE_ADDRESS_LEVEL1, 8, u"New York", + u"New York", true}, // Filling a state to a text field with a maxlength value lower than the // value's length but higher than the value's abbreviation should fill // the state abbreviation. - FillStateTextTestCase{HTML_TYPE_ADDRESS_LEVEL1, 2, "New York", "NY", + FillStateTextTestCase{HTML_TYPE_ADDRESS_LEVEL1, 2, u"New York", u"NY", true}, - FillStateTextTestCase{HTML_TYPE_ADDRESS_LEVEL1, 2, "NY", "NY", true}, + FillStateTextTestCase{HTML_TYPE_ADDRESS_LEVEL1, 2, u"NY", u"NY", true}, // Filling a state to a text field with a maxlength value lower than the // value's length and the value's abbreviation should not fill at all. - FillStateTextTestCase{HTML_TYPE_ADDRESS_LEVEL1, 1, "New York", "", + FillStateTextTestCase{HTML_TYPE_ADDRESS_LEVEL1, 1, u"New York", u"", false}, - FillStateTextTestCase{HTML_TYPE_ADDRESS_LEVEL1, 1, "NY", "", false}, + FillStateTextTestCase{HTML_TYPE_ADDRESS_LEVEL1, 1, u"NY", u"", false}, // Filling a state to a text field with a maxlength value lower than the // value's length and that has no associated abbreviation should not // fill at all. - FillStateTextTestCase{HTML_TYPE_ADDRESS_LEVEL1, 3, "Quebec", "", + FillStateTextTestCase{HTML_TYPE_ADDRESS_LEVEL1, 3, u"Quebec", u"", false})); // Tests that the correct option is chosen in the selection box when one of the
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 54e0c2e..2d04f20 100644 --- a/components/autofill/core/browser/form_parsing/form_field_unittest.cc +++ b/components/autofill/core/browser/form_parsing/form_field_unittest.cc
@@ -15,7 +15,6 @@ #include "testing/gtest/include/gtest/gtest.h" using autofill::features::kAutofillFixFillableFieldTypes; -using base::ASCIIToUTF16; namespace autofill { @@ -26,9 +25,9 @@ } // Sets both the field label and parseable label to |label|. -void SetFieldLabels(AutofillField* field, const std::string& label) { - field->label = base::UTF8ToUTF16(label); - field->set_parseable_label(base::UTF8ToUTF16(label)); +void SetFieldLabels(AutofillField* field, const std::u16string& label) { + field->label = label; + field->set_parseable_label(label); } } // namespace @@ -40,76 +39,76 @@ EXPECT_TRUE(FormField::Match(&field, std::u16string(), MATCH_LABEL)); // Empty pattern matches non-empty string. - SetFieldLabels(&field, "a"); + SetFieldLabels(&field, u"a"); EXPECT_TRUE(FormField::Match(&field, std::u16string(), MATCH_LABEL)); // Strictly empty pattern matches empty string. - SetFieldLabels(&field, ""); + SetFieldLabels(&field, u""); EXPECT_TRUE(FormField::Match(&field, u"^$", MATCH_LABEL)); // Strictly empty pattern does not match non-empty string. - SetFieldLabels(&field, "a"); + SetFieldLabels(&field, u"a"); EXPECT_FALSE(FormField::Match(&field, u"^$", MATCH_LABEL)); // Non-empty pattern doesn't match empty string. - SetFieldLabels(&field, ""); + SetFieldLabels(&field, u""); EXPECT_FALSE(FormField::Match(&field, u"a", MATCH_LABEL)); // Beginning of line. - SetFieldLabels(&field, "head_tail"); + SetFieldLabels(&field, u"head_tail"); EXPECT_TRUE(FormField::Match(&field, u"^head", MATCH_LABEL)); EXPECT_FALSE(FormField::Match(&field, u"^tail", MATCH_LABEL)); // End of line. - SetFieldLabels(&field, "head_tail"); + SetFieldLabels(&field, u"head_tail"); EXPECT_FALSE(FormField::Match(&field, u"head$", MATCH_LABEL)); EXPECT_TRUE(FormField::Match(&field, u"tail$", MATCH_LABEL)); // Exact. - SetFieldLabels(&field, "head_tail"); + SetFieldLabels(&field, u"head_tail"); EXPECT_FALSE(FormField::Match(&field, u"^head$", MATCH_LABEL)); EXPECT_FALSE(FormField::Match(&field, u"^tail$", MATCH_LABEL)); EXPECT_TRUE(FormField::Match(&field, u"^head_tail$", MATCH_LABEL)); // Escaped dots. - SetFieldLabels(&field, "m.i."); + SetFieldLabels(&field, u"m.i."); // Note: This pattern is misleading as the "." characters are wild cards. EXPECT_TRUE(FormField::Match(&field, u"m.i.", MATCH_LABEL)); EXPECT_TRUE(FormField::Match(&field, u"m\\.i\\.", MATCH_LABEL)); - SetFieldLabels(&field, "mXiX"); + SetFieldLabels(&field, u"mXiX"); EXPECT_TRUE(FormField::Match(&field, u"m.i.", MATCH_LABEL)); EXPECT_FALSE(FormField::Match(&field, u"m\\.i\\.", MATCH_LABEL)); // Repetition. - SetFieldLabels(&field, "headtail"); + SetFieldLabels(&field, u"headtail"); EXPECT_TRUE(FormField::Match(&field, u"head.*tail", MATCH_LABEL)); - SetFieldLabels(&field, "headXtail"); + SetFieldLabels(&field, u"headXtail"); EXPECT_TRUE(FormField::Match(&field, u"head.*tail", MATCH_LABEL)); - SetFieldLabels(&field, "headXXXtail"); + SetFieldLabels(&field, u"headXXXtail"); EXPECT_TRUE(FormField::Match(&field, u"head.*tail", MATCH_LABEL)); - SetFieldLabels(&field, "headtail"); + SetFieldLabels(&field, u"headtail"); EXPECT_FALSE(FormField::Match(&field, u"head.+tail", MATCH_LABEL)); - SetFieldLabels(&field, "headXtail"); + SetFieldLabels(&field, u"headXtail"); EXPECT_TRUE(FormField::Match(&field, u"head.+tail", MATCH_LABEL)); - SetFieldLabels(&field, "headXXXtail"); + SetFieldLabels(&field, u"headXXXtail"); EXPECT_TRUE(FormField::Match(&field, u"head.+tail", MATCH_LABEL)); // Alternation. - SetFieldLabels(&field, "head_tail"); + SetFieldLabels(&field, u"head_tail"); EXPECT_TRUE(FormField::Match(&field, u"head|other", MATCH_LABEL)); EXPECT_TRUE(FormField::Match(&field, u"tail|other", MATCH_LABEL)); EXPECT_FALSE(FormField::Match(&field, u"bad|good", MATCH_LABEL)); // Case sensitivity. - SetFieldLabels(&field, "xxxHeAd_tAiLxxx"); + SetFieldLabels(&field, u"xxxHeAd_tAiLxxx"); EXPECT_TRUE(FormField::Match(&field, u"head_tail", MATCH_LABEL)); // Word boundaries. - SetFieldLabels(&field, "contains word:"); + SetFieldLabels(&field, u"contains word:"); EXPECT_TRUE(FormField::Match(&field, u"\\bword\\b", MATCH_LABEL)); EXPECT_FALSE(FormField::Match(&field, u"\\bcon\\b", MATCH_LABEL)); - // Make sure the circumflex in 'crepe' is not treated as a word boundary. - field.label = base::UTF8ToUTF16("cr\xC3\xAApe"); + // Make sure the circumflex in 'crêpe' is not treated as a word boundary. + field.label = u"crêpe"; EXPECT_FALSE(FormField::Match(&field, u"\\bcr\\b", MATCH_LABEL)); }
diff --git a/components/autofill/core/browser/form_processing/name_processing_util.cc b/components/autofill/core/browser/form_processing/name_processing_util.cc index 29140ba..fc78a6ca 100644 --- a/components/autofill/core/browser/form_processing/name_processing_util.cc +++ b/components/autofill/core/browser/form_processing/name_processing_util.cc
@@ -28,7 +28,7 @@ constexpr int kMinCommonNameLongPrefixLength = 16; // Regular expression for checking if |parseable_name| is valid after stripping // affixes. -constexpr char kParseableNameValidationRe[] = "\\D"; +constexpr char16_t kParseableNameValidationRe[] = u"\\D"; using NamePieces = std::vector<base::StringPiece16>; using OptionalNamePieces = base::Optional<NamePieces>; @@ -85,7 +85,7 @@ // is the |autofill::kParseableNameValidationRe| regex. bool IsValidParseableName(const base::StringPiece16 parseable_name) { static const std::u16string kParseableNameValidationPattern = - base::UTF8ToUTF16(kParseableNameValidationRe); + kParseableNameValidationRe; return MatchesPattern(parseable_name, kParseableNameValidationPattern); }
diff --git a/components/autofill/core/browser/geo/phone_number_i18n_unittest.cc b/components/autofill/core/browser/geo/phone_number_i18n_unittest.cc index 5b5148f..9139a8e 100644 --- a/components/autofill/core/browser/geo/phone_number_i18n_unittest.cc +++ b/components/autofill/core/browser/geo/phone_number_i18n_unittest.cc
@@ -15,9 +15,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/libphonenumber/phonenumber_api.h" -using base::ASCIIToUTF16; -using base::UTF8ToUTF16; - namespace autofill { using i18n::ConstructPhoneNumber; @@ -26,20 +23,15 @@ using i18n::PhoneNumbersMatch; TEST(PhoneNumberI18NTest, NormalizePhoneNumber) { - // "Large" digits. - std::u16string phone1( - UTF8ToUTF16("\xEF\xBC\x91\xEF\xBC\x96\xEF\xBC\x95\xEF\xBC\x90" - "\xEF\xBC\x97\xEF\xBC\x94\xEF\xBC\x99\xEF\xBC\x98" - "\xEF\xBC\x93\xEF\xBC\x92\xEF\xBC\x93")); + // "Large" digits; these are not ASCII. + std::u16string phone1(u"16507498323"); EXPECT_EQ(NormalizePhoneNumber(phone1, "US"), u"16507498323"); // Devanagari script digits. - std::u16string phone2( - UTF8ToUTF16("\xD9\xA1\xD9\xA6\xD9\xA5\xD9\xA0\xD9\xA8\xD9\xA3" - "\xD9\xA2\xD9\xA3\xD9\xA7\xD9\xA4\xD9\xA9")); + std::u16string phone2(u"١٦٥٠٨٣٢٣٧٤٩"); EXPECT_EQ(NormalizePhoneNumber(phone2, "US"), u"16508323749"); - std::u16string phone3(UTF8ToUTF16("16503334\xef\xbc\x92\x35\xd9\xa5")); + std::u16string phone3(u"1650333425٥"); EXPECT_EQ(NormalizePhoneNumber(phone3, "US"), u"16503334255"); std::u16string phone4(u"+1(650)2346789"); @@ -53,20 +45,20 @@ // Expected parsing result. bool isPossibleNumber; // Inputs. - std::string input; + std::u16string input; std::string assumed_region; // Further expectations. - std::string number; - std::string city_code; - std::string country_code; + std::u16string number; + std::u16string city_code; + std::u16string country_code; std::string deduced_region; }; namespace { // Returns a string which is too long to be considered a phone number. -std::string GenerateTooLongString() { - return std::string(i18n::kMaxPhoneNumberSize + 1, '7'); +std::u16string GenerateTooLongString() { + return std::u16string(i18n::kMaxPhoneNumberSize + 1, u'7'); } } // namespace @@ -75,19 +67,18 @@ TEST_P(ParseNumberTest, ParsePhoneNumber) { auto test_case = GetParam(); - SCOPED_TRACE("Testing phone number " + test_case.input); + SCOPED_TRACE(test_case.input.c_str()); std::u16string country_code, city_code, number; std::string deduced_region; ::i18n::phonenumbers::PhoneNumber unused_i18n_number; - EXPECT_EQ( - test_case.isPossibleNumber, - ParsePhoneNumber(UTF8ToUTF16(test_case.input), test_case.assumed_region, - &country_code, &city_code, &number, &deduced_region, - &unused_i18n_number)); - EXPECT_EQ(ASCIIToUTF16(test_case.number), number); - EXPECT_EQ(ASCIIToUTF16(test_case.city_code), city_code); - EXPECT_EQ(ASCIIToUTF16(test_case.country_code), country_code); + EXPECT_EQ(test_case.isPossibleNumber, + ParsePhoneNumber(test_case.input, test_case.assumed_region, + &country_code, &city_code, &number, + &deduced_region, &unused_i18n_number)); + EXPECT_EQ(test_case.number, number); + EXPECT_EQ(test_case.city_code, city_code); + EXPECT_EQ(test_case.country_code, country_code); EXPECT_EQ(test_case.deduced_region, deduced_region); } @@ -96,99 +87,93 @@ ParseNumberTest, testing::Values( // Test for empty string. Should give back empty strings. - ParseNumberTestCase{false, "", "US"}, + ParseNumberTestCase{false, u"", "US"}, // Test for string with less than 7 digits. Should give back empty // strings. - ParseNumberTestCase{false, "1234", "US"}, + ParseNumberTestCase{false, u"1234", "US"}, // Too long strings should not be parsed. ParseNumberTestCase{false, GenerateTooLongString(), "US"}, // Test for string with exactly 7 digits. It is too short. // Should fail parsing in US. - ParseNumberTestCase{false, "17134567", "US"}, + ParseNumberTestCase{false, u"17134567", "US"}, // Does not have area code, but still a possible number with // unknown("ZZ") deduced region. - ParseNumberTestCase{true, "7134567", "US", "7134567", "", "", "ZZ"}, + ParseNumberTestCase{true, u"7134567", "US", u"7134567", u"", u"", "ZZ"}, // Valid Canadian toll-free number. - ParseNumberTestCase{true, "3101234", "CA", "3101234", "", "", "ZZ"}, + ParseNumberTestCase{true, u"3101234", "CA", u"3101234", u"", u"", "ZZ"}, // Test for string with greater than 7 digits but less than 10 digits. // Should fail parsing in US. - ParseNumberTestCase{false, "123456789", "US"}, + ParseNumberTestCase{false, u"123456789", "US"}, // Test for string with greater than 7 digits but less than 10 digits // and // separators. // Should fail parsing in US. - ParseNumberTestCase{false, "12.345-6789", "US"}, + ParseNumberTestCase{false, u"12.345-6789", "US"}, // Non-printable ASCII. - ParseNumberTestCase{false, "123\x11", "US"}, - ParseNumberTestCase{false, - "123\x7F" - "567", - "US"}, + ParseNumberTestCase{false, u"123", "US"}, + ParseNumberTestCase{false, u"123\u007f567", "US"}, // Unicode noncharacters. - ParseNumberTestCase{false, - "1\xEF\xB7\xAF" - "23", - "US"}, - // Invalid UTF8. - ParseNumberTestCase{false, "1\xC0", "US"}, + ParseNumberTestCase{false, u"1\ufdef23", "US"}, + // Invalid UTF16. + ParseNumberTestCase{false, u"1\xdfff", "US"}, // Test for string with exactly 10 digits. // Should give back phone number and city code. // This one has an incorrect area code but could still be a possible // number with unknown("ZZ") deducted region. - ParseNumberTestCase{true, "1234567890", "US", "1234567890", "", "", + ParseNumberTestCase{true, u"1234567890", "US", u"1234567890", u"", u"", "ZZ"}, // This is actually not a valid number because the first number after // area code is 1. But it's still a possible number, just with deduced // country set to unknown("ZZ"). - ParseNumberTestCase{true, "6501567890", "US", "1567890", "650", "", + ParseNumberTestCase{true, u"6501567890", "US", u"1567890", u"650", u"", "ZZ"}, - ParseNumberTestCase{true, "6504567890", "US", "4567890", "650", "", + ParseNumberTestCase{true, u"6504567890", "US", u"4567890", u"650", u"", "US"}, // Test for string with exactly 10 digits and separators. // Should give back phone number and city code. - ParseNumberTestCase{true, "(650) 456-7890", "US", "4567890", "650", "", - "US"}, + ParseNumberTestCase{true, u"(650) 456-7890", "US", u"4567890", u"650", + u"", "US"}, // Tests for string with over 10 digits. // 01 is incorrect prefix in the USA, we interpret 011 as prefix, and // rest is parsed as a Singapore number(country code "SG"). - ParseNumberTestCase{true, "0116504567890", "US", "04567890", "", "65", - "SG"}, + ParseNumberTestCase{true, u"0116504567890", "US", u"04567890", u"", + u"65", "SG"}, // 011 is a correct "dial out" prefix in the USA - the parsing should // succeed. - ParseNumberTestCase{true, "01116504567890", "US", "4567890", "650", "1", - "US"}, + ParseNumberTestCase{true, u"01116504567890", "US", u"4567890", u"650", + u"1", "US"}, // 011 is a correct "dial out" prefix in the USA but the rest of the // number // can't parse as a US number. - ParseNumberTestCase{true, "01178124567890", "US", "4567890", "812", "7", - "RU"}, + ParseNumberTestCase{true, u"01178124567890", "US", u"4567890", u"812", + u"7", "RU"}, // Test for string with over 10 digits with separator characters. // Should give back phone number, city code, and country code. "011" is // US "dial out" code, which is discarded. - ParseNumberTestCase{true, "(0111) 650-456.7890", "US", "4567890", "650", - "1", "US"}, + ParseNumberTestCase{true, u"(0111) 650-456.7890", "US", u"4567890", + u"650", u"1", "US"}, // Now try phone from Czech republic - it has 00 dial out code, 420 // country // code and variable length area codes. - ParseNumberTestCase{true, "+420 27-89.10.112", "US", "910112", "278", - "420", "CZ"}, - ParseNumberTestCase{false, "27-89.10.112", "US"}, - ParseNumberTestCase{true, "27-89.10.112", "CZ", "910112", "278", "", + ParseNumberTestCase{true, u"+420 27-89.10.112", "US", u"910112", u"278", + u"420", "CZ"}, + ParseNumberTestCase{false, u"27-89.10.112", "US"}, + ParseNumberTestCase{true, u"27-89.10.112", "CZ", u"910112", u"278", u"", "CZ"}, - ParseNumberTestCase{false, "420 57-89.10.112", "US"}, - ParseNumberTestCase{true, "420 57-89.10.112", "CZ", "910112", "578", - "420", "CZ"}, + ParseNumberTestCase{false, u"420 57-89.10.112", "US"}, + ParseNumberTestCase{true, u"420 57-89.10.112", "CZ", u"910112", u"578", + u"420", "CZ"}, // Parses vanity numbers. - ParseNumberTestCase{true, "1-650-FLOWERS", "US", "3569377", "650", "1", - "US"}, + ParseNumberTestCase{true, u"1-650-FLOWERS", "US", u"3569377", u"650", + u"1", "US"}, // 800 is not an area code, but the destination code. In our library // these // codes should be treated the same as area codes. - ParseNumberTestCase{true, "1-800-FLOWERS", "US", "3569377", "800", "1", - "US"}, + ParseNumberTestCase{true, u"1-800-FLOWERS", "US", u"3569377", u"800", + u"1", "US"}, // Don't add a country code where there was none. - ParseNumberTestCase{true, "(08) 450 777 7777", "DE", "7777777", "8450", - "", "DE"})); + ParseNumberTestCase{true, u"(08) 450 777 7777", "DE", u"7777777", + u"8450", u"", "DE"})); TEST(PhoneNumberI18NTest, ConstructPhoneNumber) { std::u16string number; @@ -316,18 +301,18 @@ // Test for the GetFormattedPhoneNumberForDisplay method. struct PhoneNumberFormatCase { - PhoneNumberFormatCase(const char* phone, - const char* country, - const char* expected_format, + PhoneNumberFormatCase(const char16_t* phone, + const char16_t* country, + const char16_t* expected_format, const char* locale = "") : phone(phone), country(country), expected_format(expected_format), locale(locale) {} - const char* phone; - const char* country; - const char* expected_format; + const char16_t* phone; + const char16_t* country; + const char16_t* expected_format; const char* locale; }; @@ -337,13 +322,10 @@ TEST_P(GetFormattedPhoneNumberForDisplayTest, GetFormattedPhoneNumberForDisplay) { AutofillProfile profile; - profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16(GetParam().phone)); - profile.SetRawInfo(ADDRESS_HOME_COUNTRY, - base::UTF8ToUTF16(GetParam().country)); - EXPECT_EQ(GetParam().expected_format, - base::UTF16ToUTF8(i18n::GetFormattedPhoneNumberForDisplay( - profile, GetParam().locale))); + profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, GetParam().phone); + profile.SetRawInfo(ADDRESS_HOME_COUNTRY, GetParam().country); + EXPECT_EQ(GetParam().expected_format, i18n::GetFormattedPhoneNumberForDisplay( + profile, GetParam().locale)); } INSTANTIATE_TEST_SUITE_P( @@ -354,104 +336,104 @@ // US phone in US. ////////////////////////// // Formatted phone numbers. - PhoneNumberFormatCase("+1 415-555-5555", "US", "+1 415-555-5555"), - PhoneNumberFormatCase("1 415-555-5555", "US", "+1 415-555-5555"), - PhoneNumberFormatCase("415-555-5555", "US", "+1 415-555-5555"), + PhoneNumberFormatCase(u"+1 415-555-5555", u"US", u"+1 415-555-5555"), + PhoneNumberFormatCase(u"1 415-555-5555", u"US", u"+1 415-555-5555"), + PhoneNumberFormatCase(u"415-555-5555", u"US", u"+1 415-555-5555"), // Raw phone numbers. - PhoneNumberFormatCase("+14155555555", "US", "+1 415-555-5555"), - PhoneNumberFormatCase("14155555555", "US", "+1 415-555-5555"), - PhoneNumberFormatCase("4155555555", "US", "+1 415-555-5555"), + PhoneNumberFormatCase(u"+14155555555", u"US", u"+1 415-555-5555"), + PhoneNumberFormatCase(u"14155555555", u"US", u"+1 415-555-5555"), + PhoneNumberFormatCase(u"4155555555", u"US", u"+1 415-555-5555"), ////////////////////////// // US phone in CA. ////////////////////////// // Formatted phone numbers. - PhoneNumberFormatCase("+1 415-555-5555", "CA", "+1 415-555-5555"), - PhoneNumberFormatCase("1 415-555-5555", "CA", "+1 415-555-5555"), - PhoneNumberFormatCase("415-555-5555", "CA", "+1 415-555-5555"), + PhoneNumberFormatCase(u"+1 415-555-5555", u"CA", u"+1 415-555-5555"), + PhoneNumberFormatCase(u"1 415-555-5555", u"CA", u"+1 415-555-5555"), + PhoneNumberFormatCase(u"415-555-5555", u"CA", u"+1 415-555-5555"), // Raw phone numbers. - PhoneNumberFormatCase("+14155555555", "CA", "+1 415-555-5555"), - PhoneNumberFormatCase("14155555555", "CA", "+1 415-555-5555"), - PhoneNumberFormatCase("4155555555", "CA", "+1 415-555-5555"), + PhoneNumberFormatCase(u"+14155555555", u"CA", u"+1 415-555-5555"), + PhoneNumberFormatCase(u"14155555555", u"CA", u"+1 415-555-5555"), + PhoneNumberFormatCase(u"4155555555", u"CA", u"+1 415-555-5555"), ////////////////////////// // US phone in AU. ////////////////////////// // A US phone with the country code is correctly formatted as an US // number. - PhoneNumberFormatCase("+1 415-555-5555", "AU", "+1 415-555-5555"), - PhoneNumberFormatCase("1 415-555-5555", "AU", "+1 415-555-5555"), + PhoneNumberFormatCase(u"+1 415-555-5555", u"AU", u"+1 415-555-5555"), + PhoneNumberFormatCase(u"1 415-555-5555", u"AU", u"+1 415-555-5555"), // Without a country code, the phone is formatted for the profile's // country, if it's valid. - PhoneNumberFormatCase("2 9374 4000", "AU", "+61 2 9374 4000"), + PhoneNumberFormatCase(u"2 9374 4000", u"AU", u"+61 2 9374 4000"), // Without a country code, formatting returns the number as entered by // user, if it's invalid. - PhoneNumberFormatCase("415-555-5555", "AU", "4155555555"), + PhoneNumberFormatCase(u"415-555-5555", u"AU", u"4155555555"), ////////////////////////// // US phone in MX. ////////////////////////// // A US phone with the country code is correctly formatted as an US // number. - PhoneNumberFormatCase("+1 415-555-5555", "MX", "+1 415-555-5555"), + PhoneNumberFormatCase(u"+1 415-555-5555", u"MX", u"+1 415-555-5555"), // "+52 415 555 5555" is a valid number for Mexico, - PhoneNumberFormatCase("1 415-555-5555", "MX", "+52 415 555 5555"), + PhoneNumberFormatCase(u"1 415-555-5555", u"MX", u"+52 415 555 5555"), // Without a country code, the phone is formatted for the profile's // country. - PhoneNumberFormatCase("415-555-5555", "MX", "+52 415 555 5555"), + PhoneNumberFormatCase(u"415-555-5555", u"MX", u"+52 415 555 5555"), ////////////////////////// // AU phone in AU. ////////////////////////// // Formatted phone numbers. - PhoneNumberFormatCase("+61 2 9374 4000", "AU", "+61 2 9374 4000"), - PhoneNumberFormatCase("61 2 9374 4000", "AU", "+61 2 9374 4000"), - PhoneNumberFormatCase("02 9374 4000", "AU", "+61 2 9374 4000"), - PhoneNumberFormatCase("2 9374 4000", "AU", "+61 2 9374 4000"), + PhoneNumberFormatCase(u"+61 2 9374 4000", u"AU", u"+61 2 9374 4000"), + PhoneNumberFormatCase(u"61 2 9374 4000", u"AU", u"+61 2 9374 4000"), + PhoneNumberFormatCase(u"02 9374 4000", u"AU", u"+61 2 9374 4000"), + PhoneNumberFormatCase(u"2 9374 4000", u"AU", u"+61 2 9374 4000"), // Raw phone numbers. - PhoneNumberFormatCase("+61293744000", "AU", "+61 2 9374 4000"), - PhoneNumberFormatCase("61293744000", "AU", "+61 2 9374 4000"), - PhoneNumberFormatCase("0293744000", "AU", "+61 2 9374 4000"), - PhoneNumberFormatCase("293744000", "AU", "+61 2 9374 4000"), + PhoneNumberFormatCase(u"+61293744000", u"AU", u"+61 2 9374 4000"), + PhoneNumberFormatCase(u"61293744000", u"AU", u"+61 2 9374 4000"), + PhoneNumberFormatCase(u"0293744000", u"AU", u"+61 2 9374 4000"), + PhoneNumberFormatCase(u"293744000", u"AU", u"+61 2 9374 4000"), ////////////////////////// // AU phone in US. ////////////////////////// // An AU phone with the country code is correctly formatted as an AU // number. - PhoneNumberFormatCase("+61 2 9374 4000", "US", "+61 2 9374 4000"), - PhoneNumberFormatCase("61 2 9374 4000", "US", "+61 2 9374 4000"), + PhoneNumberFormatCase(u"+61 2 9374 4000", u"US", u"+61 2 9374 4000"), + PhoneNumberFormatCase(u"61 2 9374 4000", u"US", u"+61 2 9374 4000"), // Without a country code, the phone is formatted for the profile's // country. // This local AU number is associated with US profile, the number is // not a valid US number, therefore formatting will just return what // user entered. - PhoneNumberFormatCase("02 9374 4000", "US", "0293744000"), + PhoneNumberFormatCase(u"02 9374 4000", u"US", u"0293744000"), // This local GR(Greece) number is formatted as an US number, if it's // valid US number. - PhoneNumberFormatCase("22 6800 0090", "US", "+1 226-800-0090"), + PhoneNumberFormatCase(u"22 6800 0090", u"US", u"+1 226-800-0090"), ////////////////////////// // MX phone in MX. ////////////////////////// // Formatted phone numbers. - PhoneNumberFormatCase("+52 55 5342 8400", "MX", "+52 55 5342 8400"), - PhoneNumberFormatCase("52 55 5342 8400", "MX", "+52 55 5342 8400"), - PhoneNumberFormatCase("55 5342 8400", "MX", "+52 55 5342 8400"), + PhoneNumberFormatCase(u"+52 55 5342 8400", u"MX", u"+52 55 5342 8400"), + PhoneNumberFormatCase(u"52 55 5342 8400", u"MX", u"+52 55 5342 8400"), + PhoneNumberFormatCase(u"55 5342 8400", u"MX", u"+52 55 5342 8400"), // Raw phone numbers. - PhoneNumberFormatCase("+525553428400", "MX", "+52 55 5342 8400"), - PhoneNumberFormatCase("525553428400", "MX", "+52 55 5342 8400"), - PhoneNumberFormatCase("5553428400", "MX", "+52 55 5342 8400"), + PhoneNumberFormatCase(u"+525553428400", u"MX", u"+52 55 5342 8400"), + PhoneNumberFormatCase(u"525553428400", u"MX", u"+52 55 5342 8400"), + PhoneNumberFormatCase(u"5553428400", u"MX", u"+52 55 5342 8400"), ////////////////////////// // MX phone in US. ////////////////////////// // A MX phone with the country code is correctly formatted as a MX // number. - PhoneNumberFormatCase("+52 55 5342 8400", "US", "+52 55 5342 8400"), - PhoneNumberFormatCase("52 55 5342 8400", "US", "+52 55 5342 8400"), + PhoneNumberFormatCase(u"+52 55 5342 8400", u"US", u"+52 55 5342 8400"), + PhoneNumberFormatCase(u"52 55 5342 8400", u"US", u"+52 55 5342 8400"), // This number is not a valid US number, we won't try to format. - PhoneNumberFormatCase("55 5342 8400", "US", "5553428400"))); + PhoneNumberFormatCase(u"55 5342 8400", u"US", u"5553428400"))); INSTANTIATE_TEST_SUITE_P( GetFormattedPhoneNumberForDisplay_EdgeCases, @@ -461,31 +443,40 @@ // No country. ////////////////////////// // Fallback to locale if no country is set. - PhoneNumberFormatCase("52 55 5342 8400", - "", - "+52 55 5342 8400", + PhoneNumberFormatCase(u"52 55 5342 8400", + u"", + u"+52 55 5342 8400", "es_MX"), - PhoneNumberFormatCase("55 5342 8400", "", "+52 55 5342 8400", "es_MX"), - PhoneNumberFormatCase("61 2 9374 4000", "", "+61 2 9374 4000", "en_AU"), - PhoneNumberFormatCase("02 9374 4000", "", "+61 2 9374 4000", "en_AU"), + PhoneNumberFormatCase(u"55 5342 8400", + u"", + u"+52 55 5342 8400", + "es_MX"), + PhoneNumberFormatCase(u"61 2 9374 4000", + u"", + u"+61 2 9374 4000", + "en_AU"), + PhoneNumberFormatCase(u"02 9374 4000", + u"", + u"+61 2 9374 4000", + "en_AU"), // Numbers in local format yet are invalid with user locale, user might // be trying to enter a foreign number, calling formatting will just // return what the user entered. - PhoneNumberFormatCase("55 5342 8400", "", "5553428400", "en_US"), - PhoneNumberFormatCase("55 5342 8400", "", "5553428400"), - PhoneNumberFormatCase("226 123 1234", "", "2261231234", "en_US"), - PhoneNumberFormatCase("293744000", "", "293744000"), - PhoneNumberFormatCase("02 9374 4000", "", "0293744000"), + PhoneNumberFormatCase(u"55 5342 8400", u"", u"5553428400", "en_US"), + PhoneNumberFormatCase(u"55 5342 8400", u"", u"5553428400"), + PhoneNumberFormatCase(u"226 123 1234", u"", u"2261231234", "en_US"), + PhoneNumberFormatCase(u"293744000", u"", u"293744000"), + PhoneNumberFormatCase(u"02 9374 4000", u"", u"0293744000"), ////////////////////////// // No country or locale. ////////////////////////// // Format according to the country code. - PhoneNumberFormatCase("61 2 9374 4000", "", "+61 2 9374 4000"), - PhoneNumberFormatCase("52 55 5342 8400", "", "+52 55 5342 8400"), - PhoneNumberFormatCase("1 415 555 5555", "", "+1 415-555-5555"), + PhoneNumberFormatCase(u"61 2 9374 4000", u"", u"+61 2 9374 4000"), + PhoneNumberFormatCase(u"52 55 5342 8400", u"", u"+52 55 5342 8400"), + PhoneNumberFormatCase(u"1 415 555 5555", u"", u"+1 415-555-5555"), // If no country code is found, formats for US. - PhoneNumberFormatCase("415-555-5555", "", "+1 415-555-5555"))); + PhoneNumberFormatCase(u"415-555-5555", u"", u"+1 415-555-5555"))); } // namespace autofill
diff --git a/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc b/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc index 96ab3fdb..890cfee8 100644 --- a/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc +++ b/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc
@@ -82,10 +82,10 @@ const char kTestGUID[] = "00000000-0000-0000-0000-000000000001"; const char kTestNumber[] = "4234567890123456"; // Visa const char16_t kTestNumber16[] = u"4234567890123456"; -const char kTestCvc[] = "123"; const char16_t kTestCvc16[] = u"123"; #if !defined(OS_IOS) +const char kTestCvc[] = "123"; // Base64 encoding of "This is a test challenge". constexpr char kTestChallenge[] = "VGhpcyBpcyBhIHRlc3QgY2hhbGxlbmdl"; // Base64 encoding of "This is a test Credential ID". @@ -1844,8 +1844,8 @@ CreateServerCard(kTestGUID, kTestNumber, /*masked=*/false); CreditCard* unmasked_card = credit_card_access_manager_->GetCreditCard(kTestGUID); - credit_card_access_manager_->CacheUnmaskedCardInfo( - *unmasked_card, base::UTF8ToUTF16(kTestCvc)); + credit_card_access_manager_->CacheUnmaskedCardInfo(*unmasked_card, + kTestCvc16); CreateServerCard(kTestGUID, kTestNumber, /*masked=*/true); CreditCard* masked_card =
diff --git a/components/autofill/core/browser/personal_data_manager_unittest.cc b/components/autofill/core/browser/personal_data_manager_unittest.cc index 10e3952..a10d33c 100644 --- a/components/autofill/core/browser/personal_data_manager_unittest.cc +++ b/components/autofill/core/browser/personal_data_manager_unittest.cc
@@ -78,6 +78,7 @@ namespace { const char kPrimaryAccountEmail[] = "syncuser@example.com"; +const char16_t kPrimaryAccountEmail16[] = u"syncuser@example.com"; const char kSyncTransportAccountEmail[] = "transport@example.com"; enum UserMode { USER_MODE_NORMAL, USER_MODE_INCOGNITO }; @@ -3975,7 +3976,7 @@ // merge logic works correctly. typedef struct { autofill::ServerFieldType field_type; - std::string field_value; + std::u16string field_value; } ProfileField; typedef std::vector<ProfileField> ProfileFields; @@ -4036,7 +4037,7 @@ // Apply changes to the original profile (if applicable). for (ProfileField change : test_case.changes_to_original) { original_profile.SetRawInfoWithVerificationStatus( - change.field_type, base::UTF8ToUTF16(change.field_value), + change.field_type, change.field_value, structured_address::VerificationStatus::kObserved); } @@ -4052,7 +4053,7 @@ // Apply changes to the second profile (if applicable). for (ProfileField change : test_case.changes_to_new) { profile2.SetRawInfoWithVerificationStatus( - change.field_type, base::UTF8ToUTF16(change.field_value), + change.field_type, change.field_value, structured_address::VerificationStatus::kObserved); } @@ -4085,7 +4086,7 @@ // Make sure the new information was merged correctly. for (ProfileField changed_field : test_case.changed_field_values) { - EXPECT_EQ(base::UTF8ToUTF16(changed_field.field_value), + EXPECT_EQ(changed_field.field_value, saved_profiles.front()->GetRawInfo(changed_field.field_type)); } // Verify that the merged profile's use count, use date and modification @@ -4121,66 +4122,66 @@ // Test that saving an identical profile except for the name results // in two profiles being saved. SaveImportedProfileTestCase{ProfileFields(), - {{NAME_FIRST, "Marionette"}}}, + {{NAME_FIRST, u"Marionette"}}}, // Test that saving an identical profile except with the middle name // initial instead of the full middle name results in the profiles // getting merged and the full middle name being kept. SaveImportedProfileTestCase{ ProfileFields(), - {{NAME_MIDDLE, "M"}}, - {{NAME_MIDDLE, "Mitchell"}, - {NAME_FULL, "Marion Mitchell Morrison"}}}, + {{NAME_MIDDLE, u"M"}}, + {{NAME_MIDDLE, u"Mitchell"}, + {NAME_FULL, u"Marion Mitchell Morrison"}}}, // Test that saving an identical profile except with the full middle // name instead of the middle name initial results in the profiles // getting merged and the full middle name replacing the initial. - SaveImportedProfileTestCase{{{NAME_MIDDLE, "M"}}, - {{NAME_MIDDLE, "Mitchell"}}, - {{NAME_MIDDLE, "Mitchell"}}}, + SaveImportedProfileTestCase{{{NAME_MIDDLE, u"M"}}, + {{NAME_MIDDLE, u"Mitchell"}}, + {{NAME_MIDDLE, u"Mitchell"}}}, // Test that saving an identical profile except with no middle name // results in the profiles getting merged and the full middle name // being kept. SaveImportedProfileTestCase{ProfileFields(), - {{NAME_MIDDLE, ""}}, - {{NAME_MIDDLE, "Mitchell"}}}, + {{NAME_MIDDLE, u""}}, + {{NAME_MIDDLE, u"Mitchell"}}}, // Test that saving an identical profile except with a middle name // initial results in the profiles getting merged and the middle // name initial being saved. - SaveImportedProfileTestCase{{{NAME_MIDDLE, ""}}, - {{NAME_MIDDLE, "M"}}, - {{NAME_MIDDLE, "M"}}}, + SaveImportedProfileTestCase{{{NAME_MIDDLE, u""}}, + {{NAME_MIDDLE, u"M"}}, + {{NAME_MIDDLE, u"M"}}}, // Test that saving an identical profile except with a middle name // results in the profiles getting merged and the full middle name // being saved. - SaveImportedProfileTestCase{{{NAME_MIDDLE, ""}}, - {{NAME_MIDDLE, "Mitchell"}}, - {{NAME_MIDDLE, "Mitchell"}}}, + SaveImportedProfileTestCase{{{NAME_MIDDLE, u""}}, + {{NAME_MIDDLE, u"Mitchell"}}, + {{NAME_MIDDLE, u"Mitchell"}}}, // Test that saving a identical profile except with the full name // set instead of the name parts results in the two profiles being // merged and all the name parts kept and the full name being added. SaveImportedProfileTestCase{ { - {NAME_FIRST, "Marion"}, - {NAME_MIDDLE, "Mitchell"}, - {NAME_LAST, "Morrison"}, - {NAME_FULL, ""}, + {NAME_FIRST, u"Marion"}, + {NAME_MIDDLE, u"Mitchell"}, + {NAME_LAST, u"Morrison"}, + {NAME_FULL, u""}, }, { - {NAME_FIRST, ""}, - {NAME_MIDDLE, ""}, - {NAME_LAST, ""}, - {NAME_FULL, "Marion Mitchell Morrison"}, + {NAME_FIRST, u""}, + {NAME_MIDDLE, u""}, + {NAME_LAST, u""}, + {NAME_FULL, u"Marion Mitchell Morrison"}, }, { - {NAME_FIRST, "Marion"}, - {NAME_MIDDLE, "Mitchell"}, - {NAME_LAST, "Morrison"}, - {NAME_FULL, "Marion Mitchell Morrison"}, + {NAME_FIRST, u"Marion"}, + {NAME_MIDDLE, u"Mitchell"}, + {NAME_LAST, u"Morrison"}, + {NAME_FULL, u"Marion Mitchell Morrison"}, }, }, @@ -4190,22 +4191,22 @@ // added. SaveImportedProfileTestCase{ { - {NAME_FIRST, ""}, - {NAME_MIDDLE, ""}, - {NAME_LAST, ""}, - {NAME_FULL, "Marion Mitchell Morrison"}, + {NAME_FIRST, u""}, + {NAME_MIDDLE, u""}, + {NAME_LAST, u""}, + {NAME_FULL, u"Marion Mitchell Morrison"}, }, { - {NAME_FIRST, "Marion"}, - {NAME_MIDDLE, "Mitchell"}, - {NAME_LAST, "Morrison"}, - {NAME_FULL, ""}, + {NAME_FIRST, u"Marion"}, + {NAME_MIDDLE, u"Mitchell"}, + {NAME_LAST, u"Morrison"}, + {NAME_FULL, u""}, }, { - {NAME_FIRST, "Marion"}, - {NAME_MIDDLE, "Mitchell"}, - {NAME_LAST, "Morrison"}, - {NAME_FULL, "Marion Mitchell Morrison"}, + {NAME_FIRST, u"Marion"}, + {NAME_MIDDLE, u"Mitchell"}, + {NAME_LAST, u"Morrison"}, + {NAME_FULL, u"Marion Mitchell Morrison"}, }, }, @@ -4214,16 +4215,16 @@ // names are different. SaveImportedProfileTestCase{ { - {NAME_FIRST, "Marion"}, - {NAME_MIDDLE, "Mitchell"}, - {NAME_LAST, "Morrison"}, - {NAME_FULL, ""}, + {NAME_FIRST, u"Marion"}, + {NAME_MIDDLE, u"Mitchell"}, + {NAME_LAST, u"Morrison"}, + {NAME_FULL, u""}, }, { - {NAME_FIRST, ""}, - {NAME_MIDDLE, ""}, - {NAME_LAST, ""}, - {NAME_FULL, "John Thompson Smith"}, + {NAME_FIRST, u""}, + {NAME_MIDDLE, u""}, + {NAME_LAST, u""}, + {NAME_FULL, u"John Thompson Smith"}, }, }, @@ -4232,16 +4233,16 @@ // names are different. SaveImportedProfileTestCase{ { - {NAME_FIRST, ""}, - {NAME_MIDDLE, ""}, - {NAME_LAST, ""}, - {NAME_FULL, "John Thompson Smith"}, + {NAME_FIRST, u""}, + {NAME_MIDDLE, u""}, + {NAME_LAST, u""}, + {NAME_FULL, u"John Thompson Smith"}, }, { - {NAME_FIRST, "Marion"}, - {NAME_MIDDLE, "Mitchell"}, - {NAME_LAST, "Morrison"}, - {NAME_FULL, ""}, + {NAME_FIRST, u"Marion"}, + {NAME_MIDDLE, u"Mitchell"}, + {NAME_LAST, u"Morrison"}, + {NAME_FULL, u""}, }, }, @@ -4249,146 +4250,147 @@ // address line results in two profiles being saved. SaveImportedProfileTestCase{ ProfileFields(), - {{ADDRESS_HOME_LINE1, "123 Aquarium St."}}}, + {{ADDRESS_HOME_LINE1, u"123 Aquarium St."}}}, // Test that saving an identical profile except for the second // address line results in two profiles being saved. SaveImportedProfileTestCase{ProfileFields(), - {{ADDRESS_HOME_LINE2, "unit 7"}}}, + {{ADDRESS_HOME_LINE2, u"unit 7"}}}, // Tests that saving an identical profile that has a new piece of // information (company name) results in a merge and that the // original empty value gets overwritten by the new information. - SaveImportedProfileTestCase{{{COMPANY_NAME, ""}}, + SaveImportedProfileTestCase{{{COMPANY_NAME, u""}}, ProfileFields(), - {{COMPANY_NAME, "Fox"}}}, + {{COMPANY_NAME, u"Fox"}}}, // Tests that saving an identical profile except a loss of // information results in a merge but the original value is not // overwritten (no information loss). SaveImportedProfileTestCase{ProfileFields(), - {{COMPANY_NAME, ""}}, - {{COMPANY_NAME, "Fox"}}}, + {{COMPANY_NAME, u""}}, + {{COMPANY_NAME, u"Fox"}}}, // Tests that saving an identical profile except a slightly // different postal code results in a merge with the new value kept. - SaveImportedProfileTestCase{{{ADDRESS_HOME_ZIP, "R2C 0A1"}}, - {{ADDRESS_HOME_ZIP, "R2C0A1"}}, - {{ADDRESS_HOME_ZIP, "R2C0A1"}}}, - SaveImportedProfileTestCase{{{ADDRESS_HOME_ZIP, "R2C0A1"}}, - {{ADDRESS_HOME_ZIP, "R2C 0A1"}}, - {{ADDRESS_HOME_ZIP, "R2C 0A1"}}}, - SaveImportedProfileTestCase{{{ADDRESS_HOME_ZIP, "r2c 0a1"}}, - {{ADDRESS_HOME_ZIP, "R2C0A1"}}, - {{ADDRESS_HOME_ZIP, "R2C0A1"}}}, + SaveImportedProfileTestCase{{{ADDRESS_HOME_ZIP, u"R2C 0A1"}}, + {{ADDRESS_HOME_ZIP, u"R2C0A1"}}, + {{ADDRESS_HOME_ZIP, u"R2C0A1"}}}, + SaveImportedProfileTestCase{{{ADDRESS_HOME_ZIP, u"R2C0A1"}}, + {{ADDRESS_HOME_ZIP, u"R2C 0A1"}}, + {{ADDRESS_HOME_ZIP, u"R2C 0A1"}}}, + SaveImportedProfileTestCase{{{ADDRESS_HOME_ZIP, u"r2c 0a1"}}, + {{ADDRESS_HOME_ZIP, u"R2C0A1"}}, + {{ADDRESS_HOME_ZIP, u"R2C0A1"}}}, // Tests that saving an identical profile plus a new piece of // information on the address line 2 results in a merge and that the // original empty value gets overwritten by the new information. - SaveImportedProfileTestCase{{{ADDRESS_HOME_LINE2, ""}}, + SaveImportedProfileTestCase{{{ADDRESS_HOME_LINE2, u""}}, ProfileFields(), - {{ADDRESS_HOME_LINE2, "unit 5"}}}, + {{ADDRESS_HOME_LINE2, u"unit 5"}}}, // Tests that saving an identical profile except a loss of // information on the address line 2 results in a merge but that the // original value gets not overwritten (no information loss). SaveImportedProfileTestCase{ProfileFields(), - {{ADDRESS_HOME_LINE2, ""}}, - {{ADDRESS_HOME_LINE2, "unit 5"}}}, + {{ADDRESS_HOME_LINE2, u""}}, + {{ADDRESS_HOME_LINE2, u"unit 5"}}}, // Tests that saving an identical except with more punctuation in // the fist address line, while the second is empty, results in a // merge and that the original address gets overwritten. - SaveImportedProfileTestCase{{{ADDRESS_HOME_LINE2, ""}}, - {{ADDRESS_HOME_LINE2, ""}, - {ADDRESS_HOME_LINE1, "123, Zoo St."}}, - {{ADDRESS_HOME_LINE1, "123, Zoo St."}}}, + SaveImportedProfileTestCase{ + {{ADDRESS_HOME_LINE2, u""}}, + {{ADDRESS_HOME_LINE2, u""}, + {ADDRESS_HOME_LINE1, u"123, Zoo St."}}, + {{ADDRESS_HOME_LINE1, u"123, Zoo St."}}}, // Tests that saving an identical profile except with less // punctuation in the fist address line, while the second is empty, // results in a merge and that the longer address is retained. - SaveImportedProfileTestCase{{{ADDRESS_HOME_LINE2, ""}, - {ADDRESS_HOME_LINE1, "123, Zoo St."}}, - {{ADDRESS_HOME_LINE2, ""}}, - {{ADDRESS_HOME_LINE1, "123 Zoo St"}}}, + SaveImportedProfileTestCase{{{ADDRESS_HOME_LINE2, u""}, + {ADDRESS_HOME_LINE1, u"123, Zoo St."}}, + {{ADDRESS_HOME_LINE2, u""}}, + {{ADDRESS_HOME_LINE1, u"123 Zoo St"}}}, // Tests that saving an identical profile except additional // punctuation in the two address lines results in a merge and that // the newer address is retained. SaveImportedProfileTestCase{ProfileFields(), - {{ADDRESS_HOME_LINE1, "123, Zoo St."}, - {ADDRESS_HOME_LINE2, "unit. 5"}}, - {{ADDRESS_HOME_LINE1, "123, Zoo St."}, - {ADDRESS_HOME_LINE2, "unit. 5"}}}, + {{ADDRESS_HOME_LINE1, u"123, Zoo St."}, + {ADDRESS_HOME_LINE2, u"unit. 5"}}, + {{ADDRESS_HOME_LINE1, u"123, Zoo St."}, + {ADDRESS_HOME_LINE2, u"unit. 5"}}}, // Tests that saving an identical profile except less punctuation in // the two address lines results in a merge and that the newer // address is retained. - SaveImportedProfileTestCase{{{ADDRESS_HOME_LINE1, "123, Zoo St."}, - {ADDRESS_HOME_LINE2, "unit. 5"}}, + SaveImportedProfileTestCase{{{ADDRESS_HOME_LINE1, u"123, Zoo St."}, + {ADDRESS_HOME_LINE2, u"unit. 5"}}, ProfileFields(), - {{ADDRESS_HOME_LINE1, "123 Zoo St"}, - {ADDRESS_HOME_LINE2, "unit 5"}}}, + {{ADDRESS_HOME_LINE1, u"123 Zoo St"}, + {ADDRESS_HOME_LINE2, u"unit 5"}}}, // Tests that saving an identical profile with accented characters // in the two address lines results in a merge and that the newer // address is retained. SaveImportedProfileTestCase{ProfileFields(), - {{ADDRESS_HOME_LINE1, "123 Zôö St"}, - {ADDRESS_HOME_LINE2, "üñìt 5"}}, - {{ADDRESS_HOME_LINE1, "123 Zôö St"}, - {ADDRESS_HOME_LINE2, "üñìt 5"}}}, + {{ADDRESS_HOME_LINE1, u"123 Zôö St"}, + {ADDRESS_HOME_LINE2, u"üñìt 5"}}, + {{ADDRESS_HOME_LINE1, u"123 Zôö St"}, + {ADDRESS_HOME_LINE2, u"üñìt 5"}}}, // Tests that saving an identical profile without accented // characters in the two address lines results in a merge and that // the newer address is retained. - SaveImportedProfileTestCase{{{ADDRESS_HOME_LINE1, "123 Zôö St"}, - {ADDRESS_HOME_LINE2, "üñìt 5"}}, + SaveImportedProfileTestCase{{{ADDRESS_HOME_LINE1, u"123 Zôö St"}, + {ADDRESS_HOME_LINE2, u"üñìt 5"}}, ProfileFields(), - {{ADDRESS_HOME_LINE1, "123 Zoo St"}, - {ADDRESS_HOME_LINE2, "unit 5"}}}, + {{ADDRESS_HOME_LINE1, u"123 Zoo St"}, + {ADDRESS_HOME_LINE2, u"unit 5"}}}, // Tests that saving an identical profile except that the address // line 1 is in the address line 2 results in a merge and that the // multi-lne address is retained. SaveImportedProfileTestCase{ ProfileFields(), - {{ADDRESS_HOME_LINE1, "123 Zoo St, unit 5"}, - {ADDRESS_HOME_LINE2, ""}}, - {{ADDRESS_HOME_LINE1, "123 Zoo St"}, - {ADDRESS_HOME_LINE2, "unit 5"}}}, + {{ADDRESS_HOME_LINE1, u"123 Zoo St, unit 5"}, + {ADDRESS_HOME_LINE2, u""}}, + {{ADDRESS_HOME_LINE1, u"123 Zoo St"}, + {ADDRESS_HOME_LINE2, u"unit 5"}}}, // Tests that saving an identical profile except that the address // line 2 contains part of the old address line 1 results in a merge // and that the original address lines of the reference profile get // overwritten. SaveImportedProfileTestCase{ - {{ADDRESS_HOME_LINE1, "123 Zoo St, unit 5"}, - {ADDRESS_HOME_LINE2, ""}}, + {{ADDRESS_HOME_LINE1, u"123 Zoo St, unit 5"}, + {ADDRESS_HOME_LINE2, u""}}, ProfileFields(), - {{ADDRESS_HOME_LINE1, "123 Zoo St"}, - {ADDRESS_HOME_LINE2, "unit 5"}}}, + {{ADDRESS_HOME_LINE1, u"123 Zoo St"}, + {ADDRESS_HOME_LINE2, u"unit 5"}}}, // Tests that saving an identical profile except that the state is // the abbreviation instead of the full form results in a merge and // that the original state gets overwritten. - SaveImportedProfileTestCase{{{ADDRESS_HOME_STATE, "California"}}, + SaveImportedProfileTestCase{{{ADDRESS_HOME_STATE, u"California"}}, ProfileFields(), - {{ADDRESS_HOME_STATE, "CA"}}}, + {{ADDRESS_HOME_STATE, u"CA"}}}, // Tests that saving an identical profile except that the state is // the full form instead of the abbreviation results in a merge and // that the abbreviated state is retained. SaveImportedProfileTestCase{ProfileFields(), - {{ADDRESS_HOME_STATE, "California"}}, - {{ADDRESS_HOME_STATE, "CA"}}}, + {{ADDRESS_HOME_STATE, u"California"}}, + {{ADDRESS_HOME_STATE, u"CA"}}}, // Tests that saving and identical profile except that the company // name has different punctuation and case results in a merge and // that the syntax of the new profile replaces the old one. - SaveImportedProfileTestCase{{{COMPANY_NAME, "Stark inc"}}, - {{COMPANY_NAME, "Stark Inc."}}, - {{COMPANY_NAME, "Stark Inc."}}}))); + SaveImportedProfileTestCase{{{COMPANY_NAME, u"Stark inc"}}, + {{COMPANY_NAME, u"Stark Inc."}}, + {{COMPANY_NAME, u"Stark Inc."}}}))); // Tests that MergeProfile tries to merge the imported profile into the // existing profile in decreasing order of frecency. @@ -5667,8 +5669,7 @@ // Make sure that the added address has the email address of the currently // signed-in user. - EXPECT_EQ(base::UTF8ToUTF16(kPrimaryAccountEmail), - profiles[0]->GetRawInfo(EMAIL_ADDRESS)); + EXPECT_EQ(kPrimaryAccountEmail16, profiles[0]->GetRawInfo(EMAIL_ADDRESS)); } // Tests that the converted wallet address is merged into an existing local @@ -7839,16 +7840,16 @@ } struct ShareNicknameTestParam { - std::string local_nickname; - std::string server_nickname; - std::string expected_nickname; + std::u16string local_nickname; + std::u16string server_nickname; + std::u16string expected_nickname; }; const ShareNicknameTestParam kShareNicknameTestParam[] = { - {"", "", ""}, - {"", "server nickname", "server nickname"}, - {"local nickname", "", "local nickname"}, - {"local nickname", "server nickname", "local nickname"}, + {u"", u"", u""}, + {u"", u"server nickname", u"server nickname"}, + {u"local nickname", u"", u"local nickname"}, + {u"local nickname", u"server nickname", u"local nickname"}, }; class PersonalDataManagerTestForSharingNickname @@ -7856,9 +7857,9 @@ public testing::WithParamInterface<ShareNicknameTestParam> { public: PersonalDataManagerTestForSharingNickname() - : local_nickname_(base::UTF8ToUTF16(GetParam().local_nickname)), - server_nickname_(base::UTF8ToUTF16(GetParam().server_nickname)), - expected_nickname_(base::UTF8ToUTF16(GetParam().expected_nickname)) {} + : local_nickname_(GetParam().local_nickname), + server_nickname_(GetParam().server_nickname), + expected_nickname_(GetParam().expected_nickname) {} CreditCard GetLocalCard() { CreditCard local_card("287151C8-6AB1-487C-9095-28E80BE5DA15",
diff --git a/components/autofill/core/browser/strike_database_integrator_base.h b/components/autofill/core/browser/strike_database_integrator_base.h index 8e9296e3..db76b433 100644 --- a/components/autofill/core/browser/strike_database_integrator_base.h +++ b/components/autofill/core/browser/strike_database_integrator_base.h
@@ -55,8 +55,8 @@ void ClearAllStrikes(); protected: - // Removes all strikes in which it has been longer than GetExpiryTimeMicros() - // past |last_update_timestamp|. + // Removes one strike for each key where it has been longer than + // GetExpiryTimeMicros() since |last_update_timestamp|. void RemoveExpiredStrikes(); private:
diff --git a/components/autofill/core/browser/ui/address_form_label_formatter_unittest.cc b/components/autofill/core/browser/ui/address_form_label_formatter_unittest.cc index c77fd7f..04f396f 100644 --- a/components/autofill/core/browser/ui/address_form_label_formatter_unittest.cc +++ b/components/autofill/core/browser/ui/address_form_label_formatter_unittest.cc
@@ -175,9 +175,8 @@ LabelFormatter::Create(profiles, "pt-BR", NAME_FIRST, GetFieldTypes()); EXPECT_THAT(formatter->GetLabels(), - ElementsAre(base::UTF8ToUTF16( - "Av. Pedro Álvares Cabral, 1301, Vila Mariana, São " - "Paulo-SP, 04094-050"))); + ElementsAre(u"Av. Pedro Álvares Cabral, 1301, Vila Mariana, São " + u"Paulo-SP, 04094-050")); } TEST(AddressFormLabelFormatterTest, GetLabelsForFormWithoutName) {
diff --git a/components/autofill/ios/form_util/form_activity_tab_helper.h b/components/autofill/ios/form_util/form_activity_tab_helper.h index 8411714..8ec5596a 100644 --- a/components/autofill/ios/form_util/form_activity_tab_helper.h +++ b/components/autofill/ios/form_util/form_activity_tab_helper.h
@@ -7,7 +7,6 @@ #include "base/macros.h" #include "base/observer_list.h" -#include "base/values.h" #include "ios/web/public/web_state_observer.h" #import "ios/web/public/web_state_user_data.h"
diff --git a/components/data_use_measurement/core/data_use_tracker_prefs_unittest.cc b/components/data_use_measurement/core/data_use_tracker_prefs_unittest.cc index 1e0c7e3..ca9de52e 100644 --- a/components/data_use_measurement/core/data_use_tracker_prefs_unittest.cc +++ b/components/data_use_measurement/core/data_use_tracker_prefs_unittest.cc
@@ -58,12 +58,12 @@ DataUseTrackerPrefsTest tracker_prefs_test_1(&clock, &test_prefs); tracker_prefs_test_1.data_use_tracker_prefs()->ReportNetworkServiceDataUse( true, true, true, 10); - EXPECT_EQ(1u, - test_prefs.GetDictionary(prefs::kDataUsedUserForeground)->size()); + EXPECT_EQ( + 1u, test_prefs.GetDictionary(prefs::kDataUsedUserForeground)->DictSize()); tracker_prefs_test_1.data_use_tracker_prefs()->ReportNetworkServiceDataUse( true, true, true, 10); - EXPECT_EQ(1u, - test_prefs.GetDictionary(prefs::kDataUsedUserForeground)->size()); + EXPECT_EQ( + 1u, test_prefs.GetDictionary(prefs::kDataUsedUserForeground)->DictSize()); // Verify other prefs are not set. EXPECT_TRUE( @@ -77,24 +77,24 @@ // entry in the dictionary pref. clock.Advance(base::TimeDelta::FromDays(10)); DataUseTrackerPrefsTest tracker_prefs_test_2(&clock, &test_prefs); - EXPECT_EQ(1u, - test_prefs.GetDictionary(prefs::kDataUsedUserForeground)->size()); + EXPECT_EQ( + 1u, test_prefs.GetDictionary(prefs::kDataUsedUserForeground)->DictSize()); tracker_prefs_test_2.data_use_tracker_prefs()->ReportNetworkServiceDataUse( true, true, true, 10); - EXPECT_EQ(2u, - test_prefs.GetDictionary(prefs::kDataUsedUserForeground)->size()); + EXPECT_EQ( + 2u, test_prefs.GetDictionary(prefs::kDataUsedUserForeground)->DictSize()); // Move clock forward 55 days. This should clean up the first entry since they // are now 65 days older (i.e., more than 60 days old). New data use reported // must go in a separate entry in the dictionary pref. clock.Advance(base::TimeDelta::FromDays(55)); DataUseTrackerPrefsTest tracker_prefs_test_3(&clock, &test_prefs); - EXPECT_EQ(1u, - test_prefs.GetDictionary(prefs::kDataUsedUserForeground)->size()); + EXPECT_EQ( + 1u, test_prefs.GetDictionary(prefs::kDataUsedUserForeground)->DictSize()); tracker_prefs_test_2.data_use_tracker_prefs()->ReportNetworkServiceDataUse( true, true, true, 10); - EXPECT_EQ(2u, - test_prefs.GetDictionary(prefs::kDataUsedUserForeground)->size()); + EXPECT_EQ( + 2u, test_prefs.GetDictionary(prefs::kDataUsedUserForeground)->DictSize()); } // Verifies that the prefs are not updated on unmetered connections.
diff --git a/components/digital_asset_links/digital_asset_links_handler.h b/components/digital_asset_links/digital_asset_links_handler.h index d612ccd..b828d35 100644 --- a/components/digital_asset_links/digital_asset_links_handler.h +++ b/components/digital_asset_links/digital_asset_links_handler.h
@@ -13,7 +13,6 @@ #include "base/memory/weak_ptr.h" #include "base/optional.h" #include "base/time/time.h" -#include "base/values.h" #include "content/public/browser/web_contents_observer.h" #include "services/data_decoder/public/cpp/data_decoder.h"
diff --git a/components/domain_reliability/config.h b/components/domain_reliability/config.h index 47765751..3efa6dc 100644 --- a/components/domain_reliability/config.h +++ b/components/domain_reliability/config.h
@@ -12,7 +12,6 @@ #include "base/json/json_value_converter.h" #include "base/macros.h" #include "base/strings/string_piece.h" -#include "base/values.h" #include "components/domain_reliability/domain_reliability_export.h" #include "url/gurl.h"
diff --git a/components/feedback/content/content_tracing_manager.h b/components/feedback/content/content_tracing_manager.h index 31d9f1ac..19c1d0f 100644 --- a/components/feedback/content/content_tracing_manager.h +++ b/components/feedback/content/content_tracing_manager.h
@@ -13,7 +13,6 @@ #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" -#include "base/values.h" // This class is used to manage performance metrics that can be attached to // feedback reports. This class is a Singleton that is owned by the preference
diff --git a/components/history/core/browser/history_backend_unittest.cc b/components/history/core/browser/history_backend_unittest.cc index 3d104ea2..d519c70d4 100644 --- a/components/history/core/browser/history_backend_unittest.cc +++ b/components/history/core/browser/history_backend_unittest.cc
@@ -568,13 +568,13 @@ const SimulateNotificationCallback& callback); static const KeywordID kTestKeywordId; - static const char kTestSearchTerm1[]; - static const char kTestSearchTerm2[]; + static const char16_t kTestSearchTerm1[]; + static const char16_t kTestSearchTerm2[]; }; const KeywordID InMemoryHistoryBackendTest::kTestKeywordId = 42; -const char InMemoryHistoryBackendTest::kTestSearchTerm1[] = "banana"; -const char InMemoryHistoryBackendTest::kTestSearchTerm2[] = "orange"; +const char16_t InMemoryHistoryBackendTest::kTestSearchTerm1[] = u"banana"; +const char16_t InMemoryHistoryBackendTest::kTestSearchTerm2[] = u"orange"; // http://crbug.com/114287 #if defined(OS_WIN) @@ -1168,7 +1168,7 @@ // This verifies that a notification is fired. In-depth testing of logic should // be done in HistoryTest.SetTitle. TEST_F(HistoryBackendTest, SetPageTitleFiresNotificationWithCorrectDetails) { - const char kTestUrlTitle[] = "Google Search"; + const char16_t kTestUrlTitle[] = u"Google Search"; ASSERT_TRUE(backend_.get()); @@ -1186,7 +1186,7 @@ backend_->AddPagesWithDetails(rows, history::SOURCE_BROWSED); ClearBroadcastedNotifications(); - backend_->SetPageTitle(row2.url(), base::UTF8ToUTF16(kTestUrlTitle)); + backend_->SetPageTitle(row2.url(), kTestUrlTitle); // Ensure that a notification was fired, and further verify that the IDs in // the notification are set to those that are in effect in the main database. @@ -1197,7 +1197,7 @@ const URLRows& changed_urls = urls_modified_notifications()[0]; ASSERT_EQ(1u, changed_urls.size()); - EXPECT_EQ(base::UTF8ToUTF16(kTestUrlTitle), changed_urls[0].title()); + EXPECT_EQ(kTestUrlTitle, changed_urls[0].title()); EXPECT_EQ(stored_row2.id(), changed_urls[0].id()); } @@ -2901,8 +2901,8 @@ // between them is the type of the notification sent out. void InMemoryHistoryBackendTest::TestAddingAndChangingURLRows( const SimulateNotificationCallback& callback) { - const char kTestTypedURLAlternativeTitle[] = "Google Search Again"; - const char kTestNonTypedURLAlternativeTitle[] = "Google News Again"; + const char16_t kTestTypedURLAlternativeTitle[] = u"Google Search Again"; + const char16_t kTestNonTypedURLAlternativeTitle[] = u"Google News Again"; // Notify the in-memory database that a typed and non-typed URLRow (which were // never before seen by the cache) have been modified. @@ -2919,15 +2919,14 @@ EXPECT_EQ(row1.id(), cached_row1.id()); // Try changing attributes (other than typed_count) for existing URLRows. - row1.set_title(base::UTF8ToUTF16(kTestTypedURLAlternativeTitle)); - row2.set_title(base::UTF8ToUTF16(kTestNonTypedURLAlternativeTitle)); + row1.set_title(kTestTypedURLAlternativeTitle); + row2.set_title(kTestNonTypedURLAlternativeTitle); callback.Run(&row1, &row2, nullptr); // URLRows that are cached by the in-memory database should be updated. EXPECT_NE(0, mem_backend_->db()->GetRowForURL(row1.url(), &cached_row1)); EXPECT_EQ(0, mem_backend_->db()->GetRowForURL(row2.url(), &cached_row2)); - EXPECT_EQ(base::UTF8ToUTF16(kTestTypedURLAlternativeTitle), - cached_row1.title()); + EXPECT_EQ(kTestTypedURLAlternativeTitle, cached_row1.title()); // Now decrease the typed count for the typed URLRow, and increase it for the // previously non-typed URLRow. @@ -2940,8 +2939,7 @@ EXPECT_EQ(0, mem_backend_->db()->GetRowForURL(row1.url(), &cached_row1)); EXPECT_NE(0, mem_backend_->db()->GetRowForURL(row2.url(), &cached_row2)); EXPECT_EQ(row2.id(), cached_row2.id()); - EXPECT_EQ(base::UTF8ToUTF16(kTestNonTypedURLAlternativeTitle), - cached_row2.title()); + EXPECT_EQ(kTestNonTypedURLAlternativeTitle, cached_row2.title()); } TEST_F(InMemoryHistoryBackendTest, OnURLsModified) { @@ -3014,8 +3012,8 @@ TEST_F(InMemoryHistoryBackendTest, SetKeywordSearchTerms) { URLRow row1(CreateTestTypedURL()); URLRow row2(CreateTestNonTypedURL()); - std::u16string term1(base::UTF8ToUTF16(kTestSearchTerm1)); - std::u16string term2(base::UTF8ToUTF16(kTestSearchTerm2)); + std::u16string term1(kTestSearchTerm1); + std::u16string term2(kTestSearchTerm2); PopulateTestURLsAndSearchTerms(&row1, &row2, term1, term2); // Both URLs now have associated search terms, so the in-memory database @@ -3037,8 +3035,8 @@ TEST_F(InMemoryHistoryBackendTest, DeleteKeywordSearchTerms) { URLRow row1(CreateTestTypedURL()); URLRow row2(CreateTestNonTypedURL()); - std::u16string term1(base::UTF8ToUTF16(kTestSearchTerm1)); - std::u16string term2(base::UTF8ToUTF16(kTestSearchTerm2)); + std::u16string term1(kTestSearchTerm1); + std::u16string term2(kTestSearchTerm2); PopulateTestURLsAndSearchTerms(&row1, &row2, term1, term2); // Delete both search terms. This should be reflected in the in-memory DB. @@ -3062,8 +3060,8 @@ TEST_F(InMemoryHistoryBackendTest, DeleteAllSearchTermsForKeyword) { URLRow row1(CreateTestTypedURL()); URLRow row2(CreateTestNonTypedURL()); - std::u16string term1(base::UTF8ToUTF16(kTestSearchTerm1)); - std::u16string term2(base::UTF8ToUTF16(kTestSearchTerm2)); + std::u16string term1(kTestSearchTerm1); + std::u16string term2(kTestSearchTerm2); PopulateTestURLsAndSearchTerms(&row1, &row2, term1, term2); // Delete all corresponding search terms from the in-memory database. @@ -3087,8 +3085,8 @@ TEST_F(InMemoryHistoryBackendTest, OnURLsDeletedWithSearchTerms) { URLRow row1(CreateTestTypedURL()); URLRow row2(CreateTestNonTypedURL()); - std::u16string term1(base::UTF8ToUTF16(kTestSearchTerm1)); - std::u16string term2(base::UTF8ToUTF16(kTestSearchTerm2)); + std::u16string term1(kTestSearchTerm1); + std::u16string term2(kTestSearchTerm2); PopulateTestURLsAndSearchTerms(&row1, &row2, term1, term2); // Notify the in-memory database that the second typed URL has been deleted.
diff --git a/components/history_clusters/core/memories_service.cc b/components/history_clusters/core/memories_service.cc index 46b40c47..4867fa49 100644 --- a/components/history_clusters/core/memories_service.cc +++ b/components/history_clusters/core/memories_service.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/feature_list.h" +#include "base/i18n/case_conversion.h" #include "base/optional.h" #include "base/ranges/algorithm.h" #include "base/strings/utf_string_conversions.h" @@ -31,27 +32,24 @@ // Extract query nodes from the query string. query_parser::QueryNodeVector query_nodes; query_parser::QueryParser::ParseQueryNodes( - base::UTF8ToUTF16(query), - query_parser::MatchingAlgorithm::ALWAYS_PREFIX_SEARCH, &query_nodes); + base::UTF8ToUTF16(query), query_parser::MatchingAlgorithm::DEFAULT, + &query_nodes); std::vector<history::Cluster> matching_clusters; - base::ranges::copy_if( - clusters, std::back_inserter(matching_clusters), - [&](const auto& cluster) { - // TODO(manukh): See if we can avoid concatenating keywords only to - // break them up again immediately after. We currently do this to - // construct a `QueryWordVector`. - // Combine lowercase keywords into a string to extract query word from. - std::u16string keywords = std::accumulate( - cluster.keywords.begin(), cluster.keywords.end(), std::u16string(), - [](std::u16string accumulated, std::u16string str) { - return accumulated + u" " + str; - }); - query_parser::QueryWordVector query_words; - query_parser::QueryParser::ExtractQueryWords(keywords, &query_words); - return query_parser::QueryParser::DoesQueryMatch(query_words, - query_nodes); - }); + base::ranges::copy_if(clusters, std::back_inserter(matching_clusters), + [&](const auto& cluster) { + query_parser::QueryWordVector find_in_words; + for (auto& keyword : cluster.keywords) { + // Each `keyword` may itself have multiple terms + // that we need to extract and append to + // `find_in_words`. + query_parser::QueryParser::ExtractQueryWords( + base::i18n::ToLower(keyword), &find_in_words); + } + + return query_parser::QueryParser::DoesQueryMatch( + find_in_words, query_nodes); + }); return matching_clusters; }
diff --git a/components/history_clusters/core/memories_service_unittest.cc b/components/history_clusters/core/memories_service_unittest.cc index 4a4651b..e765590b 100644 --- a/components/history_clusters/core/memories_service_unittest.cc +++ b/components/history_clusters/core/memories_service_unittest.cc
@@ -177,8 +177,10 @@ cluster->add_visit_ids(visit_id); } if (!clustered_visit_ids.empty()) { - response.mutable_clusters(0)->mutable_keywords()->Add("keyword 1"); - response.mutable_clusters(0)->mutable_keywords()->Add("keyword 2"); + response.mutable_clusters(0)->mutable_keywords()->Add("apples"); + // We had a bug where we couldn't match against uppercase keywords, + // so we therefore want to test against an uppercase keyword. + response.mutable_clusters(0)->mutable_keywords()->Add("Red Oranges"); } test_url_loader_factory_.AddResponse(kFakeEndpoint, response.SerializeAsString()); @@ -245,8 +247,8 @@ EXPECT_EQ(response.clusters[0]->top_visits[1]->page_title, "Github title"); ASSERT_EQ(response.clusters[0]->keywords.size(), 2u); - EXPECT_EQ(response.clusters[0]->keywords[0], u"keyword 1"); - EXPECT_EQ(response.clusters[0]->keywords[1], u"keyword 2"); + EXPECT_EQ(response.clusters[0]->keywords[0], u"apples"); + EXPECT_EQ(response.clusters[0]->keywords[1], u"Red Oranges"); EXPECT_FALSE(response.clusters[1]->id.is_empty()); ASSERT_EQ(response.clusters[1]->top_visits.size(), 1u); EXPECT_EQ(response.clusters[1]->top_visits[0]->id, 4); @@ -267,14 +269,15 @@ run_loop_.Run(); } -TEST_F(MemoriesServiceTest, QueryMemories) { +TEST_F(MemoriesServiceTest, QueryMemoriesMatchingNonEmptyQuery) { EnableMemoriesWithEndpoint(kFakeEndpoint); AddVisit(0, GURL{"https://google.com"}, u"Google title", 2, IntToTime(2), 3); AddVisit(0, GURL{"https://github.com"}, u"Github title", 4, IntToTime(4), 5); auto query_params = mojom::QueryParams::New(); - query_params->query = "Keyword"; + // Verify that we can match against the "Red Oranges" uppercase keyword. + query_params->query = "orang"; EXPECT_FALSE(test_url_loader_factory_.IsPending(kFakeEndpoint)); memories_service_->QueryMemories( @@ -302,8 +305,39 @@ EXPECT_EQ(response.clusters[0]->top_visits[1]->page_title, "Github title"); ASSERT_EQ(response.clusters[0]->keywords.size(), 2u); - EXPECT_EQ(response.clusters[0]->keywords[0], u"keyword 1"); - EXPECT_EQ(response.clusters[0]->keywords[1], u"keyword 2"); + EXPECT_EQ(response.clusters[0]->keywords[0], u"apples"); + EXPECT_EQ(response.clusters[0]->keywords[1], u"Red Oranges"); + run_loop_quit_.Run(); + }), + &task_tracker_); + + VerifyHardcodedTestDataInUrlLoaderRequest(); + InjectHardcodedTestDataToUrlLoaderResponse({{2, 4}, {4}}); + + // Verify the callback is invoked. + run_loop_.Run(); +} + +TEST_F(MemoriesServiceTest, QueryMemoriesNonMatchingNonEmptyQuery) { + EnableMemoriesWithEndpoint(kFakeEndpoint); + + AddVisit(0, GURL{"https://google.com"}, u"Google title", 2, IntToTime(2), 3); + AddVisit(0, GURL{"https://github.com"}, u"Github title", 4, IntToTime(4), 5); + + auto query_params = mojom::QueryParams::New(); + query_params->query = "should_not_match_anything"; + + EXPECT_FALSE(test_url_loader_factory_.IsPending(kFakeEndpoint)); + memories_service_->QueryMemories( + std::move(query_params), + // This "expect" block is not run until after the fake response is sent + // further down in this method. + base::BindLambdaForTesting( + [&](MemoriesService::QueryMemoriesResponse response) { + // Verify that the continuation query params is nullptr. + ASSERT_FALSE(!!response.query_params); + // Verify the parsed response. + EXPECT_TRUE(response.clusters.empty()); run_loop_quit_.Run(); }), &task_tracker_);
diff --git a/components/invalidation/public/invalidation_service.h b/components/invalidation/public/invalidation_service.h index 9844161..114ae37 100644 --- a/components/invalidation/public/invalidation_service.h +++ b/components/invalidation/public/invalidation_service.h
@@ -9,6 +9,10 @@ #include "components/invalidation/public/invalidation_util.h" #include "components/invalidation/public/invalidator_state.h" +namespace base { +class DictionaryValue; +} + namespace invalidation { class InvalidationHandler;
diff --git a/components/invalidation/public/invalidation_util.h b/components/invalidation/public/invalidation_util.h index 95704ab..e992202 100644 --- a/components/invalidation/public/invalidation_util.h +++ b/components/invalidation/public/invalidation_util.h
@@ -14,7 +14,6 @@ #include "base/callback.h" #include "base/optional.h" -#include "base/values.h" #include "components/invalidation/public/invalidation_export.h" namespace invalidation {
diff --git a/components/leveldb_proto/public/proto_database_provider.cc b/components/leveldb_proto/public/proto_database_provider.cc index 20a0552..9a5caaa9 100644 --- a/components/leveldb_proto/public/proto_database_provider.cc +++ b/components/leveldb_proto/public/proto_database_provider.cc
@@ -54,6 +54,7 @@ void ProtoDatabaseProvider::SetSharedDBDeleteObsoleteDelayForTesting( base::TimeDelta delay) { + base::AutoLock lock(get_db_lock_); if (db_) db_->set_delete_obsolete_delay_for_testing(delay); // IN-TEST }
diff --git a/components/media_router/common/media_route.h b/components/media_router/common/media_route.h index 6dc06d9f..274e00ce 100644 --- a/components/media_router/common/media_route.h +++ b/components/media_router/common/media_route.h
@@ -8,7 +8,6 @@ #include <iosfwd> #include <string> -#include "base/values.h" #include "components/media_router/common/media_sink.h" #include "components/media_router/common/media_source.h"
diff --git a/components/metrics/structured/external_metrics.h b/components/metrics/structured/external_metrics.h index 31b2d5e..2360fb3 100644 --- a/components/metrics/structured/external_metrics.h +++ b/components/metrics/structured/external_metrics.h
@@ -10,7 +10,6 @@ #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" -#include "base/values.h" namespace metrics { namespace structured {
diff --git a/components/metrics/structured/structured_metrics_provider.h b/components/metrics/structured/structured_metrics_provider.h index 747f23b..4be682a 100644 --- a/components/metrics/structured/structured_metrics_provider.h +++ b/components/metrics/structured/structured_metrics_provider.h
@@ -12,7 +12,6 @@ #include "base/files/file_path.h" #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" -#include "base/values.h" #include "components/metrics/metrics_provider.h" #include "components/metrics/structured/event_base.h" #include "components/metrics/structured/key_data.h"
diff --git a/components/mirroring/service/mirror_settings.h b/components/mirroring/service/mirror_settings.h index 4ac440f..3880283 100644 --- a/components/mirroring/service/mirror_settings.h +++ b/components/mirroring/service/mirror_settings.h
@@ -7,7 +7,6 @@ #include "base/component_export.h" #include "base/time/time.h" -#include "base/values.h" #include "media/capture/video_capture_types.h" #include "media/cast/cast_config.h"
diff --git a/components/mirroring/service/receiver_setup_querier.h b/components/mirroring/service/receiver_setup_querier.h index 3a3e993..a52f049 100644 --- a/components/mirroring/service/receiver_setup_querier.h +++ b/components/mirroring/service/receiver_setup_querier.h
@@ -14,7 +14,6 @@ #include "base/memory/weak_ptr.h" #include "base/optional.h" #include "base/timer/timer.h" -#include "base/values.h" #include "components/mirroring/mojom/session_observer.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/remote.h"
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc b/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc index 0837c6e..5b51b432 100644 --- a/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc +++ b/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc
@@ -124,7 +124,7 @@ const char kSuggestionUrl2[] = "http://foo.com/bar"; -const char kTestJsonDefaultCategoryTitle[] = "Some title"; +const char16_t kTestJsonDefaultCategoryTitle[] = u"Some title"; const int kOtherCategoryId = 2; const int kUnknownRemoteCategoryId = 1234; @@ -592,8 +592,7 @@ } TEST_F(RemoteSuggestionsProviderImplTest, CategoryTitle) { - const std::u16string test_default_title = - base::UTF8ToUTF16(kTestJsonDefaultCategoryTitle); + const std::u16string test_default_title = kTestJsonDefaultCategoryTitle; // Don't send an initial response -- we want to test what happens without any // server status.
diff --git a/components/ntp_tiles/custom_links_manager_impl_unittest.cc b/components/ntp_tiles/custom_links_manager_impl_unittest.cc index 1c36355..a273d5c 100644 --- a/components/ntp_tiles/custom_links_manager_impl_unittest.cc +++ b/components/ntp_tiles/custom_links_manager_impl_unittest.cc
@@ -26,28 +26,29 @@ struct TestCaseItem { const char* url; - const char* title; + const char16_t* title; }; -const TestCaseItem kTestCase1[] = {{"http://foo1.com/", "Foo1"}}; +const TestCaseItem kTestCase1[] = {{"http://foo1.com/", u"Foo1"}}; const TestCaseItem kTestCase2[] = { - {"http://foo1.com/", "Foo1"}, - {"http://foo2.com/", "Foo2"}, + {"http://foo1.com/", u"Foo1"}, + {"http://foo2.com/", u"Foo2"}, }; const TestCaseItem kTestCase3[] = { - {"http://foo1.com/", "Foo1"}, - {"http://foo2.com/", "Foo2"}, - {"http://foo3.com/", "Foo3"}, + {"http://foo1.com/", u"Foo1"}, + {"http://foo2.com/", u"Foo2"}, + {"http://foo3.com/", u"Foo3"}, }; const TestCaseItem kTestCaseMax[] = { - {"http://foo1.com/", "Foo1"}, {"http://foo2.com/", "Foo2"}, - {"http://foo3.com/", "Foo3"}, {"http://foo4.com/", "Foo4"}, - {"http://foo5.com/", "Foo5"}, {"http://foo6.com/", "Foo6"}, - {"http://foo7.com/", "Foo7"}, {"http://foo8.com/", "Foo8"}, - {"http://foo9.com/", "Foo9"}, {"http://foo10.com/", "Foo10"}, + {"http://foo1.com/", u"Foo1"}, {"http://foo2.com/", u"Foo2"}, + {"http://foo3.com/", u"Foo3"}, {"http://foo4.com/", u"Foo4"}, + {"http://foo5.com/", u"Foo5"}, {"http://foo6.com/", u"Foo6"}, + {"http://foo7.com/", u"Foo7"}, {"http://foo8.com/", u"Foo8"}, + {"http://foo9.com/", u"Foo9"}, {"http://foo10.com/", u"Foo10"}, }; const char kTestTitle[] = "Test"; +const char16_t kTestTitle16[] = u"Test"; const char kTestUrl[] = "http://test.com/"; base::Value::ListStorage FillTestListStorage(const char* url, @@ -62,10 +63,10 @@ return new_link_list; } -void AddTile(NTPTilesVector* tiles, const char* url, const char* title) { +void AddTile(NTPTilesVector* tiles, const char* url, const char16_t* title) { NTPTile tile; tile.url = GURL(url); - tile.title = base::UTF8ToUTF16(title); + tile.title = title; tiles->push_back(std::move(tile)); } @@ -80,8 +81,7 @@ std::vector<Link> FillTestLinks(base::span<const TestCaseItem> test_cases) { std::vector<Link> links; for (const auto& test_case : test_cases) { - links.emplace_back( - Link{GURL(test_case.url), base::UTF8ToUTF16(test_case.title), true}); + links.emplace_back(Link{GURL(test_case.url), test_case.title, true}); } return links; } @@ -160,10 +160,8 @@ // Add link. std::vector<Link> expected_links = initial_links; - expected_links.emplace_back( - Link{GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle), false}); - EXPECT_TRUE( - custom_links_->AddLink(GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle))); + expected_links.emplace_back(Link{GURL(kTestUrl), kTestTitle16, false}); + EXPECT_TRUE(custom_links_->AddLink(GURL(kTestUrl), kTestTitle16)); EXPECT_EQ(expected_links, custom_links_->GetLinks()); } @@ -174,8 +172,7 @@ ASSERT_EQ(initial_links, custom_links_->GetLinks()); // Try to add link. This should fail and not modify the list. - EXPECT_FALSE( - custom_links_->AddLink(GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle))); + EXPECT_FALSE(custom_links_->AddLink(GURL(kTestUrl), kTestTitle16)); EXPECT_EQ(initial_links, custom_links_->GetLinks()); } @@ -186,8 +183,8 @@ ASSERT_EQ(initial_links, custom_links_->GetLinks()); // Try to add duplicate link. This should fail and not modify the list. - EXPECT_FALSE(custom_links_->AddLink(GURL(kTestCase1[0].url), - base::UTF8ToUTF16(kTestCase1[0].title))); + EXPECT_FALSE( + custom_links_->AddLink(GURL(kTestCase1[0].url), kTestCase1[0].title)); EXPECT_EQ(initial_links, custom_links_->GetLinks()); } @@ -200,25 +197,20 @@ EXPECT_TRUE(custom_links_->UpdateLink(GURL(kTestCase1[0].url), GURL(kTestUrl), std::u16string())); EXPECT_EQ( - std::vector<Link>({Link{GURL(kTestUrl), - base::UTF8ToUTF16(kTestCase1[0].title), false}}), + std::vector<Link>({Link{GURL(kTestUrl), kTestCase1[0].title, false}}), custom_links_->GetLinks()); // Update the link's title. - EXPECT_TRUE(custom_links_->UpdateLink(GURL(kTestUrl), GURL(), - base::UTF8ToUTF16(kTestTitle))); - EXPECT_EQ(std::vector<Link>( - {Link{GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle), false}}), + EXPECT_TRUE(custom_links_->UpdateLink(GURL(kTestUrl), GURL(), kTestTitle16)); + EXPECT_EQ(std::vector<Link>({Link{GURL(kTestUrl), kTestTitle16, false}}), custom_links_->GetLinks()); // Update the link's URL and title. - EXPECT_TRUE( - custom_links_->UpdateLink(GURL(kTestUrl), GURL(kTestCase1[0].url), - base::UTF8ToUTF16(kTestCase1[0].title))); - EXPECT_EQ( - std::vector<Link>({Link{GURL(kTestCase1[0].url), - base::UTF8ToUTF16(kTestCase1[0].title), false}}), - custom_links_->GetLinks()); + EXPECT_TRUE(custom_links_->UpdateLink(GURL(kTestUrl), GURL(kTestCase1[0].url), + kTestCase1[0].title)); + EXPECT_EQ(std::vector<Link>( + {Link{GURL(kTestCase1[0].url), kTestCase1[0].title, false}}), + custom_links_->GetLinks()); } TEST_F(CustomLinksManagerImplTest, UpdateLinkWithInvalidParams) { @@ -229,8 +221,7 @@ // Try to update a link that does not exist. This should fail and not modify // the list. - EXPECT_FALSE(custom_links_->UpdateLink(GURL(kTestUrl), GURL(), - base::UTF8ToUTF16(kTestTitle))); + EXPECT_FALSE(custom_links_->UpdateLink(GURL(kTestUrl), GURL(), kTestTitle16)); EXPECT_EQ(initial_links, custom_links_->GetLinks()); // Try to pass empty params. This should fail and not modify the list. @@ -239,8 +230,7 @@ EXPECT_EQ(initial_links, custom_links_->GetLinks()); // Try to pass an invalid URL. This should fail and not modify the list. - EXPECT_FALSE(custom_links_->UpdateLink(GURL("test"), GURL(), - base::UTF8ToUTF16(kTestTitle))); + EXPECT_FALSE(custom_links_->UpdateLink(GURL("test"), GURL(), kTestTitle16)); EXPECT_EQ(initial_links, custom_links_->GetLinks()); EXPECT_FALSE(custom_links_->UpdateLink(GURL(kTestCase1[0].url), GURL("test"), std::u16string())); @@ -288,25 +278,19 @@ // Move the last link to the front. EXPECT_TRUE(custom_links_->ReorderLink(GURL(kTestCase3[2].url), (size_t)0)); - EXPECT_EQ( - std::vector<Link>({Link{GURL(kTestCase3[2].url), - base::UTF8ToUTF16(kTestCase3[2].title), true}, - Link{GURL(kTestCase3[0].url), - base::UTF8ToUTF16(kTestCase3[0].title), true}, - Link{GURL(kTestCase3[1].url), - base::UTF8ToUTF16(kTestCase3[1].title), true}}), - custom_links_->GetLinks()); + EXPECT_EQ(std::vector<Link>( + {Link{GURL(kTestCase3[2].url), kTestCase3[2].title, true}, + Link{GURL(kTestCase3[0].url), kTestCase3[0].title, true}, + Link{GURL(kTestCase3[1].url), kTestCase3[1].title, true}}), + custom_links_->GetLinks()); // Move the same link to the right. EXPECT_TRUE(custom_links_->ReorderLink(GURL(kTestCase3[2].url), (size_t)1)); - EXPECT_EQ( - std::vector<Link>({Link{GURL(kTestCase3[0].url), - base::UTF8ToUTF16(kTestCase3[0].title), true}, - Link{GURL(kTestCase3[2].url), - base::UTF8ToUTF16(kTestCase3[2].title), true}, - Link{GURL(kTestCase3[1].url), - base::UTF8ToUTF16(kTestCase3[1].title), true}}), - custom_links_->GetLinks()); + EXPECT_EQ(std::vector<Link>( + {Link{GURL(kTestCase3[0].url), kTestCase3[0].title, true}, + Link{GURL(kTestCase3[2].url), kTestCase3[2].title, true}, + Link{GURL(kTestCase3[1].url), kTestCase3[1].title, true}}), + custom_links_->GetLinks()); // Move the same link to the end. EXPECT_TRUE(custom_links_->ReorderLink(GURL(kTestCase3[2].url), (size_t)2)); @@ -316,10 +300,9 @@ TEST_F(CustomLinksManagerImplTest, DeleteLink) { // Initialize. NTPTilesVector initial_tiles; - AddTile(&initial_tiles, kTestUrl, kTestTitle); + AddTile(&initial_tiles, kTestUrl, kTestTitle16); ASSERT_TRUE(custom_links_->Initialize(initial_tiles)); - ASSERT_EQ(std::vector<Link>( - {Link{GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle), true}}), + ASSERT_EQ(std::vector<Link>({Link{GURL(kTestUrl), kTestTitle16, true}}), custom_links_->GetLinks()); // Delete link. @@ -348,12 +331,10 @@ EXPECT_EQ(initial_links, custom_links_->GetLinks()); // Add link. - EXPECT_TRUE( - custom_links_->AddLink(GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle))); + EXPECT_TRUE(custom_links_->AddLink(GURL(kTestUrl), kTestTitle16)); EXPECT_EQ(std::vector<Link>( - {Link{GURL(kTestCase1[0].url), - base::UTF8ToUTF16(kTestCase1[0].title), true}, - {Link{GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle), false}}}), + {Link{GURL(kTestCase1[0].url), kTestCase1[0].title, true}, + {Link{GURL(kTestUrl), kTestTitle16, false}}}), custom_links_->GetLinks()); // Undo add link. @@ -375,8 +356,7 @@ EXPECT_TRUE(custom_links_->UpdateLink(GURL(kTestCase1[0].url), GURL(kTestUrl), std::u16string())); EXPECT_EQ( - std::vector<Link>({Link{GURL(kTestUrl), - base::UTF8ToUTF16(kTestCase1[0].title), false}}), + std::vector<Link>({Link{GURL(kTestUrl), kTestCase1[0].title, false}}), custom_links_->GetLinks()); // Undo update link. @@ -384,11 +364,11 @@ EXPECT_EQ(initial_links, custom_links_->GetLinks()); // Update the link's title. - EXPECT_TRUE(custom_links_->UpdateLink(GURL(kTestCase1[0].url), GURL(), - base::UTF8ToUTF16(kTestTitle))); - EXPECT_EQ(std::vector<Link>({Link{GURL(kTestCase1[0].url), - base::UTF8ToUTF16(kTestTitle), false}}), - custom_links_->GetLinks()); + EXPECT_TRUE( + custom_links_->UpdateLink(GURL(kTestCase1[0].url), GURL(), kTestTitle16)); + EXPECT_EQ( + std::vector<Link>({Link{GURL(kTestCase1[0].url), kTestTitle16, false}}), + custom_links_->GetLinks()); // Undo update link. EXPECT_TRUE(custom_links_->UndoAction()); @@ -402,9 +382,8 @@ TEST_F(CustomLinksManagerImplTest, UndoDeleteLink) { // Initialize. NTPTilesVector initial_tiles; - AddTile(&initial_tiles, kTestUrl, kTestTitle); - std::vector<Link> expected_links( - {Link{GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle), true}}); + AddTile(&initial_tiles, kTestUrl, kTestTitle16); + std::vector<Link> expected_links({Link{GURL(kTestUrl), kTestTitle16, true}}); ASSERT_TRUE(custom_links_->Initialize(initial_tiles)); ASSERT_EQ(expected_links, custom_links_->GetLinks()); @@ -423,10 +402,8 @@ ASSERT_TRUE(custom_links_->GetLinks().empty()); // Add link. - std::vector<Link> expected_links( - {Link{GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle), false}}); - ASSERT_TRUE( - custom_links_->AddLink(GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle))); + std::vector<Link> expected_links({Link{GURL(kTestUrl), kTestTitle16, false}}); + ASSERT_TRUE(custom_links_->AddLink(GURL(kTestUrl), kTestTitle16)); ASSERT_EQ(expected_links, custom_links_->GetLinks()); // Delete link. @@ -464,10 +441,9 @@ {history::URLRow(GURL(kTestCase2[1].url))}, /*favicon_urls=*/std::set<GURL>(), /*restrict_urls=*/base::nullopt)); - EXPECT_EQ( - std::vector<Link>({Link{GURL(kTestCase2[0].url), - base::UTF8ToUTF16(kTestCase2[0].title), true}}), - custom_links_->GetLinks()); + EXPECT_EQ(std::vector<Link>( + {Link{GURL(kTestCase2[0].url), kTestCase2[0].title, true}}), + custom_links_->GetLinks()); task_environment_.RunUntilIdle(); } @@ -534,14 +510,12 @@ // Initialize. std::vector<Link> links_after_add( - {Link{GURL(kTestCase1[0].url), base::UTF8ToUTF16(kTestCase1[0].title), - true}, - Link{GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle), false}}); + {Link{GURL(kTestCase1[0].url), kTestCase1[0].title, true}, + Link{GURL(kTestUrl), kTestTitle16, false}}); ASSERT_TRUE(custom_links_->Initialize(FillTestTiles(kTestCase1))); ASSERT_EQ(FillTestLinks(kTestCase1), custom_links_->GetLinks()); // Add link. - ASSERT_TRUE( - custom_links_->AddLink(GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle))); + ASSERT_TRUE(custom_links_->AddLink(GURL(kTestUrl), kTestTitle16)); ASSERT_EQ(links_after_add, custom_links_->GetLinks()); // Try to delete the added link. This should fail and not modify the list. @@ -563,8 +537,7 @@ /*expired=*/false, history::URLRows(), /*favicon_urls=*/std::set<GURL>(), /*restrict_urls=*/base::nullopt)); - EXPECT_EQ(std::vector<Link>( - {Link{GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle), false}}), + EXPECT_EQ(std::vector<Link>({Link{GURL(kTestUrl), kTestTitle16, false}}), custom_links_->GetLinks()); task_environment_.RunUntilIdle(); @@ -636,11 +609,9 @@ ASSERT_EQ(FillTestLinks(kTestCase1), custom_links_->GetLinks()); // Add link. std::vector<Link> links_after_add( - {Link{GURL(kTestCase1[0].url), base::UTF8ToUTF16(kTestCase1[0].title), - true}, - Link{GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle), false}}); - ASSERT_TRUE( - custom_links_->AddLink(GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle))); + {Link{GURL(kTestCase1[0].url), kTestCase1[0].title, true}, + Link{GURL(kTestUrl), kTestTitle16, false}}); + ASSERT_TRUE(custom_links_->AddLink(GURL(kTestUrl), kTestTitle16)); ASSERT_EQ(links_after_add, custom_links_->GetLinks()); // Try an empty history deletion. This should do nothing. @@ -669,12 +640,11 @@ // Modifying ourselves should not notify. EXPECT_CALL(callback, Run()).Times(0); - EXPECT_TRUE(custom_links_->AddLink(GURL(kTestCase1[0].url), - base::UTF8ToUTF16(kTestCase1[0].title))); - EXPECT_EQ( - std::vector<Link>({Link{GURL(kTestCase1[0].url), - base::UTF8ToUTF16(kTestCase1[0].title), false}}), - custom_links_->GetLinks()); + EXPECT_TRUE( + custom_links_->AddLink(GURL(kTestCase1[0].url), kTestCase1[0].title)); + EXPECT_EQ(std::vector<Link>( + {Link{GURL(kTestCase1[0].url), kTestCase1[0].title, false}}), + custom_links_->GetLinks()); // Modify the preference. This should notify and update the current list of // links. @@ -682,8 +652,7 @@ prefs_.SetUserPref(prefs::kCustomLinksList, std::make_unique<base::Value>( FillTestListStorage(kTestUrl, kTestTitle, true))); - EXPECT_EQ(std::vector<Link>( - {Link{GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle), true}}), + EXPECT_EQ(std::vector<Link>({Link{GURL(kTestUrl), kTestTitle16, true}}), custom_links_->GetLinks()); } @@ -703,8 +672,7 @@ std::make_unique<base::Value>( FillTestListStorage(kTestUrl, kTestTitle, false))); EXPECT_TRUE(custom_links_->IsInitialized()); - EXPECT_EQ(std::vector<Link>( - {Link{GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle), false}}), + EXPECT_EQ(std::vector<Link>({Link{GURL(kTestUrl), kTestTitle16, false}}), custom_links_->GetLinks()); }
diff --git a/components/ntp_tiles/custom_links_store_unittest.cc b/components/ntp_tiles/custom_links_store_unittest.cc index efa4cfa..36aa913 100644 --- a/components/ntp_tiles/custom_links_store_unittest.cc +++ b/components/ntp_tiles/custom_links_store_unittest.cc
@@ -19,8 +19,8 @@ namespace { -const char kTestTitle1[] = "Foo1"; -const char kTestTitle2[] = "Foo2"; +const char16_t kTestTitle1[] = u"Foo1"; +const char16_t kTestTitle2[] = u"Foo2"; const char kTestUrl1[] = "http://foo1.com/"; const char kTestUrl2[] = "http://foo2.com/"; @@ -41,8 +41,8 @@ }; TEST_F(CustomLinksStoreTest, StoreAndRetrieveLinks) { - std::vector<CustomLinksManager::Link> initial_links({CustomLinksManager::Link{ - GURL(kTestUrl1), base::UTF8ToUTF16(kTestTitle1), true}}); + std::vector<CustomLinksManager::Link> initial_links( + {CustomLinksManager::Link{GURL(kTestUrl1), kTestTitle1, true}}); custom_links_store_->StoreLinks(initial_links); std::vector<CustomLinksManager::Link> retrieved_links = @@ -52,10 +52,8 @@ TEST_F(CustomLinksStoreTest, StoreEmptyList) { std::vector<CustomLinksManager::Link> populated_links( - {CustomLinksManager::Link{GURL(kTestUrl1), base::UTF8ToUTF16(kTestTitle1), - false}, - CustomLinksManager::Link{GURL(kTestUrl2), base::UTF8ToUTF16(kTestTitle2), - true}}); + {CustomLinksManager::Link{GURL(kTestUrl1), kTestTitle1, false}, + CustomLinksManager::Link{GURL(kTestUrl2), kTestTitle2, true}}); custom_links_store_->StoreLinks(populated_links); std::vector<CustomLinksManager::Link> retrieved_links = @@ -68,8 +66,8 @@ } TEST_F(CustomLinksStoreTest, ClearLinks) { - std::vector<CustomLinksManager::Link> initial_links({CustomLinksManager::Link{ - GURL(kTestUrl1), base::UTF8ToUTF16(kTestTitle1)}}); + std::vector<CustomLinksManager::Link> initial_links( + {CustomLinksManager::Link{GURL(kTestUrl1), kTestTitle1}}); custom_links_store_->StoreLinks(initial_links); std::vector<CustomLinksManager::Link> retrieved_links = @@ -83,10 +81,8 @@ TEST_F(CustomLinksStoreTest, LinksSavedAfterShutdown) { std::vector<CustomLinksManager::Link> initial_links( - {CustomLinksManager::Link{GURL(kTestUrl1), base::UTF8ToUTF16(kTestTitle1), - false}, - CustomLinksManager::Link{GURL(kTestUrl2), base::UTF8ToUTF16(kTestTitle2), - true}}); + {CustomLinksManager::Link{GURL(kTestUrl1), kTestTitle1, false}, + CustomLinksManager::Link{GURL(kTestUrl2), kTestTitle2, true}}); custom_links_store_->StoreLinks(initial_links); std::vector<CustomLinksManager::Link> retrieved_links =
diff --git a/components/omnibox/browser/autocomplete_match_type_unittest.cc b/components/omnibox/browser/autocomplete_match_type_unittest.cc index cef395a6..5cae4c0 100644 --- a/components/omnibox/browser/autocomplete_match_type_unittest.cc +++ b/components/omnibox/browser/autocomplete_match_type_unittest.cc
@@ -74,7 +74,6 @@ ASSERT_TRUE(ParseAnswer(answer_json, &answer)); match.answer = answer; - EXPECT_EQ(kSearch + base::UTF8ToUTF16( - ", answer, sunny with a chance of hail, 4 of 6"), + EXPECT_EQ(kSearch + u", answer, sunny with a chance of hail, 4 of 6", AutocompleteMatchType::ToAccessibilityLabel(match, kSearch, 3, 6)); }
diff --git a/components/omnibox/browser/clipboard_provider_unittest.cc b/components/omnibox/browser/clipboard_provider_unittest.cc index f7c01fda..8a5fb0c 100644 --- a/components/omnibox/browser/clipboard_provider_unittest.cc +++ b/components/omnibox/browser/clipboard_provider_unittest.cc
@@ -36,8 +36,8 @@ const char kCurrentURL[] = "http://example.com/current"; const char kClipboardURL[] = "http://example.com/clipboard"; -const char kClipboardText[] = "Search for me"; -const char kClipboardTitleText[] = "\"Search for me\""; +const char16_t kClipboardText[] = u"Search for me"; +const char16_t kClipboardTitleText[] = u"\"Search for me\""; class CreateMatchWithContentCallbackWaiter { public: @@ -185,13 +185,11 @@ auto template_url_service = std::make_unique<TemplateURLService>( /*initializers=*/nullptr, /*count=*/0); client_->set_template_url_service(std::move(template_url_service)); - SetClipboardText(base::UTF8ToUTF16(kClipboardText)); + SetClipboardText(kClipboardText); provider_->Start(CreateAutocompleteInput(OmniboxFocusType::ON_FOCUS), false); ASSERT_GE(provider_->matches().size(), 1U); - EXPECT_EQ(base::UTF8ToUTF16(kClipboardTitleText), - provider_->matches().back().contents); - EXPECT_EQ(base::UTF8ToUTF16(kClipboardText), - provider_->matches().back().fill_into_edit); + EXPECT_EQ(kClipboardTitleText, provider_->matches().back().contents); + EXPECT_EQ(kClipboardText, provider_->matches().back().fill_into_edit); EXPECT_EQ(AutocompleteMatchType::CLIPBOARD_TEXT, provider_->matches().back().type); } @@ -218,7 +216,7 @@ auto template_url_service = std::make_unique<TemplateURLService>( /*initializers=*/nullptr, /*count=*/0); client_->set_template_url_service(std::move(template_url_service)); - SetClipboardText(base::UTF8ToUTF16(kClipboardText)); + SetClipboardText(kClipboardText); provider_->Start(CreateAutocompleteInput(OmniboxFocusType::ON_FOCUS), false); ASSERT_EQ(provider_->matches().size(), 1U); @@ -253,7 +251,7 @@ auto template_url_service = std::make_unique<TemplateURLService>( /*initializers=*/nullptr, /*count=*/0); client_->set_template_url_service(std::move(template_url_service)); - SetClipboardText(base::UTF8ToUTF16(kClipboardText)); + SetClipboardText(kClipboardText); provider_->Start(CreateAutocompleteInput(OmniboxFocusType::ON_FOCUS), false); ASSERT_GE(provider_->matches().size(), 1U); EXPECT_EQ(AutocompleteMatchType::CLIPBOARD_TEXT, @@ -299,7 +297,7 @@ } TEST_F(ClipboardProviderTest, CreateTextMatchWithContent) { - SetClipboardText(base::UTF8ToUTF16(kClipboardText)); + SetClipboardText(kClipboardText); auto template_url_service = std::make_unique<TemplateURLService>( /*initializers=*/nullptr, /*count=*/0); client_->set_template_url_service(std::move(template_url_service)); @@ -307,8 +305,8 @@ CreateMatchWithContentCallbackWaiter waiter(provider_, &match); waiter.WaitForMatchUpdated(); - EXPECT_EQ(base::UTF8ToUTF16(kClipboardTitleText), match.contents); - EXPECT_EQ(base::UTF8ToUTF16(kClipboardText), match.fill_into_edit); + EXPECT_EQ(kClipboardTitleText, match.contents); + EXPECT_EQ(kClipboardText, match.fill_into_edit); EXPECT_EQ(AutocompleteMatchType::CLIPBOARD_TEXT, match.type); }
diff --git a/components/omnibox/browser/history_quick_provider_unittest.cc b/components/omnibox/browser/history_quick_provider_unittest.cc index 26ee153..b7610a3 100644 --- a/components/omnibox/browser/history_quick_provider_unittest.cc +++ b/components/omnibox/browser/history_quick_provider_unittest.cc
@@ -559,9 +559,9 @@ "%95%8C%E5%A4%A7%E6%88%A6#.E3.83.B4.E3.82.A7.E3.83.AB.E3.82.B5.E3.82." "A4.E3.83.A6.E4.BD.93.E5.88.B6"); RunTest(u"第二 e3", false, expected_urls, false, - base::UTF8ToUTF16("ja.wikipedia.org/wiki/第二次世界大戦#.E3.83.B4.E3." - "82.A7.E3.83.AB.E3.82.B5.E3.82.A4.E3.83.A6.E4.BD." - "93.E5.88.B6"), + u"ja.wikipedia.org/wiki/第二次世界大戦#.E3.83.B4.E3." + u"82.A7.E3.83.AB.E3.82.B5.E3.82.A4.E3.83.A6.E4.BD." + u"93.E5.88.B6", std::u16string()); #if DCHECK_IS_ON() ac_matches()[0].Validate(); @@ -813,10 +813,9 @@ } ScoredHistoryMatch BuildScoredHistoryMatch(const std::string& url_text, - const std::string& input_term) { + const std::u16string& input_term) { return ScoredHistoryMatch(history::URLRow(GURL(url_text)), VisitInfoVector(), - base::UTF8ToUTF16(input_term), - String16Vector(1, base::UTF8ToUTF16(input_term)), + input_term, String16Vector(1, input_term), WordStarts(1, 0), RowWordStarts(), false, 0, base::Time()); } @@ -827,7 +826,7 @@ TestSchemeClassifier()); provider().Start(input, false); ScoredHistoryMatch history_match = - BuildScoredHistoryMatch("http://www.facebook.com", "face"); + BuildScoredHistoryMatch("http://www.facebook.com", u"face"); AutocompleteMatch match = provider().QuickMatchToACMatch(history_match, 100); EXPECT_EQ(u"facebook.com", match.contents); @@ -840,7 +839,7 @@ TestSchemeClassifier()); provider().Start(input, false); ScoredHistoryMatch history_match = - BuildScoredHistoryMatch("http://www.facebook.com", "http://face"); + BuildScoredHistoryMatch("http://www.facebook.com", u"http://face"); AutocompleteMatch match = provider().QuickMatchToACMatch(history_match, 100); EXPECT_EQ(u"http://facebook.com", match.contents); @@ -853,7 +852,7 @@ TestSchemeClassifier()); provider().Start(input, false); ScoredHistoryMatch history_match = - BuildScoredHistoryMatch("http://www.facebook.com", "ht"); + BuildScoredHistoryMatch("http://www.facebook.com", u"ht"); history_match.match_in_scheme = true; AutocompleteMatch match = provider().QuickMatchToACMatch(history_match, 100); @@ -867,7 +866,7 @@ TestSchemeClassifier()); provider().Start(input, false); ScoredHistoryMatch history_match = - BuildScoredHistoryMatch("https://www.facebook.com", "https://face"); + BuildScoredHistoryMatch("https://www.facebook.com", u"https://face"); AutocompleteMatch match = provider().QuickMatchToACMatch(history_match, 100); EXPECT_EQ(u"https://facebook.com", match.contents); @@ -879,7 +878,7 @@ TestSchemeClassifier()); provider().Start(input, false); ScoredHistoryMatch history_match = - BuildScoredHistoryMatch("https://www.facebook.com", "face"); + BuildScoredHistoryMatch("https://www.facebook.com", u"face"); AutocompleteMatch match = provider().QuickMatchToACMatch(history_match, 100); EXPECT_EQ(u"facebook.com", match.contents);
diff --git a/components/password_manager/content/browser/bad_message.cc b/components/password_manager/content/browser/bad_message.cc index d68b2f9..a308fb8 100644 --- a/components/password_manager/content/browser/bad_message.cc +++ b/components/password_manager/content/browser/bad_message.cc
@@ -56,36 +56,19 @@ return true; } -bool CheckChildProcessSecurityPolicy(content::RenderFrameHost* frame, - const PasswordForm& password_form, - BadMessageReason reason) { - return CheckChildProcessSecurityPolicyForURL(frame, password_form.url, - reason) && - CheckChildProcessSecurityPolicyForURL( - frame, GURL(password_form.signon_realm), reason) && - CheckChildProcessSecurityPolicyForURL( - frame, password_form.form_data.url, reason); -} - -bool CheckChildProcessSecurityPolicy(content::RenderFrameHost* frame, - const std::vector<PasswordForm>& forms, - BadMessageReason reason) { - for (const auto& form : forms) { - if (!bad_message::CheckChildProcessSecurityPolicy(frame, form, reason)) - return false; - } - return true; -} - bool CheckChildProcessSecurityPolicy( content::RenderFrameHost* frame, - const std::vector<autofill::FormData>& forms_data, + base::span<const autofill::FormData> forms_data, BadMessageReason reason) { for (const auto& form_data : forms_data) { if (!bad_message::CheckChildProcessSecurityPolicyForURL( frame, form_data.url, reason)) { return false; } + if (!bad_message::CheckChildProcessSecurityPolicyForURL( + frame, form_data.full_url, reason)) { + return false; + } } return true; }
diff --git a/components/password_manager/content/browser/bad_message.h b/components/password_manager/content/browser/bad_message.h index 06b2f97..6619d7c 100644 --- a/components/password_manager/content/browser/bad_message.h +++ b/components/password_manager/content/browser/bad_message.h
@@ -7,6 +7,7 @@ #include <vector> +#include "base/containers/span.h" #include "components/autofill/core/common/form_data.h" namespace content { @@ -15,8 +16,6 @@ namespace password_manager { -struct PasswordForm; - // The browser process often chooses to terminate a renderer if it receives // a bad IPC message. The reasons are tracked for metrics. // @@ -39,6 +38,8 @@ CPMD_BAD_ORIGIN_SHOW_MANUAL_PASSWORD_GENERATION_POPUP = 11, CPMD_BAD_ORIGIN_SHOW_PASSWORD_EDITING_POPUP = 12, CPMD_BAD_ORIGIN_GENERATION_AVAILABLE_FOR_FORM = 13, + CPMD_BAD_ORIGIN_PASSWORD_FORM_CLEARED = 14, + CPMD_BAD_ORIGIN_CHECK_SAFE_BROWSING_REPUTATION = 15, // Please add new elements here. The naming convention is abbreviated class // name (e.g. ContentPasswordManagerDriver becomes CPMD) plus a unique @@ -57,23 +58,9 @@ const GURL& form_url, BadMessageReason reason); -// Returns true if the renderer for |frame| is allowed to perform an operation -// on |password_form|. If the origin mismatches, the process for |frame| is -// terminated and the function returns false. -// TODO: Delete this signature after transferring all driver calls to FormData -bool CheckChildProcessSecurityPolicy(content::RenderFrameHost* frame, - const PasswordForm& password_form, - BadMessageReason reason); - -// Same as above but checks every form in |forms|. -// TODO: Delete this signature after transferring all driver calls to FormData -bool CheckChildProcessSecurityPolicy(content::RenderFrameHost* frame, - const std::vector<PasswordForm>& forms, - BadMessageReason reason); - bool CheckChildProcessSecurityPolicy( content::RenderFrameHost* frame, - const std::vector<autofill::FormData>& forms_data, + base::span<const autofill::FormData> forms_data, BadMessageReason reason); } // namespace bad_message
diff --git a/components/password_manager/content/browser/content_password_manager_driver.cc b/components/password_manager/content/browser/content_password_manager_driver.cc index 4278a6a..ed82930 100644 --- a/components/password_manager/content/browser/content_password_manager_driver.cc +++ b/components/password_manager/content/browser/content_password_manager_driver.cc
@@ -216,7 +216,7 @@ void ContentPasswordManagerDriver::PasswordFormsParsed( const std::vector<autofill::FormData>& forms_data) { if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( - render_frame_host_, forms_data, + render_frame_host_, base::make_span(forms_data), BadMessageReason::CPMD_BAD_ORIGIN_FORMS_PARSED)) return; GetPasswordManager()->OnPasswordFormsParsed(this, forms_data); @@ -226,7 +226,7 @@ const std::vector<autofill::FormData>& visible_forms_data, bool did_stop_loading) { if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( - render_frame_host_, visible_forms_data, + render_frame_host_, base::make_span(visible_forms_data), BadMessageReason::CPMD_BAD_ORIGIN_FORMS_RENDERED)) return; GetPasswordManager()->OnPasswordFormsRendered(this, visible_forms_data, @@ -235,8 +235,8 @@ void ContentPasswordManagerDriver::PasswordFormSubmitted( const autofill::FormData& form_data) { - if (!password_manager::bad_message::CheckChildProcessSecurityPolicyForURL( - render_frame_host_, form_data.url, + if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( + render_frame_host_, base::make_span(&form_data, 1), BadMessageReason::CPMD_BAD_ORIGIN_FORM_SUBMITTED)) return; GetPasswordManager()->OnPasswordFormSubmitted(this, form_data); @@ -246,8 +246,8 @@ void ContentPasswordManagerDriver::InformAboutUserInput( const autofill::FormData& form_data) { - if (!password_manager::bad_message::CheckChildProcessSecurityPolicyForURL( - render_frame_host_, form_data.url, + if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( + render_frame_host_, base::make_span(&form_data, 1), BadMessageReason::CPMD_BAD_ORIGIN_UPON_USER_INPUT_CHANGE)) return; GetPasswordManager()->OnInformAboutUserInput(this, form_data); @@ -274,6 +274,10 @@ void ContentPasswordManagerDriver::PasswordFormCleared( const autofill::FormData& form_data) { + if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( + render_frame_host_, base::make_span(&form_data, 1), + BadMessageReason::CPMD_BAD_ORIGIN_PASSWORD_FORM_CLEARED)) + return; GetPasswordManager()->OnPasswordFormCleared(this, form_data); } @@ -311,6 +315,10 @@ void ContentPasswordManagerDriver::CheckSafeBrowsingReputation( const GURL& form_action, const GURL& frame_url) { + if (!password_manager::bad_message::CheckChildProcessSecurityPolicyForURL( + render_frame_host_, frame_url, + BadMessageReason::CPMD_BAD_ORIGIN_CHECK_SAFE_BROWSING_REPUTATION)) + return; // Despite the name, this method is only called on password fields. // (See PasswordAutofillAgent::MaybeCheckSafeBrowsingReputation()) if (client_->GetMetricsRecorder()) {
diff --git a/components/password_manager/core/browser/votes_uploader_unittest.cc b/components/password_manager/core/browser/votes_uploader_unittest.cc index 3b29f72..9475312 100644 --- a/components/password_manager/core/browser/votes_uploader_unittest.cc +++ b/components/password_manager/core/browser/votes_uploader_unittest.cc
@@ -374,8 +374,8 @@ FormStructure form_structure(form); VotesUploader votes_uploader(&client_, true); votes_uploader.GeneratePasswordAttributesVote( - base::UTF8ToUTF16("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr" - "stuvwxyz!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"), + u"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr" + u"stuvwxyz!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", &form_structure); base::Optional<std::pair<PasswordAttribute, bool>> vote = form_structure.get_password_attributes_vote(); @@ -386,14 +386,13 @@ // Checks that password attributes vote is not generated if the password has // non-ascii characters. for (const auto* password : - {"пароль1", "パスワード", "münchen", "סיסמה-A", "Σ-12345", - "գաղտնաբառըTTT", "Slaptažodis", "密碼", "كلمهالسر", "mậtkhẩu!", - "ລະຫັດຜ່ານ-l", "စကားဝှက်ကို3", "პაროლი", "पारण शब्द"}) { + {u"пароль1", u"パスワード", u"münchen", u"סיסמה-A", u"Σ-12345", + u"գաղտնաբառըTTT", u"Slaptažodis", u"密碼", u"كلمهالسر", u"mậtkhẩu!", + u"ລະຫັດຜ່ານ-l", u"စကားဝှက်ကို3", u"პაროლი", u"पारण शब्द"}) { FormData form; FormStructure form_structure(form); VotesUploader votes_uploader(&client_, true); - votes_uploader.GeneratePasswordAttributesVote(base::UTF8ToUTF16(password), - &form_structure); + votes_uploader.GeneratePasswordAttributesVote(password, &form_structure); base::Optional<std::pair<PasswordAttribute, bool>> vote = form_structure.get_password_attributes_vote();
diff --git a/components/payments/content/payment_credential_enrollment_model_unittest.cc b/components/payments/content/payment_credential_enrollment_model_unittest.cc index 1a56b4c4..d113285 100644 --- a/components/payments/content/payment_credential_enrollment_model_unittest.cc +++ b/components/payments/content/payment_credential_enrollment_model_unittest.cc
@@ -15,9 +15,10 @@ PaymentCredentialEnrollmentModel model; std::u16string title(u"Use Touch ID to verify and complete your purchase?"); - std::u16string description(base::UTF8ToUTF16( - "Save payment information to this device and skip bank verification next " - "time when you use Touch ID to verify your payment with Visa ••••4444.")); + std::u16string description( + u"Save payment information to this device and skip bank verification " + u"next " + u"time when you use Touch ID to verify your payment with Visa ••••4444."); std::u16string accept_button_label(u"Use Touch ID"); std::u16string cancel_button_label(u"No thanks");
diff --git a/components/policy/core/common/cloud/user_cloud_policy_store_base.cc b/components/policy/core/common/cloud/user_cloud_policy_store_base.cc index 3511939..5223b42 100644 --- a/components/policy/core/common/cloud/user_cloud_policy_store_base.cc +++ b/components/policy/core/common/cloud/user_cloud_policy_store_base.cc
@@ -51,8 +51,17 @@ const std::string& policy_signature_public_key) { // Decode the payload. policy_map_.Clear(); - DecodeProtoFields(*payload, external_data_manager(), policy_source_, - policy_scope_, &policy_map_); +#if BUILDFLAG(IS_CHROMEOS_LACROS) + // From the policies that Lacros fetched from the cloud, it should only + // respect the ones with per_profile=True. Session-wide policies + // (per_profile=False) are be provided by ash and installed by + // PolicyLoaderLacros. + PolicyPerProfileFilter filter = PolicyPerProfileFilter::kTrue; +#else + PolicyPerProfileFilter filter = PolicyPerProfileFilter::kAny; +#endif + DecodeProtoFieldsPerProfile(*payload, external_data_manager(), policy_source_, + policy_scope_, &policy_map_, filter); policy_ = std::move(policy_data); policy_signature_public_key_ = policy_signature_public_key; }
diff --git a/components/policy/core/common/policy_loader_lacros.cc b/components/policy/core/common/policy_loader_lacros.cc index eecbc634..6a5fdc3 100644 --- a/components/policy/core/common/policy_loader_lacros.cc +++ b/components/policy/core/common/policy_loader_lacros.cc
@@ -27,13 +27,6 @@ : AsyncPolicyLoader(task_runner, /*periodic_updates=*/false), task_runner_(task_runner) { auto* lacros_chrome_service = chromeos::LacrosChromeServiceImpl::Get(); - if (!lacros_chrome_service) { - // LacrosChromeService should be available at this timing in production. - // However, in some existing tests, it is not. - // TODO(crbug.com/1114069): Set up LacrosChromeServiceImpl in tests. - LOG(ERROR) << "No LacrosChromeService is found."; - return; - } const crosapi::mojom::BrowserInitParams* init_params = lacros_chrome_service->init_params(); if (!init_params) {
diff --git a/components/policy/core/common/policy_map_unittest.cc b/components/policy/core/common/policy_map_unittest.cc index 68ebdee..484e4de 100644 --- a/components/policy/core/common/policy_map_unittest.cc +++ b/components/policy/core/common/policy_map_unittest.cc
@@ -36,7 +36,7 @@ const char kTestPolicyName8[] = "policy.test.8"; // Dummy error message. -const char kTestError[] = "Test error message"; +const char16_t kTestError[] = u"Test error message"; // Utility functions for the tests. void SetPolicy(PolicyMap* map, const char* name, base::Value value) { @@ -83,20 +83,19 @@ EXPECT_TRUE(expected_b.Equals(map.GetValue(kTestPolicyName1))); SetPolicy(&map, kTestPolicyName1, CreateExternalDataFetcher("dummy")); map.AddMessage(kTestPolicyName1, PolicyMap::MessageType::kError, - IDS_POLICY_STORE_STATUS_VALIDATION_ERROR, - {base::UTF8ToUTF16(kTestError)}); + IDS_POLICY_STORE_STATUS_VALIDATION_ERROR, {kTestError}); EXPECT_FALSE(map.GetValue(kTestPolicyName1)); const PolicyMap::Entry* entry = map.Get(kTestPolicyName1); ASSERT_TRUE(entry != nullptr); EXPECT_EQ(POLICY_LEVEL_MANDATORY, entry->level); EXPECT_EQ(POLICY_SCOPE_USER, entry->scope); EXPECT_EQ(POLICY_SOURCE_CLOUD, entry->source); - std::string error_string = base::StrCat({"Validation error: ", kTestError}); + std::u16string error_string = + base::StrCat({u"Validation error: ", kTestError}); PolicyMap::Entry::L10nLookupFunction lookup = base::BindRepeating( static_cast<std::u16string (*)(int)>(&base::NumberToString16)); - EXPECT_EQ( - base::UTF8ToUTF16(error_string), - entry->GetLocalizedMessages(PolicyMap::MessageType::kError, lookup)); + EXPECT_EQ(error_string, entry->GetLocalizedMessages( + PolicyMap::MessageType::kError, lookup)); EXPECT_TRUE( ExternalDataFetcher::Equals(entry->external_data_fetcher.get(), CreateExternalDataFetcher("dummy").get())); @@ -137,28 +136,27 @@ EXPECT_EQ(u"1234\n5678", entry1->GetLocalizedMessages( PolicyMap::MessageType::kError, lookup)); EXPECT_EQ( - base::UTF8ToUTF16("This policy is deprecated. You should use the " - "SomeNewPolicy policy instead."), + u"This policy is deprecated. You should use the " + u"SomeNewPolicy policy instead.", entry2->GetLocalizedMessages(PolicyMap::MessageType::kError, lookup)); map.AddMessage(kTestPolicyName2, PolicyMap::MessageType::kError, 1357); EXPECT_EQ(u"1234\n5678", entry1->GetLocalizedMessages( PolicyMap::MessageType::kError, lookup)); EXPECT_EQ( - base::UTF8ToUTF16("1357\nThis policy is deprecated. You should use " - "the SomeNewPolicy policy instead."), + u"1357\nThis policy is deprecated. You should use " + u"the SomeNewPolicy policy instead.", entry2->GetLocalizedMessages(PolicyMap::MessageType::kError, lookup)); // Test adding Error message with placeholder replacement (two args) map.AddMessage(kTestPolicyName1, PolicyMap::MessageType::kError, IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_COPY_VM, {u"SomeSource", u"SomeDestination"}); EXPECT_EQ( - base::UTF8ToUTF16( - "1234\n5678\nSharing from SomeSource to SomeDestination has " - "been blocked by administrator policy"), + u"1234\n5678\nSharing from SomeSource to SomeDestination has " + u"been blocked by administrator policy", entry1->GetLocalizedMessages(PolicyMap::MessageType::kError, lookup)); EXPECT_EQ( - base::UTF8ToUTF16("1357\nThis policy is deprecated. You should use " - "the SomeNewPolicy policy instead."), + u"1357\nThis policy is deprecated. You should use " + u"the SomeNewPolicy policy instead.", entry2->GetLocalizedMessages(PolicyMap::MessageType::kError, lookup)); // Ensure other message types are empty @@ -192,28 +190,27 @@ EXPECT_EQ(u"1234\n5678", entry1->GetLocalizedMessages( PolicyMap::MessageType::kWarning, lookup)); EXPECT_EQ( - base::UTF8ToUTF16("This policy is deprecated. You should use the " - "SomeNewPolicy policy instead."), + u"This policy is deprecated. You should use the " + u"SomeNewPolicy policy instead.", entry2->GetLocalizedMessages(PolicyMap::MessageType::kWarning, lookup)); entry2->AddMessage(PolicyMap::MessageType::kWarning, 1357); EXPECT_EQ(u"1234\n5678", entry1->GetLocalizedMessages( PolicyMap::MessageType::kWarning, lookup)); EXPECT_EQ( - base::UTF8ToUTF16("1357\nThis policy is deprecated. You should use " - "the SomeNewPolicy policy instead."), + u"1357\nThis policy is deprecated. You should use " + u"the SomeNewPolicy policy instead.", entry2->GetLocalizedMessages(PolicyMap::MessageType::kWarning, lookup)); // Test adding Warning message with placeholder replacement (two args) entry1->AddMessage(PolicyMap::MessageType::kWarning, IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_COPY_VM, {u"SomeSource", u"SomeDestination"}); EXPECT_EQ( - base::UTF8ToUTF16( - "1234\n5678\nSharing from SomeSource to SomeDestination has " - "been blocked by administrator policy"), + u"1234\n5678\nSharing from SomeSource to SomeDestination has " + u"been blocked by administrator policy", entry1->GetLocalizedMessages(PolicyMap::MessageType::kWarning, lookup)); EXPECT_EQ( - base::UTF8ToUTF16("1357\nThis policy is deprecated. You should use " - "the SomeNewPolicy policy instead."), + u"1357\nThis policy is deprecated. You should use " + u"the SomeNewPolicy policy instead.", entry2->GetLocalizedMessages(PolicyMap::MessageType::kWarning, lookup)); // Ensure other message types are empty @@ -247,28 +244,27 @@ EXPECT_EQ(u"1234\n5678", entry1->GetLocalizedMessages( PolicyMap::MessageType::kInfo, lookup)); EXPECT_EQ( - base::UTF8ToUTF16("This policy is deprecated. You should use the " - "SomeNewPolicy policy instead."), + u"This policy is deprecated. You should use the " + u"SomeNewPolicy policy instead.", entry2->GetLocalizedMessages(PolicyMap::MessageType::kInfo, lookup)); entry2->AddMessage(PolicyMap::MessageType::kInfo, 1357); EXPECT_EQ(u"1234\n5678", entry1->GetLocalizedMessages( PolicyMap::MessageType::kInfo, lookup)); EXPECT_EQ( - base::UTF8ToUTF16("1357\nThis policy is deprecated. You should use " - "the SomeNewPolicy policy instead."), + u"1357\nThis policy is deprecated. You should use " + u"the SomeNewPolicy policy instead.", entry2->GetLocalizedMessages(PolicyMap::MessageType::kInfo, lookup)); // Test adding Info message with placeholder replacement (two args) entry1->AddMessage(PolicyMap::MessageType::kInfo, IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_COPY_VM, {u"SomeSource", u"SomeDestination"}); EXPECT_EQ( - base::UTF8ToUTF16( - "1234\n5678\nSharing from SomeSource to SomeDestination has " - "been blocked by administrator policy"), + u"1234\n5678\nSharing from SomeSource to SomeDestination has " + u"been blocked by administrator policy", entry1->GetLocalizedMessages(PolicyMap::MessageType::kInfo, lookup)); EXPECT_EQ( - base::UTF8ToUTF16("1357\nThis policy is deprecated. You should use " - "the SomeNewPolicy policy instead."), + u"1357\nThis policy is deprecated. You should use " + u"the SomeNewPolicy policy instead.", entry2->GetLocalizedMessages(PolicyMap::MessageType::kInfo, lookup)); // Ensure other message types are empty
diff --git a/components/prefs/command_line_pref_store.cc b/components/prefs/command_line_pref_store.cc index 4a475f57..35c74a4 100644 --- a/components/prefs/command_line_pref_store.cc +++ b/components/prefs/command_line_pref_store.cc
@@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" +#include "base/values.h" CommandLinePrefStore::CommandLinePrefStore( const base::CommandLine* command_line)
diff --git a/components/prefs/command_line_pref_store.h b/components/prefs/command_line_pref_store.h index 03d5da9..bbc7b2bf 100644 --- a/components/prefs/command_line_pref_store.h +++ b/components/prefs/command_line_pref_store.h
@@ -7,7 +7,6 @@ #include "base/command_line.h" #include "base/macros.h" -#include "base/values.h" #include "components/prefs/value_map_pref_store.h" // Base class for a PrefStore that maps command line switches to preferences.
diff --git a/components/query_parser/query_parser.cc b/components/query_parser/query_parser.cc index 42c1a77..5be2cd74 100644 --- a/components/query_parser/query_parser.cc +++ b/components/query_parser/query_parser.cc
@@ -457,6 +457,9 @@ // static void QueryParser::ExtractQueryWords(const std::u16string& text, QueryWordVector* words) { + DCHECK(text == base::i18n::ToLower(text)) + << "The caller must have already lowercased `text`. Value = " + << base::UTF16ToUTF8(text); base::i18n::BreakIterator iter(text, base::i18n::BreakIterator::BREAK_WORD); // TODO(evanm): support a locale here if (!iter.Init())
diff --git a/components/query_parser/query_parser.h b/components/query_parser/query_parser.h index c1c22fcd..f28ed650 100644 --- a/components/query_parser/query_parser.h +++ b/components/query_parser/query_parser.h
@@ -124,6 +124,8 @@ const QueryNodeVector& find_nodes); // Extracts the words from |text|, placing each word into |words|. + // |text| must already be lowercased by the caller, as otherwise the output + // will NEVER match anything. static void ExtractQueryWords(const std::u16string& text, QueryWordVector* words);
diff --git a/components/reporting/client/mock_report_queue.h b/components/reporting/client/mock_report_queue.h index 27c79d1..984634b 100644 --- a/components/reporting/client/mock_report_queue.h +++ b/components/reporting/client/mock_report_queue.h
@@ -6,7 +6,6 @@ #define COMPONENTS_REPORTING_CLIENT_MOCK_REPORT_QUEUE_H_ #include "base/callback.h" -#include "base/values.h" #include "components/reporting/client/mock_report_queue.h" #include "components/reporting/client/report_queue.h" #include "components/reporting/proto/record.pb.h"
diff --git a/components/safe_browsing/content/renderer/phishing_classifier/phishing_term_feature_extractor_unittest.cc b/components/safe_browsing/content/renderer/phishing_classifier/phishing_term_feature_extractor_unittest.cc index f647c176..1df89d98 100644 --- a/components/safe_browsing/content/renderer/phishing_classifier/phishing_term_feature_extractor_unittest.cc +++ b/components/safe_browsing/content/renderer/phishing_classifier/phishing_term_feature_extractor_unittest.cc
@@ -263,19 +263,15 @@ // Chinese translation of the phrase "hello goodbye hello goodbye". This tests // that we can correctly separate terms in languages that don't use spaces. - page_text = base::UTF8ToUTF16( - "\xe4\xbd\xa0\xe5\xa5\xbd\xe5\x86\x8d\xe8\xa7\x81" - "\xe4\xbd\xa0\xe5\xa5\xbd\xe5\x86\x8d\xe8\xa7\x81"); + page_text = u"你好再见你好再见"; expected_features.Clear(); expected_features.AddBooleanFeature(features::kPageTerm + - std::string("\xe4\xbd\xa0\xe5\xa5\xbd")); + std::string("你好")); expected_features.AddBooleanFeature(features::kPageTerm + - std::string("\xe5\x86\x8d\xe8\xa7\x81")); + std::string("再见")); expected_shingle_hashes.clear(); expected_shingle_hashes.insert( - MurmurHash3String("\xe4\xbd\xa0\xe5\xa5\xbd \xe5\x86\x8d\xe8\xa7\x81 " - "\xe4\xbd\xa0\xe5\xa5\xbd \xe5\x86\x8d\xe8\xa7\x81 ", - kMurmurHash3Seed)); + MurmurHash3String("你好 再见 你好 再见 ", kMurmurHash3Seed)); features.Clear(); shingle_hashes.clear();
diff --git a/components/safe_browsing/core/password_protection/password_protection_service_base.h b/components/safe_browsing/core/password_protection/password_protection_service_base.h index c775a5c..4f8222ed 100644 --- a/components/safe_browsing/core/password_protection/password_protection_service_base.h +++ b/components/safe_browsing/core/password_protection/password_protection_service_base.h
@@ -14,7 +14,6 @@ #include "base/memory/weak_ptr.h" #include "base/scoped_observation.h" #include "base/task/cancelable_task_tracker.h" -#include "base/values.h" #include "build/build_config.h" #include "components/history/core/browser/history_service.h" #include "components/history/core/browser/history_service_observer.h"
diff --git a/components/search_engines/template_url_unittest.cc b/components/search_engines/template_url_unittest.cc index 79ec26e..2cbb292 100644 --- a/components/search_engines/template_url_unittest.cc +++ b/components/search_engines/template_url_unittest.cc
@@ -522,14 +522,14 @@ const std::string url; const std::string expected_result; } test_data[] = { - {"BIG5", u"\x60BD", "http://foo/?{searchTerms}{inputEncoding}", + {"BIG5", u"悽", "http://foo/?{searchTerms}{inputEncoding}", "http://foo/?%B1~BIG5"}, {"UTF-8", u"blah", "http://foo/?{searchTerms}{inputEncoding}", "http://foo/?blahUTF-8"}, - {"Shift_JIS", base::UTF8ToUTF16("\xe3\x81\x82"), - "http://foo/{searchTerms}/bar", "http://foo/%82%A0/bar"}, - {"Shift_JIS", base::UTF8ToUTF16("\xe3\x81\x82 \xe3\x81\x84"), - "http://foo/{searchTerms}/bar", "http://foo/%82%A0%20%82%A2/bar"}, + {"Shift_JIS", u"あ", "http://foo/{searchTerms}/bar", + "http://foo/%82%A0/bar"}, + {"Shift_JIS", u"あ い", "http://foo/{searchTerms}/bar", + "http://foo/%82%A0%20%82%A2/bar"}, }; TemplateURLData data; for (size_t i = 0; i < base::size(test_data); ++i) { @@ -558,27 +558,27 @@ } test_data[] = { // First and third encodings are valid. First is used. {{"windows-1251", "cp-866", "UTF-8"}, - base::UTF8ToUTF16("\xD1\x8F"), + u"я", "http://foo/?{searchTerms}{inputEncoding}", "http://foo/?%FFwindows-1251"}, // Second and third encodings are valid, second is used. {{"cp-866", "GB2312", "UTF-8"}, - base::UTF8ToUTF16("\xE7\x8B\x97"), + u"狗", "http://foo/?{searchTerms}{inputEncoding}", "http://foo/?%B9%B7GB2312"}, // Second and third encodings are valid in another order, second is used. {{"cp-866", "UTF-8", "GB2312"}, - base::UTF8ToUTF16("\xE7\x8B\x97"), + u"狗", "http://foo/?{searchTerms}{inputEncoding}", "http://foo/?%E7%8B%97UTF-8"}, // Both encodings are invalid, fallback to UTF-8. {{"cp-866", "windows-1251"}, - base::UTF8ToUTF16("\xE7\x8B\x97"), + u"狗", "http://foo/?{searchTerms}{inputEncoding}", "http://foo/?%E7%8B%97UTF-8"}, // No encodings are given, fallback to UTF-8. {{}, - base::UTF8ToUTF16("\xE7\x8B\x97"), + u"狗", "http://foo/?{searchTerms}{inputEncoding}", "http://foo/?%E7%8B%97UTF-8"}, }; @@ -1854,9 +1854,7 @@ ASSERT_EQ(u"blah", TemplateURL::GenerateKeyword(GURL("http://blah/"))); // Don't generate the empty string. ASSERT_EQ(u"www.", TemplateURL::GenerateKeyword(GURL("http://www."))); - ASSERT_EQ( - base::UTF8ToUTF16("\xd0\xb0\xd0\xb1\xd0\xb2"), - TemplateURL::GenerateKeyword(GURL("http://xn--80acd"))); + ASSERT_EQ(u"абв", TemplateURL::GenerateKeyword(GURL("http://xn--80acd"))); // Generated keywords must always be in lowercase, because TemplateURLs always // converts keywords to lowercase in its constructor and TemplateURLService
diff --git a/components/signin/core/browser/signin_internals_util.h b/components/signin/core/browser/signin_internals_util.h index dc6a0e240..09e80e8 100644 --- a/components/signin/core/browser/signin_internals_util.h +++ b/components/signin/core/browser/signin_internals_util.h
@@ -11,7 +11,6 @@ #include <memory> #include <string> -#include "base/values.h" namespace signin_internals_util {
diff --git a/components/site_isolation/site_isolation_policy.cc b/components/site_isolation/site_isolation_policy.cc index 5dd10bb..41b36342 100644 --- a/components/site_isolation/site_isolation_policy.cc +++ b/components/site_isolation/site_isolation_policy.cc
@@ -139,9 +139,9 @@ return; std::vector<url::Origin> origins; - for (const auto& value : - *user_prefs::UserPrefs::Get(browser_context) - ->GetList(prefs::kUserTriggeredIsolatedOrigins)) { + for (const auto& value : user_prefs::UserPrefs::Get(browser_context) + ->GetList(prefs::kUserTriggeredIsolatedOrigins) + ->GetList()) { origins.push_back(url::Origin::Create(GURL(value.GetString()))); }
diff --git a/components/spellcheck/renderer/spellcheck_unittest.cc b/components/spellcheck/renderer/spellcheck_unittest.cc index c2d149a..387fb378 100644 --- a/components/spellcheck/renderer/spellcheck_unittest.cc +++ b/components/spellcheck/renderer/spellcheck_unittest.cc
@@ -1065,12 +1065,12 @@ TEST_F(SpellCheckTest, SpellCheckParagraphLongSentence) { std::vector<SpellCheckResult> expected; // The text is taken from US constitution preamble. - const std::u16string text = base::UTF8ToUTF16( - "We the people of the United States, in order to form a more perfect " - "union, establish justice, insure domestic tranquility, provide for " - "the common defense, promote the general welfare, and secure the " - "blessings of liberty to ourselves and our posterity, do ordain and " - "establish this Constitution for the United States of America."); + const std::u16string text = + u"We the people of the United States, in order to form a more perfect " + u"union, establish justice, insure domestic tranquility, provide for " + u"the common defense, promote the general welfare, and secure the " + u"blessings of liberty to ourselves and our posterity, do ordain and " + u"establish this Constitution for the United States of America."; TestSpellCheckParagraph(text, expected); } @@ -1080,12 +1080,12 @@ std::vector<SpellCheckResult> expected; // All 'the' are converted to 'hte' in US consitition preamble. - const std::u16string text = base::UTF8ToUTF16( - "We hte people of hte United States, in order to form a more perfect " - "union, establish justice, insure domestic tranquility, provide for " - "hte common defense, promote hte general welfare, and secure hte " - "blessings of liberty to ourselves and our posterity, do ordain and " - "establish this Constitution for hte United States of America."); + const std::u16string text = + u"We hte people of hte United States, in order to form a more perfect " + u"union, establish justice, insure domestic tranquility, provide for " + u"hte common defense, promote hte general welfare, and secure hte " + u"blessings of liberty to ourselves and our posterity, do ordain and " + u"establish this Constitution for hte United States of America."; expected.push_back(SpellCheckResult( SpellCheckResult::SPELLING, 3, 3));
diff --git a/components/sync/base/unique_position.h b/components/sync/base/unique_position.h index a1ba63c..25aebe6 100644 --- a/components/sync/base/unique_position.h +++ b/components/sync/base/unique_position.h
@@ -76,6 +76,12 @@ // Creates an empty, invalid value. UniquePosition(); + // Type is copyable and movable. + UniquePosition(const UniquePosition&) = default; + UniquePosition(UniquePosition&&) = default; + UniquePosition& operator=(const UniquePosition&) = default; + UniquePosition& operator=(UniquePosition&&) = default; + bool LessThan(const UniquePosition& other) const; bool Equals(const UniquePosition& other) const;
diff --git a/components/sync/engine/bookmark_update_preprocessing.cc b/components/sync/engine/bookmark_update_preprocessing.cc index 39517542..6601975 100644 --- a/components/sync/engine/bookmark_update_preprocessing.cc +++ b/components/sync/engine/bookmark_update_preprocessing.cc
@@ -111,7 +111,8 @@ } if (update_entity.has_unique_position()) { - data->unique_position = update_entity.unique_position(); + data->unique_position = + UniquePosition::FromProto(update_entity.unique_position()); } else if (update_entity.has_position_in_parent() || update_entity.has_insert_after_item_id()) { bool missing_originator_fields = false; @@ -129,12 +130,11 @@ if (update_entity.has_position_in_parent()) { data->unique_position = - UniquePosition::FromInt64(update_entity.position_in_parent(), suffix) - .ToProto(); + UniquePosition::FromInt64(update_entity.position_in_parent(), suffix); } else { // If update_entity has insert_after_item_id, use 0 index. DCHECK(update_entity.has_insert_after_item_id()); - data->unique_position = UniquePosition::FromInt64(0, suffix).ToProto(); + data->unique_position = UniquePosition::FromInt64(0, suffix); } } else { DLOG(ERROR) << "Missing required position information in update: "
diff --git a/components/sync/engine/bookmark_update_preprocessing_unittest.cc b/components/sync/engine/bookmark_update_preprocessing_unittest.cc index 6ff08bf9..9e66744b 100644 --- a/components/sync/engine/bookmark_update_preprocessing_unittest.cc +++ b/components/sync/engine/bookmark_update_preprocessing_unittest.cc
@@ -40,8 +40,7 @@ EntityData entity_data; AdaptUniquePositionForBookmark(entity, &entity_data); - EXPECT_TRUE( - syncer::UniquePosition::FromProto(entity_data.unique_position).IsValid()); + EXPECT_TRUE(entity_data.unique_position.IsValid()); } TEST(BookmarkUpdatePreprocessingTest, @@ -54,8 +53,7 @@ EntityData entity_data; AdaptUniquePositionForBookmark(entity, &entity_data); - EXPECT_TRUE( - syncer::UniquePosition::FromProto(entity_data.unique_position).IsValid()); + EXPECT_TRUE(entity_data.unique_position.IsValid()); } TEST(BookmarkUpdatePreprocessingTest, @@ -68,8 +66,7 @@ EntityData entity_data; AdaptUniquePositionForBookmark(entity, &entity_data); - EXPECT_TRUE( - syncer::UniquePosition::FromProto(entity_data.unique_position).IsValid()); + EXPECT_TRUE(entity_data.unique_position.IsValid()); } // Tests that AdaptGuidForBookmark() propagates GUID in specifics if the field
diff --git a/components/sync/engine/commit_contribution_impl.cc b/components/sync/engine/commit_contribution_impl.cc index df9a38a..ee6d3a4 100644 --- a/components/sync/engine/commit_contribution_impl.cc +++ b/components/sync/engine/commit_contribution_impl.cc
@@ -224,15 +224,11 @@ if (type == BOOKMARKS) { // position_in_parent field is set only for legacy reasons. See comments // in sync.proto for more information. - const UniquePosition unique_position = - UniquePosition::FromProto(entity_data.unique_position); + const UniquePosition& unique_position = entity_data.unique_position; if (unique_position.IsValid()) { commit_proto->set_position_in_parent(unique_position.ToInt64()); } - commit_proto->mutable_unique_position()->CopyFrom( - entity_data.unique_position); - // TODO(mamir): check if parent_id_string needs to be populated for - // non-deletions. + *commit_proto->mutable_unique_position() = unique_position.ToProto(); if (!entity_data.parent_id.empty()) { commit_proto->set_parent_id_string(entity_data.parent_id); }
diff --git a/components/sync/engine/commit_contribution_impl_unittest.cc b/components/sync/engine/commit_contribution_impl_unittest.cc index 8e221b4..6ed320f 100644 --- a/components/sync/engine/commit_contribution_impl_unittest.cc +++ b/components/sync/engine/commit_contribution_impl_unittest.cc
@@ -112,9 +112,8 @@ data->name = "Name:"; data->parent_id = "ParentOf:"; data->is_folder = true; - syncer::UniquePosition uniquePosition = syncer::UniquePosition::FromInt64( + data->unique_position = syncer::UniquePosition::FromInt64( 10, syncer::UniquePosition::RandomSuffix()); - data->unique_position = uniquePosition.ToProto(); CommitRequestData request_data; request_data.sequence_number = 2;
diff --git a/components/sync/engine/entity_data.cc b/components/sync/engine/entity_data.cc index d2db3fda..fe21dbc 100644 --- a/components/sync/engine/entity_data.cc +++ b/components/sync/engine/entity_data.cc
@@ -21,51 +21,19 @@ namespace { -std::string UniquePositionToString( - const sync_pb::UniquePosition& unique_position) { - return UniquePosition::FromProto(unique_position).ToDebugString(); +std::string UniquePositionToString(const UniquePosition& unique_position) { + return unique_position.ToDebugString(); } } // namespace EntityData::EntityData() = default; -EntityData::EntityData(EntityData&& other) - : id(std::move(other.id)), - client_tag_hash(std::move(other.client_tag_hash)), - originator_cache_guid(std::move(other.originator_cache_guid)), - originator_client_item_id(std::move(other.originator_client_item_id)), - server_defined_unique_tag(std::move(other.server_defined_unique_tag)), - name(std::move(other.name)), - creation_time(other.creation_time), - modification_time(other.modification_time), - parent_id(std::move(other.parent_id)), - is_folder(other.is_folder), - is_bookmark_guid_in_specifics_preprocessed( - other.is_bookmark_guid_in_specifics_preprocessed) { - specifics.Swap(&other.specifics); - unique_position.Swap(&other.unique_position); -} +EntityData::EntityData(EntityData&& other) = default; EntityData::~EntityData() = default; -EntityData& EntityData::operator=(EntityData&& other) { - id = std::move(other.id); - client_tag_hash = std::move(other.client_tag_hash); - originator_cache_guid = std::move(other.originator_cache_guid); - originator_client_item_id = std::move(other.originator_client_item_id); - server_defined_unique_tag = std::move(other.server_defined_unique_tag); - name = std::move(other.name); - creation_time = other.creation_time; - modification_time = other.modification_time; - parent_id = std::move(other.parent_id); - is_folder = other.is_folder; - is_bookmark_guid_in_specifics_preprocessed = - other.is_bookmark_guid_in_specifics_preprocessed; - specifics.Swap(&other.specifics); - unique_position.Swap(&other.unique_position); - return *this; -} +EntityData& EntityData::operator=(EntityData&& other) = default; #define ADD_TO_DICT(dict, value) \ dict->SetString(base::ToUpperASCII(#value), value);
diff --git a/components/sync/engine/entity_data.h b/components/sync/engine/entity_data.h index 48ca7b1..b6664bc7 100644 --- a/components/sync/engine/entity_data.h +++ b/components/sync/engine/entity_data.h
@@ -12,6 +12,7 @@ #include "base/time/time.h" #include "base/values.h" #include "components/sync/base/client_tag_hash.h" +#include "components/sync/base/unique_position.h" #include "components/sync/protocol/sync.pb.h" // TODO(crbug.com/947443): Code outside components/sync depends on this file @@ -85,7 +86,7 @@ // Unique position of an entity among its siblings. This is supposed to be // set only for datatypes that support positioning (e.g. Bookmarks). - sync_pb::UniquePosition unique_position; + UniquePosition unique_position; // True if EntityData represents deleted entity; otherwise false. // Note that EntityData would be considered to represent a deletion if its
diff --git a/components/sync/engine/model_type_worker_unittest.cc b/components/sync/engine/model_type_worker_unittest.cc index f1df964..eab7448 100644 --- a/components/sync/engine/model_type_worker_unittest.cc +++ b/components/sync/engine/model_type_worker_unittest.cc
@@ -1563,8 +1563,7 @@ ModelTypeWorker::PopulateUpdateResponseData( FakeCryptographer(), BOOKMARKS, entity, &response_data)); const EntityData& data = response_data.entity; - EXPECT_TRUE( - syncer::UniquePosition::FromProto(data.unique_position).IsValid()); + EXPECT_TRUE(data.unique_position.IsValid()); } TEST(ModelTypeWorkerPopulateUpdateResponseDataTest, @@ -1582,8 +1581,7 @@ ModelTypeWorker::PopulateUpdateResponseData( FakeCryptographer(), BOOKMARKS, entity, &response_data)); const EntityData& data = response_data.entity; - EXPECT_TRUE( - syncer::UniquePosition::FromProto(data.unique_position).IsValid()); + EXPECT_TRUE(data.unique_position.IsValid()); } TEST(ModelTypeWorkerPopulateUpdateResponseDataTest, @@ -1601,8 +1599,7 @@ ModelTypeWorker::PopulateUpdateResponseData( FakeCryptographer(), BOOKMARKS, entity, &response_data)); const EntityData& data = response_data.entity; - EXPECT_TRUE( - syncer::UniquePosition::FromProto(data.unique_position).IsValid()); + EXPECT_TRUE(data.unique_position.IsValid()); } TEST(ModelTypeWorkerPopulateUpdateResponseDataTest, @@ -1622,8 +1619,7 @@ ModelTypeWorker::PopulateUpdateResponseData( FakeCryptographer(), BOOKMARKS, entity, &response_data)); const EntityData& data = response_data.entity; - EXPECT_FALSE( - syncer::UniquePosition::FromProto(data.unique_position).IsValid()); + EXPECT_FALSE(data.unique_position.IsValid()); } TEST(ModelTypeWorkerPopulateUpdateResponseDataTest, NonBookmarkWithNoPosition) { @@ -1638,8 +1634,7 @@ ModelTypeWorker::PopulateUpdateResponseData( FakeCryptographer(), PREFERENCES, entity, &response_data)); const EntityData& data = response_data.entity; - EXPECT_FALSE( - syncer::UniquePosition::FromProto(data.unique_position).IsValid()); + EXPECT_FALSE(data.unique_position.IsValid()); } TEST(ModelTypeWorkerPopulateUpdateResponseDataTest, BookmarkWithGUID) {
diff --git a/components/sync/test/fake_server/fake_server_verifier.h b/components/sync/test/fake_server/fake_server_verifier.h index 7dc1633..fc728cdc 100644 --- a/components/sync/test/fake_server/fake_server_verifier.h +++ b/components/sync/test/fake_server/fake_server_verifier.h
@@ -10,7 +10,6 @@ #include <string> #include "base/macros.h" -#include "base/values.h" #include "components/sync/base/model_type.h" #include "components/sync/test/fake_server/sessions_hierarchy.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/components/sync_bookmarks/bookmark_local_changes_builder.cc b/components/sync_bookmarks/bookmark_local_changes_builder.cc index 1f85aa70..18e6ebe 100644 --- a/components/sync_bookmarks/bookmark_local_changes_builder.cc +++ b/components/sync_bookmarks/bookmark_local_changes_builder.cc
@@ -7,6 +7,7 @@ #include <memory> #include <string> #include <utility> +#include <vector> #include "base/strings/utf_string_conversions.h" #include "components/bookmarks/browser/bookmark_model.h" @@ -90,7 +91,8 @@ // 2. Bookmarks (maybe ancient legacy bookmarks only?) use/used |name| to // encode the title. data->is_folder = node->is_folder(); - data->unique_position = metadata->unique_position(); + data->unique_position = + syncer::UniquePosition::FromProto(metadata->unique_position()); // Assign specifics only for the non-deletion case. In case of deletion, // EntityData should contain empty specifics to indicate deletion. data->specifics = CreateSpecificsFromBookmarkNode(
diff --git a/components/sync_bookmarks/bookmark_model_merger.cc b/components/sync_bookmarks/bookmark_model_merger.cc index 90b8c9ea..dd1d21ba 100644 --- a/components/sync_bookmarks/bookmark_model_merger.cc +++ b/components/sync_bookmarks/bookmark_model_merger.cc
@@ -317,8 +317,7 @@ DCHECK(!update_entity.is_deleted()); DCHECK(update_entity.server_defined_unique_tag.empty()); - if (!syncer::UniquePosition::FromProto(update_entity.unique_position) - .IsValid()) { + if (!update_entity.unique_position.IsValid()) { // Ignore updates with invalid positions. DLOG(ERROR) << "Remote update with invalid position: " @@ -411,11 +410,7 @@ bool BookmarkModelMerger::RemoteTreeNode::UniquePositionLessThan( const RemoteTreeNode& lhs, const RemoteTreeNode& rhs) { - const syncer::UniquePosition a_pos = - syncer::UniquePosition::FromProto(lhs.entity().unique_position); - const syncer::UniquePosition b_pos = - syncer::UniquePosition::FromProto(rhs.entity().unique_position); - return a_pos.LessThan(b_pos); + return lhs.entity().unique_position.LessThan(rhs.entity().unique_position); } // static @@ -866,7 +861,7 @@ const sync_pb::EntitySpecifics specifics = CreateSpecificsFromBookmarkNode( node, bookmark_model_, /*force_favicon_load=*/true); const SyncedBookmarkTracker::Entity* entity = bookmark_tracker_->Add( - node, sync_id, server_version, creation_time, pos.ToProto(), specifics); + node, sync_id, server_version, creation_time, pos, specifics); // Mark the entity that it needs to be committed. bookmark_tracker_->IncrementSequenceNumber(entity); for (size_t i = 0; i < node->children().size(); ++i) {
diff --git a/components/sync_bookmarks/bookmark_model_merger_unittest.cc b/components/sync_bookmarks/bookmark_model_merger_unittest.cc index a798934..b6e06ca 100644 --- a/components/sync_bookmarks/bookmark_model_merger_unittest.cc +++ b/components/sync_bookmarks/bookmark_model_merger_unittest.cc
@@ -81,7 +81,7 @@ const syncer::UniquePosition& unique_position) { data_.id = server_id; data_.parent_id = parent_id; - data_.unique_position = unique_position.ToProto(); + data_.unique_position = unique_position; data_.is_folder = true; sync_pb::BookmarkSpecifics* bookmark_specifics =
diff --git a/components/sync_bookmarks/bookmark_model_observer_impl.cc b/components/sync_bookmarks/bookmark_model_observer_impl.cc index 01edbbf9..aacbed17 100644 --- a/components/sync_bookmarks/bookmark_model_observer_impl.cc +++ b/components/sync_bookmarks/bookmark_model_observer_impl.cc
@@ -60,8 +60,8 @@ const std::string& sync_id = entity->metadata()->server_id(); const base::Time modification_time = base::Time::Now(); - const sync_pb::UniquePosition unique_position = - ComputePosition(*new_parent, new_index, sync_id).ToProto(); + const syncer::UniquePosition unique_position = + ComputePosition(*new_parent, new_index, sync_id); sync_pb::EntitySpecifics specifics = CreateSpecificsFromBookmarkNode(node, model, /*force_favicon_load=*/true); @@ -88,13 +88,8 @@ // Should be removed after figuring out the reason for the crash. CHECK(parent_entity); - // Assign a temp server id for the entity. Will be overriden by the actual - // server id upon receiving commit response. - // Local bookmark creations should have used a random GUID so it's safe to - // use it as originator client item ID, without the risk for collision. - const sync_pb::UniquePosition unique_position = - ComputePosition(*parent, index, node->guid().AsLowercaseString()) - .ToProto(); + const syncer::UniquePosition unique_position = + ComputePosition(*parent, index, node->guid().AsLowercaseString()); sync_pb::EntitySpecifics specifics = CreateSpecificsFromBookmarkNode(node, model, /*force_favicon_load=*/true); @@ -294,7 +289,7 @@ child.get(), model, /*force_favicon_load=*/true); bookmark_tracker_->Update(entity, entity->metadata()->server_version(), - modification_time, position.ToProto(), specifics); + modification_time, position, specifics); // Mark the entity that it needs to be committed. bookmark_tracker_->IncrementSequenceNumber(entity); } @@ -383,9 +378,11 @@ return; } - bookmark_tracker_->Update(entity, entity->metadata()->server_version(), - /*modification_time=*/base::Time::Now(), - entity->metadata()->unique_position(), specifics); + bookmark_tracker_->Update( + entity, entity->metadata()->server_version(), + /*modification_time=*/base::Time::Now(), + syncer::UniquePosition::FromProto(entity->metadata()->unique_position()), + specifics); // Mark the entity that it needs to be committed. bookmark_tracker_->IncrementSequenceNumber(entity); nudge_for_commit_closure_.Run();
diff --git a/components/sync_bookmarks/bookmark_model_observer_impl_unittest.cc b/components/sync_bookmarks/bookmark_model_observer_impl_unittest.cc index 7e22d12a..7c0e78d 100644 --- a/components/sync_bookmarks/bookmark_model_observer_impl_unittest.cc +++ b/components/sync_bookmarks/bookmark_model_observer_impl_unittest.cc
@@ -138,8 +138,7 @@ /*sync_id=*/kBookmarkBarId, /*server_version=*/0, /*creation_time=*/base::Time::Now(), syncer::UniquePosition::InitialPosition( - syncer::UniquePosition::RandomSuffix()) - .ToProto(), + syncer::UniquePosition::RandomSuffix()), specifics); specifics.mutable_bookmark()->set_legacy_canonicalized_title( kOtherBookmarksTag); @@ -148,8 +147,7 @@ /*sync_id=*/kOtherBookmarksId, /*server_version=*/0, /*creation_time=*/base::Time::Now(), syncer::UniquePosition::InitialPosition( - syncer::UniquePosition::RandomSuffix()) - .ToProto(), + syncer::UniquePosition::RandomSuffix()), specifics); specifics.mutable_bookmark()->set_legacy_canonicalized_title( kMobileBookmarksTag); @@ -158,8 +156,7 @@ /*sync_id=*/kMobileBookmarksId, /*server_version=*/0, /*creation_time=*/base::Time::Now(), syncer::UniquePosition::InitialPosition( - syncer::UniquePosition::RandomSuffix()) - .ToProto(), + syncer::UniquePosition::RandomSuffix()), specifics); } @@ -574,8 +571,7 @@ /*sync_id=*/kBookmarkBarId, /*server_version=*/0, /*creation_time=*/base::Time::Now(), syncer::UniquePosition::InitialPosition( - syncer::UniquePosition::RandomSuffix()) - .ToProto(), + syncer::UniquePosition::RandomSuffix()), specifics); specifics.mutable_bookmark()->set_legacy_canonicalized_title( kOtherBookmarksTag); @@ -584,8 +580,7 @@ /*sync_id=*/kOtherBookmarksId, /*server_version=*/0, /*creation_time=*/base::Time::Now(), syncer::UniquePosition::InitialPosition( - syncer::UniquePosition::RandomSuffix()) - .ToProto(), + syncer::UniquePosition::RandomSuffix()), specifics); specifics.mutable_bookmark()->set_legacy_canonicalized_title( kMobileBookmarksTag); @@ -594,8 +589,7 @@ /*sync_id=*/kMobileBookmarksId, /*server_version=*/0, /*creation_time=*/base::Time::Now(), syncer::UniquePosition::InitialPosition( - syncer::UniquePosition::RandomSuffix()) - .ToProto(), + syncer::UniquePosition::RandomSuffix()), specifics); BookmarkModelObserverImpl observer( nudge_for_commit_closure()->Get(), @@ -647,8 +641,7 @@ /*sync_id=*/kBookmarkBarId, /*server_version=*/0, /*creation_time=*/base::Time::Now(), syncer::UniquePosition::InitialPosition( - syncer::UniquePosition::RandomSuffix()) - .ToProto(), + syncer::UniquePosition::RandomSuffix()), specifics); // Build this structure: @@ -817,8 +810,7 @@ const SyncedBookmarkTracker::Entity* entity = bookmark_tracker()->Add( bookmark_node, "id", /*server_version=*/1, base::Time::Now(), syncer::UniquePosition::InitialPosition( - syncer::UniquePosition::RandomSuffix()) - .ToProto(), + syncer::UniquePosition::RandomSuffix()), specifics); bookmark_tracker()->IncrementSequenceNumber(entity);
diff --git a/components/sync_bookmarks/bookmark_model_type_processor.cc b/components/sync_bookmarks/bookmark_model_type_processor.cc index b194584..ef7e44d1 100644 --- a/components/sync_bookmarks/bookmark_model_type_processor.cc +++ b/components/sync_bookmarks/bookmark_model_type_processor.cc
@@ -517,7 +517,8 @@ syncer::ProtoTimeToTime(metadata->modification_time()); data.name = base::UTF16ToUTF8(node->GetTitle()); data.is_folder = node->is_folder(); - data.unique_position = metadata->unique_position(); + data.unique_position = + syncer::UniquePosition::FromProto(metadata->unique_position()); data.specifics = CreateSpecificsFromBookmarkNode(node, bookmark_model_, /*force_favicon_load=*/false);
diff --git a/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc b/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc index c981271..9eea19e3 100644 --- a/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc +++ b/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc
@@ -66,7 +66,7 @@ data.id = bookmark_info.server_id; data.parent_id = bookmark_info.parent_id; data.server_defined_unique_tag = bookmark_info.server_tag; - data.unique_position = unique_position.ToProto(); + data.unique_position = unique_position; data.originator_client_item_id = guid.AsLowercaseString(); sync_pb::BookmarkSpecifics* bookmark_specifics =
diff --git a/components/sync_bookmarks/bookmark_remote_updates_handler.cc b/components/sync_bookmarks/bookmark_remote_updates_handler.cc index 42940e7..46d147d 100644 --- a/components/sync_bookmarks/bookmark_remote_updates_handler.cc +++ b/components/sync_bookmarks/bookmark_remote_updates_handler.cc
@@ -108,14 +108,11 @@ } size_t ComputeChildNodeIndex(const bookmarks::BookmarkNode* parent, - const sync_pb::UniquePosition& unique_position, + const syncer::UniquePosition& position, const SyncedBookmarkTracker* bookmark_tracker) { DCHECK(parent); DCHECK(bookmark_tracker); - const syncer::UniquePosition position = - syncer::UniquePosition::FromProto(unique_position); - auto iter = std::partition_point( parent->children().begin(), parent->children().end(), [bookmark_tracker, @@ -233,8 +230,7 @@ LogProblematicBookmark(RemoteBookmarkUpdateError::kInvalidSpecifics); continue; } - if (!syncer::UniquePosition::FromProto(update_entity.unique_position) - .IsValid()) { + if (!update_entity.unique_position.IsValid()) { // Ignore updates with invalid unique position. DLOG(ERROR) << "Couldn't process an update bookmark with an invalid " "unique position."; @@ -371,7 +367,7 @@ // static size_t BookmarkRemoteUpdatesHandler::ComputeChildNodeIndexForTest( const bookmarks::BookmarkNode* parent, - const sync_pb::UniquePosition& unique_position, + const syncer::UniquePosition& unique_position, const SyncedBookmarkTracker* bookmark_tracker) { return ComputeChildNodeIndex(parent, unique_position, bookmark_tracker); }
diff --git a/components/sync_bookmarks/bookmark_remote_updates_handler.h b/components/sync_bookmarks/bookmark_remote_updates_handler.h index c050df6..dc32e41 100644 --- a/components/sync_bookmarks/bookmark_remote_updates_handler.h +++ b/components/sync_bookmarks/bookmark_remote_updates_handler.h
@@ -9,6 +9,7 @@ #include <string> #include <vector> +#include "components/sync/base/unique_position.h" #include "components/sync/engine/commit_and_get_updates_types.h" #include "components/sync_bookmarks/synced_bookmark_tracker.h" @@ -46,7 +47,7 @@ static size_t ComputeChildNodeIndexForTest( const bookmarks::BookmarkNode* parent, - const sync_pb::UniquePosition& unique_position, + const syncer::UniquePosition& unique_position, const SyncedBookmarkTracker* bookmark_tracker); private:
diff --git a/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc b/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc index b0dd827..5f016d4 100644 --- a/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc +++ b/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc
@@ -124,7 +124,7 @@ syncer::EntityData data; data.id = server_id; data.parent_id = parent_id; - data.unique_position = unique_position.ToProto(); + data.unique_position = unique_position; data.originator_client_item_id = guid.AsLowercaseString(); // EntityData would be considered a deletion if its specifics hasn't been set. @@ -919,8 +919,7 @@ data.id = kParentId; data.parent_id = kBookmarkBarId; data.unique_position = syncer::UniquePosition::InitialPosition( - syncer::UniquePosition::RandomSuffix()) - .ToProto(); + syncer::UniquePosition::RandomSuffix()); sync_pb::BookmarkSpecifics* bookmark_specifics = data.specifics.mutable_bookmark(); bookmark_specifics->set_guid( @@ -972,8 +971,7 @@ data.id = "server_id"; data.parent_id = kBookmarkBarId; data.unique_position = syncer::UniquePosition::InitialPosition( - syncer::UniquePosition::RandomSuffix()) - .ToProto(); + syncer::UniquePosition::RandomSuffix()); sync_pb::BookmarkSpecifics* bookmark_specifics = data.specifics.mutable_bookmark(); bookmark_specifics->set_guid( @@ -1014,8 +1012,7 @@ data.id = "server_id"; data.parent_id = kBookmarkBarId; data.unique_position = syncer::UniquePosition::InitialPosition( - syncer::UniquePosition::RandomSuffix()) - .ToProto(); + syncer::UniquePosition::RandomSuffix()); sync_pb::BookmarkSpecifics* bookmark_specifics = data.specifics.mutable_bookmark(); bookmark_specifics->set_guid( @@ -1056,7 +1053,7 @@ sync_pb::ModelTypeState model_type_state; model_type_state.set_initial_sync_done(true); - const sync_pb::UniquePosition unique_position; + const syncer::UniquePosition unique_position; sync_pb::EntitySpecifics specifics; sync_pb::BookmarkSpecifics* bookmark_specifics = specifics.mutable_bookmark(); bookmark_specifics->set_guid( @@ -1081,8 +1078,7 @@ data.originator_client_item_id = kOriginatorClientItemId; // Set the other required fields. data.unique_position = syncer::UniquePosition::InitialPosition( - syncer::UniquePosition::RandomSuffix()) - .ToProto(); + syncer::UniquePosition::RandomSuffix()); data.specifics = specifics; data.specifics.mutable_bookmark()->set_guid(kOriginatorClientItemId); data.is_folder = true; @@ -1121,7 +1117,7 @@ sync_pb::ModelTypeState model_type_state; model_type_state.set_initial_sync_done(true); - const sync_pb::UniquePosition unique_position; + const syncer::UniquePosition unique_position; sync_pb::EntitySpecifics specifics; sync_pb::BookmarkSpecifics* bookmark_specifics = specifics.mutable_bookmark(); bookmark_specifics->set_guid(kBookmarkGuid); @@ -1146,8 +1142,7 @@ syncer::ClientTagHash::FromUnhashed(syncer::BOOKMARKS, kBookmarkGuid); // Set the other required fields. data.unique_position = syncer::UniquePosition::InitialPosition( - syncer::UniquePosition::RandomSuffix()) - .ToProto(); + syncer::UniquePosition::RandomSuffix()); data.specifics = specifics; data.specifics.mutable_bookmark()->set_guid(kBookmarkGuid); data.is_folder = true; @@ -1955,7 +1950,7 @@ // Should always return 0 for any UniquePosition in the initial state. EXPECT_EQ(0u, BookmarkRemoteUpdatesHandler::ComputeChildNodeIndexForTest( - bookmark_bar_node, pos1.ToProto(), tracker.get())); + bookmark_bar_node, pos1, tracker.get())); } TEST(BookmarkRemoteUpdatesHandlerTest, ShouldComputeRightChildNodeIndex) { @@ -1997,32 +1992,30 @@ // Check for the same position as existing bookmarks have. In practice this // shouldn't happen. EXPECT_EQ(1u, BookmarkRemoteUpdatesHandler::ComputeChildNodeIndexForTest( - bookmark_bar_node, pos1.ToProto(), tracker.get())); + bookmark_bar_node, pos1, tracker.get())); EXPECT_EQ(2u, BookmarkRemoteUpdatesHandler::ComputeChildNodeIndexForTest( - bookmark_bar_node, pos2.ToProto(), tracker.get())); + bookmark_bar_node, pos2, tracker.get())); EXPECT_EQ(3u, BookmarkRemoteUpdatesHandler::ComputeChildNodeIndexForTest( - bookmark_bar_node, pos3.ToProto(), tracker.get())); + bookmark_bar_node, pos3, tracker.get())); - EXPECT_EQ(0u, BookmarkRemoteUpdatesHandler::ComputeChildNodeIndexForTest( - bookmark_bar_node, - syncer::UniquePosition::Before(pos1, suffix).ToProto(), - tracker.get())); + EXPECT_EQ(0u, + BookmarkRemoteUpdatesHandler::ComputeChildNodeIndexForTest( + bookmark_bar_node, syncer::UniquePosition::Before(pos1, suffix), + tracker.get())); EXPECT_EQ(1u, BookmarkRemoteUpdatesHandler::ComputeChildNodeIndexForTest( bookmark_bar_node, syncer::UniquePosition::Between(/*before=*/pos1, - /*after=*/pos2, suffix) - .ToProto(), + /*after=*/pos2, suffix), tracker.get())); EXPECT_EQ(2u, BookmarkRemoteUpdatesHandler::ComputeChildNodeIndexForTest( bookmark_bar_node, syncer::UniquePosition::Between(/*before=*/pos2, - /*after=*/pos3, suffix) - .ToProto(), + /*after=*/pos3, suffix), tracker.get())); - EXPECT_EQ(3u, BookmarkRemoteUpdatesHandler::ComputeChildNodeIndexForTest( - bookmark_bar_node, - syncer::UniquePosition::After(pos3, suffix).ToProto(), - tracker.get())); + EXPECT_EQ(3u, + BookmarkRemoteUpdatesHandler::ComputeChildNodeIndexForTest( + bookmark_bar_node, syncer::UniquePosition::After(pos3, suffix), + tracker.get())); } } // namespace
diff --git a/components/sync_bookmarks/synced_bookmark_tracker.cc b/components/sync_bookmarks/synced_bookmark_tracker.cc index 8f4b2546..9f6f053d 100644 --- a/components/sync_bookmarks/synced_bookmark_tracker.cc +++ b/components/sync_bookmarks/synced_bookmark_tracker.cc
@@ -84,7 +84,7 @@ return metadata_->is_deleted() == data.is_deleted(); } if (!syncer::UniquePosition::FromProto(metadata_->unique_position()) - .Equals(syncer::UniquePosition::FromProto(data.unique_position))) { + .Equals(data.unique_position)) { return false; } return MatchesSpecificsHash(data.specifics); @@ -256,7 +256,7 @@ const std::string& sync_id, int64_t server_version, base::Time creation_time, - const sync_pb::UniquePosition& unique_position, + const syncer::UniquePosition& unique_position, const sync_pb::EntitySpecifics& specifics) { DCHECK_GT(specifics.ByteSize(), 0); DCHECK(bookmark_node); @@ -273,7 +273,7 @@ metadata->set_modification_time(syncer::TimeToProtoTime(creation_time)); metadata->set_sequence_number(0); metadata->set_acked_sequence_number(0); - metadata->mutable_unique_position()->CopyFrom(unique_position); + *metadata->mutable_unique_position() = unique_position.ToProto(); metadata->set_client_tag_hash(client_tag_hash.value()); HashSpecifics(specifics, metadata->mutable_specifics_hash()); metadata->set_bookmark_favicon_hash( @@ -298,7 +298,7 @@ const Entity* entity, int64_t server_version, base::Time modification_time, - const sync_pb::UniquePosition& unique_position, + const syncer::UniquePosition& unique_position, const sync_pb::EntitySpecifics& specifics) { DCHECK_GT(specifics.ByteSize(), 0); DCHECK(entity); @@ -307,7 +307,8 @@ mutable_entity->metadata()->set_server_version(server_version); mutable_entity->metadata()->set_modification_time( syncer::TimeToProtoTime(modification_time)); - *mutable_entity->metadata()->mutable_unique_position() = unique_position; + *mutable_entity->metadata()->mutable_unique_position() = + unique_position.ToProto(); HashSpecifics(specifics, mutable_entity->metadata()->mutable_specifics_hash()); mutable_entity->metadata()->set_bookmark_favicon_hash(
diff --git a/components/sync_bookmarks/synced_bookmark_tracker.h b/components/sync_bookmarks/synced_bookmark_tracker.h index 486f416..9fed5324 100644 --- a/components/sync_bookmarks/synced_bookmark_tracker.h +++ b/components/sync_bookmarks/synced_bookmark_tracker.h
@@ -16,7 +16,6 @@ #include "components/sync/base/client_tag_hash.h" #include "components/sync/protocol/bookmark_model_metadata.pb.h" #include "components/sync/protocol/entity_metadata.pb.h" -#include "components/sync/protocol/unique_position.pb.h" namespace base { class GUID; @@ -30,6 +29,7 @@ namespace syncer { class ClientTagHash; struct EntityData; +class UniquePosition; } // namespace syncer namespace sync_bookmarks { @@ -154,7 +154,7 @@ const std::string& sync_id, int64_t server_version, base::Time creation_time, - const sync_pb::UniquePosition& unique_position, + const syncer::UniquePosition& unique_position, const sync_pb::EntitySpecifics& specifics); // Updates the sync metadata for a tracked entity. |entity| must be owned by @@ -162,7 +162,7 @@ void Update(const Entity* entity, int64_t server_version, base::Time modification_time, - const sync_pb::UniquePosition& unique_position, + const syncer::UniquePosition& unique_position, const sync_pb::EntitySpecifics& specifics); // Updates the server version of an existing entity. |entity| must be owned by
diff --git a/components/sync_bookmarks/synced_bookmark_tracker_unittest.cc b/components/sync_bookmarks/synced_bookmark_tracker_unittest.cc index ae1d2098..68cac7a 100644 --- a/components/sync_bookmarks/synced_bookmark_tracker_unittest.cc +++ b/components/sync_bookmarks/synced_bookmark_tracker_unittest.cc
@@ -129,7 +129,7 @@ bookmarks::BookmarkNode node(kId, kGuid, kUrl); const SyncedBookmarkTracker::Entity* entity = tracker->Add(&node, kSyncId, kServerVersion, kCreationTime, - unique_position.ToProto(), specifics); + unique_position, specifics); ASSERT_THAT(entity, NotNull()); EXPECT_THAT(entity->bookmark_node(), Eq(&node)); EXPECT_THAT(entity->GetClientTagHash(), @@ -151,7 +151,7 @@ syncer::EntityData data; *data.specifics.mutable_bookmark() = specifics.bookmark(); - data.unique_position = unique_position.ToProto(); + data.unique_position = unique_position; EXPECT_TRUE(entity->MatchesDataIgnoringParent(data)); EXPECT_THAT(tracker->GetEntityForSyncId("unknown id"), IsNull()); @@ -167,7 +167,7 @@ const int64_t kServerVersion = 1000; const base::Time kModificationTime(base::Time::Now() - base::TimeDelta::FromSeconds(1)); - const sync_pb::UniquePosition unique_position; + const syncer::UniquePosition unique_position; const sync_pb::EntitySpecifics specifics = GenerateSpecifics(/*title=*/std::string(), /*url=*/std::string()); bookmarks::BookmarkNode node(kId, kGuid, GURL()); @@ -210,8 +210,8 @@ GenerateSpecifics(/*title=*/std::string(), /*url=*/std::string()); bookmarks::BookmarkNode node(kId, base::GUID::GenerateRandomV4(), kUrl); - tracker->Add(&node, kSyncId, kServerVersion, kCreationTime, - unique_position.ToProto(), specifics); + tracker->Add(&node, kSyncId, kServerVersion, kCreationTime, unique_position, + specifics); sync_pb::BookmarkModelMetadata bookmark_model_metadata = tracker->BuildBookmarkModelMetadata(); @@ -233,7 +233,7 @@ const int64_t kServerVersion = 1000; const base::Time kModificationTime(base::Time::Now() - base::TimeDelta::FromSeconds(1)); - const sync_pb::UniquePosition unique_position; + const syncer::UniquePosition unique_position; const sync_pb::EntitySpecifics specifics = GenerateSpecifics(/*title=*/std::string(), /*url=*/std::string()); bookmarks::BookmarkNode node(kId, base::GUID::GenerateRandomV4(), GURL()); @@ -257,7 +257,7 @@ const int64_t kServerVersion = 1000; const base::Time kModificationTime(base::Time::Now() - base::TimeDelta::FromSeconds(1)); - const sync_pb::UniquePosition unique_position; + const syncer::UniquePosition unique_position; const sync_pb::EntitySpecifics specifics = GenerateSpecifics(/*title=*/std::string(), /*url=*/std::string()); bookmarks::BookmarkNode node(kId, base::GUID::GenerateRandomV4(), GURL()); @@ -293,7 +293,7 @@ const int64_t kNewServerVersion = 1001; const base::Time kModificationTime(base::Time::Now() - base::TimeDelta::FromSeconds(1)); - const sync_pb::UniquePosition unique_position; + const syncer::UniquePosition unique_position; const sync_pb::EntitySpecifics specifics = GenerateSpecifics(/*title=*/std::string(), /*url=*/std::string()); bookmarks::BookmarkNode node(kId, base::GUID::GenerateRandomV4(), GURL()); @@ -328,7 +328,7 @@ const int64_t kServerVersion = 1000; const base::Time kModificationTime(base::Time::Now() - base::TimeDelta::FromSeconds(1)); - const sync_pb::UniquePosition unique_position; + const syncer::UniquePosition unique_position; const sync_pb::EntitySpecifics specifics = GenerateSpecifics(/*title=*/std::string(), /*url=*/std::string()); bookmarks::BookmarkNode node(/*id=*/1, base::GUID::GenerateRandomV4(), @@ -491,7 +491,7 @@ const int64_t kServerVersion = 1000; const base::Time kModificationTime(base::Time::Now() - base::TimeDelta::FromSeconds(1)); - const sync_pb::UniquePosition unique_position; + const syncer::UniquePosition unique_position; const sync_pb::EntitySpecifics specifics = GenerateSpecifics(/*title=*/std::string(), /*url=*/std::string()); bookmarks::BookmarkNode node(kId, kGuid, GURL()); @@ -533,7 +533,7 @@ const int64_t kServerVersion = 1000; const base::Time kModificationTime(base::Time::Now() - base::TimeDelta::FromSeconds(1)); - const sync_pb::UniquePosition unique_position; + const syncer::UniquePosition unique_position; const sync_pb::EntitySpecifics specifics = GenerateSpecifics(/*title=*/std::string(), /*url=*/std::string()); bookmarks::BookmarkNode node(kId, kGuid, GURL()); @@ -1029,7 +1029,7 @@ bookmarks::BookmarkNode node(kId, base::GUID::GenerateRandomV4(), kUrl); const SyncedBookmarkTracker::Entity* entity = tracker->Add(&node, kSyncId, kServerVersion, kCreationTime, - kUniquePosition.ToProto(), specifics); + kUniquePosition, specifics); EXPECT_TRUE(entity->metadata()->has_bookmark_favicon_hash()); EXPECT_TRUE(entity->MatchesFaviconHash(kFaviconPngBytes)); @@ -1075,8 +1075,8 @@ sync_pb::EntitySpecifics specifics = GenerateSpecifics(kTitle, kUrl.spec()); specifics.mutable_bookmark()->set_favicon(kFaviconPngBytes); - tracker->Update(entity, kServerVersion, kModificationTime, - kUniquePosition.ToProto(), specifics); + tracker->Update(entity, kServerVersion, kModificationTime, kUniquePosition, + specifics); EXPECT_TRUE(entity->metadata()->has_bookmark_favicon_hash()); EXPECT_TRUE(entity->MatchesFaviconHash(kFaviconPngBytes)); @@ -1147,8 +1147,7 @@ tracker->Add(node, /*sync_id=*/"id", /*server_version=*/0, /*creation_time=*/base::Time::Now(), syncer::UniquePosition::InitialPosition( - syncer::UniquePosition::RandomSuffix()) - .ToProto(), + syncer::UniquePosition::RandomSuffix()), specifics); sync_pb::EntitySpecifics permanent_specifics; @@ -1158,20 +1157,17 @@ tracker->Add(model->bookmark_bar_node(), kBookmarkBarId, /*server_version=*/0, /*creation_time=*/base::Time::Now(), syncer::UniquePosition::InitialPosition( - syncer::UniquePosition::RandomSuffix()) - .ToProto(), + syncer::UniquePosition::RandomSuffix()), permanent_specifics); tracker->Add(model->other_node(), kOtherBookmarksId, /*server_version=*/0, /*creation_time=*/base::Time::Now(), syncer::UniquePosition::InitialPosition( - syncer::UniquePosition::RandomSuffix()) - .ToProto(), + syncer::UniquePosition::RandomSuffix()), permanent_specifics); tracker->Add(model->mobile_node(), kMobileBookmarksId, /*server_version=*/0, /*creation_time=*/base::Time::Now(), syncer::UniquePosition::InitialPosition( - syncer::UniquePosition::RandomSuffix()) - .ToProto(), + syncer::UniquePosition::RandomSuffix()), permanent_specifics); ASSERT_FALSE(tracker->HasLocalChanges());
diff --git a/components/translate/core/browser/translate_prefs.cc b/components/translate/core/browser/translate_prefs.cc index 2eb63eec..edf7286 100644 --- a/components/translate/core/browser/translate_prefs.cc +++ b/components/translate/core/browser/translate_prefs.cc
@@ -860,7 +860,7 @@ if (never_prompt_list) { const base::ListValue* list = prefs_->GetList(kPrefNeverPromptSitesDeprecated); - for (auto& site : *list) { + for (auto& site : list->GetList()) { if (!never_prompt_list->HasKey(site.GetString())) { never_prompt_list->SetKey(site.GetString(), base::Value(0)); }
diff --git a/components/viz/common/frame_sinks/begin_frame_args.h b/components/viz/common/frame_sinks/begin_frame_args.h index 31252663..61481ff 100644 --- a/components/viz/common/frame_sinks/begin_frame_args.h +++ b/components/viz/common/frame_sinks/begin_frame_args.h
@@ -13,7 +13,6 @@ #include "base/location.h" #include "base/memory/ref_counted.h" #include "base/time/time.h" -#include "base/values.h" #include "components/viz/common/viz_common_export.h" namespace perfetto {
diff --git a/components/viz/common/frame_sinks/delay_based_time_source.h b/components/viz/common/frame_sinks/delay_based_time_source.h index f387bea5..8adf436 100644 --- a/components/viz/common/frame_sinks/delay_based_time_source.h +++ b/components/viz/common/frame_sinks/delay_based_time_source.h
@@ -11,7 +11,6 @@ #include "base/cancelable_callback.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "base/values.h" #include "components/viz/common/viz_common_export.h" namespace base {
diff --git a/content/browser/accessibility/accessibility_browsertest.cc b/content/browser/accessibility/accessibility_browsertest.cc index a17673e..209b8c22 100644 --- a/content/browser/accessibility/accessibility_browsertest.cc +++ b/content/browser/accessibility/accessibility_browsertest.cc
@@ -102,15 +102,15 @@ AccessibilityNotificationWaiter selection_waiter( shell()->web_contents(), ui::kAXModeComplete, ax::mojom::Event::kTextSelectionChanged); - ExecuteScript(base::UTF8ToUTF16( - "let selection=document.getSelection();" - "let range=document.createRange();" - "let editable=document.querySelector('p[contenteditable=\"true\"]');" - "editable.focus();" - "range.setStart(editable.lastChild, 0);" - "range.setEnd(editable.lastChild, 0);" - "selection.removeAllRanges();" - "selection.addRange(range);")); + ExecuteScript( + u"let selection=document.getSelection();" + u"let range=document.createRange();" + u"let editable=document.querySelector('p[contenteditable=\"true\"]');" + u"editable.focus();" + u"range.setStart(editable.lastChild, 0);" + u"range.setEnd(editable.lastChild, 0);" + u"selection.removeAllRanges();" + u"selection.addRange(range);"); selection_waiter.WaitForNotification(); }
diff --git a/content/browser/accessibility/accessibility_win_browsertest.cc b/content/browser/accessibility/accessibility_win_browsertest.cc index 403a73a..d2a9a080 100644 --- a/content/browser/accessibility/accessibility_win_browsertest.cc +++ b/content/browser/accessibility/accessibility_win_browsertest.cc
@@ -3683,11 +3683,12 @@ ui::kAXModeComplete, ax::mojom::Event::kValueChanged); // Place an e acute, and two emoticons in the text field. - ExecuteScript(base::UTF8ToUTF16(R"SCRIPT( + ExecuteScript( + uR"SCRIPT( const input = document.querySelector('input'); input.value = 'e\u0301\uD83D\uDC69\u200D\u2764\uFE0F\u200D\uD83D\uDC69\uD83D\uDC36'; - )SCRIPT")); + )SCRIPT"); waiter.WaitForNotification(); LONG n_characters; @@ -4035,10 +4036,11 @@ ui::kAXModeComplete, ax::mojom::Event::kValueChanged); // Add a blank line at the end of the textarea. - ExecuteScript(base::UTF8ToUTF16(R"SCRIPT( + ExecuteScript( + uR"SCRIPT( const textarea = document.querySelector('textarea'); textarea.value += '\n'; - )SCRIPT")); + )SCRIPT"); waiter.WaitForNotification(); // The second last line should have an additional trailing newline. Also,
diff --git a/content/browser/android/java/gin_java_bound_object.h b/content/browser/android/java/gin_java_bound_object.h index 61e7fadb..24958e5 100644 --- a/content/browser/android/java/gin_java_bound_object.h +++ b/content/browser/android/java/gin_java_bound_object.h
@@ -15,7 +15,6 @@ #include "base/android/jni_weak_ref.h" #include "base/android/scoped_java_ref.h" #include "base/memory/ref_counted.h" -#include "base/values.h" #include "content/browser/android/java/java_method.h" namespace content {
diff --git a/content/browser/browser_interface_binders.cc b/content/browser/browser_interface_binders.cc index d7c8300..2a3e8e1d 100644 --- a/content/browser/browser_interface_binders.cc +++ b/content/browser/browser_interface_binders.cc
@@ -87,7 +87,6 @@ #include "services/metrics/public/mojom/ukm_interface.mojom.h" #include "services/metrics/ukm_recorder_interface.h" #include "services/network/public/cpp/cross_origin_embedder_policy.h" -#include "services/network/public/mojom/p2p.mojom.h" #include "services/network/public/mojom/restricted_cookie_manager.mojom.h" #include "services/shape_detection/public/mojom/barcodedetection_provider.mojom.h" #include "services/shape_detection/public/mojom/facedetection_provider.mojom.h" @@ -533,14 +532,6 @@ GetDeviceService().BindVibrationManager(std::move(receiver)); } -void BindSocketManager( - RenderFrameHostImpl* frame, - mojo::PendingReceiver<network::mojom::P2PSocketManager> receiver) { - static_cast<RenderProcessHostImpl*>(frame->GetProcess()) - ->BindP2PSocketManager(frame->GetNetworkIsolationKey(), - std::move(receiver)); -} - } // namespace // Documents/frames @@ -613,9 +604,6 @@ map->Add<blink::mojom::NotificationService>(base::BindRepeating( &RenderFrameHostImpl::CreateNotificationService, base::Unretained(host))); - map->Add<network::mojom::P2PSocketManager>( - base::BindRepeating(&BindSocketManager, base::Unretained(host))); - map->Add<blink::mojom::PeerConnectionTrackerHost>( base::BindRepeating(&RenderFrameHostImpl::BindPeerConnectionTrackerHost, base::Unretained(host)));
diff --git a/content/browser/devtools/devtools_session.h b/content/browser/devtools/devtools_session.h index 4ca61523..6b4bbf6 100644 --- a/content/browser/devtools/devtools_session.h +++ b/content/browser/devtools/devtools_session.h
@@ -14,7 +14,6 @@ #include "base/containers/span.h" #include "base/memory/weak_ptr.h" #include "base/optional.h" -#include "base/values.h" #include "content/browser/devtools/protocol/forward.h" #include "content/public/browser/devtools_agent_host_client_channel.h" #include "content/public/browser/devtools_external_agent_proxy.h"
diff --git a/content/browser/file_system_access/file_system_chooser_unittest.cc b/content/browser/file_system_access/file_system_chooser_unittest.cc index 3fc7b59..0b6108751 100644 --- a/content/browser/file_system_access/file_system_chooser_unittest.cc +++ b/content/browser/file_system_access/file_system_chooser_unittest.cc
@@ -237,19 +237,19 @@ new CancellingSelectFileDialogFactory(&dialog_params)); std::vector<blink::mojom::ChooseFileSystemEntryAcceptsOptionPtr> accepts; accepts.emplace_back(blink::mojom::ChooseFileSystemEntryAcceptsOption::New( - base::UTF8ToUTF16("Description with \t a \r lot of \n " - " spaces"), + u"Description with \t a \r lot of \n " + u" spaces", std::vector<std::string>({}), std::vector<std::string>({"txt"}))); accepts.emplace_back(blink::mojom::ChooseFileSystemEntryAcceptsOption::New( - base::UTF8ToUTF16("Description that is very long and should be " - "truncated to 64 code points if it works"), + u"Description that is very long and should be " + u"truncated to 64 code points if it works", std::vector<std::string>({}), std::vector<std::string>({"js"}))); accepts.emplace_back(blink::mojom::ChooseFileSystemEntryAcceptsOption::New( - base::UTF8ToUTF16("Unbalanced RTL \xe2\x80\xae section"), - std::vector<std::string>({}), std::vector<std::string>({"js"}))); + u"Unbalanced RTL \u202e section", std::vector<std::string>({}), + std::vector<std::string>({"js"}))); accepts.emplace_back(blink::mojom::ChooseFileSystemEntryAcceptsOption::New( - base::UTF8ToUTF16("Unbalanced RTL \xe2\x80\xae section in a otherwise " - "very long description that will be truncated"), + u"Unbalanced RTL \u202e section in a otherwise " + u"very long description that will be truncated", std::vector<std::string>({}), std::vector<std::string>({"js"}))); SyncShowDialog(std::move(accepts), /*include_accepts_all=*/false); @@ -258,16 +258,14 @@ dialog_params.file_types->extension_description_overrides.size()); EXPECT_EQ(u"Description with a lot of spaces", dialog_params.file_types->extension_description_overrides[0]); + EXPECT_EQ(u"Description that is very long and should be truncated to 64 cod…", + dialog_params.file_types->extension_description_overrides[1]); + EXPECT_EQ(u"Unbalanced RTL \u202e section\u202c", + dialog_params.file_types->extension_description_overrides[2]); EXPECT_EQ( - base::UTF8ToUTF16( - "Description that is very long and should be truncated to 64 cod…"), - dialog_params.file_types->extension_description_overrides[1]); - EXPECT_EQ( - base::UTF8ToUTF16("Unbalanced RTL \xe2\x80\xae section\xe2\x80\xac"), - dialog_params.file_types->extension_description_overrides[2]); - EXPECT_EQ(base::UTF8ToUTF16("Unbalanced RTL \xe2\x80\xae section in a " - "otherwise very long description t…\xe2\x80\xac"), - dialog_params.file_types->extension_description_overrides[3]); + u"Unbalanced RTL \u202e section in a " + u"otherwise very long description t…\u202c", + dialog_params.file_types->extension_description_overrides[3]); } } // namespace content
diff --git a/content/browser/indexed_db/indexed_db_dispatcher_host_unittest.cc b/content/browser/indexed_db/indexed_db_dispatcher_host_unittest.cc index 0212255..14c32e96 100644 --- a/content/browser/indexed_db/indexed_db_dispatcher_host_unittest.cc +++ b/content/browser/indexed_db/indexed_db_dispatcher_host_unittest.cc
@@ -81,7 +81,7 @@ return arg.Equals(key); } -static const char kDatabaseName[] = "db"; +static const char16_t kDatabaseName[] = u"db"; static const char kOrigin[] = "https://www.example.com"; base::FilePath CreateAndReturnTempDir(base::ScopedTempDir* temp_dir) { @@ -255,7 +255,7 @@ FROM_HERE, base::BindLambdaForTesting([&]() { connection = std::make_unique<TestDatabaseConnection>( context_impl_->IDBTaskRunner(), url::Origin::Create(GURL(kOrigin)), - base::UTF8ToUTF16(kDatabaseName), kDBVersion, kTransactionId); + kDatabaseName, kDBVersion, kTransactionId); EXPECT_CALL(*connection->open_callbacks, MockedUpgradeNeeded(IsAssociatedInterfacePtrInfoValid(true), IndexedDBDatabaseMetadata::NO_VERSION, @@ -287,7 +287,7 @@ const int64_t kDBVersion = 1; const int64_t kTransactionId = 1; const int64_t kObjectStoreId = 10; - const char kObjectStoreName[] = "os"; + const char16_t kObjectStoreName[] = u"os"; std::unique_ptr<TestDatabaseConnection> connection; IndexedDBDatabaseMetadata metadata; mojo::PendingAssociatedRemote<blink::mojom::IDBDatabase> pending_database; @@ -297,8 +297,8 @@ FROM_HERE, base::BindLambdaForTesting([&]() { // Open connection. connection = std::make_unique<TestDatabaseConnection>( - context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), - base::UTF8ToUTF16(kDatabaseName), kDBVersion, kTransactionId); + context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), kDatabaseName, + kDBVersion, kTransactionId); EXPECT_CALL(*connection->open_callbacks, MockedUpgradeNeeded(IsAssociatedInterfacePtrInfoValid(true), @@ -337,8 +337,7 @@ ASSERT_TRUE(connection->database.is_bound()); ASSERT_TRUE(connection->version_change_transaction.is_bound()); connection->version_change_transaction->CreateObjectStore( - kObjectStoreId, base::UTF8ToUTF16(kObjectStoreName), - blink::IndexedDBKeyPath(), false); + kObjectStoreId, kObjectStoreName, blink::IndexedDBKeyPath(), false); connection->version_change_transaction->Commit(0); })); loop2.Run(); @@ -357,7 +356,7 @@ const int64_t kDBVersion = 1; const int64_t kTransactionId = 1; const int64_t kObjectStoreId = 10; - const char kObjectStoreName[] = "os"; + const char16_t kObjectStoreName[] = u"os"; std::unique_ptr<TestDatabaseConnection> connection1; mojo::PendingAssociatedRemote<blink::mojom::IDBDatabase> pending_database1; IndexedDBDatabaseMetadata metadata1; @@ -368,7 +367,7 @@ // Open connection 1, and expect the upgrade needed. connection1 = std::make_unique<TestDatabaseConnection>( context_impl_->IDBTaskRunner(), url::Origin::Create(GURL(kOrigin)), - base::UTF8ToUTF16(kDatabaseName), kDBVersion, kTransactionId); + kDatabaseName, kDBVersion, kTransactionId); EXPECT_CALL(*connection1->open_callbacks, MockedUpgradeNeeded(IsAssociatedInterfacePtrInfoValid(true), @@ -394,8 +393,8 @@ context_impl_->IDBTaskRunner()->PostTask( FROM_HERE, base::BindLambdaForTesting([&]() { connection2 = std::make_unique<TestDatabaseConnection>( - context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), - base::UTF8ToUTF16(kDatabaseName), kDBVersion, 0); + context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), kDatabaseName, + kDBVersion, 0); // Check that we're called in order and the second connection gets it's // database after the first connection completes. @@ -425,8 +424,7 @@ // Create object store. connection1->version_change_transaction->CreateObjectStore( - kObjectStoreId, base::UTF8ToUTF16(kObjectStoreName), - blink::IndexedDBKeyPath(), false); + kObjectStoreId, kObjectStoreName, blink::IndexedDBKeyPath(), false); connection1->version_change_transaction->Commit(0); })); loop2.Run(); @@ -457,7 +455,7 @@ const int64_t kDBVersion = 1; const int64_t kTransactionId = 1; const int64_t kObjectStoreId = 10; - const char kObjectStoreName[] = "os"; + const char16_t kObjectStoreName[] = u"os"; std::unique_ptr<TestDatabaseConnection> connection; IndexedDBDatabaseMetadata metadata; mojo::PendingAssociatedRemote<blink::mojom::IDBDatabase> pending_database; @@ -468,7 +466,7 @@ // Open connection. connection = std::make_unique<TestDatabaseConnection>( context_impl_->IDBTaskRunner(), url::Origin::Create(GURL(kOrigin)), - base::UTF8ToUTF16(kDatabaseName), kDBVersion, kTransactionId); + kDatabaseName, kDBVersion, kTransactionId); EXPECT_CALL(*connection->open_callbacks, MockedUpgradeNeeded(IsAssociatedInterfacePtrInfoValid(true), @@ -518,8 +516,7 @@ ASSERT_TRUE(connection->database.is_bound()); ASSERT_TRUE(connection->version_change_transaction.is_bound()); connection->version_change_transaction->CreateObjectStore( - kObjectStoreId, base::UTF8ToUTF16(kObjectStoreName), - blink::IndexedDBKeyPath(), false); + kObjectStoreId, kObjectStoreName, blink::IndexedDBKeyPath(), false); // Call Put with an invalid blob. std::vector<blink::mojom::IDBExternalObjectPtr> external_objects; mojo::PendingRemote<blink::mojom::Blob> blob; @@ -571,8 +568,8 @@ FROM_HERE, base::BindLambdaForTesting([&]() { // Open connection. connection = std::make_unique<TestDatabaseConnection>( - context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), - base::UTF8ToUTF16(kDatabaseName), kDBVersion, kTransactionId); + context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), kDatabaseName, + kDBVersion, kTransactionId); EXPECT_CALL(*connection->open_callbacks, MockedUpgradeNeeded(IsAssociatedInterfacePtrInfoValid(true), IndexedDBDatabaseMetadata::NO_VERSION, @@ -633,7 +630,7 @@ const int64_t kDBVersion = 1; const int64_t kTransactionId = 1; const int64_t kObjectStoreId = 10; - const char kObjectStoreName[] = "os"; + const char16_t kObjectStoreName[] = u"os"; std::unique_ptr<TestDatabaseConnection> connection; IndexedDBDatabaseMetadata metadata; mojo::PendingAssociatedRemote<blink::mojom::IDBDatabase> pending_database; @@ -643,8 +640,8 @@ FROM_HERE, base::BindLambdaForTesting([&]() { // Open connection. connection = std::make_unique<TestDatabaseConnection>( - context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), - base::UTF8ToUTF16(kDatabaseName), kDBVersion, kTransactionId); + context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), kDatabaseName, + kDBVersion, kTransactionId); EXPECT_CALL(*connection->open_callbacks, MockedUpgradeNeeded(IsAssociatedInterfacePtrInfoValid(true), IndexedDBDatabaseMetadata::NO_VERSION, @@ -689,8 +686,7 @@ ASSERT_TRUE(connection->database.is_bound()); ASSERT_TRUE(connection->version_change_transaction.is_bound()); connection->version_change_transaction->CreateObjectStore( - kObjectStoreId, base::UTF8ToUTF16(kObjectStoreName), - blink::IndexedDBKeyPath(), false); + kObjectStoreId, kObjectStoreName, blink::IndexedDBKeyPath(), false); idb_mojo_factory_->AbortTransactionsAndCompactDatabase(base::BindOnce( &TestStatusCallback, std::move(quit_closure2), &callback_result)); })); @@ -719,8 +715,8 @@ FROM_HERE, base::BindLambdaForTesting([&]() { // Open connection. connection = std::make_unique<TestDatabaseConnection>( - context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), - base::UTF8ToUTF16(kDatabaseName), kDBVersion, kTransactionId); + context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), kDatabaseName, + kDBVersion, kTransactionId); EXPECT_CALL(*connection->open_callbacks, MockedUpgradeNeeded(IsAssociatedInterfacePtrInfoValid(true), IndexedDBDatabaseMetadata::NO_VERSION, @@ -793,8 +789,8 @@ FROM_HERE, base::BindLambdaForTesting([&]() { // Open connection. connection = std::make_unique<TestDatabaseConnection>( - context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), - base::UTF8ToUTF16(kDatabaseName), kDBVersion, kTransactionId); + context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), kDatabaseName, + kDBVersion, kTransactionId); { EXPECT_CALL(*connection->open_callbacks, MockedUpgradeNeeded( @@ -859,7 +855,7 @@ const int64_t kDBVersion = 1; const int64_t kTransactionId = 1; const int64_t kObjectStoreId = 10; - const char kObjectStoreName[] = "os"; + const char16_t kObjectStoreName[] = u"os"; std::unique_ptr<TestDatabaseConnection> connection; IndexedDBDatabaseMetadata metadata; mojo::PendingAssociatedRemote<blink::mojom::IDBDatabase> pending_database; @@ -869,8 +865,8 @@ FROM_HERE, base::BindLambdaForTesting([&]() { // Open connection. connection = std::make_unique<TestDatabaseConnection>( - context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), - base::UTF8ToUTF16(kDatabaseName), kDBVersion, kTransactionId); + context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), kDatabaseName, + kDBVersion, kTransactionId); EXPECT_CALL(*connection->open_callbacks, MockedUpgradeNeeded(IsAssociatedInterfacePtrInfoValid(true), @@ -916,8 +912,7 @@ ASSERT_TRUE(connection->database.is_bound()); ASSERT_TRUE(connection->version_change_transaction.is_bound()); connection->version_change_transaction->CreateObjectStore( - kObjectStoreId, base::UTF8ToUTF16(kObjectStoreName), - blink::IndexedDBKeyPath(), false); + kObjectStoreId, kObjectStoreName, blink::IndexedDBKeyPath(), false); idb_mojo_factory_->AbortTransactionsForDatabase(base::BindOnce( &TestStatusCallback, std::move(quit_closure2), &callback_result)); })); @@ -946,8 +941,8 @@ FROM_HERE, base::BindLambdaForTesting([&]() { // Open connection. connection = std::make_unique<TestDatabaseConnection>( - context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), - base::UTF8ToUTF16(kDatabaseName), kDBVersion, kTransactionId); + context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), kDatabaseName, + kDBVersion, kTransactionId); EXPECT_CALL(*connection->open_callbacks, MockedUpgradeNeeded(IsAssociatedInterfacePtrInfoValid(true), @@ -1018,8 +1013,8 @@ const int64_t kTransactionId3 = 3; const int64_t kObjectStoreId = 10; const int64_t kIndexId = 100; - const char kObjectStoreName[] = "os"; - const char kIndexName[] = "index"; + const char16_t kObjectStoreName[] = u"os"; + const char16_t kIndexName[] = u"index"; mojo::PendingReceiver<storage::mojom::IndexedDBObserver> receiver; mojo::PendingRemote<storage::mojom::IndexedDBObserver> remote; @@ -1037,8 +1032,8 @@ context_impl_->IDBTaskRunner()->PostTask( FROM_HERE, base::BindLambdaForTesting([&]() { connection1 = std::make_unique<TestDatabaseConnection>( - context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), - base::UTF8ToUTF16(kDatabaseName), kDBVersion1, kTransactionId1); + context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), kDatabaseName, + kDBVersion1, kTransactionId1); EXPECT_CALL(*connection1->open_callbacks, MockedUpgradeNeeded( @@ -1082,12 +1077,11 @@ ASSERT_TRUE(connection1->database.is_bound()); connection1->version_change_transaction->CreateObjectStore( - kObjectStoreId, base::UTF8ToUTF16(kObjectStoreName), - blink::IndexedDBKeyPath(), false); - connection1->database->CreateIndex( - kTransactionId1, kObjectStoreId, kIndexId, - base::UTF8ToUTF16(kIndexName), blink::IndexedDBKeyPath(), false, + kObjectStoreId, kObjectStoreName, blink::IndexedDBKeyPath(), false); + connection1->database->CreateIndex( + kTransactionId1, kObjectStoreId, kIndexId, kIndexName, + blink::IndexedDBKeyPath(), false, false); connection1->version_change_transaction->Commit(0); })); loop.Run(); @@ -1111,8 +1105,8 @@ connection2 = std::make_unique<TestDatabaseConnection>( context_impl_->IDBTaskRunner(), - url::Origin::Create(GURL(kOrigin)), - base::UTF8ToUTF16(kDatabaseName), kDBVersion2, kTransactionId2); + url::Origin::Create(GURL(kOrigin)), kDatabaseName, kDBVersion2, + kTransactionId2); EXPECT_CALL(*connection2->open_callbacks, MockedUpgradeNeeded( @@ -1174,8 +1168,8 @@ FROM_HERE, base::BindLambdaForTesting([&]() { connection2->database->Close(); connection3 = std::make_unique<TestDatabaseConnection>( - context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), - base::UTF8ToUTF16(kDatabaseName), kDBVersion3, kTransactionId3); + context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), kDatabaseName, + kDBVersion3, kTransactionId3); EXPECT_CALL(*connection3->open_callbacks, MockedUpgradeNeeded( @@ -1249,7 +1243,7 @@ const int64_t kTransactionId1 = 1; const int64_t kTransactionId2 = 2; const int64_t kObjectStoreId = 10; - const char kObjectStoreName[] = "os"; + const char16_t kObjectStoreName[] = u"os"; mojo::PendingReceiver<storage::mojom::IndexedDBObserver> receiver; mojo::PendingRemote<storage::mojom::IndexedDBObserver> remote; @@ -1268,7 +1262,7 @@ // Open connection 1. connection1 = std::make_unique<TestDatabaseConnection>( context_impl_->IDBTaskRunner(), url::Origin::Create(GURL(kOrigin)), - base::UTF8ToUTF16(kDatabaseName), kDBVersion1, kTransactionId1); + kDatabaseName, kDBVersion1, kTransactionId1); EXPECT_CALL(*connection1->open_callbacks, MockedUpgradeNeeded(IsAssociatedInterfacePtrInfoValid(true), @@ -1315,8 +1309,7 @@ ASSERT_TRUE(connection1->database.is_bound()); ASSERT_TRUE(connection1->version_change_transaction.is_bound()); connection1->version_change_transaction->CreateObjectStore( - kObjectStoreId, base::UTF8ToUTF16(kObjectStoreName), - blink::IndexedDBKeyPath(), false); + kObjectStoreId, kObjectStoreName, blink::IndexedDBKeyPath(), false); std::string value = "value"; const char* value_data = value.data(); @@ -1357,8 +1350,8 @@ ::testing::InSequence dummy; connection2 = std::make_unique<TestDatabaseConnection>( - context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), - base::UTF8ToUTF16(kDatabaseName), kDBVersion2, kTransactionId2); + context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), kDatabaseName, + kDBVersion2, kTransactionId2); EXPECT_CALL(*connection2->open_callbacks, MockedUpgradeNeeded( @@ -1450,8 +1443,8 @@ FROM_HERE, base::BindLambdaForTesting([&]() { // Open connection. connection = std::make_unique<TestDatabaseConnection>( - context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), - base::UTF8ToUTF16(kDatabaseName), kDBVersion, kTransactionId); + context_impl_->IDBTaskRunner(), ToOrigin(kOrigin), kDatabaseName, + kDBVersion, kTransactionId); EXPECT_CALL(*connection->open_callbacks, MockedUpgradeNeeded(IsAssociatedInterfacePtrInfoValid(true),
diff --git a/content/browser/media/media_internals_unittest.cc b/content/browser/media/media_internals_unittest.cc index ab4b44e..09a06fc 100644 --- a/content/browser/media/media_internals_unittest.cc +++ b/content/browser/media/media_internals_unittest.cc
@@ -308,8 +308,8 @@ namespace { // Test page titles. -const char kTestTitle1[] = "Test Title 1"; -const char kTestTitle2[] = "Test Title 2"; +const char16_t kTestTitle1[] = u"Test Title 1"; +const char16_t kTestTitle2[] = u"Test Title 2"; } // namespace @@ -415,8 +415,7 @@ TEST_F(MediaInternalsAudioFocusTest, AudioFocusStateIsUpdated) { // Create a test media session and request audio focus. std::unique_ptr<WebContents> web_contents1 = CreateTestWebContents(); - static_cast<TestWebContents*>(web_contents1.get()) - ->SetTitle(base::UTF8ToUTF16(kTestTitle1)); + static_cast<TestWebContents*>(web_contents1.get())->SetTitle(kTestTitle1); MediaSessionImpl* media_session1 = MediaSessionImpl::Get(web_contents1.get()); media_session1->RequestSystemAudioFocus(AudioFocusType::kGain); WaitForCallbackCount(1); @@ -438,8 +437,7 @@ // Create another media session. std::unique_ptr<WebContents> web_contents2 = CreateTestWebContents(); - static_cast<TestWebContents*>(web_contents2.get()) - ->SetTitle(base::UTF8ToUTF16(kTestTitle2)); + static_cast<TestWebContents*>(web_contents2.get())->SetTitle(kTestTitle2); MediaSessionImpl* media_session2 = MediaSessionImpl::Get(web_contents2.get()); media_session2->RequestSystemAudioFocus( AudioFocusType::kGainTransientMayDuck);
diff --git a/content/browser/renderer_host/dwrite_font_proxy_impl_win_unittest.cc b/content/browser/renderer_host/dwrite_font_proxy_impl_win_unittest.cc index 72cc421c..6a869e3a 100644 --- a/content/browser/renderer_host/dwrite_font_proxy_impl_win_unittest.cc +++ b/content/browser/renderer_host/dwrite_font_proxy_impl_win_unittest.cc
@@ -36,7 +36,7 @@ namespace { struct FontExpectation { - const char font_name[64]; + const char* font_name; uint16_t ttc_index; }; @@ -354,10 +354,10 @@ return; base::FilePath result_path; uint32_t ttc_index; - std::string unavailable_font_name = - "Unavailable_Font_Name_56E7EA7E-2C69-4E23-99DC-750BC19B250E"; - dwrite_font_proxy().MatchUniqueFont(base::UTF8ToUTF16(unavailable_font_name), - &result_path, &ttc_index); + std::u16string unavailable_font_name = + u"Unavailable_Font_Name_56E7EA7E-2C69-4E23-99DC-750BC19B250E"; + dwrite_font_proxy().MatchUniqueFont(unavailable_font_name, &result_path, + &ttc_index); ASSERT_EQ(result_path.value().size(), 0u); ASSERT_EQ(ttc_index, 0u); }
diff --git a/content/browser/renderer_host/p2p/socket_dispatcher_host.cc b/content/browser/renderer_host/p2p/socket_dispatcher_host.cc index 66ae66ac..67a67f7 100644 --- a/content/browser/renderer_host/p2p/socket_dispatcher_host.cc +++ b/content/browser/renderer_host/p2p/socket_dispatcher_host.cc
@@ -12,10 +12,7 @@ #include "content/browser/bad_message.h" #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/storage_partition_impl.h" -#include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" -#include "mojo/public/cpp/bindings/receiver_set.h" -#include "mojo/public/cpp/bindings/remote_set.h" #include "net/base/net_errors.h" #include "services/network/public/cpp/p2p_param_traits.h" @@ -27,7 +24,7 @@ P2PSocketDispatcherHost::P2PSocketDispatcherHost(int render_process_id) : render_process_id_(render_process_id) {} -P2PSocketDispatcherHost::~P2PSocketDispatcherHost() = default; +P2PSocketDispatcherHost::~P2PSocketDispatcherHost() {} void P2PSocketDispatcherHost::StartRtpDump( bool incoming, @@ -43,9 +40,8 @@ dump_outgoing_rtp_packet_ = true; packet_callback_ = std::move(packet_callback); - for (auto& trusted_socket_manager : trusted_socket_managers_) { - trusted_socket_manager->StartRtpDump(incoming, outgoing); - } + if (trusted_socket_manager_) + trusted_socket_manager_->StartRtpDump(incoming, outgoing); } } @@ -62,36 +58,35 @@ if (!dump_incoming_rtp_packet_ && !dump_outgoing_rtp_packet_) packet_callback_.Reset(); - for (auto& trusted_socket_manager : trusted_socket_managers_) { - trusted_socket_manager->StopRtpDump(incoming, outgoing); - } + if (trusted_socket_manager_) + trusted_socket_manager_->StopRtpDump(incoming, outgoing); } } void P2PSocketDispatcherHost::BindReceiver( - RenderProcessHostImpl& process, - mojo::PendingReceiver<network::mojom::P2PSocketManager> receiver, - net::NetworkIsolationKey isolation_key) { - DCHECK_EQ(process.GetID(), render_process_id_); + mojo::PendingReceiver<network::mojom::P2PSocketManager> receiver) { + auto* rph = RenderProcessHostImpl::FromID(render_process_id_); + if (!rph) + return; - mojo::PendingRemote<network::mojom::P2PTrustedSocketManagerClient> - trusted_socket_manager_client; - receivers_.Add( - this, trusted_socket_manager_client.InitWithNewPipeAndPassReceiver()); + // In case the renderer was connected previously but the network process + // crashed. + receiver_.reset(); + auto trusted_socket_manager_client = receiver_.BindNewPipeAndPassRemote(); - mojo::PendingRemote<network::mojom::P2PTrustedSocketManager> - pending_trusted_socket_manager; - process.GetStoragePartition()->GetNetworkContext()->CreateP2PSocketManager( - isolation_key, std::move(trusted_socket_manager_client), - pending_trusted_socket_manager.InitWithNewPipeAndPassReceiver(), + trusted_socket_manager_.reset(); + // TODO(https://crbug.com/1085022): Make this interface per-frame instead of + // per-process, and grab the correct NetworkIsolationKey from the associated + // RenderFrameHost. + rph->GetStoragePartition()->GetNetworkContext()->CreateP2PSocketManager( + net::NetworkIsolationKey::Todo(), + std::move(trusted_socket_manager_client), + trusted_socket_manager_.BindNewPipeAndPassReceiver(), std::move(receiver)); - mojo::Remote<network::mojom::P2PTrustedSocketManager> trusted_socket_manager( - std::move(pending_trusted_socket_manager)); if (dump_incoming_rtp_packet_ || dump_outgoing_rtp_packet_) { - trusted_socket_manager->StartRtpDump(dump_incoming_rtp_packet_, - dump_outgoing_rtp_packet_); + trusted_socket_manager_->StartRtpDump(dump_incoming_rtp_packet_, + dump_outgoing_rtp_packet_); } - trusted_socket_managers_.Add(std::move(trusted_socket_manager)); } base::WeakPtr<P2PSocketDispatcherHost> P2PSocketDispatcherHost::GetWeakPtr() {
diff --git a/content/browser/renderer_host/p2p/socket_dispatcher_host.h b/content/browser/renderer_host/p2p/socket_dispatcher_host.h index 2cebb4a8..a130f1a0 100644 --- a/content/browser/renderer_host/p2p/socket_dispatcher_host.h +++ b/content/browser/renderer_host/p2p/socket_dispatcher_host.h
@@ -17,9 +17,8 @@ #include "base/sequenced_task_runner.h" #include "content/public/browser/render_process_host.h" #include "mojo/public/cpp/bindings/pending_receiver.h" -#include "mojo/public/cpp/bindings/receiver_set.h" -#include "mojo/public/cpp/bindings/remote_set.h" -#include "net/base/network_isolation_key.h" +#include "mojo/public/cpp/bindings/receiver.h" +#include "mojo/public/cpp/bindings/remote.h" #include "services/network/public/mojom/p2p.mojom.h" #include "services/network/public/mojom/p2p_trusted.mojom.h" @@ -41,9 +40,7 @@ void StopRtpDump(bool incoming, bool outgoing); void BindReceiver( - RenderProcessHostImpl& process, - mojo::PendingReceiver<network::mojom::P2PSocketManager> receiver, - net::NetworkIsolationKey isolation_key); + mojo::PendingReceiver<network::mojom::P2PSocketManager> receiver); base::WeakPtr<P2PSocketDispatcherHost> GetWeakPtr(); @@ -60,16 +57,8 @@ bool dump_outgoing_rtp_packet_ = false; RenderProcessHost::WebRtcRtpPacketCallback packet_callback_; - // TODO(crbug.com/1178670): We use sets of interfaces for now (instead of - // creating a host-per-frame) since RTP dumps are started/stopped at the - // process level (for now). - // There are, however, plans to: - // 1. Make WebRtcLoggingAgent per-frame (and RTP dumps along with it) - // 2. (Maybe) deprecate RTP dumps. - // Once either of these happens, this can be cleaned up. - mojo::ReceiverSet<network::mojom::P2PTrustedSocketManagerClient> receivers_; - mojo::RemoteSet<network::mojom::P2PTrustedSocketManager> - trusted_socket_managers_; + mojo::Receiver<network::mojom::P2PTrustedSocketManagerClient> receiver_{this}; + mojo::Remote<network::mojom::P2PTrustedSocketManager> trusted_socket_manager_; network::mojom::P2PNetworkNotificationClientPtr network_notification_client_;
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 6eee013d..805f772e 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -2430,6 +2430,11 @@ AddUIThreadInterface( registry.get(), + base::BindRepeating(&RenderProcessHostImpl::BindP2PSocketManager, + weak_factory_.GetWeakPtr())); + + AddUIThreadInterface( + registry.get(), base::BindRepeating(&RenderProcessHostImpl::CreateMediaLogRecordHost, weak_factory_.GetWeakPtr())); @@ -2598,10 +2603,8 @@ } void RenderProcessHostImpl::BindP2PSocketManager( - net::NetworkIsolationKey isolation_key, mojo::PendingReceiver<network::mojom::P2PSocketManager> receiver) { - p2p_socket_dispatcher_host_->BindReceiver(*this, std::move(receiver), - isolation_key); + p2p_socket_dispatcher_host_->BindReceiver(std::move(receiver)); } void RenderProcessHostImpl::CreateMediaLogRecordHost(
diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h index 78ac2ff6..9ac6bb7 100644 --- a/content/browser/renderer_host/render_process_host_impl.h +++ b/content/browser/renderer_host/render_process_host_impl.h
@@ -649,10 +649,6 @@ mojo::PendingReceiver<blink::mojom::WebSocketConnector> receiver) override; - void BindP2PSocketManager( - net::NetworkIsolationKey isolation_key, - mojo::PendingReceiver<network::mojom::P2PSocketManager> receiver); - // Allows |process_id| to use an additional |allowed_request_initiator| // (bypassing |request_initiator_origin_lock| enforcement). // @@ -777,6 +773,8 @@ mojo::PendingReceiver<blink::mojom::WebDatabaseHost> receiver); void BindAecDumpManager( mojo::PendingReceiver<blink::mojom::AecDumpManager> receiver); + void BindP2PSocketManager( + mojo::PendingReceiver<network::mojom::P2PSocketManager> receiver); void CreateMediaLogRecordHost( mojo::PendingReceiver<content::mojom::MediaInternalLogRecords> receiver); #if BUILDFLAG(ENABLE_PLUGINS)
diff --git a/content/browser/webauth/authenticator_impl_unittest.cc b/content/browser/webauth/authenticator_impl_unittest.cc index 7823b5e..1836c65 100644 --- a/content/browser/webauth/authenticator_impl_unittest.cc +++ b/content/browser/webauth/authenticator_impl_unittest.cc
@@ -3783,6 +3783,7 @@ } static constexpr char kTestPIN[] = "1234"; +static constexpr char16_t kTestPIN16[] = u"1234"; class UVTestAuthenticatorClientDelegate : public AuthenticatorRequestClientDelegate { @@ -3807,8 +3808,7 @@ *collected_pin_ = true; *min_pin_length_ = options.min_pin_length; base::SequencedTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::BindOnce(std::move(provide_pin_cb), base::UTF8ToUTF16(kTestPIN))); + FROM_HERE, base::BindOnce(std::move(provide_pin_cb), kTestPIN16)); } void StartBioEnrollment(base::OnceClosure next_callback) override { @@ -3933,7 +3933,7 @@ // the PIN to answer with. struct PINExpectation { PINReason reason; - std::string pin; + std::u16string pin; int attempts; uint32_t min_pin_length = device::kMinPinLength; PINError error = PINError::kNoError; @@ -3969,12 +3969,11 @@ DCHECK_EQ(expected_.front().min_pin_length, options.min_pin_length); DCHECK_EQ(expected_.front().reason, options.reason); DCHECK_EQ(expected_.front().error, options.error); - std::string pin = std::move(expected_.front().pin); + std::u16string pin = std::move(expected_.front().pin); expected_.pop_front(); base::SequencedTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(provide_pin_cb), - base::UTF8ToUTF16(std::move(pin)))); + FROM_HERE, base::BindOnce(std::move(provide_pin_cb), std::move(pin))); } void FinishCollectToken() override {} @@ -4160,12 +4159,13 @@ case kSetPIN: // A single PIN prompt to set a PIN is expected. - test_client_.expected = {{PINReason::kSet, kTestPIN}}; + test_client_.expected = {{PINReason::kSet, kTestPIN16}}; break; case kUsePIN: // A single PIN prompt to get the PIN is expected. - test_client_.expected = {{PINReason::kChallenge, kTestPIN, 8}}; + test_client_.expected = { + {PINReason::kChallenge, kTestPIN16, 8}}; break; default: @@ -4210,10 +4210,10 @@ virtual_device_factory_->mutable_state()->pin_retries = device::kMaxPinRetries; - test_client_.expected = {{PINReason::kChallenge, "wrong", 8}, - {PINReason::kChallenge, "wrong", 7, + test_client_.expected = {{PINReason::kChallenge, u"wrong", 8}, + {PINReason::kChallenge, u"wrong", 7, device::kMinPinLength, PINError::kWrongPIN}, - {PINReason::kChallenge, "wrong", 6, + {PINReason::kChallenge, u"wrong", 6, device::kMinPinLength, PINError::kWrongPIN}}; EXPECT_EQ(AuthenticatorMakeCredential(make_credential_options()).status, AuthenticatorStatus::NOT_ALLOWED_ERROR); @@ -4228,7 +4228,7 @@ virtual_device_factory_->mutable_state()->pin = kTestPIN; virtual_device_factory_->mutable_state()->pin_retries = 1; - test_client_.expected = {{PINReason::kChallenge, "wrong", 1}}; + test_client_.expected = {{PINReason::kChallenge, u"wrong", 1}}; EXPECT_EQ(AuthenticatorMakeCredential().status, AuthenticatorStatus::NOT_ALLOWED_ERROR); EXPECT_EQ(0, virtual_device_factory_->mutable_state()->pin_retries); @@ -4243,8 +4243,8 @@ device::kMaxPinRetries; // Test that we can successfully get a PIN token after a failure. - test_client_.expected = {{PINReason::kChallenge, "wrong", 8}, - {PINReason::kChallenge, kTestPIN, 7, + test_client_.expected = {{PINReason::kChallenge, u"wrong", 8}, + {PINReason::kChallenge, kTestPIN16, 7, device::kMinPinLength, PINError::kWrongPIN}}; EXPECT_EQ(AuthenticatorMakeCredential().status, AuthenticatorStatus::SUCCESS); EXPECT_EQ(static_cast<int>(device::kMaxPinRetries), @@ -4262,7 +4262,7 @@ virtual_device_factory_->mutable_state()->pin_retries = device::kMaxPinRetries; test_client_.expected = { - {PINReason::kChallenge, kTestPIN, device::kMaxPinRetries}}; + {PINReason::kChallenge, kTestPIN16, device::kMaxPinRetries}}; EXPECT_EQ(AuthenticatorMakeCredential().status, AuthenticatorStatus::SUCCESS); EXPECT_EQ(taps, 1); } @@ -4293,7 +4293,7 @@ ->ReplaceDefaultDiscoveryFactoryForTesting(std::move(discovery)); test_client_.expected = { - {PINReason::kChallenge, kTestPIN, device::kMaxPinRetries}}; + {PINReason::kChallenge, kTestPIN16, device::kMaxPinRetries}}; EXPECT_EQ(AuthenticatorMakeCredential().status, AuthenticatorStatus::SUCCESS); EXPECT_EQ(taps, 2); } @@ -4312,7 +4312,7 @@ virtual_device_factory_->SetCtap2Config(config); virtual_device_factory_->mutable_state()->pin = kTestPIN; test_client_.expected = { - {PINReason::kChallenge, kTestPIN, device::kMaxPinRetries}}; + {PINReason::kChallenge, kTestPIN16, device::kMaxPinRetries}}; MakeCredentialResult result = AuthenticatorMakeCredential(make_credential_options( @@ -4365,7 +4365,7 @@ config.ctap2_versions = {device::Ctap2Version::kCtap2_1}; virtual_device_factory_->SetCtap2Config(config); virtual_device_factory_->mutable_state()->min_pin_length = 6; - test_client_.expected = {{PINReason::kSet, "123456", 0, 6}}; + test_client_.expected = {{PINReason::kSet, u"123456", 0, 6}}; MakeCredentialResult result = AuthenticatorMakeCredential(make_credential_options()); @@ -4385,7 +4385,7 @@ virtual_device_factory_->mutable_state()->min_pin_length = 6; virtual_device_factory_->mutable_state()->pin = "123456"; test_client_.expected = { - {PINReason::kChallenge, "123456", device::kMaxPinRetries, 6}}; + {PINReason::kChallenge, u"123456", device::kMaxPinRetries, 6}}; MakeCredentialResult result = AuthenticatorMakeCredential(make_credential_options()); @@ -4408,9 +4408,9 @@ virtual_device_factory_->mutable_state()->pin_retries = device::kMaxPinRetries; virtual_device_factory_->mutable_state()->min_pin_length = 6; - test_client_.expected = {{PINReason::kChallenge, kTestPIN, + test_client_.expected = {{PINReason::kChallenge, kTestPIN16, device::kMaxPinRetries, device::kMinPinLength}, - {PINReason::kChange, "567890", 0, 6}}; + {PINReason::kChange, u"567890", 0, 6}}; MakeCredentialResult result = AuthenticatorMakeCredential(make_credential_options()); @@ -4440,7 +4440,7 @@ // PIN is still required for discoverable credentials, or if the caller // requests it. if (discoverable || request_uv) { - test_client_.expected = {{PINReason::kChallenge, kTestPIN, + test_client_.expected = {{PINReason::kChallenge, kTestPIN16, device::kMaxPinRetries, device::kMinPinLength}}; } else { @@ -4485,10 +4485,10 @@ virtual_device_factory_->SetCtap2Config(config); if (pin_set) { virtual_device_factory_->mutable_state()->pin = kTestPIN; - test_client_.expected = {{PINReason::kChallenge, kTestPIN, + test_client_.expected = {{PINReason::kChallenge, kTestPIN16, device::kMaxPinRetries, device::kMinPinLength}}; } else { - test_client_.expected = {{PINReason::kSet, kTestPIN, + test_client_.expected = {{PINReason::kSet, kTestPIN16, device::kMaxPinRetries, device::kMinPinLength}}; } @@ -4556,7 +4556,8 @@ case kUsePIN: // A single prompt to get the PIN is expected. - test_client_.expected = {{PINReason::kChallenge, kTestPIN, 8}}; + test_client_.expected = { + {PINReason::kChallenge, kTestPIN16, 8}}; break; default: @@ -4603,10 +4604,10 @@ ASSERT_TRUE(virtual_device_factory_->mutable_state()->InjectRegistration( options->allow_credentials[0].id(), kTestRelyingPartyId)); - test_client_.expected = {{PINReason::kChallenge, "wrong", 8}, - {PINReason::kChallenge, "wrong", 7, + test_client_.expected = {{PINReason::kChallenge, u"wrong", 8}, + {PINReason::kChallenge, u"wrong", 7, device::kMinPinLength, PINError::kWrongPIN}, - {PINReason::kChallenge, "wrong", 6, + {PINReason::kChallenge, u"wrong", 6, device::kMinPinLength, PINError::kWrongPIN}}; EXPECT_EQ(AuthenticatorGetAssertion(std::move(options)).status, AuthenticatorStatus::NOT_ALLOWED_ERROR); @@ -4625,7 +4626,7 @@ ASSERT_TRUE(virtual_device_factory_->mutable_state()->InjectRegistration( options->allow_credentials[0].id(), kTestRelyingPartyId)); - test_client_.expected = {{PINReason::kChallenge, "wrong", 1}}; + test_client_.expected = {{PINReason::kChallenge, u"wrong", 1}}; EXPECT_EQ(AuthenticatorGetAssertion(std::move(options)).status, AuthenticatorStatus::NOT_ALLOWED_ERROR); EXPECT_EQ(0, virtual_device_factory_->mutable_state()->pin_retries); @@ -4646,7 +4647,7 @@ ASSERT_TRUE(virtual_device_factory_->mutable_state()->InjectRegistration( options->allow_credentials[0].id(), kTestRelyingPartyId)); test_client_.expected = { - {PINReason::kChallenge, kTestPIN, device::kMaxPinRetries}}; + {PINReason::kChallenge, kTestPIN16, device::kMaxPinRetries}}; EXPECT_EQ(AuthenticatorGetAssertion(std::move(options)).status, AuthenticatorStatus::SUCCESS); EXPECT_EQ(taps, 1); @@ -4681,7 +4682,7 @@ ->ReplaceDefaultDiscoveryFactoryForTesting(std::move(discovery)); test_client_.expected = { - {PINReason::kChallenge, kTestPIN, device::kMaxPinRetries}}; + {PINReason::kChallenge, kTestPIN16, device::kMaxPinRetries}}; EXPECT_EQ(AuthenticatorGetAssertion(std::move(options)).status, AuthenticatorStatus::SUCCESS); EXPECT_EQ(taps, 2); @@ -4701,7 +4702,7 @@ ASSERT_TRUE(virtual_device_factory_->mutable_state()->InjectRegistration( options->allow_credentials[0].id(), kTestRelyingPartyId)); test_client_.expected = { - {PINReason::kChallenge, kTestPIN, device::kMaxPinRetries}}; + {PINReason::kChallenge, kTestPIN16, device::kMaxPinRetries}}; GetAssertionResult result = AuthenticatorGetAssertion(std::move(options)); EXPECT_EQ(result.status, AuthenticatorStatus::SUCCESS); @@ -4772,7 +4773,7 @@ device::kMaxPinRetries; virtual_device_factory_->SetCtap2Config(config); test_client_.expected = { - {PINReason::kChallenge, kTestPIN, device::kMaxPinRetries}}; + {PINReason::kChallenge, kTestPIN16, device::kMaxPinRetries}}; // Since converting to U2F isn't possible, this will trigger a PIN prompt // and succeed because the device does actually support the algorithm. expected_to_succeed = true; @@ -4832,7 +4833,7 @@ // test infrastructure will CHECK if |expected| is set and not used.) options->prf_enable = true; test_client_.expected = { - {PINReason::kChallenge, kTestPIN, device::kMaxPinRetries}}; + {PINReason::kChallenge, kTestPIN16, device::kMaxPinRetries}}; } else { // If PRF is requested, but the authenticator doesn't support it, then we // should still use U2F. @@ -4870,7 +4871,7 @@ device::kMaxPinRetries; test_client_.expected = { - {PINReason::kChallenge, kTestPIN, device::kMaxPinRetries}}; + {PINReason::kChallenge, kTestPIN16, device::kMaxPinRetries}}; // Craft an exclude list that is large enough to trigger batched probing and // includes one match for a credProtect=uvRequired credential. @@ -5479,8 +5480,7 @@ CollectPINOptions options, base::OnceCallback<void(std::u16string)> provide_pin_cb) override { base::SequencedTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::BindOnce(std::move(provide_pin_cb), base::UTF8ToUTF16(kTestPIN))); + FROM_HERE, base::BindOnce(std::move(provide_pin_cb), kTestPIN16)); } void FinishCollectToken() override {}
diff --git a/content/browser/webui/web_ui_data_source_unittest.cc b/content/browser/webui/web_ui_data_source_unittest.cc index ae07bfa..ffdf3cd 100644 --- a/content/browser/webui/web_ui_data_source_unittest.cc +++ b/content/browser/webui/web_ui_data_source_unittest.cc
@@ -20,7 +20,7 @@ const int kDummyResourceId = 789; const int kDummyJSResourceId = 790; -const char kDummyString[] = "foo"; +const char16_t kDummyString[] = u"foo"; const char kDummyDefaultResource[] = "<html>foo</html>"; const char kDummyResource[] = "<html>blah</html>"; const char kDummyJSResource[] = "export const bar = 5;"; @@ -31,7 +31,7 @@ std::u16string GetLocalizedString(int message_id) override { if (message_id == kDummyStringId) - return base::UTF8ToUTF16(kDummyString); + return kDummyString; return std::u16string(); }
diff --git a/content/public/browser/background_tracing_manager.h b/content/public/browser/background_tracing_manager.h index e9463fd..0b4665d3 100644 --- a/content/public/browser/background_tracing_manager.h +++ b/content/public/browser/background_tracing_manager.h
@@ -10,7 +10,6 @@ #include "base/strings/string_piece.h" #include "base/trace_event/trace_event_impl.h" -#include "base/values.h" #include "content/common/content_export.h" namespace content {
diff --git a/content/public/browser/tracing_controller.h b/content/public/browser/tracing_controller.h index 3927389d..ee0704a 100644 --- a/content/public/browser/tracing_controller.h +++ b/content/public/browser/tracing_controller.h
@@ -15,7 +15,6 @@ #include "base/memory/ref_counted.h" #include "base/task/task_traits.h" #include "base/trace_event/trace_event.h" -#include "base/values.h" #include "content/common/content_export.h" #include "content/public/browser/tracing_delegate.h"
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 2d3f4ec..f61d4bb 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -1088,11 +1088,9 @@ media::DecoderFactory* RenderThreadImpl::GetMediaDecoderFactory() { DCHECK(IsMainThread()); - - // Note that we don't reset this, ever. We instantiate it once and never reset - // it, even if the gpu process restarts. - if (media_decoder_factory_) - return media_decoder_factory_.get(); + // Note that we don't reset this, ever. We hand it out to WebRTC once, and it + // never asks for another one, even if the gpu process restarts. + DCHECK(!media_decoder_factory_); // MediaInterfaceFactory guarantees that the media::InterfaceFactory is // accessed from the current (main) thread.
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc index df7e323..b000033f 100644 --- a/content/renderer/render_view_browsertest.cc +++ b/content/renderer/render_view_browsertest.cc
@@ -2375,8 +2375,7 @@ 0, base::DoNothing()); // Non surrogate pair unicode character. - const std::u16string unicode_composition = base::UTF8ToUTF16( - "\xE3\x81\x82\xE3\x81\x84\xE3\x81\x86\xE3\x81\x88\xE3\x81\x8A"); + const std::u16string unicode_composition = u"あいうえお"; widget_input_handler->ImeSetComposition(unicode_composition, empty_ime_text_span, gfx::Range::InvalidRange(), 0, 0); @@ -2389,8 +2388,7 @@ base::DoNothing()); // Surrogate pair character. - const std::u16string surrogate_pair_char = - base::UTF8ToUTF16("\xF0\xA0\xAE\x9F"); + const std::u16string surrogate_pair_char = u"𠮟"; widget_input_handler->ImeSetComposition(surrogate_pair_char, empty_ime_text_span, gfx::Range::InvalidRange(), 0, 0); @@ -2404,8 +2402,8 @@ // Mixed string. const std::u16string surrogate_pair_mixed_composition = - surrogate_pair_char + base::UTF8ToUTF16("\xE3\x81\x82") + - surrogate_pair_char + u"b" + surrogate_pair_char; + surrogate_pair_char + u"あ" + surrogate_pair_char + u"b" + + surrogate_pair_char; const size_t utf16_length = 8UL; const bool is_surrogate_pair_empty_rect[8] = {false, true, false, false, true, false, false, true};
diff --git a/content/test/gpu/gpu_tests/mediapipe_integration_test.py b/content/test/gpu/gpu_tests/mediapipe_integration_test.py index 590fae2..870658a 100644 --- a/content/test/gpu/gpu_tests/mediapipe_integration_test.py +++ b/content/test/gpu/gpu_tests/mediapipe_integration_test.py
@@ -56,6 +56,13 @@ if errors: self.fail(errors) + @classmethod + def ExpectationsFiles(cls): + return [ + os.path.join(os.path.dirname(os.path.abspath(__file__)), + 'test_expectations', 'mediapipe_expectations.txt'), + ] + def _get_test_html(entry): return '%s/_CLICK_ME_TO_RUN_%s_LOCALLY.html' % (entry, entry)
diff --git a/content/test/gpu/gpu_tests/test_expectations/mediapipe_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/mediapipe_expectations.txt new file mode 100644 index 0000000..2dc6367 --- /dev/null +++ b/content/test/gpu/gpu_tests/test_expectations/mediapipe_expectations.txt
@@ -0,0 +1,60 @@ +# BEGIN TAG HEADER (autogenerated, see validate_tag_consistency.py) +# OS +# tags: [ android android-lollipop android-marshmallow android-nougat +# android-pie android-r +# chromeos +# fuchsia +# linux ubuntu +# mac bigsur catalina lion highsierra mac-10.12 mojave mountainlion +# sierra +# win win7 win8 win10 ] +# Devices +# tags: [ android-nexus-5 android-nexus-5x android-nexus-6 android-nexus-9 +# android-pixel-2 android-pixel-4 android-shield-android-tv +# chromeos-board-amd64-generic chromeos-board-kevin +# fuchsia-board-astro fuchsia-board-qemu-x64 ] +# Platform +# tags: [ desktop +# mobile ] +# Browser +# tags: [ android-chromium android-webview-instrumentation +# debug debug-x64 +# release release-x64 ] +# GPU +# tags: [ amd amd-0x6613 amd-0x679e amd-0x6821 amd-0x7340 +# apple apple-apple-m1 apple-angle-metal-renderer:-apple-m1 +# arm +# google google-0xffff +# intel intel-0xa2e intel-0xd26 intel-0xa011 intel-0x3e92 intel-0x3e9b +# intel-0x5912 +# nvidia nvidia-0xfe9 nvidia-0x1cb3 nvidia-0x2184 +# qualcomm ] +# Decoder +# tags: [ passthrough no-passthrough ] +# ANGLE Backend +# tags: [ angle-disabled +# angle-d3d9 angle-d3d11 +# angle-metal +# angle-opengl angle-opengles +# angle-swiftshader +# angle-vulkan ] +# Skia Renderer +# tags: [ skia-renderer-dawn +# skia-renderer-disabled +# skia-renderer-gl +# skia-renderer-vulkan ] +# SwiftShader +# tags: [ swiftshader-gl no-swiftshader-gl ] +# Driver +# tags: [ intel_lt_25.20.100.6444 intel_lt_25.20.100.6577 +# intel_lt_26.20.100.7000 intel_lt_26.20.100.7870 +# intel_lt_26.20.100.7323 intel_lt_26.20.100.8141 +# intel_lt_27.20.100.8280 +# mesa_lt_19.1 mesa_ge_20.1 ] +# ASan +# tags: [ asan no-asan ] +# Display Server +# tags: [ display-server-wayland display-server-x ] +# results: [ Failure RetryOnFailure Skip ] +# END TAG HEADER +
diff --git a/content/web_test/common/web_test_runtime_flags.h b/content/web_test/common/web_test_runtime_flags.h index abada58e..e83871d 100644 --- a/content/web_test/common/web_test_runtime_flags.h +++ b/content/web_test/common/web_test_runtime_flags.h
@@ -9,7 +9,6 @@ #include "base/check.h" #include "base/macros.h" -#include "base/values.h" #include "content/web_test/common/tracked_dictionary.h" namespace content {
diff --git a/device/bluetooth/dbus/bluetooth_agent_manager_client.h b/device/bluetooth/dbus/bluetooth_agent_manager_client.h index 1663293..f5f67b9 100644 --- a/device/bluetooth/dbus/bluetooth_agent_manager_client.h +++ b/device/bluetooth/dbus/bluetooth_agent_manager_client.h
@@ -11,7 +11,6 @@ #include "base/callback.h" #include "base/macros.h" #include "base/observer_list.h" -#include "base/values.h" #include "dbus/object_path.h" #include "device/bluetooth/bluetooth_export.h" #include "device/bluetooth/dbus/bluez_dbus_client.h"
diff --git a/device/bluetooth/dbus/bluetooth_battery_client.h b/device/bluetooth/dbus/bluetooth_battery_client.h index adc9192..794353a4 100644 --- a/device/bluetooth/dbus/bluetooth_battery_client.h +++ b/device/bluetooth/dbus/bluetooth_battery_client.h
@@ -13,7 +13,6 @@ #include "base/callback.h" #include "base/macros.h" #include "base/observer_list.h" -#include "base/values.h" #include "dbus/object_path.h" #include "dbus/property.h" #include "device/bluetooth/bluetooth_export.h"
diff --git a/device/bluetooth/dbus/bluetooth_debug_manager_client.h b/device/bluetooth/dbus/bluetooth_debug_manager_client.h index 0efb8a74..a6ce6b0 100644 --- a/device/bluetooth/dbus/bluetooth_debug_manager_client.h +++ b/device/bluetooth/dbus/bluetooth_debug_manager_client.h
@@ -10,7 +10,6 @@ #include "base/callback.h" #include "base/macros.h" -#include "base/values.h" #include "dbus/object_path.h" #include "device/bluetooth/bluetooth_export.h" #include "device/bluetooth/dbus/bluez_dbus_client.h"
diff --git a/device/bluetooth/dbus/bluetooth_device_client.h b/device/bluetooth/dbus/bluetooth_device_client.h index ccf3c0e..8ee4cad 100644 --- a/device/bluetooth/dbus/bluetooth_device_client.h +++ b/device/bluetooth/dbus/bluetooth_device_client.h
@@ -14,7 +14,6 @@ #include "base/callback.h" #include "base/macros.h" #include "base/observer_list.h" -#include "base/values.h" #include "dbus/object_path.h" #include "dbus/property.h" #include "device/bluetooth/bluetooth_export.h"
diff --git a/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h b/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h index bc8382f..e9cad0b 100644 --- a/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h +++ b/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h
@@ -12,7 +12,6 @@ #include "base/callback.h" #include "base/macros.h" -#include "base/values.h" #include "dbus/object_path.h" #include "device/bluetooth/bluetooth_export.h" #include "device/bluetooth/dbus/bluez_dbus_client.h"
diff --git a/device/bluetooth/dbus/bluetooth_profile_manager_client.h b/device/bluetooth/dbus/bluetooth_profile_manager_client.h index d1bc5dd..79e3101 100644 --- a/device/bluetooth/dbus/bluetooth_profile_manager_client.h +++ b/device/bluetooth/dbus/bluetooth_profile_manager_client.h
@@ -13,7 +13,6 @@ #include "base/callback.h" #include "base/macros.h" -#include "base/values.h" #include "dbus/object_path.h" #include "device/bluetooth/bluetooth_export.h" #include "device/bluetooth/dbus/bluez_dbus_client.h"
diff --git a/device/bluetooth/dbus/fake_bluetooth_battery_client.cc b/device/bluetooth/dbus/fake_bluetooth_battery_client.cc index 108859f..1cf752f4 100644 --- a/device/bluetooth/dbus/fake_bluetooth_battery_client.cc +++ b/device/bluetooth/dbus/fake_bluetooth_battery_client.cc
@@ -4,6 +4,7 @@ #include "device/bluetooth/dbus/fake_bluetooth_battery_client.h" +#include "base/containers/contains.h" #include "base/logging.h" #include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h" #include "third_party/cros_system_api/dbus/service_constants.h"
diff --git a/device/fido/auth_token_requester_unittest.cc b/device/fido/auth_token_requester_unittest.cc index 4111ee2..1bbcc77d 100644 --- a/device/fido/auth_token_requester_unittest.cc +++ b/device/fido/auth_token_requester_unittest.cc
@@ -34,14 +34,15 @@ device::AuthenticatorSupportedOptions::UserVerificationAvailability; constexpr char kTestPIN[] = "1234"; -constexpr char kNewPIN[] = "5678"; +constexpr char16_t kTestPIN16[] = u"1234"; +constexpr char16_t kNewPIN[] = u"5678"; struct TestExpectation { pin::PINEntryReason reason; pin::PINEntryError error = pin::PINEntryError::kNoError; uint32_t min_pin_length = kMinPinLength; int attempts = 8; - std::u16string pin = base::UTF8ToUTF16(kTestPIN); + std::u16string pin = kTestPIN16; }; struct TestCase { @@ -471,7 +472,7 @@ { .reason = pin::PINEntryReason::kChange, .attempts = 0, - .pin = base::UTF8ToUTF16(kNewPIN), + .pin = kNewPIN, }}}); EXPECT_EQ(*delegate_->result(), AuthTokenRequester::Result::kSuccess); @@ -500,7 +501,7 @@ .reason = pin::PINEntryReason::kChange, .error = pin::PINEntryError::kSameAsCurrentPIN, .attempts = 0, - .pin = base::UTF8ToUTF16(kNewPIN), + .pin = kNewPIN, }}}); EXPECT_EQ(*delegate_->result(), AuthTokenRequester::Result::kSuccess);
diff --git a/extensions/browser/api/bluetooth/bluetooth_api_utils.h b/extensions/browser/api/bluetooth/bluetooth_api_utils.h index d5bd39e1..22d2293 100644 --- a/extensions/browser/api/bluetooth/bluetooth_api_utils.h +++ b/extensions/browser/api/bluetooth/bluetooth_api_utils.h
@@ -5,7 +5,6 @@ #ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_UTILS_H_ #define EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_UTILS_H_ -#include "base/values.h" #include "build/chromeos_buildflags.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_device.h"
diff --git a/extensions/browser/api/dns/dns_api.h b/extensions/browser/api/dns/dns_api.h index 926cd73..3609eedd 100644 --- a/extensions/browser/api/dns/dns_api.h +++ b/extensions/browser/api/dns/dns_api.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_BROWSER_API_DNS_DNS_API_H_ #define EXTENSIONS_BROWSER_API_DNS_DNS_API_H_ -#include <string> - #include "extensions/browser/extension_function.h" #include "mojo/public/cpp/bindings/receiver.h" #include "net/base/address_list.h"
diff --git a/extensions/browser/api/feedback_private/access_rate_limiter.h b/extensions/browser/api/feedback_private/access_rate_limiter.h index e8153bc..452b866 100644 --- a/extensions/browser/api/feedback_private/access_rate_limiter.h +++ b/extensions/browser/api/feedback_private/access_rate_limiter.h
@@ -5,9 +5,6 @@ #ifndef EXTENSIONS_BROWSER_API_FEEDBACK_PRIVATE_ACCESS_RATE_LIMITER_H_ #define EXTENSIONS_BROWSER_API_FEEDBACK_PRIVATE_ACCESS_RATE_LIMITER_H_ -#include <algorithm> -#include <memory> - #include "base/macros.h" #include "base/time/default_tick_clock.h" #include "base/time/tick_clock.h"
diff --git a/extensions/browser/api/feedback_private/feedback_service.h b/extensions/browser/api/feedback_private/feedback_service.h index 19d7d2f..fdf5e9f 100644 --- a/extensions/browser/api/feedback_private/feedback_service.h +++ b/extensions/browser/api/feedback_private/feedback_service.h
@@ -7,8 +7,6 @@ #include <stdint.h> -#include <vector> - #include "base/callback.h" #include "base/macros.h" #include "base/memory/weak_ptr.h"
diff --git a/extensions/browser/api/media_perception_private/media_perception_api_delegate.h b/extensions/browser/api/media_perception_private/media_perception_api_delegate.h index 3c6af78e..3f5eb23 100644 --- a/extensions/browser/api/media_perception_private/media_perception_api_delegate.h +++ b/extensions/browser/api/media_perception_private/media_perception_api_delegate.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_BROWSER_API_MEDIA_PERCEPTION_PRIVATE_MEDIA_PERCEPTION_API_DELEGATE_H_ #define EXTENSIONS_BROWSER_API_MEDIA_PERCEPTION_PRIVATE_MEDIA_PERCEPTION_API_DELEGATE_H_ -#include <memory> - #include "base/callback.h" #include "base/files/file_path.h" #include "chromeos/services/media_perception/public/mojom/media_perception_service.mojom.h"
diff --git a/extensions/browser/api/storage/storage_api.h b/extensions/browser/api/storage/storage_api.h index 169bff1b..d5e3d33 100644 --- a/extensions/browser/api/storage/storage_api.h +++ b/extensions/browser/api/storage/storage_api.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_BROWSER_API_STORAGE_STORAGE_API_H_ #define EXTENSIONS_BROWSER_API_STORAGE_STORAGE_API_H_ -#include <string> - #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "extensions/browser/api/storage/settings_observer.h"
diff --git a/extensions/browser/api/system_network/system_network_api.h b/extensions/browser/api/system_network/system_network_api.h index 22d030e7..c97b300 100644 --- a/extensions/browser/api/system_network/system_network_api.h +++ b/extensions/browser/api/system_network/system_network_api.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_BROWSER_API_SYSTEM_NETWORK_SYSTEM_NETWORK_API_H_ #define EXTENSIONS_BROWSER_API_SYSTEM_NETWORK_SYSTEM_NETWORK_API_H_ -#include <memory> - #include "extensions/browser/extension_function.h" #include "extensions/common/api/system_network.h" #include "net/base/network_interfaces.h"
diff --git a/extensions/browser/api/system_storage/storage_api_test_util.h b/extensions/browser/api/system_storage/storage_api_test_util.h index a035906..4c79fae 100644 --- a/extensions/browser/api/system_storage/storage_api_test_util.h +++ b/extensions/browser/api/system_storage/storage_api_test_util.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_BROWSER_API_SYSTEM_STORAGE_STORAGE_API_TEST_UTIL_H_ #define EXTENSIONS_BROWSER_API_SYSTEM_STORAGE_STORAGE_API_TEST_UTIL_H_ -#include <vector> - #include "components/storage_monitor/storage_info.h" #include "extensions/browser/api/system_storage/storage_info_provider.h"
diff --git a/extensions/browser/app_window/app_window_geometry_cache.h b/extensions/browser/app_window/app_window_geometry_cache.h index 9145d1070..10acedd1 100644 --- a/extensions/browser/app_window/app_window_geometry_cache.h +++ b/extensions/browser/app_window/app_window_geometry_cache.h
@@ -17,7 +17,6 @@ #include "base/scoped_observation.h" #include "base/time/time.h" #include "base/timer/timer.h" -#include "base/values.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "components/keyed_service/core/keyed_service.h" #include "extensions/browser/extension_registry.h"
diff --git a/extensions/browser/content_script_tracker.h b/extensions/browser/content_script_tracker.h index 2b22151..5623ebf1 100644 --- a/extensions/browser/content_script_tracker.h +++ b/extensions/browser/content_script_tracker.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_BROWSER_CONTENT_SCRIPT_TRACKER_H_ #define EXTENSIONS_BROWSER_CONTENT_SCRIPT_TRACKER_H_ -#include <vector> - #include "base/types/pass_key.h" #include "extensions/common/extension_id.h" #include "extensions/common/mojom/host_id.mojom-forward.h"
diff --git a/extensions/browser/events/event_ack_data.h b/extensions/browser/events/event_ack_data.h index fd86f0b..b0d71a8 100644 --- a/extensions/browser/events/event_ack_data.h +++ b/extensions/browser/events/event_ack_data.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_BROWSER_EVENTS_EVENT_ACK_DATA_H_ #define EXTENSIONS_BROWSER_EVENTS_EVENT_ACK_DATA_H_ -#include <map> - #include "base/callback_forward.h" #include "base/memory/weak_ptr.h"
diff --git a/extensions/browser/extension_icon_image.h b/extensions/browser/extension_icon_image.h index 386584d..cb55828 100644 --- a/extensions/browser/extension_icon_image.h +++ b/extensions/browser/extension_icon_image.h
@@ -5,9 +5,6 @@ #ifndef EXTENSIONS_BROWSER_EXTENSION_ICON_IMAGE_H_ #define EXTENSIONS_BROWSER_EXTENSION_ICON_IMAGE_H_ -#include <map> -#include <string> - #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h"
diff --git a/extensions/browser/extension_zoom_request_client.h b/extensions/browser/extension_zoom_request_client.h index d8570a7..42c2e8b 100644 --- a/extensions/browser/extension_zoom_request_client.h +++ b/extensions/browser/extension_zoom_request_client.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_BROWSER_EXTENSION_ZOOM_REQUEST_CLIENT_H_ #define EXTENSIONS_BROWSER_EXTENSION_ZOOM_REQUEST_CLIENT_H_ -#include <memory> - #include "base/macros.h" #include "components/zoom/zoom_controller.h" #include "extensions/common/extension.h"
diff --git a/extensions/browser/image_sanitizer.h b/extensions/browser/image_sanitizer.h index 0370c3e..6961ffc7 100644 --- a/extensions/browser/image_sanitizer.h +++ b/extensions/browser/image_sanitizer.h
@@ -14,7 +14,6 @@ #include "base/files/file_path.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "base/values.h" #include "mojo/public/cpp/bindings/remote.h" #include "services/data_decoder/public/mojom/image_decoder.mojom.h"
diff --git a/extensions/browser/pref_types.h b/extensions/browser/pref_types.h index f10b150..798588a 100644 --- a/extensions/browser/pref_types.h +++ b/extensions/browser/pref_types.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_BROWSER_PREF_TYPES_H_ #define EXTENSIONS_BROWSER_PREF_TYPES_H_ -#include <string> - namespace extensions { enum PrefType {
diff --git a/extensions/browser/update_observer.h b/extensions/browser/update_observer.h index 68c6e22..0085592 100644 --- a/extensions/browser/update_observer.h +++ b/extensions/browser/update_observer.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_BROWSER_UPDATE_OBSERVER_H_ #define EXTENSIONS_BROWSER_UPDATE_OBSERVER_H_ -#include <string> - namespace extensions { class Extension;
diff --git a/extensions/browser/zipfile_installer.h b/extensions/browser/zipfile_installer.h index 2e70483..15a8097 100644 --- a/extensions/browser/zipfile_installer.h +++ b/extensions/browser/zipfile_installer.h
@@ -16,7 +16,6 @@ #include "base/memory/weak_ptr.h" #include "base/optional.h" #include "base/sequence_checker.h" -#include "base/values.h" #include "services/data_decoder/public/cpp/data_decoder.h" namespace extensions {
diff --git a/extensions/common/api/declarative/declarative_manifest_data.cc b/extensions/common/api/declarative/declarative_manifest_data.cc index 0e26d62..4a898e1 100644 --- a/extensions/common/api/declarative/declarative_manifest_data.cc +++ b/extensions/common/api/declarative/declarative_manifest_data.cc
@@ -130,7 +130,7 @@ return nullptr; } - for (const auto& element : *list) { + for (const auto& element : list->GetList()) { const base::DictionaryValue* dict = nullptr; if (!element.GetAsDictionary(&dict)) { error_builder.Append("expected dictionary, got %s",
diff --git a/extensions/common/extension_features.cc b/extensions/common/extension_features.cc index 28ba316..6fe1f6b2 100644 --- a/extensions/common/extension_features.cc +++ b/extensions/common/extension_features.cc
@@ -70,9 +70,4 @@ const base::Feature kReportKeepaliveUkm{"ReportKeepaliveUkm", base::FEATURE_ENABLED_BY_DEFAULT}; -// Enables default Chrome apps on Chrome OS to sync uninstallation across -// devices. -const base::Feature kDefaultChromeAppUninstallSync{ - "DefaultChromeAppUninstallSync", base::FEATURE_DISABLED_BY_DEFAULT}; - } // namespace extensions_features
diff --git a/extensions/common/extension_features.h b/extensions/common/extension_features.h index ab66329..b2f8640 100644 --- a/extensions/common/extension_features.h +++ b/extensions/common/extension_features.h
@@ -33,8 +33,6 @@ extern const base::Feature kReportKeepaliveUkm; -extern const base::Feature kDefaultChromeAppUninstallSync; - } // namespace extensions_features #endif // EXTENSIONS_COMMON_EXTENSION_FEATURES_H_
diff --git a/extensions/common/features/feature.h b/extensions/common/features/feature.h index c6691dc..0aeb612 100644 --- a/extensions/common/features/feature.h +++ b/extensions/common/features/feature.h
@@ -9,7 +9,6 @@ #include <string> #include "base/strings/string_piece.h" -#include "base/values.h" #include "extensions/common/hashed_extension_id.h" #include "extensions/common/manifest.h" #include "extensions/common/mojom/manifest.mojom-shared.h"
diff --git a/extensions/common/features/manifest_feature.h b/extensions/common/features/manifest_feature.h index c3822d7..ca851b5 100644 --- a/extensions/common/features/manifest_feature.h +++ b/extensions/common/features/manifest_feature.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_COMMON_FEATURES_MANIFEST_FEATURE_H_ #define EXTENSIONS_COMMON_FEATURES_MANIFEST_FEATURE_H_ -#include <string> - #include "extensions/common/features/simple_feature.h" namespace extensions {
diff --git a/extensions/common/features/permission_feature.h b/extensions/common/features/permission_feature.h index 17ac6d6a..8ff7f15e 100644 --- a/extensions/common/features/permission_feature.h +++ b/extensions/common/features/permission_feature.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_COMMON_FEATURES_PERMISSION_FEATURE_H_ #define EXTENSIONS_COMMON_FEATURES_PERMISSION_FEATURE_H_ -#include <string> - #include "extensions/common/features/simple_feature.h" namespace extensions {
diff --git a/extensions/common/features/simple_feature.h b/extensions/common/features/simple_feature.h index 0473834..606fdeb7 100644 --- a/extensions/common/features/simple_feature.h +++ b/extensions/common/features/simple_feature.h
@@ -18,7 +18,6 @@ #include "base/lazy_instance.h" #include "base/macros.h" #include "base/optional.h" -#include "base/values.h" #include "components/version_info/version_info.h" #include "extensions/common/extension.h" #include "extensions/common/features/feature.h"
diff --git a/extensions/common/identifiability_metrics.h b/extensions/common/identifiability_metrics.h index ccd7e45..591e6e1 100644 --- a/extensions/common/identifiability_metrics.h +++ b/extensions/common/identifiability_metrics.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_COMMON_IDENTIFIABILITY_METRICS_H_ #define EXTENSIONS_COMMON_IDENTIFIABILITY_METRICS_H_ -#include <string> - #include "extensions/common/extension_id.h" #include "services/metrics/public/cpp/ukm_source_id.h" #include "third_party/blink/public/common/privacy_budget/identifiable_surface.h"
diff --git a/extensions/common/manifest_handlers/background_info.h b/extensions/common/manifest_handlers/background_info.h index 24b03f8a..576006d 100644 --- a/extensions/common/manifest_handlers/background_info.h +++ b/extensions/common/manifest_handlers/background_info.h
@@ -10,7 +10,6 @@ #include "base/macros.h" #include "base/optional.h" -#include "base/values.h" #include "extensions/common/extension.h" #include "extensions/common/manifest_handler.h" #include "url/gurl.h"
diff --git a/extensions/common/manifest_handlers/shared_module_info.h b/extensions/common/manifest_handlers/shared_module_info.h index f9f4db2..2f6875c 100644 --- a/extensions/common/manifest_handlers/shared_module_info.h +++ b/extensions/common/manifest_handlers/shared_module_info.h
@@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "base/values.h" #include "extensions/common/extension.h" #include "extensions/common/manifest_handler.h"
diff --git a/extensions/common/permissions/permission_message_provider.h b/extensions/common/permissions/permission_message_provider.h index 8446972e..bbd4ed6 100644 --- a/extensions/common/permissions/permission_message_provider.h +++ b/extensions/common/permissions/permission_message_provider.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_ #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_ -#include <vector> - #include "extensions/common/manifest.h" #include "extensions/common/permissions/permission_message.h"
diff --git a/extensions/common/stack_frame.cc b/extensions/common/stack_frame.cc index 9ec229bb..157492d 100644 --- a/extensions/common/stack_frame.cc +++ b/extensions/common/stack_frame.cc
@@ -13,7 +13,7 @@ namespace extensions { namespace { -const char kAnonymousFunction[] = "(anonymous function)"; +const char16_t kAnonymousFunction[] = u"(anonymous function)"; } StackFrame::StackFrame() : line_number(1), column_number(1) { @@ -33,8 +33,7 @@ : line_number(line_number), column_number(column_number), source(source), - function(function.empty() ? base::UTF8ToUTF16(kAnonymousFunction) - : function) {} + function(function.empty() ? kAnonymousFunction : function) {} StackFrame::~StackFrame() { }
diff --git a/extensions/renderer/extension_throttle_test_support.h b/extensions/renderer/extension_throttle_test_support.h index e7c1f9640..26891da 100644 --- a/extensions/renderer/extension_throttle_test_support.h +++ b/extensions/renderer/extension_throttle_test_support.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_RENDERER_EXTENSION_THROTTLE_TEST_SUPPORT_H_ #define EXTENSIONS_RENDERER_EXTENSION_THROTTLE_TEST_SUPPORT_H_ -#include <string> - #include "base/macros.h" #include "base/time/tick_clock.h" #include "base/time/time.h"
diff --git a/extensions/renderer/extensions_render_frame_observer.cc b/extensions/renderer/extensions_render_frame_observer.cc index 63e85e3..4adc86c 100644 --- a/extensions/renderer/extensions_render_frame_observer.cc +++ b/extensions/renderer/extensions_render_frame_observer.cc
@@ -26,7 +26,7 @@ namespace { // The delimiter for a stack trace provided by WebKit. -const char kStackFrameDelimiter[] = "\n at "; +const char16_t kStackFrameDelimiter[] = u"\n at "; // Get a stack trace from a WebKit console message. // There are three possible scenarios: @@ -46,17 +46,16 @@ std::vector<std::u16string> pieces; size_t index = 0; - if (message->find(base::UTF8ToUTF16(kStackFrameDelimiter)) != - std::u16string::npos) { - pieces = base::SplitStringUsingSubstr( - *message, base::UTF8ToUTF16(kStackFrameDelimiter), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + if (message->find(kStackFrameDelimiter) != std::u16string::npos) { + pieces = base::SplitStringUsingSubstr(*message, kStackFrameDelimiter, + base::TRIM_WHITESPACE, + base::SPLIT_WANT_ALL); *message = pieces[0]; index = 1; } else if (!stack_trace.empty()) { - pieces = base::SplitStringUsingSubstr( - stack_trace, base::UTF8ToUTF16(kStackFrameDelimiter), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + pieces = base::SplitStringUsingSubstr(stack_trace, kStackFrameDelimiter, + base::TRIM_WHITESPACE, + base::SPLIT_WANT_ALL); } // If we got a stack trace, parse each frame from the text.
diff --git a/extensions/renderer/guest_view/guest_view_internal_custom_bindings.h b/extensions/renderer/guest_view/guest_view_internal_custom_bindings.h index 83d01bd0..e47a95f 100644 --- a/extensions/renderer/guest_view/guest_view_internal_custom_bindings.h +++ b/extensions/renderer/guest_view/guest_view_internal_custom_bindings.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_RENDERER_GUEST_VIEW_GUEST_VIEW_INTERNAL_CUSTOM_BINDINGS_H_ #define EXTENSIONS_RENDERER_GUEST_VIEW_GUEST_VIEW_INTERNAL_CUSTOM_BINDINGS_H_ -#include <map> - #include "extensions/renderer/object_backed_native_handler.h" namespace extensions {
diff --git a/extensions/renderer/messaging_bindings.h b/extensions/renderer/messaging_bindings.h index d6d2ec1..65ba3a2 100644 --- a/extensions/renderer/messaging_bindings.h +++ b/extensions/renderer/messaging_bindings.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_RENDERER_MESSAGING_BINDINGS_H_ #define EXTENSIONS_RENDERER_MESSAGING_BINDINGS_H_ -#include <string> - #include "base/macros.h" #include "extensions/renderer/object_backed_native_handler.h"
diff --git a/extensions/shell/browser/shell_extension_loader.h b/extensions/shell/browser/shell_extension_loader.h index 4702d06..72781d6 100644 --- a/extensions/shell/browser/shell_extension_loader.h +++ b/extensions/shell/browser/shell_extension_loader.h
@@ -5,9 +5,6 @@ #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_LOADER_H_ #define EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_LOADER_H_ -#include <memory> -#include <string> - #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h"
diff --git a/extensions/shell/test/shell_test.h b/extensions/shell/test/shell_test.h index ead304c..41f7e217 100644 --- a/extensions/shell/test/shell_test.h +++ b/extensions/shell/test/shell_test.h
@@ -5,8 +5,6 @@ #ifndef EXTENSIONS_SHELL_TEST_SHELL_TEST_H_ #define EXTENSIONS_SHELL_TEST_SHELL_TEST_H_ -#include <memory> - #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_base.h"
diff --git a/headless/lib/browser/headless_devtools_manager_delegate.h b/headless/lib/browser/headless_devtools_manager_delegate.h index 313536c..ed20bd3 100644 --- a/headless/lib/browser/headless_devtools_manager_delegate.h +++ b/headless/lib/browser/headless_devtools_manager_delegate.h
@@ -11,7 +11,6 @@ #include "base/callback_forward.h" #include "base/memory/weak_ptr.h" -#include "base/values.h" #include "content/public/browser/devtools_manager_delegate.h" namespace headless {
diff --git a/headless/lib/browser/protocol/headless_devtools_session.h b/headless/lib/browser/protocol/headless_devtools_session.h index db7c9da3..226dc1a 100644 --- a/headless/lib/browser/protocol/headless_devtools_session.h +++ b/headless/lib/browser/protocol/headless_devtools_session.h
@@ -7,7 +7,6 @@ #include <memory> -#include "base/values.h" #include "base/containers/flat_map.h" #include "base/memory/weak_ptr.h" #include "content/public/browser/devtools_manager_delegate.h"
diff --git a/infra/config/generated/cr-buildbucket.cfg b/infra/config/generated/cr-buildbucket.cfg index 716caf9..ff4f539 100644 --- a/infra/config/generated/cr-buildbucket.cfg +++ b/infra/config/generated/cr-buildbucket.cfg
@@ -656,7 +656,7 @@ cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$build/reclient\":{\"instance\":\"rbe-chromium-trusted\",\"metrics_project\":\"chromium-reclient-metrics\"},\"$kitchen\":{\"devshell\":true,\"emulate_gce\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"$recipe_engine/resultdb/test_presentation\":{\"column_keys\":[],\"grouping_keys\":[\"status\",\"v.test_suite\"]},\"builder_group\":\"chromium.android.fyi\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$build/reclient\":{\"instance\":\"rbe-chromium-trusted\",\"jobs\":150,\"metrics_project\":\"chromium-reclient-metrics\"},\"$kitchen\":{\"devshell\":true,\"emulate_gce\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"$recipe_engine/resultdb/test_presentation\":{\"column_keys\":[],\"grouping_keys\":[\"status\",\"v.test_suite\"]},\"builder_group\":\"chromium.android.fyi\",\"recipe\":\"chromium\"}" execution_timeout_secs: 14400 build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -2272,7 +2272,7 @@ cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"jobs\":500,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$build/reclient\":{\"instance\":\"rbe-chromium-trusted\",\"metrics_project\":\"chromium-reclient-metrics\"},\"$kitchen\":{\"devshell\":true,\"emulate_gce\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"$recipe_engine/resultdb/test_presentation\":{\"column_keys\":[],\"grouping_keys\":[\"status\",\"v.test_suite\"]},\"builder_group\":\"chromium.android.fyi\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$build/reclient\":{\"instance\":\"rbe-chromium-trusted\",\"jobs\":150,\"metrics_project\":\"chromium-reclient-metrics\"},\"$kitchen\":{\"devshell\":true,\"emulate_gce\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"$recipe_engine/resultdb/test_presentation\":{\"column_keys\":[],\"grouping_keys\":[\"status\",\"v.test_suite\"]},\"builder_group\":\"chromium.android.fyi\",\"recipe\":\"chromium\"}" execution_timeout_secs: 18000 build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com"
diff --git a/infra/config/subprojects/chromium/ci.star b/infra/config/subprojects/chromium/ci.star index 8f1dc3a..3797003 100644 --- a/infra/config/subprojects/chromium/ci.star +++ b/infra/config/subprojects/chromium/ci.star
@@ -990,7 +990,7 @@ short_name = "64", ), cq_mirrors_console_view = "mirrors", - goma_jobs = goma.jobs.MANY_JOBS_FOR_CI, + reclient_jobs = 150, execution_timeout = 5 * time.hour, main_console_view = main_console_if_on_branch(), reclient_instance = "rbe-chromium-trusted", @@ -1010,6 +1010,7 @@ # build. execution_timeout = 4 * time.hour, reclient_instance = "rbe-chromium-trusted", + reclient_jobs = 150, configure_kitchen = True, kitchen_emulate_gce = True, os = os.LINUX_DEFAULT,
diff --git a/ios/chrome/browser/passwords/ios_chrome_password_check_manager.h b/ios/chrome/browser/passwords/ios_chrome_password_check_manager.h index 81444df6..f6e5335 100644 --- a/ios/chrome/browser/passwords/ios_chrome_password_check_manager.h +++ b/ios/chrome/browser/passwords/ios_chrome_password_check_manager.h
@@ -94,6 +94,10 @@ observers_.RemoveObserver(observer); } + password_manager::SavedPasswordsPresenter* GetSavedPasswordsPresenter() { + return &saved_passwords_presenter_; + } + private: friend class RefCounted<IOSChromePasswordCheckManager>; friend class IOSChromePasswordCheckManagerProxy;
diff --git a/ios/chrome/browser/ui/settings/google_services/BUILD.gn b/ios/chrome/browser/ui/settings/google_services/BUILD.gn index 9df2532..3812c06 100644 --- a/ios/chrome/browser/ui/settings/google_services/BUILD.gn +++ b/ios/chrome/browser/ui/settings/google_services/BUILD.gn
@@ -183,11 +183,14 @@ "//components/sync/driver:test_support", "//ios/chrome/browser/browser_state:test_support", "//ios/chrome/browser/main:test_support", + "//ios/chrome/browser/signin", + "//ios/chrome/browser/signin:test_support", "//ios/chrome/browser/sync", "//ios/chrome/browser/sync:test_support", "//ios/chrome/browser/ui/settings/google_services:constants", "//ios/chrome/browser/ui/table_view", "//ios/chrome/browser/ui/table_view/cells", + "//ios/public/provider/chrome/browser/signin:fake_chrome_identity", "//ios/web/public/test", "//ios/web/public/test", "//testing/gtest",
diff --git a/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_mediator.h b/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_mediator.h index b3d0f91..c3c51e93 100644 --- a/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_mediator.h +++ b/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_mediator.h
@@ -7,6 +7,7 @@ #import <UIKit/UIKit.h> +#import "ios/chrome/browser/sync/sync_observer_bridge.h" #import "ios/chrome/browser/ui/settings/google_services/manage_sync_settings_service_delegate.h" #import "ios/chrome/browser/ui/settings/google_services/manage_sync_settings_view_controller_model_delegate.h" @@ -23,7 +24,8 @@ // Mediator for the manager sync settings. @interface ManageSyncSettingsMediator : NSObject <ManageSyncSettingsServiceDelegate, - ManageSyncSettingsTableViewControllerModelDelegate> + ManageSyncSettingsTableViewControllerModelDelegate, + SyncObserverModelBridge> // Consumer. @property(nonatomic, weak) id<ManageSyncSettingsConsumer> consumer;
diff --git a/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_mediator.mm b/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_mediator.mm index aee815c..0b5e610 100644 --- a/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_mediator.mm +++ b/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_mediator.mm
@@ -50,9 +50,9 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error"; } // namespace -@interface ManageSyncSettingsMediator () <BooleanObserver, - IdentityManagerObserverBridgeDelegate, - SyncObserverModelBridge> { +@interface ManageSyncSettingsMediator () < + BooleanObserver, + IdentityManagerObserverBridgeDelegate> { // Sync observer. std::unique_ptr<SyncObserverBridge> _syncObserver; // Whether Sync State changes should be currently ignored. @@ -586,9 +586,11 @@ } BOOL needsSyncErrorItemsUpdate = [self updateSyncErrorItems]; if (notifyConsumer && needsSyncErrorItemsUpdate) { - NSUInteger sectionIndex = [self.consumer.tableViewModel - sectionForSectionIdentifier:SyncErrorsSectionIdentifier]; - NSIndexSet* indexSet = [NSIndexSet indexSetWithIndex:sectionIndex]; + // Need to reload all sections since the error will be inserted into the + // first section position. + NSIndexSet* indexSet = [NSIndexSet + indexSetWithIndexesInRange:NSMakeRange(0, self.consumer.tableViewModel + .numberOfSections)]; [self.consumer reloadSections:indexSet]; } } @@ -651,10 +653,10 @@ self.syncErrorItem = [self createSyncErrorItemWithItemType:type]; } [self.consumer.tableViewModel - addSectionWithIdentifier:SyncErrorsSectionIdentifier]; - [model insertItem:self.syncErrorItem - inSectionWithIdentifier:SyncErrorsSectionIdentifier - atIndex:0]; + insertSectionWithIdentifier:SyncErrorsSectionIdentifier + atIndex:0]; + [model addItem:self.syncErrorItem + toSectionWithIdentifier:SyncErrorsSectionIdentifier]; return YES; }
diff --git a/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_mediator_unittest.mm b/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_mediator_unittest.mm index 61169f1..bdc9ad5 100644 --- a/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_mediator_unittest.mm +++ b/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_mediator_unittest.mm
@@ -6,13 +6,17 @@ #import <UIKit/UIKit.h> +#include "base/test/scoped_feature_list.h" #import "components/autofill/core/common/autofill_prefs.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/testing_pref_service.h" +#include "components/signin/public/base/account_consistency_method.h" #import "components/sync/driver/mock_sync_service.h" #include "components/sync/driver/sync_service.h" #import "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #import "ios/chrome/browser/main/test_browser.h" +#include "ios/chrome/browser/signin/authentication_service_factory.h" +#import "ios/chrome/browser/signin/authentication_service_fake.h" #import "ios/chrome/browser/sync/profile_sync_service_factory.h" #import "ios/chrome/browser/sync/sync_setup_service_factory.h" #import "ios/chrome/browser/sync/sync_setup_service_mock.h" @@ -63,6 +67,10 @@ builder.AddTestingFactory( SyncSetupServiceFactory::GetInstance(), base::BindRepeating(&SyncSetupServiceMock::CreateKeyedService)); + builder.AddTestingFactory( + AuthenticationServiceFactory::GetInstance(), + base::BindRepeating( + &AuthenticationServiceFake::CreateAuthenticationService)); browser_state_ = builder.Build(); consumer_ = [[ManageSyncSettingsTableViewController alloc] @@ -70,6 +78,8 @@ [consumer_ loadModel]; pref_service_ = SetPrefService(); + authentication_service_ = + AuthenticationServiceFactory::GetForBrowserState(browser_state_.get()); sync_setup_service_mock_ = static_cast<SyncSetupServiceMock*>( SyncSetupServiceFactory::GetForBrowserState(browser_state_.get())); sync_service_mock_ = static_cast<syncer::MockSyncService*>( @@ -79,6 +89,7 @@ initWithSyncService:sync_service_mock_ userPrefService:pref_service_]; mediator_.syncSetupService = sync_setup_service_mock_; + mediator_.authService = authentication_service_; mediator_.consumer = consumer_; } @@ -115,6 +126,7 @@ ManageSyncSettingsMediator* mediator_ = nullptr; ManageSyncSettingsTableViewController* consumer_ = nullptr; PrefService* pref_service_ = nullptr; + AuthenticationService* authentication_service_ = nullptr; }; // Tests for Advanced Settings items. @@ -197,3 +209,28 @@ ASSERT_FALSE([mediator_.consumer.tableViewModel hasSectionForSectionIdentifier:SyncErrorsSectionIdentifier]); } + +// Tests that a Sync error that occurs after the user has loaded the Settings +// page once will update the full page. +TEST_F(ManageSyncSettingsMediatorTest, SyncServiceSuccessThenDisabled) { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndEnableFeature(signin::kMobileIdentityConsistency); + + SetupSyncServiceInitializedExpectations(); + EXPECT_CALL(*sync_service_mock_, GetDisableReasons()) + .WillOnce(Return(syncer::MockSyncService::DisableReasonSet())) + .WillOnce(Return(syncer::SyncService::DISABLE_REASON_ENTERPRISE_POLICY)); + + // Loads the Sync page once in success state. + [mediator_ manageSyncSettingsTableViewControllerLoadModel:mediator_.consumer]; + // Loads the Sync page again in disabled tate. + [mediator_ onSyncStateChanged]; + + ASSERT_TRUE([mediator_.consumer.tableViewModel + hasSectionForSectionIdentifier:SyncSettingsSectionIdentifier:: + SyncErrorsSectionIdentifier]); + NSArray* error_items = [mediator_.consumer.tableViewModel + itemsInSectionWithIdentifier:SyncSettingsSectionIdentifier:: + SyncErrorsSectionIdentifier]; + ASSERT_EQ(1UL, error_items.count); +}
diff --git a/ios/chrome/browser/ui/settings/password/BUILD.gn b/ios/chrome/browser/ui/settings/password/BUILD.gn index 6c27d6d..4782b2d0 100644 --- a/ios/chrome/browser/ui/settings/password/BUILD.gn +++ b/ios/chrome/browser/ui/settings/password/BUILD.gn
@@ -15,6 +15,8 @@ "passwords_coordinator.mm", "passwords_mediator.h", "passwords_mediator.mm", + "saved_passwords_presenter_observer.h", + "saved_passwords_presenter_observer.mm", ] deps = [ ":password_ui",
diff --git a/ios/chrome/browser/ui/settings/password/passwords_consumer.h b/ios/chrome/browser/ui/settings/password/passwords_consumer.h index 43f9af4..50e6454 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_consumer.h +++ b/ios/chrome/browser/ui/settings/password/passwords_consumer.h
@@ -38,8 +38,9 @@ compromisedPasswordsCount:(NSInteger)count; // Displays password and blocked forms. -- (void)setPasswordsForms: - (std::vector<std::unique_ptr<password_manager::PasswordForm>>)forms; +- (void) + setPasswordsForms:(std::vector<password_manager::PasswordForm>)savedForms + blockedForms:(std::vector<password_manager::PasswordForm>)blockedForms; @end
diff --git a/ios/chrome/browser/ui/settings/password/passwords_coordinator.mm b/ios/chrome/browser/ui/settings/password/passwords_coordinator.mm index 94f06e78..ab041a6 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_coordinator.mm +++ b/ios/chrome/browser/ui/settings/password/passwords_coordinator.mm
@@ -7,12 +7,10 @@ #include "base/metrics/histogram_functions.h" #include "components/keyed_service/core/service_access_type.h" #include "components/password_manager/core/browser/password_manager_metrics_util.h" -#include "components/password_manager/core/browser/password_store.h" #include "components/password_manager/core/common/password_manager_features.h" #import "ios/chrome/browser/main/browser.h" #include "ios/chrome/browser/passwords/ios_chrome_password_check_manager.h" #include "ios/chrome/browser/passwords/ios_chrome_password_check_manager_factory.h" -#include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h" #include "ios/chrome/browser/signin/authentication_service_factory.h" #include "ios/chrome/browser/sync/sync_setup_service_factory.h" #import "ios/chrome/browser/ui/commands/application_commands.h" @@ -97,14 +95,12 @@ - (void)start { self.mediator = [[PasswordsMediator alloc] - initWithPasswordStore:IOSChromePasswordStoreFactory::GetForBrowserState( - self.browser->GetBrowserState(), - ServiceAccessType::EXPLICIT_ACCESS) - passwordCheckManager:[self passwordCheckManager] - authService:AuthenticationServiceFactory::GetForBrowserState( - self.browser->GetBrowserState()) - syncService:SyncSetupServiceFactory::GetForBrowserState( - self.browser->GetBrowserState())]; + initWithPasswordCheckManager:[self passwordCheckManager] + authService:AuthenticationServiceFactory:: + GetForBrowserState( + self.browser->GetBrowserState()) + syncService:SyncSetupServiceFactory::GetForBrowserState( + self.browser->GetBrowserState())]; self.reauthModule = [[ReauthenticationModule alloc] initWithSuccessfulReauthTimeAccessor:self.mediator]; @@ -178,7 +174,7 @@ - (BOOL)willHandlePasswordDeletion: (const password_manager::PasswordForm&)password { - [self.passwordsViewController deletePasswordForm:password]; + [self.mediator deletePasswordForm:password]; return YES; } @@ -196,7 +192,8 @@ deletePassword: (const password_manager::PasswordForm&)password { DCHECK_EQ(self.passwordDetailsCoordinator, coordinator); - [self.passwordsViewController deletePasswordForm:password]; + [self.mediator deletePasswordForm:password]; + [self.baseNavigationController popViewControllerAnimated:YES]; } #pragma mark Private
diff --git a/ios/chrome/browser/ui/settings/password/passwords_mediator.h b/ios/chrome/browser/ui/settings/password/passwords_mediator.h index de70e96..927cd85 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_mediator.h +++ b/ios/chrome/browser/ui/settings/password/passwords_mediator.h
@@ -16,25 +16,22 @@ @protocol PasswordsConsumer; class SyncSetupService; -namespace password_manager { -class PasswordStore; -} - // This mediator fetches and organises the passwords for its consumer. @interface PasswordsMediator : NSObject <PasswordsTableViewControllerDelegate, SuccessfulReauthTimeAccessor> -- (instancetype) - initWithPasswordStore: - (scoped_refptr<password_manager::PasswordStore>)passwordStore - passwordCheckManager: - (scoped_refptr<IOSChromePasswordCheckManager>)passwordCheckManager - authService:(AuthenticationService*)authService - syncService:(SyncSetupService*)syncService +- (instancetype)initWithPasswordCheckManager: + (scoped_refptr<IOSChromePasswordCheckManager>) + passwordCheckManager + authService:(AuthenticationService*)authService + syncService:(SyncSetupService*)syncService NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; +// Deletes 'form' and its duplicates. +- (void)deletePasswordForm:(const password_manager::PasswordForm&)form; + @property(nonatomic, weak) id<PasswordsConsumer> consumer; @end
diff --git a/ios/chrome/browser/ui/settings/password/passwords_mediator.mm b/ios/chrome/browser/ui/settings/password/passwords_mediator.mm index 606de41..b0c7526 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_mediator.mm +++ b/ios/chrome/browser/ui/settings/password/passwords_mediator.mm
@@ -8,14 +8,13 @@ #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" #include "components/password_manager/core/browser/leak_detection_dialog_utils.h" -#include "components/password_manager/core/browser/password_store.h" #include "components/password_manager/core/common/password_manager_features.h" #include "ios/chrome/browser/passwords/password_check_observer_bridge.h" -#include "ios/chrome/browser/passwords/password_store_observer_bridge.h" #import "ios/chrome/browser/passwords/save_passwords_consumer.h" #import "ios/chrome/browser/signin/authentication_service.h" #include "ios/chrome/browser/sync/sync_setup_service.h" #import "ios/chrome/browser/ui/settings/password/passwords_consumer.h" +#import "ios/chrome/browser/ui/settings/password/saved_passwords_presenter_observer.h" #include "ios/chrome/browser/ui/ui_feature_flags.h" #import "ios/chrome/common/string_util.h" #import "ios/chrome/common/ui/colors/semantic_color_names.h" @@ -37,30 +36,26 @@ } // namespace @interface PasswordsMediator () <PasswordCheckObserver, - PasswordStoreObserver, - SavePasswordsConsumerDelegate> { + SavedPasswordsPresenterObserver> { // The service responsible for password check feature. scoped_refptr<IOSChromePasswordCheckManager> _passwordCheckManager; - // The interface for getting and manipulating a user's saved passwords. - scoped_refptr<password_manager::PasswordStore> _passwordStore; - // Service used to check if user is signed in. AuthenticationService* _authService; // Service to check if passwords are synced. SyncSetupService* _syncService; + password_manager::SavedPasswordsPresenter* _savedPasswordsPresenter; + // A helper object for passing data about changes in password check status // and changes to compromised credentials list. std::unique_ptr<PasswordCheckObserverBridge> _passwordCheckObserver; // A helper object for passing data about saved passwords from a finished // password store request to the PasswordsTableViewController. - std::unique_ptr<ios::SavePasswordsConsumer> _savedPasswordsConsumer; - - // A helper object which listens to the password store changes. - std::unique_ptr<PasswordStoreObserverBridge> _passwordStoreObserver; + std::unique_ptr<SavedPasswordsPresenterObserverBridge> + _passwordsPresenterObserver; // Current state of password check. PasswordCheckState _currentState; @@ -76,33 +71,33 @@ @implementation PasswordsMediator -- (instancetype) - initWithPasswordStore: - (scoped_refptr<password_manager::PasswordStore>)passwordStore - passwordCheckManager: - (scoped_refptr<IOSChromePasswordCheckManager>)passwordCheckManager - authService:(AuthenticationService*)authService - syncService:(SyncSetupService*)syncService { +- (instancetype)initWithPasswordCheckManager: + (scoped_refptr<IOSChromePasswordCheckManager>) + passwordCheckManager + authService:(AuthenticationService*)authService + syncService:(SyncSetupService*)syncService { self = [super init]; if (self) { - _passwordStore = passwordStore; _authService = authService; _syncService = syncService; - _savedPasswordsConsumer = - std::make_unique<ios::SavePasswordsConsumer>(self); - _passwordStoreObserver = - std::make_unique<PasswordStoreObserverBridge>(self); - _passwordStore->AddObserver(_passwordStoreObserver.get()); + _passwordCheckManager = passwordCheckManager; + _savedPasswordsPresenter = + passwordCheckManager->GetSavedPasswordsPresenter(); + DCHECK(_savedPasswordsPresenter); + _passwordCheckObserver = std::make_unique<PasswordCheckObserverBridge>( self, _passwordCheckManager.get()); + _passwordsPresenterObserver = + std::make_unique<SavedPasswordsPresenterObserverBridge>( + self, _savedPasswordsPresenter); } return self; } - (void)dealloc { - if (_passwordStoreObserver) { - _passwordStore->RemoveObserver(_passwordStoreObserver.get()); + if (_passwordsPresenterObserver) { + _savedPasswordsPresenter->RemoveObserver(_passwordsPresenterObserver.get()); } if (_passwordCheckObserver) { _passwordCheckManager->RemoveObserver(_passwordCheckObserver.get()); @@ -113,7 +108,8 @@ if (_consumer == consumer) return; _consumer = consumer; - [self loginsDidChange]; + + [self providePasswordsToConsumer]; _currentState = _passwordCheckManager->GetPasswordCheckState(); [self.consumer setPasswordCheckUIState: @@ -123,8 +119,19 @@ .size()]; } +- (void)deletePasswordForm:(const password_manager::PasswordForm&)form { + _savedPasswordsPresenter->RemovePassword(form); +} + #pragma mark - PasswordsTableViewControllerDelegate +- (void)deletePasswordForms: + (const std::vector<password_manager::PasswordForm>&)forms { + for (const auto& form : forms) { + _savedPasswordsPresenter->RemovePassword(form); + } +} + - (void)startPasswordCheck { _passwordCheckManager->StartPasswordCheck(); } @@ -232,6 +239,24 @@ #pragma mark - Private Methods +// Provides passwords and blocked forms to the '_consumer'. +- (void)providePasswordsToConsumer { + std::vector<password_manager::PasswordForm> forms = + _savedPasswordsPresenter->GetUniquePasswordForms(); + + std::vector<password_manager::PasswordForm> savedForms, blockedForms; + for (const auto& form : forms) { + if (form.blocked_by_user) { + blockedForms.push_back(std::move(form)); + } else { + savedForms.push_back(std::move(form)); + } + } + + [_consumer setPasswordsForms:std::move(savedForms) + blockedForms:std::move(blockedForms)]; +} + // Returns PasswordCheckUIState based on PasswordCheckState. - (PasswordCheckUIState)computePasswordCheckUIStateWith: (PasswordCheckState)newState { @@ -270,20 +295,11 @@ !_syncService->IsEncryptEverythingEnabled(); } -#pragma mark - PasswordStoreObserver +#pragma mark - SavedPasswordsPresenterObserver -- (void)loginsDidChange { - // Cancel ongoing requests to the password store and issue a new request. - _savedPasswordsConsumer->cancelable_task_tracker()->TryCancelAll(); - _passwordStore->GetAllLogins(_savedPasswordsConsumer.get()); -} - -#pragma mark - SavePasswordsConsumerDelegate - -- (void)onGetPasswordStoreResults: - (std::vector<std::unique_ptr<password_manager::PasswordForm>>)results { - DCHECK(self.consumer); - [self.consumer setPasswordsForms:std::move(results)]; +- (void)savedPasswordsDidChanged: + (password_manager::SavedPasswordsPresenter::SavedPasswordsView)passwords { + [self providePasswordsToConsumer]; } #pragma mark SuccessfulReauthTimeAccessor
diff --git a/ios/chrome/browser/ui/settings/password/passwords_mediator_unittest.mm b/ios/chrome/browser/ui/settings/password/passwords_mediator_unittest.mm index 9239230d..f000a1d 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_mediator_unittest.mm +++ b/ios/chrome/browser/ui/settings/password/passwords_mediator_unittest.mm
@@ -53,9 +53,23 @@ web::BrowserState, TestPasswordStore>)) .get())); } + +// Creates a saved password form. +PasswordForm CreatePasswordForm() { + PasswordForm form; + form.username_value = u"test@egmail.com"; + form.password_value = u"test"; + form.signon_realm = "http://www.example.com/"; + form.in_store = PasswordForm::Store::kProfileStore; + return form; +} + } // namespace -@interface FakePasswordsConsumer : NSObject <PasswordsConsumer> +@interface FakePasswordsConsumer : NSObject <PasswordsConsumer> { + std::vector<password_manager::PasswordForm> _savedForms; + std::vector<password_manager::PasswordForm> _blockedForms; +} @end @@ -66,7 +80,15 @@ } - (void)setPasswordsForms: - (std::vector<std::unique_ptr<password_manager::PasswordForm>>)form { + (std::vector<password_manager::PasswordForm>)savedForms + blockedForms: + (std::vector<password_manager::PasswordForm>)blockedForms { + _savedForms = savedForms; + _blockedForms = blockedForms; +} + +- (std::vector<password_manager::PasswordForm>)savedForms { + return _savedForms; } @end @@ -98,10 +120,10 @@ consumer_ = [[FakePasswordsConsumer alloc] init]; - mediator_ = [[PasswordsMediator alloc] initWithPasswordStore:store_ - passwordCheckManager:password_check_ - authService:auth_service_ - syncService:syncService()]; + mediator_ = + [[PasswordsMediator alloc] initWithPasswordCheckManager:password_check_ + authService:auth_service_ + syncService:syncService()]; mediator_.consumer = consumer_; } @@ -113,6 +135,12 @@ ChromeBrowserState* browserState() { return browser_state_.get(); } + TestPasswordStore* store() { return store_.get(); } + + FakePasswordsConsumer* consumer() { return consumer_; } + + void RunUntilIdle() { task_environment_.RunUntilIdle(); } + private: web::WebTaskEnvironment task_environment_; std::unique_ptr<TestChromeBrowserState> browser_state_; @@ -143,3 +171,32 @@ EXPECT_NSEQ(@"Last checked 5 minutes ago.", [mediator() formatElapsedTimeSinceLastCheck]); } + +// Consumer should be notified when passwords are changed. +TEST_F(PasswordsMediatorTest, NotifiesConsumerOnPasswordChange) { + PasswordForm form = CreatePasswordForm(); + store()->AddLogin(form); + RunUntilIdle(); + EXPECT_THAT([consumer() savedForms], testing::ElementsAre(form)); + + // Remove form from the store. + store()->RemoveLogin(form); + RunUntilIdle(); + EXPECT_THAT([consumer() savedForms], testing::IsEmpty()); +} + +// Duplicates of a form should be removed as well. +TEST_F(PasswordsMediatorTest, DeleteFormWithDuplicates) { + PasswordForm form = CreatePasswordForm(); + PasswordForm duplicate = form; + duplicate.username_element = u"element"; + + store()->AddLogin(form); + store()->AddLogin(duplicate); + RunUntilIdle(); + ASSERT_THAT([consumer() savedForms], testing::ElementsAre(form)); + + [mediator() deletePasswordForm:form]; + RunUntilIdle(); + EXPECT_THAT([consumer() savedForms], testing::IsEmpty()); +}
diff --git a/ios/chrome/browser/ui/settings/password/passwords_settings_egtest.mm b/ios/chrome/browser/ui/settings/password/passwords_settings_egtest.mm index f08e66e..b61167d 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_settings_egtest.mm +++ b/ios/chrome/browser/ui/settings/password/passwords_settings_egtest.mm
@@ -537,9 +537,10 @@ // Wait until the alert and the detail view are dismissed. [ChromeEarlGreyUI waitForAppToIdle]; - // Check that the current view is now the list view, by locating the header - // of the list of passwords. - [[EarlGrey selectElementWithMatcher:SavedPasswordsHeaderMatcher()] + // Check that the current view is now the list view, by locating + // PasswordTableViewController. + [[EarlGrey + selectElementWithMatcher:grey_accessibilityID(kPasswordsTableViewId)] assertWithMatcher:grey_notNil()]; // Verify that the deletion was propagated to the PasswordStore. @@ -597,9 +598,10 @@ // Wait until the alert and the detail view are dismissed. [ChromeEarlGreyUI waitForAppToIdle]; - // Check that the current view is now the list view, by locating the header - // of the list of passwords. - [[EarlGrey selectElementWithMatcher:SavedPasswordsHeaderMatcher()] + // Check that the current view is now the list view, by locating + // PasswordTableViewController. + [[EarlGrey + selectElementWithMatcher:grey_accessibilityID(kPasswordsTableViewId)] assertWithMatcher:grey_notNil()]; // Verify that the deletion was propagated to the PasswordStore. @@ -645,13 +647,11 @@ // Wait until the alert and the detail view are dismissed. [ChromeEarlGreyUI waitForAppToIdle]; - // Check that the current view is now the list view, by locating the header - // of the list of passwords. - [[EarlGrey selectElementWithMatcher: - grey_allOf(grey_accessibilityLabel(l10n_util::GetNSString( - IDS_IOS_SETTINGS_PASSWORDS_EXCEPTIONS_HEADING)), - grey_accessibilityTrait(UIAccessibilityTraitHeader), - nullptr)] assertWithMatcher:grey_notNil()]; + // Check that the current view is now the list view, by locating + // PasswordTableViewController. + [[EarlGrey + selectElementWithMatcher:grey_accessibilityID(kPasswordsTableViewId)] + assertWithMatcher:grey_notNil()]; // Verify that the deletion was propagated to the PasswordStore. GREYAssertEqual(0, [PasswordSettingsAppInterface passwordStoreResultsCount], @@ -1614,4 +1614,47 @@ performAction:grey_tap()]; } +// Tests that removing multiple passwords works fine. +- (void)testRemovingMultiplePasswords { + constexpr int kPasswordsCount = 4; + + // Send the passwords to the queue to be added to the PasswordStore. + [PasswordSettingsAppInterface saveExamplePasswordWithCount:kPasswordsCount]; + + OpenPasswordSettings(); + [ChromeEarlGrey verifyAccessibilityForCurrentScreen]; + + TapEdit(); + + for (int i = kPasswordsCount; i >= 1; i--) { + [GetInteractionForPasswordEntry([NSString + stringWithFormat:@"www%02d.example.com, concrete username %02d", i, i]) + performAction:grey_tap()]; + } + + [[EarlGrey selectElementWithMatcher:DeleteButton()] performAction:grey_tap()]; + + // Wait until animation is over. + [ChromeEarlGreyUI waitForAppToIdle]; + + // Check that saved forms header is removed. + [[EarlGrey selectElementWithMatcher:SavedPasswordsHeaderMatcher()] + assertWithMatcher:grey_nil()]; + + // Verify that the deletion was propagated to the PasswordStore. + GREYAssertEqual(0, [PasswordSettingsAppInterface passwordStoreResultsCount], + @"Stored password was not removed from PasswordStore."); + + // Finally, verify that the Edit button is visible and disabled, because there + // are no other password entries left for deletion via the "Edit" mode. + [[EarlGrey selectElementWithMatcher:NavigationBarEditButton()] + assertWithMatcher:grey_allOf(grey_sufficientlyVisible(), + grey_not(grey_enabled()), nil)]; + + [[EarlGrey selectElementWithMatcher:SettingsMenuBackButton()] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:SettingsDoneButton()] + performAction:grey_tap()]; +} + @end
diff --git a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.h b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.h index 1e28f32..da0f8b39 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.h
@@ -26,9 +26,6 @@ - (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; -// Deletes passed password form and updates list accordingly. -- (void)deletePasswordForm:(const password_manager::PasswordForm&)form; - @property(nonatomic, weak) id<PasswordsSettingsCommands> handler; // Delegate.
diff --git a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.mm b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.mm index a163416..55da5f6 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.mm
@@ -17,7 +17,6 @@ #include "components/password_manager/core/browser/password_list_sorter.h" #include "components/password_manager/core/browser/password_manager_constants.h" #include "components/password_manager/core/browser/password_manager_metrics_util.h" -#include "components/password_manager/core/browser/password_store.h" #include "components/password_manager/core/browser/password_ui_utils.h" #include "components/password_manager/core/browser/ui/password_check_referrer.h" #include "components/password_manager/core/common/password_manager_features.h" @@ -27,7 +26,6 @@ #include "ios/chrome/browser/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/main/browser.h" -#include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h" #import "ios/chrome/browser/signin/chrome_identity_service_observer_bridge.h" #include "ios/chrome/browser/system_flags.h" #import "ios/chrome/browser/ui/elements/home_waiting_view.h" @@ -97,13 +95,12 @@ }; std::vector<std::unique_ptr<password_manager::PasswordForm>> CopyOf( - const std::vector<std::unique_ptr<password_manager::PasswordForm>>& - password_list) { + const std::vector<password_manager::PasswordForm>& password_list) { std::vector<std::unique_ptr<password_manager::PasswordForm>> password_list_copy; for (const auto& form : password_list) { password_list_copy.push_back( - std::make_unique<password_manager::PasswordForm>(*form)); + std::make_unique<password_manager::PasswordForm>(form)); } return password_list_copy; } @@ -111,7 +108,7 @@ } // namespace @interface PasswordFormContentItem : TableViewDetailTextItem -@property(nonatomic) password_manager::PasswordForm* form; +@property(nonatomic) password_manager::PasswordForm form; @end @implementation PasswordFormContentItem @end @@ -189,16 +186,10 @@ TableViewTextItem* _checkForProblemsItem; // The item related to the button for exporting passwords. TableViewTextItem* _exportPasswordsItem; - // The interface for getting and manipulating a user's saved passwords. - scoped_refptr<password_manager::PasswordStore> _passwordStore; // The list of the user's saved passwords. - std::vector<std::unique_ptr<password_manager::PasswordForm>> _savedForms; + std::vector<password_manager::PasswordForm> _savedForms; // The list of the user's blocked sites. - std::vector<std::unique_ptr<password_manager::PasswordForm>> _blockedForms; - // Map containing duplicates of saved passwords. - password_manager::DuplicatesMap _savedPasswordDuplicates; - // Map containing duplicates of blocked passwords. - password_manager::DuplicatesMap _blockedPasswordDuplicates; + std::vector<password_manager::PasswordForm> _blockedForms; // The browser where the screen is being displayed. Browser* _browser; // The current Chrome browser state. @@ -256,9 +247,6 @@ self.title = l10n_util::GetNSString(IDS_IOS_PASSWORDS); self.shouldHideDoneButton = YES; self.searchTerm = @""; - _passwordStore = IOSChromePasswordStoreFactory::GetForBrowserState( - _browserState, ServiceAccessType::EXPLICIT_ACCESS); - DCHECK(_passwordStore); _passwordManagerEnabled = [[PrefBackedBoolean alloc] initWithPrefService:_browserState->GetPrefs() prefName:password_manager::prefs::kCredentialsEnableService]; @@ -580,10 +568,10 @@ return exportPasswordsItem; } -- (SavedFormContentItem*)savedFormItemWithText:(NSString*)text - andDetailText:(NSString*)detailText - forForm:(password_manager::PasswordForm*) - form { +- (SavedFormContentItem*) + savedFormItemWithText:(NSString*)text + andDetailText:(NSString*)detailText + forForm:(const password_manager::PasswordForm&)form { SavedFormContentItem* passwordItem = [[SavedFormContentItem alloc] initWithType:ItemTypeSavedPassword]; passwordItem.text = text; @@ -596,7 +584,7 @@ - (BlockedFormContentItem*) blockedFormItemWithText:(NSString*)text - forForm:(password_manager::PasswordForm*)form { + forForm:(const password_manager::PasswordForm&)form { BlockedFormContentItem* passwordItem = [[BlockedFormContentItem alloc] initWithType:ItemTypeBlocked]; passwordItem.text = text; @@ -719,32 +707,62 @@ } - (void)setPasswordsForms: - (std::vector<std::unique_ptr<password_manager::PasswordForm>>)results { - _blockedForms.clear(); - _savedForms.clear(); - _savedPasswordDuplicates.clear(); - _blockedPasswordDuplicates.clear(); + (std::vector<password_manager::PasswordForm>)savedForms + blockedForms: + (std::vector<password_manager::PasswordForm>)blockedForms { + _blockedForms = std::move(blockedForms); + _savedForms = std::move(savedForms); - _didReceiveSavedForms = YES; - [self hideLoadingSpinnerBackground]; - if (results.empty()) { + if (!_didReceiveSavedForms) { + _didReceiveSavedForms = YES; + [self hideLoadingSpinnerBackground]; + [self updateUIForEditState]; [self reloadData]; - return; - } - for (auto& form : results) { - if (form->blocked_by_user) - _blockedForms.push_back(std::move(form)); - else - _savedForms.push_back(std::move(form)); - } + } else { + TableViewModel* model = self.tableViewModel; + NSMutableIndexSet* sectionsToUpdate = [NSMutableIndexSet indexSet]; - password_manager::SortEntriesAndHideDuplicates(&_savedForms, - &_savedPasswordDuplicates); - password_manager::SortEntriesAndHideDuplicates(&_blockedForms, - &_blockedPasswordDuplicates); + // Hold in reverse order of section indexes (bottom up of section + // displayed). if we don't we'll cause a crash. + SectionIdentifier sections[2] = {SectionIdentifierBlocked, + SectionIdentifierSavedPasswords}; + for (int i = 0; i < 2; i++) { + SectionIdentifier section = sections[i]; + bool hasSection = [model hasSectionForSectionIdentifier:section]; + bool needsSection = section == SectionIdentifierBlocked + ? !_blockedForms.empty() + : !_savedForms.empty(); - [self updateUIForEditState]; - [self reloadData]; + // If section exists but it shouldn't - gracefully remove it with + // animation. + if (!needsSection && hasSection) { + [self clearSectionWithIdentifier:section + withRowAnimation:UITableViewRowAnimationAutomatic]; + } + // If section exists and it should - reload it. + else if (needsSection && hasSection) { + [sectionsToUpdate addIndex:[model sectionForSectionIdentifier:section]]; + } + // If section doesn't exist but it should - add it. + else if (needsSection && !hasSection) { + // This is very rare condition, in this case just reload all data. + [self updateUIForEditState]; + [self reloadData]; + return; + } + } + + [self updateExportPasswordsButton]; + + // Reload items in sections. + if (sectionsToUpdate.count > 0) { + [self filterItems:self.searchTerm]; + [self.tableView reloadSections:sectionsToUpdate + withRowAnimation:UITableViewRowAnimationAutomatic]; + } else if (_savedForms.empty() && _blockedForms.empty()) { + [self setEditing:NO animated:YES]; + } + } } #pragma mark - UITableViewDelegate @@ -970,8 +988,8 @@ SectionIdentifierSavedPasswords]; for (const auto& form : _savedForms) { NSString* text = base::SysUTF8ToNSString( - password_manager::GetShownOriginAndLinkUrl(*form).first); - NSString* detailText = base::SysUTF16ToNSString(form->username_value); + password_manager::GetShownOriginAndLinkUrl(form).first); + NSString* detailText = base::SysUTF16ToNSString(form.username_value); bool hidden = searchTerm.length > 0 && ![text localizedCaseInsensitiveContainsString:searchTerm] && @@ -980,7 +998,7 @@ continue; [model addItem:[self savedFormItemWithText:text andDetailText:detailText - forForm:form.get()] + forForm:form] toSectionWithIdentifier:SectionIdentifierSavedPasswords]; } } @@ -989,12 +1007,12 @@ [model deleteAllItemsFromSectionWithIdentifier:SectionIdentifierBlocked]; for (const auto& form : _blockedForms) { NSString* text = base::SysUTF8ToNSString( - password_manager::GetShownOriginAndLinkUrl(*form).first); + password_manager::GetShownOriginAndLinkUrl(form).first); bool hidden = searchTerm.length > 0 && ![text localizedCaseInsensitiveContainsString:searchTerm]; if (hidden) continue; - [model addItem:[self blockedFormItemWithText:text forForm:form.get()] + [model addItem:[self blockedFormItemWithText:text forForm:form] toSectionWithIdentifier:SectionIdentifierBlocked]; } } @@ -1227,96 +1245,17 @@ } - (void)deleteItemAtIndexPaths:(NSArray<NSIndexPath*>*)indexPaths { - // Ensure indexPaths are sorted to maintain delete logic, and keep track of - // number of items deleted to adjust index for accessing elements in the - // forms vectors. - NSArray* sortedIndexPaths = - [indexPaths sortedArrayUsingSelector:@selector(compare:)]; - auto passwordIterator = _savedForms.begin(); - auto passwordEndIterator = _savedForms.end(); - auto blockedIterator = _blockedForms.begin(); - auto blockedEndIterator = _blockedForms.end(); - for (NSIndexPath* indexPath in sortedIndexPaths) { + std::vector<password_manager::PasswordForm> formsToDelete; + + for (NSIndexPath* indexPath in indexPaths) { // Only form items are editable. PasswordFormContentItem* item = base::mac::ObjCCastStrict<PasswordFormContentItem>( [self.tableViewModel itemAtIndexPath:indexPath]); - BOOL blocked = [item isKindOfClass:[BlockedFormContentItem class]]; - auto& forms = blocked ? _blockedForms : _savedForms; - auto& duplicates = - blocked ? _blockedPasswordDuplicates : _savedPasswordDuplicates; - - const password_manager::PasswordForm& deletedForm = *item.form; - auto begin = blocked ? blockedIterator : passwordIterator; - auto end = blocked ? blockedEndIterator : passwordEndIterator; - - auto formIterator = std::find_if( - begin, end, - [&deletedForm]( - const std::unique_ptr<password_manager::PasswordForm>& value) { - return password_manager::ArePasswordFormUniqueKeysEqual(*value, - deletedForm); - }); - DCHECK(formIterator != end); - - std::unique_ptr<password_manager::PasswordForm> form = - std::move(*formIterator); - std::string key = password_manager::CreateSortKey(*form); - auto duplicatesRange = duplicates.equal_range(key); - for (auto iterator = duplicatesRange.first; - iterator != duplicatesRange.second; ++iterator) { - _passwordStore->RemoveLogin(*(iterator->second)); - } - duplicates.erase(key); - - formIterator = forms.erase(formIterator); - _passwordStore->RemoveLogin(*form); - - // Keep track of where we are in the current list. - if (blocked) { - blockedIterator = formIterator; - } else { - passwordIterator = formIterator; - } + formsToDelete.push_back(item.form); } - // Remove empty sections. - __weak PasswordsTableViewController* weakSelf = self; - [self.tableView - performBatchUpdates:^{ - PasswordsTableViewController* strongSelf = weakSelf; - if (!strongSelf) - return; - - [strongSelf removeFromModelItemAtIndexPaths:indexPaths]; - [strongSelf.tableView - deleteRowsAtIndexPaths:indexPaths - withRowAnimation:UITableViewRowAnimationAutomatic]; - - // Delete in reverse order of section indexes (bottom up of section - // displayed), so that indexes in model matches those in the view. if - // we don't we'll cause a crash. - if (strongSelf->_blockedForms.empty()) { - [self clearSectionWithIdentifier:SectionIdentifierBlocked - withRowAnimation:UITableViewRowAnimationAutomatic]; - } - if (strongSelf->_savedForms.empty()) { - [strongSelf - clearSectionWithIdentifier:SectionIdentifierSavedPasswords - withRowAnimation:UITableViewRowAnimationAutomatic]; - } - } - completion:^(BOOL finished) { - PasswordsTableViewController* strongSelf = weakSelf; - if (!strongSelf) - return; - // If both lists are empty, exit editing mode. - if (strongSelf->_savedForms.empty() && - strongSelf->_blockedForms.empty()) - [strongSelf setEditing:NO animated:YES]; - [strongSelf updateUIForEditState]; - [strongSelf updateExportPasswordsButton]; - }]; + [self.delegate deletePasswordForms:formsToDelete]; } - (void)showPasswordIssuesPage { @@ -1356,7 +1295,7 @@ SavedFormContentItem* saveFormItem = base::mac::ObjCCastStrict<SavedFormContentItem>( [model itemAtIndexPath:indexPath]); - [self.handler showDetailedViewForForm:*saveFormItem.form]; + [self.handler showDetailedViewForForm:saveFormItem.form]; break; } case ItemTypeBlocked: { @@ -1365,7 +1304,7 @@ BlockedFormContentItem* blockedItem = base::mac::ObjCCastStrict<BlockedFormContentItem>( [model itemAtIndexPath:indexPath]); - [self.handler showDetailedViewForForm:*blockedItem.form]; + [self.handler showDetailedViewForForm:blockedItem.form]; break; } case ItemTypeExportPasswordsButton: @@ -1629,43 +1568,6 @@ } } -// Deletes passed password form and updates list accordingly. -- (void)deletePasswordForm:(const password_manager::PasswordForm&)form { - _passwordStore->RemoveLogin(form); - - std::vector<std::unique_ptr<password_manager::PasswordForm>>& forms = - form.blocked_by_user ? _blockedForms : _savedForms; - auto iterator = std::find_if( - forms.begin(), forms.end(), - [&form](const std::unique_ptr<password_manager::PasswordForm>& value) { - return password_manager::ArePasswordFormUniqueKeysEqual(*value, form); - }); - // If |form| not found, pop password details view controller. - if (iterator == forms.end()) { - [self.navigationController popViewControllerAnimated:YES]; - return; - } - - forms.erase(iterator); - - password_manager::DuplicatesMap& duplicates = form.blocked_by_user - ? _blockedPasswordDuplicates - : _savedPasswordDuplicates; - std::string key = password_manager::CreateSortKey(form); - auto duplicatesRange = duplicates.equal_range(key); - for (auto iterator = duplicatesRange.first; - iterator != duplicatesRange.second; ++iterator) { - _passwordStore->RemoveLogin(*(iterator->second)); - } - duplicates.erase(key); - - [self updateUIForEditState]; - [self reloadData]; - // TODO(crbug.com/1096986): Delete this once - // LegacyPasswordDetailsTableViewController is removed. - [self.navigationController popViewControllerAnimated:YES]; -} - #pragma mark - Testing #pragma mark - ChromeIdentityServiceObserver
diff --git a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller_delegate.h b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller_delegate.h index efa2005..f2cf44c3 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller_delegate.h +++ b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller_delegate.h
@@ -7,9 +7,17 @@ #import <Foundation/Foundation.h> +namespace password_manager { +struct PasswordForm; +} + // Delegate for |PasswordsTableViewController|. @protocol PasswordsTableViewControllerDelegate +// Deletes form with its duplicates. +- (void)deletePasswordForms: + (const std::vector<password_manager::PasswordForm>&)forms; + // Starts password check. - (void)startPasswordCheck;
diff --git a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller_unittest.mm index 28611e9..a3810bb 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller_unittest.mm
@@ -99,21 +99,18 @@ CreateController(); mediator_ = [[PasswordsMediator alloc] - initWithPasswordStore:IOSChromePasswordStoreFactory::GetForBrowserState( - browser_->GetBrowserState(), - ServiceAccessType::EXPLICIT_ACCESS) - passwordCheckManager:IOSChromePasswordCheckManagerFactory:: - GetForBrowserState( - browser_->GetBrowserState()) - authService:nil - syncService:nil]; + initWithPasswordCheckManager:IOSChromePasswordCheckManagerFactory:: + GetForBrowserState( + browser_->GetBrowserState()) + authService:nil + syncService:nil]; // Inject some fake passwords to pass the loading state. PasswordsTableViewController* passwords_controller = static_cast<PasswordsTableViewController*>(controller()); passwords_controller.delegate = mediator_; mediator_.consumer = passwords_controller; - [passwords_controller setPasswordsForms:{}]; + [passwords_controller setPasswordsForms:{} blockedForms:{}]; } int GetSectionIndex(PasswordsSections section) { @@ -237,15 +234,13 @@ RunUntilIdle(); } - // Deletes the item at (row, section) and wait util condition returns true or - // timeout. - bool deleteItemAndWait(int section, int row, ConditionBlock condition) { + // Deletes the item at (row, section) and wait util idle. + void deleteItemAndWait(int section, int row) { PasswordsTableViewController* passwords_controller = static_cast<PasswordsTableViewController*>(controller()); [passwords_controller deleteItems:@[ [NSIndexPath indexPathForRow:row inSection:section] ]]; - return base::test::ios::WaitUntilConditionOrTimeout( - base::test::ios::kWaitForUIElementTimeout, condition); + RunUntilIdle(); } void CheckDetailItemTextWithPluralIds(int expected_text_id, @@ -355,23 +350,23 @@ AddSavedForm1(); AddBlockedForm1(); AddBlockedForm2(); + ASSERT_EQ(5, NumberOfSections()); // Delete item in save passwords section. - ASSERT_TRUE(deleteItemAndWait(GetSectionIndex(SavedPasswords), 0, ^{ - return NumberOfSections() == (3 + SectionsOffset()); - })); + deleteItemAndWait(GetSectionIndex(SavedPasswords), 0); + EXPECT_EQ(4, NumberOfSections()); + // Section 2 should now be the blocked passwords section, and should still // have both its items. EXPECT_EQ(2, NumberOfItemsInSection(GetSectionIndex(SavedPasswords))); // Delete item in blocked passwords section. - ASSERT_TRUE(deleteItemAndWait(GetSectionIndex(SavedPasswords), 0, ^{ - return NumberOfItemsInSection(GetSectionIndex(SavedPasswords)) == 1; - })); + deleteItemAndWait(GetSectionIndex(SavedPasswords), 0); + EXPECT_EQ(1, NumberOfItemsInSection(GetSectionIndex(SavedPasswords))); + // There should be no password sections remaining and no search bar. - EXPECT_TRUE(deleteItemAndWait(GetSectionIndex(SavedPasswords), 0, ^{ - return NumberOfSections() == (2 + +SectionsOffset()); - })); + deleteItemAndWait(GetSectionIndex(SavedPasswords), 0); + EXPECT_EQ(3, NumberOfSections()); } // Tests deleting items from saved passwords and blocked passwords sections @@ -382,23 +377,23 @@ AddBlockedForm1(); AddBlockedForm1(); AddBlockedForm2(); + ASSERT_EQ(5, NumberOfSections()); // Delete item in save passwords section. - ASSERT_TRUE(deleteItemAndWait(GetSectionIndex(SavedPasswords), 0, ^{ - return NumberOfSections() == (3 + SectionsOffset()); - })); + deleteItemAndWait(GetSectionIndex(SavedPasswords), 0); + EXPECT_EQ(4, NumberOfSections()); + // Section 2 should now be the blocked passwords section, and should still // have both its items. EXPECT_EQ(2, NumberOfItemsInSection(GetSectionIndex(Blocked) - 1)); // Delete item in blocked passwords section. - ASSERT_TRUE(deleteItemAndWait(GetSectionIndex(Blocked) - 1, 0, ^{ - return NumberOfItemsInSection(GetSectionIndex(Blocked) - 1) == 1; - })); + deleteItemAndWait(GetSectionIndex(Blocked) - 1, 0); + EXPECT_EQ(1, NumberOfItemsInSection(GetSectionIndex(Blocked) - 1)); + // There should be no password sections remaining and no search bar. - EXPECT_TRUE(deleteItemAndWait(GetSectionIndex(Blocked) - 1, 0, ^{ - return NumberOfSections() == (2 + SectionsOffset()); - })); + deleteItemAndWait(GetSectionIndex(Blocked) - 1, 0); + EXPECT_EQ(3, NumberOfSections()); } TEST_F(PasswordsTableViewControllerTest, @@ -676,19 +671,4 @@ EXPECT_EQ(1, NumberOfItemsInSection(GetSectionIndex(SavedPasswords))); } -// Test verifies Passwords View Controller handles deletion of passwords. -TEST_F(PasswordsTableViewControllerTest, PasswordIssuesDeletion) { - AddSavedForm1(); - AddSavedForm2(); - EXPECT_EQ(2, NumberOfItemsInSection(GetSectionIndex(SavedPasswords))); - - PasswordsTableViewController* passwords_controller = - static_cast<PasswordsTableViewController*>(controller()); - - auto password = - GetTestStore().stored_passwords().at("http://www.example.com/").at(0); - [passwords_controller deletePasswordForm:password]; - EXPECT_EQ(1, NumberOfItemsInSection(GetSectionIndex(SavedPasswords))); -} - } // namespace
diff --git a/ios/chrome/browser/ui/settings/password/saved_passwords_presenter_observer.h b/ios/chrome/browser/ui/settings/password/saved_passwords_presenter_observer.h new file mode 100644 index 0000000..6007642 --- /dev/null +++ b/ios/chrome/browser/ui/settings/password/saved_passwords_presenter_observer.h
@@ -0,0 +1,40 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_UI_SETTINGS_PASSWORD_SAVED_PASSWORDS_PRESENTER_OBSERVER_H_ +#define IOS_CHROME_BROWSER_UI_SETTINGS_PASSWORD_SAVED_PASSWORDS_PRESENTER_OBSERVER_H_ + +#import <Foundation/Foundation.h> + +#include "base/scoped_observation.h" +#include "components/password_manager/core/browser/ui/saved_passwords_presenter.h" + +@protocol SavedPasswordsPresenterObserver + +- (void)savedPasswordsDidChanged: + (password_manager::SavedPasswordsPresenter::SavedPasswordsView)passwords; + +@end + +// Simple observer bridge that forwards all events to its delegate observer. +class SavedPasswordsPresenterObserverBridge + : public password_manager::SavedPasswordsPresenter::Observer { + public: + SavedPasswordsPresenterObserverBridge( + id<SavedPasswordsPresenterObserver> delegate, + password_manager::SavedPasswordsPresenter* presenter); + ~SavedPasswordsPresenterObserverBridge() override; + + void OnSavedPasswordsChanged( + password_manager::SavedPasswordsPresenter::SavedPasswordsView passwords) + override; + + private: + __weak id<SavedPasswordsPresenterObserver> delegate_ = nil; + base::ScopedObservation<password_manager::SavedPasswordsPresenter, + password_manager::SavedPasswordsPresenter::Observer> + saved_passwords_presenter_observer_{this}; +}; + +#endif // IOS_CHROME_BROWSER_UI_SETTINGS_PASSWORD_SAVED_PASSWORDS_PRESENTER_OBSERVER_H_
diff --git a/ios/chrome/browser/ui/settings/password/saved_passwords_presenter_observer.mm b/ios/chrome/browser/ui/settings/password/saved_passwords_presenter_observer.mm new file mode 100644 index 0000000..382e9e3 --- /dev/null +++ b/ios/chrome/browser/ui/settings/password/saved_passwords_presenter_observer.mm
@@ -0,0 +1,25 @@ +// 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 "ios/chrome/browser/ui/settings/password/saved_passwords_presenter_observer.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +SavedPasswordsPresenterObserverBridge::SavedPasswordsPresenterObserverBridge( + id<SavedPasswordsPresenterObserver> delegate, + password_manager::SavedPasswordsPresenter* presenter) + : delegate_(delegate) { + DCHECK(presenter); + saved_passwords_presenter_observer_.Observe(presenter); +} + +SavedPasswordsPresenterObserverBridge:: + ~SavedPasswordsPresenterObserverBridge() = default; + +void SavedPasswordsPresenterObserverBridge::OnSavedPasswordsChanged( + password_manager::SavedPasswordsPresenter::SavedPasswordsView passwords) { + [delegate_ savedPasswordsDidChanged:passwords]; +}
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1 index c2dedf8..052035a 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -05678c1067df4c3b34be3eb08b10d6187090cbf6 \ No newline at end of file +62c8b9846fc3d994d4d76ce07390365b30fe127f \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1 index 499baf9..177de99b 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -f08dda4250d5915567e5994bee564b435b77a8c0 \ No newline at end of file +629dc7e3a44a995f81aa98331b285d97893f613d \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.arm64.zip.sha1 index 0197934e..0df1dd7 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -1352605265121957c7f7539a2af83de3a0fdf869 \ No newline at end of file +01812579879424e11b5219caab72537bc4bc372e \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.x64.zip.sha1 index 0e65acf..780547c 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -527693c37d8b0ff260d0eac25c35d78b7045ed58 \ No newline at end of file +ae136fa4fba85714d3e3726dc8bb5cb7f51e987a \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1 index 5a60a7e3..12e51e2 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -cc29e2a2c43bb70e907e9782a997a0a72197e089 \ No newline at end of file +456f38937b2986fd6cef11e08e4c771f677ee360 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1 index 3c75e431..2e93344 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -f543ad1571391f7585f45fa5a992eedc6aca8b93 \ No newline at end of file +7fd824febf1a64d57436e6c1a61cc7f7864efcfe \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1 index 02ce6fe..86a5b0b 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -e2639b8234082cd4bc07ea8b962d2fd585b2ffe8 \ No newline at end of file +a224b478669138d21993ef5fde96b22da66896d4 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1 index 33d619e8..93a1496d 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -8bfc2e7e084e5c692568d1f71d693f58d030cddd \ No newline at end of file +189d694320cbd3412d221a34bb52be437d46a62f \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1 index d5b4c9a0..e6ca423 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -aef4528fa839b6d9bc7b9a30a8df00d45cee7435 \ No newline at end of file +43e257e1739aba49f123b36eff40b696cbf1b144 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1 index 4a55be7..98aaa7f 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -e03cd74b6726547240c055587258e4a0f18ef502 \ No newline at end of file +bf00f574b416035d3ddd49d2ca5083ba24a083b3 \ No newline at end of file
diff --git a/ios/web/js_features/scroll_helper/scroll_helper_java_script_feature.h b/ios/web/js_features/scroll_helper/scroll_helper_java_script_feature.h index 6746f18..9b551e91 100644 --- a/ios/web/js_features/scroll_helper/scroll_helper_java_script_feature.h +++ b/ios/web/js_features/scroll_helper/scroll_helper_java_script_feature.h
@@ -5,7 +5,6 @@ #ifndef IOS_WEB_JS_FEATURES_SCROLL_HELPER_SCROLL_HELPER_JAVA_SCRIPT_FEATURE_H_ #define IOS_WEB_JS_FEATURES_SCROLL_HELPER_SCROLL_HELPER_JAVA_SCRIPT_FEATURE_H_ -#include "base/values.h" #include "ios/web/public/js_messaging/java_script_feature.h" @class WKScriptMessage;
diff --git a/ios/web/js_features/scroll_helper/scroll_helper_java_script_feature.mm b/ios/web/js_features/scroll_helper/scroll_helper_java_script_feature.mm index fd2a3c70..79bde871 100644 --- a/ios/web/js_features/scroll_helper/scroll_helper_java_script_feature.mm +++ b/ios/web/js_features/scroll_helper/scroll_helper_java_script_feature.mm
@@ -4,6 +4,7 @@ #import "ios/web/js_features/scroll_helper/scroll_helper_java_script_feature.h" +#include "base/values.h" #include "ios/web/public/js_messaging/java_script_feature_util.h" #include "ios/web/public/js_messaging/web_frame_util.h"
diff --git a/ios/web/public/web_client.h b/ios/web/public/web_client.h index e6850e6..c9c2cc35 100644 --- a/ios/web/public/web_client.h +++ b/ios/web/public/web_client.h
@@ -14,7 +14,6 @@ #include "base/optional.h" #include "base/strings/string_piece.h" #include "base/task/thread_pool/thread_pool_instance.h" -#include "base/values.h" #include "ios/web/common/user_agent.h" #include "mojo/public/cpp/bindings/generic_pending_receiver.h" #include "ui/base/layout.h"
diff --git a/ios/web_view/internal/autofill/cwv_autofill_client_ios_bridge.h b/ios/web_view/internal/autofill/cwv_autofill_client_ios_bridge.h index bc8f329f..32922dd 100644 --- a/ios/web_view/internal/autofill/cwv_autofill_client_ios_bridge.h +++ b/ios/web_view/internal/autofill/cwv_autofill_client_ios_bridge.h
@@ -11,7 +11,6 @@ #include "base/callback.h" #include "base/memory/weak_ptr.h" -#include "base/values.h" #include "components/autofill/core/browser/autofill_client.h" #include "components/autofill/core/browser/payments/card_unmask_delegate.h" #include "components/autofill/core/browser/payments/legal_message_line.h"
diff --git a/media/mojo/mojom/video_frame_mojom_traits.h b/media/mojo/mojom/video_frame_mojom_traits.h index 9071089..a0369fc 100644 --- a/media/mojo/mojom/video_frame_mojom_traits.h +++ b/media/mojo/mojom/video_frame_mojom_traits.h
@@ -7,7 +7,6 @@ #include "base/memory/ref_counted.h" #include "base/optional.h" -#include "base/values.h" #include "gpu/ipc/common/mailbox_holder_mojom_traits.h" #include "gpu/ipc/common/vulkan_ycbcr_info_mojom_traits.h" #include "media/base/ipc/media_param_traits_macros.h"
diff --git a/net/dns/host_cache.cc b/net/dns/host_cache.cc index f2f2a91a..3f3d2859 100644 --- a/net/dns/host_cache.cc +++ b/net/dns/host_cache.cc
@@ -47,6 +47,7 @@ const char kNetworkIsolationKeyKey[] = "network_isolation_key"; const char kExpirationKey[] = "expiration"; const char kTtlKey[] = "ttl"; +const char kPinnedKey[] = "pinned"; const char kNetworkChangesKey[] = "network_changes"; const char kNetErrorKey[] = "net_error"; const char kAddressesKey[] = "addresses"; @@ -238,6 +239,7 @@ hostnames_(entry.hostnames()), experimental_results_(entry.experimental_results()), source_(entry.source()), + pinned_(entry.pinned()), ttl_(entry.ttl()), expires_(now + ttl), network_changes_(network_changes) {} @@ -361,6 +363,9 @@ NetLog::TickCountToString(expires())); entry_dict.SetIntKey(kTtlKey, ttl().InMilliseconds()); entry_dict.SetIntKey(kNetworkChangesKey, network_changes()); + // The "pinned" status is meaningful only if "network_changes" is also + // preserved. + entry_dict.SetBoolKey(kPinnedKey, pinned()); } else { // Convert expiration time in TimeTicks to Time for serialization, using a // string because base::Value doesn't handle 64-bit integers. @@ -534,9 +539,12 @@ if (caching_is_disabled()) return; + bool preserve_pin = false; bool result_changed = false; auto it = entries_.find(key); if (it != entries_.end()) { + preserve_pin = HasActivePin(it->second); + base::Optional<AddressListDeltaType> addresses_delta; if (entry.addresses() || it->second.addresses()) { if (entry.addresses() && it->second.addresses()) { @@ -594,11 +602,18 @@ entries_.erase(it); } else { result_changed = true; - if (size() == max_entries_) - EvictOneEntry(now); + // This loop almost always runs at most once, for total runtime + // O(max_entries_). It only runs more than once if the cache was over-full + // due to pinned entries, and this is the first call to Set() after + // Invalidate(). The amortized cost remains O(size()) per call to Set(). + while (size() >= max_entries_ && EvictOneEntry(now)) { + } } Entry entry_for_cache(entry, now, ttl, network_changes_); + if (preserve_pin) + entry_for_cache.set_pinned(true); + entry_for_cache.PrepareForCacheInsertion(); AddEntry(key, std::move(entry_for_cache)); @@ -607,10 +622,8 @@ } void HostCache::AddEntry(const Key& key, Entry&& entry) { - DCHECK_GT(max_entries_, size()); DCHECK_EQ(0u, entries_.count(key)); entries_.emplace(key, std::move(entry)); - DCHECK_GE(max_entries_, size()); } void HostCache::Invalidate() { @@ -878,19 +891,38 @@ return std::make_unique<HostCache>(kDefaultMaxEntries); } -void HostCache::EvictOneEntry(base::TimeTicks now) { +bool HostCache::EvictOneEntry(base::TimeTicks now) { DCHECK_LT(0u, entries_.size()); - auto oldest_it = entries_.begin(); + base::Optional<net::HostCache::EntryMap::iterator> oldest_it; for (auto it = entries_.begin(); it != entries_.end(); ++it) { - if ((it->second.expires() < oldest_it->second.expires()) && - (it->second.IsStale(now, network_changes_) || - !oldest_it->second.IsStale(now, network_changes_))) { + const Entry& entry = it->second; + if (HasActivePin(entry)) { + continue; + } + + if (!oldest_it) { + oldest_it = it; + continue; + } + + const Entry& oldest = (*oldest_it)->second; + if ((entry.expires() < oldest.expires()) && + (entry.IsStale(now, network_changes_) || + !oldest.IsStale(now, network_changes_))) { oldest_it = it; } } - entries_.erase(oldest_it); + if (oldest_it) { + entries_.erase(*oldest_it); + return true; + } + return false; +} + +bool HostCache::HasActivePin(const Entry& entry) { + return entry.pinned() && entry.network_changes() == network_changes(); } const HostCache::Key* HostCache::GetMatchingKey(
diff --git a/net/dns/host_cache.h b/net/dns/host_cache.h index ddf58df..3e7266c8 100644 --- a/net/dns/host_cache.h +++ b/net/dns/host_cache.h
@@ -168,6 +168,8 @@ base::Optional<std::vector<bool>> experimental_results) { experimental_results_ = std::move(experimental_results); } + bool pinned() const { return pinned_; } + void set_pinned(bool pinned) { pinned_ = pinned; } Source source() const { return source_; } bool has_ttl() const { return ttl_ >= base::TimeDelta(); } @@ -263,6 +265,10 @@ base::Optional<std::vector<bool>> experimental_results_; // Where results were obtained (e.g. DNS lookup, hosts file, etc). Source source_ = SOURCE_UNKNOWN; + // If true, this entry cannot be evicted from the cache until after the next + // network change. When a pinned Entry is replaced, HostCache will copy + // this flag to the replacement. + bool pinned_ = false; // TTL obtained from the nameserver. Negative if unknown. base::TimeDelta ttl_ = base::TimeDelta::FromSeconds(-1); @@ -414,7 +420,10 @@ // Returns true if this HostCache can contain no entries. bool caching_is_disabled() const { return max_entries_ == 0; } - void EvictOneEntry(base::TimeTicks now); + // Returns true if an entry was removed. + bool EvictOneEntry(base::TimeTicks now); + // Helper to check if an Entry is currently pinned in the cache. + bool HasActivePin(const Entry& entry); // Helper to insert an Entry into the cache. void AddEntry(const Key& key, Entry&& entry);
diff --git a/net/dns/host_cache_unittest.cc b/net/dns/host_cache_unittest.cc index 925b5b59..2cd4097 100644 --- a/net/dns/host_cache_unittest.cc +++ b/net/dns/host_cache_unittest.cc
@@ -743,6 +743,148 @@ EXPECT_FALSE(cache.LookupStale(key3, now, &stale)); } +// Pinned entries should not be evicted, even if the cache is full and the Entry +// has expired. +TEST(HostCacheTest, NoEvictPinned) { + HostCache cache(2); + + base::TimeTicks now; + + HostCache::Key key1 = Key("foobar.com"); + HostCache::Key key2 = Key("foobar2.com"); + HostCache::Key key3 = Key("foobar3.com"); + HostCache::Entry entry = + HostCache::Entry(OK, AddressList(), HostCache::Entry::SOURCE_UNKNOWN); + entry.set_pinned(true); + + cache.Set(key1, entry, now, base::TimeDelta::FromSeconds(5)); + now += base::TimeDelta::FromSeconds(10); + cache.Set(key2, entry, now, base::TimeDelta::FromSeconds(5)); + now += base::TimeDelta::FromSeconds(10); + cache.Set(key3, entry, now, base::TimeDelta::FromSeconds(5)); + + // There are 3 entries in this cache whose nominal max size is 2. + EXPECT_EQ(3u, cache.size()); + EXPECT_TRUE(cache.LookupStale(key1, now, nullptr)); + EXPECT_TRUE(cache.LookupStale(key2, now, nullptr)); + EXPECT_TRUE(cache.Lookup(key3, now)); +} + +// Obsolete pinned entries should be evicted normally. +TEST(HostCacheTest, EvictObsoletePinned) { + HostCache cache(2); + + base::TimeTicks now; + + HostCache::Key key1 = Key("foobar.com"); + HostCache::Key key2 = Key("foobar2.com"); + HostCache::Key key3 = Key("foobar3.com"); + HostCache::Key key4 = Key("foobar4.com"); + HostCache::Entry entry = + HostCache::Entry(OK, AddressList(), HostCache::Entry::SOURCE_UNKNOWN); + entry.set_pinned(true); + + // |key2| should be preserved, since it expires later. + cache.Set(key1, entry, now, base::TimeDelta::FromSeconds(5)); + cache.Set(key2, entry, now, base::TimeDelta::FromSeconds(10)); + cache.Set(key3, entry, now, base::TimeDelta::FromSeconds(5)); + // There are 3 entries in this cache whose nominal max size is 2. + EXPECT_EQ(3u, cache.size()); + + cache.Invalidate(); + // |Invalidate()| does not trigger eviction. + EXPECT_EQ(3u, cache.size()); + + // |Set()| triggers an eviction, leaving only |key2| in cache, + // before adding |key4| + cache.Set(key4, entry, now, base::TimeDelta::FromSeconds(2)); + EXPECT_EQ(2u, cache.size()); + EXPECT_FALSE(cache.LookupStale(key1, now, nullptr)); + EXPECT_TRUE(cache.LookupStale(key2, now, nullptr)); + EXPECT_FALSE(cache.LookupStale(key3, now, nullptr)); + EXPECT_TRUE(cache.LookupStale(key4, now, nullptr)); +} + +// An active pin is preserved if the record is +// replaced due to a Set() call without the pin. +TEST(HostCacheTest, PreserveActivePin) { + HostCache cache(2); + + base::TimeTicks now; + + // Make entry1 and entry2, identical except for IP and pinned flag. + IPAddress address1(192, 0, 2, 1); + IPAddress address2(192, 0, 2, 2); + IPEndPoint endpoint1(address1, 0); + IPEndPoint endpoint2(address2, 0); + HostCache::Entry entry1 = HostCache::Entry(OK, AddressList(endpoint1), + HostCache::Entry::SOURCE_UNKNOWN); + HostCache::Entry entry2 = HostCache::Entry(OK, AddressList(endpoint2), + HostCache::Entry::SOURCE_UNKNOWN); + entry1.set_pinned(true); + + HostCache::Key key = Key("foobar.com"); + + // Insert entry1, and verify that it can be retrieved with the + // correct IP and |pinned()| == true. + cache.Set(key, entry1, now, base::TimeDelta::FromSeconds(10)); + const auto* pair1 = cache.Lookup(key, now); + ASSERT_TRUE(pair1); + const HostCache::Entry& result1 = pair1->second; + EXPECT_EQ(endpoint1, result1.addresses()->front()); + EXPECT_TRUE(result1.pinned()); + + // Insert |entry2|, and verify that it when it is retrieved, it + // has the new IP, and the "pinned" flag copied from |entry1|. + cache.Set(key, entry2, now, base::TimeDelta::FromSeconds(10)); + const auto* pair2 = cache.Lookup(key, now); + ASSERT_TRUE(pair2); + const HostCache::Entry& result2 = pair2->second; + EXPECT_EQ(endpoint2, result2.addresses()->front()); + EXPECT_TRUE(result2.pinned()); +} + +// An obsolete cache pin is not preserved if the record is replaced. +TEST(HostCacheTest, DontPreserveObsoletePin) { + HostCache cache(2); + + base::TimeTicks now; + + // Make entry1 and entry2, identical except for IP and "pinned" flag. + IPAddress address1(192, 0, 2, 1); + IPAddress address2(192, 0, 2, 2); + IPEndPoint endpoint1(address1, 0); + IPEndPoint endpoint2(address2, 0); + HostCache::Entry entry1 = HostCache::Entry(OK, AddressList(endpoint1), + HostCache::Entry::SOURCE_UNKNOWN); + HostCache::Entry entry2 = HostCache::Entry(OK, AddressList(endpoint2), + HostCache::Entry::SOURCE_UNKNOWN); + entry1.set_pinned(true); + + HostCache::Key key = Key("foobar.com"); + + // Insert entry1, and verify that it can be retrieved with the + // correct IP and |pinned()| == true. + cache.Set(key, entry1, now, base::TimeDelta::FromSeconds(10)); + const auto* pair1 = cache.Lookup(key, now); + ASSERT_TRUE(pair1); + const HostCache::Entry& result1 = pair1->second; + EXPECT_EQ(endpoint1, result1.addresses()->front()); + EXPECT_TRUE(result1.pinned()); + + // Make entry1 obsolete. + cache.Invalidate(); + + // Insert |entry2|, and verify that it when it is retrieved, it + // has the new IP, and the "pinned" flag is not copied from |entry1|. + cache.Set(key, entry2, now, base::TimeDelta::FromSeconds(10)); + const auto* pair2 = cache.Lookup(key, now); + ASSERT_TRUE(pair2); + const HostCache::Entry& result2 = pair2->second; + EXPECT_EQ(endpoint2, result2.addresses()->front()); + EXPECT_FALSE(result2.pinned()); +} + // Tests the less than and equal operators for HostCache::Key work. TEST(HostCacheTest, KeyComparators) { struct CacheTestParameters {
diff --git a/net/http/http_security_headers.h b/net/http/http_security_headers.h index 83d138c..310136af 100644 --- a/net/http/http_security_headers.h +++ b/net/http/http_security_headers.h
@@ -10,7 +10,6 @@ #include <string> #include "base/time/time.h" -#include "base/values.h" #include "net/base/hash_value.h" #include "net/base/net_export.h"
diff --git a/net/nqe/network_qualities_prefs_manager.cc b/net/nqe/network_qualities_prefs_manager.cc index ec867df..f0fe9c3 100644 --- a/net/nqe/network_qualities_prefs_manager.cc +++ b/net/nqe/network_qualities_prefs_manager.cc
@@ -32,7 +32,7 @@ // Parses |value| into a map of NetworkIDs and CachedNetworkQualities, // and returns the map. ParsedPrefs ConvertDictionaryValueToMap(const base::DictionaryValue* value) { - DCHECK_GE(kMaxCacheSize, value->size()); + DCHECK_GE(kMaxCacheSize, value->DictSize()); ParsedPrefs read_prefs; for (const auto& it : value->DictItems()) { @@ -63,7 +63,7 @@ prefs_(pref_delegate_->GetDictionaryValue()), network_quality_estimator_(nullptr) { DCHECK(pref_delegate_); - DCHECK_GE(kMaxCacheSize, prefs_->size()); + DCHECK_GE(kMaxCacheSize, prefs_->DictSize()); } NetworkQualitiesPrefsManager::~NetworkQualitiesPrefsManager() { @@ -103,9 +103,9 @@ void NetworkQualitiesPrefsManager::ClearPrefs() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - LOCAL_HISTOGRAM_COUNTS_100("NQE.PrefsSizeOnClearing", prefs_->size()); + LOCAL_HISTOGRAM_COUNTS_100("NQE.PrefsSizeOnClearing", prefs_->DictSize()); prefs_->Clear(); - DCHECK_EQ(0u, prefs_->size()); + DCHECK_EQ(0u, prefs_->DictSize()); pref_delegate_->SetDictionaryValue(*prefs_); } @@ -113,7 +113,7 @@ const nqe::internal::NetworkID& network_id, const nqe::internal::CachedNetworkQuality& cached_network_quality) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK_GE(kMaxCacheSize, prefs_->size()); + DCHECK_GE(kMaxCacheSize, prefs_->DictSize()); std::string network_id_string = network_id.ToString(); @@ -126,10 +126,10 @@ GetNameForEffectiveConnectionType( cached_network_quality.effective_connection_type())); - if (prefs_->size() > kMaxCacheSize) { + if (prefs_->DictSize() > kMaxCacheSize) { // Delete one randomly selected value that has a key that is different from // |network_id|. - DCHECK_EQ(kMaxCacheSize + 1, prefs_->size()); + DCHECK_EQ(kMaxCacheSize + 1, prefs_->DictSize()); // Generate a random number in the range [0, |kMaxCacheSize| - 1] since the // number of network IDs in |prefs_| other than |network_id| is // |kMaxCacheSize|. @@ -148,7 +148,7 @@ index_to_delete--; } } - DCHECK_GE(kMaxCacheSize, prefs_->size()); + DCHECK_GE(kMaxCacheSize, prefs_->DictSize()); // Notify the pref delegate so that it updates the prefs on the disk. pref_delegate_->SetDictionaryValue(*prefs_);
diff --git a/net/tools/quic/quic_http_proxy_backend.h b/net/tools/quic/quic_http_proxy_backend.h index 8f4d2544..7739b9d 100644 --- a/net/tools/quic/quic_http_proxy_backend.h +++ b/net/tools/quic/quic_http_proxy_backend.h
@@ -30,7 +30,6 @@ #include "base/single_thread_task_runner.h" #include "base/threading/thread.h" #include "base/threading/thread_task_runner_handle.h" -#include "base/values.h" #include "net/third_party/quiche/src/quic/tools/quic_simple_server_backend.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_builder.h"
diff --git a/printing/backend/BUILD.gn b/printing/backend/BUILD.gn index e0527df..9e980cb 100644 --- a/printing/backend/BUILD.gn +++ b/printing/backend/BUILD.gn
@@ -152,5 +152,6 @@ deps = [ ":backend", "//base", + "//printing/mojom", ] }
diff --git a/printing/backend/print_backend.h b/printing/backend/print_backend.h index 8ddfc549..52662be 100644 --- a/printing/backend/print_backend.h +++ b/printing/backend/print_backend.h
@@ -173,21 +173,22 @@ : public base::RefCountedThreadSafe<PrintBackend> { public: // Enumerates the list of installed local and network printers. It will - // return true when the available installed printers have been enumerated + // return success when the available installed printers have been enumerated // into `printer_list`. Note that `printer_list` must not be null and also // should be empty prior to this call. If there are no printers installed - // then it will still return true, and `printer_list` remains empty. It - // returns false when an error has occurred trying to get the list of - // printers. - virtual bool EnumeratePrinters(PrinterList* printer_list) = 0; + // then it will still return success, and `printer_list` remains empty. The + // result code will return one of the error result codes when there is a + // failure in generating the list. + virtual mojom::ResultCode EnumeratePrinters(PrinterList* printer_list) = 0; // Gets the default printer name. Empty string if no default printer. virtual std::string GetDefaultPrinterName() = 0; // Gets the basic printer info for a specific printer. Implementations must // check `printer_name` validity in the same way as IsValidPrinter(). - virtual bool GetPrinterBasicInfo(const std::string& printer_name, - PrinterBasicInfo* printer_info) = 0; + virtual mojom::ResultCode GetPrinterBasicInfo( + const std::string& printer_name, + PrinterBasicInfo* printer_info) = 0; // Gets the semantic capabilities and defaults for a specific printer. // This is usually a lighter implementation than GetPrinterCapsAndDefaults(). @@ -195,12 +196,12 @@ // IsValidPrinter(). // NOTE: on some old platforms (WinXP without XPS pack) // GetPrinterCapsAndDefaults() will fail, while this function will succeed. - virtual bool GetPrinterSemanticCapsAndDefaults( + virtual mojom::ResultCode GetPrinterSemanticCapsAndDefaults( const std::string& printer_name, PrinterSemanticCapsAndDefaults* printer_info) = 0; // Gets the capabilities and defaults for a specific printer. - virtual bool GetPrinterCapsAndDefaults( + virtual mojom::ResultCode GetPrinterCapsAndDefaults( const std::string& printer_name, PrinterCapsAndDefaults* printer_info) = 0;
diff --git a/printing/backend/print_backend_chromeos.cc b/printing/backend/print_backend_chromeos.cc index f2de132..e122459 100644 --- a/printing/backend/print_backend_chromeos.cc +++ b/printing/backend/print_backend_chromeos.cc
@@ -7,6 +7,7 @@ #include "base/memory/ref_counted.h" #include "base/notreached.h" #include "base/values.h" +#include "printing/mojom/print.mojom.h" #if defined(USE_CUPS) #include "printing/backend/cups_ipp_utils.h" @@ -22,13 +23,15 @@ explicit PrintBackendChromeOS(const std::string& locale); // PrintBackend implementation. - bool EnumeratePrinters(PrinterList* printer_list) override; + mojom::ResultCode EnumeratePrinters(PrinterList* printer_list) override; std::string GetDefaultPrinterName() override; - bool GetPrinterBasicInfo(const std::string& printer_name, - PrinterBasicInfo* printer_info) override; - bool GetPrinterCapsAndDefaults(const std::string& printer_name, - PrinterCapsAndDefaults* printer_info) override; - bool GetPrinterSemanticCapsAndDefaults( + mojom::ResultCode GetPrinterBasicInfo( + const std::string& printer_name, + PrinterBasicInfo* printer_info) override; + mojom::ResultCode GetPrinterCapsAndDefaults( + const std::string& printer_name, + PrinterCapsAndDefaults* printer_info) override; + mojom::ResultCode GetPrinterSemanticCapsAndDefaults( const std::string& printer_name, PrinterSemanticCapsAndDefaults* printer_info) override; std::string GetPrinterDriverInfo(const std::string& printer_name) override; @@ -41,27 +44,29 @@ PrintBackendChromeOS::PrintBackendChromeOS(const std::string& locale) : PrintBackend(locale) {} -bool PrintBackendChromeOS::EnumeratePrinters(PrinterList* printer_list) { - return true; +mojom::ResultCode PrintBackendChromeOS::EnumeratePrinters( + PrinterList* printer_list) { + return mojom::ResultCode::kSuccess; } -bool PrintBackendChromeOS::GetPrinterBasicInfo(const std::string& printer_name, - PrinterBasicInfo* printer_info) { - return false; +mojom::ResultCode PrintBackendChromeOS::GetPrinterBasicInfo( + const std::string& printer_name, + PrinterBasicInfo* printer_info) { + return mojom::ResultCode::kFailed; } -bool PrintBackendChromeOS::GetPrinterCapsAndDefaults( +mojom::ResultCode PrintBackendChromeOS::GetPrinterCapsAndDefaults( const std::string& printer_name, PrinterCapsAndDefaults* printer_info) { NOTREACHED(); - return false; + return mojom::ResultCode::kFailed; } -bool PrintBackendChromeOS::GetPrinterSemanticCapsAndDefaults( +mojom::ResultCode PrintBackendChromeOS::GetPrinterSemanticCapsAndDefaults( const std::string& printer_name, PrinterSemanticCapsAndDefaults* printer_info) { NOTREACHED(); - return false; + return mojom::ResultCode::kFailed; } std::string PrintBackendChromeOS::GetPrinterDriverInfo(
diff --git a/printing/backend/print_backend_cups.cc b/printing/backend/print_backend_cups.cc index 3649def..20f31aa 100644 --- a/printing/backend/print_backend_cups.cc +++ b/printing/backend/print_backend_cups.cc
@@ -22,6 +22,7 @@ #include "build/build_config.h" #include "printing/backend/cups_helper.h" #include "printing/backend/print_backend_consts.h" +#include "printing/mojom/print.mojom.h" #include "url/gurl.h" #if defined(OS_MAC) @@ -46,7 +47,7 @@ PrintBackendCUPS::~PrintBackendCUPS() = default; // static -bool PrintBackendCUPS::PrinterBasicInfoFromCUPS( +mojom::ResultCode PrintBackendCUPS::PrinterBasicInfoFromCUPS( const cups_dest_t& printer, PrinterBasicInfo* printer_info) { const char* type_str = @@ -62,7 +63,7 @@ constexpr cups_ptype_t kMask = CUPS_PRINTER_FAX | CUPS_PRINTER_SCANNER | CUPS_PRINTER_DISCOVERED; if (type & kMask) - return false; + return mojom::ResultCode::kFailed; } } @@ -102,7 +103,7 @@ if (info) printer_info->printer_description = info; #endif - return true; + return mojom::ResultCode::kSuccess; } // static @@ -119,7 +120,8 @@ cupsFreeDests(1, dest); } -bool PrintBackendCUPS::EnumeratePrinters(PrinterList* printer_list) { +mojom::ResultCode PrintBackendCUPS::EnumeratePrinters( + PrinterList* printer_list) { DCHECK(printer_list); printer_list->clear(); @@ -137,25 +139,27 @@ << ", server: " << print_server_url_ << ", error: " << static_cast<int>(last_error) << " - " << cupsLastErrorString(); - return false; + return mojom::ResultCode::kFailed; } VLOG(1) << "CUPS: No printers found for CUPS server: " << print_server_url_; - return true; + return mojom::ResultCode::kSuccess; } for (int printer_index = 0; printer_index < num_dests; ++printer_index) { const cups_dest_t& printer = destinations[printer_index]; PrinterBasicInfo printer_info; - if (PrinterBasicInfoFromCUPS(printer, &printer_info)) + if (PrinterBasicInfoFromCUPS(printer, &printer_info) == + mojom::ResultCode::kSuccess) { printer_list->push_back(printer_info); + } } cupsFreeDests(num_dests, destinations); VLOG(1) << "CUPS: Enumerated printers, server: " << print_server_url_ << ", # of printers: " << printer_list->size(); - return true; + return mojom::ResultCode::kSuccess; } std::string PrintBackendCUPS::GetDefaultPrinterName() { @@ -168,32 +172,37 @@ return name; } -bool PrintBackendCUPS::GetPrinterBasicInfo(const std::string& printer_name, - PrinterBasicInfo* printer_info) { +mojom::ResultCode PrintBackendCUPS::GetPrinterBasicInfo( + const std::string& printer_name, + PrinterBasicInfo* printer_info) { ScopedDestination dest = GetNamedDest(printer_name); if (!dest) - return false; + return mojom::ResultCode::kFailed; DCHECK_EQ(printer_name, dest->name); return PrinterBasicInfoFromCUPS(*dest, printer_info); } -bool PrintBackendCUPS::GetPrinterSemanticCapsAndDefaults( +mojom::ResultCode PrintBackendCUPS::GetPrinterSemanticCapsAndDefaults( const std::string& printer_name, PrinterSemanticCapsAndDefaults* printer_info) { PrinterCapsAndDefaults info; if (!IsValidPrinter(printer_name)) - return false; + return mojom::ResultCode::kFailed; - if (!GetPrinterCapsAndDefaults(printer_name, &info)) - return false; + mojom::ResultCode result_code = + GetPrinterCapsAndDefaults(printer_name, &info); + if (result_code != mojom::ResultCode::kSuccess) + return result_code; ScopedDestination dest = GetNamedDest(printer_name); return ParsePpdCapabilities(dest.get(), locale(), info.printer_capabilities, - printer_info); + printer_info) + ? mojom::ResultCode::kSuccess + : mojom::ResultCode::kFailed; } -bool PrintBackendCUPS::GetPrinterCapsAndDefaults( +mojom::ResultCode PrintBackendCUPS::GetPrinterCapsAndDefaults( const std::string& printer_name, PrinterCapsAndDefaults* printer_info) { DCHECK(printer_info); @@ -204,7 +213,7 @@ // In some cases CUPS failed to get ppd file. if (ppd_path.empty()) { LOG(ERROR) << "CUPS: Failed to get PPD, printer name: " << printer_name; - return false; + return mojom::ResultCode::kFailed; } std::string content; @@ -212,15 +221,16 @@ base::DeleteFile(ppd_path); - if (res) { - printer_info->printer_capabilities.swap(content); - printer_info->caps_mime_type = "application/pagemaker"; - // In CUPS, printer defaults is a part of PPD file. Nothing to upload here. - printer_info->printer_defaults.clear(); - printer_info->defaults_mime_type.clear(); - } + if (!res) + return mojom::ResultCode::kFailed; - return res; + printer_info->printer_capabilities.swap(content); + printer_info->caps_mime_type = "application/pagemaker"; + // In CUPS, printer defaults is a part of PPD file. Nothing to upload here. + printer_info->printer_defaults.clear(); + printer_info->defaults_mime_type.clear(); + + return mojom::ResultCode::kSuccess; } std::string PrintBackendCUPS::GetPrinterDriverInfo(
diff --git a/printing/backend/print_backend_cups.h b/printing/backend/print_backend_cups.h index 9f35beab..3d60170 100644 --- a/printing/backend/print_backend_cups.h +++ b/printing/backend/print_backend_cups.h
@@ -13,6 +13,7 @@ #include "base/component_export.h" #include "base/files/file_path.h" #include "printing/backend/print_backend.h" +#include "printing/mojom/print.mojom.h" #include "url/gurl.h" namespace printing { @@ -26,8 +27,9 @@ // These static functions are exposed here for use in the tests. COMPONENT_EXPORT(PRINT_BACKEND) - static bool PrinterBasicInfoFromCUPS(const cups_dest_t& printer, - PrinterBasicInfo* printer_info); + static mojom::ResultCode PrinterBasicInfoFromCUPS( + const cups_dest_t& printer, + PrinterBasicInfo* printer_info); COMPONENT_EXPORT(PRINT_BACKEND) static std::string PrinterDriverInfoFromCUPS(const cups_dest_t& printer); @@ -40,15 +42,17 @@ ~PrintBackendCUPS() override; // PrintBackend implementation. - bool EnumeratePrinters(PrinterList* printer_list) override; + mojom::ResultCode EnumeratePrinters(PrinterList* printer_list) override; std::string GetDefaultPrinterName() override; - bool GetPrinterBasicInfo(const std::string& printer_name, - PrinterBasicInfo* printer_info) override; - bool GetPrinterSemanticCapsAndDefaults( + mojom::ResultCode GetPrinterBasicInfo( + const std::string& printer_name, + PrinterBasicInfo* printer_info) override; + mojom::ResultCode GetPrinterSemanticCapsAndDefaults( const std::string& printer_name, PrinterSemanticCapsAndDefaults* printer_info) override; - bool GetPrinterCapsAndDefaults(const std::string& printer_name, - PrinterCapsAndDefaults* printer_info) override; + mojom::ResultCode GetPrinterCapsAndDefaults( + const std::string& printer_name, + PrinterCapsAndDefaults* printer_info) override; std::string GetPrinterDriverInfo(const std::string& printer_name) override; bool IsValidPrinter(const std::string& printer_name) override;
diff --git a/printing/backend/print_backend_cups_ipp.cc b/printing/backend/print_backend_cups_ipp.cc index fff28ecb..4f7a219 100644 --- a/printing/backend/print_backend_cups_ipp.cc +++ b/printing/backend/print_backend_cups_ipp.cc
@@ -17,6 +17,7 @@ #include "printing/backend/cups_connection.h" #include "printing/backend/cups_ipp_helper.h" #include "printing/backend/print_backend_consts.h" +#include "printing/mojom/print.mojom.h" #include "printing/units.h" namespace printing { @@ -28,7 +29,8 @@ PrintBackendCupsIpp::~PrintBackendCupsIpp() = default; -bool PrintBackendCupsIpp::EnumeratePrinters(PrinterList* printer_list) { +mojom::ResultCode PrintBackendCupsIpp::EnumeratePrinters( + PrinterList* printer_list) { DCHECK(printer_list); printer_list->clear(); @@ -44,11 +46,11 @@ << ", server: " << cups_connection_->server_name() << ", error: " << last_error << " - " << cups_connection_->last_error_message(); - return false; + return mojom::ResultCode::kFailed; } VLOG(1) << "CUPS: No printers found for CUPS server: " << cups_connection_->server_name(); - return true; + return mojom::ResultCode::kSuccess; } VLOG(1) << "CUPS: found " << printers.size() @@ -60,7 +62,7 @@ } } - return true; + return mojom::ResultCode::kSuccess; } std::string PrintBackendCupsIpp::GetDefaultPrinterName() { @@ -75,36 +77,38 @@ return std::string(); } -bool PrintBackendCupsIpp::GetPrinterBasicInfo(const std::string& printer_name, - PrinterBasicInfo* printer_info) { +mojom::ResultCode PrintBackendCupsIpp::GetPrinterBasicInfo( + const std::string& printer_name, + PrinterBasicInfo* printer_info) { std::unique_ptr<CupsPrinter> printer( cups_connection_->GetPrinter(printer_name)); if (!printer) - return false; + return mojom::ResultCode::kFailed; DCHECK_EQ(printer_name, printer->GetName()); - return printer->ToPrinterInfo(printer_info); + return printer->ToPrinterInfo(printer_info) ? mojom::ResultCode::kSuccess + : mojom::ResultCode::kFailed; } -bool PrintBackendCupsIpp::GetPrinterCapsAndDefaults( +mojom::ResultCode PrintBackendCupsIpp::GetPrinterCapsAndDefaults( const std::string& printer_name, PrinterCapsAndDefaults* printer_info) { NOTREACHED(); - return false; + return mojom::ResultCode::kFailed; } -bool PrintBackendCupsIpp::GetPrinterSemanticCapsAndDefaults( +mojom::ResultCode PrintBackendCupsIpp::GetPrinterSemanticCapsAndDefaults( const std::string& printer_name, PrinterSemanticCapsAndDefaults* printer_info) { std::unique_ptr<CupsPrinter> printer( cups_connection_->GetPrinter(printer_name)); if (!printer || !printer->EnsureDestInfo()) - return false; + return mojom::ResultCode::kFailed; CapsAndDefaultsFromPrinter(*printer, printer_info); - return true; + return mojom::ResultCode::kSuccess; } std::string PrintBackendCupsIpp::GetPrinterDriverInfo(
diff --git a/printing/backend/print_backend_cups_ipp.h b/printing/backend/print_backend_cups_ipp.h index 693c989..7da7a88 100644 --- a/printing/backend/print_backend_cups_ipp.h +++ b/printing/backend/print_backend_cups_ipp.h
@@ -10,6 +10,7 @@ #include "printing/backend/cups_connection.h" #include "printing/backend/print_backend.h" +#include "printing/mojom/print.mojom.h" namespace printing { @@ -22,13 +23,15 @@ ~PrintBackendCupsIpp() override; // PrintBackend implementation. - bool EnumeratePrinters(PrinterList* printer_list) override; + mojom::ResultCode EnumeratePrinters(PrinterList* printer_list) override; std::string GetDefaultPrinterName() override; - bool GetPrinterBasicInfo(const std::string& printer_name, - PrinterBasicInfo* printer_info) override; - bool GetPrinterCapsAndDefaults(const std::string& printer_name, - PrinterCapsAndDefaults* printer_info) override; - bool GetPrinterSemanticCapsAndDefaults( + mojom::ResultCode GetPrinterBasicInfo( + const std::string& printer_name, + PrinterBasicInfo* printer_info) override; + mojom::ResultCode GetPrinterCapsAndDefaults( + const std::string& printer_name, + PrinterCapsAndDefaults* printer_info) override; + mojom::ResultCode GetPrinterSemanticCapsAndDefaults( const std::string& printer_name, PrinterSemanticCapsAndDefaults* printer_info) override; std::string GetPrinterDriverInfo(const std::string& printer_name) override;
diff --git a/printing/backend/print_backend_cups_unittest.cc b/printing/backend/print_backend_cups_unittest.cc index 8a39815..e7b4318 100644 --- a/printing/backend/print_backend_cups_unittest.cc +++ b/printing/backend/print_backend_cups_unittest.cc
@@ -10,6 +10,7 @@ #include "build/build_config.h" #include "printing/backend/print_backend.h" #include "printing/backend/print_backend_consts.h" +#include "printing/mojom/print.mojom.h" #include "testing/gtest/include/gtest/gtest.h" namespace printing { @@ -33,11 +34,11 @@ dest->options = options; PrinterBasicInfo printer_info; - const bool eligible = + const mojom::ResultCode result_code = PrintBackendCUPS::PrinterBasicInfoFromCUPS(*dest, &printer_info); cupsFreeDests(num_dests, dest); - return eligible; + return result_code == mojom::ResultCode::kSuccess; } } // namespace @@ -69,8 +70,8 @@ printer->options = options; PrinterBasicInfo printer_info; - EXPECT_TRUE( - PrintBackendCUPS::PrinterBasicInfoFromCUPS(*printer, &printer_info)); + EXPECT_EQ(PrintBackendCUPS::PrinterBasicInfoFromCUPS(*printer, &printer_info), + mojom::ResultCode::kSuccess); cupsFreeDests(/*num_dests=*/1, printer); EXPECT_EQ(kName, printer_info.printer_name);
diff --git a/printing/backend/print_backend_dummy.cc b/printing/backend/print_backend_dummy.cc index 6cf9162a..fefe3bf 100644 --- a/printing/backend/print_backend_dummy.cc +++ b/printing/backend/print_backend_dummy.cc
@@ -9,6 +9,7 @@ #include "printing/backend/print_backend.h" #include "base/values.h" +#include "printing/mojom/print.mojom.h" namespace printing { @@ -19,25 +20,28 @@ DummyPrintBackend(const DummyPrintBackend&) = delete; DummyPrintBackend& operator=(const DummyPrintBackend&) = delete; - bool EnumeratePrinters(PrinterList* printer_list) override { return false; } + mojom::ResultCode EnumeratePrinters(PrinterList* printer_list) override { + return mojom::ResultCode::kFailed; + } std::string GetDefaultPrinterName() override { return std::string(); } - bool GetPrinterBasicInfo(const std::string& printer_name, - PrinterBasicInfo* printer_info) override { - return false; + mojom::ResultCode GetPrinterBasicInfo( + const std::string& printer_name, + PrinterBasicInfo* printer_info) override { + return mojom::ResultCode::kFailed; } - bool GetPrinterSemanticCapsAndDefaults( + mojom::ResultCode GetPrinterSemanticCapsAndDefaults( const std::string& printer_name, PrinterSemanticCapsAndDefaults* printer_info) override { - return false; + return mojom::ResultCode::kFailed; } - bool GetPrinterCapsAndDefaults( + mojom::ResultCode GetPrinterCapsAndDefaults( const std::string& printer_name, PrinterCapsAndDefaults* printer_info) override { - return false; + return mojom::ResultCode::kFailed; } std::string GetPrinterDriverInfo(const std::string& printer_name) override {
diff --git a/printing/backend/print_backend_unittest.cc b/printing/backend/print_backend_unittest.cc index 8252f78c..ae930dd 100644 --- a/printing/backend/print_backend_unittest.cc +++ b/printing/backend/print_backend_unittest.cc
@@ -5,6 +5,7 @@ #include "printing/backend/print_backend.h" #include "base/memory/scoped_refptr.h" +#include "printing/mojom/print.mojom.h" #include "testing/gtest/include/gtest/gtest.h" namespace printing { @@ -36,7 +37,8 @@ TEST_F(PrintBackendTest, MANUAL_EnumeratePrintersSomeInstalled) { PrinterList printer_list; - EXPECT_TRUE(GetPrintBackend()->EnumeratePrinters(&printer_list)); + EXPECT_EQ(GetPrintBackend()->EnumeratePrinters(&printer_list), + mojom::ResultCode::kSuccess); EXPECT_FALSE(printer_list.empty()); DLOG(WARNING) << "Number of printers found: " << printer_list.size(); @@ -48,7 +50,8 @@ TEST_F(PrintBackendTest, MANUAL_EnumeratePrintersNoneInstalled) { PrinterList printer_list; - EXPECT_TRUE(GetPrintBackend()->EnumeratePrinters(&printer_list)); + EXPECT_EQ(GetPrintBackend()->EnumeratePrinters(&printer_list), + mojom::ResultCode::kSuccess); EXPECT_TRUE(printer_list.empty()); }
diff --git a/printing/backend/print_backend_win.cc b/printing/backend/print_backend_win.cc index 7591fbe7..102769b 100644 --- a/printing/backend/print_backend_win.cc +++ b/printing/backend/print_backend_win.cc
@@ -31,6 +31,17 @@ namespace { +// `GetResultCodeFromSystemErrorCode()` is only ever invoked when something has +// gone wrong while interacting with the OS printing system. If the cause of +// the failure was not of the type to register and be and available from +// `GetLastError()` then we should just use the general error result. +mojom::ResultCode GetResultCodeFromSystemErrorCode( + logging::SystemErrorCode system_code) { + if (system_code == ERROR_ACCESS_DENIED) + return mojom::ResultCode::kAccessDenied; + return mojom::ResultCode::kFailed; +} + ScopedPrinterHandle GetPrinterHandle(const std::string& printer_name) { ScopedPrinterHandle handle; handle.OpenPrinterWithName(base::UTF8ToWide(printer_name).c_str()); @@ -174,15 +185,17 @@ explicit PrintBackendWin(const std::string& locale) : PrintBackend(locale) {} // PrintBackend implementation. - bool EnumeratePrinters(PrinterList* printer_list) override; + mojom::ResultCode EnumeratePrinters(PrinterList* printer_list) override; std::string GetDefaultPrinterName() override; - bool GetPrinterBasicInfo(const std::string& printer_name, - PrinterBasicInfo* printer_info) override; - bool GetPrinterSemanticCapsAndDefaults( + mojom::ResultCode GetPrinterBasicInfo( + const std::string& printer_name, + PrinterBasicInfo* printer_info) override; + mojom::ResultCode GetPrinterSemanticCapsAndDefaults( const std::string& printer_name, PrinterSemanticCapsAndDefaults* printer_info) override; - bool GetPrinterCapsAndDefaults(const std::string& printer_name, - PrinterCapsAndDefaults* printer_info) override; + mojom::ResultCode GetPrinterCapsAndDefaults( + const std::string& printer_name, + PrinterCapsAndDefaults* printer_info) override; std::string GetPrinterDriverInfo(const std::string& printer_name) override; bool IsValidPrinter(const std::string& printer_name) override; @@ -190,7 +203,8 @@ ~PrintBackendWin() override = default; }; -bool PrintBackendWin::EnumeratePrinters(PrinterList* printer_list) { +mojom::ResultCode PrintBackendWin::EnumeratePrinters( + PrinterList* printer_list) { DCHECK(printer_list); DWORD bytes_needed = 0; DWORD count_returned = 0; @@ -201,7 +215,7 @@ // No bytes needed could mean the operation failed or that there are simply // no printer drivers installed. Rely upon system error code to // distinguish between these. - return logging::GetLastSystemErrorCode() == ERROR_SUCCESS; + return GetResultCodeFromSystemErrorCode(logging::GetLastSystemErrorCode()); } auto printer_info_buffer = std::make_unique<BYTE[]>(bytes_needed); @@ -209,7 +223,7 @@ kLevel, printer_info_buffer.get(), bytes_needed, &bytes_needed, &count_returned)) { NOTREACHED(); - return false; + return GetResultCodeFromSystemErrorCode(logging::GetLastSystemErrorCode()); } std::string default_printer = GetDefaultPrinterName(); @@ -224,7 +238,7 @@ printer_list->push_back(info); } } - return true; + return mojom::ResultCode::kSuccess; } std::string PrintBackendWin::GetDefaultPrinterName() { @@ -238,32 +252,38 @@ return ret; } -bool PrintBackendWin::GetPrinterBasicInfo(const std::string& printer_name, - PrinterBasicInfo* printer_info) { +mojom::ResultCode PrintBackendWin::GetPrinterBasicInfo( + const std::string& printer_name, + PrinterBasicInfo* printer_info) { ScopedPrinterHandle printer_handle = GetPrinterHandle(printer_name); if (!printer_handle.IsValid()) - return false; + return GetResultCodeFromSystemErrorCode(logging::GetLastSystemErrorCode()); - if (!InitBasicPrinterInfo(printer_handle.Get(), printer_info)) - return false; + if (!InitBasicPrinterInfo(printer_handle.Get(), printer_info)) { + // InitBasicPrinterInfo() doesn't set a system error code, so just treat as + // general failure. + return mojom::ResultCode::kFailed; + } std::string default_printer = GetDefaultPrinterName(); printer_info->is_default = (printer_info->printer_name == default_printer); - return true; + return mojom::ResultCode::kSuccess; } -bool PrintBackendWin::GetPrinterSemanticCapsAndDefaults( +mojom::ResultCode PrintBackendWin::GetPrinterSemanticCapsAndDefaults( const std::string& printer_name, PrinterSemanticCapsAndDefaults* printer_info) { ScopedPrinterHandle printer_handle = GetPrinterHandle(printer_name); if (!printer_handle.IsValid()) { - LOG(WARNING) << "Failed to open printer, error = " << GetLastError(); - return false; + logging::SystemErrorCode err = logging::GetLastSystemErrorCode(); + LOG(WARNING) << "Failed to open printer, error = " + << logging::SystemErrorCodeToString(err); + return GetResultCodeFromSystemErrorCode(err); } PrinterInfo5 info_5; if (!info_5.Init(printer_handle.Get())) - return false; + return GetResultCodeFromSystemErrorCode(logging::GetLastSystemErrorCode()); const wchar_t* name = info_5.get()->pPrinterName; const wchar_t* port = info_5.get()->pPortName; DCHECK_EQ(name, base::UTF8ToWide(printer_name)); @@ -322,10 +342,10 @@ LoadDpi(name, port, user_settings.get(), &caps); *printer_info = caps; - return true; + return mojom::ResultCode::kSuccess; } -bool PrintBackendWin::GetPrinterCapsAndDefaults( +mojom::ResultCode PrintBackendWin::GetPrinterCapsAndDefaults( const std::string& printer_name, PrinterCapsAndDefaults* printer_info) { DCHECK(printer_info); @@ -334,13 +354,13 @@ CHECK(xps_initializer.initialized()); if (!IsValidPrinter(printer_name)) - return false; + return GetResultCodeFromSystemErrorCode(logging::GetLastSystemErrorCode()); HPTPROVIDER provider = nullptr; std::wstring wide_printer_name = base::UTF8ToWide(printer_name); HRESULT hr = XPSModule::OpenProvider(wide_printer_name, 1, &provider); if (!provider) - return true; + return mojom::ResultCode::kSuccess; { Microsoft::WRL::ComPtr<IStream> print_capabilities_stream; @@ -352,7 +372,9 @@ provider, nullptr, print_capabilities_stream.Get(), error.Receive()); DCHECK(SUCCEEDED(hr)); if (FAILED(hr)) { - return false; + // Failures from getting print capabilities don't give a system error, + // so just indicate general failure. + return mojom::ResultCode::kFailed; } hr = StreamOnHGlobalToString(print_capabilities_stream.Get(), &printer_info->printer_capabilities); @@ -363,8 +385,10 @@ if (printer_handle.OpenPrinterWithName(wide_printer_name.c_str())) { std::unique_ptr<DEVMODE, base::FreeDeleter> devmode_out( CreateDevMode(printer_handle.Get(), nullptr)); - if (!devmode_out) - return false; + if (!devmode_out) { + return GetResultCodeFromSystemErrorCode( + logging::GetLastSystemErrorCode()); + } Microsoft::WRL::ComPtr<IStream> printer_defaults_stream; hr = CreateStreamOnHGlobal(nullptr, TRUE, &printer_defaults_stream); DCHECK(SUCCEEDED(hr)); @@ -384,7 +408,7 @@ } XPSModule::CloseProvider(provider); } - return true; + return mojom::ResultCode::kSuccess; } // Gets the information about driver for a specific printer.
diff --git a/printing/backend/test_print_backend.cc b/printing/backend/test_print_backend.cc index 49b27599..61c582d5 100644 --- a/printing/backend/test_print_backend.cc +++ b/printing/backend/test_print_backend.cc
@@ -10,19 +10,46 @@ #include "base/check.h" #include "base/containers/contains.h" +#include "base/location.h" #include "base/logging.h" #include "printing/backend/print_backend.h" +#include "printing/mojom/print.mojom.h" namespace printing { +namespace { + +mojom::ResultCode ReportErrorAccessDenied(const base::Location& from_here) { + DLOG(ERROR) << from_here.ToString() << " failed, access denied"; + return mojom::ResultCode::kAccessDenied; +} + +mojom::ResultCode ReportErrorNoData(const base::Location& from_here) { + DLOG(ERROR) << from_here.ToString() << " failed, no data"; + return mojom::ResultCode::kFailed; +} + +mojom::ResultCode ReportErrorNoDevice(const base::Location& from_here) { + DLOG(ERROR) << from_here.ToString() << " failed, no such device"; + return mojom::ResultCode::kFailed; +} + +mojom::ResultCode ReportErrorNotImplemented(const base::Location& from_here) { + DLOG(ERROR) << from_here.ToString() << " failed, method not implemented"; + return mojom::ResultCode::kFailed; +} + +} // namespace + TestPrintBackend::TestPrintBackend() : PrintBackend(/*locale=*/std::string()) {} TestPrintBackend::~TestPrintBackend() = default; -bool TestPrintBackend::EnumeratePrinters(PrinterList* printer_list) { +mojom::ResultCode TestPrintBackend::EnumeratePrinters( + PrinterList* printer_list) { DCHECK(printer_list->empty()); if (printer_map_.empty()) - return true; + return mojom::ResultCode::kSuccess; for (const auto& entry : printer_map_) { const std::unique_ptr<PrinterData>& data = entry.second; @@ -31,49 +58,57 @@ if (data->info) printer_list->emplace_back(*data->info); } - return true; + return mojom::ResultCode::kSuccess; } std::string TestPrintBackend::GetDefaultPrinterName() { return default_printer_name_; } -bool TestPrintBackend::GetPrinterBasicInfo(const std::string& printer_name, - PrinterBasicInfo* printer_info) { +mojom::ResultCode TestPrintBackend::GetPrinterBasicInfo( + const std::string& printer_name, + PrinterBasicInfo* printer_info) { auto found = printer_map_.find(printer_name); - if (found == printer_map_.end()) - return false; // Matching entry not found. + if (found == printer_map_.end()) { + // Matching entry not found. + return ReportErrorNoDevice(FROM_HERE); + } + + const std::unique_ptr<PrinterData>& data = found->second; + if (data->blocked_by_permissions) + return ReportErrorAccessDenied(FROM_HERE); // Basic info might not have been provided. - const std::unique_ptr<PrinterData>& data = found->second; if (!data->info) - return false; + return ReportErrorNoData(FROM_HERE); *printer_info = *data->info; - return true; + return mojom::ResultCode::kSuccess; } -bool TestPrintBackend::GetPrinterSemanticCapsAndDefaults( +mojom::ResultCode TestPrintBackend::GetPrinterSemanticCapsAndDefaults( const std::string& printer_name, PrinterSemanticCapsAndDefaults* printer_caps) { auto found = printer_map_.find(printer_name); if (found == printer_map_.end()) - return false; + return ReportErrorNoDevice(FROM_HERE); + + const std::unique_ptr<PrinterData>& data = found->second; + if (data->blocked_by_permissions) + return ReportErrorAccessDenied(FROM_HERE); // Capabilities might not have been provided. - const std::unique_ptr<PrinterData>& data = found->second; if (!data->caps) - return false; + return ReportErrorNoData(FROM_HERE); *printer_caps = *data->caps; - return true; + return mojom::ResultCode::kSuccess; } -bool TestPrintBackend::GetPrinterCapsAndDefaults( +mojom::ResultCode TestPrintBackend::GetPrinterCapsAndDefaults( const std::string& printer_name, PrinterCapsAndDefaults* printer_caps) { - // not implemented - return false; + return ReportErrorNotImplemented(FROM_HERE); } std::string TestPrintBackend::GetPrinterDriverInfo( @@ -112,11 +147,25 @@ const std::string& printer_name, std::unique_ptr<PrinterSemanticCapsAndDefaults> caps, std::unique_ptr<PrinterBasicInfo> info) { + AddPrinter(printer_name, std::move(caps), std::move(info), + /*blocked_by_permissions=*/false); +} + +void TestPrintBackend::AddAccessDeniedPrinter(const std::string& printer_name) { + AddPrinter(printer_name, /*caps=*/nullptr, /*info=*/nullptr, + /*blocked_by_permissions=*/true); +} + +void TestPrintBackend::AddPrinter( + const std::string& printer_name, + std::unique_ptr<PrinterSemanticCapsAndDefaults> caps, + std::unique_ptr<PrinterBasicInfo> info, + bool blocked_by_permissions) { DCHECK(!printer_name.empty()); const bool is_default = info && info->is_default; - printer_map_[printer_name] = - std::make_unique<PrinterData>(std::move(caps), std::move(info)); + printer_map_[printer_name] = std::make_unique<PrinterData>( + std::move(caps), std::move(info), blocked_by_permissions); // Ensure that default settings are honored if more than one is attempted to // be marked as default or if this prior default should no longer be so. @@ -128,8 +177,11 @@ TestPrintBackend::PrinterData::PrinterData( std::unique_ptr<PrinterSemanticCapsAndDefaults> caps, - std::unique_ptr<PrinterBasicInfo> info) - : caps(std::move(caps)), info(std::move(info)) {} + std::unique_ptr<PrinterBasicInfo> info, + bool blocked_by_permissions) + : caps(std::move(caps)), + info(std::move(info)), + blocked_by_permissions(blocked_by_permissions) {} TestPrintBackend::PrinterData::~PrinterData() = default;
diff --git a/printing/backend/test_print_backend.h b/printing/backend/test_print_backend.h index 17ff074..b8b910d 100644 --- a/printing/backend/test_print_backend.h +++ b/printing/backend/test_print_backend.h
@@ -10,6 +10,7 @@ #include "base/containers/flat_map.h" #include "printing/backend/print_backend.h" +#include "printing/mojom/print.mojom.h" namespace printing { @@ -20,15 +21,17 @@ TestPrintBackend(); // PrintBackend overrides - bool EnumeratePrinters(PrinterList* printer_list) override; + mojom::ResultCode EnumeratePrinters(PrinterList* printer_list) override; std::string GetDefaultPrinterName() override; - bool GetPrinterBasicInfo(const std::string& printer_name, - PrinterBasicInfo* printer_info) override; - bool GetPrinterSemanticCapsAndDefaults( + mojom::ResultCode GetPrinterBasicInfo( + const std::string& printer_name, + PrinterBasicInfo* printer_info) override; + mojom::ResultCode GetPrinterSemanticCapsAndDefaults( const std::string& printer_name, PrinterSemanticCapsAndDefaults* printer_info) override; - bool GetPrinterCapsAndDefaults(const std::string& printer_name, - PrinterCapsAndDefaults* printer_info) override; + mojom::ResultCode GetPrinterCapsAndDefaults( + const std::string& printer_name, + PrinterCapsAndDefaults* printer_info) override; std::string GetPrinterDriverInfo(const std::string& printer_name) override; bool IsValidPrinter(const std::string& printer_name) override; @@ -50,17 +53,28 @@ std::unique_ptr<PrinterSemanticCapsAndDefaults> caps, std::unique_ptr<PrinterBasicInfo> info); + // Adds a printer which will fail with an access-denied permission error for + // calls specific to a particular `printer_name`. + void AddAccessDeniedPrinter(const std::string& printer_name); + protected: ~TestPrintBackend() override; private: + void AddPrinter(const std::string& printer_name, + std::unique_ptr<PrinterSemanticCapsAndDefaults> caps, + std::unique_ptr<PrinterBasicInfo> info, + bool blocked_by_permissions); + struct PrinterData { PrinterData(std::unique_ptr<PrinterSemanticCapsAndDefaults> caps, - std::unique_ptr<PrinterBasicInfo> info); + std::unique_ptr<PrinterBasicInfo> info, + bool blocked_by_permissions); ~PrinterData(); std::unique_ptr<PrinterSemanticCapsAndDefaults> caps; std::unique_ptr<PrinterBasicInfo> info; + bool blocked_by_permissions = false; }; std::string default_printer_name_;
diff --git a/printing/backend/test_print_backend_unittest.cc b/printing/backend/test_print_backend_unittest.cc index a2506699..f9e5ba82 100644 --- a/printing/backend/test_print_backend_unittest.cc +++ b/printing/backend/test_print_backend_unittest.cc
@@ -26,6 +26,7 @@ constexpr char kDefaultPrinterName[] = "default-test-printer"; constexpr char kAlternatePrinterName[] = "alternate-test-printer"; constexpr char kNullDataPrinterName[] = "null-data-test-printer"; +constexpr char kAccessDeniedPrinterName[] = "access-denied-test-printer"; constexpr char kInvalidPrinterName[] = "invalid-test-printer"; constexpr int kDefaultPrinterStatus = 0; @@ -77,6 +78,10 @@ /*info=*/nullptr); } + void AddAccessDeniedPrinter() { + test_print_backend_->AddAccessDeniedPrinter(kAccessDeniedPrinterName); + } + // Get the test print backend. TestPrintBackend* GetPrintBackend() { return test_print_backend_.get(); } @@ -90,7 +95,8 @@ AddPrinters(); - EXPECT_TRUE(GetPrintBackend()->EnumeratePrinters(&printer_list)); + EXPECT_EQ(GetPrintBackend()->EnumeratePrinters(&printer_list), + mojom::ResultCode::kSuccess); EXPECT_THAT(printer_list, testing::ContainerEq(kPrinterList)); } @@ -99,7 +105,8 @@ PrinterList printer_list; // Should return true even when there are no printers in the environment. - EXPECT_TRUE(GetPrintBackend()->EnumeratePrinters(&printer_list)); + EXPECT_EQ(GetPrintBackend()->EnumeratePrinters(&printer_list), + mojom::ResultCode::kSuccess); EXPECT_TRUE(printer_list.empty()); } @@ -142,72 +149,105 @@ AddPrinters(); - EXPECT_TRUE(GetPrintBackend()->GetPrinterBasicInfo(kDefaultPrinterName, - &printer_info)); + EXPECT_EQ(GetPrintBackend()->GetPrinterBasicInfo(kDefaultPrinterName, + &printer_info), + mojom::ResultCode::kSuccess); EXPECT_EQ(printer_info.printer_name, kDefaultPrinterName); EXPECT_EQ(printer_info.printer_status, kDefaultPrinterStatus); EXPECT_TRUE(printer_info.is_default); - EXPECT_TRUE(GetPrintBackend()->GetPrinterBasicInfo(kAlternatePrinterName, - &printer_info)); + EXPECT_EQ(GetPrintBackend()->GetPrinterBasicInfo(kAlternatePrinterName, + &printer_info), + mojom::ResultCode::kSuccess); EXPECT_EQ(printer_info.printer_name, kAlternatePrinterName); EXPECT_EQ(printer_info.printer_status, kAlternatePrinterStatus); EXPECT_FALSE(printer_info.is_default); - EXPECT_FALSE(GetPrintBackend()->GetPrinterBasicInfo(kInvalidPrinterName, - &printer_info)); + EXPECT_EQ(GetPrintBackend()->GetPrinterBasicInfo(kInvalidPrinterName, + &printer_info), + mojom::ResultCode::kFailed); // Changing default should be reflected on next query. GetPrintBackend()->SetDefaultPrinterName(kAlternatePrinterName); - EXPECT_TRUE(GetPrintBackend()->GetPrinterBasicInfo(kAlternatePrinterName, - &printer_info)); + EXPECT_EQ(GetPrintBackend()->GetPrinterBasicInfo(kAlternatePrinterName, + &printer_info), + mojom::ResultCode::kSuccess); EXPECT_TRUE(printer_info.is_default); - EXPECT_TRUE(GetPrintBackend()->GetPrinterBasicInfo(kDefaultPrinterName, - &printer_info)); + EXPECT_EQ(GetPrintBackend()->GetPrinterBasicInfo(kDefaultPrinterName, + &printer_info), + mojom::ResultCode::kSuccess); EXPECT_FALSE(printer_info.is_default); // Printers added with null basic info fail to get data on a query. - EXPECT_FALSE(GetPrintBackend()->GetPrinterBasicInfo(kNullDataPrinterName, - &printer_info)); + EXPECT_EQ(GetPrintBackend()->GetPrinterBasicInfo(kNullDataPrinterName, + &printer_info), + mojom::ResultCode::kFailed); // Verify that (re)adding a printer with null basic info results in a failure // the next time when trying to get the basic info. GetPrintBackend()->AddValidPrinter(kAlternatePrinterName, /*caps=*/nullptr, /*info=*/nullptr); - EXPECT_FALSE(GetPrintBackend()->GetPrinterBasicInfo(kAlternatePrinterName, - &printer_info)); + EXPECT_EQ(GetPrintBackend()->GetPrinterBasicInfo(kAlternatePrinterName, + &printer_info), + mojom::ResultCode::kFailed); +} + +TEST_F(TestPrintBackendTest, PrinterBasicInfoAccessDenied) { + PrinterBasicInfo printer_info; + + AddAccessDeniedPrinter(); + + EXPECT_EQ(GetPrintBackend()->GetPrinterBasicInfo(kAccessDeniedPrinterName, + &printer_info), + mojom::ResultCode::kAccessDenied); } TEST_F(TestPrintBackendTest, GetPrinterSemanticCapsAndDefaults) { PrinterSemanticCapsAndDefaults caps; // Should fail when there are no printers in the environment. - EXPECT_FALSE(GetPrintBackend()->GetPrinterSemanticCapsAndDefaults( - kDefaultPrinterName, &caps)); + EXPECT_EQ(GetPrintBackend()->GetPrinterSemanticCapsAndDefaults( + kDefaultPrinterName, &caps), + mojom::ResultCode::kFailed); AddPrinters(); - EXPECT_TRUE(GetPrintBackend()->GetPrinterSemanticCapsAndDefaults( - kDefaultPrinterName, &caps)); + EXPECT_EQ(GetPrintBackend()->GetPrinterSemanticCapsAndDefaults( + kDefaultPrinterName, &caps), + mojom::ResultCode::kSuccess); EXPECT_EQ(caps.copies_max, kDefaultCopiesMax); - EXPECT_TRUE(GetPrintBackend()->GetPrinterSemanticCapsAndDefaults( - kAlternatePrinterName, &caps)); + EXPECT_EQ(GetPrintBackend()->GetPrinterSemanticCapsAndDefaults( + kAlternatePrinterName, &caps), + mojom::ResultCode::kSuccess); EXPECT_EQ(caps.copies_max, kAlternateCopiesMax); - EXPECT_FALSE(GetPrintBackend()->GetPrinterSemanticCapsAndDefaults( - kInvalidPrinterName, &caps)); + EXPECT_EQ(GetPrintBackend()->GetPrinterSemanticCapsAndDefaults( + kInvalidPrinterName, &caps), + mojom::ResultCode::kFailed); // Printers added with null capabilities fail to get data on a query. - EXPECT_FALSE(GetPrintBackend()->GetPrinterSemanticCapsAndDefaults( - kNullDataPrinterName, &caps)); + EXPECT_EQ(GetPrintBackend()->GetPrinterSemanticCapsAndDefaults( + kNullDataPrinterName, &caps), + mojom::ResultCode::kFailed); // Verify that (re)adding a printer with null capabilities results in a // failure the next time when trying to get capabilities. GetPrintBackend()->AddValidPrinter(kAlternatePrinterName, /*caps=*/nullptr, /*info=*/nullptr); - EXPECT_FALSE(GetPrintBackend()->GetPrinterSemanticCapsAndDefaults( - kAlternatePrinterName, &caps)); + EXPECT_EQ(GetPrintBackend()->GetPrinterSemanticCapsAndDefaults( + kAlternatePrinterName, &caps), + mojom::ResultCode::kFailed); +} + +TEST_F(TestPrintBackendTest, GetPrinterSemanticCapsAndDefaultsAccessDenied) { + PrinterSemanticCapsAndDefaults caps; + + AddAccessDeniedPrinter(); + + EXPECT_EQ(GetPrintBackend()->GetPrinterSemanticCapsAndDefaults( + kAccessDeniedPrinterName, &caps), + mojom::ResultCode::kAccessDenied); } TEST_F(TestPrintBackendTest, IsValidPrinter) {
diff --git a/printing/mojom/print.mojom b/printing/mojom/print.mojom index b32eb76..2c97229 100644 --- a/printing/mojom/print.mojom +++ b/printing/mojom/print.mojom
@@ -126,3 +126,12 @@ kPin = 1, kNoPin = 2, }; + +// Result codes distilled from system error codes. +enum ResultCode { + kSuccess, + // Generic code for uncategorized errors. + kFailed, + // Insufficient permissions to perform the operation. + kAccessDenied, +};
diff --git a/remoting/base/telemetry_log_writer.h b/remoting/base/telemetry_log_writer.h index 39feb1a..c9bd66a 100644 --- a/remoting/base/telemetry_log_writer.h +++ b/remoting/base/telemetry_log_writer.h
@@ -13,7 +13,6 @@ #include "base/memory/scoped_refptr.h" #include "base/threading/thread_checker.h" #include "base/timer/timer.h" -#include "base/values.h" #include "net/base/backoff_entry.h" #include "remoting/base/chromoting_event.h" #include "remoting/base/chromoting_event_log_writer.h"
diff --git a/remoting/host/host_settings.h b/remoting/host/host_settings.h index 722d9f7..838aeaf0c 100644 --- a/remoting/host/host_settings.h +++ b/remoting/host/host_settings.h
@@ -7,8 +7,6 @@ #include <string> -#include "base/values.h" - namespace remoting { using HostSettingKey = char[];
diff --git a/remoting/host/host_settings_mac.cc b/remoting/host/host_settings_mac.cc index fc9121c8..ffb118e 100644 --- a/remoting/host/host_settings_mac.cc +++ b/remoting/host/host_settings_mac.cc
@@ -8,6 +8,7 @@ #include "base/json/json_file_value_serializer.h" #include "base/logging.h" #include "base/no_destructor.h" +#include "base/values.h" #include "remoting/base/logging.h" #include "remoting/host/mac/constants_mac.h"
diff --git a/remoting/host/host_settings_mac.h b/remoting/host/host_settings_mac.h index 30eddc7b..86c0a65bd 100644 --- a/remoting/host/host_settings_mac.h +++ b/remoting/host/host_settings_mac.h
@@ -9,6 +9,10 @@ #include "remoting/host/host_settings.h" +namespace base { +class Value; +} + namespace remoting { class HostSettingsMac final : public HostSettings {
diff --git a/remoting/host/policy_watcher_unittest.cc b/remoting/host/policy_watcher_unittest.cc index c1efa44..c6b65629 100644 --- a/remoting/host/policy_watcher_unittest.cc +++ b/remoting/host/policy_watcher_unittest.cc
@@ -800,7 +800,7 @@ StartWatching(); std::unique_ptr<base::DictionaryValue> effective_policies = policy_watcher_->GetEffectivePolicies(); - ASSERT_EQ(0u, effective_policies->size()); + ASSERT_EQ(0u, effective_policies->DictSize()); } TEST_F(PolicyWatcherTest, GetPlatformPolicies) { @@ -811,9 +811,9 @@ OnPolicyUpdatePtr(IsPolicies(&nat_false_))); StartWatching(); - ASSERT_EQ(0u, policy_watcher_->GetPlatformPolicies()->size()); + ASSERT_EQ(0u, policy_watcher_->GetPlatformPolicies()->DictSize()); SetPolicies(nat_false_); - ASSERT_EQ(1u, policy_watcher_->GetPlatformPolicies()->size()); + ASSERT_EQ(1u, policy_watcher_->GetPlatformPolicies()->DictSize()); } TEST_F(PolicyWatcherTest, GetPlatformPoliciesMultipleOverrides) { @@ -828,13 +828,13 @@ OnPolicyUpdatePtr(IsPolicies(&nat_true_domain_empty_))); StartWatching(); - ASSERT_EQ(0u, policy_watcher_->GetPlatformPolicies()->size()); + ASSERT_EQ(0u, policy_watcher_->GetPlatformPolicies()->DictSize()); SetPolicies(domain_full_); - ASSERT_EQ(1u, policy_watcher_->GetPlatformPolicies()->size()); + ASSERT_EQ(1u, policy_watcher_->GetPlatformPolicies()->DictSize()); SetPolicies(nat_false_domain_full_); - ASSERT_EQ(2u, policy_watcher_->GetPlatformPolicies()->size()); + ASSERT_EQ(2u, policy_watcher_->GetPlatformPolicies()->DictSize()); SetPolicies(nat_true_domain_empty_); - ASSERT_EQ(2u, policy_watcher_->GetPlatformPolicies()->size()); + ASSERT_EQ(2u, policy_watcher_->GetPlatformPolicies()->DictSize()); } TEST_F(PolicyWatcherTest, GetPlatformPoliciesError) { @@ -842,7 +842,7 @@ SetPolicies(nat_one_); StartWatching(); - ASSERT_EQ(0u, policy_watcher_->GetPlatformPolicies()->size()); + ASSERT_EQ(0u, policy_watcher_->GetPlatformPolicies()->DictSize()); } } // namespace remoting
diff --git a/sandbox/win/src/sandbox_policy_diagnostic.h b/sandbox/win/src/sandbox_policy_diagnostic.h index 981215d4..89982a3f 100644 --- a/sandbox/win/src/sandbox_policy_diagnostic.h +++ b/sandbox/win/src/sandbox_policy_diagnostic.h
@@ -12,7 +12,6 @@ #include <vector> #include "base/macros.h" -#include "base/values.h" #include "sandbox/win/src/app_container.h" #include "sandbox/win/src/handle_closer.h" #include "sandbox/win/src/policy_low_level.h"
diff --git a/services/device/public/cpp/bluetooth/bluetooth_utils_unittest.cc b/services/device/public/cpp/bluetooth/bluetooth_utils_unittest.cc index 21755d2..303645f 100644 --- a/services/device/public/cpp/bluetooth/bluetooth_utils_unittest.cc +++ b/services/device/public/cpp/bluetooth/bluetooth_utils_unittest.cc
@@ -21,7 +21,9 @@ constexpr std::array<uint8_t, 6> kAddress = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; constexpr char kName[] = "Foo Bar"; +constexpr char16_t kName16[] = u"Foo Bar"; constexpr char kUnicodeName[] = "❤❤❤❤"; +constexpr char16_t kUnicodeName16[] = u"❤❤❤❤"; constexpr char kEmptyName[] = ""; constexpr char kWhitespaceName[] = " "; constexpr char kUnicodeWhitespaceName[] = " "; @@ -62,7 +64,7 @@ info->address = kAddress; info->name = kName; info->device_type = BluetoothDeviceInfo::DeviceType::kUnknown; - EXPECT_EQ(base::UTF8ToUTF16(kName), GetBluetoothDeviceNameForDisplay(info)); + EXPECT_EQ(kName16, GetBluetoothDeviceNameForDisplay(info)); } TEST(BluetoothUtilsTest, @@ -71,7 +73,7 @@ info->address = kAddress; info->name = kName; info->device_type = BluetoothDeviceInfo::DeviceType::kComputer; - EXPECT_EQ(base::UTF8ToUTF16(kName), GetBluetoothDeviceNameForDisplay(info)); + EXPECT_EQ(kName16, GetBluetoothDeviceNameForDisplay(info)); } TEST(BluetoothUtilsTest, GetBluetoothDeviceNameForDisplay_UnicodeName) { @@ -79,8 +81,7 @@ info->address = kAddress; info->name = kUnicodeName; info->device_type = BluetoothDeviceInfo::DeviceType::kComputer; - EXPECT_EQ(base::UTF8ToUTF16(kUnicodeName), - GetBluetoothDeviceNameForDisplay(info)); + EXPECT_EQ(kUnicodeName16, GetBluetoothDeviceNameForDisplay(info)); } TEST(BluetoothUtilsTest, GetBluetoothDeviceNameForDisplay_EmptyName) { @@ -129,15 +130,14 @@ TEST(BluetoothUtilsTest, GetBluetoothDeviceLabelForAccessibility) { EXPECT_EQ( l10n_util::GetStringFUTF16( - IDS_BLUETOOTH_ACCESSIBILITY_DEVICE_TYPE_COMPUTER, - base::UTF8ToUTF16(kName)), + IDS_BLUETOOTH_ACCESSIBILITY_DEVICE_TYPE_COMPUTER, kName16), LabelFromTypeWithName(BluetoothDeviceInfo::DeviceType::kComputer, kName)); - EXPECT_EQ(l10n_util::GetStringFUTF16( - IDS_BLUETOOTH_ACCESSIBILITY_DEVICE_TYPE_CAR_AUDIO, - base::UTF8ToUTF16(kUnicodeName)), - LabelFromTypeWithName(BluetoothDeviceInfo::DeviceType::kCarAudio, - kUnicodeName)); + EXPECT_EQ( + l10n_util::GetStringFUTF16( + IDS_BLUETOOTH_ACCESSIBILITY_DEVICE_TYPE_CAR_AUDIO, kUnicodeName16), + LabelFromTypeWithName(BluetoothDeviceInfo::DeviceType::kCarAudio, + kUnicodeName)); EXPECT_EQ(l10n_util::GetStringFUTF16( IDS_BLUETOOTH_ACCESSIBILITY_DEVICE_TYPE_KEYBOARD, u"00:00:00:00:00:00"),
diff --git a/services/network/first_party_sets/first_party_set_parser.h b/services/network/first_party_sets/first_party_set_parser.h index 93b1ef1..a6bf0f3 100644 --- a/services/network/first_party_sets/first_party_set_parser.h +++ b/services/network/first_party_sets/first_party_set_parser.h
@@ -13,7 +13,6 @@ #include "base/containers/flat_map.h" #include "base/optional.h" #include "base/strings/string_piece_forward.h" -#include "base/values.h" namespace net { class SchemefulSite;
diff --git a/services/network/trust_tokens/test/trust_token_test_util.h b/services/network/trust_tokens/test/trust_token_test_util.h index af2bbad..2d3979f 100644 --- a/services/network/trust_tokens/test/trust_token_test_util.h +++ b/services/network/trust_tokens/test/trust_token_test_util.h
@@ -13,7 +13,6 @@ #include "base/json/json_string_value_serializer.h" #include "base/strings/string_piece.h" #include "base/test/task_environment.h" -#include "base/values.h" #include "net/log/net_log.h" #include "net/log/test_net_log.h" #include "net/log/test_net_log_util.h"
diff --git a/testing/buildbot/chromium.android.fyi.json b/testing/buildbot/chromium.android.fyi.json index fa3e00f..10653df 100644 --- a/testing/buildbot/chromium.android.fyi.json +++ b/testing/buildbot/chromium.android.fyi.json
@@ -4754,11 +4754,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Client Library Skew Tests For 91.0.4472.48" + "weblayer_instrumentation_test_versions_apk_Client Library Skew Tests For 91.0.4472.49" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Client Library Skew Tests For 91.0.4472.48", + "name": "weblayer_instrumentation_test_versions_apk_Client Library Skew Tests For 91.0.4472.49", "resultdb": { "enable": true }, @@ -4768,7 +4768,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M91", - "revision": "version:91.0.4472.48" + "revision": "version:91.0.4472.49" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -4991,11 +4991,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Implementation Library Skew Tests For 91.0.4472.48" + "weblayer_instrumentation_test_versions_apk_Implementation Library Skew Tests For 91.0.4472.49" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Implementation Library Skew Tests For 91.0.4472.48", + "name": "weblayer_instrumentation_test_versions_apk_Implementation Library Skew Tests For 91.0.4472.49", "resultdb": { "enable": true }, @@ -5005,7 +5005,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M91", - "revision": "version:91.0.4472.48" + "revision": "version:91.0.4472.49" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}",
diff --git a/testing/buildbot/chromium.android.json b/testing/buildbot/chromium.android.json index d05cdd11..417fe40 100644 --- a/testing/buildbot/chromium.android.json +++ b/testing/buildbot/chromium.android.json
@@ -53918,11 +53918,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_with_chrome_apk_Client Library Skew Tests For 91.0.4472.48" + "weblayer_instrumentation_test_versions_with_chrome_apk_Client Library Skew Tests For 91.0.4472.49" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_with_chrome_apk_Client Library Skew Tests For 91.0.4472.48", + "name": "weblayer_instrumentation_test_versions_with_chrome_apk_Client Library Skew Tests For 91.0.4472.49", "resultdb": { "enable": true }, @@ -53932,7 +53932,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M91", - "revision": "version:91.0.4472.48" + "revision": "version:91.0.4472.49" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -54158,11 +54158,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_with_chrome_apk_Implementation Library Skew Tests For 91.0.4472.48" + "weblayer_instrumentation_test_versions_with_chrome_apk_Implementation Library Skew Tests For 91.0.4472.49" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_with_chrome_apk_Implementation Library Skew Tests For 91.0.4472.48", + "name": "weblayer_instrumentation_test_versions_with_chrome_apk_Implementation Library Skew Tests For 91.0.4472.49", "resultdb": { "enable": true }, @@ -54172,7 +54172,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M91", - "revision": "version:91.0.4472.48" + "revision": "version:91.0.4472.49" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -54462,11 +54462,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Client Library Skew Tests For 91.0.4472.48" + "weblayer_instrumentation_test_versions_apk_Client Library Skew Tests For 91.0.4472.49" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Client Library Skew Tests For 91.0.4472.48", + "name": "weblayer_instrumentation_test_versions_apk_Client Library Skew Tests For 91.0.4472.49", "resultdb": { "enable": true }, @@ -54476,7 +54476,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M91", - "revision": "version:91.0.4472.48" + "revision": "version:91.0.4472.49" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -54699,11 +54699,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Implementation Library Skew Tests For 91.0.4472.48" + "weblayer_instrumentation_test_versions_apk_Implementation Library Skew Tests For 91.0.4472.49" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Implementation Library Skew Tests For 91.0.4472.48", + "name": "weblayer_instrumentation_test_versions_apk_Implementation Library Skew Tests For 91.0.4472.49", "resultdb": { "enable": true }, @@ -54713,7 +54713,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M91", - "revision": "version:91.0.4472.48" + "revision": "version:91.0.4472.49" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -55003,11 +55003,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Client Library Skew Tests For 91.0.4472.48" + "weblayer_instrumentation_test_versions_apk_Client Library Skew Tests For 91.0.4472.49" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Client Library Skew Tests For 91.0.4472.48", + "name": "weblayer_instrumentation_test_versions_apk_Client Library Skew Tests For 91.0.4472.49", "resultdb": { "enable": true }, @@ -55017,7 +55017,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M91", - "revision": "version:91.0.4472.48" + "revision": "version:91.0.4472.49" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -55240,11 +55240,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Implementation Library Skew Tests For 91.0.4472.48" + "weblayer_instrumentation_test_versions_apk_Implementation Library Skew Tests For 91.0.4472.49" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Implementation Library Skew Tests For 91.0.4472.48", + "name": "weblayer_instrumentation_test_versions_apk_Implementation Library Skew Tests For 91.0.4472.49", "resultdb": { "enable": true }, @@ -55254,7 +55254,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M91", - "revision": "version:91.0.4472.48" + "revision": "version:91.0.4472.49" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}",
diff --git a/testing/buildbot/chromium.perf.fyi.json b/testing/buildbot/chromium.perf.fyi.json index b0155c26..180b781 100644 --- a/testing/buildbot/chromium.perf.fyi.json +++ b/testing/buildbot/chromium.perf.fyi.json
@@ -32,6 +32,9 @@ "override_compile_targets": [ "performance_test_suite" ], + "resultdb": { + "enable": true + }, "swarming": { "can_use_on_swarming_builders": true, "dimension_sets": [ @@ -78,6 +81,9 @@ "override_compile_targets": [ "performance_test_suite" ], + "resultdb": { + "enable": true + }, "swarming": { "can_use_on_swarming_builders": true, "dimension_sets": [ @@ -128,6 +134,9 @@ "override_compile_targets": [ "performance_test_suite" ], + "resultdb": { + "enable": true + }, "swarming": { "can_use_on_swarming_builders": true, "dimension_sets": [ @@ -193,6 +202,9 @@ "override_compile_targets": [ "performance_test_suite" ], + "resultdb": { + "enable": true + }, "swarming": { "can_use_on_swarming_builders": true, "dimension_sets": [ @@ -252,6 +264,9 @@ "override_compile_targets": [ "performance_web_engine_test_suite" ], + "resultdb": { + "enable": true + }, "swarming": { "can_use_on_swarming_builders": true, "dimension_sets": [ @@ -349,6 +364,9 @@ "override_compile_targets": [ "performance_test_suite" ], + "resultdb": { + "enable": true + }, "swarming": { "can_use_on_swarming_builders": true, "dimension_sets": [
diff --git a/testing/buildbot/variants.pyl b/testing/buildbot/variants.pyl index 2f9947a6..c60de26 100644 --- a/testing/buildbot/variants.pyl +++ b/testing/buildbot/variants.pyl
@@ -346,13 +346,13 @@ '../../weblayer/browser/android/javatests/skew/expectations.txt', '--impl-version=91', ], - 'identifier': 'Implementation Library Skew Tests For 91.0.4472.48', + 'identifier': 'Implementation Library Skew Tests For 91.0.4472.49', 'swarming': { 'cipd_packages': [ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M91', - 'revision': 'version:91.0.4472.48', + 'revision': 'version:91.0.4472.49', } ], }, @@ -418,13 +418,13 @@ '../../weblayer/browser/android/javatests/skew/expectations.txt', '--impl-version=91', ], - 'identifier': 'Implementation Library Skew Tests For 91.0.4472.48', + 'identifier': 'Implementation Library Skew Tests For 91.0.4472.49', 'swarming': { 'cipd_packages': [ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M91', - 'revision': 'version:91.0.4472.48', + 'revision': 'version:91.0.4472.49', } ], }, @@ -490,13 +490,13 @@ '../../weblayer/browser/android/javatests/skew/expectations.txt', '--client-version=91', ], - 'identifier': 'Client Library Skew Tests For 91.0.4472.48', + 'identifier': 'Client Library Skew Tests For 91.0.4472.49', 'swarming': { 'cipd_packages': [ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M91', - 'revision': 'version:91.0.4472.48', + 'revision': 'version:91.0.4472.49', } ], },
diff --git a/third_party/blink/common/page_state/page_state_serialization_unittest.cc b/third_party/blink/common/page_state/page_state_serialization_unittest.cc index 3ed40254..da6ef99 100644 --- a/third_party/blink/common/page_state/page_state_serialization_unittest.cc +++ b/third_party/blink/common/page_state/page_state_serialization_unittest.cc
@@ -197,8 +197,8 @@ frame_state->document_sequence_number = 456; frame_state->page_scale_factor = 2.0f; - frame_state->document_state.push_back(base::UTF8ToUTF16( - "\n\r?% WebKit serialized form state version 8 \n\r=&")); + frame_state->document_state.push_back( + u"\n\r?% WebKit serialized form state version 8 \n\r=&"); frame_state->document_state.push_back(u"form key"); frame_state->document_state.push_back(u"1"); frame_state->document_state.push_back(u"foo"); @@ -459,9 +459,8 @@ ExplodedPageState input; PopulateFrameState(&input.top); - std::string excessive_length_string(kMaxScrollAnchorSelectorLength + 1, 'a'); - - input.top.scroll_anchor_selector = base::UTF8ToUTF16(excessive_length_string); + input.top.scroll_anchor_selector = + std::u16string(kMaxScrollAnchorSelectorLength + 1, u'a'); std::string encoded; EncodePageState(input, &encoded);
diff --git a/third_party/blink/public/platform/TaskTypes.md b/third_party/blink/public/platform/TaskTypes.md index 1b52e7b..b849f06 100644 --- a/third_party/blink/public/platform/TaskTypes.md +++ b/third_party/blink/public/platform/TaskTypes.md
@@ -32,6 +32,7 @@ | Sensor | No | No | Yes | Yes | Yes | Yes | | PerformanceTimeline | No | No | Yes | Yes | Yes | Yes | | WebGL | No | No | Yes | Yes | Yes | Yes | +| WebGPU | No | No | Yes | Yes | Yes | Yes | | IdleTask | No | No | Yes | Yes | Yes | Yes | | MiscPlatformAPI | No | No | Yes | Yes | Yes | Yes | | WorkerAnimation | No | No | No | Yes | Yes | Yes |
diff --git a/third_party/blink/public/platform/task_type.h b/third_party/blink/public/platform/task_type.h index 94aa5c21..d2b2e22 100644 --- a/third_party/blink/public/platform/task_type.h +++ b/third_party/blink/public/platform/task_type.h
@@ -14,7 +14,8 @@ // // When a new task type is created: // * use kCount value as a new value, -// * update tools/metrics/histograms/enums.xml, +// * in tools/metrics/histograms/enums.xml update the +// "RendererSchedulerTaskType" enum // * update TaskTypes.md enum class TaskType : unsigned char { /////////////////////////////////////// @@ -257,6 +258,9 @@ // Tasks that are should use input priority task queue/runner. kInternalInputBlocking = 77, + // Tasks related to the WebGPU API + kWebGPU = 78, + /////////////////////////////////////// // The following task types are only for thread-local queues. /////////////////////////////////////// @@ -284,7 +288,7 @@ kWorkerThreadTaskQueueV8 = 47, kWorkerThreadTaskQueueCompositor = 48, - kCount = 78, + kCount = 79, }; } // namespace blink
diff --git a/third_party/blink/renderer/bindings/core/v8/custom/v8_html_all_collection_custom.cc b/third_party/blink/renderer/bindings/core/v8/custom/v8_html_all_collection_custom.cc index a143285..14dc366 100644 --- a/third_party/blink/renderer/bindings/core/v8/custom/v8_html_all_collection_custom.cc +++ b/third_party/blink/renderer/bindings/core/v8/custom/v8_html_all_collection_custom.cc
@@ -31,7 +31,6 @@ #include "third_party/blink/renderer/bindings/core/v8/v8_html_all_collection.h" #include "third_party/blink/renderer/bindings/core/v8/html_collection_or_element.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/platform/bindings/v8_set_return_value.h" namespace blink {
diff --git a/third_party/blink/renderer/bindings/core/v8/custom_wrappable_adapter.cc b/third_party/blink/renderer/bindings/core/v8/custom_wrappable_adapter.cc index 113918f..1ab638f 100644 --- a/third_party/blink/renderer/bindings/core/v8/custom_wrappable_adapter.cc +++ b/third_party/blink/renderer/bindings/core/v8/custom_wrappable_adapter.cc
@@ -66,8 +66,9 @@ ScriptState* script_state) { DCHECK(wrapper_.IsEmpty()); v8::Isolate* isolate = script_state->GetIsolate(); - v8::Local<v8::Object> wrapper_object = V8DOMWrapper::CreateWrapper( - isolate, script_state->GetContext()->Global(), &custom_wrappable_info); + v8::Local<v8::Object> wrapper_object = + V8DOMWrapper::CreateWrapper(script_state, &custom_wrappable_info) + .ToLocalChecked(); V8DOMWrapper::AssociateObjectWithWrapper( isolate, this, &custom_wrappable_info, wrapper_object); wrapper_.Set(isolate, wrapper_object);
diff --git a/third_party/blink/renderer/bindings/core/v8/to_v8_traits.h b/third_party/blink/renderer/bindings/core/v8/to_v8_traits.h index 02c2077..b298ca7 100644 --- a/third_party/blink/renderer/bindings/core/v8/to_v8_traits.h +++ b/third_party/blink/renderer/bindings/core/v8/to_v8_traits.h
@@ -212,10 +212,7 @@ return wrapper; } - if (!script_wrappable->WrapV2(script_state).ToLocal(&wrapper)) { - return v8::MaybeLocal<v8::Value>(); - } - return wrapper; + return script_wrappable->Wrap(script_state); } // For optimization @@ -233,10 +230,7 @@ CHECK(!creation_context_object.IsEmpty()); ScriptState* script_state = ScriptState::From(creation_context_object->CreationContext()); - if (!script_wrappable->WrapV2(script_state).ToLocal(&wrapper)) { - return v8::MaybeLocal<v8::Value>(); - } - return wrapper; + return script_wrappable->Wrap(script_state); } } // namespace bindings
diff --git a/third_party/blink/renderer/core/exported/web_plugin_container_test.cc b/third_party/blink/renderer/core/exported/web_plugin_container_test.cc index a93b9e0c..179744f 100644 --- a/third_party/blink/renderer/core/exported/web_plugin_container_test.cc +++ b/third_party/blink/renderer/core/exported/web_plugin_container_test.cc
@@ -1490,7 +1490,7 @@ ASSERT_EQ(1u, display_items.size()); ASSERT_EQ(DisplayItem::kForeignLayerPlugin, display_items[0].GetType()); const auto& foreign_layer_display_item = - static_cast<const ForeignLayerDisplayItem&>(display_items[0]); + To<ForeignLayerDisplayItem>(display_items[0]); EXPECT_EQ(plugin->GetCcLayer(), foreign_layer_display_item.GetLayer()); }
diff --git a/third_party/blink/renderer/core/frame/dom_window.cc b/third_party/blink/renderer/core/frame/dom_window.cc index 702069c..3aa427e 100644 --- a/third_party/blink/renderer/core/frame/dom_window.cc +++ b/third_party/blink/renderer/core/frame/dom_window.cc
@@ -54,24 +54,7 @@ DCHECK(!frame_); } -v8::Local<v8::Value> DOMWindow::Wrap(v8::Isolate* isolate, - v8::Local<v8::Object> creation_context) { - // TODO(yukishiino): Get understanding of why it's possible to initialize - // the context after the frame is detached. And then, remove the following - // lines. See also https://crbug.com/712638 . - Frame* frame = GetFrame(); - if (!frame) - return v8::Null(isolate); - - // TODO(yukishiino): Make this function always return the non-empty handle - // even if the frame is detached because the global proxy must always exist - // per spec. - ScriptState* script_state = ScriptState::From(isolate->GetCurrentContext()); - return frame->GetWindowProxy(script_state->World()) - ->GlobalProxyIfNotDetached(); -} - -v8::MaybeLocal<v8::Value> DOMWindow::WrapV2(ScriptState* script_state) { +v8::MaybeLocal<v8::Value> DOMWindow::Wrap(ScriptState* script_state) { // TODO(yukishiino): Get understanding of why it's possible to initialize // the context after the frame is detached. And then, remove the following // lines. See also https://crbug.com/712638 .
diff --git a/third_party/blink/renderer/core/frame/dom_window.h b/third_party/blink/renderer/core/frame/dom_window.h index 0a3d30b0..9c935c8d 100644 --- a/third_party/blink/renderer/core/frame/dom_window.h +++ b/third_party/blink/renderer/core/frame/dom_window.h
@@ -67,9 +67,7 @@ virtual bool IsRemoteDOMWindow() const = 0; // ScriptWrappable overrides: - v8::Local<v8::Value> Wrap(v8::Isolate*, - v8::Local<v8::Object> creation_context) final; - v8::MaybeLocal<v8::Value> WrapV2(ScriptState*) final; + v8::MaybeLocal<v8::Value> Wrap(ScriptState*) final; v8::Local<v8::Object> AssociateWithWrapper( v8::Isolate*, const WrapperTypeInfo*,
diff --git a/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc index 30efd9c8d..6071cb1c 100644 --- a/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc
@@ -2084,19 +2084,21 @@ spanned_tracks_size += AffectedSizeForContribution(current_set, contribution_type); - if (is_group_spanning_flex_track) { + if (is_group_spanning_flex_track && + !current_set.TrackSize().HasFlexMaxTrackBreadth()) { // From https://drafts.csswg.org/css-grid-2/#algo-spanning-flex-items: // Distributing space only to flexible tracks (i.e. treating all other // tracks as having a fixed sizing function). - if (!current_set.TrackSize().HasFlexMaxTrackBreadth()) - continue; - flex_factor_sum += current_set.FlexFactor(); + continue; } if (IsContributionAppliedToSet(current_set, contribution_type)) { if (current_set.PlannedIncrease() == kIndefiniteSize) current_set.SetPlannedIncrease(LayoutUnit()); + if (is_group_spanning_flex_track) + flex_factor_sum += current_set.FlexFactor(); + sets_to_grow.push_back(¤t_set); if (ShouldUsedSizeGrowBeyondLimit(current_set, contribution_type)) sets_to_grow_beyond_limit.push_back(¤t_set);
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.h b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.h index 5f476f5..3a5424c 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.h +++ b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.h
@@ -55,7 +55,7 @@ NGBlockBreakToken> { public: // Default constructor. - NGBlockLayoutAlgorithm(const NGLayoutAlgorithmParams& params); + explicit NGBlockLayoutAlgorithm(const NGLayoutAlgorithmParams& params); ~NGBlockLayoutAlgorithm() override;
diff --git a/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.h b/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.h index 669ce4c..9629b00f 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.h +++ b/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.h
@@ -22,7 +22,7 @@ NGBoxFragmentBuilder, NGBlockBreakToken> { public: - NGColumnLayoutAlgorithm(const NGLayoutAlgorithmParams& params); + explicit NGColumnLayoutAlgorithm(const NGLayoutAlgorithmParams& params); const NGLayoutResult* Layout() override;
diff --git a/third_party/blink/renderer/core/layout/ng/ng_fieldset_layout_algorithm.h b/third_party/blink/renderer/core/layout/ng/ng_fieldset_layout_algorithm.h index e19cd29..3275071a 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_fieldset_layout_algorithm.h +++ b/third_party/blink/renderer/core/layout/ng/ng_fieldset_layout_algorithm.h
@@ -21,7 +21,7 @@ NGBoxFragmentBuilder, NGBlockBreakToken> { public: - NGFieldsetLayoutAlgorithm(const NGLayoutAlgorithmParams& params); + explicit NGFieldsetLayoutAlgorithm(const NGLayoutAlgorithmParams& params); const NGLayoutResult* Layout() override;
diff --git a/third_party/blink/renderer/core/paint/view_painter_test.cc b/third_party/blink/renderer/core/paint/view_painter_test.cc index 94cde8c..ced8a68 100644 --- a/third_party/blink/renderer/core/paint/view_painter_test.cc +++ b/third_party/blink/renderer/core/paint/view_painter_test.cc
@@ -81,8 +81,7 @@ } sk_sp<const PaintRecord> record = - static_cast<const DrawingDisplayItem*>(background_display_item) - ->GetPaintRecord(); + To<DrawingDisplayItem>(background_display_item)->GetPaintRecord(); ASSERT_EQ(record->size(), 2u); cc::PaintOpBuffer::Iterator it(record.get()); ASSERT_EQ((*++it)->GetType(), cc::PaintOpType::DrawRect);
diff --git a/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.cc b/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.cc index b4fb9ec..ea420e7 100644 --- a/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.cc +++ b/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.cc
@@ -99,23 +99,7 @@ return Create(std::move(contents)); } -v8::Local<v8::Value> DOMArrayBuffer::Wrap( - v8::Isolate* isolate, - v8::Local<v8::Object> creation_context) { - DCHECK(!DOMDataStore::ContainsWrapper(this, isolate)); - - const WrapperTypeInfo* wrapper_type_info = GetWrapperTypeInfo(); - - v8::Local<v8::ArrayBuffer> wrapper; - { - v8::Context::Scope context_scope(creation_context->CreationContext()); - wrapper = v8::ArrayBuffer::New(isolate, Content()->BackingStore()); - } - - return AssociateWithWrapper(isolate, wrapper_type_info, wrapper); -} - -v8::MaybeLocal<v8::Value> DOMArrayBuffer::WrapV2(ScriptState* script_state) { +v8::MaybeLocal<v8::Value> DOMArrayBuffer::Wrap(ScriptState* script_state) { DCHECK(!DOMDataStore::ContainsWrapper(this, script_state->GetIsolate())); const WrapperTypeInfo* wrapper_type_info = GetWrapperTypeInfo();
diff --git a/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h b/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h index e4314f3..940b3d5 100644 --- a/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h +++ b/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h
@@ -76,9 +76,7 @@ return true; } - v8::Local<v8::Value> Wrap(v8::Isolate*, - v8::Local<v8::Object> creation_context) override; - v8::MaybeLocal<v8::Value> WrapV2(ScriptState*) override; + v8::MaybeLocal<v8::Value> Wrap(ScriptState*) override; private: bool TransferDetachable(v8::Isolate*, ArrayBufferContents& result);
diff --git a/third_party/blink/renderer/core/typed_arrays/dom_array_buffer_base.h b/third_party/blink/renderer/core/typed_arrays/dom_array_buffer_base.h index ecc3326..d0518f0 100644 --- a/third_party/blink/renderer/core/typed_arrays/dom_array_buffer_base.h +++ b/third_party/blink/renderer/core/typed_arrays/dom_array_buffer_base.h
@@ -34,14 +34,9 @@ bool IsShared() const { return contents_.IsShared(); } // ScriptWrappable overrides: - v8::Local<v8::Value> Wrap(v8::Isolate*, - v8::Local<v8::Object> creation_context) override { + v8::MaybeLocal<v8::Value> Wrap(ScriptState*) override { NOTREACHED(); - return v8::Local<v8::Object>(); - } - v8::MaybeLocal<v8::Value> WrapV2(ScriptState*) override { - NOTREACHED(); - return v8::MaybeLocal<v8::Value>(); + return v8::Local<v8::Value>(); } protected:
diff --git a/third_party/blink/renderer/core/typed_arrays/dom_array_buffer_view.h b/third_party/blink/renderer/core/typed_arrays/dom_array_buffer_view.h index 504a8db..9388089b 100644 --- a/third_party/blink/renderer/core/typed_arrays/dom_array_buffer_view.h +++ b/third_party/blink/renderer/core/typed_arrays/dom_array_buffer_view.h
@@ -112,14 +112,9 @@ } // ScriptWrappable overrides: - v8::Local<v8::Value> Wrap(v8::Isolate*, - v8::Local<v8::Object> creation_context) override { + v8::MaybeLocal<v8::Value> Wrap(ScriptState*) override { NOTREACHED(); - return v8::Local<v8::Object>(); - } - v8::MaybeLocal<v8::Value> WrapV2(ScriptState*) override { - NOTREACHED(); - return v8::MaybeLocal<v8::Value>(); + return v8::Local<v8::Value>(); } void Trace(Visitor* visitor) const override {
diff --git a/third_party/blink/renderer/core/typed_arrays/dom_data_view.cc b/third_party/blink/renderer/core/typed_arrays/dom_data_view.cc index ec68b5b..e22d3757 100644 --- a/third_party/blink/renderer/core/typed_arrays/dom_data_view.cc +++ b/third_party/blink/renderer/core/typed_arrays/dom_data_view.cc
@@ -20,27 +20,7 @@ return MakeGarbageCollected<DOMDataView>(buffer, byte_offset, byte_length); } -v8::Local<v8::Value> DOMDataView::Wrap(v8::Isolate* isolate, - v8::Local<v8::Object> creation_context) { - DCHECK(!DOMDataStore::ContainsWrapper(this, isolate)); - - const WrapperTypeInfo* wrapper_type_info = GetWrapperTypeInfo(); - v8::Local<v8::Value> v8_buffer = ToV8(buffer(), creation_context, isolate); - if (v8_buffer.IsEmpty()) - return v8::Local<v8::Object>(); - DCHECK(v8_buffer->IsArrayBuffer()); - - v8::Local<v8::Object> wrapper; - { - v8::Context::Scope context_scope(creation_context->CreationContext()); - wrapper = v8::DataView::New(v8_buffer.As<v8::ArrayBuffer>(), byteOffset(), - byteLength()); - } - - return AssociateWithWrapper(isolate, wrapper_type_info, wrapper); -} - -v8::MaybeLocal<v8::Value> DOMDataView::WrapV2(ScriptState* script_state) { +v8::MaybeLocal<v8::Value> DOMDataView::Wrap(ScriptState* script_state) { DCHECK(!DOMDataStore::ContainsWrapper(this, script_state->GetIsolate())); const WrapperTypeInfo* wrapper_type_info = GetWrapperTypeInfo();
diff --git a/third_party/blink/renderer/core/typed_arrays/dom_data_view.h b/third_party/blink/renderer/core/typed_arrays/dom_data_view.h index a4734d5..e44260f 100644 --- a/third_party/blink/renderer/core/typed_arrays/dom_data_view.h +++ b/third_party/blink/renderer/core/typed_arrays/dom_data_view.h
@@ -26,9 +26,7 @@ : DOMArrayBufferView(dom_array_buffer, byte_offset), raw_byte_length_(byte_length) {} - v8::Local<v8::Value> Wrap(v8::Isolate*, - v8::Local<v8::Object> creation_context) override; - v8::MaybeLocal<v8::Value> WrapV2(ScriptState*) override; + v8::MaybeLocal<v8::Value> Wrap(ScriptState*) override; size_t byteLength() const final { return !IsDetached() ? raw_byte_length_ : 0;
diff --git a/third_party/blink/renderer/core/typed_arrays/dom_shared_array_buffer.cc b/third_party/blink/renderer/core/typed_arrays/dom_shared_array_buffer.cc index abceb42..38e9ff1bb 100644 --- a/third_party/blink/renderer/core/typed_arrays/dom_shared_array_buffer.cc +++ b/third_party/blink/renderer/core/typed_arrays/dom_shared_array_buffer.cc
@@ -8,18 +8,7 @@ namespace blink { -v8::Local<v8::Value> DOMSharedArrayBuffer::Wrap( - v8::Isolate* isolate, - v8::Local<v8::Object> creation_context) { - DCHECK(!DOMDataStore::ContainsWrapper(this, isolate)); - - const WrapperTypeInfo* wrapper_type_info = GetWrapperTypeInfo(); - v8::Local<v8::SharedArrayBuffer> wrapper = - v8::SharedArrayBuffer::New(isolate, Content()->BackingStore()); - return AssociateWithWrapper(isolate, wrapper_type_info, wrapper); -} - -v8::MaybeLocal<v8::Value> DOMSharedArrayBuffer::WrapV2( +v8::MaybeLocal<v8::Value> DOMSharedArrayBuffer::Wrap( ScriptState* script_state) { DCHECK(!DOMDataStore::ContainsWrapper(this, script_state->GetIsolate()));
diff --git a/third_party/blink/renderer/core/typed_arrays/dom_shared_array_buffer.h b/third_party/blink/renderer/core/typed_arrays/dom_shared_array_buffer.h index 14e3484..7c26fda 100644 --- a/third_party/blink/renderer/core/typed_arrays/dom_shared_array_buffer.h +++ b/third_party/blink/renderer/core/typed_arrays/dom_shared_array_buffer.h
@@ -55,9 +55,7 @@ return true; } - v8::Local<v8::Value> Wrap(v8::Isolate*, - v8::Local<v8::Object> creation_context) override; - v8::MaybeLocal<v8::Value> WrapV2(ScriptState*) override; + v8::MaybeLocal<v8::Value> Wrap(ScriptState*) override; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/typed_arrays/dom_typed_array.cc b/third_party/blink/renderer/core/typed_arrays/dom_typed_array.cc index a8b3c61..ac23996a 100644 --- a/third_party/blink/renderer/core/typed_arrays/dom_typed_array.cc +++ b/third_party/blink/renderer/core/typed_arrays/dom_typed_array.cc
@@ -22,35 +22,7 @@ namespace blink { template <typename T, typename V8TypedArray, bool clamped> -v8::Local<v8::Value> DOMTypedArray<T, V8TypedArray, clamped>::Wrap( - v8::Isolate* isolate, - v8::Local<v8::Object> creation_context) { - DCHECK(!DOMDataStore::ContainsWrapper(this, isolate)); - - const WrapperTypeInfo* wrapper_type_info = GetWrapperTypeInfo(); - DOMArrayBufferBase* buffer = BufferBase(); - v8::Local<v8::Value> v8_buffer = ToV8(buffer, creation_context, isolate); - if (v8_buffer.IsEmpty()) - return v8::Local<v8::Object>(); - DCHECK_EQ(IsShared(), v8_buffer->IsSharedArrayBuffer()); - - v8::Local<v8::Object> wrapper; - { - v8::Context::Scope context_scope(creation_context->CreationContext()); - if (IsShared()) { - wrapper = V8TypedArray::New(v8_buffer.As<v8::SharedArrayBuffer>(), - byteOffset(), length()); - } else { - wrapper = V8TypedArray::New(v8_buffer.As<v8::ArrayBuffer>(), byteOffset(), - length()); - } - } - - return AssociateWithWrapper(isolate, wrapper_type_info, wrapper); -} - -template <typename T, typename V8TypedArray, bool clamped> -v8::MaybeLocal<v8::Value> DOMTypedArray<T, V8TypedArray, clamped>::WrapV2( +v8::MaybeLocal<v8::Value> DOMTypedArray<T, V8TypedArray, clamped>::Wrap( ScriptState* script_state) { DCHECK(!DOMDataStore::ContainsWrapper(this, script_state->GetIsolate()));
diff --git a/third_party/blink/renderer/core/typed_arrays/dom_typed_array.h b/third_party/blink/renderer/core/typed_arrays/dom_typed_array.h index 452a6d2..bf59ee58 100644 --- a/third_party/blink/renderer/core/typed_arrays/dom_typed_array.h +++ b/third_party/blink/renderer/core/typed_arrays/dom_typed_array.h
@@ -96,9 +96,7 @@ return Data()[index]; } - v8::Local<v8::Value> Wrap(v8::Isolate*, - v8::Local<v8::Object> creation_context) override; - v8::MaybeLocal<v8::Value> WrapV2(ScriptState*) override; + v8::MaybeLocal<v8::Value> Wrap(ScriptState*) override; private: // It may be stale after Detach. Use length() instead.
diff --git a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc index 5a93da2..4f013118 100644 --- a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc +++ b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc
@@ -214,20 +214,11 @@ return g_null_atom; } -v8::Local<v8::Value> WorkerOrWorkletGlobalScope::Wrap( - v8::Isolate*, - v8::Local<v8::Object> creation_context) { +v8::MaybeLocal<v8::Value> WorkerOrWorkletGlobalScope::Wrap(ScriptState*) { LOG(FATAL) << "WorkerOrWorkletGlobalScope must never be wrapped with wrap " "method. The global object of ECMAScript environment is used " "as the wrapper."; - return v8::Local<v8::Object>(); -} - -v8::MaybeLocal<v8::Value> WorkerOrWorkletGlobalScope::WrapV2(ScriptState*) { - LOG(FATAL) << "WorkerOrWorkletGlobalScope must never be wrapped with wrap " - "method. The global object of ECMAScript environment is used " - "as the wrapper."; - return v8::MaybeLocal<v8::Value>(); + return v8::Local<v8::Value>(); } v8::Local<v8::Object> WorkerOrWorkletGlobalScope::AssociateWithWrapper(
diff --git a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h index 005c6ddd..2490a1f 100644 --- a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h +++ b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h
@@ -62,9 +62,7 @@ const AtomicString& InterfaceName() const override; // ScriptWrappable - v8::Local<v8::Value> Wrap(v8::Isolate*, - v8::Local<v8::Object> creation_context) final; - v8::MaybeLocal<v8::Value> WrapV2(ScriptState*) final; + v8::MaybeLocal<v8::Value> Wrap(ScriptState*) final; v8::Local<v8::Object> AssociateWithWrapper( v8::Isolate*, const WrapperTypeInfo*,
diff --git a/third_party/blink/renderer/core/workers/worker_thread.cc b/third_party/blink/renderer/core/workers/worker_thread.cc index 332db9c..0ac53dd 100644 --- a/third_party/blink/renderer/core/workers/worker_thread.cc +++ b/third_party/blink/renderer/core/workers/worker_thread.cc
@@ -580,6 +580,7 @@ TaskType::kUserInteraction, TaskType::kWakeLock, TaskType::kWebGL, + TaskType::kWebGPU, TaskType::kWebLocks, TaskType::kWebSocket, TaskType::kWorkerAnimation};
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.cc b/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.cc index 9cd712a..0e6e243 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.cc
@@ -238,10 +238,10 @@ MediaStreamAudioProcessor::MediaStreamAudioProcessor( const blink::AudioProcessingProperties& properties, bool use_capture_multi_channel_processing, - scoped_refptr<WebRtcAudioDeviceImpl> playout_data_source) + blink::WebRtcPlayoutDataSource* playout_data_source) : render_delay_ms_(0), audio_delay_stats_reporter_(kBuffersPerSecond), - playout_data_source_(std::move(playout_data_source)), + playout_data_source_(playout_data_source), main_thread_runner_(base::ThreadTaskRunnerHandle::Get()), audio_mirroring_(false), typing_detected_(false),
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.h b/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.h index 6bd9547..a754b647 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.h +++ b/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.h
@@ -38,7 +38,6 @@ class AecDumpAgentImpl; class MediaStreamAudioBus; class MediaStreamAudioFifo; -class WebRtcAudioDeviceImpl; using webrtc::AudioProcessorInterface; @@ -57,10 +56,9 @@ // // Threading note: The constructor assumes it is being run on the main render // thread. - MediaStreamAudioProcessor( - const AudioProcessingProperties& properties, - bool use_capture_multi_channel_processing, - scoped_refptr<WebRtcAudioDeviceImpl> playout_data_source); + MediaStreamAudioProcessor(const AudioProcessingProperties& properties, + bool use_capture_multi_channel_processing, + WebRtcPlayoutDataSource* playout_data_source); // Called when the format of the capture data has changed. // Called on the main render thread. The caller is responsible for stopping @@ -219,8 +217,11 @@ media::AudioParameters input_format_; media::AudioParameters output_format_; + // Raw pointer to the WebRtcPlayoutDataSource, which is valid for the + // lifetime of RenderThread. + // // TODO(crbug.com/704136): Replace with Member at some point. - scoped_refptr<WebRtcAudioDeviceImpl> playout_data_source_; + WebRtcPlayoutDataSource* playout_data_source_; // Task runner for the main render thread. const scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner_;
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor_test.cc b/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor_test.cc index 9cc7a382..b10289931 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor_test.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor_test.cc
@@ -197,7 +197,7 @@ blink::AudioProcessingProperties properties; scoped_refptr<MediaStreamAudioProcessor> audio_processor( new rtc::RefCountedObject<MediaStreamAudioProcessor>( - properties, use_multichannel_processing, webrtc_audio_device)); + properties, use_multichannel_processing, webrtc_audio_device.get())); EXPECT_TRUE(audio_processor->has_audio_processing()); audio_processor->OnCaptureFormatChanged(params_); VerifyDefaultComponents(audio_processor.get()); @@ -222,7 +222,7 @@ scoped_refptr<MediaStreamAudioProcessor> audio_processor( new rtc::RefCountedObject<MediaStreamAudioProcessor>( properties, /*use_multichannel_processing=*/true, - webrtc_audio_device)); + webrtc_audio_device.get())); EXPECT_FALSE(audio_processor->has_audio_processing()); audio_processor->OnCaptureFormatChanged(params_); @@ -247,7 +247,7 @@ blink::AudioProcessingProperties properties; scoped_refptr<MediaStreamAudioProcessor> audio_processor( new rtc::RefCountedObject<MediaStreamAudioProcessor>( - properties, use_multichannel_processing, webrtc_audio_device)); + properties, use_multichannel_processing, webrtc_audio_device.get())); EXPECT_TRUE(audio_processor->has_audio_processing()); static const int kSupportedSampleRates[] = { @@ -302,7 +302,7 @@ scoped_refptr<MediaStreamAudioProcessor> audio_processor( new rtc::RefCountedObject<MediaStreamAudioProcessor>( properties, /*use_multichannel_processing=*/true, - webrtc_audio_device)); + webrtc_audio_device.get())); // Start and stop recording. audio_processor->OnStartDump(base::File( @@ -327,6 +327,7 @@ const bool use_multichannel_processing = GetParam(); scoped_refptr<WebRtcAudioDeviceImpl> webrtc_audio_device( new rtc::RefCountedObject<WebRtcAudioDeviceImpl>()); + const media::AudioParameters source_params( media::AudioParameters::AUDIO_PCM_LOW_LATENCY, media::CHANNEL_LAYOUT_STEREO, 48000, 480); @@ -363,7 +364,8 @@ properties.goog_audio_mirroring = true; scoped_refptr<MediaStreamAudioProcessor> audio_processor( new rtc::RefCountedObject<MediaStreamAudioProcessor>( - properties, use_multichannel_processing, webrtc_audio_device)); + properties, use_multichannel_processing, + webrtc_audio_device.get())); EXPECT_EQ(audio_processor->has_audio_processing(), use_apm); audio_processor->OnCaptureFormatChanged(source_params); // There's no sense in continuing if this fails. @@ -420,7 +422,7 @@ blink::AudioProcessingProperties properties; scoped_refptr<MediaStreamAudioProcessor> audio_processor( new rtc::RefCountedObject<MediaStreamAudioProcessor>( - properties, use_multichannel_processing, webrtc_audio_device)); + properties, use_multichannel_processing, webrtc_audio_device.get())); EXPECT_TRUE(audio_processor->has_audio_processing()); media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, @@ -453,7 +455,7 @@ scoped_refptr<MediaStreamAudioProcessor> audio_processor( new rtc::RefCountedObject<MediaStreamAudioProcessor>( properties, /*use_multichannel_processing=*/true, - webrtc_audio_device)); + webrtc_audio_device.get())); base::Optional<webrtc::AudioProcessing::Config> apm_config = audio_processor->GetAudioProcessingModuleConfig(); @@ -494,7 +496,7 @@ scoped_refptr<MediaStreamAudioProcessor> audio_processor( new rtc::RefCountedObject<MediaStreamAudioProcessor>( properties, /*use_multichannel_processing=*/true, - webrtc_audio_device)); + webrtc_audio_device.get())); base::Optional<webrtc::AudioProcessing::Config> apm_config = audio_processor->GetAudioProcessingModuleConfig(); @@ -546,7 +548,7 @@ scoped_refptr<MediaStreamAudioProcessor> audio_processor( new rtc::RefCountedObject<MediaStreamAudioProcessor>( properties, /*use_multichannel_processing=*/true, - webrtc_audio_device)); + webrtc_audio_device.get())); base::Optional<webrtc::AudioProcessing::Config> apm_config = audio_processor->GetAudioProcessingModuleConfig(); @@ -566,7 +568,7 @@ scoped_refptr<MediaStreamAudioProcessor> audio_processor( new rtc::RefCountedObject<MediaStreamAudioProcessor>( properties, /*use_multichannel_processing=*/true, - webrtc_audio_device)); + webrtc_audio_device.get())); EXPECT_TRUE(audio_processor->has_audio_processing()); media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio_test.cc b/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio_test.cc index a8fb6f8..f24a654 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio_test.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio_test.cc
@@ -20,7 +20,6 @@ #include "third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_source.h" #include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h" #include "third_party/blink/public/platform/web_string.h" -#include "third_party/blink/renderer/core/testing/sim/sim_test.h" #include "third_party/blink/renderer/modules/mediastream/local_media_stream_audio_source.h" #include "third_party/blink/renderer/modules/mediastream/mock_constraint_factory.h" #include "third_party/blink/renderer/modules/mediastream/processed_local_audio_source.h" @@ -79,7 +78,7 @@ } // namespace -class MediaStreamConstraintsUtilAudioTestBase : public SimTest { +class MediaStreamConstraintsUtilAudioTestBase { protected: void MakeSystemEchoCancellerDeviceExperimental() { media::AudioParameters experimental_system_echo_canceller_parameters( @@ -128,7 +127,7 @@ device.input.set_effects(effects); return std::make_unique<ProcessedLocalAudioSource>( - *MainFrame().GetFrame(), device, disable_local_echo, properties, + nullptr /*web_frame*/, device, disable_local_echo, properties, num_requested_channels, base::NullCallback(), blink::scheduler::GetSingleThreadTaskRunnerForTesting()); } @@ -495,10 +494,9 @@ class MediaStreamConstraintsUtilAudioTest : public MediaStreamConstraintsUtilAudioTestBase, - public testing::WithParamInterface<std::string> { + public testing::TestWithParam<std::string> { public: void SetUp() override { - MediaStreamConstraintsUtilAudioTestBase::SetUp(); ResetFactory(); if (IsDeviceCapture()) { capabilities_.emplace_back(
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_renderer_factory.cc b/third_party/blink/renderer/modules/mediastream/media_stream_renderer_factory.cc index 8d320bd..3c622fd 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_renderer_factory.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_renderer_factory.cc
@@ -10,8 +10,6 @@ #include "third_party/blink/public/platform/modules/webrtc/webrtc_logging.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/web/web_local_frame.h" -#include "third_party/blink/renderer/core/execution_context/execution_context.h" -#include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_video_renderer_sink.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_video_track.h" @@ -35,10 +33,9 @@ // be rendered to a matching output device, should one exist. // Note that if there are more than one open capture devices the function // will not be able to pick an appropriate device and return 0. -base::UnguessableToken GetSessionIdForWebRtcAudioRenderer( - ExecutionContext& context) { +base::UnguessableToken GetSessionIdForWebRtcAudioRenderer() { WebRtcAudioDeviceImpl* audio_device = - PeerConnectionDependencyFactory::From(context).GetWebRtcAudioDevice(); + PeerConnectionDependencyFactory::GetInstance()->GetWebRtcAudioDevice(); return audio_device ? audio_device->GetAuthorizedDeviceSessionIdForAudioRenderer() : base::UnguessableToken(); @@ -121,9 +118,6 @@ return nullptr; } - auto* frame = To<LocalFrame>(WebLocalFrame::ToCoreFrame(*web_frame)); - DCHECK(frame); - // If the track has a local source, or is a remote track that does not use the // WebRTC audio pipeline, return a new TrackAudioRenderer instance. if (!PeerConnectionRemoteAudioTrack::From(audio_track)) { @@ -133,7 +127,11 @@ "%s => (creating TrackAudioRenderer for %s audio track)", __func__, audio_track->is_local_track() ? "local" : "remote")); - return new TrackAudioRenderer(audio_components[0].Get(), *frame, + auto* frame = + web_frame + ? static_cast<LocalFrame*>(WebLocalFrame::ToCoreFrame(*web_frame)) + : nullptr; + return new TrackAudioRenderer(audio_components[0].Get(), frame, /*session_id=*/base::UnguessableToken(), String(device_id), std::move(on_render_error_callback)); @@ -141,8 +139,7 @@ // This is a remote WebRTC media stream. WebRtcAudioDeviceImpl* audio_device = - PeerConnectionDependencyFactory::From(*frame->DomWindow()) - .GetWebRtcAudioDevice(); + PeerConnectionDependencyFactory::GetInstance()->GetWebRtcAudioDevice(); DCHECK(audio_device); SendLogMessage(String::Format( "%s => (media stream is a remote WebRTC stream)", __func__)); @@ -159,11 +156,9 @@ __func__)); renderer = new WebRtcAudioRenderer( - PeerConnectionDependencyFactory::From(*frame->DomWindow()) - .GetWebRtcSignalingTaskRunner(), - web_stream, web_frame, - - GetSessionIdForWebRtcAudioRenderer(*frame->DomWindow()), + PeerConnectionDependencyFactory::GetInstance() + ->GetWebRtcSignalingTaskRunner(), + web_stream, web_frame, GetSessionIdForWebRtcAudioRenderer(), String(device_id), std::move(on_render_error_callback)); if (!audio_device->SetAudioRenderer(renderer.get())) {
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_video_track_test.cc b/third_party/blink/renderer/modules/mediastream/media_stream_video_track_test.cc index c6d7115..a7ea3f5 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_video_track_test.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_video_track_test.cc
@@ -639,8 +639,7 @@ Persistent<MediaStreamComponent> media_stream_component = *track; blink::MediaStreamVideoWebRtcSink webrtc_sink( - media_stream_component, - MakeGarbageCollected<MockPeerConnectionDependencyFactory>(), + media_stream_component, new blink::MockPeerConnectionDependencyFactory(), blink::scheduler::GetSingleThreadTaskRunnerForTesting()); EXPECT_EQ(webrtc_sink.GetRequiredMinFramesPerSec(), 1); @@ -667,8 +666,7 @@ // Second sink. Persistent<MediaStreamComponent> media_stream_component = *track; blink::MediaStreamVideoWebRtcSink webrtc_sink( - media_stream_component, - MakeGarbageCollected<MockPeerConnectionDependencyFactory>(), + media_stream_component, new blink::MockPeerConnectionDependencyFactory(), blink::scheduler::GetSingleThreadTaskRunnerForTesting()); EXPECT_EQ(webrtc_sink.GetRequiredMinFramesPerSec(), 1); @@ -698,7 +696,7 @@ Persistent<MediaStreamComponent> media_stream_component = *track; blink::MediaStreamVideoWebRtcSink webrtc_sink( media_stream_component, - MakeGarbageCollected<MockPeerConnectionDependencyFactory>(), + new blink::MockPeerConnectionDependencyFactory(), blink::scheduler::GetSingleThreadTaskRunnerForTesting()); EXPECT_EQ(webrtc_sink.GetRequiredMinFramesPerSec(), 1); }
diff --git a/third_party/blink/renderer/modules/mediastream/processed_local_audio_source.cc b/third_party/blink/renderer/modules/mediastream/processed_local_audio_source.cc index 7f66df7..3b0c5524 100644 --- a/third_party/blink/renderer/modules/mediastream/processed_local_audio_source.cc +++ b/third_party/blink/renderer/modules/mediastream/processed_local_audio_source.cc
@@ -25,7 +25,6 @@ #include "third_party/blink/public/platform/modules/webrtc/webrtc_logging.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/web/web_local_frame.h" -#include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util.h" @@ -104,7 +103,7 @@ } // namespace ProcessedLocalAudioSource::ProcessedLocalAudioSource( - LocalFrame& frame, + LocalFrame* frame, const blink::MediaStreamDevice& device, bool disable_local_echo, const blink::AudioProcessingProperties& audio_processing_properties, @@ -114,15 +113,12 @@ : blink::MediaStreamAudioSource(std::move(task_runner), true /* is_local_source */, disable_local_echo), - consumer_frame_(&frame), - dependency_factory_( - PeerConnectionDependencyFactory::From(*frame.DomWindow())), + consumer_frame_(frame), audio_processing_properties_(audio_processing_properties), num_requested_channels_(num_requested_channels), started_callback_(std::move(started_callback)), volume_(0), allow_invalid_render_frame_id_for_testing_(false) { - DCHECK(frame.DomWindow()); SetDevice(device); SendLogMessage( base::StringPrintf("ProcessedLocalAudioSource({session_id=%s})", @@ -218,9 +214,8 @@ // Create the MediaStreamAudioProcessor, bound to the WebRTC audio device // module. - DCHECK(dependency_factory_); WebRtcAudioDeviceImpl* const rtc_audio_device = - dependency_factory_->GetWebRtcAudioDevice(); + PeerConnectionDependencyFactory::GetInstance()->GetWebRtcAudioDevice(); if (!rtc_audio_device) { SendLogMessageWithSessionId( "EnsureSourceIsStarted() => (ERROR: no WebRTC ADM instance)"); @@ -323,8 +318,10 @@ scoped_refptr<media::AudioCapturerSource> source_to_stop(std::move(source_)); - if (dependency_factory_) { - dependency_factory_->GetWebRtcAudioDevice()->RemoveAudioCapturer(this); + if (WebRtcAudioDeviceImpl* rtc_audio_device = + PeerConnectionDependencyFactory::GetInstance() + ->GetWebRtcAudioDevice()) { + rtc_audio_device->RemoveAudioCapturer(this); } source_to_stop->Stop();
diff --git a/third_party/blink/renderer/modules/mediastream/processed_local_audio_source.h b/third_party/blink/renderer/modules/mediastream/processed_local_audio_source.h index 557d286..6587c4b 100644 --- a/third_party/blink/renderer/modules/mediastream/processed_local_audio_source.h +++ b/third_party/blink/renderer/modules/mediastream/processed_local_audio_source.h
@@ -28,7 +28,6 @@ class LocalFrame; class MediaStreamAudioProcessor; -class PeerConnectionDependencyFactory; // Represents a local source of audio data that is routed through the WebRTC // audio pipeline for post-processing (e.g., for echo cancellation during a @@ -44,7 +43,7 @@ // audio session ID are derived from |device_info|. |factory| must outlive // this instance. ProcessedLocalAudioSource( - LocalFrame& frame, + LocalFrame* frame, const MediaStreamDevice& device, bool disable_local_echo, const AudioProcessingProperties& audio_processing_properties, @@ -135,7 +134,6 @@ // TODO(crbug.com/704136): Consider moving ProcessedLocalAudioSource to // Oilpan and use Member<> here. WeakPersistent<LocalFrame> consumer_frame_; - WeakPersistent<PeerConnectionDependencyFactory> dependency_factory_; blink::AudioProcessingProperties audio_processing_properties_; int num_requested_channels_;
diff --git a/third_party/blink/renderer/modules/mediastream/processed_local_audio_source_test.cc b/third_party/blink/renderer/modules/mediastream/processed_local_audio_source_test.cc index 7c34cf8..bf8d1e7 100644 --- a/third_party/blink/renderer/modules/mediastream/processed_local_audio_source_test.cc +++ b/third_party/blink/renderer/modules/mediastream/processed_local_audio_source_test.cc
@@ -14,7 +14,6 @@ #include "third_party/blink/public/platform/modules/mediastream/web_media_stream_audio_sink.h" #include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h" #include "third_party/blink/public/web/web_heap.h" -#include "third_party/blink/renderer/core/testing/sim/sim_test.h" #include "third_party/blink/renderer/modules/mediastream/processed_local_audio_source.h" #include "third_party/blink/renderer/modules/mediastream/testing_platform_support_with_mock_audio_capture_source.h" #include "third_party/blink/renderer/modules/webrtc/webrtc_audio_device_impl.h" @@ -77,14 +76,13 @@ } // namespace -class ProcessedLocalAudioSourceTest : public SimTest { +class ProcessedLocalAudioSourceTest : public testing::Test { protected: - ProcessedLocalAudioSourceTest() = default; + ProcessedLocalAudioSourceTest() {} - ~ProcessedLocalAudioSourceTest() override = default; + ~ProcessedLocalAudioSourceTest() override {} void SetUp() override { - SimTest::SetUp(); audio_source_ = MakeGarbageCollected<MediaStreamSource>( String::FromUTF8("audio_label"), MediaStreamSource::kTypeAudio, String::FromUTF8("audio_track"), false /* remote */); @@ -93,7 +91,6 @@ } void TearDown() override { - SimTest::TearDown(); audio_source_ = nullptr; audio_component_ = nullptr; WebHeap::CollectAllGarbageForTesting(); @@ -104,7 +101,7 @@ int num_requested_channels) { std::unique_ptr<blink::ProcessedLocalAudioSource> source = std::make_unique<blink::ProcessedLocalAudioSource>( - *MainFrame().GetFrame(), + nullptr /* consumer_web_frame is N/A for non-browser tests */, MediaStreamDevice(mojom::MediaStreamType::DEVICE_AUDIO_CAPTURE, "mock_audio_device_id", "Mock audio device", kSampleRate, kChannelLayout,
diff --git a/third_party/blink/renderer/modules/mediastream/testing_platform_support_with_mock_audio_capture_source.cc b/third_party/blink/renderer/modules/mediastream/testing_platform_support_with_mock_audio_capture_source.cc index ff40353..1ece4899 100644 --- a/third_party/blink/renderer/modules/mediastream/testing_platform_support_with_mock_audio_capture_source.cc +++ b/third_party/blink/renderer/modules/mediastream/testing_platform_support_with_mock_audio_capture_source.cc
@@ -10,6 +10,7 @@ AudioCapturerSourceTestingPlatformSupport::NewAudioCapturerSource( WebLocalFrame* web_frame, const media::AudioSourceParameters& params) { + EXPECT_EQ(nullptr, web_frame); return mock_audio_capturer_source_; }
diff --git a/third_party/blink/renderer/modules/mediastream/track_audio_renderer.cc b/third_party/blink/renderer/modules/mediastream/track_audio_renderer.cc index 9eca039..12d16bb 100644 --- a/third_party/blink/renderer/modules/mediastream/track_audio_renderer.cc +++ b/third_party/blink/renderer/modules/mediastream/track_audio_renderer.cc
@@ -152,7 +152,7 @@ TrackAudioRenderer::TrackAudioRenderer( MediaStreamComponent* audio_component, - LocalFrame& playout_frame, + LocalFrame* playout_frame, const base::UnguessableToken& session_id, const String& device_id, base::RepeatingCallback<void()> on_render_error_callback) @@ -160,7 +160,7 @@ playout_frame_(playout_frame), session_id_(session_id), task_runner_( - playout_frame.GetTaskRunner(blink::TaskType::kInternalMedia)), + playout_frame->GetTaskRunner(blink::TaskType::kInternalMedia)), num_samples_rendered_(0), on_render_error_callback_(std::move(on_render_error_callback)), playing_(false),
diff --git a/third_party/blink/renderer/modules/mediastream/track_audio_renderer.h b/third_party/blink/renderer/modules/mediastream/track_audio_renderer.h index f1d3132..bd4452f 100644 --- a/third_party/blink/renderer/modules/mediastream/track_audio_renderer.h +++ b/third_party/blink/renderer/modules/mediastream/track_audio_renderer.h
@@ -62,7 +62,7 @@ // // Called on the main thread. TrackAudioRenderer(MediaStreamComponent* audio_component, - LocalFrame& playout_web_frame, + LocalFrame* playout_web_frame, const base::UnguessableToken& session_id, const String& device_id, base::RepeatingCallback<void()> on_render_error_callback);
diff --git a/third_party/blink/renderer/modules/mediastream/user_media_processor.cc b/third_party/blink/renderer/modules/mediastream/user_media_processor.cc index 4847d121..1ee6f8c 100644 --- a/third_party/blink/renderer/modules/mediastream/user_media_processor.cc +++ b/third_party/blink/renderer/modules/mediastream/user_media_processor.cc
@@ -1417,7 +1417,7 @@ SendLogMessage( base::StringPrintf("%s => (audiprocessing is required)", __func__)); return std::make_unique<blink::ProcessedLocalAudioSource>( - *frame_, device, stream_controls->disable_local_echo, + frame_, device, stream_controls->disable_local_echo, audio_processing_properties, current_request_info_->audio_capture_settings().num_channels(), std::move(source_ready), task_runner_);
diff --git a/third_party/blink/renderer/modules/peerconnection/media_stream_remote_video_source_test.cc b/third_party/blink/renderer/modules/peerconnection/media_stream_remote_video_source_test.cc index af94571..d991064 100644 --- a/third_party/blink/renderer/modules/peerconnection/media_stream_remote_video_source_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/media_stream_remote_video_source_test.cc
@@ -25,7 +25,6 @@ #include "third_party/blink/renderer/modules/mediastream/mock_media_stream_video_sink.h" #include "third_party/blink/renderer/modules/peerconnection/adapters/web_rtc_cross_thread_copier.h" #include "third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.h" -#include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/mediastream/media_stream_source.h" #include "third_party/blink/renderer/platform/testing/io_task_runner_testing_platform_support.h" #include "third_party/blink/renderer/platform/webrtc/track_observer.h" @@ -67,8 +66,7 @@ class MediaStreamRemoteVideoSourceTest : public ::testing::Test { public: MediaStreamRemoteVideoSourceTest() - : mock_factory_( - MakeGarbageCollected<MockPeerConnectionDependencyFactory>()), + : mock_factory_(new blink::MockPeerConnectionDependencyFactory()), webrtc_video_source_(blink::MockWebRtcVideoTrackSource::Create( /*supports_encoded_output=*/true)), webrtc_video_track_( @@ -168,7 +166,7 @@ } ScopedTestingPlatformSupport<IOTaskRunnerTestingPlatformSupport> platform_; - Persistent<blink::MockPeerConnectionDependencyFactory> mock_factory_; + std::unique_ptr<blink::MockPeerConnectionDependencyFactory> mock_factory_; scoped_refptr<webrtc::VideoTrackSourceInterface> webrtc_video_source_; scoped_refptr<webrtc::VideoTrackInterface> webrtc_video_track_; // |remote_source_| is owned by |source_|.
diff --git a/third_party/blink/renderer/modules/peerconnection/media_stream_video_webrtc_sink_test.cc b/third_party/blink/renderer/modules/peerconnection/media_stream_video_webrtc_sink_test.cc index b88b9efe..49f8a6d 100644 --- a/third_party/blink/renderer/modules/peerconnection/media_stream_video_webrtc_sink_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/media_stream_video_webrtc_sink_test.cc
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/modules/mediastream/mock_media_stream_registry.h" #include "third_party/blink/renderer/modules/mediastream/video_track_adapter_settings.h" #include "third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.h" -#include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/mediastream/media_stream_component.h" #include "third_party/blink/renderer/platform/testing/io_task_runner_testing_platform_support.h" @@ -39,8 +38,7 @@ protected: Persistent<MediaStreamComponent> component_; - Persistent<MockPeerConnectionDependencyFactory> dependency_factory_ = - MakeGarbageCollected<MockPeerConnectionDependencyFactory>(); + blink::MockPeerConnectionDependencyFactory dependency_factory_; private: ScopedTestingPlatformSupport<IOTaskRunnerTestingPlatformSupport> platform_; @@ -51,7 +49,7 @@ TEST_F(MediaStreamVideoWebRtcSinkTest, NoiseReductionDefaultsToNotSet) { SetVideoTrack(); blink::MediaStreamVideoWebRtcSink my_sink( - component_, dependency_factory_.Get(), + component_, &dependency_factory_, blink::scheduler::GetSingleThreadTaskRunnerForTesting()); EXPECT_TRUE(my_sink.webrtc_video_track()); EXPECT_FALSE(my_sink.SourceNeedsDenoisingForTesting());
diff --git a/third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.cc b/third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.cc index 187ff76..51f6076a 100644 --- a/third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.cc +++ b/third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.cc
@@ -335,7 +335,9 @@ }; MockPeerConnectionDependencyFactory::MockPeerConnectionDependencyFactory() - : signaling_thread_("MockPCFactory WebRtc Signaling Thread") { + : blink::PeerConnectionDependencyFactory( + /*create_p2p_socket_dispatcher =*/false), + signaling_thread_("MockPCFactory WebRtc Signaling Thread") { EnsureWebRtcAudioDeviceImpl(); CHECK(signaling_thread_.Start()); }
diff --git a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc index 5ba0131..c79896d1 100644 --- a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc +++ b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc
@@ -33,13 +33,11 @@ #include "third_party/blink/public/web/web_document.h" #include "third_party/blink/public/web/web_local_frame.h" #include "third_party/blink/public/web/web_local_frame_client.h" -#include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/modules/peerconnection/rtc_error_util.h" #include "third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h" #include "third_party/blink/renderer/modules/webrtc/webrtc_audio_device_impl.h" #include "third_party/blink/renderer/platform/mediastream/media_constraints.h" #include "third_party/blink/renderer/platform/mediastream/webrtc_uma_histograms.h" -#include "third_party/blink/renderer/platform/mojo/mojo_binding_context.h" #include "third_party/blink/renderer/platform/p2p/empty_network_manager.h" #include "third_party/blink/renderer/platform/p2p/filtering_network_manager.h" #include "third_party/blink/renderer/platform/p2p/ipc_network_manager.h" @@ -69,8 +67,6 @@ namespace { -using PassKey = base::PassKey<PeerConnectionDependencyFactory>; - enum WebRTCIPHandlingPolicy { DEFAULT, DEFAULT_PUBLIC_AND_PRIVATE_INTERFACES, @@ -112,176 +108,32 @@ IpcPacketSocketFactory* ipc_psf_; }; -// Encapsulates process-wide static dependencies used by -// `PeerConnectionDependencyFactory`, namely the threads used by WebRTC. This -// avoids allocating multiple threads per factory instance, as they are -// "heavy-weight" and we don't want to create them per frame. -class PeerConnectionStaticDeps { - public: - PeerConnectionStaticDeps() - : chrome_signaling_thread_("WebRTC_Signaling"), - chrome_network_thread_("WebRTC_Network") { - if (base::FeatureList::IsEnabled(features::kWebRtcDistinctWorkerThread)) { - chrome_worker_thread_.emplace("WebRTC_Worker"); - } - } - - void EnsureChromeThreadsStarted() { - if (!chrome_signaling_thread_.IsRunning()) - chrome_signaling_thread_.Start(); - if (!chrome_network_thread_.IsRunning()) - chrome_network_thread_.Start(); - - if (chrome_worker_thread_ && !chrome_worker_thread_->IsRunning()) - chrome_worker_thread_->Start(); - - // To allow sending to the signaling/worker threads. - jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); - jingle_glue::JingleThreadWrapper::current()->set_send_allowed(true); - } - - base::WaitableEvent& InitializeWorkerThread() { - // If there is no worker thread, the event was already created SIGNALED. - if (!chrome_worker_thread_) - return init_worker_event; - - if (!worker_thread_) { - PostCrossThreadTask( - *chrome_worker_thread_->task_runner(), FROM_HERE, - CrossThreadBindOnce(&PeerConnectionStaticDeps::InitializeOnThread, - CrossThreadUnretained(this), - CrossThreadUnretained(&worker_thread_), - CrossThreadUnretained(&init_worker_event))); - } - return init_worker_event; - } - - base::WaitableEvent& InitializeNetworkThread() { - if (!network_thread_) { - PostCrossThreadTask( - *chrome_network_thread_.task_runner(), FROM_HERE, - CrossThreadBindOnce(&PeerConnectionStaticDeps::InitializeOnThread, - CrossThreadUnretained(this), - CrossThreadUnretained(&network_thread_), - CrossThreadUnretained(&init_network_event))); - } - return init_network_event; - } - - base::WaitableEvent& InitializeSignalingThread() { - if (!signaling_thread_) { - PostCrossThreadTask( - *chrome_signaling_thread_.task_runner(), FROM_HERE, - CrossThreadBindOnce(&PeerConnectionStaticDeps::InitializeOnThread, - CrossThreadUnretained(this), - CrossThreadUnretained(&signaling_thread_), - CrossThreadUnretained(&init_signaling_event))); - } - return init_signaling_event; - } - - rtc::Thread* GetSignalingThread() { return signaling_thread_; } - rtc::Thread* GetWorkerThread() { return worker_thread_; } - rtc::Thread* GetNetworkThread() { return network_thread_; } - base::Thread& GetChromeSignalingThread() { return chrome_signaling_thread_; } - base::Thread* GetChromeWorkerThread() { - return chrome_worker_thread_.has_value() ? &*chrome_worker_thread_ - : nullptr; - } - base::Thread& GetChromeNetworkThread() { return chrome_network_thread_; } - - private: - void InitializeOnThread(rtc::Thread** thread, base::WaitableEvent* event) { - jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); - jingle_glue::JingleThreadWrapper::current()->set_send_allowed(true); - if (!*thread) { - *thread = jingle_glue::JingleThreadWrapper::current(); - event->Signal(); - } - } - - // PeerConnection threads. signaling_thread_ is created from the "current" - // (main) chrome thread. - rtc::Thread* signaling_thread_ = nullptr; - rtc::Thread* worker_thread_ = nullptr; - rtc::Thread* network_thread_ = nullptr; - base::Thread chrome_signaling_thread_; - base::Optional<base::Thread> chrome_worker_thread_; - base::Thread chrome_network_thread_; - - // WaitableEvents for observing thread initialization. - base::WaitableEvent init_signaling_event{ - base::WaitableEvent::ResetPolicy::MANUAL, - base::WaitableEvent::InitialState::NOT_SIGNALED}; - base::WaitableEvent init_worker_event{ - base::WaitableEvent::ResetPolicy::MANUAL, - // If we don't create a separate worker thread, start the event as already - // signaled so it doesn't block anything. - base::FeatureList::IsEnabled(features::kWebRtcDistinctWorkerThread) - ? base::WaitableEvent::InitialState::NOT_SIGNALED - : base::WaitableEvent::InitialState::SIGNALED}; - base::WaitableEvent init_network_event{ - base::WaitableEvent::ResetPolicy::MANUAL, - base::WaitableEvent::InitialState::NOT_SIGNALED}; - - THREAD_CHECKER(thread_checker_); -}; - -PeerConnectionStaticDeps& StaticDeps() { - DEFINE_THREAD_SAFE_STATIC_LOCAL(PeerConnectionStaticDeps, instance, ()); - return instance; -} - -rtc::Thread* GetSignalingThread() { - return StaticDeps().GetSignalingThread(); -} -rtc::Thread* GetWorkerThread() { - return StaticDeps().GetWorkerThread(); -} -rtc::Thread* GetNetworkThread() { - return StaticDeps().GetNetworkThread(); -} -base::Thread& GetChromeSignalingThread() { - return StaticDeps().GetChromeSignalingThread(); -} -base::Thread* GetChromeWorkerThread() { - return StaticDeps().GetChromeWorkerThread(); -} -base::Thread& GetChromeNetworkThread() { - return StaticDeps().GetChromeNetworkThread(); -} - } // namespace -// static -const char PeerConnectionDependencyFactory::kSupplementName[] = - "PeerConnectionDependencyFactory"; - -PeerConnectionDependencyFactory& PeerConnectionDependencyFactory::From( - ExecutionContext& context) { - auto* supplement = - Supplement<ExecutionContext>::From<PeerConnectionDependencyFactory>( - context); - if (!supplement) { - supplement = MakeGarbageCollected<PeerConnectionDependencyFactory>( - context, PassKey()); - ProvideTo(context, supplement); +PeerConnectionDependencyFactory::PeerConnectionDependencyFactory( + bool create_p2p_socket_dispatcher) + : network_manager_(nullptr), + p2p_socket_dispatcher_( + create_p2p_socket_dispatcher ? new P2PSocketDispatcher() : nullptr), + chrome_signaling_thread_("WebRTC_Signaling"), + chrome_network_thread_("WebRTC_Network") { + if (base::FeatureList::IsEnabled(features::kWebRtcDistinctWorkerThread)) { + chrome_worker_thread_.emplace("WebRTC_Worker"); } - return *supplement; } -PeerConnectionDependencyFactory::PeerConnectionDependencyFactory( - ExecutionContext& context, - PassKey) - : Supplement(context), - ExecutionContextLifecycleObserver(&context), - network_manager_(nullptr), - p2p_socket_dispatcher_(P2PSocketDispatcher::From(context)) {} +PeerConnectionDependencyFactory::~PeerConnectionDependencyFactory() { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DVLOG(1) << "~PeerConnectionDependencyFactory()"; + DCHECK(!pc_factory_); +} -PeerConnectionDependencyFactory::PeerConnectionDependencyFactory() - : Supplement(nullptr), ExecutionContextLifecycleObserver(nullptr) {} - -PeerConnectionDependencyFactory::~PeerConnectionDependencyFactory() = default; +PeerConnectionDependencyFactory* +PeerConnectionDependencyFactory::GetInstance() { + DEFINE_STATIC_LOCAL(PeerConnectionDependencyFactory, instance, + (/*create_p2p_socket_dispatcher= */ true)); + return &instance; +} std::unique_ptr<RTCPeerConnectionHandler> PeerConnectionDependencyFactory::CreateRTCPeerConnectionHandler( @@ -307,20 +159,23 @@ return pc_factory_; } +void PeerConnectionDependencyFactory::WillDestroyCurrentMessageLoop() { + CleanupPeerConnectionFactory(); +} + void PeerConnectionDependencyFactory::CreatePeerConnectionFactory() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(!pc_factory_.get()); + DCHECK(!signaling_thread_); + DCHECK(!worker_thread_); + DCHECK(!network_thread_); DCHECK(!network_manager_); DCHECK(!socket_factory_); + DCHECK(!chrome_signaling_thread_.IsRunning()); + DCHECK(!chrome_worker_thread_ || !chrome_worker_thread_->IsRunning()); + DCHECK(!chrome_network_thread_.IsRunning()); DVLOG(1) << "PeerConnectionDependencyFactory::CreatePeerConnectionFactory()"; - StaticDeps().EnsureChromeThreadsStarted(); - base::WaitableEvent& worker_thread_started_event = - StaticDeps().InitializeWorkerThread(); - StaticDeps().InitializeNetworkThread(); - StaticDeps().InitializeSignalingThread(); - #if BUILDFLAG(RTC_USE_H264) && BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) // Building /w |rtc_use_h264|, is the corresponding run-time feature enabled? if (!base::FeatureList::IsEnabled( @@ -332,6 +187,11 @@ webrtc::DisableRtcUseH264(); #endif // BUILDFLAG(RTC_USE_H264) && BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) + base::CurrentThread::Get()->AddDestructionObserver(this); + // To allow sending to the signaling/worker threads. + jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); + jingle_glue::JingleThreadWrapper::current()->set_send_allowed(true); + EnsureWebRtcAudioDeviceImpl(); // Init SSL, which will be needed by PeerConnection. @@ -341,6 +201,22 @@ return; } + base::WaitableEvent start_worker_event( + base::WaitableEvent::ResetPolicy::MANUAL, + base::WaitableEvent::InitialState::NOT_SIGNALED); + if (chrome_worker_thread_) { + CHECK(chrome_worker_thread_->Start()); + PostCrossThreadTask( + *chrome_worker_thread_->task_runner().get(), FROM_HERE, + CrossThreadBindOnce( + &PeerConnectionDependencyFactory::InitializeWorkerThread, + CrossThreadUnretained(this), CrossThreadUnretained(&worker_thread_), + CrossThreadUnretained(&start_worker_event))); + } + + CHECK(chrome_signaling_thread_.Start()); + CHECK(chrome_network_thread_.Start()); + base::WaitableEvent create_network_manager_event( base::WaitableEvent::ResetPolicy::MANUAL, base::WaitableEvent::InitialState::NOT_SIGNALED); @@ -350,34 +226,36 @@ blink::features::kWebRtcHideLocalIpsWithMdns)) { // Note that MdnsResponderAdapter is created on the main thread to have // access to the connector to the service manager. - // TODO(crbug.com/1178670): Pass MojoBindingContext and use its BIB to bind. mdns_responder = std::make_unique<MdnsResponderAdapter>(); } #endif // BUILDFLAG(ENABLE_MDNS) PostCrossThreadTask( - *GetWebRtcNetworkTaskRunner(), FROM_HERE, + *chrome_network_thread_.task_runner().get(), FROM_HERE, CrossThreadBindOnce(&PeerConnectionDependencyFactory:: CreateIpcNetworkManagerOnNetworkThread, - WrapCrossThreadPersistent(this), + CrossThreadUnretained(this), CrossThreadUnretained(&create_network_manager_event), - std::move(mdns_responder))); + std::move(mdns_responder), + CrossThreadUnretained(&network_thread_))); create_network_manager_event.Wait(); - CHECK(GetNetworkThread()); + CHECK(network_thread_); // Wait for the worker thread, since `InitializeSignalingThread` needs to // refer to `worker_thread_`. - worker_thread_started_event.Wait(); - CHECK(!GetChromeWorkerThread() || GetWorkerThread()); + if (chrome_worker_thread_) { + start_worker_event.Wait(); + CHECK(worker_thread_); + } base::WaitableEvent start_signaling_event( base::WaitableEvent::ResetPolicy::MANUAL, base::WaitableEvent::InitialState::NOT_SIGNALED); PostCrossThreadTask( - *GetChromeSignalingThread().task_runner(), FROM_HERE, + *chrome_signaling_thread_.task_runner().get(), FROM_HERE, CrossThreadBindOnce( &PeerConnectionDependencyFactory::InitializeSignalingThread, - WrapCrossThreadPersistent(this), + CrossThreadUnretained(this), Platform::Current()->GetRenderingColorSpace(), Platform::Current()->MediaThreadTaskRunner(), CrossThreadUnretained(Platform::Current()->GetGpuFactories()), @@ -385,7 +263,7 @@ CrossThreadUnretained(&start_signaling_event))); start_signaling_event.Wait(); - CHECK(GetSignalingThread()); + CHECK(signaling_thread_); } void PeerConnectionDependencyFactory::InitializeSignalingThread( @@ -394,12 +272,13 @@ media::GpuVideoAcceleratorFactories* gpu_factories, media::DecoderFactory* media_decoder_factory, base::WaitableEvent* event) { - DCHECK(GetChromeSignalingThread().task_runner()->BelongsToCurrentThread()); - DCHECK(GetNetworkThread()); - // The task to initialize `signaling_thread_` was posted to the same thread, - // so there is no need to wait on its event. - DCHECK(GetSignalingThread()); - DCHECK(p2p_socket_dispatcher_); + DCHECK(chrome_signaling_thread_.task_runner()->BelongsToCurrentThread()); + DCHECK(network_thread_); + DCHECK(p2p_socket_dispatcher_.get()); + + jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); + jingle_glue::JingleThreadWrapper::current()->set_send_allowed(true); + signaling_thread_ = jingle_glue::JingleThreadWrapper::current(); net::NetworkTrafficAnnotationTag traffic_annotation = net::DefineNetworkTrafficAnnotation("webrtc_peer_connection", R"( @@ -438,7 +317,7 @@ } )"); socket_factory_ = std::make_unique<IpcPacketSocketFactory>( - p2p_socket_dispatcher_.Get(), traffic_annotation); + p2p_socket_dispatcher_.get(), traffic_annotation); gpu_factories_ = gpu_factories; std::unique_ptr<webrtc::VideoEncoderFactory> webrtc_encoder_factory = @@ -464,10 +343,9 @@ } webrtc::PeerConnectionFactoryDependencies pcf_deps; - pcf_deps.worker_thread = - GetWorkerThread() ? GetWorkerThread() : GetSignalingThread(); - pcf_deps.signaling_thread = GetSignalingThread(); - pcf_deps.network_thread = GetNetworkThread(); + pcf_deps.worker_thread = worker_thread_ ? worker_thread_ : signaling_thread_; + pcf_deps.signaling_thread = signaling_thread_; + pcf_deps.network_thread = network_thread_; pcf_deps.task_queue_factory = CreateWebRtcTaskQueueFactory(); pcf_deps.call_factory = webrtc::CreateCallFactory(); pcf_deps.event_log_factory = std::make_unique<webrtc::RtcEventLogFactory>( @@ -651,8 +529,8 @@ if (!PeerConnectionFactoryCreated()) CreatePeerConnectionFactory(); - return webrtc::VideoTrackSourceProxy::Create(GetSignalingThread(), - GetNetworkThread(), source) + return webrtc::VideoTrackSourceProxy::Create(signaling_thread_, + network_thread_, source) .get(); } @@ -678,47 +556,56 @@ return audio_device_.get(); } +void PeerConnectionDependencyFactory::InitializeWorkerThread( + rtc::Thread** thread, + base::WaitableEvent* event) { + jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); + jingle_glue::JingleThreadWrapper::current()->set_send_allowed(true); + *thread = jingle_glue::JingleThreadWrapper::current(); + event->Signal(); +} + void PeerConnectionDependencyFactory::CreateIpcNetworkManagerOnNetworkThread( base::WaitableEvent* event, - std::unique_ptr<MdnsResponderAdapter> mdns_responder) { - DCHECK(GetChromeNetworkThread().task_runner()->BelongsToCurrentThread()); - // The task to initialize `network_thread_` was posted to the same thread, so - // there is no need to wait on its event. - DCHECK(GetNetworkThread()); + std::unique_ptr<MdnsResponderAdapter> mdns_responder, + rtc::Thread** thread) { + DCHECK(chrome_network_thread_.task_runner()->BelongsToCurrentThread()); + + jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); + jingle_glue::JingleThreadWrapper::current()->set_send_allowed(true); + *thread = jingle_glue::JingleThreadWrapper::current(); network_manager_ = std::make_unique<blink::IpcNetworkManager>( - p2p_socket_dispatcher_.Get(), std::move(mdns_responder)); + p2p_socket_dispatcher_.get(), std::move(mdns_responder)); event->Signal(); } -void PeerConnectionDependencyFactory::DeleteIpcNetworkManager( - base::WaitableEvent* event) { - DCHECK(GetChromeNetworkThread().task_runner()->BelongsToCurrentThread()); +void PeerConnectionDependencyFactory::DeleteIpcNetworkManager() { + DCHECK(chrome_network_thread_.task_runner()->BelongsToCurrentThread()); network_manager_.reset(); - event->Signal(); -} - -void PeerConnectionDependencyFactory::ContextDestroyed() { - CleanupPeerConnectionFactory(); } void PeerConnectionDependencyFactory::CleanupPeerConnectionFactory() { DVLOG(1) << "PeerConnectionDependencyFactory::CleanupPeerConnectionFactory()"; pc_factory_ = nullptr; if (network_manager_) { - base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL, - base::WaitableEvent::InitialState::NOT_SIGNALED); // The network manager needs to free its resources on the thread they were - // created, which is the network thread. - PostCrossThreadTask( - *GetWebRtcNetworkTaskRunner(), FROM_HERE, - CrossThreadBindOnce( - &PeerConnectionDependencyFactory::DeleteIpcNetworkManager, - WrapCrossThreadPersistent(this), CrossThreadUnretained(&event))); - - event.Wait(); - DCHECK(!network_manager_); + // created, which is the worked thread. + if (chrome_network_thread_.IsRunning()) { + PostCrossThreadTask( + *chrome_network_thread_.task_runner().get(), FROM_HERE, + CrossThreadBindOnce( + &PeerConnectionDependencyFactory::DeleteIpcNetworkManager, + CrossThreadUnretained(this))); + // Stopping the thread will wait until all tasks have been + // processed before returning. We wait for the above task to finish before + // letting the the function continue to avoid any potential race issues. + chrome_network_thread_.Stop(); + DCHECK(!network_manager_); + } else { + NOTREACHED() << "Worker thread not running."; + } } } @@ -730,8 +617,8 @@ scoped_refptr<base::SingleThreadTaskRunner> PeerConnectionDependencyFactory::GetWebRtcNetworkTaskRunner() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - return GetChromeNetworkThread().IsRunning() - ? GetChromeNetworkThread().task_runner() + return chrome_network_thread_.IsRunning() + ? chrome_network_thread_.task_runner() : nullptr; } @@ -739,8 +626,8 @@ PeerConnectionDependencyFactory::GetWebRtcSignalingTaskRunner() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); EnsureInitialized(); - return GetChromeSignalingThread().IsRunning() - ? GetChromeSignalingThread().task_runner() + return chrome_signaling_thread_.IsRunning() + ? chrome_signaling_thread_.task_runner() : nullptr; } @@ -780,10 +667,4 @@ PeerConnectionDependencyFactory::GetGpuFactories() { return gpu_factories_; } - -void PeerConnectionDependencyFactory::Trace(Visitor* visitor) const { - Supplement<ExecutionContext>::Trace(visitor); - ExecutionContextLifecycleObserver::Trace(visitor); - visitor->Trace(p2p_socket_dispatcher_); -} } // namespace blink
diff --git a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.h b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.h index 1e2e7f4..a8806c8 100644 --- a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.h +++ b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.h
@@ -7,15 +7,11 @@ #include "base/macros.h" #include "base/single_thread_task_runner.h" +#include "base/task/current_thread.h" #include "base/threading/thread.h" #include "base/threading/thread_checker.h" -#include "base/types/pass_key.h" -#include "third_party/blink/renderer/core/execution_context/execution_context.h" -#include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h" #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" -#include "third_party/blink/renderer/platform/mojo/mojo_binding_context.h" -#include "third_party/blink/renderer/platform/supplementable.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/webrtc/api/peer_connection_interface.h" @@ -53,18 +49,12 @@ // Object factory for RTC PeerConnections. class MODULES_EXPORT PeerConnectionDependencyFactory - : public GarbageCollected<PeerConnectionDependencyFactory>, - public Supplement<ExecutionContext>, - public ExecutionContextLifecycleObserver { + : base::CurrentThread::DestructionObserver { public: - static const char kSupplementName[]; - - static PeerConnectionDependencyFactory& From(ExecutionContext& context); - PeerConnectionDependencyFactory( - ExecutionContext& context, - base::PassKey<PeerConnectionDependencyFactory>); ~PeerConnectionDependencyFactory() override; + static PeerConnectionDependencyFactory* GetInstance(); + // Create a RTCPeerConnectionHandler object. std::unique_ptr<RTCPeerConnectionHandler> CreateRTCPeerConnectionHandler( RTCPeerConnectionHandlerClient* client, @@ -130,11 +120,8 @@ media::GpuVideoAcceleratorFactories* GetGpuFactories(); - void Trace(Visitor*) const override; - protected: - // Ctor for tests. - PeerConnectionDependencyFactory(); + PeerConnectionDependencyFactory(bool create_p2p_socket_dispatcher); virtual const scoped_refptr<webrtc::PeerConnectionFactoryInterface>& GetPcFactory(); @@ -144,8 +131,10 @@ void EnsureWebRtcAudioDeviceImpl(); private: - // ExecutionContextLifecycleObserver overrides: - void ContextDestroyed() override; + // Implement base::CurrentThread::DestructionObserver. + // This makes sure the libjingle PeerConnectionFactory is released before + // the renderer message loop is destroyed. + void WillDestroyCurrentMessageLoop() override; // Functions related to Stun probing trial to determine how fast we could send // Stun request without being dropped by NAT. @@ -162,13 +151,16 @@ media::DecoderFactory* media_decoder_factory, base::WaitableEvent* event); + void InitializeWorkerThread(rtc::Thread** thread, base::WaitableEvent* event); + void CreateIpcNetworkManagerOnNetworkThread( base::WaitableEvent* event, - std::unique_ptr<MdnsResponderAdapter> mdns_responder); - void DeleteIpcNetworkManager(base::WaitableEvent* event); + std::unique_ptr<MdnsResponderAdapter> mdns_responder, + rtc::Thread** thread); + void DeleteIpcNetworkManager(); void CleanupPeerConnectionFactory(); - // network_manager_ must be deleted on the network thread. The network manager + // network_manager_ must be deleted on the worker thread. The network manager // uses |p2p_socket_dispatcher_|. std::unique_ptr<blink::IpcNetworkManager> network_manager_; std::unique_ptr<IpcPacketSocketFactory> socket_factory_; @@ -176,12 +168,21 @@ scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_; // Dispatches all P2P sockets. - Member<P2PSocketDispatcher> p2p_socket_dispatcher_; + scoped_refptr<P2PSocketDispatcher> p2p_socket_dispatcher_; scoped_refptr<blink::WebRtcAudioDeviceImpl> audio_device_; media::GpuVideoAcceleratorFactories* gpu_factories_; + // PeerConnection threads. signaling_thread_ is created from the + // "current" chrome thread. + rtc::Thread* signaling_thread_ = nullptr; + rtc::Thread* worker_thread_ = nullptr; + rtc::Thread* network_thread_ = nullptr; + base::Thread chrome_signaling_thread_; + base::Optional<base::Thread> chrome_worker_thread_; + base::Thread chrome_network_thread_; + THREAD_CHECKER(thread_checker_); DISALLOW_COPY_AND_ASSIGN(PeerConnectionDependencyFactory);
diff --git a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory_test.cc b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory_test.cc index 053e84ad..3a01919 100644 --- a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory_test.cc
@@ -16,11 +16,12 @@ public: void SetUp() override { dependency_factory_ = - MakeGarbageCollected<MockPeerConnectionDependencyFactory>(); + std::make_unique<blink::MockPeerConnectionDependencyFactory>(); } protected: - Persistent<MockPeerConnectionDependencyFactory> dependency_factory_; + std::unique_ptr<blink::MockPeerConnectionDependencyFactory> + dependency_factory_; }; TEST_F(PeerConnectionDependencyFactoryTest, CreateRTCPeerConnectionHandler) {
diff --git a/third_party/blink/renderer/modules/peerconnection/peer_connection_tracker_test.cc b/third_party/blink/renderer/modules/peerconnection/peer_connection_tracker_test.cc index b500d51..c803e17 100644 --- a/third_party/blink/renderer/modules/peerconnection/peer_connection_tracker_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/peer_connection_tracker_test.cc
@@ -16,7 +16,6 @@ #include "third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.h" #include "third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_client.h" #include "third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h" -#include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/mediastream/media_constraints.h" #include "third_party/blink/renderer/platform/peerconnection/rtc_offer_options_platform.h" #include "third_party/blink/renderer/platform/peerconnection/rtc_rtp_receiver_platform.h" @@ -124,23 +123,17 @@ class MockPeerConnectionHandler : public RTCPeerConnectionHandler { public: MockPeerConnectionHandler() - : MockPeerConnectionHandler( - MakeGarbageCollected<MockPeerConnectionDependencyFactory>()) {} + : RTCPeerConnectionHandler( + &client_, + &dependency_factory_, + blink::scheduler::GetSingleThreadTaskRunnerForTesting(), + /*force_encoded_audio_insertable_streams=*/false, + /*force_encoded_video_insertable_streams=*/false) {} MOCK_METHOD0(CloseClientPeerConnection, void()); MOCK_METHOD1(OnThermalStateChange, void(mojom::blink::DeviceThermalState)); private: - explicit MockPeerConnectionHandler( - MockPeerConnectionDependencyFactory* factory) - : RTCPeerConnectionHandler( - &client_, - factory, - blink::scheduler::GetSingleThreadTaskRunnerForTesting(), - /*force_encoded_audio_insertable_streams=*/false, - /*force_encoded_video_insertable_streams=*/false), - factory_(factory) {} - - Persistent<MockPeerConnectionDependencyFactory> factory_; + blink::MockPeerConnectionDependencyFactory dependency_factory_; MockRTCPeerConnectionHandlerClient client_; };
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_certificate_generator.cc b/third_party/blink/renderer/modules/peerconnection/rtc_certificate_generator.cc index c44ff7e7..77c2a8c 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_certificate_generator.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_certificate_generator.cc
@@ -10,7 +10,6 @@ #include "base/bind.h" #include "base/macros.h" #include "base/single_thread_task_runner.h" -#include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.h" #include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h" #include "third_party/webrtc/api/scoped_refptr.h" @@ -87,16 +86,15 @@ const rtc::KeyParams& key_params, const absl::optional<uint64_t>& expires_ms, blink::RTCCertificateCallback completion_callback, - ExecutionContext& context, scoped_refptr<base::SingleThreadTaskRunner> task_runner) { DCHECK(key_params.IsValid()); - auto& pc_dependency_factory = - blink::PeerConnectionDependencyFactory::From(context); - pc_dependency_factory.EnsureInitialized(); + auto* pc_dependency_factory = + blink::PeerConnectionDependencyFactory::GetInstance(); + pc_dependency_factory->EnsureInitialized(); scoped_refptr<RTCCertificateGeneratorRequest> request = base::MakeRefCounted<RTCCertificateGeneratorRequest>( - task_runner, pc_dependency_factory.GetWebRtcNetworkTaskRunner()); + task_runner, pc_dependency_factory->GetWebRtcNetworkTaskRunner()); request->GenerateCertificateAsync(key_params, expires_ms, std::move(completion_callback)); } @@ -106,22 +104,18 @@ void RTCCertificateGenerator::GenerateCertificate( const rtc::KeyParams& key_params, blink::RTCCertificateCallback completion_callback, - ExecutionContext& context, scoped_refptr<base::SingleThreadTaskRunner> task_runner) { - GenerateCertificateWithOptionalExpiration(key_params, absl::nullopt, - std::move(completion_callback), - context, task_runner); + GenerateCertificateWithOptionalExpiration( + key_params, absl::nullopt, std::move(completion_callback), task_runner); } void RTCCertificateGenerator::GenerateCertificateWithExpiration( const rtc::KeyParams& key_params, uint64_t expires_ms, blink::RTCCertificateCallback completion_callback, - ExecutionContext& context, scoped_refptr<base::SingleThreadTaskRunner> task_runner) { - GenerateCertificateWithOptionalExpiration(key_params, expires_ms, - std::move(completion_callback), - context, task_runner); + GenerateCertificateWithOptionalExpiration( + key_params, expires_ms, std::move(completion_callback), task_runner); } bool RTCCertificateGenerator::IsSupportedKeyParams(
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_certificate_generator.h b/third_party/blink/renderer/modules/peerconnection/rtc_certificate_generator.h index d8846c7..5fc6b15 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_certificate_generator.h +++ b/third_party/blink/renderer/modules/peerconnection/rtc_certificate_generator.h
@@ -16,8 +16,6 @@ namespace blink { -class ExecutionContext; - using RTCCertificateCallback = base::OnceCallback<void(rtc::scoped_refptr<rtc::RTCCertificate>)>; @@ -35,13 +33,11 @@ void GenerateCertificate( const rtc::KeyParams& key_params, blink::RTCCertificateCallback completion_callback, - ExecutionContext& context, scoped_refptr<base::SingleThreadTaskRunner> task_runner); void GenerateCertificateWithExpiration( const rtc::KeyParams& key_params, uint64_t expires_ms, blink::RTCCertificateCallback completion_callback, - ExecutionContext& context, scoped_refptr<base::SingleThreadTaskRunner> task_runner); // Determines if the parameters are supported by |GenerateCertificate|.
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_dtls_transport.cc b/third_party/blink/renderer/modules/peerconnection/rtc_dtls_transport.cc index 94b752fc..f68ab13 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_dtls_transport.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_dtls_transport.cc
@@ -52,8 +52,9 @@ scoped_refptr<base::SingleThreadTaskRunner> proxy_thread = frame->GetTaskRunner(TaskType::kNetworking); scoped_refptr<base::SingleThreadTaskRunner> host_thread = - PeerConnectionDependencyFactory::From(*context) - .GetWebRtcNetworkTaskRunner(); + PeerConnectionDependencyFactory::GetInstance() + ->GetWebRtcNetworkTaskRunner(); + return DtlsTransportProxy::Create(*frame, proxy_thread, host_thread, native_transport, delegate); }
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_ice_transport.cc b/third_party/blink/renderer/modules/peerconnection/rtc_ice_transport.cc index 8e8d640b..c8a127df 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_ice_transport.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_ice_transport.cc
@@ -86,10 +86,10 @@ scoped_refptr<base::SingleThreadTaskRunner> proxy_thread = context->GetTaskRunner(TaskType::kNetworking); - PeerConnectionDependencyFactory::From(*context).EnsureInitialized(); + PeerConnectionDependencyFactory::GetInstance()->EnsureInitialized(); scoped_refptr<base::SingleThreadTaskRunner> host_thread = - PeerConnectionDependencyFactory::From(*context) - .GetWebRtcNetworkTaskRunner(); + PeerConnectionDependencyFactory::GetInstance() + ->GetWebRtcNetworkTaskRunner(); return MakeGarbageCollected<RTCIceTransport>( context, std::move(proxy_thread), std::move(host_thread), std::make_unique<DtlsIceTransportAdapterCrossThreadFactory>(
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc index cb74611..3149a6b 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc
@@ -806,8 +806,8 @@ std::move(g_create_rpc_peer_connection_handler_callback_.Get()).Run(); } else { peer_handler_ = - PeerConnectionDependencyFactory::From(*context) - .CreateRTCPeerConnectionHandler( + PeerConnectionDependencyFactory::GetInstance() + ->CreateRTCPeerConnectionHandler( this, window->GetTaskRunner(TaskType::kInternalMedia), force_encoded_audio_insertable_streams_, force_encoded_video_insertable_streams_); @@ -1896,12 +1896,11 @@ ->GetTaskRunner(blink::TaskType::kInternalMedia); if (!expires) { certificate_generator->GenerateCertificate( - key_params.value(), std::move(completion_callback), - *ExecutionContext::From(script_state), task_runner); + key_params.value(), std::move(completion_callback), task_runner); } else { certificate_generator->GenerateCertificateWithExpiration( key_params.value(), expires.value(), std::move(completion_callback), - *ExecutionContext::From(script_state), task_runner); + task_runner); } return promise;
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.cc b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.cc index 060eb32..0f595a96 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.cc
@@ -1137,10 +1137,6 @@ // garbage collection. client_ = nullptr; is_unregistered_ = true; - - // Reset the `PeerConnectionDependencyFactory` so we don't prevent it from - // being garbage-collected. - dependency_factory_ = nullptr; } bool RTCPeerConnectionHandler::Initialize( @@ -1151,7 +1147,6 @@ ExceptionState& exception_state) { DCHECK(task_runner_->RunsTasksInCurrentSequence()); DCHECK(frame); - DCHECK(dependency_factory_); frame_ = frame; CHECK(!initialize_called_); @@ -1203,7 +1198,6 @@ PeerConnectionTracker* peer_connection_tracker, ExceptionState& exception_state) { DCHECK(task_runner_->RunsTasksInCurrentSequence()); - DCHECK(dependency_factory_); CHECK(!initialize_called_); initialize_called_ = true; @@ -1577,7 +1571,6 @@ RTCVoidRequest* request, RTCIceCandidatePlatform* candidate) { DCHECK(task_runner_->RunsTasksInCurrentSequence()); - DCHECK(dependency_factory_); TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::addICECandidate"); std::unique_ptr<webrtc::IceCandidateInterface> native_candidate( dependency_factory_->CreateIceCandidate( @@ -1981,7 +1974,6 @@ bool RTCPeerConnectionHandler::RemoveTrackPlanB( blink::RTCRtpSenderPlatform* web_sender) { - DCHECK(task_runner_->RunsTasksInCurrentSequence()); DCHECK_EQ(configuration_.sdp_semantics, webrtc::SdpSemantics::kPlanB); auto* track = web_sender->Track(); auto it = FindSender(web_sender->Id()); @@ -2326,7 +2318,6 @@ void RTCPeerConnectionHandler::TrackIceConnectionStateChange( RTCPeerConnectionHandler::IceConnectionStateVersion version, webrtc::PeerConnectionInterface::IceConnectionState state) { - DCHECK(task_runner_->RunsTasksInCurrentSequence()); if (!peer_connection_tracker_) return; switch (version) { @@ -2486,7 +2477,6 @@ webrtc::PeerConnectionInterface::SignalingState signaling_state, std::vector<blink::RtpTransceiverState> transceiver_states, bool is_remote_description) { - DCHECK(task_runner_->RunsTasksInCurrentSequence()); DCHECK_EQ(configuration_.sdp_semantics, webrtc::SdpSemantics::kUnifiedPlan); Vector<std::unique_ptr<RTCRtpTransceiverPlatform>> platform_transceivers( SafeCast<WTF::wtf_size_t>(transceiver_states.size())); @@ -2756,7 +2746,6 @@ scoped_refptr<base::SingleThreadTaskRunner> RTCPeerConnectionHandler::signaling_thread() const { DCHECK(task_runner_->RunsTasksInCurrentSequence()); - DCHECK(dependency_factory_); return dependency_factory_->GetWebRtcSignalingTaskRunner(); }
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h index c773961..e6f0a62 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h +++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h
@@ -460,9 +460,9 @@ webrtc::PeerConnectionInterface::SignalingState previous_signaling_state_ = webrtc::PeerConnectionInterface::kStable; - // Will be reset to nullptr when the handler is `StopAndUnregister()`-ed, so - // it doesn't prevent the factory from being garbage-collected. - Persistent<PeerConnectionDependencyFactory> dependency_factory_; + // |dependency_factory_| is a raw pointer, and is valid for the lifetime of + // RenderThreadImpl. + blink::PeerConnectionDependencyFactory* const dependency_factory_ = nullptr; blink::WebLocalFrame* frame_ = nullptr;
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler_test.cc b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler_test.cc index 5e1fcd4..2541959 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler_test.cc
@@ -33,7 +33,6 @@ #include "third_party/blink/public/platform/web_url.h" #include "third_party/blink/public/web/web_heap.h" #include "third_party/blink/renderer/core/frame/local_frame.h" -#include "third_party/blink/renderer/core/testing/sim/sim_test.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_video_track.h" #include "third_party/blink/renderer/modules/mediastream/mock_media_stream_video_source.h" #include "third_party/blink/renderer/modules/mediastream/processed_local_audio_source.h" @@ -283,19 +282,18 @@ return native_peer_connection()->observer(); } - bool HasThermalUmaListener() const { return thermal_uma_listener(); } + bool HasThermalUmaListner() const { return thermal_uma_listener(); } }; -class RTCPeerConnectionHandlerTest : public SimTest { +class RTCPeerConnectionHandlerTest : public ::testing::Test { public: RTCPeerConnectionHandlerTest() : mock_peer_connection_(nullptr) {} void SetUp() override { - SimTest::SetUp(); mock_client_ = std::make_unique<NiceMock<MockRTCPeerConnectionHandlerClient>>(); mock_dependency_factory_ = - MakeGarbageCollected<MockPeerConnectionDependencyFactory>(); + std::make_unique<blink::MockPeerConnectionDependencyFactory>(); pc_handler_ = CreateRTCPeerConnectionHandlerUnderTest(); mock_tracker_ = MakeGarbageCollected<NiceMock<MockPeerConnectionTracker>>(); @@ -311,7 +309,6 @@ } void TearDown() override { - SimTest::TearDown(); pc_handler_ = nullptr; mock_tracker_ = nullptr; mock_dependency_factory_ = nullptr; @@ -322,7 +319,7 @@ std::unique_ptr<RTCPeerConnectionHandlerUnderTest> CreateRTCPeerConnectionHandlerUnderTest() { return std::make_unique<RTCPeerConnectionHandlerUnderTest>( - mock_client_.get(), mock_dependency_factory_.Get()); + mock_client_.get(), mock_dependency_factory_.get()); } // Creates a WebKit local MediaStream. @@ -333,7 +330,7 @@ audio_track_label, MediaStreamSource::kTypeAudio, String::FromUTF8("audio_track"), false /* remote */); auto processed_audio_source = std::make_unique<ProcessedLocalAudioSource>( - *LocalFrameRoot().GetFrame(), + nullptr /* consumer_web_frame is N/A for non-browser tests */, MediaStreamDevice(blink::mojom::MediaStreamType::DEVICE_AUDIO_CAPTURE, "mock_device_id", "Mock device", media::AudioParameters::kAudioCDSampleRate, @@ -587,7 +584,8 @@ ScopedTestingPlatformSupport<AudioCapturerSourceTestingPlatformSupport> webrtc_audio_device_platform_support_; std::unique_ptr<MockRTCPeerConnectionHandlerClient> mock_client_; - Persistent<MockPeerConnectionDependencyFactory> mock_dependency_factory_; + std::unique_ptr<blink::MockPeerConnectionDependencyFactory> + mock_dependency_factory_; Persistent<NiceMock<MockPeerConnectionTracker>> mock_tracker_; std::unique_ptr<RTCPeerConnectionHandlerUnderTest> pc_handler_; @@ -1283,7 +1281,7 @@ for (bool force_encoded_audio_insertable_streams : {true, false}) { for (bool force_encoded_video_insertable_streams : {true, false}) { auto handler = std::make_unique<RTCPeerConnectionHandlerUnderTest>( - mock_client_.get(), mock_dependency_factory_.Get(), + mock_client_.get(), mock_dependency_factory_.get(), force_encoded_audio_insertable_streams, force_encoded_video_insertable_streams); EXPECT_EQ(handler->force_encoded_audio_insertable_streams(), @@ -1351,10 +1349,10 @@ TEST_F(RTCPeerConnectionHandlerTest, ThermalStateUmaListenerCreatedWhenVideoStreamAdded) { base::HistogramTester histogram; - EXPECT_FALSE(pc_handler_->HasThermalUmaListener()); + EXPECT_FALSE(pc_handler_->HasThermalUmaListner()); MediaStreamDescriptor* local_stream = CreateLocalMediaStream("local_stream"); EXPECT_TRUE(AddStream(local_stream)); - EXPECT_TRUE(pc_handler_->HasThermalUmaListener()); + EXPECT_TRUE(pc_handler_->HasThermalUmaListner()); } } // namespace blink
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.cc b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.cc index 7a96344..adf33013 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.cc
@@ -291,8 +291,8 @@ HeapVector<Member<RTCRtpHeaderExtensionCapability>>()); std::unique_ptr<webrtc::RtpCapabilities> rtc_capabilities = - PeerConnectionDependencyFactory::From(*ExecutionContext::From(state)) - .GetReceiverCapabilities(kind); + PeerConnectionDependencyFactory::GetInstance()->GetReceiverCapabilities( + kind); HeapVector<Member<RTCRtpCodecCapability>> codecs; codecs.ReserveInitialCapacity(
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver_impl_test.cc b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver_impl_test.cc index ce70378..49e323b 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver_impl_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver_impl_test.cc
@@ -33,12 +33,12 @@ public: void SetUp() override { dependency_factory_ = - MakeGarbageCollected<MockPeerConnectionDependencyFactory>(); + std::make_unique<blink::MockPeerConnectionDependencyFactory>(); main_thread_ = blink::scheduler::GetSingleThreadTaskRunnerForTesting(); track_map_ = base::MakeRefCounted<blink::WebRtcMediaStreamTrackAdapterMap>( - dependency_factory_.Get(), main_thread_); + dependency_factory_.get(), main_thread_); peer_connection_ = new rtc::RefCountedObject<blink::MockPeerConnectionImpl>( - dependency_factory_.Get(), nullptr); + dependency_factory_.get(), nullptr); } void TearDown() override { @@ -106,7 +106,8 @@ ScopedTestingPlatformSupport<IOTaskRunnerTestingPlatformSupport> platform_; - Persistent<blink::MockPeerConnectionDependencyFactory> dependency_factory_; + std::unique_ptr<blink::MockPeerConnectionDependencyFactory> + dependency_factory_; scoped_refptr<base::SingleThreadTaskRunner> main_thread_; scoped_refptr<blink::WebRtcMediaStreamTrackAdapterMap> track_map_; rtc::scoped_refptr<blink::MockPeerConnectionImpl> peer_connection_;
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender.cc b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender.cc index 7612cd53..8718730 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender.cc
@@ -723,9 +723,6 @@ RTCRtpCapabilities* RTCRtpSender::getCapabilities(ScriptState* state, const String& kind) { - if (!state->ContextIsValid()) - return nullptr; - if (kind != "audio" && kind != "video") return nullptr; @@ -735,8 +732,8 @@ HeapVector<Member<RTCRtpHeaderExtensionCapability>>()); std::unique_ptr<webrtc::RtpCapabilities> rtc_capabilities = - PeerConnectionDependencyFactory::From(*ExecutionContext::From(state)) - .GetSenderCapabilities(kind); + PeerConnectionDependencyFactory::GetInstance()->GetSenderCapabilities( + kind); HeapVector<Member<RTCRtpCodecCapability>> codecs; codecs.ReserveInitialCapacity(
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender_impl_test.cc b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender_impl_test.cc index 23d7cef..1a98d75 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender_impl_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender_impl_test.cc
@@ -20,7 +20,6 @@ #include "third_party/blink/renderer/modules/peerconnection/test_webrtc_stats_report_obtainer.h" #include "third_party/blink/renderer/modules/peerconnection/testing/mock_rtp_sender.h" #include "third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_map.h" -#include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/mediastream/media_stream_audio_source.h" #include "third_party/blink/renderer/platform/mediastream/media_stream_component.h" #include "third_party/blink/renderer/platform/mediastream/media_stream_source.h" @@ -39,12 +38,12 @@ public: void SetUp() override { dependency_factory_ = - MakeGarbageCollected<MockPeerConnectionDependencyFactory>(); + std::make_unique<blink::MockPeerConnectionDependencyFactory>(); main_thread_ = blink::scheduler::GetSingleThreadTaskRunnerForTesting(); track_map_ = base::MakeRefCounted<blink::WebRtcMediaStreamTrackAdapterMap>( - dependency_factory_.Get(), main_thread_); + dependency_factory_.get(), main_thread_); peer_connection_ = new rtc::RefCountedObject<blink::MockPeerConnectionImpl>( - dependency_factory_.Get(), nullptr); + dependency_factory_.get(), nullptr); mock_webrtc_sender_ = new rtc::RefCountedObject<MockRtpSender>(); } @@ -144,7 +143,8 @@ ScopedTestingPlatformSupport<IOTaskRunnerTestingPlatformSupport> platform_; - Persistent<MockPeerConnectionDependencyFactory> dependency_factory_; + std::unique_ptr<blink::MockPeerConnectionDependencyFactory> + dependency_factory_; scoped_refptr<base::SingleThreadTaskRunner> main_thread_; scoped_refptr<blink::WebRtcMediaStreamTrackAdapterMap> track_map_; rtc::scoped_refptr<blink::MockPeerConnectionImpl> peer_connection_;
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_transceiver_impl_test.cc b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_transceiver_impl_test.cc index a0999d81..725edf11 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_transceiver_impl_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_transceiver_impl_test.cc
@@ -32,12 +32,12 @@ public: void SetUp() override { dependency_factory_ = - MakeGarbageCollected<MockPeerConnectionDependencyFactory>(); + std::make_unique<blink::MockPeerConnectionDependencyFactory>(); main_task_runner_ = blink::scheduler::GetSingleThreadTaskRunnerForTesting(); track_map_ = base::MakeRefCounted<blink::WebRtcMediaStreamTrackAdapterMap>( - dependency_factory_.Get(), main_task_runner_); + dependency_factory_.get(), main_task_runner_); peer_connection_ = new rtc::RefCountedObject<blink::MockPeerConnectionImpl>( - dependency_factory_.Get(), nullptr); + dependency_factory_.get(), nullptr); } void TearDown() override { @@ -178,7 +178,8 @@ ScopedTestingPlatformSupport<IOTaskRunnerTestingPlatformSupport> platform_; protected: - Persistent<MockPeerConnectionDependencyFactory> dependency_factory_; + std::unique_ptr<blink::MockPeerConnectionDependencyFactory> + dependency_factory_; scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; scoped_refptr<blink::WebRtcMediaStreamTrackAdapterMap> track_map_; rtc::scoped_refptr<blink::MockPeerConnectionImpl> peer_connection_;
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_sctp_transport.cc b/third_party/blink/renderer/modules/peerconnection/rtc_sctp_transport.cc index 9bb3c0f..2fedeb93 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_sctp_transport.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_sctp_transport.cc
@@ -64,8 +64,8 @@ : RTCSctpTransport(context, native_transport, context->GetTaskRunner(TaskType::kNetworking), - PeerConnectionDependencyFactory::From(*context) - .GetWebRtcNetworkTaskRunner()) {} + PeerConnectionDependencyFactory::GetInstance() + ->GetWebRtcNetworkTaskRunner()) {} RTCSctpTransport::RTCSctpTransport( ExecutionContext* context,
diff --git a/third_party/blink/renderer/modules/peerconnection/transceiver_state_surfacer_test.cc b/third_party/blink/renderer/modules/peerconnection/transceiver_state_surfacer_test.cc index faa1b1bd..9211298c 100644 --- a/third_party/blink/renderer/modules/peerconnection/transceiver_state_surfacer_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/transceiver_state_surfacer_test.cc
@@ -44,11 +44,11 @@ public: void SetUp() override { dependency_factory_ = - MakeGarbageCollected<MockPeerConnectionDependencyFactory>(); + std::make_unique<blink::MockPeerConnectionDependencyFactory>(); main_task_runner_ = blink::scheduler::GetSingleThreadTaskRunnerForTesting(); track_adapter_map_ = base::MakeRefCounted<blink::WebRtcMediaStreamTrackAdapterMap>( - dependency_factory_.Get(), main_task_runner_); + dependency_factory_.get(), main_task_runner_); surfacer_ = std::make_unique<TransceiverStateSurfacer>( main_task_runner_, signaling_task_runner()); DummyExceptionStateForTesting exception_state; @@ -276,7 +276,7 @@ protected: scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_; - CrossThreadPersistent<MockPeerConnectionDependencyFactory> + std::unique_ptr<blink::MockPeerConnectionDependencyFactory> dependency_factory_; scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; scoped_refptr<blink::WebRtcMediaStreamTrackAdapterMap> track_adapter_map_;
diff --git a/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter.cc b/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter.cc index 36188170..6bfc928 100644 --- a/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter.cc +++ b/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter.cc
@@ -70,7 +70,6 @@ blink::PeerConnectionDependencyFactory* factory, const scoped_refptr<base::SingleThreadTaskRunner>& main_thread) : factory_(factory), - webrtc_signaling_task_runner_(nullptr), main_thread_(main_thread), remote_track_can_complete_initialization_( base::WaitableEvent::ResetPolicy::MANUAL, @@ -172,16 +171,9 @@ // the webrtc::AudioSourceInterface, and also do not need references to the // audio level calculator or audio processor passed to the sink. webrtc::AudioSourceInterface* source_interface = nullptr; - - // Initialize `webrtc_signaling_task_runner_` here instead of the ctor since - // `GetWebRtcSignalingTaskRunner()` must be called on the main thread. - auto factory = factory_.Lock(); - DCHECK(factory); - webrtc_signaling_task_runner_ = factory->GetWebRtcSignalingTaskRunner(); - local_track_audio_sink_ = std::make_unique<blink::WebRtcAudioSink>( - component_->Id().Utf8(), source_interface, webrtc_signaling_task_runner_, - main_thread_); + component_->Id().Utf8(), source_interface, + factory_->GetWebRtcSignalingTaskRunner(), main_thread_); if (auto* media_stream_source = blink::ProcessedLocalAudioSource::From( blink::MediaStreamAudioSource::From(component_->Source()))) { @@ -207,17 +199,10 @@ DCHECK(component); DCHECK_EQ(component->Source()->GetType(), MediaStreamSource::kTypeVideo); component_ = component; - auto factory = factory_.Lock(); - DCHECK(factory); local_track_video_sink_ = std::make_unique<blink::MediaStreamVideoWebRtcSink>( - component_, factory, main_thread_); + component_, factory_, main_thread_); webrtc_track_ = local_track_video_sink_->webrtc_video_track(); DCHECK(webrtc_track_); - - // Initialize `webrtc_signaling_task_runner_` here instead of the ctor since - // `GetWebRtcSignalingTaskRunner()` must be called on the main thread. - webrtc_signaling_task_runner_ = factory->GetWebRtcSignalingTaskRunner(); - is_initialized_ = true; } @@ -280,13 +265,6 @@ remote_video_track_adapter_->Initialize(); component_ = remote_video_track_adapter_->track(); } - - // Initialize `webrtc_signaling_task_runner_` here instead of the ctor since - // `GetWebRtcSignalingTaskRunner()` must be called on the main thread. - auto factory = factory_.Lock(); - DCHECK(factory); - webrtc_signaling_task_runner_ = factory->GetWebRtcSignalingTaskRunner(); - is_initialized_ = true; } @@ -326,10 +304,8 @@ DCHECK(main_thread_->BelongsToCurrentThread()); DCHECK(remote_audio_track_adapter_); DCHECK_EQ(component_->Source()->GetType(), MediaStreamSource::kTypeAudio); - - DCHECK(webrtc_signaling_task_runner_); PostCrossThreadTask( - *webrtc_signaling_task_runner_, FROM_HERE, + *factory_->GetWebRtcSignalingTaskRunner().get(), FROM_HERE, CrossThreadBindOnce( &WebRtcMediaStreamTrackAdapter:: UnregisterRemoteAudioTrackAdapterOnSignalingThread,
diff --git a/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter.h b/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter.h index 8882981..405267b0 100644 --- a/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter.h +++ b/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter.h
@@ -27,8 +27,6 @@ // There are different sinks/adapters used whether the track is local or remote // and whether it is an audio or video track; this adapter hides that fact and // lets you use a single class for any type of track. -// The adapter may be created and used from either the main thread or the -// webrtc signaling thread. class MODULES_EXPORT WebRtcMediaStreamTrackAdapter : public WTF::ThreadSafeRefCounted<WebRtcMediaStreamTrackAdapter, WebRtcMediaStreamTrackAdapterTraits> { @@ -110,17 +108,9 @@ void UnregisterRemoteAudioTrackAdapterOnSignalingThread(); void FinalizeRemoteTrackDisposingOnMainThread(); - // `factory_` is only accessed from the main thread (which owns it), but - // `this` may be constructed by the signaling thread (for remote tracks), - // making it impossible to construct a `WeakPersistent`. - // The track adapter is indirectly owned by `RTCPeerConnection`, which is - // outlived by the `PeerConnectionDependencyFactory`, so `factory_` should - // never be null (with the possible exception of the dtor). - const CrossThreadWeakPersistent<PeerConnectionDependencyFactory> factory_; - // Proper disposal of remote audio tracks needs to be done from the WebRTC - // signaling thread. Since `this` may be disposed after `factory_`, we cache - // the task runner, and use it to post the task to dispose of the track. - scoped_refptr<base::SingleThreadTaskRunner> webrtc_signaling_task_runner_; + // Pointer to a |PeerConnectionDependencyFactory| owned by the |RenderThread|. + // It's valid for the lifetime of |RenderThread|. + blink::PeerConnectionDependencyFactory* const factory_; scoped_refptr<base::SingleThreadTaskRunner> main_thread_; // Part of the initialization of remote tracks occurs on the signaling thread.
diff --git a/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_map.cc b/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_map.cc index 3d48465..60c220d 100644 --- a/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_map.cc +++ b/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_map.cc
@@ -129,7 +129,7 @@ // is blocked waiting for |lock_| we end up in a deadlock. base::AutoUnlock scoped_unlock(lock_); new_adapter = blink::WebRtcMediaStreamTrackAdapter::CreateLocalTrackAdapter( - factory_.Lock(), main_thread_, component); + factory_, main_thread_, component); } DCHECK(new_adapter->is_initialized()); local_track_adapters_.Insert(component->UniqueId(), new_adapter); @@ -189,7 +189,7 @@ base::AutoUnlock scoped_unlock(lock_); new_adapter = blink::WebRtcMediaStreamTrackAdapter::CreateRemoteTrackAdapter( - factory_.Lock(), main_thread_, webrtc_track); + factory_, main_thread_, webrtc_track); } remote_track_adapters_.Insert(webrtc_track.get(), new_adapter); // The new adapter is initialized in a post to the main thread. As soon as it
diff --git a/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_map.h b/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_map.h index e3e8d8c..eb3a77b 100644 --- a/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_map.h +++ b/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_map.h
@@ -23,11 +23,6 @@ // creating, initializing and disposing track adapters independently of media // streams. Adapters are accessed via |AdapterRef|s, when all references to an // adapter are destroyed it is disposed and removed from the map. -// Objects of this class must be constructed on the main thread, after which -// they may be accessed from any thread. The two exceptions to that are -// `GetOrCreateLocalTrackAdapter()` that must be called from the main thread and -// `GetOrCreateRemoteTrackAdapter()` which must not be called from the main -// thread. class MODULES_EXPORT WebRtcMediaStreamTrackAdapterMap : public WTF::ThreadSafeRefCounted<WebRtcMediaStreamTrackAdapterMap> { public: @@ -140,10 +135,9 @@ // Invoke on the main thread. virtual ~WebRtcMediaStreamTrackAdapterMap(); - // The adapter map is indirectly owned by `RTCPeerConnection`, which is - // outlived by the `PeerConnectionDependencyFactory`, so `factory_` should - // never be null (with the possible exception of the dtor). - const CrossThreadWeakPersistent<PeerConnectionDependencyFactory> factory_; + // Pointer to a |PeerConnectionDependencyFactory| owned by the |RenderThread|. + // It's valid for the lifetime of |RenderThread|. + blink::PeerConnectionDependencyFactory* const factory_; scoped_refptr<base::SingleThreadTaskRunner> main_thread_; mutable base::Lock lock_;
diff --git a/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_map_test.cc b/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_map_test.cc index ecad32a..21d582e 100644 --- a/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_map_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_map_test.cc
@@ -27,10 +27,10 @@ public: void SetUp() override { dependency_factory_ = - MakeGarbageCollected<MockPeerConnectionDependencyFactory>(); + std::make_unique<blink::MockPeerConnectionDependencyFactory>(); main_thread_ = blink::scheduler::GetSingleThreadTaskRunnerForTesting(); map_ = base::MakeRefCounted<blink::WebRtcMediaStreamTrackAdapterMap>( - dependency_factory_.Get(), main_thread_); + dependency_factory_.get(), main_thread_); } void TearDown() override { blink::WebHeap::CollectAllGarbageForTesting(); } @@ -110,7 +110,7 @@ protected: ScopedTestingPlatformSupport<IOTaskRunnerTestingPlatformSupport> platform_; - CrossThreadPersistent<MockPeerConnectionDependencyFactory> + std::unique_ptr<blink::MockPeerConnectionDependencyFactory> dependency_factory_; scoped_refptr<base::SingleThreadTaskRunner> main_thread_; scoped_refptr<blink::WebRtcMediaStreamTrackAdapterMap> map_;
diff --git a/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_test.cc b/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_test.cc index 966ca78..5b104a8 100644 --- a/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_test.cc
@@ -30,7 +30,7 @@ public: void SetUp() override { dependency_factory_ = - MakeGarbageCollected<MockPeerConnectionDependencyFactory>(); + std::make_unique<blink::MockPeerConnectionDependencyFactory>(); main_thread_ = blink::scheduler::GetSingleThreadTaskRunnerForTesting(); } @@ -76,7 +76,7 @@ webrtc::MediaStreamTrackInterface* webrtc_track) { track_adapter_ = blink::WebRtcMediaStreamTrackAdapter::CreateRemoteTrackAdapter( - dependency_factory_.Get(), main_thread_, webrtc_track); + dependency_factory_.get(), main_thread_, webrtc_track); } void HoldOntoAdapterReference( @@ -111,7 +111,7 @@ protected: ScopedTestingPlatformSupport<IOTaskRunnerTestingPlatformSupport> platform_; - CrossThreadPersistent<MockPeerConnectionDependencyFactory> + std::unique_ptr<blink::MockPeerConnectionDependencyFactory> dependency_factory_; scoped_refptr<base::SingleThreadTaskRunner> main_thread_; scoped_refptr<blink::WebRtcMediaStreamTrackAdapter> track_adapter_; @@ -120,7 +120,7 @@ TEST_F(WebRtcMediaStreamTrackAdapterTest, LocalAudioTrack) { track_adapter_ = blink::WebRtcMediaStreamTrackAdapter::CreateLocalTrackAdapter( - dependency_factory_.Get(), main_thread_, CreateLocalAudioTrack()); + dependency_factory_.get(), main_thread_, CreateLocalAudioTrack()); EXPECT_TRUE(track_adapter_->is_initialized()); EXPECT_TRUE(track_adapter_->track()); EXPECT_EQ(track_adapter_->track()->Source()->GetType(), @@ -140,7 +140,7 @@ TEST_F(WebRtcMediaStreamTrackAdapterTest, DISABLED_LocalVideoTrack) { track_adapter_ = blink::WebRtcMediaStreamTrackAdapter::CreateLocalTrackAdapter( - dependency_factory_.Get(), main_thread_, CreateLocalVideoTrack()); + dependency_factory_.get(), main_thread_, CreateLocalVideoTrack()); EXPECT_TRUE(track_adapter_->is_initialized()); EXPECT_TRUE(track_adapter_->track()); EXPECT_EQ(track_adapter_->track()->Source()->GetType(),
diff --git a/third_party/blink/renderer/modules/peerconnection/webrtc_set_description_observer_test.cc b/third_party/blink/renderer/modules/peerconnection/webrtc_set_description_observer_test.cc index b2c400c..9a79f11 100644 --- a/third_party/blink/renderer/modules/peerconnection/webrtc_set_description_observer_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/webrtc_set_description_observer_test.cc
@@ -223,11 +223,11 @@ void SetUp() override { pc_ = new MockPeerConnectionInterface; dependency_factory_ = - MakeGarbageCollected<MockPeerConnectionDependencyFactory>(); + std::make_unique<blink::MockPeerConnectionDependencyFactory>(); main_thread_ = blink::scheduler::GetSingleThreadTaskRunnerForTesting(); track_adapter_map_ = base::MakeRefCounted<blink::WebRtcMediaStreamTrackAdapterMap>( - dependency_factory_.Get(), main_thread_); + dependency_factory_.get(), main_thread_); observer_ = base::MakeRefCounted<WebRtcSetDescriptionObserverForTest>(); observer_handler_ = std::make_unique<ObserverHandlerWrapper>( handler_type_, main_thread_, @@ -362,7 +362,7 @@ protected: scoped_refptr<MockPeerConnectionInterface> pc_; - Persistent<MockPeerConnectionDependencyFactory> dependency_factory_; + std::unique_ptr<MockPeerConnectionDependencyFactory> dependency_factory_; scoped_refptr<base::SingleThreadTaskRunner> main_thread_; scoped_refptr<blink::WebRtcMediaStreamTrackAdapterMap> track_adapter_map_; scoped_refptr<WebRtcSetDescriptionObserverForTest> observer_;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_buffer.cc b/third_party/blink/renderer/modules/webgpu/gpu_buffer.cc index 0dde430..7e09fa8 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_buffer.cc +++ b/third_party/blink/renderer/modules/webgpu/gpu_buffer.cc
@@ -13,12 +13,14 @@ #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer_descriptor.h" #include "third_party/blink/renderer/core/dom/dom_exception.h" +#include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h" #include "third_party/blink/renderer/modules/webgpu/dawn_callback.h" #include "third_party/blink/renderer/modules/webgpu/dawn_conversions.h" #include "third_party/blink/renderer/modules/webgpu/gpu_device.h" #include "third_party/blink/renderer/modules/webgpu/gpu_queue.h" #include "third_party/blink/renderer/platform/heap/heap.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink { @@ -102,15 +104,18 @@ return MapAsyncImpl(script_state, mode, offset, size, exception_state); } -DOMArrayBuffer* GPUBuffer::getMappedRange(uint64_t offset, +DOMArrayBuffer* GPUBuffer::getMappedRange(ExecutionContext* execution_context, + uint64_t offset, ExceptionState& exception_state) { - return GetMappedRangeImpl(offset, base::nullopt, exception_state); + return GetMappedRangeImpl(offset, base::nullopt, execution_context, + exception_state); } -DOMArrayBuffer* GPUBuffer::getMappedRange(uint64_t offset, +DOMArrayBuffer* GPUBuffer::getMappedRange(ExecutionContext* execution_context, + uint64_t offset, uint64_t size, ExceptionState& exception_state) { - return GetMappedRangeImpl(offset, size, exception_state); + return GetMappedRangeImpl(offset, size, execution_context, exception_state); } void GPUBuffer::unmap(ScriptState* script_state) { @@ -165,9 +170,11 @@ return promise; } -DOMArrayBuffer* GPUBuffer::GetMappedRangeImpl(uint64_t offset, - base::Optional<uint64_t> size, - ExceptionState& exception_state) { +DOMArrayBuffer* GPUBuffer::GetMappedRangeImpl( + uint64_t offset, + base::Optional<uint64_t> size, + ExecutionContext* execution_context, + ExceptionState& exception_state) { // Compute the defaulted size which is "until the end of the buffer" or 0 if // offset is past the end of the buffer. uint64_t size_defaulted = 0; @@ -241,7 +248,8 @@ const_cast<uint8_t*>(static_cast<const uint8_t*>(map_data_const)); mapped_ranges_.push_back(std::make_pair(range_offset, range_end)); - return CreateArrayBufferForMappedData(map_data, range_size); + return CreateArrayBufferForMappedData(map_data, range_size, + execution_context); } void GPUBuffer::OnMapAsyncCallback(ScriptPromiseResolver* resolver, @@ -277,8 +285,10 @@ } } -DOMArrayBuffer* GPUBuffer::CreateArrayBufferForMappedData(void* data, - size_t data_length) { +DOMArrayBuffer* GPUBuffer::CreateArrayBufferForMappedData( + void* data, + size_t data_length, + ExecutionContext* execution_context) { DCHECK(data); DCHECK_LE(static_cast<uint64_t>(data_length), v8::TypedArray::kMaxLength); @@ -291,20 +301,43 @@ // To prevent this issue we make the ArrayBuffer keep a reference to the // WGPUBuffer, by referencing the buffer and then have a custom deleter for // the v8 backing store that releases that reference. + // + // V8 can call the ArrayBuffer deleter on any thread but dawn_wire and the + // rest of the WebGPU implementation expect to be used on a single thread at + // the moment. To fix this we keep a reference to the task runner for the + // execution context that called getMappedRange and do a deletion on a task + // posted to it. struct ArrayBufferStrongRefs { + scoped_refptr<base::SingleThreadTaskRunner> task_runner; scoped_refptr<DawnControlClientHolder> dawn_control_client; WGPUBuffer dawn_buffer; }; GetProcs().bufferReference(GetHandle()); - ArrayBufferStrongRefs* refs = - new ArrayBufferStrongRefs{GetDawnControlClient(), GetHandle()}; + ArrayBufferStrongRefs* refs = new ArrayBufferStrongRefs{ + execution_context->GetTaskRunner(TaskType::kWebGPU), + GetDawnControlClient(), GetHandle()}; v8::BackingStore::DeleterCallback deleter = [](void*, size_t, void* userdata) { ArrayBufferStrongRefs* refs = static_cast<ArrayBufferStrongRefs*>(userdata); - refs->dawn_control_client->GetProcs().bufferRelease(refs->dawn_buffer); - delete refs; + + // Happy case, we happen to be called on the correct thread. Release the + // buffer immediately. + if (refs->task_runner->BelongsToCurrentThread()) { + refs->dawn_control_client->GetProcs().bufferRelease(refs->dawn_buffer); + delete refs; + return; + } + + refs->task_runner->PostTask( + FROM_HERE, ConvertToBaseOnceCallback(WTF::CrossThreadBindOnce( + [](ArrayBufferStrongRefs* refs) { + refs->dawn_control_client->GetProcs().bufferRelease( + refs->dawn_buffer); + delete refs; + }, + WTF::CrossThreadUnretained(refs)))); }; ArrayBufferContents contents(
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_buffer.h b/third_party/blink/renderer/modules/webgpu/gpu_buffer.h index 1dd4b86..c22d678 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_buffer.h +++ b/third_party/blink/renderer/modules/webgpu/gpu_buffer.h
@@ -16,6 +16,7 @@ class DOMArrayBuffer; class GPUBufferDescriptor; +class ExecutionContext; class ScriptPromiseResolver; class GPUBuffer : public DawnObject<WGPUBuffer> { @@ -40,9 +41,11 @@ uint64_t offset, uint64_t size, ExceptionState& exception_state); - DOMArrayBuffer* getMappedRange(uint64_t offset, + DOMArrayBuffer* getMappedRange(ExecutionContext* execution_context, + uint64_t offset, ExceptionState& exception_state); - DOMArrayBuffer* getMappedRange(uint64_t offset, + DOMArrayBuffer* getMappedRange(ExecutionContext* execution_context, + uint64_t offset, uint64_t size, ExceptionState& exception_state); void unmap(ScriptState* script_state); @@ -56,13 +59,16 @@ ExceptionState& exception_state); DOMArrayBuffer* GetMappedRangeImpl(uint64_t offset, base::Optional<uint64_t> size, + ExecutionContext* execution_context, ExceptionState& exception_state); void OnMapAsyncCallback(ScriptPromiseResolver* resolver, WGPUBufferMapAsyncStatus status); - DOMArrayBuffer* CreateArrayBufferForMappedData(void* data, - size_t data_length); + DOMArrayBuffer* CreateArrayBufferForMappedData( + void* data, + size_t data_length, + ExecutionContext* execution_context); void ResetMappingState(ScriptState* script_state); uint64_t size_;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_buffer.idl b/third_party/blink/renderer/modules/webgpu/gpu_buffer.idl index eefd25d..7b949b6 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_buffer.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_buffer.idl
@@ -11,8 +11,9 @@ GPUMapModeFlags mode, optional GPUSize64 offset = 0, optional GPUSize64 size); - [RaisesException] ArrayBuffer getMappedRange(optional GPUSize64 offset = 0, - optional GPUSize64 size); + [CallWith=ExecutionContext, RaisesException] ArrayBuffer getMappedRange( + optional GPUSize64 offset = 0, + optional GPUSize64 size); [CallWith=ScriptState] void unmap(); [CallWith=ScriptState] void destroy(); };
diff --git a/third_party/blink/renderer/modules/webrtc/webrtc_audio_device_impl.cc b/third_party/blink/renderer/modules/webrtc/webrtc_audio_device_impl.cc index 07ad762..047145b 100644 --- a/third_party/blink/renderer/modules/webrtc/webrtc_audio_device_impl.cc +++ b/third_party/blink/renderer/modules/webrtc/webrtc_audio_device_impl.cc
@@ -51,6 +51,7 @@ WebRtcAudioDeviceImpl::~WebRtcAudioDeviceImpl() { SendLogMessage(base::StringPrintf("%s() [id=%s]", __func__, GetAudioProcessingId().ToString().c_str())); + DCHECK_CALLED_ON_VALID_THREAD(main_thread_checker_); DCHECK(!initialized_) << "Terminate must have been called."; }
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index 42b197fd..9da03c4 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -852,8 +852,6 @@ "graphics/compositor_filter_operations.h", "graphics/compositor_mutator_client.cc", "graphics/compositor_mutator_client.h", - "graphics/contiguous_container.cc", - "graphics/contiguous_container.h", "graphics/cpu/arm/webgl_image_conversion_neon.h", "graphics/cpu/mips/webgl_image_conversion_msa.h", "graphics/cpu/x86/webgl_image_conversion_sse.h", @@ -2037,7 +2035,6 @@ "graphics/compositing/paint_artifact_compositor_test.cc", "graphics/compositing/paint_chunks_to_cc_layer_test.cc", "graphics/compositor_element_id_test.cc", - "graphics/contiguous_container_test.cc", "graphics/dark_mode_color_classifier_test.cc", "graphics/dark_mode_filter_test.cc", "graphics/dark_mode_image_cache_test.cc",
diff --git a/third_party/blink/renderer/platform/bindings/script_wrappable.cc b/third_party/blink/renderer/platform/bindings/script_wrappable.cc index 1e714a5..a445df9f 100644 --- a/third_party/blink/renderer/platform/bindings/script_wrappable.cc +++ b/third_party/blink/renderer/platform/bindings/script_wrappable.cc
@@ -18,26 +18,13 @@ ASSERT_SIZE(ScriptWrappable, SameSizeAsScriptWrappable); -v8::Local<v8::Value> ScriptWrappable::Wrap( - v8::Isolate* isolate, - v8::Local<v8::Object> creation_context) { - const WrapperTypeInfo* wrapper_type_info = GetWrapperTypeInfo(); - - DCHECK(!DOMDataStore::ContainsWrapper(this, isolate)); - - v8::Local<v8::Object> wrapper = - V8DOMWrapper::CreateWrapper(isolate, creation_context, wrapper_type_info); - DCHECK(!wrapper.IsEmpty()); - return AssociateWithWrapper(isolate, wrapper_type_info, wrapper); -} - -v8::MaybeLocal<v8::Value> ScriptWrappable::WrapV2(ScriptState* script_state) { +v8::MaybeLocal<v8::Value> ScriptWrappable::Wrap(ScriptState* script_state) { const WrapperTypeInfo* wrapper_type_info = GetWrapperTypeInfo(); DCHECK(!DOMDataStore::ContainsWrapper(this, script_state->GetIsolate())); v8::Local<v8::Object> wrapper; - if (!V8DOMWrapper::CreateWrapperV2(script_state, wrapper_type_info) + if (!V8DOMWrapper::CreateWrapper(script_state, wrapper_type_info) .ToLocal(&wrapper)) { return v8::MaybeLocal<v8::Value>(); }
diff --git a/third_party/blink/renderer/platform/bindings/script_wrappable.h b/third_party/blink/renderer/platform/bindings/script_wrappable.h index fb0fc247..bec2169 100644 --- a/third_party/blink/renderer/platform/bindings/script_wrappable.h +++ b/third_party/blink/renderer/platform/bindings/script_wrappable.h
@@ -97,12 +97,7 @@ virtual const WrapperTypeInfo* GetWrapperTypeInfo() const = 0; // Creates and returns a new wrapper object. - virtual v8::Local<v8::Value> Wrap(v8::Isolate*, - v8::Local<v8::Object> creation_context); - // This is another version of Wrap which returns v8::MaybeLocal value - // in order to throw an exception. - // TODO(canonmukai): We should replace current Wrap with this WrapV2. - virtual v8::MaybeLocal<v8::Value> WrapV2(ScriptState*); + virtual v8::MaybeLocal<v8::Value> Wrap(ScriptState*); // Associates the instance with the given |wrapper| if this instance is not // yet associated with any wrapper. Returns the wrapper already associated
diff --git a/third_party/blink/renderer/platform/bindings/to_v8.h b/third_party/blink/renderer/platform/bindings/to_v8.h index 7c4f0d8..bd04ccb8 100644 --- a/third_party/blink/renderer/platform/bindings/to_v8.h +++ b/third_party/blink/renderer/platform/bindings/to_v8.h
@@ -5,6 +5,9 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_TO_V8_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_TO_V8_H_ +// ToV8() is a legacy API and deprecated. Use ToV8Traits<T>::ToV8() instead. +// TODO(crbug.com/1172074): Replace this old ToV8 with ToV8Traits. + // ToV8() provides C++ -> V8 conversion. Note that ToV8() can return an empty // handle. Call sites must check IsEmpty() before using return value. @@ -39,7 +42,9 @@ if (!wrapper.IsEmpty()) return wrapper; - wrapper = impl->Wrap(isolate, creation_context); + ScriptState* script_state = + ScriptState::From(creation_context->CreationContext()); + wrapper = impl->Wrap(script_state).ToLocalChecked(); DCHECK(!wrapper.IsEmpty()); return wrapper; }
diff --git a/third_party/blink/renderer/platform/bindings/v8_dom_wrapper.cc b/third_party/blink/renderer/platform/bindings/v8_dom_wrapper.cc index 05838971..95b7db8 100644 --- a/third_party/blink/renderer/platform/bindings/v8_dom_wrapper.cc +++ b/third_party/blink/renderer/platform/bindings/v8_dom_wrapper.cc
@@ -37,41 +37,7 @@ namespace blink { -v8::Local<v8::Object> V8DOMWrapper::CreateWrapper( - v8::Isolate* isolate, - v8::Local<v8::Object> creation_context, - const WrapperTypeInfo* type) { - RUNTIME_CALL_TIMER_SCOPE(isolate, - RuntimeCallStats::CounterId::kCreateWrapper); - - // TODO(adithyas): We should abort wrapper creation if the context access - // check fails and throws an exception. - V8WrapperInstantiationScope scope(creation_context, isolate, type); - CHECK(!scope.AccessCheckFailed()); - - V8PerContextData* per_context_data = - V8PerContextData::From(scope.GetContext()); - v8::Local<v8::Object> wrapper; - if (per_context_data) { - wrapper = per_context_data->CreateWrapperFromCache(type); - CHECK(!wrapper.IsEmpty()); - } else { - // The context is detached, but still accessible. - // TODO(yukishiino): This code does not create a wrapper with - // the correct settings. Should follow the same way as - // V8PerContextData::createWrapperFromCache, though there is no need to - // cache resulting objects or their constructors. - const DOMWrapperWorld& world = DOMWrapperWorld::World(scope.GetContext()); - wrapper = type->GetV8ClassTemplate(isolate, world) - .As<v8::FunctionTemplate>() - ->InstanceTemplate() - ->NewInstance(scope.GetContext()) - .ToLocalChecked(); - } - return wrapper; -} - -v8::MaybeLocal<v8::Object> V8DOMWrapper::CreateWrapperV2( +v8::MaybeLocal<v8::Object> V8DOMWrapper::CreateWrapper( ScriptState* script_state, const WrapperTypeInfo* type) { RUNTIME_CALL_TIMER_SCOPE(script_state->GetIsolate(),
diff --git a/third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h b/third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h index 29d047b..b4cdabe6 100644 --- a/third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h +++ b/third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h
@@ -53,15 +53,7 @@ STATIC_ONLY(V8DOMWrapper); public: - PLATFORM_EXPORT static v8::Local<v8::Object> CreateWrapper( - v8::Isolate*, - v8::Local<v8::Object> creation_context, - const WrapperTypeInfo*); - // This is another version of CreateWrapper which returns - // v8::MaybeLocal in order to throw an exception. - // TODO(canonmukai): We should replace CreateWrapper with - // CreateWrapperV2 soon. - PLATFORM_EXPORT static v8::MaybeLocal<v8::Object> CreateWrapperV2( + PLATFORM_EXPORT static v8::MaybeLocal<v8::Object> CreateWrapper( ScriptState*, const WrapperTypeInfo*); PLATFORM_EXPORT static bool IsWrapper(v8::Isolate*, v8::Local<v8::Value>);
diff --git a/third_party/blink/renderer/platform/bindings/v8_set_return_value.h b/third_party/blink/renderer/platform/bindings/v8_set_return_value.h index d630dedf..7b37c98 100644 --- a/third_party/blink/renderer/platform/bindings/v8_set_return_value.h +++ b/third_party/blink/renderer/platform/bindings/v8_set_return_value.h
@@ -68,7 +68,7 @@ ScriptWrappable* wrappable, v8::Local<v8::Context> creation_context) { v8::Local<v8::Value> wrapper; - if (!wrappable->WrapV2(ScriptState::From(creation_context)) + if (!wrappable->Wrap(ScriptState::From(creation_context)) .ToLocal(&wrapper)) { return; }
diff --git a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc index 9ba8adc..99f8172a 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc
@@ -142,8 +142,7 @@ // This is only OK if the ForeignLayer doesn't have hit test data. DCHECK(!pending_layer.FirstPaintChunk().hit_test_data); const auto& foreign_layer_display_item = - static_cast<const ForeignLayerDisplayItem&>( - pending_layer.FirstDisplayItem()); + To<ForeignLayerDisplayItem>(pending_layer.FirstDisplayItem()); layer = foreign_layer_display_item.GetLayer(); layer_offset = FloatPoint(foreign_layer_display_item.VisualRect().Location()); @@ -243,7 +242,7 @@ // the layer's offset for decomposited transforms. DCHECK_EQ(FloatPoint(), pending_layer.offset_of_decomposited_transforms); - const auto& scrollbar_item = static_cast<const ScrollbarDisplayItem&>(item); + const auto& scrollbar_item = To<ScrollbarDisplayItem>(item); auto* existing_layer = ScrollbarLayer(scrollbar_item.ElementId()); return scrollbar_item.CreateOrReuseLayer(existing_layer); } @@ -320,10 +319,8 @@ return nullptr; const auto& first_display_item = artifact.GetDisplayItemList()[chunk.begin_index]; - if (!first_display_item.IsForeignLayer()) - return nullptr; - return static_cast<const ForeignLayerDisplayItem&>(first_display_item) - .GetLayer(); + auto* foreign_layer = DynamicTo<ForeignLayerDisplayItem>(first_display_item); + return foreign_layer ? foreign_layer->GetLayer() : nullptr; } // True if the paint chunk change affects the result of |Update|, such as the @@ -877,12 +874,12 @@ } static bool IsCompositedScrollbar(const DisplayItem& item) { - if (!item.IsScrollbar()) - return false; - const auto* scroll_translation = - static_cast<const ScrollbarDisplayItem&>(item).ScrollTranslation(); - return scroll_translation && - scroll_translation->HasDirectCompositingReasons(); + if (const auto* scrollbar = DynamicTo<ScrollbarDisplayItem>(item)) { + const auto* scroll_translation = scrollbar->ScrollTranslation(); + return scroll_translation && + scroll_translation->HasDirectCompositingReasons(); + } + return false; } void PaintArtifactCompositor::LayerizeGroup( @@ -1485,10 +1482,7 @@ case PendingLayer::kScrollbarLayer: { // TODO(pdr): Share this code with ScrollbarLayerForPendingLayer. const auto& item = pending_layer.FirstDisplayItem(); - DCHECK(item.IsScrollbar()); - const auto& scrollbar_item = - static_cast<const ScrollbarDisplayItem&>(item); - layer = ScrollbarLayer(scrollbar_item.ElementId()); + layer = ScrollbarLayer(To<ScrollbarDisplayItem>(item).ElementId()); } break; default: { ContentLayerClientImpl* content_layer_client = nullptr; @@ -1864,8 +1858,7 @@ layer = &pending_layer.graphics_layer->CcLayer(); break; case PendingLayer::kForeignLayer: - layer = static_cast<const ForeignLayerDisplayItem&>( - pending_layer.FirstDisplayItem()) + layer = To<ForeignLayerDisplayItem>(pending_layer.FirstDisplayItem()) .GetLayer(); break; case PendingLayer::kScrollbarLayer:
diff --git a/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.cc b/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.cc index 3c30824..5efa9bfa 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.cc
@@ -712,10 +712,10 @@ for (const auto& item : it.DisplayItems()) { sk_sp<const PaintRecord> record; - if (item.IsScrollbar()) - record = static_cast<const ScrollbarDisplayItem&>(item).Paint(); - else if (item.IsDrawing()) - record = static_cast<const DrawingDisplayItem&>(item).GetPaintRecord(); + if (auto* scrollbar = DynamicTo<ScrollbarDisplayItem>(item)) + record = scrollbar->Paint(); + else if (auto* drawing = DynamicTo<DrawingDisplayItem>(item)) + record = drawing->GetPaintRecord(); else continue;
diff --git a/third_party/blink/renderer/platform/graphics/contiguous_container.cc b/third_party/blink/renderer/platform/graphics/contiguous_container.cc deleted file mode 100644 index f0ee0bdb..0000000 --- a/third_party/blink/renderer/platform/graphics/contiguous_container.cc +++ /dev/null
@@ -1,59 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "third_party/blink/renderer/platform/graphics/contiguous_container.h" - -#include <algorithm> -#include <memory> - -namespace blink { - -ContiguousContainerBase::ContiguousContainerBase( - wtf_size_t max_item_size, - wtf_size_t initial_capacity_in_bytes) - : max_item_size_(max_item_size), - initial_capacity_in_bytes_( - std::max(max_item_size, initial_capacity_in_bytes)) {} - -ContiguousContainerBase::~ContiguousContainerBase() = default; - -wtf_size_t ContiguousContainerBase::CapacityInBytes() const { - wtf_size_t capacity = 0; - for (const auto& buffer : buffers_) - capacity += buffer.Capacity(); - return capacity; -} - -wtf_size_t ContiguousContainerBase::UsedCapacityInBytes() const { - wtf_size_t used_capacity = 0; - for (const auto& buffer : buffers_) - used_capacity += buffer.UsedCapacity(); - return used_capacity; -} - -wtf_size_t ContiguousContainerBase::MemoryUsageInBytes() const { - return sizeof(*this) + CapacityInBytes() + items_.CapacityInBytes(); -} - -uint8_t* ContiguousContainerBase::Allocate(wtf_size_t item_size, - const char* type_name) { - DCHECK_LE(item_size, max_item_size_); - - Buffer* buffer_for_alloc = nullptr; - if (!buffers_.IsEmpty() && buffers_.back().UnusedCapacity() >= item_size) - buffer_for_alloc = &buffers_.back(); - - if (!buffer_for_alloc) { - wtf_size_t new_buffer_size = buffers_.IsEmpty() - ? initial_capacity_in_bytes_ - : 2 * buffers_.back().Capacity(); - buffer_for_alloc = &buffers_.emplace_back(new_buffer_size, type_name); - } - - uint8_t* item = buffer_for_alloc->Allocate(item_size); - items_.push_back(item); - return item; -} - -} // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/contiguous_container.h b/third_party/blink/renderer/platform/graphics/contiguous_container.h deleted file mode 100644 index 12c03b0..0000000 --- a/third_party/blink/renderer/platform/graphics/contiguous_container.h +++ /dev/null
@@ -1,269 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_CONTIGUOUS_CONTAINER_H_ -#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_CONTIGUOUS_CONTAINER_H_ - -#include <cstddef> -#include <iterator> -#include <memory> -#include <utility> - -#include "base/compiler_specific.h" -#include "third_party/blink/renderer/platform/platform_export.h" -#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" -#include "third_party/blink/renderer/platform/wtf/allocator/partitions.h" -#include "third_party/blink/renderer/platform/wtf/container_annotations.h" -#include "third_party/blink/renderer/platform/wtf/vector.h" - -namespace blink { - -// ContiguousContainer is a container which stores a list of heterogeneous -// items (in particular, of varying sizes), packed next to one another in -// memory. Items are never relocated, so it is safe to store pointers to them -// for the lifetime of the container (unless the item is removed). -// -// Memory is allocated in a series of buffers (with exponential growth). When an -// item is allocated, it is given only the space it requires (possibly with -// enough padding to preserve alignment), rather than the maximum possible size. -// This allows small and large items to coexist without wasting much space. -// -// Since it stores pointers to all of the items it allocates in a vector, it -// supports efficient iteration and indexing. However, for mutation the -// supported operations are limited to appending to the end of the list and -// replacing the last item. -// -// Clients should instantiate ContiguousContainer; ContiguousContainerBase is an -// artifact of the implementation. - -class PLATFORM_EXPORT ContiguousContainerBase { - DISALLOW_NEW(); - - public: - ContiguousContainerBase(const ContiguousContainerBase&) = delete; - ContiguousContainerBase& operator=(const ContiguousContainerBase&) = delete; - ContiguousContainerBase(ContiguousContainerBase&&) = delete; - ContiguousContainerBase& operator=(ContiguousContainerBase&&) = delete; - - protected: - // The initial capacity will be allocated when the first item is added. - ContiguousContainerBase(wtf_size_t max_item_size, - wtf_size_t initial_capacity_in_bytes); - ~ContiguousContainerBase(); - - wtf_size_t size() const { return items_.size(); } - bool IsEmpty() const { return !size(); } - wtf_size_t CapacityInBytes() const; - wtf_size_t UsedCapacityInBytes() const; - wtf_size_t MemoryUsageInBytes() const; - - // These do not invoke constructors or destructors. - uint8_t* Allocate(wtf_size_t item_size, const char* type_name); - - wtf_size_t LastItemSize() const { - return static_cast<wtf_size_t>(buffers_.back().End() - items_.back()); - } - - using ItemVector = Vector<uint8_t*>; - ItemVector items_; - - private: - class Buffer { - public: - Buffer(wtf_size_t buffer_size, const char* type_name) - : capacity_(static_cast<wtf_size_t>( - WTF::Partitions::BufferPotentialCapacity(buffer_size))), - begin_(static_cast<uint8_t*>( - WTF::Partitions::BufferMalloc(capacity_, type_name))), - end_(begin_) { - ANNOTATE_NEW_BUFFER(begin_, capacity_, 0); - } - - ~Buffer() { - ANNOTATE_DELETE_BUFFER(begin_, capacity_, UsedCapacity()); - WTF::Partitions::BufferFree(begin_); - } - - wtf_size_t Capacity() const { return capacity_; } - wtf_size_t UsedCapacity() const { - return static_cast<wtf_size_t>(end_ - begin_); - } - wtf_size_t UnusedCapacity() const { return Capacity() - UsedCapacity(); } - bool IsEmpty() const { return UsedCapacity() == 0; } - - uint8_t* Allocate(wtf_size_t item_size) { - DCHECK_GE(UnusedCapacity(), item_size); - ANNOTATE_CHANGE_SIZE(begin_, capacity_, UsedCapacity(), - UsedCapacity() + item_size); - uint8_t* result = end_; - end_ += item_size; - return result; - } - - uint8_t* End() const { return end_; } - - private: - // begin_ <= end_ <= begin_ + capacity_ - wtf_size_t capacity_; - uint8_t* begin_; - uint8_t* end_; - }; - - Vector<Buffer> buffers_; - wtf_size_t max_item_size_; - wtf_size_t initial_capacity_in_bytes_; -}; - -// For most cases, no alignment stricter than pointer alignment is required. If -// one of the derived classes has stronger alignment requirements (and the -// static_assert fires), set alignment to the LCM of the derived class -// alignments. For small structs without pointers, it may be possible to reduce -// alignment for tighter packing. - -template <class BaseItemType, unsigned alignment = sizeof(void*)> -class ContiguousContainer : public ContiguousContainerBase { - private: - // Declares itself as a forward iterator, but also supports a few more - // things. The whole random access iterator interface is a bit much. - template <typename BaseIterator, typename ValueType> - class IteratorWrapper - : public std::iterator<std::forward_iterator_tag, ValueType> { - DISALLOW_NEW(); - - public: - IteratorWrapper() = default; - bool operator==(const IteratorWrapper& other) const { - return it_ == other.it_; - } - bool operator!=(const IteratorWrapper& other) const { - return it_ != other.it_; - } - bool operator<(const IteratorWrapper& other) const { - return it_ < other.it_; - } - ValueType& operator*() const { return *reinterpret_cast<ValueType*>(*it_); } - ValueType* operator->() const { return &operator*(); } - IteratorWrapper operator+(std::ptrdiff_t n) const { - return IteratorWrapper(it_ + n); - } - IteratorWrapper operator++(int) { - IteratorWrapper tmp = *this; - ++it_; - return tmp; - } - std::ptrdiff_t operator-(const IteratorWrapper& other) const { - return it_ - other.it_; - } - IteratorWrapper& operator++() { - ++it_; - return *this; - } - - private: - explicit IteratorWrapper(const BaseIterator& it) : it_(it) {} - BaseIterator it_; - friend class ContiguousContainer; - }; - - public: - using iterator = IteratorWrapper<ItemVector::iterator, BaseItemType>; - using const_iterator = - IteratorWrapper<ItemVector::const_iterator, const BaseItemType>; - using reverse_iterator = - IteratorWrapper<ItemVector::reverse_iterator, BaseItemType>; - using const_reverse_iterator = - IteratorWrapper<ItemVector::const_reverse_iterator, const BaseItemType>; - - using value_type = BaseItemType; - - ContiguousContainer(wtf_size_t max_item_size, - wtf_size_t initial_capacity_in_bytes) - : ContiguousContainerBase(Align(max_item_size), - initial_capacity_in_bytes) {} - ~ContiguousContainer() { - for (auto& item : *this) { - (void)item; // MSVC incorrectly reports this variable as unused. - item.~BaseItemType(); - } - } - - using ContiguousContainerBase::CapacityInBytes; - using ContiguousContainerBase::IsEmpty; - using ContiguousContainerBase::MemoryUsageInBytes; - using ContiguousContainerBase::size; - using ContiguousContainerBase::UsedCapacityInBytes; - - iterator begin() { return iterator(items_.begin()); } - iterator end() { return iterator(items_.end()); } - const_iterator begin() const { return const_iterator(items_.begin()); } - const_iterator end() const { return const_iterator(items_.end()); } - reverse_iterator rbegin() { return reverse_iterator(items_.rbegin()); } - reverse_iterator rend() { return reverse_iterator(items_.rend()); } - const_reverse_iterator rbegin() const { - return const_reverse_iterator(items_.rbegin()); - } - const_reverse_iterator rend() const { - return const_reverse_iterator(items_.rend()); - } - - BaseItemType& front() { return *begin(); } - const BaseItemType& front() const { return *begin(); } - BaseItemType& back() { return *rbegin(); } - const BaseItemType& back() const { return *rbegin(); } - BaseItemType& operator[](wtf_size_t index) { return *(begin() + index); } - const BaseItemType& operator[](wtf_size_t index) const { - return *(begin() + index); - } - - template <class DerivedItemType, typename... Args> - DerivedItemType& AllocateAndConstruct(Args&&... args) { - static_assert(WTF::IsSubclass<DerivedItemType, BaseItemType>::value, - "Must use subclass of BaseItemType."); - static_assert(alignment % alignof(DerivedItemType) == 0, - "Derived type requires stronger alignment."); - return *new (AlignedAllocate(sizeof(DerivedItemType))) - DerivedItemType(std::forward<Args>(args)...); - } - - // Appends a new item using memcpy, then default-constructs a base item - // in its place. Use with care. - BaseItemType& AppendByMoving(BaseItemType& item, wtf_size_t size) { - DCHECK_GE(size, sizeof(BaseItemType)); - void* new_item = AlignedAllocate(size); - memcpy(new_item, static_cast<void*>(&item), size); - new (&item) BaseItemType; - return *static_cast<BaseItemType*>(new_item); - } - - // The caller must ensure that |size| (the actual size of |item|) is the same - // as or smaller than the replaced item. - BaseItemType& ReplaceLastByMoving(BaseItemType& item, wtf_size_t size) { - DCHECK_GE(size, sizeof(BaseItemType)); - DCHECK_GE(LastItemSize(), size); - back().~BaseItemType(); - memcpy(static_cast<void*>(&back()), static_cast<void*>(&item), size); - new (&item) BaseItemType; - return back(); - } - - private: - void* AlignedAllocate(wtf_size_t size) { - void* result = ContiguousContainerBase::Allocate( - Align(size), WTF_HEAP_PROFILER_TYPE_NAME(BaseItemType)); - DCHECK_EQ(reinterpret_cast<intptr_t>(result) & (alignment - 1), 0u); - return result; - } - - static wtf_size_t Align(wtf_size_t size) { - wtf_size_t aligned_size = alignment * ((size + alignment - 1) / alignment); - DCHECK_EQ(aligned_size % alignment, 0u); - DCHECK_GE(aligned_size, size); - DCHECK_LT(aligned_size, size + alignment); - return aligned_size; - } -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_CONTIGUOUS_CONTAINER_H_
diff --git a/third_party/blink/renderer/platform/graphics/contiguous_container_test.cc b/third_party/blink/renderer/platform/graphics/contiguous_container_test.cc deleted file mode 100644 index 5fd7cbbe..0000000 --- a/third_party/blink/renderer/platform/graphics/contiguous_container_test.cc +++ /dev/null
@@ -1,360 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "third_party/blink/renderer/platform/graphics/contiguous_container.h" - -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" -#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" -#include "third_party/blink/renderer/platform/wtf/type_traits.h" - -namespace blink { -namespace { - -struct Point2D { - Point2D() : Point2D(0, 0) {} - Point2D(int x, int y) : x(x), y(y) {} - int x, y; -}; - -struct Point3D : public Point2D { - Point3D() : Point3D(0, 0, 0) {} - Point3D(int x, int y, int z) : Point2D(x, y), z(z) {} - int z; -}; - -// Maximum size of a subclass of Point2D. -static const wtf_size_t kMaxPointSize = sizeof(Point3D); - -// Alignment for Point2D and its subclasses. -static const wtf_size_t kPointAlignment = sizeof(int); - -// How many elements to use for tests with "plenty" of elements. -static const wtf_size_t kNumElements = 150; - -static const wtf_size_t kDefaultInitialCapacityInBytes = 256; - -class PointList : public ContiguousContainer<Point2D, kPointAlignment> { - public: - explicit PointList( - wtf_size_t initial_capacity_in_bytes = kDefaultInitialCapacityInBytes) - : ContiguousContainer(kMaxPointSize, initial_capacity_in_bytes) {} -}; - -TEST(ContiguousContainerTest, SimpleStructs) { - PointList list; - list.AllocateAndConstruct<Point2D>(1, 2); - list.AllocateAndConstruct<Point3D>(3, 4, 5); - list.AllocateAndConstruct<Point2D>(6, 7); - - ASSERT_EQ(3u, list.size()); - EXPECT_EQ(1, list[0].x); - EXPECT_EQ(2, list[0].y); - EXPECT_EQ(3, list[1].x); - EXPECT_EQ(4, list[1].y); - EXPECT_EQ(5, static_cast<Point3D&>(list[1]).z); - EXPECT_EQ(6, list[2].x); - EXPECT_EQ(7, list[2].y); -} - -TEST(ContiguousContainerTest, AllocateLots) { - PointList list; - for (int i = 0; i < static_cast<int>(kNumElements); i++) - list.AllocateAndConstruct<Point2D>(i, i); - ASSERT_EQ(kNumElements, list.size()); - for (int i = 0; i < static_cast<int>(kNumElements); i++) { - ASSERT_EQ(i, list[i].x); - ASSERT_EQ(i, list[i].y); - } -} - -class MockDestructible { - USING_FAST_MALLOC(MockDestructible); - - public: - ~MockDestructible() { Destruct(); } - MOCK_METHOD0(Destruct, void()); -}; - -class MockDestructibleList : public ContiguousContainer<MockDestructible> { - public: - explicit MockDestructibleList( - wtf_size_t initial_capacity_in_bytes = kDefaultInitialCapacityInBytes) - : ContiguousContainer(sizeof(MockDestructible), - initial_capacity_in_bytes) {} -}; - -TEST(ContiguousContainerTest, DestructorCalled) { - MockDestructibleList list; - auto& destructible = list.AllocateAndConstruct<MockDestructible>(); - EXPECT_EQ(&destructible, &list.front()); - EXPECT_CALL(destructible, Destruct()); -} - -TEST(ContiguousContainerTest, InsertionAndIndexedAccess) { - PointList list; - - auto& point1 = list.AllocateAndConstruct<Point2D>(); - auto& point2 = list.AllocateAndConstruct<Point2D>(); - auto& point3 = list.AllocateAndConstruct<Point2D>(); - - EXPECT_EQ(3u, list.size()); - EXPECT_EQ(&point1, &list.front()); - EXPECT_EQ(&point3, &list.back()); - EXPECT_EQ(&point1, &list[0]); - EXPECT_EQ(&point2, &list[1]); - EXPECT_EQ(&point3, &list[2]); -} - -TEST(ContiguousContainerTest, Insertion) { - PointList list; - EXPECT_TRUE(list.IsEmpty()); - EXPECT_EQ(0u, list.size()); - EXPECT_EQ(0u, list.CapacityInBytes()); - EXPECT_EQ(0u, list.UsedCapacityInBytes()); - - list.AllocateAndConstruct<Point2D>(); - EXPECT_FALSE(list.IsEmpty()); - EXPECT_EQ(1u, list.size()); - EXPECT_GE(list.CapacityInBytes(), kDefaultInitialCapacityInBytes); - EXPECT_EQ(sizeof(Point2D), list.UsedCapacityInBytes()); -} - -TEST(ContiguousContainerTest, ElementAddressesAreStable) { - PointList list; - Vector<Point2D*> pointers; - for (int i = 0; i < static_cast<int>(kNumElements); i++) - pointers.push_back(&list.AllocateAndConstruct<Point2D>()); - EXPECT_EQ(kNumElements, list.size()); - EXPECT_EQ(kNumElements, pointers.size()); - - auto list_it = list.begin(); - auto** vector_it = pointers.begin(); - for (; list_it != list.end(); ++list_it, ++vector_it) - EXPECT_EQ(&*list_it, *vector_it); -} - -TEST(ContiguousContainerTest, ForwardIteration) { - PointList list; - for (int i = 0; i < static_cast<int>(kNumElements); i++) - list.AllocateAndConstruct<Point2D>(i, i); - wtf_size_t count = 0; - for (Point2D& point : list) { - EXPECT_EQ(static_cast<int>(count), point.x); - count++; - } - EXPECT_EQ(kNumElements, count); - - static_assert(std::is_same<decltype(*list.begin()), Point2D&>::value, - "Non-const iteration should produce non-const references."); -} - -TEST(ContiguousContainerTest, ConstForwardIteration) { - PointList list; - for (int i = 0; i < static_cast<int>(kNumElements); i++) - list.AllocateAndConstruct<Point2D>(i, i); - - const auto& const_list = list; - wtf_size_t count = 0; - for (const Point2D& point : const_list) { - EXPECT_EQ(static_cast<int>(count), point.x); - count++; - } - EXPECT_EQ(kNumElements, count); - - static_assert( - std::is_same<decltype(*const_list.begin()), const Point2D&>::value, - "Const iteration should produce const references."); -} - -TEST(ContiguousContainerTest, ReverseIteration) { - PointList list; - for (int i = 0; i < static_cast<int>(kNumElements); i++) - list.AllocateAndConstruct<Point2D>(i, i); - - wtf_size_t count = 0; - for (auto it = list.rbegin(); it != list.rend(); ++it) { - EXPECT_EQ(static_cast<int>(kNumElements - 1 - count), it->x); - count++; - } - EXPECT_EQ(kNumElements, count); - - static_assert(std::is_same<decltype(*list.rbegin()), Point2D&>::value, - "Non-const iteration should produce non-const references."); -} - -// Checks that the latter list has pointers to the elements of the former. -template <typename It1, typename It2> -bool EqualPointers(It1 it1, const It1& end1, It2 it2) { - for (; it1 != end1; ++it1, ++it2) { - if (&*it1 != *it2) - return false; - } - return true; -} - -TEST(ContiguousContainerTest, AppendByMovingSameList) { - PointList list; - list.AllocateAndConstruct<Point3D>(1, 2, 3); - - // Moves the Point3D to the end, and default-constructs a Point2D in its - // place. - list.AppendByMoving(list.front(), sizeof(Point3D)); - EXPECT_EQ(1, list.back().x); - EXPECT_EQ(2, list.back().y); - EXPECT_EQ(3, static_cast<const Point3D&>(list.back()).z); - EXPECT_EQ(2u, list.size()); - - // Moves that Point2D to the end, and default-constructs another in its - // place. - list.front().x = 4; - list.AppendByMoving(list.front(), sizeof(Point2D)); - EXPECT_EQ(4, list.back().x); - EXPECT_EQ(3u, list.size()); -} - -TEST(ContiguousContainerTest, AppendByMovingDoesNotDestruct) { - // GMock mock objects (e.g. MockDestructible) aren't guaranteed to be safe - // to memcpy (which is required for appendByMoving). - class DestructionNotifier { - USING_FAST_MALLOC(DestructionNotifier); - - public: - DestructionNotifier(bool* flag = nullptr) : flag_(flag) {} - ~DestructionNotifier() { - if (flag_) - *flag_ = true; - } - - private: - bool* flag_; - }; - - bool destroyed = false; - ContiguousContainer<DestructionNotifier> list1( - sizeof(DestructionNotifier), kDefaultInitialCapacityInBytes); - list1.AllocateAndConstruct<DestructionNotifier>(&destroyed); - { - // Make sure destructor isn't called during appendByMoving. - ContiguousContainer<DestructionNotifier> list2( - sizeof(DestructionNotifier), kDefaultInitialCapacityInBytes); - list2.AppendByMoving(list1.back(), sizeof(DestructionNotifier)); - EXPECT_FALSE(destroyed); - } - // But it should be destroyed when list2 is. - EXPECT_TRUE(destroyed); -} - -TEST(ContiguousContainerTest, AppendByMovingReturnsMovedPointer) { - PointList list1; - PointList list2; - - Point2D& point = list1.AllocateAndConstruct<Point2D>(); - Point2D& moved_point1 = list2.AppendByMoving(point, sizeof(Point2D)); - EXPECT_EQ(&moved_point1, &list2.back()); - - Point2D& moved_point2 = list1.AppendByMoving(moved_point1, sizeof(Point2D)); - EXPECT_EQ(&moved_point2, &list1.back()); - EXPECT_NE(&moved_point1, &moved_point2); -} - -TEST(ContiguousContainerTest, AppendByMovingReplacesSourceWithNewElement) { - PointList list1; - PointList list2; - - list1.AllocateAndConstruct<Point2D>(1, 2); - EXPECT_EQ(1, list1.front().x); - EXPECT_EQ(2, list1.front().y); - - list2.AppendByMoving(list1.front(), sizeof(Point2D)); - EXPECT_EQ(0, list1.front().x); - EXPECT_EQ(0, list1.front().y); - EXPECT_EQ(1, list2.front().x); - EXPECT_EQ(2, list2.front().y); - - EXPECT_EQ(1u, list1.size()); - EXPECT_EQ(1u, list2.size()); -} - -TEST(ContiguousContainerTest, AppendByMovingElementsOfDifferentSizes) { - PointList list; - list.AllocateAndConstruct<Point3D>(1, 2, 3); - list.AllocateAndConstruct<Point2D>(4, 5); - - EXPECT_EQ(1, list[0].x); - EXPECT_EQ(2, list[0].y); - EXPECT_EQ(3, static_cast<const Point3D&>(list[0]).z); - EXPECT_EQ(4, list[1].x); - EXPECT_EQ(5, list[1].y); - - // Test that moving the first element actually moves the entire object, not - // just the base element. - list.AppendByMoving(list[0], sizeof(Point3D)); - EXPECT_EQ(1, list[2].x); - EXPECT_EQ(2, list[2].y); - EXPECT_EQ(3, static_cast<const Point3D&>(list[2]).z); - EXPECT_EQ(4, list[1].x); - EXPECT_EQ(5, list[1].y); - - list.AppendByMoving(list[1], sizeof(Point2D)); - EXPECT_EQ(1, list[2].x); - EXPECT_EQ(2, list[2].y); - EXPECT_EQ(3, static_cast<const Point3D&>(list[2]).z); - EXPECT_EQ(4, list[3].x); - EXPECT_EQ(5, list[3].y); -} - -TEST(ContiguousContainerTest, CapacityInBytes) { - const int kIterations = 500; - const wtf_size_t kInitialCapacity = 10 * kMaxPointSize; - const wtf_size_t kUpperBoundOnMinCapacity = kInitialCapacity; - // In worst case, there are 2 buffers, and the second buffer contains only one - // element, so the factor is close to 3 as the second buffer is twice as big - // as the first buffer. - const size_t kMaxWasteFactor = 3; - - PointList list(kInitialCapacity); - - // The capacity should grow with the list. - for (int i = 0; i < kIterations; i++) { - size_t capacity = list.CapacityInBytes(); - ASSERT_GE(capacity, list.size() * sizeof(Point2D)); - ASSERT_LE(capacity, std::max<wtf_size_t>(list.size() * sizeof(Point2D), - kUpperBoundOnMinCapacity) * - kMaxWasteFactor); - list.AllocateAndConstruct<Point2D>(); - } -} - -TEST(ContiguousContainerTest, Alignment) { - const size_t kMaxAlign = alignof(long double); - ContiguousContainer<Point2D, kMaxAlign> list(kMaxPointSize, - kDefaultInitialCapacityInBytes); - - list.AllocateAndConstruct<Point2D>(); - EXPECT_EQ(0u, reinterpret_cast<intptr_t>(&list.back()) & (kMaxAlign - 1)); - list.AllocateAndConstruct<Point2D>(); - EXPECT_EQ(0u, reinterpret_cast<intptr_t>(&list.back()) & (kMaxAlign - 1)); - list.AllocateAndConstruct<Point3D>(); - EXPECT_EQ(0u, reinterpret_cast<intptr_t>(&list.back()) & (kMaxAlign - 1)); - list.AllocateAndConstruct<Point3D>(); - EXPECT_EQ(0u, reinterpret_cast<intptr_t>(&list.back()) & (kMaxAlign - 1)); - list.AllocateAndConstruct<Point2D>(); - EXPECT_EQ(0u, reinterpret_cast<intptr_t>(&list.back()) & (kMaxAlign - 1)); - - list.AppendByMoving(list[0], sizeof(Point2D)); - EXPECT_EQ(0u, reinterpret_cast<intptr_t>(&list.back()) & (kMaxAlign - 1)); - list.AppendByMoving(list[1], sizeof(Point2D)); - EXPECT_EQ(0u, reinterpret_cast<intptr_t>(&list.back()) & (kMaxAlign - 1)); - list.AppendByMoving(list[2], sizeof(Point3D)); - EXPECT_EQ(0u, reinterpret_cast<intptr_t>(&list.back()) & (kMaxAlign - 1)); - list.AppendByMoving(list[3], sizeof(Point3D)); - EXPECT_EQ(0u, reinterpret_cast<intptr_t>(&list.back()) & (kMaxAlign - 1)); - list.AppendByMoving(list[4], sizeof(Point2D)); - EXPECT_EQ(0u, reinterpret_cast<intptr_t>(&list.back()) & (kMaxAlign - 1)); -} - -} // namespace -} // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/paint/display_item.cc b/third_party/blink/renderer/platform/graphics/paint/display_item.cc index afbe79f..3ee0ba3c 100644 --- a/third_party/blink/renderer/platform/graphics/paint/display_item.cc +++ b/third_party/blink/renderer/platform/graphics/paint/display_item.cc
@@ -4,12 +4,14 @@ #include "third_party/blink/renderer/platform/graphics/paint/display_item.h" +#include "third_party/blink/renderer/platform/graphics/paint/drawing_display_item.h" +#include "third_party/blink/renderer/platform/graphics/paint/foreign_layer_display_item.h" +#include "third_party/blink/renderer/platform/graphics/paint/scrollbar_display_item.h" #include "third_party/blink/renderer/platform/wtf/size_assertions.h" namespace blink { struct SameSizeAsDisplayItem { - virtual ~SameSizeAsDisplayItem() = default; // Allocate vtable pointer. void* pointer; IntRect rect; uint32_t i1; @@ -17,6 +19,47 @@ }; ASSERT_SIZE(DisplayItem, SameSizeAsDisplayItem); +void DisplayItem::Destruct() { + if (IsTombstone()) + return; + if (auto* drawing = DynamicTo<DrawingDisplayItem>(this)) { + drawing->~DrawingDisplayItem(); + } else if (auto* foreign_layer = DynamicTo<ForeignLayerDisplayItem>(this)) { + foreign_layer->~ForeignLayerDisplayItem(); + } else { + To<ScrollbarDisplayItem>(this)->~ScrollbarDisplayItem(); + } +} + +bool DisplayItem::EqualsForUnderInvalidation(const DisplayItem& other) const { + DCHECK(RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()); + SECURITY_CHECK(!IsTombstone()); + if (client_ != other.client_ || type_ != other.type_ || + fragment_ != other.fragment_ || + raster_effect_outset_ != other.raster_effect_outset_ || + draws_content_ != other.draws_content_ || + is_cacheable_ != other.is_cacheable_) + return false; + + if (visual_rect_ != other.visual_rect_ && + // Change of empty visual rect doesn't matter. + (visual_rect_.IsEmpty() && other.visual_rect_.IsEmpty()) && + // Visual rect of a DrawingDisplayItem not drawing content doesn't matter. + (!IsDrawing() || draws_content_)) + return false; + + if (auto* drawing = DynamicTo<DrawingDisplayItem>(this)) { + return drawing->EqualsForUnderInvalidationImpl( + To<DrawingDisplayItem>(other)); + } + if (auto* foreign_layer = DynamicTo<ForeignLayerDisplayItem>(this)) { + return foreign_layer->EqualsForUnderInvalidationImpl( + To<ForeignLayerDisplayItem>(other)); + } + return To<ScrollbarDisplayItem>(this)->EqualsForUnderInvalidationImpl( + To<ScrollbarDisplayItem>(other)); +} + #if DCHECK_IS_ON() static WTF::String PaintPhaseAsDebugString(int paint_phase) { @@ -164,9 +207,6 @@ } void DisplayItem::PropertiesAsJSON(JSONObject& json) const { - if (IsTombstone()) - json.SetBoolean("ISTOMBSTONE", true); - json.SetString("id", GetId().ToString()); json.SetString("visualRect", VisualRect().ToString()); if (GetRasterEffectOutset() != RasterEffectOutset::kNone) { @@ -174,6 +214,16 @@ "outset", GetRasterEffectOutset() == RasterEffectOutset::kHalfPixel ? 0.5 : 1); } + + if (IsTombstone()) { + json.SetBoolean("ISTOMBSTONE", true); + } else if (auto* drawing = DynamicTo<DrawingDisplayItem>(this)) { + drawing->PropertiesAsJSONImpl(json); + } else if (auto* foreign_layer = DynamicTo<ForeignLayerDisplayItem>(this)) { + foreign_layer->PropertiesAsJSONImpl(json); + } else { + To<ScrollbarDisplayItem>(this)->PropertiesAsJSONImpl(json); + } } #endif // DCHECK_IS_ON()
diff --git a/third_party/blink/renderer/platform/graphics/paint/display_item.h b/third_party/blink/renderer/platform/graphics/paint/display_item.h index a8eb1c7..93583ae 100644 --- a/third_party/blink/renderer/platform/graphics/paint/display_item.h +++ b/third_party/blink/renderer/platform/graphics/paint/display_item.h
@@ -7,7 +7,6 @@ #include "base/dcheck_is_on.h" #include "third_party/blink/renderer/platform/geometry/int_rect.h" -#include "third_party/blink/renderer/platform/graphics/contiguous_container.h" #include "third_party/blink/renderer/platform/graphics/paint/display_item_client.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" @@ -53,6 +52,8 @@ // - DEFINE_PAINT_PHASE_CONVERSION_METHOD(<Category>[<Subset>]) to define // paintPhaseTo<Category>[<Subset>]Type(PaintPhase) method. enum Type { + kUninitializedType, + kDrawingFirst, kDrawingPaintPhaseFirst = kDrawingFirst, kDrawingPaintPhaseLast = kDrawingFirst + kPaintPhaseMax, @@ -149,38 +150,13 @@ kScrollbarHorizontal, kScrollbarVertical, - kUninitializedType, - kTypeLast = kUninitializedType + kTypeLast = kScrollbarVertical, }; - // Some fields are copied from |client|, because we need to access them in - // later paint cycles when |client| may have been destroyed. - DisplayItem(const DisplayItemClient& client, - Type type, - wtf_size_t derived_size, - const IntRect& visual_rect, - bool draws_content = false) - : client_(&client), - visual_rect_(visual_rect), - fragment_(0), - type_(type), - derived_size_(derived_size), - raster_effect_outset_( - static_cast<unsigned>(client.VisualRectOutsetForRasterEffects())), - draws_content_(draws_content), - is_cacheable_(client.IsCacheable()), - is_tombstone_(false), - known_to_be_opaque_is_set_(false), - known_to_be_opaque_(false) { - // |derived_size| must fit in |derived_size_|. - // If it doesn't, enlarge |derived_size_| and fix this assert. - SECURITY_DCHECK(derived_size == derived_size_); - SECURITY_DCHECK(derived_size >= sizeof(*this)); - DCHECK_EQ(client.VisualRectOutsetForRasterEffects(), - GetRasterEffectOutset()); - } - - virtual ~DisplayItem() = default; + DisplayItem(const DisplayItem&) = delete; + DisplayItem(DisplayItem&&) = delete; + DisplayItem& operator=(const DisplayItem&) = delete; + DisplayItem& operator=(DisplayItem&&) = delete; // Ids are for matching new DisplayItems with existing DisplayItems. struct Id { @@ -214,12 +190,6 @@ Type GetType() const { return static_cast<Type>(type_); } - // Size of this object in memory, used to move it with memcpy. - // This is not sizeof(*this), because it needs to account for the size of - // the derived class (i.e. runtime type). Derived classes are expected to - // supply this to the DisplayItem constructor. - wtf_size_t DerivedSize() const { return derived_size_; } - // The fragment is part of the id, to uniquely identify display items in // different fragments for the same client and type. wtf_size_t Fragment() const { return fragment_; } @@ -260,38 +230,60 @@ bool IsCacheable() const { return is_cacheable_; } void SetUncacheable() { is_cacheable_ = false; } - virtual bool Equals(const DisplayItem& other) const { - // Failure of this DCHECK would cause bad casts in subclasses. - SECURITY_CHECK(!is_tombstone_); - return client_ == other.client_ && type_ == other.type_ && - fragment_ == other.fragment_ && derived_size_ == other.derived_size_; - } + bool EqualsForUnderInvalidation(const DisplayItem& other) const; // True if this DisplayItem is the tombstone/"dead display item" as part of - // moving an item from one list to another. See the default constructor of - // DisplayItem. - bool IsTombstone() const { return is_tombstone_; } + // moving an item from one list to another. See CreateTombstone(). + bool IsTombstone() const { return !is_not_tombstone_; } bool DrawsContent() const { return draws_content_; } #if DCHECK_IS_ON() static WTF::String TypeAsDebugString(DisplayItem::Type); WTF::String AsDebugString() const; - virtual void PropertiesAsJSON(JSONObject&) const; + void PropertiesAsJSON(JSONObject&) const; #endif + protected: + // Some fields are copied from |client|, because we need to access them in + // later paint cycles when |client| may have been destroyed. + DisplayItem(const DisplayItemClient& client, + Type type, + const IntRect& visual_rect, + bool draws_content = false) + : client_(&client), + visual_rect_(visual_rect), + fragment_(0), + type_(type), + raster_effect_outset_( + static_cast<unsigned>(client.VisualRectOutsetForRasterEffects())), + draws_content_(draws_content), + is_cacheable_(client.IsCacheable()), + is_not_tombstone_(true), + known_to_be_opaque_is_set_(false), + known_to_be_opaque_(false) { + DCHECK_EQ(client.VisualRectOutsetForRasterEffects(), + GetRasterEffectOutset()); + } + + ~DisplayItem() = default; + private: - template <typename T, wtf_size_t alignment> - friend class ContiguousContainer; friend class DisplayItemList; - // The default DisplayItem constructor is only used by ContiguousContainer:: - // AppendByMoving() where a tombstone DisplayItem is constructed at the source - // location. Only set draws_content_ to false and is_tombstone_ to true, - // leaving other fields as-is so that we can get their original values. - // |visual_rect_| and |raster_effect_outset_| are special, see - // DisplayItemList::AppendByMoving(). - DisplayItem() : draws_content_(false), is_tombstone_(true) {} + // DisplayItemList calls this method to destruct a DisplayItem in place. + // It knows how to destruct subclasses. + void Destruct(); + + // Used by DisplayItemList::AppendByMoving() and ReplaceLastByMoving() where + // a tombstone DisplayItem is constructed at the source location. Only set + // draws_content_ and is_not_tombstone_ to false, leaving other fields as-is + // so that we can get their original values for debugging and raster + // invalidation. + void CreateTombstone() { + draws_content_ = false; + is_not_tombstone_ = false; + } const DisplayItemClient* client_; IntRect visual_rect_; @@ -299,11 +291,12 @@ static_assert(kTypeLast < (1 << 8), "DisplayItem::Type should fit in uint8_t"); unsigned type_ : 8; - unsigned derived_size_ : 8; // size of the actual derived class unsigned raster_effect_outset_ : 2; unsigned draws_content_ : 1; unsigned is_cacheable_ : 1; - unsigned is_tombstone_ : 1; + // This is not |is_tombstone_| to allow memset(0) to clear a display item to + // be a tombstone. + unsigned is_not_tombstone_ : 1; protected: // These are for DrawingDisplayItem to save memory.
diff --git a/third_party/blink/renderer/platform/graphics/paint/display_item_list.cc b/third_party/blink/renderer/platform/graphics/paint/display_item_list.cc index 2565409..1974c82 100644 --- a/third_party/blink/renderer/platform/graphics/paint/display_item_list.cc +++ b/third_party/blink/renderer/platform/graphics/paint/display_item_list.cc
@@ -9,6 +9,11 @@ namespace blink { +DisplayItemList::~DisplayItemList() { + for (auto& item : *this) + item.Destruct(); +} + #if DCHECK_IS_ON() std::unique_ptr<JSONArray> DisplayItemList::DisplayItemsAsJSON( @@ -44,7 +49,7 @@ } if ((flags & kShowPaintRecords) && item.IsDrawing()) { - const auto& drawing_item = static_cast<const DrawingDisplayItem&>(item); + const auto& drawing_item = To<DrawingDisplayItem>(item); if (const auto* record = drawing_item.GetPaintRecord().get()) json->SetArray("record", RecordAsJSON(*record)); }
diff --git a/third_party/blink/renderer/platform/graphics/paint/display_item_list.h b/third_party/blink/renderer/platform/graphics/paint/display_item_list.h index fdf99d2..e1bc8f9 100644 --- a/third_party/blink/renderer/platform/graphics/paint/display_item_list.h +++ b/third_party/blink/renderer/platform/graphics/paint/display_item_list.h
@@ -5,59 +5,151 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_DISPLAY_ITEM_LIST_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_DISPLAY_ITEM_LIST_H_ -#include "base/dcheck_is_on.h" -#include "third_party/blink/renderer/platform/graphics/contiguous_container.h" #include "third_party/blink/renderer/platform/graphics/paint/display_item.h" #include "third_party/blink/renderer/platform/graphics/paint/scrollbar_display_item.h" -#include "third_party/blink/renderer/platform/wtf/assertions.h" +#include "third_party/blink/renderer/platform/platform_export.h" +#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +#include "third_party/blink/renderer/platform/wtf/vector.h" namespace blink { class JSONArray; -// kDisplayItemAlignment must be a multiple of alignof(derived display item) for -// each derived display item; the ideal value is the least common multiple. -// The validity of kDisplayItemAlignment and kMaximumDisplayItemSize are checked -// in PaintController::CreateAndAppend(). -static constexpr wtf_size_t kDisplayItemAlignment = - alignof(ScrollbarDisplayItem); -static constexpr wtf_size_t kMaximumDisplayItemSize = - sizeof(ScrollbarDisplayItem); - -// A container for a list of display items. -class PLATFORM_EXPORT DisplayItemList - : public ContiguousContainer<DisplayItem, kDisplayItemAlignment> { +// A container for a list of display items of various types. +class PLATFORM_EXPORT DisplayItemList { public: - static constexpr wtf_size_t kDefaultCapacityInBytes = 512; + static constexpr wtf_size_t kDefaultCapacity = 16; - // Using 0 as the default value to make 0 also fall back to - // kDefaultCapacityInBytes. - explicit DisplayItemList(wtf_size_t initial_capacity_in_bytes = 0) - : ContiguousContainer(kMaximumDisplayItemSize, - initial_capacity_in_bytes - ? initial_capacity_in_bytes - : kDefaultCapacityInBytes) {} + // Using 0 as the default value to make 0 also fall back to kDefaultCapacity. + // The initial capacity will be allocated when the first item is appended. + explicit DisplayItemList(wtf_size_t initial_capacity = 0) + : initial_capacity_(initial_capacity ? initial_capacity + : kDefaultCapacity) {} + ~DisplayItemList(); + + DisplayItemList(const DisplayItemList&) = delete; + DisplayItemList& operator=(const DisplayItemList&) = delete; + DisplayItemList(DisplayItemList&&) = delete; + DisplayItemList& operator=(DisplayItemList&&) = delete; + + template <class DerivedItemType, typename... Args> + DerivedItemType& AllocateAndConstruct(Args&&... args) { + static_assert(WTF::IsSubclass<DerivedItemType, DisplayItem>::value, + "Must use subclass of DisplayItem."); + static_assert(sizeof(DerivedItemType) <= kMaxItemSize, + "DisplayItem subclass is larger than kMaxItemSize."); + static_assert(kAlignment % alignof(DerivedItemType) == 0, + "Derived type requires stronger alignment."); + void* result = AllocateUninitializedItem(); + new (result) DerivedItemType(std::forward<Args>(args)...); + return *static_cast<DerivedItemType*>(result); + } DisplayItem& AppendByMoving(DisplayItem& item) { SECURITY_CHECK(!item.IsTombstone()); - DisplayItem& result = - ContiguousContainer::AppendByMoving(item, item.DerivedSize()); - SetupTombstone(item, result); - return result; + return MoveItem(item, AllocateUninitializedItem()); } DisplayItem& ReplaceLastByMoving(DisplayItem& item) { SECURITY_CHECK(!item.IsTombstone()); - DCHECK_EQ(back().DerivedSize(), item.DerivedSize()); - DisplayItem& result = - ContiguousContainer::ReplaceLastByMoving(item, item.DerivedSize()); - SetupTombstone(item, result); - return result; + DisplayItem& last = back(); + last.Destruct(); + return MoveItem(item, &last); + } + + private: + // Declares itself as a forward iterator, but also supports a few more + // things. The whole random access iterator interface is a bit much. + template <typename BaseIterator, typename ItemType> + class IteratorWrapper + : public std::iterator<std::forward_iterator_tag, ItemType> { + DISALLOW_NEW(); + + public: + IteratorWrapper() = default; + explicit IteratorWrapper(const BaseIterator& it) : it_(it) {} + + bool operator==(const IteratorWrapper& other) const { + return it_ == other.it_; + } + bool operator!=(const IteratorWrapper& other) const { + return it_ != other.it_; + } + bool operator<(const IteratorWrapper& other) const { + return it_ < other.it_; + } + ItemType& operator*() const { return reinterpret_cast<ItemType&>(*it_); } + ItemType* operator->() const { return &operator*(); } + IteratorWrapper operator+(std::ptrdiff_t n) const { + return IteratorWrapper(it_ + n); + } + IteratorWrapper operator++(int) { + IteratorWrapper tmp = *this; + ++it_; + return tmp; + } + std::ptrdiff_t operator-(const IteratorWrapper& other) const { + return it_ - other.it_; + } + IteratorWrapper& operator++() { + ++it_; + return *this; + } + + private: + BaseIterator it_; + }; + + // kAlignment must be a multiple of alignof(derived display item) for each + // derived display item; the ideal value is the least common multiple. + // The validity of kAlignment and kMaxItemSize are checked in + // AllocateAndConstruct(). + static constexpr wtf_size_t kAlignment = alignof(ScrollbarDisplayItem); + static constexpr wtf_size_t kMaxItemSize = sizeof(ScrollbarDisplayItem); + + struct ItemSlot { + alignas(kAlignment) uint8_t data[kMaxItemSize]; + }; + using ItemVector = Vector<ItemSlot>; + + public: + using value_type = DisplayItem; + using iterator = IteratorWrapper<ItemVector::iterator, DisplayItem>; + using const_iterator = + IteratorWrapper<ItemVector::const_iterator, const DisplayItem>; + iterator begin() { return iterator(items_.begin()); } + iterator end() { return iterator(items_.end()); } + const_iterator begin() const { return const_iterator(items_.begin()); } + const_iterator end() const { return const_iterator(items_.end()); } + + DisplayItem& front() { return *begin(); } + const DisplayItem& front() const { return *begin(); } + DisplayItem& back() { + DCHECK(size()); + return (*this)[size() - 1]; + } + const DisplayItem& back() const { + DCHECK(size()); + return (*this)[size() - 1]; + } + + DisplayItem& operator[](wtf_size_t index) { return *(begin() + index); } + const DisplayItem& operator[](wtf_size_t index) const { + return *(begin() + index); + } + + wtf_size_t size() const { return items_.size(); } + bool IsEmpty() const { return !size(); } + + size_t MemoryUsageInBytes() const { + return sizeof(*this) + items_.CapacityInBytes(); } // Useful for iterating with a range-based for loop. template <typename Iterator> class Range { + DISALLOW_NEW(); + public: Range(const Iterator& begin, const Iterator& end) : begin_(begin), end_(end) {} @@ -103,24 +195,30 @@ #endif // DCHECK_IS_ON() private: - // Called by AppendByMoving() and ReplaceLastByMoving() which created a - // tombstone/"dead display item" that can be safely destructed but should - // never be used except for debugging and raster invalidation. - void SetupTombstone(DisplayItem& item, const DisplayItem& new_item) { - DCHECK(item.IsTombstone()); - // We need |visual_rect_| and |outset_for_raster_effects_| of the old - // display item for raster invalidation. Also, the fields that make up the - // ID (|client_|, |type_| and |fragment_|) need to match. As their values - // were either initialized to default values or were left uninitialized by - // DisplayItem's default constructor, now copy their original values back - // from |result|. - item.client_ = new_item.client_; - item.type_ = new_item.type_; - item.fragment_ = new_item.fragment_; - DCHECK_EQ(item.GetId(), new_item.GetId()); - item.visual_rect_ = new_item.visual_rect_; - item.raster_effect_outset_ = new_item.raster_effect_outset_; + void* AllocateUninitializedItem() { + if (items_.IsEmpty()) + items_.ReserveCapacity(initial_capacity_); + items_.emplace_back(); + return &items_.back(); } + + DisplayItem& MoveItem(DisplayItem& item, void* new_item_space) { + memcpy(new_item_space, static_cast<void*>(&item), kMaxItemSize); + + // Created a tombstone/"dead display item" that can be safely destructed but + // should never be used except for debugging and raster invalidation. + item.CreateTombstone(); + DCHECK(item.IsTombstone()); + // Original values for other fields are kept for debugging and raster + // invalidation. + DisplayItem& new_item = *static_cast<DisplayItem*>(new_item_space); + DCHECK_EQ(item.VisualRect(), new_item.VisualRect()); + DCHECK_EQ(item.GetRasterEffectOutset(), new_item.GetRasterEffectOutset()); + return new_item; + } + + ItemVector items_; + wtf_size_t initial_capacity_; }; using DisplayItemIterator = DisplayItemList::const_iterator;
diff --git a/third_party/blink/renderer/platform/graphics/paint/display_item_test.cc b/third_party/blink/renderer/platform/graphics/paint/display_item_test.cc index 0114fe4..ed8548b 100644 --- a/third_party/blink/renderer/platform/graphics/paint/display_item_test.cc +++ b/third_party/blink/renderer/platform/graphics/paint/display_item_test.cc
@@ -20,5 +20,10 @@ } #endif // DCHECK_IS_ON() +TEST(DisplayItemTest, AllZeroIsTombstone) { + alignas(alignof(DisplayItem)) uint8_t buffer[sizeof(DisplayItem)] = {0}; + EXPECT_TRUE(reinterpret_cast<const DisplayItem*>(buffer)->IsTombstone()); +} + } // namespace } // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/paint/drawing_display_item.cc b/third_party/blink/renderer/platform/graphics/paint/drawing_display_item.cc index c5f3c826..4186d2e 100644 --- a/third_party/blink/renderer/platform/graphics/paint/drawing_display_item.cc +++ b/third_party/blink/renderer/platform/graphics/paint/drawing_display_item.cc
@@ -7,12 +7,11 @@ #include "cc/paint/display_item_list.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_canvas.h" +#include "third_party/blink/renderer/platform/wtf/size_assertions.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkData.h" -#include "third_party/blink/renderer/platform/graphics/logging_canvas.h" - namespace blink { static SkBitmap RecordToBitmap(sk_sp<const PaintRecord> record, @@ -51,13 +50,12 @@ return !mismatch_count; } -bool DrawingDisplayItem::Equals(const DisplayItem& other) const { - if (!DisplayItem::Equals(other)) - return false; +bool DrawingDisplayItem::EqualsForUnderInvalidationImpl( + const DrawingDisplayItem& other) const { + DCHECK(RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()); const auto& record = GetPaintRecord(); - const auto& other_record = - static_cast<const DrawingDisplayItem&>(other).GetPaintRecord(); + const auto& other_record = other.GetPaintRecord(); if (!record && !other_record) return true; if (!record || !other_record) @@ -79,6 +77,8 @@ } SkColor DrawingDisplayItem::BackgroundColor(float& area) const { + DCHECK(!IsTombstone()); + if (GetType() != DisplayItem::kBoxDecorationBackground && GetType() != DisplayItem::kDocumentBackground && GetType() != DisplayItem::kDocumentRootBackdrop)
diff --git a/third_party/blink/renderer/platform/graphics/paint/drawing_display_item.h b/third_party/blink/renderer/platform/graphics/paint/drawing_display_item.h index 7aabddc..a2e17ab5 100644 --- a/third_party/blink/renderer/platform/graphics/paint/drawing_display_item.h +++ b/third_party/blink/renderer/platform/graphics/paint/drawing_display_item.h
@@ -10,21 +10,13 @@ #include "third_party/blink/renderer/platform/graphics/paint/paint_record.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" +#include "third_party/blink/renderer/platform/wtf/casting.h" #include "third_party/skia/include/core/SkRefCnt.h" namespace blink { // DrawingDisplayItem contains recorded painting operations which can be // replayed to produce a rastered output. -// -// This class has two notions of the bounds around the content that was recorded -// and will be produced by the item. The first is the |record_bounds| which -// describes the bounds of all content in the |record| in the space of the -// record. The second is the |visual_rect| which should describe the same thing, -// but takes into account transforms and clips that would apply to the -// PaintRecord, and is in the space of the DisplayItemList. This allows the -// visual_rect to be compared between DrawingDisplayItems, and to give bounds -// around what the user can actually see from the PaintRecord. class PLATFORM_EXPORT DrawingDisplayItem : public DisplayItem { public: DISABLE_CFI_PERF @@ -33,11 +25,13 @@ const IntRect& visual_rect, sk_sp<const PaintRecord> record); - const sk_sp<const PaintRecord>& GetPaintRecord() const { return record_; } - - bool Equals(const DisplayItem& other) const final; + const sk_sp<const PaintRecord>& GetPaintRecord() const { + DCHECK(!IsTombstone()); + return record_; + } bool KnownToBeOpaque() const { + DCHECK(!IsTombstone()); if (!RuntimeEnabledFeatures::CompositeAfterPaintEnabled()) return false; if (!known_to_be_opaque_is_set_) { @@ -47,6 +41,7 @@ return known_to_be_opaque_; } void SetKnownToBeOpaqueForTesting() { + DCHECK(!IsTombstone()); known_to_be_opaque_is_set_ = true; known_to_be_opaque_ = true; } @@ -54,6 +49,12 @@ SkColor BackgroundColor(float& area) const; private: + friend class DisplayItem; + bool EqualsForUnderInvalidationImpl(const DrawingDisplayItem&) const; +#if DCHECK_IS_ON() + void PropertiesAsJSONImpl(JSONObject&) const {} +#endif + bool CalculateKnownToBeOpaque(const PaintRecord*) const; sk_sp<const PaintRecord> record_; @@ -67,13 +68,19 @@ sk_sp<const PaintRecord> record) : DisplayItem(client, type, - sizeof(*this), visual_rect, /* draws_content*/ record && record->size()), record_(DrawsContent() ? std::move(record) : nullptr) { - DCHECK(IsDrawingType(type)); + DCHECK(IsDrawing()); } +template <> +struct DowncastTraits<DrawingDisplayItem> { + static bool AllowFrom(const DisplayItem& i) { + return !i.IsTombstone() && i.IsDrawing(); + } +}; + } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_DRAWING_DISPLAY_ITEM_H_
diff --git a/third_party/blink/renderer/platform/graphics/paint/drawing_display_item_test.cc b/third_party/blink/renderer/platform/graphics/paint/drawing_display_item_test.cc index 26bd71f..e82329d 100644 --- a/third_party/blink/renderer/platform/graphics/paint/drawing_display_item_test.cc +++ b/third_party/blink/renderer/platform/graphics/paint/drawing_display_item_test.cc
@@ -12,6 +12,7 @@ #include "third_party/blink/renderer/platform/graphics/paint/paint_recorder.h" #include "third_party/blink/renderer/platform/graphics/skia/skia_utils.h" #include "third_party/blink/renderer/platform/testing/fake_display_item_client.h" +#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" #include "third_party/skia/include/core/SkTypes.h" namespace blink { @@ -67,7 +68,9 @@ EXPECT_FALSE(item.DrawsContent()); } -TEST_F(DrawingDisplayItemTest, Equals) { +TEST_F(DrawingDisplayItemTest, EqualsForUnderInvalidation) { + ScopedPaintUnderInvalidationCheckingForTest under_invalidation_checking(true); + FloatRect bounds1(100.1, 100.2, 100.3, 100.4); DrawingDisplayItem item1(client_, DisplayItem::kDocumentBackground, EnclosingIntRect(bounds1), @@ -89,35 +92,35 @@ DrawingDisplayItem empty_item(client_, DisplayItem::kDocumentBackground, IntRect(), nullptr); - EXPECT_TRUE(item1.Equals(item1)); - EXPECT_FALSE(item1.Equals(item2)); - EXPECT_FALSE(item1.Equals(translated)); - EXPECT_TRUE(item1.Equals(zero_translated)); - EXPECT_FALSE(item1.Equals(empty_item)); + EXPECT_TRUE(item1.EqualsForUnderInvalidation(item1)); + EXPECT_FALSE(item1.EqualsForUnderInvalidation(item2)); + EXPECT_FALSE(item1.EqualsForUnderInvalidation(translated)); + EXPECT_TRUE(item1.EqualsForUnderInvalidation(zero_translated)); + EXPECT_FALSE(item1.EqualsForUnderInvalidation(empty_item)); - EXPECT_FALSE(item2.Equals(item1)); - EXPECT_TRUE(item2.Equals(item2)); - EXPECT_FALSE(item2.Equals(translated)); - EXPECT_FALSE(item2.Equals(zero_translated)); - EXPECT_FALSE(item2.Equals(empty_item)); + EXPECT_FALSE(item2.EqualsForUnderInvalidation(item1)); + EXPECT_TRUE(item2.EqualsForUnderInvalidation(item2)); + EXPECT_FALSE(item2.EqualsForUnderInvalidation(translated)); + EXPECT_FALSE(item2.EqualsForUnderInvalidation(zero_translated)); + EXPECT_FALSE(item2.EqualsForUnderInvalidation(empty_item)); - EXPECT_FALSE(translated.Equals(item1)); - EXPECT_FALSE(translated.Equals(item2)); - EXPECT_TRUE(translated.Equals(translated)); - EXPECT_FALSE(translated.Equals(zero_translated)); - EXPECT_FALSE(translated.Equals(empty_item)); + EXPECT_FALSE(translated.EqualsForUnderInvalidation(item1)); + EXPECT_FALSE(translated.EqualsForUnderInvalidation(item2)); + EXPECT_TRUE(translated.EqualsForUnderInvalidation(translated)); + EXPECT_FALSE(translated.EqualsForUnderInvalidation(zero_translated)); + EXPECT_FALSE(translated.EqualsForUnderInvalidation(empty_item)); - EXPECT_TRUE(zero_translated.Equals(item1)); - EXPECT_FALSE(zero_translated.Equals(item2)); - EXPECT_FALSE(zero_translated.Equals(translated)); - EXPECT_TRUE(zero_translated.Equals(zero_translated)); - EXPECT_FALSE(zero_translated.Equals(empty_item)); + EXPECT_TRUE(zero_translated.EqualsForUnderInvalidation(item1)); + EXPECT_FALSE(zero_translated.EqualsForUnderInvalidation(item2)); + EXPECT_FALSE(zero_translated.EqualsForUnderInvalidation(translated)); + EXPECT_TRUE(zero_translated.EqualsForUnderInvalidation(zero_translated)); + EXPECT_FALSE(zero_translated.EqualsForUnderInvalidation(empty_item)); - EXPECT_FALSE(empty_item.Equals(item1)); - EXPECT_FALSE(empty_item.Equals(item2)); - EXPECT_FALSE(empty_item.Equals(translated)); - EXPECT_FALSE(empty_item.Equals(zero_translated)); - EXPECT_TRUE(empty_item.Equals(empty_item)); + EXPECT_FALSE(empty_item.EqualsForUnderInvalidation(item1)); + EXPECT_FALSE(empty_item.EqualsForUnderInvalidation(item2)); + EXPECT_FALSE(empty_item.EqualsForUnderInvalidation(translated)); + EXPECT_FALSE(empty_item.EqualsForUnderInvalidation(zero_translated)); + EXPECT_TRUE(empty_item.EqualsForUnderInvalidation(empty_item)); } } // namespace
diff --git a/third_party/blink/renderer/platform/graphics/paint/drawing_recorder_test.cc b/third_party/blink/renderer/platform/graphics/paint/drawing_recorder_test.cc index 33ee5925..42eb5e04 100644 --- a/third_party/blink/renderer/platform/graphics/paint/drawing_recorder_test.cc +++ b/third_party/blink/renderer/platform/graphics/paint/drawing_recorder_test.cc
@@ -27,9 +27,9 @@ CommitAndFinishCycle(); EXPECT_THAT(GetPaintController().GetDisplayItemList(), ElementsAre(IsSameId(&client, kForegroundType))); - EXPECT_FALSE(static_cast<const DrawingDisplayItem&>( - GetPaintController().GetDisplayItemList()[0]) - .GetPaintRecord()); + EXPECT_FALSE( + To<DrawingDisplayItem>(GetPaintController().GetDisplayItemList()[0]) + .GetPaintRecord()); } TEST_F(DrawingRecorderTest, Rect) {
diff --git a/third_party/blink/renderer/platform/graphics/paint/foreign_layer_display_item.cc b/third_party/blink/renderer/platform/graphics/paint/foreign_layer_display_item.cc index 52c2622..6c2a977 100644 --- a/third_party/blink/renderer/platform/graphics/paint/foreign_layer_display_item.cc +++ b/third_party/blink/renderer/platform/graphics/paint/foreign_layer_display_item.cc
@@ -22,21 +22,19 @@ const IntPoint& offset) : DisplayItem(client, type, - sizeof(*this), IntRect(offset, IntSize(layer->bounds()))), layer_(std::move(layer)) { DCHECK(IsForeignLayerType(type)); } -bool ForeignLayerDisplayItem::Equals(const DisplayItem& other) const { - return DisplayItem::Equals(other) && - GetLayer() == - static_cast<const ForeignLayerDisplayItem&>(other).GetLayer(); +bool ForeignLayerDisplayItem::EqualsForUnderInvalidationImpl( + const ForeignLayerDisplayItem& other) const { + DCHECK(RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()); + return GetLayer() == other.GetLayer(); } #if DCHECK_IS_ON() -void ForeignLayerDisplayItem::PropertiesAsJSON(JSONObject& json) const { - DisplayItem::PropertiesAsJSON(json); +void ForeignLayerDisplayItem::PropertiesAsJSONImpl(JSONObject& json) const { json.SetInteger("layer", GetLayer()->id()); } #endif
diff --git a/third_party/blink/renderer/platform/graphics/paint/foreign_layer_display_item.h b/third_party/blink/renderer/platform/graphics/paint/foreign_layer_display_item.h index bd58691..376ca14c 100644 --- a/third_party/blink/renderer/platform/graphics/paint/foreign_layer_display_item.h +++ b/third_party/blink/renderer/platform/graphics/paint/foreign_layer_display_item.h
@@ -10,6 +10,7 @@ #include "third_party/blink/renderer/platform/graphics/paint/display_item.h" #include "third_party/blink/renderer/platform/graphics/paint/property_tree_state.h" #include "third_party/blink/renderer/platform/platform_export.h" +#include "third_party/blink/renderer/platform/wtf/casting.h" namespace blink { @@ -28,15 +29,18 @@ scoped_refptr<cc::Layer>, const IntPoint& offset); - cc::Layer* GetLayer() const { return layer_.get(); } - - // DisplayItem - bool Equals(const DisplayItem&) const final; -#if DCHECK_IS_ON() - void PropertiesAsJSON(JSONObject&) const final; -#endif + cc::Layer* GetLayer() const { + DCHECK(!IsTombstone()); + return layer_.get(); + } private: + friend class DisplayItem; + bool EqualsForUnderInvalidationImpl(const ForeignLayerDisplayItem&) const; +#if DCHECK_IS_ON() + void PropertiesAsJSONImpl(JSONObject&) const; +#endif + scoped_refptr<cc::Layer> layer_; }; @@ -53,6 +57,13 @@ const char* name_; }; +template <> +struct DowncastTraits<ForeignLayerDisplayItem> { + static bool AllowFrom(const DisplayItem& i) { + return !i.IsTombstone() && i.IsForeignLayer(); + } +}; + // Records a foreign layer into a GraphicsContext. // Use this where you would use a recorder class. // |client| provides DebugName and optionally DOMNodeId, while VisualRect will
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_artifact.h b/third_party/blink/renderer/platform/graphics/paint/paint_artifact.h index f2250a8..1f23d41a 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_artifact.h +++ b/third_party/blink/renderer/platform/graphics/paint/paint_artifact.h
@@ -27,11 +27,10 @@ USING_FAST_MALLOC(PaintArtifact); public: - explicit PaintArtifact( - wtf_size_t initial_display_item_list_capacity_in_bytes = 0, - wtf_size_t initial_paint_chunks_capacity_in_elements = 0) - : display_item_list_(initial_display_item_list_capacity_in_bytes) { - chunks_.ReserveInitialCapacity(initial_paint_chunks_capacity_in_elements); + explicit PaintArtifact(wtf_size_t initial_display_item_list_capacity = 0, + wtf_size_t initial_paint_chunks_capacity = 0) + : display_item_list_(initial_display_item_list_capacity) { + chunks_.ReserveInitialCapacity(initial_paint_chunks_capacity); } PaintArtifact(const PaintArtifact& other) = delete;
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_chunker.cc b/third_party/blink/renderer/platform/graphics/paint/paint_chunker.cc index 73e5f1e..4247e45 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_chunker.cc +++ b/third_party/blink/renderer/platform/graphics/paint/paint_chunker.cc
@@ -99,15 +99,13 @@ // set the candidate to be this item. if (item.IsDrawing() && item.DrawsContent()) { float item_area; - Color item_color = - static_cast<const DrawingDisplayItem&>(item).BackgroundColor(item_area); + Color item_color = To<DrawingDisplayItem>(item).BackgroundColor(item_area); ProcessBackgroundColorCandidate(chunk.id, item_color, item_area); } constexpr wtf_size_t kMaxRegionComplexity = 10; if (should_compute_contents_opaque_ && item.IsDrawing()) { - const DrawingDisplayItem& drawing = - static_cast<const DrawingDisplayItem&>(item); + const DrawingDisplayItem& drawing = To<DrawingDisplayItem>(item); if (drawing.KnownToBeOpaque() && last_chunk_known_to_be_opaque_region_.Complexity() < kMaxRegionComplexity) {
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_controller.cc b/third_party/blink/renderer/platform/graphics/paint/paint_controller.cc index adcb19e..b3dc676 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_controller.cc +++ b/third_party/blink/renderer/platform/graphics/paint/paint_controller.cc
@@ -556,7 +556,7 @@ current_paint_artifact_ = std::move(new_paint_artifact_); if (usage_ == kMultiplePaints) { new_paint_artifact_ = base::MakeRefCounted<PaintArtifact>( - current_paint_artifact_->GetDisplayItemList().UsedCapacityInBytes(), + current_paint_artifact_->GetDisplayItemList().size(), current_paint_artifact_->PaintChunks().size()); paint_chunker_.ResetChunks(&new_paint_artifact_->PaintChunks()); } else { @@ -663,16 +663,11 @@ LOG(ERROR) << "See http://crbug.com/619103."; const PaintRecord* new_record = nullptr; - if (new_item.IsDrawing()) { - new_record = - static_cast<const DrawingDisplayItem&>(new_item).GetPaintRecord().get(); - } + if (auto* new_drawing = DynamicTo<DrawingDisplayItem>(new_item)) + new_record = new_drawing->GetPaintRecord().get(); const PaintRecord* old_record = nullptr; - if (old_item->IsDrawing()) { - old_record = static_cast<const DrawingDisplayItem*>(old_item) - ->GetPaintRecord() - .get(); - } + if (auto* old_drawing = DynamicTo<DrawingDisplayItem>(old_item)) + old_record = old_drawing->GetPaintRecord().get(); LOG(INFO) << "new record:\n" << (new_record ? RecordAsDebugString(*new_record).Utf8() : "None"); LOG(INFO) << "old record:\n" @@ -722,7 +717,7 @@ ? ¤t_paint_artifact_->GetDisplayItemList()[old_item_index] : nullptr; - if (!old_item || !new_item.Equals(*old_item)) { + if (!old_item || !new_item.EqualsForUnderInvalidation(*old_item)) { // If we ever skipped reporting any under-invalidations, report the earliest // one. ShowUnderInvalidationError("under-invalidation: display item changed",
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_controller.h b/third_party/blink/renderer/platform/graphics/paint/paint_controller.h index b5e7cec1..c14f15c 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_controller.h +++ b/third_party/blink/renderer/platform/graphics/paint/paint_controller.h
@@ -15,7 +15,6 @@ #include "cc/input/layer_selection_bound.h" #include "third_party/blink/renderer/platform/geometry/int_rect.h" #include "third_party/blink/renderer/platform/geometry/layout_point.h" -#include "third_party/blink/renderer/platform/graphics/contiguous_container.h" #include "third_party/blink/renderer/platform/graphics/paint/display_item.h" #include "third_party/blink/renderer/platform/graphics/paint/display_item_list.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_artifact.h" @@ -132,15 +131,6 @@ template <typename DisplayItemClass, typename... Args> void CreateAndAppend(Args&&... args) { - static_assert(WTF::IsSubclass<DisplayItemClass, DisplayItem>::value, - "Can only createAndAppend subclasses of DisplayItem."); - static_assert( - sizeof(DisplayItemClass) <= kMaximumDisplayItemSize, - "DisplayItem subclass is larger than kMaximumDisplayItemSize."); - static_assert(kDisplayItemAlignment % alignof(DisplayItemClass) == 0, - "DisplayItem subclass alignment is not a factor of " - "kDisplayItemAlignment."); - DisplayItemClass& display_item = new_paint_artifact_->GetDisplayItemList() .AllocateAndConstruct<DisplayItemClass>(
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.cc b/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.cc index f733eec..914a07a 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.cc +++ b/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.cc
@@ -404,12 +404,10 @@ EXPECT_TRUE(ClientCacheIsValid(first)); EXPECT_TRUE(ClientCacheIsValid(second)); sk_sp<const PaintRecord> first_paint_record = - static_cast<const DrawingDisplayItem&>( - GetPaintController().GetDisplayItemList()[0]) + To<DrawingDisplayItem>(GetPaintController().GetDisplayItemList()[0]) .GetPaintRecord(); sk_sp<const PaintRecord> second_paint_record = - static_cast<const DrawingDisplayItem&>( - GetPaintController().GetDisplayItemList()[1]) + To<DrawingDisplayItem>(GetPaintController().GetDisplayItemList()[1]) .GetPaintRecord(); first.Invalidate(); @@ -426,15 +424,14 @@ IsSameId(&second, kBackgroundType))); // The first display item should be updated. EXPECT_NE(first_paint_record, - static_cast<const DrawingDisplayItem&>( - GetPaintController().GetDisplayItemList()[0]) + To<DrawingDisplayItem>(GetPaintController().GetDisplayItemList()[0]) .GetPaintRecord()); // The second display item should be cached. if (!RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) { - EXPECT_EQ(second_paint_record, - static_cast<const DrawingDisplayItem&>( - GetPaintController().GetDisplayItemList()[1]) - .GetPaintRecord()); + EXPECT_EQ( + second_paint_record, + To<DrawingDisplayItem>(GetPaintController().GetDisplayItemList()[1]) + .GetPaintRecord()); } EXPECT_TRUE(ClientCacheIsValid(first)); EXPECT_TRUE(ClientCacheIsValid(second)); @@ -1271,12 +1268,10 @@ IsSameId(&content, kForegroundType), IsSameId(&content, kForegroundType))); sk_sp<const PaintRecord> record1 = - static_cast<const DrawingDisplayItem&>( - GetPaintController().GetDisplayItemList()[1]) + To<DrawingDisplayItem>(GetPaintController().GetDisplayItemList()[1]) .GetPaintRecord(); sk_sp<const PaintRecord> record2 = - static_cast<const DrawingDisplayItem&>( - GetPaintController().GetDisplayItemList()[2]) + To<DrawingDisplayItem>(GetPaintController().GetDisplayItemList()[2]) .GetPaintRecord(); EXPECT_NE(record1, record2); EXPECT_DEFAULT_ROOT_CHUNK(3); @@ -1305,12 +1300,12 @@ ElementsAre(IsSameId(&multicol, kBackgroundType), IsSameId(&content, kForegroundType), IsSameId(&content, kForegroundType))); - EXPECT_NE(record1, static_cast<const DrawingDisplayItem&>( - GetPaintController().GetDisplayItemList()[1]) - .GetPaintRecord()); - EXPECT_NE(record2, static_cast<const DrawingDisplayItem&>( - GetPaintController().GetDisplayItemList()[2]) - .GetPaintRecord()); + EXPECT_NE(record1, + To<DrawingDisplayItem>(GetPaintController().GetDisplayItemList()[1]) + .GetPaintRecord()); + EXPECT_NE(record2, + To<DrawingDisplayItem>(GetPaintController().GetDisplayItemList()[2]) + .GetPaintRecord()); EXPECT_DEFAULT_ROOT_CHUNK(3); InitRootChunk(); @@ -1333,11 +1328,9 @@ IsSameId(&content, kForegroundType), IsSameId(&content, kForegroundType))); EXPECT_NE(record1, - static_cast<const DrawingDisplayItem&>(display_item_list[1]) - .GetPaintRecord()); + To<DrawingDisplayItem>(display_item_list[1]).GetPaintRecord()); EXPECT_NE(record2, - static_cast<const DrawingDisplayItem&>(display_item_list[2]) - .GetPaintRecord()); + To<DrawingDisplayItem>(display_item_list[2]).GetPaintRecord()); CommitAndFinishCycle(); EXPECT_DEFAULT_ROOT_CHUNK(4); @@ -1365,16 +1358,13 @@ IsSameId(&content, kForegroundType), IsSameId(&content, kForegroundType))); sk_sp<const PaintRecord> record0 = - static_cast<const DrawingDisplayItem&>( - GetPaintController().GetDisplayItemList()[0]) + To<DrawingDisplayItem>(GetPaintController().GetDisplayItemList()[0]) .GetPaintRecord(); sk_sp<const PaintRecord> record1 = - static_cast<const DrawingDisplayItem&>( - GetPaintController().GetDisplayItemList()[1]) + To<DrawingDisplayItem>(GetPaintController().GetDisplayItemList()[1]) .GetPaintRecord(); sk_sp<const PaintRecord> record2 = - static_cast<const DrawingDisplayItem&>( - GetPaintController().GetDisplayItemList()[2]) + To<DrawingDisplayItem>(GetPaintController().GetDisplayItemList()[2]) .GetPaintRecord(); EXPECT_NE(record1, record2); @@ -1405,15 +1395,15 @@ ElementsAre(IsSameId(&content, kBackgroundType), IsSameId(&content, kForegroundType), IsSameId(&content, kForegroundType))); - EXPECT_NE(record0, static_cast<const DrawingDisplayItem&>( - GetPaintController().GetDisplayItemList()[0]) - .GetPaintRecord()); - EXPECT_NE(record1, static_cast<const DrawingDisplayItem&>( - GetPaintController().GetDisplayItemList()[1]) - .GetPaintRecord()); - EXPECT_NE(record2, static_cast<const DrawingDisplayItem&>( - GetPaintController().GetDisplayItemList()[2]) - .GetPaintRecord()); + EXPECT_NE(record0, + To<DrawingDisplayItem>(GetPaintController().GetDisplayItemList()[0]) + .GetPaintRecord()); + EXPECT_NE(record1, + To<DrawingDisplayItem>(GetPaintController().GetDisplayItemList()[1]) + .GetPaintRecord()); + EXPECT_NE(record2, + To<DrawingDisplayItem>(GetPaintController().GetDisplayItemList()[2]) + .GetPaintRecord()); } TEST_P(PaintControllerTest, SkipCacheDuplicatedItemAndChunkIds) {
diff --git a/third_party/blink/renderer/platform/graphics/paint/scrollbar_display_item.cc b/third_party/blink/renderer/platform/graphics/paint/scrollbar_display_item.cc index 3995ac8e..8296840 100644 --- a/third_party/blink/renderer/platform/graphics/paint/scrollbar_display_item.cc +++ b/third_party/blink/renderer/platform/graphics/paint/scrollbar_display_item.cc
@@ -26,7 +26,6 @@ CompositorElementId element_id) : DisplayItem(client, type, - sizeof(*this), visual_rect, /*draws_content*/ true), data_(new Data{std::move(scrollbar), scroll_translation, element_id}) { @@ -35,6 +34,7 @@ } sk_sp<const PaintRecord> ScrollbarDisplayItem::Paint() const { + DCHECK(!IsTombstone()); auto* scrollbar = data_->scrollbar_.get(); if (data_->record_) { DCHECK(!scrollbar->NeedsRepaintPart( @@ -59,6 +59,7 @@ scoped_refptr<cc::ScrollbarLayerBase> ScrollbarDisplayItem::CreateOrReuseLayer( cc::ScrollbarLayerBase* existing_layer) const { + DCHECK(!IsTombstone()); // This function is called when the scrollbar is composited. We don't need // record_ which is for non-composited scrollbars. data_->record_ = nullptr; @@ -83,24 +84,19 @@ return layer; } -bool ScrollbarDisplayItem::Equals(const DisplayItem& other) const { - if (!DisplayItem::Equals(other)) - return false; - +bool ScrollbarDisplayItem::EqualsForUnderInvalidationImpl( + const ScrollbarDisplayItem& other) const { + DCHECK(RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()); // Don't check scrollbar_ because it's always newly created when we repaint // a scrollbar (including forced repaint for PaintUnderInvalidationChecking). // Don't check record_ because it's lazily created, and the DCHECKs in Paint() // can catch most under-invalidation cases. - const auto& other_scrollbar_item = - static_cast<const ScrollbarDisplayItem&>(other); - return data_->scroll_translation_ == - other_scrollbar_item.data_->scroll_translation_ && - data_->element_id_ == other_scrollbar_item.data_->element_id_; + return data_->scroll_translation_ == other.data_->scroll_translation_ && + data_->element_id_ == other.data_->element_id_; } #if DCHECK_IS_ON() -void ScrollbarDisplayItem::PropertiesAsJSON(JSONObject& json) const { - DisplayItem::PropertiesAsJSON(json); +void ScrollbarDisplayItem::PropertiesAsJSONImpl(JSONObject& json) const { json.SetString("scrollTranslation", String::Format("%p", data_->scroll_translation_)); }
diff --git a/third_party/blink/renderer/platform/graphics/paint/scrollbar_display_item.h b/third_party/blink/renderer/platform/graphics/paint/scrollbar_display_item.h index 2ac7daa9..0bbf18a 100644 --- a/third_party/blink/renderer/platform/graphics/paint/scrollbar_display_item.h +++ b/third_party/blink/renderer/platform/graphics/paint/scrollbar_display_item.h
@@ -10,6 +10,7 @@ #include "third_party/blink/renderer/platform/graphics/compositor_element_id.h" #include "third_party/blink/renderer/platform/graphics/paint/display_item.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_record.h" +#include "third_party/blink/renderer/platform/wtf/casting.h" #include "third_party/skia/include/core/SkRefCnt.h" namespace cc { @@ -37,9 +38,13 @@ CompositorElementId element_id); const TransformPaintPropertyNode* ScrollTranslation() const { + DCHECK(!IsTombstone()); return data_->scroll_translation_; } - CompositorElementId ElementId() const { return data_->element_id_; } + CompositorElementId ElementId() const { + DCHECK(!IsTombstone()); + return data_->element_id_; + } // Paints the scrollbar into the internal paint record, for non-composited // scrollbar. @@ -49,12 +54,6 @@ scoped_refptr<cc::ScrollbarLayerBase> CreateOrReuseLayer( cc::ScrollbarLayerBase* existing_layer) const; - // DisplayItem - bool Equals(const DisplayItem&) const override; -#if DCHECK_IS_ON() - void PropertiesAsJSON(JSONObject&) const override; -#endif - // Records a scrollbar into a GraphicsContext. Must check // PaintController::UseCachedItem() before calling this function. // |rect| is the bounding box of the scrollbar in the current transform space. @@ -67,6 +66,12 @@ CompositorElementId element_id); private: + friend class DisplayItem; + bool EqualsForUnderInvalidationImpl(const ScrollbarDisplayItem&) const; +#if DCHECK_IS_ON() + void PropertiesAsJSONImpl(JSONObject&) const; +#endif + struct Data { scoped_refptr<cc::Scrollbar> scrollbar_; const TransformPaintPropertyNode* scroll_translation_; @@ -82,6 +87,13 @@ std::unique_ptr<Data> data_; }; +template <> +struct DowncastTraits<ScrollbarDisplayItem> { + static bool AllowFrom(const DisplayItem& i) { + return !i.IsTombstone() && i.IsScrollbar(); + } +}; + } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_SCROLLBAR_DISPLAY_ITEM_H_
diff --git a/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder.cc b/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder.cc index 4b75caf..66a0940 100644 --- a/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder.cc +++ b/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder.cc
@@ -295,7 +295,11 @@ if (Failed()) return false; - const unsigned kWebpHeaderSize = 30; + // RIFF header (12 bytes) + data chunk header (8 bytes). + const unsigned kWebpHeaderSize = 20; + // The number of bytes needed to retrieve the size will vary based on the + // type of chunk (VP8/VP8L/VP8X). This check just serves as an early out + // before bitstream validation can occur. if (data_->size() < kWebpHeaderSize) return IsAllDataReceived() ? SetFailed() : false; @@ -329,10 +333,18 @@ reinterpret_cast<const uint8_t*>(consolidated_data_->data()), consolidated_data_->size()}; demux_ = WebPDemuxPartial(&input_data, &demux_state_); - if (!demux_ || (IsAllDataReceived() && demux_state_ != WEBP_DEMUX_DONE)) { - if (!demux_) + const bool truncated_file = + IsAllDataReceived() && demux_state_ != WEBP_DEMUX_DONE; + if (!demux_ || demux_state_ < WEBP_DEMUX_PARSED_HEADER || truncated_file) { + if (!demux_) { consolidated_data_.reset(); - return SetFailed(); + } else { + // We delete the demuxer early to avoid breaking the expectation that + // frame count == 0 when IsSizeAvailable() is false. + WebPDemuxDelete(demux_); + demux_ = nullptr; + } + return truncated_file ? SetFailed() : false; } DCHECK_GT(demux_state_, WEBP_DEMUX_PARSING_HEADER);
diff --git a/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder_test.cc b/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder_test.cc index 6c705281..3154e3e 100644 --- a/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder_test.cc +++ b/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder_test.cc
@@ -514,6 +514,9 @@ TestByteByByteDecode(&CreateWEBPDecoder, "/images/resources/crbug.364830.webp", 1u, kAnimationNone); + TestByteByByteDecode(&CreateWEBPDecoder, + "/images/resources/size-failure.b186640109.webp", 1u, + kAnimationNone); } TEST(StaticWebPTests, isSizeAvailable) { @@ -522,6 +525,9 @@ 520u, true, kAnimationNone); TestByteByByteSizeAvailable(&CreateWEBPDecoder, "/images/resources/test.webp", 30u, false, kAnimationNone); + TestByteByByteSizeAvailable(&CreateWEBPDecoder, + "/images/resources/size-failure.b186640109.webp", + 25u, false, kAnimationNone); } TEST(StaticWebPTests, notAnimated) {
diff --git a/third_party/blink/renderer/platform/p2p/empty_network_manager.cc b/third_party/blink/renderer/platform/p2p/empty_network_manager.cc index b49d3cd..0d7be63 100644 --- a/third_party/blink/renderer/platform/p2p/empty_network_manager.cc +++ b/third_party/blink/renderer/platform/p2p/empty_network_manager.cc
@@ -8,27 +8,16 @@ #include "base/check_op.h" #include "base/location.h" #include "base/threading/thread_task_runner_handle.h" -#include "third_party/blink/renderer/platform/p2p/ipc_network_manager.h" #include "third_party/blink/renderer/platform/p2p/network_manager_uma.h" namespace blink { -EmptyNetworkManager::EmptyNetworkManager(IpcNetworkManager* network_manager) - : EmptyNetworkManager(network_manager, - network_manager->AsWeakPtrForSignalingThread()) {} - -// DO NOT dereference/check `network_manager_for_signaling_thread_` in the ctor! -// Doing so would bind its WeakFactory to the constructing thread (main thread) -// instead of the thread `this` lives in (signaling thread). -EmptyNetworkManager::EmptyNetworkManager( - rtc::NetworkManager* network_manager, - base::WeakPtr<rtc::NetworkManager> network_manager_for_signaling_thread) - : network_manager_for_signaling_thread_( - network_manager_for_signaling_thread) { +EmptyNetworkManager::EmptyNetworkManager(rtc::NetworkManager* network_manager) + : network_manager_(network_manager) { DCHECK(network_manager); DETACH_FROM_THREAD(thread_checker_); set_enumeration_permission(ENUMERATION_BLOCKED); - network_manager->SignalNetworksChanged.connect( + network_manager_->SignalNetworksChanged.connect( this, &EmptyNetworkManager::OnNetworksChanged); } @@ -38,17 +27,13 @@ void EmptyNetworkManager::StartUpdating() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - DCHECK(network_manager_for_signaling_thread_); ++start_count_; - network_manager_for_signaling_thread_->StartUpdating(); + network_manager_->StartUpdating(); } void EmptyNetworkManager::StopUpdating() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - - if (network_manager_for_signaling_thread_) - network_manager_for_signaling_thread_->StopUpdating(); - + network_manager_->StopUpdating(); --start_count_; DCHECK_GE(start_count_, 0); } @@ -61,10 +46,7 @@ bool EmptyNetworkManager::GetDefaultLocalAddress( int family, rtc::IPAddress* ipaddress) const { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - DCHECK(network_manager_for_signaling_thread_); - return network_manager_for_signaling_thread_->GetDefaultLocalAddress( - family, ipaddress); + return network_manager_->GetDefaultLocalAddress(family, ipaddress); } void EmptyNetworkManager::OnNetworksChanged() {
diff --git a/third_party/blink/renderer/platform/p2p/empty_network_manager.h b/third_party/blink/renderer/platform/p2p/empty_network_manager.h index 5e0a17d1..77d43634 100644 --- a/third_party/blink/renderer/platform/p2p/empty_network_manager.h +++ b/third_party/blink/renderer/platform/p2p/empty_network_manager.h
@@ -18,19 +18,16 @@ namespace blink { -class FilteringNetworkManagerTest; -class IpcNetworkManager; - // A NetworkManager implementation which handles the case where local address // enumeration is not requested and just returns empty network lists. This class // is not thread safe and should only be used by WebRTC's network thread. class EmptyNetworkManager : public rtc::NetworkManagerBase, public sigslot::has_slots<> { public: - // This class is created on the main thread but used by WebRTC's worker thread - // |task_runner|. + // This class is created by WebRTC's signaling thread but used by WebRTC's + // worker thread |task_runner|. PLATFORM_EXPORT explicit EmptyNetworkManager( - IpcNetworkManager* network_manager); + rtc::NetworkManager* network_manager); PLATFORM_EXPORT ~EmptyNetworkManager() override; // rtc::NetworkManager: @@ -41,19 +38,6 @@ rtc::IPAddress* ipaddress) const override; private: - friend class FilteringNetworkManagerTest; - // We can't dereference the wrapped network manager from the construction - // thread, as that would cause it to bind to the wrong sequence. We also can't - // obtain a `WeakPtr` from an arbitrary `rtc::NetworkManager`, so we take 2 - // pointers pointing to the same instance, one is a raw pointer for use on the - // constructing thread and the other is a weak pointer for use on the worker - // thread. - // TODO(crbug.com/1191914): Simplify this, to avoid the subtleties of having - // to pass two pointers to the same object. - PLATFORM_EXPORT EmptyNetworkManager( - rtc::NetworkManager* network_manager, - base::WeakPtr<rtc::NetworkManager> network_manager_for_signaling_thread); - // Receive callback from the wrapped NetworkManager when the underneath // network list is changed. // @@ -71,10 +55,9 @@ // StartUpdating. int start_count_ = 0; - // `network_manager_for_signaling_thread_` is owned by the - // PeerConnectionDependencyFactory, that may be destroyed when the frame is - // detached. - base::WeakPtr<rtc::NetworkManager> network_manager_for_signaling_thread_; + // |network_manager_| is just a reference, owned by + // PeerConnectionDependencyFactory. + rtc::NetworkManager* network_manager_; base::WeakPtrFactory<EmptyNetworkManager> weak_ptr_factory_{this};
diff --git a/third_party/blink/renderer/platform/p2p/filtering_network_manager.cc b/third_party/blink/renderer/platform/p2p/filtering_network_manager.cc index 728eaee6..d240762 100644 --- a/third_party/blink/renderer/platform/p2p/filtering_network_manager.cc +++ b/third_party/blink/renderer/platform/p2p/filtering_network_manager.cc
@@ -10,28 +10,15 @@ #include "base/logging.h" #include "base/threading/thread_task_runner_handle.h" #include "media/base/media_permission.h" -#include "third_party/blink/renderer/platform/p2p/ipc_network_manager.h" #include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink { FilteringNetworkManager::FilteringNetworkManager( - IpcNetworkManager* network_manager, + rtc::NetworkManager* network_manager, media::MediaPermission* media_permission, bool allow_mdns_obfuscation) - : FilteringNetworkManager(network_manager->AsWeakPtrForSignalingThread(), - media_permission, - allow_mdns_obfuscation) {} - -// DO NOT dereference/check `network_manager_for_signaling_thread` in the ctor! -// Doing so would bind its WeakFactory to the constructing thread (main thread) -// instead of the thread `this` lives in (signaling thread). -FilteringNetworkManager::FilteringNetworkManager( - base::WeakPtr<rtc::NetworkManager> network_manager_for_signaling_thread, - media::MediaPermission* media_permission, - bool allow_mdns_obfuscation) - : network_manager_for_signaling_thread_( - std::move(network_manager_for_signaling_thread)), + : network_manager_(network_manager), media_permission_(media_permission), allow_mdns_obfuscation_(allow_mdns_obfuscation) { DETACH_FROM_THREAD(thread_checker_); @@ -66,11 +53,10 @@ void FilteringNetworkManager::StartUpdating() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(started_permission_check_); - DCHECK(network_manager_for_signaling_thread_); if (start_updating_time_.is_null()) { start_updating_time_ = base::TimeTicks::Now(); - network_manager_for_signaling_thread_->SignalNetworksChanged.connect( + network_manager_->SignalNetworksChanged.connect( this, &FilteringNetworkManager::OnNetworksChanged); } @@ -78,7 +64,7 @@ // StartUpdating, in case the update signal is fired synchronously. pending_network_update_ = true; ++start_count_; - network_manager_for_signaling_thread_->StartUpdating(); + network_manager_->StartUpdating(); // If we have not sent the first update, which implies we have not received // the first network update from the base network manager, we wait until the // base network manager signals a network change for us to populate the @@ -90,8 +76,7 @@ void FilteringNetworkManager::StopUpdating() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - if (network_manager_for_signaling_thread_) - network_manager_for_signaling_thread_->StopUpdating(); + network_manager_->StopUpdating(); DCHECK_GT(start_count_, 0); --start_count_; } @@ -110,17 +95,13 @@ const { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - if (!network_manager_for_signaling_thread_) - return nullptr; - // mDNS responder is set to null if we have the enumeration permission or the // mDNS obfuscation of IPs is disallowed. if (enumeration_permission() == ENUMERATION_ALLOWED || - !allow_mdns_obfuscation_) { + !allow_mdns_obfuscation_) return nullptr; - } - return network_manager_for_signaling_thread_->GetMdnsResponder(); + return network_manager_->GetMdnsResponder(); } void FilteringNetworkManager::CheckPermission() { @@ -160,23 +141,19 @@ void FilteringNetworkManager::OnNetworksChanged() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - DCHECK(network_manager_for_signaling_thread_); - pending_network_update_ = false; // Update the default local addresses. rtc::IPAddress ipv4_default; rtc::IPAddress ipv6_default; - network_manager_for_signaling_thread_->GetDefaultLocalAddress(AF_INET, - &ipv4_default); - network_manager_for_signaling_thread_->GetDefaultLocalAddress(AF_INET6, - &ipv6_default); + network_manager_->GetDefaultLocalAddress(AF_INET, &ipv4_default); + network_manager_->GetDefaultLocalAddress(AF_INET6, &ipv6_default); set_default_local_addresses(ipv4_default, ipv6_default); // Copy and merge the networks. Fire a signal if the permission status is // known. NetworkList networks; - network_manager_for_signaling_thread_->GetNetworks(&networks); + network_manager_->GetNetworks(&networks); NetworkList copied_networks; copied_networks.reserve(networks.size()); for (rtc::Network* network : networks) {
diff --git a/third_party/blink/renderer/platform/p2p/filtering_network_manager.h b/third_party/blink/renderer/platform/p2p/filtering_network_manager.h index c991a04..8243e2f 100644 --- a/third_party/blink/renderer/platform/p2p/filtering_network_manager.h +++ b/third_party/blink/renderer/platform/p2p/filtering_network_manager.h
@@ -20,9 +20,6 @@ namespace blink { -class FilteringNetworkManagerTest; -class IpcNetworkManager; - // FilteringNetworkManager exposes rtc::NetworkManager to // PeerConnectionDependencyFactory and wraps the IpcNetworkManager. It only // handles the case where multiple_routes is requested. It checks at least one @@ -39,10 +36,10 @@ class FilteringNetworkManager : public rtc::NetworkManagerBase, public sigslot::has_slots<> { public: - // This class is created by WebRTC's main thread but used by WebRTC's + // This class is created by WebRTC's signaling thread but used by WebRTC's // worker thread |task_runner|. PLATFORM_EXPORT FilteringNetworkManager( - IpcNetworkManager* network_manager, + rtc::NetworkManager* network_manager, media::MediaPermission* media_permission, bool allow_mdns_obfuscation); @@ -57,13 +54,6 @@ webrtc::MdnsResponderInterface* GetMdnsResponder() const override; private: - friend class FilteringNetworkManagerTest; - - PLATFORM_EXPORT FilteringNetworkManager( - base::WeakPtr<rtc::NetworkManager> network_manager_for_signaling_thread, - media::MediaPermission* media_permission, - bool allow_mdns_obfuscation); - // Check mic/camera permission. void CheckPermission(); @@ -92,14 +82,11 @@ void SendNetworksChangedSignal(); - // `network_manager_for_signaling_thread_` is owned by the - // `PeerConnectionDependencyFactory`, that may be destroyed when the frame is - // detached. - // TODO(crbug.com/1191914): Clarify the lifetime of - // `network_manager_for_signaling_thread_` and `this`. - base::WeakPtr<rtc::NetworkManager> network_manager_for_signaling_thread_; + // |network_manager_| is just a reference, owned by + // PeerConnectionDependencyFactory. + rtc::NetworkManager* network_manager_; - // The class is created by the main thread but used by the worker thread. + // The class is created by the signaling thread but used by the worker thread. THREAD_CHECKER(thread_checker_); media::MediaPermission* media_permission_;
diff --git a/third_party/blink/renderer/platform/p2p/filtering_network_manager_test.cc b/third_party/blink/renderer/platform/p2p/filtering_network_manager_test.cc index b254b1f..84d7b80 100644 --- a/third_party/blink/renderer/platform/p2p/filtering_network_manager_test.cc +++ b/third_party/blink/renderer/platform/p2p/filtering_network_manager_test.cc
@@ -12,7 +12,6 @@ #include "base/check.h" #include "base/memory/ref_counted.h" -#include "base/memory/weak_ptr.h" #include "base/notreached.h" #include "base/stl_util.h" #include "base/test/test_simple_task_runner.h" @@ -98,15 +97,10 @@ network_->AddIP(network_->GetBestIP()); } - base::WeakPtr<MockNetworkManager> AsWeakPtr() { - return weak_factory_.GetWeakPtr(); - } - private: bool sent_first_update_ = false; std::unique_ptr<rtc::Network> network_; std::unique_ptr<EmptyMdnsResponder> mdns_responder_; - base::WeakPtrFactory<MockNetworkManager> weak_factory_{this}; }; class MockMediaPermission : public media::MediaPermission { @@ -177,13 +171,13 @@ base_network_manager_ = std::make_unique<MockNetworkManager>(); SetNewNetworkForBaseNetworkManager(); if (multiple_routes_requested) { - network_manager_.reset(new FilteringNetworkManager( - base_network_manager_->AsWeakPtr(), media_permission_.get(), - allow_mdns_obfuscation_)); + network_manager_ = std::make_unique<FilteringNetworkManager>( + base_network_manager_.get(), media_permission_.get(), + allow_mdns_obfuscation_); network_manager_->Initialize(); } else { - network_manager_.reset(new EmptyNetworkManager( - base_network_manager_.get(), base_network_manager_->AsWeakPtr())); + network_manager_ = std::make_unique<blink::EmptyNetworkManager>( + base_network_manager_.get()); } network_manager_->SignalNetworksChanged.connect( this, &FilteringNetworkManagerTest::OnNetworksChanged);
diff --git a/third_party/blink/renderer/platform/p2p/host_address_request.cc b/third_party/blink/renderer/platform/p2p/host_address_request.cc index ec9ad2e..1e36c27 100644 --- a/third_party/blink/renderer/platform/p2p/host_address_request.cc +++ b/third_party/blink/renderer/platform/p2p/host_address_request.cc
@@ -29,7 +29,6 @@ DoneCallback done_callback) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_EQ(STATE_CREATED, state_); - DCHECK(dispatcher_); state_ = STATE_SENT; done_callback_ = std::move(done_callback); @@ -39,7 +38,6 @@ String(host_name.hostname().data()), enable_mdns, WTF::Bind(&P2PAsyncAddressResolver::OnResponse, scoped_refptr<P2PAsyncAddressResolver>(this))); - dispatcher_ = nullptr; } void P2PAsyncAddressResolver::Cancel() {
diff --git a/third_party/blink/renderer/platform/p2p/host_address_request.h b/third_party/blink/renderer/platform/p2p/host_address_request.h index 451ae176..9bb5ccf 100644 --- a/third_party/blink/renderer/platform/p2p/host_address_request.h +++ b/third_party/blink/renderer/platform/p2p/host_address_request.h
@@ -12,7 +12,6 @@ #include "base/memory/ref_counted.h" #include "base/threading/thread_checker.h" #include "net/base/ip_address.h" -#include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/webrtc/rtc_base/async_resolver_interface.h" @@ -21,8 +20,7 @@ class P2PSocketDispatcher; // P2PAsyncAddressResolver performs DNS hostname resolution. It's used -// to resolve addresses of STUN and relay servers. It is created and lives on -// one of libjingle's threads. +// to resolve addresses of STUN and relay servers. class P2PAsyncAddressResolver : public base::RefCountedThreadSafe<P2PAsyncAddressResolver> { public: @@ -49,10 +47,7 @@ void OnResponse(const Vector<net::IPAddress>& address); - // `P2PSocketDispatcher` is owned by the main thread, and must be accessed in - // a thread-safe way. Will be reset once `Start()` is called, so it doesn't - // prevent the dispatcher from being garbage-collected. - CrossThreadPersistent<P2PSocketDispatcher> dispatcher_; + P2PSocketDispatcher* dispatcher_; THREAD_CHECKER(thread_checker_); // State must be accessed from delegate thread only.
diff --git a/third_party/blink/renderer/platform/p2p/ipc_network_manager.cc b/third_party/blink/renderer/platform/p2p/ipc_network_manager.cc index 1c4228e7..451df84c 100644 --- a/third_party/blink/renderer/platform/p2p/ipc_network_manager.cc +++ b/third_party/blink/renderer/platform/p2p/ipc_network_manager.cc
@@ -9,7 +9,6 @@ #include <vector> #include "base/location.h" -#include "base/memory/weak_ptr.h" #include "base/metrics/histogram_macros.h" #include "base/single_thread_task_runner.h" #include "base/sys_byteorder.h" @@ -52,24 +51,15 @@ std::unique_ptr<webrtc::MdnsResponderInterface> mdns_responder) : network_list_manager_(network_list_manager), mdns_responder_(std::move(mdns_responder)) { - DETACH_FROM_THREAD(thread_checker_); network_list_manager->AddNetworkListObserver(this); } IpcNetworkManager::~IpcNetworkManager() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - auto network_list_manager = network_list_manager_.Lock(); - DCHECK(network_list_manager); - network_list_manager->RemoveNetworkListObserver(this); -} - -base::WeakPtr<IpcNetworkManager> -IpcNetworkManager::AsWeakPtrForSignalingThread() { - return weak_factory_.GetWeakPtr(); + DCHECK(!start_count_); + network_list_manager_->RemoveNetworkListObserver(this); } void IpcNetworkManager::StartUpdating() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (network_list_received_) { // Post a task to avoid reentrancy. base::ThreadTaskRunnerHandle::Get()->PostTask( @@ -83,7 +73,6 @@ } void IpcNetworkManager::StopUpdating() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_GT(start_count_, 0); --start_count_; } @@ -92,7 +81,6 @@ const net::NetworkInterfaceList& list, const net::IPAddress& default_ipv4_local_address, const net::IPAddress& default_ipv6_local_address) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // Update flag if network list received for the first time. if (!network_list_received_) { VLOG(1) << "IpcNetworkManager received network list from browser process " @@ -202,12 +190,10 @@ } webrtc::MdnsResponderInterface* IpcNetworkManager::GetMdnsResponder() const { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return mdns_responder_.get(); } void IpcNetworkManager::SendNetworksChangedSignal() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); SignalNetworksChanged(); }
diff --git a/third_party/blink/renderer/platform/p2p/ipc_network_manager.h b/third_party/blink/renderer/platform/p2p/ipc_network_manager.h index 0a87a830..8db0420 100644 --- a/third_party/blink/renderer/platform/p2p/ipc_network_manager.h +++ b/third_party/blink/renderer/platform/p2p/ipc_network_manager.h
@@ -8,7 +8,6 @@ #include <memory> #include "base/memory/weak_ptr.h" -#include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/p2p/network_list_manager.h" #include "third_party/blink/renderer/platform/p2p/network_list_observer.h" #include "third_party/blink/renderer/platform/platform_export.h" @@ -23,12 +22,6 @@ // IpcNetworkManager is a NetworkManager for libjingle that gets a // list of network interfaces from the browser. -// -// Threading note: -// The IpcNetworkManager is constructed on the network thread, and after that -// may only be accessed from the signaling thread. The one exception to that is -// access to slots (e.g., `NetworkManager::SignalNetworksChanged`) that are safe -// to access from any thread. class IpcNetworkManager : public rtc::NetworkManagerBase, public blink::NetworkListObserver { public: @@ -38,10 +31,6 @@ std::unique_ptr<webrtc::MdnsResponderInterface> mdns_responder); ~IpcNetworkManager() override; - // Weak pointers may only be dereferenced on the signaling thread. - base::WeakPtr<IpcNetworkManager> PLATFORM_EXPORT - AsWeakPtrForSignalingThread(); - // rtc:::NetworkManager: void StartUpdating() override; void StopUpdating() override; @@ -56,17 +45,13 @@ private: void SendNetworksChangedSignal(); - // 'this' is created on the network thread, whereas the `NetworkListManager` - // is owned by the main thread, so it needs to be accessed in a thread-safe - // manner. `this` is indirectly owned by `PeerConnectionDependencyFactory`, - // which also owns the network list manager, so this should be never be null. - CrossThreadWeakPersistent<NetworkListManager> network_list_manager_; + // TODO(crbug.com/787254): Consider moving NetworkListManager to Oilpan and + // avoid using a raw pointer. + blink::NetworkListManager* network_list_manager_; std::unique_ptr<webrtc::MdnsResponderInterface> mdns_responder_; int start_count_ = 0; bool network_list_received_ = false; - THREAD_CHECKER(thread_checker_); - base::WeakPtrFactory<IpcNetworkManager> weak_factory_{this}; };
diff --git a/third_party/blink/renderer/platform/p2p/ipc_network_manager_test.cc b/third_party/blink/renderer/platform/p2p/ipc_network_manager_test.cc index ea6d32d..5ce40f8 100644 --- a/third_party/blink/renderer/platform/p2p/ipc_network_manager_test.cc +++ b/third_party/blink/renderer/platform/p2p/ipc_network_manager_test.cc
@@ -19,9 +19,7 @@ namespace { -class MockP2PSocketDispatcher - : public GarbageCollected<MockP2PSocketDispatcher>, - public NetworkListManager { +class MockP2PSocketDispatcher : public blink::NetworkListManager { public: void AddNetworkListObserver( blink::NetworkListObserver* network_list_observer) override {} @@ -29,9 +27,7 @@ void RemoveNetworkListObserver( blink::NetworkListObserver* network_list_observer) override {} - void Trace(Visitor* visitor) const override { - NetworkListManager::Trace(visitor); - } + ~MockP2PSocketDispatcher() override {} }; class EmptyMdnsResponder : public webrtc::MdnsResponderInterface { @@ -54,13 +50,13 @@ class IpcNetworkManagerTest : public testing::Test { public: IpcNetworkManagerTest() - : network_list_manager_(MakeGarbageCollected<MockP2PSocketDispatcher>()), + : network_list_manager_(new MockP2PSocketDispatcher()), network_manager_(std::make_unique<IpcNetworkManager>( - network_list_manager_.Get(), + network_list_manager_.get(), std::make_unique<EmptyMdnsResponder>())) {} protected: - Persistent<MockP2PSocketDispatcher> network_list_manager_; + std::unique_ptr<MockP2PSocketDispatcher> network_list_manager_; std::unique_ptr<IpcNetworkManager> network_manager_; };
diff --git a/third_party/blink/renderer/platform/p2p/ipc_socket_factory.cc b/third_party/blink/renderer/platform/p2p/ipc_socket_factory.cc index 021d4e63..613abb3 100644 --- a/third_party/blink/renderer/platform/p2p/ipc_socket_factory.cc +++ b/third_party/blink/renderer/platform/p2p/ipc_socket_factory.cc
@@ -8,7 +8,6 @@ #include <algorithm> #include <list> -#include <memory> #include "base/compiler_specific.h" #include "base/logging.h" @@ -724,10 +723,8 @@ const rtc::SocketAddress& local_address, uint16_t min_port, uint16_t max_port) { - auto socket_dispatcher = socket_dispatcher_.Lock(); - DCHECK(socket_dispatcher); auto socket_client = std::make_unique<P2PSocketClientImpl>( - socket_dispatcher, traffic_annotation_); + socket_dispatcher_, traffic_annotation_); std::unique_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); if (!socket->Init(network::P2P_SOCKET_UDP, std::move(socket_client), local_address, min_port, max_port, rtc::SocketAddress())) { @@ -748,10 +745,8 @@ network::P2PSocketType type = (opts & rtc::PacketSocketFactory::OPT_STUN) ? network::P2P_SOCKET_STUN_TCP_SERVER : network::P2P_SOCKET_TCP_SERVER; - auto socket_dispatcher = socket_dispatcher_.Lock(); - DCHECK(socket_dispatcher); auto socket_client = std::make_unique<P2PSocketClientImpl>( - socket_dispatcher, traffic_annotation_); + socket_dispatcher_, traffic_annotation_); std::unique_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); if (!socket->Init(type, std::move(socket_client), local_address, min_port, max_port, rtc::SocketAddress())) { @@ -784,10 +779,8 @@ ? network::P2P_SOCKET_STUN_TCP_CLIENT : network::P2P_SOCKET_TCP_CLIENT; } - auto socket_dispatcher = socket_dispatcher_.Lock(); - DCHECK(socket_dispatcher); auto socket_client = std::make_unique<P2PSocketClientImpl>( - socket_dispatcher, traffic_annotation_); + socket_dispatcher_, traffic_annotation_); std::unique_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); if (!socket->Init(type, std::move(socket_client), local_address, 0, 0, remote_address)) @@ -796,9 +789,9 @@ } rtc::AsyncResolverInterface* IpcPacketSocketFactory::CreateAsyncResolver() { - auto socket_dispatcher = socket_dispatcher_.Lock(); - DCHECK(socket_dispatcher); - return new AsyncAddressResolverImpl(socket_dispatcher); + std::unique_ptr<AsyncAddressResolverImpl> resolver( + new AsyncAddressResolverImpl(socket_dispatcher_)); + return resolver.release(); } } // namespace blink
diff --git a/third_party/blink/renderer/platform/p2p/ipc_socket_factory.h b/third_party/blink/renderer/platform/p2p/ipc_socket_factory.h index 62bc47e..21a0a25 100644 --- a/third_party/blink/renderer/platform/p2p/ipc_socket_factory.h +++ b/third_party/blink/renderer/platform/p2p/ipc_socket_factory.h
@@ -10,7 +10,6 @@ #include "base/compiler_specific.h" #include "base/macros.h" #include "net/traffic_annotation/network_traffic_annotation.h" -#include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/webrtc/api/packet_socket_factory.h" @@ -20,7 +19,7 @@ // IpcPacketSocketFactory implements rtc::PacketSocketFactory // interface for libjingle using IPC-based P2P sockets. The class must -// be created and used on a thread that is a libjingle thread (implements +// be used on a thread that is a libjingle thread (implements // rtc::Thread) and also has associated base::MessageLoop. Each // socket created by the factory must be used on the thread it was // created on. @@ -49,12 +48,7 @@ rtc::AsyncResolverInterface* CreateAsyncResolver() override; private: - // `P2PSocketDispatcher` is owned by the main thread, and must be accessed in - // a thread-safe way. `this` is indirectly owned by - // `PeerConnectionDependencyFactory`, which holds a hard reference to the - // dispatcher, so this should be never be null (with the possible exception of - // the dtor). - CrossThreadWeakPersistent<P2PSocketDispatcher> socket_dispatcher_; + P2PSocketDispatcher* socket_dispatcher_; const net::NetworkTrafficAnnotationTag traffic_annotation_; DISALLOW_COPY_AND_ASSIGN(IpcPacketSocketFactory);
diff --git a/third_party/blink/renderer/platform/p2p/network_list_manager.h b/third_party/blink/renderer/platform/p2p/network_list_manager.h index 9a197eb8..0be11c05 100644 --- a/third_party/blink/renderer/platform/p2p/network_list_manager.h +++ b/third_party/blink/renderer/platform/p2p/network_list_manager.h
@@ -9,7 +9,6 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_P2P_NETWORK_LIST_MANAGER_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_P2P_NETWORK_LIST_MANAGER_H_ -#include "third_party/blink/renderer/platform/heap/garbage_collected.h" #include "third_party/blink/renderer/platform/platform_export.h" namespace blink { @@ -18,7 +17,7 @@ // TODO(crbug.com/787254): Verify whether this abstract class is still // needed now that its Clients have all switched to Blink. -class PLATFORM_EXPORT NetworkListManager : public GarbageCollectedMixin { +class PLATFORM_EXPORT NetworkListManager { public: // Add a new network list observer. Each observer is called // immidiately after it is registered and then later whenever @@ -31,6 +30,11 @@ // which the observer was added. virtual void RemoveNetworkListObserver( NetworkListObserver* network_list_observer) = 0; + + protected: + // Marked as protected to prevent explicit deletion, as + // P2PSocketDispatcher is not owned by IpcNetworkManager. + virtual ~NetworkListManager() {} }; } // namespace blink
diff --git a/third_party/blink/renderer/platform/p2p/socket_client_impl.cc b/third_party/blink/renderer/platform/p2p/socket_client_impl.cc index 2654f76..eb40597 100644 --- a/third_party/blink/renderer/platform/p2p/socket_client_impl.cc +++ b/third_party/blink/renderer/platform/p2p/socket_client_impl.cc
@@ -56,9 +56,7 @@ DCHECK_EQ(state_, STATE_UNINITIALIZED); state_ = STATE_OPENING; - auto dispatcher = dispatcher_.Lock(); - CHECK(dispatcher); - dispatcher->GetP2PSocketManager()->CreateSocket( + dispatcher_->GetP2PSocketManager()->CreateSocket( type, local_address, network::P2PPortRange(min_port, max_port), remote_address, receiver_.BindNewPipeAndPassRemote(), socket_.BindNewPipeAndPassReceiver()); @@ -139,10 +137,8 @@ client_receiver) { DCHECK_EQ(state_, STATE_OPEN); - auto dispatcher = dispatcher_.Lock(); - CHECK(dispatcher); auto new_client = - std::make_unique<P2PSocketClientImpl>(dispatcher, traffic_annotation_); + std::make_unique<P2PSocketClientImpl>(dispatcher_, traffic_annotation_); new_client->state_ = STATE_OPEN; new_client->socket_.Bind(std::move(socket));
diff --git a/third_party/blink/renderer/platform/p2p/socket_client_impl.h b/third_party/blink/renderer/platform/p2p/socket_client_impl.h index a981931f4..a04db9a 100644 --- a/third_party/blink/renderer/platform/p2p/socket_client_impl.h +++ b/third_party/blink/renderer/platform/p2p/socket_client_impl.h
@@ -18,7 +18,6 @@ #include "net/traffic_annotation/network_traffic_annotation.h" #include "services/network/public/cpp/p2p_socket_type.h" #include "services/network/public/mojom/p2p.mojom-blink.h" -#include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/p2p/socket_client.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -32,7 +31,7 @@ // P2P socket that routes all calls over Mojo. // -// The object is created and runs on the WebRTC worker thread. +// The object runs on the WebRTC worker thread. class P2PSocketClientImpl : public blink::P2PSocketClient, public network::mojom::blink::P2PSocketClient { public: @@ -101,9 +100,7 @@ void OnConnectionError(); - // `P2PSocketDispatcher` is owned by the main thread, and must be accessed in - // a thread-safe way. - CrossThreadWeakPersistent<P2PSocketDispatcher> dispatcher_; + P2PSocketDispatcher* dispatcher_; THREAD_CHECKER(thread_checker_); int socket_id_; blink::P2PSocketClientDelegate* delegate_;
diff --git a/third_party/blink/renderer/platform/p2p/socket_dispatcher.cc b/third_party/blink/renderer/platform/p2p/socket_dispatcher.cc index bec6d355..72ec477 100644 --- a/third_party/blink/renderer/platform/p2p/socket_dispatcher.cc +++ b/third_party/blink/renderer/platform/p2p/socket_dispatcher.cc
@@ -5,44 +5,22 @@ #include "third_party/blink/renderer/platform/p2p/socket_dispatcher.h" #include "base/memory/scoped_refptr.h" -#include "base/types/pass_key.h" #include "services/network/public/cpp/p2p_param_traits.h" -#include "third_party/blink/public/common/browser_interface_broker_proxy.h" +#include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/heap/heap.h" -#include "third_party/blink/renderer/platform/heap/persistent.h" -#include "third_party/blink/renderer/platform/mojo/mojo_binding_context.h" #include "third_party/blink/renderer/platform/p2p/network_list_observer.h" #include "third_party/blink/renderer/platform/p2p/socket_client_impl.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" -#include "third_party/blink/renderer/platform/supplementable.h" #include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink { -using PassKey = base::PassKey<P2PSocketDispatcher>; - -const char P2PSocketDispatcher::kSupplementName[] = "P2PSocketDispatcher"; - -// static -P2PSocketDispatcher& P2PSocketDispatcher::From(MojoBindingContext& context) { - auto* supplement = - Supplement<MojoBindingContext>::From<P2PSocketDispatcher>(context); - if (!supplement) { - supplement = MakeGarbageCollected<P2PSocketDispatcher>(context, PassKey()); - ProvideTo(context, supplement); - } - return *supplement; -} - -P2PSocketDispatcher::P2PSocketDispatcher(MojoBindingContext& context, PassKey) - : Supplement(context), - main_task_runner_(base::ThreadTaskRunnerHandle::Get()), +P2PSocketDispatcher::P2PSocketDispatcher() + : main_task_runner_(base::ThreadTaskRunnerHandle::Get()), network_list_observers_( - new base::ObserverListThreadSafe<blink::NetworkListObserver>()), - network_notification_client_receiver_(this, &context) {} + new base::ObserverListThreadSafe<blink::NetworkListObserver>()) {} -P2PSocketDispatcher::~P2PSocketDispatcher() = default; +P2PSocketDispatcher::~P2PSocketDispatcher() {} void P2PSocketDispatcher::AddNetworkListObserver( blink::NetworkListObserver* network_list_observer) { @@ -50,7 +28,7 @@ PostCrossThreadTask( *main_task_runner_.get(), FROM_HERE, CrossThreadBindOnce(&P2PSocketDispatcher::RequestNetworkEventsIfNecessary, - WrapCrossThreadWeakPersistent(this))); + scoped_refptr<P2PSocketDispatcher>(this))); } void P2PSocketDispatcher::RemoveNetworkListObserver( @@ -70,16 +48,14 @@ mojo::SharedRemote<network::mojom::blink::P2PSocketManager>( std::move(p2p_socket_manager)); p2p_socket_manager_.set_disconnect_handler( - ConvertToBaseOnceCallback( - CrossThreadBindOnce(&P2PSocketDispatcher::OnConnectionError, - WrapCrossThreadWeakPersistent(this))), + WTF::Bind(&P2PSocketDispatcher::OnConnectionError, + WTF::Unretained(this)), main_task_runner_); } - PostCrossThreadTask( *main_task_runner_.get(), FROM_HERE, CrossThreadBindOnce(&P2PSocketDispatcher::RequestInterfaceIfNecessary, - WrapCrossThreadWeakPersistent(this))); + scoped_refptr<P2PSocketDispatcher>(this))); return p2p_socket_manager_; } @@ -105,11 +81,10 @@ } void P2PSocketDispatcher::RequestInterfaceIfNecessary() { - DCHECK(main_task_runner_->BelongsToCurrentThread()); if (!p2p_socket_manager_receiver_.is_valid()) return; - GetSupplementable()->GetBrowserInterfaceBroker().GetInterface( + blink::Platform::Current()->GetBrowserInterfaceBroker()->GetInterface( std::move(p2p_socket_manager_receiver_)); } @@ -128,8 +103,7 @@ default_ipv6_local_address_); } else { GetP2PSocketManager()->StartNetworkNotifications( - network_notification_client_receiver_.BindNewPipeAndPassRemote( - GetSupplementable()->GetTaskRunner(TaskType::kMiscPlatformAPI))); + network_notification_client_receiver_.BindNewPipeAndPassRemote()); } } @@ -141,20 +115,13 @@ PostCrossThreadTask( *main_task_runner_.get(), FROM_HERE, CrossThreadBindOnce(&P2PSocketDispatcher::ReconnectP2PSocketManager, - WrapCrossThreadWeakPersistent(this))); + scoped_refptr<P2PSocketDispatcher>(this))); } void P2PSocketDispatcher::ReconnectP2PSocketManager() { network_notification_client_receiver_.reset(); GetP2PSocketManager()->StartNetworkNotifications( - network_notification_client_receiver_.BindNewPipeAndPassRemote( - GetSupplementable()->GetTaskRunner(TaskType::kNetworking))); -} - -void P2PSocketDispatcher::Trace(Visitor* visitor) const { - Supplement::Trace(visitor); - NetworkListManager::Trace(visitor); - visitor->Trace(network_notification_client_receiver_); + network_notification_client_receiver_.BindNewPipeAndPassRemote()); } } // namespace blink
diff --git a/third_party/blink/renderer/platform/p2p/socket_dispatcher.h b/third_party/blink/renderer/platform/p2p/socket_dispatcher.h index a178b03b..b3e97396 100644 --- a/third_party/blink/renderer/platform/p2p/socket_dispatcher.h +++ b/third_party/blink/renderer/platform/p2p/socket_dispatcher.h
@@ -28,7 +28,6 @@ #include "base/memory/ref_counted.h" #include "base/observer_list_threadsafe.h" #include "base/synchronization/lock.h" -#include "base/types/pass_key.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/shared_remote.h" @@ -36,12 +35,8 @@ #include "net/base/network_interfaces.h" #include "services/network/public/cpp/p2p_socket_type.h" #include "services/network/public/mojom/p2p.mojom-blink.h" -#include "third_party/blink/renderer/platform/heap/garbage_collected.h" -#include "third_party/blink/renderer/platform/mojo/heap_mojo_receiver.h" -#include "third_party/blink/renderer/platform/mojo/mojo_binding_context.h" #include "third_party/blink/renderer/platform/p2p/network_list_manager.h" #include "third_party/blink/renderer/platform/platform_export.h" -#include "third_party/blink/renderer/platform/supplementable.h" #include "third_party/blink/renderer/platform/wtf/vector.h" namespace base { @@ -50,22 +45,18 @@ namespace blink { class NetworkListObserver; +} + +namespace blink { // This class is created on the main thread, but is used primarily on the // WebRTC worker threads. class PLATFORM_EXPORT P2PSocketDispatcher - : public GarbageCollected<P2PSocketDispatcher>, - public Supplement<MojoBindingContext>, + : public base::RefCountedThreadSafe<P2PSocketDispatcher>, public blink::NetworkListManager, public network::mojom::blink::P2PNetworkNotificationClient { public: - static const char kSupplementName[]; - - static P2PSocketDispatcher& From(MojoBindingContext& context); - - P2PSocketDispatcher(MojoBindingContext& context, - base::PassKey<P2PSocketDispatcher>); - ~P2PSocketDispatcher() override; + P2PSocketDispatcher(); // blink::NetworkListManager interface: void AddNetworkListObserver( @@ -76,9 +67,11 @@ mojo::SharedRemote<network::mojom::blink::P2PSocketManager> GetP2PSocketManager(); - void Trace(Visitor*) const override; - private: + friend class base::RefCountedThreadSafe<P2PSocketDispatcher>; + + ~P2PSocketDispatcher() override; + // network::mojom::blink::P2PNetworkNotificationClient interface. void NetworkListChanged( const Vector<net::NetworkInterface>& networks, @@ -109,9 +102,8 @@ net::IPAddress default_ipv4_local_address_; net::IPAddress default_ipv6_local_address_; - HeapMojoReceiver<network::mojom::blink::P2PNetworkNotificationClient, - P2PSocketDispatcher> - network_notification_client_receiver_; + mojo::Receiver<network::mojom::blink::P2PNetworkNotificationClient> + network_notification_client_receiver_{this}; DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcher); };
diff --git a/third_party/blink/renderer/platform/scheduler/BUILD.gn b/third_party/blink/renderer/platform/scheduler/BUILD.gn index fd501f1a..9b65415 100644 --- a/third_party/blink/renderer/platform/scheduler/BUILD.gn +++ b/third_party/blink/renderer/platform/scheduler/BUILD.gn
@@ -240,6 +240,7 @@ "main_thread/frame_task_queue_controller_unittest.cc", "main_thread/idle_time_estimator_unittest.cc", "main_thread/main_thread_metrics_helper_unittest.cc", + "main_thread/main_thread_perftest.cc", "main_thread/main_thread_scheduler_impl_unittest.cc", "main_thread/main_thread_unittest.cc", "main_thread/memory_purge_manager_unittest.cc",
diff --git a/third_party/blink/renderer/platform/scheduler/DEPS b/third_party/blink/renderer/platform/scheduler/DEPS index 94505c5f..5bc12c5 100644 --- a/third_party/blink/renderer/platform/scheduler/DEPS +++ b/third_party/blink/renderer/platform/scheduler/DEPS
@@ -8,6 +8,7 @@ # Dependencies. "+base/atomic_sequence_num.h", "+base/atomicops.h", + "+base/barrier_closure.h", "+base/callback_helpers.h", "+base/cancelable_callback.h", "+base/command_line.h",
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc index 0559e51..a976b52 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc
@@ -430,6 +430,7 @@ case TaskType::kSensor: case TaskType::kPerformanceTimeline: case TaskType::kWebGL: + case TaskType::kWebGPU: case TaskType::kIdleTask: case TaskType::kInternalDefault: case TaskType::kMiscPlatformAPI:
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl_unittest.cc b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl_unittest.cc index 12c39c5..4ef6fad 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl_unittest.cc
@@ -148,10 +148,11 @@ TaskType::kInternalNavigationAssociatedUnfreezable, TaskType::kInternalHighPriorityLocalFrame, TaskType::kInternalInputBlocking, - TaskType::kWakeLock}; + TaskType::kWakeLock, + TaskType::kWebGPU}; static_assert( - static_cast<int>(TaskType::kCount) == 78, + static_cast<int>(TaskType::kCount) == 79, "When adding a TaskType, make sure that kAllFrameTaskTypes is updated."); void AppendToVectorTestTask(Vector<String>* vector, String value) {
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_perftest.cc b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_perftest.cc new file mode 100644 index 0000000..23d35949 --- /dev/null +++ b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_perftest.cc
@@ -0,0 +1,90 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/barrier_closure.h" +#include "base/run_loop.h" +#include "base/time/time.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "testing/perf/perf_result_reporter.h" +#include "third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.h" +#include "third_party/blink/renderer/platform/testing/scoped_scheduler_overrider.h" + +// Too slow with TSAN. +#if !defined(THREAD_SANITIZER) + +namespace blink { +namespace scheduler { +namespace { + +constexpr char kMetricPrefix[] = "MainThreadSchedulerPerfTest."; +// Includes time to |PostTask()|. +constexpr char kTimePerTask[] = "time_per_task"; +// Time to |PostTask()|. +constexpr char kTimePerPostTask[] = "time_per_post_task"; +// |time_per_task| - |time_per_post_task|. +constexpr char kTimePerTaskRun[] = "time_per_task_run"; + +class MainThreadPerfTest : public testing::Test { + public: + MainThreadPerfTest() = default; + ~MainThreadPerfTest() override = default; + + void SetUp() override { + scheduler_ = std::make_unique<MainThreadSchedulerImpl>( + base::sequence_manager::CreateSequenceManagerOnCurrentThreadWithPump( + base::MessagePump::Create(base::MessagePumpType::DEFAULT), + base::sequence_manager::SequenceManager::Settings::Builder() + .Build()), + base::nullopt); + scheduler_overrider_ = + std::make_unique<ScopedSchedulerOverrider>(scheduler_.get()); + } + + void TearDown() override { scheduler_->Shutdown(); } + + protected: + std::unique_ptr<MainThreadSchedulerImpl> scheduler_; + std::unique_ptr<ScopedSchedulerOverrider> scheduler_overrider_; + + DISALLOW_COPY_AND_ASSIGN(MainThreadPerfTest); +}; + +TEST_F(MainThreadPerfTest, PostTaskPerformance) { + const int kTaskCount = 1000000; + base::RunLoop run_loop; + auto counter_closure = + base::BarrierClosure(kTaskCount, run_loop.QuitClosure()); + + base::TimeTicks before = base::TimeTicks::Now(); + for (int i = 0; i < kTaskCount; i++) { + scheduler_->DefaultTaskRunner()->PostTask(FROM_HERE, counter_closure); + } + base::TimeTicks after_post_task = base::TimeTicks::Now(); + run_loop.Run(); + base::TimeTicks after = base::TimeTicks::Now(); + + perf_test::PerfResultReporter reporter(kMetricPrefix, + "main_thread_post_task"); + reporter.RegisterImportantMetric(kTimePerPostTask, "ns/iteration"); + reporter.RegisterImportantMetric(kTimePerTask, "ns/iteration"); + reporter.RegisterImportantMetric(kTimePerTaskRun, "ns/iteration"); + + size_t ns_per_post_task = static_cast<size_t>( + (after_post_task - before).InNanoseconds() / kTaskCount); + reporter.AddResult(kTimePerPostTask, ns_per_post_task); + + size_t ns_per_iteration = + static_cast<size_t>((after - before).InNanoseconds() / kTaskCount); + reporter.AddResult(kTimePerTask, ns_per_iteration); + + size_t ns_per_task_iteration = static_cast<size_t>( + (after - after_post_task).InNanoseconds() / kTaskCount); + reporter.AddResult(kTimePerTaskRun, ns_per_task_iteration); +} + +} // namespace +} // namespace scheduler +} // namespace blink + +#endif // defined(THREAD_SANITIZER)
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/task_type_names.cc b/third_party/blink/renderer/platform/scheduler/main_thread/task_type_names.cc index 2e1d31f..b0565ab 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/task_type_names.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/task_type_names.cc
@@ -149,6 +149,8 @@ return "MainThreadTaskQueueIPCTracking"; case TaskType::kWakeLock: return "WakeLock"; + case TaskType::kWebGPU: + return "WebGPU"; case TaskType::kCount: return "Count"; }
diff --git a/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler.cc b/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler.cc index 2c8e0703..c55346e9 100644 --- a/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler.cc +++ b/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler.cc
@@ -160,6 +160,7 @@ case TaskType::kSensor: case TaskType::kPerformanceTimeline: case TaskType::kWebGL: + case TaskType::kWebGPU: case TaskType::kIdleTask: case TaskType::kMiscPlatformAPI: case TaskType::kFontLoading:
diff --git a/third_party/blink/web_tests/FlagExpectations/force-renderer-accessibility b/third_party/blink/web_tests/FlagExpectations/force-renderer-accessibility index 7f326f41..eb8c9d5 100644 --- a/third_party/blink/web_tests/FlagExpectations/force-renderer-accessibility +++ b/third_party/blink/web_tests/FlagExpectations/force-renderer-accessibility
@@ -164,7 +164,8 @@ virtual/layout_ng_block_frag/fast/multicol/caret-range-anonymous-block-rtl.html [ Crash ] virtual/layout_ng_block_frag/fast/multicol/caret-range-anonymous-block.html [ Crash ] virtual/layout_ng_block_frag/fast/multicol/caret-range-outside-columns-rtl.html [ Crash ] -virtual/layout_ng_block_frag/fast/multicol/caret-range-outside-columns.html [ Crash ] +virtual/layout_ng_block_frag/fast/multicol/caret-range-outside-columns-mac.html [ Crash ] +virtual/layout_ng_block_frag/fast/multicol/caret-range-outside-columns-win.html [ Crash ] virtual/layout_ng_block_frag/fast/multicol/change-column-rule.html [ Crash ] virtual/layout_ng_block_frag/fast/multicol/client-rects-rtl.html [ Crash ] virtual/layout_ng_block_frag/fast/multicol/client-rects.html [ Crash ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 2f01175..e5efb2e 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -1102,7 +1102,6 @@ crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/float-margin-at-row-boundary-fixed-multicol-height.html [ Failure ] crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/forced-break-in-nested-columns.html [ Failure ] crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/forced-break-too-short-column.html [ Failure ] -crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/hit-test-above-or-below.html [ Failure ] crbug.com/1066629 virtual/layout_ng_block_frag/fast/multicol/hit-test-translate-z.html [ Failure ] crbug.com/829181 virtual/layout_ng_block_frag/fast/multicol/infinitely-tall-content-in-outer-crash.html [ Skip ] crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/insane-column-count-and-padding-nested-crash.html [ Skip ] @@ -2518,6 +2517,11 @@ crbug.com/958381 [ Mac ] external/wpt/css/CSS2/tables/table-anonymous-objects-206.xht [ Failure ] # ====== New tests from wpt-importer added here ====== +crbug.com/626703 [ Mac10.15 ] external/wpt/webrtc-encoded-transform/idlharness.https.window.html [ Failure Crash ] +crbug.com/626703 [ Mac11.0 ] external/wpt/webrtc-encoded-transform/idlharness.https.window.html [ Failure Crash ] +crbug.com/626703 [ Mac10.13 ] external/wpt/html/syntax/xmldecl/xmldecl-3.html [ Timeout ] +crbug.com/626703 [ Mac10.14 ] external/wpt/html/syntax/xmldecl/xmldecl-3.html [ Timeout ] +crbug.com/626703 [ Mac11.0 ] external/wpt/html/syntax/xmldecl/xmldecl-3.html [ Timeout ] crbug.com/626703 external/wpt/css/css-will-change/will-change-stacking-context-mask-1.html [ Failure ] crbug.com/626703 external/wpt/css/css-will-change/will-change-fixpos-cb-transform-style-1.html [ Failure ] crbug.com/626703 external/wpt/css/css-will-change/will-change-fixpos-cb-contain-1.html [ Failure ] @@ -4018,7 +4022,9 @@ crbug.com/759665 external/wpt/css/css-grid/animation/grid-template-rows-001.html [ Failure ] crbug.com/1045599 external/wpt/css/css-grid/layout-algorithm/flex-sizing-rows-indefinite-height.html [ Failure ] crbug.com/1045599 external/wpt/css/css-grid/layout-algorithm/grid-content-distribution-must-account-for-track-sizing-002.html [ Failure ] +crbug.com/935102 external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-001.html [ Failure ] crbug.com/935102 external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-002.html [ Failure ] +crbug.com/935102 external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-003.html [ Failure ] crbug.com/707359 [ Mac ] external/wpt/css/css-grid/alignment/self-baseline/grid-self-baseline-003.html [ Failure ] crbug.com/1102918 external/wpt/css/css-grid/grid-definition/grid-auto-fill-columns-001.html [ Failure ] crbug.com/1102918 external/wpt/css/css-grid/grid-definition/grid-auto-fill-rows-001.html [ Failure ] @@ -4134,7 +4140,9 @@ virtual/layout-ng-grid/external/wpt/css/css-grid/grid-model/grid-overflow-padding-002.html [ Pass ] virtual/layout-ng-grid/external/wpt/css/css-grid/layout-algorithm/flex-sizing-rows-indefinite-height.html [ Pass ] virtual/layout-ng-grid/external/wpt/css/css-grid/layout-algorithm/grid-content-distribution-must-account-for-track-sizing-002.html [ Pass ] +virtual/layout-ng-grid/external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-001.html [ Pass ] virtual/layout-ng-grid/external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-002.html [ Pass ] +virtual/layout-ng-grid/external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-003.html [ Pass ] virtual/layout-ng-grid/fast/css-grid-layout/maximize-tracks-definite-indefinite-height.html [ Pass ] ### Tests failing with LayoutNGGrid enabled: @@ -4160,8 +4168,6 @@ crbug.com/1045599 virtual/layout-ng-grid/external/wpt/css/css-grid/alignment/grid-self-baseline-not-applied-if-sizing-cyclic-dependency-002.html [ Failure ] crbug.com/1045599 virtual/layout-ng-grid/external/wpt/css/css-grid/alignment/grid-self-baseline-not-applied-if-sizing-cyclic-dependency-003.html [ Failure ] crbug.com/1045599 virtual/layout-ng-grid/external/wpt/css/css-grid/layout-algorithm/grid-as-flex-item-should-not-shrink-to-fit-007.html [ Failure ] -crbug.com/1045599 virtual/layout-ng-grid/external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-001.html [ Failure ] -crbug.com/1045599 virtual/layout-ng-grid/external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-003.html [ Failure ] crbug.com/1045599 virtual/layout-ng-grid/external/wpt/css/css-grid/layout-algorithm/grid-intrinsic-size-with-orthogonal-items.html [ Failure ] crbug.com/1045599 virtual/layout-ng-grid/external/wpt/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim-vertical-lr.html [ Failure ] crbug.com/1045599 virtual/layout-ng-grid/external/wpt/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim-vertical-rl.html [ Failure ] @@ -4235,17 +4241,8 @@ crbug.com/1179585 virtual/layout_ng_svg_text/external/wpt/svg/text/scripted/textpath-textlength-text-anchor-001.tentative.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/external/wpt/svg/types/scripted/SVGAnimatedEnumeration-SVGFEMorphologyElement.html [ Pass Crash ] crbug.com/1179585 virtual/layout_ng_svg_text/external/wpt/svg/types/scripted/SVGAnimatedEnumeration-SVGMaskElement.html [ Pass Crash ] -crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html.xhtml [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/animated-svg-as-image.html [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/animated-svg-as-image-same-image.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/ems-display-none.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/exs-display-none.svg [ Failure ] -crbug.com/1179585 [ Mac ] virtual/layout_ng_svg_text/paint/invalidation/svg/filter-repaint.svg [ Failure ] -crbug.com/1179585 [ Mac ] virtual/layout_ng_svg_text/paint/invalidation/svg/filter-width-update.svg [ Failure Crash ] -crbug.com/1179585 [ Mac ] virtual/layout_ng_svg_text/paint/invalidation/svg/hit-test-unclosed-subpaths.svg [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/inner-svg-change-viewPort-relative.svg [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/js-late-clipPath-and-object-creation.svg [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/js-late-clipPath-creation.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/js-late-gradient-and-object-creation.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/js-late-gradient-creation.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/js-late-pattern-and-object-creation.svg [ Failure ] @@ -4254,27 +4251,19 @@ crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/outline-offset-text.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/repaint-non-scaling-stroke-text.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/repaint-non-scaling-stroke-text-decoration.html [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/tabgroup.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/text-mask-update.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/text-match-svg.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/text-pattern-update.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/text-pattern-update-2.html [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/text-repaint-including-stroke.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/text-rescale.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/text-selection-text-05-t.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/text-selection-update.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/text-viewbox-rescale.html [ Failure ] -crbug.com/1179585 [ Mac ] virtual/layout_ng_svg_text/paint/invalidation/svg/text-xy-updates-SVGList.xhtml [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/transform-text-element.html [ Pass Failure ] crbug.com/1179585 [ Mac ] virtual/layout_ng_svg_text/paint/invalidation/svg/tspan-dynamic-positioning.svg [ Failure Crash ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/use-detach.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/use-event-handler-on-use-element.svg [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/window.svg [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/paint/invalidation/svg/zoom-coords-viewattr-01-b.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/animations/animate-text-nested-transforms.html [ Timeout ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-1.html [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-5.html [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-6.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/batik/paints/patternRegions.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/batik/paints/patternRegions-positioned-objects.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/batik/text/longTextOnPath.svg [ Failure ] @@ -4298,7 +4287,6 @@ crbug.com/1179585 virtual/layout_ng_svg_text/svg/batik/text/verticalText.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/batik/text/verticalTextOnPath.svg [ Failure Crash ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/batik/text/xmlSpace.svg [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/clip-path/clip-path-pixelation.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/clip-path/clip-path-text.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/clip-path/clip-path-text-and-shape.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/clip-path/clip-path-text-and-stroke.svg [ Failure ] @@ -4306,7 +4294,6 @@ crbug.com/1179585 virtual/layout_ng_svg_text/svg/clip-path/clip-path-use-referencing-clipped-text.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/clip-path/clip-path-use-referencing-text.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/clip-path/clip-path-with-text-clipped.svg [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/clip-path/deep-nested-clip-in-mask-panning.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/css/text-gradient-shadow.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/css/text-shadow-multiple.xhtml [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/custom/acid3-test-77.html [ Failure ] @@ -4350,29 +4337,12 @@ crbug.com/1179585 virtual/layout_ng_svg_text/svg/custom/zoomed-mixed-scripts.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/dom/references-in-shadow-trees.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/dom/undefined-null.html [ Pass Crash ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-dom-in-attr.html [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-dom-operator-attr.html [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-dom-radius-attr.html [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-svgdom-in-prop.html [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-svgdom-operator-prop.html [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-svgdom-radius-call.html [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-dx-attr.html [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-dy-attr.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-lengthAdjust-attr.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-textLength-attr.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-transform-attr.html [ Pass Failure ] -crbug.com/1179585 [ Mac ] virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-x-attr.html [ Failure ] -crbug.com/1179585 [ Mac ] virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-y-attr.html [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-dx-prop.html [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-dy-prop.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-lengthAdjust-prop.html [ Failure ] -crbug.com/1179585 [ Mac ] virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-rotate-prop.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-textLength-prop.html [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-transform-prop.html [ Pass Failure ] -crbug.com/1179585 [ Mac ] virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-x-prop.html [ Failure ] -crbug.com/1179585 [ Mac ] virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-y-prop.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/filters/feComponentTransfer-style-crash.xhtml [ Pass ] -crbug.com/1179585 [ Mac ] virtual/layout_ng_svg_text/svg/filters/feComposite.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/filters/feDisplacementMap.svg [ Pass Timeout ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/filters/filter-on-filter-for-text.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/filters/filter-on-tspan.svg [ Failure ] @@ -4590,13 +4560,6 @@ crbug.com/1179585 virtual/layout_ng_svg_text/svg/W3C-SVG-1.1-SE/struct-use-14-f.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/W3C-SVG-1.1-SE/svgdom-over-01-f.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/W3C-SVG-1.1-SE/text-tspan-02-b.svg [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/wicd/test-rightsizing-a.xhtml [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/wicd/test-rightsizing-b.xhtml [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/wicd/test-scalable-background-image2.xhtml [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/zoom/page/zoom-coords-viewattr-01-b.svg [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/zoom/page/zoom-mask-with-percentages.svg [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/zoom/page/zoom-svg-through-object-with-absolute-size.xhtml [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2.xhtml [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/zoom/page/zoom-zoom-coords.xhtml [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/zoom/text/lowdpi-zoom-text.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/zoom/zoomed-text-in-clippath.html [ Failure ]
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 e43aa664..2fc429bf 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
@@ -1498,6 +1498,13 @@ {} ] ], + "chrome-bug-1205852.html": [ + "2048b57bc070b8f7a085b2c4a4b9c9f9e2ef3d60", + [ + null, + {} + ] + ], "firefox-bug-1688293.html": [ "9ab1a88312683a66798cb52693c2ba4389222ff4", [ @@ -184852,6 +184859,10 @@ "ebf84dd43fe17d345f7db7cd736470d403ff6c99", [] ], + "enumerateDevices-with-selectAudioOutput.https-expected.txt": [ + "c46f9ed094ed5fa0d39008486fcf57f08e96b3c9", + [] + ], "idlharness.https.window-expected.txt": [ "4a3b092593547bdd8b4d14b148faf07a0634e03d", [] @@ -185761,7 +185772,7 @@ [] ], "font.py": [ - "ba5f939ff32c48ad95bc05b3010e68214bce777a", + "7900079cdf32747ee591880bae0317ca36a8f03e", [] ], "image.py": [ @@ -196092,7 +196103,7 @@ [] ], "t421-rgb-values-meaning-b-ref.html": [ - "b468f0eb9888c6e88ff00feb8f01955ac28ff090", + "b824200a06bcd4c27b05e19ae9da12ff96176a0b", [] ], "t422-rgba-a1.0-a-ref.html": [ @@ -228461,7 +228472,7 @@ [] ], "wpt_lint_rules.py": [ - "b9997372520f3670a1047d3020ed2475f3f09098", + "01f965edfd370927cda0e110af05babda7aa30fa", [] ], "writing-tests": { @@ -239794,7 +239805,7 @@ [] ], "idlharness.https_exclude=(Document_Window_HTML._)-expected.txt": [ - "35a7816f95a1710ecbbf0a7f11a010aff57b8e90", + "f3fcb35cdd0d809fa6a87207b0c4d024af64a724", [] ], "idlharness.https_include=(Document_Window)-expected.txt": [ @@ -239806,7 +239817,7 @@ [] ], "idlharness.worker-expected.txt": [ - "572fc473097c45c3b2921640971dfdb1d567aa0b", + "260003cb59a7f9a54d93396062bb2c7119895b7f", [] ], "new-harness.js": [ @@ -245816,7 +245827,7 @@ [] ], "404-response-with-actual-image-data.py": [ - "f7c99fb878866d45910cbf27123a6c89e6b55cd2", + "083aa90b4152f5294ce641309a1afa4db0a48cc3", [] ], "available-images-ref.html": [ @@ -248727,6 +248738,10 @@ "e5c303abd87f3cf0190dc122a0a4d8fa4a0c6df7", [] ], + "test_support.js": [ + "ec3668d1bf699c15bd65a7413e887e0188e78aba", + [] + ], "trickle.py": [ "f1ef785c94621a0c41d1e352cd8441bb30d59ab6", [] @@ -249177,7 +249192,7 @@ [] ], "slow-png.py": [ - "7869856ed0c8e1b7d8538d015800c2ac76b45d35", + "fced22aa26d2593078965a4e4cb06677acbcabc8", [] ], "url-entry-document-timer-frame.html": [ @@ -250959,7 +250974,7 @@ [] ], "device-posture.idl": [ - "c9ce0d87f2aa3dfe1a5d4a45fef9df3741e0ddc9", + "5f3574db98fa09dd5cd5ab72c15f9f01941ce865", [] ], "dom-overlays.idl": [ @@ -251067,7 +251082,7 @@ [] ], "html.idl": [ - "c070f248273294c15fa291dbfed36bab6ccff39c", + "99443be4a71990cca3e1c22c79341ff4a4b69db5", [] ], "idle-detection.idl": [ @@ -251171,7 +251186,7 @@ [] ], "mediasession.idl": [ - "3dd0cd75270bddebf310fc027c5ef1d31c417a13", + "4cec354c9d1ec80d20b1f506baa94447330c8bbc", [] ], "mediastream-recording.idl": [ @@ -251255,7 +251270,7 @@ [] ], "permissions.idl": [ - "06b6d0f0a3bb894c10c72dee72b98b1158077416", + "0ad42ff0b24601a21540c71b1b272a52bb57ea71", [] ], "picture-in-picture.idl": [ @@ -251318,6 +251333,10 @@ "112266865bb8c5c2dda4a3b76ea4c0be9b7c7749", [] ], + "sanitizer-api.idl": [ + "9db926c478cae7e733d6bffad3ffb1b5bdbae5de", + [] + ], "sanitizer-api.tentative.idl": [ "e130e4ecb05c46bc0c7c8519d3f10fb66d6e5af2", [] @@ -251326,6 +251345,10 @@ "f1274b8ef74c35804a72237b579c5e28dc9d3c1f", [] ], + "scheduling-apis.idl": [ + "82162b568e1a3f78b4418a00df86a26673e2489c", + [] + ], "screen-capture.idl": [ "7786b7fb4d7c9affd615bef5c7c51c22a8f9d8e9", [] @@ -251403,7 +251426,7 @@ [] ], "ua-client-hints.idl": [ - "e5ff0cf36d7cf049a8f76b6a4c49e8c52ae88af5", + "d9d487df2b9c45b89edc6cc34429591fd41ec3f7", [] ], "uievents.idl": [ @@ -251442,12 +251465,16 @@ "088c8ee3a3994eb2b39cb708792b5936ce331b16", [] ], + "web-animations-2.idl": [ + "bf4f9aa1846e5b8e400304d5776b0c050cef8142", + [] + ], "web-animations.idl": [ "6e973d195e382d12b40f831146b9cb7edda06b97", [] ], "web-bluetooth.idl": [ - "68decfa6ca998f1d9a9b5a7dc87eeb0609ed51b4", + "fbd029770943eea2324b9ff4a41ac472699c5edd", [] ], "web-locks.idl": [ @@ -251475,7 +251502,7 @@ [] ], "webcodecs.idl": [ - "f846edbcc390952aa8fc707744e1f9151079702b", + "aae4aa0121f6e53f30f4af2ee9779826b55db0a6", [] ], "webdriver.idl": [ @@ -251499,7 +251526,7 @@ [] ], "webrtc-encoded-transform.idl": [ - "253fab1ba0293965e3a2feef529b1610feb9923c", + "2ceb9355b02af12f66c6b19366ba4708fbeb2175", [] ], "webrtc-ice.idl": [ @@ -251535,7 +251562,7 @@ [] ], "webvtt.idl": [ - "0ba67c7fbb46f5cfc499aa5cea018efbb0077084", + "730e893e980f354a61a4fd87bacb0c50829ee843", [] ], "webxr-ar-module.idl": [ @@ -253412,6 +253439,10 @@ "b64cd975108aceafff61dbfed27c598748513004", [] ], + "cross-origin-expected.txt": [ + "48fb703c5a8f5d1a4cca78267a103c6bf2f37330", + [] + ], "historical-expected.txt": [ "404b6a774fdba6fddf2b11f22b9fcfea15d4e18f", [] @@ -253588,6 +253619,10 @@ [] ] }, + "idlharness.window-expected.txt": [ + "d9833ecfcbb092948364de9648ec387ee43e6ec9", + [] + ], "mediametadata-expected.txt": [ "5c6f25926b132202d1c68da9845b984a17664bf7", [] @@ -255005,7 +255040,7 @@ [] ], "idlharness.https.any.worker-expected.txt": [ - "70ecd5aabe939ae2ea75666ce5ada0feb943510f", + "edc336cabd9e75ce4e14bbd6b2a08d978fd40203", [] ], "service_workers": { @@ -259698,10 +259733,6 @@ "d039b9be364db485691ff9b4ba52c2e570df5bf6", [] ], - "idlharness.https.any.worker-expected.txt": [ - "d039b9be364db485691ff9b4ba52c2e570df5bf6", - [] - ], "service-worker": { "ServiceWorkerGlobalScope": { "isSecureContext.serviceworker.js": [ @@ -260329,7 +260360,7 @@ [] ], "fetch-access-control.py": [ - "c5ad0718d839a06ab1ad3252a5ef5b059796989d", + "a5f558d3d5901120e8c8110a2d4e022f76cb1288", [] ], "fetch-canvas-tainting-double-write-worker.js": [ @@ -261279,7 +261310,7 @@ [] ], "trickle.py": [ - "5a3f2eb23590a37b415cfe8c2d647ad57878064c", + "6423f7f36fe76f7ac37d68cb961ae216c9c4e40c", [] ], "type-check-worker.js": [ @@ -266211,7 +266242,7 @@ [] ], "asserts.py": [ - "1029af8dad8b2838a5fabdfe279ddb881bd5dff0", + "0ff992b3beca95e7ea23203958738a5ac314cf7a", [] ], "authentication.py": [ @@ -266227,7 +266258,7 @@ [] ], "helpers.py": [ - "13607e30481876a7777edfad57f48fcafbf8e40f", + "1d25d3832aea7c4ec139704e74ae1c90dfc1c2e6", [] ], "html": { @@ -266257,7 +266288,7 @@ [] ], "image.py": [ - "4cecd0c4901c3218960f683df121ba875aeaad68", + "2e7ad8c1309b2b4a1e02b424cbd74a610535a4ed", [] ], "inline.py": [ @@ -266265,7 +266296,7 @@ [] ], "merge_dictionaries.py": [ - "c13ab904e40e82faad1b9c4905003b1d5185baa7", + "72f1cab352dec4f333aa9f5498d6115276a3f836", [] ], "sync.py": [ @@ -266770,6 +266801,10 @@ "c943dafe5b154314132124e1d563df2a00b2aaf7", [] ], + "idlharness.https.window-expected.txt": [ + "7acdaa278fc4668732257ef436b2d21c5886a9bc", + [] + ], "resources": { "blank.html": [ "a3c3a4689a62b45b1e429f6b7a94690e556a1259", @@ -267611,7 +267646,7 @@ [] ], "idlharness.https.any.worker-expected.txt": [ - "31776dd036e88a43a480098af12ab8a889d8fe9d", + "2e02fbb532757bfce44cb3cdf5d58fb51f7305cf", [] ], "resources": { @@ -284106,6 +284141,15 @@ ] }, "audio-output": { + "enumerateDevices-with-selectAudioOutput.https.html": [ + "51da44286a760b1f6df84d7cfdb24f6dbdf6f6a9", + [ + null, + { + "testdriver": true + } + ] + ], "idlharness.https.window.js": [ "d7cdbd076833481b53f35b26d5ee016fd70c4111", [ @@ -325272,7 +325316,7 @@ ] ], "test_media_queries.html": [ - "1630e54e513b245a186a2ba777d1b1169cb4ecdf", + "ca56082d144f9ddc924b1898d9bd63bac45fe359", [ null, {} @@ -380847,7 +380891,7 @@ ] ], "Document.currentScript.html": [ - "34b3ec9a254ca6659d34615d5a76bd9f27d5f78f", + "245bae98ee109a0a3034e840a4d85af9ab8e5036", [ null, {} @@ -396359,14 +396403,21 @@ }, "xmldecl": { "xmldecl-1.html": [ - "30a0918407bcc539cfe85d8f6486ba6cbb96593c", + "40ebb932e4ba0298d58e3e4f64c71f14a3e18adc", [ null, {} ] ], "xmldecl-2.html": [ - "bb286328d217d5cbdd58648df814019a7ff5a67a", + "e546e38f9abe6f78cbce47b8caa994e613ebd816", + [ + null, + {} + ] + ], + "xmldecl-3.html": [ + "4b7aea0dcb25c1cb621b42b1f9abb0b9fb0f8347", [ null, {} @@ -404048,6 +404099,13 @@ {} ] ], + "cross-origin.html": [ + "14d92c8fc8193ea8321519f97f9d4d661664db4d", + [ + null, + {} + ] + ], "ended.html": [ "845fbcbaa6e798daeb64f3c6cc69e8b6cc1edff6", [ @@ -427413,7 +427471,7 @@ ] ], "animation-timeline-none.html": [ - "d5d585366c9e3c451f9d19f0c573798d1413644e", + "a8e07a44d6de1337005bc64bf41f5acbaf026ad4", [ null, {} @@ -427441,7 +427499,7 @@ ] ], "at-scroll-timeline-dynamic.tentative.html": [ - "0722115593c4800aac8b613be936e5aa71d7d4c4", + "e8ce88ea9e3b5e5bc5955e6ad5503a01492be6cd", [ null, {} @@ -489030,14 +489088,14 @@ }, "print": { "printcmd.py": [ - "67df27ad5f3af1748c85ffca6ddc9e4cd411ff73", + "89296d2b146bd75cd99fcb00c2a1043f45cff791", [ null, {} ] ], "user_prompts.py": [ - "cb32009e90a7f8f2359adf326ebdd24bb60d36f0", + "0a29b518ac9a2307e6f5656e3f455831f2a05337", [ null, {
diff --git a/third_party/blink/web_tests/external/wpt/audio-output/enumerateDevices-with-selectAudioOutput.https-expected.txt b/third_party/blink/web_tests/external/wpt/audio-output/enumerateDevices-with-selectAudioOutput.https-expected.txt new file mode 100644 index 0000000..c46f9ed --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/audio-output/enumerateDevices-with-selectAudioOutput.https-expected.txt
@@ -0,0 +1,6 @@ +This is a testharness.js-based test. +FAIL enumerateDevices() returns no audiooutput devices before permission grant assert_equals: number of audiooutput devices. expected 0 but got 3 +FAIL selectAudioOutput() promise_test: Unhandled rejection with value: object "TypeError: navigator.mediaDevices.selectAudioOutput is not a function" +FAIL enumerateDevices() after selectAudioOutput() assert_equals: number of audiooutput devices. expected 1 but got 3 +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/audio-output/enumerateDevices-with-selectAudioOutput.https.html b/third_party/blink/web_tests/external/wpt/audio-output/enumerateDevices-with-selectAudioOutput.https.html new file mode 100644 index 0000000..51da442 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/audio-output/enumerateDevices-with-selectAudioOutput.https.html
@@ -0,0 +1,48 @@ +<!doctype html> +<head> +<title>Test effect of selectAudioOutput() on audiooutput devices from enumerateDevices()</title> +<link rel="help" href="https://w3c.github.io/mediacapture-output/#dom-mediadevices-selectaudiooutput"> +</head> +<body> + <p class="instructions">If prompted, <strong>please allow</strong> access to + an audio output device.</p> +</body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script> +'use strict'; + +promise_test(async () => { + const devices = await navigator.mediaDevices.enumerateDevices(); + const outputDevices = devices.filter(info => info.kind == "audiooutput"); + assert_equals(outputDevices.length, 0, "number of audiooutput devices."); +}, "enumerateDevices() returns no audiooutput devices before permission grant"); + +let selected; + +promise_test(async t => { + await test_driver.bless('transient activation for selectAudioOutput()'); + selected = await navigator.mediaDevices.selectAudioOutput(); + assert_true(selected instanceof MediaDeviceInfo, + "resolves with a MediaDeviceInfo."); + assert_equals(selected.kind, "audiooutput", "selected.kind"); + assert_greater_than(selected.deviceId.length, 0, "selected.deviceId.length"); + assert_greater_than(selected.groupId.length, 0, "selected.groupId.length"); + assert_not_equals(selected.label, undefined, "selected.label"); +}, "selectAudioOutput()"); + +promise_test(async () => { + // "Once a device is exposed after a call to selectAudioOutput, it MUST be + // listed by enumerateDevices() for the current browsing context." + const devices = await navigator.mediaDevices.enumerateDevices(); + const outputDevices = devices.filter(info => info.kind == "audiooutput"); + assert_equals(outputDevices.length, 1, "number of audiooutput devices."); + assert_not_equals(selected, undefined); + const info = outputDevices[0]; + assert_equals(info.deviceId, selected.deviceId); + assert_equals(info.groupId, selected.groupId); + assert_equals(info.label, selected.label); +}, "enumerateDevices() after selectAudioOutput()"); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/common/security-features/subresource/font.py b/third_party/blink/web_tests/external/wpt/common/security-features/subresource/font.py index ba5f939..7900079cd 100644 --- a/third_party/blink/web_tests/external/wpt/common/security-features/subresource/font.py +++ b/third_party/blink/web_tests/external/wpt/common/security-features/subresource/font.py
@@ -1,13 +1,11 @@ -import os, sys, base64 +import os, sys +from base64 import decodebytes from wptserve.utils import isomorphic_decode import importlib subresource = importlib.import_module("common.security-features.subresource.subresource") -def decodebytes(s): - return base64.decodebytes(s) - def generate_payload(request, server_data): data = (u'{"headers": %(headers)s}') % server_data if b"id" in request.GET:
diff --git a/third_party/blink/web_tests/external/wpt/css/css-color/t421-rgb-values-meaning-b-ref.html b/third_party/blink/web_tests/external/wpt/css/css-color/t421-rgb-values-meaning-b-ref.html index b468f0eb..b824200a 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-color/t421-rgb-values-meaning-b-ref.html +++ b/third_party/blink/web_tests/external/wpt/css/css-color/t421-rgb-values-meaning-b-ref.html
@@ -1202,82 +1202,82 @@ <table border="border"> <tr> <td style="background: black"> </td> - <td style="background: #00ff00"> </td> - <td style="background: #00ee11"> </td> - <td style="background: #00dd22"> </td> - <td style="background: #00cc33"> </td> - <td style="background: #00bb44"> </td> - <td style="background: #00aa55"> </td> - <td style="background: #009966"> </td> - <td style="background: #008877"> </td> - <td style="background: #007788"> </td> - <td style="background: #006699"> </td> - <td style="background: #0055aa"> </td> - <td style="background: #0044bb"> </td> - <td style="background: #0033cc"> </td> - <td style="background: #0022dd"> </td> - <td style="background: #0011ee"> </td> <td style="background: #0000ff"> </td> + <td style="background: #1100ee"> </td> + <td style="background: #2200dd"> </td> + <td style="background: #3300cc"> </td> + <td style="background: #4400bb"> </td> + <td style="background: #5500aa"> </td> + <td style="background: #660099"> </td> + <td style="background: #770088"> </td> + <td style="background: #880077"> </td> + <td style="background: #990066"> </td> + <td style="background: #aa0055"> </td> + <td style="background: #bb0044"> </td> + <td style="background: #cc0033"> </td> + <td style="background: #dd0022"> </td> + <td style="background: #ee0011"> </td> + <td style="background: #ff0000"> </td> <td style="background: white"> </td> </tr> <tr> <td style="background: white"> </td> - <td style="background: #00ff00"> </td> - <td style="background: #00ee11"> </td> - <td style="background: #00dd22"> </td> - <td style="background: #00cc33"> </td> - <td style="background: #00bb44"> </td> - <td style="background: #00aa55"> </td> - <td style="background: #009966"> </td> - <td style="background: #008877"> </td> - <td style="background: #007788"> </td> - <td style="background: #006699"> </td> - <td style="background: #0055aa"> </td> - <td style="background: #0044bb"> </td> - <td style="background: #0033cc"> </td> - <td style="background: #0022dd"> </td> - <td style="background: #0011ee"> </td> <td style="background: #0000ff"> </td> + <td style="background: #1100ee"> </td> + <td style="background: #2200dd"> </td> + <td style="background: #3300cc"> </td> + <td style="background: #4400bb"> </td> + <td style="background: #5500aa"> </td> + <td style="background: #660099"> </td> + <td style="background: #770088"> </td> + <td style="background: #880077"> </td> + <td style="background: #990066"> </td> + <td style="background: #aa0055"> </td> + <td style="background: #bb0044"> </td> + <td style="background: #cc0033"> </td> + <td style="background: #dd0022"> </td> + <td style="background: #ee0011"> </td> + <td style="background: #ff0000"> </td> <td style="background: black"> </td> </tr> <tr> <td style="background: black"> </td> - <td style="background: #00ff00"> </td> - <td style="background: #00ee11"> </td> - <td style="background: #00dd22"> </td> - <td style="background: #00cc33"> </td> - <td style="background: #00bb44"> </td> - <td style="background: #00aa55"> </td> - <td style="background: #009966"> </td> - <td style="background: #008877"> </td> - <td style="background: #007788"> </td> - <td style="background: #006699"> </td> - <td style="background: #0055aa"> </td> - <td style="background: #0044bb"> </td> - <td style="background: #0033cc"> </td> - <td style="background: #0022dd"> </td> - <td style="background: #0011ee"> </td> <td style="background: #0000ff"> </td> + <td style="background: #1100ee"> </td> + <td style="background: #2200dd"> </td> + <td style="background: #3300cc"> </td> + <td style="background: #4400bb"> </td> + <td style="background: #5500aa"> </td> + <td style="background: #660099"> </td> + <td style="background: #770088"> </td> + <td style="background: #880077"> </td> + <td style="background: #990066"> </td> + <td style="background: #aa0055"> </td> + <td style="background: #bb0044"> </td> + <td style="background: #cc0033"> </td> + <td style="background: #dd0022"> </td> + <td style="background: #ee0011"> </td> + <td style="background: #ff0000"> </td> <td style="background: white"> </td> </tr> <tr> <td style="background: white"> </td> - <td style="background: #00ff00"> </td> - <td style="background: #00ee11"> </td> - <td style="background: #00dd22"> </td> - <td style="background: #00cc33"> </td> - <td style="background: #00bb44"> </td> - <td style="background: #00aa55"> </td> - <td style="background: #009966"> </td> - <td style="background: #008877"> </td> - <td style="background: #007788"> </td> - <td style="background: #006699"> </td> - <td style="background: #0055aa"> </td> - <td style="background: #0044bb"> </td> - <td style="background: #0033cc"> </td> - <td style="background: #0022dd"> </td> - <td style="background: #0011ee"> </td> <td style="background: #0000ff"> </td> + <td style="background: #1100ee"> </td> + <td style="background: #2200dd"> </td> + <td style="background: #3300cc"> </td> + <td style="background: #4400bb"> </td> + <td style="background: #5500aa"> </td> + <td style="background: #660099"> </td> + <td style="background: #770088"> </td> + <td style="background: #880077"> </td> + <td style="background: #990066"> </td> + <td style="background: #aa0055"> </td> + <td style="background: #bb0044"> </td> + <td style="background: #cc0033"> </td> + <td style="background: #dd0022"> </td> + <td style="background: #ee0011"> </td> + <td style="background: #ff0000"> </td> <td style="background: black"> </td> </tr> </table>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-001-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-001-expected.txt deleted file mode 100644 index 549da5a5..0000000 --- a/third_party/blink/web_tests/external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-001-expected.txt +++ /dev/null
@@ -1,33 +0,0 @@ -This is a testharness.js-based test. -PASS 'grid' with: grid-template-columns: 0fr; and grid-template-rows: 0fr; -PASS 'grid' with: grid-template-columns: 1fr; and grid-template-rows: 1fr; -PASS 'grid' with: grid-template-columns: 2fr; and grid-template-rows: 2fr; -PASS 'grid' with: grid-template-columns: minmax(0, 0fr); and grid-template-rows: minmax(0, 0fr); -PASS 'grid' with: grid-template-columns: minmax(0, .5fr); and grid-template-rows: minmax(0, .5fr); -PASS 'grid' with: grid-template-columns: minmax(0, 1fr); and grid-template-rows: minmax(0, 1fr); -PASS 'grid' with: grid-template-columns: minmax(0, 2fr); and grid-template-rows: minmax(0, 2fr); -PASS 'grid' with: grid-template-columns: minmax(75px, 1fr); and grid-template-rows: minmax(75px, 1fr); -FAIL 'grid' with: grid-template-columns: 0fr 0fr; and grid-template-rows: 0fr 0fr; assert_in_array: gridTemplateColumns value "0px 0px" not in array ["50px 50px"] -FAIL 'grid' with: grid-template-columns: 0fr 1fr; and grid-template-rows: 0fr 1fr; assert_in_array: gridTemplateColumns value "0px 50px" not in array ["0px 100px"] -FAIL 'grid' with: grid-template-columns: 1fr 0fr; and grid-template-rows: 1fr 0fr; assert_in_array: gridTemplateColumns value "50px 0px" not in array ["100px 0px"] -FAIL 'grid' with: grid-template-columns: 1fr 1fr; and grid-template-rows: 1fr 1fr; assert_in_array: gridTemplateColumns value "25px 25px" not in array ["50px 50px"] -FAIL 'grid' with: grid-template-columns: 1fr 3fr; and grid-template-rows: 1fr 3fr; assert_in_array: gridTemplateColumns value "12.5px 37.5px" not in array ["25px 75px"] -FAIL 'grid' with: grid-template-columns: 0fr 0fr 1fr; and grid-template-rows: 0fr 0fr 1fr; assert_in_array: gridTemplateColumns value "0px 0px 50px" not in array ["50px 50px 0px"] -PASS 'grid' with: grid-template-columns: minmax(0, 0fr) minmax(0, 0fr); and grid-template-rows: minmax(0, 0fr) minmax(0, 0fr); -PASS 'grid' with: grid-template-columns: minmax(0, 0fr) minmax(0, 1fr); and grid-template-rows: minmax(0, 0fr) minmax(0, 1fr); -PASS 'grid' with: grid-template-columns: minmax(15px, 0fr) minmax(0, 1fr); and grid-template-rows: minmax(15px, 0fr) minmax(0, 1fr); -PASS 'grid' with: grid-template-columns: minmax(20px, 1fr) minmax(0, 1fr); and grid-template-rows: minmax(20px, 1fr) minmax(0, 1fr); -PASS 'grid' with: grid-template-columns: minmax(30px, 1fr) minmax(0, 1fr); and grid-template-rows: minmax(30px, 1fr) minmax(0, 1fr); -FAIL 'grid' with: grid-template-columns: 0fr minmax(0, 0fr); and grid-template-rows: 0fr minmax(0, 0fr); assert_in_array: gridTemplateColumns value "0px 0px" not in array ["100px 0px"] -FAIL 'grid' with: grid-template-columns: 0fr minmax(0, 1fr); and grid-template-rows: 0fr minmax(0, 1fr); assert_in_array: gridTemplateColumns value "0px 50px" not in array ["100px 0px"] -FAIL 'grid' with: grid-template-columns: 1fr minmax(0, 1fr); and grid-template-rows: 1fr minmax(0, 1fr); assert_in_array: gridTemplateColumns value "25px 25px" not in array ["100px 0px"] -FAIL 'grid' with: grid-template-columns: 1fr minmax(25px, 1fr); and grid-template-rows: 1fr minmax(25px, 1fr); assert_in_array: gridTemplateColumns value "25px 25px" not in array ["75px 25px"] -FAIL 'grid' with: grid-template-columns: 0fr auto; and grid-template-rows: 0fr auto; assert_in_array: gridTemplateColumns value "0px 50px" not in array ["100px 0px"] -FAIL 'grid' with: grid-template-columns: 1fr auto; and grid-template-rows: 1fr auto; assert_in_array: gridTemplateColumns value "50px 0px" not in array ["100px 0px"] -FAIL 'grid' with: grid-template-columns: 1fr max-content; and grid-template-rows: 1fr max-content; assert_in_array: gridTemplateColumns value "50px 0px" not in array ["100px 0px"] -FAIL 'grid' with: grid-template-columns: minmax(0, 0fr) auto; and grid-template-rows: minmax(0, 0fr) auto; assert_in_array: gridTemplateColumns value "0px 50px" not in array ["0px 100px"] -FAIL 'grid' with: grid-template-columns: minmax(0, 1fr) auto; and grid-template-rows: minmax(0, 1fr) auto; assert_in_array: gridTemplateColumns value "50px 0px" not in array ["0px 100px"] -FAIL 'grid' with: grid-template-columns: minmax(25px, 0fr) auto; and grid-template-rows: minmax(25px, 0fr) auto; assert_in_array: gridTemplateColumns value "25px 25px" not in array ["25px 75px"] -FAIL 'grid' with: grid-template-columns: minmax(25px, 1fr) auto; and grid-template-rows: minmax(25px, 1fr) auto; assert_in_array: gridTemplateColumns value "50px 0px" not in array ["25px 75px"] -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-001.html b/third_party/blink/web_tests/external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-001.html index a478f9a..f983a4b 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-001.html +++ b/third_party/blink/web_tests/external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-001.html
@@ -74,8 +74,8 @@ checkTrackSizes(2, "1fr max-content", "100px 0px"); // Item spanning a fixed flexible track and an intrinsic non-flexible track -checkTrackSizes(2, "minmax(0, 0fr) auto", "0px 100px"); -checkTrackSizes(2, "minmax(0, 1fr) auto", "0px 100px"); -checkTrackSizes(2, "minmax(25px, 0fr) auto", "25px 75px"); -checkTrackSizes(2, "minmax(25px, 1fr) auto", "25px 75px"); +checkTrackSizes(2, "minmax(0, 0fr) auto", "0px 50px"); +checkTrackSizes(2, "minmax(0, 1fr) auto", "50px 0px"); +checkTrackSizes(2, "minmax(25px, 0fr) auto", "25px 25px"); +checkTrackSizes(2, "minmax(25px, 1fr) auto", "50px 0px"); </script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-003-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-003-expected.txt deleted file mode 100644 index b2c708e..0000000 --- a/third_party/blink/web_tests/external/wpt/css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-003-expected.txt +++ /dev/null
@@ -1,106 +0,0 @@ -This is a testharness.js-based test. -Found 102 tests; 78 PASS, 24 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS auto min item 'grid' with: grid-template-columns: 0fr; and grid-template-rows: 0fr; -PASS auto min item 'grid' with: grid-template-columns: 1fr; and grid-template-rows: 1fr; -PASS auto min item 'grid' with: grid-template-columns: 2fr; and grid-template-rows: 2fr; -PASS auto min item 'grid' with: grid-template-columns: minmax(0, 0fr); and grid-template-rows: minmax(0, 0fr); -PASS auto min item 'grid' with: grid-template-columns: minmax(0, .5fr); and grid-template-rows: minmax(0, .5fr); -PASS auto min item 'grid' with: grid-template-columns: minmax(0, 1fr); and grid-template-rows: minmax(0, 1fr); -PASS auto min item 'grid' with: grid-template-columns: minmax(0, 2fr); and grid-template-rows: minmax(0, 2fr); -PASS auto min item 'grid' with: grid-template-columns: minmax(75px, 1fr); and grid-template-rows: minmax(75px, 1fr); -PASS auto min item 'grid' with: grid-template-columns: 0fr 0fr; and grid-template-rows: 0fr 0fr; -PASS auto min item 'grid' with: grid-template-columns: 0fr 1fr; and grid-template-rows: 0fr 1fr; -PASS auto min item 'grid' with: grid-template-columns: 1fr 0fr; and grid-template-rows: 1fr 0fr; -PASS auto min item 'grid' with: grid-template-columns: 1fr 1fr; and grid-template-rows: 1fr 1fr; -PASS auto min item 'grid' with: grid-template-columns: 1fr 3fr; and grid-template-rows: 1fr 3fr; -PASS auto min item 'grid' with: grid-template-columns: 0fr 0fr 1fr; and grid-template-rows: 0fr 0fr 1fr; -PASS auto min item 'grid' with: grid-template-columns: minmax(0, 0fr) minmax(0, 0fr); and grid-template-rows: minmax(0, 0fr) minmax(0, 0fr); -PASS auto min item 'grid' with: grid-template-columns: minmax(0, 0fr) minmax(0, 1fr); and grid-template-rows: minmax(0, 0fr) minmax(0, 1fr); -PASS auto min item 'grid' with: grid-template-columns: minmax(15px, 0fr) minmax(0, 1fr); and grid-template-rows: minmax(15px, 0fr) minmax(0, 1fr); -PASS auto min item 'grid' with: grid-template-columns: minmax(20px, 1fr) minmax(0, 1fr); and grid-template-rows: minmax(20px, 1fr) minmax(0, 1fr); -PASS auto min item 'grid' with: grid-template-columns: minmax(40px, 1fr) minmax(0, 1fr); and grid-template-rows: minmax(40px, 1fr) minmax(0, 1fr); -PASS auto min item 'grid' with: grid-template-columns: 0fr minmax(0, 0fr); and grid-template-rows: 0fr minmax(0, 0fr); -PASS auto min item 'grid' with: grid-template-columns: 0fr minmax(0, 1fr); and grid-template-rows: 0fr minmax(0, 1fr); -PASS auto min item 'grid' with: grid-template-columns: 1fr minmax(0, 1fr); and grid-template-rows: 1fr minmax(0, 1fr); -PASS auto min item 'grid' with: grid-template-columns: 1fr minmax(25px, 1fr); and grid-template-rows: 1fr minmax(25px, 1fr); -PASS auto min item 'grid' with: grid-template-columns: 0fr min-content; and grid-template-rows: 0fr min-content; -PASS auto min item 'grid' with: grid-template-columns: 0fr auto; and grid-template-rows: 0fr auto; -PASS auto min item 'grid' with: grid-template-columns: 0.5fr auto; and grid-template-rows: 0.5fr auto; -PASS auto min item 'grid' with: grid-template-columns: 1fr auto; and grid-template-rows: 1fr auto; -PASS auto min item 'grid' with: grid-template-columns: 1fr max-content; and grid-template-rows: 1fr max-content; -PASS auto min item 'grid' with: grid-template-columns: 1fr min-content; and grid-template-rows: 1fr min-content; -PASS auto min item 'grid' with: grid-template-columns: minmax(0, 0fr) min-content; and grid-template-rows: minmax(0, 0fr) min-content; -PASS auto min item 'grid' with: grid-template-columns: minmax(0, 0fr) auto; and grid-template-rows: minmax(0, 0fr) auto; -PASS auto min item 'grid' with: grid-template-columns: minmax(0, 1fr) auto; and grid-template-rows: minmax(0, 1fr) auto; -PASS auto min item 'grid' with: grid-template-columns: minmax(25px, 0fr) auto; and grid-template-rows: minmax(25px, 0fr) auto; -PASS auto min item 'grid' with: grid-template-columns: minmax(25px, 1fr) auto; and grid-template-rows: minmax(25px, 1fr) auto; -PASS min-content min item 'grid' with: grid-template-columns: 0fr; and grid-template-rows: 0fr; -PASS min-content min item 'grid' with: grid-template-columns: 1fr; and grid-template-rows: 1fr; -PASS min-content min item 'grid' with: grid-template-columns: 2fr; and grid-template-rows: 2fr; -PASS min-content min item 'grid' with: grid-template-columns: minmax(0, 0fr); and grid-template-rows: minmax(0, 0fr); -PASS min-content min item 'grid' with: grid-template-columns: minmax(0, .5fr); and grid-template-rows: minmax(0, .5fr); -PASS min-content min item 'grid' with: grid-template-columns: minmax(0, 1fr); and grid-template-rows: minmax(0, 1fr); -PASS min-content min item 'grid' with: grid-template-columns: minmax(0, 2fr); and grid-template-rows: minmax(0, 2fr); -PASS min-content min item 'grid' with: grid-template-columns: minmax(75px, 1fr); and grid-template-rows: minmax(75px, 1fr); -FAIL min-content min item 'grid' with: grid-template-columns: 0fr 0fr; and grid-template-rows: 0fr 0fr; assert_in_array: gridTemplateColumns value "0px 0px" not in array ["50px 50px"] -FAIL min-content min item 'grid' with: grid-template-columns: 0fr 1fr; and grid-template-rows: 0fr 1fr; assert_in_array: gridTemplateColumns value "0px 60px" not in array ["0px 100px"] -FAIL min-content min item 'grid' with: grid-template-columns: 1fr 0fr; and grid-template-rows: 1fr 0fr; assert_in_array: gridTemplateColumns value "60px 0px" not in array ["100px 0px"] -FAIL min-content min item 'grid' with: grid-template-columns: 1fr 1fr; and grid-template-rows: 1fr 1fr; assert_in_array: gridTemplateColumns value "30px 30px" not in array ["50px 50px"] -FAIL min-content min item 'grid' with: grid-template-columns: 1fr 3fr; and grid-template-rows: 1fr 3fr; assert_in_array: gridTemplateColumns value "15px 45px" not in array ["25px 75px"] -FAIL min-content min item 'grid' with: grid-template-columns: 0fr 0fr 1fr; and grid-template-rows: 0fr 0fr 1fr; assert_in_array: gridTemplateColumns value "0px 0px 60px" not in array ["50px 50px 0px"] -PASS min-content min item 'grid' with: grid-template-columns: minmax(0, 0fr) minmax(0, 0fr); and grid-template-rows: minmax(0, 0fr) minmax(0, 0fr); -PASS min-content min item 'grid' with: grid-template-columns: minmax(0, 0fr) minmax(0, 1fr); and grid-template-rows: minmax(0, 0fr) minmax(0, 1fr); -PASS min-content min item 'grid' with: grid-template-columns: minmax(15px, 0fr) minmax(0, 1fr); and grid-template-rows: minmax(15px, 0fr) minmax(0, 1fr); -PASS min-content min item 'grid' with: grid-template-columns: minmax(20px, 1fr) minmax(0, 1fr); and grid-template-rows: minmax(20px, 1fr) minmax(0, 1fr); -PASS min-content min item 'grid' with: grid-template-columns: minmax(40px, 1fr) minmax(0, 1fr); and grid-template-rows: minmax(40px, 1fr) minmax(0, 1fr); -FAIL min-content min item 'grid' with: grid-template-columns: 0fr minmax(0, 0fr); and grid-template-rows: 0fr minmax(0, 0fr); assert_in_array: gridTemplateColumns value "0px 0px" not in array ["100px 0px"] -FAIL min-content min item 'grid' with: grid-template-columns: 0fr minmax(0, 1fr); and grid-template-rows: 0fr minmax(0, 1fr); assert_in_array: gridTemplateColumns value "0px 60px" not in array ["100px 0px"] -FAIL min-content min item 'grid' with: grid-template-columns: 1fr minmax(0, 1fr); and grid-template-rows: 1fr minmax(0, 1fr); assert_in_array: gridTemplateColumns value "30px 30px" not in array ["100px 0px"] -FAIL min-content min item 'grid' with: grid-template-columns: 1fr minmax(25px, 1fr); and grid-template-rows: 1fr minmax(25px, 1fr); assert_in_array: gridTemplateColumns value "30px 30px" not in array ["75px 25px"] -FAIL min-content min item 'grid' with: grid-template-columns: 0fr min-content; and grid-template-rows: 0fr min-content; assert_in_array: gridTemplateColumns value "0px 0px" not in array ["100px 0px"] -FAIL min-content min item 'grid' with: grid-template-columns: 0fr auto; and grid-template-rows: 0fr auto; assert_in_array: gridTemplateColumns value "0px 60px" not in array ["100px 0px"] -FAIL min-content min item 'grid' with: grid-template-columns: 0.5fr auto; and grid-template-rows: 0.5fr auto; assert_in_array: gridTemplateColumns value "30px 30px" not in array ["100px 0px"] -FAIL min-content min item 'grid' with: grid-template-columns: 1fr auto; and grid-template-rows: 1fr auto; assert_in_array: gridTemplateColumns value "60px 0px" not in array ["100px 0px"] -FAIL min-content min item 'grid' with: grid-template-columns: 1fr max-content; and grid-template-rows: 1fr max-content; assert_in_array: gridTemplateColumns value "60px 0px" not in array ["100px 0px"] -FAIL min-content min item 'grid' with: grid-template-columns: 1fr min-content; and grid-template-rows: 1fr min-content; assert_in_array: gridTemplateColumns value "60px 0px" not in array ["100px 0px"] -PASS min-content min item 'grid' with: grid-template-columns: minmax(0, 0fr) min-content; and grid-template-rows: minmax(0, 0fr) min-content; -PASS min-content min item 'grid' with: grid-template-columns: minmax(0, 0fr) auto; and grid-template-rows: minmax(0, 0fr) auto; -PASS min-content min item 'grid' with: grid-template-columns: minmax(0, 1fr) auto; and grid-template-rows: minmax(0, 1fr) auto; -PASS min-content min item 'grid' with: grid-template-columns: minmax(25px, 0fr) auto; and grid-template-rows: minmax(25px, 0fr) auto; -PASS min-content min item 'grid' with: grid-template-columns: minmax(25px, 1fr) auto; and grid-template-rows: minmax(25px, 1fr) auto; -PASS 50px min item 'grid' with: grid-template-columns: 0fr; and grid-template-rows: 0fr; -PASS 50px min item 'grid' with: grid-template-columns: 1fr; and grid-template-rows: 1fr; -PASS 50px min item 'grid' with: grid-template-columns: 2fr; and grid-template-rows: 2fr; -PASS 50px min item 'grid' with: grid-template-columns: minmax(0, 0fr); and grid-template-rows: minmax(0, 0fr); -PASS 50px min item 'grid' with: grid-template-columns: minmax(0, .5fr); and grid-template-rows: minmax(0, .5fr); -PASS 50px min item 'grid' with: grid-template-columns: minmax(0, 1fr); and grid-template-rows: minmax(0, 1fr); -PASS 50px min item 'grid' with: grid-template-columns: minmax(0, 2fr); and grid-template-rows: minmax(0, 2fr); -PASS 50px min item 'grid' with: grid-template-columns: minmax(75px, 1fr); and grid-template-rows: minmax(75px, 1fr); -FAIL 50px min item 'grid' with: grid-template-columns: 0fr 0fr; and grid-template-rows: 0fr 0fr; assert_in_array: gridTemplateColumns value "0px 0px" not in array ["25px 25px"] -PASS 50px min item 'grid' with: grid-template-columns: 0fr 1fr; and grid-template-rows: 0fr 1fr; -PASS 50px min item 'grid' with: grid-template-columns: 1fr 0fr; and grid-template-rows: 1fr 0fr; -PASS 50px min item 'grid' with: grid-template-columns: 1fr 1fr; and grid-template-rows: 1fr 1fr; -PASS 50px min item 'grid' with: grid-template-columns: 1fr 3fr; and grid-template-rows: 1fr 3fr; -FAIL 50px min item 'grid' with: grid-template-columns: 0fr 0fr 1fr; and grid-template-rows: 0fr 0fr 1fr; assert_in_array: gridTemplateColumns value "0px 0px 60px" not in array ["25px 25px 10px"] -PASS 50px min item 'grid' with: grid-template-columns: minmax(0, 0fr) minmax(0, 0fr); and grid-template-rows: minmax(0, 0fr) minmax(0, 0fr); -PASS 50px min item 'grid' with: grid-template-columns: minmax(0, 0fr) minmax(0, 1fr); and grid-template-rows: minmax(0, 0fr) minmax(0, 1fr); -PASS 50px min item 'grid' with: grid-template-columns: minmax(15px, 0fr) minmax(0, 1fr); and grid-template-rows: minmax(15px, 0fr) minmax(0, 1fr); -PASS 50px min item 'grid' with: grid-template-columns: minmax(20px, 1fr) minmax(0, 1fr); and grid-template-rows: minmax(20px, 1fr) minmax(0, 1fr); -PASS 50px min item 'grid' with: grid-template-columns: minmax(40px, 1fr) minmax(0, 1fr); and grid-template-rows: minmax(40px, 1fr) minmax(0, 1fr); -FAIL 50px min item 'grid' with: grid-template-columns: 0fr minmax(0, 0fr); and grid-template-rows: 0fr minmax(0, 0fr); assert_in_array: gridTemplateColumns value "0px 0px" not in array ["50px 0px"] -FAIL 50px min item 'grid' with: grid-template-columns: 0fr minmax(0, 1fr); and grid-template-rows: 0fr minmax(0, 1fr); assert_in_array: gridTemplateColumns value "0px 60px" not in array ["50px 10px"] -FAIL 50px min item 'grid' with: grid-template-columns: 1fr minmax(0, 1fr); and grid-template-rows: 1fr minmax(0, 1fr); assert_in_array: gridTemplateColumns value "30px 30px" not in array ["50px 10px"] -PASS 50px min item 'grid' with: grid-template-columns: 1fr minmax(25px, 1fr); and grid-template-rows: 1fr minmax(25px, 1fr); -FAIL 50px min item 'grid' with: grid-template-columns: 0fr min-content; and grid-template-rows: 0fr min-content; assert_in_array: gridTemplateColumns value "0px 0px" not in array ["50px 0px"] -FAIL 50px min item 'grid' with: grid-template-columns: 0fr auto; and grid-template-rows: 0fr auto; assert_in_array: gridTemplateColumns value "0px 60px" not in array ["50px 10px"] -FAIL 50px min item 'grid' with: grid-template-columns: 0.5fr auto; and grid-template-rows: 0.5fr auto; assert_in_array: gridTemplateColumns value "30px 30px" not in array ["50px 10px"] -PASS 50px min item 'grid' with: grid-template-columns: 1fr auto; and grid-template-rows: 1fr auto; -PASS 50px min item 'grid' with: grid-template-columns: 1fr max-content; and grid-template-rows: 1fr max-content; -PASS 50px min item 'grid' with: grid-template-columns: 1fr min-content; and grid-template-rows: 1fr min-content; -PASS 50px min item 'grid' with: grid-template-columns: minmax(0, 0fr) min-content; and grid-template-rows: minmax(0, 0fr) min-content; -PASS 50px min item 'grid' with: grid-template-columns: minmax(0, 0fr) auto; and grid-template-rows: minmax(0, 0fr) auto; -PASS 50px min item 'grid' with: grid-template-columns: minmax(0, 1fr) auto; and grid-template-rows: minmax(0, 1fr) auto; -PASS 50px min item 'grid' with: grid-template-columns: minmax(25px, 0fr) auto; and grid-template-rows: minmax(25px, 0fr) auto; -PASS 50px min item 'grid' with: grid-template-columns: minmax(25px, 1fr) auto; and grid-template-rows: minmax(25px, 1fr) auto; -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/css/mediaqueries/test_media_queries.html b/third_party/blink/web_tests/external/wpt/css/mediaqueries/test_media_queries.html index 1630e54..ca56082d 100644 --- a/third_party/blink/web_tests/external/wpt/css/mediaqueries/test_media_queries.html +++ b/third_party/blink/web_tests/external/wpt/css/mediaqueries/test_media_queries.html
@@ -32,14 +32,14 @@ function should_apply(q) { test(function() { - assert_true(query_applies(q)); - }, "subtest_" + ++testNum + ": " + q + " should apply"); + assert_true(query_applies(q), q + " should apply"); + }, "subtest_" + ++testNum); } function should_not_apply(q) { test(function() { - assert_false(query_applies(q)); - }, "subtest_" + ++testNum + ": " + q + " should not apply"); + assert_false(query_applies(q), q + " should not apply"); + }, "subtest_" + ++testNum); } /*
diff --git a/third_party/blink/web_tests/external/wpt/docs/wpt_lint_rules.py b/third_party/blink/web_tests/external/wpt/docs/wpt_lint_rules.py index b999737..01f965e 100644 --- a/third_party/blink/web_tests/external/wpt/docs/wpt_lint_rules.py +++ b/third_party/blink/web_tests/external/wpt/docs/wpt_lint_rules.py
@@ -3,7 +3,6 @@ from recommonmark.parser import CommonMarkParser import importlib import textwrap -from six import iteritems class WPTLintRules(Directive): """A docutils directive to generate documentation for the @@ -32,7 +31,7 @@ """wpt-lint-rules: unable to resolve the module at "{}".""".format(self.module_specifier) ) - for binding_name, value in iteritems(module.__dict__): + for binding_name, value in module.__dict__.items(): if hasattr(value, "__abstractmethods__") and len(value.__abstractmethods__): continue
diff --git a/third_party/blink/web_tests/external/wpt/html/dom/documents/dom-tree-accessors/Document.currentScript.html b/third_party/blink/web_tests/external/wpt/html/dom/documents/dom-tree-accessors/Document.currentScript.html index 34b3ec9..245bae9 100644 --- a/third_party/blink/web_tests/external/wpt/html/dom/documents/dom-tree-accessors/Document.currentScript.html +++ b/third_party/blink/web_tests/external/wpt/html/dom/documents/dom-tree-accessors/Document.currentScript.html
@@ -25,7 +25,8 @@ "script-async-false" : [], "iframe-src" : [], "cross-origin" : [null], - "document-write" : [] + "document-write" : [], + "microtask": [], }; var expected = {}; @@ -208,3 +209,11 @@ <script> document.write('<script id="document-write">verify("document-write"); finish("document-write");</' + 'script>'); </script> + +<!-- Testing microtask --> +<script id="microtask"> + Promise.resolve().then(() => { + verify("microtask"); + finish("microtask"); + }); +</script>
diff --git "a/third_party/blink/web_tests/external/wpt/html/dom/idlharness.https_exclude=\050Document_Window_HTML._\051-expected.txt" "b/third_party/blink/web_tests/external/wpt/html/dom/idlharness.https_exclude=\050Document_Window_HTML._\051-expected.txt" index 35a7816..f3fcb35c 100644 --- "a/third_party/blink/web_tests/external/wpt/html/dom/idlharness.https_exclude=\050Document_Window_HTML._\051-expected.txt" +++ "b/third_party/blink/web_tests/external/wpt/html/dom/idlharness.https_exclude=\050Document_Window_HTML._\051-expected.txt"
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 1418 tests; 1387 PASS, 31 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 1441 tests; 1410 PASS, 31 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idl_test setup PASS idl_test validation PASS Partial interface Document: original interface defined @@ -431,6 +431,7 @@ PASS CanvasRenderingContext2D interface: operation getContextAttributes() PASS CanvasRenderingContext2D interface: operation save() PASS CanvasRenderingContext2D interface: operation restore() +PASS CanvasRenderingContext2D interface: operation reset() PASS CanvasRenderingContext2D interface: operation scale(unrestricted double, unrestricted double) PASS CanvasRenderingContext2D interface: operation rotate(unrestricted double) PASS CanvasRenderingContext2D interface: operation translate(unrestricted double, unrestricted double) @@ -477,9 +478,9 @@ PASS CanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double) PASS CanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double) PASS CanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) -PASS CanvasRenderingContext2D interface: operation createImageData(long, long) +PASS CanvasRenderingContext2D interface: operation createImageData(long, long, optional ImageDataSettings) PASS CanvasRenderingContext2D interface: operation createImageData(ImageData) -PASS CanvasRenderingContext2D interface: operation getImageData(long, long, long, long) +PASS CanvasRenderingContext2D interface: operation getImageData(long, long, long, long, optional ImageDataSettings) PASS CanvasRenderingContext2D interface: operation putImageData(ImageData, long, long) PASS CanvasRenderingContext2D interface: operation putImageData(ImageData, long, long, long, long, long, long) PASS CanvasRenderingContext2D interface: attribute lineWidth @@ -493,6 +494,12 @@ PASS CanvasRenderingContext2D interface: attribute textAlign PASS CanvasRenderingContext2D interface: attribute textBaseline PASS CanvasRenderingContext2D interface: attribute direction +PASS CanvasRenderingContext2D interface: attribute textLetterSpacing +PASS CanvasRenderingContext2D interface: attribute textWordSpacing +PASS CanvasRenderingContext2D interface: attribute fontKerning +PASS CanvasRenderingContext2D interface: attribute fontStretch +PASS CanvasRenderingContext2D interface: attribute fontVariantCaps +PASS CanvasRenderingContext2D interface: attribute textRendering PASS CanvasRenderingContext2D interface: operation closePath() PASS CanvasRenderingContext2D interface: operation moveTo(unrestricted double, unrestricted double) PASS CanvasRenderingContext2D interface: operation lineTo(unrestricted double, unrestricted double) @@ -508,6 +515,7 @@ PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getContextAttributes()" with the proper type PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "save()" with the proper type PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "restore()" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "reset()" with the proper type PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "scale(unrestricted double, unrestricted double)" with the proper type PASS CanvasRenderingContext2D interface: calling scale(unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "rotate(unrestricted double)" with the proper type @@ -584,12 +592,12 @@ PASS CanvasRenderingContext2D interface: calling drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double)" with the proper type PASS CanvasRenderingContext2D interface: calling drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError -PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "createImageData(long, long)" with the proper type -PASS CanvasRenderingContext2D interface: calling createImageData(long, long) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "createImageData(long, long, optional ImageDataSettings)" with the proper type +PASS CanvasRenderingContext2D interface: calling createImageData(long, long, optional ImageDataSettings) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "createImageData(ImageData)" with the proper type PASS CanvasRenderingContext2D interface: calling createImageData(ImageData) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError -PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getImageData(long, long, long, long)" with the proper type -PASS CanvasRenderingContext2D interface: calling getImageData(long, long, long, long) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getImageData(long, long, long, long, optional ImageDataSettings)" with the proper type +PASS CanvasRenderingContext2D interface: calling getImageData(long, long, long, long, optional ImageDataSettings) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "putImageData(ImageData, long, long)" with the proper type PASS CanvasRenderingContext2D interface: calling putImageData(ImageData, long, long) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "putImageData(ImageData, long, long, long, long, long, long)" with the proper type @@ -606,6 +614,12 @@ PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "textAlign" with the proper type PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "textBaseline" with the proper type PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "direction" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "textLetterSpacing" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "textWordSpacing" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "fontKerning" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "fontStretch" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "fontVariantCaps" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "textRendering" with the proper type PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "closePath()" with the proper type PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "moveTo(unrestricted double, unrestricted double)" with the proper type PASS CanvasRenderingContext2D interface: calling moveTo(unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError @@ -664,11 +678,13 @@ PASS ImageData interface: attribute width PASS ImageData interface: attribute height PASS ImageData interface: attribute data +PASS ImageData interface: attribute colorSpace PASS ImageData must be primary interface of new ImageData(10, 10) PASS Stringification of new ImageData(10, 10) PASS ImageData interface: new ImageData(10, 10) must inherit property "width" with the proper type PASS ImageData interface: new ImageData(10, 10) must inherit property "height" with the proper type FAIL ImageData interface: new ImageData(10, 10) must inherit property "data" with the proper type assert_inherits: property "data" found on object expected in prototype chain +PASS ImageData interface: new ImageData(10, 10) must inherit property "colorSpace" with the proper type PASS Path2D interface: existence and properties of interface object PASS Path2D interface object length PASS Path2D interface object name @@ -714,6 +730,7 @@ PASS OffscreenCanvasRenderingContext2D interface: attribute canvas PASS OffscreenCanvasRenderingContext2D interface: operation save() PASS OffscreenCanvasRenderingContext2D interface: operation restore() +PASS OffscreenCanvasRenderingContext2D interface: operation reset() PASS OffscreenCanvasRenderingContext2D interface: operation scale(unrestricted double, unrestricted double) PASS OffscreenCanvasRenderingContext2D interface: operation rotate(unrestricted double) PASS OffscreenCanvasRenderingContext2D interface: operation translate(unrestricted double, unrestricted double) @@ -756,9 +773,9 @@ PASS OffscreenCanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double) PASS OffscreenCanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double) PASS OffscreenCanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) -PASS OffscreenCanvasRenderingContext2D interface: operation createImageData(long, long) +PASS OffscreenCanvasRenderingContext2D interface: operation createImageData(long, long, optional ImageDataSettings) PASS OffscreenCanvasRenderingContext2D interface: operation createImageData(ImageData) -PASS OffscreenCanvasRenderingContext2D interface: operation getImageData(long, long, long, long) +PASS OffscreenCanvasRenderingContext2D interface: operation getImageData(long, long, long, long, optional ImageDataSettings) PASS OffscreenCanvasRenderingContext2D interface: operation putImageData(ImageData, long, long) PASS OffscreenCanvasRenderingContext2D interface: operation putImageData(ImageData, long, long, long, long, long, long) PASS OffscreenCanvasRenderingContext2D interface: attribute lineWidth @@ -772,6 +789,12 @@ PASS OffscreenCanvasRenderingContext2D interface: attribute textAlign PASS OffscreenCanvasRenderingContext2D interface: attribute textBaseline PASS OffscreenCanvasRenderingContext2D interface: attribute direction +PASS OffscreenCanvasRenderingContext2D interface: attribute textLetterSpacing +PASS OffscreenCanvasRenderingContext2D interface: attribute textWordSpacing +PASS OffscreenCanvasRenderingContext2D interface: attribute fontKerning +PASS OffscreenCanvasRenderingContext2D interface: attribute fontStretch +PASS OffscreenCanvasRenderingContext2D interface: attribute fontVariantCaps +PASS OffscreenCanvasRenderingContext2D interface: attribute textRendering PASS OffscreenCanvasRenderingContext2D interface: operation closePath() PASS OffscreenCanvasRenderingContext2D interface: operation moveTo(unrestricted double, unrestricted double) PASS OffscreenCanvasRenderingContext2D interface: operation lineTo(unrestricted double, unrestricted double)
diff --git a/third_party/blink/web_tests/external/wpt/html/dom/idlharness.worker-expected.txt b/third_party/blink/web_tests/external/wpt/html/dom/idlharness.worker-expected.txt index 572fc47..260003c 100644 --- a/third_party/blink/web_tests/external/wpt/html/dom/idlharness.worker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/html/dom/idlharness.worker-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 796 tests; 788 PASS, 8 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 804 tests; 796 PASS, 8 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idl_test setup PASS idl_test validation PASS Partial interface Document: original interface defined @@ -295,6 +295,7 @@ PASS ImageData interface: attribute width PASS ImageData interface: attribute height PASS ImageData interface: attribute data +PASS ImageData interface: attribute colorSpace PASS Path2D interface: existence and properties of interface object PASS Path2D interface object length PASS Path2D interface object name @@ -340,6 +341,7 @@ PASS OffscreenCanvasRenderingContext2D interface: attribute canvas PASS OffscreenCanvasRenderingContext2D interface: operation save() PASS OffscreenCanvasRenderingContext2D interface: operation restore() +PASS OffscreenCanvasRenderingContext2D interface: operation reset() PASS OffscreenCanvasRenderingContext2D interface: operation scale(unrestricted double, unrestricted double) PASS OffscreenCanvasRenderingContext2D interface: operation rotate(unrestricted double) PASS OffscreenCanvasRenderingContext2D interface: operation translate(unrestricted double, unrestricted double) @@ -382,9 +384,9 @@ PASS OffscreenCanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double) PASS OffscreenCanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double) PASS OffscreenCanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) -PASS OffscreenCanvasRenderingContext2D interface: operation createImageData(long, long) +PASS OffscreenCanvasRenderingContext2D interface: operation createImageData(long, long, optional ImageDataSettings) PASS OffscreenCanvasRenderingContext2D interface: operation createImageData(ImageData) -PASS OffscreenCanvasRenderingContext2D interface: operation getImageData(long, long, long, long) +PASS OffscreenCanvasRenderingContext2D interface: operation getImageData(long, long, long, long, optional ImageDataSettings) PASS OffscreenCanvasRenderingContext2D interface: operation putImageData(ImageData, long, long) PASS OffscreenCanvasRenderingContext2D interface: operation putImageData(ImageData, long, long, long, long, long, long) PASS OffscreenCanvasRenderingContext2D interface: attribute lineWidth @@ -398,6 +400,12 @@ PASS OffscreenCanvasRenderingContext2D interface: attribute textAlign PASS OffscreenCanvasRenderingContext2D interface: attribute textBaseline PASS OffscreenCanvasRenderingContext2D interface: attribute direction +PASS OffscreenCanvasRenderingContext2D interface: attribute textLetterSpacing +PASS OffscreenCanvasRenderingContext2D interface: attribute textWordSpacing +PASS OffscreenCanvasRenderingContext2D interface: attribute fontKerning +PASS OffscreenCanvasRenderingContext2D interface: attribute fontStretch +PASS OffscreenCanvasRenderingContext2D interface: attribute fontVariantCaps +PASS OffscreenCanvasRenderingContext2D interface: attribute textRendering PASS OffscreenCanvasRenderingContext2D interface: operation closePath() PASS OffscreenCanvasRenderingContext2D interface: operation moveTo(unrestricted double, unrestricted double) PASS OffscreenCanvasRenderingContext2D interface: operation lineTo(unrestricted double, unrestricted double)
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-img-element/404-response-with-actual-image-data.py b/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-img-element/404-response-with-actual-image-data.py index f7c99fb..083aa90 100644 --- a/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-img-element/404-response-with-actual-image-data.py +++ b/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-img-element/404-response-with-actual-image-data.py
@@ -1,4 +1,4 @@ -import base64 +from base64 import decodebytes def main(req, res): - return 404, [(b'Content-Type', b'image/png')], base64.decodebytes(b"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAhSURBVDhPY3wro/KfgQLABKXJBqMGjBoAAqMGDLwBDAwAEsoCTFWunmQAAAAASUVORK5CYII=") + return 404, [(b'Content-Type', b'image/png')], decodebytes(b"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAhSURBVDhPY3wro/KfgQLABKXJBqMGjBoAAqMGDLwBDAwAEsoCTFWunmQAAAAASUVORK5CYII=")
diff --git a/third_party/blink/web_tests/external/wpt/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/slow-png.py b/third_party/blink/web_tests/external/wpt/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/slow-png.py index 7869856..fced22a 100644 --- a/third_party/blink/web_tests/external/wpt/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/slow-png.py +++ b/third_party/blink/web_tests/external/wpt/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/slow-png.py
@@ -1,7 +1,7 @@ -from base64 import decodestring import time +from base64 import decodebytes -png_response = decodestring(b'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVR4nGNiAAAABgADNjd8qAAAAABJRU5ErkJggg==') +png_response = decodebytes(b'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVR4nGNiAAAABgADNjd8qAAAAABJRU5ErkJggg==') def main(request, response): time.sleep(2)
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/device-posture.idl b/third_party/blink/web_tests/external/wpt/interfaces/device-posture.idl index c9ce0d8..5f3574d 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/device-posture.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/device-posture.idl
@@ -3,9 +3,9 @@ // (https://github.com/w3c/webref) // Source: Device Posture API (https://w3c.github.io/device-posture/) -[SecureContext] -partial interface Screen { - [SameObject] readonly attribute DevicePosture posture; +[SecureContext, Exposed=(Window)] +partial interface Navigator { + [SameObject] readonly attribute DevicePosture devicePosture; }; [SecureContext, Exposed=(Window)]
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/html.idl b/third_party/blink/web_tests/external/wpt/interfaces/html.idl index c070f24..99443be4 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/html.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/html.idl
@@ -1265,11 +1265,14 @@ ImageBitmap or OffscreenCanvas) CanvasImageSource; +enum PredefinedColorSpace { "srgb", "display-p3" }; + enum CanvasFillRule { "nonzero", "evenodd" }; dictionary CanvasRenderingContext2DSettings { boolean alpha = true; boolean desynchronized = false; + PredefinedColorSpace colorSpace = "srgb"; }; enum ImageSmoothingQuality { "low", "medium", "high" }; @@ -1302,6 +1305,7 @@ // state undefined save(); // push state on state stack undefined restore(); // pop state stack and restore state + undefined reset(); // reset the rendering context to its default state }; interface mixin CanvasTransform { @@ -1399,9 +1403,9 @@ interface mixin CanvasImageData { // pixel manipulation - ImageData createImageData([EnforceRange] long sw, [EnforceRange] long sh); + ImageData createImageData([EnforceRange] long sw, [EnforceRange] long sh, optional ImageDataSettings settings = {}); ImageData createImageData(ImageData imagedata); - ImageData getImageData([EnforceRange] long sx, [EnforceRange] long sy, [EnforceRange] long sw, [EnforceRange] long sh); + ImageData getImageData([EnforceRange] long sx, [EnforceRange] long sy, [EnforceRange] long sw, [EnforceRange] long sh, optional ImageDataSettings settings = {}); undefined putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy); undefined putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy, [EnforceRange] long dirtyX, [EnforceRange] long dirtyY, [EnforceRange] long dirtyWidth, [EnforceRange] long dirtyHeight); }; @@ -1411,6 +1415,10 @@ enum CanvasTextAlign { "start", "end", "left", "right", "center" }; enum CanvasTextBaseline { "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" }; enum CanvasDirection { "ltr", "rtl", "inherit" }; +enum CanvasFontKerning { "auto", "normal", "none" }; +enum CanvasFontStretch { "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "normal", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded" }; +enum CanvasFontVariantCaps { "normal", "small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase", "titling-caps" }; +enum CanvasTextRendering { "auto", "optimizeSpeed", "optimizeLegibility", "geometricPrecision" }; interface mixin CanvasPathDrawingStyles { // line caps/joins @@ -1431,6 +1439,12 @@ attribute CanvasTextAlign textAlign; // (default: "start") attribute CanvasTextBaseline textBaseline; // (default: "alphabetic") attribute CanvasDirection direction; // (default: "inherit") + attribute double textLetterSpacing; // (default: 0) + attribute double textWordSpacing; // (default: 0) + attribute CanvasFontKerning fontKerning; // (default: "auto") + attribute CanvasFontStretch fontStretch; // (default: "normal") + attribute CanvasFontVariantCaps fontVariantCaps; // (default: "normal") + attribute CanvasTextRendering textRendering; // (default: "normal") }; interface mixin CanvasPath { @@ -1477,15 +1491,20 @@ readonly attribute double ideographicBaseline; }; +dictionary ImageDataSettings { + PredefinedColorSpace colorSpace; +}; + [Exposed=(Window,Worker), Serializable] interface ImageData { - constructor(unsigned long sw, unsigned long sh); - constructor(Uint8ClampedArray data, unsigned long sw, optional unsigned long sh); + constructor(unsigned long sw, unsigned long sh, optional ImageDataSettings settings = {}); + constructor(Uint8ClampedArray data, unsigned long sw, optional unsigned long sh, optional ImageDataSettings settings = {}); readonly attribute unsigned long width; readonly attribute unsigned long height; readonly attribute Uint8ClampedArray data; + readonly attribute PredefinedColorSpace colorSpace; }; [Exposed=(Window,Worker)]
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/mediasession.idl b/third_party/blink/web_tests/external/wpt/interfaces/mediasession.idl index 3dd0cd7..4cec354 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/mediasession.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/mediasession.idl
@@ -23,7 +23,10 @@ "nexttrack", "skipad", "stop", - "seekto" + "seekto", + "togglemicrophone", + "togglecamera", + "hangup" }; callback MediaSessionActionHandler = undefined(MediaSessionActionDetails details); @@ -37,6 +40,10 @@ undefined setActionHandler(MediaSessionAction action, MediaSessionActionHandler? handler); undefined setPositionState(optional MediaPositionState state = {}); + + undefined setMicrophoneActive(boolean active); + + undefined setCameraActive(boolean active); }; [Exposed=Window]
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/permissions.idl b/third_party/blink/web_tests/external/wpt/interfaces/permissions.idl index 06b6d0f..0ad42ff 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/permissions.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/permissions.idl
@@ -35,25 +35,25 @@ }; enum PermissionName { - "geolocation", - "notifications", - "push", - "midi", - "camera", - "microphone", - "speaker-selection", - "device-info", + "accelerometer", + "ambient-light-sensor", "background-fetch", "background-sync", "bluetooth", - "persistent-storage", - "ambient-light-sensor", - "accelerometer", + "camera", + "clipboard-write", + "device-info", + "display-capture", + "geolocation", "gyroscope", "magnetometer", - "clipboard-write", - "display-capture", + "microphone", + "midi", "nfc", + "notifications", + "persistent-storage", + "push", + "speaker-selection", }; dictionary PushPermissionDescriptor : PermissionDescriptor {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/sanitizer-api.idl b/third_party/blink/web_tests/external/wpt/interfaces/sanitizer-api.idl new file mode 100644 index 0000000..9db926c4 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/interfaces/sanitizer-api.idl
@@ -0,0 +1,30 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: HTML Sanitizer API (https://wicg.github.io/sanitizer-api/) + +[ + Exposed=(Window), + SecureContext +] interface Sanitizer { + constructor(optional SanitizerConfig config = {}); + + DocumentFragment sanitize(SanitizerInput input); + DOMString sanitizeToString(SanitizerInput input); + + SanitizerConfig config(); + static SanitizerConfig defaultConfig(); +}; + +typedef (DOMString or DocumentFragment or Document) SanitizerInput; + +dictionary SanitizerConfig { + sequence<DOMString> allowElements; + sequence<DOMString> blockElements; + sequence<DOMString> dropElements; + AttributeMatchList allowAttributes; + AttributeMatchList dropAttributes; + boolean allowCustomElements; +}; + +typedef record<DOMString, sequence<DOMString>> AttributeMatchList;
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/scheduling-apis.idl b/third_party/blink/web_tests/external/wpt/interfaces/scheduling-apis.idl new file mode 100644 index 0000000..82162b5 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/interfaces/scheduling-apis.idl
@@ -0,0 +1,53 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: Prioritized Task Scheduling (https://wicg.github.io/scheduling-apis/) + +enum TaskPriority { + "user-blocking", + "user-visible", + "background" +}; + +dictionary SchedulerPostTaskOptions { + AbortSignal signal; + TaskPriority priority; + [EnforceRange] unsigned long long delay = 0; +}; + +callback SchedulerPostTaskCallback = any (); + +[Exposed=(Window, Worker)] +interface Scheduler { + Promise<any> postTask(SchedulerPostTaskCallback callback, + optional SchedulerPostTaskOptions options = {}); +}; + +[Exposed=(Window, Worker)] +interface TaskPriorityChangeEvent : Event { + constructor(DOMString type, TaskPriorityChangeEventInit priorityChangeEventInitDict); + + readonly attribute TaskPriority previousPriority; +}; + +dictionary TaskPriorityChangeEventInit : EventInit { + required TaskPriority previousPriority; +}; + +[Exposed=(Window,Worker)] +interface TaskController : AbortController { + constructor(optional TaskPriority priority = "user-visible"); + + undefined setPriority(TaskPriority priority); +}; + +[Exposed=(Window, Worker)] +interface TaskSignal : AbortSignal { + readonly attribute TaskPriority priority; + + attribute EventHandler onprioritychange; +}; + +partial interface mixin WindowOrWorkerGlobalScope { + readonly attribute Scheduler scheduler; +};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/ua-client-hints.idl b/third_party/blink/web_tests/external/wpt/interfaces/ua-client-hints.idl index e5ff0cf3..d9d487df 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/ua-client-hints.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/ua-client-hints.idl
@@ -9,7 +9,7 @@ }; dictionary UADataValues { - FrozenArray<NavigatorUABrandVersion> brands; + sequence<NavigatorUABrandVersion> brands; boolean mobile; DOMString platform; DOMString architecture; @@ -20,7 +20,7 @@ }; dictionary UALowEntropyJSON { - FrozenArray<NavigatorUABrandVersion> brands; + sequence<NavigatorUABrandVersion> brands; boolean mobile; DOMString platform; };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/web-animations-2.idl b/third_party/blink/web_tests/external/wpt/interfaces/web-animations-2.idl new file mode 100644 index 0000000..bf4f9aa --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/interfaces/web-animations-2.idl
@@ -0,0 +1,76 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: Web Animations Level 2 (https://drafts.csswg.org/web-animations-2/) + +[Exposed=Window] +partial interface AnimationTimeline { + Animation play (optional AnimationEffect? effect = null); +}; + +[Exposed=Window] +partial interface AnimationEffect { + // Timing hierarchy + readonly attribute GroupEffect? parent; + readonly attribute AnimationEffect? previousSibling; + readonly attribute AnimationEffect? nextSibling; + + undefined before (AnimationEffect... effects); + undefined after (AnimationEffect... effects); + undefined replace (AnimationEffect... effects); + undefined remove (); +}; + +partial dictionary EffectTiming { + double playbackRate = 1.0; +}; + +partial dictionary OptionalEffectTiming { + double playbackRate; +}; + +partial dictionary ComputedEffectTiming { + double startTime; +}; + +[Exposed=Window] +interface GroupEffect { + constructor(sequence<AnimationEffect>? children, + optional (unrestricted double or EffectTiming) timing = {}); + + readonly attribute AnimationNodeList children; + readonly attribute AnimationEffect? firstChild; + readonly attribute AnimationEffect? lastChild; + GroupEffect clone (); + + undefined prepend (AnimationEffect... effects); + undefined append (AnimationEffect... effects); +}; + +[Exposed=Window] +interface AnimationNodeList { + readonly attribute unsigned long length; + getter AnimationEffect? item (unsigned long index); +}; + +[Exposed=Window] +interface SequenceEffect : GroupEffect { + constructor(sequence<AnimationEffect>? children, + optional (unrestricted double or EffectTiming) timing = {}); + + SequenceEffect clone (); +}; + +partial interface KeyframeEffect { + attribute IterationCompositeOperation iterationComposite; +}; + +partial dictionary KeyframeEffectOptions { + IterationCompositeOperation iterationComposite = "replace"; +}; + +enum IterationCompositeOperation { "replace", "accumulate" }; + +callback EffectCallback = undefined (double? progress, + (Element or CSSPseudoElement) currentTarget, + Animation animation);
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/web-bluetooth.idl b/third_party/blink/web_tests/external/wpt/interfaces/web-bluetooth.idl index 68decfa..fbd0297 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/web-bluetooth.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/web-bluetooth.idl
@@ -8,14 +8,20 @@ BufferSource mask; }; +dictionary BluetoothManufacturerDataFilterInit : BluetoothDataFilterInit { + required [EnforceRange] unsigned short companyIdentifier; +}; + +dictionary BluetoothServiceDataFilterInit : BluetoothDataFilterInit { + required BluetoothServiceUUID service; +}; + dictionary BluetoothLEScanFilterInit { sequence<BluetoothServiceUUID> services; DOMString name; DOMString namePrefix; - // Maps unsigned shorts to BluetoothDataFilters. - object manufacturerData; - // Maps BluetoothServiceUUIDs to BluetoothDataFilters. - object serviceData; + sequence<BluetoothManufacturerDataFilterInit> manufacturerData; + sequence<BluetoothServiceDataFilterInit> serviceData; }; dictionary RequestDeviceOptions {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webcodecs.idl b/third_party/blink/web_tests/external/wpt/interfaces/webcodecs.idl index f846edb..aae4aa0 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webcodecs.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webcodecs.idl
@@ -20,11 +20,11 @@ }; dictionary AudioDecoderInit { - required AudioFrameOutputCallback output; + required AudioDataOutputCallback output; required WebCodecsErrorCallback error; }; -callback AudioFrameOutputCallback = undefined(AudioFrame output); +callback AudioDataOutputCallback = undefined(AudioData output); [Exposed=(Window,DedicatedWorker)] interface VideoDecoder { @@ -57,7 +57,7 @@ readonly attribute long encodeQueueSize; undefined configure(AudioEncoderConfig config); - undefined encode(AudioFrame frame); + undefined encode(AudioData data); Promise<undefined> flush(); undefined reset(); undefined close(); @@ -212,26 +212,49 @@ }; [Exposed=(Window,DedicatedWorker)] -interface AudioFrame { - constructor(AudioFrameInit init); +interface AudioData { + constructor(AudioDataInit init); + + readonly attribute AudioSampleFormat sampleFormat; + readonly attribute float sampleRate; + readonly attribute unsigned long numberOfFrames; + readonly attribute unsigned long numberOfChannels; + readonly attribute unsigned long allocationSize; + readonly attribute unsigned long long duration; readonly attribute unsigned long long timestamp; - readonly attribute AudioBuffer? buffer; + + undefined copyTo([AllowShared] BufferSource destination, unsigned long planeNumber); + AudioData clone(); undefined close(); }; -dictionary AudioFrameInit { +dictionary AudioDataInit { + required AudioSampleFormat sampleFormat; + required float sampleRate; + required unsigned long numberOfFrames; + required unsigned long numberOfChannels; required unsigned long long timestamp; - required AudioBuffer buffer; + required BufferSource data; +}; + +enum AudioSampleFormat { + "U8", + "S16", + "S32", + "FLT", + "S16P", + "S32P", + "FLTP", }; [Exposed=(Window,DedicatedWorker)] interface VideoFrame { - constructor(ImageBitmap imageBitmap, optional VideoFrameInit frameInit = {}); - constructor(PixelFormat pixelFormat, sequence<(Plane or PlaneInit)> planes, - optional VideoFrameInit frameInit = {}); + constructor(CanvasImageSource image, optional VideoFrameInit init = {}); + constructor(sequence<(Plane or PlaneInit)> planes, + VideoFramePlaneInit init); readonly attribute PixelFormat format; - readonly attribute FrozenArray<Plane> planes; + readonly attribute FrozenArray<Plane>? planes; readonly attribute unsigned long codedWidth; readonly attribute unsigned long codedHeight; readonly attribute unsigned long cropLeft; @@ -243,17 +266,19 @@ readonly attribute unsigned long long? duration; readonly attribute unsigned long long? timestamp; - undefined destroy(); VideoFrame clone(); - - Promise<ImageBitmap> createImageBitmap( - optional ImageBitmapOptions options = {}); - + undefined close(); }; dictionary VideoFrameInit { - unsigned long codedWidth; - unsigned long codedHeight; + unsigned long long duration; + unsigned long long timestamp; +}; + +dictionary VideoFramePlaneInit { + required PixelFormat format; + required unsigned long codedWidth; + required unsigned long codedHeight; unsigned long cropLeft; unsigned long cropTop; unsigned long cropWidth; @@ -282,3 +307,58 @@ enum PixelFormat { "I420" }; + +[Exposed=(Window,DedicatedWorker)] +interface ImageDecoder { + constructor(ImageDecoderInit init); + + readonly attribute boolean complete; + readonly attribute Promise<undefined> completed; + readonly attribute ImageTrackList tracks; + + Promise<ImageDecodeResult> decode(optional ImageDecodeOptions options = {}); + undefined reset(); + undefined close(); + + static Promise<boolean> isTypeSupported(DOMString type); +}; + +typedef (BufferSource or ReadableStream) ImageBufferSource; +dictionary ImageDecoderInit { + required DOMString type; + required ImageBufferSource data; + PremultiplyAlpha premultiplyAlpha = "default"; + ColorSpaceConversion colorSpaceConversion = "default"; + unsigned long desiredWidth; + unsigned long desiredHeight; + boolean preferAnimation; +}; + +dictionary ImageDecodeOptions { + unsigned long frameIndex = 0; + boolean completeFramesOnly = true; +}; + +dictionary ImageDecodeResult { + required VideoFrame image; + required boolean complete; +}; + +[Exposed=(Window,DedicatedWorker)] +interface ImageTrackList { + getter ImageTrack (unsigned long index); + + readonly attribute Promise<undefined> ready; + readonly attribute unsigned long length; + readonly attribute long selectedIndex; + readonly attribute ImageTrack? selectedTrack; +}; + +[Exposed=(Window,DedicatedWorker)] +interface ImageTrack : EventTarget { + readonly attribute boolean animated; + readonly attribute unsigned long frameCount; + readonly attribute unrestricted float repetitionCount; + attribute EventHandler onchange; + attribute boolean selected; +};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webrtc-encoded-transform.idl b/third_party/blink/web_tests/external/wpt/interfaces/webrtc-encoded-transform.idl index 253fab1..2ceb9355 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webrtc-encoded-transform.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webrtc-encoded-transform.idl
@@ -9,21 +9,14 @@ WritableStream writable; }; -// New fields in RTCConfiguration -partial dictionary RTCConfiguration { - boolean encodedInsertableStreams = false; -}; - typedef (SFrameTransform or RTCRtpScriptTransform) RTCRtpTransform; // New methods for RTCRtpSender and RTCRtpReceiver partial interface RTCRtpSender { - RTCInsertableStreams createEncodedStreams(); attribute RTCRtpTransform? transform; }; partial interface RTCRtpReceiver { - RTCInsertableStreams createEncodedStreams(); attribute RTCRtpTransform? transform; };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webvtt.idl b/third_party/blink/web_tests/external/wpt/interfaces/webvtt.idl index 0ba67c7..730e893 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webvtt.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webvtt.idl
@@ -11,7 +11,7 @@ enum AlignSetting { "start", "center", "end", "left", "right" }; [Exposed=Window] interface VTTCue : TextTrackCue { - constructor(double startTime, double endTime, DOMString text); + constructor(double startTime, unrestricted double endTime, DOMString text); attribute VTTRegion? region; attribute DirectionSetting vertical; attribute boolean snapToLines;
diff --git a/third_party/blink/web_tests/external/wpt/mediacapture-fromelement/cross-origin-expected.txt b/third_party/blink/web_tests/external/wpt/mediacapture-fromelement/cross-origin-expected.txt new file mode 100644 index 0000000..48fb703 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/mediacapture-fromelement/cross-origin-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Capturing stream from cross-origin video assert_true: cross-origin video is muted expected true got false +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/mediacapture-fromelement/cross-origin.html b/third_party/blink/web_tests/external/wpt/mediacapture-fromelement/cross-origin.html new file mode 100644 index 0000000..14d92c8f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/mediacapture-fromelement/cross-origin.html
@@ -0,0 +1,41 @@ +<!DOCTYPE html> +<html> +<head> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +</head> +<body> +<video autoplay controls id="output"></video> +<script> + +// Run captureStream() on cross-origin <video> content + async_test(function() { + const video = document.createElement('video'); + video.src = location.origin.replace("//", "//www1.") + "/media/white.webm"; + video.onerror = this.unreached_func("<video> error"); + video.loop = true; + video.play(); + + const stream = video.captureStream(); + assert_not_equals(stream, null, "error generating stream"); + const output = document.getElementById("output"); + const canvas = document.createElement("canvas"); + const ctx = canvas.getContext('2d'); + + stream.onaddtrack = this.step_func_done(function() { + canvas.width = output.videoWidth || 320; + canvas.height = output.videoHeight || 240; + // The stream got a (number of) MediaStreamTracks added. + assert_equals(stream.getVideoTracks().length, 1, 'video tracks'); + assert_equals(stream.getAudioTracks().length, 0, 'audio'); + assert_true(stream.getVideoTracks()[0].muted, 'cross-origin video is muted'); + ctx.drawImage(output, 0, 0, canvas.width, canvas.height); + + const pixels = ctx.getImageData(0,0,canvas.width, canvas.height); + assert_equals(pixels.data[canvas.width*canvas.height*4 - 4], 0, "cross-origin content appears black"); + }, "<video>.captureStream() returns muted/black stream"); + }, "Capturing stream from cross-origin video"); + +</script> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/mediasession/idlharness.window-expected.txt b/third_party/blink/web_tests/external/wpt/mediasession/idlharness.window-expected.txt new file mode 100644 index 0000000..d9833ecf --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/mediasession/idlharness.window-expected.txt
@@ -0,0 +1,59 @@ +This is a testharness.js-based test. +Found 55 tests; 49 PASS, 6 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS idl_test setup +PASS idl_test validation +PASS Partial interface Navigator: original interface defined +PASS Partial interface Navigator: valid exposure set +PASS Partial interface Navigator: member names are unique +PASS Partial interface mixin NavigatorID: member names are unique +PASS Navigator includes NavigatorID: member names are unique +PASS Navigator includes NavigatorLanguage: member names are unique +PASS Navigator includes NavigatorOnLine: member names are unique +PASS Navigator includes NavigatorContentUtils: member names are unique +PASS Navigator includes NavigatorCookies: member names are unique +PASS Navigator includes NavigatorPlugins: member names are unique +PASS Navigator includes NavigatorConcurrentHardware: member names are unique +PASS MediaSession interface: existence and properties of interface object +PASS MediaSession interface object length +PASS MediaSession interface object name +PASS MediaSession interface: existence and properties of interface prototype object +PASS MediaSession interface: existence and properties of interface prototype object's "constructor" property +PASS MediaSession interface: existence and properties of interface prototype object's @@unscopables property +PASS MediaSession interface: attribute metadata +PASS MediaSession interface: attribute playbackState +PASS MediaSession interface: operation setActionHandler(MediaSessionAction, MediaSessionActionHandler?) +PASS MediaSession interface: operation setPositionState(optional MediaPositionState) +FAIL MediaSession interface: operation setMicrophoneActive(boolean) assert_own_property: interface prototype object missing non-static operation expected property "setMicrophoneActive" missing +FAIL MediaSession interface: operation setCameraActive(boolean) assert_own_property: interface prototype object missing non-static operation expected property "setCameraActive" missing +PASS MediaSession must be primary interface of navigator.mediaSession +PASS Stringification of navigator.mediaSession +PASS MediaSession interface: navigator.mediaSession must inherit property "metadata" with the proper type +PASS MediaSession interface: navigator.mediaSession must inherit property "playbackState" with the proper type +PASS MediaSession interface: navigator.mediaSession must inherit property "setActionHandler(MediaSessionAction, MediaSessionActionHandler?)" with the proper type +PASS MediaSession interface: calling setActionHandler(MediaSessionAction, MediaSessionActionHandler?) on navigator.mediaSession with too few arguments must throw TypeError +PASS MediaSession interface: navigator.mediaSession must inherit property "setPositionState(optional MediaPositionState)" with the proper type +PASS MediaSession interface: calling setPositionState(optional MediaPositionState) on navigator.mediaSession with too few arguments must throw TypeError +FAIL MediaSession interface: navigator.mediaSession must inherit property "setMicrophoneActive(boolean)" with the proper type assert_inherits: property "setMicrophoneActive" not found in prototype chain +FAIL MediaSession interface: calling setMicrophoneActive(boolean) on navigator.mediaSession with too few arguments must throw TypeError assert_inherits: property "setMicrophoneActive" not found in prototype chain +FAIL MediaSession interface: navigator.mediaSession must inherit property "setCameraActive(boolean)" with the proper type assert_inherits: property "setCameraActive" not found in prototype chain +FAIL MediaSession interface: calling setCameraActive(boolean) on navigator.mediaSession with too few arguments must throw TypeError assert_inherits: property "setCameraActive" not found in prototype chain +PASS MediaMetadata interface: existence and properties of interface object +PASS MediaMetadata interface object length +PASS MediaMetadata interface object name +PASS MediaMetadata interface: existence and properties of interface prototype object +PASS MediaMetadata interface: existence and properties of interface prototype object's "constructor" property +PASS MediaMetadata interface: existence and properties of interface prototype object's @@unscopables property +PASS MediaMetadata interface: attribute title +PASS MediaMetadata interface: attribute artist +PASS MediaMetadata interface: attribute album +PASS MediaMetadata interface: attribute artwork +PASS MediaMetadata must be primary interface of new MediaMetadata() +PASS Stringification of new MediaMetadata() +PASS MediaMetadata interface: new MediaMetadata() must inherit property "title" with the proper type +PASS MediaMetadata interface: new MediaMetadata() must inherit property "artist" with the proper type +PASS MediaMetadata interface: new MediaMetadata() must inherit property "album" with the proper type +PASS MediaMetadata interface: new MediaMetadata() must inherit property "artwork" with the proper type +PASS Navigator interface: attribute mediaSession +PASS Navigator interface: navigator must inherit property "mediaSession" with the proper type +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/fetch-access-control.py b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/fetch-access-control.py index c5ad0718..a5f558d 100644 --- a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/fetch-access-control.py +++ b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/fetch-access-control.py
@@ -1,12 +1,9 @@ -import base64 import json import os +from base64 import decodebytes from wptserve.utils import isomorphic_decode, isomorphic_encode -def decodebytes(s): - return base64.decodebytes(s) - def main(request, response): headers = [] headers.append((b'X-ServiceWorker-ServerHeader', b'SetInTheServer'))
diff --git a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/trickle.py b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/trickle.py index 5a3f2eb2..6423f7f3 100644 --- a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/trickle.py +++ b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/trickle.py
@@ -1,7 +1,5 @@ import time -from six import range - def main(request, response): delay = float(request.GET.first(b"ms", 500)) / 1E3 count = int(request.GET.first(b"count", 50))
diff --git a/third_party/blink/web_tests/external/wpt/webdriver/tests/print/printcmd.py b/third_party/blink/web_tests/external/wpt/webdriver/tests/print/printcmd.py index 67df27a..89296d2b 100644 --- a/third_party/blink/web_tests/external/wpt/webdriver/tests/print/printcmd.py +++ b/third_party/blink/web_tests/external/wpt/webdriver/tests/print/printcmd.py
@@ -1,13 +1,9 @@ -import base64 +from base64 import decodebytes import pytest -import six - from tests.support.asserts import assert_error, assert_success -def decodebytes(s): - return base64.decodebytes(six.ensure_binary(s)) def do_print(session, options): return session.transport.send( @@ -28,7 +24,7 @@ def test_no_browsing_context(session, closed_frame): response = do_print(session, {}) value = assert_success(response) - pdf = decodebytes(value) + pdf = decodebytes(value.encode()) assert_pdf(pdf) @@ -41,7 +37,7 @@ "shrinkToFit": False }) value = assert_success(response) - pdf = decodebytes(value) + pdf = decodebytes(value.encode()) # TODO: Test that the output is reasonable assert_pdf(pdf)
diff --git a/third_party/blink/web_tests/external/wpt/webdriver/tests/print/user_prompts.py b/third_party/blink/web_tests/external/wpt/webdriver/tests/print/user_prompts.py index cb32009e..0a29b518 100644 --- a/third_party/blink/web_tests/external/wpt/webdriver/tests/print/user_prompts.py +++ b/third_party/blink/web_tests/external/wpt/webdriver/tests/print/user_prompts.py
@@ -1,17 +1,12 @@ # META: timeout=long -import base64 +from base64 import decodebytes import pytest -import six - from tests.support.asserts import assert_dialog_handled, assert_error, assert_success from .printcmd import do_print, assert_pdf -def decodebytes(s): - return base64.decodebytes(six.ensure_binary(s)) - @pytest.fixture def check_user_prompt_closed_without_exception(session, create_dialog, inline): def check_user_prompt_closed_without_exception(dialog_type, retval): @@ -22,7 +17,7 @@ response = do_print(session, {}) value = assert_success(response) - pdf = decodebytes(value) + pdf = decodebytes(value.encode()) assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval) assert_pdf(pdf)
diff --git a/third_party/blink/web_tests/external/wpt/webdriver/tests/support/asserts.py b/third_party/blink/web_tests/external/wpt/webdriver/tests/support/asserts.py index 1029af8..0ff992b 100644 --- a/third_party/blink/web_tests/external/wpt/webdriver/tests/support/asserts.py +++ b/third_party/blink/web_tests/external/wpt/webdriver/tests/support/asserts.py
@@ -1,15 +1,12 @@ -import base64 import imghdr import struct +from base64 import decodebytes import six from webdriver import Element, NoSuchAlertException, WebDriverException -def decodebytes(s): - return base64.decodebytes(six.ensure_binary(s)) - # WebDriver specification ID: dfn-error-response-data errors = { "element click intercepted": 400, @@ -217,6 +214,6 @@ def assert_png(screenshot): """Test that screenshot is a Base64 encoded PNG file.""" - image = decodebytes(screenshot) + image = decodebytes(screenshot.encode()) mime_type = imghdr.what("", image) assert mime_type == "png", "Expected image to be PNG, but it was {}".format(mime_type)
diff --git a/third_party/blink/web_tests/external/wpt/webdriver/tests/support/helpers.py b/third_party/blink/web_tests/external/wpt/webdriver/tests/support/helpers.py index 13607e30..1d25d38 100644 --- a/third_party/blink/web_tests/external/wpt/webdriver/tests/support/helpers.py +++ b/third_party/blink/web_tests/external/wpt/webdriver/tests/support/helpers.py
@@ -4,8 +4,6 @@ import math import sys -from six import iteritems - import webdriver from tests.support import defaults @@ -114,7 +112,7 @@ Update a nested dictionary or similar mapping. Modify ``source`` in place. """ - for key, value in iteritems(overrides): + for key, value in overrides.items(): if isinstance(value, collections.Mapping) and value: returned = deep_update(source.get(key, {}), value) source[key] = returned
diff --git a/third_party/blink/web_tests/external/wpt/webdriver/tests/support/image.py b/third_party/blink/web_tests/external/wpt/webdriver/tests/support/image.py index 4cecd0c..2e7ad8c 100644 --- a/third_party/blink/web_tests/external/wpt/webdriver/tests/support/image.py +++ b/third_party/blink/web_tests/external/wpt/webdriver/tests/support/image.py
@@ -1,17 +1,12 @@ -import base64 import math import struct - -import six +from base64 import decodebytes from tests.support.asserts import assert_png -def decodebytes(s): - return base64.decodebytes(six.ensure_binary(s)) - def png_dimensions(screenshot): assert_png(screenshot) - image = decodebytes(screenshot) + image = decodebytes(screenshot.encode()) width, height = struct.unpack(">LL", image[16:24]) return int(width), int(height)
diff --git a/third_party/blink/web_tests/external/wpt/webdriver/tests/support/merge_dictionaries.py b/third_party/blink/web_tests/external/wpt/webdriver/tests/support/merge_dictionaries.py index c13ab904..72f1cab 100644 --- a/third_party/blink/web_tests/external/wpt/webdriver/tests/support/merge_dictionaries.py +++ b/third_party/blink/web_tests/external/wpt/webdriver/tests/support/merge_dictionaries.py
@@ -1,5 +1,3 @@ -from six import iteritems - def merge_dictionaries(first, second): """Given two dictionaries, create a third that defines all specified key/value pairs. This merge_dictionaries is performed "deeply" on any nested @@ -7,7 +5,7 @@ an exception will be raised.""" result = dict(first) - for key, value in iteritems(second): + for key, value in second.items(): if key in result and result[key] != value: if isinstance(result[key], dict) and isinstance(value, dict): result[key] = merge_dictionaries(result[key], value)
diff --git a/third_party/blink/web_tests/external/wpt/webrtc-encoded-transform/idlharness.https.window-expected.txt b/third_party/blink/web_tests/external/wpt/webrtc-encoded-transform/idlharness.https.window-expected.txt index 308dd3c..7acdaa27 100644 --- a/third_party/blink/web_tests/external/wpt/webrtc-encoded-transform/idlharness.https.window-expected.txt +++ b/third_party/blink/web_tests/external/wpt/webrtc-encoded-transform/idlharness.https.window-expected.txt
@@ -1,9 +1,7 @@ This is a testharness.js-based test. -Found 56 tests; 39 PASS, 17 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 50 tests; 33 PASS, 17 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idl_test setup PASS idl_test validation -PASS Partial dictionary RTCConfiguration: original dictionary defined -PASS Partial dictionary RTCConfiguration: member names are unique PASS Partial interface RTCRtpSender: original interface defined PASS Partial interface RTCRtpSender: member names are unique PASS Partial interface RTCRtpReceiver: original interface defined @@ -48,13 +46,9 @@ FAIL RTCRtpScriptTransform interface: existence and properties of interface prototype object assert_own_property: self does not have own property "RTCRtpScriptTransform" expected property "RTCRtpScriptTransform" missing FAIL RTCRtpScriptTransform interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "RTCRtpScriptTransform" expected property "RTCRtpScriptTransform" missing FAIL RTCRtpScriptTransform interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "RTCRtpScriptTransform" expected property "RTCRtpScriptTransform" missing -PASS RTCRtpSender interface: operation createEncodedStreams() FAIL RTCRtpSender interface: attribute transform assert_true: The prototype object must have a property "transform" expected true got false -PASS RTCRtpSender interface: new RTCPeerConnection().addTransceiver('audio').sender must inherit property "createEncodedStreams()" with the proper type FAIL RTCRtpSender interface: new RTCPeerConnection().addTransceiver('audio').sender must inherit property "transform" with the proper type assert_inherits: property "transform" not found in prototype chain -PASS RTCRtpReceiver interface: operation createEncodedStreams() FAIL RTCRtpReceiver interface: attribute transform assert_true: The prototype object must have a property "transform" expected true got false -PASS RTCRtpReceiver interface: new RTCPeerConnection().addTransceiver('audio').receiver must inherit property "createEncodedStreams()" with the proper type FAIL RTCRtpReceiver interface: new RTCPeerConnection().addTransceiver('audio').receiver must inherit property "transform" with the proper type assert_inherits: property "transform" not found in prototype chain Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/fast/multicol/caret-range-outside-columns-mac-expected.txt b/third_party/blink/web_tests/fast/multicol/caret-range-outside-columns-mac-expected.txt new file mode 100644 index 0000000..bf65ac3 --- /dev/null +++ b/third_party/blink/web_tests/fast/multicol/caret-range-outside-columns-mac-expected.txt
@@ -0,0 +1,54 @@ +Test that hitting areas outside columns takes us to the right text content inside columns. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + +Above first column: +PASS document.caretRangeFromPoint(50,0).startOffset is 0 +PASS document.caretRangeFromPoint(150,0).startOffset is 0 +PASS document.caretRangeFromPoint(189,0).startOffset is 0 +Above second column: +PASS document.caretRangeFromPoint(190,0).startOffset is 12 +PASS document.caretRangeFromPoint(250,0).startOffset is 12 +PASS document.caretRangeFromPoint(289,0).startOffset is 12 +Above third column: +PASS document.caretRangeFromPoint(290,0).startOffset is 24 +PASS document.caretRangeFromPoint(350,0).startOffset is 24 +PASS document.caretRangeFromPoint(450,0).startOffset is 24 +Below first column: +FAIL document.caretRangeFromPoint(50,100).startOffset should be 11. Was 12. +FAIL document.caretRangeFromPoint(150,100).startOffset should be 11. Was 12. +FAIL document.caretRangeFromPoint(189,100).startOffset should be 11. Was 12. +Below second column: +FAIL document.caretRangeFromPoint(190,100).startOffset should be 23. Was 24. +FAIL document.caretRangeFromPoint(250,100).startOffset should be 23. Was 24. +FAIL document.caretRangeFromPoint(289,100).startOffset should be 23. Was 24. +Below third column: +PASS document.caretRangeFromPoint(290,100).startOffset is 35 +PASS document.caretRangeFromPoint(350,100).startOffset is 35 +PASS document.caretRangeFromPoint(389,100).startOffset is 35 +To the left of the first column: +PASS document.caretRangeFromPoint(0,10).startOffset is 0 +PASS document.caretRangeFromPoint(0,30).startOffset is 0 +PASS document.caretRangeFromPoint(0,50).startOffset is 4 +PASS document.caretRangeFromPoint(0,70).startOffset is 8 +FAIL document.caretRangeFromPoint(0,90).startOffset should be 11. Was 12. +To the right of the third column: +PASS document.caretRangeFromPoint(400,10).startOffset is 24 +PASS document.caretRangeFromPoint(400,30).startOffset is 27 +PASS document.caretRangeFromPoint(400,50).startOffset is 31 +PASS document.caretRangeFromPoint(400,70).startOffset is 35 +In the gap between the first and second columns: +PASS document.caretRangeFromPoint(180,20).startOffset is 3 +PASS document.caretRangeFromPoint(180,40).startOffset is 7 +PASS document.caretRangeFromPoint(180,60).startOffset is 11 +PASS document.caretRangeFromPoint(180,69).startOffset is 11 +In the gap between the second and third columns: +PASS document.caretRangeFromPoint(280,20).startOffset is 15 +PASS document.caretRangeFromPoint(280,40).startOffset is 19 +PASS document.caretRangeFromPoint(280,60).startOffset is 23 +PASS document.caretRangeFromPoint(280,69).startOffset is 23 +PASS successfullyParsed is true + +TEST COMPLETE + +xxx xxx xxx xxx xxx xxx xxx xxx xxx
diff --git a/third_party/blink/web_tests/fast/multicol/caret-range-outside-columns-mac.html b/third_party/blink/web_tests/fast/multicol/caret-range-outside-columns-mac.html new file mode 100644 index 0000000..d11d890 --- /dev/null +++ b/third_party/blink/web_tests/fast/multicol/caret-range-outside-columns-mac.html
@@ -0,0 +1,86 @@ +<!DOCTYPE html> +<style> + body { + margin:0; + } + + #mc { + -webkit-columns: 3; + -webkit-column-gap: 20px; + width: 280px; + margin:20px 100px; + font: 20px/1 Ahem; + } + + #log { + position: absolute; + top: 101px; + } +</style> +<div id="log"> + <p id="description"></p> + <div id="console"></div> +</div> +<div id="mc">xxx xxx xxx xxx xxx xxx xxx xxx xxx</div> +<script src="../../resources/js-test.js"></script> +<script> + if (window.internals) + internals.settings.setEditingBehavior('mac'); + + description("Test that hitting areas outside columns takes us to the right text content inside columns."); + + debug("Above first column:"); + shouldBe("document.caretRangeFromPoint(50,0).startOffset", "0"); + shouldBe("document.caretRangeFromPoint(150,0).startOffset", "0"); + shouldBe("document.caretRangeFromPoint(189,0).startOffset", "0"); + + debug("Above second column:"); + shouldBe("document.caretRangeFromPoint(190,0).startOffset", "12"); + shouldBe("document.caretRangeFromPoint(250,0).startOffset", "12"); + shouldBe("document.caretRangeFromPoint(289,0).startOffset", "12"); + + debug("Above third column:"); + shouldBe("document.caretRangeFromPoint(290,0).startOffset", "24"); + shouldBe("document.caretRangeFromPoint(350,0).startOffset", "24"); + shouldBe("document.caretRangeFromPoint(450,0).startOffset", "24"); + + debug("Below first column:"); + shouldBe("document.caretRangeFromPoint(50,100).startOffset", "11"); + shouldBe("document.caretRangeFromPoint(150,100).startOffset", "11"); + shouldBe("document.caretRangeFromPoint(189,100).startOffset", "11"); + + debug("Below second column:"); + shouldBe("document.caretRangeFromPoint(190,100).startOffset", "23"); + shouldBe("document.caretRangeFromPoint(250,100).startOffset", "23"); + shouldBe("document.caretRangeFromPoint(289,100).startOffset", "23"); + + debug("Below third column:"); + shouldBe("document.caretRangeFromPoint(290,100).startOffset", "35"); + shouldBe("document.caretRangeFromPoint(350,100).startOffset", "35"); + shouldBe("document.caretRangeFromPoint(389,100).startOffset", "35"); + + debug("To the left of the first column:"); + shouldBe("document.caretRangeFromPoint(0,10).startOffset", "0"); + shouldBe("document.caretRangeFromPoint(0,30).startOffset", "0"); + shouldBe("document.caretRangeFromPoint(0,50).startOffset", "4"); + shouldBe("document.caretRangeFromPoint(0,70).startOffset", "8"); + shouldBe("document.caretRangeFromPoint(0,90).startOffset", "11"); + + debug("To the right of the third column:"); + shouldBe("document.caretRangeFromPoint(400,10).startOffset", "24"); + shouldBe("document.caretRangeFromPoint(400,30).startOffset", "27"); + shouldBe("document.caretRangeFromPoint(400,50).startOffset", "31"); + shouldBe("document.caretRangeFromPoint(400,70).startOffset", "35"); + + debug("In the gap between the first and second columns:"); + shouldBe("document.caretRangeFromPoint(180,20).startOffset", "3"); + shouldBe("document.caretRangeFromPoint(180,40).startOffset", "7"); + shouldBe("document.caretRangeFromPoint(180,60).startOffset", "11"); + shouldBe("document.caretRangeFromPoint(180,69).startOffset", "11"); + + debug("In the gap between the second and third columns:"); + shouldBe("document.caretRangeFromPoint(280,20).startOffset", "15"); + shouldBe("document.caretRangeFromPoint(280,40).startOffset", "19"); + shouldBe("document.caretRangeFromPoint(280,60).startOffset", "23"); + shouldBe("document.caretRangeFromPoint(280,69).startOffset", "23"); +</script>
diff --git a/third_party/blink/web_tests/fast/multicol/caret-range-outside-columns-expected.txt b/third_party/blink/web_tests/fast/multicol/caret-range-outside-columns-win-expected.txt similarity index 100% rename from third_party/blink/web_tests/fast/multicol/caret-range-outside-columns-expected.txt rename to third_party/blink/web_tests/fast/multicol/caret-range-outside-columns-win-expected.txt
diff --git a/third_party/blink/web_tests/fast/multicol/caret-range-outside-columns.html b/third_party/blink/web_tests/fast/multicol/caret-range-outside-columns-win.html similarity index 100% rename from third_party/blink/web_tests/fast/multicol/caret-range-outside-columns.html rename to third_party/blink/web_tests/fast/multicol/caret-range-outside-columns-win.html
diff --git a/third_party/blink/web_tests/fast/multicol/hit-test-above-or-below-expected.txt b/third_party/blink/web_tests/fast/multicol/hit-test-above-or-below-expected.txt deleted file mode 100644 index be4fc6e..0000000 --- a/third_party/blink/web_tests/fast/multicol/hit-test-above-or-below-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -123 -abc -def -ghi -jkl -mno -Character at 150, 25 is 1 as expected. -Character at 350, 25 is d as expected. -Character at 550, 25 is j as expected. -Character at 750, 25 is m as expected. -Character at 150, 275 is d as expected. -Character at 350, 275 is j as expected. -Character at 550, 275 is m as expected. -Character at 750, 275 is null as expected. -Character at 150, 475 is d as expected. -Character at 350, 475 is j as expected. -Character at 550, 475 is m as expected. -Character at 750, 475 is null as expected. -
diff --git a/third_party/blink/web_tests/fast/multicol/hit-test-above-or-below.html b/third_party/blink/web_tests/fast/multicol/hit-test-above-or-below.html deleted file mode 100644 index 83766b6..0000000 --- a/third_party/blink/web_tests/fast/multicol/hit-test-above-or-below.html +++ /dev/null
@@ -1,51 +0,0 @@ -<body style="margin: 0"> -<div style="margin: 50px; background-color: lightblue; width: 800px; height: 200px; -webkit-column-width:185px; -webkit-column-gap:15px; column-width:185px; column-gap:15px; column-fill:auto; font-family: Ahem; font-size: 50px; line-height: 1; orphans:1; widows:1;"> - 123<div style="background-color: blue; height: 70px;"></div>abc<br>def<div style="background-color: blue; height: 60px;"></div>ghi<br>jkl<div style="background-color: blue; height: 110px;"></div>mno</div> -<pre id="console" style="display: none;"></pre> -<script> - if (window.internals) - internals.settings.setEditingBehavior("mac"); - function characterAtPoint(x, y) - { - var range = document.caretRangeFromPoint(x, y); - if (range.startContainer.nodeType !== Node.TEXT_NODE) - return null; - if (range.startOffset >= range.startContainer.length) - return null; - return range.startContainer.data[range.startOffset]; - } - - function log(message) - { - document.getElementById("console").appendChild(document.createTextNode(message + "\n")); - } - - function test(x, y, character) - { - var actualCharacter = characterAtPoint(x, y); - if (character === actualCharacter) - log ("Character at " + x + ", " + y + " is " + character + " as expected."); - else - log ("FAIL: Character at " + x + ", " + y + " is " + actualCharacter + ". Expected " + character + "."); - } - - if (window.testRunner) - testRunner.dumpAsText(); - - test(150, 25, "1"); - test(350, 25, "d"); - test(550, 25, "j"); - test(750, 25, "m"); - - test(150, 275, "d"); - test(350, 275, "j"); - test(550, 275, "m"); - test(750, 275, null); - - test(150, 475, "d"); - test(350, 475, "j"); - test(550, 475, "m"); - test(750, 475, null); - - document.getElementById("console").style.display = "block"; -</script>
diff --git a/third_party/blink/web_tests/flag-specific/composite-after-paint/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.txt b/third_party/blink/web_tests/flag-specific/composite-after-paint/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.txt new file mode 100644 index 0000000..248439b --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/composite-after-paint/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.txt
@@ -0,0 +1,19 @@ +{ + "layers": [ + { + "name": "Scrolling background of LayoutView #document", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [244, 104, 126, 46], + [203, 336, 126, 45], + [108, 84, 105, 102], + [355, 125, 104, 104], + [352, 398, 99, 98], + [90, 207, 98, 99] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/images/resources/size-failure.b186640109.webp b/third_party/blink/web_tests/images/resources/size-failure.b186640109.webp new file mode 100644 index 0000000..4410fb9 --- /dev/null +++ b/third_party/blink/web_tests/images/resources/size-failure.b186640109.webp Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/external/wpt/css/mediaqueries/test_media_queries-expected.txt b/third_party/blink/web_tests/platform/linux/external/wpt/css/mediaqueries/test_media_queries-expected.txt new file mode 100644 index 0000000..9eee6a5 --- /dev/null +++ b/third_party/blink/web_tests/platform/linux/external/wpt/css/mediaqueries/test_media_queries-expected.txt
@@ -0,0 +1,785 @@ +This is a testharness.js-based test. +Harness Error. harness_status.status = 1 , harness_status.message = Uncaught Error: assert_not_equals: overflow-block should be equivalent to not (overflow-block: none) got disallowed value false +Found 780 tests; 568 PASS, 212 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS subtest_1 +FAIL subtest_2 assert_true: expected true got false +PASS subtest_3 +PASS subtest_4 +PASS subtest_5 +PASS subtest_6 +PASS subtest_7 +PASS subtest_8 +FAIL subtest_9 assert_true: expected true got false +FAIL subtest_10 assert_true: expected true got false +PASS subtest_11 +PASS subtest_12 +PASS subtest_13 +PASS subtest_14 +PASS subtest_15 +PASS subtest_16 +PASS subtest_17 +PASS subtest_18 +PASS subtest_19 +PASS subtest_20 +PASS subtest_21 +PASS subtest_22 +PASS subtest_23 +PASS subtest_24 +PASS subtest_25 +PASS subtest_26 +PASS subtest_27 +PASS subtest_28 +PASS subtest_29 +PASS subtest_30 +PASS subtest_31 +PASS subtest_32 +FAIL subtest_33 assert_true: expected true got false +FAIL subtest_34 assert_true: expected true got false +FAIL subtest_35 assert_true: expected true got false +FAIL subtest_36 assert_true: expected true got false +FAIL subtest_37 assert_true: expected true got false +FAIL subtest_38 assert_true: expected true got false +FAIL subtest_39 assert_true: expected true got false +FAIL subtest_40 assert_true: expected true got false +PASS subtest_41 +PASS subtest_42 +PASS subtest_43 +PASS subtest_44 +PASS subtest_45 +PASS subtest_46 +PASS subtest_47 +FAIL subtest_48 assert_true: expected true got false +FAIL subtest_49 assert_true: expected true got false +FAIL subtest_50 assert_true: expected true got false +FAIL subtest_51 assert_true: expected true got false +FAIL subtest_52 assert_true: expected true got false +FAIL subtest_53 assert_true: expected true got false +FAIL subtest_54 assert_true: expected true got false +FAIL subtest_55 assert_true: expected true got false +PASS subtest_56 +PASS subtest_57 +PASS subtest_58 +PASS subtest_59 +PASS subtest_60 +PASS subtest_61 +PASS subtest_62 +PASS subtest_63 +FAIL subtest_64 assert_true: expected true got false +FAIL subtest_65 assert_true: expected true got false +FAIL subtest_66 assert_true: expected true got false +FAIL subtest_67 assert_true: expected true got false +FAIL subtest_68 assert_true: expected true got false +FAIL subtest_69 assert_true: expected true got false +FAIL subtest_70 assert_true: expected true got false +FAIL subtest_71 assert_true: expected true got false +PASS subtest_72 +PASS subtest_73 +PASS subtest_74 +PASS subtest_75 +PASS subtest_76 +PASS subtest_77 +PASS subtest_78 +FAIL subtest_79 assert_true: expected true got false +FAIL subtest_80 assert_true: expected true got false +FAIL subtest_81 assert_true: expected true got false +FAIL subtest_82 assert_true: expected true got false +FAIL subtest_83 assert_true: expected true got false +FAIL subtest_84 assert_true: expected true got false +FAIL subtest_85 assert_true: expected true got false +FAIL subtest_86 assert_true: expected true got false +PASS subtest_87 +PASS subtest_88 +PASS subtest_89 +PASS subtest_90 +PASS subtest_91 +PASS subtest_92 +PASS subtest_93 +PASS subtest_94 +FAIL subtest_95 assert_true: expected true got false +FAIL subtest_96 assert_true: expected true got false +FAIL subtest_97 assert_true: expected true got false +FAIL subtest_98 assert_true: expected true got false +FAIL subtest_99 assert_true: expected true got false +FAIL subtest_100 assert_true: expected true got false +FAIL subtest_101 assert_true: expected true got false +FAIL subtest_102 assert_true: expected true got false +PASS subtest_103 +PASS subtest_104 +PASS subtest_105 +PASS subtest_106 +PASS subtest_107 +PASS subtest_108 +PASS subtest_109 +PASS subtest_110 +PASS subtest_111 +PASS subtest_112 +PASS subtest_113 +PASS subtest_114 +PASS subtest_115 +PASS subtest_116 +PASS subtest_117 +PASS subtest_118 +PASS subtest_119 +PASS subtest_120 +PASS subtest_121 +PASS subtest_122 +PASS subtest_123 +PASS subtest_124 +PASS subtest_125 +PASS subtest_126 +PASS subtest_127 +FAIL subtest_128 assert_true: expected true got false +FAIL subtest_129 assert_true: expected true got false +FAIL subtest_130 assert_true: expected true got false +FAIL subtest_131 assert_true: expected true got false +FAIL subtest_132 assert_true: expected true got false +FAIL subtest_133 assert_true: expected true got false +FAIL subtest_134 assert_true: expected true got false +FAIL subtest_135 assert_true: expected true got false +PASS subtest_136 +PASS subtest_137 +PASS subtest_138 +PASS subtest_139 +PASS subtest_140 +PASS subtest_141 +PASS subtest_142 +FAIL subtest_143 assert_true: expected true got false +FAIL subtest_144 assert_true: expected true got false +FAIL subtest_145 assert_true: expected true got false +FAIL subtest_146 assert_true: expected true got false +FAIL subtest_147 assert_true: expected true got false +FAIL subtest_148 assert_true: expected true got false +FAIL subtest_149 assert_true: expected true got false +FAIL subtest_150 assert_true: expected true got false +PASS subtest_151 +PASS subtest_152 +PASS subtest_153 +PASS subtest_154 +PASS subtest_155 +PASS subtest_156 +PASS subtest_157 +PASS subtest_158 +FAIL subtest_159 assert_true: expected true got false +FAIL subtest_160 assert_true: expected true got false +FAIL subtest_161 assert_true: expected true got false +FAIL subtest_162 assert_true: expected true got false +FAIL subtest_163 assert_true: expected true got false +FAIL subtest_164 assert_true: expected true got false +FAIL subtest_165 assert_true: expected true got false +FAIL subtest_166 assert_true: expected true got false +PASS subtest_167 +PASS subtest_168 +PASS subtest_169 +PASS subtest_170 +PASS subtest_171 +PASS subtest_172 +PASS subtest_173 +FAIL subtest_174 assert_true: expected true got false +FAIL subtest_175 assert_true: expected true got false +FAIL subtest_176 assert_true: expected true got false +FAIL subtest_177 assert_true: expected true got false +FAIL subtest_178 assert_true: expected true got false +FAIL subtest_179 assert_true: expected true got false +FAIL subtest_180 assert_true: expected true got false +FAIL subtest_181 assert_true: expected true got false +PASS subtest_182 +PASS subtest_183 +PASS subtest_184 +PASS subtest_185 +PASS subtest_186 +PASS subtest_187 +PASS subtest_188 +PASS subtest_189 +FAIL subtest_190 assert_true: expected true got false +FAIL subtest_191 assert_true: expected true got false +FAIL subtest_192 assert_true: expected true got false +FAIL subtest_193 assert_true: expected true got false +FAIL subtest_194 assert_true: expected true got false +FAIL subtest_195 assert_true: expected true got false +FAIL subtest_196 assert_true: expected true got false +FAIL subtest_197 assert_true: expected true got false +PASS subtest_198 +PASS subtest_199 +PASS subtest_200 +PASS subtest_201 +PASS subtest_202 +PASS subtest_203 +PASS subtest_204 +PASS subtest_205 +PASS subtest_206 +PASS subtest_207 +PASS subtest_208 +PASS subtest_209 +PASS subtest_210 +PASS subtest_211 +PASS subtest_212 +PASS subtest_213 +PASS subtest_214 +PASS subtest_215 +PASS subtest_216 +PASS subtest_217 +PASS subtest_218 +PASS subtest_219 +PASS subtest_220 +PASS subtest_221 +PASS subtest_222 +FAIL subtest_223 assert_true: expected true got false +FAIL subtest_224 assert_true: expected true got false +FAIL subtest_225 assert_true: expected true got false +FAIL subtest_226 assert_true: expected true got false +FAIL subtest_227 assert_true: expected true got false +FAIL subtest_228 assert_true: expected true got false +FAIL subtest_229 assert_true: expected true got false +FAIL subtest_230 assert_true: expected true got false +PASS subtest_231 +PASS subtest_232 +PASS subtest_233 +PASS subtest_234 +PASS subtest_235 +PASS subtest_236 +PASS subtest_237 +FAIL subtest_238 assert_true: expected true got false +FAIL subtest_239 assert_true: expected true got false +FAIL subtest_240 assert_true: expected true got false +FAIL subtest_241 assert_true: expected true got false +FAIL subtest_242 assert_true: expected true got false +FAIL subtest_243 assert_true: expected true got false +FAIL subtest_244 assert_true: expected true got false +FAIL subtest_245 assert_true: expected true got false +PASS subtest_246 +PASS subtest_247 +PASS subtest_248 +PASS subtest_249 +PASS subtest_250 +PASS subtest_251 +PASS subtest_252 +PASS subtest_253 +FAIL subtest_254 assert_true: expected true got false +FAIL subtest_255 assert_true: expected true got false +FAIL subtest_256 assert_true: expected true got false +FAIL subtest_257 assert_true: expected true got false +FAIL subtest_258 assert_true: expected true got false +FAIL subtest_259 assert_true: expected true got false +FAIL subtest_260 assert_true: expected true got false +FAIL subtest_261 assert_true: expected true got false +PASS subtest_262 +PASS subtest_263 +PASS subtest_264 +PASS subtest_265 +PASS subtest_266 +PASS subtest_267 +PASS subtest_268 +FAIL subtest_269 assert_true: expected true got false +FAIL subtest_270 assert_true: expected true got false +FAIL subtest_271 assert_true: expected true got false +FAIL subtest_272 assert_true: expected true got false +FAIL subtest_273 assert_true: expected true got false +FAIL subtest_274 assert_true: expected true got false +FAIL subtest_275 assert_true: expected true got false +FAIL subtest_276 assert_true: expected true got false +PASS subtest_277 +PASS subtest_278 +PASS subtest_279 +PASS subtest_280 +PASS subtest_281 +PASS subtest_282 +PASS subtest_283 +PASS subtest_284 +FAIL subtest_285 assert_true: expected true got false +FAIL subtest_286 assert_true: expected true got false +FAIL subtest_287 assert_true: expected true got false +FAIL subtest_288 assert_true: expected true got false +FAIL subtest_289 assert_true: expected true got false +FAIL subtest_290 assert_true: expected true got false +FAIL subtest_291 assert_true: expected true got false +FAIL subtest_292 assert_true: expected true got false +PASS subtest_293 +PASS subtest_294 +PASS subtest_295 +PASS subtest_296 +PASS subtest_297 +PASS subtest_298 +PASS subtest_299 +PASS subtest_300 +PASS subtest_301 +PASS subtest_302 +PASS subtest_303 +PASS subtest_304 +PASS subtest_305 +PASS subtest_306 +PASS subtest_307 +PASS subtest_308 +PASS subtest_309 +PASS subtest_310 +PASS subtest_311 +PASS subtest_312 +PASS subtest_313 +PASS subtest_314 +PASS subtest_315 +PASS subtest_316 +PASS subtest_317 +FAIL subtest_318 assert_true: expected true got false +FAIL subtest_319 assert_true: expected true got false +FAIL subtest_320 assert_true: expected true got false +FAIL subtest_321 assert_true: expected true got false +FAIL subtest_322 assert_true: expected true got false +FAIL subtest_323 assert_true: expected true got false +FAIL subtest_324 assert_true: expected true got false +FAIL subtest_325 assert_true: expected true got false +PASS subtest_326 +PASS subtest_327 +PASS subtest_328 +PASS subtest_329 +PASS subtest_330 +PASS subtest_331 +PASS subtest_332 +FAIL subtest_333 assert_true: expected true got false +FAIL subtest_334 assert_true: expected true got false +FAIL subtest_335 assert_true: expected true got false +FAIL subtest_336 assert_true: expected true got false +FAIL subtest_337 assert_true: expected true got false +FAIL subtest_338 assert_true: expected true got false +FAIL subtest_339 assert_true: expected true got false +FAIL subtest_340 assert_true: expected true got false +PASS subtest_341 +PASS subtest_342 +PASS subtest_343 +PASS subtest_344 +PASS subtest_345 +PASS subtest_346 +PASS subtest_347 +PASS subtest_348 +FAIL subtest_349 assert_true: expected true got false +FAIL subtest_350 assert_true: expected true got false +FAIL subtest_351 assert_true: expected true got false +FAIL subtest_352 assert_true: expected true got false +FAIL subtest_353 assert_true: expected true got false +FAIL subtest_354 assert_true: expected true got false +FAIL subtest_355 assert_true: expected true got false +FAIL subtest_356 assert_true: expected true got false +PASS subtest_357 +PASS subtest_358 +PASS subtest_359 +PASS subtest_360 +PASS subtest_361 +PASS subtest_362 +PASS subtest_363 +FAIL subtest_364 assert_true: expected true got false +FAIL subtest_365 assert_true: expected true got false +FAIL subtest_366 assert_true: expected true got false +FAIL subtest_367 assert_true: expected true got false +FAIL subtest_368 assert_true: expected true got false +FAIL subtest_369 assert_true: expected true got false +FAIL subtest_370 assert_true: expected true got false +FAIL subtest_371 assert_true: expected true got false +PASS subtest_372 +PASS subtest_373 +PASS subtest_374 +PASS subtest_375 +PASS subtest_376 +PASS subtest_377 +PASS subtest_378 +PASS subtest_379 +FAIL subtest_380 assert_true: expected true got false +FAIL subtest_381 assert_true: expected true got false +FAIL subtest_382 assert_true: expected true got false +FAIL subtest_383 assert_true: expected true got false +FAIL subtest_384 assert_true: expected true got false +FAIL subtest_385 assert_true: expected true got false +FAIL subtest_386 assert_true: expected true got false +FAIL subtest_387 assert_true: expected true got false +PASS subtest_388 +PASS subtest_389 +PASS subtest_390 +PASS subtest_391 +PASS subtest_392 +PASS subtest_393 +PASS subtest_394 +PASS subtest_395 +FAIL subtest_396 assert_true: all and (width = 117px) should apply expected true got false +PASS subtest_397 +PASS subtest_398 +PASS subtest_399 +PASS subtest_400 +PASS subtest_401 +PASS subtest_402 +PASS subtest_403 +PASS subtest_404 +PASS subtest_405 +PASS subtest_406 +PASS subtest_407 +PASS subtest_408 +PASS subtest_409 +PASS subtest_410 +FAIL subtest_411 assert_true: (width <= 117px) should apply expected true got false +FAIL subtest_412 assert_true: (width >= 117px) should apply expected true got false +PASS subtest_413 +PASS subtest_414 +FAIL subtest_415 assert_true: (width < 118px) should apply expected true got false +FAIL subtest_416 assert_true: (width <= 118px) should apply expected true got false +PASS subtest_417 +PASS subtest_418 +FAIL subtest_419 assert_true: (width > 116px) should apply expected true got false +FAIL subtest_420 assert_true: (width >= 116px) should apply expected true got false +PASS subtest_421 +PASS subtest_422 +PASS subtest_423 +FAIL subtest_424 assert_true: all and (height = 76px) should apply expected true got false +PASS subtest_425 +PASS subtest_426 +PASS subtest_427 +PASS subtest_428 +PASS subtest_429 +PASS subtest_430 +PASS subtest_431 +PASS subtest_432 +PASS subtest_433 +PASS subtest_434 +PASS subtest_435 +PASS subtest_436 +PASS subtest_437 +PASS subtest_438 +FAIL subtest_439 assert_true: (height <= 76px) should apply expected true got false +FAIL subtest_440 assert_true: (height >= 76px) should apply expected true got false +PASS subtest_441 +PASS subtest_442 +FAIL subtest_443 assert_true: (height < 77px) should apply expected true got false +FAIL subtest_444 assert_true: (height <= 77px) should apply expected true got false +PASS subtest_445 +PASS subtest_446 +FAIL subtest_447 assert_true: (height > 75px) should apply expected true got false +FAIL subtest_448 assert_true: (height >= 75px) should apply expected true got false +PASS subtest_449 +PASS subtest_450 +PASS subtest_451 +FAIL subtest_452 assert_true: all and (device-width = 1280px) should apply expected true got false +PASS subtest_453 +PASS subtest_454 +PASS subtest_455 +PASS subtest_456 +PASS subtest_457 +PASS subtest_458 +PASS subtest_459 +PASS subtest_460 +PASS subtest_461 +PASS subtest_462 +PASS subtest_463 +PASS subtest_464 +PASS subtest_465 +PASS subtest_466 +FAIL subtest_467 assert_true: (device-width <= 1280px) should apply expected true got false +FAIL subtest_468 assert_true: (device-width >= 1280px) should apply expected true got false +PASS subtest_469 +PASS subtest_470 +FAIL subtest_471 assert_true: (device-width < 1281px) should apply expected true got false +FAIL subtest_472 assert_true: (device-width <= 1281px) should apply expected true got false +PASS subtest_473 +PASS subtest_474 +FAIL subtest_475 assert_true: (device-width > 1279px) should apply expected true got false +FAIL subtest_476 assert_true: (device-width >= 1279px) should apply expected true got false +PASS subtest_477 +PASS subtest_478 +PASS subtest_479 +FAIL subtest_480 assert_true: all and (device-height = 800px) should apply expected true got false +PASS subtest_481 +PASS subtest_482 +PASS subtest_483 +PASS subtest_484 +PASS subtest_485 +PASS subtest_486 +PASS subtest_487 +PASS subtest_488 +PASS subtest_489 +PASS subtest_490 +PASS subtest_491 +PASS subtest_492 +PASS subtest_493 +PASS subtest_494 +FAIL subtest_495 assert_true: (device-height <= 800px) should apply expected true got false +FAIL subtest_496 assert_true: (device-height >= 800px) should apply expected true got false +PASS subtest_497 +PASS subtest_498 +FAIL subtest_499 assert_true: (device-height < 801px) should apply expected true got false +FAIL subtest_500 assert_true: (device-height <= 801px) should apply expected true got false +PASS subtest_501 +PASS subtest_502 +FAIL subtest_503 assert_true: (device-height > 799px) should apply expected true got false +FAIL subtest_504 assert_true: (device-height >= 799px) should apply expected true got false +PASS subtest_505 +PASS subtest_506 +PASS subtest_507 +PASS subtest_508 +PASS subtest_509 +PASS subtest_510 +PASS subtest_511 +PASS subtest_512 +PASS subtest_513 +PASS subtest_514 +PASS subtest_515 +PASS subtest_516 +PASS subtest_517 +PASS subtest_518 +PASS subtest_519 +PASS subtest_520 +PASS subtest_521 +PASS subtest_522 +PASS subtest_523 +PASS subtest_524 +PASS subtest_525 +PASS subtest_526 +PASS subtest_527 +PASS subtest_528 +PASS subtest_529 +PASS subtest_530 +PASS subtest_531 +PASS subtest_532 +PASS subtest_533 +PASS subtest_534 +PASS subtest_535 +PASS subtest_536 +PASS subtest_537 +PASS subtest_538 +PASS subtest_539 +PASS subtest_540 +PASS subtest_541 +PASS subtest_542 +PASS subtest_543 +PASS subtest_544 +PASS subtest_545 +PASS subtest_546 +PASS subtest_547 +PASS subtest_548 +PASS subtest_549 +PASS subtest_550 +PASS subtest_551 +PASS subtest_552 +PASS subtest_553 +PASS subtest_554 +PASS subtest_555 +PASS subtest_556 +PASS subtest_557 +PASS subtest_558 +PASS subtest_559 +PASS subtest_560 +PASS subtest_561 +PASS subtest_562 +PASS subtest_563 +PASS subtest_564 +PASS subtest_565 +PASS subtest_566 +PASS subtest_567 +PASS subtest_568 +PASS subtest_569 +PASS subtest_570 +PASS subtest_571 +PASS subtest_572 +PASS subtest_573 +PASS subtest_574 +PASS subtest_575 +PASS subtest_576 +PASS subtest_577 +PASS subtest_578 +PASS subtest_579 +PASS subtest_580 +FAIL subtest_581 assert_true: expected true got false +FAIL subtest_582 assert_true: expected true got false +FAIL subtest_583 assert_true: expected true got false +FAIL subtest_584 assert_true: expected true got false +FAIL subtest_585 assert_true: expected true got false +FAIL subtest_586 assert_true: expected true got false +FAIL subtest_587 assert_true: expected true got false +FAIL subtest_588 assert_true: expected true got false +PASS subtest_589 +PASS subtest_590 +PASS subtest_591 +PASS subtest_592 +PASS subtest_593 +PASS subtest_594 +PASS subtest_595 +PASS subtest_596 +PASS subtest_597 +PASS subtest_598 +PASS subtest_599 +PASS subtest_600 +FAIL subtest_601 assert_true: expected true got false +FAIL subtest_602 assert_true: expected true got false +FAIL subtest_603 assert_true: expected true got false +FAIL subtest_604 assert_true: expected true got false +FAIL subtest_605 assert_true: expected true got false +FAIL subtest_606 assert_true: expected true got false +FAIL subtest_607 assert_true: expected true got false +FAIL subtest_608 assert_true: expected true got false +PASS subtest_609 +PASS subtest_610 +PASS subtest_611 +PASS subtest_612 +PASS subtest_613 +PASS subtest_614 +PASS subtest_615 +PASS subtest_616 +PASS monochrome_and_color +PASS find_depth +PASS subtest_617 +PASS subtest_618 +PASS subtest_619 +PASS subtest_620 +PASS subtest_621 +PASS subtest_622 +PASS subtest_623 +PASS subtest_624 +PASS subtest_625 +PASS subtest_626 +PASS subtest_627 +PASS subtest_628 +PASS subtest_629 +PASS subtest_630 +PASS subtest_631 +PASS subtest_632 +PASS subtest_633 +PASS subtest_634 +PASS subtest_635 +PASS subtest_636 +PASS subtest_637 +PASS subtest_638 +PASS subtest_639 +PASS subtest_640 +PASS subtest_641 +PASS subtest_642 +PASS subtest_643 +PASS subtest_644 +PASS subtest_645 +PASS subtest_646 +PASS subtest_647 +PASS subtest_648 +PASS subtest_649 +PASS subtest_650 +PASS subtest_651 +PASS subtest_652 +PASS subtest_653 +PASS subtest_654 +PASS subtest_655 +PASS subtest_656 +PASS subtest_657 +PASS subtest_658 +PASS subtest_659 +PASS subtest_660 +PASS subtest_661 +PASS subtest_662 +PASS subtest_663 +PASS subtest_664 +PASS subtest_665 +PASS subtest_666 +PASS subtest_667 +PASS subtest_668 +PASS subtest_669 +PASS subtest_670 +PASS subtest_671 +PASS subtest_672 +PASS subtest_673 +PASS subtest_674 +PASS subtest_675 +PASS subtest_676 +PASS subtest_677 +PASS subtest_678 +PASS subtest_679 +PASS subtest_680 +PASS subtest_681 +PASS subtest_682 +PASS subtest_683 +PASS subtest_684 +PASS subtest_685 +PASS subtest_686 +PASS subtest_687 +PASS subtest_688 +PASS subtest_689 +PASS subtest_690 +PASS subtest_691 +PASS subtest_692 +PASS subtest_693 +PASS subtest_694 +PASS subtest_695 +PASS subtest_696 +PASS subtest_697 +PASS subtest_698 +PASS subtest_699 +PASS find_resolution +PASS subtest_700 +PASS subtest_701 +PASS subtest_702 +PASS subtest_703 +PASS subtest_704 +PASS subtest_705 +PASS subtest_706 +PASS subtest_707 +PASS subtest_708 +PASS subtest_709 +PASS subtest_710 +PASS subtest_711 +PASS subtest_712 +PASS subtest_713 +PASS subtest_714 +PASS subtest_715 +PASS subtest_716 +PASS subtest_717 +PASS subtest_718 +PASS subtest_719 +PASS subtest_720 +PASS subtest_721 +PASS subtest_722 +PASS subtest_723 +PASS subtest_724 +PASS subtest_725 +PASS subtest_726 +PASS subtest_727 +PASS subtest_728 +PASS subtest_729 +PASS subtest_730 +PASS subtest_731 +PASS subtest_732 +PASS subtest_733 +PASS subtest_734 +PASS subtest_735 +PASS subtest_736 +PASS subtest_737 +PASS subtest_738 +PASS subtest_739 +PASS subtest_740 +PASS subtest_741 +PASS subtest_742 +PASS subtest_743 +PASS subtest_744 +PASS subtest_745 +PASS subtest_746 +PASS subtest_747 +PASS subtest_748 +PASS subtest_749 +PASS subtest_750 +PASS subtest_751 +PASS subtest_752 +PASS subtest_753 +PASS subtest_754 +PASS subtest_755 +PASS subtest_756 +PASS subtest_757 +PASS subtest_758 +PASS subtest_759 +PASS subtest_760 +PASS subtest_761 +PASS subtest_762 +PASS subtest_763 +PASS subtest_764 +PASS subtest_765 +PASS subtest_766 +PASS subtest_767 +PASS subtest_768 +PASS subtest_769 +PASS subtest_770 +PASS subtest_771 +FAIL subtest_772 assert_true: expected true got false +FAIL subtest_773 assert_true: expected true got false +FAIL subtest_774 assert_true: expected true got false +FAIL subtest_775 assert_true: expected true got false +FAIL subtest_776 assert_true: expected true got false +PASS subtest_777 +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.png b/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.png new file mode 100644 index 0000000..88b1a61 --- /dev/null +++ b/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.txt b/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.txt new file mode 100644 index 0000000..f219dbe --- /dev/null +++ b/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.txt
@@ -0,0 +1,19 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [244, 104, 126, 46], + [203, 336, 126, 45], + [108, 84, 105, 102], + [355, 125, 104, 104], + [352, 398, 99, 98], + [90, 207, 98, 99] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/paint/invalidation/svg/tabgroup-expected.png b/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/paint/invalidation/svg/tabgroup-expected.png new file mode 100644 index 0000000..da933c3a --- /dev/null +++ b/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/paint/invalidation/svg/tabgroup-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-5-expected.png b/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-5-expected.png new file mode 100644 index 0000000..c22a38a --- /dev/null +++ b/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-5-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/svg/wicd/test-scalable-background-image2-expected.png b/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/svg/wicd/test-scalable-background-image2-expected.png new file mode 100644 index 0000000..27a3e8d --- /dev/null +++ b/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/svg/wicd/test-scalable-background-image2-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/svg/zoom/page/zoom-mask-with-percentages-expected.png b/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/svg/zoom/page/zoom-mask-with-percentages-expected.png new file mode 100644 index 0000000..c717d95 --- /dev/null +++ b/third_party/blink/web_tests/platform/linux/virtual/layout_ng_svg_text/svg/zoom/page/zoom-mask-with-percentages-expected.png Binary files differ
diff --git "a/third_party/blink/web_tests/platform/mac-mac-arm11.0/external/wpt/html/dom/idlharness.https_exclude=\050Document_Window_HTML._\051-expected.txt" "b/third_party/blink/web_tests/platform/mac-mac-arm11.0/external/wpt/html/dom/idlharness.https_exclude=\050Document_Window_HTML._\051-expected.txt" new file mode 100644 index 0000000..35a7816 --- /dev/null +++ "b/third_party/blink/web_tests/platform/mac-mac-arm11.0/external/wpt/html/dom/idlharness.https_exclude=\050Document_Window_HTML._\051-expected.txt"
@@ -0,0 +1,1422 @@ +This is a testharness.js-based test. +Found 1418 tests; 1387 PASS, 31 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS idl_test setup +PASS idl_test validation +PASS Partial interface Document: original interface defined +PASS Partial interface Document: member names are unique +PASS Partial interface mixin DocumentOrShadowRoot: original interface mixin defined +PASS Partial interface mixin DocumentOrShadowRoot: member names are unique +PASS Partial interface mixin NavigatorID: original interface mixin defined +PASS Partial interface mixin NavigatorID: member names are unique +PASS Partial interface HTMLAnchorElement: original interface defined +PASS Partial interface HTMLAnchorElement: member names are unique +PASS Partial interface HTMLAreaElement: original interface defined +PASS Partial interface HTMLAreaElement: member names are unique +PASS Partial interface HTMLBodyElement: original interface defined +PASS Partial interface HTMLBodyElement: member names are unique +PASS Partial interface HTMLBRElement: original interface defined +PASS Partial interface HTMLBRElement: member names are unique +PASS Partial interface HTMLTableCaptionElement: original interface defined +PASS Partial interface HTMLTableCaptionElement: member names are unique +PASS Partial interface HTMLTableColElement: original interface defined +PASS Partial interface HTMLTableColElement: member names are unique +PASS Partial interface HTMLDivElement: original interface defined +PASS Partial interface HTMLDivElement: member names are unique +PASS Partial interface HTMLDListElement: original interface defined +PASS Partial interface HTMLDListElement: member names are unique +PASS Partial interface HTMLEmbedElement: original interface defined +PASS Partial interface HTMLEmbedElement: member names are unique +PASS Partial interface HTMLHeadingElement: original interface defined +PASS Partial interface HTMLHeadingElement: member names are unique +PASS Partial interface HTMLHRElement: original interface defined +PASS Partial interface HTMLHRElement: member names are unique +PASS Partial interface HTMLHtmlElement: original interface defined +PASS Partial interface HTMLHtmlElement: member names are unique +PASS Partial interface HTMLIFrameElement: original interface defined +PASS Partial interface HTMLIFrameElement: member names are unique +PASS Partial interface HTMLImageElement: original interface defined +PASS Partial interface HTMLImageElement: member names are unique +PASS Partial interface HTMLInputElement: original interface defined +PASS Partial interface HTMLInputElement: member names are unique +PASS Partial interface HTMLLegendElement: original interface defined +PASS Partial interface HTMLLegendElement: member names are unique +PASS Partial interface HTMLLIElement: original interface defined +PASS Partial interface HTMLLIElement: member names are unique +PASS Partial interface HTMLLinkElement: original interface defined +PASS Partial interface HTMLLinkElement: member names are unique +PASS Partial interface HTMLMenuElement: original interface defined +PASS Partial interface HTMLMenuElement: member names are unique +PASS Partial interface HTMLMetaElement: original interface defined +PASS Partial interface HTMLMetaElement: member names are unique +PASS Partial interface HTMLObjectElement: original interface defined +PASS Partial interface HTMLObjectElement: member names are unique +PASS Partial interface HTMLOListElement: original interface defined +PASS Partial interface HTMLOListElement: member names are unique +PASS Partial interface HTMLParagraphElement: original interface defined +PASS Partial interface HTMLParagraphElement: member names are unique +PASS Partial interface HTMLParamElement: original interface defined +PASS Partial interface HTMLParamElement: member names are unique +PASS Partial interface HTMLPreElement: original interface defined +PASS Partial interface HTMLPreElement: member names are unique +PASS Partial interface HTMLStyleElement: original interface defined +PASS Partial interface HTMLStyleElement: member names are unique +PASS Partial interface HTMLScriptElement: original interface defined +PASS Partial interface HTMLScriptElement: member names are unique +PASS Partial interface HTMLTableElement: original interface defined +PASS Partial interface HTMLTableElement: member names are unique +PASS Partial interface HTMLTableSectionElement: original interface defined +PASS Partial interface HTMLTableSectionElement: member names are unique +PASS Partial interface HTMLTableCellElement: original interface defined +PASS Partial interface HTMLTableCellElement: member names are unique +PASS Partial interface HTMLTableRowElement: original interface defined +PASS Partial interface HTMLTableRowElement: member names are unique +PASS Partial interface HTMLUListElement: original interface defined +PASS Partial interface HTMLUListElement: member names are unique +PASS Partial interface Document[2]: original interface defined +PASS Partial interface Document[2]: member names are unique +PASS Partial interface Window: original interface defined +PASS Partial interface Window: member names are unique +PASS Partial interface Document[3]: member names are unique +PASS Partial interface mixin DocumentOrShadowRoot[2]: member names are unique +PASS Partial interface UIEvent: member names are unique +PASS Partial interface MouseEvent: member names are unique +PASS Partial interface UIEvent[2]: member names are unique +PASS Partial dictionary UIEventInit: member names are unique +PASS Document includes GlobalEventHandlers: member names are unique +PASS Document includes DocumentAndElementEventHandlers: member names are unique +PASS HTMLElement includes GlobalEventHandlers: member names are unique +PASS HTMLElement includes DocumentAndElementEventHandlers: member names are unique +PASS HTMLElement includes ElementContentEditable: member names are unique +PASS HTMLElement includes HTMLOrSVGElement: member names are unique +PASS HTMLLinkElement includes LinkStyle: member names are unique +PASS HTMLStyleElement includes LinkStyle: member names are unique +PASS HTMLBodyElement includes WindowEventHandlers: member names are unique +PASS HTMLAnchorElement includes HTMLHyperlinkElementUtils: member names are unique +PASS HTMLAreaElement includes HTMLHyperlinkElementUtils: member names are unique +PASS CanvasRenderingContext2D includes CanvasState: member names are unique +PASS CanvasRenderingContext2D includes CanvasTransform: member names are unique +PASS CanvasRenderingContext2D includes CanvasCompositing: member names are unique +PASS CanvasRenderingContext2D includes CanvasImageSmoothing: member names are unique +PASS CanvasRenderingContext2D includes CanvasFillStrokeStyles: member names are unique +PASS CanvasRenderingContext2D includes CanvasShadowStyles: member names are unique +PASS CanvasRenderingContext2D includes CanvasFilters: member names are unique +PASS CanvasRenderingContext2D includes CanvasRect: member names are unique +PASS CanvasRenderingContext2D includes CanvasDrawPath: member names are unique +PASS CanvasRenderingContext2D includes CanvasUserInterface: member names are unique +PASS CanvasRenderingContext2D includes CanvasText: member names are unique +PASS CanvasRenderingContext2D includes CanvasDrawImage: member names are unique +PASS CanvasRenderingContext2D includes CanvasImageData: member names are unique +PASS CanvasRenderingContext2D includes CanvasPathDrawingStyles: member names are unique +PASS CanvasRenderingContext2D includes CanvasTextDrawingStyles: member names are unique +PASS CanvasRenderingContext2D includes CanvasPath: member names are unique +PASS Path2D includes CanvasPath: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasState: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasTransform: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasCompositing: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasImageSmoothing: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasFillStrokeStyles: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasShadowStyles: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasFilters: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasRect: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasDrawPath: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasText: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasDrawImage: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasImageData: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasPathDrawingStyles: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasTextDrawingStyles: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasPath: member names are unique +PASS ElementInternals includes ARIAMixin: member names are unique +PASS Window includes GlobalEventHandlers: member names are unique +PASS Window includes WindowEventHandlers: member names are unique +PASS Window includes WindowOrWorkerGlobalScope: member names are unique +PASS WorkerGlobalScope includes WindowOrWorkerGlobalScope: member names are unique +PASS Navigator includes NavigatorID: member names are unique +PASS Navigator includes NavigatorLanguage: member names are unique +PASS Navigator includes NavigatorOnLine: member names are unique +PASS Navigator includes NavigatorContentUtils: member names are unique +PASS Navigator includes NavigatorCookies: member names are unique +PASS Navigator includes NavigatorPlugins: member names are unique +PASS Navigator includes NavigatorConcurrentHardware: member names are unique +PASS Window includes AnimationFrameProvider: member names are unique +PASS DedicatedWorkerGlobalScope includes AnimationFrameProvider: member names are unique +PASS Worker includes AbstractWorker: member names are unique +PASS SharedWorker includes AbstractWorker: member names are unique +PASS WorkerNavigator includes NavigatorID: member names are unique +PASS WorkerNavigator includes NavigatorLanguage: member names are unique +PASS WorkerNavigator includes NavigatorOnLine: member names are unique +PASS WorkerNavigator includes NavigatorConcurrentHardware: member names are unique +PASS Window includes WindowSessionStorage: member names are unique +PASS Window includes WindowLocalStorage: member names are unique +PASS HTMLFrameSetElement includes WindowEventHandlers: member names are unique +PASS Element includes ARIAMixin: member names are unique +PASS SVGElement includes GlobalEventHandlers: member names are unique +PASS SVGElement includes DocumentAndElementEventHandlers: member names are unique +PASS SVGElement includes SVGElementInstance: member names are unique +PASS SVGElement includes HTMLOrSVGElement: member names are unique +PASS SVGGraphicsElement includes SVGTests: member names are unique +PASS SVGSVGElement includes SVGFitToViewBox: member names are unique +PASS SVGSVGElement includes WindowEventHandlers: member names are unique +PASS SVGImageElement includes SVGURIReference: member names are unique +PASS SVGScriptElement includes SVGURIReference: member names are unique +PASS HTMLElement includes ElementCSSInlineStyle: member names are unique +PASS SVGElement includes ElementCSSInlineStyle: member names are unique +PASS Document includes NonElementParentNode: member names are unique +PASS DocumentFragment includes NonElementParentNode: member names are unique +PASS Document includes DocumentOrShadowRoot: member names are unique +PASS ShadowRoot includes DocumentOrShadowRoot: member names are unique +PASS Document includes ParentNode: member names are unique +PASS DocumentFragment includes ParentNode: member names are unique +PASS Element includes ParentNode: member names are unique +PASS Element includes NonDocumentTypeChildNode: member names are unique +PASS Element includes ChildNode: member names are unique +PASS Element includes Slottable: member names are unique +PASS Document includes XPathEvaluatorBase: member names are unique +PASS RadioNodeList interface: existence and properties of interface object +PASS RadioNodeList interface object length +PASS RadioNodeList interface object name +PASS RadioNodeList interface: existence and properties of interface prototype object +PASS RadioNodeList interface: existence and properties of interface prototype object's "constructor" property +PASS RadioNodeList interface: existence and properties of interface prototype object's @@unscopables property +PASS RadioNodeList interface: attribute value +PASS DOMStringList interface: existence and properties of interface object +PASS DOMStringList interface object length +PASS DOMStringList interface object name +PASS DOMStringList interface: existence and properties of interface prototype object +PASS DOMStringList interface: existence and properties of interface prototype object's "constructor" property +PASS DOMStringList interface: existence and properties of interface prototype object's @@unscopables property +PASS DOMStringList interface: attribute length +PASS DOMStringList interface: operation item(unsigned long) +PASS DOMStringList interface: operation contains(DOMString) +PASS DOMStringList must be primary interface of location.ancestorOrigins +PASS Stringification of location.ancestorOrigins +PASS DOMStringList interface: location.ancestorOrigins must inherit property "length" with the proper type +PASS DOMStringList interface: location.ancestorOrigins must inherit property "item(unsigned long)" with the proper type +PASS DOMStringList interface: calling item(unsigned long) on location.ancestorOrigins with too few arguments must throw TypeError +PASS DOMStringList interface: location.ancestorOrigins must inherit property "contains(DOMString)" with the proper type +PASS DOMStringList interface: calling contains(DOMString) on location.ancestorOrigins with too few arguments must throw TypeError +PASS DOMStringMap interface: existence and properties of interface object +PASS DOMStringMap interface object length +PASS DOMStringMap interface object name +PASS DOMStringMap interface: existence and properties of interface prototype object +PASS DOMStringMap interface: existence and properties of interface prototype object's "constructor" property +PASS DOMStringMap interface: existence and properties of interface prototype object's @@unscopables property +PASS DOMStringMap must be primary interface of document.head.dataset +PASS Stringification of document.head.dataset +PASS MediaError interface: existence and properties of interface object +PASS MediaError interface object length +PASS MediaError interface object name +PASS MediaError interface: existence and properties of interface prototype object +PASS MediaError interface: existence and properties of interface prototype object's "constructor" property +PASS MediaError interface: existence and properties of interface prototype object's @@unscopables property +PASS MediaError interface: constant MEDIA_ERR_ABORTED on interface object +PASS MediaError interface: constant MEDIA_ERR_ABORTED on interface prototype object +PASS MediaError interface: constant MEDIA_ERR_NETWORK on interface object +PASS MediaError interface: constant MEDIA_ERR_NETWORK on interface prototype object +PASS MediaError interface: constant MEDIA_ERR_DECODE on interface object +PASS MediaError interface: constant MEDIA_ERR_DECODE on interface prototype object +PASS MediaError interface: constant MEDIA_ERR_SRC_NOT_SUPPORTED on interface object +PASS MediaError interface: constant MEDIA_ERR_SRC_NOT_SUPPORTED on interface prototype object +PASS MediaError interface: attribute code +PASS MediaError interface: attribute message +PASS MediaError must be primary interface of errorVideo.error +PASS Stringification of errorVideo.error +PASS MediaError interface: errorVideo.error must inherit property "MEDIA_ERR_ABORTED" with the proper type +PASS MediaError interface: errorVideo.error must inherit property "MEDIA_ERR_NETWORK" with the proper type +PASS MediaError interface: errorVideo.error must inherit property "MEDIA_ERR_DECODE" with the proper type +PASS MediaError interface: errorVideo.error must inherit property "MEDIA_ERR_SRC_NOT_SUPPORTED" with the proper type +PASS MediaError interface: errorVideo.error must inherit property "code" with the proper type +PASS MediaError interface: errorVideo.error must inherit property "message" with the proper type +PASS AudioTrackList interface: existence and properties of interface object +PASS AudioTrackList interface object length +PASS AudioTrackList interface object name +PASS AudioTrackList interface: existence and properties of interface prototype object +PASS AudioTrackList interface: existence and properties of interface prototype object's "constructor" property +PASS AudioTrackList interface: existence and properties of interface prototype object's @@unscopables property +PASS AudioTrackList interface: attribute length +PASS AudioTrackList interface: operation getTrackById(DOMString) +PASS AudioTrackList interface: attribute onchange +PASS AudioTrackList interface: attribute onaddtrack +PASS AudioTrackList interface: attribute onremovetrack +PASS AudioTrack interface: existence and properties of interface object +PASS AudioTrack interface object length +PASS AudioTrack interface object name +PASS AudioTrack interface: existence and properties of interface prototype object +PASS AudioTrack interface: existence and properties of interface prototype object's "constructor" property +PASS AudioTrack interface: existence and properties of interface prototype object's @@unscopables property +PASS AudioTrack interface: attribute id +PASS AudioTrack interface: attribute kind +PASS AudioTrack interface: attribute label +PASS AudioTrack interface: attribute language +PASS AudioTrack interface: attribute enabled +PASS VideoTrackList interface: existence and properties of interface object +PASS VideoTrackList interface object length +PASS VideoTrackList interface object name +PASS VideoTrackList interface: existence and properties of interface prototype object +PASS VideoTrackList interface: existence and properties of interface prototype object's "constructor" property +PASS VideoTrackList interface: existence and properties of interface prototype object's @@unscopables property +PASS VideoTrackList interface: attribute length +PASS VideoTrackList interface: operation getTrackById(DOMString) +PASS VideoTrackList interface: attribute selectedIndex +PASS VideoTrackList interface: attribute onchange +PASS VideoTrackList interface: attribute onaddtrack +PASS VideoTrackList interface: attribute onremovetrack +PASS VideoTrack interface: existence and properties of interface object +PASS VideoTrack interface object length +PASS VideoTrack interface object name +PASS VideoTrack interface: existence and properties of interface prototype object +PASS VideoTrack interface: existence and properties of interface prototype object's "constructor" property +PASS VideoTrack interface: existence and properties of interface prototype object's @@unscopables property +PASS VideoTrack interface: attribute id +PASS VideoTrack interface: attribute kind +PASS VideoTrack interface: attribute label +PASS VideoTrack interface: attribute language +PASS VideoTrack interface: attribute selected +PASS TextTrackList interface: existence and properties of interface object +PASS TextTrackList interface object length +PASS TextTrackList interface object name +PASS TextTrackList interface: existence and properties of interface prototype object +PASS TextTrackList interface: existence and properties of interface prototype object's "constructor" property +PASS TextTrackList interface: existence and properties of interface prototype object's @@unscopables property +PASS TextTrackList interface: attribute length +PASS TextTrackList interface: operation getTrackById(DOMString) +PASS TextTrackList interface: attribute onchange +PASS TextTrackList interface: attribute onaddtrack +PASS TextTrackList interface: attribute onremovetrack +PASS TextTrackList must be primary interface of document.createElement("video").textTracks +PASS Stringification of document.createElement("video").textTracks +PASS TextTrackList interface: document.createElement("video").textTracks must inherit property "length" with the proper type +PASS TextTrackList interface: document.createElement("video").textTracks must inherit property "getTrackById(DOMString)" with the proper type +PASS TextTrackList interface: calling getTrackById(DOMString) on document.createElement("video").textTracks with too few arguments must throw TypeError +PASS TextTrackList interface: document.createElement("video").textTracks must inherit property "onchange" with the proper type +PASS TextTrackList interface: document.createElement("video").textTracks must inherit property "onaddtrack" with the proper type +PASS TextTrackList interface: document.createElement("video").textTracks must inherit property "onremovetrack" with the proper type +PASS TextTrack interface: existence and properties of interface object +PASS TextTrack interface object length +PASS TextTrack interface object name +PASS TextTrack interface: existence and properties of interface prototype object +PASS TextTrack interface: existence and properties of interface prototype object's "constructor" property +PASS TextTrack interface: existence and properties of interface prototype object's @@unscopables property +PASS TextTrack interface: attribute kind +PASS TextTrack interface: attribute label +PASS TextTrack interface: attribute language +PASS TextTrack interface: attribute id +FAIL TextTrack interface: attribute inBandMetadataTrackDispatchType assert_true: The prototype object must have a property "inBandMetadataTrackDispatchType" expected true got false +PASS TextTrack interface: attribute mode +PASS TextTrack interface: attribute cues +PASS TextTrack interface: attribute activeCues +PASS TextTrack interface: operation addCue(TextTrackCue) +PASS TextTrack interface: operation removeCue(TextTrackCue) +PASS TextTrack interface: attribute oncuechange +PASS TextTrack must be primary interface of document.createElement("track").track +PASS Stringification of document.createElement("track").track +PASS TextTrack interface: document.createElement("track").track must inherit property "kind" with the proper type +PASS TextTrack interface: document.createElement("track").track must inherit property "label" with the proper type +PASS TextTrack interface: document.createElement("track").track must inherit property "language" with the proper type +PASS TextTrack interface: document.createElement("track").track must inherit property "id" with the proper type +FAIL TextTrack interface: document.createElement("track").track must inherit property "inBandMetadataTrackDispatchType" with the proper type assert_inherits: property "inBandMetadataTrackDispatchType" not found in prototype chain +PASS TextTrack interface: document.createElement("track").track must inherit property "mode" with the proper type +PASS TextTrack interface: document.createElement("track").track must inherit property "cues" with the proper type +PASS TextTrack interface: document.createElement("track").track must inherit property "activeCues" with the proper type +PASS TextTrack interface: document.createElement("track").track must inherit property "addCue(TextTrackCue)" with the proper type +PASS TextTrack interface: calling addCue(TextTrackCue) on document.createElement("track").track with too few arguments must throw TypeError +PASS TextTrack interface: document.createElement("track").track must inherit property "removeCue(TextTrackCue)" with the proper type +PASS TextTrack interface: calling removeCue(TextTrackCue) on document.createElement("track").track with too few arguments must throw TypeError +PASS TextTrack interface: document.createElement("track").track must inherit property "oncuechange" with the proper type +PASS TextTrackCueList interface: existence and properties of interface object +PASS TextTrackCueList interface object length +PASS TextTrackCueList interface object name +PASS TextTrackCueList interface: existence and properties of interface prototype object +PASS TextTrackCueList interface: existence and properties of interface prototype object's "constructor" property +PASS TextTrackCueList interface: existence and properties of interface prototype object's @@unscopables property +PASS TextTrackCueList interface: attribute length +PASS TextTrackCueList interface: operation getCueById(DOMString) +PASS TextTrackCueList must be primary interface of document.createElement("video").addTextTrack("subtitles").cues +PASS Stringification of document.createElement("video").addTextTrack("subtitles").cues +PASS TextTrackCueList interface: document.createElement("video").addTextTrack("subtitles").cues must inherit property "length" with the proper type +PASS TextTrackCueList interface: document.createElement("video").addTextTrack("subtitles").cues must inherit property "getCueById(DOMString)" with the proper type +PASS TextTrackCueList interface: calling getCueById(DOMString) on document.createElement("video").addTextTrack("subtitles").cues with too few arguments must throw TypeError +PASS TextTrackCue interface: existence and properties of interface object +PASS TextTrackCue interface object length +PASS TextTrackCue interface object name +PASS TextTrackCue interface: existence and properties of interface prototype object +PASS TextTrackCue interface: existence and properties of interface prototype object's "constructor" property +PASS TextTrackCue interface: existence and properties of interface prototype object's @@unscopables property +PASS TextTrackCue interface: attribute track +PASS TextTrackCue interface: attribute id +PASS TextTrackCue interface: attribute startTime +PASS TextTrackCue interface: attribute endTime +PASS TextTrackCue interface: attribute pauseOnExit +PASS TextTrackCue interface: attribute onenter +PASS TextTrackCue interface: attribute onexit +PASS TimeRanges interface: existence and properties of interface object +PASS TimeRanges interface object length +PASS TimeRanges interface object name +PASS TimeRanges interface: existence and properties of interface prototype object +PASS TimeRanges interface: existence and properties of interface prototype object's "constructor" property +PASS TimeRanges interface: existence and properties of interface prototype object's @@unscopables property +PASS TimeRanges interface: attribute length +PASS TimeRanges interface: operation start(unsigned long) +PASS TimeRanges interface: operation end(unsigned long) +PASS TimeRanges must be primary interface of document.createElement("video").buffered +PASS Stringification of document.createElement("video").buffered +PASS TimeRanges interface: document.createElement("video").buffered must inherit property "length" with the proper type +PASS TimeRanges interface: document.createElement("video").buffered must inherit property "start(unsigned long)" with the proper type +PASS TimeRanges interface: calling start(unsigned long) on document.createElement("video").buffered with too few arguments must throw TypeError +PASS TimeRanges interface: document.createElement("video").buffered must inherit property "end(unsigned long)" with the proper type +PASS TimeRanges interface: calling end(unsigned long) on document.createElement("video").buffered with too few arguments must throw TypeError +PASS TrackEvent interface: existence and properties of interface object +PASS TrackEvent interface object length +PASS TrackEvent interface object name +PASS TrackEvent interface: existence and properties of interface prototype object +PASS TrackEvent interface: existence and properties of interface prototype object's "constructor" property +PASS TrackEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS TrackEvent interface: attribute track +PASS TrackEvent must be primary interface of new TrackEvent("addtrack", {track:document.createElement("track").track}) +PASS Stringification of new TrackEvent("addtrack", {track:document.createElement("track").track}) +PASS TrackEvent interface: new TrackEvent("addtrack", {track:document.createElement("track").track}) must inherit property "track" with the proper type +PASS ValidityState interface: existence and properties of interface object +PASS ValidityState interface object length +PASS ValidityState interface object name +PASS ValidityState interface: existence and properties of interface prototype object +PASS ValidityState interface: existence and properties of interface prototype object's "constructor" property +PASS ValidityState interface: existence and properties of interface prototype object's @@unscopables property +PASS ValidityState interface: attribute valueMissing +PASS ValidityState interface: attribute typeMismatch +PASS ValidityState interface: attribute patternMismatch +PASS ValidityState interface: attribute tooLong +PASS ValidityState interface: attribute tooShort +PASS ValidityState interface: attribute rangeUnderflow +PASS ValidityState interface: attribute rangeOverflow +PASS ValidityState interface: attribute stepMismatch +PASS ValidityState interface: attribute badInput +PASS ValidityState interface: attribute customError +PASS ValidityState interface: attribute valid +PASS ValidityState must be primary interface of document.createElement("input").validity +PASS Stringification of document.createElement("input").validity +PASS ValidityState interface: document.createElement("input").validity must inherit property "valueMissing" with the proper type +PASS ValidityState interface: document.createElement("input").validity must inherit property "typeMismatch" with the proper type +PASS ValidityState interface: document.createElement("input").validity must inherit property "patternMismatch" with the proper type +PASS ValidityState interface: document.createElement("input").validity must inherit property "tooLong" with the proper type +PASS ValidityState interface: document.createElement("input").validity must inherit property "tooShort" with the proper type +PASS ValidityState interface: document.createElement("input").validity must inherit property "rangeUnderflow" with the proper type +PASS ValidityState interface: document.createElement("input").validity must inherit property "rangeOverflow" with the proper type +PASS ValidityState interface: document.createElement("input").validity must inherit property "stepMismatch" with the proper type +PASS ValidityState interface: document.createElement("input").validity must inherit property "badInput" with the proper type +PASS ValidityState interface: document.createElement("input").validity must inherit property "customError" with the proper type +PASS ValidityState interface: document.createElement("input").validity must inherit property "valid" with the proper type +PASS SubmitEvent interface: existence and properties of interface object +PASS SubmitEvent interface object length +PASS SubmitEvent interface object name +PASS SubmitEvent interface: existence and properties of interface prototype object +PASS SubmitEvent interface: existence and properties of interface prototype object's "constructor" property +PASS SubmitEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS SubmitEvent interface: attribute submitter +PASS FormDataEvent interface: existence and properties of interface object +PASS FormDataEvent interface object length +PASS FormDataEvent interface object name +PASS FormDataEvent interface: existence and properties of interface prototype object +PASS FormDataEvent interface: existence and properties of interface prototype object's "constructor" property +PASS FormDataEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS FormDataEvent interface: attribute formData +PASS FormDataEvent must be primary interface of new FormDataEvent("formdata", { formData: new FormData() }) +PASS Stringification of new FormDataEvent("formdata", { formData: new FormData() }) +PASS FormDataEvent interface: new FormDataEvent("formdata", { formData: new FormData() }) must inherit property "formData" with the proper type +PASS CanvasRenderingContext2D interface: existence and properties of interface object +PASS CanvasRenderingContext2D interface object length +PASS CanvasRenderingContext2D interface object name +PASS CanvasRenderingContext2D interface: existence and properties of interface prototype object +PASS CanvasRenderingContext2D interface: existence and properties of interface prototype object's "constructor" property +PASS CanvasRenderingContext2D interface: existence and properties of interface prototype object's @@unscopables property +PASS CanvasRenderingContext2D interface: attribute canvas +PASS CanvasRenderingContext2D interface: operation getContextAttributes() +PASS CanvasRenderingContext2D interface: operation save() +PASS CanvasRenderingContext2D interface: operation restore() +PASS CanvasRenderingContext2D interface: operation scale(unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation rotate(unrestricted double) +PASS CanvasRenderingContext2D interface: operation translate(unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation transform(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation getTransform() +PASS CanvasRenderingContext2D interface: operation setTransform(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation setTransform(optional DOMMatrix2DInit) +PASS CanvasRenderingContext2D interface: operation resetTransform() +PASS CanvasRenderingContext2D interface: attribute globalAlpha +PASS CanvasRenderingContext2D interface: attribute globalCompositeOperation +PASS CanvasRenderingContext2D interface: attribute imageSmoothingEnabled +PASS CanvasRenderingContext2D interface: attribute imageSmoothingQuality +PASS CanvasRenderingContext2D interface: attribute strokeStyle +PASS CanvasRenderingContext2D interface: attribute fillStyle +PASS CanvasRenderingContext2D interface: operation createLinearGradient(double, double, double, double) +PASS CanvasRenderingContext2D interface: operation createRadialGradient(double, double, double, double, double, double) +PASS CanvasRenderingContext2D interface: operation createPattern(CanvasImageSource, DOMString) +PASS CanvasRenderingContext2D interface: attribute shadowOffsetX +PASS CanvasRenderingContext2D interface: attribute shadowOffsetY +PASS CanvasRenderingContext2D interface: attribute shadowBlur +PASS CanvasRenderingContext2D interface: attribute shadowColor +PASS CanvasRenderingContext2D interface: attribute filter +PASS CanvasRenderingContext2D interface: operation clearRect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation fillRect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation strokeRect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation beginPath() +PASS CanvasRenderingContext2D interface: operation fill(optional CanvasFillRule) +PASS CanvasRenderingContext2D interface: operation fill(Path2D, optional CanvasFillRule) +PASS CanvasRenderingContext2D interface: operation stroke() +PASS CanvasRenderingContext2D interface: operation stroke(Path2D) +PASS CanvasRenderingContext2D interface: operation clip(optional CanvasFillRule) +PASS CanvasRenderingContext2D interface: operation clip(Path2D, optional CanvasFillRule) +PASS CanvasRenderingContext2D interface: operation isPointInPath(unrestricted double, unrestricted double, optional CanvasFillRule) +PASS CanvasRenderingContext2D interface: operation isPointInPath(Path2D, unrestricted double, unrestricted double, optional CanvasFillRule) +PASS CanvasRenderingContext2D interface: operation isPointInStroke(unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation isPointInStroke(Path2D, unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation drawFocusIfNeeded(Element) +PASS CanvasRenderingContext2D interface: operation drawFocusIfNeeded(Path2D, Element) +PASS CanvasRenderingContext2D interface: operation scrollPathIntoView() +PASS CanvasRenderingContext2D interface: operation scrollPathIntoView(Path2D) +PASS CanvasRenderingContext2D interface: operation fillText(DOMString, unrestricted double, unrestricted double, optional unrestricted double) +PASS CanvasRenderingContext2D interface: operation strokeText(DOMString, unrestricted double, unrestricted double, optional unrestricted double) +PASS CanvasRenderingContext2D interface: operation measureText(DOMString) +PASS CanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation createImageData(long, long) +PASS CanvasRenderingContext2D interface: operation createImageData(ImageData) +PASS CanvasRenderingContext2D interface: operation getImageData(long, long, long, long) +PASS CanvasRenderingContext2D interface: operation putImageData(ImageData, long, long) +PASS CanvasRenderingContext2D interface: operation putImageData(ImageData, long, long, long, long, long, long) +PASS CanvasRenderingContext2D interface: attribute lineWidth +PASS CanvasRenderingContext2D interface: attribute lineCap +PASS CanvasRenderingContext2D interface: attribute lineJoin +PASS CanvasRenderingContext2D interface: attribute miterLimit +PASS CanvasRenderingContext2D interface: operation setLineDash(sequence<unrestricted double>) +PASS CanvasRenderingContext2D interface: operation getLineDash() +PASS CanvasRenderingContext2D interface: attribute lineDashOffset +PASS CanvasRenderingContext2D interface: attribute font +PASS CanvasRenderingContext2D interface: attribute textAlign +PASS CanvasRenderingContext2D interface: attribute textBaseline +PASS CanvasRenderingContext2D interface: attribute direction +PASS CanvasRenderingContext2D interface: operation closePath() +PASS CanvasRenderingContext2D interface: operation moveTo(unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation lineTo(unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation quadraticCurveTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation bezierCurveTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation arcTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation rect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS CanvasRenderingContext2D interface: operation arc(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean) +PASS CanvasRenderingContext2D interface: operation ellipse(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean) +PASS CanvasRenderingContext2D must be primary interface of document.createElement("canvas").getContext("2d") +PASS Stringification of document.createElement("canvas").getContext("2d") +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "canvas" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getContextAttributes()" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "save()" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "restore()" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "scale(unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling scale(unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "rotate(unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling rotate(unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "translate(unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling translate(unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "transform(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling transform(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getTransform()" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "setTransform(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling setTransform(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "setTransform(optional DOMMatrix2DInit)" with the proper type +PASS CanvasRenderingContext2D interface: calling setTransform(optional DOMMatrix2DInit) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "resetTransform()" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "globalAlpha" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "globalCompositeOperation" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "imageSmoothingEnabled" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "imageSmoothingQuality" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "strokeStyle" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "fillStyle" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "createLinearGradient(double, double, double, double)" with the proper type +PASS CanvasRenderingContext2D interface: calling createLinearGradient(double, double, double, double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "createRadialGradient(double, double, double, double, double, double)" with the proper type +PASS CanvasRenderingContext2D interface: calling createRadialGradient(double, double, double, double, double, double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "createPattern(CanvasImageSource, DOMString)" with the proper type +PASS CanvasRenderingContext2D interface: calling createPattern(CanvasImageSource, DOMString) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "shadowOffsetX" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "shadowOffsetY" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "shadowBlur" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "shadowColor" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "filter" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "clearRect(unrestricted double, unrestricted double, unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling clearRect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "fillRect(unrestricted double, unrestricted double, unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling fillRect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "strokeRect(unrestricted double, unrestricted double, unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling strokeRect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "beginPath()" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "fill(optional CanvasFillRule)" with the proper type +PASS CanvasRenderingContext2D interface: calling fill(optional CanvasFillRule) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "fill(Path2D, optional CanvasFillRule)" with the proper type +PASS CanvasRenderingContext2D interface: calling fill(Path2D, optional CanvasFillRule) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "stroke()" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "stroke(Path2D)" with the proper type +PASS CanvasRenderingContext2D interface: calling stroke(Path2D) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "clip(optional CanvasFillRule)" with the proper type +PASS CanvasRenderingContext2D interface: calling clip(optional CanvasFillRule) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "clip(Path2D, optional CanvasFillRule)" with the proper type +PASS CanvasRenderingContext2D interface: calling clip(Path2D, optional CanvasFillRule) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "isPointInPath(unrestricted double, unrestricted double, optional CanvasFillRule)" with the proper type +PASS CanvasRenderingContext2D interface: calling isPointInPath(unrestricted double, unrestricted double, optional CanvasFillRule) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "isPointInPath(Path2D, unrestricted double, unrestricted double, optional CanvasFillRule)" with the proper type +PASS CanvasRenderingContext2D interface: calling isPointInPath(Path2D, unrestricted double, unrestricted double, optional CanvasFillRule) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "isPointInStroke(unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling isPointInStroke(unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "isPointInStroke(Path2D, unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling isPointInStroke(Path2D, unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "drawFocusIfNeeded(Element)" with the proper type +PASS CanvasRenderingContext2D interface: calling drawFocusIfNeeded(Element) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "drawFocusIfNeeded(Path2D, Element)" with the proper type +PASS CanvasRenderingContext2D interface: calling drawFocusIfNeeded(Path2D, Element) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "scrollPathIntoView()" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "scrollPathIntoView(Path2D)" with the proper type +PASS CanvasRenderingContext2D interface: calling scrollPathIntoView(Path2D) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "fillText(DOMString, unrestricted double, unrestricted double, optional unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling fillText(DOMString, unrestricted double, unrestricted double, optional unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "strokeText(DOMString, unrestricted double, unrestricted double, optional unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling strokeText(DOMString, unrestricted double, unrestricted double, optional unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "measureText(DOMString)" with the proper type +PASS CanvasRenderingContext2D interface: calling measureText(DOMString) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "drawImage(CanvasImageSource, unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling drawImage(CanvasImageSource, unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "createImageData(long, long)" with the proper type +PASS CanvasRenderingContext2D interface: calling createImageData(long, long) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "createImageData(ImageData)" with the proper type +PASS CanvasRenderingContext2D interface: calling createImageData(ImageData) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getImageData(long, long, long, long)" with the proper type +PASS CanvasRenderingContext2D interface: calling getImageData(long, long, long, long) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "putImageData(ImageData, long, long)" with the proper type +PASS CanvasRenderingContext2D interface: calling putImageData(ImageData, long, long) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "putImageData(ImageData, long, long, long, long, long, long)" with the proper type +PASS CanvasRenderingContext2D interface: calling putImageData(ImageData, long, long, long, long, long, long) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "lineWidth" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "lineCap" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "lineJoin" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "miterLimit" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "setLineDash(sequence<unrestricted double>)" with the proper type +PASS CanvasRenderingContext2D interface: calling setLineDash(sequence<unrestricted double>) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getLineDash()" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "lineDashOffset" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "font" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "textAlign" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "textBaseline" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "direction" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "closePath()" with the proper type +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "moveTo(unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling moveTo(unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "lineTo(unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling lineTo(unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "quadraticCurveTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling quadraticCurveTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "bezierCurveTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling bezierCurveTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "arcTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling arcTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "rect(unrestricted double, unrestricted double, unrestricted double, unrestricted double)" with the proper type +PASS CanvasRenderingContext2D interface: calling rect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "arc(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean)" with the proper type +PASS CanvasRenderingContext2D interface: calling arc(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "ellipse(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean)" with the proper type +PASS CanvasRenderingContext2D interface: calling ellipse(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError +PASS CanvasGradient interface: existence and properties of interface object +PASS CanvasGradient interface object length +PASS CanvasGradient interface object name +PASS CanvasGradient interface: existence and properties of interface prototype object +PASS CanvasGradient interface: existence and properties of interface prototype object's "constructor" property +PASS CanvasGradient interface: existence and properties of interface prototype object's @@unscopables property +PASS CanvasGradient interface: operation addColorStop(double, DOMString) +PASS CanvasPattern interface: existence and properties of interface object +PASS CanvasPattern interface object length +PASS CanvasPattern interface object name +PASS CanvasPattern interface: existence and properties of interface prototype object +PASS CanvasPattern interface: existence and properties of interface prototype object's "constructor" property +PASS CanvasPattern interface: existence and properties of interface prototype object's @@unscopables property +PASS CanvasPattern interface: operation setTransform(optional DOMMatrix2DInit) +PASS TextMetrics interface: existence and properties of interface object +PASS TextMetrics interface object length +PASS TextMetrics interface object name +PASS TextMetrics interface: existence and properties of interface prototype object +PASS TextMetrics interface: existence and properties of interface prototype object's "constructor" property +PASS TextMetrics interface: existence and properties of interface prototype object's @@unscopables property +PASS TextMetrics interface: attribute width +PASS TextMetrics interface: attribute actualBoundingBoxLeft +PASS TextMetrics interface: attribute actualBoundingBoxRight +PASS TextMetrics interface: attribute fontBoundingBoxAscent +PASS TextMetrics interface: attribute fontBoundingBoxDescent +PASS TextMetrics interface: attribute actualBoundingBoxAscent +PASS TextMetrics interface: attribute actualBoundingBoxDescent +PASS TextMetrics interface: attribute emHeightAscent +PASS TextMetrics interface: attribute emHeightDescent +FAIL TextMetrics interface: attribute hangingBaseline assert_true: The prototype object must have a property "hangingBaseline" expected true got false +FAIL TextMetrics interface: attribute alphabeticBaseline assert_true: The prototype object must have a property "alphabeticBaseline" expected true got false +FAIL TextMetrics interface: attribute ideographicBaseline assert_true: The prototype object must have a property "ideographicBaseline" expected true got false +PASS ImageData interface: existence and properties of interface object +PASS ImageData interface object length +PASS ImageData interface object name +PASS ImageData interface: existence and properties of interface prototype object +PASS ImageData interface: existence and properties of interface prototype object's "constructor" property +PASS ImageData interface: existence and properties of interface prototype object's @@unscopables property +PASS ImageData interface: attribute width +PASS ImageData interface: attribute height +PASS ImageData interface: attribute data +PASS ImageData must be primary interface of new ImageData(10, 10) +PASS Stringification of new ImageData(10, 10) +PASS ImageData interface: new ImageData(10, 10) must inherit property "width" with the proper type +PASS ImageData interface: new ImageData(10, 10) must inherit property "height" with the proper type +FAIL ImageData interface: new ImageData(10, 10) must inherit property "data" with the proper type assert_inherits: property "data" found on object expected in prototype chain +PASS Path2D interface: existence and properties of interface object +PASS Path2D interface object length +PASS Path2D interface object name +PASS Path2D interface: existence and properties of interface prototype object +PASS Path2D interface: existence and properties of interface prototype object's "constructor" property +PASS Path2D interface: existence and properties of interface prototype object's @@unscopables property +PASS Path2D interface: operation addPath(Path2D, optional DOMMatrix2DInit) +PASS Path2D interface: operation closePath() +PASS Path2D interface: operation moveTo(unrestricted double, unrestricted double) +PASS Path2D interface: operation lineTo(unrestricted double, unrestricted double) +PASS Path2D interface: operation quadraticCurveTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS Path2D interface: operation bezierCurveTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS Path2D interface: operation arcTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS Path2D interface: operation rect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS Path2D interface: operation arc(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean) +PASS Path2D interface: operation ellipse(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean) +PASS ImageBitmapRenderingContext interface: existence and properties of interface object +PASS ImageBitmapRenderingContext interface object length +PASS ImageBitmapRenderingContext interface object name +PASS ImageBitmapRenderingContext interface: existence and properties of interface prototype object +PASS ImageBitmapRenderingContext interface: existence and properties of interface prototype object's "constructor" property +PASS ImageBitmapRenderingContext interface: existence and properties of interface prototype object's @@unscopables property +PASS ImageBitmapRenderingContext interface: attribute canvas +PASS ImageBitmapRenderingContext interface: operation transferFromImageBitmap(ImageBitmap?) +PASS OffscreenCanvas interface: existence and properties of interface object +PASS OffscreenCanvas interface object length +PASS OffscreenCanvas interface object name +PASS OffscreenCanvas interface: existence and properties of interface prototype object +PASS OffscreenCanvas interface: existence and properties of interface prototype object's "constructor" property +PASS OffscreenCanvas interface: existence and properties of interface prototype object's @@unscopables property +PASS OffscreenCanvas interface: attribute width +PASS OffscreenCanvas interface: attribute height +PASS OffscreenCanvas interface: operation getContext(OffscreenRenderingContextId, optional any) +PASS OffscreenCanvas interface: operation transferToImageBitmap() +PASS OffscreenCanvas interface: operation convertToBlob(optional ImageEncodeOptions) +PASS OffscreenCanvasRenderingContext2D interface: existence and properties of interface object +PASS OffscreenCanvasRenderingContext2D interface object length +PASS OffscreenCanvasRenderingContext2D interface object name +PASS OffscreenCanvasRenderingContext2D interface: existence and properties of interface prototype object +PASS OffscreenCanvasRenderingContext2D interface: existence and properties of interface prototype object's "constructor" property +PASS OffscreenCanvasRenderingContext2D interface: existence and properties of interface prototype object's @@unscopables property +PASS OffscreenCanvasRenderingContext2D interface: operation commit() +PASS OffscreenCanvasRenderingContext2D interface: attribute canvas +PASS OffscreenCanvasRenderingContext2D interface: operation save() +PASS OffscreenCanvasRenderingContext2D interface: operation restore() +PASS OffscreenCanvasRenderingContext2D interface: operation scale(unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation rotate(unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation translate(unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation transform(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation getTransform() +PASS OffscreenCanvasRenderingContext2D interface: operation setTransform(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation setTransform(optional DOMMatrix2DInit) +PASS OffscreenCanvasRenderingContext2D interface: operation resetTransform() +PASS OffscreenCanvasRenderingContext2D interface: attribute globalAlpha +PASS OffscreenCanvasRenderingContext2D interface: attribute globalCompositeOperation +PASS OffscreenCanvasRenderingContext2D interface: attribute imageSmoothingEnabled +PASS OffscreenCanvasRenderingContext2D interface: attribute imageSmoothingQuality +PASS OffscreenCanvasRenderingContext2D interface: attribute strokeStyle +PASS OffscreenCanvasRenderingContext2D interface: attribute fillStyle +PASS OffscreenCanvasRenderingContext2D interface: operation createLinearGradient(double, double, double, double) +PASS OffscreenCanvasRenderingContext2D interface: operation createRadialGradient(double, double, double, double, double, double) +PASS OffscreenCanvasRenderingContext2D interface: operation createPattern(CanvasImageSource, DOMString) +PASS OffscreenCanvasRenderingContext2D interface: attribute shadowOffsetX +PASS OffscreenCanvasRenderingContext2D interface: attribute shadowOffsetY +PASS OffscreenCanvasRenderingContext2D interface: attribute shadowBlur +PASS OffscreenCanvasRenderingContext2D interface: attribute shadowColor +PASS OffscreenCanvasRenderingContext2D interface: attribute filter +PASS OffscreenCanvasRenderingContext2D interface: operation clearRect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation fillRect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation strokeRect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation beginPath() +PASS OffscreenCanvasRenderingContext2D interface: operation fill(optional CanvasFillRule) +PASS OffscreenCanvasRenderingContext2D interface: operation fill(Path2D, optional CanvasFillRule) +PASS OffscreenCanvasRenderingContext2D interface: operation stroke() +PASS OffscreenCanvasRenderingContext2D interface: operation stroke(Path2D) +PASS OffscreenCanvasRenderingContext2D interface: operation clip(optional CanvasFillRule) +PASS OffscreenCanvasRenderingContext2D interface: operation clip(Path2D, optional CanvasFillRule) +PASS OffscreenCanvasRenderingContext2D interface: operation isPointInPath(unrestricted double, unrestricted double, optional CanvasFillRule) +PASS OffscreenCanvasRenderingContext2D interface: operation isPointInPath(Path2D, unrestricted double, unrestricted double, optional CanvasFillRule) +PASS OffscreenCanvasRenderingContext2D interface: operation isPointInStroke(unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation isPointInStroke(Path2D, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation fillText(DOMString, unrestricted double, unrestricted double, optional unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation strokeText(DOMString, unrestricted double, unrestricted double, optional unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation measureText(DOMString) +PASS OffscreenCanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation createImageData(long, long) +PASS OffscreenCanvasRenderingContext2D interface: operation createImageData(ImageData) +PASS OffscreenCanvasRenderingContext2D interface: operation getImageData(long, long, long, long) +PASS OffscreenCanvasRenderingContext2D interface: operation putImageData(ImageData, long, long) +PASS OffscreenCanvasRenderingContext2D interface: operation putImageData(ImageData, long, long, long, long, long, long) +PASS OffscreenCanvasRenderingContext2D interface: attribute lineWidth +PASS OffscreenCanvasRenderingContext2D interface: attribute lineCap +PASS OffscreenCanvasRenderingContext2D interface: attribute lineJoin +PASS OffscreenCanvasRenderingContext2D interface: attribute miterLimit +PASS OffscreenCanvasRenderingContext2D interface: operation setLineDash(sequence<unrestricted double>) +PASS OffscreenCanvasRenderingContext2D interface: operation getLineDash() +PASS OffscreenCanvasRenderingContext2D interface: attribute lineDashOffset +PASS OffscreenCanvasRenderingContext2D interface: attribute font +PASS OffscreenCanvasRenderingContext2D interface: attribute textAlign +PASS OffscreenCanvasRenderingContext2D interface: attribute textBaseline +PASS OffscreenCanvasRenderingContext2D interface: attribute direction +PASS OffscreenCanvasRenderingContext2D interface: operation closePath() +PASS OffscreenCanvasRenderingContext2D interface: operation moveTo(unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation lineTo(unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation quadraticCurveTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation bezierCurveTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation arcTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation rect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation arc(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean) +PASS OffscreenCanvasRenderingContext2D interface: operation ellipse(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean) +PASS CustomElementRegistry interface: existence and properties of interface object +PASS CustomElementRegistry interface object length +PASS CustomElementRegistry interface object name +PASS CustomElementRegistry interface: existence and properties of interface prototype object +PASS CustomElementRegistry interface: existence and properties of interface prototype object's "constructor" property +PASS CustomElementRegistry interface: existence and properties of interface prototype object's @@unscopables property +PASS CustomElementRegistry interface: operation define(DOMString, CustomElementConstructor, optional ElementDefinitionOptions) +PASS CustomElementRegistry interface: operation get(DOMString) +PASS CustomElementRegistry interface: operation whenDefined(DOMString) +PASS CustomElementRegistry interface: operation upgrade(Node) +PASS ElementInternals interface: existence and properties of interface object +PASS ElementInternals interface object length +PASS ElementInternals interface object name +PASS ElementInternals interface: existence and properties of interface prototype object +PASS ElementInternals interface: existence and properties of interface prototype object's "constructor" property +PASS ElementInternals interface: existence and properties of interface prototype object's @@unscopables property +PASS ElementInternals interface: attribute shadowRoot +PASS ElementInternals interface: operation setFormValue((File or USVString or FormData)?, optional (File or USVString or FormData)?) +PASS ElementInternals interface: attribute form +FAIL ElementInternals interface: operation setValidity(optional ValidityStateFlags, optional DOMString, optional HTMLElement) assert_equals: property has wrong .length expected 0 but got 1 +PASS ElementInternals interface: attribute willValidate +PASS ElementInternals interface: attribute validity +PASS ElementInternals interface: attribute validationMessage +PASS ElementInternals interface: operation checkValidity() +PASS ElementInternals interface: operation reportValidity() +PASS ElementInternals interface: attribute labels +PASS DataTransfer interface: existence and properties of interface object +PASS DataTransfer interface object length +PASS DataTransfer interface object name +PASS DataTransfer interface: existence and properties of interface prototype object +PASS DataTransfer interface: existence and properties of interface prototype object's "constructor" property +PASS DataTransfer interface: existence and properties of interface prototype object's @@unscopables property +PASS DataTransfer interface: attribute dropEffect +PASS DataTransfer interface: attribute effectAllowed +PASS DataTransfer interface: attribute items +PASS DataTransfer interface: operation setDragImage(Element, long, long) +PASS DataTransfer interface: attribute types +PASS DataTransfer interface: operation getData(DOMString) +PASS DataTransfer interface: operation setData(DOMString, DOMString) +PASS DataTransfer interface: operation clearData(optional DOMString) +PASS DataTransfer interface: attribute files +PASS DataTransferItemList interface: existence and properties of interface object +PASS DataTransferItemList interface object length +PASS DataTransferItemList interface object name +PASS DataTransferItemList interface: existence and properties of interface prototype object +PASS DataTransferItemList interface: existence and properties of interface prototype object's "constructor" property +PASS DataTransferItemList interface: existence and properties of interface prototype object's @@unscopables property +PASS DataTransferItemList interface: attribute length +PASS DataTransferItemList interface: operation add(DOMString, DOMString) +PASS DataTransferItemList interface: operation add(File) +PASS DataTransferItemList interface: operation remove(unsigned long) +PASS DataTransferItemList interface: operation clear() +PASS DataTransferItem interface: existence and properties of interface object +PASS DataTransferItem interface object length +PASS DataTransferItem interface object name +PASS DataTransferItem interface: existence and properties of interface prototype object +PASS DataTransferItem interface: existence and properties of interface prototype object's "constructor" property +PASS DataTransferItem interface: existence and properties of interface prototype object's @@unscopables property +PASS DataTransferItem interface: attribute kind +PASS DataTransferItem interface: attribute type +PASS DataTransferItem interface: operation getAsString(FunctionStringCallback?) +PASS DataTransferItem interface: operation getAsFile() +PASS DragEvent interface: existence and properties of interface object +PASS DragEvent interface object length +PASS DragEvent interface object name +PASS DragEvent interface: existence and properties of interface prototype object +PASS DragEvent interface: existence and properties of interface prototype object's "constructor" property +PASS DragEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS DragEvent interface: attribute dataTransfer +PASS BarProp interface: existence and properties of interface object +PASS BarProp interface object length +PASS BarProp interface object name +PASS BarProp interface: existence and properties of interface prototype object +PASS BarProp interface: existence and properties of interface prototype object's "constructor" property +PASS BarProp interface: existence and properties of interface prototype object's @@unscopables property +PASS BarProp interface: attribute visible +PASS History interface: existence and properties of interface object +PASS History interface object length +PASS History interface object name +PASS History interface: existence and properties of interface prototype object +PASS History interface: existence and properties of interface prototype object's "constructor" property +PASS History interface: existence and properties of interface prototype object's @@unscopables property +PASS History interface: attribute length +PASS History interface: attribute scrollRestoration +PASS History interface: attribute state +PASS History interface: operation go(optional long) +PASS History interface: operation back() +PASS History interface: operation forward() +PASS History interface: operation pushState(any, DOMString, optional USVString?) +PASS History interface: operation replaceState(any, DOMString, optional USVString?) +PASS History must be primary interface of window.history +PASS Stringification of window.history +PASS History interface: window.history must inherit property "length" with the proper type +PASS History interface: window.history must inherit property "scrollRestoration" with the proper type +PASS History interface: window.history must inherit property "state" with the proper type +PASS History interface: window.history must inherit property "go(optional long)" with the proper type +PASS History interface: calling go(optional long) on window.history with too few arguments must throw TypeError +PASS History interface: window.history must inherit property "back()" with the proper type +PASS History interface: window.history must inherit property "forward()" with the proper type +PASS History interface: window.history must inherit property "pushState(any, DOMString, optional USVString?)" with the proper type +PASS History interface: calling pushState(any, DOMString, optional USVString?) on window.history with too few arguments must throw TypeError +PASS History interface: window.history must inherit property "replaceState(any, DOMString, optional USVString?)" with the proper type +PASS History interface: calling replaceState(any, DOMString, optional USVString?) on window.history with too few arguments must throw TypeError +PASS Location interface: existence and properties of interface object +PASS Location interface object length +PASS Location interface object name +PASS Location interface: existence and properties of interface prototype object +PASS Location interface: existence and properties of interface prototype object's "constructor" property +PASS Location interface: existence and properties of interface prototype object's @@unscopables property +FAIL Location interface: stringifier assert_own_property: interface prototype object missing non-static operation expected property "toString" missing +PASS Location must be primary interface of window.location +PASS Stringification of window.location +PASS Location interface: window.location must have own property "href" +PASS Location interface: window.location must have own property "origin" +PASS Location interface: window.location must have own property "protocol" +PASS Location interface: window.location must have own property "host" +PASS Location interface: window.location must have own property "hostname" +PASS Location interface: window.location must have own property "port" +PASS Location interface: window.location must have own property "pathname" +PASS Location interface: window.location must have own property "search" +PASS Location interface: window.location must have own property "hash" +PASS Location interface: window.location must have own property "assign" +PASS Location interface: calling assign(USVString) on window.location with too few arguments must throw TypeError +PASS Location interface: window.location must have own property "replace" +PASS Location interface: calling replace(USVString) on window.location with too few arguments must throw TypeError +PASS Location interface: window.location must have own property "reload" +PASS Location interface: window.location must have own property "ancestorOrigins" +PASS PopStateEvent interface: existence and properties of interface object +PASS PopStateEvent interface object length +PASS PopStateEvent interface object name +PASS PopStateEvent interface: existence and properties of interface prototype object +PASS PopStateEvent interface: existence and properties of interface prototype object's "constructor" property +PASS PopStateEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS PopStateEvent interface: attribute state +PASS PopStateEvent must be primary interface of new PopStateEvent("popstate", { data: {} }) +PASS Stringification of new PopStateEvent("popstate", { data: {} }) +PASS PopStateEvent interface: new PopStateEvent("popstate", { data: {} }) must inherit property "state" with the proper type +PASS HashChangeEvent interface: existence and properties of interface object +PASS HashChangeEvent interface object length +PASS HashChangeEvent interface object name +PASS HashChangeEvent interface: existence and properties of interface prototype object +PASS HashChangeEvent interface: existence and properties of interface prototype object's "constructor" property +PASS HashChangeEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS HashChangeEvent interface: attribute oldURL +PASS HashChangeEvent interface: attribute newURL +PASS PageTransitionEvent interface: existence and properties of interface object +PASS PageTransitionEvent interface object length +PASS PageTransitionEvent interface object name +PASS PageTransitionEvent interface: existence and properties of interface prototype object +PASS PageTransitionEvent interface: existence and properties of interface prototype object's "constructor" property +PASS PageTransitionEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS PageTransitionEvent interface: attribute persisted +PASS BeforeUnloadEvent interface: existence and properties of interface object +PASS BeforeUnloadEvent interface object length +PASS BeforeUnloadEvent interface object name +PASS BeforeUnloadEvent interface: existence and properties of interface prototype object +PASS BeforeUnloadEvent interface: existence and properties of interface prototype object's "constructor" property +PASS BeforeUnloadEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS BeforeUnloadEvent interface: attribute returnValue +PASS ErrorEvent interface: existence and properties of interface object +PASS ErrorEvent interface object length +PASS ErrorEvent interface object name +PASS ErrorEvent interface: existence and properties of interface prototype object +PASS ErrorEvent interface: existence and properties of interface prototype object's "constructor" property +PASS ErrorEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS ErrorEvent interface: attribute message +PASS ErrorEvent interface: attribute filename +PASS ErrorEvent interface: attribute lineno +PASS ErrorEvent interface: attribute colno +PASS ErrorEvent interface: attribute error +PASS PromiseRejectionEvent interface: existence and properties of interface object +PASS PromiseRejectionEvent interface object length +PASS PromiseRejectionEvent interface object name +PASS PromiseRejectionEvent interface: existence and properties of interface prototype object +PASS PromiseRejectionEvent interface: existence and properties of interface prototype object's "constructor" property +PASS PromiseRejectionEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS PromiseRejectionEvent interface: attribute promise +PASS PromiseRejectionEvent interface: attribute reason +PASS DOMParser interface: existence and properties of interface object +PASS DOMParser interface object length +PASS DOMParser interface object name +PASS DOMParser interface: existence and properties of interface prototype object +PASS DOMParser interface: existence and properties of interface prototype object's "constructor" property +PASS DOMParser interface: existence and properties of interface prototype object's @@unscopables property +PASS DOMParser interface: operation parseFromString(DOMString, DOMParserSupportedType) +PASS DOMParser must be primary interface of new DOMParser() +PASS Stringification of new DOMParser() +PASS DOMParser interface: new DOMParser() must inherit property "parseFromString(DOMString, DOMParserSupportedType)" with the proper type +PASS DOMParser interface: calling parseFromString(DOMString, DOMParserSupportedType) on new DOMParser() with too few arguments must throw TypeError +PASS Navigator interface: existence and properties of interface object +PASS Navigator interface object length +PASS Navigator interface object name +PASS Navigator interface: existence and properties of interface prototype object +PASS Navigator interface: existence and properties of interface prototype object's "constructor" property +PASS Navigator interface: existence and properties of interface prototype object's @@unscopables property +PASS Navigator interface: attribute appCodeName +PASS Navigator interface: attribute appName +PASS Navigator interface: attribute appVersion +PASS Navigator interface: attribute platform +PASS Navigator interface: attribute product +PASS Navigator interface: attribute productSub +PASS Navigator interface: attribute userAgent +PASS Navigator interface: attribute vendor +PASS Navigator interface: attribute vendorSub +FAIL Navigator interface: operation taintEnabled() assert_own_property: interface prototype object missing non-static operation expected property "taintEnabled" missing +FAIL Navigator interface: attribute oscpu assert_true: The prototype object must have a property "oscpu" expected true got false +PASS Navigator interface: attribute language +PASS Navigator interface: attribute languages +PASS Navigator interface: attribute onLine +PASS Navigator interface: operation registerProtocolHandler(DOMString, USVString) +PASS Navigator interface: operation unregisterProtocolHandler(DOMString, USVString) +PASS Navigator interface: attribute cookieEnabled +PASS Navigator interface: attribute plugins +PASS Navigator interface: attribute mimeTypes +PASS Navigator interface: operation javaEnabled() +PASS Navigator interface: attribute hardwareConcurrency +PASS Navigator must be primary interface of window.navigator +PASS Stringification of window.navigator +PASS Navigator interface: window.navigator must inherit property "appCodeName" with the proper type +PASS Navigator interface: window.navigator must inherit property "appName" with the proper type +PASS Navigator interface: window.navigator must inherit property "appVersion" with the proper type +PASS Navigator interface: window.navigator must inherit property "platform" with the proper type +PASS Navigator interface: window.navigator must inherit property "product" with the proper type +PASS Navigator interface: window.navigator must inherit property "productSub" with the proper type +PASS Navigator interface: window.navigator must inherit property "userAgent" with the proper type +PASS Navigator interface: window.navigator must inherit property "vendor" with the proper type +PASS Navigator interface: window.navigator must inherit property "vendorSub" with the proper type +FAIL Navigator interface: window.navigator must inherit property "taintEnabled()" with the proper type assert_inherits: property "taintEnabled" not found in prototype chain +FAIL Navigator interface: window.navigator must inherit property "oscpu" with the proper type assert_inherits: property "oscpu" not found in prototype chain +PASS Navigator interface: window.navigator must inherit property "language" with the proper type +PASS Navigator interface: window.navigator must inherit property "languages" with the proper type +PASS Navigator interface: window.navigator must inherit property "onLine" with the proper type +PASS Navigator interface: window.navigator must inherit property "registerProtocolHandler(DOMString, USVString)" with the proper type +PASS Navigator interface: calling registerProtocolHandler(DOMString, USVString) on window.navigator with too few arguments must throw TypeError +PASS Navigator interface: window.navigator must inherit property "unregisterProtocolHandler(DOMString, USVString)" with the proper type +PASS Navigator interface: calling unregisterProtocolHandler(DOMString, USVString) on window.navigator with too few arguments must throw TypeError +PASS Navigator interface: window.navigator must inherit property "cookieEnabled" with the proper type +PASS Navigator interface: window.navigator must inherit property "plugins" with the proper type +PASS Navigator interface: window.navigator must inherit property "mimeTypes" with the proper type +PASS Navigator interface: window.navigator must inherit property "javaEnabled()" with the proper type +PASS Navigator interface: window.navigator must inherit property "hardwareConcurrency" with the proper type +PASS ImageBitmap interface: existence and properties of interface object +PASS ImageBitmap interface object length +PASS ImageBitmap interface object name +PASS ImageBitmap interface: existence and properties of interface prototype object +PASS ImageBitmap interface: existence and properties of interface prototype object's "constructor" property +PASS ImageBitmap interface: existence and properties of interface prototype object's @@unscopables property +PASS ImageBitmap interface: attribute width +PASS ImageBitmap interface: attribute height +PASS ImageBitmap interface: operation close() +PASS MessageEvent interface: existence and properties of interface object +PASS MessageEvent interface object length +PASS MessageEvent interface object name +PASS MessageEvent interface: existence and properties of interface prototype object +PASS MessageEvent interface: existence and properties of interface prototype object's "constructor" property +PASS MessageEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS MessageEvent interface: attribute data +PASS MessageEvent interface: attribute origin +PASS MessageEvent interface: attribute lastEventId +PASS MessageEvent interface: attribute source +PASS MessageEvent interface: attribute ports +PASS MessageEvent interface: operation initMessageEvent(DOMString, optional boolean, optional boolean, optional any, optional USVString, optional DOMString, optional MessageEventSource?, optional sequence<MessagePort>) +PASS MessageEvent must be primary interface of new MessageEvent("message", { data: 5 }) +PASS Stringification of new MessageEvent("message", { data: 5 }) +PASS MessageEvent interface: new MessageEvent("message", { data: 5 }) must inherit property "data" with the proper type +PASS MessageEvent interface: new MessageEvent("message", { data: 5 }) must inherit property "origin" with the proper type +PASS MessageEvent interface: new MessageEvent("message", { data: 5 }) must inherit property "lastEventId" with the proper type +PASS MessageEvent interface: new MessageEvent("message", { data: 5 }) must inherit property "source" with the proper type +PASS MessageEvent interface: new MessageEvent("message", { data: 5 }) must inherit property "ports" with the proper type +PASS MessageEvent interface: new MessageEvent("message", { data: 5 }) must inherit property "initMessageEvent(DOMString, optional boolean, optional boolean, optional any, optional USVString, optional DOMString, optional MessageEventSource?, optional sequence<MessagePort>)" with the proper type +PASS MessageEvent interface: calling initMessageEvent(DOMString, optional boolean, optional boolean, optional any, optional USVString, optional DOMString, optional MessageEventSource?, optional sequence<MessagePort>) on new MessageEvent("message", { data: 5 }) with too few arguments must throw TypeError +PASS EventSource interface: existence and properties of interface object +PASS EventSource interface object length +PASS EventSource interface object name +PASS EventSource interface: existence and properties of interface prototype object +PASS EventSource interface: existence and properties of interface prototype object's "constructor" property +PASS EventSource interface: existence and properties of interface prototype object's @@unscopables property +PASS EventSource interface: attribute url +PASS EventSource interface: attribute withCredentials +PASS EventSource interface: constant CONNECTING on interface object +PASS EventSource interface: constant CONNECTING on interface prototype object +PASS EventSource interface: constant OPEN on interface object +PASS EventSource interface: constant OPEN on interface prototype object +PASS EventSource interface: constant CLOSED on interface object +PASS EventSource interface: constant CLOSED on interface prototype object +PASS EventSource interface: attribute readyState +PASS EventSource interface: attribute onopen +PASS EventSource interface: attribute onmessage +PASS EventSource interface: attribute onerror +PASS EventSource interface: operation close() +PASS EventSource must be primary interface of new EventSource("http://invalid") +PASS Stringification of new EventSource("http://invalid") +PASS EventSource interface: new EventSource("http://invalid") must inherit property "url" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "withCredentials" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "CONNECTING" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "OPEN" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "CLOSED" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "readyState" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "onopen" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "onmessage" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "onerror" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "close()" with the proper type +PASS WebSocket interface: existence and properties of interface object +PASS WebSocket interface object length +PASS WebSocket interface object name +PASS WebSocket interface: existence and properties of interface prototype object +PASS WebSocket interface: existence and properties of interface prototype object's "constructor" property +PASS WebSocket interface: existence and properties of interface prototype object's @@unscopables property +PASS WebSocket interface: attribute url +PASS WebSocket interface: constant CONNECTING on interface object +PASS WebSocket interface: constant CONNECTING on interface prototype object +PASS WebSocket interface: constant OPEN on interface object +PASS WebSocket interface: constant OPEN on interface prototype object +PASS WebSocket interface: constant CLOSING on interface object +PASS WebSocket interface: constant CLOSING on interface prototype object +PASS WebSocket interface: constant CLOSED on interface object +PASS WebSocket interface: constant CLOSED on interface prototype object +PASS WebSocket interface: attribute readyState +PASS WebSocket interface: attribute bufferedAmount +PASS WebSocket interface: attribute onopen +PASS WebSocket interface: attribute onerror +PASS WebSocket interface: attribute onclose +PASS WebSocket interface: attribute extensions +PASS WebSocket interface: attribute protocol +PASS WebSocket interface: operation close(optional unsigned short, optional USVString) +PASS WebSocket interface: attribute onmessage +PASS WebSocket interface: attribute binaryType +PASS WebSocket interface: operation send(USVString) +PASS WebSocket interface: operation send(Blob) +PASS WebSocket interface: operation send(ArrayBuffer) +PASS WebSocket interface: operation send(ArrayBufferView) +PASS WebSocket must be primary interface of new WebSocket("wss://nonexistent.web-platform.test") +PASS Stringification of new WebSocket("wss://nonexistent.web-platform.test") +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "url" with the proper type +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "CONNECTING" with the proper type +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "OPEN" with the proper type +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "CLOSING" with the proper type +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "CLOSED" with the proper type +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "readyState" with the proper type +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "bufferedAmount" with the proper type +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "onopen" with the proper type +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "onerror" with the proper type +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "onclose" with the proper type +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "extensions" with the proper type +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "protocol" with the proper type +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "close(optional unsigned short, optional USVString)" with the proper type +PASS WebSocket interface: calling close(optional unsigned short, optional USVString) on new WebSocket("wss://nonexistent.web-platform.test") with too few arguments must throw TypeError +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "onmessage" with the proper type +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "binaryType" with the proper type +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "send(USVString)" with the proper type +PASS WebSocket interface: calling send(USVString) on new WebSocket("wss://nonexistent.web-platform.test") with too few arguments must throw TypeError +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "send(Blob)" with the proper type +PASS WebSocket interface: calling send(Blob) on new WebSocket("wss://nonexistent.web-platform.test") with too few arguments must throw TypeError +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "send(ArrayBuffer)" with the proper type +PASS WebSocket interface: calling send(ArrayBuffer) on new WebSocket("wss://nonexistent.web-platform.test") with too few arguments must throw TypeError +PASS WebSocket interface: new WebSocket("wss://nonexistent.web-platform.test") must inherit property "send(ArrayBufferView)" with the proper type +PASS WebSocket interface: calling send(ArrayBufferView) on new WebSocket("wss://nonexistent.web-platform.test") with too few arguments must throw TypeError +PASS CloseEvent interface: existence and properties of interface object +PASS CloseEvent interface object length +PASS CloseEvent interface object name +PASS CloseEvent interface: existence and properties of interface prototype object +PASS CloseEvent interface: existence and properties of interface prototype object's "constructor" property +PASS CloseEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS CloseEvent interface: attribute wasClean +PASS CloseEvent interface: attribute code +PASS CloseEvent interface: attribute reason +PASS CloseEvent must be primary interface of new CloseEvent("close") +PASS Stringification of new CloseEvent("close") +PASS CloseEvent interface: new CloseEvent("close") must inherit property "wasClean" with the proper type +PASS CloseEvent interface: new CloseEvent("close") must inherit property "code" with the proper type +PASS CloseEvent interface: new CloseEvent("close") must inherit property "reason" with the proper type +PASS MessageChannel interface: existence and properties of interface object +PASS MessageChannel interface object length +PASS MessageChannel interface object name +PASS MessageChannel interface: existence and properties of interface prototype object +PASS MessageChannel interface: existence and properties of interface prototype object's "constructor" property +PASS MessageChannel interface: existence and properties of interface prototype object's @@unscopables property +PASS MessageChannel interface: attribute port1 +PASS MessageChannel interface: attribute port2 +PASS MessagePort interface: existence and properties of interface object +PASS MessagePort interface object length +PASS MessagePort interface object name +PASS MessagePort interface: existence and properties of interface prototype object +PASS MessagePort interface: existence and properties of interface prototype object's "constructor" property +PASS MessagePort interface: existence and properties of interface prototype object's @@unscopables property +PASS MessagePort interface: operation postMessage(any, sequence<object>) +PASS MessagePort interface: operation postMessage(any, optional PostMessageOptions) +PASS MessagePort interface: operation start() +PASS MessagePort interface: operation close() +PASS MessagePort interface: attribute onmessage +PASS MessagePort interface: attribute onmessageerror +PASS BroadcastChannel interface: existence and properties of interface object +PASS BroadcastChannel interface object length +PASS BroadcastChannel interface object name +PASS BroadcastChannel interface: existence and properties of interface prototype object +PASS BroadcastChannel interface: existence and properties of interface prototype object's "constructor" property +PASS BroadcastChannel interface: existence and properties of interface prototype object's @@unscopables property +PASS BroadcastChannel interface: attribute name +PASS BroadcastChannel interface: operation postMessage(any) +PASS BroadcastChannel interface: operation close() +PASS BroadcastChannel interface: attribute onmessage +PASS BroadcastChannel interface: attribute onmessageerror +PASS WorkerGlobalScope interface: existence and properties of interface object +PASS DedicatedWorkerGlobalScope interface: existence and properties of interface object +PASS SharedWorkerGlobalScope interface: existence and properties of interface object +PASS Worker interface: existence and properties of interface object +PASS Worker interface object length +PASS Worker interface object name +PASS Worker interface: existence and properties of interface prototype object +PASS Worker interface: existence and properties of interface prototype object's "constructor" property +PASS Worker interface: existence and properties of interface prototype object's @@unscopables property +PASS Worker interface: operation terminate() +PASS Worker interface: operation postMessage(any, sequence<object>) +PASS Worker interface: operation postMessage(any, optional PostMessageOptions) +PASS Worker interface: attribute onmessage +FAIL Worker interface: attribute onmessageerror assert_true: The prototype object must have a property "onmessageerror" expected true got false +PASS Worker interface: attribute onerror +PASS SharedWorker interface: existence and properties of interface object +PASS SharedWorker interface object length +PASS SharedWorker interface object name +PASS SharedWorker interface: existence and properties of interface prototype object +PASS SharedWorker interface: existence and properties of interface prototype object's "constructor" property +PASS SharedWorker interface: existence and properties of interface prototype object's @@unscopables property +PASS SharedWorker interface: attribute port +PASS SharedWorker interface: attribute onerror +PASS WorkerNavigator interface: existence and properties of interface object +PASS WorkerLocation interface: existence and properties of interface object +PASS WorkletGlobalScope interface: existence and properties of interface object +PASS Worklet interface: existence and properties of interface object +PASS Worklet interface object length +PASS Worklet interface object name +PASS Worklet interface: existence and properties of interface prototype object +PASS Worklet interface: existence and properties of interface prototype object's "constructor" property +PASS Worklet interface: existence and properties of interface prototype object's @@unscopables property +PASS Worklet interface: operation addModule(USVString, optional WorkletOptions) +PASS Storage interface: existence and properties of interface object +PASS Storage interface object length +PASS Storage interface object name +PASS Storage interface: existence and properties of interface prototype object +PASS Storage interface: existence and properties of interface prototype object's "constructor" property +PASS Storage interface: existence and properties of interface prototype object's @@unscopables property +PASS Storage interface: attribute length +PASS Storage interface: operation key(unsigned long) +PASS Storage interface: operation getItem(DOMString) +PASS Storage interface: operation setItem(DOMString, DOMString) +PASS Storage interface: operation removeItem(DOMString) +PASS Storage interface: operation clear() +PASS Storage must be primary interface of localStorage +PASS Stringification of localStorage +PASS Storage interface: localStorage must inherit property "length" with the proper type +PASS Storage interface: localStorage must inherit property "key(unsigned long)" with the proper type +PASS Storage interface: calling key(unsigned long) on localStorage with too few arguments must throw TypeError +PASS Storage interface: localStorage must inherit property "getItem(DOMString)" with the proper type +PASS Storage interface: calling getItem(DOMString) on localStorage with too few arguments must throw TypeError +PASS Storage interface: localStorage must inherit property "setItem(DOMString, DOMString)" with the proper type +PASS Storage interface: calling setItem(DOMString, DOMString) on localStorage with too few arguments must throw TypeError +PASS Storage interface: localStorage must inherit property "removeItem(DOMString)" with the proper type +PASS Storage interface: calling removeItem(DOMString) on localStorage with too few arguments must throw TypeError +PASS Storage interface: localStorage must inherit property "clear()" with the proper type +PASS Storage must be primary interface of sessionStorage +PASS Stringification of sessionStorage +PASS Storage interface: sessionStorage must inherit property "length" with the proper type +PASS Storage interface: sessionStorage must inherit property "key(unsigned long)" with the proper type +PASS Storage interface: calling key(unsigned long) on sessionStorage with too few arguments must throw TypeError +PASS Storage interface: sessionStorage must inherit property "getItem(DOMString)" with the proper type +PASS Storage interface: calling getItem(DOMString) on sessionStorage with too few arguments must throw TypeError +PASS Storage interface: sessionStorage must inherit property "setItem(DOMString, DOMString)" with the proper type +PASS Storage interface: calling setItem(DOMString, DOMString) on sessionStorage with too few arguments must throw TypeError +PASS Storage interface: sessionStorage must inherit property "removeItem(DOMString)" with the proper type +PASS Storage interface: calling removeItem(DOMString) on sessionStorage with too few arguments must throw TypeError +PASS Storage interface: sessionStorage must inherit property "clear()" with the proper type +PASS StorageEvent interface: existence and properties of interface object +PASS StorageEvent interface object length +PASS StorageEvent interface object name +PASS StorageEvent interface: existence and properties of interface prototype object +PASS StorageEvent interface: existence and properties of interface prototype object's "constructor" property +PASS StorageEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS StorageEvent interface: attribute key +PASS StorageEvent interface: attribute oldValue +PASS StorageEvent interface: attribute newValue +PASS StorageEvent interface: attribute url +PASS StorageEvent interface: attribute storageArea +PASS StorageEvent interface: operation initStorageEvent(DOMString, optional boolean, optional boolean, optional DOMString?, optional DOMString?, optional DOMString?, optional USVString, optional Storage?) +PASS StorageEvent must be primary interface of new StorageEvent("storage") +PASS Stringification of new StorageEvent("storage") +PASS StorageEvent interface: new StorageEvent("storage") must inherit property "key" with the proper type +PASS StorageEvent interface: new StorageEvent("storage") must inherit property "oldValue" with the proper type +PASS StorageEvent interface: new StorageEvent("storage") must inherit property "newValue" with the proper type +PASS StorageEvent interface: new StorageEvent("storage") must inherit property "url" with the proper type +PASS StorageEvent interface: new StorageEvent("storage") must inherit property "storageArea" with the proper type +PASS StorageEvent interface: new StorageEvent("storage") must inherit property "initStorageEvent(DOMString, optional boolean, optional boolean, optional DOMString?, optional DOMString?, optional DOMString?, optional USVString, optional Storage?)" with the proper type +PASS StorageEvent interface: calling initStorageEvent(DOMString, optional boolean, optional boolean, optional DOMString?, optional DOMString?, optional DOMString?, optional USVString, optional Storage?) on new StorageEvent("storage") with too few arguments must throw TypeError +PASS External interface: existence and properties of interface object +PASS External interface object length +PASS External interface object name +PASS External interface: existence and properties of interface prototype object +PASS External interface: existence and properties of interface prototype object's "constructor" property +PASS External interface: existence and properties of interface prototype object's @@unscopables property +PASS External interface: operation AddSearchProvider() +PASS External interface: operation IsSearchProviderInstalled() +PASS External must be primary interface of window.external +PASS Stringification of window.external +PASS External interface: window.external must inherit property "AddSearchProvider()" with the proper type +PASS External interface: window.external must inherit property "IsSearchProviderInstalled()" with the proper type +PASS PluginArray interface: existence and properties of interface object +PASS PluginArray interface object length +PASS PluginArray interface object name +PASS PluginArray interface: existence and properties of interface prototype object +PASS PluginArray interface: existence and properties of interface prototype object's "constructor" property +PASS PluginArray interface: existence and properties of interface prototype object's @@unscopables property +PASS PluginArray interface: operation refresh() +PASS PluginArray interface: attribute length +PASS PluginArray interface: operation item(unsigned long) +PASS PluginArray interface: operation namedItem(DOMString) +PASS MimeTypeArray interface: existence and properties of interface object +PASS MimeTypeArray interface object length +PASS MimeTypeArray interface object name +PASS MimeTypeArray interface: existence and properties of interface prototype object +PASS MimeTypeArray interface: existence and properties of interface prototype object's "constructor" property +PASS MimeTypeArray interface: existence and properties of interface prototype object's @@unscopables property +PASS MimeTypeArray interface: attribute length +PASS MimeTypeArray interface: operation item(unsigned long) +PASS MimeTypeArray interface: operation namedItem(DOMString) +PASS Plugin interface: existence and properties of interface object +PASS Plugin interface object length +PASS Plugin interface object name +PASS Plugin interface: existence and properties of interface prototype object +PASS Plugin interface: existence and properties of interface prototype object's "constructor" property +PASS Plugin interface: existence and properties of interface prototype object's @@unscopables property +PASS Plugin interface: attribute name +PASS Plugin interface: attribute description +PASS Plugin interface: attribute filename +PASS Plugin interface: attribute length +PASS Plugin interface: operation item(unsigned long) +PASS Plugin interface: operation namedItem(DOMString) +PASS MimeType interface: existence and properties of interface object +PASS MimeType interface object length +PASS MimeType interface object name +PASS MimeType interface: existence and properties of interface prototype object +PASS MimeType interface: existence and properties of interface prototype object's "constructor" property +PASS MimeType interface: existence and properties of interface prototype object's @@unscopables property +PASS MimeType interface: attribute type +PASS MimeType interface: attribute description +PASS MimeType interface: attribute suffixes +PASS MimeType interface: attribute enabledPlugin +PASS SVGElement interface: attribute onabort +PASS SVGElement interface: attribute onauxclick +PASS SVGElement interface: attribute onblur +PASS SVGElement interface: attribute oncancel +PASS SVGElement interface: attribute oncanplay +PASS SVGElement interface: attribute oncanplaythrough +PASS SVGElement interface: attribute onchange +PASS SVGElement interface: attribute onclick +PASS SVGElement interface: attribute onclose +PASS SVGElement interface: attribute oncontextmenu +PASS SVGElement interface: attribute oncuechange +PASS SVGElement interface: attribute ondblclick +PASS SVGElement interface: attribute ondrag +PASS SVGElement interface: attribute ondragend +PASS SVGElement interface: attribute ondragenter +PASS SVGElement interface: attribute ondragleave +PASS SVGElement interface: attribute ondragover +PASS SVGElement interface: attribute ondragstart +PASS SVGElement interface: attribute ondrop +PASS SVGElement interface: attribute ondurationchange +PASS SVGElement interface: attribute onemptied +PASS SVGElement interface: attribute onended +PASS SVGElement interface: attribute onerror +PASS SVGElement interface: attribute onfocus +PASS SVGElement interface: attribute onformdata +PASS SVGElement interface: attribute oninput +PASS SVGElement interface: attribute oninvalid +PASS SVGElement interface: attribute onkeydown +PASS SVGElement interface: attribute onkeypress +PASS SVGElement interface: attribute onkeyup +PASS SVGElement interface: attribute onload +PASS SVGElement interface: attribute onloadeddata +PASS SVGElement interface: attribute onloadedmetadata +PASS SVGElement interface: attribute onloadstart +PASS SVGElement interface: attribute onmousedown +PASS SVGElement interface: attribute onmouseenter +PASS SVGElement interface: attribute onmouseleave +PASS SVGElement interface: attribute onmousemove +PASS SVGElement interface: attribute onmouseout +PASS SVGElement interface: attribute onmouseover +PASS SVGElement interface: attribute onmouseup +PASS SVGElement interface: attribute onpause +PASS SVGElement interface: attribute onplay +PASS SVGElement interface: attribute onplaying +PASS SVGElement interface: attribute onprogress +PASS SVGElement interface: attribute onratechange +PASS SVGElement interface: attribute onreset +PASS SVGElement interface: attribute onresize +PASS SVGElement interface: attribute onscroll +FAIL SVGElement interface: attribute onsecuritypolicyviolation assert_true: The prototype object must have a property "onsecuritypolicyviolation" expected true got false +PASS SVGElement interface: attribute onseeked +PASS SVGElement interface: attribute onseeking +PASS SVGElement interface: attribute onselect +FAIL SVGElement interface: attribute onslotchange assert_true: The prototype object must have a property "onslotchange" expected true got false +PASS SVGElement interface: attribute onstalled +PASS SVGElement interface: attribute onsubmit +PASS SVGElement interface: attribute onsuspend +PASS SVGElement interface: attribute ontimeupdate +PASS SVGElement interface: attribute ontoggle +PASS SVGElement interface: attribute onvolumechange +PASS SVGElement interface: attribute onwaiting +PASS SVGElement interface: attribute onwebkitanimationend +PASS SVGElement interface: attribute onwebkitanimationiteration +PASS SVGElement interface: attribute onwebkitanimationstart +PASS SVGElement interface: attribute onwebkittransitionend +PASS SVGElement interface: attribute onwheel +PASS SVGElement interface: attribute oncopy +PASS SVGElement interface: attribute oncut +PASS SVGElement interface: attribute onpaste +PASS SVGElement interface: attribute dataset +PASS SVGElement interface: attribute nonce +PASS SVGElement interface: attribute autofocus +PASS SVGElement interface: attribute tabIndex +PASS SVGElement interface: operation focus(optional FocusOptions) +PASS SVGElement interface: operation blur() +FAIL SVGSVGElement interface: attribute onafterprint assert_true: The prototype object must have a property "onafterprint" expected true got false +FAIL SVGSVGElement interface: attribute onbeforeprint assert_true: The prototype object must have a property "onbeforeprint" expected true got false +FAIL SVGSVGElement interface: attribute onbeforeunload assert_true: The prototype object must have a property "onbeforeunload" expected true got false +FAIL SVGSVGElement interface: attribute onhashchange assert_true: The prototype object must have a property "onhashchange" expected true got false +FAIL SVGSVGElement interface: attribute onlanguagechange assert_true: The prototype object must have a property "onlanguagechange" expected true got false +FAIL SVGSVGElement interface: attribute onmessage assert_true: The prototype object must have a property "onmessage" expected true got false +FAIL SVGSVGElement interface: attribute onmessageerror assert_true: The prototype object must have a property "onmessageerror" expected true got false +FAIL SVGSVGElement interface: attribute onoffline assert_true: The prototype object must have a property "onoffline" expected true got false +FAIL SVGSVGElement interface: attribute ononline assert_true: The prototype object must have a property "ononline" expected true got false +FAIL SVGSVGElement interface: attribute onpagehide assert_true: The prototype object must have a property "onpagehide" expected true got false +FAIL SVGSVGElement interface: attribute onpageshow assert_true: The prototype object must have a property "onpageshow" expected true got false +FAIL SVGSVGElement interface: attribute onpopstate assert_true: The prototype object must have a property "onpopstate" expected true got false +FAIL SVGSVGElement interface: attribute onrejectionhandled assert_true: The prototype object must have a property "onrejectionhandled" expected true got false +FAIL SVGSVGElement interface: attribute onstorage assert_true: The prototype object must have a property "onstorage" expected true got false +FAIL SVGSVGElement interface: attribute onunhandledrejection assert_true: The prototype object must have a property "onunhandledrejection" expected true got false +FAIL SVGSVGElement interface: attribute onunload assert_true: The prototype object must have a property "onunload" expected true got false +PASS ShadowRoot interface: attribute activeElement +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/mac-mac-arm11.0/external/wpt/html/dom/idlharness.worker-expected.txt b/third_party/blink/web_tests/platform/mac-mac-arm11.0/external/wpt/html/dom/idlharness.worker-expected.txt new file mode 100644 index 0000000..572fc47 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac-arm11.0/external/wpt/html/dom/idlharness.worker-expected.txt
@@ -0,0 +1,800 @@ +This is a testharness.js-based test. +Found 796 tests; 788 PASS, 8 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS idl_test setup +PASS idl_test validation +PASS Partial interface Document: original interface defined +PASS Partial interface Document: member names are unique +PASS Partial interface mixin DocumentOrShadowRoot: original interface mixin defined +PASS Partial interface mixin DocumentOrShadowRoot: member names are unique +PASS Partial interface mixin NavigatorID: original interface mixin defined +PASS Partial interface mixin NavigatorID: member names are unique +PASS Partial interface HTMLAnchorElement: original interface defined +PASS Partial interface HTMLAnchorElement: member names are unique +PASS Partial interface HTMLAreaElement: original interface defined +PASS Partial interface HTMLAreaElement: member names are unique +PASS Partial interface HTMLBodyElement: original interface defined +PASS Partial interface HTMLBodyElement: member names are unique +PASS Partial interface HTMLBRElement: original interface defined +PASS Partial interface HTMLBRElement: member names are unique +PASS Partial interface HTMLTableCaptionElement: original interface defined +PASS Partial interface HTMLTableCaptionElement: member names are unique +PASS Partial interface HTMLTableColElement: original interface defined +PASS Partial interface HTMLTableColElement: member names are unique +PASS Partial interface HTMLDivElement: original interface defined +PASS Partial interface HTMLDivElement: member names are unique +PASS Partial interface HTMLDListElement: original interface defined +PASS Partial interface HTMLDListElement: member names are unique +PASS Partial interface HTMLEmbedElement: original interface defined +PASS Partial interface HTMLEmbedElement: member names are unique +PASS Partial interface HTMLHeadingElement: original interface defined +PASS Partial interface HTMLHeadingElement: member names are unique +PASS Partial interface HTMLHRElement: original interface defined +PASS Partial interface HTMLHRElement: member names are unique +PASS Partial interface HTMLHtmlElement: original interface defined +PASS Partial interface HTMLHtmlElement: member names are unique +PASS Partial interface HTMLIFrameElement: original interface defined +PASS Partial interface HTMLIFrameElement: member names are unique +PASS Partial interface HTMLImageElement: original interface defined +PASS Partial interface HTMLImageElement: member names are unique +PASS Partial interface HTMLInputElement: original interface defined +PASS Partial interface HTMLInputElement: member names are unique +PASS Partial interface HTMLLegendElement: original interface defined +PASS Partial interface HTMLLegendElement: member names are unique +PASS Partial interface HTMLLIElement: original interface defined +PASS Partial interface HTMLLIElement: member names are unique +PASS Partial interface HTMLLinkElement: original interface defined +PASS Partial interface HTMLLinkElement: member names are unique +PASS Partial interface HTMLMenuElement: original interface defined +PASS Partial interface HTMLMenuElement: member names are unique +PASS Partial interface HTMLMetaElement: original interface defined +PASS Partial interface HTMLMetaElement: member names are unique +PASS Partial interface HTMLObjectElement: original interface defined +PASS Partial interface HTMLObjectElement: member names are unique +PASS Partial interface HTMLOListElement: original interface defined +PASS Partial interface HTMLOListElement: member names are unique +PASS Partial interface HTMLParagraphElement: original interface defined +PASS Partial interface HTMLParagraphElement: member names are unique +PASS Partial interface HTMLParamElement: original interface defined +PASS Partial interface HTMLParamElement: member names are unique +PASS Partial interface HTMLPreElement: original interface defined +PASS Partial interface HTMLPreElement: member names are unique +PASS Partial interface HTMLStyleElement: original interface defined +PASS Partial interface HTMLStyleElement: member names are unique +PASS Partial interface HTMLScriptElement: original interface defined +PASS Partial interface HTMLScriptElement: member names are unique +PASS Partial interface HTMLTableElement: original interface defined +PASS Partial interface HTMLTableElement: member names are unique +PASS Partial interface HTMLTableSectionElement: original interface defined +PASS Partial interface HTMLTableSectionElement: member names are unique +PASS Partial interface HTMLTableCellElement: original interface defined +PASS Partial interface HTMLTableCellElement: member names are unique +PASS Partial interface HTMLTableRowElement: original interface defined +PASS Partial interface HTMLTableRowElement: member names are unique +PASS Partial interface HTMLUListElement: original interface defined +PASS Partial interface HTMLUListElement: member names are unique +PASS Partial interface Document[2]: original interface defined +PASS Partial interface Document[2]: member names are unique +PASS Partial interface Window: original interface defined +PASS Partial interface Window: member names are unique +PASS Partial interface UIEvent: member names are unique +PASS Partial interface MouseEvent: member names are unique +PASS Partial interface UIEvent[2]: member names are unique +PASS Partial dictionary UIEventInit: member names are unique +PASS Document includes GlobalEventHandlers: member names are unique +PASS Document includes DocumentAndElementEventHandlers: member names are unique +PASS HTMLElement includes GlobalEventHandlers: member names are unique +PASS HTMLElement includes DocumentAndElementEventHandlers: member names are unique +PASS HTMLElement includes ElementContentEditable: member names are unique +PASS HTMLElement includes HTMLOrSVGElement: member names are unique +PASS HTMLLinkElement includes LinkStyle: member names are unique +PASS HTMLStyleElement includes LinkStyle: member names are unique +PASS HTMLBodyElement includes WindowEventHandlers: member names are unique +PASS HTMLAnchorElement includes HTMLHyperlinkElementUtils: member names are unique +PASS HTMLAreaElement includes HTMLHyperlinkElementUtils: member names are unique +PASS CanvasRenderingContext2D includes CanvasState: member names are unique +PASS CanvasRenderingContext2D includes CanvasTransform: member names are unique +PASS CanvasRenderingContext2D includes CanvasCompositing: member names are unique +PASS CanvasRenderingContext2D includes CanvasImageSmoothing: member names are unique +PASS CanvasRenderingContext2D includes CanvasFillStrokeStyles: member names are unique +PASS CanvasRenderingContext2D includes CanvasShadowStyles: member names are unique +PASS CanvasRenderingContext2D includes CanvasFilters: member names are unique +PASS CanvasRenderingContext2D includes CanvasRect: member names are unique +PASS CanvasRenderingContext2D includes CanvasDrawPath: member names are unique +PASS CanvasRenderingContext2D includes CanvasUserInterface: member names are unique +PASS CanvasRenderingContext2D includes CanvasText: member names are unique +PASS CanvasRenderingContext2D includes CanvasDrawImage: member names are unique +PASS CanvasRenderingContext2D includes CanvasImageData: member names are unique +PASS CanvasRenderingContext2D includes CanvasPathDrawingStyles: member names are unique +PASS CanvasRenderingContext2D includes CanvasTextDrawingStyles: member names are unique +PASS CanvasRenderingContext2D includes CanvasPath: member names are unique +PASS Path2D includes CanvasPath: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasState: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasTransform: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasCompositing: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasImageSmoothing: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasFillStrokeStyles: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasShadowStyles: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasFilters: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasRect: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasDrawPath: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasText: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasDrawImage: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasImageData: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasPathDrawingStyles: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasTextDrawingStyles: member names are unique +PASS OffscreenCanvasRenderingContext2D includes CanvasPath: member names are unique +PASS ElementInternals includes ARIAMixin: member names are unique +PASS Window includes GlobalEventHandlers: member names are unique +PASS Window includes WindowEventHandlers: member names are unique +PASS Window includes WindowOrWorkerGlobalScope: member names are unique +PASS WorkerGlobalScope includes WindowOrWorkerGlobalScope: member names are unique +PASS Navigator includes NavigatorID: member names are unique +PASS Navigator includes NavigatorLanguage: member names are unique +PASS Navigator includes NavigatorOnLine: member names are unique +PASS Navigator includes NavigatorContentUtils: member names are unique +PASS Navigator includes NavigatorCookies: member names are unique +PASS Navigator includes NavigatorPlugins: member names are unique +PASS Navigator includes NavigatorConcurrentHardware: member names are unique +PASS Window includes AnimationFrameProvider: member names are unique +PASS DedicatedWorkerGlobalScope includes AnimationFrameProvider: member names are unique +PASS Worker includes AbstractWorker: member names are unique +PASS SharedWorker includes AbstractWorker: member names are unique +PASS WorkerNavigator includes NavigatorID: member names are unique +PASS WorkerNavigator includes NavigatorLanguage: member names are unique +PASS WorkerNavigator includes NavigatorOnLine: member names are unique +PASS WorkerNavigator includes NavigatorConcurrentHardware: member names are unique +PASS Window includes WindowSessionStorage: member names are unique +PASS Window includes WindowLocalStorage: member names are unique +PASS HTMLFrameSetElement includes WindowEventHandlers: member names are unique +PASS Element includes ARIAMixin: member names are unique +PASS Document includes NonElementParentNode: member names are unique +PASS DocumentFragment includes NonElementParentNode: member names are unique +PASS Document includes DocumentOrShadowRoot: member names are unique +PASS ShadowRoot includes DocumentOrShadowRoot: member names are unique +PASS Document includes ParentNode: member names are unique +PASS DocumentFragment includes ParentNode: member names are unique +PASS Element includes ParentNode: member names are unique +PASS Element includes NonDocumentTypeChildNode: member names are unique +PASS Element includes ChildNode: member names are unique +PASS Element includes Slottable: member names are unique +PASS Document includes XPathEvaluatorBase: member names are unique +PASS HTMLElement includes ElementCSSInlineStyle: member names are unique +PASS HTMLAllCollection interface: existence and properties of interface object +PASS HTMLFormControlsCollection interface: existence and properties of interface object +PASS RadioNodeList interface: existence and properties of interface object +PASS HTMLOptionsCollection interface: existence and properties of interface object +PASS DOMStringList interface: existence and properties of interface object +PASS DOMStringList interface object length +PASS DOMStringList interface object name +PASS DOMStringList interface: existence and properties of interface prototype object +PASS DOMStringList interface: existence and properties of interface prototype object's "constructor" property +PASS DOMStringList interface: existence and properties of interface prototype object's @@unscopables property +PASS DOMStringList interface: attribute length +PASS DOMStringList interface: operation item(unsigned long) +PASS DOMStringList interface: operation contains(DOMString) +PASS HTMLElement interface: existence and properties of interface object +PASS HTMLUnknownElement interface: existence and properties of interface object +PASS DOMStringMap interface: existence and properties of interface object +PASS HTMLHtmlElement interface: existence and properties of interface object +PASS HTMLHeadElement interface: existence and properties of interface object +PASS HTMLTitleElement interface: existence and properties of interface object +PASS HTMLBaseElement interface: existence and properties of interface object +PASS HTMLLinkElement interface: existence and properties of interface object +PASS HTMLMetaElement interface: existence and properties of interface object +PASS HTMLStyleElement interface: existence and properties of interface object +PASS HTMLBodyElement interface: existence and properties of interface object +PASS HTMLHeadingElement interface: existence and properties of interface object +PASS HTMLParagraphElement interface: existence and properties of interface object +PASS HTMLHRElement interface: existence and properties of interface object +PASS HTMLPreElement interface: existence and properties of interface object +PASS HTMLQuoteElement interface: existence and properties of interface object +PASS HTMLOListElement interface: existence and properties of interface object +PASS HTMLUListElement interface: existence and properties of interface object +PASS HTMLMenuElement interface: existence and properties of interface object +PASS HTMLLIElement interface: existence and properties of interface object +PASS HTMLDListElement interface: existence and properties of interface object +PASS HTMLDivElement interface: existence and properties of interface object +PASS HTMLAnchorElement interface: existence and properties of interface object +PASS HTMLDataElement interface: existence and properties of interface object +PASS HTMLTimeElement interface: existence and properties of interface object +PASS HTMLSpanElement interface: existence and properties of interface object +PASS HTMLBRElement interface: existence and properties of interface object +PASS HTMLModElement interface: existence and properties of interface object +PASS HTMLPictureElement interface: existence and properties of interface object +PASS HTMLSourceElement interface: existence and properties of interface object +PASS HTMLImageElement interface: existence and properties of interface object +PASS HTMLIFrameElement interface: existence and properties of interface object +PASS HTMLEmbedElement interface: existence and properties of interface object +PASS HTMLObjectElement interface: existence and properties of interface object +PASS HTMLParamElement interface: existence and properties of interface object +PASS HTMLVideoElement interface: existence and properties of interface object +PASS HTMLAudioElement interface: existence and properties of interface object +PASS HTMLTrackElement interface: existence and properties of interface object +PASS HTMLMediaElement interface: existence and properties of interface object +PASS MediaError interface: existence and properties of interface object +PASS AudioTrackList interface: existence and properties of interface object +PASS AudioTrack interface: existence and properties of interface object +PASS VideoTrackList interface: existence and properties of interface object +PASS VideoTrack interface: existence and properties of interface object +PASS TextTrackList interface: existence and properties of interface object +PASS TextTrack interface: existence and properties of interface object +PASS TextTrackCueList interface: existence and properties of interface object +PASS TextTrackCue interface: existence and properties of interface object +PASS TimeRanges interface: existence and properties of interface object +PASS TrackEvent interface: existence and properties of interface object +PASS HTMLMapElement interface: existence and properties of interface object +PASS HTMLAreaElement interface: existence and properties of interface object +PASS HTMLTableElement interface: existence and properties of interface object +PASS HTMLTableCaptionElement interface: existence and properties of interface object +PASS HTMLTableColElement interface: existence and properties of interface object +PASS HTMLTableSectionElement interface: existence and properties of interface object +PASS HTMLTableRowElement interface: existence and properties of interface object +PASS HTMLTableCellElement interface: existence and properties of interface object +PASS HTMLFormElement interface: existence and properties of interface object +PASS HTMLLabelElement interface: existence and properties of interface object +PASS HTMLInputElement interface: existence and properties of interface object +PASS HTMLButtonElement interface: existence and properties of interface object +PASS HTMLSelectElement interface: existence and properties of interface object +PASS HTMLDataListElement interface: existence and properties of interface object +PASS HTMLOptGroupElement interface: existence and properties of interface object +PASS HTMLOptionElement interface: existence and properties of interface object +PASS HTMLTextAreaElement interface: existence and properties of interface object +PASS HTMLOutputElement interface: existence and properties of interface object +PASS HTMLProgressElement interface: existence and properties of interface object +PASS HTMLMeterElement interface: existence and properties of interface object +PASS HTMLFieldSetElement interface: existence and properties of interface object +PASS HTMLLegendElement interface: existence and properties of interface object +PASS ValidityState interface: existence and properties of interface object +PASS SubmitEvent interface: existence and properties of interface object +PASS FormDataEvent interface: existence and properties of interface object +PASS HTMLDetailsElement interface: existence and properties of interface object +PASS HTMLDialogElement interface: existence and properties of interface object +PASS HTMLScriptElement interface: existence and properties of interface object +PASS HTMLTemplateElement interface: existence and properties of interface object +PASS HTMLSlotElement interface: existence and properties of interface object +PASS HTMLCanvasElement interface: existence and properties of interface object +PASS CanvasRenderingContext2D interface: existence and properties of interface object +PASS CanvasGradient interface: existence and properties of interface object +PASS CanvasGradient interface object length +PASS CanvasGradient interface object name +PASS CanvasGradient interface: existence and properties of interface prototype object +PASS CanvasGradient interface: existence and properties of interface prototype object's "constructor" property +PASS CanvasGradient interface: existence and properties of interface prototype object's @@unscopables property +PASS CanvasGradient interface: operation addColorStop(double, DOMString) +PASS CanvasPattern interface: existence and properties of interface object +PASS CanvasPattern interface object length +PASS CanvasPattern interface object name +PASS CanvasPattern interface: existence and properties of interface prototype object +PASS CanvasPattern interface: existence and properties of interface prototype object's "constructor" property +PASS CanvasPattern interface: existence and properties of interface prototype object's @@unscopables property +PASS CanvasPattern interface: operation setTransform(optional DOMMatrix2DInit) +PASS TextMetrics interface: existence and properties of interface object +PASS TextMetrics interface object length +PASS TextMetrics interface object name +PASS TextMetrics interface: existence and properties of interface prototype object +PASS TextMetrics interface: existence and properties of interface prototype object's "constructor" property +PASS TextMetrics interface: existence and properties of interface prototype object's @@unscopables property +PASS TextMetrics interface: attribute width +PASS TextMetrics interface: attribute actualBoundingBoxLeft +PASS TextMetrics interface: attribute actualBoundingBoxRight +PASS TextMetrics interface: attribute fontBoundingBoxAscent +PASS TextMetrics interface: attribute fontBoundingBoxDescent +PASS TextMetrics interface: attribute actualBoundingBoxAscent +PASS TextMetrics interface: attribute actualBoundingBoxDescent +PASS TextMetrics interface: attribute emHeightAscent +PASS TextMetrics interface: attribute emHeightDescent +FAIL TextMetrics interface: attribute hangingBaseline assert_true: The prototype object must have a property "hangingBaseline" expected true got false +FAIL TextMetrics interface: attribute alphabeticBaseline assert_true: The prototype object must have a property "alphabeticBaseline" expected true got false +FAIL TextMetrics interface: attribute ideographicBaseline assert_true: The prototype object must have a property "ideographicBaseline" expected true got false +PASS ImageData interface: existence and properties of interface object +PASS ImageData interface object length +PASS ImageData interface object name +PASS ImageData interface: existence and properties of interface prototype object +PASS ImageData interface: existence and properties of interface prototype object's "constructor" property +PASS ImageData interface: existence and properties of interface prototype object's @@unscopables property +PASS ImageData interface: attribute width +PASS ImageData interface: attribute height +PASS ImageData interface: attribute data +PASS Path2D interface: existence and properties of interface object +PASS Path2D interface object length +PASS Path2D interface object name +PASS Path2D interface: existence and properties of interface prototype object +PASS Path2D interface: existence and properties of interface prototype object's "constructor" property +PASS Path2D interface: existence and properties of interface prototype object's @@unscopables property +PASS Path2D interface: operation addPath(Path2D, optional DOMMatrix2DInit) +PASS Path2D interface: operation closePath() +PASS Path2D interface: operation moveTo(unrestricted double, unrestricted double) +PASS Path2D interface: operation lineTo(unrestricted double, unrestricted double) +PASS Path2D interface: operation quadraticCurveTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS Path2D interface: operation bezierCurveTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS Path2D interface: operation arcTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS Path2D interface: operation rect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS Path2D interface: operation arc(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean) +PASS Path2D interface: operation ellipse(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean) +PASS ImageBitmapRenderingContext interface: existence and properties of interface object +PASS ImageBitmapRenderingContext interface object length +PASS ImageBitmapRenderingContext interface object name +PASS ImageBitmapRenderingContext interface: existence and properties of interface prototype object +PASS ImageBitmapRenderingContext interface: existence and properties of interface prototype object's "constructor" property +PASS ImageBitmapRenderingContext interface: existence and properties of interface prototype object's @@unscopables property +PASS ImageBitmapRenderingContext interface: attribute canvas +PASS ImageBitmapRenderingContext interface: operation transferFromImageBitmap(ImageBitmap?) +PASS OffscreenCanvas interface: existence and properties of interface object +PASS OffscreenCanvas interface object length +PASS OffscreenCanvas interface object name +PASS OffscreenCanvas interface: existence and properties of interface prototype object +PASS OffscreenCanvas interface: existence and properties of interface prototype object's "constructor" property +PASS OffscreenCanvas interface: existence and properties of interface prototype object's @@unscopables property +PASS OffscreenCanvas interface: attribute width +PASS OffscreenCanvas interface: attribute height +PASS OffscreenCanvas interface: operation getContext(OffscreenRenderingContextId, optional any) +PASS OffscreenCanvas interface: operation transferToImageBitmap() +PASS OffscreenCanvas interface: operation convertToBlob(optional ImageEncodeOptions) +PASS OffscreenCanvasRenderingContext2D interface: existence and properties of interface object +PASS OffscreenCanvasRenderingContext2D interface object length +PASS OffscreenCanvasRenderingContext2D interface object name +PASS OffscreenCanvasRenderingContext2D interface: existence and properties of interface prototype object +PASS OffscreenCanvasRenderingContext2D interface: existence and properties of interface prototype object's "constructor" property +PASS OffscreenCanvasRenderingContext2D interface: existence and properties of interface prototype object's @@unscopables property +PASS OffscreenCanvasRenderingContext2D interface: operation commit() +PASS OffscreenCanvasRenderingContext2D interface: attribute canvas +PASS OffscreenCanvasRenderingContext2D interface: operation save() +PASS OffscreenCanvasRenderingContext2D interface: operation restore() +PASS OffscreenCanvasRenderingContext2D interface: operation scale(unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation rotate(unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation translate(unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation transform(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation getTransform() +PASS OffscreenCanvasRenderingContext2D interface: operation setTransform(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation setTransform(optional DOMMatrix2DInit) +PASS OffscreenCanvasRenderingContext2D interface: operation resetTransform() +PASS OffscreenCanvasRenderingContext2D interface: attribute globalAlpha +PASS OffscreenCanvasRenderingContext2D interface: attribute globalCompositeOperation +PASS OffscreenCanvasRenderingContext2D interface: attribute imageSmoothingEnabled +PASS OffscreenCanvasRenderingContext2D interface: attribute imageSmoothingQuality +PASS OffscreenCanvasRenderingContext2D interface: attribute strokeStyle +PASS OffscreenCanvasRenderingContext2D interface: attribute fillStyle +PASS OffscreenCanvasRenderingContext2D interface: operation createLinearGradient(double, double, double, double) +PASS OffscreenCanvasRenderingContext2D interface: operation createRadialGradient(double, double, double, double, double, double) +PASS OffscreenCanvasRenderingContext2D interface: operation createPattern(CanvasImageSource, DOMString) +PASS OffscreenCanvasRenderingContext2D interface: attribute shadowOffsetX +PASS OffscreenCanvasRenderingContext2D interface: attribute shadowOffsetY +PASS OffscreenCanvasRenderingContext2D interface: attribute shadowBlur +PASS OffscreenCanvasRenderingContext2D interface: attribute shadowColor +PASS OffscreenCanvasRenderingContext2D interface: attribute filter +PASS OffscreenCanvasRenderingContext2D interface: operation clearRect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation fillRect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation strokeRect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation beginPath() +PASS OffscreenCanvasRenderingContext2D interface: operation fill(optional CanvasFillRule) +PASS OffscreenCanvasRenderingContext2D interface: operation fill(Path2D, optional CanvasFillRule) +PASS OffscreenCanvasRenderingContext2D interface: operation stroke() +PASS OffscreenCanvasRenderingContext2D interface: operation stroke(Path2D) +PASS OffscreenCanvasRenderingContext2D interface: operation clip(optional CanvasFillRule) +PASS OffscreenCanvasRenderingContext2D interface: operation clip(Path2D, optional CanvasFillRule) +PASS OffscreenCanvasRenderingContext2D interface: operation isPointInPath(unrestricted double, unrestricted double, optional CanvasFillRule) +PASS OffscreenCanvasRenderingContext2D interface: operation isPointInPath(Path2D, unrestricted double, unrestricted double, optional CanvasFillRule) +PASS OffscreenCanvasRenderingContext2D interface: operation isPointInStroke(unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation isPointInStroke(Path2D, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation fillText(DOMString, unrestricted double, unrestricted double, optional unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation strokeText(DOMString, unrestricted double, unrestricted double, optional unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation measureText(DOMString) +PASS OffscreenCanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation drawImage(CanvasImageSource, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation createImageData(long, long) +PASS OffscreenCanvasRenderingContext2D interface: operation createImageData(ImageData) +PASS OffscreenCanvasRenderingContext2D interface: operation getImageData(long, long, long, long) +PASS OffscreenCanvasRenderingContext2D interface: operation putImageData(ImageData, long, long) +PASS OffscreenCanvasRenderingContext2D interface: operation putImageData(ImageData, long, long, long, long, long, long) +PASS OffscreenCanvasRenderingContext2D interface: attribute lineWidth +PASS OffscreenCanvasRenderingContext2D interface: attribute lineCap +PASS OffscreenCanvasRenderingContext2D interface: attribute lineJoin +PASS OffscreenCanvasRenderingContext2D interface: attribute miterLimit +PASS OffscreenCanvasRenderingContext2D interface: operation setLineDash(sequence<unrestricted double>) +PASS OffscreenCanvasRenderingContext2D interface: operation getLineDash() +PASS OffscreenCanvasRenderingContext2D interface: attribute lineDashOffset +PASS OffscreenCanvasRenderingContext2D interface: attribute font +PASS OffscreenCanvasRenderingContext2D interface: attribute textAlign +PASS OffscreenCanvasRenderingContext2D interface: attribute textBaseline +PASS OffscreenCanvasRenderingContext2D interface: attribute direction +PASS OffscreenCanvasRenderingContext2D interface: operation closePath() +PASS OffscreenCanvasRenderingContext2D interface: operation moveTo(unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation lineTo(unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation quadraticCurveTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation bezierCurveTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation arcTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation rect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) +PASS OffscreenCanvasRenderingContext2D interface: operation arc(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean) +PASS OffscreenCanvasRenderingContext2D interface: operation ellipse(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean) +PASS CustomElementRegistry interface: existence and properties of interface object +PASS ElementInternals interface: existence and properties of interface object +PASS DataTransfer interface: existence and properties of interface object +PASS DataTransferItemList interface: existence and properties of interface object +PASS DataTransferItem interface: existence and properties of interface object +PASS DragEvent interface: existence and properties of interface object +PASS Window interface: existence and properties of interface object +PASS BarProp interface: existence and properties of interface object +PASS History interface: existence and properties of interface object +PASS Location interface: existence and properties of interface object +PASS PopStateEvent interface: existence and properties of interface object +PASS HashChangeEvent interface: existence and properties of interface object +PASS PageTransitionEvent interface: existence and properties of interface object +PASS BeforeUnloadEvent interface: existence and properties of interface object +PASS ErrorEvent interface: existence and properties of interface object +PASS ErrorEvent interface object length +PASS ErrorEvent interface object name +PASS ErrorEvent interface: existence and properties of interface prototype object +PASS ErrorEvent interface: existence and properties of interface prototype object's "constructor" property +PASS ErrorEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS ErrorEvent interface: attribute message +PASS ErrorEvent interface: attribute filename +PASS ErrorEvent interface: attribute lineno +PASS ErrorEvent interface: attribute colno +PASS ErrorEvent interface: attribute error +PASS PromiseRejectionEvent interface: existence and properties of interface object +PASS PromiseRejectionEvent interface object length +PASS PromiseRejectionEvent interface object name +PASS PromiseRejectionEvent interface: existence and properties of interface prototype object +PASS PromiseRejectionEvent interface: existence and properties of interface prototype object's "constructor" property +PASS PromiseRejectionEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS PromiseRejectionEvent interface: attribute promise +PASS PromiseRejectionEvent interface: attribute reason +PASS DOMParser interface: existence and properties of interface object +PASS Navigator interface: existence and properties of interface object +PASS ImageBitmap interface: existence and properties of interface object +PASS ImageBitmap interface object length +PASS ImageBitmap interface object name +PASS ImageBitmap interface: existence and properties of interface prototype object +PASS ImageBitmap interface: existence and properties of interface prototype object's "constructor" property +PASS ImageBitmap interface: existence and properties of interface prototype object's @@unscopables property +PASS ImageBitmap interface: attribute width +PASS ImageBitmap interface: attribute height +PASS ImageBitmap interface: operation close() +PASS MessageEvent interface: existence and properties of interface object +PASS MessageEvent interface object length +PASS MessageEvent interface object name +PASS MessageEvent interface: existence and properties of interface prototype object +PASS MessageEvent interface: existence and properties of interface prototype object's "constructor" property +PASS MessageEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS MessageEvent interface: attribute data +PASS MessageEvent interface: attribute origin +PASS MessageEvent interface: attribute lastEventId +PASS MessageEvent interface: attribute source +PASS MessageEvent interface: attribute ports +PASS MessageEvent interface: operation initMessageEvent(DOMString, optional boolean, optional boolean, optional any, optional USVString, optional DOMString, optional MessageEventSource?, optional sequence<MessagePort>) +PASS MessageEvent must be primary interface of new MessageEvent("message", { data: 5 }) +PASS Stringification of new MessageEvent("message", { data: 5 }) +PASS MessageEvent interface: new MessageEvent("message", { data: 5 }) must inherit property "data" with the proper type +PASS MessageEvent interface: new MessageEvent("message", { data: 5 }) must inherit property "origin" with the proper type +PASS MessageEvent interface: new MessageEvent("message", { data: 5 }) must inherit property "lastEventId" with the proper type +PASS MessageEvent interface: new MessageEvent("message", { data: 5 }) must inherit property "source" with the proper type +PASS MessageEvent interface: new MessageEvent("message", { data: 5 }) must inherit property "ports" with the proper type +PASS MessageEvent interface: new MessageEvent("message", { data: 5 }) must inherit property "initMessageEvent(DOMString, optional boolean, optional boolean, optional any, optional USVString, optional DOMString, optional MessageEventSource?, optional sequence<MessagePort>)" with the proper type +PASS MessageEvent interface: calling initMessageEvent(DOMString, optional boolean, optional boolean, optional any, optional USVString, optional DOMString, optional MessageEventSource?, optional sequence<MessagePort>) on new MessageEvent("message", { data: 5 }) with too few arguments must throw TypeError +PASS EventSource interface: existence and properties of interface object +PASS EventSource interface object length +PASS EventSource interface object name +PASS EventSource interface: existence and properties of interface prototype object +PASS EventSource interface: existence and properties of interface prototype object's "constructor" property +PASS EventSource interface: existence and properties of interface prototype object's @@unscopables property +PASS EventSource interface: attribute url +PASS EventSource interface: attribute withCredentials +PASS EventSource interface: constant CONNECTING on interface object +PASS EventSource interface: constant CONNECTING on interface prototype object +PASS EventSource interface: constant OPEN on interface object +PASS EventSource interface: constant OPEN on interface prototype object +PASS EventSource interface: constant CLOSED on interface object +PASS EventSource interface: constant CLOSED on interface prototype object +PASS EventSource interface: attribute readyState +PASS EventSource interface: attribute onopen +PASS EventSource interface: attribute onmessage +PASS EventSource interface: attribute onerror +PASS EventSource interface: operation close() +PASS EventSource must be primary interface of new EventSource("http://invalid") +PASS Stringification of new EventSource("http://invalid") +PASS EventSource interface: new EventSource("http://invalid") must inherit property "url" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "withCredentials" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "CONNECTING" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "OPEN" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "CLOSED" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "readyState" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "onopen" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "onmessage" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "onerror" with the proper type +PASS EventSource interface: new EventSource("http://invalid") must inherit property "close()" with the proper type +PASS WebSocket interface: existence and properties of interface object +PASS WebSocket interface object length +PASS WebSocket interface object name +PASS WebSocket interface: existence and properties of interface prototype object +PASS WebSocket interface: existence and properties of interface prototype object's "constructor" property +PASS WebSocket interface: existence and properties of interface prototype object's @@unscopables property +PASS WebSocket interface: attribute url +PASS WebSocket interface: constant CONNECTING on interface object +PASS WebSocket interface: constant CONNECTING on interface prototype object +PASS WebSocket interface: constant OPEN on interface object +PASS WebSocket interface: constant OPEN on interface prototype object +PASS WebSocket interface: constant CLOSING on interface object +PASS WebSocket interface: constant CLOSING on interface prototype object +PASS WebSocket interface: constant CLOSED on interface object +PASS WebSocket interface: constant CLOSED on interface prototype object +PASS WebSocket interface: attribute readyState +PASS WebSocket interface: attribute bufferedAmount +PASS WebSocket interface: attribute onopen +PASS WebSocket interface: attribute onerror +PASS WebSocket interface: attribute onclose +PASS WebSocket interface: attribute extensions +PASS WebSocket interface: attribute protocol +PASS WebSocket interface: operation close(optional unsigned short, optional USVString) +PASS WebSocket interface: attribute onmessage +PASS WebSocket interface: attribute binaryType +PASS WebSocket interface: operation send(USVString) +PASS WebSocket interface: operation send(Blob) +PASS WebSocket interface: operation send(ArrayBuffer) +PASS WebSocket interface: operation send(ArrayBufferView) +PASS WebSocket must be primary interface of new WebSocket("ws://invalid") +PASS Stringification of new WebSocket("ws://invalid") +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "url" with the proper type +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "CONNECTING" with the proper type +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "OPEN" with the proper type +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "CLOSING" with the proper type +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "CLOSED" with the proper type +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "readyState" with the proper type +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "bufferedAmount" with the proper type +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "onopen" with the proper type +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "onerror" with the proper type +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "onclose" with the proper type +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "extensions" with the proper type +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "protocol" with the proper type +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "close(optional unsigned short, optional USVString)" with the proper type +PASS WebSocket interface: calling close(optional unsigned short, optional USVString) on new WebSocket("ws://invalid") with too few arguments must throw TypeError +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "onmessage" with the proper type +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "binaryType" with the proper type +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "send(USVString)" with the proper type +PASS WebSocket interface: calling send(USVString) on new WebSocket("ws://invalid") with too few arguments must throw TypeError +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "send(Blob)" with the proper type +PASS WebSocket interface: calling send(Blob) on new WebSocket("ws://invalid") with too few arguments must throw TypeError +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "send(ArrayBuffer)" with the proper type +PASS WebSocket interface: calling send(ArrayBuffer) on new WebSocket("ws://invalid") with too few arguments must throw TypeError +PASS WebSocket interface: new WebSocket("ws://invalid") must inherit property "send(ArrayBufferView)" with the proper type +PASS WebSocket interface: calling send(ArrayBufferView) on new WebSocket("ws://invalid") with too few arguments must throw TypeError +PASS CloseEvent interface: existence and properties of interface object +PASS CloseEvent interface object length +PASS CloseEvent interface object name +PASS CloseEvent interface: existence and properties of interface prototype object +PASS CloseEvent interface: existence and properties of interface prototype object's "constructor" property +PASS CloseEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS CloseEvent interface: attribute wasClean +PASS CloseEvent interface: attribute code +PASS CloseEvent interface: attribute reason +PASS CloseEvent must be primary interface of new CloseEvent("close") +PASS Stringification of new CloseEvent("close") +PASS CloseEvent interface: new CloseEvent("close") must inherit property "wasClean" with the proper type +PASS CloseEvent interface: new CloseEvent("close") must inherit property "code" with the proper type +PASS CloseEvent interface: new CloseEvent("close") must inherit property "reason" with the proper type +PASS MessageChannel interface: existence and properties of interface object +PASS MessageChannel interface object length +PASS MessageChannel interface object name +PASS MessageChannel interface: existence and properties of interface prototype object +PASS MessageChannel interface: existence and properties of interface prototype object's "constructor" property +PASS MessageChannel interface: existence and properties of interface prototype object's @@unscopables property +PASS MessageChannel interface: attribute port1 +PASS MessageChannel interface: attribute port2 +PASS MessagePort interface: existence and properties of interface object +PASS MessagePort interface object length +PASS MessagePort interface object name +PASS MessagePort interface: existence and properties of interface prototype object +PASS MessagePort interface: existence and properties of interface prototype object's "constructor" property +PASS MessagePort interface: existence and properties of interface prototype object's @@unscopables property +PASS MessagePort interface: operation postMessage(any, sequence<object>) +PASS MessagePort interface: operation postMessage(any, optional PostMessageOptions) +PASS MessagePort interface: operation start() +PASS MessagePort interface: operation close() +PASS MessagePort interface: attribute onmessage +PASS MessagePort interface: attribute onmessageerror +PASS BroadcastChannel interface: existence and properties of interface object +PASS BroadcastChannel interface object length +PASS BroadcastChannel interface object name +PASS BroadcastChannel interface: existence and properties of interface prototype object +PASS BroadcastChannel interface: existence and properties of interface prototype object's "constructor" property +PASS BroadcastChannel interface: existence and properties of interface prototype object's @@unscopables property +PASS BroadcastChannel interface: attribute name +PASS BroadcastChannel interface: operation postMessage(any) +PASS BroadcastChannel interface: operation close() +PASS BroadcastChannel interface: attribute onmessage +PASS BroadcastChannel interface: attribute onmessageerror +PASS WorkerGlobalScope interface: existence and properties of interface object +PASS WorkerGlobalScope interface object length +PASS WorkerGlobalScope interface object name +PASS WorkerGlobalScope interface: existence and properties of interface prototype object +PASS WorkerGlobalScope interface: existence and properties of interface prototype object's "constructor" property +PASS WorkerGlobalScope interface: existence and properties of interface prototype object's @@unscopables property +PASS WorkerGlobalScope interface: attribute self +PASS WorkerGlobalScope interface: attribute location +PASS WorkerGlobalScope interface: attribute navigator +PASS WorkerGlobalScope interface: operation importScripts(USVString...) +PASS WorkerGlobalScope interface: attribute onerror +PASS WorkerGlobalScope interface: attribute onlanguagechange +FAIL WorkerGlobalScope interface: attribute onoffline assert_true: The prototype object must have a property "onoffline" expected true got false +FAIL WorkerGlobalScope interface: attribute ononline assert_true: The prototype object must have a property "ononline" expected true got false +PASS WorkerGlobalScope interface: attribute onrejectionhandled +PASS WorkerGlobalScope interface: attribute onunhandledrejection +PASS WorkerGlobalScope interface: attribute origin +PASS WorkerGlobalScope interface: attribute isSecureContext +PASS WorkerGlobalScope interface: attribute crossOriginIsolated +PASS WorkerGlobalScope interface: operation btoa(DOMString) +PASS WorkerGlobalScope interface: operation atob(DOMString) +PASS WorkerGlobalScope interface: operation setTimeout(TimerHandler, optional long, any...) +PASS WorkerGlobalScope interface: operation clearTimeout(optional long) +PASS WorkerGlobalScope interface: operation setInterval(TimerHandler, optional long, any...) +PASS WorkerGlobalScope interface: operation clearInterval(optional long) +PASS WorkerGlobalScope interface: operation queueMicrotask(VoidFunction) +PASS WorkerGlobalScope interface: operation createImageBitmap(ImageBitmapSource, optional ImageBitmapOptions) +PASS WorkerGlobalScope interface: operation createImageBitmap(ImageBitmapSource, long, long, long, long, optional ImageBitmapOptions) +PASS DedicatedWorkerGlobalScope interface: existence and properties of interface object +PASS DedicatedWorkerGlobalScope interface object length +PASS DedicatedWorkerGlobalScope interface object name +PASS DedicatedWorkerGlobalScope interface: existence and properties of interface prototype object +PASS DedicatedWorkerGlobalScope interface: internal [[SetPrototypeOf]] method of interface prototype object - setting to a new value via Object.setPrototypeOf should throw a TypeError +PASS DedicatedWorkerGlobalScope interface: internal [[SetPrototypeOf]] method of interface prototype object - setting to a new value via __proto__ should throw a TypeError +PASS DedicatedWorkerGlobalScope interface: internal [[SetPrototypeOf]] method of interface prototype object - setting to a new value via Reflect.setPrototypeOf should return false +PASS DedicatedWorkerGlobalScope interface: internal [[SetPrototypeOf]] method of interface prototype object - setting to its original value via Object.setPrototypeOf should not throw +PASS DedicatedWorkerGlobalScope interface: internal [[SetPrototypeOf]] method of interface prototype object - setting to its original value via __proto__ should not throw +PASS DedicatedWorkerGlobalScope interface: internal [[SetPrototypeOf]] method of interface prototype object - setting to its original value via Reflect.setPrototypeOf should return true +PASS DedicatedWorkerGlobalScope interface: existence and properties of interface prototype object's "constructor" property +PASS DedicatedWorkerGlobalScope interface: existence and properties of interface prototype object's @@unscopables property +PASS DedicatedWorkerGlobalScope interface: attribute name +PASS DedicatedWorkerGlobalScope interface: operation postMessage(any, sequence<object>) +PASS DedicatedWorkerGlobalScope interface: operation postMessage(any, optional PostMessageOptions) +PASS DedicatedWorkerGlobalScope interface: operation close() +PASS DedicatedWorkerGlobalScope interface: attribute onmessage +PASS DedicatedWorkerGlobalScope interface: attribute onmessageerror +PASS DedicatedWorkerGlobalScope interface: operation requestAnimationFrame(FrameRequestCallback) +PASS DedicatedWorkerGlobalScope interface: operation cancelAnimationFrame(unsigned long) +PASS DedicatedWorkerGlobalScope interface: internal [[SetPrototypeOf]] method of global platform object - setting to a new value via Object.setPrototypeOf should throw a TypeError +PASS DedicatedWorkerGlobalScope interface: internal [[SetPrototypeOf]] method of global platform object - setting to a new value via __proto__ should throw a TypeError +PASS DedicatedWorkerGlobalScope interface: internal [[SetPrototypeOf]] method of global platform object - setting to a new value via Reflect.setPrototypeOf should return false +PASS DedicatedWorkerGlobalScope interface: internal [[SetPrototypeOf]] method of global platform object - setting to its original value via Object.setPrototypeOf should not throw +PASS DedicatedWorkerGlobalScope interface: internal [[SetPrototypeOf]] method of global platform object - setting to its original value via __proto__ should not throw +PASS DedicatedWorkerGlobalScope interface: internal [[SetPrototypeOf]] method of global platform object - setting to its original value via Reflect.setPrototypeOf should return true +PASS DedicatedWorkerGlobalScope must be primary interface of self +PASS Stringification of self +PASS DedicatedWorkerGlobalScope interface: self must inherit property "name" with the proper type +PASS DedicatedWorkerGlobalScope interface: self must inherit property "postMessage(any, sequence<object>)" with the proper type +PASS DedicatedWorkerGlobalScope interface: calling postMessage(any, sequence<object>) on self with too few arguments must throw TypeError +PASS DedicatedWorkerGlobalScope interface: self must inherit property "postMessage(any, optional PostMessageOptions)" with the proper type +PASS DedicatedWorkerGlobalScope interface: calling postMessage(any, optional PostMessageOptions) on self with too few arguments must throw TypeError +PASS DedicatedWorkerGlobalScope interface: self must inherit property "close()" with the proper type +PASS DedicatedWorkerGlobalScope interface: self must inherit property "onmessage" with the proper type +PASS DedicatedWorkerGlobalScope interface: self must inherit property "onmessageerror" with the proper type +PASS DedicatedWorkerGlobalScope interface: self must inherit property "requestAnimationFrame(FrameRequestCallback)" with the proper type +PASS DedicatedWorkerGlobalScope interface: calling requestAnimationFrame(FrameRequestCallback) on self with too few arguments must throw TypeError +PASS DedicatedWorkerGlobalScope interface: self must inherit property "cancelAnimationFrame(unsigned long)" with the proper type +PASS DedicatedWorkerGlobalScope interface: calling cancelAnimationFrame(unsigned long) on self with too few arguments must throw TypeError +PASS WorkerGlobalScope interface: self must inherit property "self" with the proper type +PASS WorkerGlobalScope interface: self must inherit property "location" with the proper type +PASS WorkerGlobalScope interface: self must inherit property "navigator" with the proper type +PASS WorkerGlobalScope interface: self must inherit property "importScripts(USVString...)" with the proper type +PASS WorkerGlobalScope interface: calling importScripts(USVString...) on self with too few arguments must throw TypeError +PASS WorkerGlobalScope interface: self must inherit property "onerror" with the proper type +PASS WorkerGlobalScope interface: self must inherit property "onlanguagechange" with the proper type +FAIL WorkerGlobalScope interface: self must inherit property "onoffline" with the proper type assert_inherits: property "onoffline" not found in prototype chain +FAIL WorkerGlobalScope interface: self must inherit property "ononline" with the proper type assert_inherits: property "ononline" not found in prototype chain +PASS WorkerGlobalScope interface: self must inherit property "onrejectionhandled" with the proper type +PASS WorkerGlobalScope interface: self must inherit property "onunhandledrejection" with the proper type +PASS WorkerGlobalScope interface: self must inherit property "origin" with the proper type +PASS WorkerGlobalScope interface: self must inherit property "isSecureContext" with the proper type +PASS WorkerGlobalScope interface: self must inherit property "crossOriginIsolated" with the proper type +PASS WorkerGlobalScope interface: self must inherit property "btoa(DOMString)" with the proper type +PASS WorkerGlobalScope interface: calling btoa(DOMString) on self with too few arguments must throw TypeError +PASS WorkerGlobalScope interface: self must inherit property "atob(DOMString)" with the proper type +PASS WorkerGlobalScope interface: calling atob(DOMString) on self with too few arguments must throw TypeError +PASS WorkerGlobalScope interface: self must inherit property "setTimeout(TimerHandler, optional long, any...)" with the proper type +PASS WorkerGlobalScope interface: calling setTimeout(TimerHandler, optional long, any...) on self with too few arguments must throw TypeError +PASS WorkerGlobalScope interface: self must inherit property "clearTimeout(optional long)" with the proper type +PASS WorkerGlobalScope interface: calling clearTimeout(optional long) on self with too few arguments must throw TypeError +PASS WorkerGlobalScope interface: self must inherit property "setInterval(TimerHandler, optional long, any...)" with the proper type +PASS WorkerGlobalScope interface: calling setInterval(TimerHandler, optional long, any...) on self with too few arguments must throw TypeError +PASS WorkerGlobalScope interface: self must inherit property "clearInterval(optional long)" with the proper type +PASS WorkerGlobalScope interface: calling clearInterval(optional long) on self with too few arguments must throw TypeError +PASS WorkerGlobalScope interface: self must inherit property "queueMicrotask(VoidFunction)" with the proper type +PASS WorkerGlobalScope interface: calling queueMicrotask(VoidFunction) on self with too few arguments must throw TypeError +PASS WorkerGlobalScope interface: self must inherit property "createImageBitmap(ImageBitmapSource, optional ImageBitmapOptions)" with the proper type +PASS WorkerGlobalScope interface: calling createImageBitmap(ImageBitmapSource, optional ImageBitmapOptions) on self with too few arguments must throw TypeError +PASS WorkerGlobalScope interface: self must inherit property "createImageBitmap(ImageBitmapSource, long, long, long, long, optional ImageBitmapOptions)" with the proper type +PASS WorkerGlobalScope interface: calling createImageBitmap(ImageBitmapSource, long, long, long, long, optional ImageBitmapOptions) on self with too few arguments must throw TypeError +PASS SharedWorkerGlobalScope interface: existence and properties of interface object +PASS Worker interface: existence and properties of interface object +PASS Worker interface object length +PASS Worker interface object name +PASS Worker interface: existence and properties of interface prototype object +PASS Worker interface: existence and properties of interface prototype object's "constructor" property +PASS Worker interface: existence and properties of interface prototype object's @@unscopables property +PASS Worker interface: operation terminate() +PASS Worker interface: operation postMessage(any, sequence<object>) +PASS Worker interface: operation postMessage(any, optional PostMessageOptions) +PASS Worker interface: attribute onmessage +FAIL Worker interface: attribute onmessageerror assert_true: The prototype object must have a property "onmessageerror" expected true got false +PASS Worker interface: attribute onerror +PASS SharedWorker interface: existence and properties of interface object +PASS WorkerNavigator interface: existence and properties of interface object +PASS WorkerNavigator interface object length +PASS WorkerNavigator interface object name +PASS WorkerNavigator interface: existence and properties of interface prototype object +PASS WorkerNavigator interface: existence and properties of interface prototype object's "constructor" property +PASS WorkerNavigator interface: existence and properties of interface prototype object's @@unscopables property +PASS WorkerNavigator interface: attribute appCodeName +PASS WorkerNavigator interface: attribute appName +PASS WorkerNavigator interface: attribute appVersion +PASS WorkerNavigator interface: attribute platform +PASS WorkerNavigator interface: attribute product +PASS WorkerNavigator interface: member productSub +PASS WorkerNavigator interface: attribute userAgent +PASS WorkerNavigator interface: member vendor +PASS WorkerNavigator interface: member vendorSub +PASS WorkerNavigator interface: member taintEnabled +PASS WorkerNavigator interface: member oscpu +PASS WorkerNavigator interface: attribute language +PASS WorkerNavigator interface: attribute languages +PASS WorkerNavigator interface: attribute onLine +PASS WorkerNavigator interface: attribute hardwareConcurrency +PASS WorkerNavigator must be primary interface of self.navigator +PASS Stringification of self.navigator +PASS WorkerNavigator interface: self.navigator must inherit property "appCodeName" with the proper type +PASS WorkerNavigator interface: self.navigator must inherit property "appName" with the proper type +PASS WorkerNavigator interface: self.navigator must inherit property "appVersion" with the proper type +PASS WorkerNavigator interface: self.navigator must inherit property "platform" with the proper type +PASS WorkerNavigator interface: self.navigator must inherit property "product" with the proper type +PASS WorkerNavigator interface: self.navigator must not have property "productSub" +PASS WorkerNavigator interface: self.navigator must inherit property "userAgent" with the proper type +PASS WorkerNavigator interface: self.navigator must not have property "vendor" +PASS WorkerNavigator interface: self.navigator must not have property "vendorSub" +PASS WorkerNavigator interface: self.navigator must not have property "taintEnabled" +PASS WorkerNavigator interface: self.navigator must not have property "oscpu" +PASS WorkerNavigator interface: self.navigator must inherit property "language" with the proper type +PASS WorkerNavigator interface: self.navigator must inherit property "languages" with the proper type +PASS WorkerNavigator interface: self.navigator must inherit property "onLine" with the proper type +PASS WorkerNavigator interface: self.navigator must inherit property "hardwareConcurrency" with the proper type +PASS WorkerLocation interface: existence and properties of interface object +PASS WorkerLocation interface object length +PASS WorkerLocation interface object name +PASS WorkerLocation interface: existence and properties of interface prototype object +PASS WorkerLocation interface: existence and properties of interface prototype object's "constructor" property +PASS WorkerLocation interface: existence and properties of interface prototype object's @@unscopables property +PASS WorkerLocation interface: attribute href +PASS WorkerLocation interface: stringifier +PASS WorkerLocation interface: attribute origin +PASS WorkerLocation interface: attribute protocol +PASS WorkerLocation interface: attribute host +PASS WorkerLocation interface: attribute hostname +PASS WorkerLocation interface: attribute port +PASS WorkerLocation interface: attribute pathname +PASS WorkerLocation interface: attribute search +PASS WorkerLocation interface: attribute hash +PASS WorkerLocation must be primary interface of self.location +PASS Stringification of self.location +PASS WorkerLocation interface: self.location must inherit property "href" with the proper type +PASS WorkerLocation interface: self.location must inherit property "origin" with the proper type +PASS WorkerLocation interface: self.location must inherit property "protocol" with the proper type +PASS WorkerLocation interface: self.location must inherit property "host" with the proper type +PASS WorkerLocation interface: self.location must inherit property "hostname" with the proper type +PASS WorkerLocation interface: self.location must inherit property "port" with the proper type +PASS WorkerLocation interface: self.location must inherit property "pathname" with the proper type +PASS WorkerLocation interface: self.location must inherit property "search" with the proper type +PASS WorkerLocation interface: self.location must inherit property "hash" with the proper type +PASS WorkletGlobalScope interface: existence and properties of interface object +PASS Worklet interface: existence and properties of interface object +PASS Storage interface: existence and properties of interface object +PASS StorageEvent interface: existence and properties of interface object +PASS HTMLMarqueeElement interface: existence and properties of interface object +PASS HTMLFrameSetElement interface: existence and properties of interface object +PASS HTMLFrameElement interface: existence and properties of interface object +PASS HTMLDirectoryElement interface: existence and properties of interface object +PASS HTMLFontElement interface: existence and properties of interface object +PASS External interface: existence and properties of interface object +PASS PluginArray interface: existence and properties of interface object +PASS MimeTypeArray interface: existence and properties of interface object +PASS Plugin interface: existence and properties of interface object +PASS MimeType interface: existence and properties of interface object +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/mac-mac-arm11.0/external/wpt/webrtc-encoded-transform/idlharness.https.window-expected.txt b/third_party/blink/web_tests/platform/mac-mac-arm11.0/external/wpt/webrtc-encoded-transform/idlharness.https.window-expected.txt new file mode 100644 index 0000000..308dd3c --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac-arm11.0/external/wpt/webrtc-encoded-transform/idlharness.https.window-expected.txt
@@ -0,0 +1,60 @@ +This is a testharness.js-based test. +Found 56 tests; 39 PASS, 17 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS idl_test setup +PASS idl_test validation +PASS Partial dictionary RTCConfiguration: original dictionary defined +PASS Partial dictionary RTCConfiguration: member names are unique +PASS Partial interface RTCRtpSender: original interface defined +PASS Partial interface RTCRtpSender: member names are unique +PASS Partial interface RTCRtpReceiver: original interface defined +PASS Partial interface RTCRtpReceiver: member names are unique +PASS Partial interface DedicatedWorkerGlobalScope: original interface defined +PASS Partial interface DedicatedWorkerGlobalScope: member names are unique +PASS Partial interface RTCRtpSender[2]: member names are unique +PASS SFrameTransform includes GenericTransformStream: member names are unique +PASS WorkerGlobalScope includes WindowOrWorkerGlobalScope: member names are unique +PASS DedicatedWorkerGlobalScope includes AnimationFrameProvider: member names are unique +FAIL SFrameTransform interface: existence and properties of interface object assert_own_property: self does not have own property "SFrameTransform" expected property "SFrameTransform" missing +FAIL SFrameTransform interface object length assert_own_property: self does not have own property "SFrameTransform" expected property "SFrameTransform" missing +FAIL SFrameTransform interface object name assert_own_property: self does not have own property "SFrameTransform" expected property "SFrameTransform" missing +FAIL SFrameTransform interface: existence and properties of interface prototype object assert_own_property: self does not have own property "SFrameTransform" expected property "SFrameTransform" missing +FAIL SFrameTransform interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "SFrameTransform" expected property "SFrameTransform" missing +FAIL SFrameTransform interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "SFrameTransform" expected property "SFrameTransform" missing +FAIL SFrameTransform interface: operation setEncryptionKey(CryptoKey, optional CryptoKeyID) assert_own_property: self does not have own property "SFrameTransform" expected property "SFrameTransform" missing +PASS RTCEncodedVideoFrame interface: existence and properties of interface object +PASS RTCEncodedVideoFrame interface object length +PASS RTCEncodedVideoFrame interface object name +PASS RTCEncodedVideoFrame interface: existence and properties of interface prototype object +PASS RTCEncodedVideoFrame interface: existence and properties of interface prototype object's "constructor" property +PASS RTCEncodedVideoFrame interface: existence and properties of interface prototype object's @@unscopables property +PASS RTCEncodedVideoFrame interface: attribute type +PASS RTCEncodedVideoFrame interface: attribute timestamp +PASS RTCEncodedVideoFrame interface: attribute data +PASS RTCEncodedVideoFrame interface: operation getMetadata() +PASS RTCEncodedAudioFrame interface: existence and properties of interface object +PASS RTCEncodedAudioFrame interface object length +PASS RTCEncodedAudioFrame interface object name +PASS RTCEncodedAudioFrame interface: existence and properties of interface prototype object +PASS RTCEncodedAudioFrame interface: existence and properties of interface prototype object's "constructor" property +PASS RTCEncodedAudioFrame interface: existence and properties of interface prototype object's @@unscopables property +PASS RTCEncodedAudioFrame interface: attribute timestamp +PASS RTCEncodedAudioFrame interface: attribute data +PASS RTCEncodedAudioFrame interface: operation getMetadata() +PASS RTCTransformEvent interface: existence and properties of interface object +PASS RTCRtpScriptTransformer interface: existence and properties of interface object +FAIL RTCRtpScriptTransform interface: existence and properties of interface object assert_own_property: self does not have own property "RTCRtpScriptTransform" expected property "RTCRtpScriptTransform" missing +FAIL RTCRtpScriptTransform interface object length assert_own_property: self does not have own property "RTCRtpScriptTransform" expected property "RTCRtpScriptTransform" missing +FAIL RTCRtpScriptTransform interface object name assert_own_property: self does not have own property "RTCRtpScriptTransform" expected property "RTCRtpScriptTransform" missing +FAIL RTCRtpScriptTransform interface: existence and properties of interface prototype object assert_own_property: self does not have own property "RTCRtpScriptTransform" expected property "RTCRtpScriptTransform" missing +FAIL RTCRtpScriptTransform interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "RTCRtpScriptTransform" expected property "RTCRtpScriptTransform" missing +FAIL RTCRtpScriptTransform interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "RTCRtpScriptTransform" expected property "RTCRtpScriptTransform" missing +PASS RTCRtpSender interface: operation createEncodedStreams() +FAIL RTCRtpSender interface: attribute transform assert_true: The prototype object must have a property "transform" expected true got false +PASS RTCRtpSender interface: new RTCPeerConnection().addTransceiver('audio').sender must inherit property "createEncodedStreams()" with the proper type +FAIL RTCRtpSender interface: new RTCPeerConnection().addTransceiver('audio').sender must inherit property "transform" with the proper type assert_inherits: property "transform" not found in prototype chain +PASS RTCRtpReceiver interface: operation createEncodedStreams() +FAIL RTCRtpReceiver interface: attribute transform assert_true: The prototype object must have a property "transform" expected true got false +PASS RTCRtpReceiver interface: new RTCPeerConnection().addTransceiver('audio').receiver must inherit property "createEncodedStreams()" with the proper type +FAIL RTCRtpReceiver interface: new RTCPeerConnection().addTransceiver('audio').receiver must inherit property "transform" with the proper type assert_inherits: property "transform" not found in prototype chain +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.png new file mode 100644 index 0000000..0e5d90b --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.txt new file mode 100644 index 0000000..32fe1d4 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.txt
@@ -0,0 +1,19 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [244, 102, 121, 44], + [203, 334, 121, 44], + [108, 82, 105, 102], + [355, 123, 104, 104], + [352, 396, 99, 98], + [90, 205, 98, 99] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-svg-as-image-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-svg-as-image-expected.png new file mode 100644 index 0000000..db2ae874 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-svg-as-image-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-svg-as-image-same-image-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-svg-as-image-same-image-expected.png new file mode 100644 index 0000000..db2ae874 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-svg-as-image-same-image-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/filter-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/filter-repaint-expected.png new file mode 100644 index 0000000..75a7bfb --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/filter-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/filter-width-update-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/filter-width-update-expected.png new file mode 100644 index 0000000..b28fe38a --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/filter-width-update-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/hit-test-unclosed-subpaths-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/hit-test-unclosed-subpaths-expected.png new file mode 100644 index 0000000..a8f06f7 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/hit-test-unclosed-subpaths-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/inner-svg-change-viewPort-relative-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/inner-svg-change-viewPort-relative-expected.png new file mode 100644 index 0000000..fbe9f4b --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/inner-svg-change-viewPort-relative-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/tabgroup-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/tabgroup-expected.png new file mode 100644 index 0000000..88033d33 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/tabgroup-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/text-repaint-including-stroke-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/text-repaint-including-stroke-expected.png new file mode 100644 index 0000000..955fe80 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/text-repaint-including-stroke-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/text-xy-updates-SVGList-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/text-xy-updates-SVGList-expected.png new file mode 100644 index 0000000..8ed5d56 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/text-xy-updates-SVGList-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/window-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/window-expected.png new file mode 100644 index 0000000..8877b74 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/window-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/zoom-coords-viewattr-01-b-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/zoom-coords-viewattr-01-b-expected.png new file mode 100644 index 0000000..d61b416 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/paint/invalidation/svg/zoom-coords-viewattr-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-1-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-1-expected.png new file mode 100644 index 0000000..302c54b --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-1-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-5-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-5-expected.png new file mode 100644 index 0000000..59780b8 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-5-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-6-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-6-expected.png new file mode 100644 index 0000000..8186c4c0 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-6-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/clip-path/clip-path-pixelation-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/clip-path/clip-path-pixelation-expected.png new file mode 100644 index 0000000..21fb3e3 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/clip-path/clip-path-pixelation-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/clip-path/deep-nested-clip-in-mask-panning-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/clip-path/deep-nested-clip-in-mask-panning-expected.png new file mode 100644 index 0000000..8b83fbc --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/clip-path/deep-nested-clip-in-mask-panning-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-dom-in-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-dom-in-attr-expected.png new file mode 100644 index 0000000..7a5e7fce --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-dom-in-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-dom-operator-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-dom-operator-attr-expected.png new file mode 100644 index 0000000..532ba7f --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-dom-operator-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-dom-radius-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-dom-radius-attr-expected.png new file mode 100644 index 0000000..532ba7f --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-dom-radius-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-svgdom-in-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-svgdom-in-prop-expected.png new file mode 100644 index 0000000..7a5e7fce --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-svgdom-in-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-svgdom-operator-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-svgdom-operator-prop-expected.png new file mode 100644 index 0000000..532ba7f --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-svgdom-operator-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-svgdom-radius-call-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-svgdom-radius-call-expected.png new file mode 100644 index 0000000..532ba7f --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGFEMorphologyElement-svgdom-radius-call-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-dx-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-dx-attr-expected.png new file mode 100644 index 0000000..3c021f13 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-dx-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-dy-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-dy-attr-expected.png new file mode 100644 index 0000000..3c021f13 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-dy-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-x-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-x-attr-expected.png new file mode 100644 index 0000000..3c021f13 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-x-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-y-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-y-attr-expected.png new file mode 100644 index 0000000..3c021f13 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-dom-y-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-dx-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-dx-prop-expected.png new file mode 100644 index 0000000..3c021f13 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-dx-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-dy-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-dy-prop-expected.png new file mode 100644 index 0000000..3c021f13 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-dy-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-rotate-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-rotate-prop-expected.png new file mode 100644 index 0000000..3113426b --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-rotate-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-transform-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-transform-prop-expected.png new file mode 100644 index 0000000..7e2b27a --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-transform-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-x-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-x-prop-expected.png new file mode 100644 index 0000000..3c021f13 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-x-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-y-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-y-prop-expected.png new file mode 100644 index 0000000..3c021f13 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/dynamic-updates/SVGTextElement-svgdom-y-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/filters/feComposite-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/filters/feComposite-expected.png new file mode 100644 index 0000000..a753dbe --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/filters/feComposite-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/wicd/test-scalable-background-image2-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/wicd/test-scalable-background-image2-expected.png new file mode 100644 index 0000000..7c54578 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/wicd/test-scalable-background-image2-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/zoom/page/zoom-coords-viewattr-01-b-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/zoom/page/zoom-coords-viewattr-01-b-expected.png new file mode 100644 index 0000000..26dd7fcb --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/zoom/page/zoom-coords-viewattr-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.png new file mode 100644 index 0000000..3ac5f14 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.png new file mode 100644 index 0000000..3ac5f14 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_svg_text/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/external/wpt/css/mediaqueries/test_media_queries-expected.txt b/third_party/blink/web_tests/platform/mac/external/wpt/css/mediaqueries/test_media_queries-expected.txt index d81c997..9e7bb736 100644 --- a/third_party/blink/web_tests/platform/mac/external/wpt/css/mediaqueries/test_media_queries-expected.txt +++ b/third_party/blink/web_tests/platform/mac/external/wpt/css/mediaqueries/test_media_queries-expected.txt
@@ -395,128 +395,128 @@ PASS subtest_392 PASS subtest_393 PASS subtest_394 -PASS subtest_395: all and (width: 117px) should apply -FAIL subtest_396: all and (width = 117px) should apply assert_true: expected true got false -PASS subtest_397: all and (width: 118px) should not apply -PASS subtest_398: all and (width: 116px) should not apply -PASS subtest_399: all and (width = 118px) should not apply -PASS subtest_400: all and (width = 116px) should not apply -PASS subtest_401: all and (min-width: 117px) should apply -PASS subtest_402: all and (min-width: 118px) should not apply -PASS subtest_403: all and (min-width: 116px) should apply -PASS subtest_404: all and (max-width: 117px) should apply -PASS subtest_405: all and (max-width: 118px) should apply -PASS subtest_406: all and (max-width: 116px) should not apply -PASS subtest_407: all and (min-width: 9em) should not apply -PASS subtest_408: all and (min-width: 6em) should apply -PASS subtest_409: all and (max-width: 9em) should apply -PASS subtest_410: all and (max-width: 6em) should not apply -FAIL subtest_411: (width <= 117px) should apply assert_true: expected true got false -FAIL subtest_412: (width >= 117px) should apply assert_true: expected true got false -PASS subtest_413: (width < 117px) should not apply -PASS subtest_414: (width > 117px) should not apply -FAIL subtest_415: (width < 118px) should apply assert_true: expected true got false -FAIL subtest_416: (width <= 118px) should apply assert_true: expected true got false -PASS subtest_417: (width > 118px) should not apply -PASS subtest_418: (width >= 118px) should not apply -FAIL subtest_419: (width > 116px) should apply assert_true: expected true got false -FAIL subtest_420: (width >= 116px) should apply assert_true: expected true got false -PASS subtest_421: (width < 116px) should not apply -PASS subtest_422: (width <= 116px) should not apply -PASS subtest_423: all and (height: 76px) should apply -FAIL subtest_424: all and (height = 76px) should apply assert_true: expected true got false -PASS subtest_425: all and (height: 77px) should not apply -PASS subtest_426: all and (height: 75px) should not apply -PASS subtest_427: all and (height = 77px) should not apply -PASS subtest_428: all and (height = 75px) should not apply -PASS subtest_429: all and (min-height: 76px) should apply -PASS subtest_430: all and (min-height: 77px) should not apply -PASS subtest_431: all and (min-height: 75px) should apply -PASS subtest_432: all and (max-height: 76px) should apply -PASS subtest_433: all and (max-height: 77px) should apply -PASS subtest_434: all and (max-height: 75px) should not apply -PASS subtest_435: all and (min-height: 6em) should not apply -PASS subtest_436: all and (min-height: 3em) should apply -PASS subtest_437: all and (max-height: 6em) should apply -PASS subtest_438: all and (max-height: 3em) should not apply -FAIL subtest_439: (height <= 76px) should apply assert_true: expected true got false -FAIL subtest_440: (height >= 76px) should apply assert_true: expected true got false -PASS subtest_441: (height < 76px) should not apply -PASS subtest_442: (height > 76px) should not apply -FAIL subtest_443: (height < 77px) should apply assert_true: expected true got false -FAIL subtest_444: (height <= 77px) should apply assert_true: expected true got false -PASS subtest_445: (height > 77px) should not apply -PASS subtest_446: (height >= 77px) should not apply -FAIL subtest_447: (height > 75px) should apply assert_true: expected true got false -FAIL subtest_448: (height >= 75px) should apply assert_true: expected true got false -PASS subtest_449: (height < 75px) should not apply -PASS subtest_450: (height <= 75px) should not apply -PASS subtest_451: all and (device-width: 1280px) should apply -FAIL subtest_452: all and (device-width = 1280px) should apply assert_true: expected true got false -PASS subtest_453: all and (device-width: 1281px) should not apply -PASS subtest_454: all and (device-width: 1279px) should not apply -PASS subtest_455: all and (device-width = 1281px) should not apply -PASS subtest_456: all and (device-width = 1279px) should not apply -PASS subtest_457: all and (min-device-width: 1280px) should apply -PASS subtest_458: all and (min-device-width: 1281px) should not apply -PASS subtest_459: all and (min-device-width: 1279px) should apply -PASS subtest_460: all and (max-device-width: 1280px) should apply -PASS subtest_461: all and (max-device-width: 1281px) should apply -PASS subtest_462: all and (max-device-width: 1279px) should not apply -PASS subtest_463: all and (min-device-width: 81em) should not apply -PASS subtest_464: all and (min-device-width: 79em) should apply -PASS subtest_465: all and (max-device-width: 81em) should apply -PASS subtest_466: all and (max-device-width: 79em) should not apply -FAIL subtest_467: (device-width <= 1280px) should apply assert_true: expected true got false -FAIL subtest_468: (device-width >= 1280px) should apply assert_true: expected true got false -PASS subtest_469: (device-width < 1280px) should not apply -PASS subtest_470: (device-width > 1280px) should not apply -FAIL subtest_471: (device-width < 1281px) should apply assert_true: expected true got false -FAIL subtest_472: (device-width <= 1281px) should apply assert_true: expected true got false -PASS subtest_473: (device-width > 1281px) should not apply -PASS subtest_474: (device-width >= 1281px) should not apply -FAIL subtest_475: (device-width > 1279px) should apply assert_true: expected true got false -FAIL subtest_476: (device-width >= 1279px) should apply assert_true: expected true got false -PASS subtest_477: (device-width < 1279px) should not apply -PASS subtest_478: (device-width <= 1279px) should not apply -PASS subtest_479: all and (device-height: 1024px) should apply -FAIL subtest_480: all and (device-height = 1024px) should apply assert_true: expected true got false -PASS subtest_481: all and (device-height: 1025px) should not apply -PASS subtest_482: all and (device-height: 1023px) should not apply -PASS subtest_483: all and (device-height = 1025px) should not apply -PASS subtest_484: all and (device-height = 1023px) should not apply -PASS subtest_485: all and (min-device-height: 1024px) should apply -PASS subtest_486: all and (min-device-height: 1025px) should not apply -PASS subtest_487: all and (min-device-height: 1023px) should apply -PASS subtest_488: all and (max-device-height: 1024px) should apply -PASS subtest_489: all and (max-device-height: 1025px) should apply -PASS subtest_490: all and (max-device-height: 1023px) should not apply -PASS subtest_491: all and (min-device-height: 65em) should not apply -PASS subtest_492: all and (min-device-height: 63em) should apply -PASS subtest_493: all and (max-device-height: 65em) should apply -PASS subtest_494: all and (max-device-height: 63em) should not apply -FAIL subtest_495: (device-height <= 1024px) should apply assert_true: expected true got false -FAIL subtest_496: (device-height >= 1024px) should apply assert_true: expected true got false -PASS subtest_497: (device-height < 1024px) should not apply -PASS subtest_498: (device-height > 1024px) should not apply -FAIL subtest_499: (device-height < 1025px) should apply assert_true: expected true got false -FAIL subtest_500: (device-height <= 1025px) should apply assert_true: expected true got false -PASS subtest_501: (device-height > 1025px) should not apply -PASS subtest_502: (device-height >= 1025px) should not apply -FAIL subtest_503: (device-height > 1023px) should apply assert_true: expected true got false -FAIL subtest_504: (device-height >= 1023px) should apply assert_true: expected true got false -PASS subtest_505: (device-height < 1023px) should not apply -PASS subtest_506: (device-height <= 1023px) should not apply -PASS subtest_507: all and (height) should apply -PASS subtest_508: all and (width) should not apply -PASS subtest_509: all and (height) should not apply -PASS subtest_510: all and (width) should not apply -PASS subtest_511: all and (device-height) should apply -PASS subtest_512: all and (device-width) should apply -PASS subtest_513: all and (height) should not apply -PASS subtest_514: all and (width) should apply -PASS subtest_515: all and (height) should apply -PASS subtest_516: all and (width) should apply +PASS subtest_395 +FAIL subtest_396 assert_true: all and (width = 117px) should apply expected true got false +PASS subtest_397 +PASS subtest_398 +PASS subtest_399 +PASS subtest_400 +PASS subtest_401 +PASS subtest_402 +PASS subtest_403 +PASS subtest_404 +PASS subtest_405 +PASS subtest_406 +PASS subtest_407 +PASS subtest_408 +PASS subtest_409 +PASS subtest_410 +FAIL subtest_411 assert_true: (width <= 117px) should apply expected true got false +FAIL subtest_412 assert_true: (width >= 117px) should apply expected true got false +PASS subtest_413 +PASS subtest_414 +FAIL subtest_415 assert_true: (width < 118px) should apply expected true got false +FAIL subtest_416 assert_true: (width <= 118px) should apply expected true got false +PASS subtest_417 +PASS subtest_418 +FAIL subtest_419 assert_true: (width > 116px) should apply expected true got false +FAIL subtest_420 assert_true: (width >= 116px) should apply expected true got false +PASS subtest_421 +PASS subtest_422 +PASS subtest_423 +FAIL subtest_424 assert_true: all and (height = 76px) should apply expected true got false +PASS subtest_425 +PASS subtest_426 +PASS subtest_427 +PASS subtest_428 +PASS subtest_429 +PASS subtest_430 +PASS subtest_431 +PASS subtest_432 +PASS subtest_433 +PASS subtest_434 +PASS subtest_435 +PASS subtest_436 +PASS subtest_437 +PASS subtest_438 +FAIL subtest_439 assert_true: (height <= 76px) should apply expected true got false +FAIL subtest_440 assert_true: (height >= 76px) should apply expected true got false +PASS subtest_441 +PASS subtest_442 +FAIL subtest_443 assert_true: (height < 77px) should apply expected true got false +FAIL subtest_444 assert_true: (height <= 77px) should apply expected true got false +PASS subtest_445 +PASS subtest_446 +FAIL subtest_447 assert_true: (height > 75px) should apply expected true got false +FAIL subtest_448 assert_true: (height >= 75px) should apply expected true got false +PASS subtest_449 +PASS subtest_450 +PASS subtest_451 +FAIL subtest_452 assert_true: all and (device-width = 1280px) should apply expected true got false +PASS subtest_453 +PASS subtest_454 +PASS subtest_455 +PASS subtest_456 +PASS subtest_457 +PASS subtest_458 +PASS subtest_459 +PASS subtest_460 +PASS subtest_461 +PASS subtest_462 +PASS subtest_463 +PASS subtest_464 +PASS subtest_465 +PASS subtest_466 +FAIL subtest_467 assert_true: (device-width <= 1280px) should apply expected true got false +FAIL subtest_468 assert_true: (device-width >= 1280px) should apply expected true got false +PASS subtest_469 +PASS subtest_470 +FAIL subtest_471 assert_true: (device-width < 1281px) should apply expected true got false +FAIL subtest_472 assert_true: (device-width <= 1281px) should apply expected true got false +PASS subtest_473 +PASS subtest_474 +FAIL subtest_475 assert_true: (device-width > 1279px) should apply expected true got false +FAIL subtest_476 assert_true: (device-width >= 1279px) should apply expected true got false +PASS subtest_477 +PASS subtest_478 +PASS subtest_479 +FAIL subtest_480 assert_true: all and (device-height = 1024px) should apply expected true got false +PASS subtest_481 +PASS subtest_482 +PASS subtest_483 +PASS subtest_484 +PASS subtest_485 +PASS subtest_486 +PASS subtest_487 +PASS subtest_488 +PASS subtest_489 +PASS subtest_490 +PASS subtest_491 +PASS subtest_492 +PASS subtest_493 +PASS subtest_494 +FAIL subtest_495 assert_true: (device-height <= 1024px) should apply expected true got false +FAIL subtest_496 assert_true: (device-height >= 1024px) should apply expected true got false +PASS subtest_497 +PASS subtest_498 +FAIL subtest_499 assert_true: (device-height < 1025px) should apply expected true got false +FAIL subtest_500 assert_true: (device-height <= 1025px) should apply expected true got false +PASS subtest_501 +PASS subtest_502 +FAIL subtest_503 assert_true: (device-height > 1023px) should apply expected true got false +FAIL subtest_504 assert_true: (device-height >= 1023px) should apply expected true got false +PASS subtest_505 +PASS subtest_506 +PASS subtest_507 +PASS subtest_508 +PASS subtest_509 +PASS subtest_510 +PASS subtest_511 +PASS subtest_512 +PASS subtest_513 +PASS subtest_514 +PASS subtest_515 +PASS subtest_516 PASS subtest_517 PASS subtest_518 PASS subtest_519 @@ -526,56 +526,56 @@ PASS subtest_523 PASS subtest_524 PASS subtest_525 -PASS subtest_526: (orientation) should apply -PASS subtest_527: (orientation: landscape) should apply -PASS subtest_528: (orientation: portrait) should not apply -PASS subtest_529: not all and (orientation: portrait) should apply -PASS subtest_530: (orientation) should apply -PASS subtest_531: (orientation: landscape) should not apply -PASS subtest_532: not all and (orientation: landscape) should apply -PASS subtest_533: (orientation: portrait) should apply -PASS subtest_534: (aspect-ratio: 59/80) should apply -PASS subtest_535: (aspect-ratio: 58/80) should not apply -PASS subtest_536: (aspect-ratio: 59/81) should not apply -PASS subtest_537: (aspect-ratio: 60/80) should not apply -PASS subtest_538: (aspect-ratio: 59/79) should not apply -PASS subtest_539: (aspect-ratio: 177/240) should apply -PASS subtest_540: (aspect-ratio: 413/560) should apply -PASS subtest_541: (aspect-ratio: 5900/8000) should apply -PASS subtest_542: (aspect-ratio: 5901/8000) should not apply -PASS subtest_543: (aspect-ratio: 5899/8000) should not apply -PASS subtest_544: (aspect-ratio: 5900/8001) should not apply -PASS subtest_545: (aspect-ratio: 5900/7999) should not apply -PASS subtest_546: (aspect-ratio) should apply -PASS subtest_547: (min-aspect-ratio: 59/80) should apply -PASS subtest_548: (min-aspect-ratio: 58/80) should apply -PASS subtest_549: (min-aspect-ratio: 59/81) should apply -PASS subtest_550: (min-aspect-ratio: 60/80) should not apply -PASS subtest_551: (min-aspect-ratio: 59/79) should not apply +PASS subtest_526 +PASS subtest_527 +PASS subtest_528 +PASS subtest_529 +PASS subtest_530 +PASS subtest_531 +PASS subtest_532 +PASS subtest_533 +PASS subtest_534 +PASS subtest_535 +PASS subtest_536 +PASS subtest_537 +PASS subtest_538 +PASS subtest_539 +PASS subtest_540 +PASS subtest_541 +PASS subtest_542 +PASS subtest_543 +PASS subtest_544 +PASS subtest_545 +PASS subtest_546 +PASS subtest_547 +PASS subtest_548 +PASS subtest_549 +PASS subtest_550 +PASS subtest_551 PASS subtest_552 -PASS subtest_553: (max-aspect-ratio: 59/80) should apply -PASS subtest_554: (max-aspect-ratio: 58/80) should not apply -PASS subtest_555: (max-aspect-ratio: 59/81) should not apply -PASS subtest_556: (max-aspect-ratio: 60/80) should apply -PASS subtest_557: (max-aspect-ratio: 59/79) should apply +PASS subtest_553 +PASS subtest_554 +PASS subtest_555 +PASS subtest_556 +PASS subtest_557 PASS subtest_558 -PASS subtest_559: (device-aspect-ratio: 1280/1024) should apply -PASS subtest_560: not all and (device-aspect-ratio: 1281/1024) should apply -PASS subtest_561: all and (device-aspect-ratio: 1280/1023) should not apply -PASS subtest_562: all and (device-aspect-ratio: 1279/1024) should not apply -PASS subtest_563: not all and (device-aspect-ratio: 1280/1025) should apply -PASS subtest_564: (device-aspect-ratio) should apply -PASS subtest_565: (min-device-aspect-ratio: 1280/1024) should apply -PASS subtest_566: all and (min-device-aspect-ratio: 1281/1024) should not apply -PASS subtest_567: not all and (min-device-aspect-ratio: 1280/1023) should apply -PASS subtest_568: not all and (min-device-aspect-ratio: 1279/1024) should not apply -PASS subtest_569: all and (min-device-aspect-ratio: 1280/1025) should apply +PASS subtest_559 +PASS subtest_560 +PASS subtest_561 +PASS subtest_562 +PASS subtest_563 +PASS subtest_564 +PASS subtest_565 +PASS subtest_566 +PASS subtest_567 +PASS subtest_568 +PASS subtest_569 PASS subtest_570 -PASS subtest_571: all and (max-device-aspect-ratio: 1280/1024) should apply -PASS subtest_572: (max-device-aspect-ratio: 1281/1024) should apply -PASS subtest_573: (max-device-aspect-ratio: 1280/1023) should apply -PASS subtest_574: all and (max-device-aspect-ratio: 1279/1024) should not apply -PASS subtest_575: not all and (max-device-aspect-ratio: 1280/1025) should apply +PASS subtest_571 +PASS subtest_572 +PASS subtest_573 +PASS subtest_574 +PASS subtest_575 PASS subtest_576 PASS subtest_577 PASS subtest_578 @@ -619,22 +619,22 @@ PASS subtest_616 PASS monochrome_and_color PASS find_depth -PASS subtest_617: all and (color:8) should apply -PASS subtest_618: all and (color:7) should not apply -PASS subtest_619: all and (color:9) should not apply -PASS subtest_620: all and (max-color:8) should apply -PASS subtest_621: all and (max-color:7) should not apply -PASS subtest_622: all and (max-color:9) should apply -PASS subtest_623: all and (color) should apply +PASS subtest_617 +PASS subtest_618 +PASS subtest_619 +PASS subtest_620 +PASS subtest_621 +PASS subtest_622 +PASS subtest_623 PASS subtest_624 PASS subtest_625 -PASS subtest_626: all and (monochrome) should not apply +PASS subtest_626 PASS subtest_627 PASS subtest_628 -PASS subtest_629: not all and (monochrome) should apply -PASS subtest_630: not all and (color) should not apply -PASS subtest_631: only all and (color) should apply -PASS subtest_632: only all and (monochrome) should not apply +PASS subtest_629 +PASS subtest_630 +PASS subtest_631 +PASS subtest_632 PASS subtest_633 PASS subtest_634 PASS subtest_635 @@ -653,13 +653,13 @@ PASS subtest_648 PASS subtest_649 PASS subtest_650 -PASS subtest_651: (color-index: 0) should apply -PASS subtest_652: (color-index: 1) should not apply -PASS subtest_653: (min-color-index: 0) should apply -PASS subtest_654: (min-color-index: 1) should not apply -PASS subtest_655: (max-color-index: 0) should apply -PASS subtest_656: (max-color-index: 1) should apply -PASS subtest_657: (max-color-index: 157) should apply +PASS subtest_651 +PASS subtest_652 +PASS subtest_653 +PASS subtest_654 +PASS subtest_655 +PASS subtest_656 +PASS subtest_657 PASS subtest_658 PASS subtest_659 PASS subtest_660 @@ -703,19 +703,19 @@ PASS subtest_698 PASS subtest_699 PASS find_resolution -PASS subtest_700: (resolution: 96dpi) should apply -PASS subtest_701: (resolution: 1dppx) should apply -PASS subtest_702: (resolution: 1x) should apply -PASS subtest_703: (resolution: 97dpi) should not apply -PASS subtest_704: (resolution: 95dpi) should not apply -PASS subtest_705: (min-resolution: 95dpi) should apply -PASS subtest_706: not all and (min-resolution: 95dpi) should not apply -PASS subtest_707: not all and (min-resolution: 97dpi) should apply -PASS subtest_708: all and (min-resolution: 97dpi) should not apply -PASS subtest_709: (min-resolution: 37dpcm) should apply -PASS subtest_710: (max-resolution: 39dpcm) should apply -PASS subtest_711: (max-resolution: 37dpcm) should not apply -PASS subtest_712: not all and (min-resolution: 39dpcm) should apply +PASS subtest_700 +PASS subtest_701 +PASS subtest_702 +PASS subtest_703 +PASS subtest_704 +PASS subtest_705 +PASS subtest_706 +PASS subtest_707 +PASS subtest_708 +PASS subtest_709 +PASS subtest_710 +PASS subtest_711 +PASS subtest_712 PASS subtest_713 PASS subtest_714 PASS subtest_715 @@ -723,12 +723,12 @@ PASS subtest_717 PASS subtest_718 PASS subtest_719 -PASS subtest_720: (scan) should not apply -PASS subtest_721: (scan: progressive) should not apply -PASS subtest_722: (scan: interlace) should not apply -PASS subtest_723: not all and (scan) should apply -PASS subtest_724: not all and (scan: progressive) should apply -PASS subtest_725: not all and (scan: interlace) should apply +PASS subtest_720 +PASS subtest_721 +PASS subtest_722 +PASS subtest_723 +PASS subtest_724 +PASS subtest_725 PASS subtest_726 PASS subtest_727 PASS subtest_728 @@ -738,43 +738,43 @@ PASS subtest_732 PASS subtest_733 PASS subtest_734 -PASS subtest_735: (grid) should not apply -PASS subtest_736: (grid: 0) should apply -PASS subtest_737: (grid: 1) should not apply -PASS subtest_738: (grid: 2) should not apply -PASS subtest_739: (grid: -1) should not apply -PASS subtest_740: (orientation should apply -PASS subtest_741: not all and (orientation should not apply -PASS subtest_742: (orientation: should not apply -PASS subtest_743: (orientation:) should not apply -PASS subtest_744: (orientation: ) should not apply -PASS subtest_745: all,(orientation: should apply -PASS subtest_746: (orientation:,all should not apply -PASS subtest_747: not all and (grid should apply -PASS subtest_748: only all and (grid should not apply -PASS subtest_749: (grid should not apply -PASS subtest_750: all,(grid should apply -PASS subtest_751: (grid,all should not apply -PASS subtest_752: ,all should apply -PASS subtest_753: all, should apply -PASS subtest_754: ,all, should apply -PASS subtest_755: all,badmedium should apply -PASS subtest_756: badmedium,all should apply -PASS subtest_757: ,badmedium, should not apply -PASS subtest_758: all,(badexpression) should apply -PASS subtest_759: (badexpression),all should apply -PASS subtest_760: (badexpression),badmedium should not apply -PASS subtest_761: badmedium,(badexpression) should not apply -PASS subtest_762: all,[badsyntax] should apply -PASS subtest_763: [badsyntax],all should apply -PASS subtest_764: badmedium,[badsyntax] should not apply -PASS subtest_765: [badsyntax],badmedium should not apply +PASS subtest_735 +PASS subtest_736 +PASS subtest_737 +PASS subtest_738 +PASS subtest_739 +PASS subtest_740 +PASS subtest_741 +PASS subtest_742 +PASS subtest_743 +PASS subtest_744 +PASS subtest_745 +PASS subtest_746 +PASS subtest_747 +PASS subtest_748 +PASS subtest_749 +PASS subtest_750 +PASS subtest_751 +PASS subtest_752 +PASS subtest_753 +PASS subtest_754 +PASS subtest_755 +PASS subtest_756 +PASS subtest_757 +PASS subtest_758 +PASS subtest_759 +PASS subtest_760 +PASS subtest_761 +PASS subtest_762 +PASS subtest_763 +PASS subtest_764 +PASS subtest_765 PASS subtest_766 PASS subtest_767 -PASS subtest_768: all and min-color : 1 should not apply -PASS subtest_769: (bogus) should not apply -PASS subtest_770: not all and (bogus) should not apply -PASS subtest_771: only all and (bogus) should not apply +PASS subtest_768 +PASS subtest_769 +PASS subtest_770 +PASS subtest_771 FAIL subtest_772 assert_true: expected true got false FAIL subtest_773 assert_true: expected true got false FAIL subtest_774 assert_true: expected true got false
diff --git a/third_party/blink/web_tests/platform/win/external/wpt/css/mediaqueries/test_media_queries-expected.txt b/third_party/blink/web_tests/platform/win/external/wpt/css/mediaqueries/test_media_queries-expected.txt index 29041b82..bf56828 100644 --- a/third_party/blink/web_tests/platform/win/external/wpt/css/mediaqueries/test_media_queries-expected.txt +++ b/third_party/blink/web_tests/platform/win/external/wpt/css/mediaqueries/test_media_queries-expected.txt
@@ -395,128 +395,128 @@ PASS subtest_392 PASS subtest_393 PASS subtest_394 -PASS subtest_395: all and (width: 117px) should apply -FAIL subtest_396: all and (width = 117px) should apply assert_true: expected true got false -PASS subtest_397: all and (width: 118px) should not apply -PASS subtest_398: all and (width: 116px) should not apply -PASS subtest_399: all and (width = 118px) should not apply -PASS subtest_400: all and (width = 116px) should not apply -PASS subtest_401: all and (min-width: 117px) should apply -PASS subtest_402: all and (min-width: 118px) should not apply -PASS subtest_403: all and (min-width: 116px) should apply -PASS subtest_404: all and (max-width: 117px) should apply -PASS subtest_405: all and (max-width: 118px) should apply -PASS subtest_406: all and (max-width: 116px) should not apply -PASS subtest_407: all and (min-width: 9em) should not apply -PASS subtest_408: all and (min-width: 6em) should apply -PASS subtest_409: all and (max-width: 9em) should apply -PASS subtest_410: all and (max-width: 6em) should not apply -FAIL subtest_411: (width <= 117px) should apply assert_true: expected true got false -FAIL subtest_412: (width >= 117px) should apply assert_true: expected true got false -PASS subtest_413: (width < 117px) should not apply -PASS subtest_414: (width > 117px) should not apply -FAIL subtest_415: (width < 118px) should apply assert_true: expected true got false -FAIL subtest_416: (width <= 118px) should apply assert_true: expected true got false -PASS subtest_417: (width > 118px) should not apply -PASS subtest_418: (width >= 118px) should not apply -FAIL subtest_419: (width > 116px) should apply assert_true: expected true got false -FAIL subtest_420: (width >= 116px) should apply assert_true: expected true got false -PASS subtest_421: (width < 116px) should not apply -PASS subtest_422: (width <= 116px) should not apply -PASS subtest_423: all and (height: 76px) should apply -FAIL subtest_424: all and (height = 76px) should apply assert_true: expected true got false -PASS subtest_425: all and (height: 77px) should not apply -PASS subtest_426: all and (height: 75px) should not apply -PASS subtest_427: all and (height = 77px) should not apply -PASS subtest_428: all and (height = 75px) should not apply -PASS subtest_429: all and (min-height: 76px) should apply -PASS subtest_430: all and (min-height: 77px) should not apply -PASS subtest_431: all and (min-height: 75px) should apply -PASS subtest_432: all and (max-height: 76px) should apply -PASS subtest_433: all and (max-height: 77px) should apply -PASS subtest_434: all and (max-height: 75px) should not apply -PASS subtest_435: all and (min-height: 6em) should not apply -PASS subtest_436: all and (min-height: 3em) should apply -PASS subtest_437: all and (max-height: 6em) should apply -PASS subtest_438: all and (max-height: 3em) should not apply -FAIL subtest_439: (height <= 76px) should apply assert_true: expected true got false -FAIL subtest_440: (height >= 76px) should apply assert_true: expected true got false -PASS subtest_441: (height < 76px) should not apply -PASS subtest_442: (height > 76px) should not apply -FAIL subtest_443: (height < 77px) should apply assert_true: expected true got false -FAIL subtest_444: (height <= 77px) should apply assert_true: expected true got false -PASS subtest_445: (height > 77px) should not apply -PASS subtest_446: (height >= 77px) should not apply -FAIL subtest_447: (height > 75px) should apply assert_true: expected true got false -FAIL subtest_448: (height >= 75px) should apply assert_true: expected true got false -PASS subtest_449: (height < 75px) should not apply -PASS subtest_450: (height <= 75px) should not apply -PASS subtest_451: all and (device-width: 1024px) should apply -FAIL subtest_452: all and (device-width = 1024px) should apply assert_true: expected true got false -PASS subtest_453: all and (device-width: 1025px) should not apply -PASS subtest_454: all and (device-width: 1023px) should not apply -PASS subtest_455: all and (device-width = 1025px) should not apply -PASS subtest_456: all and (device-width = 1023px) should not apply -PASS subtest_457: all and (min-device-width: 1024px) should apply -PASS subtest_458: all and (min-device-width: 1025px) should not apply -PASS subtest_459: all and (min-device-width: 1023px) should apply -PASS subtest_460: all and (max-device-width: 1024px) should apply -PASS subtest_461: all and (max-device-width: 1025px) should apply -PASS subtest_462: all and (max-device-width: 1023px) should not apply -PASS subtest_463: all and (min-device-width: 65em) should not apply -PASS subtest_464: all and (min-device-width: 63em) should apply -PASS subtest_465: all and (max-device-width: 65em) should apply -PASS subtest_466: all and (max-device-width: 63em) should not apply -FAIL subtest_467: (device-width <= 1024px) should apply assert_true: expected true got false -FAIL subtest_468: (device-width >= 1024px) should apply assert_true: expected true got false -PASS subtest_469: (device-width < 1024px) should not apply -PASS subtest_470: (device-width > 1024px) should not apply -FAIL subtest_471: (device-width < 1025px) should apply assert_true: expected true got false -FAIL subtest_472: (device-width <= 1025px) should apply assert_true: expected true got false -PASS subtest_473: (device-width > 1025px) should not apply -PASS subtest_474: (device-width >= 1025px) should not apply -FAIL subtest_475: (device-width > 1023px) should apply assert_true: expected true got false -FAIL subtest_476: (device-width >= 1023px) should apply assert_true: expected true got false -PASS subtest_477: (device-width < 1023px) should not apply -PASS subtest_478: (device-width <= 1023px) should not apply -PASS subtest_479: all and (device-height: 768px) should apply -FAIL subtest_480: all and (device-height = 768px) should apply assert_true: expected true got false -PASS subtest_481: all and (device-height: 769px) should not apply -PASS subtest_482: all and (device-height: 767px) should not apply -PASS subtest_483: all and (device-height = 769px) should not apply -PASS subtest_484: all and (device-height = 767px) should not apply -PASS subtest_485: all and (min-device-height: 768px) should apply -PASS subtest_486: all and (min-device-height: 769px) should not apply -PASS subtest_487: all and (min-device-height: 767px) should apply -PASS subtest_488: all and (max-device-height: 768px) should apply -PASS subtest_489: all and (max-device-height: 769px) should apply -PASS subtest_490: all and (max-device-height: 767px) should not apply -PASS subtest_491: all and (min-device-height: 49em) should not apply -PASS subtest_492: all and (min-device-height: 47em) should apply -PASS subtest_493: all and (max-device-height: 49em) should apply -PASS subtest_494: all and (max-device-height: 47em) should not apply -FAIL subtest_495: (device-height <= 768px) should apply assert_true: expected true got false -FAIL subtest_496: (device-height >= 768px) should apply assert_true: expected true got false -PASS subtest_497: (device-height < 768px) should not apply -PASS subtest_498: (device-height > 768px) should not apply -FAIL subtest_499: (device-height < 769px) should apply assert_true: expected true got false -FAIL subtest_500: (device-height <= 769px) should apply assert_true: expected true got false -PASS subtest_501: (device-height > 769px) should not apply -PASS subtest_502: (device-height >= 769px) should not apply -FAIL subtest_503: (device-height > 767px) should apply assert_true: expected true got false -FAIL subtest_504: (device-height >= 767px) should apply assert_true: expected true got false -PASS subtest_505: (device-height < 767px) should not apply -PASS subtest_506: (device-height <= 767px) should not apply -PASS subtest_507: all and (height) should apply -PASS subtest_508: all and (width) should not apply -PASS subtest_509: all and (height) should not apply -PASS subtest_510: all and (width) should not apply -PASS subtest_511: all and (device-height) should apply -PASS subtest_512: all and (device-width) should apply -PASS subtest_513: all and (height) should not apply -PASS subtest_514: all and (width) should apply -PASS subtest_515: all and (height) should apply -PASS subtest_516: all and (width) should apply +PASS subtest_395 +FAIL subtest_396 assert_true: all and (width = 117px) should apply expected true got false +PASS subtest_397 +PASS subtest_398 +PASS subtest_399 +PASS subtest_400 +PASS subtest_401 +PASS subtest_402 +PASS subtest_403 +PASS subtest_404 +PASS subtest_405 +PASS subtest_406 +PASS subtest_407 +PASS subtest_408 +PASS subtest_409 +PASS subtest_410 +FAIL subtest_411 assert_true: (width <= 117px) should apply expected true got false +FAIL subtest_412 assert_true: (width >= 117px) should apply expected true got false +PASS subtest_413 +PASS subtest_414 +FAIL subtest_415 assert_true: (width < 118px) should apply expected true got false +FAIL subtest_416 assert_true: (width <= 118px) should apply expected true got false +PASS subtest_417 +PASS subtest_418 +FAIL subtest_419 assert_true: (width > 116px) should apply expected true got false +FAIL subtest_420 assert_true: (width >= 116px) should apply expected true got false +PASS subtest_421 +PASS subtest_422 +PASS subtest_423 +FAIL subtest_424 assert_true: all and (height = 76px) should apply expected true got false +PASS subtest_425 +PASS subtest_426 +PASS subtest_427 +PASS subtest_428 +PASS subtest_429 +PASS subtest_430 +PASS subtest_431 +PASS subtest_432 +PASS subtest_433 +PASS subtest_434 +PASS subtest_435 +PASS subtest_436 +PASS subtest_437 +PASS subtest_438 +FAIL subtest_439 assert_true: (height <= 76px) should apply expected true got false +FAIL subtest_440 assert_true: (height >= 76px) should apply expected true got false +PASS subtest_441 +PASS subtest_442 +FAIL subtest_443 assert_true: (height < 77px) should apply expected true got false +FAIL subtest_444 assert_true: (height <= 77px) should apply expected true got false +PASS subtest_445 +PASS subtest_446 +FAIL subtest_447 assert_true: (height > 75px) should apply expected true got false +FAIL subtest_448 assert_true: (height >= 75px) should apply expected true got false +PASS subtest_449 +PASS subtest_450 +PASS subtest_451 +FAIL subtest_452 assert_true: all and (device-width = 1024px) should apply expected true got false +PASS subtest_453 +PASS subtest_454 +PASS subtest_455 +PASS subtest_456 +PASS subtest_457 +PASS subtest_458 +PASS subtest_459 +PASS subtest_460 +PASS subtest_461 +PASS subtest_462 +PASS subtest_463 +PASS subtest_464 +PASS subtest_465 +PASS subtest_466 +FAIL subtest_467 assert_true: (device-width <= 1024px) should apply expected true got false +FAIL subtest_468 assert_true: (device-width >= 1024px) should apply expected true got false +PASS subtest_469 +PASS subtest_470 +FAIL subtest_471 assert_true: (device-width < 1025px) should apply expected true got false +FAIL subtest_472 assert_true: (device-width <= 1025px) should apply expected true got false +PASS subtest_473 +PASS subtest_474 +FAIL subtest_475 assert_true: (device-width > 1023px) should apply expected true got false +FAIL subtest_476 assert_true: (device-width >= 1023px) should apply expected true got false +PASS subtest_477 +PASS subtest_478 +PASS subtest_479 +FAIL subtest_480 assert_true: all and (device-height = 768px) should apply expected true got false +PASS subtest_481 +PASS subtest_482 +PASS subtest_483 +PASS subtest_484 +PASS subtest_485 +PASS subtest_486 +PASS subtest_487 +PASS subtest_488 +PASS subtest_489 +PASS subtest_490 +PASS subtest_491 +PASS subtest_492 +PASS subtest_493 +PASS subtest_494 +FAIL subtest_495 assert_true: (device-height <= 768px) should apply expected true got false +FAIL subtest_496 assert_true: (device-height >= 768px) should apply expected true got false +PASS subtest_497 +PASS subtest_498 +FAIL subtest_499 assert_true: (device-height < 769px) should apply expected true got false +FAIL subtest_500 assert_true: (device-height <= 769px) should apply expected true got false +PASS subtest_501 +PASS subtest_502 +FAIL subtest_503 assert_true: (device-height > 767px) should apply expected true got false +FAIL subtest_504 assert_true: (device-height >= 767px) should apply expected true got false +PASS subtest_505 +PASS subtest_506 +PASS subtest_507 +PASS subtest_508 +PASS subtest_509 +PASS subtest_510 +PASS subtest_511 +PASS subtest_512 +PASS subtest_513 +PASS subtest_514 +PASS subtest_515 +PASS subtest_516 PASS subtest_517 PASS subtest_518 PASS subtest_519 @@ -526,56 +526,56 @@ PASS subtest_523 PASS subtest_524 PASS subtest_525 -PASS subtest_526: (orientation) should apply -PASS subtest_527: (orientation: landscape) should apply -PASS subtest_528: (orientation: portrait) should not apply -PASS subtest_529: not all and (orientation: portrait) should apply -PASS subtest_530: (orientation) should apply -PASS subtest_531: (orientation: landscape) should not apply -PASS subtest_532: not all and (orientation: landscape) should apply -PASS subtest_533: (orientation: portrait) should apply -PASS subtest_534: (aspect-ratio: 59/80) should apply -PASS subtest_535: (aspect-ratio: 58/80) should not apply -PASS subtest_536: (aspect-ratio: 59/81) should not apply -PASS subtest_537: (aspect-ratio: 60/80) should not apply -PASS subtest_538: (aspect-ratio: 59/79) should not apply -PASS subtest_539: (aspect-ratio: 177/240) should apply -PASS subtest_540: (aspect-ratio: 413/560) should apply -PASS subtest_541: (aspect-ratio: 5900/8000) should apply -PASS subtest_542: (aspect-ratio: 5901/8000) should not apply -PASS subtest_543: (aspect-ratio: 5899/8000) should not apply -PASS subtest_544: (aspect-ratio: 5900/8001) should not apply -PASS subtest_545: (aspect-ratio: 5900/7999) should not apply -PASS subtest_546: (aspect-ratio) should apply -PASS subtest_547: (min-aspect-ratio: 59/80) should apply -PASS subtest_548: (min-aspect-ratio: 58/80) should apply -PASS subtest_549: (min-aspect-ratio: 59/81) should apply -PASS subtest_550: (min-aspect-ratio: 60/80) should not apply -PASS subtest_551: (min-aspect-ratio: 59/79) should not apply +PASS subtest_526 +PASS subtest_527 +PASS subtest_528 +PASS subtest_529 +PASS subtest_530 +PASS subtest_531 +PASS subtest_532 +PASS subtest_533 +PASS subtest_534 +PASS subtest_535 +PASS subtest_536 +PASS subtest_537 +PASS subtest_538 +PASS subtest_539 +PASS subtest_540 +PASS subtest_541 +PASS subtest_542 +PASS subtest_543 +PASS subtest_544 +PASS subtest_545 +PASS subtest_546 +PASS subtest_547 +PASS subtest_548 +PASS subtest_549 +PASS subtest_550 +PASS subtest_551 PASS subtest_552 -PASS subtest_553: (max-aspect-ratio: 59/80) should apply -PASS subtest_554: (max-aspect-ratio: 58/80) should not apply -PASS subtest_555: (max-aspect-ratio: 59/81) should not apply -PASS subtest_556: (max-aspect-ratio: 60/80) should apply -PASS subtest_557: (max-aspect-ratio: 59/79) should apply +PASS subtest_553 +PASS subtest_554 +PASS subtest_555 +PASS subtest_556 +PASS subtest_557 PASS subtest_558 -PASS subtest_559: (device-aspect-ratio: 1024/768) should apply -PASS subtest_560: not all and (device-aspect-ratio: 1025/768) should apply -PASS subtest_561: all and (device-aspect-ratio: 1024/767) should not apply -PASS subtest_562: all and (device-aspect-ratio: 1023/768) should not apply -PASS subtest_563: not all and (device-aspect-ratio: 1024/769) should apply -PASS subtest_564: (device-aspect-ratio) should apply -PASS subtest_565: (min-device-aspect-ratio: 1024/768) should apply -PASS subtest_566: all and (min-device-aspect-ratio: 1025/768) should not apply -PASS subtest_567: not all and (min-device-aspect-ratio: 1024/767) should apply -PASS subtest_568: not all and (min-device-aspect-ratio: 1023/768) should not apply -PASS subtest_569: all and (min-device-aspect-ratio: 1024/769) should apply +PASS subtest_559 +PASS subtest_560 +PASS subtest_561 +PASS subtest_562 +PASS subtest_563 +PASS subtest_564 +PASS subtest_565 +PASS subtest_566 +PASS subtest_567 +PASS subtest_568 +PASS subtest_569 PASS subtest_570 -PASS subtest_571: all and (max-device-aspect-ratio: 1024/768) should apply -PASS subtest_572: (max-device-aspect-ratio: 1025/768) should apply -PASS subtest_573: (max-device-aspect-ratio: 1024/767) should apply -PASS subtest_574: all and (max-device-aspect-ratio: 1023/768) should not apply -PASS subtest_575: not all and (max-device-aspect-ratio: 1024/769) should apply +PASS subtest_571 +PASS subtest_572 +PASS subtest_573 +PASS subtest_574 +PASS subtest_575 PASS subtest_576 PASS subtest_577 PASS subtest_578 @@ -619,22 +619,22 @@ PASS subtest_616 PASS monochrome_and_color PASS find_depth -PASS subtest_617: all and (color:8) should apply -PASS subtest_618: all and (color:7) should not apply -PASS subtest_619: all and (color:9) should not apply -PASS subtest_620: all and (max-color:8) should apply -PASS subtest_621: all and (max-color:7) should not apply -PASS subtest_622: all and (max-color:9) should apply -PASS subtest_623: all and (color) should apply +PASS subtest_617 +PASS subtest_618 +PASS subtest_619 +PASS subtest_620 +PASS subtest_621 +PASS subtest_622 +PASS subtest_623 PASS subtest_624 PASS subtest_625 -PASS subtest_626: all and (monochrome) should not apply +PASS subtest_626 PASS subtest_627 PASS subtest_628 -PASS subtest_629: not all and (monochrome) should apply -PASS subtest_630: not all and (color) should not apply -PASS subtest_631: only all and (color) should apply -PASS subtest_632: only all and (monochrome) should not apply +PASS subtest_629 +PASS subtest_630 +PASS subtest_631 +PASS subtest_632 PASS subtest_633 PASS subtest_634 PASS subtest_635 @@ -653,13 +653,13 @@ PASS subtest_648 PASS subtest_649 PASS subtest_650 -PASS subtest_651: (color-index: 0) should apply -PASS subtest_652: (color-index: 1) should not apply -PASS subtest_653: (min-color-index: 0) should apply -PASS subtest_654: (min-color-index: 1) should not apply -PASS subtest_655: (max-color-index: 0) should apply -PASS subtest_656: (max-color-index: 1) should apply -PASS subtest_657: (max-color-index: 157) should apply +PASS subtest_651 +PASS subtest_652 +PASS subtest_653 +PASS subtest_654 +PASS subtest_655 +PASS subtest_656 +PASS subtest_657 PASS subtest_658 PASS subtest_659 PASS subtest_660 @@ -703,19 +703,19 @@ PASS subtest_698 PASS subtest_699 PASS find_resolution -PASS subtest_700: (resolution: 96dpi) should apply -PASS subtest_701: (resolution: 1dppx) should apply -PASS subtest_702: (resolution: 1x) should apply -PASS subtest_703: (resolution: 97dpi) should not apply -PASS subtest_704: (resolution: 95dpi) should not apply -PASS subtest_705: (min-resolution: 95dpi) should apply -PASS subtest_706: not all and (min-resolution: 95dpi) should not apply -PASS subtest_707: not all and (min-resolution: 97dpi) should apply -PASS subtest_708: all and (min-resolution: 97dpi) should not apply -PASS subtest_709: (min-resolution: 37dpcm) should apply -PASS subtest_710: (max-resolution: 39dpcm) should apply -PASS subtest_711: (max-resolution: 37dpcm) should not apply -PASS subtest_712: not all and (min-resolution: 39dpcm) should apply +PASS subtest_700 +PASS subtest_701 +PASS subtest_702 +PASS subtest_703 +PASS subtest_704 +PASS subtest_705 +PASS subtest_706 +PASS subtest_707 +PASS subtest_708 +PASS subtest_709 +PASS subtest_710 +PASS subtest_711 +PASS subtest_712 PASS subtest_713 PASS subtest_714 PASS subtest_715 @@ -723,12 +723,12 @@ PASS subtest_717 PASS subtest_718 PASS subtest_719 -PASS subtest_720: (scan) should not apply -PASS subtest_721: (scan: progressive) should not apply -PASS subtest_722: (scan: interlace) should not apply -PASS subtest_723: not all and (scan) should apply -PASS subtest_724: not all and (scan: progressive) should apply -PASS subtest_725: not all and (scan: interlace) should apply +PASS subtest_720 +PASS subtest_721 +PASS subtest_722 +PASS subtest_723 +PASS subtest_724 +PASS subtest_725 PASS subtest_726 PASS subtest_727 PASS subtest_728 @@ -738,43 +738,43 @@ PASS subtest_732 PASS subtest_733 PASS subtest_734 -PASS subtest_735: (grid) should not apply -PASS subtest_736: (grid: 0) should apply -PASS subtest_737: (grid: 1) should not apply -PASS subtest_738: (grid: 2) should not apply -PASS subtest_739: (grid: -1) should not apply -PASS subtest_740: (orientation should apply -PASS subtest_741: not all and (orientation should not apply -PASS subtest_742: (orientation: should not apply -PASS subtest_743: (orientation:) should not apply -PASS subtest_744: (orientation: ) should not apply -PASS subtest_745: all,(orientation: should apply -PASS subtest_746: (orientation:,all should not apply -PASS subtest_747: not all and (grid should apply -PASS subtest_748: only all and (grid should not apply -PASS subtest_749: (grid should not apply -PASS subtest_750: all,(grid should apply -PASS subtest_751: (grid,all should not apply -PASS subtest_752: ,all should apply -PASS subtest_753: all, should apply -PASS subtest_754: ,all, should apply -PASS subtest_755: all,badmedium should apply -PASS subtest_756: badmedium,all should apply -PASS subtest_757: ,badmedium, should not apply -PASS subtest_758: all,(badexpression) should apply -PASS subtest_759: (badexpression),all should apply -PASS subtest_760: (badexpression),badmedium should not apply -PASS subtest_761: badmedium,(badexpression) should not apply -PASS subtest_762: all,[badsyntax] should apply -PASS subtest_763: [badsyntax],all should apply -PASS subtest_764: badmedium,[badsyntax] should not apply -PASS subtest_765: [badsyntax],badmedium should not apply +PASS subtest_735 +PASS subtest_736 +PASS subtest_737 +PASS subtest_738 +PASS subtest_739 +PASS subtest_740 +PASS subtest_741 +PASS subtest_742 +PASS subtest_743 +PASS subtest_744 +PASS subtest_745 +PASS subtest_746 +PASS subtest_747 +PASS subtest_748 +PASS subtest_749 +PASS subtest_750 +PASS subtest_751 +PASS subtest_752 +PASS subtest_753 +PASS subtest_754 +PASS subtest_755 +PASS subtest_756 +PASS subtest_757 +PASS subtest_758 +PASS subtest_759 +PASS subtest_760 +PASS subtest_761 +PASS subtest_762 +PASS subtest_763 +PASS subtest_764 +PASS subtest_765 PASS subtest_766 PASS subtest_767 -PASS subtest_768: all and min-color : 1 should not apply -PASS subtest_769: (bogus) should not apply -PASS subtest_770: not all and (bogus) should not apply -PASS subtest_771: only all and (bogus) should not apply +PASS subtest_768 +PASS subtest_769 +PASS subtest_770 +PASS subtest_771 FAIL subtest_772 assert_true: expected true got false FAIL subtest_773 assert_true: expected true got false FAIL subtest_774 assert_true: expected true got false
diff --git a/third_party/blink/web_tests/platform/win/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.png b/third_party/blink/web_tests/platform/win/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.png new file mode 100644 index 0000000..5649521 --- /dev/null +++ b/third_party/blink/web_tests/platform/win/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.txt b/third_party/blink/web_tests/platform/win/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.txt new file mode 100644 index 0000000..ef1563e1 --- /dev/null +++ b/third_party/blink/web_tests/platform/win/virtual/layout_ng_svg_text/paint/invalidation/svg/animated-path-inside-transformed-html-expected.txt
@@ -0,0 +1,19 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [244, 104, 124, 45], + [203, 336, 124, 45], + [108, 84, 105, 102], + [355, 125, 104, 104], + [352, 398, 99, 98], + [90, 207, 98, 99] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/win/virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-5-expected.png b/third_party/blink/web_tests/platform/win/virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-5-expected.png new file mode 100644 index 0000000..23c82431 --- /dev/null +++ b/third_party/blink/web_tests/platform/win/virtual/layout_ng_svg_text/svg/as-background-image/svg-as-background-5-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/virtual/layout_ng_svg_text/svg/wicd/test-scalable-background-image2-expected.png b/third_party/blink/web_tests/platform/win/virtual/layout_ng_svg_text/svg/wicd/test-scalable-background-image2-expected.png new file mode 100644 index 0000000..48894f5 --- /dev/null +++ b/third_party/blink/web_tests/platform/win/virtual/layout_ng_svg_text/svg/wicd/test-scalable-background-image2-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/virtual/layout_ng_svg_text/svg/zoom/page/zoom-mask-with-percentages-expected.png b/third_party/blink/web_tests/platform/win/virtual/layout_ng_svg_text/svg/zoom/page/zoom-mask-with-percentages-expected.png new file mode 100644 index 0000000..988909b3 --- /dev/null +++ b/third_party/blink/web_tests/platform/win/virtual/layout_ng_svg_text/svg/zoom/page/zoom-mask-with-percentages-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/external/wpt/css/mediaqueries/test_media_queries-expected.txt b/third_party/blink/web_tests/platform/win7/external/wpt/css/mediaqueries/test_media_queries-expected.txt index 4db8087..c78c208 100644 --- a/third_party/blink/web_tests/platform/win7/external/wpt/css/mediaqueries/test_media_queries-expected.txt +++ b/third_party/blink/web_tests/platform/win7/external/wpt/css/mediaqueries/test_media_queries-expected.txt
@@ -395,128 +395,128 @@ PASS subtest_392 PASS subtest_393 PASS subtest_394 -PASS subtest_395: all and (width: 117px) should apply -FAIL subtest_396: all and (width = 117px) should apply assert_true: expected true got false -PASS subtest_397: all and (width: 118px) should not apply -PASS subtest_398: all and (width: 116px) should not apply -PASS subtest_399: all and (width = 118px) should not apply -PASS subtest_400: all and (width = 116px) should not apply -PASS subtest_401: all and (min-width: 117px) should apply -PASS subtest_402: all and (min-width: 118px) should not apply -PASS subtest_403: all and (min-width: 116px) should apply -PASS subtest_404: all and (max-width: 117px) should apply -PASS subtest_405: all and (max-width: 118px) should apply -PASS subtest_406: all and (max-width: 116px) should not apply -PASS subtest_407: all and (min-width: 9em) should not apply -PASS subtest_408: all and (min-width: 6em) should apply -PASS subtest_409: all and (max-width: 9em) should apply -PASS subtest_410: all and (max-width: 6em) should not apply -FAIL subtest_411: (width <= 117px) should apply assert_true: expected true got false -FAIL subtest_412: (width >= 117px) should apply assert_true: expected true got false -PASS subtest_413: (width < 117px) should not apply -PASS subtest_414: (width > 117px) should not apply -FAIL subtest_415: (width < 118px) should apply assert_true: expected true got false -FAIL subtest_416: (width <= 118px) should apply assert_true: expected true got false -PASS subtest_417: (width > 118px) should not apply -PASS subtest_418: (width >= 118px) should not apply -FAIL subtest_419: (width > 116px) should apply assert_true: expected true got false -FAIL subtest_420: (width >= 116px) should apply assert_true: expected true got false -PASS subtest_421: (width < 116px) should not apply -PASS subtest_422: (width <= 116px) should not apply -PASS subtest_423: all and (height: 76px) should apply -FAIL subtest_424: all and (height = 76px) should apply assert_true: expected true got false -PASS subtest_425: all and (height: 77px) should not apply -PASS subtest_426: all and (height: 75px) should not apply -PASS subtest_427: all and (height = 77px) should not apply -PASS subtest_428: all and (height = 75px) should not apply -PASS subtest_429: all and (min-height: 76px) should apply -PASS subtest_430: all and (min-height: 77px) should not apply -PASS subtest_431: all and (min-height: 75px) should apply -PASS subtest_432: all and (max-height: 76px) should apply -PASS subtest_433: all and (max-height: 77px) should apply -PASS subtest_434: all and (max-height: 75px) should not apply -PASS subtest_435: all and (min-height: 6em) should not apply -PASS subtest_436: all and (min-height: 3em) should apply -PASS subtest_437: all and (max-height: 6em) should apply -PASS subtest_438: all and (max-height: 3em) should not apply -FAIL subtest_439: (height <= 76px) should apply assert_true: expected true got false -FAIL subtest_440: (height >= 76px) should apply assert_true: expected true got false -PASS subtest_441: (height < 76px) should not apply -PASS subtest_442: (height > 76px) should not apply -FAIL subtest_443: (height < 77px) should apply assert_true: expected true got false -FAIL subtest_444: (height <= 77px) should apply assert_true: expected true got false -PASS subtest_445: (height > 77px) should not apply -PASS subtest_446: (height >= 77px) should not apply -FAIL subtest_447: (height > 75px) should apply assert_true: expected true got false -FAIL subtest_448: (height >= 75px) should apply assert_true: expected true got false -PASS subtest_449: (height < 75px) should not apply -PASS subtest_450: (height <= 75px) should not apply -PASS subtest_451: all and (device-width: 1272px) should apply -FAIL subtest_452: all and (device-width = 1272px) should apply assert_true: expected true got false -PASS subtest_453: all and (device-width: 1273px) should not apply -PASS subtest_454: all and (device-width: 1271px) should not apply -PASS subtest_455: all and (device-width = 1273px) should not apply -PASS subtest_456: all and (device-width = 1271px) should not apply -PASS subtest_457: all and (min-device-width: 1272px) should apply -PASS subtest_458: all and (min-device-width: 1273px) should not apply -PASS subtest_459: all and (min-device-width: 1271px) should apply -PASS subtest_460: all and (max-device-width: 1272px) should apply -PASS subtest_461: all and (max-device-width: 1273px) should apply -PASS subtest_462: all and (max-device-width: 1271px) should not apply -PASS subtest_463: all and (min-device-width: 81em) should not apply -PASS subtest_464: all and (min-device-width: 78em) should apply -PASS subtest_465: all and (max-device-width: 81em) should apply -PASS subtest_466: all and (max-device-width: 78em) should not apply -FAIL subtest_467: (device-width <= 1272px) should apply assert_true: expected true got false -FAIL subtest_468: (device-width >= 1272px) should apply assert_true: expected true got false -PASS subtest_469: (device-width < 1272px) should not apply -PASS subtest_470: (device-width > 1272px) should not apply -FAIL subtest_471: (device-width < 1273px) should apply assert_true: expected true got false -FAIL subtest_472: (device-width <= 1273px) should apply assert_true: expected true got false -PASS subtest_473: (device-width > 1273px) should not apply -PASS subtest_474: (device-width >= 1273px) should not apply -FAIL subtest_475: (device-width > 1271px) should apply assert_true: expected true got false -FAIL subtest_476: (device-width >= 1271px) should apply assert_true: expected true got false -PASS subtest_477: (device-width < 1271px) should not apply -PASS subtest_478: (device-width <= 1271px) should not apply -PASS subtest_479: all and (device-height: 855px) should apply -FAIL subtest_480: all and (device-height = 855px) should apply assert_true: expected true got false -PASS subtest_481: all and (device-height: 856px) should not apply -PASS subtest_482: all and (device-height: 854px) should not apply -PASS subtest_483: all and (device-height = 856px) should not apply -PASS subtest_484: all and (device-height = 854px) should not apply -PASS subtest_485: all and (min-device-height: 855px) should apply -PASS subtest_486: all and (min-device-height: 856px) should not apply -PASS subtest_487: all and (min-device-height: 854px) should apply -PASS subtest_488: all and (max-device-height: 855px) should apply -PASS subtest_489: all and (max-device-height: 856px) should apply -PASS subtest_490: all and (max-device-height: 854px) should not apply -PASS subtest_491: all and (min-device-height: 55em) should not apply -PASS subtest_492: all and (min-device-height: 52em) should apply -PASS subtest_493: all and (max-device-height: 55em) should apply -PASS subtest_494: all and (max-device-height: 52em) should not apply -FAIL subtest_495: (device-height <= 855px) should apply assert_true: expected true got false -FAIL subtest_496: (device-height >= 855px) should apply assert_true: expected true got false -PASS subtest_497: (device-height < 855px) should not apply -PASS subtest_498: (device-height > 855px) should not apply -FAIL subtest_499: (device-height < 856px) should apply assert_true: expected true got false -FAIL subtest_500: (device-height <= 856px) should apply assert_true: expected true got false -PASS subtest_501: (device-height > 856px) should not apply -PASS subtest_502: (device-height >= 856px) should not apply -FAIL subtest_503: (device-height > 854px) should apply assert_true: expected true got false -FAIL subtest_504: (device-height >= 854px) should apply assert_true: expected true got false -PASS subtest_505: (device-height < 854px) should not apply -PASS subtest_506: (device-height <= 854px) should not apply -PASS subtest_507: all and (height) should apply -PASS subtest_508: all and (width) should not apply -PASS subtest_509: all and (height) should not apply -PASS subtest_510: all and (width) should not apply -PASS subtest_511: all and (device-height) should apply -PASS subtest_512: all and (device-width) should apply -PASS subtest_513: all and (height) should not apply -PASS subtest_514: all and (width) should apply -PASS subtest_515: all and (height) should apply -PASS subtest_516: all and (width) should apply +PASS subtest_395 +FAIL subtest_396 assert_true: all and (width = 117px) should apply expected true got false +PASS subtest_397 +PASS subtest_398 +PASS subtest_399 +PASS subtest_400 +PASS subtest_401 +PASS subtest_402 +PASS subtest_403 +PASS subtest_404 +PASS subtest_405 +PASS subtest_406 +PASS subtest_407 +PASS subtest_408 +PASS subtest_409 +PASS subtest_410 +FAIL subtest_411 assert_true: (width <= 117px) should apply expected true got false +FAIL subtest_412 assert_true: (width >= 117px) should apply expected true got false +PASS subtest_413 +PASS subtest_414 +FAIL subtest_415 assert_true: (width < 118px) should apply expected true got false +FAIL subtest_416 assert_true: (width <= 118px) should apply expected true got false +PASS subtest_417 +PASS subtest_418 +FAIL subtest_419 assert_true: (width > 116px) should apply expected true got false +FAIL subtest_420 assert_true: (width >= 116px) should apply expected true got false +PASS subtest_421 +PASS subtest_422 +PASS subtest_423 +FAIL subtest_424 assert_true: all and (height = 76px) should apply expected true got false +PASS subtest_425 +PASS subtest_426 +PASS subtest_427 +PASS subtest_428 +PASS subtest_429 +PASS subtest_430 +PASS subtest_431 +PASS subtest_432 +PASS subtest_433 +PASS subtest_434 +PASS subtest_435 +PASS subtest_436 +PASS subtest_437 +PASS subtest_438 +FAIL subtest_439 assert_true: (height <= 76px) should apply expected true got false +FAIL subtest_440 assert_true: (height >= 76px) should apply expected true got false +PASS subtest_441 +PASS subtest_442 +FAIL subtest_443 assert_true: (height < 77px) should apply expected true got false +FAIL subtest_444 assert_true: (height <= 77px) should apply expected true got false +PASS subtest_445 +PASS subtest_446 +FAIL subtest_447 assert_true: (height > 75px) should apply expected true got false +FAIL subtest_448 assert_true: (height >= 75px) should apply expected true got false +PASS subtest_449 +PASS subtest_450 +PASS subtest_451 +FAIL subtest_452 assert_true: all and (device-width = 1352px) should apply expected true got false +PASS subtest_453 +PASS subtest_454 +PASS subtest_455 +PASS subtest_456 +PASS subtest_457 +PASS subtest_458 +PASS subtest_459 +PASS subtest_460 +PASS subtest_461 +PASS subtest_462 +PASS subtest_463 +PASS subtest_464 +PASS subtest_465 +PASS subtest_466 +FAIL subtest_467 assert_true: (device-width <= 1352px) should apply expected true got false +FAIL subtest_468 assert_true: (device-width >= 1352px) should apply expected true got false +PASS subtest_469 +PASS subtest_470 +FAIL subtest_471 assert_true: (device-width < 1353px) should apply expected true got false +FAIL subtest_472 assert_true: (device-width <= 1353px) should apply expected true got false +PASS subtest_473 +PASS subtest_474 +FAIL subtest_475 assert_true: (device-width > 1351px) should apply expected true got false +FAIL subtest_476 assert_true: (device-width >= 1351px) should apply expected true got false +PASS subtest_477 +PASS subtest_478 +PASS subtest_479 +FAIL subtest_480 assert_true: all and (device-height = 648px) should apply expected true got false +PASS subtest_481 +PASS subtest_482 +PASS subtest_483 +PASS subtest_484 +PASS subtest_485 +PASS subtest_486 +PASS subtest_487 +PASS subtest_488 +PASS subtest_489 +PASS subtest_490 +PASS subtest_491 +PASS subtest_492 +PASS subtest_493 +PASS subtest_494 +FAIL subtest_495 assert_true: (device-height <= 648px) should apply expected true got false +FAIL subtest_496 assert_true: (device-height >= 648px) should apply expected true got false +PASS subtest_497 +PASS subtest_498 +FAIL subtest_499 assert_true: (device-height < 649px) should apply expected true got false +FAIL subtest_500 assert_true: (device-height <= 649px) should apply expected true got false +PASS subtest_501 +PASS subtest_502 +FAIL subtest_503 assert_true: (device-height > 647px) should apply expected true got false +FAIL subtest_504 assert_true: (device-height >= 647px) should apply expected true got false +PASS subtest_505 +PASS subtest_506 +PASS subtest_507 +PASS subtest_508 +PASS subtest_509 +PASS subtest_510 +PASS subtest_511 +PASS subtest_512 +PASS subtest_513 +PASS subtest_514 +PASS subtest_515 +PASS subtest_516 PASS subtest_517 PASS subtest_518 PASS subtest_519 @@ -526,56 +526,56 @@ PASS subtest_523 PASS subtest_524 PASS subtest_525 -PASS subtest_526: (orientation) should apply -PASS subtest_527: (orientation: landscape) should apply -PASS subtest_528: (orientation: portrait) should not apply -PASS subtest_529: not all and (orientation: portrait) should apply -PASS subtest_530: (orientation) should apply -PASS subtest_531: (orientation: landscape) should not apply -PASS subtest_532: not all and (orientation: landscape) should apply -PASS subtest_533: (orientation: portrait) should apply -PASS subtest_534: (aspect-ratio: 59/80) should apply -PASS subtest_535: (aspect-ratio: 58/80) should not apply -PASS subtest_536: (aspect-ratio: 59/81) should not apply -PASS subtest_537: (aspect-ratio: 60/80) should not apply -PASS subtest_538: (aspect-ratio: 59/79) should not apply -PASS subtest_539: (aspect-ratio: 177/240) should apply -PASS subtest_540: (aspect-ratio: 413/560) should apply -PASS subtest_541: (aspect-ratio: 5900/8000) should apply -PASS subtest_542: (aspect-ratio: 5901/8000) should not apply -PASS subtest_543: (aspect-ratio: 5899/8000) should not apply -PASS subtest_544: (aspect-ratio: 5900/8001) should not apply -PASS subtest_545: (aspect-ratio: 5900/7999) should not apply -PASS subtest_546: (aspect-ratio) should apply -PASS subtest_547: (min-aspect-ratio: 59/80) should apply -PASS subtest_548: (min-aspect-ratio: 58/80) should apply -PASS subtest_549: (min-aspect-ratio: 59/81) should apply -PASS subtest_550: (min-aspect-ratio: 60/80) should not apply -PASS subtest_551: (min-aspect-ratio: 59/79) should not apply +PASS subtest_526 +PASS subtest_527 +PASS subtest_528 +PASS subtest_529 +PASS subtest_530 +PASS subtest_531 +PASS subtest_532 +PASS subtest_533 +PASS subtest_534 +PASS subtest_535 +PASS subtest_536 +PASS subtest_537 +PASS subtest_538 +PASS subtest_539 +PASS subtest_540 +PASS subtest_541 +PASS subtest_542 +PASS subtest_543 +PASS subtest_544 +PASS subtest_545 +PASS subtest_546 +PASS subtest_547 +PASS subtest_548 +PASS subtest_549 +PASS subtest_550 +PASS subtest_551 PASS subtest_552 -PASS subtest_553: (max-aspect-ratio: 59/80) should apply -PASS subtest_554: (max-aspect-ratio: 58/80) should not apply -PASS subtest_555: (max-aspect-ratio: 59/81) should not apply -PASS subtest_556: (max-aspect-ratio: 60/80) should apply -PASS subtest_557: (max-aspect-ratio: 59/79) should apply +PASS subtest_553 +PASS subtest_554 +PASS subtest_555 +PASS subtest_556 +PASS subtest_557 PASS subtest_558 -PASS subtest_559: (device-aspect-ratio: 1272/855) should apply -PASS subtest_560: not all and (device-aspect-ratio: 1273/855) should apply -PASS subtest_561: all and (device-aspect-ratio: 1272/854) should not apply -PASS subtest_562: all and (device-aspect-ratio: 1271/855) should not apply -PASS subtest_563: not all and (device-aspect-ratio: 1272/856) should apply -PASS subtest_564: (device-aspect-ratio) should apply -PASS subtest_565: (min-device-aspect-ratio: 1272/855) should apply -PASS subtest_566: all and (min-device-aspect-ratio: 1273/855) should not apply -PASS subtest_567: not all and (min-device-aspect-ratio: 1272/854) should apply -PASS subtest_568: not all and (min-device-aspect-ratio: 1271/855) should not apply -PASS subtest_569: all and (min-device-aspect-ratio: 1272/856) should apply +PASS subtest_559 +PASS subtest_560 +PASS subtest_561 +PASS subtest_562 +PASS subtest_563 +PASS subtest_564 +PASS subtest_565 +PASS subtest_566 +PASS subtest_567 +PASS subtest_568 +PASS subtest_569 PASS subtest_570 -PASS subtest_571: all and (max-device-aspect-ratio: 1272/855) should apply -PASS subtest_572: (max-device-aspect-ratio: 1273/855) should apply -PASS subtest_573: (max-device-aspect-ratio: 1272/854) should apply -PASS subtest_574: all and (max-device-aspect-ratio: 1271/855) should not apply -PASS subtest_575: not all and (max-device-aspect-ratio: 1272/856) should apply +PASS subtest_571 +PASS subtest_572 +PASS subtest_573 +PASS subtest_574 +PASS subtest_575 PASS subtest_576 PASS subtest_577 PASS subtest_578 @@ -619,22 +619,22 @@ PASS subtest_616 PASS monochrome_and_color PASS find_depth -PASS subtest_617: all and (color:8) should apply -PASS subtest_618: all and (color:7) should not apply -PASS subtest_619: all and (color:9) should not apply -PASS subtest_620: all and (max-color:8) should apply -PASS subtest_621: all and (max-color:7) should not apply -PASS subtest_622: all and (max-color:9) should apply -PASS subtest_623: all and (color) should apply +PASS subtest_617 +PASS subtest_618 +PASS subtest_619 +PASS subtest_620 +PASS subtest_621 +PASS subtest_622 +PASS subtest_623 PASS subtest_624 PASS subtest_625 -PASS subtest_626: all and (monochrome) should not apply +PASS subtest_626 PASS subtest_627 PASS subtest_628 -PASS subtest_629: not all and (monochrome) should apply -PASS subtest_630: not all and (color) should not apply -PASS subtest_631: only all and (color) should apply -PASS subtest_632: only all and (monochrome) should not apply +PASS subtest_629 +PASS subtest_630 +PASS subtest_631 +PASS subtest_632 PASS subtest_633 PASS subtest_634 PASS subtest_635 @@ -653,13 +653,13 @@ PASS subtest_648 PASS subtest_649 PASS subtest_650 -PASS subtest_651: (color-index: 0) should apply -PASS subtest_652: (color-index: 1) should not apply -PASS subtest_653: (min-color-index: 0) should apply -PASS subtest_654: (min-color-index: 1) should not apply -PASS subtest_655: (max-color-index: 0) should apply -PASS subtest_656: (max-color-index: 1) should apply -PASS subtest_657: (max-color-index: 157) should apply +PASS subtest_651 +PASS subtest_652 +PASS subtest_653 +PASS subtest_654 +PASS subtest_655 +PASS subtest_656 +PASS subtest_657 PASS subtest_658 PASS subtest_659 PASS subtest_660 @@ -703,19 +703,19 @@ PASS subtest_698 PASS subtest_699 PASS find_resolution -PASS subtest_700: (resolution: 96dpi) should apply -PASS subtest_701: (resolution: 1dppx) should apply -PASS subtest_702: (resolution: 1x) should apply -PASS subtest_703: (resolution: 97dpi) should not apply -PASS subtest_704: (resolution: 95dpi) should not apply -PASS subtest_705: (min-resolution: 95dpi) should apply -PASS subtest_706: not all and (min-resolution: 95dpi) should not apply -PASS subtest_707: not all and (min-resolution: 97dpi) should apply -PASS subtest_708: all and (min-resolution: 97dpi) should not apply -PASS subtest_709: (min-resolution: 37dpcm) should apply -PASS subtest_710: (max-resolution: 39dpcm) should apply -PASS subtest_711: (max-resolution: 37dpcm) should not apply -PASS subtest_712: not all and (min-resolution: 39dpcm) should apply +PASS subtest_700 +PASS subtest_701 +PASS subtest_702 +PASS subtest_703 +PASS subtest_704 +PASS subtest_705 +PASS subtest_706 +PASS subtest_707 +PASS subtest_708 +PASS subtest_709 +PASS subtest_710 +PASS subtest_711 +PASS subtest_712 PASS subtest_713 PASS subtest_714 PASS subtest_715 @@ -723,12 +723,12 @@ PASS subtest_717 PASS subtest_718 PASS subtest_719 -PASS subtest_720: (scan) should not apply -PASS subtest_721: (scan: progressive) should not apply -PASS subtest_722: (scan: interlace) should not apply -PASS subtest_723: not all and (scan) should apply -PASS subtest_724: not all and (scan: progressive) should apply -PASS subtest_725: not all and (scan: interlace) should apply +PASS subtest_720 +PASS subtest_721 +PASS subtest_722 +PASS subtest_723 +PASS subtest_724 +PASS subtest_725 PASS subtest_726 PASS subtest_727 PASS subtest_728 @@ -738,43 +738,43 @@ PASS subtest_732 PASS subtest_733 PASS subtest_734 -PASS subtest_735: (grid) should not apply -PASS subtest_736: (grid: 0) should apply -PASS subtest_737: (grid: 1) should not apply -PASS subtest_738: (grid: 2) should not apply -PASS subtest_739: (grid: -1) should not apply -PASS subtest_740: (orientation should apply -PASS subtest_741: not all and (orientation should not apply -PASS subtest_742: (orientation: should not apply -PASS subtest_743: (orientation:) should not apply -PASS subtest_744: (orientation: ) should not apply -PASS subtest_745: all,(orientation: should apply -PASS subtest_746: (orientation:,all should not apply -PASS subtest_747: not all and (grid should apply -PASS subtest_748: only all and (grid should not apply -PASS subtest_749: (grid should not apply -PASS subtest_750: all,(grid should apply -PASS subtest_751: (grid,all should not apply -PASS subtest_752: ,all should apply -PASS subtest_753: all, should apply -PASS subtest_754: ,all, should apply -PASS subtest_755: all,badmedium should apply -PASS subtest_756: badmedium,all should apply -PASS subtest_757: ,badmedium, should not apply -PASS subtest_758: all,(badexpression) should apply -PASS subtest_759: (badexpression),all should apply -PASS subtest_760: (badexpression),badmedium should not apply -PASS subtest_761: badmedium,(badexpression) should not apply -PASS subtest_762: all,[badsyntax] should apply -PASS subtest_763: [badsyntax],all should apply -PASS subtest_764: badmedium,[badsyntax] should not apply -PASS subtest_765: [badsyntax],badmedium should not apply +PASS subtest_735 +PASS subtest_736 +PASS subtest_737 +PASS subtest_738 +PASS subtest_739 +PASS subtest_740 +PASS subtest_741 +PASS subtest_742 +PASS subtest_743 +PASS subtest_744 +PASS subtest_745 +PASS subtest_746 +PASS subtest_747 +PASS subtest_748 +PASS subtest_749 +PASS subtest_750 +PASS subtest_751 +PASS subtest_752 +PASS subtest_753 +PASS subtest_754 +PASS subtest_755 +PASS subtest_756 +PASS subtest_757 +PASS subtest_758 +PASS subtest_759 +PASS subtest_760 +PASS subtest_761 +PASS subtest_762 +PASS subtest_763 +PASS subtest_764 +PASS subtest_765 PASS subtest_766 PASS subtest_767 -PASS subtest_768: all and min-color : 1 should not apply -PASS subtest_769: (bogus) should not apply -PASS subtest_770: not all and (bogus) should not apply -PASS subtest_771: only all and (bogus) should not apply +PASS subtest_768 +PASS subtest_769 +PASS subtest_770 +PASS subtest_771 FAIL subtest_772 assert_true: expected true got false FAIL subtest_773 assert_true: expected true got false FAIL subtest_774 assert_true: expected true got false
diff --git a/third_party/blink/web_tests/virtual/layout_ng_block_frag/fast/multicol/caret-range-outside-columns-mac-expected.txt b/third_party/blink/web_tests/virtual/layout_ng_block_frag/fast/multicol/caret-range-outside-columns-mac-expected.txt new file mode 100644 index 0000000..1fe9206 --- /dev/null +++ b/third_party/blink/web_tests/virtual/layout_ng_block_frag/fast/multicol/caret-range-outside-columns-mac-expected.txt
@@ -0,0 +1,54 @@ +Test that hitting areas outside columns takes us to the right text content inside columns. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + +Above first column: +PASS document.caretRangeFromPoint(50,0).startOffset is 0 +PASS document.caretRangeFromPoint(150,0).startOffset is 0 +PASS document.caretRangeFromPoint(189,0).startOffset is 0 +Above second column: +PASS document.caretRangeFromPoint(190,0).startOffset is 12 +PASS document.caretRangeFromPoint(250,0).startOffset is 12 +PASS document.caretRangeFromPoint(289,0).startOffset is 12 +Above third column: +PASS document.caretRangeFromPoint(290,0).startOffset is 24 +PASS document.caretRangeFromPoint(350,0).startOffset is 24 +PASS document.caretRangeFromPoint(450,0).startOffset is 24 +Below first column: +PASS document.caretRangeFromPoint(50,100).startOffset is 11 +PASS document.caretRangeFromPoint(150,100).startOffset is 11 +PASS document.caretRangeFromPoint(189,100).startOffset is 11 +Below second column: +PASS document.caretRangeFromPoint(190,100).startOffset is 23 +PASS document.caretRangeFromPoint(250,100).startOffset is 23 +PASS document.caretRangeFromPoint(289,100).startOffset is 23 +Below third column: +PASS document.caretRangeFromPoint(290,100).startOffset is 35 +PASS document.caretRangeFromPoint(350,100).startOffset is 35 +PASS document.caretRangeFromPoint(389,100).startOffset is 35 +To the left of the first column: +PASS document.caretRangeFromPoint(0,10).startOffset is 0 +PASS document.caretRangeFromPoint(0,30).startOffset is 0 +PASS document.caretRangeFromPoint(0,50).startOffset is 4 +PASS document.caretRangeFromPoint(0,70).startOffset is 8 +PASS document.caretRangeFromPoint(0,90).startOffset is 11 +To the right of the third column: +PASS document.caretRangeFromPoint(400,10).startOffset is 24 +PASS document.caretRangeFromPoint(400,30).startOffset is 27 +PASS document.caretRangeFromPoint(400,50).startOffset is 31 +PASS document.caretRangeFromPoint(400,70).startOffset is 35 +In the gap between the first and second columns: +PASS document.caretRangeFromPoint(180,20).startOffset is 3 +PASS document.caretRangeFromPoint(180,40).startOffset is 7 +PASS document.caretRangeFromPoint(180,60).startOffset is 11 +PASS document.caretRangeFromPoint(180,69).startOffset is 11 +In the gap between the second and third columns: +PASS document.caretRangeFromPoint(280,20).startOffset is 15 +PASS document.caretRangeFromPoint(280,40).startOffset is 19 +PASS document.caretRangeFromPoint(280,60).startOffset is 23 +PASS document.caretRangeFromPoint(280,69).startOffset is 23 +PASS successfullyParsed is true + +TEST COMPLETE + +xxx xxx xxx xxx xxx xxx xxx xxx xxx
diff --git a/third_party/blink/web_tests/virtual/layout_ng_block_frag/fast/multicol/caret-range-outside-columns-expected.txt b/third_party/blink/web_tests/virtual/layout_ng_block_frag/fast/multicol/caret-range-outside-columns-win-expected.txt similarity index 100% rename from third_party/blink/web_tests/virtual/layout_ng_block_frag/fast/multicol/caret-range-outside-columns-expected.txt rename to third_party/blink/web_tests/virtual/layout_ng_block_frag/fast/multicol/caret-range-outside-columns-win-expected.txt
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index bd7e062..946ecc31 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -7362,6 +7362,8 @@ label="CPMD_BAD_ORIGIN_SHOW_MANUAL_PASSWORD_GENERATION_POPUP"/> <int value="12" label="CPMD_BAD_ORIGIN_SHOW_PASSWORD_EDITING_POPUP"/> <int value="13" label="CPMD_BAD_ORIGIN_GENERATION_AVAILABLE_FOR_FORM"/> + <int value="14" label="CPMD_BAD_ORIGIN_PASSWORD_FORM_CLEARED"/> + <int value="15" label="CPMD_BAD_ORIGIN_CHECK_SAFE_BROWSING_REPUTATION"/> </enum> <enum name="BadSyncDataReason"> @@ -67590,6 +67592,8 @@ <int value="74" label="MainThreadTaskQueueIPCTracking"/> <int value="75" label="NetworkingUnfreezable"/> <int value="76" label="WakeLock"/> + <int value="77" label="InternalInputBlocking"/> + <int value="78" label="WebGL"/> </enum> <enum name="RendererSchedulerTaskUseCase">
diff --git a/tools/metrics/histograms/histograms_xml/METRIC_REVIEWER_OWNERS b/tools/metrics/histograms/histograms_xml/METRIC_REVIEWER_OWNERS index df81362..5e80c49 100644 --- a/tools/metrics/histograms/histograms_xml/METRIC_REVIEWER_OWNERS +++ b/tools/metrics/histograms/histograms_xml/METRIC_REVIEWER_OWNERS
@@ -14,6 +14,7 @@ iclelland@chromium.org javierrobles@chromium.org jsaul@google.com +kron@chromium.org lizeb@chromium.org lyf@chromium.org mcrouse@chromium.org
diff --git a/tools/metrics/histograms/histograms_xml/input/histograms.xml b/tools/metrics/histograms/histograms_xml/input/histograms.xml index 41244a7a..54abbd1 100644 --- a/tools/metrics/histograms/histograms_xml/input/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/input/histograms.xml
@@ -256,6 +256,20 @@ </summary> </histogram> +<histogram name="InputMethod.CharactersPerSession" units="characters" + expires_after="2021-11-01"> + <owner>keithlee@chromium.org</owner> + <owner>essential-inputs-team@google.com</owner> + <summary> + Number of characters entered in a single user session on ChromeOS. A user + session consists of a user typing 10+ characters for 1+ seconds where there + is no period of time where the user is inactive for more than 3 seconds. + This gets recorded when we detect user input and it has been more than 3 + seconds since the last input by the user and also when a change in the + Engine or Text field selected is detected. + </summary> +</histogram> + <histogram name="InputMethod.Commit.Index" units="units" expires_after="2021-10-10"> <owner>shend@chromium.org</owner> @@ -584,6 +598,21 @@ </summary> </histogram> +<histogram name="InputMethod.SessionDuration" units="ms" + expires_after="2021-11-01"> + <owner>keithlee@chromium.org</owner> + <owner>essential-inputs-team@google.com</owner> + <summary> + The average length of user sessions on ChromeOS. This can be combined with + characters per session to determine characters per minute. A user session + consists of a user typing 10+ characters for 1+ seconds where there is no + period of time where the user is inactive for more than 3 seconds. This gets + recorded when we detect user input and it has been more than 3 seconds since + the last input by the user and also when a change in the Engine or Text + field selected is detected. + </summary> +</histogram> + <histogram name="InputMethod.SystemEmojiPicker.TriggerType" enum="VirtualKeyboardEmojiTriggerType" expires_after="M95"> <owner>jopalmer@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/media/OWNERS b/tools/metrics/histograms/histograms_xml/media/OWNERS index 858933b..3a0c4501 100644 --- a/tools/metrics/histograms/histograms_xml/media/OWNERS +++ b/tools/metrics/histograms/histograms_xml/media/OWNERS
@@ -2,3 +2,4 @@ # Use either chromium-metrics-reviews@google.com or the below owners. toyoshim@chromium.org +kron@chromium.org
diff --git a/tools/metrics/histograms/histograms_xml/web_rtc/OWNER b/tools/metrics/histograms/histograms_xml/web_rtc/OWNER new file mode 100644 index 0000000..bc26f87 --- /dev/null +++ b/tools/metrics/histograms/histograms_xml/web_rtc/OWNER
@@ -0,0 +1,5 @@ +per-file OWNERS=file://tools/metrics/histograms/histograms_xml/METRIC_REVIEWER_OWNERS + +# Prefer sending CLs to the owners listed below. +# Use chromium-metrics-reviews@google.com as a backup. +kron@chromium.org
diff --git a/tools/perf/core/bot_platforms.py b/tools/perf/core/bot_platforms.py index 5912ab92..b040135 100644 --- a/tools/perf/core/bot_platforms.py +++ b/tools/perf/core/bot_platforms.py
@@ -367,7 +367,7 @@ ]) _WIN_10_LOW_END_HP_CANDIDATE_BENCHMARK_CONFIGS = PerfSuite([ _GetBenchmarkConfig('v8.browsing_desktop'), - _GetBenchmarkConfig('rendering.desktop'), + _GetBenchmarkConfig('rendering.desktop', abridged=True), ]) _WIN_10_AMD_BENCHMARK_CONFIGS = PerfSuite([ _GetBenchmarkConfig('jetstream'),
diff --git a/tools/perf/core/perf_data_generator.py b/tools/perf/core/perf_data_generator.py index 950fbc7..a6e5f87 100755 --- a/tools/perf/core/perf_data_generator.py +++ b/tools/perf/core/perf_data_generator.py
@@ -1460,7 +1460,7 @@ } # TODO(crbug.com/1104244) Enable Result DB on all platforms when verified. - if builder_name == 'linux-perf-fyi': + if builder_name in FYI_BUILDERS: result['resultdb'] = {'enable': True} # For now we either get shards from the number of devices specified
diff --git a/tools/perf/core/shard_maps/win-10_laptop_low_end-perf_hp-candidate_map.json b/tools/perf/core/shard_maps/win-10_laptop_low_end-perf_hp-candidate_map.json index dadb894..349565e 100644 --- a/tools/perf/core/shard_maps/win-10_laptop_low_end-perf_hp-candidate_map.json +++ b/tools/perf/core/shard_maps/win-10_laptop_low_end-perf_hp-candidate_map.json
@@ -2,7 +2,7 @@ "0": { "benchmarks": { "rendering.desktop": { - "abridged": false + "abridged": true }, "v8.browsing_desktop": { "abridged": false @@ -10,11 +10,11 @@ } }, "extra_infos": { - "num_stories": 331, - "predicted_min_shard_time": 5424.0, + "num_stories": 40, + "predicted_min_shard_time": 2061.0, "predicted_min_shard_index": 0, - "predicted_max_shard_time": 5424.0, + "predicted_max_shard_time": 2061.0, "predicted_max_shard_index": 0, - "shard #0": 5424.0 + "shard #0": 2061.0 } } \ No newline at end of file
diff --git a/ui/accessibility/ax_text_utils_unittest.cc b/ui/accessibility/ax_text_utils_unittest.cc index c644941..8fd1b90 100644 --- a/ui/accessibility/ax_text_utils_unittest.cc +++ b/ui/accessibility/ax_text_utils_unittest.cc
@@ -290,14 +290,14 @@ } TEST(AXTextUtils, GetSentenceStartOffsetsBasicTest) { - const std::u16string text = base::UTF8ToUTF16( - "This is the first sentence. This is the second sentence"); + const std::u16string text = + u"This is the first sentence. This is the second sentence"; EXPECT_THAT(GetSentenceStartOffsets(text), testing::ElementsAre(0, 28)); } TEST(AXTextUtils, GetSentenceEndOffsetsBasicTest) { - const std::u16string text = base::UTF8ToUTF16( - "This is the first sentence. This is the second sentence"); + const std::u16string text = + u"This is the first sentence. This is the second sentence"; EXPECT_THAT(GetSentenceEndOffsets(text), testing::ElementsAre(28, 55)); }
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn index 4ca8addaac..a7fd3c7 100644 --- a/ui/base/BUILD.gn +++ b/ui/base/BUILD.gn
@@ -817,7 +817,10 @@ "ime/chromeos/mock_input_method_manager.cc", "ime/chromeos/mock_input_method_manager.h", ] - deps += [ "//ui/base/ime/chromeos" ] + deps += [ + "//ui/base/ime/chromeos", + "//ui/base/ime/chromeos:typing_session_manager", + ] } } @@ -1055,10 +1058,12 @@ "ime/chromeos/input_method_chromeos_unittest.cc", "ime/chromeos/input_method_descriptor_unittest.cc", "ime/chromeos/input_method_util_unittest.cc", + "ime/chromeos/typing_session_manager_unittest.cc", ] deps += [ "//build:branding_buildflags", "//ui/base/ime/chromeos", + "//ui/base/ime/chromeos:typing_session_manager", ] } if ((is_linux || is_chromeos_lacros) && use_aura) {
diff --git a/ui/base/clipboard/clipboard_test_template.h b/ui/base/clipboard/clipboard_test_template.h index bf608e2c..e89e626 100644 --- a/ui/base/clipboard/clipboard_test_template.h +++ b/ui/base/clipboard/clipboard_test_template.h
@@ -63,7 +63,6 @@ using base::ASCIIToUTF16; using base::UTF16ToUTF8; -using base::UTF8ToUTF16; using testing::Contains; @@ -366,8 +365,7 @@ // Some platforms store HTML as UTF-8 internally. Make sure fragment indices are // adjusted appropriately when converting back to UTF-16. TYPED_TEST(ClipboardTest, UnicodeHTMLTest) { - std::u16string markup(UTF8ToUTF16("<div>A \xc3\xb8 \xe6\xb0\xb4</div>")), - markup_result; + std::u16string markup(u"<div>A ø 水</div>"), markup_result; std::string url, url_result; { @@ -443,7 +441,7 @@ this->clipboard().ReadAvailableTypes(ClipboardBuffer::kCopyPaste, /* data_dst = */ nullptr, &types); EXPECT_EQ(1u, types.size()); - EXPECT_EQ("text/uri-list", base::UTF16ToUTF8(types[0])); + EXPECT_EQ(u"text/uri-list", types[0]); std::vector<ui::FileInfo> filenames; this->clipboard().ReadFilenames(ClipboardBuffer::kCopyPaste, @@ -708,6 +706,7 @@ TYPED_TEST(ClipboardTest, DataTest) { const std::string kFormatString = "chromium/x-test-format"; + const std::u16string kFormatString16 = u"chromium/x-test-format"; const ClipboardFormatType kFormat = ClipboardFormatType::GetType(kFormatString); const std::string payload = "test string"; @@ -716,7 +715,7 @@ { ScopedClipboardWriter clipboard_writer(ClipboardBuffer::kCopyPaste); - clipboard_writer.WriteData(UTF8ToUTF16(kFormatString), + clipboard_writer.WriteData(kFormatString16, mojo_base::BigBuffer(payload_span)); } @@ -736,6 +735,7 @@ !BUILDFLAG(IS_CHROMEOS_ASH) TYPED_TEST(ClipboardTest, MultipleDataTest) { const std::string kFormatString1 = "chromium/x-test-format1"; + const std::u16string kFormatString116 = u"chromium/x-test-format1"; const ClipboardFormatType kFormat1 = ClipboardFormatType::GetType(kFormatString1); const std::string payload1("test string1"); @@ -743,6 +743,7 @@ reinterpret_cast<const uint8_t*>(payload1.data()), payload1.size()); const std::string kFormatString2 = "chromium/x-test-format2"; + const std::u16string kFormatString216 = u"chromium/x-test-format2"; const ClipboardFormatType kFormat2 = ClipboardFormatType::GetType(kFormatString2); const std::string payload2("test string2"); @@ -752,16 +753,16 @@ { ScopedClipboardWriter clipboard_writer(ClipboardBuffer::kCopyPaste); // Both payloads should write successfully and not overwrite one another. - clipboard_writer.WriteData(UTF8ToUTF16(kFormatString1), + clipboard_writer.WriteData(kFormatString116, mojo_base::BigBuffer(payload_span1)); - clipboard_writer.WriteData(UTF8ToUTF16(kFormatString2), + clipboard_writer.WriteData(kFormatString216, mojo_base::BigBuffer(payload_span2)); } // Check format 1. EXPECT_THAT(this->clipboard().ReadAvailablePlatformSpecificFormatNames( ClipboardBuffer::kCopyPaste, /* data_dst = */ nullptr), - Contains(ASCIIToUTF16(kFormatString1))); + Contains(kFormatString116)); EXPECT_TRUE(this->clipboard().IsFormatAvailable( kFormat1, ClipboardBuffer::kCopyPaste, /* data_dst = */ nullptr)); std::string output1; @@ -771,7 +772,7 @@ // Check format 2. EXPECT_THAT(this->clipboard().ReadAvailablePlatformSpecificFormatNames( ClipboardBuffer::kCopyPaste, /* data_dst = */ nullptr), - Contains(ASCIIToUTF16(kFormatString2))); + Contains(kFormatString216)); EXPECT_TRUE(this->clipboard().IsFormatAvailable( kFormat2, ClipboardBuffer::kCopyPaste, /* data_dst = */ nullptr)); std::string output2; @@ -904,9 +905,9 @@ TYPED_TEST(ClipboardTest, HyperlinkTest) { const std::string kTitle("The <Example> Company's \"home page\""); const std::string kUrl("http://www.example.com?x=3<=3#\"'<>"); - const std::u16string kExpectedHtml(UTF8ToUTF16( - "<a href=\"http://www.example.com?x=3&lt=3#"'<>\">" - "The <Example> Company's "home page"</a>")); + const std::u16string kExpectedHtml( + u"<a href=\"http://www.example.com?x=3&lt=3#"'<>\">" + u"The <Example> Company's "home page"</a>"); std::string url_result; std::u16string html_result;
diff --git a/ui/base/ime/chromeos/BUILD.gn b/ui/base/ime/chromeos/BUILD.gn index f687837..5bc3643 100644 --- a/ui/base/ime/chromeos/BUILD.gn +++ b/ui/base/ime/chromeos/BUILD.gn
@@ -10,6 +10,18 @@ sources = [ "ime_keyset.h" ] } +source_set("typing_session_manager") { + sources = [ + "typing_session_manager.cc", + "typing_session_manager.h", + ] + + public_deps = [ + "//base:base", + "//third_party/abseil-cpp:absl", + ] +} + component("chromeos") { output_name = "ui_base_ime_chromeos" @@ -55,6 +67,7 @@ deps = [ ":ime_types", + ":typing_session_manager", "//build:branding_buildflags", "//chromeos/services/ime/public/mojom", "//chromeos/system",
diff --git a/ui/base/ime/chromeos/input_method_chromeos.cc b/ui/base/ime/chromeos/input_method_chromeos.cc index 527e2a4..177d9b8 100644 --- a/ui/base/ime/chromeos/input_method_chromeos.cc +++ b/ui/base/ime/chromeos/input_method_chromeos.cc
@@ -18,11 +18,13 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/third_party/icu/icu_utf.h" +#include "base/time/default_clock.h" #include "chromeos/system/devicemode.h" #include "ui/base/ime/chromeos/ime_bridge.h" #include "ui/base/ime/chromeos/ime_engine_handler_interface.h" #include "ui/base/ime/chromeos/ime_keyboard.h" #include "ui/base/ime/chromeos/input_method_manager.h" +#include "ui/base/ime/chromeos/typing_session_manager.h" #include "ui/base/ime/composition_text.h" #include "ui/base/ime/input_method_delegate.h" #include "ui/base/ime/text_input_client.h" @@ -39,7 +41,9 @@ // InputMethodChromeOS implementation ----------------------------------------- InputMethodChromeOS::InputMethodChromeOS( internal::InputMethodDelegate* delegate) - : InputMethodBase(delegate) { + : InputMethodBase(delegate), + typing_session_manager_( + TypingSessionManager(base::DefaultClock::GetInstance())) { ResetContext(); } @@ -52,6 +56,7 @@ ui::IMEBridge::Get()->GetInputContextHandler() == this) { ui::IMEBridge::Get()->SetInputContextHandler(nullptr); } + typing_session_manager_.EndAndRecordSession(); } InputMethodChromeOS::PendingSetCompositionRange::PendingSetCompositionRange( @@ -346,7 +351,7 @@ if (IsTextInputTypeNone()) return false; - + typing_session_manager_.Heartbeat(); // The given range and spans are relative to the current selection. gfx::Range range; if (!client->GetEditableSelectionRange(&range)) @@ -427,6 +432,7 @@ bool InputMethodChromeOS::SetSelectionRange(uint32_t start, uint32_t end) { if (IsTextInputTypeNone()) return false; + typing_session_manager_.Heartbeat(); return GetTextInputClient()->SetEditableSelectionRange( gfx::Range(start, end)); } @@ -434,9 +440,11 @@ void InputMethodChromeOS::ConfirmCompositionText(bool reset_engine, bool keep_selection) { TextInputClient* client = GetTextInputClient(); - if (client && client->HasCompositionText()) - client->ConfirmCompositionText(keep_selection); - + if (client && client->HasCompositionText()) { + const uint32_t characters_committed = + client->ConfirmCompositionText(keep_selection); + typing_session_manager_.CommitCharacters(characters_committed); + } // See https://crbug.com/984472. ResetContext(reset_engine); } @@ -563,8 +571,10 @@ // If a key event was not filtered by |context_| and |character_composer_|, // then it means the key event didn't generate any result text. So we need // to send corresponding character to the focused text input client. - if (event->GetCharacter()) + if (event->GetCharacter()) { client->InsertChar(*event); + typing_session_manager_.CommitCharacters(1); + } return details; } @@ -601,6 +611,7 @@ } composing_text_ = false; } + typing_session_manager_.CommitCharacters(result_text_.length()); } // TODO(https://crbug.com/952757): Refactor this code to be clearer and less @@ -670,10 +681,10 @@ // If we are not handling key event, do not bother sending text result if the // focused text input client does not support text input. if (!handling_key_event_ && !IsTextInputTypeNone()) { - if (!SendFakeProcessKeyEvent(true)) + if (!SendFakeProcessKeyEvent(true)) { GetTextInputClient()->InsertText(text, cursor_behavior); - SendFakeProcessKeyEvent(false); - result_text_.clear(); + typing_session_manager_.CommitCharacters(text.length()); + } result_text_cursor_ = 0; } }
diff --git a/ui/base/ime/chromeos/input_method_chromeos.h b/ui/base/ime/chromeos/input_method_chromeos.h index efff94b35..d325f5e 100644 --- a/ui/base/ime/chromeos/input_method_chromeos.h +++ b/ui/base/ime/chromeos/input_method_chromeos.h
@@ -17,6 +17,7 @@ #include "base/memory/weak_ptr.h" #include "ui/base/ime/character_composer.h" #include "ui/base/ime/chromeos/ime_input_context_handler_interface.h" +#include "ui/base/ime/chromeos/typing_session_manager.h" #include "ui/base/ime/composition_text.h" #include "ui/base/ime/input_method_base.h" #include "ui/base/ime/text_input_client.h" @@ -185,6 +186,8 @@ // This is used in CommitText/UpdateCompositionText/etc. bool handling_key_event_ = false; + TypingSessionManager typing_session_manager_; + // Used for making callbacks. base::WeakPtrFactory<InputMethodChromeOS> weak_ptr_factory_{this};
diff --git a/ui/base/ime/chromeos/typing_session_manager.cc b/ui/base/ime/chromeos/typing_session_manager.cc new file mode 100644 index 0000000..da75615 --- /dev/null +++ b/ui/base/ime/chromeos/typing_session_manager.cc
@@ -0,0 +1,87 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/base/ime/chromeos/typing_session_manager.h" + +#include "base/metrics/histogram_functions.h" +#include "base/time/clock.h" + +#include <stddef.h> + +#include <algorithm> +#include <cstring> +#include <set> +#include <utility> + +namespace ui { + +const uint64_t INACTIVITY_TIMEOUT_FOR_SESSION_IN_MS = 3000; +const uint64_t MIN_CHARACTERS_COMMITTED = 10; +const base::TimeDelta MIN_SESSION_DURATION_IN_MS = + base::TimeDelta::FromSeconds(1); + +// TODO: We cannot assume that the time will always increase, it can decrease if +// system clock is explicitly set. Invalidate sessions where system clock +// decreases. +TypingSessionManager::TypingSessionManager(base::Clock* clock) + : characters_committed_this_session_count_(0), + clock_(clock ? clock : base::DefaultClock::GetInstance()), + is_active_(false) { + session_start_time_ = clock_->Now(); + last_user_action_time_ = clock_->Now(); +} + +TypingSessionManager::TypingSessionManager( + const TypingSessionManager& typing_session_manager) {} + +TypingSessionManager::~TypingSessionManager() { + EndAndRecordSession(); +} + +void TypingSessionManager::Heartbeat() { + base::Time current_time = clock_->Now(); + + // If too much time has passed, then end the previous session and + // start a new one. + if (is_active_) { + if (last_user_action_time_ + base::TimeDelta::FromMilliseconds( + INACTIVITY_TIMEOUT_FOR_SESSION_IN_MS) < + current_time) { + EndAndRecordSession(); + } + } + + last_user_action_time_ = current_time; + // If no session is active, create a new one here. + if (!is_active_) { + is_active_ = true; + session_start_time_ = current_time; + characters_committed_this_session_count_ = 0; + } +} + +// Note: only count characters as committed if the VK is enabled. +void TypingSessionManager::CommitCharacters(uint64_t character_count) { + Heartbeat(); + characters_committed_this_session_count_ += character_count; +} + +void TypingSessionManager::EndAndRecordSession() { + // Only record for sessions where at least 10 characters were entered + base::TimeDelta time_taken = last_user_action_time_ - session_start_time_; + if (characters_committed_this_session_count_ >= MIN_CHARACTERS_COMMITTED && + time_taken >= MIN_SESSION_DURATION_IN_MS) { + base::UmaHistogramTimes("InputMethod.SessionDuration", time_taken); + base::UmaHistogramCounts100000("InputMethod.CharactersPerSession", + characters_committed_this_session_count_); + } + + // Reset the typing session + characters_committed_this_session_count_ = 0; + is_active_ = false; + session_start_time_ = clock_->Now(); + last_user_action_time_ = clock_->Now(); +} + +} // namespace ui
diff --git a/ui/base/ime/chromeos/typing_session_manager.h b/ui/base/ime/chromeos/typing_session_manager.h new file mode 100644 index 0000000..2b57176f --- /dev/null +++ b/ui/base/ime/chromeos/typing_session_manager.h
@@ -0,0 +1,53 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_BASE_IME_CHROMEOS_TYPING_SESSION_MANAGER_H_ +#define UI_BASE_IME_CHROMEOS_TYPING_SESSION_MANAGER_H_ + +#include <stdint.h> + +#include <memory> +#include <set> +#include <string> + +#include "base/macros.h" +#include "base/time/default_clock.h" +#include "base/time/time.h" + +namespace ui { + +class TypingSessionManager { + public: + explicit TypingSessionManager(base::Clock* clock); + + TypingSessionManager(const TypingSessionManager& typing_session_manager); + + ~TypingSessionManager(); + + // To be called whenever user activity is detected to keep the + // session going. + void Heartbeat(); + + // Record that |character_count| characters have been committed + // This also triggers a Heartbeat. + void CommitCharacters(uint64_t character_count); + + // End a typing session, record the metrics and + void EndAndRecordSession(); + + private: + uint64_t characters_committed_this_session_count_; + + base::Time session_start_time_; + + base::Time last_user_action_time_; + + base::Clock* clock_; + + bool is_active_; +}; + +} // namespace ui + +#endif // UI_BASE_IME_CHROMEOS_TYPING_SESSION_MANAGER_H_
diff --git a/ui/base/ime/chromeos/typing_session_manager_unittest.cc b/ui/base/ime/chromeos/typing_session_manager_unittest.cc new file mode 100644 index 0000000..ee2b90f --- /dev/null +++ b/ui/base/ime/chromeos/typing_session_manager_unittest.cc
@@ -0,0 +1,187 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/base/ime/chromeos/typing_session_manager.h" + +#include <memory> +#include <utility> + +#include "base/guid.h" +#include "base/strings/utf_string_conversions.h" +#include "base/test/metrics/histogram_tester.h" +#include "base/test/simple_test_clock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace chromeos { +namespace { + +class TypingSessionManagerTest : public testing::Test { + protected: + void SetUp() override { + base::Time now = base::Time::Now(); + test_clock_.SetNow(now); + } + + public: + TypingSessionManagerTest() : typing_session_manager_(&test_clock_) {} + + base::SimpleTestClock test_clock_; + ui::TypingSessionManager typing_session_manager_; +}; + +TEST_F(TypingSessionManagerTest, RecordMetricsForSimpleTypingSession) { + base::HistogramTester histogram_tester; + + histogram_tester.ExpectTotalCount("InputMethod.SessionDuration", 0); + histogram_tester.ExpectTotalCount("InputMethod.CharactersPerSession", 0); + + typing_session_manager_.CommitCharacters(15); + test_clock_.Advance(base::TimeDelta::FromSeconds(1)); + typing_session_manager_.CommitCharacters(20); + test_clock_.Advance(base::TimeDelta::FromSeconds(2)); + + typing_session_manager_.EndAndRecordSession(); + + histogram_tester.ExpectTotalCount("InputMethod.SessionDuration", 1); + histogram_tester.ExpectUniqueSample("InputMethod.SessionDuration", 1000, 1); + histogram_tester.ExpectTotalCount("InputMethod.CharactersPerSession", 1); + histogram_tester.ExpectUniqueSample("InputMethod.CharactersPerSession", 35, + 1); + + typing_session_manager_.CommitCharacters(25); + test_clock_.Advance(base::TimeDelta::FromMilliseconds(500)); + test_clock_.Advance(base::TimeDelta::FromSeconds(1)); + typing_session_manager_.CommitCharacters(30); + test_clock_.Advance(base::TimeDelta::FromSeconds(2)); + + typing_session_manager_.EndAndRecordSession(); + + histogram_tester.ExpectTotalCount("InputMethod.SessionDuration", 2); + histogram_tester.ExpectBucketCount("InputMethod.SessionDuration", 1500, 1); + histogram_tester.ExpectTotalCount("InputMethod.CharactersPerSession", 2); + histogram_tester.ExpectBucketCount("InputMethod.CharactersPerSession", 55, 1); +} + +TEST_F(TypingSessionManagerTest, + RecordMetricsForAutomaticallyEndedTypingSession) { + base::HistogramTester histogram_tester; + + histogram_tester.ExpectTotalCount("InputMethod.SessionDuration", 0); + histogram_tester.ExpectTotalCount("InputMethod.CharactersPerSession", 0); + + typing_session_manager_.CommitCharacters(15); + test_clock_.Advance(base::TimeDelta::FromSeconds(1)); + typing_session_manager_.CommitCharacters(20); + test_clock_.Advance(base::TimeDelta::FromSeconds(4)); + + typing_session_manager_.CommitCharacters(25); + + histogram_tester.ExpectTotalCount("InputMethod.SessionDuration", 1); + histogram_tester.ExpectUniqueSample("InputMethod.SessionDuration", 1000, 1); + histogram_tester.ExpectTotalCount("InputMethod.CharactersPerSession", 1); + histogram_tester.ExpectUniqueSample("InputMethod.CharactersPerSession", 35, + 1); + + test_clock_.Advance(base::TimeDelta::FromMilliseconds(500)); + test_clock_.Advance(base::TimeDelta::FromSeconds(1)); + typing_session_manager_.CommitCharacters(30); + test_clock_.Advance(base::TimeDelta::FromSeconds(4)); + + typing_session_manager_.Heartbeat(); + + histogram_tester.ExpectTotalCount("InputMethod.SessionDuration", 2); + histogram_tester.ExpectBucketCount("InputMethod.SessionDuration", 1500, 1); + histogram_tester.ExpectTotalCount("InputMethod.CharactersPerSession", 2); + histogram_tester.ExpectBucketCount("InputMethod.CharactersPerSession", 55, 1); +} + +TEST_F(TypingSessionManagerTest, DoNotRecordInvalidTypingSessionManuallyEnded) { + base::HistogramTester histogram_tester; + + histogram_tester.ExpectTotalCount("InputMethod.SessionDuration", 0); + histogram_tester.ExpectTotalCount("InputMethod.CharactersPerSession", 0); + + typing_session_manager_.CommitCharacters(1); + test_clock_.Advance(base::TimeDelta::FromSeconds(1)); + typing_session_manager_.CommitCharacters(2); + test_clock_.Advance(base::TimeDelta::FromSeconds(2)); + + typing_session_manager_.EndAndRecordSession(); + + histogram_tester.ExpectTotalCount("InputMethod.SessionDuration", 0); + histogram_tester.ExpectTotalCount("InputMethod.CharactersPerSession", 0); + + typing_session_manager_.CommitCharacters(3); + test_clock_.Advance(base::TimeDelta::FromMilliseconds(500)); + test_clock_.Advance(base::TimeDelta::FromSeconds(1)); + typing_session_manager_.CommitCharacters(4); + test_clock_.Advance(base::TimeDelta::FromSeconds(2)); + + typing_session_manager_.EndAndRecordSession(); + + histogram_tester.ExpectTotalCount("InputMethod.SessionDuration", 0); + histogram_tester.ExpectTotalCount("InputMethod.CharactersPerSession", 0); +} + +TEST_F(TypingSessionManagerTest, + DoNotRecordInvalidTypingSessionAutomaticallyEnded) { + base::HistogramTester histogram_tester; + + histogram_tester.ExpectTotalCount("InputMethod.SessionDuration", 0); + histogram_tester.ExpectTotalCount("InputMethod.CharactersPerSession", 0); + + typing_session_manager_.CommitCharacters(1); + test_clock_.Advance(base::TimeDelta::FromSeconds(1)); + typing_session_manager_.CommitCharacters(2); + test_clock_.Advance(base::TimeDelta::FromSeconds(4)); + + typing_session_manager_.CommitCharacters(3); + + histogram_tester.ExpectTotalCount("InputMethod.SessionDuration", 0); + histogram_tester.ExpectTotalCount("InputMethod.CharactersPerSession", 0); + + test_clock_.Advance(base::TimeDelta::FromMilliseconds(500)); + test_clock_.Advance(base::TimeDelta::FromSeconds(1)); + typing_session_manager_.CommitCharacters(4); + test_clock_.Advance(base::TimeDelta::FromSeconds(4)); + + typing_session_manager_.Heartbeat(); + + histogram_tester.ExpectTotalCount("InputMethod.SessionDuration", 0); + histogram_tester.ExpectTotalCount("InputMethod.CharactersPerSession", 0); +} + +TEST_F(TypingSessionManagerTest, DoNotRecordTooShortTypingSession) { + base::HistogramTester histogram_tester; + + histogram_tester.ExpectTotalCount("InputMethod.SessionDuration", 0); + histogram_tester.ExpectTotalCount("InputMethod.CharactersPerSession", 0); + + typing_session_manager_.CommitCharacters(15); + test_clock_.Advance(base::TimeDelta::FromMilliseconds(500)); + typing_session_manager_.CommitCharacters(20); + test_clock_.Advance(base::TimeDelta::FromSeconds(2)); + + typing_session_manager_.EndAndRecordSession(); + + histogram_tester.ExpectTotalCount("InputMethod.SessionDuration", 0); + histogram_tester.ExpectTotalCount("InputMethod.CharactersPerSession", 0); + + typing_session_manager_.CommitCharacters(25); + test_clock_.Advance(base::TimeDelta::FromMilliseconds(500)); + test_clock_.Advance(base::TimeDelta::FromSeconds(1)); + typing_session_manager_.CommitCharacters(30); + test_clock_.Advance(base::TimeDelta::FromSeconds(2)); + + typing_session_manager_.EndAndRecordSession(); + + histogram_tester.ExpectTotalCount("InputMethod.SessionDuration", 1); + histogram_tester.ExpectBucketCount("InputMethod.SessionDuration", 1500, 1); + histogram_tester.ExpectTotalCount("InputMethod.CharactersPerSession", 1); + histogram_tester.ExpectBucketCount("InputMethod.CharactersPerSession", 55, 1); +} + +} // namespace + +} // namespace chromeos
diff --git a/ui/gfx/bidi_line_iterator_unittest.cc b/ui/gfx/bidi_line_iterator_unittest.cc index d8dbc51c..73032f2 100644 --- a/ui/gfx/bidi_line_iterator_unittest.cc +++ b/ui/gfx/bidi_line_iterator_unittest.cc
@@ -121,9 +121,10 @@ TEST_P(BiDiLineIteratorTest, RTLPunctuationNoCustomBehavior) { // This string features Hebrew characters interleaved with ASCII punctuation. - iterator()->Open(base::UTF8ToUTF16("א!ב\"ג#ד$ה%ו&ז'ח(ט)י*ך+כ,ל-ם.מ/" - "ן:נ;ס<ע=ף>פ?ץ@צ[ק\\ר]ש^ת_א`ב{ג|ד}ה~ו"), - GetParam()); + iterator()->Open( + u"א!ב\"ג#ד$ה%ו&ז'ח(ט)י*ך+כ,ל-ם.מ/" + u"ן:נ;ס<ע=ף>פ?ץ@צ[ק\\ר]ש^ת_א`ב{ג|ד}ה~ו", + GetParam()); // Expect a single RTL run. ASSERT_EQ(1, iterator()->CountRuns());
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc index 132b257..e0fd5c5 100644 --- a/ui/gfx/render_text_unittest.cc +++ b/ui/gfx/render_text_unittest.cc
@@ -60,22 +60,18 @@ #include "base/mac/mac_util.h" #endif -using base::ASCIIToUTF16; -using base::UTF8ToUTF16; -using base::WideToUTF16; - namespace gfx { namespace { // Various weak, LTR, RTL, and Bidi string cases with three characters each. -const char kWeak[] = " . "; -const char kLtr[] = "abc"; -const char kRtl[] = "\u05d0\u05d1\u05d2"; -const char kLtrRtl[] = "a\u05d0\u05d1"; -const char kLtrRtlLtr[] = "a\u05d1b"; -const char kRtlLtr[] = "\u05d0\u05d1a"; -const char kRtlLtrRtl[] = "\u05d0a\u05d1"; +const char16_t kWeak[] = u" . "; +const char16_t kLtr[] = u"abc"; +const char16_t kRtl[] = u"אבג"; +const char16_t kLtrRtl[] = u"aאב"; +const char16_t kLtrRtlLtr[] = u"aבb"; +const char16_t kRtlLtr[] = u"אבa"; +const char16_t kRtlLtrRtl[] = u"אaב"; constexpr bool kUseWordWrap = true; constexpr bool kUseObscuredText = true; @@ -257,15 +253,6 @@ return std::u16string(length, RenderText::kPasswordReplacementChar); } -// Converts a vector of UTF8 literals into a vector of (UTF16) string16. -std::vector<std::u16string> ToString16Vec( - const std::vector<const char*>& utf8_literals) { - std::vector<std::u16string> vec; - for (auto* const literal : utf8_literals) - vec.push_back(UTF8ToUTF16(literal)); - return vec; -} - // Returns the combined character range from all text runs on |line|. Range LineCharRange(const internal::Line& line) { if (line.segments.empty()) @@ -676,14 +663,14 @@ // Check the default styles applied to new instances and adjusted text. RenderText* render_text = GetRenderText(); EXPECT_TRUE(render_text->text().empty()); - const char* const cases[] = {kWeak, kLtr, "Hello", kRtl, "", ""}; + const char16_t* const cases[] = {kWeak, kLtr, u"Hello", kRtl, u"", u""}; for (size_t i = 0; i < base::size(cases); ++i) { EXPECT_TRUE(test_api()->colors().EqualsValueForTesting(kPlaceholderColor)); EXPECT_TRUE(test_api()->baselines().EqualsValueForTesting(NORMAL_BASELINE)); EXPECT_TRUE(test_api()->font_size_overrides().EqualsValueForTesting(0)); for (size_t style = 0; style < static_cast<int>(TEXT_STYLE_COUNT); ++style) EXPECT_TRUE(test_api()->styles()[style].EqualsValueForTesting(false)); - render_text->SetText(UTF8ToUTF16(cases[i])); + render_text->SetText(cases[i]); } } @@ -695,7 +682,7 @@ render_text->SetBaselineStyle(SUPERSCRIPT); render_text->SetWeight(Font::Weight::BOLD); render_text->SetStyle(TEXT_STYLE_UNDERLINE, false); - const char* const cases[] = {kWeak, kLtr, "Hello", kRtl, "", ""}; + const char16_t* const cases[] = {kWeak, kLtr, u"Hello", kRtl, u"", u""}; for (size_t i = 0; i < base::size(cases); ++i) { EXPECT_TRUE(test_api()->colors().EqualsValueForTesting(color)); EXPECT_TRUE(test_api()->baselines().EqualsValueForTesting(SUPERSCRIPT)); @@ -704,7 +691,7 @@ EXPECT_TRUE( test_api()->styles()[TEXT_STYLE_UNDERLINE].EqualsValueForTesting( false)); - render_text->SetText(UTF8ToUTF16(cases[i])); + render_text->SetText(cases[i]); // Ensure custom default styles can be applied after text has been set. if (i == 1) @@ -821,7 +808,7 @@ TEST_F(RenderTextTest, ApplyStyleGrapheme) { RenderText* render_text = GetRenderText(); - render_text->SetText(u"\u0065\u0301"); + render_text->SetText(u"e\u0301"); render_text->ApplyStyle(TEXT_STYLE_ITALIC, true, gfx::Range(1, 2)); render_text->ApplyStyle(TEXT_STYLE_UNDERLINE, true, gfx::Range(0, 1)); Draw(); @@ -832,7 +819,7 @@ TEST_F(RenderTextTest, ApplyStyleMultipleGraphemes) { RenderText* render_text = GetRenderText(); - render_text->SetText(u"xx\u0065\u0301x"); + render_text->SetText(u"xxe\u0301x"); // Apply the style in the middle of a grapheme. gfx::Range range(1, 3); render_text->ApplyStyle(TEXT_STYLE_ITALIC, true, range); @@ -943,14 +930,14 @@ // Render the isolated form of the first glyph. RenderText* render_text = GetRenderText(); - render_text->SetText(u"\u0628"); + render_text->SetText(u"ب"); Draw(); ASSERT_EQ(1u, text_log().size()); ASSERT_EQ(1u, text_log()[0].glyphs().size()); uint16_t isolated_first_glyph = text_log()[0].glyphs()[0]; // Render a pair of glyphs (initial form and final form). - render_text->SetText(u"\u0628\u0645"); + render_text->SetText(u"بم"); Draw(); ASSERT_EQ(1u, text_log().size()); ASSERT_LE(2u, text_log()[0].glyphs().size()); @@ -1068,7 +1055,8 @@ constexpr float kGlyphWidth = 5.5f; constexpr Size kCanvasSize(300, 50); constexpr SkColor kTranslucentBlue = SkColorSetARGB(0x7F, 0x00, 0x00, 0xFF); - const char* kTestString{"A B C D"}; + const char* const kTestString{"A B C D"}; + const char16_t* const kTestString16{u"A B C D"}; SkBitmap bitmap; bitmap.allocPixels( @@ -1082,7 +1070,7 @@ render_text->set_selection_background_focused_color(kTranslucentBlue); render_text->set_focused(true); - render_text->SetText(UTF8ToUTF16(kTestString)); + render_text->SetText(kTestString16); render_text->SelectRange(Range(0, 7)); const Rect text_rect = Rect(render_text->GetStringSize()); render_text->SetDisplayRect(text_rect); @@ -1098,7 +1086,7 @@ TEST_F(RenderTextTest, SelectRangeColoredGrapheme) { RenderText* render_text = GetRenderText(); - render_text->SetText(u"x\u0065\u0301y"); + render_text->SetText(u"xe\u0301y"); render_text->SetColor(SK_ColorBLACK); render_text->set_selection_color(SK_ColorGREEN); render_text->set_focused(true); @@ -1161,7 +1149,7 @@ TEST_F(RenderTextTest, SetCompositionRangeColoredGrapheme) { RenderText* render_text = GetRenderText(); - render_text->SetText(u"x\u0065\u0301y"); + render_text->SetText(u"xe\u0301y"); render_text->SetCompositionRange(Range(0, 1)); Draw(); @@ -1263,15 +1251,16 @@ std::ceil(render_text->GetCursorSpan({0, 2}).length())); // Cursoring is independent of underlying characters when text is obscured. - const char* const texts[] = { - kWeak, kLtr, kLtrRtl, kLtrRtlLtr, kRtl, kRtlLtr, kRtlLtrRtl, - "hop on pop", // Check LTR word boundaries. - "\u05d0\u05d1 \u05d0\u05d2 \u05d1\u05d2", // Check RTL word boundaries. + const char16_t* const texts[] = { + kWeak, kLtr, kLtrRtl, kLtrRtlLtr, kRtl, kRtlLtr, kRtlLtrRtl, + u"hop on pop", // Check LTR word boundaries. + u"אב אג בג", // Check RTL word boundaries. }; for (size_t i = 0; i < base::size(texts); ++i) { - std::u16string text = UTF8ToUTF16(texts[i]); - TestVisualCursorMotionInObscuredField(render_text, text, SELECTION_NONE); - TestVisualCursorMotionInObscuredField(render_text, text, SELECTION_RETAIN); + TestVisualCursorMotionInObscuredField(render_text, texts[i], + SELECTION_NONE); + TestVisualCursorMotionInObscuredField(render_text, texts[i], + SELECTION_RETAIN); } } @@ -1348,8 +1337,7 @@ // Text with invalid surrogates (surrogates low 0xDC00 and high 0xD800). // Invalid surrogates are replaced by replacement character (e.g. 0xFFFD). - const char16_t invalid_surrogates[] = {0xDC00, 0xD800, 'h', 'o', 'p', 0}; - render_text->SetText(invalid_surrogates); + render_text->SetText(u"\xDC00\xD800hop"); EXPECT_EQ(GetObscuredString(5), render_text->GetDisplayText()); render_text->RenderText::SetObscuredRevealIndex(0); EXPECT_EQ(GetObscuredString(5, 0, 0xFFFD), render_text->GetDisplayText()); @@ -1359,9 +1347,7 @@ EXPECT_EQ(GetObscuredString(5, 2, 'h'), render_text->GetDisplayText()); // Text with valid surrogates before and after the reveal index. - const char16_t valid_surrogates[] = {0xD800, 0xDC00, 'h', 'o', - 'p', 0xD800, 0xDC00, 0}; - render_text->SetText(valid_surrogates); + render_text->SetText(u"\xD800\xDC00hop\xD800\xDC00"); EXPECT_EQ(GetObscuredString(5), render_text->GetDisplayText()); render_text->RenderText::SetObscuredRevealIndex(0); const char16_t valid_expect_0_and_1[] = {0xD800, @@ -1394,12 +1380,11 @@ RenderText* render_text = GetRenderText(); render_text->SetObscured(true); // Test U+1F601 😁 "Grinning face with smiling eyes", followed by 'y'. - // Windows requires wide strings for \Unnnnnnnn universal character names. - render_text->SetText(u"\U0001F601y"); + render_text->SetText(u"😁y"); render_text->Draw(canvas()); - // Emoji codepoints are replaced by bullets (e.g. "\u2022\u2022"). - EXPECT_EQ(u"\u2022\u2022", render_text->GetDisplayText()); + // Emoji codepoints are replaced by bullets. + EXPECT_EQ(u"••", render_text->GetDisplayText()); EXPECT_EQ(0U, test_api()->TextIndexToDisplayIndex(0U)); EXPECT_EQ(0U, test_api()->TextIndexToDisplayIndex(1U)); EXPECT_EQ(1U, test_api()->TextIndexToDisplayIndex(2U)); @@ -1412,12 +1397,11 @@ EXPECT_EQ(3U, test_api()->DisplayIndexToTextIndex(2U)); // Test two U+1F4F7 📷 "Camera" characters in a row. - // Windows requires wide strings for \Unnnnnnnn universal character names. - render_text->SetText(u"\U0001F4F7\U0001F4F7"); + render_text->SetText(u"📷📷"); render_text->Draw(canvas()); - // Emoji codepoints are replaced by bullets (e.g. "\u2022\u2022"). - EXPECT_EQ(u"\u2022\u2022", render_text->GetDisplayText()); + // Emoji codepoints are replaced by bullets. + EXPECT_EQ(u"••", render_text->GetDisplayText()); EXPECT_EQ(0U, test_api()->TextIndexToDisplayIndex(0U)); EXPECT_EQ(0U, test_api()->TextIndexToDisplayIndex(1U)); EXPECT_EQ(1U, test_api()->TextIndexToDisplayIndex(2U)); @@ -1430,7 +1414,7 @@ render_text->SetObscuredRevealIndex(0); render_text->Draw(canvas()); - EXPECT_EQ(u"\U0001F4F7\u2022", render_text->GetDisplayText()); + EXPECT_EQ(u"📷•", render_text->GetDisplayText()); EXPECT_EQ(0U, test_api()->TextIndexToDisplayIndex(0U)); EXPECT_EQ(0U, test_api()->TextIndexToDisplayIndex(1U)); EXPECT_EQ(2U, test_api()->TextIndexToDisplayIndex(2U)); @@ -1444,7 +1428,7 @@ TEST_F(RenderTextTest, ObscuredEmojiRevealed) { RenderText* render_text = GetRenderText(); - std::u16string text = u"123\U0001F4F7\U0001F4F7x\U0001F601-"; + std::u16string text = u"123📷📷x😁-"; for (size_t i = 0; i < text.length(); ++i) { render_text->SetText(text); render_text->SetObscured(true); @@ -1455,7 +1439,7 @@ struct TextIndexConversionCase { const char* test_name; - const wchar_t* text; + const char16_t* text; }; using TextIndexConversionParam = @@ -1481,7 +1465,7 @@ size_t reveal_index = std::get<2>(GetParam()); RenderText* render_text = GetRenderText(); - render_text->SetText(WideToUTF16(param.text)); + render_text->SetText(param.text); render_text->SetObscured(obscured); render_text->SetObscuredRevealIndex(reveal_index); render_text->Draw(canvas()); @@ -1509,15 +1493,15 @@ } const TextIndexConversionCase kTextIndexConversionCases[] = { - {"simple", L"abc"}, - {"simple_obscured1", L"abc"}, - {"simple_obscured2", L"abc"}, - {"emoji_asc", L"\U0001F6281234"}, - {"emoji_asc_obscured0", L"\U0001F6281234"}, - {"emoji_asc_obscured2", L"\U0001F6281234"}, - {"picto_title", L"x☛"}, - {"simple_mixed", L"aaڭڭcc"}, - {"simple_rtl", L"أسكي"}, + {"simple", u"abc"}, + {"simple_obscured1", u"abc"}, + {"simple_obscured2", u"abc"}, + {"emoji_asc", u"😨1234"}, + {"emoji_asc_obscured0", u"😨1234"}, + {"emoji_asc_obscured2", u"😨1234"}, + {"picto_title", u"x☛"}, + {"simple_mixed", u"aaڭڭcc"}, + {"simple_rtl", u"أسكي"}, }; // Validate that conversion text and between display text indexes are consistent @@ -1532,7 +1516,7 @@ struct RunListCase { const char* test_name; - const wchar_t* text; + const char16_t* text; const char* expected; const bool multiline = false; }; @@ -1551,40 +1535,39 @@ RunListCase param = GetParam(); RenderTextHarfBuzz* render_text = GetRenderText(); render_text->SetMultiline(param.multiline); - render_text->SetText(WideToUTF16(param.text)); + render_text->SetText(param.text); EXPECT_EQ(param.expected, GetRunListStructureString()); } const RunListCase kBasicsRunListCases[] = { - {"simpleLTR", L"abc", "[0->2]"}, - {"simpleRTL", L"ښڛڜ", "[2<-0]"}, - {"asc_arb", L"abcښڛڜdef", "[0->2][5<-3][6->8]"}, - {"asc_dev_asc", L"abcऔकखdefڜ", "[0->2][3->5][6->8][9]"}, - {"phone", L"1-(800)-xxx-xxxx", "[0][1][2][3->5][6][7][8->10][11][12->15]"}, - {"dev_ZWS", L"क\u200Bख", "[0][1][2]"}, - {"numeric", L"1 2 3 4", "[0][1][2][3][4][5][6]"}, - {"joiners1", L"1\u200C2\u200C3\u200C4", "[0->6]"}, - {"joiners2", L"\u060F\u200C\u060F", "[0->2]"}, - {"combining_accents1", L"a\u0300e\u0301", "[0->3]"}, - {"combining_accents2", L"\u0065\u0308\u0435\u0308", "[0->1][2->3]"}, - {"picto_title", L"☞☛test☚☜", "[0->1][2->5][6->7]"}, - {"picto_LTR", L"☺☺☺!", "[0->2][3]"}, - {"picto_RTL", L"☺☺☺ښ", "[3][2<-0]"}, - {"paren_picto", L"(☾☹☽)", "[0][1][2][3][4]"}, - {"emoji_asc", L"\U0001F6281234", - "[0->1][2->5]"}, // http://crbug.com/530021 - {"emoji_title", L"▶Feel goods", + {"simpleLTR", u"abc", "[0->2]"}, + {"simpleRTL", u"ښڛڜ", "[2<-0]"}, + {"asc_arb", u"abcښڛڜdef", "[0->2][5<-3][6->8]"}, + {"asc_dev_asc", u"abcऔकखdefڜ", "[0->2][3->5][6->8][9]"}, + {"phone", u"1-(800)-xxx-xxxx", "[0][1][2][3->5][6][7][8->10][11][12->15]"}, + {"dev_ZWS", u"क\u200Bख", "[0][1][2]"}, + {"numeric", u"1 2 3 4", "[0][1][2][3][4][5][6]"}, + {"joiners1", u"1\u200C2\u200C3\u200C4", "[0->6]"}, + {"joiners2", u"؏\u200C؏", "[0->2]"}, + {"combining_accents1", u"àé", "[0->3]"}, + {"combining_accents2", u"ëё", "[0->1][2->3]"}, + {"picto_title", u"☞☛test☚☜", "[0->1][2->5][6->7]"}, + {"picto_LTR", u"☺☺☺!", "[0->2][3]"}, + {"picto_RTL", u"☺☺☺ښ", "[3][2<-0]"}, + {"paren_picto", u"(☾☹☽)", "[0][1][2][3][4]"}, + {"emoji_asc", u"😨1234", "[0->1][2->5]"}, // http://crbug.com/530021 + {"emoji_title", u"▶Feel goods", "[0][1->4][5][6->10]"}, // http://crbug.com/278913 - {"jap_paren1", L"ぬ「シ」ほ", + {"jap_paren1", u"ぬ「シ」ほ", "[0][1][2][3][4]"}, // http://crbug.com/396776 - {"jap_paren2", L"國哲(c)1", + {"jap_paren2", u"國哲(c)1", "[0->1][2][3][4][5]"}, // http://crbug.com/125792 - {"newline1", L"\n\n", "[0->1]"}, - {"newline2", L"\r\n\r\n", "[0->3]"}, - {"newline3", L"\r\r\n", "[0->2]"}, - {"multiline_newline1", L"\n\n", "[0][1]", true}, - {"multiline_newline2", L"\r\n\r\n", "[0->1][2->3]", true}, - {"multiline_newline3", L"\r\r\n", "[0][1->2]", true}, + {"newline1", u"\n\n", "[0->1]"}, + {"newline2", u"\r\n\r\n", "[0->3]"}, + {"newline3", u"\r\r\n", "[0->2]"}, + {"multiline_newline1", u"\n\n", "[0][1]", true}, + {"multiline_newline2", u"\r\n\r\n", "[0->1][2->3]", true}, + {"multiline_newline3", u"\r\r\n", "[0][1->2]", true}, }; INSTANTIATE_TEST_SUITE_P(ItemizeTextToRunsBasics, @@ -1594,38 +1577,38 @@ // see 'Unicode Bidirectional Algorithm': http://unicode.org/reports/tr9/ const RunListCase kBidiRunListCases[] = { - {"simple_ltr", L"ascii", "[0->4]"}, - {"simple_rtl", L"أسكي", "[3<-0]"}, - {"simple_mixed", L"aaڭڭcc", "[0->1][3<-2][4->5]"}, - {"simple_mixed_LRE", L"\u202Aaaڭڭcc\u202C", "[0][1->2][4<-3][5->6][7]"}, - {"simple_mixed_RLE", L"\u202Baaڭڭcc\u202C", "[7][5->6][4<-3][0][1->2]"}, - {"sequence_RLE", L"\u202Baa\u202C\u202Bbb\u202C", + {"simple_ltr", u"ascii", "[0->4]"}, + {"simple_rtl", u"أسكي", "[3<-0]"}, + {"simple_mixed", u"aaڭڭcc", "[0->1][3<-2][4->5]"}, + {"simple_mixed_LRE", u"\u202Aaaڭڭcc\u202C", "[0][1->2][4<-3][5->6][7]"}, + {"simple_mixed_RLE", u"\u202Baaڭڭcc\u202C", "[7][5->6][4<-3][0][1->2]"}, + {"sequence_RLE", u"\u202Baa\u202C\u202Bbb\u202C", "[7][0][1->2][3->4][5->6]"}, - {"simple_mixed_LRI", L"\u2066aaڭڭcc\u2069", "[0][1->2][4<-3][5->6][7]"}, - {"simple_mixed_RLI", L"\u2067aaڭڭcc\u2069", "[0][5->6][4<-3][1->2][7]"}, - {"sequence_RLI", L"\u2067aa\u2069\u2067bb\u2069", + {"simple_mixed_LRI", u"\u2066aaڭڭcc\u2069", "[0][1->2][4<-3][5->6][7]"}, + {"simple_mixed_RLI", u"\u2067aaڭڭcc\u2069", "[0][5->6][4<-3][1->2][7]"}, + {"sequence_RLI", u"\u2067aa\u2069\u2067bb\u2069", "[0][1->2][3->4][5->6][7]"}, - {"override_ltr_RLO", L"\u202Eaaa\u202C", "[4][3<-1][0]"}, - {"override_rtl_LRO", L"\u202Dڭڭڭ\u202C", "[0][1->3][4]"}, - {"neutral_strong_ltr", L"a!!a", "[0][1->2][3]"}, - {"neutral_strong_rtl", L"ڭ!!ڭ", "[3][2<-1][0]"}, - {"neutral_strong_both", L"a a ڭ ڭ", "[0][1][2][3][6][5][4]"}, - {"neutral_strong_both_RLE", L"\u202Ba a ڭ ڭ\u202C", + {"override_ltr_RLO", u"\u202Eaaa\u202C", "[4][3<-1][0]"}, + {"override_rtl_LRO", u"\u202Dڭڭڭ\u202C", "[0][1->3][4]"}, + {"neutral_strong_ltr", u"a!!a", "[0][1->2][3]"}, + {"neutral_strong_rtl", u"ڭ!!ڭ", "[3][2<-1][0]"}, + {"neutral_strong_both", u"a a ڭ ڭ", "[0][1][2][3][6][5][4]"}, + {"neutral_strong_both_RLE", u"\u202Ba a ڭ ڭ\u202C", "[8][7][6][5][4][0][1][2][3]"}, - {"weak_numbers", L"one ڭ222ڭ", "[0->2][3][8][5->7][4]"}, - {"not_weak_letters", L"one ڭabcڭ", "[0->2][3][4][5->7][8]"}, - {"weak_arabic_numbers", L"one ڭ١٢٣ڭ", "[0->2][3][8][5->7][4]"}, - {"neutral_LRM_pre", L"\u200E\u2026\u2026", "[0->2]"}, - {"neutral_LRM_post", L"\u2026\u2026\u200E", "[0->2]"}, - {"neutral_RLM_pre", L"\u200F\u2026\u2026", "[2<-0]"}, - {"neutral_RLM_post", L"\u2026\u2026\u200F", "[2<-0]"}, - {"brackets_ltr", L"aa(ڭڭ)\u2026\u2026", "[0->1][2][4<-3][5][6->7]"}, - {"brackets_rtl", L"ڭڭ(aa)\u2026\u2026", "[7<-6][5][3->4][2][1<-0]"}, - {"mixed_with_punct", L"aa \"ڭڭ!\", aa", + {"weak_numbers", u"one ڭ222ڭ", "[0->2][3][8][5->7][4]"}, + {"not_weak_letters", u"one ڭabcڭ", "[0->2][3][4][5->7][8]"}, + {"weak_arabic_numbers", u"one ڭ١٢٣ڭ", "[0->2][3][8][5->7][4]"}, + {"neutral_LRM_pre", u"\u200E……", "[0->2]"}, + {"neutral_LRM_post", u"……\u200E", "[0->2]"}, + {"neutral_RLM_pre", u"\u200F……", "[2<-0]"}, + {"neutral_RLM_post", u"……\u200F", "[2<-0]"}, + {"brackets_ltr", u"aa(ڭڭ)……", "[0->1][2][4<-3][5][6->7]"}, + {"brackets_rtl", u"ڭڭ(aa)……", "[7<-6][5][3->4][2][1<-0]"}, + {"mixed_with_punct", u"aa \"ڭڭ!\", aa", "[0->1][2][3][5<-4][6->8][9][10->11]"}, - {"mixed_with_punct_RLI", L"aa \"\u2067ڭڭ!\u2069\", aa", + {"mixed_with_punct_RLI", u"aa \"\u2067ڭڭ!\u2069\", aa", "[0->1][2][3][4][7][6<-5][8][9->10][11][12->13]"}, - {"mixed_with_punct_RLM", L"aa \"ڭڭ!\u200F\", aa", + {"mixed_with_punct_RLM", u"aa \"ڭڭ!\u200F\", aa", "[0->1][2][3][7][6][5<-4][8->9][10][11->12]"}, }; @@ -1635,18 +1618,17 @@ RenderTextTestWithRunListCase::ParamInfoToString); const RunListCase kBracketsRunListCases[] = { - {"matched_parens", L"(a)", "[0][1][2]"}, - {"double_matched_parens", L"((a))", "[0->1][2][3->4]"}, - {"double_matched_parens2", L"((aaa))", "[0->1][2->4][5->6]"}, - {"square_brackets", L"[...]x", "[0][1->3][4][5]"}, - {"curly_brackets", L"{}x{}", "[0->1][2][3->4]"}, - {"style_brackets", L"\u300c...\u300dx", "[0][1->3][4][5]"}, - {"tibetan_brackets", L"\u0f3a\u0f3b\u0f20\u0f20\u0f3c\u0f3d", - "[0->1][2->3][4->5]"}, - {"angle_brackets", L"\u3008\u3007\u3007\u3009", "[0][1->2][3]"}, - {"double_angle_brackets", L"\u300A\u3007\u3007\u300B", "[0][1->2][3]"}, - {"corner_angle_brackets", L"\u300C\u3007\u3007\u300D", "[0][1->2][3]"}, - {"fullwidth_parens", L"\uff08\uff01\uff09", "[0][1][2]"}, + {"matched_parens", u"(a)", "[0][1][2]"}, + {"double_matched_parens", u"((a))", "[0->1][2][3->4]"}, + {"double_matched_parens2", u"((aaa))", "[0->1][2->4][5->6]"}, + {"square_brackets", u"[...]x", "[0][1->3][4][5]"}, + {"curly_brackets", u"{}x{}", "[0->1][2][3->4]"}, + {"style_brackets", u"「...」x", "[0][1->3][4][5]"}, + {"tibetan_brackets", u"༺༻༠༠༼༽", "[0->1][2->3][4->5]"}, + {"angle_brackets", u"〈〇〇〉", "[0][1->2][3]"}, + {"double_angle_brackets", u"《〇〇》", "[0][1->2][3]"}, + {"corner_angle_brackets", u"「〇〇」", "[0][1->2][3]"}, + {"fullwidth_parens", u"(!)", "[0][1][2]"}, }; INSTANTIATE_TEST_SUITE_P(ItemizeTextToRunsBrackets, @@ -1658,15 +1640,15 @@ // account while performing the text itemization. // See table 7 from http://www.unicode.org/reports/tr24/tr24-29.html const RunListCase kScriptExtensionRunListCases[] = { - {"implicit_com_inherited", L"a\u0301", "[0->1]"}, - {"explicit_lat", L"\u0061d", "[0->1]"}, - {"explicit_inherited_lat", L"x\u0363d", "[0->2]"}, - {"explicit_inherited_dev", L"क\u1CD1क", "[0->2]"}, - {"multi_explicit_hira", L"は\u30FCz", "[0->1][2]"}, - {"multi_explicit_kana", L"ハ\u30FCz", "[0->1][2]"}, - {"multi_explicit_lat", L"a\u30FCz", "[0][1][2]"}, - {"multi_explicit_impl_dev", L"क\u1CD0z", "[0->1][2]"}, - {"multi_explicit_expl_dev", L"क\u096Fz", "[0->1][2]"}, + {"implicit_com_inherited", u"a\u0301", "[0->1]"}, + {"explicit_lat", u"\u0061d", "[0->1]"}, + {"explicit_inherited_lat", u"x\u0363d", "[0->2]"}, + {"explicit_inherited_dev", u"क\u1CD1क", "[0->2]"}, + {"multi_explicit_hira", u"は\u30FCz", "[0->1][2]"}, + {"multi_explicit_kana", u"ハ\u30FCz", "[0->1][2]"}, + {"multi_explicit_lat", u"a\u30FCz", "[0][1][2]"}, + {"multi_explicit_impl_dev", u"क\u1CD0z", "[0->1][2]"}, + {"multi_explicit_expl_dev", u"क\u096Fz", "[0->1][2]"}, }; INSTANTIATE_TEST_SUITE_P(ItemizeTextToRunsScriptExtension, @@ -1679,111 +1661,111 @@ // See ScriptExtensions.txt and Scripts.txt from // http://www.unicode.org/reports/tr24/tr24-29.html const RunListCase kScriptsRunListCases[] = { - {"lat", L"abc", "[0->2]"}, - {"lat_diac", L"e\u0308f", "[0->2]"}, + {"lat", u"abc", "[0->2]"}, + {"lat_diac", u"e\u0308f", "[0->2]"}, // Indic Fraction codepoints have large set of script extensions. - {"indic_fraction", L"\uA830\uA832\uA834\uA835", "[0->3]"}, + {"indic_fraction", u"\uA830\uA832\uA834\uA835", "[0->3]"}, // Devanagari Danda codepoints have large set of script extensions. - {"dev_danda", L"\u0964\u0965", "[0->1]"}, + {"dev_danda", u"\u0964\u0965", "[0->1]"}, // Combining Diacritical Marks (inherited) should only merge with preceding. - {"diac_lat", L"\u0308fg", "[0][1->2]"}, - {"diac_dev", L"क\u0308f", "[0->1][2]"}, + {"diac_lat", u"\u0308fg", "[0][1->2]"}, + {"diac_dev", u"क\u0308f", "[0->1][2]"}, // ZWJW has the inherited script. - {"lat_ZWNJ", L"ab\u200Ccd", "[0->4]"}, - {"dev_ZWNJ", L"क\u200Cक", "[0->2]"}, - {"lat_dev_ZWNJ", L"a\u200Cक", "[0->1][2]"}, + {"lat_ZWNJ", u"ab\u200Ccd", "[0->4]"}, + {"dev_ZWNJ", u"क\u200Cक", "[0->2]"}, + {"lat_dev_ZWNJ", u"a\u200Cक", "[0->1][2]"}, // Invalid codepoints. - {"invalid_cp", L"\uFFFE", "[0]"}, - {"invalid_cps", L"\uFFFE\uFFFF", "[0->1]"}, - {"unknown", L"a\u243Fb", "[0][1][2]"}, + {"invalid_cp", u"\uFFFE", "[0]"}, + {"invalid_cps", u"\uFFFE\uFFFF", "[0->1]"}, + {"unknown", u"a\u243Fb", "[0][1][2]"}, // Codepoints from different code block should be in same run when part of // the same script. - {"blocks_lat", L"aɒɠƉĚÑ", "[0->5]"}, - {"blocks_lat_paren", L"([_!_])", "[0->1][2->4][5->6]"}, - {"blocks_lat_sub", L"ₐₑaeꬱ", "[0->4]"}, - {"blocks_lat_smallcap", L"ꟺM", "[0->1]"}, - {"blocks_lat_small_letter", L"ᶓᶍᶓᴔᴟ", "[0->4]"}, - {"blocks_lat_acc", L"eéěĕȩɇḕẻếⱻꞫ", "[0->10]"}, - {"blocks_com", L"⟦ℳ¥¾⟾⁸⟧Ⓔ", "[0][1][2->3][4][5][6][7]"}, + {"blocks_lat", u"aɒɠƉĚÑ", "[0->5]"}, + {"blocks_lat_paren", u"([_!_])", "[0->1][2->4][5->6]"}, + {"blocks_lat_sub", u"ₐₑaeꬱ", "[0->4]"}, + {"blocks_lat_smallcap", u"ꟺM", "[0->1]"}, + {"blocks_lat_small_letter", u"ᶓᶍᶓᴔᴟ", "[0->4]"}, + {"blocks_lat_acc", u"eéěĕȩɇḕẻếⱻꞫ", "[0->10]"}, + {"blocks_com", u"⟦ℳ¥¾⟾⁸⟧Ⓔ", "[0][1][2->3][4][5][6][7]"}, // Latin script. - {"latin_numbers", L"a1b2c3", "[0][1][2][3][4][5]"}, - {"latin_puncts1", L"a,b,c.", "[0][1][2][3][4][5]"}, - {"latin_puncts2", L"aa,bb,cc!!", "[0->1][2][3->4][5][6->7][8->9]"}, - {"latin_diac_multi", L"a\u0300e\u0352i", "[0->4]"}, + {"latin_numbers", u"a1b2c3", "[0][1][2][3][4][5]"}, + {"latin_puncts1", u"a,b,c.", "[0][1][2][3][4][5]"}, + {"latin_puncts2", u"aa,bb,cc!!", "[0->1][2][3->4][5][6->7][8->9]"}, + {"latin_diac_multi", u"a\u0300e\u0352i", "[0->4]"}, // Common script. - {"common_tm", L"•bug™", "[0][1->3][4]"}, - {"common_copyright", L"chromium©", "[0->7][8]"}, - {"common_math1", L"ℳ: ¬ƒ(x)=½×¾", "[0][1][2][3][4][5][6][7][8][9->11]"}, - {"common_math2", L"𝟏×𝟑", "[0->1][2][3->4]"}, - {"common_numbers", L"🄀𝟭𝟐⒓¹²", "[0->1][2->5][6][7->8]"}, - {"common_puncts", L",.\u0083!", "[0->1][2][3]"}, + {"common_tm", u"•bug™", "[0][1->3][4]"}, + {"common_copyright", u"chromium©", "[0->7][8]"}, + {"common_math1", u"ℳ: ¬ƒ(x)=½×¾", "[0][1][2][3][4][5][6][7][8][9->11]"}, + {"common_math2", u"𝟏×𝟑", "[0->1][2][3->4]"}, + {"common_numbers", u"🄀𝟭𝟐⒓¹²", "[0->1][2->5][6][7->8]"}, + {"common_puncts", u",.\u0083!", "[0->1][2][3]"}, // Arabic script. - {"arabic", L"\u0633\u069b\u0763\u077f\u08A2\uFB53", "[5<-0]"}, - {"arabic_lat", L"\u0633\u069b\u0763\u077f\u08A2\uFB53abc", "[6->8][5<-0]"}, - {"arabic_word_ligatures", L"\uFDFD\uFDF3", "[1<-0]"}, - {"arabic_diac", L"\u069D\u0300", "[1<-0]"}, - {"arabic_diac_lat", L"\u069D\u0300abc", "[2->4][1<-0]"}, - {"arabic_diac_lat2", L"abc\u069D\u0300abc", "[0->2][4<-3][5->7]"}, - {"arabic_lyd", L"\U00010935\U00010930\u06B0\u06B1", "[5<-4][3<-0]"}, - {"arabic_numbers", L"12\u06D034", "[3->4][2][0->1]"}, - {"arabic_letters", L"ab\u06D0cd", "[0->1][2][3->4]"}, - {"arabic_mixed", L"a1\u06D02d", "[0][1][3][2][4]"}, - {"arabic_coptic1", L"\u06D0\U000102E2\u2CB2", "[1->3][0]"}, - {"arabic_coptic2", L"\u2CB2\U000102E2\u06D0", "[0->2][3]"}, + {"arabic", u"\u0633\u069b\u0763\u077f\u08A2\uFB53", "[5<-0]"}, + {"arabic_lat", u"\u0633\u069b\u0763\u077f\u08A2\uFB53abc", "[6->8][5<-0]"}, + {"arabic_word_ligatures", u"\uFDFD\uFDF3", "[1<-0]"}, + {"arabic_diac", u"\u069D\u0300", "[1<-0]"}, + {"arabic_diac_lat", u"\u069D\u0300abc", "[2->4][1<-0]"}, + {"arabic_diac_lat2", u"abc\u069D\u0300abc", "[0->2][4<-3][5->7]"}, + {"arabic_lyd", u"\U00010935\U00010930\u06B0\u06B1", "[5<-4][3<-0]"}, + {"arabic_numbers", u"12\u06D034", "[3->4][2][0->1]"}, + {"arabic_letters", u"ab\u06D0cd", "[0->1][2][3->4]"}, + {"arabic_mixed", u"a1\u06D02d", "[0][1][3][2][4]"}, + {"arabic_coptic1", u"\u06D0\U000102E2\u2CB2", "[1->3][0]"}, + {"arabic_coptic2", u"\u2CB2\U000102E2\u06D0", "[0->2][3]"}, // Devanagari script. - {"devanagari1", L"ञटठडढणतथ", "[0->7]"}, - {"devanagari2", L"ढ꣸ꣴ", "[0->2]"}, - {"devanagari_vowels", L"\u0915\u093F\u0915\u094C", "[0->3]"}, - {"devanagari_consonants", L"\u0915\u094D\u0937", "[0->2]"}, + {"devanagari1", u"ञटठडढणतथ", "[0->7]"}, + {"devanagari2", u"ढ꣸ꣴ", "[0->2]"}, + {"devanagari_vowels", u"\u0915\u093F\u0915\u094C", "[0->3]"}, + {"devanagari_consonants", u"\u0915\u094D\u0937", "[0->2]"}, // Ethiopic script. - {"ethiopic", L"መጩጪᎅⶹⶼꬣꬦ", "[0->7]"}, - {"ethiopic_numbers", L"1ቨቤ2", "[0][1->2][3]"}, - {"ethiopic_mixed1", L"abቨቤ12", "[0->1][2->3][4->5]"}, - {"ethiopic_mixed2", L"a1ቨቤb2", "[0][1][2->3][4][5]"}, + {"ethiopic", u"መጩጪᎅⶹⶼꬣꬦ", "[0->7]"}, + {"ethiopic_numbers", u"1ቨቤ2", "[0][1->2][3]"}, + {"ethiopic_mixed1", u"abቨቤ12", "[0->1][2->3][4->5]"}, + {"ethiopic_mixed2", u"a1ቨቤb2", "[0][1][2->3][4][5]"}, // Georgian script. - {"georgian1", L"ႼႽႾႿჀჁჂჳჴჵ", "[0->9]"}, - {"georgian2", L"ლⴊⴅ", "[0->2]"}, - {"georgian_numbers", L"1ლⴊⴅ2", "[0][1->3][4]"}, - {"georgian_mixed", L"a1ლⴊⴅb2", "[0][1][2->4][5][6]"}, + {"georgian1", u"ႼႽႾႿჀჁჂჳჴჵ", "[0->9]"}, + {"georgian2", u"ლⴊⴅ", "[0->2]"}, + {"georgian_numbers", u"1ლⴊⴅ2", "[0][1->3][4]"}, + {"georgian_mixed", u"a1ლⴊⴅb2", "[0][1][2->4][5][6]"}, // Telugu script. - {"telugu_lat", L"aaఉయ!", "[0->1][2->3][4]"}, - {"telugu_numbers", L"123౦౧౨456౩౪౫", "[0->2][3->5][6->8][9->11]"}, - {"telugu_puncts", L"కురుచ, చిఱుత, చేరువ, చెఱువు!", + {"telugu_lat", u"aaఉయ!", "[0->1][2->3][4]"}, + {"telugu_numbers", u"123౦౧౨456౩౪౫", "[0->2][3->5][6->8][9->11]"}, + {"telugu_puncts", u"కురుచ, చిఱుత, చేరువ, చెఱువు!", "[0->4][5][6][7->11][12][13][14->18][19][20][21->26][27]"}, // Control Pictures. - {"control_pictures", L"␑␒␓␔␕␖␗␘␙␚␛", "[0->10]"}, - {"control_pictures_rewrite", L"␑\t␛", "[0->2]"}, + {"control_pictures", u"␑␒␓␔␕␖␗␘␙␚␛", "[0->10]"}, + {"control_pictures_rewrite", u"␑\t␛", "[0->2]"}, // Unicode art. - {"unicode_emoticon1", L"(▀̿ĺ̯▀̿ ̿)", "[0][1->2][3->4][5->6][7->8][9]"}, - {"unicode_emoticon2", L"▀̿̿Ĺ̯̿▀̿ ", "[0->2][3->5][6->7][8]"}, - {"unicode_emoticon3", L"( ͡° ͜ʖ ͡°)", "[0][1->2][3][4->5][6][7->8][9][10]"}, - {"unicode_emoticon4", L"✩·͙*̩̩͙˚̩̥̩̥( ͡ᵔ ͜ʖ ͡ᵔ )*̩̩͙✩·͙˚̩̥̩̥.", + {"unicode_emoticon1", u"(▀̿ĺ̯▀̿ ̿)", "[0][1->2][3->4][5->6][7->8][9]"}, + {"unicode_emoticon2", u"▀̿̿Ĺ̯̿▀̿ ", "[0->2][3->5][6->7][8]"}, + {"unicode_emoticon3", u"( ͡° ͜ʖ ͡°)", "[0][1->2][3][4->5][6][7->8][9][10]"}, + {"unicode_emoticon4", u"✩·͙*̩̩͙˚̩̥̩̥( ͡ᵔ ͜ʖ ͡ᵔ )*̩̩͙✩·͙˚̩̥̩̥.", "[0][1->2][3->6][7->11][12][13->14][15][16->17][18][19->20][21][22][23][" "24->27][28][29->30][31->35][36]"}, - {"unicode_emoticon5", L"ヽ(͡◕ ͜ʖ ͡◕)ノ", + {"unicode_emoticon5", u"ヽ(͡◕ ͜ʖ ͡◕)ノ", "[0][1->2][3][4->5][6][7->8][9][10][11]"}, - {"unicode_art1", L"꧁༒✧ Great ✧༒꧂", "[0][1][2][3][4->8][9][10][11][12]"}, - {"unicode_art2", L"t͎e͎s͎t͎", "[0->7]"}, + {"unicode_art1", u"꧁༒✧ Great ✧༒꧂", "[0][1][2][3][4->8][9][10][11][12]"}, + {"unicode_art2", u"t͎e͎s͎t͎", "[0->7]"}, // Combining diacritical sequences. - {"unicode_diac1", L"\u2123\u0336", "[0->1]"}, - {"unicode_diac2", L"\u273c\u0325", "[0->1]"}, - {"unicode_diac3", L"\u2580\u033f", "[0->1]"}, - {"unicode_diac4", L"\u2022\u0325\u0329", "[0->2]"}, - {"unicode_diac5", L"\u2022\u0325", "[0->1]"}, - {"unicode_diac6", L"\u00b7\u0359\u0325", "[0->2]"}, - {"unicode_diac7", L"\u2027\u0329\u0325", "[0->2]"}, - {"unicode_diac8", L"\u0332\u0305\u03c1", "[0->1][2]"}, + {"unicode_diac1", u"\u2123\u0336", "[0->1]"}, + {"unicode_diac2", u"\u273c\u0325", "[0->1]"}, + {"unicode_diac3", u"\u2580\u033f", "[0->1]"}, + {"unicode_diac4", u"\u2022\u0325\u0329", "[0->2]"}, + {"unicode_diac5", u"\u2022\u0325", "[0->1]"}, + {"unicode_diac6", u"\u00b7\u0359\u0325", "[0->2]"}, + {"unicode_diac7", u"\u2027\u0329\u0325", "[0->2]"}, + {"unicode_diac8", u"\u0332\u0305\u03c1", "[0->1][2]"}, }; INSTANTIATE_TEST_SUITE_P(ItemizeTextToRunsScripts, @@ -1797,96 +1779,96 @@ const RunListCase kEmojiRunListCases[] = { // Samples from // https://www.unicode.org/Public/emoji/12.0/emoji-data.txt - {"number_sign", L"\u0023", "[0]"}, - {"keyboard", L"\u2328", "[0]"}, - {"aries", L"\u2648", "[0]"}, - {"candle", L"\U0001F56F", "[0->1]"}, - {"anchor", L"\u2693", "[0]"}, - {"grinning_face", L"\U0001F600", "[0->1]"}, - {"face_with_monocle", L"\U0001F9D0", "[0->1]"}, - {"light_skin_tone", L"\U0001F3FB", "[0->1]"}, - {"index_pointing_up", L"\u261D", "[0]"}, - {"horse_racing", L"\U0001F3C7", "[0->1]"}, - {"kiss", L"\U0001F48F", "[0->1]"}, - {"couple_with_heart", L"\U0001F491", "[0->1]"}, - {"people_wrestling", L"\U0001F93C", "[0->1]"}, - {"eject_button", L"\u23CF", "[0]"}, + {"number_sign", u"\u0023", "[0]"}, + {"keyboard", u"\u2328", "[0]"}, + {"aries", u"\u2648", "[0]"}, + {"candle", u"\U0001F56F", "[0->1]"}, + {"anchor", u"\u2693", "[0]"}, + {"grinning_face", u"\U0001F600", "[0->1]"}, + {"face_with_monocle", u"\U0001F9D0", "[0->1]"}, + {"light_skin_tone", u"\U0001F3FB", "[0->1]"}, + {"index_pointing_up", u"\u261D", "[0]"}, + {"horse_racing", u"\U0001F3C7", "[0->1]"}, + {"kiss", u"\U0001F48F", "[0->1]"}, + {"couple_with_heart", u"\U0001F491", "[0->1]"}, + {"people_wrestling", u"\U0001F93C", "[0->1]"}, + {"eject_button", u"\u23CF", "[0]"}, // Samples from // https://unicode.org/Public/emoji/12.0/emoji-sequences.txt - {"watch", L"\u231A", "[0]"}, - {"cross_mark", L"\u274C", "[0]"}, - {"copyright", L"\u00A9\uFE0F", "[0->1]"}, - {"stop_button", L"\u23F9\uFE0F", "[0->1]"}, - {"passenger_ship", L"\U0001F6F3\uFE0F", "[0->2]"}, - {"keycap_star", L"\u002A\uFE0F\u20E3", "[0->2]"}, - {"keycap_6", L"\u0036\uFE0F\u20E3", "[0->2]"}, - {"flag_andorra", L"\U0001F1E6\U0001F1E9", "[0->3]"}, - {"flag_egypt", L"\U0001F1EA\U0001F1EC", "[0->3]"}, + {"watch", u"\u231A", "[0]"}, + {"cross_mark", u"\u274C", "[0]"}, + {"copyright", u"\u00A9\uFE0F", "[0->1]"}, + {"stop_button", u"\u23F9\uFE0F", "[0->1]"}, + {"passenger_ship", u"\U0001F6F3\uFE0F", "[0->2]"}, + {"keycap_star", u"\u002A\uFE0F\u20E3", "[0->2]"}, + {"keycap_6", u"\u0036\uFE0F\u20E3", "[0->2]"}, + {"flag_andorra", u"\U0001F1E6\U0001F1E9", "[0->3]"}, + {"flag_egypt", u"\U0001F1EA\U0001F1EC", "[0->3]"}, {"flag_england", - L"\U0001F3F4\U000E0067\U000E0062\U000E0065\U000E006E\U000E0067\U000E007F", + u"\U0001F3F4\U000E0067\U000E0062\U000E0065\U000E006E\U000E0067\U000E007F", "[0->13]"}, - {"index_up_light", L"\u261D\U0001F3FB", "[0->2]"}, - {"person_bouncing_ball_light", L"\u26F9\U0001F3FC", "[0->2]"}, - {"victory_hand_med_light", L"\u270C\U0001F3FC", "[0->2]"}, - {"horse_racing_med_dark", L"\U0001F3C7\U0001F3FE", "[0->3]"}, - {"woman_man_hands_light", L"\U0001F46B\U0001F3FB", "[0->3]"}, - {"person_haircut_med_light", L"\U0001F487\U0001F3FC", "[0->3]"}, - {"pinching_hand_light", L"\U0001F90F\U0001F3FB", "[0->3]"}, - {"love_you_light", L"\U0001F91F\U0001F3FB", "[0->3]"}, - {"leg_dark", L"\U0001F9B5\U0001F3FF", "[0->3]"}, + {"index_up_light", u"\u261D\U0001F3FB", "[0->2]"}, + {"person_bouncing_ball_light", u"\u26F9\U0001F3FC", "[0->2]"}, + {"victory_hand_med_light", u"\u270C\U0001F3FC", "[0->2]"}, + {"horse_racing_med_dark", u"\U0001F3C7\U0001F3FE", "[0->3]"}, + {"woman_man_hands_light", u"\U0001F46B\U0001F3FB", "[0->3]"}, + {"person_haircut_med_light", u"\U0001F487\U0001F3FC", "[0->3]"}, + {"pinching_hand_light", u"\U0001F90F\U0001F3FB", "[0->3]"}, + {"love_you_light", u"\U0001F91F\U0001F3FB", "[0->3]"}, + {"leg_dark", u"\U0001F9B5\U0001F3FF", "[0->3]"}, // Samples from // https://unicode.org/Public/emoji/12.0/emoji-variation-sequences.txt - {"number_sign_text", L"\u0023\uFE0E", "[0->1]"}, - {"number_sign_emoji", L"\u0023\uFE0F", "[0->1]"}, - {"digit_eight_text", L"\u0038\uFE0E", "[0->1]"}, - {"digit_eight_emoji", L"\u0038\uFE0F", "[0->1]"}, - {"up_down_arrow_text", L"\u2195\uFE0E", "[0->1]"}, - {"up_down_arrow_emoji", L"\u2195\uFE0F", "[0->1]"}, - {"stopwatch_text", L"\u23F1\uFE0E", "[0->1]"}, - {"stopwatch_emoji", L"\u23F1\uFE0F", "[0->1]"}, - {"thermometer_text", L"\U0001F321\uFE0E", "[0->2]"}, - {"thermometer_emoji", L"\U0001F321\uFE0F", "[0->2]"}, - {"thumbs_up_text", L"\U0001F44D\uFE0E", "[0->2]"}, - {"thumbs_up_emoji", L"\U0001F44D\uFE0F", "[0->2]"}, - {"hole_text", L"\U0001F573\uFE0E", "[0->2]"}, - {"hole_emoji", L"\U0001F573\uFE0F", "[0->2]"}, + {"number_sign_text", u"\u0023\uFE0E", "[0->1]"}, + {"number_sign_emoji", u"\u0023\uFE0F", "[0->1]"}, + {"digit_eight_text", u"\u0038\uFE0E", "[0->1]"}, + {"digit_eight_emoji", u"\u0038\uFE0F", "[0->1]"}, + {"up_down_arrow_text", u"\u2195\uFE0E", "[0->1]"}, + {"up_down_arrow_emoji", u"\u2195\uFE0F", "[0->1]"}, + {"stopwatch_text", u"\u23F1\uFE0E", "[0->1]"}, + {"stopwatch_emoji", u"\u23F1\uFE0F", "[0->1]"}, + {"thermometer_text", u"\U0001F321\uFE0E", "[0->2]"}, + {"thermometer_emoji", u"\U0001F321\uFE0F", "[0->2]"}, + {"thumbs_up_text", u"\U0001F44D\uFE0E", "[0->2]"}, + {"thumbs_up_emoji", u"\U0001F44D\uFE0F", "[0->2]"}, + {"hole_text", u"\U0001F573\uFE0E", "[0->2]"}, + {"hole_emoji", u"\U0001F573\uFE0F", "[0->2]"}, // Samples from // https://unicode.org/Public/emoji/12.0/emoji-zwj-sequences.txt - {"couple_man_man", L"\U0001F468\u200D\u2764\uFE0F\u200D\U0001F468", + {"couple_man_man", u"\U0001F468\u200D\u2764\uFE0F\u200D\U0001F468", "[0->7]"}, {"kiss_man_man", - L"\U0001F468\u200D\u2764\uFE0F\u200D\U0001F48B\u200D\U0001F468", + u"\U0001F468\u200D\u2764\uFE0F\u200D\U0001F48B\u200D\U0001F468", "[0->10]"}, {"family_man_woman_girl_boy", - L"\U0001F468\u200D\U0001F469\u200D\U0001F467\u200D\U0001F466", "[0->10]"}, + u"\U0001F468\u200D\U0001F469\u200D\U0001F467\u200D\U0001F466", "[0->10]"}, {"men_hands_dark_medium", - L"\U0001F468\U0001F3FF\u200D\U0001F91D\u200D\U0001F468\U0001F3FD", + u"\U0001F468\U0001F3FF\u200D\U0001F91D\u200D\U0001F468\U0001F3FD", "[0->11]"}, {"people_hands_dark", - L"\U0001F9D1\U0001F3FF\u200D\U0001F91D\u200D\U0001F9D1\U0001F3FF", + u"\U0001F9D1\U0001F3FF\u200D\U0001F91D\u200D\U0001F9D1\U0001F3FF", "[0->11]"}, - {"man_pilot", L"\U0001F468\u200D\u2708\uFE0F", "[0->4]"}, - {"man_scientist", L"\U0001F468\u200D\U0001F52C", "[0->4]"}, - {"man_mechanic_light", L"\U0001F468\U0001F3FB\u200D\U0001F527", "[0->6]"}, - {"man_judge_medium", L"\U0001F468\U0001F3FD\u200D\u2696\uFE0F", "[0->6]"}, - {"woman_cane_dark", L"\U0001F469\U0001F3FF\u200D\U0001F9AF", "[0->6]"}, - {"woman_ball_light", L"\u26F9\U0001F3FB\u200D\u2640\uFE0F", "[0->5]"}, - {"woman_running", L"\U0001F3C3\u200D\u2640\uFE0F", "[0->4]"}, - {"woman_running_dark", L"\U0001F3C3\U0001F3FF\u200D\u2640\uFE0F", "[0->6]"}, - {"woman_turban", L"\U0001F473\u200D\u2640\uFE0F", "[0->4]"}, - {"woman_detective", L"\U0001F575\uFE0F\u200D\u2640\uFE0F", "[0->5]"}, - {"man_facepalming", L"\U0001F926\u200D\u2642\uFE0F", "[0->4]"}, - {"man_red_hair", L"\U0001F468\u200D\U0001F9B0", "[0->4]"}, - {"man_medium_curly", L"\U0001F468\U0001F3FD\u200D\U0001F9B1", "[0->6]"}, - {"woman_dark_white_hair", L"\U0001F469\U0001F3FF\u200D\U0001F9B3", + {"man_pilot", u"\U0001F468\u200D\u2708\uFE0F", "[0->4]"}, + {"man_scientist", u"\U0001F468\u200D\U0001F52C", "[0->4]"}, + {"man_mechanic_light", u"\U0001F468\U0001F3FB\u200D\U0001F527", "[0->6]"}, + {"man_judge_medium", u"\U0001F468\U0001F3FD\u200D\u2696\uFE0F", "[0->6]"}, + {"woman_cane_dark", u"\U0001F469\U0001F3FF\u200D\U0001F9AF", "[0->6]"}, + {"woman_ball_light", u"\u26F9\U0001F3FB\u200D\u2640\uFE0F", "[0->5]"}, + {"woman_running", u"\U0001F3C3\u200D\u2640\uFE0F", "[0->4]"}, + {"woman_running_dark", u"\U0001F3C3\U0001F3FF\u200D\u2640\uFE0F", "[0->6]"}, + {"woman_turban", u"\U0001F473\u200D\u2640\uFE0F", "[0->4]"}, + {"woman_detective", u"\U0001F575\uFE0F\u200D\u2640\uFE0F", "[0->5]"}, + {"man_facepalming", u"\U0001F926\u200D\u2642\uFE0F", "[0->4]"}, + {"man_red_hair", u"\U0001F468\u200D\U0001F9B0", "[0->4]"}, + {"man_medium_curly", u"\U0001F468\U0001F3FD\u200D\U0001F9B1", "[0->6]"}, + {"woman_dark_white_hair", u"\U0001F469\U0001F3FF\u200D\U0001F9B3", "[0->6]"}, - {"rainbow_flag", L"\U0001F3F3\uFE0F\u200D\U0001F308", "[0->5]"}, - {"pirate_flag", L"\U0001F3F4\u200D\u2620\uFE0F", "[0->4]"}, - {"service_dog", L"\U0001F415\u200D\U0001F9BA", "[0->4]"}, - {"eye_bubble", L"\U0001F441\uFE0F\u200D\U0001F5E8\uFE0F", "[0->6]"}, + {"rainbow_flag", u"\U0001F3F3\uFE0F\u200D\U0001F308", "[0->5]"}, + {"pirate_flag", u"\U0001F3F4\u200D\u2620\uFE0F", "[0->4]"}, + {"service_dog", u"\U0001F415\u200D\U0001F9BA", "[0->4]"}, + {"eye_bubble", u"\U0001F441\uFE0F\u200D\U0001F5E8\uFE0F", "[0->6]"}, }; INSTANTIATE_TEST_SUITE_P(ItemizeTextToRunsEmoji, @@ -1903,12 +1885,12 @@ struct ElideTextCase { const char* test_name; - const wchar_t* text; - const wchar_t* display_text; + const char16_t* text; + const char16_t* display_text; // The available width, specified as a number of fixed-width glyphs. If no // value is specified, the width of the resulting |display_text| is used. This // helps test available widths larger than the resulting test; e.g. "a b" - // should yield "a\u2026" even if 3 glyph widths are available, when + // should yield "a…" even if 3 glyph widths are available, when // whitespace elision is enabled. const base::Optional<size_t> available_width_as_glyph_count = base::nullopt; const base::Optional<bool> whitespace_elision = base::nullopt; @@ -1933,8 +1915,8 @@ const ElideTextTestOptions options = std::get<0>(GetParam()); const ElideTextCase param = std::get<1>(GetParam()); - const std::u16string text = WideToUTF16(param.text); - const std::u16string display_text = WideToUTF16(param.display_text); + const std::u16string text = param.text; + const std::u16string display_text = param.display_text; // Retrieve the display_text width without eliding. RenderTextHarfBuzz* render_text = GetRenderText(); @@ -1970,68 +1952,64 @@ } const ElideTextCase kElideHeadTextCases[] = { - {"empty", L"", L""}, - {"letter_m_tail0", L"M", L""}, - {"letter_m_tail1", L"M", L"M"}, - {"no_eliding", L"012ab", L"012ab"}, - {"ltr_3", L"abc", L"abc"}, - {"ltr_2", L"abc", L"\u2026c"}, - {"ltr_1", L"abc", L"\u2026"}, - {"ltr_0", L"abc", L""}, - {"rtl_3", L"\u05d0\u05d1\u05d2", L"\u05d0\u05d1\u05d2"}, - {"rtl_2", L"\u05d0\u05d1\u05d2", L"\u2026\u05d2"}, - {"rtl_1", L"\u05d0\u05d1\u05d2", L"\u2026"}, - {"rtl_0", L"\u05d0\u05d1\u05d2", L""}, - {"ltr_rtl_5", L"abc\u05d0\u05d1\u05d2", L"\u2026c\u05d0\u05d1\u05d2"}, - {"ltr_rtl_4", L"abc\u05d0\u05d1\u05d2", L"\u2026\u05d0\u05d1\u05d2"}, - {"ltr_rtl_3", L"abc\u05d0\u05d1\u05d2", L"\u2026\u05d1\u05d2"}, - {"rtl_ltr_5", L"\u05d0\u05d1\u05d2abc", L"\u2026\u05d2abc"}, - {"rtl_ltr_4", L"\u05d0\u05d1\u05d2abc", L"\u2026abc"}, - {"rtl_ltr_3", L"\u05d0\u05d1\u05d2abc", L"\u2026bc"}, - {"bidi_1", L"a\u05d1b\u05d1c012", L"\u2026b\u05d1c012"}, - {"bidi_2", L"a\u05d1b\u05d1c012", L"\u2026\u05d1c012"}, - {"bidi_3", L"a\u05d1b\u05d1c012", L"\u2026c012"}, + {"empty", u"", u""}, + {"letter_m_tail0", u"M", u""}, + {"letter_m_tail1", u"M", u"M"}, + {"no_eliding", u"012ab", u"012ab"}, + {"ltr_3", u"abc", u"abc"}, + {"ltr_2", u"abc", u"…c"}, + {"ltr_1", u"abc", u"…"}, + {"ltr_0", u"abc", u""}, + {"rtl_3", u"אבג", u"אבג"}, + {"rtl_2", u"אבג", u"…ג"}, + {"rtl_1", u"אבג", u"…"}, + {"rtl_0", u"אבג", u""}, + {"ltr_rtl_5", u"abcאבג", u"…cאבג"}, + {"ltr_rtl_4", u"abcאבג", u"…אבג"}, + {"ltr_rtl_3", u"abcאבג", u"…בג"}, + {"rtl_ltr_5", u"אבגabc", u"…גabc"}, + {"rtl_ltr_4", u"אבגabc", u"…abc"}, + {"rtl_ltr_3", u"אבגabc", u"…bc"}, + {"bidi_1", u"aבbבc012", u"…bבc012"}, + {"bidi_2", u"aבbבc012", u"…בc012"}, + {"bidi_3", u"aבbבc012", u"…c012"}, // Test surrogate pairs. No surrogate pair should be partially elided. - {"surrogate1", L"abc\U0001D11E\U0001D122x", L"\u2026\U0001D11E\U0001D122x"}, - {"surrogate2", L"abc\U0001D11E\U0001D122x", L"\u2026\U0001D122x"}, - {"surrogate3", L"abc\U0001D11E\U0001D122x", L"\u2026x"}, + {"surrogate1", u"abc\U0001D11E\U0001D122x", u"…\U0001D11E\U0001D122x"}, + {"surrogate2", u"abc\U0001D11E\U0001D122x", u"…\U0001D122x"}, + {"surrogate3", u"abc\U0001D11E\U0001D122x", u"…x"}, // Test combining character sequences. U+0915 U+093F forms a compound // glyph, as does U+0915 U+0942. No combining sequence should be partially // elided. - {"combining1", L"0123\u0915\u093f\u0915\u0942456", - L"\u2026\u0915\u0942456"}, - {"combining2", L"0123\u0915\u093f\u0915\u0942456", L"\u2026456"}, + {"combining1", u"0123\u0915\u093f\u0915\u0942456", u"…\u0915\u0942456"}, + {"combining2", u"0123\u0915\u093f\u0915\u0942456", u"…456"}, // 𝄞 (U+1D11E, MUSICAL SYMBOL G CLEF) should be fully elided. - {"emoji1", L"012\U0001D11Ex", L"\u2026\U0001D11Ex"}, - {"emoji2", L"012\U0001D11Ex", L"\u2026x"}, + {"emoji1", u"012\U0001D11Ex", u"…\U0001D11Ex"}, + {"emoji2", u"012\U0001D11Ex", u"…x"}, // Whitespace elision tests. - {"empty_no_elision", L"", L"", 0, kForceNoWhitespaceElision}, - {"empty_elision", L"", L"", 0, kForceWhitespaceElision}, - {"xyz_no_elision", L" x xyz", L"\u2026 xyz", 5, - kForceNoWhitespaceElision}, - {"xyz_elision", L" x xyz", L"\u2026xyz", 5, kForceWhitespaceElision}, - {"ltr_rtl_elision3", L"x \u05d1 y \u05d2", L"\u2026\u05d2", 3, + {"empty_no_elision", u"", u"", 0, kForceNoWhitespaceElision}, + {"empty_elision", u"", u"", 0, kForceWhitespaceElision}, + {"xyz_no_elision", u" x xyz", u"… xyz", 5, kForceNoWhitespaceElision}, + {"xyz_elision", u" x xyz", u"…xyz", 5, kForceWhitespaceElision}, + {"ltr_rtl_elision3", u"x ב y ג", u"…ג", 3, kForceWhitespaceElision}, + {"ltr_rtl_elision6", u"x ב y ג", u"…ג", 6, kForceWhitespaceElision}, + {"ltr_rtl_elision7", u"x ב y ג", u"…y ג", 7, kForceWhitespaceElision}, - {"ltr_rtl_elision6", L"x \u05d1 y \u05d2", L"\u2026\u05d2", 6, + {"ltr_rtl_elision10", u"x ב y ג", u"…ב y ג", 10, kForceWhitespaceElision}, - {"ltr_rtl_elision7", L"x \u05d1 y \u05d2", L"\u2026y \u05d2", 7, + {"ltr_rtl_elision11", u"x ב y ג", u"…ב y ג", 11, kForceWhitespaceElision}, - {"ltr_rtl_elision10", L"x \u05d1 y \u05d2", - L"\u2026\u05d1 y \u05d2", 10, kForceWhitespaceElision}, - {"ltr_rtl_elision11", L"x \u05d1 y \u05d2", - L"\u2026\u05d1 y \u05d2", 11, kForceWhitespaceElision}, // Emoji U+1F601 and emoji U+1F321 U+FE0E are graphemes that result in // one glyph each. Eliding a glyph must remove the whole grapheme. It is // invalid to break a grapheme in pieces. - {"graphemes_elision3", L" \U0001F601 \U0001F321\uFE0E ", L"\u2026", 3, + {"graphemes_elision3", u" \U0001F601 \U0001F321\uFE0E ", u"…", 3, kForceWhitespaceElision}, - {"graphemes_elision4", L" \U0001F601 \U0001F321\uFE0E ", - L"\u2026\U0001F321\uFE0E ", 4, kForceWhitespaceElision}, - {"graphemes_elision6", L" \U0001F601 \U0001F321\uFE0E ", - L"\u2026\U0001F321\uFE0E ", 6, kForceWhitespaceElision}, - {"graphemes_elision7", L" \U0001F601 \U0001F321\uFE0E ", - L"\u2026\U0001F601 \U0001F321\uFE0E ", 7, kForceWhitespaceElision}, + {"graphemes_elision4", u" \U0001F601 \U0001F321\uFE0E ", + u"…\U0001F321\uFE0E ", 4, kForceWhitespaceElision}, + {"graphemes_elision6", u" \U0001F601 \U0001F321\uFE0E ", + u"…\U0001F321\uFE0E ", 6, kForceWhitespaceElision}, + {"graphemes_elision7", u" \U0001F601 \U0001F321\uFE0E ", + u"…\U0001F601 \U0001F321\uFE0E ", 7, kForceWhitespaceElision}, }; INSTANTIATE_TEST_SUITE_P( @@ -2042,75 +2020,71 @@ RenderTextTestWithElideTextCase::ParamInfoToString); const ElideTextCase kElideTailTextCases[] = { - {"empty", L"", L""}, - {"letter_m_tail0", L"M", L""}, - {"letter_m_tail1", L"M", L"M"}, - {"letter_weak_3", L" . ", L" . "}, - {"letter_weak_2", L" . ", L"\u2026"}, - {"no_eliding", L"012ab", L"012ab"}, - {"ltr_3", L"abc", L"abc"}, - {"ltr_2", L"abc", L"a\u2026"}, - {"ltr_1", L"abc", L"\u2026"}, - {"ltr_0", L"abc", L""}, - {"rtl_3", L"\u05d0\u05d1\u05d2", L"\u05d0\u05d1\u05d2"}, - {"rtl_2", L"\u05d0\u05d1\u05d2", L"\u05d0\u2026"}, - {"rtl_1", L"\u05d0\u05d1\u05d2", L"\u2026"}, - {"rtl_0", L"\u05d0\u05d1\u05d2", L""}, - {"ltr_rtl_5", L"abc\u05d0\u05d1\u05d2", L"abc\u05d0\u2026\u200F"}, - {"ltr_rtl_4", L"abc\u05d0\u05d1\u05d2", L"abc\u2026"}, - {"ltr_rtl_3", L"abc\u05d0\u05d1\u05d2", L"ab\u2026"}, - {"rtl_ltr_5", L"\u05d0\u05d1\u05d2abc", L"\u05d0\u05d1\u05d2a\u2026\u200E"}, - {"rtl_ltr_4", L"\u05d0\u05d1\u05d2abc", L"\u05d0\u05d1\u05d2\u2026"}, - {"rtl_ltr_3", L"\u05d0\u05d1\u05d2abc", L"\u05d0\u05d1\u2026"}, - {"bidi_1", L"012a\u05d1b\u05d1c", L"012a\u2026"}, - {"bidi_2", L"012a\u05d1b\u05d1c", L"012a\u05d1\u2026\u200F"}, - {"bidi_3", L"012a\u05d1b\u05d1c", L"012a\u05d1b\u2026"}, + {"empty", u"", u""}, + {"letter_m_tail0", u"M", u""}, + {"letter_m_tail1", u"M", u"M"}, + {"letter_weak_3", u" . ", u" . "}, + {"letter_weak_2", u" . ", u"…"}, + {"no_eliding", u"012ab", u"012ab"}, + {"ltr_3", u"abc", u"abc"}, + {"ltr_2", u"abc", u"a…"}, + {"ltr_1", u"abc", u"…"}, + {"ltr_0", u"abc", u""}, + {"rtl_3", u"אבג", u"אבג"}, + {"rtl_2", u"אבג", u"א…"}, + {"rtl_1", u"אבג", u"…"}, + {"rtl_0", u"אבג", u""}, + {"ltr_rtl_5", u"abcאבג", u"abcא…\u200F"}, + {"ltr_rtl_4", u"abcאבג", u"abc…"}, + {"ltr_rtl_3", u"abcאבג", u"ab…"}, + {"rtl_ltr_5", u"אבגabc", u"אבגa…\u200E"}, + {"rtl_ltr_4", u"אבגabc", u"אבג…"}, + {"rtl_ltr_3", u"אבגabc", u"אב…"}, + {"bidi_1", u"012aבbבc", u"012a…"}, + {"bidi_2", u"012aבbבc", u"012aב…\u200F"}, + {"bidi_3", u"012aבbבc", u"012aבb…"}, // No RLM marker added as digits (012) have weak directionality. - {"no_rlm", L"01\u05d0\u05d1\u05d2", L"01\u05d0\u2026"}, + {"no_rlm", u"01אבג", u"01א…"}, // RLM marker added as "ab" have strong LTR directionality. - {"with_rlm", L"ab\u05d0\u05d1\u05d2cd", L"ab\u05d0\u05d1\u2026\u200f"}, + {"with_rlm", u"abאבגcd", u"abאב…\u200f"}, // Test surrogate pairs. The first pair 𝄞 'MUSICAL SYMBOL G CLEF' U+1D11E // should be kept, and the second pair 𝄢 'MUSICAL SYMBOL F CLEF' U+1D122 // should be removed. No surrogate pair should be partially elided. - {"surrogate", L"0123\U0001D11E\U0001D122x", L"0123\U0001D11E\u2026"}, + {"surrogate", u"0123\U0001D11E\U0001D122x", u"0123\U0001D11E…"}, // Test combining character sequences. U+0915 U+093F forms a compound // glyph, as does U+0915 U+0942. The first should be kept; the second // removed. No combining sequence should be partially elided. - {"combining", L"0123\u0915\u093f\u0915\u0942456", - L"0123\u0915\u093f\u2026"}, + {"combining", u"0123\u0915\u093f\u0915\u0942456", u"0123\u0915\u093f…"}, // U+05E9 U+05BC U+05C1 U+05B8 forms a four-character compound glyph. // It should be either fully elided, or not elided at all. If completely // elided, an LTR Mark (U+200E) should be added. - {"grapheme1", L"0\u05e9\u05bc\u05c1\u05b8", L"0\u05e9\u05bc\u05c1\u05b8"}, - {"grapheme2", L"0\u05e9\u05bc\u05c1\u05b8abc", L"0\u2026\u200E"}, - {"grapheme3", L"01\u05e9\u05bc\u05c1\u05b8abc", L"01\u2026\u200E"}, - {"grapheme4", L"012\u05e9\u05bc\u05c1\u05b8abc", L"012\u2026\u200E"}, + {"grapheme1", u"0\u05e9\u05bc\u05c1\u05b8", u"0\u05e9\u05bc\u05c1\u05b8"}, + {"grapheme2", u"0\u05e9\u05bc\u05c1\u05b8abc", u"0…\u200E"}, + {"grapheme3", u"01\u05e9\u05bc\u05c1\u05b8abc", u"01…\u200E"}, + {"grapheme4", u"012\u05e9\u05bc\u05c1\u05b8abc", u"012…\u200E"}, // 𝄞 (U+1D11E, MUSICAL SYMBOL G CLEF) should be fully elided. - {"emoji", L"012\U0001D11Ex", L"012\u2026"}, + {"emoji", u"012\U0001D11Ex", u"012…"}, // Whitespace elision tests. - {"empty_no_elision", L"", L"", 0, kForceNoWhitespaceElision}, - {"empty_elision", L"", L"", 0, kForceWhitespaceElision}, - {"letter_weak_2_no_elision", L" . ", L" \u2026", 2, - kForceNoWhitespaceElision}, - {"xyz_no_elision", L" x xyz", L" x \u2026", 5, - kForceNoWhitespaceElision}, - {"xyz_elision", L" x xyz", L" x\u2026", 5, kForceWhitespaceElision}, - {"ltr_rtl_elision4", L"x \u05d1 y \u05d2", L"x\u2026", 4, + {"empty_no_elision", u"", u"", 0, kForceNoWhitespaceElision}, + {"empty_elision", u"", u"", 0, kForceWhitespaceElision}, + {"letter_weak_2_no_elision", u" . ", u" …", 2, kForceNoWhitespaceElision}, + {"xyz_no_elision", u" x xyz", u" x …", 5, kForceNoWhitespaceElision}, + {"xyz_elision", u" x xyz", u" x…", 5, kForceWhitespaceElision}, + {"ltr_rtl_elision4", u"x ב y ג", u"x…", 4, kForceWhitespaceElision}, + {"ltr_rtl_elision5", u"x ב y ג", u"x ב…\u200F", 5, kForceWhitespaceElision}, - {"ltr_rtl_elision5", L"x \u05d1 y \u05d2", L"x \u05d1\u2026\u200F", 5, - kForceWhitespaceElision}, - {"ltr_rtl_elision9", L"x \u05d1 y \u05d2", L"x \u05d1 y\u2026", 9, + {"ltr_rtl_elision9", u"x ב y ג", u"x ב y…", 9, kForceWhitespaceElision}, // Emoji U+1F601 and emoji U+1F321 U+FE0E are graphemes that result in // one glyph each. Eliding a glyph must remove the whole grapheme. It is // invalid to break a grapheme in pieces. - {"graphemes_elision3", L" \U0001F601 \U0001F321\uFE0E ", L"\u2026", 3, + {"graphemes_elision3", u" \U0001F601 \U0001F321\uFE0E ", u"…", 3, kForceWhitespaceElision}, - {"graphemes_elision6", L" \U0001F601 \U0001F321\uFE0E ", - L" \U0001F601\u2026", 6, kForceWhitespaceElision}, - {"graphemes_elision7", L" \U0001F601 \U0001F321\uFE0E ", - L" \U0001F601 \U0001F321\uFE0E\u2026", 7, kForceWhitespaceElision}, + {"graphemes_elision6", u" \U0001F601 \U0001F321\uFE0E ", + u" \U0001F601…", 6, kForceWhitespaceElision}, + {"graphemes_elision7", u" \U0001F601 \U0001F321\uFE0E ", + u" \U0001F601 \U0001F321\uFE0E…", 7, kForceWhitespaceElision}, }; INSTANTIATE_TEST_SUITE_P( @@ -2121,70 +2095,67 @@ RenderTextTestWithElideTextCase::ParamInfoToString); const ElideTextCase kElideTruncateTextCases[] = { - {"empty", L"", L""}, - {"letter_m_tail0", L"M", L""}, - {"letter_m_tail1", L"M", L"M"}, - {"no_eliding", L"012ab", L"012ab"}, - {"ltr_3", L"abc", L"abc"}, - {"ltr_2", L"abc", L"ab"}, - {"ltr_1", L"abc", L"a"}, - {"ltr_0", L"abc", L""}, - {"rtl_3", L"\u05d0\u05d1\u05d2", L"\u05d0\u05d1\u05d2"}, - {"rtl_2", L"\u05d0\u05d1\u05d2", L"\u05d0\u05d1"}, - {"rtl_1", L"\u05d0\u05d1\u05d2", L"\u05d0"}, - {"rtl_0", L"\u05d0\u05d1\u05d2", L""}, - {"ltr_rtl_5", L"abc\u05d0\u05d1\u05d2", L"abc\u05d0\u05d1"}, - {"ltr_rtl_4", L"abc\u05d0\u05d1\u05d2", L"abc\u05d0"}, - {"ltr_rtl_3", L"abc\u05d0\u05d1\u05d2", L"abc"}, - {"ltr_rtl_2", L"abc\u05d0\u05d1\u05d2", L"ab"}, - {"rtl_ltr_5", L"\u05d0\u05d1\u05d2abc", L"\u05d0\u05d1\u05d2ab"}, - {"rtl_ltr_4", L"\u05d0\u05d1\u05d2abc", L"\u05d0\u05d1\u05d2a"}, - {"rtl_ltr_3", L"\u05d0\u05d1\u05d2abc", L"\u05d0\u05d1\u05d2"}, - {"rtl_ltr_2", L"\u05d0\u05d1\u05d2abc", L"\u05d0\u05d1"}, - {"bidi_1", L"012a\u05d1b\u05d1c", L"012a\u05d1b\u05d1"}, - {"bidi_2", L"012a\u05d1b\u05d1c", L"012a\u05d1b"}, - {"bidi_3", L"012a\u05d1b\u05d1c", L"012a\u05d1"}, - {"bidi_4", L"012a\u05d1b\u05d1c", L"012a\u05d1"}, + {"empty", u"", u""}, + {"letter_m_tail0", u"M", u""}, + {"letter_m_tail1", u"M", u"M"}, + {"no_eliding", u"012ab", u"012ab"}, + {"ltr_3", u"abc", u"abc"}, + {"ltr_2", u"abc", u"ab"}, + {"ltr_1", u"abc", u"a"}, + {"ltr_0", u"abc", u""}, + {"rtl_3", u"אבג", u"אבג"}, + {"rtl_2", u"אבג", u"אב"}, + {"rtl_1", u"אבג", u"א"}, + {"rtl_0", u"אבג", u""}, + {"ltr_rtl_5", u"abcאבג", u"abcאב"}, + {"ltr_rtl_4", u"abcאבג", u"abcא"}, + {"ltr_rtl_3", u"abcאבג", u"abc"}, + {"ltr_rtl_2", u"abcאבג", u"ab"}, + {"rtl_ltr_5", u"אבגabc", u"אבגab"}, + {"rtl_ltr_4", u"אבגabc", u"אבגa"}, + {"rtl_ltr_3", u"אבגabc", u"אבג"}, + {"rtl_ltr_2", u"אבגabc", u"אב"}, + {"bidi_1", u"012aבbבc", u"012aבbב"}, + {"bidi_2", u"012aבbבc", u"012aבb"}, + {"bidi_3", u"012aבbבc", u"012aב"}, + {"bidi_4", u"012aבbבc", u"012aב"}, // Test surrogate pairs. The first pair 𝄞 'MUSICAL SYMBOL G CLEF' U+1D11E // should be kept, and the second pair 𝄢 'MUSICAL SYMBOL F CLEF' U+1D122 // should be removed. No surrogate pair should be partially elided. - {"surrogate1", L"0123\U0001D11E\U0001D122x", L"0123\U0001D11E\U0001D122"}, - {"surrogate2", L"0123\U0001D11E\U0001D122x", L"0123\U0001D11E"}, - {"surrogate3", L"0123\U0001D11E\U0001D122x", L"0123"}, + {"surrogate1", u"0123\U0001D11E\U0001D122x", u"0123\U0001D11E\U0001D122"}, + {"surrogate2", u"0123\U0001D11E\U0001D122x", u"0123\U0001D11E"}, + {"surrogate3", u"0123\U0001D11E\U0001D122x", u"0123"}, // Test combining character sequences. U+0915 U+093F forms a compound // glyph, as does U+0915 U+0942. The first should be kept; the second // removed. No combining sequence should be partially elided. - {"combining", L"0123\u0915\u093f\u0915\u0942456", L"0123\u0915\u093f"}, + {"combining", u"0123\u0915\u093f\u0915\u0942456", u"0123\u0915\u093f"}, // 𝄞 (U+1D11E, MUSICAL SYMBOL G CLEF) should be fully elided. - {"emoji1", L"012\U0001D11Ex", L"012\U0001D11E"}, - {"emoji2", L"012\U0001D11Ex", L"012"}, + {"emoji1", u"012\U0001D11Ex", u"012\U0001D11E"}, + {"emoji2", u"012\U0001D11Ex", u"012"}, // Whitespace elision tests. - {"empty_no_elision", L"", L"", 0, kForceNoWhitespaceElision}, - {"empty_elision", L"", L"", 0, kForceWhitespaceElision}, - {"xyz_no_elision", L" x xyz", L" x ", 5, kForceNoWhitespaceElision}, - {"xyz_elision", L" x xyz", L" x", 5, kForceWhitespaceElision}, - {"ltr_rtl_elision3", L"x \u05d1 y \u05d2", L"x", 3, - kForceWhitespaceElision}, - {"ltr_rtl_elision4", L"x \u05d1 y \u05d2", L"x \u05d1", 4, - kForceWhitespaceElision}, - {"ltr_rtl_elision5", L"x \u05d1 y \u05d2", L"x \u05d1", 5, - kForceWhitespaceElision}, - {"ltr_rtl_elision9", L"x \u05d1 y \u05d2", L"x \u05d1 y", 9, + {"empty_no_elision", u"", u"", 0, kForceNoWhitespaceElision}, + {"empty_elision", u"", u"", 0, kForceWhitespaceElision}, + {"xyz_no_elision", u" x xyz", u" x ", 5, kForceNoWhitespaceElision}, + {"xyz_elision", u" x xyz", u" x", 5, kForceWhitespaceElision}, + {"ltr_rtl_elision3", u"x ב y ג", u"x", 3, kForceWhitespaceElision}, + {"ltr_rtl_elision4", u"x ב y ג", u"x ב", 4, kForceWhitespaceElision}, + {"ltr_rtl_elision5", u"x ב y ג", u"x ב", 5, kForceWhitespaceElision}, + {"ltr_rtl_elision9", u"x ב y ג", u"x ב y", 9, kForceWhitespaceElision}, // Emoji U+1F601 and emoji U+1F321 U+FE0E are graphemes that result in // one glyph each. Eliding a glyph must remove the whole grapheme. It is // invalid to break a grapheme in pieces. - {"graphemes_elision2", L" \U0001F601 \U0001F321\uFE0E ", L"", 2, + {"graphemes_elision2", u" \U0001F601 \U0001F321\uFE0E ", u"", 2, kForceWhitespaceElision}, - {"graphemes_elision3", L" \U0001F601 \U0001F321\uFE0E ", L" \U0001F601", + {"graphemes_elision3", u" \U0001F601 \U0001F321\uFE0E ", u" \U0001F601", 3, kForceWhitespaceElision}, - {"graphemes_elision5", L" \U0001F601 \U0001F321\uFE0E ", L" \U0001F601", + {"graphemes_elision5", u" \U0001F601 \U0001F321\uFE0E ", u" \U0001F601", 5, kForceWhitespaceElision}, - {"graphemes_elision6", L" \U0001F601 \U0001F321\uFE0E ", - L" \U0001F601 \U0001F321\uFE0E", 6, kForceWhitespaceElision}, - {"graphemes_elision7", L" \U0001F601 \U0001F321\uFE0E ", - L" \U0001F601 \U0001F321\uFE0E", 7, kForceWhitespaceElision}, + {"graphemes_elision6", u" \U0001F601 \U0001F321\uFE0E ", + u" \U0001F601 \U0001F321\uFE0E", 6, kForceWhitespaceElision}, + {"graphemes_elision7", u" \U0001F601 \U0001F321\uFE0E ", + u" \U0001F601 \U0001F321\uFE0E", 7, kForceWhitespaceElision}, }; INSTANTIATE_TEST_SUITE_P( @@ -2196,44 +2167,44 @@ const ElideTextCase kElideEmailTextCases[] = { // Invalid email text. - {"empty", L"", L""}, - {"invalid_char1", L"x", L""}, - {"invalid_char3", L"xyz", L"x\u2026"}, - {"invalid_amp", L"@", L""}, - {"invalid_no_prefix0", L"@y", L""}, - {"invalid_no_prefix1", L"@y", L"\u2026"}, - {"invalid_no_prefix2", L"@xyz", L"@x\u2026"}, - {"invalid_no_suffix0", L"x@", L""}, - {"invalid_no_suffix1", L"x@", L"\u2026"}, - {"invalid_no_suffix2", L"xyz@", L"x\u2026@"}, + {"empty", u"", u""}, + {"invalid_char1", u"x", u""}, + {"invalid_char3", u"xyz", u"x…"}, + {"invalid_amp", u"@", u""}, + {"invalid_no_prefix0", u"@y", u""}, + {"invalid_no_prefix1", u"@y", u"…"}, + {"invalid_no_prefix2", u"@xyz", u"@x…"}, + {"invalid_no_suffix0", u"x@", u""}, + {"invalid_no_suffix1", u"x@", u"…"}, + {"invalid_no_suffix2", u"xyz@", u"x…@"}, - {"at1", L"@", L"@"}, - {"at2", L"@@", L"\u2026", 1}, - {"at3", L"@@@", L"\u2026", 2}, - {"at4", L"@@@@", L"@\u2026@", 3}, + {"at1", u"@", u"@"}, + {"at2", u"@@", u"…", 1}, + {"at3", u"@@@", u"…", 2}, + {"at4", u"@@@@", u"@…@", 3}, - {"small1", L"a@b", L"\u2026", 1}, - {"small2", L"a@b", L"\u2026", 2}, - {"small3", L"a@b", L"a@b", 3}, - {"small_username3", L"xyz@b", L"\u2026", 3}, - {"small_username4", L"xyz@b", L"x\u2026@b", 4}, - {"small_username5", L"xyz@b", L"xyz@b", 5}, - {"small_domain3", L"a@xyz", L"\u2026", 3}, - {"small_domain4", L"a@xyz", L"a@x\u2026", 4}, - {"small_domain5", L"a@xyz", L"a@xyz", 5}, + {"small1", u"a@b", u"…", 1}, + {"small2", u"a@b", u"…", 2}, + {"small3", u"a@b", u"a@b", 3}, + {"small_username3", u"xyz@b", u"…", 3}, + {"small_username4", u"xyz@b", u"x…@b", 4}, + {"small_username5", u"xyz@b", u"xyz@b", 5}, + {"small_domain3", u"a@xyz", u"…", 3}, + {"small_domain4", u"a@xyz", u"a@x…", 4}, + {"small_domain5", u"a@xyz", u"a@xyz", 5}, // Valid email. - {"email_small", L"a@b.com", L"\u2026"}, - {"email_nobody3", L"nobody@gmail.com", L"\u2026", 3}, - {"email_nobody4", L"nobody@gmail.com", L"\u2026", 4}, - {"email_nobody5", L"nobody@gmail.com", L"n\u2026@g\u2026", 5}, - {"email_nobody6", L"nobody@gmail.com", L"no\u2026@g\u2026", 6}, - {"email_nobody7", L"nobody@gmail.com", L"no\u2026@g\u2026m", 7}, - {"email_nobody8", L"nobody@gmail.com", L"nob\u2026@g\u2026m", 8}, - {"email_nobody9", L"nobody@gmail.com", L"nob\u2026@gm\u2026m", 9}, - {"email_nobody10", L"nobody@gmail.com", L"nobo\u2026@gm\u2026m", 10}, - {"email_root", L"root@localhost", L"r\u2026@l\u2026", 5}, - {"email_myself", L"myself@127.0.0.1", L"my\u2026@1\u2026", 6}, + {"email_small", u"a@b.com", u"…"}, + {"email_nobody3", u"nobody@gmail.com", u"…", 3}, + {"email_nobody4", u"nobody@gmail.com", u"…", 4}, + {"email_nobody5", u"nobody@gmail.com", u"n…@g…", 5}, + {"email_nobody6", u"nobody@gmail.com", u"no…@g…", 6}, + {"email_nobody7", u"nobody@gmail.com", u"no…@g…m", 7}, + {"email_nobody8", u"nobody@gmail.com", u"nob…@g…m", 8}, + {"email_nobody9", u"nobody@gmail.com", u"nob…@gm…m", 9}, + {"email_nobody10", u"nobody@gmail.com", u"nobo…@gm…m", 10}, + {"email_root", u"root@localhost", u"r…@l…", 5}, + {"email_myself", u"myself@127.0.0.1", u"my…@1…", 6}, }; INSTANTIATE_TEST_SUITE_P( @@ -2288,11 +2259,11 @@ render_text->SetCursorEnabled(false); render_text->SetDisplayRect(Rect(0, 0, 3 * kGlyphWidth, 100)); render_text->SetElideBehavior(ELIDE_TAIL); - EXPECT_EQ(u"ab\u2026", render_text->GetDisplayText()); + EXPECT_EQ(u"ab…", render_text->GetDisplayText()); // Setting a different eliding behavior must trigger a relayout. render_text->SetElideBehavior(ELIDE_HEAD); - EXPECT_EQ(u"\u2026ef", render_text->GetDisplayText()); + EXPECT_EQ(u"…ef", render_text->GetDisplayText()); } TEST_F(RenderTextTest, SetWhitespaceElision) { @@ -2306,11 +2277,11 @@ render_text->SetDisplayRect(Rect(0, 0, 3 * kGlyphWidth, 100)); render_text->SetElideBehavior(ELIDE_TAIL); render_text->SetWhitespaceElision(false); - EXPECT_EQ(u"a \u2026", render_text->GetDisplayText()); + EXPECT_EQ(u"a …", render_text->GetDisplayText()); // Setting a different whitespace elision must trigger a relayout. render_text->SetWhitespaceElision(true); - EXPECT_EQ(u"a\u2026", render_text->GetDisplayText()); + EXPECT_EQ(u"a…", render_text->GetDisplayText()); } TEST_F(RenderTextTest, ElidedObscuredText) { @@ -2560,23 +2531,22 @@ } TEST_F(RenderTextTest, ElidedStyledTextRtl) { - static const char* kInputTexts[] = { - "http://ar.wikipedia.com/فحص", - "testحص,", - "حص,test", - "…", - "…test", - "test…", - "حص,test…", - "ٱ", - "\uFEFF", // BOM: Byte Order Marker - "…\u200F", // Right to left marker. + static const char16_t* kInputTexts[] = { + u"http://ar.wikipedia.com/فحص", + u"testحص,", + u"حص,test", + u"…", + u"…test", + u"test…", + u"حص,test…", + u"ٱ", + u"\uFEFF", // BOM: Byte Order Marker + u"…\u200F", // Right to left marker. }; for (const auto* raw_text : kInputTexts) { - SCOPED_TRACE( - base::StringPrintf("ElidedStyledTextRtl text = %s", raw_text)); - std::u16string input_text(UTF8ToUTF16(raw_text)); + std::u16string input_text(raw_text); + SCOPED_TRACE(u"ElidedStyledTextRtl text = " + input_text); RenderText* render_text = GetRenderText(); render_text->SetText(input_text); @@ -2614,61 +2584,61 @@ TEST_F(RenderTextTest, TruncatedText) { struct { - const wchar_t* text; - const wchar_t* display_text; + const char16_t* text; + const char16_t* display_text; } cases[] = { // Strings shorter than the truncation length should be laid out in full. - {L"", L""}, - {L" . ", L" . "}, // a wide kWeak - {L"abc", L"abc"}, // a wide kLtr - {L"\u05d0\u05d1\u05d2", L"\u05d0\u05d1\u05d2"}, // a wide kRtl - {L"a\u05d0\u05d1", L"a\u05d0\u05d1"}, // a wide kLtrRtl - {L"a\u05d1b", L"a\u05d1b"}, // a wide kLtrRtlLtr - {L"\u05d0\u05d1a", L"\u05d0\u05d1a"}, // a wide kRtlLtr - {L"\u05d0a\u05d1", L"\u05d0a\u05d1"}, // a wide kRtlLtrRtl - {L"01234", L"01234"}, + {u"", u""}, + {u" . ", u" . "}, // a wide kWeak + {u"abc", u"abc"}, // a wide kLtr + {u"אבג", u"אבג"}, // a wide kRtl + {u"aאב", u"aאב"}, // a wide kLtrRtl + {u"aבb", u"aבb"}, // a wide kLtrRtlLtr + {u"אבa", u"אבa"}, // a wide kRtlLtr + {u"אaב", u"אaב"}, // a wide kRtlLtrRtl + {u"01234", u"01234"}, // Long strings should be truncated with an ellipsis appended at the end. - {L"012345", L"0123\u2026"}, - {L"012 . ", L"012 \u2026"}, - {L"012abc", L"012a\u2026"}, - {L"012a\u05d0\u05d1", L"012a\u2026"}, - {L"012a\u05d1b", L"012a\u2026"}, - {L"012\u05d0\u05d1\u05d2", L"012\u05d0\u2026"}, - {L"012\u05d0\u05d1a", L"012\u05d0\u2026"}, - {L"012\u05d0a\u05d1", L"012\u05d0\u2026"}, + {u"012345", u"0123…"}, + {u"012 . ", u"012 …"}, + {u"012abc", u"012a…"}, + {u"012aאב", u"012a…"}, + {u"012aבb", u"012a…"}, + {u"012אבג", u"012א…"}, + {u"012אבa", u"012א…"}, + {u"012אaב", u"012א…"}, // Surrogate pairs should be truncated reasonably enough. - {L"0123\u0915\u093f", L"0123\u2026"}, - {L"\u05e9\u05bc\u05c1\u05b8", L"\u05e9\u05bc\u05c1\u05b8"}, - {L"0\u05e9\u05bc\u05c1\u05b8", L"0\u05e9\u05bc\u05c1\u05b8"}, - {L"01\u05e9\u05bc\u05c1\u05b8", L"01\u2026"}, - {L"012\u05e9\u05bc\u05c1\u05b8", L"012\u2026"}, + {u"0123\u0915\u093f", u"0123…"}, + {u"\u05e9\u05bc\u05c1\u05b8", u"\u05e9\u05bc\u05c1\u05b8"}, + {u"0\u05e9\u05bc\u05c1\u05b8", u"0\u05e9\u05bc\u05c1\u05b8"}, + {u"01\u05e9\u05bc\u05c1\u05b8", u"01…"}, + {u"012\u05e9\u05bc\u05c1\u05b8", u"012…"}, // Codepoint U+0001D11E is using 2x 16-bit characters. - {L"0\U0001D11Eaaa", L"0\U0001D11Ea\u2026"}, - {L"01\U0001D11Eaaa", L"01\U0001D11E\u2026"}, - {L"012\U0001D11Eaaa", L"012\u2026"}, - {L"0123\U0001D11Eaaa", L"0123\u2026"}, - {L"01234\U0001D11Eaaa", L"0123\u2026"}, + {u"0\U0001D11Eaaa", u"0\U0001D11Ea…"}, + {u"01\U0001D11Eaaa", u"01\U0001D11E…"}, + {u"012\U0001D11Eaaa", u"012…"}, + {u"0123\U0001D11Eaaa", u"0123…"}, + {u"01234\U0001D11Eaaa", u"0123…"}, // Combining codepoint should stay together. // (Letter 'e' U+0065 and acute accent U+0301). - {L"0e\u0301aaa", L"0e\u0301a\u2026"}, - {L"01e\u0301aaa", L"01e\u0301\u2026"}, - {L"012e\u0301aaa", L"012\u2026"}, + {u"0e\u0301aaa", u"0e\u0301a…"}, + {u"01e\u0301aaa", u"01e\u0301…"}, + {u"012e\u0301aaa", u"012…"}, // Emoji 'keycap letter 6'. - {L"\u0036\uFE0F\u20E3aaa", L"\u0036\uFE0F\u20E3a\u2026"}, - {L"0\u0036\uFE0F\u20E3aaa", L"0\u0036\uFE0F\u20E3\u2026"}, - {L"01\u0036\uFE0F\u20E3aaa", L"01\u2026"}, + {u"\u0036\uFE0F\u20E3aaa", u"\u0036\uFE0F\u20E3a…"}, + {u"0\u0036\uFE0F\u20E3aaa", u"0\u0036\uFE0F\u20E3…"}, + {u"01\u0036\uFE0F\u20E3aaa", u"01…"}, // Emoji 'pilot'. - {L"\U0001F468\u200D\u2708\uFE0F", L"\U0001F468\u200D\u2708\uFE0F"}, - {L"\U0001F468\u200D\u2708\uFE0F0", L"\u2026"}, - {L"0\U0001F468\u200D\u2708\uFE0F", L"0\u2026"}, + {u"\U0001F468\u200D\u2708\uFE0F", u"\U0001F468\u200D\u2708\uFE0F"}, + {u"\U0001F468\u200D\u2708\uFE0F0", u"…"}, + {u"0\U0001F468\u200D\u2708\uFE0F", u"0…"}, }; RenderText* render_text = GetRenderText(); render_text->set_truncate_length(5); for (size_t i = 0; i < base::size(cases); i++) { - render_text->SetText(WideToUTF16(cases[i].text)); - EXPECT_EQ(WideToUTF16(cases[i].text), render_text->text()); - EXPECT_EQ(WideToUTF16(cases[i].display_text), render_text->GetDisplayText()) + render_text->SetText(cases[i].text); + EXPECT_EQ(cases[i].text, render_text->text()); + EXPECT_EQ(cases[i].display_text, render_text->GetDisplayText()) << "For case " << i << ": " << cases[i].text; } } @@ -2691,13 +2661,13 @@ EXPECT_EQ(GetObscuredString(3), render_text->GetDisplayText()); render_text->SetObscuredRevealIndex(0); - EXPECT_EQ(u"e\u0301\u2026", render_text->GetDisplayText()); + EXPECT_EQ(u"e\u0301…", render_text->GetDisplayText()); render_text->SetObscuredRevealIndex(2); - EXPECT_EQ(u"\u2022\u2026", render_text->GetDisplayText()); + EXPECT_EQ(u"\u2022…", render_text->GetDisplayText()); render_text->SetObscuredRevealIndex(7); - EXPECT_EQ(u"\u2022\u2022\u2026", render_text->GetDisplayText()); + EXPECT_EQ(u"\u2022\u2022…", render_text->GetDisplayText()); } TEST_F(RenderTextTest, TruncatedCursorMovementLTR) { @@ -2731,7 +2701,7 @@ TEST_F(RenderTextTest, TruncatedCursorMovementRTL) { RenderText* render_text = GetRenderText(); render_text->set_truncate_length(2); - render_text->SetText(u"\u05d0\u05d1\u05d2\u05d3"); + render_text->SetText(u"אבגד"); EXPECT_EQ(SelectionModel(0, CURSOR_BACKWARD), render_text->selection_model()); render_text->MoveCursor(LINE_BREAK, CURSOR_LEFT, SELECTION_NONE); @@ -3253,18 +3223,18 @@ render_text->SetText(u"a"); EXPECT_EQ(base::i18n::LEFT_TO_RIGHT, render_text->GetTextDirection()); - render_text->SetText(u"\u05d0"); + render_text->SetText(u"א"); EXPECT_EQ(base::i18n::RIGHT_TO_LEFT, render_text->GetTextDirection()); // The codepoints u+2026 (ellipsis) has no strong direction. - render_text->SetText(u"\u2026"); + render_text->SetText(u"…"); EXPECT_EQ(original_text_direction, render_text->GetTextDirection()); render_text->AppendText(u"a"); EXPECT_EQ(base::i18n::LEFT_TO_RIGHT, render_text->GetTextDirection()); - render_text->SetText(u"\u2026"); + render_text->SetText(u"…"); EXPECT_EQ(original_text_direction, render_text->GetTextDirection()); - render_text->AppendText(u"\u05d0"); + render_text->AppendText(u"א"); EXPECT_EQ(base::i18n::RIGHT_TO_LEFT, render_text->GetTextDirection()); } @@ -3278,18 +3248,18 @@ render_text->SetText(u"a"); EXPECT_EQ(base::i18n::LEFT_TO_RIGHT, render_text->GetDisplayTextDirection()); - render_text->SetText(u"\u05d0"); + render_text->SetText(u"א"); EXPECT_EQ(base::i18n::RIGHT_TO_LEFT, render_text->GetDisplayTextDirection()); // The codepoints u+2026 (ellipsis) has no strong direction. - render_text->SetText(u"\u2026"); + render_text->SetText(u"…"); EXPECT_EQ(original_text_direction, render_text->GetDisplayTextDirection()); render_text->AppendText(u"a"); EXPECT_EQ(base::i18n::LEFT_TO_RIGHT, render_text->GetDisplayTextDirection()); - render_text->SetText(u"\u2026"); + render_text->SetText(u"…"); EXPECT_EQ(original_text_direction, render_text->GetDisplayTextDirection()); - render_text->AppendText(u"\u05d0"); + render_text->AppendText(u"א"); EXPECT_EQ(base::i18n::RIGHT_TO_LEFT, render_text->GetDisplayTextDirection()); } @@ -3304,7 +3274,7 @@ // The elided text is an ellipsis with neutral directionality, and a 'z' with // a strong LTR directionality. - EXPECT_EQ(u"\u2026z", render_text->GetDisplayText()); + EXPECT_EQ(u"…z", render_text->GetDisplayText()); EXPECT_EQ(base::i18n::RIGHT_TO_LEFT, render_text->GetTextDirection()); EXPECT_EQ(base::i18n::LEFT_TO_RIGHT, render_text->GetDisplayTextDirection()); } @@ -3314,7 +3284,7 @@ ASSERT_EQ(render_text->directionality_mode(), DIRECTIONALITY_FROM_TEXT); // The codepoints u+2026 (ellipsis) has weak directionality. - render_text->SetText(u"\u2026"); + render_text->SetText(u"…"); const base::i18n::TextDirection original_text_direction = render_text->GetTextDirection(); @@ -3338,11 +3308,11 @@ render_text->SetVerticalAlignment(ALIGN_TOP); const size_t kLineSize = 50; - std::string text; + std::u16string text; for (size_t i = 0; i < kLineSize - 1; ++i) - text += "a\n"; + text += u"a\n"; - render_text->SetText(ASCIIToUTF16(text)); + render_text->SetText(text); EXPECT_EQ(kLineSize, render_text->GetNumLines()); // Move cursor down with scroll. @@ -3383,11 +3353,11 @@ TEST_F(RenderTextTest, GetDisplayTextDirection) { struct { - const char* text; + const char16_t* text; const base::i18n::TextDirection text_direction; } cases[] = { // Blank strings and those with no/weak directionality default to LTR. - {"", base::i18n::LEFT_TO_RIGHT}, + {u"", base::i18n::LEFT_TO_RIGHT}, {kWeak, base::i18n::LEFT_TO_RIGHT}, // Strings that begin with strong LTR characters. {kLtr, base::i18n::LEFT_TO_RIGHT}, @@ -3410,7 +3380,7 @@ // Ensure that directionality modes yield the correct text directions. for (size_t j = 0; j < base::size(cases); j++) { - render_text->SetText(UTF8ToUTF16(cases[j].text)); + render_text->SetText(cases[j].text); render_text->SetDirectionalityMode(DIRECTIONALITY_FROM_TEXT); EXPECT_EQ(render_text->GetDisplayTextDirection(),cases[j].text_direction); render_text->SetDirectionalityMode(DIRECTIONALITY_FROM_UI); @@ -3431,15 +3401,15 @@ // Ensure that text changes update the direction for DIRECTIONALITY_FROM_TEXT. render_text->SetDirectionalityMode(DIRECTIONALITY_FROM_TEXT); - render_text->SetText(UTF8ToUTF16(kLtr)); + render_text->SetText(kLtr); EXPECT_EQ(render_text->GetDisplayTextDirection(), base::i18n::LEFT_TO_RIGHT); - render_text->SetText(UTF8ToUTF16(kRtl)); + render_text->SetText(kRtl); EXPECT_EQ(render_text->GetDisplayTextDirection(), base::i18n::RIGHT_TO_LEFT); } struct GetTextIndexOfLineCase { const char* test_name; - const wchar_t* const text; + const char16_t* const text; const std::vector<size_t> line_breaks; const bool set_word_wrap = false; const bool set_obscured = false; @@ -3465,60 +3435,60 @@ render_text->SetWordWrapBehavior(WRAP_LONG_WORDS); } render_text->SetObscured(param.set_obscured); - render_text->SetText(base::WideToUTF16(param.text)); + render_text->SetText(param.text); for (size_t i = 0; i < param.line_breaks.size(); ++i) { EXPECT_EQ(param.line_breaks[i], render_text->GetTextIndexOfLine(i)); } } const GetTextIndexOfLineCase kGetTextIndexOfLineCases[] = { - {"emptyString", L"", {0}}, + {"emptyString", u"", {0}}, // The following test strings are three character strings. // The word wrap makes each character fall on a new line. - {"kWeak_minWidth", L" . ", {0, 1, 2}, kUseWordWrap}, - {"kLtr_minWidth", L"abc", {0, 1, 2}, kUseWordWrap}, - {"kLtrRtl_minWidth", L"a\u05d0\u05d1", {0, 1, 2}, kUseWordWrap}, - {"kLtrRtlLtr_minWidth", L"a\u05d1b", {0, 1, 2}, kUseWordWrap}, - {"kRtl_minWidth", L"\u05d0\u05d1\u05d2", {0, 1, 2}, kUseWordWrap}, - {"kRtlLtr_minWidth", L"\u05d0\u05d1a", {0, 1, 2}, kUseWordWrap}, - {"kRtlLtrRtl_minWidth", L"\u05d0a\u05d1", {0, 1, 2}, kUseWordWrap}, + {"kWeak_minWidth", u" . ", {0, 1, 2}, kUseWordWrap}, + {"kLtr_minWidth", u"abc", {0, 1, 2}, kUseWordWrap}, + {"kLtrRtl_minWidth", u"aאב", {0, 1, 2}, kUseWordWrap}, + {"kLtrRtlLtr_minWidth", u"aבb", {0, 1, 2}, kUseWordWrap}, + {"kRtl_minWidth", u"אבג", {0, 1, 2}, kUseWordWrap}, + {"kRtlLtr_minWidth", u"אבa", {0, 1, 2}, kUseWordWrap}, + {"kRtlLtrRtl_minWidth", u"אaב", {0, 1, 2}, kUseWordWrap}, // The following test strings have 2 graphemes separated by a newline. // The obscured text replace each grapheme by a single codepoint. {"grapheme_unobscured", - L"\U0001F601\n\U0001F468\u200D\u2708\uFE0F\nx", + u"\U0001F601\n\U0001F468\u200D\u2708\uFE0F\nx", {0, 3, 9}}, {"grapheme_obscured", - L"\U0001F601\n\U0001F468\u200D\u2708\uFE0F\nx", + u"\U0001F601\n\U0001F468\u200D\u2708\uFE0F\nx", {0, 3, 9}, !kUseWordWrap, kUseObscuredText}, // The following test strings have a new line character. - {"basic_newLine", L"abc\ndef", {0, 4}}, - {"basic_newLineWindows", L"abc\r\ndef", {0, 5}}, - {"spaces_newLine", L"a \n b ", {0, 3}}, - {"spaces_newLineWindows", L"a \r\n b ", {0, 4}}, - {"double_newLine", L"a\n\nb", {0, 2, 3}}, - {"double_newLineWindows", L"a\r\n\r\nb", {0, 3, 5}}, - {"start_newLine", L"\nab", {0, 1}}, - {"start_newLineWindows", L"\r\nab", {0, 2}}, - {"end_newLine", L"ab\n", {0}}, - {"end_newLineWindows", L"ab\r\n", {0}}, - {"isolated_newLine", L"\n", {0}}, - {"isolated_newLineWindows", L"\r\n", {0}}, - {"isolatedDouble_newLine", L"\n\n", {0, 1}}, - {"isolatedDouble_newLineWindows", L"\r\n\r\n", {0, 2}}, + {"basic_newLine", u"abc\ndef", {0, 4}}, + {"basic_newLineWindows", u"abc\r\ndef", {0, 5}}, + {"spaces_newLine", u"a \n b ", {0, 3}}, + {"spaces_newLineWindows", u"a \r\n b ", {0, 4}}, + {"double_newLine", u"a\n\nb", {0, 2, 3}}, + {"double_newLineWindows", u"a\r\n\r\nb", {0, 3, 5}}, + {"start_newLine", u"\nab", {0, 1}}, + {"start_newLineWindows", u"\r\nab", {0, 2}}, + {"end_newLine", u"ab\n", {0}}, + {"end_newLineWindows", u"ab\r\n", {0}}, + {"isolated_newLine", u"\n", {0}}, + {"isolated_newLineWindows", u"\r\n", {0}}, + {"isolatedDouble_newLine", u"\n\n", {0, 1}}, + {"isolatedDouble_newLineWindows", u"\r\n\r\n", {0, 2}}, // The following test strings have unicode characters. - {"playSymbol_unicode", L"x\n\u25B6\ny", {0, 2, 4}}, - {"emoji_unicode", L"x\n\U0001F601\ny\n\u2728\nz", {0, 2, 5, 7, 9}}, - {"flag_unicode", L"🇬🇧\n🇯🇵", {0, 5}, false, false}, + {"playSymbol_unicode", u"x\n\u25B6\ny", {0, 2, 4}}, + {"emoji_unicode", u"x\n\U0001F601\ny\n\u2728\nz", {0, 2, 5, 7, 9}}, + {"flag_unicode", u"🇬🇧\n🇯🇵", {0, 5}, false, false}, // The following cases test that GetTextIndexOfLine returns the length of // the text when passed a line index larger than the number of lines. - {"basic_outsideRange", L"abc", {0, 1, 2, 3, 3}, kUseWordWrap}, - {"emptyString_outsideRange", L"", {0, 0, 0}}, - {"newLine_outsideRange", L"\n", {0, 1, 1}}, - {"newLineWindows_outsideRange", L"\r\n", {0, 2, 2, 2}}, - {"doubleNewLine_outsideRange", L"\n\n", {0, 1, 2, 2}}, - {"doubleNewLineWindows_outsideRange", L"\r\n\r\n", {0, 2, 4, 4}}, + {"basic_outsideRange", u"abc", {0, 1, 2, 3, 3}, kUseWordWrap}, + {"emptyString_outsideRange", u"", {0, 0, 0}}, + {"newLine_outsideRange", u"\n", {0, 1, 1}}, + {"newLineWindows_outsideRange", u"\r\n", {0, 2, 2, 2}}, + {"doubleNewLine_outsideRange", u"\n\n", {0, 1, 2, 2}}, + {"doubleNewLineWindows_outsideRange", u"\r\n\r\n", {0, 2, 4, 4}}, }; INSTANTIATE_TEST_SUITE_P( @@ -3553,7 +3523,7 @@ TEST_F(RenderTextTest, MoveCursorLeftRightInLtrRtl) { RenderText* render_text = GetRenderText(); // LTR-RTL - render_text->SetText(u"abc\u05d0\u05d1\u05d2"); + render_text->SetText(u"abcאבג"); // The last one is the expected END position. std::vector<SelectionModel> expected; expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); @@ -3581,7 +3551,7 @@ TEST_F(RenderTextTest, MoveCursorLeftRightInLtrRtlLtr) { RenderText* render_text = GetRenderText(); // LTR-RTL-LTR. - render_text->SetText(u"a\u05d1b"); + render_text->SetText(u"aבb"); std::vector<SelectionModel> expected; expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); expected.push_back(SelectionModel(1, CURSOR_BACKWARD)); @@ -3602,7 +3572,7 @@ TEST_F(RenderTextTest, MoveCursorLeftRightInRtl) { RenderText* render_text = GetRenderText(); // Pure RTL. - render_text->SetText(u"\u05d0\u05d1\u05d2"); + render_text->SetText(u"אבג"); render_text->MoveCursor(LINE_BREAK, CURSOR_RIGHT, SELECTION_NONE); std::vector<SelectionModel> expected; @@ -3626,7 +3596,7 @@ TEST_F(RenderTextTest, MoveCursorLeftRightInRtlLtr) { RenderText* render_text = GetRenderText(); // RTL-LTR - render_text->SetText(u"\u05d0\u05d1\u05d2abc"); + render_text->SetText(u"אבגabc"); render_text->MoveCursor(LINE_BREAK, CURSOR_RIGHT, SELECTION_NONE); std::vector<SelectionModel> expected; expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); @@ -3654,7 +3624,7 @@ TEST_F(RenderTextTest, MoveCursorLeftRightInRtlLtrRtl) { RenderText* render_text = GetRenderText(); // RTL-LTR-RTL. - render_text->SetText(u"\u05d0a\u05d1"); + render_text->SetText(u"אaב"); render_text->MoveCursor(LINE_BREAK, CURSOR_RIGHT, SELECTION_NONE); std::vector<SelectionModel> expected; expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); @@ -3956,12 +3926,12 @@ } TEST_F(RenderTextTest, FindCursorPosition) { - const char* kTestStrings[] = {kLtrRtl, kLtrRtlLtr, kRtlLtr, kRtlLtrRtl}; + const char16_t* kTestStrings[] = {kLtrRtl, kLtrRtlLtr, kRtlLtr, kRtlLtrRtl}; RenderText* render_text = GetRenderText(); render_text->SetDisplayRect(Rect(0, 0, 100, 20)); for (size_t i = 0; i < base::size(kTestStrings); ++i) { SCOPED_TRACE(base::StringPrintf("Testing case[%" PRIuS "]", i)); - render_text->SetText(UTF8ToUTF16(kTestStrings[i])); + render_text->SetText(kTestStrings[i]); for (size_t j = 0; j < render_text->text().length(); ++j) { gfx::RangeF cursor_span = render_text->GetCursorSpan(Range(j, j + 1)); // Test a point just inside the leading edge of the glyph bounds. @@ -3974,8 +3944,7 @@ // Tests that FindCursorPosition behaves correctly for multi-line text. TEST_F(RenderTextTest, FindCursorPositionMultiline) { - const char* kTestStrings[] = {"abc def", - "\u05d0\u05d1\u05d2 \u05d3\u05d4\u05d5"}; + const char16_t* kTestStrings[] = {u"abc def", u"אבג דהו"}; SetGlyphWidth(5); RenderText* render_text = GetRenderText(); @@ -3983,7 +3952,7 @@ render_text->SetMultiline(true); for (size_t i = 0; i < base::size(kTestStrings); i++) { - render_text->SetText(UTF8ToUTF16(kTestStrings[i])); + render_text->SetText(kTestStrings[i]); EXPECT_EQ(2u, render_text->GetNumLines()); const bool is_ltr = @@ -4075,8 +4044,8 @@ } TEST_F(RenderTextTest, SelectAll) { - const char* const cases[] = {kWeak, kLtr, kLtrRtl, kLtrRtlLtr, - kRtl, kRtlLtr, kRtlLtrRtl}; + const char16_t* const cases[] = {kWeak, kLtr, kLtrRtl, kLtrRtlLtr, + kRtl, kRtlLtr, kRtlLtrRtl}; // Ensure that SelectAll respects the |reversed| argument regardless of // application locale and text content directionality. @@ -4093,7 +4062,7 @@ // Test the weak, LTR, RTL, and Bidi string cases. for (size_t j = 0; j < base::size(cases); j++) { - render_text->SetText(UTF8ToUTF16(cases[j])); + render_text->SetText(cases[j]); render_text->SelectAll(false); EXPECT_EQ(render_text->selection_model(), expected_forwards); render_text->SelectAll(true); @@ -4106,7 +4075,7 @@ TEST_F(RenderTextTest, MoveCursorLeftRightWithSelection) { RenderText* render_text = GetRenderText(); - render_text->SetText(u"abc\u05d0\u05d1\u05d2"); + render_text->SetText(u"abcאבג"); // Left arrow on select ranging (6, 4). render_text->MoveCursor(LINE_BREAK, CURSOR_RIGHT, SELECTION_NONE); EXPECT_EQ(Range(6), render_text->selection()); @@ -4270,9 +4239,9 @@ render_text->GetUpdatedCursorBounds().right()); } -void MoveLeftRightByWordVerifier(RenderText* render_text, const char* str) { +void MoveLeftRightByWordVerifier(RenderText* render_text, const char16_t* str) { SCOPED_TRACE(str); - const std::u16string str16(UTF8ToUTF16(str)); + const std::u16string str16(str); render_text->SetText(str16); // Test moving by word from left to right. @@ -4344,37 +4313,37 @@ TEST_F(RenderTextTest, MAYBE_MoveLeftRightByWordInBidiText) { RenderText* render_text = GetRenderText(); // For testing simplicity, each word is a 3-character word. - std::vector<const char*> test; - test.push_back("abc"); - test.push_back("abc def"); - test.push_back("\u05E1\u05E2\u05E3"); - test.push_back("\u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6"); - test.push_back("abc \u05E1\u05E2\u05E3"); - test.push_back("abc def \u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6"); + std::vector<const char16_t*> test; + test.push_back(u"abc"); + test.push_back(u"abc def"); + test.push_back(u"\u05E1\u05E2\u05E3"); + test.push_back(u"\u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6"); + test.push_back(u"abc \u05E1\u05E2\u05E3"); + test.push_back(u"abc def \u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6"); test.push_back( - "abc def hij \u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6" - " \u05E7\u05E8\u05E9"); + u"abc def hij \u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6" + u" \u05E7\u05E8\u05E9"); - test.push_back("abc \u05E1\u05E2\u05E3 hij"); - test.push_back("abc def \u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6 hij opq"); + test.push_back(u"abc \u05E1\u05E2\u05E3 hij"); + test.push_back(u"abc def \u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6 hij opq"); test.push_back( - "abc def hij \u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6" - " \u05E7\u05E8\u05E9 opq rst uvw"); + u"abc def hij \u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6" + u" \u05E7\u05E8\u05E9 opq rst uvw"); - test.push_back("\u05E1\u05E2\u05E3 abc"); - test.push_back("\u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6 abc def"); + test.push_back(u"\u05E1\u05E2\u05E3 abc"); + test.push_back(u"\u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6 abc def"); test.push_back( - "\u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6 \u05E7\u05E8\u05E9" - " abc def hij"); + u"\u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6 \u05E7\u05E8\u05E9" + u" abc def hij"); - test.push_back("\u05D1\u05D2\u05D3 abc \u05E1\u05E2\u05E3"); + test.push_back(u"בגד abc \u05E1\u05E2\u05E3"); test.push_back( - "\u05D1\u05D2\u05D3 \u05D4\u05D5\u05D6 abc def" - " \u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6"); + u"בגד הוז abc def" + u" \u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6"); test.push_back( - "\u05D1\u05D2\u05D3 \u05D4\u05D5\u05D6 \u05D7\u05D8\u05D9" - " abc def hij \u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6" - " \u05E7\u05E8\u05E9"); + u"בגד הוז חטי" + u" abc def hij \u05E1\u05E2\u05E3 \u05E4\u05E5\u05E6" + u" \u05E7\u05E8\u05E9"); for (size_t i = 0; i < test.size(); ++i) MoveLeftRightByWordVerifier(render_text, test[i]); @@ -4711,15 +4680,13 @@ Font cjk_font(kCJKFontName, 16); ASSERT_EQ(base::ToLowerASCII(kCJKFontName), base::ToLowerASCII(cjk_font.GetActualFontName())); - // "a" should be rendered with the test font, not with the CJK font. - const char* test_font_text = "a"; - // "円" (U+5168 Han character YEN) should render with the CJK font, not - // the test font. - const char* cjk_font_text = "\u5168"; Font smaller_font = test_font; Font larger_font = cjk_font; - const char* smaller_font_text = test_font_text; - const char* larger_font_text = cjk_font_text; + // "a" should be rendered with the test font, not with the CJK font. + const char16_t* smaller_font_text = u"a"; + // "円" (U+5168 Han character YEN) should render with the CJK font, not + // the test font. + const char16_t* larger_font_text = u"\u5168"; if (cjk_font.GetHeight() < test_font.GetHeight() && cjk_font.GetBaseline() < test_font.GetBaseline()) { std::swap(smaller_font, larger_font); @@ -4730,7 +4697,7 @@ // Check |smaller_font_text| is rendered with the smaller font. RenderText* render_text = GetRenderText(); - render_text->SetText(UTF8ToUTF16(smaller_font_text)); + render_text->SetText(smaller_font_text); render_text->SetFontList(FontList(smaller_font)); render_text->SetDisplayRect(Rect(0, 0, 0, render_text->font_list().GetHeight())); @@ -4840,7 +4807,7 @@ RenderText* render_text = GetRenderText(); for (size_t text_length = 0; text_length < 10; ++text_length) { - render_text->SetText(ASCIIToUTF16(std::string(text_length, 'x'))); + render_text->SetText(std::u16string(text_length, u'x')); // Ensures that conversion from float to integer ceils the values. const float expected_width = text_length * kGlyphWidth; @@ -4881,7 +4848,7 @@ if (line != 0) render_text->AppendText(u"\n"); const int text_length = line; - render_text->AppendText(ASCIIToUTF16(std::string(text_length, 'x'))); + render_text->AppendText(std::u16string(text_length, u'x')); // Ensures that conversion from float to integer ceils the values. const float expected_width = text_length * kGlyphWidth; @@ -4945,7 +4912,7 @@ const int kGlyphCount = 3; RenderText* render_text = GetRenderText(); - render_text->SetText(ASCIIToUTF16(std::string(kGlyphCount, 'x'))); + render_text->SetText(std::u16string(kGlyphCount, u'x')); render_text->SetDisplayRect(Rect(1, 1, 25, 12)); render_text->SetCursorEnabled(false); render_text->SetVerticalAlignment(ALIGN_TOP); @@ -5444,18 +5411,18 @@ // Make sure the last word is selected when the cursor is at text.length(). TEST_F(RenderTextTest, LastWordSelected) { - const std::string kTestURL1 = "http://www.google.com"; - const std::string kTestURL2 = "http://www.google.com/something/"; + const std::u16string kTestURL1 = u"http://www.google.com"; + const std::u16string kTestURL2 = u"http://www.google.com/something/"; RenderText* render_text = GetRenderText(); - render_text->SetText(ASCIIToUTF16(kTestURL1)); + render_text->SetText(kTestURL1); render_text->SetCursorPosition(kTestURL1.length()); render_text->SelectWord(); EXPECT_EQ(u"com", GetSelectedText(render_text)); EXPECT_FALSE(render_text->selection().is_reversed()); - render_text->SetText(ASCIIToUTF16(kTestURL2)); + render_text->SetText(kTestURL2); render_text->SetCursorPosition(kTestURL2.length()); render_text->SelectWord(); EXPECT_EQ(u"/", GetSelectedText(render_text)); @@ -5465,11 +5432,11 @@ // When given a non-empty selection, SelectWord should expand the selection to // nearest word boundaries. TEST_F(RenderTextTest, SelectMultipleWords) { - const std::string kTestURL = "http://www.google.com"; + const std::u16string kTestURL = u"http://www.google.com"; RenderText* render_text = GetRenderText(); - render_text->SetText(ASCIIToUTF16(kTestURL)); + render_text->SetText(kTestURL); render_text->SelectRange(Range(16, 20)); render_text->SelectWord(); EXPECT_EQ(u"google.com", GetSelectedText(render_text)); @@ -5511,9 +5478,7 @@ EXPECT_EQ(width, render_text->GetUpdatedCursorBounds().x()); // Repeat the test with RTL text. - render_text->SetText( - UTF8ToUTF16("\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5\u05d6\u05d7" - "\u05d8\u05d9\u05da\u05db\u05dc\u05dd\u05de\u05df")); + render_text->SetText(u"אבגדהוזחטיךכלםמן"); render_text->SetCursorPosition(0); width = render_text->GetStringSize().width(); ASSERT_GT(width, 10); @@ -5569,9 +5534,7 @@ render_text->GetUpdatedCursorBounds().x()); // Repeat the test with RTL text. - render_text->SetText( - UTF8ToUTF16("\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5\u05d6\u05d7" - "\u05d8\u05d9\u05da\u05db\u05dc\u05dd\u05de\u05df")); + render_text->SetText(u"אבגדהוזחטיךכלםמן"); render_text->SetCursorPosition(render_text->text().length()); width = render_text->GetStringSize().width(); ASSERT_GT(width, 10); @@ -5601,12 +5564,12 @@ // Changing colors between or inside ligated glyphs should not break shaping. TEST_F(RenderTextTest, SelectionKeepsLigatures) { - const char* kTestStrings[] = {"\u0644\u0623", "\u0633\u0627"}; + const char16_t* const kTestStrings[] = {u"\u0644\u0623", u"\u0633\u0627"}; RenderText* render_text = GetRenderText(); render_text->set_selection_color(SK_ColorGREEN); for (size_t i = 0; i < base::size(kTestStrings); ++i) { - render_text->SetText(UTF8ToUTF16(kTestStrings[i])); + render_text->SetText(kTestStrings[i]); const int expected_width = render_text->GetStringSize().width(); render_text->SelectRange({0, 1}); EXPECT_EQ(expected_width, render_text->GetStringSize().width()); @@ -5633,7 +5596,8 @@ EXPECT_EQ(std::vector<std::u16string>({ramen_katakana}), RunsFor(ramen_katakana)); - EXPECT_EQ(ToString16Vec({"らあ", "メン"}), RunsFor(ramen_mixed)); + EXPECT_EQ(std::vector<std::u16string>({u"らあ", u"メン"}), + RunsFor(ramen_mixed)); } // Test that whitespace breaks runs of text. E.g. this can permit better fonts @@ -5649,18 +5613,20 @@ // This says "thank you very much" with a full-width non-ascii space (U+3000). const std::u16string full_width_space = u"ども ありがと"; - EXPECT_EQ(ToString16Vec({"סיבית", " ", "–", " ", "ויקיפדיה"}), - RunsFor(ascii_space_he)); - EXPECT_EQ(ToString16Vec({"Bit", " ", "-", " ", "Wikipedia"}), - RunsFor(ascii_space_en)); - EXPECT_EQ(ToString16Vec({"ども", " ", "ありがと"}), + EXPECT_EQ( + std::vector<std::u16string>({u"סיבית", u" ", u"–", u" ", u"ויקיפדיה"}), + RunsFor(ascii_space_he)); + EXPECT_EQ( + std::vector<std::u16string>({u"Bit", u" ", u"-", u" ", u"Wikipedia"}), + RunsFor(ascii_space_en)); + EXPECT_EQ(std::vector<std::u16string>({u"ども", u" ", u"ありがと"}), RunsFor(full_width_space)); } // Ensure strings wrap onto multiple lines for a small available width. TEST_F(RenderTextTest, Multiline_MinWidth) { - const char* kTestStrings[] = {kWeak, kLtr, kLtrRtl, kLtrRtlLtr, - kRtl, kRtlLtr, kRtlLtrRtl}; + const char16_t* kTestStrings[] = {kWeak, kLtr, kLtrRtl, kLtrRtlLtr, + kRtl, kRtlLtr, kRtlLtrRtl}; RenderText* render_text = GetRenderText(); render_text->SetDisplayRect(Rect(1, 1000)); @@ -5669,7 +5635,7 @@ for (size_t i = 0; i < base::size(kTestStrings); ++i) { SCOPED_TRACE(base::StringPrintf("kTestStrings[%" PRIuS "]", i)); - render_text->SetText(UTF8ToUTF16(kTestStrings[i])); + render_text->SetText(kTestStrings[i]); render_text->Draw(canvas()); EXPECT_GT(test_api()->lines().size(), 1U); } @@ -5680,7 +5646,7 @@ // Should RenderText suppress drawing whitespace at the end of a line? // Currently it does not. const struct { - const char* const text; + const char16_t* const text; const Range first_line_char_range; const Range second_line_char_range; @@ -5692,22 +5658,20 @@ bool is_ltr; } kTestStrings[] = { - {"abc defg hijkl", Range(0, 9), Range(9, 14), {3, 1, 4, 1, 5}, 4, true}, - {"qwertyzxcvbn", Range(0, 10), Range(10, 12), {10, 2}, 1, true}, + {u"abc defg hijkl", Range(0, 9), Range(9, 14), {3, 1, 4, 1, 5}, 4, true}, + {u"qwertyzxcvbn", Range(0, 10), Range(10, 12), {10, 2}, 1, true}, // RTL: should render left-to-right as "<space>43210 \n cba9876". // Note this used to say "Arabic language", in Arabic, but the last // character in the string (\u0629) got fancy in an updated Mac font, so // now the penultimate character repeats. (See "NOTE" below). - {"\u0627\u0644\u0644\u063A\u0629 " - "\u0627\u0644\u0639\u0631\u0628\u064A\u064A", + {u"اللغة العربيي", Range(0, 6), Range(6, 13), {1 /* space first */, 5, 7}, 2, false}, // RTL: should render left-to-right as "<space>3210 \n cba98765". - {"\u062A\u0641\u0627\u062D \u05EA\u05E4\u05D5\u05D6\u05D9" - "\u05DA\u05DB\u05DD", + {u"تفاح תפוזיךכם", Range(0, 5), Range(5, 13), {1 /* space first */, 5, 8}, @@ -5726,7 +5690,7 @@ for (size_t i = 0; i < base::size(kTestStrings); ++i) { SCOPED_TRACE(base::StringPrintf("kTestStrings[%" PRIuS "]", i)); - render_text->SetText(UTF8ToUTF16(kTestStrings[i].text)); + render_text->SetText(kTestStrings[i].text); DrawVisualText(); ASSERT_EQ(2U, test_api()->lines().size()); @@ -5760,8 +5724,14 @@ // Ensure strings don't wrap onto multiple lines for a sufficient available // width. TEST_F(RenderTextTest, Multiline_SufficientWidth) { - const char* kTestStrings[] = {"", " ", ".", " . ", "abc", "a b c", - "\u062E\u0628\u0632", "\u062E \u0628 \u0632"}; + const char16_t* kTestStrings[] = {u"", + u" ", + u".", + u" . ", + u"abc", + u"a b c", + u"\u062E\u0628\u0632", + u"\u062E \u0628 \u0632"}; RenderText* render_text = GetRenderText(); render_text->SetDisplayRect(Rect(1000, 1000)); @@ -5769,7 +5739,7 @@ for (size_t i = 0; i < base::size(kTestStrings); ++i) { SCOPED_TRACE(base::StringPrintf("kTestStrings[%" PRIuS "]", i)); - render_text->SetText(UTF8ToUTF16(kTestStrings[i])); + render_text->SetText(kTestStrings[i]); render_text->Draw(canvas()); EXPECT_EQ(1U, test_api()->lines().size()); } @@ -5777,17 +5747,17 @@ TEST_F(RenderTextTest, Multiline_Newline) { const struct { - const char* const text; + const char16_t* const text; const size_t lines_count; // Ranges of the characters on each line. const Range line_char_ranges[3]; } kTestStrings[] = { - {"abc\ndef", 2ul, {Range(0, 4), Range(4, 7), Range::InvalidRange()}}, - {"a \n b ", 2ul, {Range(0, 3), Range(3, 6), Range::InvalidRange()}}, - {"ab\n", 2ul, {Range(0, 3), Range(), Range::InvalidRange()}}, - {"a\n\nb", 3ul, {Range(0, 2), Range(2, 3), Range(3, 4)}}, - {"\nab", 2ul, {Range(0, 1), Range(1, 3), Range::InvalidRange()}}, - {"\n", 2ul, {Range(0, 1), Range(), Range::InvalidRange()}}, + {u"abc\ndef", 2ul, {Range(0, 4), Range(4, 7), Range::InvalidRange()}}, + {u"a \n b ", 2ul, {Range(0, 3), Range(3, 6), Range::InvalidRange()}}, + {u"ab\n", 2ul, {Range(0, 3), Range(), Range::InvalidRange()}}, + {u"a\n\nb", 3ul, {Range(0, 2), Range(2, 3), Range(3, 4)}}, + {u"\nab", 2ul, {Range(0, 1), Range(1, 3), Range::InvalidRange()}}, + {u"\n", 2ul, {Range(0, 1), Range(), Range::InvalidRange()}}, }; RenderText* render_text = GetRenderText(); @@ -5796,7 +5766,7 @@ for (size_t i = 0; i < base::size(kTestStrings); ++i) { SCOPED_TRACE(base::StringPrintf("kTestStrings[%" PRIuS "]", i)); - render_text->SetText(UTF8ToUTF16(kTestStrings[i].text)); + render_text->SetText(kTestStrings[i].text); render_text->Draw(canvas()); EXPECT_EQ(kTestStrings[i].lines_count, test_api()->lines().size()); if (kTestStrings[i].lines_count != test_api()->lines().size()) @@ -5821,23 +5791,20 @@ TEST_F(RenderTextTest, Multiline_IgnoreElide) { const char16_t kTestString[] = u"very very very long string xxxxxxxxxxxxxxxxxxxxxxxxxx"; - const char kEllipsis[] = "\u2026"; RenderText* render_text = GetRenderText(); render_text->SetElideBehavior(ELIDE_TAIL); render_text->SetDisplayRect(Rect(20, 1000)); render_text->SetText(kTestString); - EXPECT_NE(std::u16string::npos, - render_text->GetDisplayText().find(base::UTF8ToUTF16(kEllipsis))); + EXPECT_NE(std::u16string::npos, render_text->GetDisplayText().find(u"…")); render_text->SetMultiline(true); - EXPECT_EQ(std::u16string::npos, - render_text->GetDisplayText().find(base::UTF8ToUTF16(kEllipsis))); + EXPECT_EQ(std::u16string::npos, render_text->GetDisplayText().find(u"…")); } TEST_F(RenderTextTest, Multiline_NewlineCharacterReplacement) { - const char* kTestStrings[] = { - "abc\ndef", "a \n b ", "ab\n", "a\n\nb", "\nab", "\n", + const char16_t* kTestStrings[] = { + u"abc\ndef", u"a \n b ", u"ab\n", u"a\n\nb", u"\nab", u"\n", }; for (size_t i = 0; i < base::size(kTestStrings); ++i) { @@ -5845,49 +5812,45 @@ ResetRenderTextInstance(); RenderText* render_text = GetRenderText(); render_text->SetDisplayRect(Rect(200, 1000)); - render_text->SetText(ASCIIToUTF16(kTestStrings[i])); + render_text->SetText(kTestStrings[i]); std::u16string display_text = render_text->GetDisplayText(); // If RenderText is not multiline, the newline characters are replaced // by symbols, therefore the character should be changed. - EXPECT_NE(ASCIIToUTF16(kTestStrings[i]), render_text->GetDisplayText()); + EXPECT_NE(kTestStrings[i], render_text->GetDisplayText()); // Setting multiline will fix this, the newline characters will be back // to the original text. render_text->SetMultiline(true); - EXPECT_EQ(ASCIIToUTF16(kTestStrings[i]), render_text->GetDisplayText()); + EXPECT_EQ(kTestStrings[i], render_text->GetDisplayText()); } } // Ensure horizontal alignment works in multiline mode. TEST_F(RenderTextTest, Multiline_HorizontalAlignment) { constexpr struct { - const char* const text; + const char16_t* const text; const HorizontalAlignment alignment; const base::i18n::TextDirection display_text_direction; } kTestStrings[] = { - {"abcdefghi\nhijk", ALIGN_LEFT, base::i18n::LEFT_TO_RIGHT}, - {"nhij\nabcdefghi", ALIGN_LEFT, base::i18n::LEFT_TO_RIGHT}, + {u"abcdefghi\nhijk", ALIGN_LEFT, base::i18n::LEFT_TO_RIGHT}, + {u"nhij\nabcdefghi", ALIGN_LEFT, base::i18n::LEFT_TO_RIGHT}, // Hebrew, 2nd line shorter - {"\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5\u05d6\u05d7\n" - "\u05d0\u05d1\u05d2\u05d3", - ALIGN_RIGHT, - base::i18n::RIGHT_TO_LEFT}, + {u"אבגדהוזח\n" + u"אבגד", + ALIGN_RIGHT, base::i18n::RIGHT_TO_LEFT}, // Hebrew, 2nd line longer - {"\u05d0\u05d1\u05d2\u05d3\n" - "\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5\u05d6\u05d7", - ALIGN_RIGHT, - base::i18n::RIGHT_TO_LEFT}, + {u"אבגד\n" + u"אבגדהוזח", + ALIGN_RIGHT, base::i18n::RIGHT_TO_LEFT}, // Arabic, 2nd line shorter. - {"\u0627\u0627\u0627\u0627\u0627\u0627\u0627\u0627\n" - "\u0627\u0644\u0644\u063A", - ALIGN_RIGHT, - base::i18n::RIGHT_TO_LEFT}, + {u"\u0627\u0627\u0627\u0627\u0627\u0627\u0627\u0627\n" + u"\u0627\u0644\u0644\u063A", + ALIGN_RIGHT, base::i18n::RIGHT_TO_LEFT}, // Arabic, 2nd line longer. - {"\u0627\u0644\u0644\u063A\n" - "\u0627\u0627\u0627\u0627\u0627\u0627\u0627\u0627", - ALIGN_RIGHT, - base::i18n::RIGHT_TO_LEFT}, + {u"\u0627\u0644\u0644\u063A\n" + u"\u0627\u0627\u0627\u0627\u0627\u0627\u0627\u0627", + ALIGN_RIGHT, base::i18n::RIGHT_TO_LEFT}, }; const int kGlyphSize = 5; RenderTextHarfBuzz* render_text = GetRenderText(); @@ -5899,7 +5862,7 @@ for (size_t i = 0; i < base::size(kTestStrings); ++i) { SCOPED_TRACE(testing::Message("kTestStrings[") << i << "] = " << kTestStrings[i].text); - render_text->SetText(UTF8ToUTF16(kTestStrings[i].text)); + render_text->SetText(kTestStrings[i].text); EXPECT_EQ(kTestStrings[i].display_text_direction, render_text->GetDisplayTextDirection()); render_text->Draw(canvas()); @@ -5908,9 +5871,9 @@ EXPECT_EQ(0, test_api()->GetAlignmentOffset(0).x()); EXPECT_EQ(0, test_api()->GetAlignmentOffset(1).x()); } else { - std::vector<std::u16string> lines = base::SplitString( - base::UTF8ToUTF16(kTestStrings[i].text), std::u16string(1, '\n'), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::u16string> lines = + base::SplitString(kTestStrings[i].text, std::u16string(1, '\n'), + base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); ASSERT_EQ(2u, lines.size()); // Sanity check the input string lengths match the glyph lengths. @@ -5970,36 +5933,46 @@ TEST_F(RenderTextTest, Multiline_LineBreakerBehavior) { const int kGlyphSize = 5; const struct { - const char* const text; + const char16_t* const text; const WordWrapBehavior behavior; const Range char_ranges[3]; } kTestScenarios[] = { - {"a single run", + {u"a single run", IGNORE_LONG_WORDS, {Range(0, 2), Range(2, 9), Range(9, 12)}}, // 3 words: "That's ", ""good". ", "aaa" and 7 runs: "That", "'", "s ", // """, "good", "". ", "aaa". They all mixed together. - {"That's \"good\". aaa", IGNORE_LONG_WORDS, + {u"That's \"good\". aaa", + IGNORE_LONG_WORDS, {Range(0, 7), Range(7, 15), Range(15, 18)}}, // Test "\"" should be put into a new line correctly. - {"a \"good\" one.", IGNORE_LONG_WORDS, + {u"a \"good\" one.", + IGNORE_LONG_WORDS, {Range(0, 2), Range(2, 9), Range(9, 13)}}, // Test for full-width space. - {"That's\u3000good.\u3000yyy", IGNORE_LONG_WORDS, + {u"That's\u3000good.\u3000yyy", + IGNORE_LONG_WORDS, {Range(0, 7), Range(7, 13), Range(13, 16)}}, - {"a single run", TRUNCATE_LONG_WORDS, + {u"a single run", + TRUNCATE_LONG_WORDS, {Range(0, 2), Range(2, 6), Range(9, 12)}}, - {"That's \"good\". aaa", TRUNCATE_LONG_WORDS, + {u"That's \"good\". aaa", + TRUNCATE_LONG_WORDS, {Range(0, 4), Range(7, 11), Range(15, 18)}}, - {"That's good. aaa", TRUNCATE_LONG_WORDS, + {u"That's good. aaa", + TRUNCATE_LONG_WORDS, {Range(0, 4), Range(7, 11), Range(13, 16)}}, - {"a \"good\" one.", TRUNCATE_LONG_WORDS, + {u"a \"good\" one.", + TRUNCATE_LONG_WORDS, {Range(0, 2), Range(2, 6), Range(9, 13)}}, - {"asingleword", WRAP_LONG_WORDS, + {u"asingleword", + WRAP_LONG_WORDS, {Range(0, 4), Range(4, 8), Range(8, 11)}}, - {"That's good", WRAP_LONG_WORDS, + {u"That's good", + WRAP_LONG_WORDS, {Range(0, 4), Range(4, 7), Range(7, 11)}}, - {"That's \"g\".", WRAP_LONG_WORDS, + {u"That's \"g\".", + WRAP_LONG_WORDS, {Range(0, 4), Range(4, 7), Range(7, 11)}}, }; @@ -6010,7 +5983,7 @@ for (size_t i = 0; i < base::size(kTestScenarios); ++i) { SCOPED_TRACE(base::StringPrintf("kTestStrings[%" PRIuS "]", i)); - render_text->SetText(UTF8ToUTF16(kTestScenarios[i].text)); + render_text->SetText(kTestScenarios[i].text); render_text->SetWordWrapBehavior(kTestScenarios[i].behavior); render_text->Draw(canvas()); @@ -6180,8 +6153,8 @@ } TEST_F(RenderTextTest, NewlineWithoutMultilineFlag) { - const char* kTestStrings[] = { - "abc\ndef", "a \n b ", "ab\n", "a\n\nb", "\nab", "\n", + const char16_t* kTestStrings[] = { + u"abc\ndef", u"a \n b ", u"ab\n", u"a\n\nb", u"\nab", u"\n", }; RenderText* render_text = GetRenderText(); @@ -6189,7 +6162,7 @@ for (size_t i = 0; i < base::size(kTestStrings); ++i) { SCOPED_TRACE(base::StringPrintf("kTestStrings[%" PRIuS "]", i)); - render_text->SetText(ASCIIToUTF16(kTestStrings[i])); + render_text->SetText(kTestStrings[i]); render_text->Draw(canvas()); EXPECT_EQ(1U, test_api()->lines().size()); @@ -6251,18 +6224,18 @@ // LTR languages and right-to-left for RTL languages). TEST_F(RenderTextTest, HarfBuzz_HorizontalPositions) { const struct { - const char* const text; + const char16_t* const text; const char* expected_runs; } kTestStrings[] = { - {"abc\u3042\u3044\u3046\u3048\u304A", "[0->2][3->7]"}, - {"\u062A\u0641\u0627\u062D\u05EA\u05E4\u05D5\u05D6", "[7<-4][3<-0]"}, + {u"abc\u3042\u3044\u3046\u3048\u304A", "[0->2][3->7]"}, + {u"\u062A\u0641\u0627\u062D\u05EA\u05E4וז", "[7<-4][3<-0]"}, }; RenderTextHarfBuzz* render_text = GetRenderText(); for (size_t i = 0; i < base::size(kTestStrings); ++i) { SCOPED_TRACE(base::StringPrintf("kTestStrings[%" PRIuS "]", i)); - render_text->SetText(UTF8ToUTF16(kTestStrings[i].text)); + render_text->SetText(kTestStrings[i].text); EXPECT_EQ(kTestStrings[i].expected_runs, GetRunListStructureString()); @@ -6355,13 +6328,13 @@ // Ensure that graphemes with multiple code points do not get split. TEST_F(RenderTextTest, HarfBuzz_SubglyphGraphemeCases) { - const char* cases[] = { + const char16_t* cases[] = { // Ä (A with combining umlaut), followed by a "B". - "A\u0308B", + u"A\u0308B", // कि (Devangari letter KA with vowel I), followed by an "a". - "\u0915\u093f\u0905", - // จำ (Thai charcters CHO CHAN and SARA AM, followed by Thai digit 0. - "\u0e08\u0e33\u0E50", + u"\u0915\u093f\u0905", + // จำ (Thai characters CHO CHAN and SARA AM, followed by Thai digit 0. + u"\u0e08\u0e33\u0E50", }; RenderTextHarfBuzz* render_text = GetRenderText(); @@ -6369,7 +6342,7 @@ for (size_t i = 0; i < base::size(cases); ++i) { SCOPED_TRACE(base::StringPrintf("Case %" PRIuS, i)); - std::u16string text = UTF8ToUTF16(cases[i]); + std::u16string text = cases[i]; render_text->SetText(text); const internal::TextRunList* run_list = GetHarfBuzzRunList(); ASSERT_EQ(1U, run_list->size()); @@ -6439,7 +6412,7 @@ TEST_F(RenderTextTest, HarfBuzz_RunDirection) { RenderTextHarfBuzz* render_text = GetRenderText(); - const std::u16string mixed = u"\u05D0\u05D11234\u05D2\u05D3abc"; + const std::u16string mixed = u"אב1234גדabc"; render_text->SetText(mixed); // Get the run list for both display directions. @@ -6454,9 +6427,9 @@ RenderTextHarfBuzz* render_text = GetRenderText(); // This string, unescaped (logical order): // www.אב.גד/הוabc/def?זח=טי - const std::u16string mixed = UTF8ToUTF16( - "www.\u05D0\u05D1.\u05D2\u05D3/\u05D4\u05D5" - "abc/def?\u05D6\u05D7=\u05D8\u05D9"); + const std::u16string mixed = + u"www.אב.גד/הו" + u"abc/def?זח=טי"; render_text->SetText(mixed); // Normal LTR text should treat URL syntax as weak (as per the normal Bidi @@ -6482,11 +6455,13 @@ // The ▶ (U+25B6) "play character" should break runs. http://crbug.com/278913 render_text->SetText(u"x\u25B6y"); - EXPECT_EQ(ToString16Vec({"x", "▶", "y"}), GetRunListStrings()); + EXPECT_EQ(std::vector<std::u16string>({u"x", u"▶", u"y"}), + GetRunListStrings()); EXPECT_EQ("[0][1][2]", GetRunListStructureString()); render_text->SetText(u"x \u25B6 y"); - EXPECT_EQ(ToString16Vec({"x", " ", "▶", " ", "y"}), GetRunListStrings()); + EXPECT_EQ(std::vector<std::u16string>({u"x", u" ", u"▶", u" ", u"y"}), + GetRunListStrings()); EXPECT_EQ("[0][1][2][3][4]", GetRunListStructureString()); } @@ -6497,13 +6472,15 @@ // drawn with color emoji fonts, so runs should be separated. crbug.com/448909 // Windows requires wide strings for \Unnnnnnnn universal character names. render_text->SetText(u"x\U0001F601y\u2728"); - EXPECT_EQ(ToString16Vec({"x", "😁", "y", "✨"}), GetRunListStrings()); + EXPECT_EQ(std::vector<std::u16string>({u"x", u"😁", u"y", u"✨"}), + GetRunListStrings()); // U+1F601 is represented as a surrogate pair in UTF-16. EXPECT_EQ("[0][1->2][3][4]", GetRunListStructureString()); // Ensure non-latin 「foo」 brackets around Emoji correctly break runs. render_text->SetText(u"「🦋」「"); - EXPECT_EQ(ToString16Vec({"「", "🦋", "」「"}), GetRunListStrings()); + EXPECT_EQ(std::vector<std::u16string>({u"「", u"🦋", u"」「"}), + GetRunListStrings()); // Note 🦋 is a surrogate pair [1->2]. EXPECT_EQ("[0][1->2][3->4]", GetRunListStructureString()); } @@ -6512,7 +6489,8 @@ RenderText* render_text = GetRenderText(); render_text->SetMultiline(true); render_text->SetText(u"x\ny"); - EXPECT_EQ(ToString16Vec({"x", "\n", "y"}), GetRunListStrings()); + EXPECT_EQ(std::vector<std::u16string>({u"x", u"\n", u"y"}), + GetRunListStrings()); EXPECT_EQ("[0][1][2]", GetRunListStructureString()); // Validate that the character newline is an unknown glyph @@ -6547,7 +6525,8 @@ // not break between the codepoints, or the incorrect glyph will be chosen. render_text->SetText(u"z\u260E\uFE0Fy"); render_text->SetDisplayRect(Rect(1000, 50)); - EXPECT_EQ(ToString16Vec({"z", "☎\uFE0F", "y"}), GetRunListStrings()); + EXPECT_EQ(std::vector<std::u16string>({u"z", u"☎\uFE0F", u"y"}), + GetRunListStrings()); EXPECT_EQ("[0][1->2][3]", GetRunListStructureString()); // Also test moving the cursor across the telephone. @@ -6588,7 +6567,7 @@ // It should never happen in normal usage, but a variation selector can appear // by itself. In this case, it can form its own text run, with no glyphs. render_text->SetText(u"\uFE0F"); - EXPECT_EQ(ToString16Vec({"\uFE0F"}), GetRunListStrings()); + EXPECT_EQ(std::vector<std::u16string>({u"\uFE0F"}), GetRunListStrings()); EXPECT_EQ("[0]", GetRunListStructureString()); CheckBoundsForCursorPositions(); } @@ -6604,7 +6583,7 @@ // cause the typesetter to render tofu in this case, but it should not break // a text run. render_text->SetText(u"z\uFE0Fy"); - EXPECT_EQ(ToString16Vec({"z\uFE0Fy"}), GetRunListStrings()); + EXPECT_EQ(std::vector<std::u16string>({u"z\uFE0Fy"}), GetRunListStrings()); EXPECT_EQ("[0->2]", GetRunListStructureString()); CheckBoundsForCursorPositions(); } @@ -6615,7 +6594,8 @@ // When a variation selector appears either side of an emoji, ensure the one // after is in the same run. render_text->SetText(u"\uFE0F\u260E\uFE0Fy"); - EXPECT_EQ(ToString16Vec({"\uFE0F", "☎\uFE0F", "y"}), GetRunListStrings()); + EXPECT_EQ(std::vector<std::u16string>({u"\uFE0F", u"☎\uFE0F", u"y"}), + GetRunListStrings()); EXPECT_EQ("[0][1->2][3]", GetRunListStructureString()); CheckBoundsForCursorPositions(); } @@ -6628,7 +6608,8 @@ // ultimately up to the typeface but, however it choses, cursor and glyph // positions should behave. render_text->SetText(u"z\u260E\uFE0F\uFE0Fy"); - EXPECT_EQ(ToString16Vec({"z", "☎\uFE0F\uFE0F", "y"}), GetRunListStrings()); + EXPECT_EQ(std::vector<std::u16string>({u"z", u"☎\uFE0F\uFE0F", u"y"}), + GetRunListStrings()); EXPECT_EQ("[0][1->3][4]", GetRunListStructureString()); CheckBoundsForCursorPositions(); } @@ -6639,7 +6620,8 @@ // Two emoji with variation selectors appearing in a correct sequence should // be in the same run. render_text->SetText(u"z\u260E\uFE0F\u260E\uFE0Fy"); - EXPECT_EQ(ToString16Vec({"z", "☎\uFE0F☎\uFE0F", "y"}), GetRunListStrings()); + EXPECT_EQ(std::vector<std::u16string>({u"z", u"☎\uFE0F☎\uFE0F", u"y"}), + GetRunListStrings()); EXPECT_EQ("[0][1->4][5]", GetRunListStructureString()); CheckBoundsForCursorPositions(); } @@ -6650,26 +6632,26 @@ // ▶ (U+25B6, Geometric Shapes) and an ascii character should have // different runs. render_text->SetText(u"▶z"); - EXPECT_EQ(ToString16Vec({"▶", "z"}), GetRunListStrings()); + EXPECT_EQ(std::vector<std::u16string>({u"▶", u"z"}), GetRunListStrings()); EXPECT_EQ("[0][1]", GetRunListStructureString()); // ★ (U+2605, Miscellaneous Symbols) and an ascii character should have // different runs. render_text->SetText(u"★1"); - EXPECT_EQ(ToString16Vec({"★", "1"}), GetRunListStrings()); + EXPECT_EQ(std::vector<std::u16string>({u"★", u"1"}), GetRunListStrings()); EXPECT_EQ("[0][1]", GetRunListStructureString()); // 🐱 (U+1F431, a cat face, Miscellaneous Symbols and Pictographs) and an // ASCII period should have separate runs. render_text->SetText(u"🐱."); - EXPECT_EQ(ToString16Vec({"🐱", "."}), GetRunListStrings()); + EXPECT_EQ(std::vector<std::u16string>({u"🐱", u"."}), GetRunListStrings()); // U+1F431 is represented as a surrogate pair in UTF-16. EXPECT_EQ("[0->1][2]", GetRunListStructureString()); // 🥴 (U+1f974, Supplemental Symbols and Pictographs) and an ascii character // should have different runs. render_text->SetText(u"🥴$"); - EXPECT_EQ(ToString16Vec({"🥴", "$"}), GetRunListStrings()); + EXPECT_EQ(std::vector<std::u16string>({u"🥴", u"$"}), GetRunListStrings()); EXPECT_EQ("[0->1][2]", GetRunListStructureString()); } @@ -6733,12 +6715,12 @@ } TEST_F(RenderTextTest, GlyphBounds) { - const char* kTestStrings[] = {"asdf 1234 qwer", "\u0647\u0654", - "\u0645\u0631\u062D\u0628\u0627"}; + const char16_t* kTestStrings[] = {u"asdf 1234 qwer", u"\u0647\u0654", + u"\u0645\u0631\u062D\u0628\u0627"}; RenderText* render_text = GetRenderText(); for (size_t i = 0; i < base::size(kTestStrings); ++i) { - render_text->SetText(UTF8ToUTF16(kTestStrings[i])); + render_text->SetText(kTestStrings[i]); for (size_t j = 0; j < render_text->text().length(); ++j) EXPECT_FALSE(render_text->GetCursorSpan(Range(j, j + 1)).is_empty()); @@ -6852,13 +6834,13 @@ // for different languages. TEST_F(RenderTextTest, HarfBuzz_FallbackFontsSupportGlyphs) { // The word 'test' in different languages. - static const wchar_t* kLanguageTests[] = { - L"test", L"اختبار", L"Δοκιμή", L"परीक्षा", L"تست", L"Փորձարկում", + static const char16_t* kLanguageTests[] = { + u"test", u"اختبار", u"Δοκιμή", u"परीक्षा", u"تست", u"Փորձարկում", }; - for (const wchar_t* text : kLanguageTests) { + for (const auto* text : kLanguageTests) { RenderTextHarfBuzz* render_text = GetRenderText(); - render_text->SetText(WideToUTF16(text)); + render_text->SetText(text); const internal::TextRunList* run_list = GetHarfBuzzRunList(); ASSERT_EQ(1U, run_list->size()); @@ -6873,15 +6855,15 @@ // Ensure that the fallback fonts offered by GetFallbackFont() support glyphs // for different languages. TEST_F(RenderTextTest, HarfBuzz_MultiRunsSupportGlyphs) { - static const wchar_t* kLanguageTests[] = { - L"www.اختبار.com", - L"(اختبار)", - L"/ זה (מבחן) /", + static const char16_t* kLanguageTests[] = { + u"www.اختبار.com", + u"(اختبار)", + u"/ זה (מבחן) /", }; - for (const wchar_t* text : kLanguageTests) { + for (const auto* text : kLanguageTests) { RenderTextHarfBuzz* render_text = GetRenderText(); - render_text->SetText(WideToUTF16(text)); + render_text->SetText(text); int missing_glyphs = 0; const internal::TextRunList* run_list = GetHarfBuzzRunList(); @@ -6897,7 +6879,7 @@ struct FallbackFontCase { const char* test_name; - const wchar_t* text; + const char16_t* text; }; class RenderTextTestWithFallbackFontCase @@ -6913,7 +6895,7 @@ TEST_P(RenderTextTestWithFallbackFontCase, FallbackFont) { FallbackFontCase param = GetParam(); RenderTextHarfBuzz* render_text = GetRenderText(); - render_text->SetText(WideToUTF16(param.text)); + render_text->SetText(param.text); int missing_glyphs = 0; const internal::TextRunList* run_list = GetHarfBuzzRunList(); @@ -6925,17 +6907,17 @@ const FallbackFontCase kUnicodeDecomposeCases[] = { // Decompose to "\u0041\u0300". - {"letter_A_with_grave", L"\u00c0"}, + {"letter_A_with_grave", u"\u00c0"}, // Decompose to "\u004f\u0328\u0304". - {"letter_O_with_ogonek_macron", L"\u01ec"}, + {"letter_O_with_ogonek_macron", u"\u01ec"}, // Decompose to "\u0041\u030a". - {"angstrom_sign", L"\u212b"}, + {"angstrom_sign", u"\u212b"}, // Decompose to "\u1100\u1164\u11b6". - {"hangul_syllable_gyaelh", L"\uac63"}, + {"hangul_syllable_gyaelh", u"\uac63"}, // Decompose to "\u1107\u1170\u11af". - {"hangul_syllable_bwel", L"\ubdc0"}, + {"hangul_syllable_bwel", u"\ubdc0"}, // Decompose to "\U00044039". - {"cjk_ideograph_fad4", L"\ufad4"}, + {"cjk_ideograph_fad4", u"\ufad4"}, }; INSTANTIATE_TEST_SUITE_P(FallbackFontUnicodeDecompose, @@ -6947,64 +6929,64 @@ // codepoint can be rendered by the font. An error here can be by an incorrect // ItemizeText(...) leading to an invalid fallback font. const FallbackFontCase kComplexTextCases[] = { - {"simple1", L"test"}, - {"simple2", L"اختبار"}, - {"simple3", L"Δοκιμή"}, - {"simple4", L"परीक्षा"}, - {"simple5", L"تست"}, - {"simple6", L"Փորձարկում"}, - {"mixed1", L"www.اختبار.com"}, - {"mixed2", L"(اختبار)"}, - {"mixed3", L"/ זה (מבחן) /"}, + {"simple1", u"test"}, + {"simple2", u"اختبار"}, + {"simple3", u"Δοκιμή"}, + {"simple4", u"परीक्षा"}, + {"simple5", u"تست"}, + {"simple6", u"Փորձարկում"}, + {"mixed1", u"www.اختبار.com"}, + {"mixed2", u"(اختبار)"}, + {"mixed3", u"/ זה (מבחן) /"}, #if defined(OS_WIN) - {"asc_arb", L"abcښڛڜdef"}, - {"devanagari", L"ञटठडढणतथ"}, - {"ethiopic", L"መጩጪᎅⶹⶼ"}, - {"greek", L"ξοπρς"}, - {"kannada", L"ಠಡಢಣತಥ"}, - {"lao", L"ປຝພຟມ"}, - {"oriya", L"ଔକଖଗଘଙ"}, - {"telugu_lat", L"aaఉయ!"}, - {"common_math", L"ℳ: ¬ƒ(x)=½×¾"}, - {"picto_title", L"☞☛test☚☜"}, - {"common_numbers", L"𝟭𝟐⒓¹²"}, - {"common_puncts", L",.!"}, - {"common_space_math1", L" 𝓐"}, - {"common_space_math2", L" 𝓉"}, - {"common_split_spaces", L"♬ 𝓐"}, - {"common_mixed", L"\U0001d4c9\u24d4\U0001d42c"}, - {"arrows", L"↰↱↲↳↴↵⇚⇛⇜⇝⇞⇟"}, - {"arrows_space", L"↰ ↱ ↲ ↳ ↴ ↵ ⇚ ⇛ ⇜ ⇝ ⇞ ⇟"}, - {"emoji_title", L"▶Feel goods"}, - {"enclosed_alpha", L"ⒶⒷⒸⒹⒺⒻⒼ"}, - {"shapes", L" ▶▷▸▹►▻◀◁◂◃◄◅"}, - {"symbols", L"☂☎☏☝☫☬☭☮☯"}, - {"symbols_space", L"☂ ☎ ☏ ☝ ☫ ☬ ☭ ☮ ☯"}, - {"dingbats", L"✂✃✄✆✇✈"}, - {"cjk_compatibility_ideographs", L"賈滑串句龜"}, - {"lat_dev_ZWNJ", L"a\u200Cक"}, - {"paren_picto", L"(☾☹☽)"}, - {"emoji1", L"This is 💩!"}, - {"emoji2", L"Look [🔝]"}, - {"strange1", L"💔♬ 𝓐 𝓉ⓔ𝐬т FỖ𝕣 c卄尺𝕆ᵐ€ ♘👹"}, - {"strange2", L"˜”*°•.˜”*°• A test for chrome •°*”˜.•°*”˜"}, - {"strange3", L"𝐭єⓢт fσ𝐑 𝔠ʰ𝕣ό𝐌𝔢"}, - {"strange4", L"тẸⓈ𝔱 𝔽𝕠ᖇ 𝕔𝐡ŕ𝔬ⓜẸ"}, - {"url1", L"http://www.google.com"}, - {"url2", L"http://www.nowhere.com/Lörick.html"}, - {"url3", L"http://www.nowhere.com/تسجيل الدخول"}, - {"url4", L"https://xyz.com:8080/تس(1)جيل الدخول"}, - {"url5", L"http://www.script.com/test.php?abc=42&cde=12&f=%20%20"}, - {"punct1", L"This‐is‑a‒test–for—punctuations"}, - {"punct2", L"⁅All ‷magic‴ comes with a ‶price″⁆"}, - {"punct3", L"⍟ Complete my sentence… †"}, - {"parens", L"❝This❞ 「test」 has ((a)) 【lot】 [{of}] 〚parentheses〛"}, - {"games", L"Let play: ♗♘⚀⚁♠♣"}, - {"braille", L"⠞⠑⠎⠞ ⠋⠕⠗ ⠉⠓⠗⠕⠍⠑"}, - {"emoticon1", L"¯\\_(ツ)_/¯"}, - {"emoticon2", L"٩(⁎❛ᴗ❛⁎)۶"}, - {"emoticon3", L"(͡° ͜ʖ ͡°)"}, - {"emoticon4", L"[̲̅$̲̅(̲̅5̲̅)̲̅$̲̅]"}, + {"asc_arb", u"abcښڛڜdef"}, + {"devanagari", u"ञटठडढणतथ"}, + {"ethiopic", u"መጩጪᎅⶹⶼ"}, + {"greek", u"ξοπρς"}, + {"kannada", u"ಠಡಢಣತಥ"}, + {"lao", u"ປຝພຟມ"}, + {"oriya", u"ଔକଖଗଘଙ"}, + {"telugu_lat", u"aaఉయ!"}, + {"common_math", u"ℳ: ¬ƒ(x)=½×¾"}, + {"picto_title", u"☞☛test☚☜"}, + {"common_numbers", u"𝟭𝟐⒓¹²"}, + {"common_puncts", u",.!"}, + {"common_space_math1", u" 𝓐"}, + {"common_space_math2", u" 𝓉"}, + {"common_split_spaces", u"♬ 𝓐"}, + {"common_mixed", u"\U0001d4c9\u24d4\U0001d42c"}, + {"arrows", u"↰↱↲↳↴↵⇚⇛⇜⇝⇞⇟"}, + {"arrows_space", u"↰ ↱ ↲ ↳ ↴ ↵ ⇚ ⇛ ⇜ ⇝ ⇞ ⇟"}, + {"emoji_title", u"▶Feel goods"}, + {"enclosed_alpha", u"ⒶⒷⒸⒹⒺⒻⒼ"}, + {"shapes", u" ▶▷▸▹►▻◀◁◂◃◄◅"}, + {"symbols", u"☂☎☏☝☫☬☭☮☯"}, + {"symbols_space", u"☂ ☎ ☏ ☝ ☫ ☬ ☭ ☮ ☯"}, + {"dingbats", u"✂✃✄✆✇✈"}, + {"cjk_compatibility_ideographs", u"賈滑串句龜"}, + {"lat_dev_ZWNJ", u"a\u200Cक"}, + {"paren_picto", u"(☾☹☽)"}, + {"emoji1", u"This is 💩!"}, + {"emoji2", u"Look [🔝]"}, + {"strange1", u"💔♬ 𝓐 𝓉ⓔ𝐬т FỖ𝕣 c卄尺𝕆ᵐ€ ♘👹"}, + {"strange2", u"˜”*°•.˜”*°• A test for chrome •°*”˜.•°*”˜"}, + {"strange3", u"𝐭єⓢт fσ𝐑 𝔠ʰ𝕣ό𝐌𝔢"}, + {"strange4", u"тẸⓈ𝔱 𝔽𝕠ᖇ 𝕔𝐡ŕ𝔬ⓜẸ"}, + {"url1", u"http://www.google.com"}, + {"url2", u"http://www.nowhere.com/Lörick.html"}, + {"url3", u"http://www.nowhere.com/تسجيل الدخول"}, + {"url4", u"https://xyz.com:8080/تس(1)جيل الدخول"}, + {"url5", u"http://www.script.com/test.php?abc=42&cde=12&f=%20%20"}, + {"punct1", u"This‐is‑a‒test–for—punctuations"}, + {"punct2", u"⁅All ‷magic‴ comes with a ‶price″⁆"}, + {"punct3", u"⍟ Complete my sentence… †"}, + {"parens", u"❝This❞ 「test」 has ((a)) 【lot】 [{of}] 〚parentheses〛"}, + {"games", u"Let play: ♗♘⚀⚁♠♣"}, + {"braille", u"⠞⠑⠎⠞ ⠋⠕⠗ ⠉⠓⠗⠕⠍⠑"}, + {"emoticon1", u"¯\\_(ツ)_/¯"}, + {"emoticon2", u"٩(⁎❛ᴗ❛⁎)۶"}, + {"emoticon3", u"(͡° ͜ʖ ͡°)"}, + {"emoticon4", u"[̲̅$̲̅(̲̅5̲̅)̲̅$̲̅]"}, #endif }; @@ -7019,110 +7001,110 @@ const FallbackFontCase kCommonScriptCases[] = { #if defined(OS_WIN) // The following tests are made to work on win7 and win10. - {"common00", L"\u237b\u2ac1\u24f5\u259f\u2a87\u23ea\u25d4\u2220"}, - {"common01", L"\u2303\u2074\u2988\u32b6\u26a2\u24e5\u2a53\u2219"}, - {"common02", L"\u29b2\u25fc\u2366\u24ae\u2647\u258e\u2654\u25fe"}, - {"common03", L"\u21ea\u22b4\u29b0\u2a84\u0008\u2657\u2731\u2697"}, - {"common04", L"\u2b3c\u2932\u21c8\u23cf\u20a1\u2aa2\u2344\u0011"}, - {"common05", L"\u22c3\u2a56\u2340\u21b7\u26ba\u2798\u220f\u2404"}, - {"common06", L"\u21f9\u25fd\u008e\u21e6\u2686\u21e4\u259f\u29ee"}, - {"common07", L"\u231e\ufe39\u0008\u2349\u2262\u2270\uff09\u2b3b"}, - {"common08", L"\u24a3\u236e\u29b2\u2259\u26ea\u2705\u00ae\u2a23"}, - {"common09", L"\u33bd\u235e\u2018\u32ba\u2973\u02c1\u20b9\u25b4"}, - {"common10", L"\u2245\u2a4d\uff19\u2042\u2aa9\u2658\u276e\uff40"}, - {"common11", L"\u0007\u21b4\u23c9\u2593\u21ba\u00a0\u258f\u23b3"}, - {"common12", L"\u2938\u250c\u2240\u2676\u2297\u2b07\u237e\u2a04"}, - {"common13", L"\u2520\u233a\u20a5\u2744\u2445\u268a\u2716\ufe62"}, - {"common14", L"\ufe4d\u25d5\u2ae1\u2a35\u2323\u273c\u26be\u2a3b"}, - {"common15", L"\u2aa2\u0000\ufe65\u2962\u2573\u21f8\u2651\u02d2"}, - {"common16", L"\u225c\u2283\u2960\u4de7\uff12\uffe1\u0016\u2905"}, - {"common17", L"\uff07\u25aa\u2076\u259e\u226c\u2568\u0026\u2691"}, - {"common18", L"\u2388\u21c2\u208d\u2a7f\u22d0\u2583\u2ad5\u240f"}, - {"common19", L"\u230a\u27ac\u001e\u261e\u259d\u25c3\u33a5\u0011"}, - {"common20", L"\ufe54\u29c7\u2477\u21ed\u2069\u4dfc\u2ae2\u21e8"}, - {"common21", L"\u2131\u2ab7\u23b9\u2660\u2083\u24c7\u228d\u2a01"}, - {"common22", L"\u2587\u2572\u21df\uff3c\u02cd\ufffd\u2404\u22b3"}, - {"common23", L"\u4dc3\u02fe\uff09\u25a3\ufe14\u255c\u2128\u2698"}, - {"common24", L"\u2b36\u3382\u02f6\u2752\uff16\u22cf\u00b0\u21d6"}, - {"common25", L"\u2561\u23db\u2958\u2782\u22af\u2621\u24a3\u29ae"}, - {"common26", L"\u2693\u22e2\u2988\u2987\u33ba\u2a94\u298e\u2328"}, - {"common27", L"\u266c\u2aa5\u2405\uffeb\uff5c\u2902\u291e\u02e6"}, - {"common28", L"\u2634\u32b2\u3385\u2032\u33be\u2366\u2ac7\u23cf"}, - {"common29", L"\u2981\ua721\u25a9\u2320\u21cf\u295a\u2273\u2ac2"}, - {"common30", L"\u22d9\u2465\u2347\u2a94\u4dca\u2389\u23b0\u208d"}, - {"common31", L"\u21cc\u2af8\u2912\u23a4\u2271\u2303\u241e\u33a1"}, + {"common00", u"\u237b\u2ac1\u24f5\u259f\u2a87\u23ea\u25d4\u2220"}, + {"common01", u"\u2303\u2074\u2988\u32b6\u26a2\u24e5\u2a53\u2219"}, + {"common02", u"\u29b2\u25fc\u2366\u24ae\u2647\u258e\u2654\u25fe"}, + {"common03", u"\u21ea\u22b4\u29b0\u2a84\u0008\u2657\u2731\u2697"}, + {"common04", u"\u2b3c\u2932\u21c8\u23cf\u20a1\u2aa2\u2344\u0011"}, + {"common05", u"\u22c3\u2a56\u2340\u21b7\u26ba\u2798\u220f\u2404"}, + {"common06", u"\u21f9\u25fd\u008e\u21e6\u2686\u21e4\u259f\u29ee"}, + {"common07", u"\u231e\ufe39\u0008\u2349\u2262\u2270\uff09\u2b3b"}, + {"common08", u"\u24a3\u236e\u29b2\u2259\u26ea\u2705\u00ae\u2a23"}, + {"common09", u"\u33bd\u235e\u2018\u32ba\u2973\u02c1\u20b9\u25b4"}, + {"common10", u"\u2245\u2a4d\uff19\u2042\u2aa9\u2658\u276e\uff40"}, + {"common11", u"\u0007\u21b4\u23c9\u2593\u21ba\u00a0\u258f\u23b3"}, + {"common12", u"\u2938\u250c\u2240\u2676\u2297\u2b07\u237e\u2a04"}, + {"common13", u"\u2520\u233a\u20a5\u2744\u2445\u268a\u2716\ufe62"}, + {"common14", u"\ufe4d\u25d5\u2ae1\u2a35\u2323\u273c\u26be\u2a3b"}, + {"common15", u"\u2aa2\u0000\ufe65\u2962\u2573\u21f8\u2651\u02d2"}, + {"common16", u"\u225c\u2283\u2960\u4de7\uff12\uffe1\u0016\u2905"}, + {"common17", u"\uff07\u25aa\u2076\u259e\u226c\u2568\u0026\u2691"}, + {"common18", u"\u2388\u21c2\u208d\u2a7f\u22d0\u2583\u2ad5\u240f"}, + {"common19", u"\u230a\u27ac\u001e\u261e\u259d\u25c3\u33a5\u0011"}, + {"common20", u"\ufe54\u29c7\u2477\u21ed\u2069\u4dfc\u2ae2\u21e8"}, + {"common21", u"\u2131\u2ab7\u23b9\u2660\u2083\u24c7\u228d\u2a01"}, + {"common22", u"\u2587\u2572\u21df\uff3c\u02cd\ufffd\u2404\u22b3"}, + {"common23", u"\u4dc3\u02fe\uff09\u25a3\ufe14\u255c\u2128\u2698"}, + {"common24", u"\u2b36\u3382\u02f6\u2752\uff16\u22cf\u00b0\u21d6"}, + {"common25", u"\u2561\u23db\u2958\u2782\u22af\u2621\u24a3\u29ae"}, + {"common26", u"\u2693\u22e2\u2988\u2987\u33ba\u2a94\u298e\u2328"}, + {"common27", u"\u266c\u2aa5\u2405\uffeb\uff5c\u2902\u291e\u02e6"}, + {"common28", u"\u2634\u32b2\u3385\u2032\u33be\u2366\u2ac7\u23cf"}, + {"common29", u"\u2981\ua721\u25a9\u2320\u21cf\u295a\u2273\u2ac2"}, + {"common30", u"\u22d9\u2465\u2347\u2a94\u4dca\u2389\u23b0\u208d"}, + {"common31", u"\u21cc\u2af8\u2912\u23a4\u2271\u2303\u241e\u33a1"}, #elif defined(OS_ANDROID) - {"common00", L"\u2497\uff04\u277c\u21b6\u2076\u21e4\u2068\u21b3"}, - {"common01", L"\u2663\u2466\u338e\u226b\u2734\u21be\u3389\u00ab"}, - {"common02", L"\u2062\u2197\u3392\u2681\u33be\u206d\ufe10\ufe34"}, - {"common03", L"\u02db\u00b0\u02d3\u2745\u33d1\u21e4\u24e4\u33d6"}, - {"common04", L"\u21da\u261f\u26a1\u2586\u27af\u2560\u21cd\u25c6"}, - {"common05", L"\ufe51\uff17\u0027\u21fd\u24de\uff5e\u2606\u251f"}, - {"common06", L"\u2493\u2466\u21fc\u226f\u202d\u21a9\u0040\u265d"}, - {"common07", L"\u2103\u255a\u2153\u26be\u27ac\u222e\u2490\u21a4"}, - {"common08", L"\u270b\u2486\u246b\u263c\u27b6\u21d9\u219d\u25a9"}, - {"common09", L"\u002d\u2494\u25fd\u2321\u2111\u2511\u00d7\u2535"}, - {"common10", L"\u2523\u203e\u25b2\ufe18\u2499\u2229\ufd3e\ufe16"}, - {"common11", L"\u2133\u2716\u273f\u2064\u2248\u005c\u265f\u21e6"}, - {"common12", L"\u2060\u246a\u231b\u2726\u25bd\ufe40\u002e\u25ca"}, - {"common13", L"\ufe39\u24a2\ufe18\u254b\u249c\u3396\ua71f\u2466"}, - {"common14", L"\u21b8\u2236\u251a\uff11\u2077\u0035\u27bd\u2013"}, - {"common15", L"\u2668\u2551\u221a\u02bc\u2741\u2649\u2192\u00a1"}, - {"common16", L"\u2211\u21ca\u24dc\u2536\u201b\u21c8\u2530\u25fb"}, - {"common17", L"\u231a\u33d8\u2934\u27bb\u2109\u23ec\u20a9\u3000"}, - {"common18", L"\u2069\u205f\u33d3\u2466\u24a1\u24dd\u21ac\u21e3"}, - {"common19", L"\u2737\u219a\u21f1\u2285\u226a\u00b0\u27b2\u2746"}, - {"common20", L"\u264f\u2539\u2202\u264e\u2548\u2530\u2111\u2007"}, - {"common21", L"\u2799\u0035\u25e4\u265b\u24e2\u2044\u222b\u0021"}, - {"common22", L"\u2728\u00a2\u2533\ufe43\u33c9\u27a2\u02f9\u005d"}, - {"common23", L"\ufe68\u256c\u25b6\u276c\u2771\u33c4\u2712\u24b3"}, - {"common24", L"\ufe5d\ufe31\ufe3d\u205e\u2512\u33b8\u272b\ufe4f"}, - {"common25", L"\u24e7\u25fc\u2582\u2743\u2010\u2474\u2262\u251a"}, - {"common26", L"\u2020\u211c\u24b4\u33c7\u2007\uff0f\u267f\u00b4"}, - {"common27", L"\u266c\u3399\u2570\u33a4\u276e\u00a8\u2506\u24dc"}, - {"common28", L"\u2202\ufe43\u2511\u2191\u339a\u33b0\u02d7\u2473"}, - {"common29", L"\u2517\u2297\u2762\u2460\u25bd\u24a9\u21a7\ufe64"}, - {"common30", L"\u2105\u2722\u275d\u249c\u21a2\u2590\u2260\uff5d"}, - {"common31", L"\u33ba\u21c6\u2706\u02cb\ufe64\u02e6\u0374\u2493"}, + {"common00", u"\u2497\uff04\u277c\u21b6\u2076\u21e4\u2068\u21b3"}, + {"common01", u"\u2663\u2466\u338e\u226b\u2734\u21be\u3389\u00ab"}, + {"common02", u"\u2062\u2197\u3392\u2681\u33be\u206d\ufe10\ufe34"}, + {"common03", u"\u02db\u00b0\u02d3\u2745\u33d1\u21e4\u24e4\u33d6"}, + {"common04", u"\u21da\u261f\u26a1\u2586\u27af\u2560\u21cd\u25c6"}, + {"common05", u"\ufe51\uff17\u0027\u21fd\u24de\uff5e\u2606\u251f"}, + {"common06", u"\u2493\u2466\u21fc\u226f\u202d\u21a9\u0040\u265d"}, + {"common07", u"\u2103\u255a\u2153\u26be\u27ac\u222e\u2490\u21a4"}, + {"common08", u"\u270b\u2486\u246b\u263c\u27b6\u21d9\u219d\u25a9"}, + {"common09", u"\u002d\u2494\u25fd\u2321\u2111\u2511\u00d7\u2535"}, + {"common10", u"\u2523\u203e\u25b2\ufe18\u2499\u2229\ufd3e\ufe16"}, + {"common11", u"\u2133\u2716\u273f\u2064\u2248\u005c\u265f\u21e6"}, + {"common12", u"\u2060\u246a\u231b\u2726\u25bd\ufe40\u002e\u25ca"}, + {"common13", u"\ufe39\u24a2\ufe18\u254b\u249c\u3396\ua71f\u2466"}, + {"common14", u"\u21b8\u2236\u251a\uff11\u2077\u0035\u27bd\u2013"}, + {"common15", u"\u2668\u2551\u221a\u02bc\u2741\u2649\u2192\u00a1"}, + {"common16", u"\u2211\u21ca\u24dc\u2536\u201b\u21c8\u2530\u25fb"}, + {"common17", u"\u231a\u33d8\u2934\u27bb\u2109\u23ec\u20a9\u3000"}, + {"common18", u"\u2069\u205f\u33d3\u2466\u24a1\u24dd\u21ac\u21e3"}, + {"common19", u"\u2737\u219a\u21f1\u2285\u226a\u00b0\u27b2\u2746"}, + {"common20", u"\u264f\u2539\u2202\u264e\u2548\u2530\u2111\u2007"}, + {"common21", u"\u2799\u0035\u25e4\u265b\u24e2\u2044\u222b\u0021"}, + {"common22", u"\u2728\u00a2\u2533\ufe43\u33c9\u27a2\u02f9\u005d"}, + {"common23", u"\ufe68\u256c\u25b6\u276c\u2771\u33c4\u2712\u24b3"}, + {"common24", u"\ufe5d\ufe31\ufe3d\u205e\u2512\u33b8\u272b\ufe4f"}, + {"common25", u"\u24e7\u25fc\u2582\u2743\u2010\u2474\u2262\u251a"}, + {"common26", u"\u2020\u211c\u24b4\u33c7\u2007\uff0f\u267f\u00b4"}, + {"common27", u"\u266c\u3399\u2570\u33a4\u276e\u00a8\u2506\u24dc"}, + {"common28", u"\u2202\ufe43\u2511\u2191\u339a\u33b0\u02d7\u2473"}, + {"common29", u"\u2517\u2297\u2762\u2460\u25bd\u24a9\u21a7\ufe64"}, + {"common30", u"\u2105\u2722\u275d\u249c\u21a2\u2590\u2260\uff5d"}, + {"common31", u"\u33ba\u21c6\u2706\u02cb\ufe64\u02e6\u0374\u2493"}, #elif defined(OS_APPLE) - {"common00", L"\u2153\u24e0\u2109\u02f0\u2a8f\u25ed\u02c5\u2716"}, - {"common01", L"\u02f0\u208c\u2203\u2518\u2067\u2270\u21f1\ufe66"}, - {"common02", L"\u2686\u2585\u2b15\u246f\u23e3\u21b4\u2394\ufe31"}, - {"common03", L"\u23c1\u2a97\u201e\u2200\u3389\u25d3\u02c2\u259d"}, + {"common00", u"\u2153\u24e0\u2109\u02f0\u2a8f\u25ed\u02c5\u2716"}, + {"common01", u"\u02f0\u208c\u2203\u2518\u2067\u2270\u21f1\ufe66"}, + {"common02", u"\u2686\u2585\u2b15\u246f\u23e3\u21b4\u2394\ufe31"}, + {"common03", u"\u23c1\u2a97\u201e\u2200\u3389\u25d3\u02c2\u259d"}, #else // The following tests are made for the mock fonts (see test_fonts). - {"common00", L"\u2153\u24e0\u2109\u02f0\u2a8f\u25ed\u02c5\u2716"}, - {"common01", L"\u02f0\u208c\u2203\u2518\u2067\u2270\u21f1\ufe66"}, - {"common02", L"\u2686\u2585\u2b15\u246f\u23e3\u21b4\u2394\ufe31"}, - {"common03", L"\u23c1\u2a97\u201e\u2200\u3389\u25d3\u02c2\u259d"}, - {"common04", L"\u2075\u4dec\u252a\uff15\u4df6\u2668\u27fa\ufe17"}, - {"common05", L"\u260b\u2049\u3036\u2a85\u2b15\u23c7\u230a\u2374"}, - {"common06", L"\u2771\u27fa\u255d\uff0b\u2213\u3396\u2a85\u2276"}, - {"common07", L"\u211e\u2b06\u2255\u2727\u26c3\u33cf\u267d\u2ab2"}, - {"common08", L"\u2373\u20b3\u22b8\u2a0f\u02fd\u2585\u3036\ufe48"}, - {"common09", L"\u256d\u2940\u21d8\u4dde\u23a1\u226b\u3374\u2a99"}, - {"common10", L"\u270f\u24e5\u26c1\u2131\u21f5\u25af\u230f\u27fe"}, - {"common11", L"\u27aa\u23a2\u02ef\u2373\u2257\u2749\u2496\ufe31"}, - {"common12", L"\u230a\u25fb\u2117\u3386\u32cc\u21c5\u24c4\u207e"}, - {"common13", L"\u2467\u2791\u3393\u33bb\u02ca\u25de\ua788\u278f"}, - {"common14", L"\ua719\u25ed\u20a8\u20a1\u4dd8\u2295\u24eb\u02c8"}, - {"common15", L"\u22b6\u2520\u2036\uffee\u21df\u002d\u277a\u2b24"}, - {"common16", L"\u21f8\u211b\u22a0\u25b6\u263e\u2704\u221a\u2758"}, - {"common17", L"\ufe10\u2060\u24ac\u3385\u27a1\u2059\u2689\u2278"}, - {"common18", L"\u269b\u211b\u33a4\ufe36\u239e\u267f\u2423\u24a2"}, - {"common19", L"\u4ded\u262d\u225e\u248b\u21df\u279d\u2518\u21ba"}, - {"common20", L"\u225a\uff16\u21d4\u21c6\u02ba\u2545\u23aa\u005e"}, - {"common21", L"\u20a5\u265e\u3395\u2a6a\u2555\u22a4\u2086\u23aa"}, - {"common22", L"\u203f\u3250\u2240\u24e9\u21cb\u258f\u24b1\u3259"}, - {"common23", L"\u27bd\u263b\uff1f\u2199\u2547\u258d\u201f\u2507"}, - {"common24", L"\u2482\u2548\u02dc\u231f\u24cd\u2198\u220e\u20ad"}, - {"common25", L"\u2ff7\u2540\ufe48\u2197\u276b\u2574\u2062\u3398"}, - {"common26", L"\u2663\u21cd\u263f\u23e5\u22d7\u2518\u21b9\u2628"}, - {"common27", L"\u21fa\ufe66\u2739\u2051\u21f4\u3399\u2599\u25f7"}, - {"common28", L"\u29d3\u25ec\u27a6\u24e0\u2735\u25b4\u2737\u25db"}, - {"common29", L"\u2622\u22e8\u33d2\u21d3\u2502\u2153\u2669\u25f2"}, - {"common30", L"\u2121\u21af\u2729\u203c\u337a\u2464\u2b08\u2e24"}, - {"common31", L"\u33cd\u007b\u02d2\u22cc\u32be\u2ffa\u2787\u02e9"}, + {"common00", u"\u2153\u24e0\u2109\u02f0\u2a8f\u25ed\u02c5\u2716"}, + {"common01", u"\u02f0\u208c\u2203\u2518\u2067\u2270\u21f1\ufe66"}, + {"common02", u"\u2686\u2585\u2b15\u246f\u23e3\u21b4\u2394\ufe31"}, + {"common03", u"\u23c1\u2a97\u201e\u2200\u3389\u25d3\u02c2\u259d"}, + {"common04", u"\u2075\u4dec\u252a\uff15\u4df6\u2668\u27fa\ufe17"}, + {"common05", u"\u260b\u2049\u3036\u2a85\u2b15\u23c7\u230a\u2374"}, + {"common06", u"\u2771\u27fa\u255d\uff0b\u2213\u3396\u2a85\u2276"}, + {"common07", u"\u211e\u2b06\u2255\u2727\u26c3\u33cf\u267d\u2ab2"}, + {"common08", u"\u2373\u20b3\u22b8\u2a0f\u02fd\u2585\u3036\ufe48"}, + {"common09", u"\u256d\u2940\u21d8\u4dde\u23a1\u226b\u3374\u2a99"}, + {"common10", u"\u270f\u24e5\u26c1\u2131\u21f5\u25af\u230f\u27fe"}, + {"common11", u"\u27aa\u23a2\u02ef\u2373\u2257\u2749\u2496\ufe31"}, + {"common12", u"\u230a\u25fb\u2117\u3386\u32cc\u21c5\u24c4\u207e"}, + {"common13", u"\u2467\u2791\u3393\u33bb\u02ca\u25de\ua788\u278f"}, + {"common14", u"\ua719\u25ed\u20a8\u20a1\u4dd8\u2295\u24eb\u02c8"}, + {"common15", u"\u22b6\u2520\u2036\uffee\u21df\u002d\u277a\u2b24"}, + {"common16", u"\u21f8\u211b\u22a0\u25b6\u263e\u2704\u221a\u2758"}, + {"common17", u"\ufe10\u2060\u24ac\u3385\u27a1\u2059\u2689\u2278"}, + {"common18", u"\u269b\u211b\u33a4\ufe36\u239e\u267f\u2423\u24a2"}, + {"common19", u"\u4ded\u262d\u225e\u248b\u21df\u279d\u2518\u21ba"}, + {"common20", u"\u225a\uff16\u21d4\u21c6\u02ba\u2545\u23aa\u005e"}, + {"common21", u"\u20a5\u265e\u3395\u2a6a\u2555\u22a4\u2086\u23aa"}, + {"common22", u"\u203f\u3250\u2240\u24e9\u21cb\u258f\u24b1\u3259"}, + {"common23", u"\u27bd\u263b\uff1f\u2199\u2547\u258d\u201f\u2507"}, + {"common24", u"\u2482\u2548\u02dc\u231f\u24cd\u2198\u220e\u20ad"}, + {"common25", u"\u2ff7\u2540\ufe48\u2197\u276b\u2574\u2062\u3398"}, + {"common26", u"\u2663\u21cd\u263f\u23e5\u22d7\u2518\u21b9\u2628"}, + {"common27", u"\u21fa\ufe66\u2739\u2051\u21f4\u3399\u2599\u25f7"}, + {"common28", u"\u29d3\u25ec\u27a6\u24e0\u2735\u25b4\u2737\u25db"}, + {"common29", u"\u2622\u22e8\u33d2\u21d3\u2502\u2153\u2669\u25f2"}, + {"common30", u"\u2121\u21af\u2729\u203c\u337a\u2464\u2b08\u2e24"}, + {"common31", u"\u33cd\u007b\u02d2\u22cc\u32be\u2ffa\u2787\u02e9"}, #endif }; @@ -7175,16 +7157,16 @@ } TEST_F(RenderTextTest, ZeroWidthCharacters) { - static const wchar_t* kEmptyText[] = { - L"\u200C", // ZERO WIDTH NON-JOINER - L"\u200D", // ZERO WIDTH JOINER - L"\u200B", // ZERO WIDTH SPACE - L"\uFEFF", // ZERO WIDTH NO-BREAK SPACE + static const char16_t* kEmptyText[] = { + u"\u200C", // ZERO WIDTH NON-JOINER + u"\u200D", // ZERO WIDTH JOINER + u"\u200B", // ZERO WIDTH SPACE + u"\uFEFF", // ZERO WIDTH NO-BREAK SPACE }; - for (const wchar_t* text : kEmptyText) { + for (const auto* text : kEmptyText) { RenderTextHarfBuzz* render_text = GetRenderText(); - render_text->SetText(WideToUTF16(text)); + render_text->SetText(text); const internal::TextRunList* run_list = GetHarfBuzzRunList(); EXPECT_EQ(0, run_list->width()); @@ -7202,10 +7184,8 @@ // crbug.com/459812. This appears to be a preexisting issue that wasn't // revealed by the prior unit tests. // "TEST_______", - "TEST some stuff", "WWWWWWWWWW", "gAXAXAXAXAXAXA", - "g\u00C5X\u00C5X\u00C5X\u00C5X\u00C5X\u00C5X\u00C5", - ("\u0647\u0654\u0647\u0654\u0647\u0654\u0647\u0654\u0645\u0631\u062D" - "\u0628\u0627")}; + "TEST some stuff", "WWWWWWWWWW", "gAXAXAXAXAXAXA", "gÅXÅXÅXÅXÅXÅXÅ", + "هٔهٔهٔهٔمرحبا"}; const Size kCanvasSize(300, 50); const int kTestSize = 10; @@ -7220,7 +7200,7 @@ for (auto* string : kTestStrings) { paint_canvas.clear(SK_ColorWHITE); - render_text->SetText(UTF8ToUTF16(string)); + render_text->SetText(base::UTF8ToUTF16(string)); render_text->ApplyBaselineStyle(SUPERSCRIPT, Range(1, 2)); render_text->ApplyBaselineStyle(SUPERIOR, Range(3, 4)); render_text->ApplyBaselineStyle(INFERIOR, Range(5, 6)); @@ -7291,7 +7271,7 @@ for (auto* string : kTestStrings) { paint_canvas.clear(SK_ColorWHITE); - render_text->SetText(UTF8ToUTF16(string)); + render_text->SetText(base::UTF8ToUTF16(string)); const Size string_size = render_text->GetStringSize(); int fake_width = string_size.width() / 2; int fake_height = string_size.height() / 2; @@ -7798,37 +7778,37 @@ // Tests text selection made at end points of individual lines of multiline // text. TEST_F(RenderTextTest, LineEndSelections) { - const char* const ltr = "abc\n\ndef"; - const char* const rtl = "שנב\n\nגקכ"; - const char* const ltr_single = "abc def ghi"; - const char* const rtl_single = "שנב גקכ עין"; + const char16_t* const ltr = u"abc\n\ndef"; + const char16_t* const rtl = u"שנב\n\nגקכ"; + const char16_t* const ltr_single = u"abc def ghi"; + const char16_t* const rtl_single = u"שנב גקכ עין"; const int left_x = -100; const int right_x = 200; struct { - const char* const text; + const char16_t* const text; const int line_num; const int x; - const char* const selected_text; + const char16_t* const selected_text; } cases[] = { - {ltr, 1, left_x, "abc\n"}, - {ltr, 1, right_x, "abc\n"}, - {ltr, 2, left_x, "abc\n\n"}, + {ltr, 1, left_x, u"abc\n"}, + {ltr, 1, right_x, u"abc\n"}, + {ltr, 2, left_x, u"abc\n\n"}, {ltr, 2, right_x, ltr}, - {rtl, 1, left_x, "שנב\n"}, - {rtl, 1, right_x, "שנב\n"}, + {rtl, 1, left_x, u"שנב\n"}, + {rtl, 1, right_x, u"שנב\n"}, {rtl, 2, left_x, rtl}, - {rtl, 2, right_x, "שנב\n\n"}, + {rtl, 2, right_x, u"שנב\n\n"}, - {ltr_single, 1, left_x, "abc "}, - {ltr_single, 1, right_x, "abc def "}, - {ltr_single, 2, left_x, "abc def "}, + {ltr_single, 1, left_x, u"abc "}, + {ltr_single, 1, right_x, u"abc def "}, + {ltr_single, 2, left_x, u"abc def "}, {ltr_single, 2, right_x, ltr_single}, - {rtl_single, 1, left_x, "שנב גקכ "}, - {rtl_single, 1, right_x, "שנב "}, + {rtl_single, 1, left_x, u"שנב גקכ "}, + {rtl_single, 1, right_x, u"שנב "}, {rtl_single, 2, left_x, rtl_single}, - {rtl_single, 2, right_x, "שנב גקכ "}, + {rtl_single, 2, right_x, u"שנב גקכ "}, }; SetGlyphWidth(5); @@ -7838,7 +7818,7 @@ for (size_t i = 0; i < base::size(cases); i++) { SCOPED_TRACE(base::StringPrintf("Testing case %" PRIuS "", i)); - render_text->SetText(UTF8ToUTF16(cases[i].text)); + render_text->SetText(cases[i].text); EXPECT_EQ(3u, render_text->GetNumLines()); // Position the cursor at the logical beginning of text. @@ -7846,8 +7826,7 @@ render_text->MoveCursorToPoint( Point(cases[i].x, GetCursorYForTesting(cases[i].line_num)), true); - EXPECT_EQ(UTF8ToUTF16(cases[i].selected_text), - GetSelectedText(render_text)); + EXPECT_EQ(cases[i].selected_text, GetSelectedText(render_text)); } } @@ -8263,7 +8242,8 @@ const int test_font_size_override = default_font_size + 5; render_text->SetText(u"0123456789"); render_text->ApplyFontSizeOverride(test_font_size_override, gfx::Range(3, 7)); - EXPECT_EQ(ToString16Vec({"012", "3456", "789"}), GetRunListStrings()); + EXPECT_EQ(std::vector<std::u16string>({u"012", u"3456", u"789"}), + GetRunListStrings()); const internal::TextRunList* run_list = GetHarfBuzzRunList(); ASSERT_EQ(3U, run_list->size());
diff --git a/ui/gfx/text_elider_unittest.cc b/ui/gfx/text_elider_unittest.cc index d1b5017..4df7150 100644 --- a/ui/gfx/text_elider_unittest.cc +++ b/ui/gfx/text_elider_unittest.cc
@@ -27,44 +27,26 @@ #include "ui/gfx/font_render_params.h" #include "ui/gfx/text_utils.h" -using base::ASCIIToUTF16; -using base::UTF16ToUTF8; -using base::UTF16ToWide; -using base::UTF8ToUTF16; - namespace gfx { namespace { -struct Testcase { - const std::string input; - const std::string output; -}; - struct FileTestcase { const base::FilePath::StringType input; - const std::string output; + const std::u16string output; // If this value is specified, we will try to cut the path down to the render // width of this string; if not specified, output will be used. - const std::string using_width_of = std::string(); + const std::u16string using_width_of = std::u16string(); }; -struct UTF16Testcase { +struct Testcase { const std::u16string input; const std::u16string output; }; -struct TestData { - const std::string a; - const std::string b; - const int compare_result; -}; - } // namespace TEST(TextEliderTest, ElideEmail) { - const std::string kEllipsisStr(kEllipsis); - // Test emails and their expected elided forms (from which the available // widths will be derived). // For elided forms in which both the username and domain must be elided: @@ -72,48 +54,43 @@ // dependent. To avoid this, the username is prefixed with the characters // expected to remain in the domain. Testcase testcases[] = { - {"g@g.c", "g@g.c"}, - {"g@g.c", kEllipsisStr}, - {"ga@co.ca", "ga@c" + kEllipsisStr + "a"}, - {"short@small.com", "s" + kEllipsisStr + "@s" + kEllipsisStr}, - {"short@small.com", "s" + kEllipsisStr + "@small.com"}, - {"short@longbutlotsofspace.com", "short@longbutlotsofspace.com"}, - {"short@longbutnotverymuchspace.com", - "short@long" + kEllipsisStr + ".com"}, - {"la_short@longbutverytightspace.ca", - "la" + kEllipsisStr + "@l" + kEllipsisStr + "a"}, - {"longusername@gmail.com", "long" + kEllipsisStr + "@gmail.com"}, - {"elidetothemax@justfits.com", "e" + kEllipsisStr + "@justfits.com"}, - {"thatom_somelongemail@thatdoesntfit.com", - "thatom" + kEllipsisStr + "@tha" + kEllipsisStr + "om"}, - {"namefits@butthedomaindoesnt.com", - "namefits@butthedo" + kEllipsisStr + "snt.com"}, - {"widthtootight@nospace.com", kEllipsisStr}, - {"nospaceforusername@l", kEllipsisStr}, - {"little@littlespace.com", "l" + kEllipsisStr + "@l" + kEllipsisStr}, - {"l@llllllllllllllllllllllll.com", "l@lllll" + kEllipsisStr + ".com"}, - {"messed\"up@whyanat\"++@notgoogley.com", - "messed\"up@whyanat\"++@notgoogley.com"}, - {"messed\"up@whyanat\"++@notgoogley.com", - "messed\"up@why" + kEllipsisStr + "@notgoogley.com"}, - {"noca_messed\"up@whyanat\"++@notgoogley.ca", - "noca" + kEllipsisStr + "@no" + kEllipsisStr + "ca"}, - {"at\"@@@@@@@@@...@@.@.@.@@@\"@madness.com", - "at\"@@@@@@@@@...@@.@." + kEllipsisStr + "@madness.com"}, + {u"g@g.c", u"g@g.c"}, + {u"g@g.c", u"…"}, + {u"ga@co.ca", u"ga@c…a"}, + {u"short@small.com", u"s…@s…"}, + {u"short@small.com", u"s…@small.com"}, + {u"short@longbutlotsofspace.com", u"short@longbutlotsofspace.com"}, + {u"short@longbutnotverymuchspace.com", u"short@long….com"}, + {u"la_short@longbutverytightspace.ca", u"la…@l…a"}, + {u"longusername@gmail.com", u"long…@gmail.com"}, + {u"elidetothemax@justfits.com", u"e…@justfits.com"}, + {u"thatom_somelongemail@thatdoesntfit.com", u"thatom…@tha…om"}, + {u"namefits@butthedomaindoesnt.com", u"namefits@butthedo…snt.com"}, + {u"widthtootight@nospace.com", u"…"}, + {u"nospaceforusername@l", u"…"}, + {u"little@littlespace.com", u"l…@l…"}, + {u"l@llllllllllllllllllllllll.com", u"l@lllll….com"}, + {u"messed\"up@whyanat\"++@notgoogley.com", + u"messed\"up@whyanat\"++@notgoogley.com"}, + {u"messed\"up@whyanat\"++@notgoogley.com", + u"messed\"up@why…@notgoogley.com"}, + {u"noca_messed\"up@whyanat\"++@notgoogley.ca", u"noca…@no…ca"}, + {u"at\"@@@@@@@@@...@@.@.@.@@@\"@madness.com", + u"at\"@@@@@@@@@...@@.@.…@madness.com"}, // Special case: "m..." takes more than half of the available width; thus // the domain must elide to "l..." and not "l...l" as it must allow enough // space for the minimal username elision although its half of the // available width would normally allow it to elide to "l...l". - {"mmmmm@llllllllll", "m" + kEllipsisStr + "@l" + kEllipsisStr}, + {u"mmmmm@llllllllll", u"m…@l…"}, }; const FontList font_list; for (size_t i = 0; i < base::size(testcases); ++i) { - const std::u16string expected_output = UTF8ToUTF16(testcases[i].output); - EXPECT_EQ(expected_output, - ElideText(UTF8ToUTF16(testcases[i].input), font_list, - GetStringWidthF(expected_output, font_list), - ELIDE_EMAIL)); + const std::u16string expected_output = testcases[i].output; + EXPECT_EQ( + expected_output, + ElideText(testcases[i].input, font_list, + GetStringWidthF(expected_output, font_list), ELIDE_EMAIL)); } } @@ -121,74 +98,69 @@ const int test_widths_extra_spaces[] = { 10, 1000, - 100000, + 100'000, }; - const char* test_emails[] = { - "a@c", - "test@email.com", - "short@verysuperdupperlongdomain.com", - "supermegalongusername@withasuperlonnnggggdomain.gouv.qc.ca", + const char16_t* const test_emails[] = { + u"a@c", + u"test@email.com", + u"short@verysuperdupperlongdomain.com", + u"supermegalongusername@withasuperlonnnggggdomain.gouv.qc.ca", }; const FontList font_list; for (const auto* test_email : test_emails) { - const std::u16string test_email16 = UTF8ToUTF16(test_email); - const int mimimum_width = GetStringWidth(test_email16, font_list); + const int mimimum_width = GetStringWidth(test_email, font_list); for (int extra_space : test_widths_extra_spaces) { // Extra space is available: the email should not be elided. - EXPECT_EQ(test_email16, - ElideText(test_email16, font_list, mimimum_width + extra_space, + EXPECT_EQ(test_email, + ElideText(test_email, font_list, mimimum_width + extra_space, ELIDE_EMAIL)); } } } TEST(TextEliderTest, TestFilenameEliding) { - const std::string kEllipsisStr(kEllipsis); const base::FilePath::StringType kPathSeparator = base::FilePath::StringType().append(1, base::FilePath::kSeparators[0]); FileTestcase testcases[] = { - {FILE_PATH_LITERAL(""), ""}, - {FILE_PATH_LITERAL("."), "."}, - {FILE_PATH_LITERAL("filename.exe"), "filename.exe"}, - {FILE_PATH_LITERAL(".longext"), ".longext"}, - {FILE_PATH_LITERAL("pie"), "pie"}, + {FILE_PATH_LITERAL(""), u""}, + {FILE_PATH_LITERAL("."), u"."}, + {FILE_PATH_LITERAL("filename.exe"), u"filename.exe"}, + {FILE_PATH_LITERAL(".longext"), u".longext"}, + {FILE_PATH_LITERAL("pie"), u"pie"}, {FILE_PATH_LITERAL("c:") + kPathSeparator + FILE_PATH_LITERAL("path") + kPathSeparator + FILE_PATH_LITERAL("filename.pie"), - "filename.pie"}, + u"filename.pie"}, {FILE_PATH_LITERAL("c:") + kPathSeparator + FILE_PATH_LITERAL("path") + kPathSeparator + FILE_PATH_LITERAL("longfilename.pie"), - "long" + kEllipsisStr + ".pie"}, - {FILE_PATH_LITERAL("http://path.com/filename.pie"), "filename.pie"}, - {FILE_PATH_LITERAL("http://path.com/longfilename.pie"), - "long" + kEllipsisStr + ".pie"}, - {FILE_PATH_LITERAL("piesmashingtacularpants"), "pie" + kEllipsisStr}, - {FILE_PATH_LITERAL(".piesmashingtacularpants"), ".pie" + kEllipsisStr}, - {FILE_PATH_LITERAL("cheese."), "cheese."}, - {FILE_PATH_LITERAL("file name.longext"), - "file" + kEllipsisStr + ".longext"}, - {FILE_PATH_LITERAL("fil ename.longext"), - "fil" + kEllipsisStr + ".longext", "fil " + kEllipsisStr + ".longext"}, - {FILE_PATH_LITERAL("filename.longext"), - "file" + kEllipsisStr + ".longext"}, + u"long….pie"}, + {FILE_PATH_LITERAL("http://path.com/filename.pie"), u"filename.pie"}, + {FILE_PATH_LITERAL("http://path.com/longfilename.pie"), u"long….pie"}, + {FILE_PATH_LITERAL("piesmashingtacularpants"), u"pie…"}, + {FILE_PATH_LITERAL(".piesmashingtacularpants"), u".pie…"}, + {FILE_PATH_LITERAL("cheese."), u"cheese."}, + {FILE_PATH_LITERAL("file name.longext"), u"file….longext"}, + {FILE_PATH_LITERAL("fil ename.longext"), u"fil….longext", + u"fil ….longext"}, + {FILE_PATH_LITERAL("filename.longext"), u"file….longext"}, {FILE_PATH_LITERAL("filename.middleext.longext"), - "filename.mid" + kEllipsisStr + ".longext"}, + u"filename.mid….longext"}, {FILE_PATH_LITERAL("filename.superduperextremelylongext"), - "filename.sup" + kEllipsisStr + "emelylongext"}, + u"filename.sup…emelylongext"}, {FILE_PATH_LITERAL("filenamereallylongtext.superdeduperextremelylongext"), - "filenamereall" + kEllipsisStr + "emelylongext"}, + u"filenamereall…emelylongext"}, {FILE_PATH_LITERAL( "file.name.really.long.text.superduperextremelylongext"), - "file.name.re" + kEllipsisStr + "emelylongext"}}; + u"file.name.re…emelylongext"}}; static const FontList font_list; for (size_t i = 0; i < base::size(testcases); ++i) { base::FilePath filepath(testcases[i].input); - std::u16string expected = UTF8ToUTF16(testcases[i].output); - std::u16string using_width_of = UTF8ToUTF16( - testcases[i].using_width_of.empty() ? testcases[i].output - : testcases[i].using_width_of); + std::u16string expected = testcases[i].output; + std::u16string using_width_of = testcases[i].using_width_of.empty() + ? testcases[i].output + : testcases[i].using_width_of; expected = base::i18n::GetDisplayStringInLTRDirectionality(expected); EXPECT_EQ(expected, ElideFilename(filepath, font_list, @@ -200,76 +172,71 @@ const FontList font_list; const float kTestWidth = GetStringWidthF(u"Test", font_list); struct TestData { - const char* input; + const char16_t* input; float width; - const char* output; + const char16_t* output; } cases[] = { - { "", 0, "" }, - { "Test", 0, "" }, - { "", kTestWidth, "" }, - { "Tes", kTestWidth, "Tes" }, - { "Test", kTestWidth, "Test" }, - { "Tests", kTestWidth, "Test" }, + {u"", 0, u""}, + {u"Test", 0, u""}, + {u"", kTestWidth, u""}, + {u"Tes", kTestWidth, u"Tes"}, + {u"Test", kTestWidth, u"Test"}, + {u"Tests", kTestWidth, u"Test"}, }; for (size_t i = 0; i < base::size(cases); ++i) { - std::u16string result = ElideText(UTF8ToUTF16(cases[i].input), font_list, - cases[i].width, TRUNCATE); - EXPECT_EQ(cases[i].output, UTF16ToUTF8(result)); + std::u16string result = + ElideText(cases[i].input, font_list, cases[i].width, TRUNCATE); + EXPECT_EQ(cases[i].output, result); } } TEST(TextEliderTest, ElideTextEllipsis) { const FontList font_list; const float kTestWidth = GetStringWidthF(u"Test", font_list); - const char* kEllipsis = "\xE2\x80\xA6"; - const float kEllipsisWidth = - GetStringWidthF(UTF8ToUTF16(kEllipsis), font_list); + const float kEllipsisWidth = GetStringWidthF(u"…", font_list); struct TestData { - const char* input; + const char16_t* input; float width; - const char* output; + const char16_t* output; } cases[] = { - { "", 0, "" }, - { "Test", 0, "" }, - { "Test", kEllipsisWidth, kEllipsis }, - { "", kTestWidth, "" }, - { "Tes", kTestWidth, "Tes" }, - { "Test", kTestWidth, "Test" }, + {u"", 0, u""}, + {u"Test", 0, u""}, + {u"Test", kEllipsisWidth, u"…"}, + {u"", kTestWidth, u""}, + {u"Tes", kTestWidth, u"Tes"}, + {u"Test", kTestWidth, u"Test"}, }; for (size_t i = 0; i < base::size(cases); ++i) { - std::u16string result = ElideText(UTF8ToUTF16(cases[i].input), font_list, - cases[i].width, ELIDE_TAIL); - EXPECT_EQ(cases[i].output, UTF16ToUTF8(result)); + std::u16string result = + ElideText(cases[i].input, font_list, cases[i].width, ELIDE_TAIL); + EXPECT_EQ(cases[i].output, result); } } TEST(TextEliderTest, ElideTextEllipsisFront) { const FontList font_list; const float kTestWidth = GetStringWidthF(u"Test", font_list); - const std::string kEllipsisStr(kEllipsis); - const float kEllipsisWidth = - GetStringWidthF(UTF8ToUTF16(kEllipsis), font_list); - const float kEllipsis23Width = - GetStringWidthF(UTF8ToUTF16(kEllipsisStr + "23"), font_list); + const float kEllipsisWidth = GetStringWidthF(u"…", font_list); + const float kEllipsis23Width = GetStringWidthF(u"…23", font_list); struct TestData { - const char* input; + const char16_t* input; float width; const std::u16string output; } cases[] = { - {"", 0, std::u16string()}, - {"Test", 0, std::u16string()}, - {"Test", kEllipsisWidth, UTF8ToUTF16(kEllipsisStr)}, - {"", kTestWidth, std::u16string()}, - {"Tes", kTestWidth, u"Tes"}, - {"Test", kTestWidth, u"Test"}, - {"Test123", kEllipsis23Width, UTF8ToUTF16(kEllipsisStr + "23")}, + {u"", 0, std::u16string()}, + {u"Test", 0, std::u16string()}, + {u"Test", kEllipsisWidth, u"…"}, + {u"", kTestWidth, std::u16string()}, + {u"Tes", kTestWidth, u"Tes"}, + {u"Test", kTestWidth, u"Test"}, + {u"Test123", kEllipsis23Width, u"…23"}, }; for (size_t i = 0; i < base::size(cases); ++i) { - std::u16string result = ElideText(UTF8ToUTF16(cases[i].input), font_list, - cases[i].width, ELIDE_HEAD); + std::u16string result = + ElideText(cases[i].input, font_list, cases[i].width, ELIDE_HEAD); EXPECT_EQ(cases[i].output, result); } } @@ -298,15 +265,13 @@ base::test::SingleThreadTaskEnvironment::MainThreadType::UI); #endif const FontList font_list; + std::vector<std::u16string> pairs; // The below is 'MUSICAL SYMBOL G CLEF' (U+1D11E), which is represented in // UTF-16 as two code units forming a surrogate pair: 0xD834 0xDD1E. - const char16_t kSurrogate[] = {0xD834, 0xDD1E, 0}; + pairs.push_back(u"\U0001d11e"); // The below is a Devanagari two-character combining sequence U+0921 U+093F. // The sequence forms a single display character and should not be separated. - const char16_t kCombiningSequence[] = {0x921, 0x93F, 0}; - std::vector<std::u16string> pairs; - pairs.push_back(kSurrogate); - pairs.push_back(kCombiningSequence); + pairs.push_back(u"\u0921\u093f"); for (const std::u16string& pair : pairs) { char16_t first_char = pair[0]; @@ -335,34 +300,33 @@ } TEST(TextEliderTest, ElideTextLongStrings) { - const std::u16string kEllipsisStr = UTF8ToUTF16(kEllipsis); std::u16string data_scheme(u"data:text/plain,"); size_t data_scheme_length = data_scheme.length(); std::u16string ten_a(10, 'a'); std::u16string hundred_a(100, 'a'); std::u16string thousand_a(1000, 'a'); - std::u16string ten_thousand_a(10000, 'a'); - std::u16string hundred_thousand_a(100000, 'a'); - std::u16string million_a(1000000, 'a'); + std::u16string ten_thousand_a(10'000, 'a'); + std::u16string hundred_thousand_a(100'000, 'a'); + std::u16string million_a(1'000'000, 'a'); // TODO(gbillock): Improve these tests by adding more string diversity and // doing string compares instead of length compares. See bug 338836. size_t number_of_as = 156; - std::u16string long_string_end( - data_scheme + std::u16string(number_of_as, 'a') + kEllipsisStr); - UTF16Testcase testcases_end[] = { - { data_scheme + ten_a, data_scheme + ten_a }, - { data_scheme + hundred_a, data_scheme + hundred_a }, - { data_scheme + thousand_a, long_string_end }, - { data_scheme + ten_thousand_a, long_string_end }, - { data_scheme + hundred_thousand_a, long_string_end }, - { data_scheme + million_a, long_string_end }, + std::u16string long_string_end(data_scheme + + std::u16string(number_of_as, 'a') + u"…"); + Testcase testcases_end[] = { + {data_scheme + ten_a, data_scheme + ten_a}, + {data_scheme + hundred_a, data_scheme + hundred_a}, + {data_scheme + thousand_a, long_string_end}, + {data_scheme + ten_thousand_a, long_string_end}, + {data_scheme + hundred_thousand_a, long_string_end}, + {data_scheme + million_a, long_string_end}, }; const FontList font_list; - float ellipsis_width = GetStringWidthF(kEllipsisStr, font_list); + float ellipsis_width = GetStringWidthF(u"…", font_list); for (size_t i = 0; i < base::size(testcases_end); ++i) { // Compare sizes rather than actual contents because if the test fails, // output is rather long. @@ -370,20 +334,19 @@ ElideText(testcases_end[i].input, font_list, GetStringWidthF(testcases_end[i].output, font_list), ELIDE_TAIL).size()); - EXPECT_EQ(kEllipsisStr, - ElideText(testcases_end[i].input, font_list, ellipsis_width, - ELIDE_TAIL)); + EXPECT_EQ(u"…", ElideText(testcases_end[i].input, font_list, ellipsis_width, + ELIDE_TAIL)); } size_t number_of_trailing_as = (data_scheme_length + number_of_as) / 2; std::u16string long_string_middle( data_scheme + std::u16string(number_of_as - number_of_trailing_as, 'a') + - kEllipsisStr + std::u16string(number_of_trailing_as, 'a')); + u"…" + std::u16string(number_of_trailing_as, 'a')); #if !defined(OS_IOS) - long_string_middle += kEllipsisStr; + long_string_middle += u"…"; #endif - UTF16Testcase testcases_middle[] = { + Testcase testcases_middle[] = { {data_scheme + ten_a, data_scheme + ten_a}, {data_scheme + hundred_a, data_scheme + hundred_a}, {data_scheme + thousand_a, long_string_middle}, @@ -400,17 +363,17 @@ GetStringWidthF(testcases_middle[i].output, font_list), ELIDE_MIDDLE) .size()); - EXPECT_EQ(kEllipsisStr, ElideText(testcases_middle[i].input, font_list, - ellipsis_width, ELIDE_MIDDLE)); + EXPECT_EQ(u"…", ElideText(testcases_middle[i].input, font_list, + ellipsis_width, ELIDE_MIDDLE)); } - std::u16string long_string_beginning(kEllipsisStr + + std::u16string long_string_beginning(u"…" + std::u16string(number_of_as, 'a')); #if !defined(OS_IOS) - long_string_beginning += kEllipsisStr; + long_string_beginning += u"…"; #endif - UTF16Testcase testcases_beginning[] = { + Testcase testcases_beginning[] = { {data_scheme + ten_a, data_scheme + ten_a}, {data_scheme + hundred_a, data_scheme + hundred_a}, {data_scheme + thousand_a, long_string_beginning}, @@ -424,8 +387,8 @@ testcases_beginning[i].input, font_list, GetStringWidthF(testcases_beginning[i].output, font_list), ELIDE_HEAD).size()); - EXPECT_EQ(kEllipsisStr, ElideText(testcases_beginning[i].input, font_list, - ellipsis_width, ELIDE_HEAD)); + EXPECT_EQ(u"…", ElideText(testcases_beginning[i].input, font_list, + ellipsis_width, ELIDE_HEAD)); } } @@ -435,11 +398,11 @@ TEST(TextEliderTest, StringSlicerBasicTest) { // Must store strings in variables (StringSlicer retains a reference to them). std::u16string text(u"Hello, world!"); - std::u16string ellipsis(kEllipsisUTF16); + std::u16string ellipsis(u"…"); StringSlicer slicer(text, ellipsis, false, false); EXPECT_EQ(u"", slicer.CutString(0, false)); - EXPECT_EQ(std::u16string(kEllipsisUTF16), slicer.CutString(0, true)); + EXPECT_EQ(u"…", slicer.CutString(0, true)); EXPECT_EQ(u"Hell", slicer.CutString(4, false)); EXPECT_EQ(u"Hell…", slicer.CutString(4, true)); @@ -459,7 +422,7 @@ TEST(TextEliderTest, StringSlicerWhitespace_UseDefault) { // Must store strings in variables (StringSlicer retains a reference to them). std::u16string text(u"Hello, world!"); - std::u16string ellipsis(kEllipsisUTF16); + std::u16string ellipsis(u"…"); // Eliding the end of a string should result in whitespace being removed // before the ellipsis by default. @@ -487,7 +450,7 @@ TEST(TextEliderTest, StringSlicerWhitespace_NoTrim) { // Must store strings in variables (StringSlicer retains a reference to them). std::u16string text(u"Hello, world!"); - std::u16string ellipsis(kEllipsisUTF16); + std::u16string ellipsis(u"…"); // Eliding the end of a string should not result in whitespace being removed // before the ellipsis in no-trim mode. @@ -515,7 +478,7 @@ TEST(TextEliderTest, StringSlicerWhitespace_Trim) { // Must store strings in variables (StringSlicer retains a reference to them). std::u16string text(u"Hello, world!"); - std::u16string ellipsis(kEllipsisUTF16); + std::u16string ellipsis(u"…"); // Eliding the end of a string should result in whitespace being removed // before the ellipsis in trim mode. @@ -543,7 +506,7 @@ TEST(TextEliderTest, StringSlicer_ElideMiddle_MultipleWhitespace) { // Must store strings in variables (StringSlicer retains a reference to them). std::u16string text(u"Hello world!"); - std::u16string ellipsis(kEllipsisUTF16); + std::u16string ellipsis(u"…"); // Eliding the middle of a string should not result in whitespace being // removed around the ellipsis in default whitespace mode. @@ -579,24 +542,23 @@ TEST(TextEliderTest, StringSlicerSurrogate) { // The below is 'MUSICAL SYMBOL G CLEF' (U+1D11E), which is represented in // UTF-16 as two code units forming a surrogate pair: 0xD834 0xDD1E. - const std::u16string kSurrogate = u"𝄞"; + const std::u16string kSurrogate = u"\U0001d11e"; ASSERT_EQ(2u, kSurrogate.size()); ASSERT_EQ(u'\xD834', kSurrogate[0]); ASSERT_EQ(u'\xDD1E', kSurrogate[1]); std::u16string text(u"abc" + kSurrogate + u"xyz"); - std::u16string ellipsis(kEllipsisUTF16); + std::u16string ellipsis(u"…"); StringSlicer slicer(text, ellipsis, false, false); // Cut surrogate on the right. Should round left and exclude the surrogate. - EXPECT_EQ(std::u16string(kEllipsisUTF16), slicer.CutString(0, true)); + EXPECT_EQ(u"…", slicer.CutString(0, true)); EXPECT_EQ(u"abc…", slicer.CutString(4, true)); - EXPECT_EQ(text + kEllipsisUTF16, slicer.CutString(text.length(), true)); + EXPECT_EQ(text + u"…", slicer.CutString(text.length(), true)); // Cut surrogate on the left. Should round right and exclude the surrogate. StringSlicer slicer_begin(text, ellipsis, false, true); - EXPECT_EQ(std::u16string(kEllipsisUTF16) + u"xyz", - slicer_begin.CutString(4, true)); + EXPECT_EQ(u"…xyz", slicer_begin.CutString(4, true)); // Cut surrogate in the middle. Should round right and exclude the surrogate. std::u16string short_text(u"abc" + kSurrogate); @@ -607,9 +569,8 @@ std::u16string dangling_trailing_text = kSurrogate.substr(1); StringSlicer slicer_dangling_trailing(dangling_trailing_text, ellipsis, false, false); - EXPECT_EQ(std::u16string(kEllipsisUTF16), - slicer_dangling_trailing.CutString(0, true)); - EXPECT_EQ(dangling_trailing_text + kEllipsisUTF16, + EXPECT_EQ(u"…", slicer_dangling_trailing.CutString(0, true)); + EXPECT_EQ(dangling_trailing_text + u"…", slicer_dangling_trailing.CutString(1, true)); } @@ -619,10 +580,8 @@ // LATIN SMALL LETTER E + COMBINING ACUTE ACCENT + COMBINING CEDILLA // LATIN SMALL LETTER X + COMBINING ENCLOSING KEYCAP // DEVANAGARI LETTER DDA + DEVANAGARI VOWEL SIGN I - const char16_t kText[] = {'e', 0x301, 0x327, ' ', 'x', - 0x20E3, ' ', 0x921, 0x93F, 0}; - std::u16string text(kText); - std::u16string ellipsis(kEllipsisUTF16); + std::u16string text(u"e\u0301\u0327 x\u20e3 \u0921\u093f"); + std::u16string ellipsis(u"…"); StringSlicer slicer(text, ellipsis, false, false); // Attempt to cut the string for all lengths. When a combining sequence is @@ -630,33 +589,31 @@ // Whitespace is also cut adjacent to the ellipsis. // First sequence: - EXPECT_EQ(std::u16string(kEllipsisUTF16), slicer.CutString(0, true)); - EXPECT_EQ(std::u16string(kEllipsisUTF16), slicer.CutString(1, true)); - EXPECT_EQ(std::u16string(kEllipsisUTF16), slicer.CutString(2, true)); - EXPECT_EQ(text.substr(0, 3) + kEllipsisUTF16, slicer.CutString(3, true)); + EXPECT_EQ(u"…", slicer.CutString(0, true)); + EXPECT_EQ(u"…", slicer.CutString(1, true)); + EXPECT_EQ(u"…", slicer.CutString(2, true)); + EXPECT_EQ(text.substr(0, 3) + u"…", slicer.CutString(3, true)); // Second sequence: - EXPECT_EQ(text.substr(0, 3) + kEllipsisUTF16, slicer.CutString(4, true)); - EXPECT_EQ(text.substr(0, 3) + kEllipsisUTF16, slicer.CutString(5, true)); - EXPECT_EQ(text.substr(0, 6) + kEllipsisUTF16, slicer.CutString(6, true)); + EXPECT_EQ(text.substr(0, 3) + u"…", slicer.CutString(4, true)); + EXPECT_EQ(text.substr(0, 3) + u"…", slicer.CutString(5, true)); + EXPECT_EQ(text.substr(0, 6) + u"…", slicer.CutString(6, true)); // Third sequence: - EXPECT_EQ(text.substr(0, 6) + kEllipsisUTF16, slicer.CutString(7, true)); - EXPECT_EQ(text.substr(0, 6) + kEllipsisUTF16, slicer.CutString(8, true)); - EXPECT_EQ(text + kEllipsisUTF16, slicer.CutString(9, true)); + EXPECT_EQ(text.substr(0, 6) + u"…", slicer.CutString(7, true)); + EXPECT_EQ(text.substr(0, 6) + u"…", slicer.CutString(8, true)); + EXPECT_EQ(text + u"…", slicer.CutString(9, true)); // Cut string in the middle, splitting the second sequence in half. Should // round both left and right, excluding the second sequence. StringSlicer slicer_mid(text, ellipsis, true, false); - EXPECT_EQ(text.substr(0, 4) + kEllipsisUTF16 + text.substr(6), + EXPECT_EQ(text.substr(0, 4) + u"…" + text.substr(6), slicer_mid.CutString(9, true)); // String that starts with a dangling combining mark. char16_t dangling_mark_chars[] = {text[1], 0}; std::u16string dangling_mark_text(dangling_mark_chars); StringSlicer slicer_dangling_mark(dangling_mark_text, ellipsis, false, false); - EXPECT_EQ(std::u16string(kEllipsisUTF16), - slicer_dangling_mark.CutString(0, true)); - EXPECT_EQ(dangling_mark_text + kEllipsisUTF16, - slicer_dangling_mark.CutString(1, true)); + EXPECT_EQ(u"…", slicer_dangling_mark.CutString(0, true)); + EXPECT_EQ(dangling_mark_text + u"…", slicer_dangling_mark.CutString(1, true)); } TEST(TextEliderTest, StringSlicerCombiningSurrogate) { @@ -664,49 +621,46 @@ // The following string contains a single combining character sequence: // MUSICAL SYMBOL G CLEF (U+1D11E) + MUSICAL SYMBOL COMBINING FLAG-1 (U+1D16E) // Represented as four UTF-16 code units. - const char16_t kText[] = {0xD834, 0xDD1E, 0xD834, 0xDD6E, 0}; - std::u16string text(kText); - std::u16string ellipsis(kEllipsisUTF16); + std::u16string text(u"\U0001d11e\U0001d16e"); + std::u16string ellipsis(u"…"); StringSlicer slicer(text, ellipsis, false, false); // Attempt to cut the string for all lengths. Should always round left and // exclude the combining sequence. - EXPECT_EQ(std::u16string(kEllipsisUTF16), slicer.CutString(0, true)); - EXPECT_EQ(std::u16string(kEllipsisUTF16), slicer.CutString(1, true)); - EXPECT_EQ(std::u16string(kEllipsisUTF16), slicer.CutString(2, true)); - EXPECT_EQ(std::u16string(kEllipsisUTF16), slicer.CutString(3, true)); - EXPECT_EQ(text + kEllipsisUTF16, slicer.CutString(4, true)); + EXPECT_EQ(u"…", slicer.CutString(0, true)); + EXPECT_EQ(u"…", slicer.CutString(1, true)); + EXPECT_EQ(u"…", slicer.CutString(2, true)); + EXPECT_EQ(u"…", slicer.CutString(3, true)); + EXPECT_EQ(text + u"…", slicer.CutString(4, true)); // Cut string in the middle. Should exclude the sequence. StringSlicer slicer_mid(text, ellipsis, true, false); - EXPECT_EQ(std::u16string(kEllipsisUTF16), slicer_mid.CutString(4, true)); + EXPECT_EQ(u"…", slicer_mid.CutString(4, true)); } TEST(TextEliderTest, ElideString) { struct TestData { - const char* input; + const char16_t* input; size_t max_len; bool result; - const char* output; + const char16_t* output; } cases[] = { - { "Hello", 0, true, "" }, - { "", 0, false, "" }, - { "Hello, my name is Tom", 1, true, "H" }, - { "Hello, my name is Tom", 2, true, "He" }, - { "Hello, my name is Tom", 3, true, "H.m" }, - { "Hello, my name is Tom", 4, true, "H..m" }, - { "Hello, my name is Tom", 5, true, "H...m" }, - { "Hello, my name is Tom", 6, true, "He...m" }, - { "Hello, my name is Tom", 7, true, "He...om" }, - { "Hello, my name is Tom", 10, true, "Hell...Tom" }, - { "Hello, my name is Tom", 100, false, "Hello, my name is Tom" } - }; + {u"Hello", 0, true, u""}, + {u"", 0, false, u""}, + {u"Hello, my name is Tom", 1, true, u"H"}, + {u"Hello, my name is Tom", 2, true, u"He"}, + {u"Hello, my name is Tom", 3, true, u"H.m"}, + {u"Hello, my name is Tom", 4, true, u"H..m"}, + {u"Hello, my name is Tom", 5, true, u"H...m"}, + {u"Hello, my name is Tom", 6, true, u"He...m"}, + {u"Hello, my name is Tom", 7, true, u"He...om"}, + {u"Hello, my name is Tom", 10, true, u"Hell...Tom"}, + {u"Hello, my name is Tom", 100, false, u"Hello, my name is Tom"}}; for (size_t i = 0; i < base::size(cases); ++i) { std::u16string output; EXPECT_EQ(cases[i].result, - ElideString(UTF8ToUTF16(cases[i].input), - cases[i].max_len, &output)); - EXPECT_EQ(cases[i].output, UTF16ToUTF8(output)); + ElideString(cases[i].input, cases[i].max_len, &output)); + EXPECT_EQ(cases[i].output, output); } } @@ -716,50 +670,51 @@ const float test_width = GetStringWidthF(u"Test", font_list); struct TestData { - const char* input; + const char16_t* input; float available_pixel_width; int available_pixel_height; bool truncated_y; - const char* output; + const char16_t* output; } cases[] = { - {"", 0, 0, false, nullptr}, - {"", 1, 1, false, nullptr}, - {"Test", test_width, 0, true, nullptr}, - {"Test", test_width, 1, false, "Test"}, - {"Test", test_width, line_height, false, "Test"}, - {"Test Test", test_width, line_height, true, "Test"}, - {"Test Test", test_width, line_height + 1, false, "Test|Test"}, - {"Test Test", test_width, line_height * 2, false, "Test|Test"}, - {"Test Test", test_width, line_height * 3, false, "Test|Test"}, - {"Test Test", test_width * 2, line_height * 2, false, "Test|Test"}, - {"Test Test", test_width * 3, line_height, false, "Test Test"}, - {"Test\nTest", test_width * 3, line_height * 2, false, "Test|Test"}, - {"Te\nst Te", test_width, line_height * 3, false, "Te|st|Te"}, - {"\nTest", test_width, line_height * 2, false, "|Test"}, - {"\nTest", test_width, line_height, true, ""}, - {"\n\nTest", test_width, line_height * 3, false, "||Test"}, - {"\n\nTest", test_width, line_height * 2, true, "|"}, - {"Test\n", 2 * test_width, line_height * 5, false, "Test|"}, - {"Test\n\n", 2 * test_width, line_height * 5, false, "Test||"}, - {"Test\n\n\n", 2 * test_width, line_height * 5, false, "Test|||"}, - {"Test\nTest\n\n", 2 * test_width, line_height * 5, false, "Test|Test||"}, - {"Test\n\nTest\n", 2 * test_width, line_height * 5, false, "Test||Test|"}, - {"Test\n\n\nTest", 2 * test_width, line_height * 5, false, "Test|||Test"}, - {"Te ", test_width, line_height, false, "Te"}, - {"Te Te Test", test_width, 3 * line_height, false, "Te|Te|Test"}, + {u"", 0, 0, false, nullptr}, + {u"", 1, 1, false, nullptr}, + {u"Test", test_width, 0, true, nullptr}, + {u"Test", test_width, 1, false, u"Test"}, + {u"Test", test_width, line_height, false, u"Test"}, + {u"Test Test", test_width, line_height, true, u"Test"}, + {u"Test Test", test_width, line_height + 1, false, u"Test|Test"}, + {u"Test Test", test_width, line_height * 2, false, u"Test|Test"}, + {u"Test Test", test_width, line_height * 3, false, u"Test|Test"}, + {u"Test Test", test_width * 2, line_height * 2, false, u"Test|Test"}, + {u"Test Test", test_width * 3, line_height, false, u"Test Test"}, + {u"Test\nTest", test_width * 3, line_height * 2, false, u"Test|Test"}, + {u"Te\nst Te", test_width, line_height * 3, false, u"Te|st|Te"}, + {u"\nTest", test_width, line_height * 2, false, u"|Test"}, + {u"\nTest", test_width, line_height, true, u""}, + {u"\n\nTest", test_width, line_height * 3, false, u"||Test"}, + {u"\n\nTest", test_width, line_height * 2, true, u"|"}, + {u"Test\n", 2 * test_width, line_height * 5, false, u"Test|"}, + {u"Test\n\n", 2 * test_width, line_height * 5, false, u"Test||"}, + {u"Test\n\n\n", 2 * test_width, line_height * 5, false, u"Test|||"}, + {u"Test\nTest\n\n", 2 * test_width, line_height * 5, false, + u"Test|Test||"}, + {u"Test\n\nTest\n", 2 * test_width, line_height * 5, false, + u"Test||Test|"}, + {u"Test\n\n\nTest", 2 * test_width, line_height * 5, false, + u"Test|||Test"}, + {u"Te ", test_width, line_height, false, u"Te"}, + {u"Te Te Test", test_width, 3 * line_height, false, u"Te|Te|Test"}, }; for (size_t i = 0; i < base::size(cases); ++i) { std::vector<std::u16string> lines; EXPECT_EQ(cases[i].truncated_y ? INSUFFICIENT_SPACE_VERTICAL : 0, - ElideRectangleText(UTF8ToUTF16(cases[i].input), - font_list, + ElideRectangleText(cases[i].input, font_list, cases[i].available_pixel_width, cases[i].available_pixel_height, - TRUNCATE_LONG_WORDS, - &lines)); + TRUNCATE_LONG_WORDS, &lines)); if (cases[i].output) { - const std::string result = UTF16ToUTF8(base::JoinString(lines, u"|")); + const std::u16string result = base::JoinString(lines, u"|"); EXPECT_EQ(cases[i].output, result) << "Case " << i << " failed!"; } else { EXPECT_TRUE(lines.empty()) << "Case " << i << " failed!"; @@ -776,27 +731,27 @@ std::vector<std::u16string> lines; - auto result_for_width = [&](const char* input, float width) { + auto result_for_width = [&](const char16_t* input, float width) { lines.clear(); - return ElideRectangleText(ASCIIToUTF16(input), font_list, width, - line_height * 4, WRAP_LONG_WORDS, &lines); + return ElideRectangleText(input, font_list, width, line_height * 4, + WRAP_LONG_WORDS, &lines); }; // Test base case. - EXPECT_EQ(0, result_for_width("Test", test_width)); + EXPECT_EQ(0, result_for_width(u"Test", test_width)); EXPECT_EQ(1u, lines.size()); EXPECT_EQ(u"Test", lines[0]); // First word truncated. EXPECT_EQ(INSUFFICIENT_SPACE_FOR_FIRST_WORD, - result_for_width("Test", tes_width)); + result_for_width(u"Test", tes_width)); EXPECT_EQ(2u, lines.size()); EXPECT_EQ(u"Tes", lines[0]); EXPECT_EQ(u"t", lines[1]); // Two words truncated. EXPECT_EQ(INSUFFICIENT_SPACE_FOR_FIRST_WORD, - result_for_width("Test\nTest", tes_width)); + result_for_width(u"Test\nTest", tes_width)); EXPECT_EQ(4u, lines.size()); EXPECT_EQ(u"Tes", lines[0]); EXPECT_EQ(u"t", lines[1]); @@ -804,14 +759,14 @@ EXPECT_EQ(u"t", lines[3]); // Word truncated, but not the first. - EXPECT_EQ(0, result_for_width("T Test", tes_width)); + EXPECT_EQ(0, result_for_width(u"T Test", tes_width)); EXPECT_EQ(3u, lines.size()); EXPECT_EQ(u"T", lines[0]); EXPECT_EQ(u"Tes", lines[1]); EXPECT_EQ(u"t", lines[2]); // Leading \n. - EXPECT_EQ(0, result_for_width("\nTest", tes_width)); + EXPECT_EQ(0, result_for_width(u"\nTest", tes_width)); EXPECT_EQ(3u, lines.size()); EXPECT_EQ(u"", lines[0]); EXPECT_EQ(u"Tes", lines[1]); @@ -827,17 +782,17 @@ INSUFFICIENT_SPACE_HORIZONTAL | INSUFFICIENT_SPACE_VERTICAL; struct TestData { - const char* input; + const char16_t* input; float available_pixel_width; int available_pixel_height; bool wrap_words; bool truncated_x; - const char* output; + const char16_t* output; } cases[] = { - { "Test T.", test_t_width, line_height * 2, false, false, "Test|T." }, - { "Test T ?", test_t_width, line_height * 2, false, false, "Test|T ?" }, - { "Test. Test", test_width, line_height * 3, false, true, "Test|Test" }, - { "Test. Test", test_width, line_height * 3, true, false, "Test|.|Test" }, + {u"Test T.", test_t_width, line_height * 2, false, false, u"Test|T."}, + {u"Test T ?", test_t_width, line_height * 2, false, false, u"Test|T ?"}, + {u"Test. Test", test_width, line_height * 3, false, true, u"Test|Test"}, + {u"Test. Test", test_width, line_height * 3, true, false, u"Test|.|Test"}, }; for (size_t i = 0; i < base::size(cases); ++i) { @@ -845,13 +800,12 @@ const WordWrapBehavior wrap_behavior = (cases[i].wrap_words ? WRAP_LONG_WORDS : TRUNCATE_LONG_WORDS); EXPECT_EQ(cases[i].truncated_x ? INSUFFICIENT_SPACE_HORIZONTAL : 0, - ElideRectangleText(UTF8ToUTF16(cases[i].input), font_list, - cases[i].available_pixel_width, - cases[i].available_pixel_height, wrap_behavior, - &lines) & + ElideRectangleText( + cases[i].input, font_list, cases[i].available_pixel_width, + cases[i].available_pixel_height, wrap_behavior, &lines) & kResultMask); if (cases[i].output) { - const std::string result = UTF16ToUTF8(base::JoinString(lines, u"|")); + const std::u16string result = base::JoinString(lines, u"|"); EXPECT_EQ(cases[i].output, result) << "Case " << i << " failed!"; } else { EXPECT_TRUE(lines.empty()) << "Case " << i << " failed!"; @@ -862,60 +816,58 @@ TEST(TextEliderTest, ElideRectangleTextLongWords) { const FontList font_list; const int kAvailableHeight = 1000; - const std::u16string kElidedTesting = - UTF8ToUTF16(std::string("Tes") + kEllipsis); + const std::u16string kElidedTesting = u"Tes…"; const float elided_width = GetStringWidthF(kElidedTesting, font_list); const float test_width = GetStringWidthF(u"Test", font_list); constexpr int kResultMask = INSUFFICIENT_SPACE_HORIZONTAL | INSUFFICIENT_SPACE_VERTICAL; struct TestData { - const char* input; + const char16_t* input; float available_pixel_width; WordWrapBehavior wrap_behavior; bool truncated_x; - const char* output; + const char16_t* output; } cases[] = { - { "Testing", test_width, IGNORE_LONG_WORDS, false, "Testing" }, - { "X Testing", test_width, IGNORE_LONG_WORDS, false, "X|Testing" }, - { "Test Testing", test_width, IGNORE_LONG_WORDS, false, "Test|Testing" }, - { "Test\nTesting", test_width, IGNORE_LONG_WORDS, false, "Test|Testing" }, - { "Test Tests ", test_width, IGNORE_LONG_WORDS, false, "Test|Tests" }, - { "Test Tests T", test_width, IGNORE_LONG_WORDS, false, "Test|Tests|T" }, + {u"Testing", test_width, IGNORE_LONG_WORDS, false, u"Testing"}, + {u"X Testing", test_width, IGNORE_LONG_WORDS, false, u"X|Testing"}, + {u"Test Testing", test_width, IGNORE_LONG_WORDS, false, u"Test|Testing"}, + {u"Test\nTesting", test_width, IGNORE_LONG_WORDS, false, u"Test|Testing"}, + {u"Test Tests ", test_width, IGNORE_LONG_WORDS, false, u"Test|Tests"}, + {u"Test Tests T", test_width, IGNORE_LONG_WORDS, false, u"Test|Tests|T"}, - { "Testing", elided_width, ELIDE_LONG_WORDS, true, "Tes..." }, - { "X Testing", elided_width, ELIDE_LONG_WORDS, true, "X|Tes..." }, - { "Test Testing", elided_width, ELIDE_LONG_WORDS, true, "Test|Tes..." }, - { "Test\nTesting", elided_width, ELIDE_LONG_WORDS, true, "Test|Tes..." }, + {u"Testing", elided_width, ELIDE_LONG_WORDS, true, u"Tes…"}, + {u"X Testing", elided_width, ELIDE_LONG_WORDS, true, u"X|Tes…"}, + {u"Test Testing", elided_width, ELIDE_LONG_WORDS, true, u"Test|Tes…"}, + {u"Test\nTesting", elided_width, ELIDE_LONG_WORDS, true, u"Test|Tes…"}, - { "Testing", test_width, TRUNCATE_LONG_WORDS, true, "Test" }, - { "X Testing", test_width, TRUNCATE_LONG_WORDS, true, "X|Test" }, - { "Test Testing", test_width, TRUNCATE_LONG_WORDS, true, "Test|Test" }, - { "Test\nTesting", test_width, TRUNCATE_LONG_WORDS, true, "Test|Test" }, - { "Test Tests ", test_width, TRUNCATE_LONG_WORDS, true, "Test|Test" }, - { "Test Tests T", test_width, TRUNCATE_LONG_WORDS, true, "Test|Test|T" }, + {u"Testing", test_width, TRUNCATE_LONG_WORDS, true, u"Test"}, + {u"X Testing", test_width, TRUNCATE_LONG_WORDS, true, u"X|Test"}, + {u"Test Testing", test_width, TRUNCATE_LONG_WORDS, true, u"Test|Test"}, + {u"Test\nTesting", test_width, TRUNCATE_LONG_WORDS, true, u"Test|Test"}, + {u"Test Tests ", test_width, TRUNCATE_LONG_WORDS, true, u"Test|Test"}, + {u"Test Tests T", test_width, TRUNCATE_LONG_WORDS, true, u"Test|Test|T"}, - { "Testing", test_width, WRAP_LONG_WORDS, false, "Test|ing" }, - { "X Testing", test_width, WRAP_LONG_WORDS, false, "X|Test|ing" }, - { "Test Testing", test_width, WRAP_LONG_WORDS, false, "Test|Test|ing" }, - { "Test\nTesting", test_width, WRAP_LONG_WORDS, false, "Test|Test|ing" }, - { "Test Tests ", test_width, WRAP_LONG_WORDS, false, "Test|Test|s" }, - { "Test Tests T", test_width, WRAP_LONG_WORDS, false, "Test|Test|s T" }, - { "TestTestTest", test_width, WRAP_LONG_WORDS, false, "Test|Test|Test" }, - { "TestTestTestT", test_width, WRAP_LONG_WORDS, false, "Test|Test|Test|T" }, + {u"Testing", test_width, WRAP_LONG_WORDS, false, u"Test|ing"}, + {u"X Testing", test_width, WRAP_LONG_WORDS, false, u"X|Test|ing"}, + {u"Test Testing", test_width, WRAP_LONG_WORDS, false, u"Test|Test|ing"}, + {u"Test\nTesting", test_width, WRAP_LONG_WORDS, false, u"Test|Test|ing"}, + {u"Test Tests ", test_width, WRAP_LONG_WORDS, false, u"Test|Test|s"}, + {u"Test Tests T", test_width, WRAP_LONG_WORDS, false, u"Test|Test|s T"}, + {u"TestTestTest", test_width, WRAP_LONG_WORDS, false, u"Test|Test|Test"}, + {u"TestTestTestT", test_width, WRAP_LONG_WORDS, false, + u"Test|Test|Test|T"}, }; for (size_t i = 0; i < base::size(cases); ++i) { std::vector<std::u16string> lines; - EXPECT_EQ( - cases[i].truncated_x ? INSUFFICIENT_SPACE_HORIZONTAL : 0, - ElideRectangleText(UTF8ToUTF16(cases[i].input), font_list, - cases[i].available_pixel_width, kAvailableHeight, - cases[i].wrap_behavior, &lines) & - kResultMask); - std::string expected_output(cases[i].output); - base::ReplaceSubstringsAfterOffset(&expected_output, 0, "...", kEllipsis); - const std::string result = UTF16ToUTF8(base::JoinString(lines, u"|")); + EXPECT_EQ(cases[i].truncated_x ? INSUFFICIENT_SPACE_HORIZONTAL : 0, + ElideRectangleText( + cases[i].input, font_list, cases[i].available_pixel_width, + kAvailableHeight, cases[i].wrap_behavior, &lines) & + kResultMask); + std::u16string expected_output(cases[i].output); + const std::u16string result = base::JoinString(lines, u"|"); EXPECT_EQ(expected_output, result) << "Case " << i << " failed!"; } } @@ -933,14 +885,10 @@ #endif const float kAvailableWidth = 235; const int kAvailableHeight = 1000; - const char text[] = "that Russian place we used to go to after fencing"; + const char16_t text[] = u"that Russian place we used to go to after fencing"; std::vector<std::u16string> lines; - EXPECT_EQ(0, ElideRectangleText(UTF8ToUTF16(text), - font_list, - kAvailableWidth, - kAvailableHeight, - WRAP_LONG_WORDS, - &lines)); + EXPECT_EQ(0, ElideRectangleText(text, font_list, kAvailableWidth, + kAvailableHeight, WRAP_LONG_WORDS, &lines)); ASSERT_EQ(2u, lines.size()); EXPECT_LE(GetStringWidthF(lines[0], font_list), kAvailableWidth); EXPECT_LE(GetStringWidthF(lines[1], font_list), kAvailableWidth); @@ -954,10 +902,10 @@ FontList font_list; font_list = FontList("Noto Sans UI,ui-sans, 12px"); SetFontRenderParamsDeviceScaleFactor(1.25f); -#define WIDTH(x) GetStringWidthF(UTF8ToUTF16(x), font_list) - EXPECT_EQ(WIDTH("The administrator for this account has"), - WIDTH("The ") + WIDTH("administrator ") + WIDTH("for ") + - WIDTH("this ") + WIDTH("account ") + WIDTH("has")); +#define WIDTH(x) GetStringWidthF((x), font_list) + EXPECT_EQ(WIDTH(u"The administrator for this account has"), + WIDTH(u"The ") + WIDTH(u"administrator ") + WIDTH(u"for ") + + WIDTH(u"this ") + WIDTH(u"account ") + WIDTH(u"has")); #undef WIDTH SetFontRenderParamsDeviceScaleFactor(1.0f); } @@ -965,181 +913,172 @@ TEST(TextEliderTest, ElideRectangleString) { struct TestData { - const char* input; + const char16_t* input; int max_rows; int max_cols; bool result; - const char* output; + const char16_t* output; } cases[] = { - { "", 0, 0, false, "" }, - { "", 1, 1, false, "" }, - { "Hi, my name is\nTom", 0, 0, true, "..." }, - { "Hi, my name is\nTom", 1, 0, true, "\n..." }, - { "Hi, my name is\nTom", 0, 1, true, "..." }, - { "Hi, my name is\nTom", 1, 1, true, "H\n..." }, - { "Hi, my name is\nTom", 2, 1, true, "H\ni\n..." }, - { "Hi, my name is\nTom", 3, 1, true, "H\ni\n,\n..." }, - { "Hi, my name is\nTom", 4, 1, true, "H\ni\n,\n \n..." }, - { "Hi, my name is\nTom", 5, 1, true, "H\ni\n,\n \nm\n..." }, - { "Hi, my name is\nTom", 0, 2, true, "..." }, - { "Hi, my name is\nTom", 1, 2, true, "Hi\n..." }, - { "Hi, my name is\nTom", 2, 2, true, "Hi\n, \n..." }, - { "Hi, my name is\nTom", 3, 2, true, "Hi\n, \nmy\n..." }, - { "Hi, my name is\nTom", 4, 2, true, "Hi\n, \nmy\n n\n..." }, - { "Hi, my name is\nTom", 5, 2, true, "Hi\n, \nmy\n n\nam\n..." }, - { "Hi, my name is\nTom", 0, 3, true, "..." }, - { "Hi, my name is\nTom", 1, 3, true, "Hi,\n..." }, - { "Hi, my name is\nTom", 2, 3, true, "Hi,\n my\n..." }, - { "Hi, my name is\nTom", 3, 3, true, "Hi,\n my\n na\n..." }, - { "Hi, my name is\nTom", 4, 3, true, "Hi,\n my\n na\nme \n..." }, - { "Hi, my name is\nTom", 5, 3, true, "Hi,\n my\n na\nme \nis\n..." }, - { "Hi, my name is\nTom", 1, 4, true, "Hi, \n..." }, - { "Hi, my name is\nTom", 2, 4, true, "Hi, \nmy n\n..." }, - { "Hi, my name is\nTom", 3, 4, true, "Hi, \nmy n\name \n..." }, - { "Hi, my name is\nTom", 4, 4, true, "Hi, \nmy n\name \nis\n..." }, - { "Hi, my name is\nTom", 5, 4, false, "Hi, \nmy n\name \nis\nTom" }, - { "Hi, my name is\nTom", 1, 5, true, "Hi, \n..." }, - { "Hi, my name is\nTom", 2, 5, true, "Hi, \nmy na\n..." }, - { "Hi, my name is\nTom", 3, 5, true, "Hi, \nmy na\nme \n..." }, - { "Hi, my name is\nTom", 4, 5, true, "Hi, \nmy na\nme \nis\n..." }, - { "Hi, my name is\nTom", 5, 5, false, "Hi, \nmy na\nme \nis\nTom" }, - { "Hi, my name is\nTom", 1, 6, true, "Hi, \n..." }, - { "Hi, my name is\nTom", 2, 6, true, "Hi, \nmy \n..." }, - { "Hi, my name is\nTom", 3, 6, true, "Hi, \nmy \nname \n..." }, - { "Hi, my name is\nTom", 4, 6, true, "Hi, \nmy \nname \nis\n..." }, - { "Hi, my name is\nTom", 5, 6, false, "Hi, \nmy \nname \nis\nTom" }, - { "Hi, my name is\nTom", 1, 7, true, "Hi, \n..." }, - { "Hi, my name is\nTom", 2, 7, true, "Hi, \nmy \n..." }, - { "Hi, my name is\nTom", 3, 7, true, "Hi, \nmy \nname \n..." }, - { "Hi, my name is\nTom", 4, 7, true, "Hi, \nmy \nname \nis\n..." }, - { "Hi, my name is\nTom", 5, 7, false, "Hi, \nmy \nname \nis\nTom" }, - { "Hi, my name is\nTom", 1, 8, true, "Hi, my \n..." }, - { "Hi, my name is\nTom", 2, 8, true, "Hi, my \nname \n..." }, - { "Hi, my name is\nTom", 3, 8, true, "Hi, my \nname \nis\n..." }, - { "Hi, my name is\nTom", 4, 8, false, "Hi, my \nname \nis\nTom" }, - { "Hi, my name is\nTom", 1, 9, true, "Hi, my \n..." }, - { "Hi, my name is\nTom", 2, 9, true, "Hi, my \nname is\n..." }, - { "Hi, my name is\nTom", 3, 9, false, "Hi, my \nname is\nTom" }, - { "Hi, my name is\nTom", 1, 10, true, "Hi, my \n..." }, - { "Hi, my name is\nTom", 2, 10, true, "Hi, my \nname is\n..." }, - { "Hi, my name is\nTom", 3, 10, false, "Hi, my \nname is\nTom" }, - { "Hi, my name is\nTom", 1, 11, true, "Hi, my \n..." }, - { "Hi, my name is\nTom", 2, 11, true, "Hi, my \nname is\n..." }, - { "Hi, my name is\nTom", 3, 11, false, "Hi, my \nname is\nTom" }, - { "Hi, my name is\nTom", 1, 12, true, "Hi, my \n..." }, - { "Hi, my name is\nTom", 2, 12, true, "Hi, my \nname is\n..." }, - { "Hi, my name is\nTom", 3, 12, false, "Hi, my \nname is\nTom" }, - { "Hi, my name is\nTom", 1, 13, true, "Hi, my name \n..." }, - { "Hi, my name is\nTom", 2, 13, true, "Hi, my name \nis\n..." }, - { "Hi, my name is\nTom", 3, 13, false, "Hi, my name \nis\nTom" }, - { "Hi, my name is\nTom", 1, 20, true, "Hi, my name is\n..." }, - { "Hi, my name is\nTom", 2, 20, false, "Hi, my name is\nTom" }, - { "Hi, my name is Tom", 1, 40, false, "Hi, my name is Tom" }, + {u"", 0, 0, false, u""}, + {u"", 1, 1, false, u""}, + {u"Hi, my name is\nTom", 0, 0, true, u"..."}, + {u"Hi, my name is\nTom", 1, 0, true, u"\n..."}, + {u"Hi, my name is\nTom", 0, 1, true, u"..."}, + {u"Hi, my name is\nTom", 1, 1, true, u"H\n..."}, + {u"Hi, my name is\nTom", 2, 1, true, u"H\ni\n..."}, + {u"Hi, my name is\nTom", 3, 1, true, u"H\ni\n,\n..."}, + {u"Hi, my name is\nTom", 4, 1, true, u"H\ni\n,\n \n..."}, + {u"Hi, my name is\nTom", 5, 1, true, u"H\ni\n,\n \nm\n..."}, + {u"Hi, my name is\nTom", 0, 2, true, u"..."}, + {u"Hi, my name is\nTom", 1, 2, true, u"Hi\n..."}, + {u"Hi, my name is\nTom", 2, 2, true, u"Hi\n, \n..."}, + {u"Hi, my name is\nTom", 3, 2, true, u"Hi\n, \nmy\n..."}, + {u"Hi, my name is\nTom", 4, 2, true, u"Hi\n, \nmy\n n\n..."}, + {u"Hi, my name is\nTom", 5, 2, true, u"Hi\n, \nmy\n n\nam\n..."}, + {u"Hi, my name is\nTom", 0, 3, true, u"..."}, + {u"Hi, my name is\nTom", 1, 3, true, u"Hi,\n..."}, + {u"Hi, my name is\nTom", 2, 3, true, u"Hi,\n my\n..."}, + {u"Hi, my name is\nTom", 3, 3, true, u"Hi,\n my\n na\n..."}, + {u"Hi, my name is\nTom", 4, 3, true, u"Hi,\n my\n na\nme \n..."}, + {u"Hi, my name is\nTom", 5, 3, true, u"Hi,\n my\n na\nme \nis\n..."}, + {u"Hi, my name is\nTom", 1, 4, true, u"Hi, \n..."}, + {u"Hi, my name is\nTom", 2, 4, true, u"Hi, \nmy n\n..."}, + {u"Hi, my name is\nTom", 3, 4, true, u"Hi, \nmy n\name \n..."}, + {u"Hi, my name is\nTom", 4, 4, true, u"Hi, \nmy n\name \nis\n..."}, + {u"Hi, my name is\nTom", 5, 4, false, u"Hi, \nmy n\name \nis\nTom"}, + {u"Hi, my name is\nTom", 1, 5, true, u"Hi, \n..."}, + {u"Hi, my name is\nTom", 2, 5, true, u"Hi, \nmy na\n..."}, + {u"Hi, my name is\nTom", 3, 5, true, u"Hi, \nmy na\nme \n..."}, + {u"Hi, my name is\nTom", 4, 5, true, u"Hi, \nmy na\nme \nis\n..."}, + {u"Hi, my name is\nTom", 5, 5, false, u"Hi, \nmy na\nme \nis\nTom"}, + {u"Hi, my name is\nTom", 1, 6, true, u"Hi, \n..."}, + {u"Hi, my name is\nTom", 2, 6, true, u"Hi, \nmy \n..."}, + {u"Hi, my name is\nTom", 3, 6, true, u"Hi, \nmy \nname \n..."}, + {u"Hi, my name is\nTom", 4, 6, true, u"Hi, \nmy \nname \nis\n..."}, + {u"Hi, my name is\nTom", 5, 6, false, u"Hi, \nmy \nname \nis\nTom"}, + {u"Hi, my name is\nTom", 1, 7, true, u"Hi, \n..."}, + {u"Hi, my name is\nTom", 2, 7, true, u"Hi, \nmy \n..."}, + {u"Hi, my name is\nTom", 3, 7, true, u"Hi, \nmy \nname \n..."}, + {u"Hi, my name is\nTom", 4, 7, true, u"Hi, \nmy \nname \nis\n..."}, + {u"Hi, my name is\nTom", 5, 7, false, u"Hi, \nmy \nname \nis\nTom"}, + {u"Hi, my name is\nTom", 1, 8, true, u"Hi, my \n..."}, + {u"Hi, my name is\nTom", 2, 8, true, u"Hi, my \nname \n..."}, + {u"Hi, my name is\nTom", 3, 8, true, u"Hi, my \nname \nis\n..."}, + {u"Hi, my name is\nTom", 4, 8, false, u"Hi, my \nname \nis\nTom"}, + {u"Hi, my name is\nTom", 1, 9, true, u"Hi, my \n..."}, + {u"Hi, my name is\nTom", 2, 9, true, u"Hi, my \nname is\n..."}, + {u"Hi, my name is\nTom", 3, 9, false, u"Hi, my \nname is\nTom"}, + {u"Hi, my name is\nTom", 1, 10, true, u"Hi, my \n..."}, + {u"Hi, my name is\nTom", 2, 10, true, u"Hi, my \nname is\n..."}, + {u"Hi, my name is\nTom", 3, 10, false, u"Hi, my \nname is\nTom"}, + {u"Hi, my name is\nTom", 1, 11, true, u"Hi, my \n..."}, + {u"Hi, my name is\nTom", 2, 11, true, u"Hi, my \nname is\n..."}, + {u"Hi, my name is\nTom", 3, 11, false, u"Hi, my \nname is\nTom"}, + {u"Hi, my name is\nTom", 1, 12, true, u"Hi, my \n..."}, + {u"Hi, my name is\nTom", 2, 12, true, u"Hi, my \nname is\n..."}, + {u"Hi, my name is\nTom", 3, 12, false, u"Hi, my \nname is\nTom"}, + {u"Hi, my name is\nTom", 1, 13, true, u"Hi, my name \n..."}, + {u"Hi, my name is\nTom", 2, 13, true, u"Hi, my name \nis\n..."}, + {u"Hi, my name is\nTom", 3, 13, false, u"Hi, my name \nis\nTom"}, + {u"Hi, my name is\nTom", 1, 20, true, u"Hi, my name is\n..."}, + {u"Hi, my name is\nTom", 2, 20, false, u"Hi, my name is\nTom"}, + {u"Hi, my name is Tom", 1, 40, false, u"Hi, my name is Tom"}, }; std::u16string output; for (size_t i = 0; i < base::size(cases); ++i) { EXPECT_EQ(cases[i].result, - ElideRectangleString(UTF8ToUTF16(cases[i].input), - cases[i].max_rows, cases[i].max_cols, - true, &output)); - EXPECT_EQ(cases[i].output, UTF16ToUTF8(output)); + ElideRectangleString(cases[i].input, cases[i].max_rows, + cases[i].max_cols, true, &output)); + EXPECT_EQ(cases[i].output, output); } } TEST(TextEliderTest, ElideRectangleStringNotStrict) { struct TestData { - const char* input; + const char16_t* input; int max_rows; int max_cols; bool result; - const char* output; + const char16_t* output; } cases[] = { - { "", 0, 0, false, "" }, - { "", 1, 1, false, "" }, - { "Hi, my name_is\nDick", 0, 0, true, "..." }, - { "Hi, my name_is\nDick", 1, 0, true, "\n..." }, - { "Hi, my name_is\nDick", 0, 1, true, "..." }, - { "Hi, my name_is\nDick", 1, 1, true, "H\n..." }, - { "Hi, my name_is\nDick", 2, 1, true, "H\ni\n..." }, - { "Hi, my name_is\nDick", 3, 1, true, "H\ni\n,\n..." }, - { "Hi, my name_is\nDick", 4, 1, true, "H\ni\n,\n \n..." }, - { "Hi, my name_is\nDick", 5, 1, true, "H\ni\n,\n \nm\n..." }, - { "Hi, my name_is\nDick", 0, 2, true, "..." }, - { "Hi, my name_is\nDick", 1, 2, true, "Hi\n..." }, - { "Hi, my name_is\nDick", 2, 2, true, "Hi\n, \n..." }, - { "Hi, my name_is\nDick", 3, 2, true, "Hi\n, \nmy\n..." }, - { "Hi, my name_is\nDick", 4, 2, true, "Hi\n, \nmy\n n\n..." }, - { "Hi, my name_is\nDick", 5, 2, true, "Hi\n, \nmy\n n\nam\n..." }, - { "Hi, my name_is\nDick", 0, 3, true, "..." }, - { "Hi, my name_is\nDick", 1, 3, true, "Hi,\n..." }, - { "Hi, my name_is\nDick", 2, 3, true, "Hi,\n my\n..." }, - { "Hi, my name_is\nDick", 3, 3, true, "Hi,\n my\n na\n..." }, - { "Hi, my name_is\nDick", 4, 3, true, "Hi,\n my\n na\nme_\n..." }, - { "Hi, my name_is\nDick", 5, 3, true, "Hi,\n my\n na\nme_\nis\n..." }, - { "Hi, my name_is\nDick", 1, 4, true, "Hi, ..." }, - { "Hi, my name_is\nDick", 2, 4, true, "Hi, my n\n..." }, - { "Hi, my name_is\nDick", 3, 4, true, "Hi, my n\name_\n..." }, - { "Hi, my name_is\nDick", 4, 4, true, "Hi, my n\name_\nis\n..." }, - { "Hi, my name_is\nDick", 5, 4, false, "Hi, my n\name_\nis\nDick" }, - { "Hi, my name_is\nDick", 1, 5, true, "Hi, ..." }, - { "Hi, my name_is\nDick", 2, 5, true, "Hi, my na\n..." }, - { "Hi, my name_is\nDick", 3, 5, true, "Hi, my na\nme_is\n..." }, - { "Hi, my name_is\nDick", 4, 5, true, "Hi, my na\nme_is\n\n..." }, - { "Hi, my name_is\nDick", 5, 5, false, "Hi, my na\nme_is\n\nDick" }, - { "Hi, my name_is\nDick", 1, 6, true, "Hi, ..." }, - { "Hi, my name_is\nDick", 2, 6, true, "Hi, my nam\n..." }, - { "Hi, my name_is\nDick", 3, 6, true, "Hi, my nam\ne_is\n..." }, - { "Hi, my name_is\nDick", 4, 6, false, "Hi, my nam\ne_is\nDick" }, - { "Hi, my name_is\nDick", 5, 6, false, "Hi, my nam\ne_is\nDick" }, - { "Hi, my name_is\nDick", 1, 7, true, "Hi, ..." }, - { "Hi, my name_is\nDick", 2, 7, true, "Hi, my name\n..." }, - { "Hi, my name_is\nDick", 3, 7, true, "Hi, my name\n_is\n..." }, - { "Hi, my name_is\nDick", 4, 7, false, "Hi, my name\n_is\nDick" }, - { "Hi, my name_is\nDick", 5, 7, false, "Hi, my name\n_is\nDick" }, - { "Hi, my name_is\nDick", 1, 8, true, "Hi, my n\n..." }, - { "Hi, my name_is\nDick", 2, 8, true, "Hi, my n\name_is\n..." }, - { "Hi, my name_is\nDick", 3, 8, false, "Hi, my n\name_is\nDick" }, - { "Hi, my name_is\nDick", 1, 9, true, "Hi, my ..." }, - { "Hi, my name_is\nDick", 2, 9, true, "Hi, my name_is\n..." }, - { "Hi, my name_is\nDick", 3, 9, false, "Hi, my name_is\nDick" }, - { "Hi, my name_is\nDick", 1, 10, true, "Hi, my ..." }, - { "Hi, my name_is\nDick", 2, 10, true, "Hi, my name_is\n..." }, - { "Hi, my name_is\nDick", 3, 10, false, "Hi, my name_is\nDick" }, - { "Hi, my name_is\nDick", 1, 11, true, "Hi, my ..." }, - { "Hi, my name_is\nDick", 2, 11, true, "Hi, my name_is\n..." }, - { "Hi, my name_is\nDick", 3, 11, false, "Hi, my name_is\nDick" }, - { "Hi, my name_is\nDick", 1, 12, true, "Hi, my ..." }, - { "Hi, my name_is\nDick", 2, 12, true, "Hi, my name_is\n..." }, - { "Hi, my name_is\nDick", 3, 12, false, "Hi, my name_is\nDick" }, - { "Hi, my name_is\nDick", 1, 13, true, "Hi, my ..." }, - { "Hi, my name_is\nDick", 2, 13, true, "Hi, my name_is\n..." }, - { "Hi, my name_is\nDick", 3, 13, false, "Hi, my name_is\nDick" }, - { "Hi, my name_is\nDick", 1, 20, true, "Hi, my name_is\n..." }, - { "Hi, my name_is\nDick", 2, 20, false, "Hi, my name_is\nDick" }, - { "Hi, my name_is Dick", 1, 40, false, "Hi, my name_is Dick" }, + {u"", 0, 0, false, u""}, + {u"", 1, 1, false, u""}, + {u"Hi, my name_is\nDick", 0, 0, true, u"..."}, + {u"Hi, my name_is\nDick", 1, 0, true, u"\n..."}, + {u"Hi, my name_is\nDick", 0, 1, true, u"..."}, + {u"Hi, my name_is\nDick", 1, 1, true, u"H\n..."}, + {u"Hi, my name_is\nDick", 2, 1, true, u"H\ni\n..."}, + {u"Hi, my name_is\nDick", 3, 1, true, u"H\ni\n,\n..."}, + {u"Hi, my name_is\nDick", 4, 1, true, u"H\ni\n,\n \n..."}, + {u"Hi, my name_is\nDick", 5, 1, true, u"H\ni\n,\n \nm\n..."}, + {u"Hi, my name_is\nDick", 0, 2, true, u"..."}, + {u"Hi, my name_is\nDick", 1, 2, true, u"Hi\n..."}, + {u"Hi, my name_is\nDick", 2, 2, true, u"Hi\n, \n..."}, + {u"Hi, my name_is\nDick", 3, 2, true, u"Hi\n, \nmy\n..."}, + {u"Hi, my name_is\nDick", 4, 2, true, u"Hi\n, \nmy\n n\n..."}, + {u"Hi, my name_is\nDick", 5, 2, true, u"Hi\n, \nmy\n n\nam\n..."}, + {u"Hi, my name_is\nDick", 0, 3, true, u"..."}, + {u"Hi, my name_is\nDick", 1, 3, true, u"Hi,\n..."}, + {u"Hi, my name_is\nDick", 2, 3, true, u"Hi,\n my\n..."}, + {u"Hi, my name_is\nDick", 3, 3, true, u"Hi,\n my\n na\n..."}, + {u"Hi, my name_is\nDick", 4, 3, true, u"Hi,\n my\n na\nme_\n..."}, + {u"Hi, my name_is\nDick", 5, 3, true, u"Hi,\n my\n na\nme_\nis\n..."}, + {u"Hi, my name_is\nDick", 1, 4, true, u"Hi, ..."}, + {u"Hi, my name_is\nDick", 2, 4, true, u"Hi, my n\n..."}, + {u"Hi, my name_is\nDick", 3, 4, true, u"Hi, my n\name_\n..."}, + {u"Hi, my name_is\nDick", 4, 4, true, u"Hi, my n\name_\nis\n..."}, + {u"Hi, my name_is\nDick", 5, 4, false, u"Hi, my n\name_\nis\nDick"}, + {u"Hi, my name_is\nDick", 1, 5, true, u"Hi, ..."}, + {u"Hi, my name_is\nDick", 2, 5, true, u"Hi, my na\n..."}, + {u"Hi, my name_is\nDick", 3, 5, true, u"Hi, my na\nme_is\n..."}, + {u"Hi, my name_is\nDick", 4, 5, true, u"Hi, my na\nme_is\n\n..."}, + {u"Hi, my name_is\nDick", 5, 5, false, u"Hi, my na\nme_is\n\nDick"}, + {u"Hi, my name_is\nDick", 1, 6, true, u"Hi, ..."}, + {u"Hi, my name_is\nDick", 2, 6, true, u"Hi, my nam\n..."}, + {u"Hi, my name_is\nDick", 3, 6, true, u"Hi, my nam\ne_is\n..."}, + {u"Hi, my name_is\nDick", 4, 6, false, u"Hi, my nam\ne_is\nDick"}, + {u"Hi, my name_is\nDick", 5, 6, false, u"Hi, my nam\ne_is\nDick"}, + {u"Hi, my name_is\nDick", 1, 7, true, u"Hi, ..."}, + {u"Hi, my name_is\nDick", 2, 7, true, u"Hi, my name\n..."}, + {u"Hi, my name_is\nDick", 3, 7, true, u"Hi, my name\n_is\n..."}, + {u"Hi, my name_is\nDick", 4, 7, false, u"Hi, my name\n_is\nDick"}, + {u"Hi, my name_is\nDick", 5, 7, false, u"Hi, my name\n_is\nDick"}, + {u"Hi, my name_is\nDick", 1, 8, true, u"Hi, my n\n..."}, + {u"Hi, my name_is\nDick", 2, 8, true, u"Hi, my n\name_is\n..."}, + {u"Hi, my name_is\nDick", 3, 8, false, u"Hi, my n\name_is\nDick"}, + {u"Hi, my name_is\nDick", 1, 9, true, u"Hi, my ..."}, + {u"Hi, my name_is\nDick", 2, 9, true, u"Hi, my name_is\n..."}, + {u"Hi, my name_is\nDick", 3, 9, false, u"Hi, my name_is\nDick"}, + {u"Hi, my name_is\nDick", 1, 10, true, u"Hi, my ..."}, + {u"Hi, my name_is\nDick", 2, 10, true, u"Hi, my name_is\n..."}, + {u"Hi, my name_is\nDick", 3, 10, false, u"Hi, my name_is\nDick"}, + {u"Hi, my name_is\nDick", 1, 11, true, u"Hi, my ..."}, + {u"Hi, my name_is\nDick", 2, 11, true, u"Hi, my name_is\n..."}, + {u"Hi, my name_is\nDick", 3, 11, false, u"Hi, my name_is\nDick"}, + {u"Hi, my name_is\nDick", 1, 12, true, u"Hi, my ..."}, + {u"Hi, my name_is\nDick", 2, 12, true, u"Hi, my name_is\n..."}, + {u"Hi, my name_is\nDick", 3, 12, false, u"Hi, my name_is\nDick"}, + {u"Hi, my name_is\nDick", 1, 13, true, u"Hi, my ..."}, + {u"Hi, my name_is\nDick", 2, 13, true, u"Hi, my name_is\n..."}, + {u"Hi, my name_is\nDick", 3, 13, false, u"Hi, my name_is\nDick"}, + {u"Hi, my name_is\nDick", 1, 20, true, u"Hi, my name_is\n..."}, + {u"Hi, my name_is\nDick", 2, 20, false, u"Hi, my name_is\nDick"}, + {u"Hi, my name_is Dick", 1, 40, false, u"Hi, my name_is Dick"}, }; std::u16string output; for (size_t i = 0; i < base::size(cases); ++i) { EXPECT_EQ(cases[i].result, - ElideRectangleString(UTF8ToUTF16(cases[i].input), - cases[i].max_rows, cases[i].max_cols, - false, &output)); - EXPECT_EQ(cases[i].output, UTF16ToUTF8(output)); + ElideRectangleString(cases[i].input, cases[i].max_rows, + cases[i].max_cols, false, &output)); + EXPECT_EQ(cases[i].output, output); } } TEST(TextEliderTest, ElideRectangleWide16) { // Two greek words separated by space. - const std::u16string str( - u"\x03a0\x03b1\x03b3\x03ba\x03cc\x03c3\x03bc\x03b9" - u"\x03bf\x03c2\x0020\x0399\x03c3\x03c4\x03cc\x03c2"); - const std::u16string out1( - u"\x03a0\x03b1\x03b3\x03ba\n" - u"\x03cc\x03c3\x03bc\x03b9\n" - u"..."); - const std::u16string out2( - u"\x03a0\x03b1\x03b3\x03ba\x03cc\x03c3\x03bc\x03b9\x03bf\x03c2\x0020\n" - u"\x0399\x03c3\x03c4\x03cc\x03c2"); + const std::u16string str(u"Παγκόσμιος Ιστός"); + const std::u16string out1(u"Παγκ\nόσμι\n..."); + const std::u16string out2(u"Παγκόσμιος \nΙστός"); std::u16string output; EXPECT_TRUE(ElideRectangleString(str, 2, 4, true, &output)); EXPECT_EQ(out1, output); @@ -1148,13 +1087,8 @@ } TEST(TextEliderTest, ElideRectangleWide32) { - // Four U+1D49C MATHEMATICAL SCRIPT CAPITAL A followed by space "aaaaa". - const std::u16string str(UTF8ToUTF16( - "\xF0\x9D\x92\x9C\xF0\x9D\x92\x9C\xF0\x9D\x92\x9C\xF0\x9D\x92\x9C" - " aaaaa")); - const std::u16string out( - UTF8ToUTF16("\xF0\x9D\x92\x9C\xF0\x9D\x92\x9C\xF0\x9D\x92\x9C\n" - "\xF0\x9D\x92\x9C \naaa\n...")); + const std::u16string str(u"𝒜𝒜𝒜𝒜 aaaaa"); + const std::u16string out(u"𝒜𝒜𝒜\n𝒜 \naaa\n..."); std::u16string output; EXPECT_TRUE(ElideRectangleString(str, 3, 3, true, &output)); EXPECT_EQ(out, output); @@ -1168,36 +1102,31 @@ EXPECT_EQ(std::u16string(), TruncateString(str, 0, CHARACTER_BREAK)); // Test breaking at character 1. - EXPECT_EQ(L"\x2026", UTF16ToWide(TruncateString(str, 1, WORD_BREAK))); - EXPECT_EQ(L"\x2026", UTF16ToWide(TruncateString(str, 1, CHARACTER_BREAK))); + EXPECT_EQ(u"…", TruncateString(str, 1, WORD_BREAK)); + EXPECT_EQ(u"…", TruncateString(str, 1, CHARACTER_BREAK)); // Test breaking in the middle of the first word. - EXPECT_EQ(L"f\x2026", UTF16ToWide(TruncateString(str, 2, WORD_BREAK))); - EXPECT_EQ(L"f\x2026", UTF16ToWide(TruncateString(str, 2, CHARACTER_BREAK))); + EXPECT_EQ(u"f…", TruncateString(str, 2, WORD_BREAK)); + EXPECT_EQ(u"f…", TruncateString(str, 2, CHARACTER_BREAK)); // Test breaking in between words. - EXPECT_EQ(L"fooooey\x2026", UTF16ToWide(TruncateString(str, 9, WORD_BREAK))); - EXPECT_EQ(L"fooooey\x2026", - UTF16ToWide(TruncateString(str, 9, CHARACTER_BREAK))); + EXPECT_EQ(u"fooooey…", TruncateString(str, 9, WORD_BREAK)); + EXPECT_EQ(u"fooooey…", TruncateString(str, 9, CHARACTER_BREAK)); // Test breaking at the start of a later word. - EXPECT_EQ(L"fooooey\x2026", UTF16ToWide(TruncateString(str, 11, WORD_BREAK))); - EXPECT_EQ(L"fooooey\x2026", - UTF16ToWide(TruncateString(str, 11, CHARACTER_BREAK))); + EXPECT_EQ(u"fooooey…", TruncateString(str, 11, WORD_BREAK)); + EXPECT_EQ(u"fooooey…", TruncateString(str, 11, CHARACTER_BREAK)); // Test breaking in the middle of a word. - EXPECT_EQ(L"fooooey\x2026", UTF16ToWide(TruncateString(str, 12, WORD_BREAK))); - EXPECT_EQ(L"fooooey\x2026", - UTF16ToWide(TruncateString(str, 12, CHARACTER_BREAK))); - EXPECT_EQ(L"fooooey\x2026", UTF16ToWide(TruncateString(str, 14, WORD_BREAK))); - EXPECT_EQ(L"fooooey bx\x2026", - UTF16ToWide(TruncateString(str, 14, CHARACTER_BREAK))); + EXPECT_EQ(u"fooooey…", TruncateString(str, 12, WORD_BREAK)); + EXPECT_EQ(u"fooooey…", TruncateString(str, 12, CHARACTER_BREAK)); + EXPECT_EQ(u"fooooey…", TruncateString(str, 14, WORD_BREAK)); + EXPECT_EQ(u"fooooey bx…", TruncateString(str, 14, CHARACTER_BREAK)); // Test breaking in whitespace at the end of the string. - EXPECT_EQ(L"fooooey bxxxar baz\x2026", - UTF16ToWide(TruncateString(str, 22, WORD_BREAK))); - EXPECT_EQ(L"fooooey bxxxar baz\x2026", - UTF16ToWide(TruncateString(str, 22, CHARACTER_BREAK))); + EXPECT_EQ(u"fooooey bxxxar baz…", TruncateString(str, 22, WORD_BREAK)); + EXPECT_EQ(u"fooooey bxxxar baz…", + TruncateString(str, 22, CHARACTER_BREAK)); // Test breaking at the end of the string. EXPECT_EQ(str, TruncateString(str, str.length(), WORD_BREAK)); @@ -1212,19 +1141,18 @@ std::u16string str2 = u" foo"; // Test breaking in leading whitespace. - EXPECT_EQ(L"\x2026", UTF16ToWide(TruncateString(str2, 2, WORD_BREAK))); - EXPECT_EQ(L"\x2026", UTF16ToWide(TruncateString(str2, 2, CHARACTER_BREAK))); + EXPECT_EQ(u"…", TruncateString(str2, 2, WORD_BREAK)); + EXPECT_EQ(u"…", TruncateString(str2, 2, CHARACTER_BREAK)); // Test breaking at the beginning of the first word, with leading whitespace. - EXPECT_EQ(L"\x2026", UTF16ToWide(TruncateString(str2, 3, WORD_BREAK))); - EXPECT_EQ(L"\x2026", UTF16ToWide(TruncateString(str2, 3, CHARACTER_BREAK))); + EXPECT_EQ(u"…", TruncateString(str2, 3, WORD_BREAK)); + EXPECT_EQ(u"…", TruncateString(str2, 3, CHARACTER_BREAK)); // Test breaking in the middle of the first word, with leading whitespace. - EXPECT_EQ(L"\x2026", UTF16ToWide(TruncateString(str2, 4, WORD_BREAK))); - EXPECT_EQ(L"\x2026", UTF16ToWide(TruncateString(str2, 4, CHARACTER_BREAK))); - EXPECT_EQ(L" f\x2026", UTF16ToWide(TruncateString(str2, 5, WORD_BREAK))); - EXPECT_EQ(L" f\x2026", - UTF16ToWide(TruncateString(str2, 5, CHARACTER_BREAK))); + EXPECT_EQ(u"…", TruncateString(str2, 4, WORD_BREAK)); + EXPECT_EQ(u"…", TruncateString(str2, 4, CHARACTER_BREAK)); + EXPECT_EQ(u" f…", TruncateString(str2, 5, WORD_BREAK)); + EXPECT_EQ(u" f…", TruncateString(str2, 5, CHARACTER_BREAK)); } } // namespace gfx
diff --git a/ui/message_center/notification_list_unittest.cc b/ui/message_center/notification_list_unittest.cc index 5c181f1..c2e019dc 100644 --- a/ui/message_center/notification_list_unittest.cc +++ b/ui/message_center/notification_list_unittest.cc
@@ -11,6 +11,7 @@ #include "base/i18n/time_formatting.h" #include "base/macros.h" +#include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" @@ -21,8 +22,6 @@ #include "ui/message_center/public/cpp/notification_types.h" #include "ui/message_center/public/cpp/notifier_id.h" -using base::UTF8ToUTF16; - namespace message_center { using NotificationState = NotificationList::NotificationState; @@ -61,13 +60,13 @@ const RichNotificationData& optional_fields, std::string* id_out) { *id_out = base::StringPrintf(kIdFormat, counter_); - std::unique_ptr<Notification> notification(new Notification( - NOTIFICATION_TYPE_SIMPLE, *id_out, - UTF8ToUTF16(base::StringPrintf(kTitleFormat, counter_)), - UTF8ToUTF16(base::StringPrintf(kMessageFormat, counter_)), gfx::Image(), - UTF8ToUTF16(kDisplaySource), GURL(), - NotifierId(NotifierType::APPLICATION, kExtensionId), optional_fields, - nullptr)); + std::unique_ptr<Notification> notification( + new Notification(NOTIFICATION_TYPE_SIMPLE, *id_out, + u"id" + base::NumberToString16(counter_), + u"message" + base::NumberToString16(counter_), + gfx::Image(), kDisplaySource, GURL(), + NotifierId(NotifierType::APPLICATION, kExtensionId), + optional_fields, nullptr)); return notification; } @@ -104,9 +103,7 @@ } static const char kIdFormat[]; - static const char kTitleFormat[]; - static const char kMessageFormat[]; - static const char kDisplaySource[]; + static const char16_t kDisplaySource[]; static const char kExtensionId[]; std::unique_ptr<FakeMessageCenter> message_center_; @@ -128,9 +125,7 @@ } const char NotificationListTest::kIdFormat[] = "id%ld"; -const char NotificationListTest::kTitleFormat[] = "id%ld"; -const char NotificationListTest::kMessageFormat[] = "message%ld"; -const char NotificationListTest::kDisplaySource[] = "source"; +const char16_t NotificationListTest::kDisplaySource[] = u"source"; const char NotificationListTest::kExtensionId[] = "ext"; TEST_F(NotificationListTest, Basic) { @@ -174,11 +169,11 @@ std::string id0 = AddNotification(); std::string replaced = id0 + "_replaced"; EXPECT_EQ(1u, notification_list_->NotificationCount(blockers_)); - std::unique_ptr<Notification> notification(new Notification( - NOTIFICATION_TYPE_SIMPLE, replaced, u"newtitle", u"newbody", gfx::Image(), - UTF8ToUTF16(kDisplaySource), GURL(), - NotifierId(NotifierType::APPLICATION, kExtensionId), - RichNotificationData(), nullptr)); + std::unique_ptr<Notification> notification( + new Notification(NOTIFICATION_TYPE_SIMPLE, replaced, u"newtitle", + u"newbody", gfx::Image(), kDisplaySource, GURL(), + NotifierId(NotifierType::APPLICATION, kExtensionId), + RichNotificationData(), nullptr)); notification_list_->UpdateNotificationMessage(id0, std::move(notification)); EXPECT_EQ(1u, notification_list_->NotificationCount(blockers_)); const NotificationList::Notifications notifications = @@ -465,11 +460,11 @@ EXPECT_EQ(0u, GetPopupCounts()); RichNotificationData optional; - std::unique_ptr<Notification> notification(new Notification( - NOTIFICATION_TYPE_SIMPLE, replaced, u"newtitle", u"newbody", - gfx::Image(), UTF8ToUTF16(kDisplaySource), GURL(), - NotifierId(NotifierType::APPLICATION, kExtensionId), optional, - nullptr)); + std::unique_ptr<Notification> notification( + new Notification(NOTIFICATION_TYPE_SIMPLE, replaced, u"newtitle", + u"newbody", gfx::Image(), kDisplaySource, GURL(), + NotifierId(NotifierType::APPLICATION, kExtensionId), + optional, nullptr)); notification_list_->UpdateNotificationMessage(id0, std::move(notification)); EXPECT_EQ(1u, notification_list_->NotificationCount(blockers_)); EXPECT_EQ(has_message_center_view ? 0U : 1U, GetPopupCounts()); @@ -498,7 +493,7 @@ optional.renotify = true; std::unique_ptr<Notification> notification(new Notification( NOTIFICATION_TYPE_SIMPLE, replaced, u"newtitle", u"newbody", gfx::Image(), - UTF8ToUTF16(kDisplaySource), GURL(), + kDisplaySource, GURL(), NotifierId(NotifierType::APPLICATION, kExtensionId), optional, nullptr)); notification_list_->UpdateNotificationMessage(id0, std::move(notification)); EXPECT_EQ(1u, notification_list_->NotificationCount(blockers_)); @@ -522,7 +517,7 @@ priority.priority = DEFAULT_PRIORITY; std::unique_ptr<Notification> notification(new Notification( NOTIFICATION_TYPE_SIMPLE, id0, u"newtitle", u"newbody", gfx::Image(), - UTF8ToUTF16(kDisplaySource), GURL(), + kDisplaySource, GURL(), NotifierId(NotifierType::APPLICATION, kExtensionId), priority, nullptr)); notification_list_->UpdateNotificationMessage(id0, std::move(notification)); EXPECT_EQ(1u, GetPopupCounts()); @@ -532,7 +527,7 @@ // update with no promotion change for id0, it won't appear as a toast. notification = std::make_unique<Notification>( NOTIFICATION_TYPE_SIMPLE, id0, u"newtitle2", u"newbody2", gfx::Image(), - UTF8ToUTF16(kDisplaySource), GURL(), + kDisplaySource, GURL(), NotifierId(NotifierType::APPLICATION, kExtensionId), priority, nullptr); notification_list_->UpdateNotificationMessage(id0, std::move(notification)); EXPECT_EQ(0u, GetPopupCounts()); @@ -541,7 +536,7 @@ priority.priority = HIGH_PRIORITY; notification = std::make_unique<Notification>( NOTIFICATION_TYPE_SIMPLE, id1, u"newtitle", u"newbody", gfx::Image(), - UTF8ToUTF16(kDisplaySource), GURL(), + kDisplaySource, GURL(), NotifierId(NotifierType::APPLICATION, kExtensionId), priority, nullptr); notification_list_->UpdateNotificationMessage(id1, std::move(notification)); EXPECT_EQ(0u, GetPopupCounts()); @@ -550,7 +545,7 @@ priority.renotify = true; notification = std::make_unique<Notification>( NOTIFICATION_TYPE_SIMPLE, id1, u"newtitle", u"newbody", gfx::Image(), - UTF8ToUTF16(kDisplaySource), GURL(), + kDisplaySource, GURL(), NotifierId(NotifierType::APPLICATION, kExtensionId), priority, nullptr); notification_list_->UpdateNotificationMessage(id1, std::move(notification)); EXPECT_EQ(1u, GetPopupCounts()); @@ -648,11 +643,11 @@ EXPECT_TRUE(n1_state.is_read); const std::string replaced("test-replaced-id"); - std::unique_ptr<Notification> notification(new Notification( - NOTIFICATION_TYPE_SIMPLE, replaced, u"newtitle", u"newbody", gfx::Image(), - UTF8ToUTF16(kDisplaySource), GURL(), - NotifierId(NotifierType::APPLICATION, kExtensionId), - RichNotificationData(), nullptr)); + std::unique_ptr<Notification> notification( + new Notification(NOTIFICATION_TYPE_SIMPLE, replaced, u"newtitle", + u"newbody", gfx::Image(), kDisplaySource, GURL(), + NotifierId(NotifierType::APPLICATION, kExtensionId), + RichNotificationData(), nullptr)); notification_list_->UpdateNotificationMessage(id1, std::move(notification)); Notification* n1 = GetNotification(id1); EXPECT_TRUE(n1 == nullptr);
diff --git a/ui/message_center/public/cpp/notification.h b/ui/message_center/public/cpp/notification.h index 9aa29701..82ad181 100644 --- a/ui/message_center/public/cpp/notification.h +++ b/ui/message_center/public/cpp/notification.h
@@ -13,7 +13,6 @@ #include "base/memory/ref_counted.h" #include "base/optional.h" #include "base/time/time.h" -#include "base/values.h" #include "build/chromeos_buildflags.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/gfx/color_palette.h"
diff --git a/ui/ozone/platform/wayland/host/wayland_clipboard.cc b/ui/ozone/platform/wayland/host/wayland_clipboard.cc index 457cd47..a426f47 100644 --- a/ui/ozone/platform/wayland/host/wayland_clipboard.cc +++ b/ui/ozone/platform/wayland/host/wayland_clipboard.cc
@@ -84,11 +84,10 @@ bool Read(const std::string& mime_type, ui::PlatformClipboard::RequestDataClosure callback) final { requested_mime_type_ = mime_type; - if (GetDevice()->RequestSelectionData(GetMimeTypeForRequest(mime_type))) { - read_clipboard_closure_ = std::move(callback); + read_clipboard_closure_ = std::move(callback); + if (GetDevice()->RequestSelectionData(GetMimeTypeForRequest(mime_type))) return true; - } - SetData(base::MakeRefCounted<base::RefCountedBytes>(), mime_type); + DeliverData(nullptr, mime_type); return false; } @@ -152,8 +151,8 @@ return mime_type; } - void SetData(ui::PlatformClipboard::Data contents, - const std::string& mime_type) { + void DeliverData(ui::PlatformClipboard::Data contents, + const std::string& mime_type) { CHECK_EQ(GetMimeTypeForRequest(requested_mime_type_), mime_type); if (!read_clipboard_closure_.is_null()) std::move(read_clipboard_closure_).Run(contents); @@ -165,16 +164,13 @@ if (IsSelectionOwner()) return; - if (!offer) - SetData({}, {}); - if (!clipboard_changed_callback_.is_null()) clipboard_changed_callback_.Run(buffer_); } void OnSelectionDataReceived(const std::string& mime_type, ui::PlatformClipboard::Data contents) final { - SetData(contents, mime_type); + DeliverData(contents, mime_type); } // WaylandDataSource::Delegate:
diff --git a/ui/ozone/platform/wayland/host/wayland_clipboard_unittest.cc b/ui/ozone/platform/wayland/host/wayland_clipboard_unittest.cc index 9ba1b62..c5a9284 100644 --- a/ui/ozone/platform/wayland/host/wayland_clipboard_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_clipboard_unittest.cc
@@ -162,12 +162,9 @@ TEST_P(WaylandClipboardTest, ReadFromClipboardWithoutOffer) { // When no data offer is advertised and client requests clipboard data // from the server, the response callback should be gracefully called with - // an empty string. - auto callback = base::BindOnce([](const PlatformClipboard::Data& data) { - ASSERT_TRUE(data.get()); - std::string string_data(data->front_as<const char>(), data->size()); - EXPECT_EQ("", string_data); - }); + // null data. + auto callback = base::BindOnce( + [](const PlatformClipboard::Data& data) { ASSERT_FALSE(data); }); clipboard_->RequestClipboardData(ClipboardBuffer::kCopyPaste, kMimeTypeTextUtf8, std::move(callback)); }
diff --git a/ui/ozone/platform/wayland/host/wayland_surface.cc b/ui/ozone/platform/wayland/host/wayland_surface.cc index 69c7ba3..bc5993b 100644 --- a/ui/ozone/platform/wayland/host/wayland_surface.cc +++ b/ui/ozone/platform/wayland/host/wayland_surface.cc
@@ -180,15 +180,16 @@ return; buffer_scale_ = new_scale; - wl_surface_set_buffer_scale(surface_.get(), buffer_scale_); - - if (!display_size_px_.IsEmpty()) { + // As per specification, wp_viewporter interface disconnects the direct + // relationship between the buffer and the surface size. So, no need to send + // |buffer_scale_| to compositor if wp_viewporter interface is available. + if (viewport() && !display_size_px_.IsEmpty()) { gfx::Size viewport_dst = gfx::ScaleToCeiledSize(display_size_px_, 1.f / buffer_scale_); - if (viewport()) { wp_viewport_set_destination(viewport(), viewport_dst.width(), viewport_dst.height()); - } + } else { + wl_surface_set_buffer_scale(surface_.get(), buffer_scale_); } connection_->ScheduleFlush();
diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc index c7f5d644..9125b66 100644 --- a/ui/views/controls/textfield/textfield_unittest.cc +++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -77,9 +77,6 @@ #include "ui/base/cocoa/text_services_context_menu.h" #endif -using base::ASCIIToUTF16; -using base::UTF8ToUTF16; - namespace views { namespace test { @@ -428,8 +425,8 @@ } void TextfieldTest::SetClipboardText(ui::ClipboardBuffer clipboard_buffer, - const std::string& text) { - ui::ScopedClipboardWriter(clipboard_buffer).WriteText(ASCIIToUTF16(text)); + const std::u16string& text) { + ui::ScopedClipboardWriter(clipboard_buffer).WriteText(text); } void TextfieldTest::ContentsChanged(Textfield* sender, @@ -1430,7 +1427,7 @@ EXPECT_EQ(u"password", textfield_->GetText()); EXPECT_TRUE(last_contents_.empty()); model_->SelectAll(false); - SetClipboardText(ui::ClipboardBuffer::kCopyPaste, "foo"); + SetClipboardText(ui::ClipboardBuffer::kCopyPaste, u"foo"); // Cut and copy should be disabled. EXPECT_FALSE(textfield_->IsCommandIdEnabled(Textfield::kCut)); @@ -1794,7 +1791,7 @@ VerifyTextfieldContextMenuContents(true, true, GetContextMenuModel()); // Exercise the "paste enabled?" check in the verifier. - SetClipboardText(ui::ClipboardBuffer::kCopyPaste, "Test"); + SetClipboardText(ui::ClipboardBuffer::kCopyPaste, u"Test"); VerifyTextfieldContextMenuContents(true, true, GetContextMenuModel()); } @@ -1893,10 +1890,10 @@ TEST_F(TextfieldTest, DragUpOrDownSelectsToEnd) { InitTextfield(); textfield_->SetText(u"hello world"); - const std::u16string expected_left = base::ASCIIToUTF16( - gfx::RenderText::kDragToEndIfOutsideVerticalBounds ? "hello" : "lo"); - const std::u16string expected_right = base::ASCIIToUTF16( - gfx::RenderText::kDragToEndIfOutsideVerticalBounds ? " world" : " w"); + const std::u16string expected_left = + gfx::RenderText::kDragToEndIfOutsideVerticalBounds ? u"hello" : u"lo"; + const std::u16string expected_right = + gfx::RenderText::kDragToEndIfOutsideVerticalBounds ? u" world" : u" w"; const int right_x = GetCursorPositionX(7); const int left_x = GetCursorPositionX(3); @@ -2166,7 +2163,7 @@ EXPECT_EQ(u"read only", textfield_->GetSelectedText()); // Cut should be disabled. - SetClipboardText(ui::ClipboardBuffer::kCopyPaste, "Test"); + SetClipboardText(ui::ClipboardBuffer::kCopyPaste, u"Test"); EXPECT_FALSE(textfield_->IsCommandIdEnabled(Textfield::kCut)); textfield_->ExecuteCommand(Textfield::kCut, 0); SendKeyEvent(ui::VKEY_X, false, true); @@ -2182,14 +2179,14 @@ EXPECT_EQ(u"read only", textfield_->GetText()); // Copy should work normally. - SetClipboardText(ui::ClipboardBuffer::kCopyPaste, "Test"); + SetClipboardText(ui::ClipboardBuffer::kCopyPaste, u"Test"); EXPECT_TRUE(textfield_->IsCommandIdEnabled(Textfield::kCopy)); textfield_->ExecuteCommand(Textfield::kCopy, 0); EXPECT_EQ(u"read only", GetClipboardText(ui::ClipboardBuffer::kCopyPaste)); - SetClipboardText(ui::ClipboardBuffer::kCopyPaste, "Test"); + SetClipboardText(ui::ClipboardBuffer::kCopyPaste, u"Test"); SendKeyEvent(ui::VKEY_C, false, true); EXPECT_EQ(u"read only", GetClipboardText(ui::ClipboardBuffer::kCopyPaste)); - SetClipboardText(ui::ClipboardBuffer::kCopyPaste, "Test"); + SetClipboardText(ui::ClipboardBuffer::kCopyPaste, u"Test"); SendAlternateCopy(); EXPECT_EQ(u"read only", GetClipboardText(ui::ClipboardBuffer::kCopyPaste)); @@ -2530,7 +2527,7 @@ EXPECT_EQ(ui::ClipboardBuffer::kCopyPaste, GetAndResetCopiedToClipboard()); // Reset clipboard text. - SetClipboardText(ui::ClipboardBuffer::kCopyPaste, ""); + SetClipboardText(ui::ClipboardBuffer::kCopyPaste, u""); // Ensure [Shift]+[Delete] is a no-op in case there is no selection. textfield_->SetText(u"123"); @@ -2568,7 +2565,7 @@ // Ensure kPaste, [Ctrl]+[V], and [Shift]+[Insert] pastes; // also ensure that [Ctrl]+[Alt]+[V] does nothing. - SetClipboardText(ui::ClipboardBuffer::kCopyPaste, "abc"); + SetClipboardText(ui::ClipboardBuffer::kCopyPaste, u"abc"); textfield_->SetText(std::u16string()); EXPECT_TRUE(textfield_->IsCommandIdEnabled(Textfield::kPaste)); textfield_->ExecuteCommand(Textfield::kPaste, 0); @@ -3252,7 +3249,7 @@ EXPECT_EQ(u"0123", GetClipboardText(ui::ClipboardBuffer::kSelection)); // Middle clicking with an empty selection clipboard should still focus. - SetClipboardText(ui::ClipboardBuffer::kSelection, std::string()); + SetClipboardText(ui::ClipboardBuffer::kSelection, std::u16string()); textfield_->GetFocusManager()->ClearFocus(); EXPECT_FALSE(textfield_->HasFocus()); textfield_->OnMousePressed(middle); @@ -3264,7 +3261,7 @@ // Middle clicking in the selection should insert the selection clipboard // contents into the middle of the selection, and move the cursor to the end // of the pasted content. - SetClipboardText(ui::ClipboardBuffer::kCopyPaste, "foo"); + SetClipboardText(ui::ClipboardBuffer::kCopyPaste, u"foo"); textfield_->SetSelectedRange(gfx::Range(2, 6)); textfield_->OnMousePressed(middle); EXPECT_EQ(u"0123foo01230123", textfield_->GetText()); @@ -3304,7 +3301,7 @@ EXPECT_EQ(u"ab cd ef", GetClipboardText(ui::ClipboardBuffer::kSelection)); EXPECT_EQ(ui::ClipboardBuffer::kMaxValue, GetAndResetCopiedToClipboard()); - SetClipboardText(ui::ClipboardBuffer::kSelection, "other"); + SetClipboardText(ui::ClipboardBuffer::kSelection, u"other"); textfield_->SelectAll(false); EXPECT_EQ(u"other", GetClipboardText(ui::ClipboardBuffer::kSelection)); EXPECT_EQ(ui::ClipboardBuffer::kMaxValue, GetAndResetCopiedToClipboard()); @@ -3380,7 +3377,7 @@ // Set text which may fall back to a font which has taller baseline than // the default font. - textfield_->SetText(UTF8ToUTF16("\xE0\xB9\x91")); + textfield_->SetText(u"๑"); const int new_baseline = textfield_->GetBaseline(); // Regardless of the text, the baseline must be the same. @@ -3425,7 +3422,7 @@ textfield_->GetAccessibleNodeData(&data); const std::string& name = data.GetStringAttribute(ax::mojom::StringAttribute::kName); - EXPECT_EQ(test_tooltip_text, ASCIIToUTF16(name)); + EXPECT_EQ(test_tooltip_text, base::ASCIIToUTF16(name)); } #if BUILDFLAG(IS_CHROMEOS_ASH) @@ -3768,12 +3765,12 @@ } TEST_F(TextfieldTest, FocusChangesScrollToStart) { - const std::string& kText = "abcdef"; + const std::u16string kText = u"abcdef"; InitTextfield(); - textfield_->SetText(ASCIIToUTF16(kText)); - EXPECT_EQ(base::ASCIIToUTF16(std::string()), textfield_->GetSelectedText()); + textfield_->SetText(kText); + EXPECT_EQ(std::u16string(), textfield_->GetSelectedText()); textfield_->AboutToRequestFocusFromTabTraversal(false); - EXPECT_EQ(base::ASCIIToUTF16(kText), textfield_->GetSelectedText()); + EXPECT_EQ(kText, textfield_->GetSelectedText()); if (PlatformStyle::kTextfieldScrollsToStartOnFocusChange) EXPECT_EQ(0U, textfield_->GetCursorPosition()); else @@ -3929,9 +3926,9 @@ #endif // defined(OS_MAC) TEST_F(TextfieldTest, AccessibilitySelectionEvents) { - const std::string& kText = "abcdef"; + const std::u16string kText = u"abcdef"; InitTextfield(); - textfield_->SetText(ASCIIToUTF16(kText)); + textfield_->SetText(kText); EXPECT_TRUE(textfield_->HasFocus()); int previous_selection_fired_count = textfield_->GetAccessibilitySelectionFiredCount();
diff --git a/ui/views/controls/textfield/textfield_unittest.h b/ui/views/controls/textfield/textfield_unittest.h index 4d796ad..fef1348c 100644 --- a/ui/views/controls/textfield/textfield_unittest.h +++ b/ui/views/controls/textfield/textfield_unittest.h
@@ -42,7 +42,7 @@ ui::ClipboardBuffer GetAndResetCopiedToClipboard(); std::u16string GetClipboardText(ui::ClipboardBuffer type); - void SetClipboardText(ui::ClipboardBuffer type, const std::string& text); + void SetClipboardText(ui::ClipboardBuffer type, const std::u16string& text); // TextfieldController: void ContentsChanged(Textfield* sender,
diff --git a/ui/views/examples/textarea_example.cc b/ui/views/examples/textarea_example.cc index cf1ddf2..d3205e9 100644 --- a/ui/views/examples/textarea_example.cc +++ b/ui/views/examples/textarea_example.cc
@@ -18,16 +18,16 @@ TextareaExample::TextareaExample() : ExampleBase("Textarea") {} void TextareaExample::CreateExampleView(View* container) { - constexpr char kLongText[] = - "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod" - " tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim " - "veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea " - "commodo consequat.\nDuis aute irure dolor in reprehenderit in voluptate " - "velit esse cillum dolore eu fugiat nulla pariatur.\n\nExcepteur sint " - "occaecat cupidatat non proident, sunt in culpa qui officia deserunt " - "mollit anim id est laborum."; + constexpr char16_t kLongText[] = + u"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do " + u"eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad " + u"minim veniam, quis nostrud exercitation ullamco laboris nisi ut " + u"aliquip ex ea commodo consequat.\nDuis aute irure dolor in " + u"reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla " + u"pariatur.\n\nExcepteur sint occaecat cupidatat non proident, sunt in " + u"culpa qui officia deserunt mollit anim id est laborum."; auto textarea = std::make_unique<Textarea>(); - textarea->SetText(base::UTF8ToUTF16(kLongText)); + textarea->SetText(kLongText); container->SetLayoutManager(std::make_unique<views::FillLayout>()); container->AddChildView(std::move(textarea)); }
diff --git a/ui/webui/resources/cr_elements/find_shortcut_behavior.js b/ui/webui/resources/cr_elements/find_shortcut_behavior.js index c39e606..7511970 100644 --- a/ui/webui/resources/cr_elements/find_shortcut_behavior.js +++ b/ui/webui/resources/cr_elements/find_shortcut_behavior.js
@@ -121,3 +121,28 @@ assertNotReached(); }, }; + +/** @interface */ +export class FindShortcutBehaviorInterface { + constructor() { + /** + * @type {boolean} + * @protected + */ + this.findShortcutListenOnAttach = true; + } + + becomeActiveFindShortcutListener() {} + + /** + * If handled, return true. + * @param {boolean} modalContextOpen + * @return {boolean} + */ + handleFindShortcut(modalContextOpen) {} + + removeSelfAsFindShortcutListener() {} + + /** @return {boolean} */ + searchInputHasFocus() {} +}
diff --git a/ui/webui/resources/js/cr/ui/store_client.js b/ui/webui/resources/js/cr/ui/store_client.js index e2ba2efa..e682f044 100644 --- a/ui/webui/resources/js/cr/ui/store_client.js +++ b/ui/webui/resources/js/cr/ui/store_client.js
@@ -134,6 +134,33 @@ }, }; + /* #export */ class StoreClientInterface { + /** + * Helper to dispatch an action to the store, which will update the store + * data and then (possibly) flow through to the UI. + * @param {?cr.ui.Action} action + */ + dispatch(action) {} + + /** + * Helper to dispatch a DeferredAction to the store, which will + * asynchronously perform updates to the store data and UI. + * @param {cr.ui.DeferredAction} action + */ + dispatchAsync(action) {} + + /** @param {Object} newState */ + onStateChanged(newState) {} + + updateFromStore() {} + + watch(localProperty, valueGetter) {} + + getState() {} + + getStore() {} + } + // #cr_define_end console.warn('crbug/1173575, non-JS module files deprecated.'); return {
diff --git a/ui/webui/resources/js/list_property_update_behavior.js b/ui/webui/resources/js/list_property_update_behavior.js index 5a9f75a2..ff55345 100644 --- a/ui/webui/resources/js/list_property_update_behavior.js +++ b/ui/webui/resources/js/list_property_update_behavior.js
@@ -24,7 +24,7 @@ * @param {function(!Object): (!Object|string)} identityGetter * @param {!Array<!Object>} updatedList * @param {boolean=} identityBasedUpdate - * @returns {boolean} True if notifySplices was called. + * @return {boolean} True if notifySplices was called. */ updateList( propertyPath, identityGetter, updatedList, identityBasedUpdate = false) { @@ -79,4 +79,16 @@ return updated; } +/* #export */ class ListPropertyUpdateBehaviorInterface { + /** + * @param {string} propertyPath + * @param {function(!Object): (!Object|string)} identityGetter + * @param {!Array<!Object>} updatedList + * @param {boolean=} identityBasedUpdate + * @return {boolean} True if notifySplices was called. + */ + updateList( + propertyPath, identityGetter, updatedList, identityBasedUpdate = false) {} +} + /* #ignore */ console.warn('crbug/1173575, non-JS module files deprecated.');
diff --git a/url/gurl_unittest.cc b/url/gurl_unittest.cc index 6d23d65..35204704 100644 --- a/url/gurl_unittest.cc +++ b/url/gurl_unittest.cc
@@ -117,8 +117,7 @@ } TEST(GURLTest, Copy) { - GURL url(base::UTF8ToUTF16( - "http://user:pass@google.com:99/foo;bar?q=a#ref")); + GURL url(u"http://user:pass@google.com:99/foo;bar?q=a#ref"); GURL url2(url); EXPECT_TRUE(url2.is_valid()); @@ -151,8 +150,7 @@ } TEST(GURLTest, Assign) { - GURL url(base::UTF8ToUTF16( - "http://user:pass@google.com:99/foo;bar?q=a#ref")); + GURL url(u"http://user:pass@google.com:99/foo;bar?q=a#ref"); GURL url2; url2 = url; @@ -194,8 +192,7 @@ } TEST(GURLTest, CopyFileSystem) { - GURL url(base::UTF8ToUTF16( - "filesystem:https://user:pass@google.com:99/t/foo;bar?q=a#ref")); + GURL url(u"filesystem:https://user:pass@google.com:99/t/foo;bar?q=a#ref"); GURL url2(url); EXPECT_TRUE(url2.is_valid());
diff --git a/weblayer/browser/stateful_ssl_host_state_delegate_factory.h b/weblayer/browser/stateful_ssl_host_state_delegate_factory.h index dee6b42..2e8f9c7 100644 --- a/weblayer/browser/stateful_ssl_host_state_delegate_factory.h +++ b/weblayer/browser/stateful_ssl_host_state_delegate_factory.h
@@ -7,7 +7,6 @@ #include "base/macros.h" #include "base/memory/singleton.h" -#include "base/values.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "components/prefs/pref_service.h"