diff --git a/DEPS b/DEPS index cca67e30..c88c978 100644 --- a/DEPS +++ b/DEPS
@@ -540,7 +540,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '88087bad47fb55e5e783ef678faddf6174a29a13', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '518bb6847a6e29b2bc23a2b7b3a39d9aa5adc166', 'src/third_party/devtools-node-modules': Var('chromium_git') + '/external/github.com/ChromeDevTools/devtools-node-modules' + '@' + Var('devtools_node_modules_revision'), @@ -1007,7 +1007,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '198d637dd3e21d837fac6b3186cc6bc72e2f7219', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '38eac97df017c202f75331f074e5777fca4d2cbe', + Var('webrtc_git') + '/src.git' + '@' + '2d02e085de5a3b600b3f75168dd56577055b9f0d', 'src/third_party/xdg-utils': { 'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d',
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 0a40f6e..9805fd9 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py
@@ -3041,15 +3041,22 @@ If a file should not have such guards (and it probably should) then it should include the string "no-include-guard-because-multiply-included". """ - def is_header_file(f): - return f.LocalPath().endswith('.h') + def is_chromium_header_file(f): + # We only check header files under the control of the Chromium + # project. That is, those outside third_party apart from + # third_party/blink. + file_with_path = input_api.os_path.normpath(f.LocalPath()) + return (file_with_path.endswith('.h') and + (not file_with_path.startswith('third_party') or + file_with_path.startswith( + input_api.os_path.join('third_party', 'blink')))) def replace_special_with_underscore(string): return input_api.re.sub(r'[\\/.-]', '_', string) errors = [] - for f in input_api.AffectedSourceFiles(is_header_file): + for f in input_api.AffectedSourceFiles(is_chromium_header_file): guard_name = None guard_line_number = None seen_guard_end = False @@ -3098,16 +3105,9 @@ guard_line_number = line_number # We allow existing files to use include guards whose names - # don't match the chromium style guide, but new files - # (outside third_party) should get it right. The only part - # of third_party we check is blink. - should_check_strict_guard_name = ( - not f.OldContents() and - (not file_with_path.startswith('third_party') or - file_with_path.startswith( - input_api.os_path.join('third_party', 'blink')))) - - if should_check_strict_guard_name: + # don't match the chromium style guide, but new files should + # get it right. + if not f.OldContents(): if guard_name != expected_guard: errors.append(output_api.PresubmitPromptWarning( 'Header using the wrong include guard name %s' % guard_name,
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index 8223bce..1572a53 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd
@@ -217,10 +217,13 @@ <message name="IDS_ASH_STATUS_TRAY_SPOKEN_FEEDBACK_BRAILLE_ENABLED_TITLE" desc="The message shown on a notification when both the spoken feedback and braille are enabled"> Braille and ChromeVox are enabled </message> - <message name="IDS_ASH_STATUS_TRAY_SIGN_OUT" desc="The label used for the button in the status tray to sign out of the system."> + <message name="IDS_ASH_STATUS_TRAY_USER_INFO_ACCESSIBILITY" desc="The accessibility string used for an item in user chooser that tells the user name and the mail address."> + <ph name="USERNAME">$1<ex>Jane Doe</ex></ph> <ph name="MAIL">$2<ex>janedoe@example.com</ex></ph> + </message> + <message name="IDS_ASH_STATUS_TRAY_SIGN_OUT" desc="The label used for the button in the status tray to sign out of the system. Should not exceed about 20 latin characters. Overflowed text is truncated with ellipsis."> Sign out </message> - <message name="IDS_ASH_STATUS_TRAY_SIGN_OUT_ALL" desc="The label used for the button in the status tray to sign out all users of the system."> + <message name="IDS_ASH_STATUS_TRAY_SIGN_OUT_ALL" desc="The label used for the button in the status tray to sign out all users of the system. Should not exceed about 20 latin characters. Overflowed text is truncated with ellipsis."> Sign out all </message> <message name="IDS_ASH_STATUS_TRAY_GUEST_LABEL" desc="The label used in the system tray's user card to indicate that the current session is a guest session.">
diff --git a/ash/system/unified/feature_pod_button.cc b/ash/system/unified/feature_pod_button.cc index 36a19e78..f895743 100644 --- a/ash/system/unified/feature_pod_button.cc +++ b/ash/system/unified/feature_pod_button.cc
@@ -7,6 +7,7 @@ #include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_popup_utils.h" #include "ash/system/unified/feature_pod_controller_base.h" +#include "ui/accessibility/ax_node_data.h" #include "ui/gfx/canvas.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/views/animation/flood_fill_ink_drop_ripple.h" @@ -83,6 +84,16 @@ rect.width() / 2); } +void FeaturePodIconButton::GetAccessibleNodeData(ui::AXNodeData* node_data) { + ImageButton::GetAccessibleNodeData(node_data); + base::string16 name; + GetTooltipText(gfx::Point(), &name); + node_data->SetName(name); + node_data->role = ax::mojom::Role::kToggleButton; + node_data->SetCheckedState(toggled_ ? ax::mojom::CheckedState::kTrue + : ax::mojom::CheckedState::kFalse); +} + FeaturePodLabelButton::FeaturePodLabelButton(views::ButtonListener* listener) : Button(listener), label_(new views::Label), sub_label_(new views::Label) { SetLayoutManager(std::make_unique<views::BoxLayout>( @@ -127,6 +138,7 @@ } void FeaturePodLabelButton::SetLabel(const base::string16& label) { + SetTooltipText(label); label_->SetText(label); Layout(); SchedulePaint(); @@ -163,6 +175,7 @@ } void FeaturePodButton::SetLabel(const base::string16& label) { + icon_button_->SetTooltipText(label); label_button_->SetLabel(label); }
diff --git a/ash/system/unified/feature_pod_button.h b/ash/system/unified/feature_pod_button.h index 4b43d423..578e31b 100644 --- a/ash/system/unified/feature_pod_button.h +++ b/ash/system/unified/feature_pod_button.h
@@ -34,6 +34,7 @@ std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() const override; std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override; + void GetAccessibleNodeData(ui::AXNodeData* node_data) override; bool toggled() const { return toggled_; }
diff --git a/ash/system/unified/top_shortcuts_view.cc b/ash/system/unified/top_shortcuts_view.cc index c00141e..51c7dc1 100644 --- a/ash/system/unified/top_shortcuts_view.cc +++ b/ash/system/unified/top_shortcuts_view.cc
@@ -37,20 +37,17 @@ : Button(listener) { SetLayoutManager(std::make_unique<views::FillLayout>()); AddChildView(CreateUserAvatarView(0 /* user_index */)); + + SetTooltipText(GetUserItemAccessibleString(0 /* user_index */)); + SetFocusPainter(TrayPopupUtils::CreateFocusPainter()); + SetFocusForPlatform(); } -class TopShortcutButtonContainer : public views::View { - public: - TopShortcutButtonContainer(); - ~TopShortcutButtonContainer() override; +} // namespace - // views::View: - void Layout() override; - gfx::Size CalculatePreferredSize() const override; +TopShortcutButtonContainer::TopShortcutButtonContainer() = default; - private: - DISALLOW_COPY_AND_ASSIGN(TopShortcutButtonContainer); -}; +TopShortcutButtonContainer::~TopShortcutButtonContainer() = default; // Buttons are equally spaced by the default value, but the gap will be // narrowed evenly when the parent view is not large enough. @@ -74,6 +71,17 @@ (child_area.width() - total_horizontal_size) / (num_visible - 1))); + int sign_out_button_width = 0; + if (sign_out_button_ && sign_out_button_->visible()) { + // resize the sign-out button + int remainder = child_area.width() - + (num_visible - 1) * kUnifiedTopShortcutButtonMinSpacing - + total_horizontal_size + + sign_out_button_->GetPreferredSize().width(); + sign_out_button_width = std::max( + 0, std::min(sign_out_button_->GetPreferredSize().width(), remainder)); + } + int horizontal_position = child_area.x(); for (int i = 0; i < child_count(); i++) { views::View* child = child_at(i); @@ -81,9 +89,11 @@ continue; gfx::Rect bounds(child_area); bounds.set_x(horizontal_position); - bounds.set_width(child->GetPreferredSize().width()); + int width = (child == sign_out_button_) ? sign_out_button_width + : child->GetPreferredSize().width(); + bounds.set_width(width); child->SetBoundsRect(bounds); - horizontal_position += child->GetPreferredSize().width() + spacing; + horizontal_position += width + spacing; } } @@ -110,11 +120,11 @@ return gfx::Size(width, max_height); } -TopShortcutButtonContainer::~TopShortcutButtonContainer() = default; - -TopShortcutButtonContainer::TopShortcutButtonContainer() = default; - -} // namespace +void TopShortcutButtonContainer::AddSignOutButton( + views::View* sign_out_button) { + AddChildView(sign_out_button); + sign_out_button_ = sign_out_button; +} TopShortcutsView::TopShortcutsView(UnifiedSystemTrayController* controller) : controller_(controller), container_(new TopShortcutButtonContainer()) { @@ -124,6 +134,7 @@ views::BoxLayout::kHorizontal, kUnifiedTopShortcutPadding, kUnifiedTopShortcutSpacing)); layout->set_cross_axis_alignment(views::BoxLayout::CROSS_AXIS_ALIGNMENT_END); + container_ = new TopShortcutButtonContainer(); AddChildView(container_); if (Shell::Get()->session_controller()->login_status() != @@ -138,7 +149,7 @@ const bool can_show_web_ui = TrayPopupUtils::CanOpenWebUISettings(); sign_out_button_ = new SignOutButton(this); - container_->AddChildView(sign_out_button_); + container_->AddSignOutButton(sign_out_button_); lock_button_ = new TopShortcutButton(this, kSystemMenuLockIcon, IDS_ASH_STATUS_TRAY_LOCK);
diff --git a/ash/system/unified/top_shortcuts_view.h b/ash/system/unified/top_shortcuts_view.h index 0484889b..097db72 100644 --- a/ash/system/unified/top_shortcuts_view.h +++ b/ash/system/unified/top_shortcuts_view.h
@@ -17,6 +17,27 @@ class TopShortcutsViewTest; class UnifiedSystemTrayController; +// Container for the top shortcut buttons. The view may narrow gaps between +// buttons when there's not enough space. When those doesn't fit in the view +// even after that, the sign-out button will be resized. +class TopShortcutButtonContainer : public views::View { + public: + TopShortcutButtonContainer(); + ~TopShortcutButtonContainer() override; + + // views::View: + void Layout() override; + gfx::Size CalculatePreferredSize() const override; + + // Add the sign-out button, which can be resized upon layout. + void AddSignOutButton(views::View* sign_out_button); + + private: + views::View* sign_out_button_ = nullptr; + + DISALLOW_COPY_AND_ASSIGN(TopShortcutButtonContainer); +}; + // Top shortcuts view shown on the top of UnifiedSystemTrayView. class ASH_EXPORT TopShortcutsView : public views::View, public views::ButtonListener { @@ -38,7 +59,7 @@ // Owned by views hierarchy. views::Button* user_avatar_button_ = nullptr; SignOutButton* sign_out_button_ = nullptr; - views::View* const container_; + TopShortcutButtonContainer* container_ = nullptr; TopShortcutButton* lock_button_ = nullptr; TopShortcutButton* settings_button_ = nullptr; TopShortcutButton* power_button_ = nullptr;
diff --git a/ash/system/unified/unified_slider_view.cc b/ash/system/unified/unified_slider_view.cc index 0e63db6..1754062 100644 --- a/ash/system/unified/unified_slider_view.cc +++ b/ash/system/unified/unified_slider_view.cc
@@ -6,8 +6,10 @@ #include "ash/system/tray/tray_constants.h" #include "ash/system/unified/top_shortcut_button.h" +#include "ui/base/l10n/l10n_util.h" #include "ui/gfx/canvas.h" #include "ui/gfx/paint_vector_icon.h" +#include "ui/views/accessibility/view_accessibility.h" #include "ui/views/border.h" #include "ui/views/layout/box_layout.h" @@ -73,6 +75,13 @@ views::ImageButton::PaintButtonContents(canvas); } +void UnifiedSliderButton::GetAccessibleNodeData(ui::AXNodeData* node_data) { + TopShortcutButton::GetAccessibleNodeData(node_data); + node_data->role = ax::mojom::Role::kToggleButton; + node_data->SetCheckedState(toggled_ ? ax::mojom::CheckedState::kTrue + : ax::mojom::CheckedState::kFalse); +} + UnifiedSliderView::UnifiedSliderView(UnifiedSliderListener* listener, const gfx::VectorIcon& icon, int accessible_name_id, @@ -86,6 +95,9 @@ AddChildView(button_); AddChildView(slider_); + slider_->set_enable_accessibility_events(false); + slider_->GetViewAccessibility().OverrideName( + l10n_util::GetStringUTF16(accessible_name_id)); slider_->SetBorder(views::CreateEmptyBorder(kUnifiedSliderPadding)); layout->SetFlexForView(slider_, 1); }
diff --git a/ash/system/unified/unified_slider_view.h b/ash/system/unified/unified_slider_view.h index dce8c76..d8253fd3 100644 --- a/ash/system/unified/unified_slider_view.h +++ b/ash/system/unified/unified_slider_view.h
@@ -58,6 +58,7 @@ // TopShortcutButton: void PaintButtonContents(gfx::Canvas* canvas) override; + void GetAccessibleNodeData(ui::AXNodeData* node_data) override; private: // Ture if the button is currently toggled.
diff --git a/ash/system/unified/user_chooser_view.cc b/ash/system/unified/user_chooser_view.cc index eafab86..1df28d0 100644 --- a/ash/system/unified/user_chooser_view.cc +++ b/ash/system/unified/user_chooser_view.cc
@@ -10,6 +10,7 @@ #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" #include "ash/system/tray/tray_constants.h" +#include "ash/system/tray/tray_popup_utils.h" #include "ash/system/unified/top_shortcuts_view.h" #include "ash/system/unified/unified_system_tray_controller.h" #include "ash/system/user/rounded_image_view.h" @@ -40,6 +41,18 @@ return image_view; } +base::string16 GetUserItemAccessibleString(int user_index) { + DCHECK(Shell::Get()); + const mojom::UserSession* const user_session = + Shell::Get()->session_controller()->GetUserSession(user_index); + DCHECK(user_session); + + return l10n_util::GetStringFUTF16( + IDS_ASH_STATUS_TRAY_USER_INFO_ACCESSIBILITY, + base::UTF8ToUTF16(user_session->user_info->display_name), + base::UTF8ToUTF16(user_session->user_info->display_email)); +} + namespace { // A button item of a switchable user. @@ -90,6 +103,10 @@ vertical_labels->AddChildView(email); AddChildView(vertical_labels); + + SetTooltipText(GetUserItemAccessibleString(user_index)); + SetFocusPainter(TrayPopupUtils::CreateFocusPainter()); + SetFocusForPlatform(); } void UserItemButton::ButtonPressed(views::Button* sender, @@ -129,6 +146,11 @@ label->SetAutoColorReadabilityEnabled(false); label->SetSubpixelRenderingEnabled(false); AddChildView(label); + + SetTooltipText( + l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SIGN_IN_ANOTHER_ACCOUNT)); + SetFocusPainter(TrayPopupUtils::CreateFocusPainter()); + SetFocusForPlatform(); } void AddUserButton::ButtonPressed(views::Button* sender,
diff --git a/ash/system/unified/user_chooser_view.h b/ash/system/unified/user_chooser_view.h index c42f89b..1df9d28 100644 --- a/ash/system/unified/user_chooser_view.h +++ b/ash/system/unified/user_chooser_view.h
@@ -14,6 +14,9 @@ // Circular image view with user's icon of |user_index|. views::View* CreateUserAvatarView(int user_index); +// Get accessibility string for |user_index|. +base::string16 GetUserItemAccessibleString(int user_index); + // A detailed view of user chooser. class UserChooserView : public views::View { public:
diff --git a/base/process/launch_win.cc b/base/process/launch_win.cc index 0ae6820..3841967 100644 --- a/base/process/launch_win.cc +++ b/base/process/launch_win.cc
@@ -255,12 +255,6 @@ startup_info->hStdError = options.stderr_handle; } - const bool launch_suspended = - options.job_handle || options.grant_foreground_privilege; - - if (launch_suspended) - flags |= CREATE_SUSPENDED; - if (options.job_handle) { // If this code is run under a debugger, the launched process is // automatically associated with a job object created by the debugger. @@ -324,9 +318,6 @@ DPLOG(ERROR) << "Failed to grant foreground privilege to launched process"; } - if (launch_suspended) - ResumeThread(process_info.thread_handle()); - if (options.wait) WaitForSingleObject(process_info.process_handle(), INFINITE);
diff --git a/base/task_scheduler/task_tracker.cc b/base/task_scheduler/task_tracker.cc index 9a292c8b..1967cf67 100644 --- a/base/task_scheduler/task_tracker.cc +++ b/base/task_scheduler/task_tracker.cc
@@ -452,10 +452,11 @@ DCHECK(latency_histogram_type == LatencyHistogramType::TASK_LATENCY || latency_histogram_type == LatencyHistogramType::HEARTBEAT_LATENCY); + // Below dereference is workaround for MSVC compiler in VS15.7. auto& histograms = - latency_histogram_type == LatencyHistogramType::TASK_LATENCY - ? task_latency_histograms_ - : heartbeat_latency_histograms_; + *(latency_histogram_type == LatencyHistogramType::TASK_LATENCY + ? &task_latency_histograms_ + : &heartbeat_latency_histograms_); histograms[static_cast<int>(task_traits.priority())] [task_traits.may_block() || task_traits.with_base_sync_primitives() ? 1
diff --git a/base/trace_event/memory_infra_background_whitelist.cc b/base/trace_event/memory_infra_background_whitelist.cc index d50947b..e4a80c1 100644 --- a/base/trace_event/memory_infra_background_whitelist.cc +++ b/base/trace_event/memory_infra_background_whitelist.cc
@@ -304,6 +304,7 @@ "sync/0x?/model_type/SYNCED_NOTIFICATION_APP_INFO", "sync/0x?/model_type/THEME", "sync/0x?/model_type/TYPED_URL", + "sync/0x?/model_type/USER_CONSENT", "sync/0x?/model_type/USER_EVENT", "sync/0x?/model_type/WALLET_METADATA", "sync/0x?/model_type/WIFI_CREDENTIAL",
diff --git a/build/fuchsia/sdk.sha1 b/build/fuchsia/sdk.sha1 index 0cd2459..0d6d6dc 100644 --- a/build/fuchsia/sdk.sha1 +++ b/build/fuchsia/sdk.sha1
@@ -1 +1 @@ -0aeaf51bb997641043c21b02d032d9538a906bca \ No newline at end of file +54a1c399fdcbb050e37b6811bf3bc0ebb478bf9c \ No newline at end of file
diff --git a/cc/trees/animation_options.h b/cc/trees/animation_options.h index c56bbc5..bce98cd 100644 --- a/cc/trees/animation_options.h +++ b/cc/trees/animation_options.h
@@ -5,6 +5,8 @@ #ifndef CC_TREES_ANIMATION_OPTIONS_H_ #define CC_TREES_ANIMATION_OPTIONS_H_ +#include <memory> + #include "cc/cc_export.h" namespace cc {
diff --git a/cc/trees/layer_tree_host_pixeltest_scrollbars.cc b/cc/trees/layer_tree_host_pixeltest_scrollbars.cc index b251df56..f218c5a4 100644 --- a/cc/trees/layer_tree_host_pixeltest_scrollbars.cc +++ b/cc/trees/layer_tree_host_pixeltest_scrollbars.cc
@@ -137,7 +137,13 @@ base::FilePath(FILE_PATH_LITERAL("spiral_double_scale.png"))); } -TEST_F(LayerTreeHostScrollbarsPixelTest, HugeTransformScale) { +// Disabled on TSan due to frequent timeouts. crbug.com/848994 +#if defined(THREAD_SANITIZER) +#define MAYBE_HugeTransformScale DISABLED_HugeTransformScale +#else +#define MAYBE_HugeTransformScale HugeTransformScale +#endif +TEST_F(LayerTreeHostScrollbarsPixelTest, MAYBE_HugeTransformScale) { scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer(gfx::Rect(400, 400), SK_ColorWHITE);
diff --git a/chrome/VERSION b/chrome/VERSION index 650ec64..e77bbea 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=69 MINOR=0 -BUILD=3449 +BUILD=3450 PATCH=0
diff --git a/chrome/android/java/res/drawable-hdpi/settings_sensors.png b/chrome/android/java/res/drawable-hdpi/settings_sensors.png new file mode 100644 index 0000000..4136188 --- /dev/null +++ b/chrome/android/java/res/drawable-hdpi/settings_sensors.png Binary files differ
diff --git a/chrome/android/java/res/drawable-mdpi/settings_sensors.png b/chrome/android/java/res/drawable-mdpi/settings_sensors.png new file mode 100644 index 0000000..bc0dbe33 --- /dev/null +++ b/chrome/android/java/res/drawable-mdpi/settings_sensors.png Binary files differ
diff --git a/chrome/android/java/res/drawable-xhdpi/settings_sensors.png b/chrome/android/java/res/drawable-xhdpi/settings_sensors.png new file mode 100644 index 0000000..9544fb3a --- /dev/null +++ b/chrome/android/java/res/drawable-xhdpi/settings_sensors.png Binary files differ
diff --git a/chrome/android/java/res/drawable-xxhdpi/settings_sensors.png b/chrome/android/java/res/drawable-xxhdpi/settings_sensors.png new file mode 100644 index 0000000..072a133b --- /dev/null +++ b/chrome/android/java/res/drawable-xxhdpi/settings_sensors.png Binary files differ
diff --git a/chrome/android/java/res/drawable-xxxhdpi/settings_sensors.png b/chrome/android/java/res/drawable-xxxhdpi/settings_sensors.png new file mode 100644 index 0000000..9cf72ce1 --- /dev/null +++ b/chrome/android/java/res/drawable-xxxhdpi/settings_sensors.png Binary files differ
diff --git a/chrome/android/java/res/xml/site_settings_preferences.xml b/chrome/android/java/res/xml/site_settings_preferences.xml index 1159fd1..698a5c0 100644 --- a/chrome/android/java/res/xml/site_settings_preferences.xml +++ b/chrome/android/java/res/xml/site_settings_preferences.xml
@@ -27,6 +27,10 @@ <org.chromium.chrome.browser.preferences.website.SiteSettingsPreference android:fragment="org.chromium.chrome.browser.preferences.website.SingleCategoryPreferences" android:key="microphone" /> + <!-- Sensors --> + <org.chromium.chrome.browser.preferences.website.SiteSettingsPreference + android:fragment="org.chromium.chrome.browser.preferences.website.SingleCategoryPreferences" + android:key="sensors" /> <!-- Notifications --> <org.chromium.chrome.browser.preferences.website.SiteSettingsPreference android:fragment="org.chromium.chrome.browser.preferences.website.SingleCategoryPreferences"
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java index 9c1a8164..5663adf 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
@@ -202,6 +202,7 @@ // When enabled, fullscreen WebContents will be moved to a new Activity. Coming soon... public static final String FULLSCREEN_ACTIVITY = "FullscreenActivity"; public static final String GRANT_NOTIFICATIONS_TO_DSE = "GrantNotificationsToDSE"; + public static final String GENERIC_SENSOR_EXTRA_CLASSES = "GenericSensorExtraClasses"; public static final String HOME_PAGE_BUTTON_FORCE_ENABLED = "HomePageButtonForceEnabled"; public static final String HORIZONTAL_TAB_SWITCHER_ANDROID = "HorizontalTabSwitcherAndroid"; // Whether we show an important sites dialog in the "Clear Browsing Data" flow.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/UkmRecorder.java b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/UkmRecorder.java new file mode 100644 index 0000000..e2ded9f --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/UkmRecorder.java
@@ -0,0 +1,34 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.browserservices; + +import org.chromium.base.annotations.JNINamespace; +import org.chromium.base.annotations.NativeCall; +import org.chromium.content_public.browser.WebContents; + +/** + * An interface and classes to record User Keyed Metrics relevant to Trusted Web Activities. This + * will allow us to concentrate on the use cases for the most used TWAs. + */ +public interface UkmRecorder { + /** + * Records a TWA has been opened. + */ + void recordTwaOpened(WebContents webContents); + + /** + * The actual recorder. + */ + @JNINamespace("browserservices") + class Bridge implements UkmRecorder { + @Override + public void recordTwaOpened(WebContents webContents) { + nativeRecordOpen(webContents); + } + + @NativeCall("Bridge") + private static native void nativeRecordOpen(WebContents webContents); + } +} \ No newline at end of file
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromeSwitchPreference.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromeSwitchPreference.java index 43f861d9..c2cf7d9a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromeSwitchPreference.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromeSwitchPreference.java
@@ -6,6 +6,7 @@ import android.content.Context; import android.content.res.TypedArray; +import android.os.Build; import android.preference.SwitchPreference; import android.support.v7.widget.SwitchCompat; import android.text.TextUtils; @@ -35,6 +36,13 @@ super(context, attrs); setWidgetLayoutResource(R.layout.preference_switch); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + // Fix animations. Background: setWidgetLayout resource call above disables view + // recycling, thus breaking SwitchCompat animations. Views recycling is safe in this + // case, as ChromeSwitchPreference doesn't change view types on the fly. + setRecycleEnabled(true); + } + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ChromeSwitchPreference); mDontUseSummaryAsTitle = a.getBoolean(R.styleable.ChromeSwitchPreference_dontUseSummaryAsTitle, false);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java index 2166a86..5e82b0db 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java
@@ -380,6 +380,13 @@ } /** + * @return true if websites are allowed to access device's sensors. + */ + public boolean areSensorsEnabled() { + return nativeGetSensorsEnabled(); + } + + /** * @return true if websites are allowed to play sound. */ public boolean isSoundEnabled() { @@ -754,6 +761,10 @@ nativeSetPasswordEchoEnabled(enabled); } + public void setSensorsEnabled(boolean allow) { + nativeSetSensorsEnabled(allow); + } + public void setSoundEnabled(boolean allow) { nativeSetSoundEnabled(allow); } @@ -1135,6 +1146,7 @@ private native boolean nativeGetIncognitoModeManaged(); private native boolean nativeGetPrintingEnabled(); private native boolean nativeGetPrintingManaged(); + private native boolean nativeGetSensorsEnabled(); private native boolean nativeGetSoundEnabled(); private native boolean nativeGetSupervisedUserSafeSitesEnabled(); private native void nativeSetTranslateEnabled(boolean enabled); @@ -1165,6 +1177,7 @@ private native void nativeSetNotificationsEnabled(boolean allow); private native void nativeSetNotificationsVibrateEnabled(boolean enabled); private native void nativeSetPasswordEchoEnabled(boolean enabled); + private native void nativeSetSensorsEnabled(boolean allow); private native void nativeSetSoundEnabled(boolean allow); private native boolean nativeCanPrefetchAndPrerender(); private native AboutVersionStrings nativeGetAboutVersionStrings();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/ContentSettingsResources.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/ContentSettingsResources.java index 5abd047..4bba8c5 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/ContentSettingsResources.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/ContentSettingsResources.java
@@ -173,6 +173,12 @@ R.string.website_settings_usb, ContentSetting.ASK, ContentSetting.BLOCK, R.string.website_settings_category_usb_ask, R.string.website_settings_category_usb_blocked)); + localMap.put(ContentSettingsType.CONTENT_SETTINGS_TYPE_SENSORS, + new ResourceItem(R.drawable.settings_sensors, R.string.sensors_permission_title, + R.string.sensors_permission_title, ContentSetting.ALLOW, + ContentSetting.BLOCK, + R.string.website_settings_category_sensors_allowed, + R.string.website_settings_category_sensors_blocked)); sResourceInfo = localMap; } return sResourceInfo;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SensorsInfo.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SensorsInfo.java new file mode 100644 index 0000000..36858833 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SensorsInfo.java
@@ -0,0 +1,27 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.preferences.website; + +/** + * Sensors information for a given origin. + */ +public class SensorsInfo extends PermissionInfo { + public SensorsInfo(String origin, String embedder, boolean isIncognito) { + super(origin, embedder, isIncognito); + } + + @Override + protected int getNativePreferenceValue(String origin, String embedder, boolean isIncognito) { + return WebsitePreferenceBridge.nativeGetSensorsSettingForOrigin( + origin, embedder, isIncognito); + } + + @Override + protected void setNativePreferenceValue( + String origin, String embedder, ContentSetting value, boolean isIncognito) { + WebsitePreferenceBridge.nativeSetSensorsSettingForOrigin( + origin, embedder, value.toInt(), isIncognito); + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleCategoryPreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleCategoryPreferences.java index 10e76d0..a30f2eb 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleCategoryPreferences.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleCategoryPreferences.java
@@ -175,6 +175,8 @@ return website.site().getPopupPermission() == ContentSetting.BLOCK; } else if (mCategory.showProtectedMediaSites()) { return website.site().getProtectedMediaIdentifierPermission() == ContentSetting.BLOCK; + } else if (mCategory.showSensorsSites()) { + return website.site().getSensorsPermission() == ContentSetting.BLOCK; } else if (mCategory.showSoundSites()) { return website.site().getSoundPermission() == ContentSetting.BLOCK; } @@ -461,6 +463,8 @@ } else if (mCategory.showProtectedMediaSites()) { PrefServiceBridge.getInstance().setProtectedMediaIdentifierEnabled( (boolean) newValue); + } else if (mCategory.showSensorsSites()) { + PrefServiceBridge.getInstance().setSensorsEnabled((boolean) newValue); } else if (mCategory.showSoundSites()) { PrefServiceBridge.getInstance().setSoundEnabled((boolean) newValue); } else if (mCategory.showUsbDevices()) { @@ -840,6 +844,8 @@ } else if (mCategory.showProtectedMediaSites()) { globalToggle.setChecked( PrefServiceBridge.getInstance().isProtectedMediaIdentifierEnabled()); + } else if (mCategory.showSensorsSites()) { + globalToggle.setChecked(PrefServiceBridge.getInstance().areSensorsEnabled()); } else if (mCategory.showSoundSites()) { globalToggle.setChecked(PrefServiceBridge.getInstance().isSoundEnabled()); } else if (mCategory.showUsbDevices()) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleWebsitePreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleWebsitePreferences.java index d9576cf..a72decc9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleWebsitePreferences.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleWebsitePreferences.java
@@ -80,11 +80,13 @@ public static final String PREF_POPUP_PERMISSION = "popup_permission_list"; public static final String PREF_PROTECTED_MEDIA_IDENTIFIER_PERMISSION = "protected_media_identifier_permission_list"; + public static final String PREF_SENSORS_PERMISSION = "sensors_permission_list"; public static final String PREF_SOUND_PERMISSION = "sound_permission_list"; // All permissions from the permissions preference category must be listed here. // TODO(mvanouwerkerk): Use this array in more places to reduce verbosity. private static final String[] PERMISSION_PREFERENCE_KEYS = { + PREF_ADS_PERMISSION, PREF_AUTOPLAY_PERMISSION, PREF_BACKGROUND_SYNC_PERMISSION, PREF_CAMERA_CAPTURE_PERMISSION, @@ -97,7 +99,7 @@ PREF_NOTIFICATIONS_PERMISSION, PREF_POPUP_PERMISSION, PREF_PROTECTED_MEDIA_IDENTIFIER_PERMISSION, - PREF_ADS_PERMISSION, + PREF_SENSORS_PERMISSION, PREF_SOUND_PERMISSION, }; @@ -232,6 +234,10 @@ && origin.equals(other.getLocalStorageInfo().getOrigin())) { merged.setLocalStorageInfo(other.getLocalStorageInfo()); } + if (merged.getSensorsInfo() == null && other.getSensorsInfo() != null + && permissionInfoIsForTopLevelOrigin(other.getSensorsInfo(), origin)) { + merged.setSensorsInfo(other.getSensorsInfo()); + } for (StorageInfo storageInfo : other.getStorageInfo()) { if (host.equals(storageInfo.getHost())) { merged.addStorageInfo(storageInfo); @@ -349,6 +355,8 @@ setUpListPreference(preference, mSite.getPopupPermission()); } else if (PREF_PROTECTED_MEDIA_IDENTIFIER_PERMISSION.equals(key)) { setUpListPreference(preference, mSite.getProtectedMediaIdentifierPermission()); + } else if (PREF_SENSORS_PERMISSION.equals(key)) { + setUpListPreference(preference, mSite.getSensorsPermission()); } else if (PREF_SOUND_PERMISSION.equals(key)) { setUpSoundPreference(preference); } @@ -749,6 +757,8 @@ return ContentSettingsType.CONTENT_SETTINGS_TYPE_POPUPS; case PREF_PROTECTED_MEDIA_IDENTIFIER_PERMISSION: return ContentSettingsType.CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER; + case PREF_SENSORS_PERMISSION: + return ContentSettingsType.CONTENT_SETTINGS_TYPE_SENSORS; case PREF_SOUND_PERMISSION: return ContentSettingsType.CONTENT_SETTINGS_TYPE_SOUND; default: @@ -810,6 +820,8 @@ mSite.setPopupPermission(permission); } else if (PREF_PROTECTED_MEDIA_IDENTIFIER_PERMISSION.equals(preference.getKey())) { mSite.setProtectedMediaIdentifierPermission(permission); + } else if (PREF_SENSORS_PERMISSION.equals(preference.getKey())) { + mSite.setSensorsPermission(permission); } else if (PREF_SOUND_PERMISSION.equals(preference.getKey())) { mSite.setSoundPermission(permission); } @@ -886,6 +898,7 @@ mSite.setNotificationPermission(ContentSetting.DEFAULT); mSite.setPopupPermission(ContentSetting.DEFAULT); mSite.setProtectedMediaIdentifierPermission(ContentSetting.DEFAULT); + mSite.setSensorsPermission(ContentSetting.DEFAULT); mSite.setSoundPermission(ContentSetting.DEFAULT); for (ChosenObjectInfo info : mSite.getChosenObjectInfo()) info.revoke();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SiteSettingsCategory.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SiteSettingsCategory.java index 09fdfb3..7a2bf43 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SiteSettingsCategory.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SiteSettingsCategory.java
@@ -47,6 +47,7 @@ public static final String CATEGORY_NOTIFICATIONS = "notifications"; public static final String CATEGORY_POPUPS = "popups"; public static final String CATEGORY_PROTECTED_MEDIA = "protected_content"; + public static final String CATEGORY_SENSORS = "sensors"; public static final String CATEGORY_SOUND = "sound"; public static final String CATEGORY_USE_STORAGE = "use_storage"; public static final String CATEGORY_USB = "usb"; @@ -137,6 +138,10 @@ return new SiteSettingsCategory(CATEGORY_PROTECTED_MEDIA, "", ContentSettingsType.CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER); } + if (CATEGORY_SENSORS.equals(category)) { + return new SiteSettingsCategory( + CATEGORY_SENSORS, "", ContentSettingsType.CONTENT_SETTINGS_TYPE_SENSORS); + } if (CATEGORY_SOUND.equals(category)) { return new SiteSettingsCategory( CATEGORY_SOUND, "", ContentSettingsType.CONTENT_SETTINGS_TYPE_SOUND); @@ -195,6 +200,9 @@ == ContentSettingsType.CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER) { return fromString(CATEGORY_PROTECTED_MEDIA); } + if (contentSettingsType == ContentSettingsType.CONTENT_SETTINGS_TYPE_SENSORS) { + return fromString(CATEGORY_SENSORS); + } if (contentSettingsType == ContentSettingsType.CONTENT_SETTINGS_TYPE_SOUND) { return fromString(CATEGORY_SOUND); } @@ -307,6 +315,13 @@ } /** + * Returns whether this category is the Sensors category. + */ + public boolean showSensorsSites() { + return mContentSettingsType == ContentSettingsType.CONTENT_SETTINGS_TYPE_SENSORS; + } + + /** * Returns whether this category is the Sound category. */ public boolean showSoundSites() {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SiteSettingsPreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SiteSettingsPreferences.java index 2da84aa9..55699e86 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SiteSettingsPreferences.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SiteSettingsPreferences.java
@@ -50,6 +50,7 @@ static final String NOTIFICATIONS_KEY = "notifications"; static final String POPUPS_KEY = "popups"; static final String PROTECTED_CONTENT_KEY = "protected_content"; + static final String SENSORS_KEY = "sensors"; static final String SOUND_KEY = "sound"; static final String STORAGE_KEY = "use_storage"; static final String TRANSLATE_KEY = "translate"; @@ -107,6 +108,8 @@ return ContentSettingsType.CONTENT_SETTINGS_TYPE_POPUPS; } else if (PROTECTED_CONTENT_KEY.equals(key)) { return ContentSettingsType.CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER; + } else if (SENSORS_KEY.equals(key)) { + return ContentSettingsType.CONTENT_SETTINGS_TYPE_SENSORS; } else if (SOUND_KEY.equals(key)) { return ContentSettingsType.CONTENT_SETTINGS_TYPE_SOUND; } else if (USB_KEY.equals(key)) { @@ -137,6 +140,7 @@ getPreferenceScreen().removePreference(findPreference(MICROPHONE_KEY)); getPreferenceScreen().removePreference(findPreference(NOTIFICATIONS_KEY)); getPreferenceScreen().removePreference(findPreference(POPUPS_KEY)); + getPreferenceScreen().removePreference(findPreference(SENSORS_KEY)); getPreferenceScreen().removePreference(findPreference(SOUND_KEY)); getPreferenceScreen().removePreference(findPreference(STORAGE_KEY)); getPreferenceScreen().removePreference(findPreference(TRANSLATE_KEY)); @@ -168,6 +172,9 @@ if (ChromeFeatureList.isEnabled(ChromeFeatureList.LANGUAGES_PREFERENCE)) { getPreferenceScreen().removePreference(findPreference(TRANSLATE_KEY)); } + if (!ChromeFeatureList.isEnabled(ChromeFeatureList.GENERIC_SENSOR_EXTRA_CLASSES)) { + getPreferenceScreen().removePreference(findPreference(SENSORS_KEY)); + } } } @@ -203,6 +210,9 @@ websitePrefs.add(MICROPHONE_KEY); websitePrefs.add(NOTIFICATIONS_KEY); websitePrefs.add(POPUPS_KEY); + if (ChromeFeatureList.isEnabled(ChromeFeatureList.GENERIC_SENSOR_EXTRA_CLASSES)) { + websitePrefs.add(SENSORS_KEY); + } if (ChromeFeatureList.isEnabled(ChromeFeatureList.SOUND_CONTENT_SETTING)) { websitePrefs.add(SOUND_KEY); } @@ -238,6 +248,8 @@ checked = PrefServiceBridge.getInstance().popupsEnabled(); } else if (PROTECTED_CONTENT_KEY.equals(prefName)) { checked = PrefServiceBridge.getInstance().isProtectedMediaIdentifierEnabled(); + } else if (SENSORS_KEY.equals(prefName)) { + checked = PrefServiceBridge.getInstance().areSensorsEnabled(); } else if (SOUND_KEY.equals(prefName)) { checked = PrefServiceBridge.getInstance().isSoundEnabled(); } else if (USB_KEY.equals(prefName)) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/Website.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/Website.java index d17eeda..f03218d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/Website.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/Website.java
@@ -43,6 +43,7 @@ private NotificationInfo mNotificationInfo; private ContentSettingException mPopupException; private ProtectedMediaIdentifierInfo mProtectedMediaIdentifierInfo; + private SensorsInfo mSensorsInfo; private ContentSettingException mSoundException; private final List<StorageInfo> mStorageInfo = new ArrayList<StorageInfo>(); private int mStorageInfoCallbacksLeft; @@ -330,6 +331,36 @@ } /** + * Sets the SensorsInfo object for this Website. + */ + public void setSensorsInfo(SensorsInfo info) { + mSensorsInfo = info; + } + + /** + * Returns the SensorsInfo object for this Website. + */ + public SensorsInfo getSensorsInfo() { + return mSensorsInfo; + } + + /** + * Returns what permission governs sensors access. + */ + public ContentSetting getSensorsPermission() { + return mSensorsInfo != null ? mSensorsInfo.getContentSetting() : null; + } + + /** + * Set sensors permission access setting for this site. + */ + public void setSensorsPermission(ContentSetting value) { + if (mSensorsInfo != null) { + mSensorsInfo.setContentSetting(value); + } + } + + /** * Returns what permission governs Sound access. */ public ContentSetting getSoundPermission() {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/WebsitePermissionsFetcher.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/WebsitePermissionsFetcher.java index a2f2561..f3f7aef5 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/WebsitePermissionsFetcher.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/WebsitePermissionsFetcher.java
@@ -136,6 +136,8 @@ queue.add(new UsbInfoFetcher()); // Clipboard info is per-origin. queue.add(new ClipboardInfoFetcher()); + // Sensors permission is per-origin. + queue.add(new SensorsInfoFetcher()); queue.add(new PermissionsAvailableCallbackRunner()); @@ -203,6 +205,9 @@ } else if (category.showClipboardSites()) { // Clipboard permission is per-origin. queue.add(new ClipboardInfoFetcher()); + } else if (category.showSensorsSites()) { + // Sensors permission is per-origin. + queue.add(new SensorsInfoFetcher()); } queue.add(new PermissionsAvailableCallbackRunner()); queue.next(); @@ -471,6 +476,17 @@ } } + private class SensorsInfoFetcher extends Task { + @Override + public void run() { + for (SensorsInfo info : WebsitePreferenceBridge.getSensorsInfo()) { + WebsiteAddress origin = WebsiteAddress.create(info.getOrigin()); + if (origin == null) continue; + findOrCreateSite(origin, null).setSensorsInfo(info); + } + } + } + private class PermissionsAvailableCallbackRunner extends Task { @Override public void run() {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/WebsitePreferenceBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/WebsitePreferenceBridge.java index 387ac30..976669a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/WebsitePreferenceBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/WebsitePreferenceBridge.java
@@ -236,6 +236,21 @@ } /** + * @return the list of origins that have permission to access device's sensors. + */ + public static List<SensorsInfo> getSensorsInfo() { + ArrayList<SensorsInfo> list = new ArrayList<SensorsInfo>(); + nativeGetSensorsOrigins(list); + return list; + } + + @CalledByNative + private static void insertSensorsInfoIntoList( + ArrayList<SensorsInfo> list, String origin, String embedder) { + list.add(new SensorsInfo(origin, embedder, false)); + } + + /** * Returns whether the DSE (Default Search Engine) controls the given permission the given * origin. */ @@ -302,5 +317,10 @@ private static native boolean nativeIsPermissionControlledByDSE( @ContentSettingsType int contentSettingsType, String origin, boolean isIncognito); private static native boolean nativeGetAdBlockingActivated(String origin); + static native int nativeGetSensorsSettingForOrigin( + String origin, String embedder, boolean isIncognito); + static native void nativeSetSensorsSettingForOrigin( + String origin, String embedder, int value, boolean isIncognito); + static native void nativeGetSensorsOrigins(Object list); static native void nativeResetNotificationsSettingsForTest(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java index b06e04e..70fad6ac 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
@@ -47,6 +47,7 @@ import org.chromium.chrome.browser.browserservices.Origin; import org.chromium.chrome.browser.browserservices.OriginVerifier; import org.chromium.chrome.browser.browserservices.OriginVerifier.OriginVerificationListener; +import org.chromium.chrome.browser.browserservices.UkmRecorder; import org.chromium.chrome.browser.compositor.layouts.LayoutManager; import org.chromium.chrome.browser.customtabs.CustomTabAppMenuPropertiesDelegate; import org.chromium.chrome.browser.customtabs.CustomTabNavigationEventObserver; @@ -127,6 +128,7 @@ implements BrowserSessionContentHandler, OriginVerificationListener { private boolean mVerificationFailed; private OriginVerifier mOriginVerifier; + private final UkmRecorder mUkmRecorder = new UkmRecorder.Bridge(); @Override public void loadUrlAndTrackFromTimestamp(LoadUrlParams params, long timestamp) {} @@ -184,7 +186,16 @@ Boolean online) { mVerificationFailed = !verified; mOriginVerifier = null; - if (mVerificationFailed) getFullscreenManager().setPositionsForTabToNonFullscreen(); + + if (mVerificationFailed) { + getFullscreenManager().setPositionsForTabToNonFullscreen(); + return; + } + + // Occasionally verification occurs in the background while there is no active Tab. + if (areTabModelsInitialized() && getActivityTab() != null) { + mUkmRecorder.recordTwaOpened(getActivityTab().getWebContents()); + } } /**
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd index 23e5375..7e3aaf7 100644 --- a/chrome/android/java/strings/android_chrome_strings.grd +++ b/chrome/android/java/strings/android_chrome_strings.grd
@@ -809,6 +809,9 @@ <message name="IDS_PUSH_NOTIFICATIONS_PERMISSION_TITLE" desc="Title for the permission for showing push notifications [CHAR-LIMIT=32]"> Notifications </message> + <message name="IDS_SENSORS_PERMISSION_TITLE" desc="Title of the permission to use device's sensors [CHAR-LIMIT=32]"> + Motion or light sensors + </message> <message name="IDS_SOUND_PERMISSION_TITLE" desc="Title of the permission to play sound [CHAR-LIMIT=32]"> Sound </message> @@ -923,6 +926,12 @@ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_CLIPBOARD_BLOCKED_LIST" desc="Summary text explaining that the clipboard permission is set to block read access on some sites. To be shown in the list of permission categories."> Blocked from reading clipboard </message> + <message name="IDS_WEBSITE_SETTINGS_CATEGORY_SENSORS_ALLOWED" desc="Summary text explaining that sites are allowed to use device's sensors and that it is the recommended setting."> + Allow sites to access your sensors (recommended) + </message> + <message name="IDS_WEBSITE_SETTINGS_CATEGORY_SENSORS_BLOCKED" desc="Summary text explaining that access to sensors is being blocked on some sites."> + Block sites from accessing your sensors + </message> <message name="IDS_WEBSITE_SETTINGS_CATEGORY_SOUND_ALLOWED" desc="Summary text explaining that sites are allowed to play sound and that it is the recommended setting."> Allow sites to play sound (recommended) </message>
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni index f16d744..3d52edb 100644 --- a/chrome/android/java_sources.gni +++ b/chrome/android/java_sources.gni
@@ -161,6 +161,7 @@ "java/src/org/chromium/chrome/browser/browserservices/BrowserSessionContentUtils.java", "java/src/org/chromium/chrome/browser/browserservices/BrowserSessionDataProvider.java", "java/src/org/chromium/chrome/browser/browserservices/OriginVerifier.java", + "java/src/org/chromium/chrome/browser/browserservices/UkmRecorder.java", "java/src/org/chromium/chrome/browser/browserservices/Origin.java", "java/src/org/chromium/chrome/browser/browserservices/PostMessageHandler.java", "java/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClient.java", @@ -1125,6 +1126,7 @@ "java/src/org/chromium/chrome/browser/preferences/website/NotificationInfo.java", "java/src/org/chromium/chrome/browser/preferences/website/PermissionInfo.java", "java/src/org/chromium/chrome/browser/preferences/website/ProtectedMediaIdentifierInfo.java", + "java/src/org/chromium/chrome/browser/preferences/website/SensorsInfo.java", "java/src/org/chromium/chrome/browser/preferences/website/SingleCategoryPreferences.java", "java/src/org/chromium/chrome/browser/preferences/website/SingleWebsitePreferences.java", "java/src/org/chromium/chrome/browser/preferences/website/SiteSettingsCategory.java",
diff --git a/chrome/android/profiles/newest.txt b/chrome/android/profiles/newest.txt index ddec348..e03d28b 100644 --- a/chrome/android/profiles/newest.txt +++ b/chrome/android/profiles/newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-69.0.3448.0_rc-r1.afdo.bz2 \ No newline at end of file +chromeos-chrome-amd64-69.0.3449.0_rc-r1.afdo.bz2 \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 364fac38..af54168e 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -1899,6 +1899,7 @@ "android/bookmarks/partner_bookmarks_shim.h", "android/bottombar/overlay_panel_content.cc", "android/bottombar/overlay_panel_content.h", + "android/browserservices/ukm_recorder.cc", "android/browsing_data/browsing_data_bridge.cc", "android/browsing_data/browsing_data_counter_bridge.cc", "android/browsing_data/browsing_data_counter_bridge.h", @@ -4299,6 +4300,7 @@ "../android/java/src/org/chromium/chrome/browser/banners/AppBannerUiDelegateAndroid.java", "../android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkBridge.java", "../android/java/src/org/chromium/chrome/browser/browserservices/OriginVerifier.java", + "../android/java/src/org/chromium/chrome/browser/browserservices/UkmRecorder.java", "../android/java/src/org/chromium/chrome/browser/browsing_data/UrlFilterBridge.java", "../android/java/src/org/chromium/chrome/browser/childaccounts/ChildAccountFeedbackReporter.java", "../android/java/src/org/chromium/chrome/browser/childaccounts/ChildAccountService.java",
diff --git a/chrome/browser/android/browserservices/ukm_recorder.cc b/chrome/browser/android/browserservices/ukm_recorder.cc new file mode 100644 index 0000000..c1b3331 --- /dev/null +++ b/chrome/browser/android/browserservices/ukm_recorder.cc
@@ -0,0 +1,27 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/android/jni_android.h" +#include "components/ukm/content/source_url_recorder.h" +#include "content/public/browser/web_contents.h" +#include "jni/UkmRecorder_jni.h" +#include "services/metrics/public/cpp/ukm_builders.h" +#include "services/metrics/public/cpp/ukm_recorder.h" + +namespace browserservices { + +// Called by Java org.chromium.chrome.browser.browserservices.UkmRecorder. +static void JNI_Bridge_RecordOpen( + JNIEnv* env, + const base::android::JavaParamRef<jclass>& jcaller, + const base::android::JavaParamRef<jobject>& java_web_contents) { + content::WebContents* web_contents = + content::WebContents::FromJavaWebContents(java_web_contents); + ukm::SourceId source_id = + ukm::GetSourceIdForWebContentsDocument(web_contents); + ukm::builders::TrustedWebActivity_Open(source_id).Record( + ukm::UkmRecorder::Get()); +} + +} // namespace browserservices
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc index 98a7f4a..ca760ab 100644 --- a/chrome/browser/android/chrome_feature_list.cc +++ b/chrome/browser/android/chrome_feature_list.cc
@@ -29,6 +29,7 @@ #include "content/public/common/content_features.h" #include "jni/ChromeFeatureList_jni.h" #include "media/base/media_switches.h" +#include "services/device/public/cpp/device_features.h" using base::android::ConvertJavaStringToUTF8; using base::android::ConvertUTF8ToJavaString; @@ -53,6 +54,7 @@ &features::kDownloadsForeground, &features::kDownloadsLocationChange, &features::kExperimentalAppBanners, + &features::kGenericSensorExtraClasses, &features::kImportantSitesInCbd, &features::kMaterialDesignIncognitoNTP, &features::kPermissionDelegation,
diff --git a/chrome/browser/android/preferences/pref_service_bridge.cc b/chrome/browser/android/preferences/pref_service_bridge.cc index e0e2ded4..70cbfd17 100644 --- a/chrome/browser/android/preferences/pref_service_bridge.cc +++ b/chrome/browser/android/preferences/pref_service_bridge.cc
@@ -258,6 +258,12 @@ return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_AUTOPLAY); } +static jboolean JNI_PrefServiceBridge_GetSensorsEnabled( + JNIEnv* env, + const JavaParamRef<jobject>& obj) { + return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_SENSORS); +} + static jboolean JNI_PrefServiceBridge_GetSoundEnabled( JNIEnv* env, const JavaParamRef<jobject>& obj) { @@ -676,6 +682,17 @@ allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); } +static void JNI_PrefServiceBridge_SetSensorsEnabled( + JNIEnv* env, + const JavaParamRef<jobject>& obj, + jboolean allow) { + HostContentSettingsMap* host_content_settings_map = + HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile()); + host_content_settings_map->SetDefaultContentSetting( + CONTENT_SETTINGS_TYPE_SENSORS, + allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); +} + static void JNI_PrefServiceBridge_SetSoundEnabled( JNIEnv* env, const JavaParamRef<jobject>& obj,
diff --git a/chrome/browser/android/preferences/website_preference_bridge.cc b/chrome/browser/android/preferences/website_preference_bridge.cc index a829a865..a77bd65 100644 --- a/chrome/browser/android/preferences/website_preference_bridge.cc +++ b/chrome/browser/android/preferences/website_preference_bridge.cc
@@ -903,6 +903,37 @@ url, GURL(), CONTENT_SETTINGS_TYPE_ADS_DATA, std::string(), nullptr); } +static void JNI_WebsitePreferenceBridge_GetSensorsOrigins( + JNIEnv* env, + const JavaParamRef<jclass>& clazz, + const JavaParamRef<jobject>& list) { + JNI_WebsitePreferenceBridge_GetOrigins( + env, CONTENT_SETTINGS_TYPE_SENSORS, + &Java_WebsitePreferenceBridge_insertSensorsInfoIntoList, list, false); +} + +static jint JNI_WebsitePreferenceBridge_GetSensorsSettingForOrigin( + JNIEnv* env, + const JavaParamRef<jclass>& clazz, + const JavaParamRef<jstring>& origin, + const JavaParamRef<jstring>& embedder, + jboolean is_incognito) { + return JNI_WebsitePreferenceBridge_GetSettingForOrigin( + env, CONTENT_SETTINGS_TYPE_SENSORS, origin, embedder, is_incognito); +} + +static void JNI_WebsitePreferenceBridge_SetSensorsSettingForOrigin( + JNIEnv* env, + const JavaParamRef<jclass>& clazz, + const JavaParamRef<jstring>& origin, + const JavaParamRef<jstring>& embedder, + jint value, + jboolean is_incognito) { + JNI_WebsitePreferenceBridge_SetSettingForOrigin( + env, CONTENT_SETTINGS_TYPE_SENSORS, origin, embedder, + static_cast<ContentSetting>(value), is_incognito); +} + // On Android O+ notification channels are not stored in the Chrome profile and // so are persisted across tests. This function resets them. static void JNI_WebsitePreferenceBridge_ResetNotificationsSettingsForTest(
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 406fddd..df85af3 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -1796,6 +1796,8 @@ sources = [ "app_mode/test_kiosk_extension_builder.cc", "app_mode/test_kiosk_extension_builder.h", + "crostini/crostini_test_helper.cc", + "crostini/crostini_test_helper.h", "extensions/test_external_cache.cc", "extensions/test_external_cache.h", "lock_screen_apps/fake_lock_screen_profile_creator.cc", @@ -1824,6 +1826,7 @@ ":chromeos", "//chrome/test:test_support", "//chromeos", + "//components/crx_file", "//components/policy/proto", "//crypto:platform", "//google_apis",
diff --git a/chrome/browser/chromeos/arc/arc_service_launcher.cc b/chrome/browser/chromeos/arc/arc_service_launcher.cc index 1569c93..37dab6ad 100644 --- a/chrome/browser/chromeos/arc/arc_service_launcher.cc +++ b/chrome/browser/chromeos/arc/arc_service_launcher.cc
@@ -48,6 +48,7 @@ #include "components/arc/audio/arc_audio_bridge.h" #include "components/arc/clipboard/arc_clipboard_bridge.h" #include "components/arc/crash_collector/arc_crash_collector_bridge.h" +#include "components/arc/disk_quota/arc_disk_quota_bridge.h" #include "components/arc/ime/arc_ime_service.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" #include "components/arc/lock_screen/arc_lock_screen_bridge.h" @@ -145,6 +146,7 @@ ArcCertStoreBridge::GetForBrowserContext(profile); ArcClipboardBridge::GetForBrowserContext(profile); ArcCrashCollectorBridge::GetForBrowserContext(profile); + ArcDiskQuotaBridge::GetForBrowserContext(profile); ArcDownloadsWatcherService::GetForBrowserContext(profile); ArcEnterpriseReportingService::GetForBrowserContext(profile); ArcFileSystemBridge::GetForBrowserContext(profile);
diff --git a/chrome/browser/chromeos/crostini/crostini_manager.cc b/chrome/browser/chromeos/crostini/crostini_manager.cc index fc0b16c..e2812ced 100644 --- a/chrome/browser/chromeos/crostini/crostini_manager.cc +++ b/chrome/browser/chromeos/crostini/crostini_manager.cc
@@ -655,13 +655,9 @@ return; } if (!GetConciergeClient()->IsContainerStartedSignalConnected() || - !GetCiceroneClient()->IsContainerStartedSignalConnected()) { - LOG(ERROR) << "Async call to StartContainer can't complete when signal " - "is not connected."; - std::move(callback).Run(ConciergeClientResult::CLIENT_ERROR); - return; - } - if (!GetConciergeClient()->IsContainerStartupFailedSignalConnected()) { + !GetConciergeClient()->IsContainerStartupFailedSignalConnected() || + !GetCiceroneClient()->IsContainerStartedSignalConnected() || + !GetCiceroneClient()->IsContainerShutdownSignalConnected()) { LOG(ERROR) << "Async call to StartContainer can't complete when signal " "is not connected."; std::move(callback).Run(ConciergeClientResult::CLIENT_ERROR); @@ -794,6 +790,16 @@ CrostiniRestarterServiceFactory::GetForProfile(profile)->Abort(restart_id); } +void CrostiniManager::AddShutdownContainerCallback( + Profile* profile, + std::string vm_name, + std::string container_name, + ShutdownContainerCallback shutdown_callback) { + shutdown_container_callbacks_.emplace( + std::make_tuple(CryptohomeIdForProfile(profile), vm_name, container_name), + std::move(shutdown_callback)); +} + void CrostiniManager::OnCreateDiskImage( CreateDiskImageCallback callback, base::Optional<vm_tools::concierge::CreateDiskImageResponse> reply) { @@ -958,6 +964,22 @@ start_container_callbacks_.erase(range.first, range.second); } +void CrostiniManager::OnContainerShutdown( + const vm_tools::cicerone::ContainerShutdownSignal& signal) { + // Find the callbacks to call, then erase them from the map. + std::string owner_id = signal.owner_id(); + // TODO(joelhockey): remove this check once Cicerone always fills in owner_id. + if (owner_id.empty()) { + owner_id = CryptohomeIdForProfile(ProfileManager::GetPrimaryUserProfile()); + } + auto range = shutdown_container_callbacks_.equal_range( + std::make_tuple(owner_id, signal.vm_name(), signal.container_name())); + for (auto it = range.first; it != range.second; ++it) { + std::move(it->second).Run(); + } + shutdown_container_callbacks_.erase(range.first, range.second); +} + void CrostiniManager::OnLaunchContainerApplication( LaunchContainerApplicationCallback callback, base::Optional<vm_tools::concierge::LaunchContainerApplicationResponse>
diff --git a/chrome/browser/chromeos/crostini/crostini_manager.h b/chrome/browser/chromeos/crostini/crostini_manager.h index a573c6f..b55cc3b 100644 --- a/chrome/browser/chromeos/crostini/crostini_manager.h +++ b/chrome/browser/chromeos/crostini/crostini_manager.h
@@ -75,6 +75,8 @@ using StopVmCallback = ConciergeClientCallback; // The type of the callback for CrostiniManager::StartContainer. using StartContainerCallback = ConciergeClientCallback; + // The type of the callback for CrostiniManager::ShutdownContainer. + using ShutdownContainerCallback = base::OnceClosure; // The type of the callback for CrostiniManager::LaunchContainerApplication. using LaunchContainerApplicationCallback = ConciergeClientCallback; // The type of the callback for CrostiniManager::GetContainerAppIcons. @@ -211,9 +213,16 @@ void AbortRestartCrostini(Profile* profile, RestartId id); // Can be called for testing to skip restart. - void set_skip_restart_for_testing() { skip_restart_for_testing_ = true; }; + void set_skip_restart_for_testing() { skip_restart_for_testing_ = true; } bool skip_restart_for_testing() { return skip_restart_for_testing_; } + // Adds a callback to receive notification of container shutdown. + void AddShutdownContainerCallback( + Profile* profile, + std::string vm_name, + std::string container_name, + ShutdownContainerCallback shutdown_callback); + // ConciergeClient::Observer: void OnContainerStarted( const vm_tools::concierge::ContainerStartedSignal& signal) override; @@ -223,6 +232,8 @@ // CiceroneClient::Observer: void OnContainerStarted( const vm_tools::cicerone::ContainerStartedSignal& signal) override; + void OnContainerShutdown( + const vm_tools::cicerone::ContainerShutdownSignal& signal) override; void RemoveCrostini(Profile* profile, std::string vm_name, @@ -311,6 +322,12 @@ bool skip_restart_for_testing_ = false; + // Pending ShutdownContainer callbacks are keyed by <owner_id, vm_name, + // container_name> string tuples. + std::multimap<std::tuple<std::string, std::string, std::string>, + ShutdownContainerCallback> + shutdown_container_callbacks_; + // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. base::WeakPtrFactory<CrostiniManager> weak_ptr_factory_;
diff --git a/chrome/browser/chromeos/crostini/crostini_manager_unittest.cc b/chrome/browser/chromeos/crostini/crostini_manager_unittest.cc index 0eb8181..cbdfe56 100644 --- a/chrome/browser/chromeos/crostini/crostini_manager_unittest.cc +++ b/chrome/browser/chromeos/crostini/crostini_manager_unittest.cc
@@ -329,6 +329,15 @@ run_loop()->Run(); } +TEST_F(CrostiniManagerTest, ShutdownContainerSignalCiceroneNotConnectedError) { + fake_cicerone_client_->set_container_shutdown_signal_connected(false); + CrostiniManager::GetInstance()->StartContainer( + kVmName, kContainerName, kContainerUserName, kCryptohomeId, + base::BindOnce(&CrostiniManagerTest::StartContainerClientErrorCallback, + base::Unretained(this), run_loop()->QuitClosure())); + run_loop()->Run(); +} + TEST_F(CrostiniManagerTest, StartContainerSuccess) { CrostiniManager::GetInstance()->StartContainer( kVmName, kContainerName, kContainerUserName, kCryptohomeId,
diff --git a/chrome/browser/chromeos/crostini/crostini_registry_service_unittest.cc b/chrome/browser/chromeos/crostini/crostini_registry_service_unittest.cc index 125df402..2cc2826 100644 --- a/chrome/browser/chromeos/crostini/crostini_registry_service_unittest.cc +++ b/chrome/browser/chromeos/crostini/crostini_registry_service_unittest.cc
@@ -8,10 +8,10 @@ #include "base/macros.h" #include "base/test/simple_test_clock.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/vm_applications/apps.pb.h" -#include "components/crx_file/id_util.h" #include "content/public/test/test_browser_thread_bundle.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -42,34 +42,6 @@ const std::vector<std::string>&)); }; - std::string GenerateAppId(const std::string& desktop_file_id, - const std::string& vm_name, - const std::string& container_name) { - return crx_file::id_util::GenerateId( - "crostini:" + vm_name + "/" + container_name + "/" + desktop_file_id); - } - - App BasicApp(const std::string& desktop_file_id, - const std::string& name = "") { - App app; - app.set_desktop_file_id(desktop_file_id); - App::LocaleString::Entry* entry = app.mutable_name()->add_values(); - entry->set_locale(std::string()); - entry->set_value(name.empty() ? desktop_file_id : name); - return app; - } - - // Returns an ApplicationList with a single desktop file - ApplicationList BasicAppList(const std::string& desktop_file_id, - const std::string& vm_name, - const std::string& container_name) { - ApplicationList app_list; - app_list.set_vm_name(vm_name); - app_list.set_container_name(container_name); - *app_list.add_apps() = BasicApp(desktop_file_id); - return app_list; - } - std::string WindowIdForWMClass(const std::string& wm_class) { return "org.chromium.termina.wmclass." + wm_class; } @@ -97,7 +69,8 @@ std::vector<std::string> mime_types = {"text/plain", "text/x-python"}; bool no_display = true; - std::string app_id = GenerateAppId(desktop_file_id, vm_name, container_name); + std::string app_id = CrostiniTestHelper::GenerateAppId( + desktop_file_id, vm_name, container_name); EXPECT_FALSE(service()->GetRegistration(app_id).has_value()); ApplicationList app_list; @@ -137,13 +110,18 @@ } TEST_F(CrostiniRegistryServiceTest, Observer) { - ApplicationList app_list = BasicAppList("app 1", "vm", "container"); - *app_list.add_apps() = BasicApp("app 2"); - *app_list.add_apps() = BasicApp("app 3"); - std::string app_id_1 = GenerateAppId("app 1", "vm", "container"); - std::string app_id_2 = GenerateAppId("app 2", "vm", "container"); - std::string app_id_3 = GenerateAppId("app 3", "vm", "container"); - std::string app_id_4 = GenerateAppId("app 4", "vm", "container"); + ApplicationList app_list = + CrostiniTestHelper::BasicAppList("app 1", "vm", "container"); + *app_list.add_apps() = CrostiniTestHelper::BasicApp("app 2"); + *app_list.add_apps() = CrostiniTestHelper::BasicApp("app 3"); + std::string app_id_1 = + CrostiniTestHelper::GenerateAppId("app 1", "vm", "container"); + std::string app_id_2 = + CrostiniTestHelper::GenerateAppId("app 2", "vm", "container"); + std::string app_id_3 = + CrostiniTestHelper::GenerateAppId("app 3", "vm", "container"); + std::string app_id_4 = + CrostiniTestHelper::GenerateAppId("app 4", "vm", "container"); Observer observer; service()->AddObserver(&observer); @@ -166,8 +144,10 @@ } TEST_F(CrostiniRegistryServiceTest, InstallAndLaunchTime) { - ApplicationList app_list = BasicAppList("app", "vm", "container"); - std::string app_id = GenerateAppId("app", "vm", "container"); + ApplicationList app_list = + CrostiniTestHelper::BasicAppList("app", "vm", "container"); + std::string app_id = + CrostiniTestHelper::GenerateAppId("app", "vm", "container"); test_clock_.Advance(base::TimeDelta::FromHours(1)); Observer observer; @@ -216,12 +196,18 @@ // Test that UpdateApplicationList doesn't clobber apps from different VMs or // containers. TEST_F(CrostiniRegistryServiceTest, MultipleContainers) { - service()->UpdateApplicationList(BasicAppList("app", "vm 1", "container 1")); - service()->UpdateApplicationList(BasicAppList("app", "vm 1", "container 2")); - service()->UpdateApplicationList(BasicAppList("app", "vm 2", "container 1")); - std::string app_id_1 = GenerateAppId("app", "vm 1", "container 1"); - std::string app_id_2 = GenerateAppId("app", "vm 1", "container 2"); - std::string app_id_3 = GenerateAppId("app", "vm 2", "container 1"); + service()->UpdateApplicationList( + CrostiniTestHelper::BasicAppList("app", "vm 1", "container 1")); + service()->UpdateApplicationList( + CrostiniTestHelper::BasicAppList("app", "vm 1", "container 2")); + service()->UpdateApplicationList( + CrostiniTestHelper::BasicAppList("app", "vm 2", "container 1")); + std::string app_id_1 = + CrostiniTestHelper::GenerateAppId("app", "vm 1", "container 1"); + std::string app_id_2 = + CrostiniTestHelper::GenerateAppId("app", "vm 1", "container 2"); + std::string app_id_3 = + CrostiniTestHelper::GenerateAppId("app", "vm 2", "container 1"); EXPECT_THAT(service()->GetRegisteredAppIds(), testing::UnorderedElementsAre(app_id_1, app_id_2, app_id_3, @@ -229,8 +215,9 @@ // Clobber app_id_2 service()->UpdateApplicationList( - BasicAppList("app 2", "vm 1", "container 2")); - std::string new_app_id = GenerateAppId("app 2", "vm 1", "container 2"); + CrostiniTestHelper::BasicAppList("app 2", "vm 1", "container 2")); + std::string new_app_id = + CrostiniTestHelper::GenerateAppId("app 2", "vm 1", "container 2"); EXPECT_THAT(service()->GetRegisteredAppIds(), testing::UnorderedElementsAre(app_id_1, app_id_3, new_app_id, @@ -240,15 +227,22 @@ // Test that ClearApplicationList works, and only removes apps from the // specified container. TEST_F(CrostiniRegistryServiceTest, ClearApplicationList) { - service()->UpdateApplicationList(BasicAppList("app", "vm 1", "container 1")); - service()->UpdateApplicationList(BasicAppList("app", "vm 1", "container 2")); - ApplicationList app_list = BasicAppList("app", "vm 2", "container 1"); - *app_list.add_apps() = BasicApp("app 2"); + service()->UpdateApplicationList( + CrostiniTestHelper::BasicAppList("app", "vm 1", "container 1")); + service()->UpdateApplicationList( + CrostiniTestHelper::BasicAppList("app", "vm 1", "container 2")); + ApplicationList app_list = + CrostiniTestHelper::BasicAppList("app", "vm 2", "container 1"); + *app_list.add_apps() = CrostiniTestHelper::BasicApp("app 2"); service()->UpdateApplicationList(app_list); - std::string app_id_1 = GenerateAppId("app", "vm 1", "container 1"); - std::string app_id_2 = GenerateAppId("app", "vm 1", "container 2"); - std::string app_id_3 = GenerateAppId("app", "vm 2", "container 1"); - std::string app_id_4 = GenerateAppId("app 2", "vm 2", "container 1"); + std::string app_id_1 = + CrostiniTestHelper::GenerateAppId("app", "vm 1", "container 1"); + std::string app_id_2 = + CrostiniTestHelper::GenerateAppId("app", "vm 1", "container 2"); + std::string app_id_3 = + CrostiniTestHelper::GenerateAppId("app", "vm 2", "container 1"); + std::string app_id_4 = + CrostiniTestHelper::GenerateAppId("app 2", "vm 2", "container 1"); EXPECT_THAT(service()->GetRegisteredAppIds(), testing::UnorderedElementsAre(app_id_1, app_id_2, app_id_3, @@ -262,21 +256,23 @@ } TEST_F(CrostiniRegistryServiceTest, GetCrostiniAppIdNoStartupID) { - ApplicationList app_list = BasicAppList("app", "vm", "container"); - *app_list.add_apps() = BasicApp("cool.app"); - *app_list.add_apps() = BasicApp("super"); + ApplicationList app_list = + CrostiniTestHelper::BasicAppList("app", "vm", "container"); + *app_list.add_apps() = CrostiniTestHelper::BasicApp("cool.app"); + *app_list.add_apps() = CrostiniTestHelper::BasicApp("super"); service()->UpdateApplicationList(app_list); - service()->UpdateApplicationList(BasicAppList("super", "vm 2", "container")); + service()->UpdateApplicationList( + CrostiniTestHelper::BasicAppList("super", "vm 2", "container")); EXPECT_THAT(service()->GetRegisteredAppIds(), testing::SizeIs(5)); EXPECT_EQ( service()->GetCrostiniShelfAppId(WindowIdForWMClass("App"), nullptr), - GenerateAppId("app", "vm", "container")); + CrostiniTestHelper::GenerateAppId("app", "vm", "container")); EXPECT_EQ( service()->GetCrostiniShelfAppId(WindowIdForWMClass("cool.app"), nullptr), - GenerateAppId("cool.app", "vm", "container")); + CrostiniTestHelper::GenerateAppId("cool.app", "vm", "container")); EXPECT_EQ( service()->GetCrostiniShelfAppId(WindowIdForWMClass("super"), nullptr), @@ -289,7 +285,7 @@ "crostini:org.chromium.termina.xid.654321"); EXPECT_EQ(service()->GetCrostiniShelfAppId("cool.app", nullptr), - GenerateAppId("cool.app", "vm", "container")); + CrostiniTestHelper::GenerateAppId("cool.app", "vm", "container")); EXPECT_EQ(service()->GetCrostiniShelfAppId("fancy.app", nullptr), "crostini:fancy.app"); @@ -298,10 +294,11 @@ } TEST_F(CrostiniRegistryServiceTest, GetCrostiniAppIdStartupWMClass) { - ApplicationList app_list = BasicAppList("app", "vm", "container"); + ApplicationList app_list = + CrostiniTestHelper::BasicAppList("app", "vm", "container"); app_list.mutable_apps(0)->set_startup_wm_class("app_start"); - *app_list.add_apps() = BasicApp("app2"); - *app_list.add_apps() = BasicApp("app3"); + *app_list.add_apps() = CrostiniTestHelper::BasicApp("app2"); + *app_list.add_apps() = CrostiniTestHelper::BasicApp("app3"); app_list.mutable_apps(1)->set_startup_wm_class("app2"); app_list.mutable_apps(2)->set_startup_wm_class("app2"); service()->UpdateApplicationList(app_list); @@ -310,34 +307,36 @@ EXPECT_EQ(service()->GetCrostiniShelfAppId(WindowIdForWMClass("app_start"), nullptr), - GenerateAppId("app", "vm", "container")); + CrostiniTestHelper::GenerateAppId("app", "vm", "container")); EXPECT_EQ( service()->GetCrostiniShelfAppId(WindowIdForWMClass("app2"), nullptr), "crostini:" + WindowIdForWMClass("app2")); } TEST_F(CrostiniRegistryServiceTest, GetCrostiniAppIdStartupNotify) { - ApplicationList app_list = BasicAppList("app", "vm", "container"); + ApplicationList app_list = + CrostiniTestHelper::BasicAppList("app", "vm", "container"); app_list.mutable_apps(0)->set_startup_notify(true); - *app_list.add_apps() = BasicApp("app2"); + *app_list.add_apps() = CrostiniTestHelper::BasicApp("app2"); service()->UpdateApplicationList(app_list); std::string startup_id = "app"; EXPECT_EQ(service()->GetCrostiniShelfAppId("whatever", &startup_id), - GenerateAppId("app", "vm", "container")); + CrostiniTestHelper::GenerateAppId("app", "vm", "container")); startup_id = "app2"; EXPECT_EQ(service()->GetCrostiniShelfAppId("whatever", &startup_id), "crostini:whatever"); } TEST_F(CrostiniRegistryServiceTest, GetCrostiniAppIdName) { - ApplicationList app_list = BasicAppList("app", "vm", "container"); - *app_list.add_apps() = BasicApp("app2", "name2"); + ApplicationList app_list = + CrostiniTestHelper::BasicAppList("app", "vm", "container"); + *app_list.add_apps() = CrostiniTestHelper::BasicApp("app2", "name2"); service()->UpdateApplicationList(app_list); EXPECT_EQ( service()->GetCrostiniShelfAppId(WindowIdForWMClass("name2"), nullptr), - GenerateAppId("app2", "vm", "container")); + CrostiniTestHelper::GenerateAppId("app2", "vm", "container")); } } // namespace crostini
diff --git a/chrome/browser/chromeos/crostini/crostini_test_helper.cc b/chrome/browser/chromeos/crostini/crostini_test_helper.cc new file mode 100644 index 0000000..982a298 --- /dev/null +++ b/chrome/browser/chromeos/crostini/crostini_test_helper.cc
@@ -0,0 +1,99 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/crostini/crostini_test_helper.h" + +#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" +#include "chrome/browser/chromeos/crostini/crostini_registry_service.h" +#include "chrome/browser/chromeos/crostini/crostini_registry_service_factory.h" +#include "chrome/browser/profiles/profile.h" +#include "components/crx_file/id_util.h" +#include "components/prefs/pref_service.h" + +using vm_tools::apps::App; +using vm_tools::apps::ApplicationList; + +namespace crostini { + +CrostiniTestHelper::CrostiniTestHelper(Profile* profile) + : registry_service_( + crostini::CrostiniRegistryServiceFactory::GetForProfile(profile)) { + EnableCrostini(profile); +} + +void CrostiniTestHelper::SetupDummyApps() { + current_apps_ = BasicAppList("dummy1", kCrostiniDefaultVmName, + kCrostiniDefaultContainerName); + // This updates the registry for us. + AddApp(BasicApp("dummy2")); +} + +App CrostiniTestHelper::GetApp(int i) { + return current_apps_.apps(i); +} + +void CrostiniTestHelper::AddApp(const vm_tools::apps::App& app) { + for (int i = 0; i < current_apps_.apps_size(); ++i) { + if (current_apps_.apps(i).desktop_file_id() == app.desktop_file_id()) { + *current_apps_.mutable_apps(i) = app; + UpdateRegistry(); + return; + } + } + *current_apps_.add_apps() = app; + UpdateRegistry(); +} + +void CrostiniTestHelper::RemoveApp(int i) { + auto* apps = current_apps_.mutable_apps(); + apps->erase(apps->begin() + i); + UpdateRegistry(); +} + +// static +void CrostiniTestHelper::EnableCrostini(Profile* profile) { + profile->GetPrefs()->SetBoolean(crostini::prefs::kCrostiniEnabled, true); +} +// static +void CrostiniTestHelper::DisableCrostini(Profile* profile) { + profile->GetPrefs()->SetBoolean(crostini::prefs::kCrostiniEnabled, false); +} + +// static +std::string CrostiniTestHelper::GenerateAppId( + const std::string& desktop_file_id, + const std::string& vm_name, + const std::string& container_name) { + return crx_file::id_util::GenerateId("crostini:" + vm_name + "/" + + container_name + "/" + desktop_file_id); +} + +// static +App CrostiniTestHelper::BasicApp(const std::string& desktop_file_id, + const std::string& name) { + App app; + app.set_desktop_file_id(desktop_file_id); + App::LocaleString::Entry* entry = app.mutable_name()->add_values(); + entry->set_locale(std::string()); + entry->set_value(name.empty() ? desktop_file_id : name); + return app; +} + +// static +ApplicationList CrostiniTestHelper::BasicAppList( + const std::string& desktop_file_id, + const std::string& vm_name, + const std::string& container_name) { + ApplicationList app_list; + app_list.set_vm_name(vm_name); + app_list.set_container_name(container_name); + *app_list.add_apps() = BasicApp(desktop_file_id); + return app_list; +} + +void CrostiniTestHelper::UpdateRegistry() { + registry_service_->UpdateApplicationList(current_apps_); +} + +} // namespace crostini
diff --git a/chrome/browser/chromeos/crostini/crostini_test_helper.h b/chrome/browser/chromeos/crostini/crostini_test_helper.h new file mode 100644 index 0000000..16629e8 --- /dev/null +++ b/chrome/browser/chromeos/crostini/crostini_test_helper.h
@@ -0,0 +1,65 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_TEST_HELPER_H_ +#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_TEST_HELPER_H_ + +#include <string> + +#include "chrome/browser/chromeos/crostini/crostini_util.h" +#include "chromeos/dbus/vm_applications/apps.pb.h" + +class Profile; + +namespace crostini { + +class CrostiniRegistryService; + +// This class is used to help test Crostini app integration by providing a +// simple interface to add, update, and remove apps from the registry. +class CrostiniTestHelper { + public: + // For convenience, instantiating this enables Crostini. + explicit CrostiniTestHelper(Profile*); + + // Creates the apps named "dummy1" and "dummy2" in the default container. + void SetupDummyApps(); + // Returns the |i|th app from the current list of apps. + vm_tools::apps::App GetApp(int i); + // Adds an app in the default container. Replaces an existing app with the + // same desktop file id if one exists. + void AddApp(const vm_tools::apps::App& app); + // Removes the |i|th app from the current list of apps. + void RemoveApp(int i); + + // Set/unset the the CrostiniEnabled pref + static void EnableCrostini(Profile* profile); + static void DisableCrostini(Profile* profile); + + // Returns the app id that the registry would use for the given desktop file. + static std::string GenerateAppId( + const std::string& desktop_file_id, + const std::string& vm_name = kCrostiniDefaultVmName, + const std::string& container_name = kCrostiniDefaultContainerName); + + // Returns an App with the desktop file id and default name as provided. + static vm_tools::apps::App BasicApp(const std::string& desktop_file_id, + const std::string& name = ""); + + // Returns an ApplicationList with a single desktop file. + static vm_tools::apps::ApplicationList BasicAppList( + const std::string& desktop_file_id, + const std::string& vm_name, + const std::string& container_name); + + private: + void UpdateRegistry(); + + vm_tools::apps::ApplicationList current_apps_; + CrostiniRegistryService* registry_service_; +}; + +} // namespace crostini + +#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_TEST_HELPER_H_
diff --git a/chrome/browser/chromeos/file_manager/volume_manager.cc b/chrome/browser/chromeos/file_manager/volume_manager.cc index ddb8af7..fdd3e262 100644 --- a/chrome/browser/chromeos/file_manager/volume_manager.cc +++ b/chrome/browser/chromeos/file_manager/volume_manager.cc
@@ -22,6 +22,8 @@ #include "chrome/browser/chromeos/arc/arc_util.h" #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.h" #include "chrome/browser/chromeos/arc/fileapi/arc_media_view_util.h" +#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/drive/drive_integration_service.h" #include "chrome/browser/chromeos/drive/file_system_util.h" #include "chrome/browser/chromeos/file_manager/path_util.h" @@ -546,6 +548,19 @@ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DoMountEvent(chromeos::MOUNT_ERROR_NONE, Volume::CreateForSshfsCrostini(sshfs_mount_path)); + + // Listen for crostini container shutdown and remove volume. + crostini::CrostiniManager::GetInstance()->AddShutdownContainerCallback( + profile_, kCrostiniDefaultVmName, kCrostiniDefaultContainerName, + base::BindOnce(&VolumeManager::RemoveSshfsCrostiniVolume, + weak_ptr_factory_.GetWeakPtr(), sshfs_mount_path)); +} + +void VolumeManager::RemoveSshfsCrostiniVolume( + const base::FilePath& sshfs_mount_path) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + DoUnmountEvent(chromeos::MOUNT_ERROR_NONE, + *Volume::CreateForSshfsCrostini(sshfs_mount_path)); } bool VolumeManager::RegisterDownloadsDirectoryForTesting(
diff --git a/chrome/browser/chromeos/file_manager/volume_manager.h b/chrome/browser/chromeos/file_manager/volume_manager.h index 96d8c7b..739d67f 100644 --- a/chrome/browser/chromeos/file_manager/volume_manager.h +++ b/chrome/browser/chromeos/file_manager/volume_manager.h
@@ -361,6 +361,7 @@ void DoUnmountEvent(chromeos::MountError error_code, const Volume& volume); void OnExternalStorageDisabledChangedUnmountCallback( chromeos::MountError error_code); + void RemoveSshfsCrostiniVolume(const base::FilePath& sshfs_mount_path); // Returns the path of the mount point for drive. base::FilePath GetDriveMountPointPath() const;
diff --git a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_service_signin_chromeos.cc b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_service_signin_chromeos.cc index 142930b..f626474 100644 --- a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_service_signin_chromeos.cc +++ b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_service_signin_chromeos.cc
@@ -171,7 +171,8 @@ : EasyUnlockService(profile), account_id_(EmptyAccountId()), user_pod_last_focused_timestamp_(base::TimeTicks::Now()), - remote_device_cache_(std::make_unique<cryptauth::RemoteDeviceCache>()), + remote_device_cache_( + cryptauth::RemoteDeviceCache::Factory::Get()->BuildInstance()), weak_ptr_factory_(this) {} EasyUnlockServiceSignin::~EasyUnlockServiceSignin() {}
diff --git a/chrome/browser/chromeos/login/webview_login_browsertest.cc b/chrome/browser/chromeos/login/webview_login_browsertest.cc index b7101ca..3b7638c 100644 --- a/chrome/browser/chromeos/login/webview_login_browsertest.cc +++ b/chrome/browser/chromeos/login/webview_login_browsertest.cc
@@ -999,7 +999,14 @@ DISALLOW_COPY_AND_ASSIGN(WebviewProxyAuthLoginTest); }; -IN_PROC_BROWSER_TEST_F(WebviewProxyAuthLoginTest, ProxyAuthTransfer) { +// Disabled fails on msan: https://crbug.com/849128. +#if defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER) || \ + defined(MEMORY_SANITIZER) +#define MAYBE_ProxyAuthTransfer DISABLED_ProxyAuthTransfer +#else +#define MAYBE_ProxyAuthTransfer ProxyAuthTransfer +#endif +IN_PROC_BROWSER_TEST_F(WebviewProxyAuthLoginTest, MAYBE_ProxyAuthTransfer) { WaitForSigninScreen(); LoginHandler* login_handler = WaitForAuthRequested();
diff --git a/chrome/browser/chromeos/policy/remote_commands/device_commands_factory_chromeos.cc b/chrome/browser/chromeos/policy/remote_commands/device_commands_factory_chromeos.cc index 93931a0c..f2bdce6 100644 --- a/chrome/browser/chromeos/policy/remote_commands/device_commands_factory_chromeos.cc +++ b/chrome/browser/chromeos/policy/remote_commands/device_commands_factory_chromeos.cc
@@ -4,11 +4,7 @@ #include "chrome/browser/chromeos/policy/remote_commands/device_commands_factory_chromeos.h" -#include <memory> - #include "base/logging.h" -#include "base/memory/ptr_util.h" -#include "base/task_scheduler/post_task.h" #include "chrome/browser/chromeos/policy/remote_commands/device_command_fetch_status_job.h" #include "chrome/browser/chromeos/policy/remote_commands/device_command_reboot_job.h" #include "chrome/browser/chromeos/policy/remote_commands/device_command_screenshot_job.h" @@ -22,27 +18,23 @@ namespace policy { -DeviceCommandsFactoryChromeOS::DeviceCommandsFactoryChromeOS() { -} +DeviceCommandsFactoryChromeOS::DeviceCommandsFactoryChromeOS() = default; -DeviceCommandsFactoryChromeOS::~DeviceCommandsFactoryChromeOS() { -} +DeviceCommandsFactoryChromeOS::~DeviceCommandsFactoryChromeOS() = default; std::unique_ptr<RemoteCommandJob> DeviceCommandsFactoryChromeOS::BuildJobForType(em::RemoteCommand_Type type) { switch (type) { case em::RemoteCommand_Type_DEVICE_REBOOT: - return base::WrapUnique<RemoteCommandJob>(new DeviceCommandRebootJob( - chromeos::DBusThreadManager::Get()->GetPowerManagerClient())); + return std::make_unique<DeviceCommandRebootJob>( + chromeos::DBusThreadManager::Get()->GetPowerManagerClient()); case em::RemoteCommand_Type_DEVICE_SCREENSHOT: - return base::WrapUnique<RemoteCommandJob>(new DeviceCommandScreenshotJob( - std::make_unique<ScreenshotDelegate>())); + return std::make_unique<DeviceCommandScreenshotJob>( + std::make_unique<ScreenshotDelegate>()); case em::RemoteCommand_Type_DEVICE_SET_VOLUME: - return base::WrapUnique<RemoteCommandJob>( - new DeviceCommandSetVolumeJob()); + return std::make_unique<DeviceCommandSetVolumeJob>(); case em::RemoteCommand_Type_DEVICE_FETCH_STATUS: - return base::WrapUnique<RemoteCommandJob>( - new DeviceCommandFetchStatusJob()); + return std::make_unique<DeviceCommandFetchStatusJob>(); default: // Other types of commands should be sent to UserCommandsFactoryChromeOS // instead of here.
diff --git a/chrome/browser/data_use_measurement/page_load_capping/page_load_capping_browsertest.cc b/chrome/browser/data_use_measurement/page_load_capping/page_load_capping_browsertest.cc index 09f439d..706ae2f9 100644 --- a/chrome/browser/data_use_measurement/page_load_capping/page_load_capping_browsertest.cc +++ b/chrome/browser/data_use_measurement/page_load_capping/page_load_capping_browsertest.cc
@@ -34,7 +34,10 @@ base::test::ScopedFeatureList scoped_feature_list_; }; -IN_PROC_BROWSER_TEST_F(PageLoadCappingBrowserTest, PageLoadCappingBlocksLoads) { +// TODO(crbug.com/848675) Disabled to due flaky timeouts on pretty much all +// platforms. +IN_PROC_BROWSER_TEST_F(PageLoadCappingBrowserTest, + DISABLED_PageLoadCappingBlocksLoads) { net::EmbeddedTestServer https_test_server( net::EmbeddedTestServer::TYPE_HTTPS); // The main resource and the favicon should be fetched. Additionally, images
diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc index 4d76ded..84310250 100644 --- a/chrome/browser/devtools/devtools_sanity_browsertest.cc +++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc
@@ -1656,8 +1656,16 @@ base::test::ScopedFeatureList scoped_feature_list_; }; +// Disabled. Failing on MacOS MSAN. See https://crbug.com/849129. +#if defined(OS_MACOSX) +#define MAYBE_TestDispatchKeyEventShowsAutoFill \ + DISABLED_TestDispatchKeyEventShowsAutoFill +#else +#define MAYBE_TestDispatchKeyEventShowsAutoFill \ + TestDispatchKeyEventShowsAutoFill +#endif IN_PROC_BROWSER_TEST_P(AutofillDevToolsSanityTest, - TestDispatchKeyEventShowsAutoFill) { + MAYBE_TestDispatchKeyEventShowsAutoFill) { OpenDevToolsWindow(kDispatchKeyEventShowsAutoFill, false); autofill::ContentAutofillDriver* autofill_driver =
diff --git a/chrome/browser/extensions/bookmark_app_navigation_throttle_browsertest.cc b/chrome/browser/extensions/bookmark_app_navigation_throttle_browsertest.cc index 66fc560..a8d34c9 100644 --- a/chrome/browser/extensions/bookmark_app_navigation_throttle_browsertest.cc +++ b/chrome/browser/extensions/bookmark_app_navigation_throttle_browsertest.cc
@@ -1093,9 +1093,14 @@ // Tests that same-origin or cross-origin apps created with window.open() from // another app window have an opener. +#if defined(OS_MACOSX) +#define MAYBE_WindowOpenInApp DISABLED_WindowOpenInApp +#else +#define MAYBE_WindowOpenInApp WindowOpenInApp +#endif IN_PROC_BROWSER_TEST_P( BookmarkAppNavigationThrottleExperimentalWindowOpenBrowserTest, - WindowOpenInApp) { + MAYBE_WindowOpenInApp) { InstallTestBookmarkApp(); InstallOtherTestBookmarkApp();
diff --git a/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc b/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc index 46fd696..91eb6b43 100644 --- a/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc +++ b/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc
@@ -134,10 +134,9 @@ MediaFileSystemBackend::MediaFileSystemBackend( const base::FilePath& profile_path) : profile_path_(profile_path), - media_copy_or_move_file_validator_factory_( - std::make_unique<MediaFileValidatorFactory>()), - native_media_file_util_( - std::make_unique<NativeMediaFileUtil>(g_media_task_runner.Get())) + media_path_filter_(new MediaPathFilter), + media_copy_or_move_file_validator_factory_(new MediaFileValidatorFactory), + native_media_file_util_(new NativeMediaFileUtil(media_path_filter_.get())) #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) , device_media_async_file_util_(
diff --git a/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc b/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc index 68853c4f..d750102 100644 --- a/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc +++ b/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc
@@ -106,14 +106,6 @@ } private: - // BrowserTestBase interface. - void PostRunTestOnMainThread() override { - // Trigger release of the FileSystemContext before the IO thread is gone, - // so it can teardown there correctly. - file_system_context_ = nullptr; - InProcessBrowserTest::PostRunTestOnMainThread(); - } - // Create the test files, filesystem objects, etc. void SetupBlocking(const std::string& filename, const std::string& content,
diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc index 4727633..b8d5ffa0 100644 --- a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc +++ b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc
@@ -65,116 +65,12 @@ } // namespace -// |NativeMediaFileUtil::Core| is used and torn-down on the media TaskRunner by -// the owning NativeMediaFileUtil. -class NativeMediaFileUtil::Core { - public: - explicit Core(scoped_refptr<base::SequencedTaskRunner> media_task_runner) - : media_task_runner_(std::move(media_task_runner)) {} - ~Core() = default; - - // The following calls are made on the media TaskRunner, using - // PostTaskAndReplyWithResult() to return the result to the IO thread. - - // Necessary for copy/move to succeed. - base::File::Error CreateDirectory( - std::unique_ptr<storage::FileSystemOperationContext> context, - const storage::FileSystemURL& url, - bool exclusive, - bool recursive); - - base::File::Error CopyOrMoveFileLocal( - std::unique_ptr<storage::FileSystemOperationContext> context, - const storage::FileSystemURL& src_url, - const storage::FileSystemURL& dest_url, - CopyOrMoveOption option, - bool copy); - base::File::Error CopyInForeignFile( - std::unique_ptr<storage::FileSystemOperationContext> context, - const base::FilePath& src_file_path, - const storage::FileSystemURL& dest_url); - base::File::Error DeleteFile( - std::unique_ptr<storage::FileSystemOperationContext> context, - const storage::FileSystemURL& url); - - // Necessary for move to succeed. - base::File::Error DeleteDirectory( - std::unique_ptr<storage::FileSystemOperationContext> context, - const storage::FileSystemURL& url); - - // The following calls are posted to the media TaskRunner, where they perform - // the specified operation, before posting |callback| back to the IO thread - // with the result. - void GetFileInfoOnTaskRunnerThread( - std::unique_ptr<storage::FileSystemOperationContext> context, - const storage::FileSystemURL& url, - GetFileInfoCallback callback); - void ReadDirectoryOnTaskRunnerThread( - std::unique_ptr<storage::FileSystemOperationContext> context, - const storage::FileSystemURL& url, - ReadDirectoryCallback callback); - void CreateSnapshotFileOnTaskRunnerThread( - std::unique_ptr<storage::FileSystemOperationContext> context, - const storage::FileSystemURL& url, - CreateSnapshotFileCallback callback); - - private: - base::File::Error GetFileInfoSync( - storage::FileSystemOperationContext* context, - const storage::FileSystemURL& url, - base::File::Info* file_info, - base::FilePath* platform_path); - base::File::Error ReadDirectorySync( - storage::FileSystemOperationContext* context, - const storage::FileSystemURL& url, - EntryList* file_list); - base::File::Error CreateSnapshotFileSync( - storage::FileSystemOperationContext* context, - const storage::FileSystemURL& url, - base::File::Info* file_info, - base::FilePath* platform_path, - scoped_refptr<storage::ShareableFileReference>* file_ref); - - // Translates the specified URL to a |local_file_path|, with no filtering. - base::File::Error GetLocalFilePath( - storage::FileSystemOperationContext* context, - const storage::FileSystemURL& file_system_url, - base::FilePath* local_file_path); - - // Like GetLocalFilePath(), but always take media_path_filter() into - // consideration. If the media_path_filter() check fails, return - // Fila::FILE_ERROR_SECURITY. |local_file_path| does not have to exist. - base::File::Error GetFilteredLocalFilePath( - storage::FileSystemOperationContext* context, - const storage::FileSystemURL& file_system_url, - base::FilePath* local_file_path); - - // Like GetLocalFilePath(), but if the file does not exist, then return - // |failure_error|. - // If |local_file_path| is a file, then take media_path_filter() into - // consideration. - // If the media_path_filter() check fails, return |failure_error|. - // If |local_file_path| is a directory, return File::FILE_OK. - base::File::Error GetFilteredLocalFilePathForExistingFileOrDirectory( - storage::FileSystemOperationContext* context, - const storage::FileSystemURL& file_system_url, - base::File::Error failure_error, - base::FilePath* local_file_path); - - MediaPathFilter media_path_filter_; - scoped_refptr<base::SequencedTaskRunner> media_task_runner_; - - DISALLOW_COPY_AND_ASSIGN(Core); -}; - -NativeMediaFileUtil::NativeMediaFileUtil( - scoped_refptr<base::SequencedTaskRunner> media_task_runner) - : media_task_runner_(std::move(media_task_runner)), - core_(std::make_unique<Core>(media_task_runner_)) {} +NativeMediaFileUtil::NativeMediaFileUtil(MediaPathFilter* media_path_filter) + : media_path_filter_(media_path_filter), + weak_factory_(this) { +} NativeMediaFileUtil::~NativeMediaFileUtil() { - DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - media_task_runner_->DeleteSoon(FROM_HERE, std::move(core_)); } // static @@ -260,12 +156,11 @@ StatusCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); storage::FileSystemOperationContext* context_ptr = context.get(); - const bool success = base::PostTaskAndReplyWithResult( - context_ptr->task_runner(), FROM_HERE, - base::BindOnce(&NativeMediaFileUtil::Core::CreateDirectory, - base::Unretained(core_.get()), std::move(context), url, - exclusive, recursive), - std::move(callback)); + const bool success = context_ptr->task_runner()->PostTask( + FROM_HERE, + base::BindOnce(&NativeMediaFileUtil::CreateDirectoryOnTaskRunnerThread, + weak_factory_.GetWeakPtr(), std::move(context), url, + exclusive, recursive, std::move(callback))); DCHECK(success); } @@ -278,8 +173,8 @@ storage::FileSystemOperationContext* context_ptr = context.get(); const bool success = context_ptr->task_runner()->PostTask( FROM_HERE, - base::BindOnce(&NativeMediaFileUtil::Core::GetFileInfoOnTaskRunnerThread, - base::Unretained(core_.get()), std::move(context), url, + base::BindOnce(&NativeMediaFileUtil::GetFileInfoOnTaskRunnerThread, + weak_factory_.GetWeakPtr(), std::move(context), url, std::move(callback))); DCHECK(success); } @@ -292,10 +187,9 @@ storage::FileSystemOperationContext* context_ptr = context.get(); const bool success = context_ptr->task_runner()->PostTask( FROM_HERE, - base::BindOnce( - &NativeMediaFileUtil::Core::ReadDirectoryOnTaskRunnerThread, - base::Unretained(core_.get()), std::move(context), url, - std::move(callback))); + base::BindOnce(&NativeMediaFileUtil::ReadDirectoryOnTaskRunnerThread, + weak_factory_.GetWeakPtr(), std::move(context), url, + std::move(callback))); DCHECK(success); } @@ -327,12 +221,12 @@ StatusCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); storage::FileSystemOperationContext* context_ptr = context.get(); - const bool success = base::PostTaskAndReplyWithResult( - context_ptr->task_runner(), FROM_HERE, - base::BindOnce(&NativeMediaFileUtil::Core::CopyOrMoveFileLocal, - base::Unretained(core_.get()), std::move(context), src_url, - dest_url, option, true /* copy */), - std::move(callback)); + const bool success = context_ptr->task_runner()->PostTask( + FROM_HERE, + base::BindOnce( + &NativeMediaFileUtil::CopyOrMoveFileLocalOnTaskRunnerThread, + weak_factory_.GetWeakPtr(), std::move(context), src_url, dest_url, + option, true /* copy */, std::move(callback))); DCHECK(success); } @@ -344,12 +238,12 @@ StatusCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); storage::FileSystemOperationContext* context_ptr = context.get(); - const bool success = base::PostTaskAndReplyWithResult( - context_ptr->task_runner(), FROM_HERE, - base::BindOnce(&NativeMediaFileUtil::Core::CopyOrMoveFileLocal, - base::Unretained(core_.get()), std::move(context), src_url, - dest_url, option, false /* copy */), - std::move(callback)); + const bool success = context_ptr->task_runner()->PostTask( + FROM_HERE, + base::BindOnce( + &NativeMediaFileUtil::CopyOrMoveFileLocalOnTaskRunnerThread, + weak_factory_.GetWeakPtr(), std::move(context), src_url, dest_url, + option, false /* copy */, std::move(callback))); DCHECK(success); } @@ -360,12 +254,11 @@ StatusCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); storage::FileSystemOperationContext* context_ptr = context.get(); - const bool success = base::PostTaskAndReplyWithResult( - context_ptr->task_runner(), FROM_HERE, - base::BindOnce(&NativeMediaFileUtil::Core::CopyInForeignFile, - base::Unretained(core_.get()), std::move(context), - src_file_path, dest_url), - std::move(callback)); + const bool success = context_ptr->task_runner()->PostTask( + FROM_HERE, + base::BindOnce(&NativeMediaFileUtil::CopyInForeignFileOnTaskRunnerThread, + weak_factory_.GetWeakPtr(), std::move(context), + src_file_path, dest_url, std::move(callback))); DCHECK(success); } @@ -375,11 +268,11 @@ StatusCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); storage::FileSystemOperationContext* context_ptr = context.get(); - const bool success = base::PostTaskAndReplyWithResult( - context_ptr->task_runner(), FROM_HERE, - base::BindOnce(&NativeMediaFileUtil::Core::DeleteFile, - base::Unretained(core_.get()), std::move(context), url), - std::move(callback)); + const bool success = context_ptr->task_runner()->PostTask( + FROM_HERE, + base::BindOnce(&NativeMediaFileUtil::DeleteFileOnTaskRunnerThread, + weak_factory_.GetWeakPtr(), std::move(context), url, + std::move(callback))); DCHECK(success); } @@ -390,11 +283,11 @@ StatusCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); storage::FileSystemOperationContext* context_ptr = context.get(); - const bool success = base::PostTaskAndReplyWithResult( - context_ptr->task_runner(), FROM_HERE, - base::BindOnce(&NativeMediaFileUtil::Core::DeleteDirectory, - base::Unretained(core_.get()), std::move(context), url), - std::move(callback)); + const bool success = context_ptr->task_runner()->PostTask( + FROM_HERE, + base::BindOnce(&NativeMediaFileUtil::DeleteDirectoryOnTaskRunnerThread, + weak_factory_.GetWeakPtr(), std::move(context), url, + std::move(callback))); DCHECK(success); } @@ -414,121 +307,29 @@ storage::FileSystemOperationContext* context_ptr = context.get(); const bool success = context_ptr->task_runner()->PostTask( FROM_HERE, - base::BindOnce( - &NativeMediaFileUtil::Core::CreateSnapshotFileOnTaskRunnerThread, - base::Unretained(core_.get()), std::move(context), url, - std::move(callback))); + base::BindOnce(&NativeMediaFileUtil::CreateSnapshotFileOnTaskRunnerThread, + weak_factory_.GetWeakPtr(), std::move(context), url, + std::move(callback))); DCHECK(success); } -base::File::Error NativeMediaFileUtil::Core::CreateDirectory( +void NativeMediaFileUtil::CreateDirectoryOnTaskRunnerThread( std::unique_ptr<storage::FileSystemOperationContext> context, const storage::FileSystemURL& url, bool exclusive, - bool recursive) { - DCHECK(media_task_runner_->RunsTasksInCurrentSequence()); + bool recursive, + StatusCallback callback) { DCHECK(IsOnTaskRunnerThread(context.get())); - base::FilePath file_path; - base::File::Error error = GetLocalFilePath(context.get(), url, &file_path); - if (error != base::File::FILE_OK) - return error; - return storage::NativeFileUtil::CreateDirectory( - file_path, exclusive, recursive); -} - -base::File::Error NativeMediaFileUtil::Core::CopyOrMoveFileLocal( - std::unique_ptr<storage::FileSystemOperationContext> context, - const storage::FileSystemURL& src_url, - const storage::FileSystemURL& dest_url, - CopyOrMoveOption option, - bool copy) { - DCHECK(media_task_runner_->RunsTasksInCurrentSequence()); - DCHECK(IsOnTaskRunnerThread(context.get())); - base::FilePath src_file_path; - base::File::Error error = GetFilteredLocalFilePathForExistingFileOrDirectory( - context.get(), src_url, base::File::FILE_ERROR_NOT_FOUND, &src_file_path); - if (error != base::File::FILE_OK) - return error; - if (storage::NativeFileUtil::DirectoryExists(src_file_path)) - return base::File::FILE_ERROR_NOT_A_FILE; - - base::FilePath dest_file_path; - error = GetLocalFilePath(context.get(), dest_url, &dest_file_path); - if (error != base::File::FILE_OK) - return error; - base::File::Info file_info; - error = storage::NativeFileUtil::GetFileInfo(dest_file_path, &file_info); - if (error != base::File::FILE_OK && - error != base::File::FILE_ERROR_NOT_FOUND) { - return error; - } - if (error == base::File::FILE_OK && file_info.is_directory) - return base::File::FILE_ERROR_INVALID_OPERATION; - if (!media_path_filter_.Match(dest_file_path)) - return base::File::FILE_ERROR_SECURITY; - - return storage::NativeFileUtil::CopyOrMoveFile( - src_file_path, - dest_file_path, - option, - storage::NativeFileUtil::CopyOrMoveModeForDestination(dest_url, copy)); -} - -base::File::Error NativeMediaFileUtil::Core::CopyInForeignFile( - std::unique_ptr<storage::FileSystemOperationContext> context, - const base::FilePath& src_file_path, - const storage::FileSystemURL& dest_url) { - DCHECK(media_task_runner_->RunsTasksInCurrentSequence()); - DCHECK(IsOnTaskRunnerThread(context.get())); - if (src_file_path.empty()) - return base::File::FILE_ERROR_INVALID_OPERATION; - - base::FilePath dest_file_path; base::File::Error error = - GetFilteredLocalFilePath(context.get(), dest_url, &dest_file_path); - if (error != base::File::FILE_OK) - return error; - return storage::NativeFileUtil::CopyOrMoveFile( - src_file_path, - dest_file_path, - storage::FileSystemOperation::OPTION_NONE, - storage::NativeFileUtil::CopyOrMoveModeForDestination(dest_url, - true /* copy */)); + CreateDirectorySync(context.get(), url, exclusive, recursive); + content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, + base::BindOnce(std::move(callback), error)); } -base::File::Error NativeMediaFileUtil::Core::DeleteFile( - std::unique_ptr<storage::FileSystemOperationContext> context, - const storage::FileSystemURL& url) { - DCHECK(media_task_runner_->RunsTasksInCurrentSequence()); - DCHECK(IsOnTaskRunnerThread(context.get())); - base::File::Info file_info; - base::FilePath file_path; - base::File::Error error = - GetFileInfoSync(context.get(), url, &file_info, &file_path); - if (error != base::File::FILE_OK) - return error; - if (file_info.is_directory) - return base::File::FILE_ERROR_NOT_A_FILE; - return storage::NativeFileUtil::DeleteFile(file_path); -} - -base::File::Error NativeMediaFileUtil::Core::DeleteDirectory( - std::unique_ptr<storage::FileSystemOperationContext> context, - const storage::FileSystemURL& url) { - DCHECK(media_task_runner_->RunsTasksInCurrentSequence()); - DCHECK(IsOnTaskRunnerThread(context.get())); - base::FilePath file_path; - base::File::Error error = GetLocalFilePath(context.get(), url, &file_path); - if (error != base::File::FILE_OK) - return error; - return storage::NativeFileUtil::DeleteDirectory(file_path); -} - -void NativeMediaFileUtil::Core::GetFileInfoOnTaskRunnerThread( +void NativeMediaFileUtil::GetFileInfoOnTaskRunnerThread( std::unique_ptr<storage::FileSystemOperationContext> context, const storage::FileSystemURL& url, GetFileInfoCallback callback) { - DCHECK(media_task_runner_->RunsTasksInCurrentSequence()); DCHECK(IsOnTaskRunnerThread(context.get())); base::File::Info file_info; base::File::Error error = @@ -538,25 +339,70 @@ base::BindOnce(std::move(callback), error, file_info)); } -void NativeMediaFileUtil::Core::ReadDirectoryOnTaskRunnerThread( +void NativeMediaFileUtil::ReadDirectoryOnTaskRunnerThread( std::unique_ptr<storage::FileSystemOperationContext> context, const storage::FileSystemURL& url, ReadDirectoryCallback callback) { - DCHECK(media_task_runner_->RunsTasksInCurrentSequence()); DCHECK(IsOnTaskRunnerThread(context.get())); EntryList entry_list; - base::File::Error error = ReadDirectorySync(context.get(), url, &entry_list); + base::File::Error error = + ReadDirectorySync(context.get(), url, &entry_list); content::BrowserThread::PostTask( content::BrowserThread::IO, FROM_HERE, base::BindOnce(std::move(callback), error, entry_list, false /* has_more */)); } -void NativeMediaFileUtil::Core::CreateSnapshotFileOnTaskRunnerThread( +void NativeMediaFileUtil::CopyOrMoveFileLocalOnTaskRunnerThread( + std::unique_ptr<storage::FileSystemOperationContext> context, + const storage::FileSystemURL& src_url, + const storage::FileSystemURL& dest_url, + CopyOrMoveOption option, + bool copy, + StatusCallback callback) { + DCHECK(IsOnTaskRunnerThread(context.get())); + base::File::Error error = + CopyOrMoveFileSync(context.get(), src_url, dest_url, option, copy); + content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, + base::BindOnce(std::move(callback), error)); +} + +void NativeMediaFileUtil::CopyInForeignFileOnTaskRunnerThread( + std::unique_ptr<storage::FileSystemOperationContext> context, + const base::FilePath& src_file_path, + const storage::FileSystemURL& dest_url, + StatusCallback callback) { + DCHECK(IsOnTaskRunnerThread(context.get())); + base::File::Error error = + CopyInForeignFileSync(context.get(), src_file_path, dest_url); + content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, + base::BindOnce(std::move(callback), error)); +} + +void NativeMediaFileUtil::DeleteFileOnTaskRunnerThread( + std::unique_ptr<storage::FileSystemOperationContext> context, + const storage::FileSystemURL& url, + StatusCallback callback) { + DCHECK(IsOnTaskRunnerThread(context.get())); + base::File::Error error = DeleteFileSync(context.get(), url); + content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, + base::BindOnce(std::move(callback), error)); +} + +void NativeMediaFileUtil::DeleteDirectoryOnTaskRunnerThread( + std::unique_ptr<storage::FileSystemOperationContext> context, + const storage::FileSystemURL& url, + StatusCallback callback) { + DCHECK(IsOnTaskRunnerThread(context.get())); + base::File::Error error = DeleteDirectorySync(context.get(), url); + content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, + base::BindOnce(std::move(callback), error)); +} + +void NativeMediaFileUtil::CreateSnapshotFileOnTaskRunnerThread( std::unique_ptr<storage::FileSystemOperationContext> context, const storage::FileSystemURL& url, CreateSnapshotFileCallback callback) { - DCHECK(media_task_runner_->RunsTasksInCurrentSequence()); DCHECK(IsOnTaskRunnerThread(context.get())); base::File::Info file_info; base::FilePath platform_path; @@ -569,11 +415,89 @@ file_ref)); } -base::File::Error NativeMediaFileUtil::Core::GetFileInfoSync( +base::File::Error NativeMediaFileUtil::CreateDirectorySync( + storage::FileSystemOperationContext* context, + const storage::FileSystemURL& url, + bool exclusive, + bool recursive) { + base::FilePath file_path; + base::File::Error error = GetLocalFilePath(context, url, &file_path); + if (error != base::File::FILE_OK) + return error; + return storage::NativeFileUtil::CreateDirectory( + file_path, exclusive, recursive); +} + +base::File::Error NativeMediaFileUtil::CopyOrMoveFileSync( + storage::FileSystemOperationContext* context, + const storage::FileSystemURL& src_url, + const storage::FileSystemURL& dest_url, + CopyOrMoveOption option, + bool copy) { + DCHECK(IsOnTaskRunnerThread(context)); + base::FilePath src_file_path; + base::File::Error error = + GetFilteredLocalFilePathForExistingFileOrDirectory( + context, src_url, + base::File::FILE_ERROR_NOT_FOUND, + &src_file_path); + if (error != base::File::FILE_OK) + return error; + if (storage::NativeFileUtil::DirectoryExists(src_file_path)) + return base::File::FILE_ERROR_NOT_A_FILE; + + base::FilePath dest_file_path; + error = GetLocalFilePath(context, dest_url, &dest_file_path); + if (error != base::File::FILE_OK) + return error; + base::File::Info file_info; + error = storage::NativeFileUtil::GetFileInfo(dest_file_path, &file_info); + if (error != base::File::FILE_OK && + error != base::File::FILE_ERROR_NOT_FOUND) { + return error; + } + if (error == base::File::FILE_OK && file_info.is_directory) + return base::File::FILE_ERROR_INVALID_OPERATION; + if (!media_path_filter_->Match(dest_file_path)) + return base::File::FILE_ERROR_SECURITY; + + return storage::NativeFileUtil::CopyOrMoveFile( + src_file_path, + dest_file_path, + option, + storage::NativeFileUtil::CopyOrMoveModeForDestination(dest_url, copy)); +} + +base::File::Error NativeMediaFileUtil::CopyInForeignFileSync( + storage::FileSystemOperationContext* context, + const base::FilePath& src_file_path, + const storage::FileSystemURL& dest_url) { + DCHECK(IsOnTaskRunnerThread(context)); + if (src_file_path.empty()) + return base::File::FILE_ERROR_INVALID_OPERATION; + + base::FilePath dest_file_path; + base::File::Error error = + GetFilteredLocalFilePath(context, dest_url, &dest_file_path); + if (error != base::File::FILE_OK) + return error; + return storage::NativeFileUtil::CopyOrMoveFile( + src_file_path, + dest_file_path, + storage::FileSystemOperation::OPTION_NONE, + storage::NativeFileUtil::CopyOrMoveModeForDestination(dest_url, + true /* copy */)); +} + +base::File::Error NativeMediaFileUtil::GetFileInfoSync( storage::FileSystemOperationContext* context, const storage::FileSystemURL& url, base::File::Info* file_info, base::FilePath* platform_path) { + DCHECK(context); + DCHECK(IsOnTaskRunnerThread(context)); + DCHECK(file_info); + base::FilePath file_path; base::File::Error error = GetLocalFilePath(context, url, &file_path); if (error != base::File::FILE_OK) @@ -586,16 +510,34 @@ if (platform_path) *platform_path = file_path; - if (file_info->is_directory || media_path_filter_.Match(file_path)) { + if (file_info->is_directory || + media_path_filter_->Match(file_path)) { return base::File::FILE_OK; } return base::File::FILE_ERROR_NOT_FOUND; } -base::File::Error NativeMediaFileUtil::Core::ReadDirectorySync( +base::File::Error NativeMediaFileUtil::GetLocalFilePath( + storage::FileSystemOperationContext* context, + const storage::FileSystemURL& url, + base::FilePath* local_file_path) { + DCHECK(local_file_path); + DCHECK(url.is_valid()); + if (url.path().empty()) { + // Root direcory case, which should not be accessed. + return base::File::FILE_ERROR_ACCESS_DENIED; + } + *local_file_path = url.path(); + return base::File::FILE_OK; +} + +base::File::Error NativeMediaFileUtil::ReadDirectorySync( storage::FileSystemOperationContext* context, const storage::FileSystemURL& url, EntryList* file_list) { + DCHECK(IsOnTaskRunnerThread(context)); + DCHECK(file_list); + DCHECK(file_list->empty()); base::File::Info file_info; base::FilePath dir_path; base::File::Error error = @@ -623,7 +565,7 @@ // NativeMediaFileUtil skip criteria. if (MediaPathFilter::ShouldSkip(enum_path)) continue; - if (!info.IsDirectory() && !media_path_filter_.Match(enum_path)) + if (!info.IsDirectory() && !media_path_filter_->Match(enum_path)) continue; file_list->emplace_back(enum_path.BaseName(), @@ -635,12 +577,39 @@ return base::File::FILE_OK; } -base::File::Error NativeMediaFileUtil::Core::CreateSnapshotFileSync( +base::File::Error NativeMediaFileUtil::DeleteFileSync( + storage::FileSystemOperationContext* context, + const storage::FileSystemURL& url) { + DCHECK(IsOnTaskRunnerThread(context)); + base::File::Info file_info; + base::FilePath file_path; + base::File::Error error = + GetFileInfoSync(context, url, &file_info, &file_path); + if (error != base::File::FILE_OK) + return error; + if (file_info.is_directory) + return base::File::FILE_ERROR_NOT_A_FILE; + return storage::NativeFileUtil::DeleteFile(file_path); +} + +base::File::Error NativeMediaFileUtil::DeleteDirectorySync( + storage::FileSystemOperationContext* context, + const storage::FileSystemURL& url) { + DCHECK(IsOnTaskRunnerThread(context)); + base::FilePath file_path; + base::File::Error error = GetLocalFilePath(context, url, &file_path); + if (error != base::File::FILE_OK) + return error; + return storage::NativeFileUtil::DeleteDirectory(file_path); +} + +base::File::Error NativeMediaFileUtil::CreateSnapshotFileSync( storage::FileSystemOperationContext* context, const storage::FileSystemURL& url, base::File::Info* file_info, base::FilePath* platform_path, scoped_refptr<storage::ShareableFileReference>* file_ref) { + DCHECK(IsOnTaskRunnerThread(context)); base::File::Error error = GetFileInfoSync(context, url, file_info, platform_path); if (error == base::File::FILE_OK && file_info->is_directory) @@ -654,29 +623,17 @@ return error; } -base::File::Error NativeMediaFileUtil::Core::GetLocalFilePath( - storage::FileSystemOperationContext* context, - const storage::FileSystemURL& url, - base::FilePath* local_file_path) { - DCHECK(url.is_valid()); - if (url.path().empty()) { - // Root direcory case, which should not be accessed. - return base::File::FILE_ERROR_ACCESS_DENIED; - } - *local_file_path = url.path(); - return base::File::FILE_OK; -} - -base::File::Error NativeMediaFileUtil::Core::GetFilteredLocalFilePath( +base::File::Error NativeMediaFileUtil::GetFilteredLocalFilePath( storage::FileSystemOperationContext* context, const storage::FileSystemURL& file_system_url, base::FilePath* local_file_path) { + DCHECK(IsOnTaskRunnerThread(context)); base::FilePath file_path; base::File::Error error = GetLocalFilePath(context, file_system_url, &file_path); if (error != base::File::FILE_OK) return error; - if (!media_path_filter_.Match(file_path)) + if (!media_path_filter_->Match(file_path)) return base::File::FILE_ERROR_SECURITY; *local_file_path = file_path; @@ -684,11 +641,12 @@ } base::File::Error -NativeMediaFileUtil::Core::GetFilteredLocalFilePathForExistingFileOrDirectory( +NativeMediaFileUtil::GetFilteredLocalFilePathForExistingFileOrDirectory( storage::FileSystemOperationContext* context, const storage::FileSystemURL& file_system_url, base::File::Error failure_error, base::FilePath* local_file_path) { + DCHECK(IsOnTaskRunnerThread(context)); base::FilePath file_path; base::File::Error error = GetLocalFilePath(context, file_system_url, &file_path); @@ -701,7 +659,8 @@ if (!base::GetFileInfo(file_path, &file_info)) return base::File::FILE_ERROR_FAILED; - if (!file_info.is_directory && !media_path_filter_.Match(file_path)) { + if (!file_info.is_directory && + !media_path_filter_->Match(file_path)) { return failure_error; }
diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util.h b/chrome/browser/media_galleries/fileapi/native_media_file_util.h index d16b90b..47f1302 100644 --- a/chrome/browser/media_galleries/fileapi/native_media_file_util.h +++ b/chrome/browser/media_galleries/fileapi/native_media_file_util.h
@@ -11,23 +11,21 @@ #include <memory> #include "base/macros.h" -#include "base/sequenced_task_runner.h" +#include "base/memory/weak_ptr.h" #include "storage/browser/fileapi/async_file_util.h" namespace net { class IOBuffer; } -// Implements the AsyncFileUtil interface to perform native file system -// operations, restricted to operating only on media files. -// Instances must be used, and torn-down, only on the browser IO-thread. +class MediaPathFilter; + +// This class handles native file system operations with media type filtering. +// To support virtual file systems it implements the AsyncFileUtil interface +// from scratch and provides synchronous override points. class NativeMediaFileUtil : public storage::AsyncFileUtil { public: - // |media_task_runner| specifies the TaskRunner on which to perform all - // native file system operations, and media file filtering. This must - // be the same TaskRunner passed in each FileSystemOperationContext. - explicit NativeMediaFileUtil( - scoped_refptr<base::SequencedTaskRunner> media_task_runner); + explicit NativeMediaFileUtil(MediaPathFilter* media_path_filter); ~NativeMediaFileUtil() override; // Uses the MIME sniffer code, which actually looks into the file, @@ -115,13 +113,122 @@ const storage::FileSystemURL& url, CreateSnapshotFileCallback callback) override; - private: - // |core_| holds state which must be used and torn-down on the - // |media_task_runner_|, rather than on the IO-thread. - class Core; + protected: + virtual void CreateDirectoryOnTaskRunnerThread( + std::unique_ptr<storage::FileSystemOperationContext> context, + const storage::FileSystemURL& url, + bool exclusive, + bool recursive, + StatusCallback callback); + virtual void GetFileInfoOnTaskRunnerThread( + std::unique_ptr<storage::FileSystemOperationContext> context, + const storage::FileSystemURL& url, + GetFileInfoCallback callback); + virtual void ReadDirectoryOnTaskRunnerThread( + std::unique_ptr<storage::FileSystemOperationContext> context, + const storage::FileSystemURL& url, + ReadDirectoryCallback callback); + virtual void CopyOrMoveFileLocalOnTaskRunnerThread( + std::unique_ptr<storage::FileSystemOperationContext> context, + const storage::FileSystemURL& src_url, + const storage::FileSystemURL& dest_url, + CopyOrMoveOption option, + bool copy, + StatusCallback callback); + virtual void CopyInForeignFileOnTaskRunnerThread( + std::unique_ptr<storage::FileSystemOperationContext> context, + const base::FilePath& src_file_path, + const storage::FileSystemURL& dest_url, + StatusCallback callback); + virtual void DeleteFileOnTaskRunnerThread( + std::unique_ptr<storage::FileSystemOperationContext> context, + const storage::FileSystemURL& url, + StatusCallback callback); + virtual void DeleteDirectoryOnTaskRunnerThread( + std::unique_ptr<storage::FileSystemOperationContext> context, + const storage::FileSystemURL& url, + StatusCallback callback); + virtual void CreateSnapshotFileOnTaskRunnerThread( + std::unique_ptr<storage::FileSystemOperationContext> context, + const storage::FileSystemURL& url, + CreateSnapshotFileCallback callback); - scoped_refptr<base::SequencedTaskRunner> media_task_runner_; - std::unique_ptr<Core> core_; + // The following methods should only be called on the task runner thread. + + // Necessary for copy/move to succeed. + virtual base::File::Error CreateDirectorySync( + storage::FileSystemOperationContext* context, + const storage::FileSystemURL& url, + bool exclusive, + bool recursive); + virtual base::File::Error CopyOrMoveFileSync( + storage::FileSystemOperationContext* context, + const storage::FileSystemURL& src_url, + const storage::FileSystemURL& dest_url, + CopyOrMoveOption option, + bool copy); + virtual base::File::Error CopyInForeignFileSync( + storage::FileSystemOperationContext* context, + const base::FilePath& src_file_path, + const storage::FileSystemURL& dest_url); + virtual base::File::Error GetFileInfoSync( + storage::FileSystemOperationContext* context, + const storage::FileSystemURL& url, + base::File::Info* file_info, + base::FilePath* platform_path); + // Called by GetFileInfoSync. Meant to be overridden by subclasses that + // have special mappings from URLs to platform paths (virtual filesystems). + virtual base::File::Error GetLocalFilePath( + storage::FileSystemOperationContext* context, + const storage::FileSystemURL& file_system_url, + base::FilePath* local_file_path); + virtual base::File::Error ReadDirectorySync( + storage::FileSystemOperationContext* context, + const storage::FileSystemURL& url, + EntryList* file_list); + virtual base::File::Error DeleteFileSync( + storage::FileSystemOperationContext* context, + const storage::FileSystemURL& url); + // Necessary for move to succeed. + virtual base::File::Error DeleteDirectorySync( + storage::FileSystemOperationContext* context, + const storage::FileSystemURL& url); + virtual base::File::Error CreateSnapshotFileSync( + storage::FileSystemOperationContext* context, + const storage::FileSystemURL& url, + base::File::Info* file_info, + base::FilePath* platform_path, + scoped_refptr<storage::ShareableFileReference>* file_ref); + + MediaPathFilter* media_path_filter() { + return media_path_filter_; + } + + private: + // Like GetLocalFilePath(), but always take media_path_filter() into + // consideration. If the media_path_filter() check fails, return + // Fila::FILE_ERROR_SECURITY. |local_file_path| does not have to exist. + base::File::Error GetFilteredLocalFilePath( + storage::FileSystemOperationContext* context, + const storage::FileSystemURL& file_system_url, + base::FilePath* local_file_path); + + // Like GetLocalFilePath(), but if the file does not exist, then return + // |failure_error|. + // If |local_file_path| is a file, then take media_path_filter() into + // consideration. + // If the media_path_filter() check fails, return |failure_error|. + // If |local_file_path| is a directory, return File::FILE_OK. + base::File::Error GetFilteredLocalFilePathForExistingFileOrDirectory( + storage::FileSystemOperationContext* context, + const storage::FileSystemURL& file_system_url, + base::File::Error failure_error, + base::FilePath* local_file_path); + + // Not owned, owned by the backend which owns this. + MediaPathFilter* const media_path_filter_; + + base::WeakPtrFactory<NativeMediaFileUtil> weak_factory_; DISALLOW_COPY_AND_ASSIGN(NativeMediaFileUtil); };
diff --git a/chrome/browser/pdf/pdf_extension_test.cc b/chrome/browser/pdf/pdf_extension_test.cc index 12ed6a1..2e8754d 100644 --- a/chrome/browser/pdf/pdf_extension_test.cc +++ b/chrome/browser/pdf/pdf_extension_test.cc
@@ -990,12 +990,17 @@ WebContents* active_web_contents = GetActiveWebContents(); ASSERT_NE(web_contents, active_web_contents); + content::TestNavigationObserver active_navigation_observer( + active_web_contents); + content::TestNavigationObserver navigation_observer(web_contents); ASSERT_TRUE(content::ExecuteScript( guest_contents, "viewer.navigator_.navigate(" " 'www.example.com', Navigator.WindowOpenDisposition.CURRENT_TAB);")); + navigation_observer.Wait(); - EXPECT_TRUE(web_contents->GetController().GetPendingEntry()); + EXPECT_FALSE(navigation_observer.last_navigation_url().is_empty()); + EXPECT_TRUE(active_navigation_observer.last_navigation_url().is_empty()); EXPECT_FALSE(active_web_contents->GetController().GetPendingEntry()); }
diff --git a/chrome/browser/sync/chrome_sync_client.cc b/chrome/browser/sync/chrome_sync_client.cc index 0ff7ef18..0c6a456f 100644 --- a/chrome/browser/sync/chrome_sync_client.cc +++ b/chrome/browser/sync/chrome_sync_client.cc
@@ -499,6 +499,10 @@ ->change_processor() ->GetControllerDelegateOnUIThread(); } + case syncer::USER_CONSENTS: + // TODO(vitaliii): Return the real delegate once it is wired to the + // consent auditor. + return base::WeakPtr<syncer::ModelTypeControllerDelegate>(); case syncer::USER_EVENTS: return browser_sync::UserEventServiceFactory::GetForProfile(profile_) ->GetSyncBridge()
diff --git a/chrome/browser/sync/profile_sync_service_factory_unittest.cc b/chrome/browser/sync/profile_sync_service_factory_unittest.cc index 633efb1..59eebb91 100644 --- a/chrome/browser/sync/profile_sync_service_factory_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_factory_unittest.cc
@@ -43,7 +43,7 @@ // Returns the collection of default datatypes. std::vector<syncer::ModelType> DefaultDatatypes() { - static_assert(41 == syncer::MODEL_TYPE_COUNT, + static_assert(42 == syncer::MODEL_TYPE_COUNT, "When adding a new type, you probably want to add it here as " "well (assuming it is already enabled)."); @@ -90,6 +90,7 @@ datatypes.push_back(syncer::SUPERVISED_USER_WHITELISTS); datatypes.push_back(syncer::TYPED_URLS); datatypes.push_back(syncer::USER_EVENTS); + // TODO(vitaliii): Add USER_CONSENTS, when the type is enabled by default. return datatypes; }
diff --git a/chrome/browser/ui/app_list/crostini/crostini_app_model_builder.cc b/chrome/browser/ui/app_list/crostini/crostini_app_model_builder.cc index b4ec52f..4fe20dd 100644 --- a/chrome/browser/ui/app_list/crostini/crostini_app_model_builder.cc +++ b/chrome/browser/ui/app_list/crostini/crostini_app_model_builder.cc
@@ -11,7 +11,6 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" #include "chrome/browser/ui/app_list/crostini/crostini_app_item.h" -#include "components/crx_file/id_util.h" #include "components/prefs/pref_change_registrar.h" #include "ui/base/l10n/l10n_util.h"
diff --git a/chrome/browser/ui/app_list/crostini/crostini_app_model_builder_unittest.cc b/chrome/browser/ui/app_list/crostini/crostini_app_model_builder_unittest.cc new file mode 100644 index 0000000..cf1ccb3c7 --- /dev/null +++ b/chrome/browser/ui/app_list/crostini/crostini_app_model_builder_unittest.cc
@@ -0,0 +1,188 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/app_list/crostini/crostini_app_model_builder.h" + +#include "base/test/scoped_feature_list.h" +#include "chrome/browser/chromeos/crostini/crostini_registry_service.h" +#include "chrome/browser/chromeos/crostini/crostini_registry_service_factory.h" +#include "chrome/browser/chromeos/crostini/crostini_test_helper.h" +#include "chrome/browser/chromeos/crostini/crostini_util.h" +#include "chrome/browser/ui/app_list/app_list_test_util.h" +#include "chrome/browser/ui/app_list/chrome_app_list_item.h" +#include "chrome/browser/ui/app_list/test/fake_app_list_model_updater.h" +#include "chrome/browser/ui/app_list/test/test_app_list_controller_delegate.h" +#include "chrome/common/chrome_features.h" +#include "chrome/test/base/testing_profile.h" +#include "testing/gmock/include/gmock/gmock.h" + +using crostini::CrostiniTestHelper; + +namespace { + +std::vector<ChromeAppListItem*> GetAppListItems( + AppListModelUpdater* model_updater) { + std::vector<ChromeAppListItem*> result; + for (size_t i = 0; i < model_updater->ItemCount(); ++i) + result.push_back(model_updater->ItemAtForTest(i)); + return result; +} + +std::vector<std::string> GetAppIds(AppListModelUpdater* model_updater) { + std::vector<std::string> result; + for (ChromeAppListItem* item : GetAppListItems(model_updater)) + result.push_back(item->id()); + return result; +} + +std::vector<std::string> GetAppNames(AppListModelUpdater* model_updater) { + std::vector<std::string> result; + for (ChromeAppListItem* item : GetAppListItems(model_updater)) + result.push_back(item->name()); + return result; +} + +} // namespace + +class CrostiniAppModelBuilderTest : public AppListTestBase { + public: + CrostiniAppModelBuilderTest() {} + ~CrostiniAppModelBuilderTest() override {} + + void SetUp() override { + scoped_feature_list_.InitAndEnableFeature( + features::kExperimentalCrostiniUI); + AppListTestBase::SetUp(); + CreateBuilder(); + } + + void TearDown() override { + ResetBuilder(); + AppListTestBase::TearDown(); + } + + protected: + void CreateBuilder() { + model_updater_ = std::make_unique<FakeAppListModelUpdater>(); + controller_ = std::make_unique<test::TestAppListControllerDelegate>(); + builder_ = std::make_unique<CrostiniAppModelBuilder>(controller_.get()); + builder_->Initialize(nullptr, profile_.get(), model_updater_.get()); + } + + void ResetBuilder() { + builder_.reset(); + controller_.reset(); + model_updater_.reset(); + } + + crostini::CrostiniRegistryService* RegistryService() { + return crostini::CrostiniRegistryServiceFactory::GetForProfile(profile()); + } + + std::unique_ptr<FakeAppListModelUpdater> model_updater_; + std::unique_ptr<test::TestAppListControllerDelegate> controller_; + std::unique_ptr<CrostiniAppModelBuilder> builder_; + + private: + base::test::ScopedFeatureList scoped_feature_list_; + + DISALLOW_COPY_AND_ASSIGN(CrostiniAppModelBuilderTest); +}; + +// Test that the Terminal app is only shown when Crostini is enabled +TEST_F(CrostiniAppModelBuilderTest, EnableCrostini) { + EXPECT_EQ(0u, model_updater_->ItemCount()); + CrostiniTestHelper::EnableCrostini(profile()); + EXPECT_EQ(1u, model_updater_->ItemCount()); + ChromeAppListItem* item = model_updater_->ItemAtForTest(0); + EXPECT_EQ(kCrostiniTerminalId, item->id()); + EXPECT_EQ(kCrostiniTerminalAppName, item->name()); +} + +TEST_F(CrostiniAppModelBuilderTest, AppInstallation) { + CrostiniTestHelper test_helper(profile()); + EXPECT_EQ(1u, model_updater_->ItemCount()); + + test_helper.SetupDummyApps(); + EXPECT_THAT(GetAppIds(model_updater_.get()), + testing::UnorderedElementsAreArray( + RegistryService()->GetRegisteredAppIds())); + EXPECT_THAT(GetAppNames(model_updater_.get()), + testing::UnorderedElementsAre(kCrostiniTerminalAppName, "dummy1", + "dummy2")); + + test_helper.AddApp(CrostiniTestHelper::BasicApp("banana", "banana app name")); + EXPECT_THAT(GetAppIds(model_updater_.get()), + testing::UnorderedElementsAreArray( + RegistryService()->GetRegisteredAppIds())); + EXPECT_THAT(GetAppNames(model_updater_.get()), + testing::UnorderedElementsAre(kCrostiniTerminalAppName, "dummy1", + "dummy2", "banana app name")); +} + +// Test that the app model builder correctly picks up changes to existing apps. +TEST_F(CrostiniAppModelBuilderTest, UpdateApps) { + CrostiniTestHelper test_helper(profile()); + test_helper.SetupDummyApps(); + EXPECT_EQ(3u, model_updater_->ItemCount()); + + // Setting NoDisplay to true should hide an app. + vm_tools::apps::App dummy1 = test_helper.GetApp(0); + dummy1.set_no_display(true); + test_helper.AddApp(dummy1); + EXPECT_EQ(2u, model_updater_->ItemCount()); + EXPECT_THAT( + GetAppIds(model_updater_.get()), + testing::UnorderedElementsAre( + kCrostiniTerminalId, CrostiniTestHelper::GenerateAppId("dummy2"))); + + // Setting NoDisplay to false should unhide an app. + dummy1.set_no_display(false); + test_helper.AddApp(dummy1); + EXPECT_EQ(3u, model_updater_->ItemCount()); + EXPECT_THAT(GetAppIds(model_updater_.get()), + testing::UnorderedElementsAreArray( + RegistryService()->GetRegisteredAppIds())); + + // Changes to app names should be detected. + vm_tools::apps::App dummy2 = + CrostiniTestHelper::BasicApp("dummy2", "new name"); + test_helper.AddApp(dummy2); + EXPECT_EQ(3u, model_updater_->ItemCount()); + EXPECT_THAT(GetAppIds(model_updater_.get()), + testing::UnorderedElementsAreArray( + RegistryService()->GetRegisteredAppIds())); + EXPECT_THAT(GetAppNames(model_updater_.get()), + testing::UnorderedElementsAre(kCrostiniTerminalAppName, "dummy1", + "new name")); +} + +// Test that the app model builder handles removed apps +TEST_F(CrostiniAppModelBuilderTest, RemoveApps) { + CrostiniTestHelper test_helper(profile()); + test_helper.SetupDummyApps(); + EXPECT_EQ(3u, model_updater_->ItemCount()); + + // Remove dummy1 + test_helper.RemoveApp(0); + EXPECT_EQ(2u, model_updater_->ItemCount()); + + // Remove dummy2 + test_helper.RemoveApp(0); + EXPECT_EQ(1u, model_updater_->ItemCount()); +} + +// Test that the Terminal app is removed when Crostini is disabled. +TEST_F(CrostiniAppModelBuilderTest, DisableCrostini) { + CrostiniTestHelper test_helper(profile()); + test_helper.SetupDummyApps(); + EXPECT_EQ(3u, model_updater_->ItemCount()); + + // The uninstall flow removes all apps before setting the CrostiniEnabled pref + // to false, so we need to do that explicitly too. + RegistryService()->ClearApplicationList(kCrostiniDefaultVmName, + kCrostiniDefaultContainerName); + CrostiniTestHelper::DisableCrostini(profile()); + EXPECT_EQ(0u, model_updater_->ItemCount()); +}
diff --git a/chrome/browser/ui/autofill/OWNERS b/chrome/browser/ui/autofill/OWNERS index 2863d571..8d6b49f 100644 --- a/chrome/browser/ui/autofill/OWNERS +++ b/chrome/browser/ui/autofill/OWNERS
@@ -1,8 +1,4 @@ estade@chromium.org mathp@chromium.org -per-file *password*=dvadym@chromium.org -per-file *password*=kolos@chromium.org -per-file *password*=vabr@chromium.org -per-file *password*=vasilii@chromium.org # COMPONENT: UI>Browser>Autofill
diff --git a/chrome/browser/ui/views/autofill/save_card_bubble_views_browsertest.cc b/chrome/browser/ui/views/autofill/save_card_bubble_views_browsertest.cc index b2d875d..4a78d556 100644 --- a/chrome/browser/ui/views/autofill/save_card_bubble_views_browsertest.cc +++ b/chrome/browser/ui/views/autofill/save_card_bubble_views_browsertest.cc
@@ -6,6 +6,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/test/metrics/histogram_tester.h" +#include "build/build_config.h" #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" @@ -70,10 +71,17 @@ FindViewInBubbleById(DialogViewId::MAIN_CONTENT_VIEW_LOCAL)->visible()); } +// Disabled. Failing on Mac 10.11. See https://crbug.com/849129. +#if defined(OS_MACOSX) +#define MAYBE_Local_ClickingSaveClosesBubble \ + DISABLED_Local_ClickingSaveClosesBubble +#else +#define MAYBE_Local_ClickingSaveClosesBubble Local_ClickingSaveClosesBubble +#endif // Tests the local save bubble. Ensures that clicking the [Save] button // successfully causes the bubble to go away. IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest, - Local_ClickingSaveClosesBubble) { + MAYBE_Local_ClickingSaveClosesBubble) { // Set up the Payments RPC. SetUploadDetailsRpcPaymentsDeclines(); @@ -103,11 +111,19 @@ AutofillMetrics::SAVE_CARD_PROMPT_END_ACCEPTED, 1); } +// Disabled. Failing on Mac 10.11. See https://crbug.com/849129. +#if defined(OS_MACOSX) +#define MAYBE_Local_ClickingNoThanksClosesBubbleIfSecondaryUiMdExpOff \ + DISABLED_Local_ClickingNoThanksClosesBubbleIfSecondaryUiMdExpOff +#else +#define MAYBE_Local_ClickingNoThanksClosesBubbleIfSecondaryUiMdExpOff \ + Local_ClickingNoThanksClosesBubbleIfSecondaryUiMdExpOff +#endif // Tests the local save bubble. Ensures that clicking the [No thanks] button // successfully causes the bubble to go away. IN_PROC_BROWSER_TEST_F( SaveCardBubbleViewsFullFormBrowserTest, - Local_ClickingNoThanksClosesBubbleIfSecondaryUiMdExpOff) { + MAYBE_Local_ClickingNoThanksClosesBubbleIfSecondaryUiMdExpOff) { // Disable the SecondaryUiMd experiment. scoped_feature_list_.InitAndDisableFeature(features::kSecondaryUiMd); @@ -166,10 +182,17 @@ EXPECT_FALSE(FindViewInBubbleById(DialogViewId::CANCEL_BUTTON)); } +#if defined(OS_MACOSX) +#define MAYBE_Local_ClickingLearnMoreClosesBubble \ + DISABLED_Local_ClickingLearnMoreClosesBubble +#else +#define MAYBE_Local_ClickingLearnMoreClosesBubble \ + Local_ClickingLearnMoreClosesBubble +#endif // Tests the local save bubble. Ensures that clicking the [Learn more] link // causes the bubble to go away and opens the relevant help page. IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest, - Local_ClickingLearnMoreClosesBubble) { + MAYBE_Local_ClickingLearnMoreClosesBubble) { // Set up the Payments RPC. SetUploadDetailsRpcPaymentsDeclines(); @@ -240,11 +263,18 @@ base::RunLoop().RunUntilIdle(); } +// Disabled. Failing on Mac 10.11. See https://crbug.com/849129. +#if defined(OS_MACOSX) +#define MAYBE_Upload_ClickingSaveClosesBubble \ + DISABLED_Upload_ClickingSaveClosesBubble +#else +#define MAYBE_Upload_ClickingSaveClosesBubble Upload_ClickingSaveClosesBubble +#endif // Tests the upload save bubble. Ensures that clicking the [Save] button // successfully causes the bubble to go away and sends an UploadCardRequest RPC // to Google Payments. IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest, - Upload_ClickingSaveClosesBubble) { + MAYBE_Upload_ClickingSaveClosesBubble) { // Set up the Payments RPC. SetUploadDetailsRpcPaymentsAccepts(); @@ -275,11 +305,19 @@ AutofillMetrics::SAVE_CARD_PROMPT_END_ACCEPTED, 1); } +// Disabled. Failing on Mac 10.11. See https://crbug.com/849129. +#if defined(OS_MACOSX) +#define MAYBE_Upload_ClickingNoThanksClosesBubbleIfSecondaryUiMdExpOff \ + DISABLED_Upload_ClickingNoThanksClosesBubbleIfSecondaryUiMdExpOff +#else +#define MAYBE_Upload_ClickingNoThanksClosesBubbleIfSecondaryUiMdExpOff \ + Upload_ClickingNoThanksClosesBubbleIfSecondaryUiMdExpOff +#endif // Tests the upload save bubble. Ensures that clicking the [No thanks] button // successfully causes the bubble to go away. IN_PROC_BROWSER_TEST_F( SaveCardBubbleViewsFullFormBrowserTest, - Upload_ClickingNoThanksClosesBubbleIfSecondaryUiMdExpOff) { + MAYBE_Upload_ClickingNoThanksClosesBubbleIfSecondaryUiMdExpOff) { // Disable the SecondaryUiMd experiment. scoped_feature_list_.InitAndDisableFeature(features::kSecondaryUiMd); @@ -336,10 +374,19 @@ EXPECT_FALSE(FindViewInBubbleById(DialogViewId::CANCEL_BUTTON)); } +// Disabled. Failing on Mac 10.11. See https://crbug.com/849129. +#if defined(OS_MACOSX) +#define MAYBE_Upload_ClickingCloseClosesBubbleIfSecondaryUiMdExpOn \ + DISABLED_Upload_ClickingCloseClosesBubbleIfSecondaryUiMdExpOn +#else +#define MAYBE_Upload_ClickingCloseClosesBubbleIfSecondaryUiMdExpOn \ + Upload_ClickingCloseClosesBubbleIfSecondaryUiMdExpOn +#endif // Tests the upload save bubble. Ensures that clicking the top-right [X] close // button successfully causes the bubble to go away. -IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest, - Upload_ClickingCloseClosesBubbleIfSecondaryUiMdExpOn) { +IN_PROC_BROWSER_TEST_F( + SaveCardBubbleViewsFullFormBrowserTest, + MAYBE_Upload_ClickingCloseClosesBubbleIfSecondaryUiMdExpOn) { // Enable the SecondaryUiMd experiment. scoped_feature_list_.InitAndEnableFeature(features::kSecondaryUiMd);
diff --git a/chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc b/chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc index befb842..51d28320 100644 --- a/chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc +++ b/chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc
@@ -222,7 +222,14 @@ TestOpenDialogFromContextMenu(); } -IN_PROC_BROWSER_TEST_F(MediaRouterUIBrowserTest, OpenDialogFromAppMenu) { +// Disabled on macOS due to many timeouts. Seems fine on all other platforms. +// crbug.com/849146 +#if defined(OS_MACOSX) +#define MAYBE_OpenDialogFromAppMenu DISABLED_OpenDialogFromAppMenu +#else +#define MAYBE_OpenDialogFromAppMenu OpenDialogFromAppMenu +#endif +IN_PROC_BROWSER_TEST_F(MediaRouterUIBrowserTest, MAYBE_OpenDialogFromAppMenu) { TestOpenDialogFromAppMenu(); }
diff --git a/chrome/browser/ui/views/relaunch_notification/relaunch_recommended_bubble_view.cc b/chrome/browser/ui/views/relaunch_notification/relaunch_recommended_bubble_view.cc index 2d3dc813..4b8e411 100644 --- a/chrome/browser/ui/views/relaunch_notification/relaunch_recommended_bubble_view.cc +++ b/chrome/browser/ui/views/relaunch_notification/relaunch_recommended_bubble_view.cc
@@ -44,6 +44,8 @@ namespace { +constexpr int kTitleIconSize = 20; + // Returns the anchor for |browser|'s app menu, accounting for macOS running // with views or Cocoa. std::pair<views::Button*, gfx::Point> GetAnchor(Browser* browser) { @@ -136,8 +138,8 @@ gfx::ImageSkia RelaunchRecommendedBubbleView::GetWindowIcon() { return gfx::CreateVectorIcon(gfx::IconDescription( - vector_icons::kBusinessIcon, 20, gfx::kChromeIconGrey, base::TimeDelta(), - gfx::kNoneIcon)); + vector_icons::kBusinessIcon, kTitleIconSize, gfx::kChromeIconGrey, + base::TimeDelta(), gfx::kNoneIcon)); } bool RelaunchRecommendedBubbleView::ShouldShowWindowIcon() const { @@ -151,15 +153,7 @@ } void RelaunchRecommendedBubbleView::Layout() { - // Align the body label with the left edge of the bubble's title. - // TODO(bsep): Remove this when fixing https://crbug.com/810970. - gfx::Point origin; - views::View::ConvertPointToWidget(GetBubbleFrameView()->title(), &origin); - views::View::ConvertPointFromWidget(this, &origin); - - gfx::Rect bounds = GetContentsBounds(); - bounds.Inset(origin.x(), 0, 0, 0); - body_label_->SetBoundsRect(bounds); + body_label_->SetBoundsRect(GetContentsBounds()); } void RelaunchRecommendedBubbleView::Init() { @@ -168,6 +162,17 @@ views::style::CONTEXT_MESSAGE_BOX_BODY_TEXT); body_label_->SetMultiLine(true); body_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); + + // Align the body label with the left edge of the bubble's title. + // TODO(bsep): Remove this when fixing https://crbug.com/810970. + // Note: BubleFrameView applies INSETS_DIALOG_TITLE either side of the icon. + int title_offset = 2 * views::LayoutProvider::Get() + ->GetInsetsMetric(views::INSETS_DIALOG_TITLE) + .left() + + kTitleIconSize; + body_label_->SetBorder(views::CreateEmptyBorder( + gfx::Insets(0, title_offset - margins().left(), 0, 0))); + AddChildView(body_label_); base::RecordAction(base::UserMetricsAction("RelaunchRecommendedShown"));
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 3162194..7291dc6 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -4412,6 +4412,7 @@ "../browser/ui/app_list/arc/arc_app_unittest.cc", "../browser/ui/app_list/arc/arc_app_utils_unittest.cc", "../browser/ui/app_list/arc/arc_vpn_provider_unittest.cc", + "../browser/ui/app_list/crostini/crostini_app_model_builder_unittest.cc", "../browser/ui/app_list/extension_app_model_builder_unittest.cc", "../browser/ui/app_list/internal_app/internal_app_model_builder_unittest.cc", "../browser/ui/app_list/search/answer_card/answer_card_result_unittest.cc",
diff --git a/chrome/test/media_router/media_router_integration_browsertest.cc b/chrome/test/media_router/media_router_integration_browsertest.cc index 1fa2759..5a51869 100644 --- a/chrome/test/media_router/media_router_integration_browsertest.cc +++ b/chrome/test/media_router/media_router_integration_browsertest.cc
@@ -725,9 +725,11 @@ WaitUntilRouteCreated(); } +// TODO(crbug.com/849216): Disabled due to crashes and timeouts. +// // Tests that creating a route with a local file opens the file in a new tab. IN_PROC_BROWSER_TEST_F(MediaRouterIntegrationBrowserTest, - OpenLocalMediaFileInNewTab) { + DISABLED_OpenLocalMediaFileInNewTab) { // Start at a tab with content in it, the file will open in a new tab. ui_test_utils::NavigateToURL(browser(), GURL("http://google.com")); // Make sure there is 1 tab.
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index 2f44caa..912956dc 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -10747.0.0 \ No newline at end of file +10750.0.0 \ No newline at end of file
diff --git a/chromeos/dbus/cicerone_client.cc b/chromeos/dbus/cicerone_client.cc index c8c22ef9..cde0605 100644 --- a/chromeos/dbus/cicerone_client.cc +++ b/chromeos/dbus/cicerone_client.cc
@@ -32,6 +32,10 @@ return is_container_started_signal_connected_; } + bool IsContainerShutdownSignalConnected() override { + return is_container_shutdown_signal_connected_; + } + void LaunchContainerApplication( const vm_tools::cicerone::LaunchContainerApplicationRequest& request, DBusMethodCallback<vm_tools::cicerone::LaunchContainerApplicationResponse> @@ -100,6 +104,13 @@ weak_ptr_factory_.GetWeakPtr()), base::BindOnce(&CiceroneClientImpl::OnSignalConnected, weak_ptr_factory_.GetWeakPtr())); + cicerone_proxy_->ConnectToSignal( + vm_tools::cicerone::kVmCiceroneInterface, + vm_tools::cicerone::kContainerShutdownSignal, + base::BindRepeating(&CiceroneClientImpl::OnContainerShutdownSignal, + weak_ptr_factory_.GetWeakPtr()), + base::BindOnce(&CiceroneClientImpl::OnSignalConnected, + weak_ptr_factory_.GetWeakPtr())); } private: @@ -132,6 +143,18 @@ } } + void OnContainerShutdownSignal(dbus::Signal* signal) { + vm_tools::cicerone::ContainerShutdownSignal container_shutdown_signal; + dbus::MessageReader reader(signal); + if (!reader.PopArrayOfBytesAsProto(&container_shutdown_signal)) { + LOG(ERROR) << "Failed to parse proto from DBus Signal"; + return; + } + for (auto& observer : observer_list_) { + observer.OnContainerShutdown(container_shutdown_signal); + } + } + void OnSignalConnected(const std::string& interface_name, const std::string& signal_name, bool is_connected) { @@ -140,8 +163,13 @@ << "Failed to connect to Signal. Async StartContainer will not work"; } DCHECK_EQ(interface_name, vm_tools::cicerone::kVmCiceroneInterface); - DCHECK_EQ(signal_name, vm_tools::cicerone::kContainerStartedSignal); - is_container_started_signal_connected_ = is_connected; + if (signal_name == vm_tools::cicerone::kContainerStartedSignal) { + is_container_started_signal_connected_ = is_connected; + } else if (signal_name == vm_tools::cicerone::kContainerShutdownSignal) { + is_container_shutdown_signal_connected_ = is_connected; + } else { + NOTREACHED(); + } } dbus::ObjectProxy* cicerone_proxy_ = nullptr; @@ -149,6 +177,7 @@ base::ObserverList<Observer> observer_list_; bool is_container_started_signal_connected_ = false; + bool is_container_shutdown_signal_connected_ = false; // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed.
diff --git a/chromeos/dbus/cicerone_client.h b/chromeos/dbus/cicerone_client.h index 9fff65b..3016287f3 100644 --- a/chromeos/dbus/cicerone_client.h +++ b/chromeos/dbus/cicerone_client.h
@@ -26,6 +26,10 @@ virtual void OnContainerStarted( const vm_tools::cicerone::ContainerStartedSignal& signal) = 0; + // OnContainerShutdown is signaled by Cicerone when a container is shutdown. + virtual void OnContainerShutdown( + const vm_tools::cicerone::ContainerShutdownSignal& signal) = 0; + protected: virtual ~Observer() = default; }; @@ -42,6 +46,10 @@ // is called. virtual bool IsContainerStartedSignalConnected() = 0; + // IsContainerShutdownSignalConnected must return true before StartContainer + // is called. + virtual bool IsContainerShutdownSignalConnected() = 0; + // Launches an application inside a running Container. // |callback| is called after the method call finishes. virtual void LaunchContainerApplication(
diff --git a/chromeos/dbus/fake_cicerone_client.cc b/chromeos/dbus/fake_cicerone_client.cc index 8943e9b..23e5bacb 100644 --- a/chromeos/dbus/fake_cicerone_client.cc +++ b/chromeos/dbus/fake_cicerone_client.cc
@@ -23,6 +23,10 @@ return is_container_started_signal_connected_; } +bool FakeCiceroneClient::IsContainerShutdownSignalConnected() { + return is_container_shutdown_signal_connected_; +} + void FakeCiceroneClient::LaunchContainerApplication( const vm_tools::cicerone::LaunchContainerApplicationRequest& request, DBusMethodCallback<vm_tools::cicerone::LaunchContainerApplicationResponse>
diff --git a/chromeos/dbus/fake_cicerone_client.h b/chromeos/dbus/fake_cicerone_client.h index c2e69fc1..756e76e1 100644 --- a/chromeos/dbus/fake_cicerone_client.h +++ b/chromeos/dbus/fake_cicerone_client.h
@@ -25,6 +25,10 @@ // is called. bool IsContainerStartedSignalConnected() override; + // IsContainerShutdownSignalConnected must return true before StartContainer + // is called. + bool IsContainerShutdownSignalConnected() override; + // Fake version of the method that launches an application inside a running // Container. |callback| is called after the method call finishes. void LaunchContainerApplication( @@ -49,11 +53,17 @@ is_container_started_signal_connected_ = connected; } + // Set ContainerShutdownSignalConnected state + void set_container_shutdown_signal_connected(bool connected) { + is_container_shutdown_signal_connected_ = connected; + } + protected: void Init(dbus::Bus* bus) override {} private: bool is_container_started_signal_connected_ = true; + bool is_container_shutdown_signal_connected_ = true; base::ObserverList<Observer> observer_list_; DISALLOW_COPY_AND_ASSIGN(FakeCiceroneClient);
diff --git a/chromeos/services/secure_channel/BUILD.gn b/chromeos/services/secure_channel/BUILD.gn index 2e276fc..4cc2f3a2 100644 --- a/chromeos/services/secure_channel/BUILD.gn +++ b/chromeos/services/secure_channel/BUILD.gn
@@ -32,8 +32,6 @@ "connection_medium.h", "connection_role.cc", "connection_role.h", - "local_device_metadata_manager.cc", - "local_device_metadata_manager.h", "multiplexed_channel.cc", "multiplexed_channel.h", "multiplexed_channel_impl.cc", @@ -120,7 +118,6 @@ "connect_to_device_operation_base_unittest.cc", "connect_to_device_operation_factory_base_unittest.cc", "connection_attempt_base_unittest.cc", - "local_device_metadata_manager_unittest.cc", "multiplexed_channel_impl_unittest.cc", "pending_ble_initiator_connection_request_unittest.cc", "pending_ble_listener_connection_request_unittest.cc",
diff --git a/chromeos/services/secure_channel/fake_active_connection_manager.cc b/chromeos/services/secure_channel/fake_active_connection_manager.cc index ca6295326..51ef989d 100644 --- a/chromeos/services/secure_channel/fake_active_connection_manager.cc +++ b/chromeos/services/secure_channel/fake_active_connection_manager.cc
@@ -20,11 +20,11 @@ void FakeActiveConnectionManager::SetDisconnecting( const ConnectionDetails& connection_details) { - DCHECK(base::ContainsKey(connection_details_to_channel_map_, + DCHECK(base::ContainsKey(connection_details_to_active_metadata_map_, connection_details)); - ConnectionState& state = - std::get<0>(connection_details_to_channel_map_[connection_details]); + ConnectionState& state = std::get<0>( + connection_details_to_active_metadata_map_[connection_details]); DCHECK_EQ(ConnectionState::kActiveConnectionExists, state); state = ConnectionState::kDisconnectingConnectionExists; @@ -32,14 +32,15 @@ void FakeActiveConnectionManager::SetDisconnected( const ConnectionDetails& connection_details) { - DCHECK(base::ContainsKey(connection_details_to_channel_map_, + DCHECK(base::ContainsKey(connection_details_to_active_metadata_map_, connection_details)); DCHECK_NE( ConnectionState::kNoConnectionExists, - std::get<0>(connection_details_to_channel_map_[connection_details])); + std::get<0>( + connection_details_to_active_metadata_map_[connection_details])); size_t num_erased = - connection_details_to_channel_map_.erase(connection_details); + connection_details_to_active_metadata_map_.erase(connection_details); DCHECK_EQ(1u, num_erased); OnChannelDisconnected(connection_details); @@ -48,31 +49,33 @@ ActiveConnectionManager::ConnectionState FakeActiveConnectionManager::GetConnectionState( const ConnectionDetails& connection_details) const { - if (!base::ContainsKey(connection_details_to_channel_map_, + if (!base::ContainsKey(connection_details_to_active_metadata_map_, connection_details)) { return ConnectionState::kNoConnectionExists; } - return std::get<0>(connection_details_to_channel_map_.at(connection_details)); + return std::get<0>( + connection_details_to_active_metadata_map_.at(connection_details)); } void FakeActiveConnectionManager::PerformAddActiveConnection( std::unique_ptr<AuthenticatedChannel> authenticated_channel, std::vector<std::unique_ptr<ClientConnectionParameters>> initial_clients, const ConnectionDetails& connection_details) { - DCHECK(!base::ContainsKey(connection_details_to_channel_map_, + DCHECK(!base::ContainsKey(connection_details_to_active_metadata_map_, connection_details)); - connection_details_to_channel_map_[connection_details] = std::make_tuple( - ConnectionState::kActiveConnectionExists, - std::move(authenticated_channel), std::move(initial_clients)); + connection_details_to_active_metadata_map_[connection_details] = + std::make_tuple(ConnectionState::kActiveConnectionExists, + std::move(authenticated_channel), + std::move(initial_clients)); } void FakeActiveConnectionManager::PerformAddClientToChannel( std::unique_ptr<ClientConnectionParameters> client_connection_parameters, const ConnectionDetails& connection_details) { - DCHECK(base::ContainsKey(connection_details_to_channel_map_, + DCHECK(base::ContainsKey(connection_details_to_active_metadata_map_, connection_details)); - std::get<2>(connection_details_to_channel_map_[connection_details]) + std::get<2>(connection_details_to_active_metadata_map_[connection_details]) .push_back(std::move(client_connection_parameters)); }
diff --git a/chromeos/services/secure_channel/fake_active_connection_manager.h b/chromeos/services/secure_channel/fake_active_connection_manager.h index 7a2223df..ddebd98 100644 --- a/chromeos/services/secure_channel/fake_active_connection_manager.h +++ b/chromeos/services/secure_channel/fake_active_connection_manager.h
@@ -36,8 +36,8 @@ std::vector<std::unique_ptr<ClientConnectionParameters>>>, ConnectionDetailsHash>; - DetailsToMetadataMap& connection_details_to_channel_map() { - return connection_details_to_channel_map_; + DetailsToMetadataMap& connection_details_to_active_metadata_map() { + return connection_details_to_active_metadata_map_; } void SetDisconnecting(const ConnectionDetails& connection_details); @@ -55,7 +55,7 @@ std::unique_ptr<ClientConnectionParameters> client_connection_parameters, const ConnectionDetails& connection_details) override; - DetailsToMetadataMap connection_details_to_channel_map_; + DetailsToMetadataMap connection_details_to_active_metadata_map_; DISALLOW_COPY_AND_ASSIGN(FakeActiveConnectionManager); };
diff --git a/chromeos/services/secure_channel/fake_client_connection_parameters.cc b/chromeos/services/secure_channel/fake_client_connection_parameters.cc index 2d1cd2d..818af77 100644 --- a/chromeos/services/secure_channel/fake_client_connection_parameters.cc +++ b/chromeos/services/secure_channel/fake_client_connection_parameters.cc
@@ -9,10 +9,16 @@ namespace secure_channel { FakeClientConnectionParameters::FakeClientConnectionParameters( - const std::string& feature) - : ClientConnectionParameters(feature), weak_ptr_factory_(this) {} + const std::string& feature, + base::OnceCallback<void(const base::UnguessableToken&)> destructor_callback) + : ClientConnectionParameters(feature), + destructor_callback_(std::move(destructor_callback)), + weak_ptr_factory_(this) {} -FakeClientConnectionParameters::~FakeClientConnectionParameters() = default; +FakeClientConnectionParameters::~FakeClientConnectionParameters() { + if (destructor_callback_) + std::move(destructor_callback_).Run(id()); +} void FakeClientConnectionParameters::CancelClientRequest() { DCHECK(!has_canceled_client_request_);
diff --git a/chromeos/services/secure_channel/fake_client_connection_parameters.h b/chromeos/services/secure_channel/fake_client_connection_parameters.h index befd3bb1..920790a 100644 --- a/chromeos/services/secure_channel/fake_client_connection_parameters.h +++ b/chromeos/services/secure_channel/fake_client_connection_parameters.h
@@ -19,7 +19,12 @@ // Test ClientConnectionParameters implementation. class FakeClientConnectionParameters : public ClientConnectionParameters { public: - FakeClientConnectionParameters(const std::string& feature); + FakeClientConnectionParameters( + const std::string& feature, + base::OnceCallback<void(const base::UnguessableToken&)> + destructor_callback = + base::OnceCallback<void(const base::UnguessableToken&)>()); + ~FakeClientConnectionParameters() override; const base::Optional<mojom::ConnectionAttemptFailureReason>& @@ -62,6 +67,8 @@ base::Optional<mojom::ChannelPtr> channel_; uint32_t disconnection_reason_ = 0u; + base::OnceCallback<void(const base::UnguessableToken&)> destructor_callback_; + base::WeakPtrFactory<FakeClientConnectionParameters> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(FakeClientConnectionParameters);
diff --git a/chromeos/services/secure_channel/fake_pending_connection_manager.cc b/chromeos/services/secure_channel/fake_pending_connection_manager.cc index 0c10d57c..65dbb88 100644 --- a/chromeos/services/secure_channel/fake_pending_connection_manager.cc +++ b/chromeos/services/secure_channel/fake_pending_connection_manager.cc
@@ -4,6 +4,9 @@ #include "chromeos/services/secure_channel/fake_pending_connection_manager.h" +#include <algorithm> +#include <iterator> + #include "base/logging.h" #include "chromeos/services/secure_channel/public/cpp/shared/authenticated_channel.h" @@ -16,7 +19,8 @@ FakePendingConnectionManager::~FakePendingConnectionManager() = default; -void FakePendingConnectionManager::NotifyConnectionForHandledRequests( +std::vector<ClientConnectionParameters*> +FakePendingConnectionManager::NotifyConnectionForHandledRequests( std::unique_ptr<AuthenticatedChannel> authenticated_channel, const ConnectionDetails& connection_details) { std::vector<std::unique_ptr<ClientConnectionParameters>> client_list; @@ -35,8 +39,16 @@ // There must be at least one client in the list. DCHECK_LT(0u, client_list.size()); + // Make a copy of the client list to pass as a return value for this function. + std::vector<ClientConnectionParameters*> client_list_raw; + std::transform(client_list.begin(), client_list.end(), + std::back_inserter(client_list_raw), + [](auto& client) { return client.get(); }); + NotifyOnConnection(std::move(authenticated_channel), std::move(client_list), connection_details); + + return client_list_raw; } void FakePendingConnectionManager::HandleConnectionRequest(
diff --git a/chromeos/services/secure_channel/fake_pending_connection_manager.h b/chromeos/services/secure_channel/fake_pending_connection_manager.h index cfa0866..36ae669b 100644 --- a/chromeos/services/secure_channel/fake_pending_connection_manager.h +++ b/chromeos/services/secure_channel/fake_pending_connection_manager.h
@@ -36,7 +36,10 @@ // associated with |connection_details|. Before this call can complete, there // must be at least one handled request with those details. This call removes // the relevant handled requests from the list returned by handled_requests(). - void NotifyConnectionForHandledRequests( + // + // The return value of this function is the raw pointers of all + // ClientConnectionParameters that were passed to the delegate function. + std::vector<ClientConnectionParameters*> NotifyConnectionForHandledRequests( std::unique_ptr<AuthenticatedChannel> authenticated_channel, const ConnectionDetails& connection_details);
diff --git a/chromeos/services/secure_channel/local_device_metadata_manager.cc b/chromeos/services/secure_channel/local_device_metadata_manager.cc deleted file mode 100644 index 217140f..0000000 --- a/chromeos/services/secure_channel/local_device_metadata_manager.cc +++ /dev/null
@@ -1,62 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromeos/services/secure_channel/local_device_metadata_manager.h" - -#include "base/logging.h" -#include "base/stl_util.h" -#include "chromeos/components/proximity_auth/logging/logging.h" - -namespace chromeos { - -namespace secure_channel { - -LocalDeviceMetadataManager::LocalDeviceMetadataManager() = default; - -LocalDeviceMetadataManager::~LocalDeviceMetadataManager() = default; - -void LocalDeviceMetadataManager::SetDefaultLocalDeviceDataMetadata( - cryptauth::RemoteDeviceRef default_local_device_metadata) { - if (default_local_device_metadata_) { - PA_LOG(WARNING) << "LocalDeviceMetadataManager::" - << "SetDefaultLocalDeviceDataMetadata(): Setting the " - << "default local device metadata, but one was already " - << "set. Overwriting the old one."; - } - - default_local_device_metadata_ = default_local_device_metadata; -} - -const base::Optional<cryptauth::RemoteDeviceRef>& -LocalDeviceMetadataManager::GetDefaultLocalDeviceMetadata() const { - return default_local_device_metadata_; -} - -void LocalDeviceMetadataManager::SetLocalDeviceMetadataForRequest( - const base::UnguessableToken& request_id, - cryptauth::RemoteDeviceRef local_device_metadata) { - if (base::ContainsKey(request_id_to_metadata_map_, request_id)) { - PA_LOG(ERROR) << "LocalDeviceMetadataManager::" - << "SetLocalDeviceMetadataForRequest(): Setting local device " - << "metadata for request ID " << request_id << ", but that " - << "request already had metadata set."; - NOTREACHED(); - } - - request_id_to_metadata_map_.insert( - std::make_pair(request_id, local_device_metadata)); -} - -base::Optional<cryptauth::RemoteDeviceRef> -LocalDeviceMetadataManager::GetLocalDeviceMetadataForRequest( - const base::UnguessableToken& request_id) const { - if (base::ContainsKey(request_id_to_metadata_map_, request_id)) - return request_id_to_metadata_map_.at(request_id); - - return base::nullopt; -} - -} // namespace secure_channel - -} // namespace chromeos
diff --git a/chromeos/services/secure_channel/local_device_metadata_manager.h b/chromeos/services/secure_channel/local_device_metadata_manager.h deleted file mode 100644 index 4df1ad2..0000000 --- a/chromeos/services/secure_channel/local_device_metadata_manager.h +++ /dev/null
@@ -1,62 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_LOCAL_DEVICE_METADATA_MANAGER_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_LOCAL_DEVICE_METADATA_MANAGER_H_ - -#include <unordered_map> - -#include "base/macros.h" -#include "base/optional.h" -#include "base/unguessable_token.h" -#include "components/cryptauth/remote_device_ref.h" - -namespace chromeos { - -namespace secure_channel { - -// Provides the ability set/fetch data associated with the local device. -class LocalDeviceMetadataManager { - public: - LocalDeviceMetadataManager(); - virtual ~LocalDeviceMetadataManager(); - - // Sets the default local device metadata; this function is intended to be - // called when the user logs in. - void SetDefaultLocalDeviceDataMetadata( - cryptauth::RemoteDeviceRef default_local_device_metadata); - - // Return value is base::nullopt if SetDefaultLocalDeviceDataMetadata() has - // not yet been called. - const base::Optional<cryptauth::RemoteDeviceRef>& - GetDefaultLocalDeviceMetadata() const; - - // Sets the local device metadata for the request with id |request_id|. This - // function is intended to be used before the user logs in; before log-in, - // the local device can be represented by several RemoteDeviceRef objects, - // each specific to a different user's account. - void SetLocalDeviceMetadataForRequest( - const base::UnguessableToken& request_id, - cryptauth::RemoteDeviceRef default_local_device_metadata); - - // Return value is base::nullopt if SetLocalDeviceMetadataForRequest() has - // not yet been called for the |request_id|. - base::Optional<cryptauth::RemoteDeviceRef> GetLocalDeviceMetadataForRequest( - const base::UnguessableToken& request_id) const; - - private: - base::Optional<cryptauth::RemoteDeviceRef> default_local_device_metadata_; - std::unordered_map<base::UnguessableToken, - cryptauth::RemoteDeviceRef, - base::UnguessableTokenHash> - request_id_to_metadata_map_; - - DISALLOW_COPY_AND_ASSIGN(LocalDeviceMetadataManager); -}; - -} // namespace secure_channel - -} // namespace chromeos - -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_LOCAL_DEVICE_METADATA_MANAGER_H_
diff --git a/chromeos/services/secure_channel/local_device_metadata_manager_unittest.cc b/chromeos/services/secure_channel/local_device_metadata_manager_unittest.cc deleted file mode 100644 index 9ba0e14..0000000 --- a/chromeos/services/secure_channel/local_device_metadata_manager_unittest.cc +++ /dev/null
@@ -1,95 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromeos/services/secure_channel/local_device_metadata_manager.h" - -#include <memory> - -#include "base/run_loop.h" -#include "base/test/gtest_util.h" -#include "base/unguessable_token.h" -#include "components/cryptauth/remote_device_test_util.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace chromeos { - -namespace secure_channel { - -namespace { -const size_t kNumTestDevices = 2; -} // namespace - -class SecureChannelLocalDeviceMetadataManagerTest : public testing::Test { - protected: - SecureChannelLocalDeviceMetadataManagerTest() - : test_device_refs_( - cryptauth::CreateRemoteDeviceRefListForTest(kNumTestDevices)) {} - ~SecureChannelLocalDeviceMetadataManagerTest() override = default; - - // testing::Test: - void SetUp() override { - manager_ = std::make_unique<LocalDeviceMetadataManager>(); - } - - cryptauth::RemoteDeviceRef GetDevice(size_t index) { - EXPECT_TRUE(index < kNumTestDevices); - return test_device_refs_[index]; - } - - LocalDeviceMetadataManager* manager() { return manager_.get(); } - - const cryptauth::RemoteDeviceRefList& test_device_refs() { - return test_device_refs_; - } - - private: - const cryptauth::RemoteDeviceRefList test_device_refs_; - - std::unique_ptr<LocalDeviceMetadataManager> manager_; - - DISALLOW_COPY_AND_ASSIGN(SecureChannelLocalDeviceMetadataManagerTest); -}; - -TEST_F(SecureChannelLocalDeviceMetadataManagerTest, DefaultLocalDevice) { - // No device should be present before one is added. - EXPECT_FALSE(manager()->GetDefaultLocalDeviceMetadata()); - - // Set the default local device. - manager()->SetDefaultLocalDeviceDataMetadata(test_device_refs()[0]); - EXPECT_EQ(test_device_refs()[0], *manager()->GetDefaultLocalDeviceMetadata()); - - // Set a new device as the default local device. - manager()->SetDefaultLocalDeviceDataMetadata(test_device_refs()[1]); - EXPECT_EQ(test_device_refs()[1], *manager()->GetDefaultLocalDeviceMetadata()); -} - -TEST_F(SecureChannelLocalDeviceMetadataManagerTest, LocalDevicePerRequest) { - auto request_id_1 = base::UnguessableToken::Create(); - auto request_id_2 = base::UnguessableToken::Create(); - - // First request. - EXPECT_FALSE(manager()->GetLocalDeviceMetadataForRequest(request_id_1)); - manager()->SetLocalDeviceMetadataForRequest(request_id_1, - test_device_refs()[0]); - EXPECT_EQ(test_device_refs()[0], - *manager()->GetLocalDeviceMetadataForRequest(request_id_1)); - - // Second request. - EXPECT_FALSE(manager()->GetLocalDeviceMetadataForRequest(request_id_2)); - manager()->SetLocalDeviceMetadataForRequest(request_id_2, - test_device_refs()[1]); - EXPECT_EQ(test_device_refs()[1], - *manager()->GetLocalDeviceMetadataForRequest(request_id_2)); - - // Setting new metadata for a request which has already been set should cause - // a crash. - EXPECT_DCHECK_DEATH(manager()->SetLocalDeviceMetadataForRequest( - request_id_1, test_device_refs()[1])); - EXPECT_DCHECK_DEATH(manager()->SetLocalDeviceMetadataForRequest( - request_id_2, test_device_refs()[0])); -} - -} // namespace secure_channel - -} // namespace chromeos
diff --git a/chromeos/system/factory_ping_embargo_check.cc b/chromeos/system/factory_ping_embargo_check.cc index a18444c..738b8e9 100644 --- a/chromeos/system/factory_ping_embargo_check.cc +++ b/chromeos/system/factory_ping_embargo_check.cc
@@ -6,11 +6,32 @@ #include <string> +#include "base/metrics/histogram_macros.h" #include "chromeos/system/statistics_provider.h" namespace chromeos { namespace system { +namespace { + +// These values are persisted to logs. Entries should not be renumbered and +// numeric values should never be reused. +// These values must match the corresponding enum defined in enums.xml. +enum class EndDateValidityHistogramValue { + kMalformed = 0, + kInvalid = 1, + kValid = 2, + kMaxValue = kValid, +}; + +// This is in a helper function to help the compiler avoid generating duplicated +// code. +void RecordEndDateValidity(EndDateValidityHistogramValue value) { + UMA_HISTOGRAM_ENUMERATION("FactoryPingEmbargo.EndDateValidity", value); +} + +} // namespace + FactoryPingEmbargoState GetFactoryPingEmbargoState( StatisticsProvider* statistics_provider) { std::string rlz_embargo_end_date; @@ -23,6 +44,7 @@ base::Time parsed_time; if (!base::Time::FromUTCString(rlz_embargo_end_date.c_str(), &parsed_time)) { LOG(ERROR) << "|rlz_embargo_end_date| exists but cannot be parsed."; + RecordEndDateValidity(EndDateValidityHistogramValue::kMalformed); return FactoryPingEmbargoState::kMissingOrMalformed; } @@ -32,11 +54,11 @@ // ignore it. Because it indicates that the device is not connected to an // ntp server in the factory, and its internal clock could be off when the // date is written. - // TODO(pmarko): UMA stat for how often this happens - // (https://crbug.com/839353). + RecordEndDateValidity(EndDateValidityHistogramValue::kInvalid); return FactoryPingEmbargoState::kInvalid; } + RecordEndDateValidity(EndDateValidityHistogramValue::kValid); return base::Time::Now() > parsed_time ? FactoryPingEmbargoState::kPassed : FactoryPingEmbargoState::kNotPassed; }
diff --git a/components/arc/BUILD.gn b/components/arc/BUILD.gn index f5505e6..abf36f0b 100644 --- a/components/arc/BUILD.gn +++ b/components/arc/BUILD.gn
@@ -14,6 +14,8 @@ "clipboard/arc_clipboard_bridge.h", "crash_collector/arc_crash_collector_bridge.cc", "crash_collector/arc_crash_collector_bridge.h", + "disk_quota/arc_disk_quota_bridge.cc", + "disk_quota/arc_disk_quota_bridge.h", "ime/arc_ime_bridge.h", "ime/arc_ime_bridge_impl.cc", "ime/arc_ime_bridge_impl.h",
diff --git a/components/arc/arc_bridge_host_impl.cc b/components/arc/arc_bridge_host_impl.cc index c59d2db..ca7baffb 100644 --- a/components/arc/arc_bridge_host_impl.cc +++ b/components/arc/arc_bridge_host_impl.cc
@@ -94,6 +94,11 @@ std::move(crash_collector_ptr)); } +void ArcBridgeHostImpl::OnDiskQuotaInstanceReady( + mojom::DiskQuotaInstancePtr disk_quota_ptr) { + OnInstanceReady(arc_bridge_service_->disk_quota(), std::move(disk_quota_ptr)); +} + void ArcBridgeHostImpl::OnEnterpriseReportingInstanceReady( mojom::EnterpriseReportingInstancePtr enterprise_reporting_ptr) { OnInstanceReady(arc_bridge_service_->enterprise_reporting(),
diff --git a/components/arc/arc_bridge_host_impl.h b/components/arc/arc_bridge_host_impl.h index 07ca1b8..979eca9 100644 --- a/components/arc/arc_bridge_host_impl.h +++ b/components/arc/arc_bridge_host_impl.h
@@ -55,6 +55,8 @@ mojom::ClipboardInstancePtr clipboard_ptr) override; void OnCrashCollectorInstanceReady( mojom::CrashCollectorInstancePtr crash_collector_ptr) override; + void OnDiskQuotaInstanceReady( + mojom::DiskQuotaInstancePtr disk_quota_ptr) override; void OnEnterpriseReportingInstanceReady( mojom::EnterpriseReportingInstancePtr enterprise_reporting_ptr) override; void OnFileSystemInstanceReady(
diff --git a/components/arc/arc_bridge_service.h b/components/arc/arc_bridge_service.h index 43bd651a..b06f5e3f 100644 --- a/components/arc/arc_bridge_service.h +++ b/components/arc/arc_bridge_service.h
@@ -34,6 +34,8 @@ class ClipboardInstance; class CrashCollectorHost; class CrashCollectorInstance; +class DiskQuotaHost; +class DiskQuotaInstance; class EnterpriseReportingHost; class EnterpriseReportingInstance; class FileSystemHost; @@ -136,6 +138,10 @@ crash_collector() { return &crash_collector_; } + ConnectionHolder<mojom::DiskQuotaInstance, mojom::DiskQuotaHost>* + disk_quota() { + return &disk_quota_; + } ConnectionHolder<mojom::EnterpriseReportingInstance, mojom::EnterpriseReportingHost>* enterprise_reporting() { @@ -245,6 +251,7 @@ ConnectionHolder<mojom::ClipboardInstance, mojom::ClipboardHost> clipboard_; ConnectionHolder<mojom::CrashCollectorInstance, mojom::CrashCollectorHost> crash_collector_; + ConnectionHolder<mojom::DiskQuotaInstance, mojom::DiskQuotaHost> disk_quota_; ConnectionHolder<mojom::EnterpriseReportingInstance, mojom::EnterpriseReportingHost> enterprise_reporting_;
diff --git a/components/arc/common/arc_bridge.mojom b/components/arc/common/arc_bridge.mojom index 6966f3e5..3ea9ee6 100644 --- a/components/arc/common/arc_bridge.mojom +++ b/components/arc/common/arc_bridge.mojom
@@ -15,6 +15,7 @@ import "components/arc/common/cert_store.mojom"; import "components/arc/common/clipboard.mojom"; import "components/arc/common/crash_collector.mojom"; +import "components/arc/common/disk_quota.mojom"; import "components/arc/common/enterprise_reporting.mojom"; import "components/arc/common/file_system.mojom"; import "components/arc/common/ime.mojom"; @@ -46,9 +47,9 @@ import "components/arc/common/wake_lock.mojom"; import "components/arc/common/wallpaper.mojom"; -// Next MinVersion: 39 +// Next MinVersion: 40 // Deprecated method IDs: 101, 105 -// Next method ID: 144 +// Next method ID: 145 interface ArcBridgeHost { // Keep the entries alphabetical. In order to do so without breaking // compatibility with the ARC instance, explicitly assign each interface a @@ -92,6 +93,9 @@ [MinVersion=7] OnCrashCollectorInstanceReady@112( CrashCollectorInstance instance_ptr); + // Notifies Chrome that the DiskQuotaInstance interface is ready. + [MinVersion=39] OnDiskQuotaInstanceReady@144(DiskQuotaInstance instance_ptr); + // Notifies Chrome that the EnterpriseReportingInstance interface is ready. [MinVersion=15] OnEnterpriseReportingInstanceReady@122( EnterpriseReportingInstance instance_ptr);
diff --git a/components/arc/disk_quota/arc_disk_quota_bridge.cc b/components/arc/disk_quota/arc_disk_quota_bridge.cc new file mode 100644 index 0000000..f90af4a --- /dev/null +++ b/components/arc/disk_quota/arc_disk_quota_bridge.cc
@@ -0,0 +1,103 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/arc/disk_quota/arc_disk_quota_bridge.h" + +#include "base/bind.h" +#include "base/memory/singleton.h" +#include "base/optional.h" +#include "chromeos/dbus/cryptohome_client.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "components/arc/arc_bridge_service.h" +#include "components/arc/arc_browser_context_keyed_service_factory_base.h" + +namespace arc { + +namespace { + +// Singleton factory for ArcDiskQuotaBridge. +class ArcDiskQuotaBridgeFactory + : public internal::ArcBrowserContextKeyedServiceFactoryBase< + ArcDiskQuotaBridge, + ArcDiskQuotaBridgeFactory> { + public: + // Factory name used by ArcBrowserContextKeyedServiceFactoryBase. + static constexpr const char* kName = "ArcDiskQuotaBridgeFactory"; + + static ArcDiskQuotaBridgeFactory* GetInstance() { + return base::Singleton<ArcDiskQuotaBridgeFactory>::get(); + } + + private: + friend base::DefaultSingletonTraits<ArcDiskQuotaBridgeFactory>; + ArcDiskQuotaBridgeFactory() = default; + ~ArcDiskQuotaBridgeFactory() override = default; +}; + +} // namespace + +// static +ArcDiskQuotaBridge* ArcDiskQuotaBridge::GetForBrowserContext( + content::BrowserContext* context) { + return ArcDiskQuotaBridgeFactory::GetForBrowserContext(context); +} + +ArcDiskQuotaBridge::ArcDiskQuotaBridge(content::BrowserContext* context, + ArcBridgeService* bridge_service) + : arc_bridge_service_(bridge_service) { + arc_bridge_service_->disk_quota()->SetHost(this); +} + +ArcDiskQuotaBridge::~ArcDiskQuotaBridge() { + arc_bridge_service_->disk_quota()->SetHost(nullptr); +} + +void ArcDiskQuotaBridge::IsQuotaSupported(IsQuotaSupportedCallback callback) { + chromeos::DBusThreadManager::Get()->GetCryptohomeClient()->IsQuotaSupported( + base::BindOnce( + [](IsQuotaSupportedCallback callback, base::Optional<bool> result) { + LOG_IF(ERROR, !result.has_value()) + << "Failed to retrieve result from IsQuotaSupported call."; + std::move(callback).Run(result.value_or(false)); + }, + std::move(callback))); +} + +void ArcDiskQuotaBridge::GetCurrentSpaceForUid( + uint32_t uid, + GetCurrentSpaceForUidCallback callback) { + chromeos::DBusThreadManager::Get() + ->GetCryptohomeClient() + ->GetCurrentSpaceForUid( + uid, base::BindOnce( + [](GetCurrentSpaceForUidCallback callback, int uid, + base::Optional<int64_t> result) { + LOG_IF(ERROR, !result.has_value()) + << "Failed to retrieve result from " + "GetCurrentSpaceForUid for uid=" + << uid; + std::move(callback).Run(result.value_or(-1LL)); + }, + std::move(callback), uid)); +} + +void ArcDiskQuotaBridge::GetCurrentSpaceForGid( + uint32_t gid, + GetCurrentSpaceForGidCallback callback) { + chromeos::DBusThreadManager::Get() + ->GetCryptohomeClient() + ->GetCurrentSpaceForGid( + gid, base::BindOnce( + [](GetCurrentSpaceForGidCallback callback, int gid, + base::Optional<int64_t> result) { + LOG_IF(ERROR, !result.has_value()) + << "Failed to retrieve result from " + "GetCurrentSpaceForGid for gid=" + << gid; + std::move(callback).Run(result.value_or(-1LL)); + }, + std::move(callback), gid)); +} + +} // namespace arc
diff --git a/components/arc/disk_quota/arc_disk_quota_bridge.h b/components/arc/disk_quota/arc_disk_quota_bridge.h new file mode 100644 index 0000000..3b8c73f --- /dev/null +++ b/components/arc/disk_quota/arc_disk_quota_bridge.h
@@ -0,0 +1,49 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_ARC_DISK_QUOTA_ARC_DISK_QUOTA_BRIDGE_H_ +#define COMPONENTS_ARC_DISK_QUOTA_ARC_DISK_QUOTA_BRIDGE_H_ + +#include "base/macros.h" +#include "components/arc/common/disk_quota.mojom.h" +#include "components/keyed_service/core/keyed_service.h" + +namespace content { +class BrowserContext; +} // namespace content + +namespace arc { + +class ArcBridgeService; + +// This class proxies quota requests from Android to cryptohome. +class ArcDiskQuotaBridge : public KeyedService, public mojom::DiskQuotaHost { + public: + // Returns singleton instance for the given BrowserContext, + // or nullptr if the browser |context| is not allowed to use ARC. + static ArcDiskQuotaBridge* GetForBrowserContext( + content::BrowserContext* context); + + ArcDiskQuotaBridge(content::BrowserContext* context, + ArcBridgeService* bridge_service); + ~ArcDiskQuotaBridge() override; + + // mojom::DiskQuotaHost overrides: + void IsQuotaSupported(IsQuotaSupportedCallback callback) override; + + void GetCurrentSpaceForUid(uint32_t uid, + GetCurrentSpaceForUidCallback callback) override; + + void GetCurrentSpaceForGid(uint32_t gid, + GetCurrentSpaceForGidCallback callback) override; + + private: + ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager. + + DISALLOW_COPY_AND_ASSIGN(ArcDiskQuotaBridge); +}; + +} // namespace arc + +#endif // COMPONENTS_ARC_DISK_QUOTA_ARC_DISK_QUOTA_BRIDGE_H_
diff --git a/components/arc/test/fake_arc_bridge_host.cc b/components/arc/test/fake_arc_bridge_host.cc index a1312ec..918e8f1 100644 --- a/components/arc/test/fake_arc_bridge_host.cc +++ b/components/arc/test/fake_arc_bridge_host.cc
@@ -41,6 +41,9 @@ void FakeArcBridgeHost::OnCrashCollectorInstanceReady( mojom::CrashCollectorInstancePtr crash_collector_ptr) {} +void FakeArcBridgeHost::OnDiskQuotaInstanceReady( + mojom::DiskQuotaInstancePtr disk_quota_ptr) {} + void FakeArcBridgeHost::OnEnterpriseReportingInstanceReady( mojom::EnterpriseReportingInstancePtr enterprise_reporting_ptr) {}
diff --git a/components/arc/test/fake_arc_bridge_host.h b/components/arc/test/fake_arc_bridge_host.h index a8acc8ed..df9640f 100644 --- a/components/arc/test/fake_arc_bridge_host.h +++ b/components/arc/test/fake_arc_bridge_host.h
@@ -35,6 +35,8 @@ mojom::ClipboardInstancePtr clipboard_ptr) override; void OnCrashCollectorInstanceReady( mojom::CrashCollectorInstancePtr crash_collector_ptr) override; + void OnDiskQuotaInstanceReady( + mojom::DiskQuotaInstancePtr disk_quota_ptr) override; void OnEnterpriseReportingInstanceReady( mojom::EnterpriseReportingInstancePtr enterprise_reporting_ptr) override; void OnFileSystemInstanceReady(
diff --git a/components/autofill/ios/fill/resources/form.js b/components/autofill/ios/fill/resources/form.js index 15c67b2..b4294bb 100644 --- a/components/autofill/ios/fill/resources/form.js +++ b/components/autofill/ios/fill/resources/form.js
@@ -253,7 +253,8 @@ return name; } name = form.getAttribute('id'); - if (name) { + if (name && name.length != 0 && + form.ownerDocument.getElementById(name) === form) { return name; } // A form name must be supplied, because the element will later need to be
diff --git a/components/browser_sync/profile_sync_components_factory_impl.cc b/components/browser_sync/profile_sync_components_factory_impl.cc index 04bd90d..0299c3c 100644 --- a/components/browser_sync/profile_sync_components_factory_impl.cc +++ b/components/browser_sync/profile_sync_components_factory_impl.cc
@@ -256,6 +256,14 @@ syncer::USER_EVENTS, sync_client_, ui_thread_)); } + // TODO(vitaliii): Enable consents once their controller delegate is wired + // properly. + if (false) { + // Consents should always be enabled. + controllers.push_back(std::make_unique<ModelTypeController>( + syncer::USER_CONSENTS, sync_client_, ui_thread_)); + } + return controllers; }
diff --git a/components/browser_sync/profile_sync_service.cc b/components/browser_sync/profile_sync_service.cc index 163e8da..6e5e999 100644 --- a/components/browser_sync/profile_sync_service.cc +++ b/components/browser_sync/profile_sync_service.cc
@@ -1371,7 +1371,7 @@ syncer::user_selectable_type::PROXY_TABS, }; - static_assert(41 == syncer::MODEL_TYPE_COUNT, + static_assert(42 == syncer::MODEL_TYPE_COUNT, "If adding a user selectable type (that is exposed to the user " "via the sync preferences UI), update " "1) The user_selectable_types[] above;"
diff --git a/components/consent_auditor/BUILD.gn b/components/consent_auditor/BUILD.gn index 727ff15..a706e77 100644 --- a/components/consent_auditor/BUILD.gn +++ b/components/consent_auditor/BUILD.gn
@@ -10,7 +10,6 @@ sources = [ "consent_auditor.cc", "consent_auditor.h", - "consent_sync_bridge.cc", "consent_sync_bridge.h", "consent_sync_bridge_impl.cc", "consent_sync_bridge_impl.h",
diff --git a/components/consent_auditor/consent_auditor_unittest.cc b/components/consent_auditor/consent_auditor_unittest.cc index d23f278f..2152654 100644 --- a/components/consent_auditor/consent_auditor_unittest.cc +++ b/components/consent_auditor/consent_auditor_unittest.cc
@@ -73,25 +73,28 @@ pref_service_ = std::make_unique<TestingPrefServiceSimple>(); user_event_service_ = std::make_unique<syncer::FakeUserEventService>(); ConsentAuditor::RegisterProfilePrefs(pref_service_->registry()); - consent_auditor_ = std::make_unique<ConsentAuditor>( - pref_service_.get(), user_event_service_.get(), kCurrentAppVersion, - kCurrentAppLocale); + app_version_ = kCurrentAppVersion; + app_locale_ = kCurrentAppLocale; + BuildConsentAuditor(); } - void UpdateAppVersionAndLocale(const std::string& new_product_version, - const std::string& new_app_locale) { - // We'll have to recreate |consent_auditor| in order to update the version - // and locale. This is not a problem, as in reality we'd have to restart - // Chrome to update both, let alone just recreate this class. + void BuildConsentAuditor() { consent_auditor_ = std::make_unique<ConsentAuditor>( - pref_service_.get(), user_event_service_.get(), new_product_version, - new_app_locale); + pref_service_.get(), user_event_service_.get(), app_version_, + app_locale_); + } + + // These have no effect before |BuildConsentAuditor|. + void SetAppVersion(const std::string& new_app_version) { + app_version_ = new_app_version; + } + + void SetAppLocale(const std::string& new_app_locale) { + app_locale_ = new_app_locale; } ConsentAuditor* consent_auditor() { return consent_auditor_.get(); } - PrefService* pref_service() const { return pref_service_.get(); } - syncer::FakeUserEventService* user_event_service() { return user_event_service_.get(); } @@ -100,9 +103,15 @@ std::unique_ptr<ConsentAuditor> consent_auditor_; std::unique_ptr<TestingPrefServiceSimple> pref_service_; std::unique_ptr<syncer::FakeUserEventService> user_event_service_; + std::string app_version_; + std::string app_locale_; }; TEST_F(ConsentAuditorTest, LocalConsentPrefRepresentation) { + SetAppVersion(kCurrentAppVersion); + SetAppLocale(kCurrentAppLocale); + BuildConsentAuditor(); + // No consents are written at first. EXPECT_FALSE(pref_service()->HasPrefPath(prefs::kLocalConsentsDictionary)); @@ -149,7 +158,12 @@ const std::string kFeature2NewConfirmation = "Yes again."; const std::string kFeature2NewAppVersion = "5.6.7.8"; const std::string kFeature2NewAppLocale = "de"; - UpdateAppVersionAndLocale(kFeature2NewAppVersion, kFeature2NewAppLocale); + SetAppVersion(kFeature2NewAppVersion); + SetAppLocale(kFeature2NewAppLocale); + // We rebuild consent auditor to emulate restarting Chrome. This is the only + // way to change app version or app locale. + BuildConsentAuditor(); + consent_auditor()->RecordLocalConsent("feature2", kFeature2NewDescription, kFeature2NewConfirmation); LoadEntriesFromLocalConsentRecord(consents, "feature2", &description, @@ -180,6 +194,10 @@ } TEST_F(ConsentAuditorTest, RecordGaiaConsent) { + SetAppVersion(kCurrentAppVersion); + SetAppLocale(kCurrentAppLocale); + BuildConsentAuditor(); + std::vector<int> kDescriptionMessageIds = {12, 37, 42}; int kConfirmationMessageId = 47; base::Time t1 = base::Time::Now();
diff --git a/components/consent_auditor/consent_sync_bridge.cc b/components/consent_auditor/consent_sync_bridge.cc deleted file mode 100644 index a887a89..0000000 --- a/components/consent_auditor/consent_sync_bridge.cc +++ /dev/null
@@ -1,15 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/consent_auditor/consent_sync_bridge.h" - -#include "components/sync/protocol/sync.pb.h" - -namespace syncer { - -ConsentSyncBridge::ConsentSyncBridge( - std::unique_ptr<ModelTypeChangeProcessor> change_processor) - : ModelTypeSyncBridge(std::move(change_processor)) {} - -} // namespace syncer
diff --git a/components/consent_auditor/consent_sync_bridge.h b/components/consent_auditor/consent_sync_bridge.h index 098cdf1..49a2f3a5 100644 --- a/components/consent_auditor/consent_sync_bridge.h +++ b/components/consent_auditor/consent_sync_bridge.h
@@ -7,21 +7,22 @@ #include <memory> -#include "components/sync/model/model_type_change_processor.h" -#include "components/sync/model/model_type_sync_bridge.h" +#include "base/memory/weak_ptr.h" +#include "components/sync/model/model_type_controller_delegate.h" namespace syncer { -// TODO(vitaliii): Don't inherit from ModelTypeSyncBridge, but add -// GetControllerDelegateOnUIThread() method instead. -class ConsentSyncBridge : public ModelTypeSyncBridge { +class ConsentSyncBridge { public: - explicit ConsentSyncBridge( - std::unique_ptr<ModelTypeChangeProcessor> change_processor); - ~ConsentSyncBridge() override = default; + ConsentSyncBridge() = default; + virtual ~ConsentSyncBridge() = default; virtual void RecordConsent( std::unique_ptr<sync_pb::UserConsentSpecifics> specifics) = 0; + + // Returns the delegate for the controller, i.e. sync integration point. + virtual base::WeakPtr<syncer::ModelTypeControllerDelegate> + GetControllerDelegateOnUIThread() = 0; }; } // namespace syncer
diff --git a/components/consent_auditor/consent_sync_bridge_impl.cc b/components/consent_auditor/consent_sync_bridge_impl.cc index 9c5c4ae..eb3cfc3 100644 --- a/components/consent_auditor/consent_sync_bridge_impl.cc +++ b/components/consent_auditor/consent_sync_bridge_impl.cc
@@ -66,7 +66,7 @@ OnceModelTypeStoreFactory store_factory, std::unique_ptr<ModelTypeChangeProcessor> change_processor, base::RepeatingCallback<std::string()> authenticated_account_id_callback) - : ConsentSyncBridge(std::move(change_processor)), + : ModelTypeSyncBridge(std::move(change_processor)), authenticated_account_id_callback_(authenticated_account_id_callback), is_sync_starting_or_started_(false) { DCHECK(authenticated_account_id_callback_); @@ -223,6 +223,11 @@ base::BindOnce(&ConsentSyncBridgeImpl::OnCommit, base::AsWeakPtr(this))); } +base::WeakPtr<syncer::ModelTypeControllerDelegate> +ConsentSyncBridgeImpl::GetControllerDelegateOnUIThread() { + return change_processor()->GetControllerDelegateOnUIThread(); +} + void ConsentSyncBridgeImpl::ProcessQueuedEvents() { DCHECK(change_processor()->IsTrackingMetadata()); for (std::unique_ptr<sync_pb::UserConsentSpecifics>& event :
diff --git a/components/consent_auditor/consent_sync_bridge_impl.h b/components/consent_auditor/consent_sync_bridge_impl.h index 67d299f..5a83854e 100644 --- a/components/consent_auditor/consent_sync_bridge_impl.h +++ b/components/consent_auditor/consent_sync_bridge_impl.h
@@ -21,7 +21,8 @@ namespace syncer { -class ConsentSyncBridgeImpl : public ConsentSyncBridge { +class ConsentSyncBridgeImpl : public ConsentSyncBridge, + public ModelTypeSyncBridge { public: ConsentSyncBridgeImpl( OnceModelTypeStoreFactory store_factory, @@ -29,7 +30,7 @@ base::RepeatingCallback<std::string()> authenticated_account_id_callback); ~ConsentSyncBridgeImpl() override; - // ModelTypeSyncBridge (through ConsentSyncBridge) implementation. + // ModelTypeSyncBridge implementation. void OnSyncStarting() override; std::unique_ptr<MetadataChangeList> CreateMetadataChangeList() override; base::Optional<ModelError> MergeSyncData( @@ -48,6 +49,8 @@ // ConsentSyncBridge implementation. void RecordConsent( std::unique_ptr<sync_pb::UserConsentSpecifics> specifics) override; + base::WeakPtr<syncer::ModelTypeControllerDelegate> + GetControllerDelegateOnUIThread() override; private: void RecordConsentImpl(
diff --git a/components/cryptauth/expiring_remote_device_cache.cc b/components/cryptauth/expiring_remote_device_cache.cc index 7cc4532..562fa67 100644 --- a/components/cryptauth/expiring_remote_device_cache.cc +++ b/components/cryptauth/expiring_remote_device_cache.cc
@@ -10,7 +10,8 @@ namespace cryptauth { ExpiringRemoteDeviceCache::ExpiringRemoteDeviceCache() - : remote_device_cache_(std::make_unique<RemoteDeviceCache>()) {} + : remote_device_cache_(RemoteDeviceCache::Factory::Get()->BuildInstance()) { +} ExpiringRemoteDeviceCache::~ExpiringRemoteDeviceCache() = default; @@ -46,4 +47,4 @@ return remote_device_cache_->GetRemoteDevice(device_id); } -} // namespace cryptauth \ No newline at end of file +} // namespace cryptauth
diff --git a/components/cryptauth/remote_device_cache.cc b/components/cryptauth/remote_device_cache.cc index 735c885..06b8919 100644 --- a/components/cryptauth/remote_device_cache.cc +++ b/components/cryptauth/remote_device_cache.cc
@@ -4,10 +4,35 @@ #include "components/cryptauth/remote_device_cache.h" +#include "base/memory/ptr_util.h" +#include "base/no_destructor.h" #include "base/stl_util.h" namespace cryptauth { +// static +RemoteDeviceCache::Factory* RemoteDeviceCache::Factory::test_factory_ = nullptr; + +// static +RemoteDeviceCache::Factory* RemoteDeviceCache::Factory::Get() { + if (test_factory_) + return test_factory_; + + static base::NoDestructor<Factory> factory; + return factory.get(); +} + +// static +void RemoteDeviceCache::Factory::SetFactoryForTesting(Factory* test_factory) { + test_factory_ = test_factory; +} + +RemoteDeviceCache::Factory::~Factory() = default; + +std::unique_ptr<RemoteDeviceCache> RemoteDeviceCache::Factory::BuildInstance() { + return base::WrapUnique(new RemoteDeviceCache()); +} + RemoteDeviceCache::RemoteDeviceCache() = default; RemoteDeviceCache::~RemoteDeviceCache() = default; @@ -48,4 +73,4 @@ return RemoteDeviceRef(remote_device_map_.at(device_id)); } -} // namespace cryptauth \ No newline at end of file +} // namespace cryptauth
diff --git a/components/cryptauth/remote_device_cache.h b/components/cryptauth/remote_device_cache.h index 2e9cfc3..b693520b 100644 --- a/components/cryptauth/remote_device_cache.h +++ b/components/cryptauth/remote_device_cache.h
@@ -21,7 +21,17 @@ // devices are not deleted from the cache). class RemoteDeviceCache { public: - RemoteDeviceCache(); + class Factory { + public: + static Factory* Get(); + static void SetFactoryForTesting(Factory* test_factory); + virtual ~Factory(); + virtual std::unique_ptr<RemoteDeviceCache> BuildInstance(); + + private: + static Factory* test_factory_; + }; + virtual ~RemoteDeviceCache(); void SetRemoteDevices(const RemoteDeviceList& remote_devices); @@ -32,6 +42,8 @@ const std::string& device_id) const; private: + RemoteDeviceCache(); + std::unordered_map<std::string, std::shared_ptr<RemoteDevice>> remote_device_map_;
diff --git a/components/cryptauth/remote_device_cache_unittest.cc b/components/cryptauth/remote_device_cache_unittest.cc index 55b06c1..700aaaea 100644 --- a/components/cryptauth/remote_device_cache_unittest.cc +++ b/components/cryptauth/remote_device_cache_unittest.cc
@@ -18,7 +18,9 @@ test_remote_device_ref_list_(CreateRemoteDeviceRefListForTest(5)){}; // testing::Test: - void SetUp() override { cache_ = std::make_unique<RemoteDeviceCache>(); } + void SetUp() override { + cache_ = RemoteDeviceCache::Factory::Get()->BuildInstance(); + } void VerifyCacheRemoteDevices( RemoteDeviceRefList expected_remote_device_ref_list) { @@ -80,4 +82,4 @@ EXPECT_EQ(remote_device.name, remote_device_ref.name()); } -} // namespace cryptauth \ No newline at end of file +} // namespace cryptauth
diff --git a/components/cryptauth/remote_device_ref.h b/components/cryptauth/remote_device_ref.h index f02ec6c3..01a0c00 100644 --- a/components/cryptauth/remote_device_ref.h +++ b/components/cryptauth/remote_device_ref.h
@@ -92,6 +92,8 @@ friend class RemoteDeviceCache; friend class RemoteDeviceRefBuilder; friend class RemoteDeviceRefTest; + friend bool IsSameDevice(const cryptauth::RemoteDevice& remote_device, + cryptauth::RemoteDeviceRef remote_device_ref); FRIEND_TEST_ALL_PREFIXES(RemoteDeviceRefTest, TestFields); FRIEND_TEST_ALL_PREFIXES(RemoteDeviceRefTest, TestCopyAndAssign); @@ -112,4 +114,4 @@ } // namespace cryptauth -#endif // COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_REF_H_ \ No newline at end of file +#endif // COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_REF_H_
diff --git a/components/cryptauth/remote_device_test_util.cc b/components/cryptauth/remote_device_test_util.cc index 062dfed..b3bca6e1 100644 --- a/components/cryptauth/remote_device_test_util.cc +++ b/components/cryptauth/remote_device_test_util.cc
@@ -58,12 +58,14 @@ } RemoteDevice CreateRemoteDeviceForTest() { - return RemoteDevice(kTestRemoteDeviceUserId, kTestRemoteDeviceName, + RemoteDevice device(kTestRemoteDeviceUserId, kTestRemoteDeviceName, kTestRemoteDevicePublicKey, kTestRemoteDevicePSK, kTestRemoteDeviceUnlockKey, kTestRemoteDeviceSupportsMobileHotspot, kTestRemoteDeviceLastUpdateTimeMillis, std::map<SoftwareFeature, SoftwareFeatureState>()); + device.LoadBeaconSeeds({}); + return device; } RemoteDeviceRef CreateRemoteDeviceRefForTest() { @@ -96,4 +98,12 @@ return generated_devices; } +bool IsSameDevice(const cryptauth::RemoteDevice& remote_device, + cryptauth::RemoteDeviceRef remote_device_ref) { + if (!remote_device_ref.remote_device_) + return false; + + return remote_device == *remote_device_ref.remote_device_; +} + } // namespace cryptauth
diff --git a/components/cryptauth/remote_device_test_util.h b/components/cryptauth/remote_device_test_util.h index b372c3e..dc1b1b4 100644 --- a/components/cryptauth/remote_device_test_util.h +++ b/components/cryptauth/remote_device_test_util.h
@@ -40,6 +40,9 @@ RemoteDeviceRefList CreateRemoteDeviceRefListForTest(size_t num_to_create); +bool IsSameDevice(const cryptauth::RemoteDevice& remote_device, + cryptauth::RemoteDeviceRef remote_device_ref); + } // namespace cryptauth #endif // COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_TEST_UTIL_H_
diff --git a/components/keyed_service/content/browser_context_dependency_manager.cc b/components/keyed_service/content/browser_context_dependency_manager.cc index fe134b9..e9cf9d39 100644 --- a/components/keyed_service/content/browser_context_dependency_manager.cc +++ b/components/keyed_service/content/browser_context_dependency_manager.cc
@@ -4,7 +4,7 @@ #include "components/keyed_service/content/browser_context_dependency_manager.h" -#include "base/memory/singleton.h" +#include "base/no_destructor.h" #include "base/trace_event/trace_event.h" #include "content/public/browser/browser_context.h" @@ -73,7 +73,8 @@ // static BrowserContextDependencyManager* BrowserContextDependencyManager::GetInstance() { - return base::Singleton<BrowserContextDependencyManager>::get(); + static base::NoDestructor<BrowserContextDependencyManager> factory; + return factory.get(); } BrowserContextDependencyManager::BrowserContextDependencyManager() {
diff --git a/components/keyed_service/content/browser_context_dependency_manager.h b/components/keyed_service/content/browser_context_dependency_manager.h index 0a6eb60..8320e2b 100644 --- a/components/keyed_service/content/browser_context_dependency_manager.h +++ b/components/keyed_service/content/browser_context_dependency_manager.h
@@ -16,7 +16,7 @@ namespace base { template <typename T> -struct DefaultSingletonTraits; +class NoDestructor; } // namespace base namespace content { @@ -85,7 +85,7 @@ private: friend class BrowserContextDependencyManagerUnittests; - friend struct base::DefaultSingletonTraits<BrowserContextDependencyManager>; + friend class base::NoDestructor<BrowserContextDependencyManager>; // Helper function used by CreateBrowserContextServices[ForTest]. void DoCreateBrowserContextServices(content::BrowserContext* context,
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index 1b89ee6..a2f18b6 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -145,7 +145,9 @@ # persistent IDs for all fields (but not for groups!) are needed. These are # specified by the 'id' keys of each policy. NEVER CHANGE EXISTING IDs, # because doing so would break the deployed wire format! -# For your editing convenience: highest ID currently used: 451 +# For your editing convenience: +# The highest ID currently used is always set in the +# 'highest_id_currently_used' value at the end of this file. # And don't forget to also update the EnterprisePolicies enum of # histograms.xml (run 'python tools/metrics/histograms/update_policies.py'). # A policy can be delete if and only if a policy is never launched but has @@ -12286,5 +12288,6 @@ }, }, 'placeholders': [], - 'deleted_policy_ids': [412] + 'deleted_policy_ids': [412], + 'highest_id_currently_used': 451 }
diff --git a/components/policy/tools/syntax_check_policy_template_json.py b/components/policy/tools/syntax_check_policy_template_json.py index f2f98a1..c52ada5 100755 --- a/components/policy/tools/syntax_check_policy_template_json.py +++ b/components/policy/tools/syntax_check_policy_template_json.py
@@ -153,10 +153,22 @@ Holes would not be a technical problem, but we want to ensure that nobody accidentally omits IDs. ''' - for i in range(len(policy_ids)): + policy_count = len(policy_ids) + len(deleted_policy_ids) + for i in range(policy_count): if (i + 1) not in policy_ids and (i + 1) not in deleted_policy_ids: self._Error('No policy with id: %s' % (i + 1)) + def _CheckHighestId(self, policy_ids, highest_id): + ''' + Checks that the 'highest_id_currently_used' value is actually set to the + highest id in use by any policy. + ''' + highest_id_in_policies = max(policy_ids) + if highest_id != highest_id_in_policies: + self._Error(("\'highest_id_currently_used\' must be set to the highest" + "policy id in use, which is currently %s (vs %s).") % + (highest_id_in_policies, highest_id)) + def _CheckPolicySchema(self, policy, policy_type): '''Checks that the 'schema' field matches the 'type' field.''' self._CheckContains(policy, 'schema', dict) @@ -540,11 +552,17 @@ parent_element=None, container_name='The root element', offending=None) + highest_id = self._CheckContains(data, 'highest_id_currently_used', int, + parent_element=None, + container_name='The root element', + offending=None) if policy_definitions is not None: policy_ids = set() for policy in policy_definitions: self._CheckPolicy(policy, False, policy_ids, deleted_policy_ids) self._CheckPolicyIDs(policy_ids, deleted_policy_ids) + if highest_id is not None: + self._CheckHighestId(policy_ids, highest_id) # Made it as a dict (policy_name -> True) to reuse _CheckContains.
diff --git a/components/sync/base/data_type_histogram.h b/components/sync/base/data_type_histogram.h index f34de939..170e3c84 100644 --- a/components/sync/base/data_type_histogram.h +++ b/components/sync/base/data_type_histogram.h
@@ -38,130 +38,133 @@ // in macros, pass in the histogram method directly as a parameter. // See http://connect.microsoft.com/VisualStudio/feedback/details/380090/ // variadic-macro-replacement#details -#define SYNC_DATA_TYPE_HISTOGRAM(datatype) \ - do { \ - switch (datatype) { \ - case ::syncer::BOOKMARKS: \ - PER_DATA_TYPE_MACRO("Bookmarks"); \ - break; \ - case ::syncer::PREFERENCES: \ - PER_DATA_TYPE_MACRO("Preferences"); \ - break; \ - case ::syncer::PASSWORDS: \ - PER_DATA_TYPE_MACRO("Passwords"); \ - break; \ - case ::syncer::AUTOFILL_PROFILE: \ - PER_DATA_TYPE_MACRO("AutofillProfiles"); \ - break; \ - case ::syncer::AUTOFILL: \ - PER_DATA_TYPE_MACRO("Autofill"); \ - break; \ - case ::syncer::AUTOFILL_WALLET_DATA: \ - PER_DATA_TYPE_MACRO("AutofillWallet"); \ - break; \ - case ::syncer::AUTOFILL_WALLET_METADATA: \ - PER_DATA_TYPE_MACRO("AutofillWalletMetadata"); \ - break; \ - case ::syncer::THEMES: \ - PER_DATA_TYPE_MACRO("Themes"); \ - break; \ - case ::syncer::TYPED_URLS: \ - PER_DATA_TYPE_MACRO("TypedUrls"); \ - break; \ - case ::syncer::EXTENSIONS: \ - PER_DATA_TYPE_MACRO("Extensions"); \ - break; \ - case ::syncer::SEARCH_ENGINES: \ - PER_DATA_TYPE_MACRO("SearchEngines"); \ - break; \ - case ::syncer::SESSIONS: \ - PER_DATA_TYPE_MACRO("Sessions"); \ - break; \ - case ::syncer::APPS: \ - PER_DATA_TYPE_MACRO("Apps"); \ - break; \ - case ::syncer::APP_SETTINGS: \ - PER_DATA_TYPE_MACRO("AppSettings"); \ - break; \ - case ::syncer::EXTENSION_SETTINGS: \ - PER_DATA_TYPE_MACRO("ExtensionSettings"); \ - break; \ - case ::syncer::APP_NOTIFICATIONS: \ - PER_DATA_TYPE_MACRO("AppNotifications"); \ - break; \ - case ::syncer::HISTORY_DELETE_DIRECTIVES: \ - PER_DATA_TYPE_MACRO("HistoryDeleteDirectives"); \ - break; \ - case ::syncer::SYNCED_NOTIFICATIONS: \ - PER_DATA_TYPE_MACRO("SyncedNotifications"); \ - break; \ - case ::syncer::SYNCED_NOTIFICATION_APP_INFO: \ - PER_DATA_TYPE_MACRO("SyncedNotificationAppInfo"); \ - break; \ - case ::syncer::DICTIONARY: \ - PER_DATA_TYPE_MACRO("Dictionary"); \ - break; \ - case ::syncer::FAVICON_IMAGES: \ - PER_DATA_TYPE_MACRO("FaviconImages"); \ - break; \ - case ::syncer::FAVICON_TRACKING: \ - PER_DATA_TYPE_MACRO("FaviconTracking"); \ - break; \ - case ::syncer::DEVICE_INFO: \ - PER_DATA_TYPE_MACRO("DeviceInfo"); \ - break; \ - case ::syncer::PRIORITY_PREFERENCES: \ - PER_DATA_TYPE_MACRO("PriorityPreferences"); \ - break; \ - case ::syncer::SUPERVISED_USER_SETTINGS: \ - PER_DATA_TYPE_MACRO("ManagedUserSetting"); \ - break; \ - case ::syncer::DEPRECATED_SUPERVISED_USERS: \ - PER_DATA_TYPE_MACRO("ManagedUser"); \ - break; \ - case ::syncer::DEPRECATED_SUPERVISED_USER_SHARED_SETTINGS:\ - PER_DATA_TYPE_MACRO("ManagedUserSharedSetting"); \ - break; \ - case ::syncer::ARTICLES: \ - PER_DATA_TYPE_MACRO("Article"); \ - break; \ - case ::syncer::APP_LIST: \ - PER_DATA_TYPE_MACRO("AppList"); \ - break; \ - case ::syncer::WIFI_CREDENTIALS: \ - PER_DATA_TYPE_MACRO("WifiCredentials"); \ - break; \ - case ::syncer::SUPERVISED_USER_WHITELISTS: \ - PER_DATA_TYPE_MACRO("ManagedUserWhitelist"); \ - break; \ - case ::syncer::ARC_PACKAGE: \ - PER_DATA_TYPE_MACRO("ArcPackage"); \ - break; \ - case ::syncer::PRINTERS: \ - PER_DATA_TYPE_MACRO("Printers"); \ - break; \ - case ::syncer::READING_LIST: \ - PER_DATA_TYPE_MACRO("ReadingList"); \ - break; \ - case ::syncer::USER_EVENTS: \ - PER_DATA_TYPE_MACRO("UserEvents"); \ - break; \ - case ::syncer::PROXY_TABS: \ - PER_DATA_TYPE_MACRO("Tabs"); \ - break; \ - case ::syncer::NIGORI: \ - PER_DATA_TYPE_MACRO("Nigori"); \ - break; \ - case ::syncer::EXPERIMENTS: \ - PER_DATA_TYPE_MACRO("Experiments"); \ - break; \ - case ::syncer::MOUNTAIN_SHARES: \ - PER_DATA_TYPE_MACRO("MountainShares"); \ - break; \ - default: \ - NOTREACHED() << "Unknown datatype " \ - << ::syncer::ModelTypeToString(datatype); \ - } \ +#define SYNC_DATA_TYPE_HISTOGRAM(datatype) \ + do { \ + switch (datatype) { \ + case ::syncer::BOOKMARKS: \ + PER_DATA_TYPE_MACRO("Bookmarks"); \ + break; \ + case ::syncer::PREFERENCES: \ + PER_DATA_TYPE_MACRO("Preferences"); \ + break; \ + case ::syncer::PASSWORDS: \ + PER_DATA_TYPE_MACRO("Passwords"); \ + break; \ + case ::syncer::AUTOFILL_PROFILE: \ + PER_DATA_TYPE_MACRO("AutofillProfiles"); \ + break; \ + case ::syncer::AUTOFILL: \ + PER_DATA_TYPE_MACRO("Autofill"); \ + break; \ + case ::syncer::AUTOFILL_WALLET_DATA: \ + PER_DATA_TYPE_MACRO("AutofillWallet"); \ + break; \ + case ::syncer::AUTOFILL_WALLET_METADATA: \ + PER_DATA_TYPE_MACRO("AutofillWalletMetadata"); \ + break; \ + case ::syncer::THEMES: \ + PER_DATA_TYPE_MACRO("Themes"); \ + break; \ + case ::syncer::TYPED_URLS: \ + PER_DATA_TYPE_MACRO("TypedUrls"); \ + break; \ + case ::syncer::EXTENSIONS: \ + PER_DATA_TYPE_MACRO("Extensions"); \ + break; \ + case ::syncer::SEARCH_ENGINES: \ + PER_DATA_TYPE_MACRO("SearchEngines"); \ + break; \ + case ::syncer::SESSIONS: \ + PER_DATA_TYPE_MACRO("Sessions"); \ + break; \ + case ::syncer::APPS: \ + PER_DATA_TYPE_MACRO("Apps"); \ + break; \ + case ::syncer::APP_SETTINGS: \ + PER_DATA_TYPE_MACRO("AppSettings"); \ + break; \ + case ::syncer::EXTENSION_SETTINGS: \ + PER_DATA_TYPE_MACRO("ExtensionSettings"); \ + break; \ + case ::syncer::APP_NOTIFICATIONS: \ + PER_DATA_TYPE_MACRO("AppNotifications"); \ + break; \ + case ::syncer::HISTORY_DELETE_DIRECTIVES: \ + PER_DATA_TYPE_MACRO("HistoryDeleteDirectives"); \ + break; \ + case ::syncer::SYNCED_NOTIFICATIONS: \ + PER_DATA_TYPE_MACRO("SyncedNotifications"); \ + break; \ + case ::syncer::SYNCED_NOTIFICATION_APP_INFO: \ + PER_DATA_TYPE_MACRO("SyncedNotificationAppInfo"); \ + break; \ + case ::syncer::DICTIONARY: \ + PER_DATA_TYPE_MACRO("Dictionary"); \ + break; \ + case ::syncer::FAVICON_IMAGES: \ + PER_DATA_TYPE_MACRO("FaviconImages"); \ + break; \ + case ::syncer::FAVICON_TRACKING: \ + PER_DATA_TYPE_MACRO("FaviconTracking"); \ + break; \ + case ::syncer::DEVICE_INFO: \ + PER_DATA_TYPE_MACRO("DeviceInfo"); \ + break; \ + case ::syncer::PRIORITY_PREFERENCES: \ + PER_DATA_TYPE_MACRO("PriorityPreferences"); \ + break; \ + case ::syncer::SUPERVISED_USER_SETTINGS: \ + PER_DATA_TYPE_MACRO("ManagedUserSetting"); \ + break; \ + case ::syncer::DEPRECATED_SUPERVISED_USERS: \ + PER_DATA_TYPE_MACRO("ManagedUser"); \ + break; \ + case ::syncer::DEPRECATED_SUPERVISED_USER_SHARED_SETTINGS: \ + PER_DATA_TYPE_MACRO("ManagedUserSharedSetting"); \ + break; \ + case ::syncer::ARTICLES: \ + PER_DATA_TYPE_MACRO("Article"); \ + break; \ + case ::syncer::APP_LIST: \ + PER_DATA_TYPE_MACRO("AppList"); \ + break; \ + case ::syncer::WIFI_CREDENTIALS: \ + PER_DATA_TYPE_MACRO("WifiCredentials"); \ + break; \ + case ::syncer::SUPERVISED_USER_WHITELISTS: \ + PER_DATA_TYPE_MACRO("ManagedUserWhitelist"); \ + break; \ + case ::syncer::ARC_PACKAGE: \ + PER_DATA_TYPE_MACRO("ArcPackage"); \ + break; \ + case ::syncer::PRINTERS: \ + PER_DATA_TYPE_MACRO("Printers"); \ + break; \ + case ::syncer::READING_LIST: \ + PER_DATA_TYPE_MACRO("ReadingList"); \ + break; \ + case ::syncer::USER_CONSENTS: \ + PER_DATA_TYPE_MACRO("UserConsents"); \ + break; \ + case ::syncer::USER_EVENTS: \ + PER_DATA_TYPE_MACRO("UserEvents"); \ + break; \ + case ::syncer::PROXY_TABS: \ + PER_DATA_TYPE_MACRO("Tabs"); \ + break; \ + case ::syncer::NIGORI: \ + PER_DATA_TYPE_MACRO("Nigori"); \ + break; \ + case ::syncer::EXPERIMENTS: \ + PER_DATA_TYPE_MACRO("Experiments"); \ + break; \ + case ::syncer::MOUNTAIN_SHARES: \ + PER_DATA_TYPE_MACRO("MountainShares"); \ + break; \ + default: \ + NOTREACHED() << "Unknown datatype " \ + << ::syncer::ModelTypeToString(datatype); \ + } \ } while (0) #endif // COMPONENTS_SYNC_BASE_DATA_TYPE_HISTOGRAM_H_
diff --git a/components/sync/base/model_type.h b/components/sync/base/model_type.h index d682f34..27f49e9 100644 --- a/components/sync/base/model_type.h +++ b/components/sync/base/model_type.h
@@ -133,6 +133,8 @@ USER_EVENTS, // Shares in project Mountain. MOUNTAIN_SHARES, + // Commit only user consents. + USER_CONSENTS, // ---- Proxy types ---- // Proxy types are excluded from the sync protocol, but are still considered @@ -201,17 +203,18 @@ // representations. This distinguishes them from Proxy types, which have no // protocol representation and are never sent to the server. constexpr ModelTypeSet ProtocolTypes() { - return ModelTypeSet( - BOOKMARKS, PREFERENCES, PASSWORDS, AUTOFILL_PROFILE, AUTOFILL, - AUTOFILL_WALLET_DATA, AUTOFILL_WALLET_METADATA, THEMES, TYPED_URLS, - EXTENSIONS, SEARCH_ENGINES, SESSIONS, APPS, APP_SETTINGS, - EXTENSION_SETTINGS, APP_NOTIFICATIONS, HISTORY_DELETE_DIRECTIVES, - SYNCED_NOTIFICATIONS, SYNCED_NOTIFICATION_APP_INFO, DICTIONARY, - FAVICON_IMAGES, FAVICON_TRACKING, DEVICE_INFO, PRIORITY_PREFERENCES, - SUPERVISED_USER_SETTINGS, DEPRECATED_SUPERVISED_USERS, - DEPRECATED_SUPERVISED_USER_SHARED_SETTINGS, ARTICLES, APP_LIST, - WIFI_CREDENTIALS, SUPERVISED_USER_WHITELISTS, ARC_PACKAGE, PRINTERS, - READING_LIST, USER_EVENTS, NIGORI, EXPERIMENTS, MOUNTAIN_SHARES); + return ModelTypeSet(BOOKMARKS, PREFERENCES, PASSWORDS, AUTOFILL_PROFILE, + AUTOFILL, AUTOFILL_WALLET_DATA, AUTOFILL_WALLET_METADATA, + THEMES, TYPED_URLS, EXTENSIONS, SEARCH_ENGINES, SESSIONS, + APPS, APP_SETTINGS, EXTENSION_SETTINGS, APP_NOTIFICATIONS, + HISTORY_DELETE_DIRECTIVES, SYNCED_NOTIFICATIONS, + SYNCED_NOTIFICATION_APP_INFO, DICTIONARY, FAVICON_IMAGES, + FAVICON_TRACKING, DEVICE_INFO, PRIORITY_PREFERENCES, + SUPERVISED_USER_SETTINGS, DEPRECATED_SUPERVISED_USERS, + DEPRECATED_SUPERVISED_USER_SHARED_SETTINGS, ARTICLES, + APP_LIST, WIFI_CREDENTIALS, SUPERVISED_USER_WHITELISTS, + ARC_PACKAGE, PRINTERS, READING_LIST, USER_EVENTS, NIGORI, + EXPERIMENTS, MOUNTAIN_SHARES, USER_CONSENTS); } // These are the normal user-controlled types. This is to distinguish from @@ -286,7 +289,7 @@ // Types that may commit data, but should never be included in a GetUpdates. constexpr ModelTypeSet CommitOnlyTypes() { - return ModelTypeSet(USER_EVENTS); + return ModelTypeSet(USER_EVENTS, USER_CONSENTS); } ModelTypeNameMap GetUserSelectableTypeNameMap();
diff --git a/components/sync/base/pref_names.cc b/components/sync/base/pref_names.cc index 4962fc9..712c0fa 100644 --- a/components/sync/base/pref_names.cc +++ b/components/sync/base/pref_names.cc
@@ -69,6 +69,7 @@ const char kSyncTabs[] = "sync.tabs"; const char kSyncThemes[] = "sync.themes"; const char kSyncTypedUrls[] = "sync.typed_urls"; +const char kSyncUserConsents[] = "sync.user_consents"; const char kSyncUserEvents[] = "sync.user_events"; const char kSyncWifiCredentials[] = "sync.wifi_credentials";
diff --git a/components/sync/base/pref_names.h b/components/sync/base/pref_names.h index d5f9a5e..a1f9300 100644 --- a/components/sync/base/pref_names.h +++ b/components/sync/base/pref_names.h
@@ -54,6 +54,7 @@ extern const char kSyncTabs[]; extern const char kSyncThemes[]; extern const char kSyncTypedUrls[]; +extern const char kSyncUserConsents[]; extern const char kSyncUserEvents[]; extern const char kSyncWifiCredentials[];
diff --git a/components/sync/base/sync_prefs.cc b/components/sync/base/sync_prefs.cc index dae064e..09edabb 100644 --- a/components/sync/base/sync_prefs.cc +++ b/components/sync/base/sync_prefs.cc
@@ -363,6 +363,8 @@ return prefs::kSyncTabs; case MOUNTAIN_SHARES: return prefs::kSyncMountainShares; + case USER_CONSENTS: + return prefs::kSyncUserConsents; case NIGORI: case EXPERIMENTS: case MODEL_TYPE_COUNT:
diff --git a/components/sync/driver/model_association_manager.cc b/components/sync/driver/model_association_manager.cc index 214e2ed..15e2210 100644 --- a/components/sync/driver/model_association_manager.cc +++ b/components/sync/driver/model_association_manager.cc
@@ -37,8 +37,9 @@ BOOKMARKS, PREFERENCES, PRIORITY_PREFERENCES, EXTENSIONS, APPS, APP_LIST, ARC_PACKAGE, READING_LIST, THEMES, SEARCH_ENGINES, SESSIONS, APP_NOTIFICATIONS, DICTIONARY, FAVICON_IMAGES, FAVICON_TRACKING, PRINTERS, - USER_EVENTS, SUPERVISED_USER_SETTINGS, SUPERVISED_USER_WHITELISTS, ARTICLES, - WIFI_CREDENTIALS, DEPRECATED_SUPERVISED_USERS, MOUNTAIN_SHARES, + USER_CONSENTS, USER_EVENTS, SUPERVISED_USER_SETTINGS, + SUPERVISED_USER_WHITELISTS, ARTICLES, WIFI_CREDENTIALS, + DEPRECATED_SUPERVISED_USERS, MOUNTAIN_SHARES, DEPRECATED_SUPERVISED_USER_SHARED_SETTINGS}; static_assert(arraysize(kStartOrder) ==
diff --git a/components/sync/protocol/proto_value_conversions_unittest.cc b/components/sync/protocol/proto_value_conversions_unittest.cc index e3f0566a..1cbb49c2 100644 --- a/components/sync/protocol/proto_value_conversions_unittest.cc +++ b/components/sync/protocol/proto_value_conversions_unittest.cc
@@ -55,7 +55,7 @@ } }; -static_assert(41 == syncer::MODEL_TYPE_COUNT, +static_assert(42 == syncer::MODEL_TYPE_COUNT, "When adding a new type, add a unit test for " "{NewType}SpecificsToValue below."); @@ -361,7 +361,7 @@ // TODO(akalin): Figure out how to better test EntitySpecificsToValue. TEST_F(ProtoValueConversionsTest, EntitySpecificsToValue) { - static_assert(41 == syncer::MODEL_TYPE_COUNT, + static_assert(42 == syncer::MODEL_TYPE_COUNT, "When adding a new type, add its field below."); sync_pb::EntitySpecifics specifics; @@ -404,6 +404,7 @@ SET_FIELD(synced_notification_app_info); SET_FIELD(theme); SET_FIELD(typed_url); + SET_FIELD(user_consent); SET_FIELD(user_event); SET_FIELD(wallet_metadata); SET_FIELD(wifi_credential);
diff --git a/components/sync/protocol/proto_visitors.h b/components/sync/protocol/proto_visitors.h index 9679dc4..6221284 100644 --- a/components/sync/protocol/proto_visitors.h +++ b/components/sync/protocol/proto_visitors.h
@@ -365,7 +365,7 @@ } VISIT_PROTO_FIELDS(const sync_pb::EntitySpecifics& proto) { - static_assert(41 == MODEL_TYPE_COUNT, + static_assert(42 == MODEL_TYPE_COUNT, "When adding a new protocol type, you will likely need to add " "it here as well."); VISIT(encrypted); @@ -885,6 +885,8 @@ VISIT_ENUM(interaction); } +// TODO(vitaliii): Delete once UserEventSpecifics::UserConsent is completely +// deprecated. VISIT_PROTO_FIELDS(const sync_pb::UserEventSpecifics::UserConsent& proto) { VISIT_ENUM(feature); VISIT_REP(description_grd_ids);
diff --git a/components/sync/syncable/model_type.cc b/components/sync/syncable/model_type.cc index f69086e..131b9906 100644 --- a/components/sync/syncable/model_type.cc +++ b/components/sync/syncable/model_type.cc
@@ -141,6 +141,8 @@ sync_pb::EntitySpecifics::kUserEventFieldNumber, 39}, {MOUNTAIN_SHARES, "MOUNTAIN_SHARE", "mountain_shares", "Mountain Shares", sync_pb::EntitySpecifics::kMountainShareFieldNumber, 40}, + {USER_CONSENTS, "USER_CONSENT", "user_consent", "User Consents", + sync_pb::EntitySpecifics::kUserConsentFieldNumber, 41}, // ---- Proxy types ---- {PROXY_TABS, "", "", "Tabs", -1, 25}, // ---- Control Types ---- @@ -153,11 +155,11 @@ static_assert(arraysize(kModelTypeInfoMap) == MODEL_TYPE_COUNT, "kModelTypeInfoMap should have MODEL_TYPE_COUNT elements"); -static_assert(41 == syncer::MODEL_TYPE_COUNT, +static_assert(42 == syncer::MODEL_TYPE_COUNT, "When adding a new type, update enum SyncModelTypes in enums.xml " "and suffix SyncModelType in histograms.xml."); -static_assert(41 == syncer::MODEL_TYPE_COUNT, +static_assert(42 == syncer::MODEL_TYPE_COUNT, "When adding a new type, update kAllocatorDumpNameWhitelist in " "base/trace_event/memory_infra_background_whitelist.cc."); @@ -275,6 +277,9 @@ case MOUNTAIN_SHARES: specifics->mutable_mountain_share(); break; + case USER_CONSENTS: + specifics->mutable_user_consent(); + break; case PROXY_TABS: NOTREACHED() << "No default field value for " << ModelTypeToString(type); break; @@ -344,7 +349,7 @@ } ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics) { - static_assert(41 == MODEL_TYPE_COUNT, + static_assert(42 == MODEL_TYPE_COUNT, "When adding new protocol types, the following type lookup " "logic must be updated."); if (specifics.has_bookmark()) @@ -419,6 +424,8 @@ return USER_EVENTS; if (specifics.has_mountain_share()) return MOUNTAIN_SHARES; + if (specifics.has_user_consent()) + return USER_CONSENTS; if (specifics.has_nigori()) return NIGORI; if (specifics.has_experiments()) @@ -440,7 +447,7 @@ } ModelTypeSet EncryptableUserTypes() { - static_assert(41 == MODEL_TYPE_COUNT, + static_assert(42 == MODEL_TYPE_COUNT, "If adding an unencryptable type, remove from " "encryptable_user_types below."); ModelTypeSet encryptable_user_types = UserTypes(); @@ -469,8 +476,10 @@ // Supervised user whitelists are not encrypted since they are managed // server-side. encryptable_user_types.Remove(SUPERVISED_USER_WHITELISTS); - // User events are not encrypted since they are consumed server-side. + // User events and consents are not encrypted since they are consumed + // server-side. encryptable_user_types.Remove(USER_EVENTS); + encryptable_user_types.Remove(USER_CONSENTS); // Proxy types have no sync representation and are therefore not encrypted. // Note however that proxy types map to one or more protocol types, which // may or may not be encrypted themselves.
diff --git a/components/sync/syncable/nigori_util.cc b/components/sync/syncable/nigori_util.cc index c29ce9b5..d96dd455 100644 --- a/components/sync/syncable/nigori_util.cc +++ b/components/sync/syncable/nigori_util.cc
@@ -246,7 +246,7 @@ bool encrypt_everything, sync_pb::NigoriSpecifics* nigori) { nigori->set_encrypt_everything(encrypt_everything); - static_assert(41 == MODEL_TYPE_COUNT, + static_assert(42 == MODEL_TYPE_COUNT, "If adding an encryptable type, update handling below."); nigori->set_encrypt_bookmarks(encrypted_types.Has(BOOKMARKS)); nigori->set_encrypt_preferences(encrypted_types.Has(PREFERENCES)); @@ -281,7 +281,7 @@ return ModelTypeSet::All(); ModelTypeSet encrypted_types; - static_assert(41 == MODEL_TYPE_COUNT, + static_assert(42 == MODEL_TYPE_COUNT, "If adding an encryptable type, update handling below."); if (nigori.encrypt_bookmarks()) encrypted_types.Put(BOOKMARKS);
diff --git a/content/browser/android/gesture_listener_manager.cc b/content/browser/android/gesture_listener_manager.cc index 2cee9bf..6bd8c0d 100644 --- a/content/browser/android/gesture_listener_manager.cc +++ b/content/browser/android/gesture_listener_manager.cc
@@ -149,48 +149,9 @@ ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); if (j_obj.is_null()) return; - - // TODO(jinsukkim): Define WebInputEvent in Java. - switch (event.GetType()) { - case WebInputEvent::kGestureFlingStart: - if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) { - // The view expects the fling velocity in pixels/s. - Java_GestureListenerManagerImpl_onFlingStartEventConsumed(env, j_obj); - } else { - // If a scroll ends with a fling, a SCROLL_END event is never sent. - // However, if that fling went unconsumed, we still need to let the - // listeners know that scrolling has ended. - Java_GestureListenerManagerImpl_onScrollEndEventAck(env, j_obj); - } - break; - case WebInputEvent::kGestureScrollBegin: - Java_GestureListenerManagerImpl_onScrollBeginEventAck(env, j_obj); - break; - case WebInputEvent::kGestureScrollUpdate: - if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) - Java_GestureListenerManagerImpl_onScrollUpdateGestureConsumed(env, - j_obj); - break; - case WebInputEvent::kGestureScrollEnd: - Java_GestureListenerManagerImpl_onScrollEndEventAck(env, j_obj); - break; - case WebInputEvent::kGesturePinchBegin: - Java_GestureListenerManagerImpl_onPinchBeginEventAck(env, j_obj); - break; - case WebInputEvent::kGesturePinchEnd: - Java_GestureListenerManagerImpl_onPinchEndEventAck(env, j_obj); - break; - case WebInputEvent::kGestureTap: - Java_GestureListenerManagerImpl_onSingleTapEventAck( - env, j_obj, ack_result == INPUT_EVENT_ACK_STATE_CONSUMED); - break; - case WebInputEvent::kGestureLongPress: - if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) - Java_GestureListenerManagerImpl_onLongPressAck(env, j_obj); - break; - default: - break; - } + Java_GestureListenerManagerImpl_onEventAck( + env, j_obj, event.GetType(), + ack_result == INPUT_EVENT_ACK_STATE_CONSUMED); } void GestureListenerManager::DidStopFlinging() {
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index 9e84453..52559b2a 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -3356,20 +3356,9 @@ BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); if (base::FeatureList::IsEnabled(network::features::kNetworkService)) { - StoragePartitionImpl* storage_partition = - static_cast<StoragePartitionImpl*>(BrowserContext::GetStoragePartition( - GetSiteInstance()->GetBrowserContext(), GetSiteInstance())); - // TODO(https://crbug.com/813479): Investigate why we need to explicitly - // specify task runner for BrowserThread::IO here. - // Bind calls to the BindRegistry should come on to the IO thread by - // default, but it looks we need this in browser tests (but not in full - // chrome build), i.e. in content/browser/loader/prefetch_browsertest.cc. - registry_->AddInterface( - base::BindRepeating( - &PrefetchURLLoaderService::ConnectToService, - base::RetainedRef(storage_partition->GetPrefetchURLLoaderService()), - frame_tree_node_->frame_tree_node_id()), - BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); + registry_->AddInterface(base::BindRepeating( + &RenderFrameHostImpl::ConnectToPrefetchURLLoaderService, + base::Unretained(this))); } } @@ -3758,19 +3747,19 @@ } } + SaveSubresourceFactories(std::move(subresource_loader_factories)); + if (IsPerNavigationMojoInterfaceEnabled() && navigation_request_ && navigation_request_->GetCommitNavigationClient()) { navigation_request_->GetCommitNavigationClient()->CommitNavigation( head, common_params, request_params, - std::move(url_loader_client_endpoints), - std::move(subresource_loader_factories), + std::move(url_loader_client_endpoints), CloneSubresourceFactories(), std::move(subresource_overrides), std::move(controller), devtools_navigation_token); } else { GetNavigationControl()->CommitNavigation( head, common_params, request_params, - std::move(url_loader_client_endpoints), - std::move(subresource_loader_factories), + std::move(url_loader_client_endpoints), CloneSubresourceFactories(), std::move(subresource_overrides), std::move(controller), devtools_navigation_token, navigation_request_ @@ -3829,16 +3818,17 @@ std::move(default_factory_info), std::map<std::string, network::mojom::URLLoaderFactoryPtrInfo>()); } + SaveSubresourceFactories(std::move(subresource_loader_factories)); if (IsPerNavigationMojoInterfaceEnabled() && navigation_request_ && navigation_request_->GetCommitNavigationClient()) { navigation_request_->GetCommitNavigationClient()->CommitFailedNavigation( common_params, request_params, has_stale_copy_in_cache, error_code, - error_page_content, std::move(subresource_loader_factories)); + error_page_content, CloneSubresourceFactories()); } else { GetNavigationControl()->CommitFailedNavigation( common_params, request_params, has_stale_copy_in_cache, error_code, - error_page_content, std::move(subresource_loader_factories), + error_page_content, CloneSubresourceFactories(), base::BindOnce( &RenderFrameHostImpl::OnCrossDocumentCommitProcessed, base::Unretained(this), @@ -4335,8 +4325,9 @@ std::make_unique<URLLoaderFactoryBundleInfo>(); subresource_loader_factories->default_factory_info() = std::move(default_factory_info); + SaveSubresourceFactories(std::move(subresource_loader_factories)); GetNavigationControl()->UpdateSubresourceLoaderFactories( - std::move(subresource_loader_factories)); + CloneSubresourceFactories()); } void RenderFrameHostImpl::CreateNetworkServiceDefaultFactoryAndObserve( @@ -4635,6 +4626,30 @@ std::move(request)); } +void RenderFrameHostImpl::ConnectToPrefetchURLLoaderService( + blink::mojom::PrefetchURLLoaderServiceRequest request) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK(base::FeatureList::IsEnabled(network::features::kNetworkService)); + auto* storage_partition = + static_cast<StoragePartitionImpl*>(BrowserContext::GetStoragePartition( + GetSiteInstance()->GetBrowserContext(), GetSiteInstance())); + auto subresource_factories = CloneSubresourceFactories(); + // Make sure that file: URL is available only when the origin of the last + // commited URL is for file:. This should be always true as far as + // SaveSubresourceFactories() is called appropriately whenever the set of + // available subresource factories is updated. (Using CHECK as breaking this + // could break our security assumptions) + CHECK(subresource_factories->factories_info().find(url::kFileScheme) == + subresource_factories->factories_info().end() || + last_committed_url_.SchemeIsFile()); + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::BindOnce(&PrefetchURLLoaderService::ConnectToService, + storage_partition->GetPrefetchURLLoaderService(), + std::move(request), frame_tree_node_->frame_tree_node_id(), + std::move(subresource_factories))); +} + void RenderFrameHostImpl::OnMediaInterfaceFactoryConnectionError() { DCHECK(media_interface_proxy_); media_interface_proxy_.reset(); @@ -5103,4 +5118,22 @@ navigation_request_.reset(); } +void RenderFrameHostImpl::SaveSubresourceFactories( + std::unique_ptr<URLLoaderFactoryBundleInfo> bundle_info) { + subresource_loader_factories_bundle_ = nullptr; + if (bundle_info) { + subresource_loader_factories_bundle_ = + base::MakeRefCounted<URLLoaderFactoryBundle>(std::move(bundle_info)); + } +} + +std::unique_ptr<URLLoaderFactoryBundleInfo> +RenderFrameHostImpl::CloneSubresourceFactories() { + if (subresource_loader_factories_bundle_) { + return base::WrapUnique(static_cast<URLLoaderFactoryBundleInfo*>( + subresource_loader_factories_bundle_->Clone().release())); + } + return nullptr; +} + } // namespace content
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h index d8423c416..4164b70 100644 --- a/content/browser/frame_host/render_frame_host_impl.h +++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -64,6 +64,7 @@ #include "services/viz/public/interfaces/hit_test/input_target_client.mojom.h" #include "third_party/blink/public/common/feature_policy/feature_policy.h" #include "third_party/blink/public/mojom/frame/find_in_page.mojom.h" +#include "third_party/blink/public/mojom/loader/prefetch_url_loader_service.mojom.h" #include "third_party/blink/public/platform/dedicated_worker_factory.mojom.h" #include "third_party/blink/public/platform/modules/bluetooth/web_bluetooth.mojom.h" #include "third_party/blink/public/platform/modules/presentation/presentation.mojom.h" @@ -1047,6 +1048,9 @@ void CreateDedicatedWorkerHostFactory( blink::mojom::DedicatedWorkerFactoryRequest request); + void ConnectToPrefetchURLLoaderService( + blink::mojom::PrefetchURLLoaderServiceRequest request); + // Callback for connection error on the media::mojom::InterfaceFactory client. void OnMediaInterfaceFactoryConnectionError(); @@ -1160,6 +1164,12 @@ void OnCrossDocumentCommitProcessed(int64_t navigation_id, blink::mojom::CommitResult result); + // Saves and clones URLLoaderFactoryBundleInfo for subresource loading. + // Must be called every time subresource_factories_bundle is updated. + void SaveSubresourceFactories( + std::unique_ptr<URLLoaderFactoryBundleInfo> bundle_info); + std::unique_ptr<URLLoaderFactoryBundleInfo> CloneSubresourceFactories(); + // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a // refcount that calls Shutdown when it reaches zero. This allows each // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring @@ -1409,6 +1419,10 @@ ContentBrowserClient::NonNetworkURLLoaderFactoryMap non_network_url_loader_factories_; + // A bundle of subresource loader factories used by this frame. + // A clone of this bundle is sent to the renderer process. + scoped_refptr<URLLoaderFactoryBundle> subresource_loader_factories_bundle_; + // Bitfield for renderer-side state that blocks fast shutdown of the frame. blink::WebSuddenTerminationDisablerType sudden_termination_disabler_types_enabled_ = 0;
diff --git a/content/browser/loader/prefetch_url_loader_service.cc b/content/browser/loader/prefetch_url_loader_service.cc index a8c1638..f764242 100644 --- a/content/browser/loader/prefetch_url_loader_service.cc +++ b/content/browser/loader/prefetch_url_loader_service.cc
@@ -20,9 +20,22 @@ namespace content { -PrefetchURLLoaderService::PrefetchURLLoaderService( - scoped_refptr<URLLoaderFactoryGetter> factory_getter) - : loader_factory_getter_(std::move(factory_getter)) {} +struct PrefetchURLLoaderService::BindContext { + BindContext(int frame_tree_node_id, + scoped_refptr<URLLoaderFactoryBundle> factory) + : frame_tree_node_id(frame_tree_node_id), factory(factory) {} + + explicit BindContext(const std::unique_ptr<BindContext>& other) + : frame_tree_node_id(other->frame_tree_node_id), + factory(other->factory) {} + + ~BindContext() = default; + + const int frame_tree_node_id; + scoped_refptr<URLLoaderFactoryBundle> factory; +}; + +PrefetchURLLoaderService::PrefetchURLLoaderService() = default; void PrefetchURLLoaderService::InitializeResourceContext( ResourceContext* resource_context, @@ -35,16 +48,15 @@ } void PrefetchURLLoaderService::ConnectToService( + blink::mojom::PrefetchURLLoaderServiceRequest request, int frame_tree_node_id, - blink::mojom::PrefetchURLLoaderServiceRequest request) { - if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::BindOnce(&PrefetchURLLoaderService::ConnectToService, this, - frame_tree_node_id, std::move(request))); - return; - } - service_bindings_.AddBinding(this, std::move(request), frame_tree_node_id); + std::unique_ptr<URLLoaderFactoryBundleInfo> factories) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); + auto factory_bundle = + base::MakeRefCounted<URLLoaderFactoryBundle>(std::move(factories)); + service_bindings_.AddBinding( + this, std::move(request), + std::make_unique<BindContext>(frame_tree_node_id, factory_bundle)); } void PrefetchURLLoaderService::CreateLoaderAndStart( @@ -85,8 +97,9 @@ void PrefetchURLLoaderService::GetFactory( network::mojom::URLLoaderFactoryRequest request) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - loader_factory_bindings_.AddBinding(this, std::move(request), - service_bindings_.dispatch_context()); + loader_factory_bindings_.AddBinding( + this, std::move(request), + std::make_unique<BindContext>(service_bindings_.dispatch_context())); } void PrefetchURLLoaderService::CreateLoaderAndStart( @@ -99,11 +112,11 @@ const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(base::FeatureList::IsEnabled(network::features::kNetworkService)); - int frame_tree_node_id = loader_factory_bindings_.dispatch_context(); + const auto& dispatch_context = *loader_factory_bindings_.dispatch_context(); + int frame_tree_node_id = dispatch_context.frame_tree_node_id; CreateLoaderAndStart( std::move(request), routing_id, request_id, options, resource_request, - std::move(client), traffic_annotation, - loader_factory_getter_->GetNetworkFactory(), + std::move(client), traffic_annotation, dispatch_context.factory, base::BindRepeating([](int id) { return id; }, frame_tree_node_id)); } @@ -111,7 +124,9 @@ network::mojom::URLLoaderFactoryRequest request) { DCHECK_CURRENTLY_ON(BrowserThread::IO); loader_factory_bindings_.AddBinding( - this, std::move(request), loader_factory_bindings_.dispatch_context()); + this, std::move(request), + std::make_unique<BindContext>( + loader_factory_bindings_.dispatch_context())); } std::vector<std::unique_ptr<content::URLLoaderThrottle>>
diff --git a/content/browser/loader/prefetch_url_loader_service.h b/content/browser/loader/prefetch_url_loader_service.h index 6573ee69..a8cce3f 100644 --- a/content/browser/loader/prefetch_url_loader_service.h +++ b/content/browser/loader/prefetch_url_loader_service.h
@@ -9,6 +9,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "content/common/content_export.h" +#include "content/common/url_loader_factory_bundle.h" #include "content/public/browser/browser_thread.h" #include "mojo/public/cpp/bindings/strong_binding_set.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" @@ -20,6 +21,7 @@ namespace network { class SharedURLLoaderFactory; +class URLLoaderFactoryBundleInfo; } namespace content { @@ -34,10 +36,7 @@ public network::mojom::URLLoaderFactory, public blink::mojom::PrefetchURLLoaderService { public: - // |factory_getter| could be null in non-NetworkService case. - // Created on the UI thread. - PrefetchURLLoaderService( - scoped_refptr<URLLoaderFactoryGetter> network_loader_factory); + PrefetchURLLoaderService(); // Must be called on the IO thread. The given |resource_context| will // be valid as far as request_context_getter returns non-null context. @@ -45,8 +44,10 @@ ResourceContext* resource_context, scoped_refptr<net::URLRequestContextGetter> request_context_getter); - void ConnectToService(int frame_tree_node_id, - blink::mojom::PrefetchURLLoaderServiceRequest request); + void ConnectToService( + blink::mojom::PrefetchURLLoaderServiceRequest request, + int frame_tree_node_id, + std::unique_ptr<URLLoaderFactoryBundleInfo> factory_info); // Used only when NetworkService is not enabled (or indirectly via the // other CreateLoaderAndStart when NetworkService is enabled). @@ -75,6 +76,8 @@ private: friend class base::DeleteHelper<content::PrefetchURLLoaderService>; friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; + struct BindContext; + ~PrefetchURLLoaderService() override; // blink::mojom::PrefetchURLLoaderService: @@ -98,7 +101,7 @@ base::RepeatingCallback<int(void)> frame_tree_node_id_getter); mojo::BindingSet<blink::mojom::PrefetchURLLoaderService, - int /* frame_tree_node_id */> + std::unique_ptr<BindContext>> service_bindings_; scoped_refptr<URLLoaderFactoryGetter> loader_factory_getter_; @@ -106,7 +109,7 @@ scoped_refptr<net::URLRequestContextGetter> request_context_getter_; mojo::BindingSet<network::mojom::URLLoaderFactory, - int /* frame_tree_node_id */> + std::unique_ptr<BindContext>> loader_factory_bindings_; base::RepeatingClosure prefetch_load_callback_for_testing_;
diff --git a/content/browser/renderer_interface_binders.cc b/content/browser/renderer_interface_binders.cc index e306536..7ebbd38 100644 --- a/content/browser/renderer_interface_binders.cc +++ b/content/browser/renderer_interface_binders.cc
@@ -28,7 +28,7 @@ #include "services/network/restricted_cookie_manager.h" #include "services/service_manager/public/cpp/binder_registry.h" #include "services/service_manager/public/cpp/connector.h" -#include "services/shape_detection/public/mojom/barcodedetection.mojom.h" +#include "services/shape_detection/public/mojom/barcodedetection_provider.mojom.h" #include "services/shape_detection/public/mojom/constants.mojom.h" #include "services/shape_detection/public/mojom/facedetection_provider.mojom.h" #include "services/shape_detection/public/mojom/textdetection.mojom.h" @@ -120,7 +120,7 @@ // override binders registered here. void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() { parameterized_binder_registry_.AddInterface(base::Bind( - &ForwardServiceRequest<shape_detection::mojom::BarcodeDetection>, + &ForwardServiceRequest<shape_detection::mojom::BarcodeDetectionProvider>, shape_detection::mojom::kServiceName)); parameterized_binder_registry_.AddInterface(base::Bind( &ForwardServiceRequest<shape_detection::mojom::FaceDetectionProvider>,
diff --git a/content/browser/service_worker/service_worker_browsertest.cc b/content/browser/service_worker/service_worker_browsertest.cc index 5423c4a..93861cf4 100644 --- a/content/browser/service_worker/service_worker_browsertest.cc +++ b/content/browser/service_worker/service_worker_browsertest.cc
@@ -205,6 +205,8 @@ const ServiceWorkerVersion* version = context_->GetLiveVersion(version_id); if (version->status() == ServiceWorkerVersion::ACTIVATED) { context_->RemoveObserver(this); + version_id_ = version_id; + registration_id_ = version->registration_id(); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&WorkerActivatedObserver::Quit, this)); @@ -212,12 +214,18 @@ } void Wait() { run_loop_.Run(); } + int64_t registration_id() { return registration_id_; } + int64_t version_id() { return version_id_; } + private: friend class base::RefCountedThreadSafe<WorkerActivatedObserver>; ~WorkerActivatedObserver() override {} void InitOnIOThread() { context_->AddObserver(this); } void Quit() { run_loop_.Quit(); } + int64_t registration_id_ = blink::mojom::kInvalidServiceWorkerRegistrationId; + int64_t version_id_ = blink::mojom::kInvalidServiceWorkerVersionId; + base::RunLoop run_loop_; ServiceWorkerContextWrapper* context_; DISALLOW_COPY_AND_ASSIGN(WorkerActivatedObserver); @@ -390,6 +398,24 @@ return info; } +// Returns a unique script for each request, to test service worker update. +std::unique_ptr<net::test_server::HttpResponse> RequestHandlerForUpdateWorker( + const net::test_server::HttpRequest& request) { + static int counter = 0; + + if (request.relative_url != "/service_worker/update_worker.js") + return std::unique_ptr<net::test_server::HttpResponse>(); + + auto http_response = std::make_unique<net::test_server::BasicHttpResponse>(); + http_response->set_code(net::HTTP_OK); + http_response->set_content( + base::StringPrintf("// empty script. counter = %d\n", counter++)); + http_response->set_content_type("text/javascript"); + // Use a large max-age to test the browser cache. + http_response->AddCustomHeader("Cache-Control", "max-age=31536000"); + return http_response; +} + const char kNavigationPreloadAbortError[] = "NetworkError: The service worker navigation preload request was cancelled " "before 'preloadResponse' settled. If you intend to use 'preloadResponse', " @@ -703,6 +729,20 @@ base::Unretained(this), status)); } + void UpdateRegistration(int64_t registration_id, + ServiceWorkerStatusCode* out_status, + bool* out_update_found) { + base::RunLoop update_run_loop; + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::BindOnce( + &self::UpdateOnIOThread, base::Unretained(this), registration_id, + base::BindOnce( + &self::ReceiveUpdateResultOnIOThread, base::Unretained(this), + update_run_loop.QuitClosure(), out_status, out_update_found))); + update_run_loop.Run(); + } + void FindRegistrationForId(int64_t id, const GURL& origin, ServiceWorkerStatusCode expected_status) { @@ -828,6 +868,32 @@ version_->CreateSimpleEventCallback(request_id)); } + void UpdateOnIOThread(int registration_id, + ServiceWorkerContextCore::UpdateCallback callback) { + ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); + ServiceWorkerRegistration* registration = + wrapper()->context()->GetLiveRegistration(registration_id); + ASSERT_TRUE(registration); + wrapper()->context()->UpdateServiceWorker( + registration, false /* force_bypass_cache */, + false /* skip_script_comparison */, std::move(callback)); + } + + void ReceiveUpdateResultOnIOThread(const base::RepeatingClosure& done_on_ui, + ServiceWorkerStatusCode* out_status, + bool* out_update_found, + ServiceWorkerStatusCode status, + const std::string& status_message, + int64_t registration_id) { + ServiceWorkerRegistration* registration = + wrapper()->context()->GetLiveRegistration(registration_id); + DCHECK(registration); + + *out_status = status; + *out_update_found = !!registration->installing_version(); + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, done_on_ui); + } + void FetchOnIOThread(const base::Closure& done, bool* prepare_result, FetchResult* result) { @@ -850,6 +916,18 @@ fetch_dispatcher_->Run(); } + void ResetLastUpdateCheckOnIOThread( + int64_t registration_id, + const base::RepeatingClosure& done_on_ui) { + ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); + ServiceWorkerRegistration* registration = + wrapper()->context()->GetLiveRegistration(registration_id); + ASSERT_TRUE(registration); + registration->set_last_update_check(base::Time::Now() - + base::TimeDelta::FromHours(24)); + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, done_on_ui); + } + // Contrary to the style guide, the output parameter of this function comes // before input parameters so Bind can be used on it to create a FetchCallback // to pass to DispatchFetchEvent. @@ -1319,6 +1397,64 @@ ASSERT_FALSE(blob_data_handle); } +// Tests that the browser cache is bypassed on update checks after 24 hours +// elapsed since the last update check that accessed network. +IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest, + UpdateBypassesCacheAfter24Hours) { + const char kScope[] = "/service_worker/handle_fetch.html"; + const char kWorkerUrl[] = "/service_worker/update_worker.js"; + + // Tell the server to return a new script for each `update_worker.js` request. + embedded_test_server()->RegisterRequestHandler( + base::BindRepeating(&RequestHandlerForUpdateWorker)); + StartServerAndNavigateToSetup(); + + // Register a service worker. + + // Make options. Set to kAll so updating exercises the browser cache. + blink::mojom::ServiceWorkerRegistrationOptions options( + embedded_test_server()->GetURL(kScope), + blink::mojom::ServiceWorkerUpdateViaCache::kAll); + + // Register and wait for activation. + auto observer = base::MakeRefCounted<WorkerActivatedObserver>(wrapper()); + observer->Init(); + public_context()->RegisterServiceWorker( + embedded_test_server()->GetURL(kWorkerUrl), options, + base::BindOnce(&ExpectResultAndRun, true, base::DoNothing())); + observer->Wait(); + int64_t registration_id = observer->registration_id(); + + // Try to update. The request should hit the browser cache so no update should + // be found. + { + ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_MAX_VALUE; + bool update_found = true; + UpdateRegistration(registration_id, &status, &update_found); + EXPECT_EQ(SERVICE_WORKER_OK, status); + EXPECT_FALSE(update_found); + } + + // Set the registration's last update time far in the past. + base::RunLoop time_run_loop; + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::BindOnce(&self::ResetLastUpdateCheckOnIOThread, + base::Unretained(this), registration_id, + time_run_loop.QuitClosure())); + time_run_loop.Run(); + + // Try to update again. The browser cache should be bypassed so the update + // should be found. + { + ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_MAX_VALUE; + bool update_found = false; + UpdateRegistration(registration_id, &status, &update_found); + EXPECT_EQ(SERVICE_WORKER_OK, status); + EXPECT_TRUE(update_found); + } +} + class MockContentBrowserClient : public TestContentBrowserClient { public: MockContentBrowserClient() @@ -2642,7 +2778,7 @@ } // The V8 code cache should be stored to the storage. It must have size - // greater than 12 bytes. + // greater than 16 bytes. EXPECT_GT(static_cast<int>(metadata_size_), kV8CacheTimeStampDataSize); // Stop the worker. @@ -2700,7 +2836,7 @@ cached_metadata_run_loop.Run(); // The V8 code cache should be stored to the storage. It must have size - // greater than 12 bytes. + // greater than 16 bytes. EXPECT_GT(static_cast<int>(metadata_size_), kV8CacheTimeStampDataSize); // Stop the worker. @@ -2875,7 +3011,7 @@ WaitUntilSideDataSizeIs(0); // Second load: The V8 code cache should be stored in CacheStorage. It must - // have size greater than 12 bytes. + // have size greater than 16 bytes. NavigateToTestPage(); WaitUntilSideDataSizeIsBiggerThan(kV8CacheTimeStampDataSize); }
diff --git a/content/browser/service_worker/service_worker_context_core.h b/content/browser/service_worker/service_worker_context_core.h index fa9bd0d..058e355 100644 --- a/content/browser/service_worker/service_worker_context_core.h +++ b/content/browser/service_worker/service_worker_context_core.h
@@ -210,6 +210,8 @@ // have passed since the last update, bypasses the browser cache. void UpdateServiceWorker(ServiceWorkerRegistration* registration, bool force_bypass_cache); + // |callback| is called when the promise for + // ServiceWorkerRegistration.update() would be resolved. void UpdateServiceWorker(ServiceWorkerRegistration* registration, bool force_bypass_cache, bool skip_script_comparison,
diff --git a/content/browser/service_worker/service_worker_installed_script_loader.cc b/content/browser/service_worker/service_worker_installed_script_loader.cc index 09bba61..0d61139 100644 --- a/content/browser/service_worker/service_worker_installed_script_loader.cc +++ b/content/browser/service_worker/service_worker_installed_script_loader.cc
@@ -82,6 +82,14 @@ head.ssl_info = info->ssl_info; client_->OnReceiveResponse(head, nullptr /* downloaded_file */); + + if (info->metadata) { + const uint8_t* data = + reinterpret_cast<const uint8_t*>(info->metadata->data()); + client_->OnReceiveCachedMetadata( + std::vector<uint8_t>(data, data + info->metadata->size())); + } + client_->OnStartLoadingResponseBody(std::move(body_handle_)); // We continue in OnFinished(). }
diff --git a/content/browser/service_worker/service_worker_script_loader_factory.cc b/content/browser/service_worker/service_worker_script_loader_factory.cc index 075e412..24b89fb 100644 --- a/content/browser/service_worker/service_worker_script_loader_factory.cc +++ b/content/browser/service_worker/service_worker_script_loader_factory.cc
@@ -39,7 +39,7 @@ network::mojom::URLLoaderClientPtr client, const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) { DCHECK(ServiceWorkerUtils::IsServicificationEnabled()); - if (!ShouldHandleScriptRequest(resource_request)) { + if (!CheckIfScriptRequestIsValid(resource_request)) { // If the request should not be handled, just do a passthrough load. This // needs a relaying as we use different associated message pipes. // TODO(kinuko): Record the reason like what we do with netlog in @@ -50,12 +50,22 @@ return; } - // If we get here, the service worker is not installed, so the script is - // usually not yet installed. However, there is a special case when an - // installing worker that imports the same script twice (e.g. - // importScripts('dupe.js'); importScripts('dupe.js');) or if it recursively - // imports the main script. In this case, read the installed script from - // storage. + // There are four cases of how to handle the request for the script. + // A) service worker is installed, script is installed: serve from storage + // (use ServceWorkerInstalledScriptLoader). Typically this case is handled + // by ServiceWorkerInstalledScriptsSender, but we can still get here when a + // new service worker starts up and becomes installed while it is running. + // B) service worker is installed, script is not installed: serve from direct + // network. This happens when the script is newly imported after + // installation. + // TODO(crbug.com/719052): deprecate this. + // C) service worker is not installed, script is installed: serve from + // storage (use ServceWorkerInstalledScriptLoader) + // D) service worker is not installed, script is not installed: serve from + // network with installing the script (use ServceWorkerNewScriptLoader) + // This is the common case: load the script and install it. + + // Case A and C: scoped_refptr<ServiceWorkerVersion> version = provider_host_->running_hosted_version(); int64_t resource_id = @@ -70,7 +80,17 @@ return; } - // The common case: load the script and install it. + // Case B: + if (ServiceWorkerVersion::IsInstalled(version->status())) { + // TODO(kinuko): Record the reason like what we do with netlog in + // ServiceWorkerContextRequestHandler. + loader_factory_->CreateLoaderAndStart( + std::move(request), routing_id, request_id, options, resource_request, + std::move(client), traffic_annotation); + return; + } + + // Case D: mojo::MakeStrongBinding( std::make_unique<ServiceWorkerNewScriptLoader>( routing_id, request_id, options, resource_request, std::move(client), @@ -84,7 +104,7 @@ bindings_.AddBinding(this, std::move(request)); } -bool ServiceWorkerScriptLoaderFactory::ShouldHandleScriptRequest( +bool ServiceWorkerScriptLoaderFactory::CheckIfScriptRequestIsValid( const network::ResourceRequest& resource_request) { if (!context_ || !provider_host_) return false; @@ -128,14 +148,6 @@ // TODO(falken): Make sure we don't handle a redirected request. - // For installed service workers, typically all the scripts are served via - // script streaming, so we don't come here. However, we still come here when - // the service worker is importing a script that was never installed. For now, - // return false here to fallback to network. Eventually, it should be - // deprecated (https://crbug.com/719052). - if (ServiceWorkerVersion::IsInstalled(version->status())) - return false; - return true; }
diff --git a/content/browser/service_worker/service_worker_script_loader_factory.h b/content/browser/service_worker/service_worker_script_loader_factory.h index acdd495..efc08ff 100644 --- a/content/browser/service_worker/service_worker_script_loader_factory.h +++ b/content/browser/service_worker/service_worker_script_loader_factory.h
@@ -55,7 +55,7 @@ void Clone(network::mojom::URLLoaderFactoryRequest request) override; private: - bool ShouldHandleScriptRequest( + bool CheckIfScriptRequestIsValid( const network::ResourceRequest& resource_request); base::WeakPtr<ServiceWorkerContextCore> context_;
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc index 891d949..fd4f120 100644 --- a/content/browser/storage_partition_impl.cc +++ b/content/browser/storage_partition_impl.cc
@@ -670,8 +670,7 @@ partition->url_loader_factory_getter_.get()); partition->prefetch_url_loader_service_ = - base::MakeRefCounted<PrefetchURLLoaderService>( - partition->url_loader_factory_getter_); + base::MakeRefCounted<PrefetchURLLoaderService>(); partition->cookie_store_context_ = base::MakeRefCounted<CookieStoreContext>(); // Unit tests use the Initialize() callback to crash early if restoring the
diff --git a/content/browser/web_package/signed_exchange_cert_fetcher.cc b/content/browser/web_package/signed_exchange_cert_fetcher.cc index 411e5f6..ba7014e 100644 --- a/content/browser/web_package/signed_exchange_cert_fetcher.cc +++ b/content/browser/web_package/signed_exchange_cert_fetcher.cc
@@ -148,8 +148,8 @@ } void SignedExchangeCertFetcher::OnHandleReady(MojoResult result) { - TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeCertFetcher::OnHandleReady"); + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), + "SignedExchangeCertFetcher::OnHandleReady"); const void* buffer = nullptr; uint32_t num_bytes = 0; MojoResult rv = @@ -157,8 +157,8 @@ if (rv == MOJO_RESULT_OK) { if (body_string_.size() + num_bytes > g_max_cert_size_for_signed_exchange) { body_->EndReadData(num_bytes); - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy_, "SignedExchangeCertFetcher::OnHandleReady", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy_, "The response body size of certificate message exceeds the limit."); Abort(); return; @@ -170,13 +170,11 @@ } else { DCHECK_EQ(MOJO_RESULT_SHOULD_WAIT, rv); } - TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeCertFetcher::OnHandleReady"); } void SignedExchangeCertFetcher::OnDataComplete() { - TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeCertFetcher::OnDataComplete"); + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), + "SignedExchangeCertFetcher::OnDataComplete"); DCHECK(callback_); url_loader_ = nullptr; body_.reset(); @@ -188,33 +186,29 @@ devtools_proxy_); body_string_.clear(); if (!cert_chain) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy_, "SignedExchangeCertFetcher::OnDataComplete", - "Failed to get certificate chain from message."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy_, "Failed to get certificate chain from message."); std::move(callback_).Run(nullptr); return; } std::move(callback_).Run(std::move(cert_chain)); - TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeCertFetcher::OnDataComplete"); } // network::mojom::URLLoaderClient void SignedExchangeCertFetcher::OnReceiveResponse( const network::ResourceResponseHead& head, network::mojom::DownloadedTempFilePtr downloaded_file) { + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), + "SignedExchangeCertFetcher::OnReceiveResponse"); if (devtools_proxy_) { DCHECK(cert_request_id_); devtools_proxy_->CertificateResponseReceived(*cert_request_id_, resource_request_->url, head); } - TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeCertFetcher::OnReceiveResponse"); if (head.headers->response_code() != net::HTTP_OK) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy_, "SignedExchangeCertFetcher::OnReceiveResponse", - base::StringPrintf("Invalid reponse code: %d", - head.headers->response_code())); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy_, base::StringPrintf("Invalid reponse code: %d", + head.headers->response_code())); Abort(); return; } @@ -225,8 +219,8 @@ std::string mime_type; if (!head.headers->GetMimeType(&mime_type) || mime_type != "application/cert-chain+cbor") { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy_, "SignedExchangeCertFetcher::OnReceiveResponse", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy_, base::StringPrintf( "Content type of cert-url must be application/cert-chain+cbor. " "Actual content type: %s", @@ -238,8 +232,8 @@ if (head.content_length > 0) { if (base::checked_cast<size_t>(head.content_length) > g_max_cert_size_for_signed_exchange) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy_, "SignedExchangeCertFetcher::OnReceiveResponse", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy_, base::StringPrintf("Invalid content length: %" PRIu64, head.content_length)); Abort(); @@ -247,8 +241,6 @@ } body_string_.reserve(head.content_length); } - TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeCertFetcher::OnReceiveResponse"); } void SignedExchangeCertFetcher::OnReceiveRedirect(
diff --git a/content/browser/web_package/signed_exchange_certificate_chain.cc b/content/browser/web_package/signed_exchange_certificate_chain.cc index 5707112..1fd297d9 100644 --- a/content/browser/web_package/signed_exchange_certificate_chain.cc +++ b/content/browser/web_package/signed_exchange_certificate_chain.cc
@@ -21,22 +21,22 @@ std::unique_ptr<SignedExchangeCertificateChain> ParseB1( base::span<const uint8_t> message, SignedExchangeDevToolsProxy* devtools_proxy) { - TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeCertificateChain::ParseB1"); + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), + "SignedExchangeCertificateChain::ParseB1"); cbor::CBORReader::DecoderError error; base::Optional<cbor::CBORValue> value = cbor::CBORReader::Read(message, &error); if (!value.has_value()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeCertificateChain::ParseB1", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf("Failed to decode CBORValue. CBOR error: %s", cbor::CBORReader::ErrorCodeToString(error))); return nullptr; } if (!value->is_array()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeCertificateChain::ParseB1", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf( "Expected top-level CBORValue to be an array. Actual type: %d", static_cast<int>(value->type()))); @@ -46,8 +46,8 @@ const cbor::CBORValue::ArrayValue& top_level_array = value->GetArray(); // Expect at least 2 elements (magic string and main certificate). if (top_level_array.size() < 2) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeCertificateChain::ParseB1", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf( "Expected top-level array to have at least 2 elements." "Actual element count: %" PRIuS, @@ -56,8 +56,8 @@ } if (!top_level_array[0].is_string() || top_level_array[0].GetString() != kCertChainCborMagic) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeCertificateChain::ParseB1", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "First element of cert chain CBOR does not match the magic string."); return nullptr; } @@ -69,8 +69,8 @@ for (size_t i = 1; i < top_level_array.size(); i++) { if (!top_level_array[i].is_map()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeCertificateChain::ParseB1", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf( "Expected certificate map, got non-map type at index %zu." " Actual type: %d", @@ -84,8 +84,8 @@ // properties of this certificate. [spec text] auto cert_iter = cert_map.find(cbor::CBORValue(kCertKey)); if (cert_iter == cert_map.end() || !cert_iter->second.is_bytestring()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeCertificateChain::ParseB1", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf( "cert is not found or not a bytestring, at index %zu.", i)); return nullptr; @@ -98,23 +98,22 @@ // DER-encoded OCSP response for that certificate (using the ASN.1 type // OCSPResponse defined in [RFC2560]). ... [spec text] if (ocsp_iter == cert_map.end() || !ocsp_iter->second.is_bytestring()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeCertificateChain::ParseB1", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "ocsp is not a bytestring, or not found in the first cert map."); return nullptr; } ocsp = ocsp_iter->second.GetBytestringAsString().as_string(); if (ocsp.empty()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeCertificateChain::ParseB1", - "ocsp must not be empty."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "ocsp must not be empty."); return nullptr; } } else if (ocsp_iter != cert_map.end()) { // Step 2. ... Subsequent certificates MUST NOT have an ocsp value. [spec // text] - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeCertificateChain::ParseB1", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf( "ocsp value found in a subsequent cert map, at index %zu.", i)); return nullptr; @@ -131,16 +130,14 @@ auto sct_iter = cert_map.find(cbor::CBORValue(kSctKey)); if (sct_iter != cert_map.end()) { if (!sct_iter->second.is_bytestring()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeCertificateChain::ParseB1", - "sct is not a bytestring."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "sct is not a bytestring."); return nullptr; } sct = sct_iter->second.GetBytestringAsString().as_string(); if (sct.empty()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeCertificateChain::ParseB1", - "sct must not be empty."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "sct must not be empty."); return nullptr; } } @@ -149,14 +146,11 @@ scoped_refptr<net::X509Certificate> cert = net::X509Certificate::CreateFromDERCertChain(der_certs); if (!cert) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeCertificateChain::ParseB1", - "X509Certificate::CreateFromDERCertChain failed."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "X509Certificate::CreateFromDERCertChain failed."); return nullptr; } - TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeCertificateChain::ParseB1"); return base::WrapUnique(new SignedExchangeCertificateChain(cert, ocsp, sct)); }
diff --git a/content/browser/web_package/signed_exchange_envelope.cc b/content/browser/web_package/signed_exchange_envelope.cc index baa80303..52fabfdf 100644 --- a/content/browser/web_package/signed_exchange_envelope.cc +++ b/content/browser/web_package/signed_exchange_envelope.cc
@@ -70,10 +70,10 @@ bool ParseRequestMap(const cbor::CBORValue& value, SignedExchangeEnvelope* out, SignedExchangeDevToolsProxy* devtools_proxy) { - TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("loading"), "ParseRequestMap"); + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), "ParseRequestMap"); if (!value.is_map()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseRequestMap", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf( "Expected request map, got non-map type. Actual type: %d", static_cast<int>(value.type()))); @@ -85,20 +85,19 @@ auto url_iter = request_map.find( cbor::CBORValue(kUrlKey, cbor::CBORValue::Type::BYTE_STRING)); if (url_iter == request_map.end() || !url_iter->second.is_bytestring()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseRequestMap", - ":url is not found or not a bytestring."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, ":url is not found or not a bytestring."); return false; } out->set_request_url(GURL(url_iter->second.GetBytestringAsString())); if (!out->request_url().is_valid()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseRequestMap", ":url is not a valid URL."); + signed_exchange_utils::ReportErrorAndTraceEvent(devtools_proxy, + ":url is not a valid URL."); return false; } if (out->request_url().has_ref()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseRequestMap", ":url can't have a fragment."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, ":url can't have a fragment."); return false; } @@ -106,9 +105,8 @@ cbor::CBORValue(kMethodKey, cbor::CBORValue::Type::BYTE_STRING)); if (method_iter == request_map.end() || !method_iter->second.is_bytestring()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseRequestMap", - ":method is not found or not a bytestring."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, ":method is not found or not a bytestring."); return false; } base::StringPiece method_str = method_iter->second.GetBytestringAsString(); @@ -117,8 +115,8 @@ // [spec text] if (!net::HttpUtil::IsMethodSafe(method_str.as_string()) || !IsMethodCacheable(method_str)) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseRequestMap", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf( "Request method is not safe or not cacheable. method: %s", method_str.as_string().c_str())); @@ -128,9 +126,8 @@ for (const auto& it : request_map) { if (!it.first.is_bytestring() || !it.second.is_bytestring()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseRequestMap", - "Non-bytestring value in the request map."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "Non-bytestring value in the request map."); return false; } base::StringPiece name_str = it.first.GetBytestringAsString(); @@ -140,8 +137,8 @@ // TODO(kouhei): Add spec ref here once // https://github.com/WICG/webpackage/issues/161 is resolved. if (name_str != base::ToLowerASCII(name_str)) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseRequestMap", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf( "Request header name should be lower-cased. header name: %s", name_str.as_string().c_str())); @@ -151,26 +148,24 @@ // 4. If exchange’s headers contain a stateful header field, as defined in // Section 4.1, return “invalid”. [spec text] if (IsStatefulRequestHeader(name_str)) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseRequestMap", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf( "Exchange contains stateful request header. header name: %s", name_str.as_string().c_str())); return false; } } - - TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("loading"), "ParseRequestMap"); return true; } bool ParseResponseMap(const cbor::CBORValue& value, SignedExchangeEnvelope* out, SignedExchangeDevToolsProxy* devtools_proxy) { - TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("loading"), "ParseResponseMap"); + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), "ParseResponseMap"); if (!value.is_map()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseResponseMap", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf( "Expected request map, got non-map type. Actual type: %d", static_cast<int>(value.type()))); @@ -182,35 +177,32 @@ cbor::CBORValue(kStatusKey, cbor::CBORValue::Type::BYTE_STRING)); if (status_iter == response_map.end() || !status_iter->second.is_bytestring()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseRequestMap", - ":status is not found or not a bytestring."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, ":status is not found or not a bytestring."); return false; } base::StringPiece response_code_str = status_iter->second.GetBytestringAsString(); int response_code; if (!base::StringToInt(response_code_str, &response_code)) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseRequestMap", - "Failed to parse status code to integer."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "Failed to parse status code to integer."); return false; } out->set_response_code(static_cast<net::HttpStatusCode>(response_code)); for (const auto& it : response_map) { if (!it.first.is_bytestring() || !it.second.is_bytestring()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseRequestMap", - "Non-bytestring value in the response map."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "Non-bytestring value in the response map."); return false; } base::StringPiece name_str = it.first.GetBytestringAsString(); if (name_str == kStatusKey) continue; if (!net::HttpUtil::IsValidHeaderName(name_str)) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseResponseMap", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf("Invalid header name. header_name: %s", name_str.as_string().c_str())); return false; @@ -219,8 +211,8 @@ // TODO(kouhei): Add spec ref here once // https://github.com/WICG/webpackage/issues/161 is resolved. if (name_str != base::ToLowerASCII(name_str)) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseResponseMap", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf( "Response header name should be lower-cased. header_name: %s", name_str.as_string().c_str())); @@ -230,8 +222,8 @@ // 4. If exchange’s headers contain a stateful header field, as defined in // Section 4.1, return “invalid”. [spec text] if (IsStatefulResponseHeader(name_str)) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseResponseMap", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf( "Exchange contains stateful response header. header_name: %s", name_str.as_string().c_str())); @@ -240,20 +232,18 @@ base::StringPiece value_str = it.second.GetBytestringAsString(); if (!net::HttpUtil::IsValidHeaderValue(value_str)) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseRequestMap", "Invalid header value."); + signed_exchange_utils::ReportErrorAndTraceEvent(devtools_proxy, + "Invalid header value."); return false; } if (!out->AddResponseHeader(name_str, value_str)) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "ParseResponseMap", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf("Duplicate header value. header_name: %s", name_str.as_string().c_str())); return false; } } - - TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("loading"), "ParseResponseMap"); return true; } @@ -264,21 +254,21 @@ base::StringPiece signature_header_field, base::span<const uint8_t> cbor_header, SignedExchangeDevToolsProxy* devtools_proxy) { - TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeEnvelope::Parse"); + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), + "SignedExchangeEnvelope::Parse"); cbor::CBORReader::DecoderError error; base::Optional<cbor::CBORValue> value = cbor::CBORReader::Read(cbor_header, &error); if (!value.has_value()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeEnvelope::Parse", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf("Failed to decode CBORValue. CBOR error: %s", cbor::CBORReader::ErrorCodeToString(error))); return base::nullopt; } if (!value->is_array()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeEnvelope::Parse", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf( "Expected top-level CBORValue to be an array. Actual type : %d", static_cast<int>(value->type()))); @@ -288,8 +278,8 @@ const cbor::CBORValue::ArrayValue& top_level_array = value->GetArray(); constexpr size_t kTopLevelArraySize = 2; if (top_level_array.size() != kTopLevelArraySize) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeEnvelope::Parse", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf("Expected top-level array to have 2 elements. " "Actual element count: %" PRIuS, top_level_array.size())); @@ -299,15 +289,13 @@ SignedExchangeEnvelope ret; if (!ParseRequestMap(top_level_array[0], &ret, devtools_proxy)) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeEnvelope::Parse", - "Failed to parse request map."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "Failed to parse request map."); return base::nullopt; } if (!ParseResponseMap(top_level_array[1], &ret, devtools_proxy)) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeEnvelope::Parse", - "Failed to parse response map."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "Failed to parse response map."); return base::nullopt; } @@ -315,16 +303,12 @@ signatures = SignedExchangeSignatureHeaderField::ParseSignature( signature_header_field, devtools_proxy); if (!signatures || signatures->empty()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeEnvelope::Parse", - "Failed to parse signature header field."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "Failed to parse signature header field."); return base::nullopt; } ret.signature_ = (*signatures)[0]; - - TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeEnvelope::Parse"); return std::move(ret); }
diff --git a/content/browser/web_package/signed_exchange_handler.cc b/content/browser/web_package/signed_exchange_handler.cc index 5bfef87..b4f7400 100644 --- a/content/browser/web_package/signed_exchange_handler.cc +++ b/content/browser/web_package/signed_exchange_handler.cc
@@ -83,8 +83,8 @@ devtools_proxy_(std::move(devtools_proxy)), weak_factory_(this) { DCHECK(signed_exchange_utils::IsSignedExchangeHandlingEnabled()); - TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeHandler::SignedExchangeHandler"); + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), + "SignedExchangeHandler::SignedExchangeHandler"); if (!SignedExchangeSignatureHeaderField::GetVersionParamFromContentType( content_type, &version_) || @@ -93,8 +93,8 @@ FROM_HERE, base::BindOnce(&SignedExchangeHandler::RunErrorCallback, weak_factory_.GetWeakPtr(), net::ERR_INVALID_SIGNED_EXCHANGE)); - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy_.get(), "SignedExchangeHandler::SignedExchangeHandler", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy_.get(), base::StringPrintf("Unsupported version of the content type. Currentry " "content type must be " "\"application/signed-exchange;v=b1\". But the " @@ -108,8 +108,6 @@ base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&SignedExchangeHandler::DoHeaderLoop, weak_factory_.GetWeakPtr())); - TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeHandler::SignedExchangeHandler"); } SignedExchangeHandler::~SignedExchangeHandler() = default; @@ -135,19 +133,19 @@ void SignedExchangeHandler::DidReadHeader(bool completed_syncly, int result) { DCHECK(state_ == State::kReadingPrologue || state_ == State::kReadingHeaders); - TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeHandler::DidReadHeader"); + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), + "SignedExchangeHandler::DidReadHeader"); if (result < 0) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy_.get(), "SignedExchangeHandler::DidReadHeader", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy_.get(), base::StringPrintf("Error reading body stream. result: %d", result)); RunErrorCallback(static_cast<net::Error>(result)); return; } if (result == 0) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy_.get(), "SignedExchangeHandler::DidReadHeader", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy_.get(), "Stream ended while reading signed exchange header."); RunErrorCallback(net::ERR_INVALID_SIGNED_EXCHANGE); return; @@ -174,12 +172,8 @@ } // We have finished reading headers, so return without queueing the next read. - if (state_ == State::kFetchingCertificate) { - TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeHandler::DidReadHeader", "state", - static_cast<int>(state_)); + if (state_ == State::kFetchingCertificate) return; - } // Trigger the next read. DCHECK(state_ == State::kReadingPrologue || state_ == State::kReadingHeaders); @@ -190,8 +184,6 @@ } else { DoHeaderLoop(); } - TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeHandler::DidReadHeader"); } bool SignedExchangeHandler::ParsePrologue() { @@ -211,8 +203,8 @@ } bool SignedExchangeHandler::ParseHeadersAndFetchCertificate() { - TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeHandler::ParseHeadersAndFetchCertificate"); + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), + "SignedExchangeHandler::ParseHeadersAndFetchCertificate"); DCHECK_EQ(state_, State::kReadingHeaders); base::StringPiece data(header_buf_->data(), header_read_buf_->size()); @@ -226,10 +218,8 @@ header_read_buf_ = nullptr; header_buf_ = nullptr; if (!header_) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy_.get(), - "SignedExchangeHandler::ParseHeadersAndFetchCertificate", - "Failed to parse SignedExchange header."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy_.get(), "Failed to parse SignedExchange header."); return false; } @@ -248,8 +238,6 @@ devtools_proxy_.get()); state_ = State::kFetchingCertificate; - TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeHandler::ParseHeadersAndFetchCertificate"); return true; } @@ -270,13 +258,12 @@ void SignedExchangeHandler::OnCertReceived( std::unique_ptr<SignedExchangeCertificateChain> cert_chain) { - TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeHandler::OnCertReceived"); + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), + "SignedExchangeHandler::OnCertReceived"); DCHECK_EQ(state_, State::kFetchingCertificate); if (!cert_chain) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy_.get(), "SignedExchangeHandler::OnCertReceived", - "Failed to fetch the certificate.", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy_.get(), "Failed to fetch the certificate.", std::make_pair(0 /* signature_index */, SignedExchangeError::Field::kSignatureCertUrl)); RunErrorCallback(net::ERR_INVALID_SIGNED_EXCHANGE); @@ -292,9 +279,8 @@ if (verify_result != SignedExchangeSignatureVerifier::Result::kSuccess) { base::Optional<SignedExchangeError::Field> error_field = SignedExchangeError::GetFieldFromSignatureVerifierResult(verify_result); - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy_.get(), "SignedExchangeHandler::OnCertReceived", - "Failed to verify the signed exchange header.", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy_.get(), "Failed to verify the signed exchange header.", error_field ? base::make_optional( std::make_pair(0 /* signature_index */, *error_field)) : base::nullopt); @@ -304,9 +290,8 @@ net::URLRequestContext* request_context = request_context_getter_->GetURLRequestContext(); if (!request_context) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy_.get(), "SignedExchangeHandler::OnCertReceived", - "No request context available."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy_.get(), "No request context available."); RunErrorCallback(net::ERR_CONTEXT_SHUT_DOWN); return; } @@ -330,9 +315,6 @@ // explicit state machines (eg: DoLoop() in //net). if (result != net::ERR_IO_PENDING) OnCertVerifyComplete(result); - - TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeHandler::OnCertReceived"); } bool SignedExchangeHandler::CheckOCSPStatus( @@ -353,12 +335,12 @@ } void SignedExchangeHandler::OnCertVerifyComplete(int result) { - TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeHandler::OnCertVerifyComplete"); + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), + "SignedExchangeHandler::OnCertVerifyComplete"); if (result != net::OK) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy_.get(), "SignedExchangeHandler::OnCertVerifyComplete", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy_.get(), base::StringPrintf("Certificate verification error: %s", net::ErrorToShortString(result).c_str()), std::make_pair(0 /* signature_index */, @@ -368,8 +350,8 @@ } if (!CheckOCSPStatus(cert_verify_result_.ocsp_result)) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy_.get(), "SignedExchangeHandler::OnCertVerifyComplete", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy_.get(), base::StringPrintf( "OCSP check failed. response status: %d, revocation status: %d", cert_verify_result_.ocsp_result.response_status, @@ -397,9 +379,8 @@ std::string mi_header_value; if (!response_head.headers->EnumerateHeader(nullptr, kMiHeader, &mi_header_value)) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy_.get(), "SignedExchangeHandler::OnCertVerifyComplete", - "Signed exchange has no MI: header"); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy_.get(), "Signed exchange has no MI: header"); RunErrorCallback(net::ERR_INVALID_SIGNED_EXCHANGE); return; } @@ -429,8 +410,6 @@ .Run(net::OK, header_->request_url(), header_->request_method(), response_head, std::move(mi_stream)); state_ = State::kHeadersCallbackCalled; - TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeHandler::OnCertVerifyComplete"); } } // namespace content
diff --git a/content/browser/web_package/signed_exchange_prologue.cc b/content/browser/web_package/signed_exchange_prologue.cc index 30f5c9a..3eb555f 100644 --- a/content/browser/web_package/signed_exchange_prologue.cc +++ b/content/browser/web_package/signed_exchange_prologue.cc
@@ -35,8 +35,8 @@ base::Optional<SignedExchangePrologue> SignedExchangePrologue::Parse( base::span<const uint8_t> input, SignedExchangeDevToolsProxy* devtools_proxy) { - TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangePrologue::Parse"); + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), + "SignedExchangePrologue::Parse"); CHECK_EQ(input.size(), kEncodedPrologueInBytes); @@ -49,8 +49,8 @@ if (memcmp(magic_string.data(), kSignedExchangeMagic, sizeof(kSignedExchangeMagic)) != 0) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangePrologue::Parse", "Wrong magic string"); + signed_exchange_utils::ReportErrorAndTraceEvent(devtools_proxy, + "Wrong magic string"); return base::nullopt; } @@ -59,15 +59,15 @@ size_t cbor_header_length = ParseEncodedLength(encoded_cbor_header_length); if (signature_header_field_length > kMaximumSignatureHeaderFieldLength) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangePrologue::Parse", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf("Signature header field too long: %zu", signature_header_field_length)); return base::nullopt; } if (cbor_header_length > kMaximumCBORHeaderLength) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangePrologue::Parse", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf("CBOR header too long: %zu", cbor_header_length)); return base::nullopt; }
diff --git a/content/browser/web_package/signed_exchange_signature_header_field.cc b/content/browser/web_package/signed_exchange_signature_header_field.cc index 5a6f0b2..a6d46f64 100644 --- a/content/browser/web_package/signed_exchange_signature_header_field.cc +++ b/content/browser/web_package/signed_exchange_signature_header_field.cc
@@ -194,16 +194,15 @@ SignedExchangeSignatureHeaderField::ParseSignature( base::StringPiece signature_str, SignedExchangeDevToolsProxy* devtools_proxy) { - TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeSignatureHeaderField::ParseSignature"); + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), + "SignedExchangeSignatureHeaderField::ParseSignature"); StructuredHeaderParser parser(signature_str); std::vector<ParameterisedIdentifier> values; parser.ParseParameterisedList(&values); if (!parser.ParsedSuccessfully()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeSignatureHeaderField::ParseSignature", - "Failed to parse signature header."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "Failed to parse signature header."); return base::nullopt; } @@ -215,34 +214,30 @@ sig.label = value.identifier; sig.sig = value.params[kSig]; if (sig.sig.empty()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeSignatureHeaderField::ParseSignature", - "'sig' parameter is not set,"); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "'sig' parameter is not set,"); return base::nullopt; } sig.integrity = value.params[kIntegrity]; if (sig.integrity.empty()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeSignatureHeaderField::ParseSignature", - "'integrity' parameter is not set."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "'integrity' parameter is not set."); return base::nullopt; } sig.cert_url = GURL(value.params[kCertUrl]); if (!sig.cert_url.is_valid() || sig.cert_url.has_ref()) { // TODO(https://crbug.com/819467) : When we will support "ed25519Key", the // params may not have "cert-url". - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeSignatureHeaderField::ParseSignature", - "'cert-url' parameter is not a valid URL."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "'cert-url' parameter is not a valid URL."); return base::nullopt; } const std::string cert_sha256_string = value.params[kCertSha256Key]; if (cert_sha256_string.size() != crypto::kSHA256Length) { // TODO(https://crbug.com/819467) : When we will support "ed25519Key", the // params may not have "cert-sha256". - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeSignatureHeaderField::ParseSignature", - "'cert-sha256' parameter is not a SHA-256 digest."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "'cert-sha256' parameter is not a SHA-256 digest."); return base::nullopt; } net::SHA256HashValue cert_sha256; @@ -252,32 +247,26 @@ // sig.ed25519_key = value.params["ed25519Key"]; sig.validity_url = GURL(value.params[kValidityUrlKey]); if (!sig.validity_url.is_valid()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeSignatureHeaderField::ParseSignature", - "'validity-url' parameter is not a valid URL."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "'validity-url' parameter is not a valid URL."); return base::nullopt; } if (sig.validity_url.has_ref()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeSignatureHeaderField::ParseSignature", - "'validity-url' parameter can't have a fragment."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "'validity-url' parameter can't have a fragment."); return base::nullopt; } if (!base::StringToUint64(value.params[kDateKey], &sig.date)) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeSignatureHeaderField::ParseSignature", - "'date' parameter is not a number."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "'date' parameter is not a number."); return base::nullopt; } if (!base::StringToUint64(value.params[kExpiresKey], &sig.expires)) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeSignatureHeaderField::ParseSignature", - "'expires' parameter is not a number."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "'expires' parameter is not a number."); return base::nullopt; } } - TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeSignatureHeaderField::ParseSignature"); return signatures; }
diff --git a/content/browser/web_package/signed_exchange_signature_verifier.cc b/content/browser/web_package/signed_exchange_signature_verifier.cc index 9aeda87..79181fc 100644 --- a/content/browser/web_package/signed_exchange_signature_verifier.cc +++ b/content/browser/web_package/signed_exchange_signature_verifier.cc
@@ -146,13 +146,13 @@ base::span<const uint8_t> msg, scoped_refptr<net::X509Certificate> cert, SignedExchangeDevToolsProxy* devtools_proxy) { - TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("loading"), "VerifySignature"); + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), "VerifySignature"); base::StringPiece spki; if (!net::asn1::ExtractSPKIFromDERCert( net::x509_util::CryptoBufferAsStringPiece(cert->cert_buffer()), &spki)) { - TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("loading"), "VerifySignature", - "error", "Failed to extract SPKI."); + signed_exchange_utils::ReportErrorAndTraceEvent(devtools_proxy, + "Failed to extract SPKI."); return false; } @@ -161,8 +161,8 @@ CBS_init(&cbs, reinterpret_cast<const uint8_t*>(spki.data()), spki.size()); bssl::UniquePtr<EVP_PKEY> pkey(EVP_parse_public_key(&cbs)); if (!pkey || CBS_len(&cbs) != 0) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "VerifySignature", "Failed to parse public key."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "Failed to parse public key."); return false; } switch (EVP_PKEY_id(pkey.get())) { @@ -177,33 +177,31 @@ algorithm = crypto::SignatureVerifier::ECDSA_SHA256; break; default: - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "VerifySignature", "Unsupported EC group."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "Unsupported EC group."); return false; } break; } default: - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "VerifySignature", "Unsupported public key type."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "Unsupported public key type."); return false; } crypto::SignatureVerifier verifier; if (!net::x509_util::SignatureVerifierInitWithCertificate( &verifier, algorithm, sig, cert->cert_buffer())) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "VerifySignature", - "SignatureVerifierInitWithCertificate failed."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "SignatureVerifierInitWithCertificate failed."); return false; } verifier.VerifyUpdate(msg); if (!verifier.VerifyFinal()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "VerifySignature", "VerifyFinal failed."); + signed_exchange_utils::ReportErrorAndTraceEvent(devtools_proxy, + "VerifyFinal failed."); return false; } - TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("loading"), "VerifySignature"); return true; } @@ -286,12 +284,12 @@ scoped_refptr<net::X509Certificate> certificate, const base::Time& verification_time, SignedExchangeDevToolsProxy* devtools_proxy) { - TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeSignatureVerifier::Verify"); + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), + "SignedExchangeSignatureVerifier::Verify"); if (!VerifyTimestamps(header, verification_time)) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeSignatureVerifier::Verify", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, base::StringPrintf( "Invalid timestamp. creation_time: %" PRIu64 ", expires_time: %" PRIu64 ", verification_time: %" PRIu64, @@ -301,16 +299,14 @@ } if (!certificate) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeSignatureVerifier::Verify", - "No certificate set."); + signed_exchange_utils::ReportErrorAndTraceEvent(devtools_proxy, + "No certificate set."); return Result::kErrNoCertificate; } if (!header.signature().cert_sha256.has_value()) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeSignatureVerifier::Verify", - "No cert-sha256 set."); + signed_exchange_utils::ReportErrorAndTraceEvent(devtools_proxy, + "No cert-sha256 set."); return Result::kErrNoCertificateSHA256; } @@ -318,17 +314,15 @@ if (*header.signature().cert_sha256 != net::X509Certificate::CalculateFingerprint256( certificate->cert_buffer())) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeSignatureVerifier::Verify", - "cert-sha256 mismatch."); + signed_exchange_utils::ReportErrorAndTraceEvent(devtools_proxy, + "cert-sha256 mismatch."); return Result::kErrCertificateSHA256Mismatch; } auto message = GenerateSignedMessage(header); if (!message) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeSignatureVerifier::Verify", - "Failed to reconstruct signed message."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "Failed to reconstruct signed message."); return Result::kErrInvalidSignatureFormat; } @@ -337,21 +331,17 @@ base::make_span(reinterpret_cast<const uint8_t*>(sig.data()), sig.size()), *message, certificate, devtools_proxy)) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeSignatureVerifier::Verify", - "Failed to verify signature \"sig\"."); + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "Failed to verify signature \"sig\"."); return Result::kErrSignatureVerificationFailed; } if (!base::EqualsCaseInsensitiveASCII(header.signature().integrity, "mi")) { - signed_exchange_utils::ReportErrorAndEndTraceEvent( - devtools_proxy, "SignedExchangeSignatureVerifier::Verify", + signed_exchange_utils::ReportErrorAndTraceEvent( + devtools_proxy, "The current implemention only supports \"mi\" integrity scheme."); return Result::kErrInvalidSignatureIntegrity; } - - TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("loading"), - "SignedExchangeSignatureVerifier::Verify"); return Result::kSuccess; }
diff --git a/content/browser/web_package/signed_exchange_utils.cc b/content/browser/web_package/signed_exchange_utils.cc index 4144465e..88559bf0 100644 --- a/content/browser/web_package/signed_exchange_utils.cc +++ b/content/browser/web_package/signed_exchange_utils.cc
@@ -17,15 +17,15 @@ namespace content { namespace signed_exchange_utils { -void ReportErrorAndEndTraceEvent( +void ReportErrorAndTraceEvent( SignedExchangeDevToolsProxy* devtools_proxy, - const char* trace_event_name, const std::string& error_message, base::Optional<SignedExchangeError::FieldIndexPair> error_field) { + TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("loading"), + "SignedExchangeError", TRACE_EVENT_SCOPE_THREAD, "error", + error_message); if (devtools_proxy) devtools_proxy->ReportError(error_message, std::move(error_field)); - TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("loading"), trace_event_name, - "error", error_message); } bool IsSignedExchangeHandlingEnabled() {
diff --git a/content/browser/web_package/signed_exchange_utils.h b/content/browser/web_package/signed_exchange_utils.h index 5c118be..105cd89 100644 --- a/content/browser/web_package/signed_exchange_utils.h +++ b/content/browser/web_package/signed_exchange_utils.h
@@ -23,11 +23,10 @@ namespace signed_exchange_utils { // Utility method to call SignedExchangeDevToolsProxy::ReportError() and -// TRACE_EVENT_END() to report the error to both DevTools and about:tracing. If -// |devtools_proxy| is nullptr, it just calls TRACE_EVENT_END(). -void ReportErrorAndEndTraceEvent( +// TRACE_EVENT_INSTANT1 to report the error to both DevTools and about:tracing. +// If |devtools_proxy| is nullptr, it just calls TRACE_EVENT_INSTANT1(). +void ReportErrorAndTraceEvent( SignedExchangeDevToolsProxy* devtools_proxy, - const char* trace_event_name, const std::string& error_message, base::Optional<SignedExchangeError::FieldIndexPair> error_field = base::nullopt);
diff --git a/content/browser/webrtc/webrtc_getusermedia_browsertest.cc b/content/browser/webrtc/webrtc_getusermedia_browsertest.cc index ac6f3a5..b55214f 100644 --- a/content/browser/webrtc/webrtc_getusermedia_browsertest.cc +++ b/content/browser/webrtc/webrtc_getusermedia_browsertest.cc
@@ -687,8 +687,9 @@ ExecuteJavascriptAndWaitForOk("srcObjectAddVideoTrack()"); } +// TODO(crbug.com/848330) Flaky on all platforms IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest, - SrcObjectReplaceInactiveTracks) { + DISABLE_SrcObjectReplaceInactiveTracks) { ASSERT_TRUE(embedded_test_server()->Start()); GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); NavigateToURL(shell(), url);
diff --git a/content/common/service_worker/service_worker_loader_helpers.cc b/content/common/service_worker/service_worker_loader_helpers.cc index 738ed31..9e43da8 100644 --- a/content/common/service_worker/service_worker_loader_helpers.cc +++ b/content/common/service_worker/service_worker_loader_helpers.cc
@@ -92,6 +92,7 @@ out_head->was_fallback_required_by_service_worker = false; out_head->url_list_via_service_worker = response.url_list; out_head->response_type_via_service_worker = response.response_type; + out_head->response_time = response.response_time; out_head->is_in_cache_storage = response.is_in_cache_storage; out_head->cache_storage_cache_name = response.cache_storage_cache_name; out_head->cors_exposed_header_names = response.cors_exposed_header_names;
diff --git a/content/public/android/java/src/org/chromium/content/browser/GestureListenerManagerImpl.java b/content/public/android/java/src/org/chromium/content/browser/GestureListenerManagerImpl.java index 17b41f9a..0930635 100644 --- a/content/public/android/java/src/org/chromium/content/browser/GestureListenerManagerImpl.java +++ b/content/public/android/java/src/org/chromium/content/browser/GestureListenerManagerImpl.java
@@ -12,6 +12,7 @@ import org.chromium.base.TraceEvent; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; +import org.chromium.blink_public.web.WebInputEventType; import org.chromium.content.browser.input.ImeAdapterImpl; import org.chromium.content.browser.selection.SelectionPopupControllerImpl; import org.chromium.content.browser.webcontents.WebContentsImpl; @@ -187,57 +188,67 @@ } @CalledByNative - private void onFlingStartEventConsumed() { - mPotentiallyActiveFlingCount++; - setTouchScrollInProgress(false); - for (mIterator.rewind(); mIterator.hasNext();) { - mIterator.next().onFlingStartGesture(verticalScrollOffset(), verticalScrollExtent()); + private void onEventAck(int event, boolean consumed) { + switch (event) { + case WebInputEventType.GESTURE_FLING_START: + if (consumed) { + // The view expects the fling velocity in pixels/s. + mPotentiallyActiveFlingCount++; + setTouchScrollInProgress(false); + for (mIterator.rewind(); mIterator.hasNext();) { + mIterator.next().onFlingStartGesture( + verticalScrollOffset(), verticalScrollExtent()); + } + } else { + // If a scroll ends with a fling, a SCROLL_END event is never sent. + // However, if that fling went unconsumed, we still need to let the + // listeners know that scrolling has ended. + updateOnScrollEnd(); + } + break; + case WebInputEventType.GESTURE_SCROLL_BEGIN: + setTouchScrollInProgress(true); + for (mIterator.rewind(); mIterator.hasNext();) { + mIterator.next().onScrollStarted( + verticalScrollOffset(), verticalScrollExtent()); + } + break; + case WebInputEventType.GESTURE_SCROLL_UPDATE: + if (!consumed) break; + destroyPastePopup(); + for (mIterator.rewind(); mIterator.hasNext();) { + mIterator.next().onScrollUpdateGestureConsumed(); + } + break; + case WebInputEventType.GESTURE_SCROLL_END: + updateOnScrollEnd(); + break; + case WebInputEventType.GESTURE_PINCH_BEGIN: + for (mIterator.rewind(); mIterator.hasNext();) mIterator.next().onPinchStarted(); + break; + case WebInputEventType.GESTURE_PINCH_END: + for (mIterator.rewind(); mIterator.hasNext();) mIterator.next().onPinchEnded(); + break; + case WebInputEventType.GESTURE_TAP: + destroyPastePopup(); + for (mIterator.rewind(); mIterator.hasNext();) { + mIterator.next().onSingleTap(consumed); + } + break; + case WebInputEventType.GESTURE_LONG_PRESS: + if (!consumed) break; + mViewDelegate.getContainerView().performHapticFeedback( + HapticFeedbackConstants.LONG_PRESS); + for (mIterator.rewind(); mIterator.hasNext();) mIterator.next().onLongPress(); + break; + default: + break; } } - @CalledByNative - private void onScrollBeginEventAck() { - setTouchScrollInProgress(true); - for (mIterator.rewind(); mIterator.hasNext();) { - mIterator.next().onScrollStarted(verticalScrollOffset(), verticalScrollExtent()); - } - } - - @CalledByNative - private void onScrollEndEventAck() { - updateOnScrollEnd(); - } - - @CalledByNative - private void onScrollUpdateGestureConsumed() { + private void destroyPastePopup() { SelectionPopupControllerImpl controller = getSelectionPopupController(); if (controller != null) controller.destroyPastePopup(); - for (mIterator.rewind(); mIterator.hasNext();) { - mIterator.next().onScrollUpdateGestureConsumed(); - } - } - - @CalledByNative - private void onPinchBeginEventAck() { - for (mIterator.rewind(); mIterator.hasNext();) mIterator.next().onPinchStarted(); - } - - @CalledByNative - private void onPinchEndEventAck() { - for (mIterator.rewind(); mIterator.hasNext();) mIterator.next().onPinchEnded(); - } - - @CalledByNative - private void onSingleTapEventAck(boolean consumed) { - SelectionPopupControllerImpl controller = getSelectionPopupController(); - if (controller != null) controller.destroyPastePopup(); - for (mIterator.rewind(); mIterator.hasNext();) mIterator.next().onSingleTap(consumed); - } - - @CalledByNative - private void onLongPressAck() { - mViewDelegate.getContainerView().performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); - for (mIterator.rewind(); mIterator.hasNext();) mIterator.next().onLongPress(); } @CalledByNative
diff --git a/content/public/app/mojo/content_browser_manifest.json b/content/public/app/mojo/content_browser_manifest.json index 87a41ab..1b1ba97 100644 --- a/content/public/app/mojo/content_browser_manifest.json +++ b/content/public/app/mojo/content_browser_manifest.json
@@ -193,7 +193,7 @@ "payments.mojom.PaymentManager", "payments.mojom.PaymentRequest", "resource_coordinator.mojom.FrameCoordinationUnit", - "shape_detection.mojom.BarcodeDetection", + "shape_detection.mojom.BarcodeDetectionProvider", "shape_detection.mojom.FaceDetectionProvider", "shape_detection.mojom.TextDetection", "ui.mojom.Gpu", @@ -217,7 +217,7 @@ "device.mojom.UsbDeviceManager", "network.mojom.WebSocket", "payments.mojom.PaymentManager", - "shape_detection.mojom.BarcodeDetection", + "shape_detection.mojom.BarcodeDetectionProvider", "shape_detection.mojom.FaceDetectionProvider", "shape_detection.mojom.TextDetection" ] @@ -237,7 +237,7 @@ "network.mojom.RestrictedCookieManager", "network.mojom.WebSocket", "payments.mojom.PaymentManager", - "shape_detection.mojom.BarcodeDetection", + "shape_detection.mojom.BarcodeDetectionProvider", "shape_detection.mojom.FaceDetectionProvider", "shape_detection.mojom.TextDetection" ] @@ -254,7 +254,7 @@ "blink.mojom.QuotaDispatcherHost", "network.mojom.WebSocket", "payments.mojom.PaymentManager", - "shape_detection.mojom.BarcodeDetection", + "shape_detection.mojom.BarcodeDetectionProvider", "shape_detection.mojom.FaceDetectionProvider", "shape_detection.mojom.TextDetection" ]
diff --git a/content/renderer/media/stream/media_stream_constraints_util_video_device.cc b/content/renderer/media/stream/media_stream_constraints_util_video_device.cc index 1e361d3d..7d0eae2 100644 --- a/content/renderer/media/stream/media_stream_constraints_util_video_device.cc +++ b/content/renderer/media/stream/media_stream_constraints_util_video_device.cc
@@ -40,7 +40,7 @@ case media::MEDIA_VIDEO_FACING_ENVIRONMENT: return blink::WebString::FromASCII("environment"); default: - return blink::WebString::FromASCII(""); + return blink::WebString(); } } @@ -241,6 +241,25 @@ return HUGE_VAL; } +double FacingModeConstraintSourceDistance( + media::VideoFacingMode value, + const blink::StringConstraint& facing_mode_constraint, + const char** failed_constraint_name) { + blink::WebString string_value = ToWebString(value); + if (string_value.IsNull()) { + if (facing_mode_constraint.Exact().empty()) + return 0.0; + + if (failed_constraint_name) + *failed_constraint_name = facing_mode_constraint.GetName(); + return HUGE_VAL; + } + + double ret = StringConstraintSourceDistance( + string_value, facing_mode_constraint, failed_constraint_name); + return ret; +} + // Returns a custom distance between a source screen dimension and |constraint|. // The source supports the range [|min_source_value|, |max_source_value|], using // cropping if necessary. This range may differ from the native range of the @@ -446,9 +465,8 @@ StringConstraintSourceDistance(blink::WebString::FromASCII(group_id), constraint_set.group_id, failed_constraint_name) + - StringConstraintSourceDistance(ToWebString(facing_mode), - constraint_set.facing_mode, - failed_constraint_name); + FacingModeConstraintSourceDistance( + facing_mode, constraint_set.facing_mode, failed_constraint_name); } // Returns a custom distance between |constraint_set| and |format| given that
diff --git a/content/renderer/media/stream/media_stream_constraints_util_video_device_unittest.cc b/content/renderer/media/stream/media_stream_constraints_util_video_device_unittest.cc index dc0188d..8a9a13eb 100644 --- a/content/renderer/media/stream/media_stream_constraints_util_video_device_unittest.cc +++ b/content/renderer/media/stream/media_stream_constraints_util_video_device_unittest.cc
@@ -260,6 +260,18 @@ result.failed_constraint_name()); } +TEST_F(MediaStreamConstraintsUtilVideoDeviceTest, + OverconstrainedOnEmptyFacingMode) { + constraint_factory_.Reset(); + // Empty is not a valid facingMode value. + constraint_factory_.basic().facing_mode.SetExact( + blink::WebString::FromASCII("")); + auto result = SelectSettings(); + EXPECT_FALSE(result.HasValue()); + EXPECT_EQ(constraint_factory_.basic().facing_mode.GetName(), + result.failed_constraint_name()); +} + TEST_F(MediaStreamConstraintsUtilVideoDeviceTest, OverconstrainedOnVideoKind) { constraint_factory_.Reset(); // No device in |capabilities_| has video kind infrared.
diff --git a/device/BUILD.gn b/device/BUILD.gn index e0df5c7..e112675 100644 --- a/device/BUILD.gn +++ b/device/BUILD.gn
@@ -285,6 +285,12 @@ "bluetooth/bluetooth_low_energy_win_fake.h", "bluetooth/test/fake_bluetooth_adapter_winrt.cc", "bluetooth/test/fake_bluetooth_adapter_winrt.h", + "bluetooth/test/fake_bluetooth_le_advertisement_received_event_args_winrt.cc", + "bluetooth/test/fake_bluetooth_le_advertisement_received_event_args_winrt.h", + "bluetooth/test/fake_bluetooth_le_advertisement_watcher_winrt.cc", + "bluetooth/test/fake_bluetooth_le_advertisement_watcher_winrt.h", + "bluetooth/test/fake_bluetooth_le_advertisement_winrt.cc", + "bluetooth/test/fake_bluetooth_le_advertisement_winrt.h", "bluetooth/test/fake_device_information_winrt.cc", "bluetooth/test/fake_device_information_winrt.h", ]
diff --git a/device/bluetooth/test/fake_bluetooth_le_advertisement_received_event_args_winrt.cc b/device/bluetooth/test/fake_bluetooth_le_advertisement_received_event_args_winrt.cc new file mode 100644 index 0000000..e571de8 --- /dev/null +++ b/device/bluetooth/test/fake_bluetooth_le_advertisement_received_event_args_winrt.cc
@@ -0,0 +1,55 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "device/bluetooth/test/fake_bluetooth_le_advertisement_received_event_args_winrt.h" + +namespace device { + +namespace { + +using ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEAdvertisementType; +using ABI::Windows::Devices::Bluetooth::Advertisement:: + IBluetoothLEAdvertisement; +using ABI::Windows::Devices::Bluetooth::IBluetoothSignalStrengthFilter; +using ABI::Windows::Foundation::DateTime; +using Microsoft::WRL::ComPtr; + +} // namespace + +FakeBluetoothLEAdvertisementReceivedEventArgsWinrt:: + FakeBluetoothLEAdvertisementReceivedEventArgsWinrt() = default; + +FakeBluetoothLEAdvertisementReceivedEventArgsWinrt:: + ~FakeBluetoothLEAdvertisementReceivedEventArgsWinrt() = default; + +HRESULT +FakeBluetoothLEAdvertisementReceivedEventArgsWinrt::get_RawSignalStrengthInDBm( + int16_t* value) { + return E_NOTIMPL; +} + +HRESULT +FakeBluetoothLEAdvertisementReceivedEventArgsWinrt::get_BluetoothAddress( + uint64_t* value) { + return E_NOTIMPL; +} + +HRESULT +FakeBluetoothLEAdvertisementReceivedEventArgsWinrt::get_AdvertisementType( + BluetoothLEAdvertisementType* value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementReceivedEventArgsWinrt::get_Timestamp( + DateTime* value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementReceivedEventArgsWinrt::get_Advertisement( + IBluetoothLEAdvertisement** value) { + return E_NOTIMPL; +} + +} // namespace device
diff --git a/device/bluetooth/test/fake_bluetooth_le_advertisement_received_event_args_winrt.h b/device/bluetooth/test/fake_bluetooth_le_advertisement_received_event_args_winrt.h new file mode 100644 index 0000000..bab000e --- /dev/null +++ b/device/bluetooth/test/fake_bluetooth_le_advertisement_received_event_args_winrt.h
@@ -0,0 +1,45 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef DEVICE_BLUETOOTH_TEST_FAKE_BLUETOOTH_LE_ADVERTISEMENT_RECEIVED_EVENT_ARGS_WINRT_H_ +#define DEVICE_BLUETOOTH_TEST_FAKE_BLUETOOTH_LE_ADVERTISEMENT_RECEIVED_EVENT_ARGS_WINRT_H_ + +#include <windows.devices.bluetooth.advertisement.h> +#include <wrl/implements.h> + +#include <stdint.h> + +#include "base/macros.h" + +namespace device { + +class FakeBluetoothLEAdvertisementReceivedEventArgsWinrt + : public Microsoft::WRL::RuntimeClass< + Microsoft::WRL::RuntimeClassFlags< + Microsoft::WRL::WinRt | Microsoft::WRL::InhibitRoOriginateError>, + ABI::Windows::Devices::Bluetooth::Advertisement:: + IBluetoothLEAdvertisementReceivedEventArgs> { + public: + FakeBluetoothLEAdvertisementReceivedEventArgsWinrt(); + ~FakeBluetoothLEAdvertisementReceivedEventArgsWinrt() override; + + // IBluetoothLEAdvertisementReceivedEventArgs: + IFACEMETHODIMP get_RawSignalStrengthInDBm(int16_t* value) override; + IFACEMETHODIMP get_BluetoothAddress(uint64_t* value) override; + IFACEMETHODIMP get_AdvertisementType( + ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEAdvertisementType* value) override; + IFACEMETHODIMP get_Timestamp( + ABI::Windows::Foundation::DateTime* value) override; + IFACEMETHODIMP get_Advertisement( + ABI::Windows::Devices::Bluetooth::Advertisement:: + IBluetoothLEAdvertisement** value) override; + + private: + DISALLOW_COPY_AND_ASSIGN(FakeBluetoothLEAdvertisementReceivedEventArgsWinrt); +}; + +} // namespace device + +#endif // DEVICE_BLUETOOTH_TEST_FAKE_BLUETOOTH_LE_ADVERTISEMENT_RECEIVED_EVENT_ARGS_WINRT_H_
diff --git a/device/bluetooth/test/fake_bluetooth_le_advertisement_watcher_winrt.cc b/device/bluetooth/test/fake_bluetooth_le_advertisement_watcher_winrt.cc new file mode 100644 index 0000000..cf413ac --- /dev/null +++ b/device/bluetooth/test/fake_bluetooth_le_advertisement_watcher_winrt.cc
@@ -0,0 +1,122 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "device/bluetooth/test/fake_bluetooth_le_advertisement_watcher_winrt.h" + +namespace device { + +namespace { + +using ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEAdvertisementReceivedEventArgs; +using ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEAdvertisementWatcher; +using ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEAdvertisementWatcherStatus; +using ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEAdvertisementWatcherStoppedEventArgs; +using ABI::Windows::Devices::Bluetooth::Advertisement::BluetoothLEScanningMode; +using ABI::Windows::Devices::Bluetooth::Advertisement:: + IBluetoothLEAdvertisementFilter; +using ABI::Windows::Devices::Bluetooth::IBluetoothSignalStrengthFilter; +using ABI::Windows::Foundation::TimeSpan; +using ABI::Windows::Foundation::ITypedEventHandler; + +} // namespace + +FakeBluetoothLEAdvertisementWatcherWinrt:: + FakeBluetoothLEAdvertisementWatcherWinrt() = default; + +FakeBluetoothLEAdvertisementWatcherWinrt:: + ~FakeBluetoothLEAdvertisementWatcherWinrt() = default; + +HRESULT FakeBluetoothLEAdvertisementWatcherWinrt::get_MinSamplingInterval( + TimeSpan* value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWatcherWinrt::get_MaxSamplingInterval( + TimeSpan* value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWatcherWinrt::get_MinOutOfRangeTimeout( + TimeSpan* value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWatcherWinrt::get_MaxOutOfRangeTimeout( + TimeSpan* value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWatcherWinrt::get_Status( + BluetoothLEAdvertisementWatcherStatus* value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWatcherWinrt::get_ScanningMode( + BluetoothLEScanningMode* value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWatcherWinrt::put_ScanningMode( + BluetoothLEScanningMode value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWatcherWinrt::get_SignalStrengthFilter( + IBluetoothSignalStrengthFilter** value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWatcherWinrt::put_SignalStrengthFilter( + IBluetoothSignalStrengthFilter* value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWatcherWinrt::get_AdvertisementFilter( + IBluetoothLEAdvertisementFilter** value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWatcherWinrt::put_AdvertisementFilter( + IBluetoothLEAdvertisementFilter* value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWatcherWinrt::Start() { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWatcherWinrt::Stop() { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWatcherWinrt::add_Received( + ITypedEventHandler<BluetoothLEAdvertisementWatcher*, + BluetoothLEAdvertisementReceivedEventArgs*>* handler, + EventRegistrationToken* token) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWatcherWinrt::remove_Received( + EventRegistrationToken token) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWatcherWinrt::add_Stopped( + ITypedEventHandler<BluetoothLEAdvertisementWatcher*, + BluetoothLEAdvertisementWatcherStoppedEventArgs*>* + handler, + EventRegistrationToken* token) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWatcherWinrt::remove_Stopped( + EventRegistrationToken token) { + return E_NOTIMPL; +} + +} // namespace device
diff --git a/device/bluetooth/test/fake_bluetooth_le_advertisement_watcher_winrt.h b/device/bluetooth/test/fake_bluetooth_le_advertisement_watcher_winrt.h new file mode 100644 index 0000000..8094b28f --- /dev/null +++ b/device/bluetooth/test/fake_bluetooth_le_advertisement_watcher_winrt.h
@@ -0,0 +1,82 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef DEVICE_BLUETOOTH_TEST_FAKE_BLUETOOTH_LE_ADVERTISEMENT_WATCHER_WINRT_H_ +#define DEVICE_BLUETOOTH_TEST_FAKE_BLUETOOTH_LE_ADVERTISEMENT_WATCHER_WINRT_H_ + +#include <windows.devices.bluetooth.h> +#include <wrl/implements.h> + +#include <stdint.h> + +#include "base/macros.h" + +namespace device { + +class FakeBluetoothLEAdvertisementWatcherWinrt + : public Microsoft::WRL::RuntimeClass< + Microsoft::WRL::RuntimeClassFlags< + Microsoft::WRL::WinRt | Microsoft::WRL::InhibitRoOriginateError>, + ABI::Windows::Devices::Bluetooth::Advertisement:: + IBluetoothLEAdvertisementWatcher> { + public: + FakeBluetoothLEAdvertisementWatcherWinrt(); + ~FakeBluetoothLEAdvertisementWatcherWinrt() override; + + // IBluetoothLEAdvertisementWatcher: + IFACEMETHODIMP get_MinSamplingInterval( + ABI::Windows::Foundation::TimeSpan* value) override; + IFACEMETHODIMP get_MaxSamplingInterval( + ABI::Windows::Foundation::TimeSpan* value) override; + IFACEMETHODIMP get_MinOutOfRangeTimeout( + ABI::Windows::Foundation::TimeSpan* value) override; + IFACEMETHODIMP get_MaxOutOfRangeTimeout( + ABI::Windows::Foundation::TimeSpan* value) override; + IFACEMETHODIMP get_Status( + ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEAdvertisementWatcherStatus* value) override; + IFACEMETHODIMP get_ScanningMode( + ABI::Windows::Devices::Bluetooth::Advertisement::BluetoothLEScanningMode* + value) override; + IFACEMETHODIMP put_ScanningMode( + ABI::Windows::Devices::Bluetooth::Advertisement::BluetoothLEScanningMode + value) override; + IFACEMETHODIMP get_SignalStrengthFilter( + ABI::Windows::Devices::Bluetooth::IBluetoothSignalStrengthFilter** value) + override; + IFACEMETHODIMP put_SignalStrengthFilter( + ABI::Windows::Devices::Bluetooth::IBluetoothSignalStrengthFilter* value) + override; + IFACEMETHODIMP get_AdvertisementFilter( + ABI::Windows::Devices::Bluetooth::Advertisement:: + IBluetoothLEAdvertisementFilter** value) override; + IFACEMETHODIMP put_AdvertisementFilter( + ABI::Windows::Devices::Bluetooth::Advertisement:: + IBluetoothLEAdvertisementFilter* value) override; + IFACEMETHODIMP Start() override; + IFACEMETHODIMP Stop() override; + IFACEMETHODIMP add_Received( + ABI::Windows::Foundation::ITypedEventHandler< + ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEAdvertisementWatcher*, + ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEAdvertisementReceivedEventArgs*>* handler, + EventRegistrationToken* token) override; + IFACEMETHODIMP remove_Received(EventRegistrationToken token) override; + IFACEMETHODIMP add_Stopped( + ABI::Windows::Foundation::ITypedEventHandler< + ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEAdvertisementWatcher*, + ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEAdvertisementWatcherStoppedEventArgs*>* handler, + EventRegistrationToken* token) override; + IFACEMETHODIMP remove_Stopped(EventRegistrationToken token) override; + + private: + DISALLOW_COPY_AND_ASSIGN(FakeBluetoothLEAdvertisementWatcherWinrt); +}; + +} // namespace device + +#endif // DEVICE_BLUETOOTH_TEST_FAKE_BLUETOOTH_LE_ADVERTISEMENT_WATCHER_WINRT_H_
diff --git a/device/bluetooth/test/fake_bluetooth_le_advertisement_winrt.cc b/device/bluetooth/test/fake_bluetooth_le_advertisement_winrt.cc new file mode 100644 index 0000000..7623a2c --- /dev/null +++ b/device/bluetooth/test/fake_bluetooth_le_advertisement_winrt.cc
@@ -0,0 +1,74 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "device/bluetooth/test/fake_bluetooth_le_advertisement_winrt.h" + +namespace device { + +namespace { + +using ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEAdvertisementDataSection; +using ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEAdvertisementFlags; +using ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEManufacturerData; +using ABI::Windows::Foundation::IReference; +using ABI::Windows::Foundation::Collections::IVector; +using ABI::Windows::Foundation::Collections::IVectorView; + +} // namespace + +FakeBluetoothLEAdvertisementWinrt::FakeBluetoothLEAdvertisementWinrt() = + default; + +FakeBluetoothLEAdvertisementWinrt::~FakeBluetoothLEAdvertisementWinrt() = + default; + +HRESULT FakeBluetoothLEAdvertisementWinrt::get_Flags( + IReference<BluetoothLEAdvertisementFlags>** value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWinrt::put_Flags( + IReference<BluetoothLEAdvertisementFlags>* value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWinrt::get_LocalName(HSTRING* value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWinrt::put_LocalName(HSTRING value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWinrt::get_ServiceUuids( + IVector<GUID>** value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWinrt::get_ManufacturerData( + IVector<BluetoothLEManufacturerData*>** value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWinrt::get_DataSections( + IVector<BluetoothLEAdvertisementDataSection*>** value) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWinrt::GetManufacturerDataByCompanyId( + uint16_t company_id, + IVectorView<BluetoothLEManufacturerData*>** data_list) { + return E_NOTIMPL; +} + +HRESULT FakeBluetoothLEAdvertisementWinrt::GetSectionsByType( + uint8_t type, + IVectorView<BluetoothLEAdvertisementDataSection*>** section_list) { + return E_NOTIMPL; +} + +} // namespace device
diff --git a/device/bluetooth/test/fake_bluetooth_le_advertisement_winrt.h b/device/bluetooth/test/fake_bluetooth_le_advertisement_winrt.h new file mode 100644 index 0000000..5889db2 --- /dev/null +++ b/device/bluetooth/test/fake_bluetooth_le_advertisement_winrt.h
@@ -0,0 +1,63 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef DEVICE_BLUETOOTH_TEST_FAKE_BLUETOOTH_LE_ADVERTISEMENT_WINRT_H_ +#define DEVICE_BLUETOOTH_TEST_FAKE_BLUETOOTH_LE_ADVERTISEMENT_WINRT_H_ + +#include <windows.devices.bluetooth.advertisement.h> +#include <wrl/implements.h> + +#include <stdint.h> + +#include "base/macros.h" + +namespace device { + +class FakeBluetoothLEAdvertisementWinrt + : public Microsoft::WRL::RuntimeClass< + Microsoft::WRL::RuntimeClassFlags< + Microsoft::WRL::WinRt | Microsoft::WRL::InhibitRoOriginateError>, + ABI::Windows::Devices::Bluetooth::Advertisement:: + IBluetoothLEAdvertisement> { + public: + FakeBluetoothLEAdvertisementWinrt(); + ~FakeBluetoothLEAdvertisementWinrt() override; + + // IBluetoothLEAdvertisement: + IFACEMETHODIMP get_Flags(ABI::Windows::Foundation::IReference< + ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEAdvertisementFlags>** value) override; + IFACEMETHODIMP put_Flags(ABI::Windows::Foundation::IReference< + ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEAdvertisementFlags>* value) override; + IFACEMETHODIMP get_LocalName(HSTRING* value) override; + IFACEMETHODIMP put_LocalName(HSTRING value) override; + IFACEMETHODIMP get_ServiceUuids( + ABI::Windows::Foundation::Collections::IVector<GUID>** value) override; + IFACEMETHODIMP get_ManufacturerData( + ABI::Windows::Foundation::Collections::IVector< + ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEManufacturerData*>** value) override; + IFACEMETHODIMP get_DataSections( + ABI::Windows::Foundation::Collections::IVector< + ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEAdvertisementDataSection*>** value) override; + IFACEMETHODIMP GetManufacturerDataByCompanyId( + uint16_t company_id, + ABI::Windows::Foundation::Collections::IVectorView< + ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEManufacturerData*>** data_list) override; + IFACEMETHODIMP GetSectionsByType( + uint8_t type, + ABI::Windows::Foundation::Collections::IVectorView< + ABI::Windows::Devices::Bluetooth::Advertisement:: + BluetoothLEAdvertisementDataSection*>** section_list) override; + + private: + DISALLOW_COPY_AND_ASSIGN(FakeBluetoothLEAdvertisementWinrt); +}; + +} // namespace device + +#endif // DEVICE_BLUETOOTH_TEST_FAKE_BLUETOOTH_LE_ADVERTISEMENT_WINRT_H_
diff --git a/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.cc b/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.cc index 5321c47a..f1dae56 100644 --- a/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.cc +++ b/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.cc
@@ -127,22 +127,6 @@ return RespondNow(NoArguments()); } -ExtensionFunction::ResponseAction VirtualKeyboardPrivateSetModeFunction::Run() { - std::unique_ptr<keyboard::SetMode::Params> params = - keyboard::SetMode::Params::Create(*args_); - EXTENSION_FUNCTION_VALIDATE(params); - if (!delegate()->SetVirtualKeyboardMode( - params->mode, base::nullopt, - base::BindOnce(&VirtualKeyboardPrivateSetModeFunction::OnSetMode, - this))) - return RespondNow(Error(kVirtualKeyboardNotEnabled)); - return RespondLater(); -} - -void VirtualKeyboardPrivateSetModeFunction::OnSetMode(bool success) { - Respond(OneArgument(std::make_unique<base::Value>(success))); -} - ExtensionFunction::ResponseAction VirtualKeyboardPrivateSetContainerBehaviorFunction::Run() { std::unique_ptr<keyboard::SetContainerBehavior::Params> params =
diff --git a/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.h b/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.h index 948730f..55ee2dd5 100644 --- a/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.h +++ b/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.h
@@ -140,22 +140,6 @@ ResponseAction Run() override; }; -class VirtualKeyboardPrivateSetModeFunction - : public VirtualKeyboardPrivateFunction { - public: - DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.setMode", - VIRTUALKEYBOARDPRIVATE_SETMODE); - - protected: - ~VirtualKeyboardPrivateSetModeFunction() override {} - - // ExtensionFunction: - ResponseAction Run() override; - - private: - void OnSetMode(bool success); -}; - class VirtualKeyboardPrivateSetContainerBehaviorFunction : public VirtualKeyboardPrivateFunction { public:
diff --git a/extensions/common/api/virtual_keyboard_private.json b/extensions/common/api/virtual_keyboard_private.json index b397f22a..a5427c0 100644 --- a/extensions/common/api/virtual_keyboard_private.json +++ b/extensions/common/api/virtual_keyboard_private.json
@@ -200,26 +200,6 @@ ] }, { - "name": "setMode", - "type": "function", - "description": "Sets the virtual keyboard container mode.", - "parameters": [ - { - "$ref": "KeyboardMode", - "name": "mode", - "description": "The value of the virtual keyboard mode to set to." - }, - { - "type": "function", - "name": "callback", - "optional": true, - "description": "Called when container mode is ready to change.", - "parameters": [] - } - ], - "deprecated": "Please use $(ref:setContainerBehavior)" - }, - { "name": "setContainerBehavior", "type": "function", "description": "Sets the virtual keyboard container behavior",
diff --git a/ios/chrome/browser/sync/ios_chrome_sync_client.mm b/ios/chrome/browser/sync/ios_chrome_sync_client.mm index 5732afc..a7b6eb12 100644 --- a/ios/chrome/browser/sync/ios_chrome_sync_client.mm +++ b/ios/chrome/browser/sync/ios_chrome_sync_client.mm
@@ -345,6 +345,10 @@ ->GetControllerDelegateOnUIThread() : base::WeakPtr<syncer::ModelTypeControllerDelegate>(); } + case syncer::USER_CONSENTS: + // TODO(crbug.com/840357): Return the real delegate once it is wired to + // the consent auditor. + return base::WeakPtr<syncer::ModelTypeControllerDelegate>(); case syncer::USER_EVENTS: return IOSUserEventServiceFactory::GetForBrowserState(browser_state_) ->GetSyncBridge()
diff --git a/ios/chrome/browser/sync/profile_sync_service_factory_unittest.cc b/ios/chrome/browser/sync/profile_sync_service_factory_unittest.cc index 7c51c61..669436a 100644 --- a/ios/chrome/browser/sync/profile_sync_service_factory_unittest.cc +++ b/ios/chrome/browser/sync/profile_sync_service_factory_unittest.cc
@@ -40,7 +40,7 @@ protected: // Returns the collection of default datatypes. std::vector<syncer::ModelType> DefaultDatatypes() { - static_assert(41 == syncer::MODEL_TYPE_COUNT, + static_assert(42 == syncer::MODEL_TYPE_COUNT, "When adding a new type, you probably want to add it here as " "well (assuming it is already enabled)."); @@ -64,6 +64,8 @@ datatypes.push_back(syncer::PROXY_TABS); datatypes.push_back(syncer::TYPED_URLS); datatypes.push_back(syncer::USER_EVENTS); + // TODO(crbug.com/840357): Add USER_CONSENTS, when the type is enabled by + // default. return datatypes; }
diff --git a/ios/chrome/browser/ui/activity_services/activity_service_controller_egtest.mm b/ios/chrome/browser/ui/activity_services/activity_service_controller_egtest.mm index 6002894..dd67bfe 100644 --- a/ios/chrome/browser/ui/activity_services/activity_service_controller_egtest.mm +++ b/ios/chrome/browser/ui/activity_services/activity_service_controller_egtest.mm
@@ -51,6 +51,23 @@ return chrome_test_util::ButtonWithAccessibilityLabel(@"Print"); } +// Returns a button with a copy label. +id<GREYMatcher> CopyButton() { + return chrome_test_util::ButtonWithAccessibilityLabel(@"Copy"); +} + +// Returns the collection view for the activity services menu. Since this is a +// system widget, it does not have an a11y id. Instead, search for a +// UICollectionView that is the superview of the "Copy" menu item. There are +// two nested UICollectionViews in the activity services menu, so choose the +// innermost one. +id<GREYMatcher> ShareMenuCollectionView() { + return grey_allOf( + grey_kindOfClass([UICollectionView class]), grey_descendant(CopyButton()), + // Looking for a nested UICollectionView. + grey_descendant(grey_kindOfClass([UICollectionView class])), nil); +} + } // namespace // Earl grey integration tests for Activity Service Controller. @@ -90,7 +107,9 @@ [ChromeEarlGrey waitForErrorPage]; // Execute the Print action. - [[EarlGrey selectElementWithMatcher:PrintButton()] performAction:grey_tap()]; + [[[EarlGrey selectElementWithMatcher:PrintButton()] + usingSearchAction:grey_scrollInDirection(kGREYDirectionRight, 100) + onElementWithMatcher:ShareMenuCollectionView()] performAction:grey_tap()]; // Verify that a toast notification appears. [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( @@ -118,8 +137,20 @@ // Verify that you can share, but that the Print action is not available. [ChromeEarlGreyUI openShareMenu]; AssertActivityServiceVisible(); - [[EarlGrey selectElementWithMatcher:PrintButton()] - assertWithMatcher:grey_nil()]; + + // To verify that the Print action is missing, scroll through the entire + // collection view using grey_scrollInDirection(), then make sure the + // operation failed with kGREYInteractionElementNotFoundErrorCode. + NSError* error; + [[[EarlGrey selectElementWithMatcher:PrintButton()] + usingSearchAction:grey_scrollInDirection(kGREYDirectionRight, 100) + onElementWithMatcher:ShareMenuCollectionView()] + assertWithMatcher:grey_notNil() + error:&error]; + + GREYAssert([error.domain isEqual:kGREYInteractionErrorDomain] && + error.code == kGREYInteractionElementNotFoundErrorCode, + @"Print action was unexpectedly present"); } - (void)testActivityServiceControllerIsDisabled { @@ -160,15 +191,13 @@ [ChromeEarlGrey loadURL:url]; [ChromeEarlGreyUI openShareMenu]; - // Verify that the share menu is up and contains a Print action. + // Verify that the share menu is up and contains a Copy action. AssertActivityServiceVisible(); - [[EarlGrey selectElementWithMatcher:PrintButton()] + [[EarlGrey selectElementWithMatcher:CopyButton()] assertWithMatcher:grey_interactable()]; // Start the Copy action and verify that the share menu gets dismissed. - [[EarlGrey - selectElementWithMatcher:chrome_test_util::ButtonWithAccessibilityLabel( - @"Copy")] performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:CopyButton()] performAction:grey_tap()]; AssertActivityServiceNotVisible(); }
diff --git a/ios/chrome/browser/ui/fullscreen/fullscreen_egtest.mm b/ios/chrome/browser/ui/fullscreen/fullscreen_egtest.mm index bc9d4c9d..b1ac7dfb 100644 --- a/ios/chrome/browser/ui/fullscreen/fullscreen_egtest.mm +++ b/ios/chrome/browser/ui/fullscreen/fullscreen_egtest.mm
@@ -7,6 +7,7 @@ #import <WebKit/WebKit.h> #import <XCTest/XCTest.h> +#include "base/ios/ios_util.h" #include "base/mac/bind_objc_block.h" #include "base/strings/stringprintf.h" #include "base/strings/sys_string_conversions.h" @@ -81,6 +82,10 @@ // Verifies that the content offset of the web view is set up at the correct // initial value when initially displaying a PDF. - (void)testLongPDFInitialState { + if (IsUIRefreshPhase1Enabled() && !base::ios::IsRunningOnIOS11OrLater()) { + EARL_GREY_TEST_DISABLED( + @"crbug.com/849132 Test broken in iOS10 with UI refresh."); + } web::test::SetUpFileBasedHttpServer(); GURL URL = web::test::HttpServer::MakeUrl( "http://ios/testing/data/http_server_files/two_pages.pdf");
diff --git a/ios/chrome/browser/ui/history/history_table_view_controller.mm b/ios/chrome/browser/ui/history/history_table_view_controller.mm index f30f4c9..abb72cb 100644 --- a/ios/chrome/browser/ui/history/history_table_view_controller.mm +++ b/ios/chrome/browser/ui/history/history_table_view_controller.mm
@@ -165,7 +165,7 @@ self.searchController.searchResultsUpdater = self; self.searchController.searchBar.backgroundColor = [UIColor whiteColor]; self.searchController.searchBar.accessibilityIdentifier = - l10n_util::GetNSStringWithFixup(IDS_IOS_ICON_SEARCH); + kHistorySearchControllerSearchBarIdentifier; // UIKit needs to know which controller will be presenting the // searchController. If we don't add this trying to dismiss while // SearchController is active will fail.
diff --git a/ios/chrome/browser/ui/history/history_ui_constants.h b/ios/chrome/browser/ui/history/history_ui_constants.h index a6e931b..15a6e01 100644 --- a/ios/chrome/browser/ui/history/history_ui_constants.h +++ b/ios/chrome/browser/ui/history/history_ui_constants.h
@@ -7,6 +7,8 @@ #import <Foundation/Foundation.h> +// Accessibility identifier of the search controller search bar. +extern NSString* const kHistorySearchControllerSearchBarIdentifier; // Accessibility identifier of the navigation controller done button. extern NSString* const kHistoryNavigationControllerDoneButtonIdentifier; // Accessibility identifier of the delete toolbar button.
diff --git a/ios/chrome/browser/ui/history/history_ui_constants.mm b/ios/chrome/browser/ui/history/history_ui_constants.mm index 4d2517a2..044d117 100644 --- a/ios/chrome/browser/ui/history/history_ui_constants.mm +++ b/ios/chrome/browser/ui/history/history_ui_constants.mm
@@ -8,6 +8,8 @@ #error "This file requires ARC support." #endif +NSString* const kHistorySearchControllerSearchBarIdentifier = + @"kHistorySearchControllerSearchBarIdentifier"; NSString* const kHistoryNavigationControllerDoneButtonIdentifier = @"kHistoryNavigationControllerDoneButtonIdentifier"; NSString* const kHistoryToolbarDeleteButtonIdentifier =
diff --git a/ios/chrome/browser/ui/history/history_ui_egtest.mm b/ios/chrome/browser/ui/history/history_ui_egtest.mm index 3f73abd..92552df9 100644 --- a/ios/chrome/browser/ui/history/history_ui_egtest.mm +++ b/ios/chrome/browser/ui/history/history_ui_egtest.mm
@@ -120,8 +120,7 @@ // Matcher for the search button. id<GREYMatcher> SearchIconButton() { if (IsUIRefreshPhase1Enabled()) { - return grey_accessibilityID( - l10n_util::GetNSStringWithFixup(IDS_IOS_ICON_SEARCH)); + return grey_accessibilityID(kHistorySearchControllerSearchBarIdentifier); } else { return ButtonWithAccessibilityLabelId(IDS_IOS_ICON_SEARCH); } @@ -271,8 +270,13 @@ NSString* searchString = [NSString stringWithFormat:@"%s", _URL1.path().c_str()]; - [[EarlGrey selectElementWithMatcher:grey_keyWindow()] - performAction:grey_typeText(searchString)]; + if (IsUIRefreshPhase1Enabled()) { + [[EarlGrey selectElementWithMatcher:SearchIconButton()] + performAction:grey_typeText(searchString)]; + } else { + [[EarlGrey selectElementWithMatcher:grey_keyWindow()] + performAction:grey_typeText(searchString)]; + } [[EarlGrey selectElementWithMatcher:HistoryEntry(_URL1, kTitle1)] assertWithMatcher:grey_notNil()]; [[EarlGrey selectElementWithMatcher:HistoryEntry(_URL2, kTitle2)]
diff --git a/ios/chrome/browser/ui/print/print_controller_egtest.mm b/ios/chrome/browser/ui/print/print_controller_egtest.mm index 16eed5f0..f71b9154 100644 --- a/ios/chrome/browser/ui/print/print_controller_egtest.mm +++ b/ios/chrome/browser/ui/print/print_controller_egtest.mm
@@ -31,6 +31,21 @@ // A test HTML URL. const char kHTMLURL[] = "http://test"; + +// Returns the collection view for the activity services menu. Since this is a +// system widget, it does not have an a11y id. Instead, search for a +// UICollectionView that is the superview of the "Copy" menu item. There are +// two nested UICollectionViews in the activity services menu, so choose the +// innermost one. +id<GREYMatcher> ShareMenuCollectionView() { + id<GREYMatcher> copyButton = + chrome_test_util::ButtonWithAccessibilityLabel(@"Copy"); + return grey_allOf( + grey_kindOfClass([UICollectionView class]), grey_descendant(copyButton), + // Looking for a nested UICollectionView. + grey_descendant(grey_kindOfClass([UICollectionView class])), nil); +} + } // namespace // Print test cases. These are Earl Grey integration tests. @@ -92,9 +107,11 @@ } else { [ChromeEarlGreyUI openShareMenu]; id<GREYMatcher> printButton = - grey_allOf(grey_accessibilityLabel(@"Print"), - grey_accessibilityTrait(UIAccessibilityTraitButton), nil); - [[EarlGrey selectElementWithMatcher:printButton] performAction:grey_tap()]; + chrome_test_util::ButtonWithAccessibilityLabel(@"Print"); + [[[EarlGrey selectElementWithMatcher:printButton] + usingSearchAction:grey_scrollInDirection(kGREYDirectionRight, 100) + onElementWithMatcher:ShareMenuCollectionView()] + performAction:grey_tap()]; } id<GREYMatcher> printerOptionButton = grey_allOf(
diff --git a/ios/chrome/browser/ui/ui_feature_flags.cc b/ios/chrome/browser/ui/ui_feature_flags.cc index d029d37..6a0622d 100644 --- a/ios/chrome/browser/ui/ui_feature_flags.cc +++ b/ios/chrome/browser/ui/ui_feature_flags.cc
@@ -11,7 +11,7 @@ base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kUIRefreshPhase1{"UIRefreshPhase1", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kCollectionsUIReboot{"CollectionsUIReboot", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/ios/chrome/browser/web/error_page_egtest.mm b/ios/chrome/browser/web/error_page_egtest.mm index 9cd5946..ce7172b 100644 --- a/ios/chrome/browser/web/error_page_egtest.mm +++ b/ios/chrome/browser/web/error_page_egtest.mm
@@ -6,8 +6,8 @@ #include <string> +#include "base/bind.h" #include "base/feature_list.h" -#import "base/mac/bind_objc_block.h" #include "base/strings/sys_string_conversions.h" #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" #import "ios/chrome/test/earl_grey/chrome_test_case.h"
diff --git a/ios/showcase/content_suggestions/BUILD.gn b/ios/showcase/content_suggestions/BUILD.gn index 85cfe66..aa33d2b 100644 --- a/ios/showcase/content_suggestions/BUILD.gn +++ b/ios/showcase/content_suggestions/BUILD.gn
@@ -17,6 +17,7 @@ "//base", "//components/strings", "//ios/chrome/app/strings", + "//ios/chrome/browser/ui:ui_util", "//ios/chrome/browser/ui/collection_view/cells", "//ios/chrome/browser/ui/content_suggestions:content_suggestions_ui", "//ios/chrome/browser/ui/content_suggestions/cells:cells_ui",
diff --git a/ios/showcase/content_suggestions/sc_content_suggestions_data_source.mm b/ios/showcase/content_suggestions/sc_content_suggestions_data_source.mm index 788b3aeb..2a4f017 100644 --- a/ios/showcase/content_suggestions/sc_content_suggestions_data_source.mm +++ b/ios/showcase/content_suggestions/sc_content_suggestions_data_source.mm
@@ -12,6 +12,7 @@ #import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.h" #import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.h" #import "ios/chrome/browser/ui/favicon/favicon_attributes.h" +#include "ios/chrome/browser/ui/ui_util.h" #include "ios/chrome/grit/ios_strings.h" #import "ios/showcase/content_suggestions/sc_content_suggestions_item.h" #import "ios/showcase/content_suggestions/sc_content_suggestions_most_visited_item.h" @@ -68,6 +69,12 @@ #pragma mark - ContentSuggestionsDataSource - (NSArray<ContentSuggestionsSectionInformation*>*)sectionsInfo { + if (IsUIRefreshPhase1Enabled()) { + return @[ + self.logoHeaderSection, self.mostVisitedSection, self.articleSection, + self.learnMoreSection + ]; + } return @[ self.logoHeaderSection, self.mostVisitedSection, self.readingListSection, self.articleSection, self.learnMoreSection
diff --git a/ios/showcase/content_suggestions/sc_content_suggestions_egtest.mm b/ios/showcase/content_suggestions/sc_content_suggestions_egtest.mm index a749eef..96f9e90 100644 --- a/ios/showcase/content_suggestions/sc_content_suggestions_egtest.mm +++ b/ios/showcase/content_suggestions/sc_content_suggestions_egtest.mm
@@ -81,12 +81,16 @@ // Tests launching ContentSuggestionsViewController. - (void)testLaunch { showcase_utils::Open(@"ContentSuggestionsViewController"); + NSString* section_header = l10n_util::GetNSStringWithFixup( + IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_HEADER); + if (IsUIRefreshPhase1Enabled()) { + section_header = [section_header uppercaseString]; + } + [CellWithMatcher(chrome_test_util::StaticTextWithAccessibilityLabel( + section_header)) assertWithMatcher:grey_notNil()]; [CellWithMatcher(chrome_test_util::ButtonWithAccessibilityLabelId( IDS_IOS_CONTENT_SUGGESTIONS_FOOTER_TITLE)) assertWithMatcher:grey_interactable()]; - [CellWithMatcher(chrome_test_util::StaticTextWithAccessibilityLabelId( - IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_HEADER)) - assertWithMatcher:grey_notNil()]; showcase_utils::Close(); } @@ -152,6 +156,10 @@ // Tests that swipe-to-dismiss on empty item does nothing. - (void)testNoSwipeToDismissEmptyItem { + if (IsUIRefreshPhase1Enabled()) { + EARL_GREY_TEST_DISABLED( + @"Test disabled in UI Refresh as there's no reading list."); + } showcase_utils::Open(@"ContentSuggestionsViewController"); [CellWithID([SCContentSuggestionsDataSource titleReadingListItem]) performAction:grey_swipeFastInDirection(kGREYDirectionLeft)];
diff --git a/media/audio/audio_output_device_unittest.cc b/media/audio/audio_output_device_unittest.cc index 31c40b50..263c253 100644 --- a/media/audio/audio_output_device_unittest.cc +++ b/media/audio/audio_output_device_unittest.cc
@@ -350,6 +350,8 @@ /*log callback*/ base::DoNothing(), params, std::move(shared_memory_region), std::move(shared_memory_mapping), std::move(browser_socket)); + reader->set_max_wait_timeout_for_test( + base::TimeDelta::FromMilliseconds(500)); time_stamp = base::TimeTicks::Now(); #if defined(OS_FUCHSIA) @@ -466,13 +468,7 @@ task_env_.RunUntilIdle(); } -// TODO(https://crbug.com/848926): Flakes frequently on Fuchsia bots. -#if defined(OS_FUCHSIA) -#define MAYBE_CreateBitStreamStream DISABLED_CreateBitStreamStream -#else -#define MAYBE_CreateBitStreamStream CreateBitStreamStream -#endif -TEST_F(AudioOutputDeviceTest, MAYBE_CreateBitStreamStream) { +TEST_F(AudioOutputDeviceTest, CreateBitStreamStream) { // The test fixture isn't used in this test, but we still have to clean up // after it. StopAudioDevice(); @@ -529,7 +525,9 @@ EXPECT_EQ(kBitstreamFrames, test_bus->GetBitstreamFrames()); EXPECT_EQ(kBitstreamDataSize, test_bus->GetBitstreamDataSize()); for (size_t i = 0; i < kBitstreamDataSize / sizeof(float); ++i) { - EXPECT_EQ(kAudioData, test_bus->channel(0)[i]); + // Note: if all of these fail, the bots will behave strangely due to the + // large amount of text output. Assert is used to avoid this. + ASSERT_EQ(kAudioData, test_bus->channel(0)[i]); } }
diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc index 2b2a579..414f4f3 100644 --- a/media/base/media_switches.cc +++ b/media/base/media_switches.cc
@@ -304,7 +304,7 @@ // Enable VA-API hardware encode acceleration for VP8. const base::Feature kVaapiVP8Encoder{"VaapiVP8Encoder", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; // Inform video blitter of video color space. const base::Feature kVideoBlitColorAccuracy{"video-blit-color-accuracy",
diff --git a/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc b/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc index 8d43d26..11da7b19 100644 --- a/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc +++ b/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc
@@ -18,6 +18,7 @@ #include "base/single_thread_task_runner.h" #include "base/strings/string_number_conversions.h" #include "base/synchronization/waitable_event.h" +#include "mojo/edk/embedder/embedder.h" #include "mojo/edk/embedder/platform_channel_utils_posix.h" #include "mojo/edk/embedder/scoped_platform_handle.h" #include "mojo/public/cpp/platform/named_platform_channel.h" @@ -290,7 +291,9 @@ mojo::PlatformChannel channel; mojo::OutgoingInvitation invitation; - std::string token = base::NumberToString(base::RandUint64()); + // Generate an arbitrary 32-byte string, as we use this length as a + // protocol version identifier. + std::string token = mojo::edk::GenerateRandomToken(); mojo::ScopedMessagePipeHandle pipe = invitation.AttachMessagePipe(token); mojo::OutgoingInvitation::Send(std::move(invitation), kUnusedChildProcessHandle,
diff --git a/media/media_options.gni b/media/media_options.gni index 0279aa5c..51e5a01d 100644 --- a/media/media_options.gni +++ b/media/media_options.gni
@@ -58,7 +58,7 @@ enable_mpeg_h_audio_demuxing = proprietary_codecs && is_chromecast enable_mse_mpeg2ts_stream_parser = - (proprietary_codecs && is_chromecast) || use_fuzzing_engine + proprietary_codecs && (is_chromecast || use_fuzzing_engine) # Enable parsing for the 'cbcs' encryption scheme added by MPEG Common # Encryption 3rd Edition (ISO/IEC 23001-7), published 02/15/2016.
diff --git a/net/websockets/websocket_basic_handshake_stream.cc b/net/websockets/websocket_basic_handshake_stream.cc index fb86f5d..ff755c91 100644 --- a/net/websockets/websocket_basic_handshake_stream.cc +++ b/net/websockets/websocket_basic_handshake_stream.cc
@@ -8,9 +8,7 @@ #include <algorithm> #include <iterator> #include <set> -#include <string> #include <utility> -#include <vector> #include "base/base64.h" #include "base/bind.h" @@ -171,7 +169,7 @@ bool using_proxy, std::vector<std::string> requested_sub_protocols, std::vector<std::string> requested_extensions, - WebSocketStreamRequest* request, + WebSocketStreamRequestAPI* request, WebSocketEndpointLockManager* websocket_endpoint_lock_manager) : result_(HandshakeResult::INCOMPLETE), state_(std::move(connection), @@ -179,8 +177,8 @@ false /* http_09_on_non_default_ports_enabled */), connect_delegate_(connect_delegate), http_response_info_(nullptr), - requested_sub_protocols_(requested_sub_protocols), - requested_extensions_(requested_extensions), + requested_sub_protocols_(std::move(requested_sub_protocols)), + requested_extensions_(std::move(requested_extensions)), stream_request_(request), websocket_endpoint_lock_manager_(websocket_endpoint_lock_manager) { DCHECK(connect_delegate); @@ -188,6 +186,12 @@ } WebSocketBasicHandshakeStream::~WebSocketBasicHandshakeStream() { + // Some members are "stolen" by RenewStreamForAuth() and should not be touched + // here. Particularly |connect_delegate_|, |stream_request_|, and + // |websocket_endpoint_lock_manager_|. + + // TODO(ricea): What's the right thing to do here if we renewed the stream for + // auth? Currently we record it as INCOMPLETE. RecordHandshakeResult(result_); } @@ -362,8 +366,24 @@ } HttpStream* WebSocketBasicHandshakeStream::RenewStreamForAuth() { - // Return null because we don't support renewing the stream. - return nullptr; + if (!base::FeatureList::IsEnabled(kWebSocketHandshakeReuseConnection)) + return nullptr; + + DCHECK(IsResponseBodyComplete()); + DCHECK(!parser()->IsMoreDataBuffered()); + // The HttpStreamParser object still has a pointer to the connection. Just to + // be extra-sure it doesn't touch the connection again, delete it here rather + // than leaving it until the destructor is called. + state_.DeleteParser(); + + auto handshake_stream = std::make_unique<WebSocketBasicHandshakeStream>( + state_.ReleaseConnection(), connect_delegate_, state_.using_proxy(), + std::move(requested_sub_protocols_), std::move(requested_extensions_), + stream_request_, websocket_endpoint_lock_manager_); + + stream_request_->OnBasicHandshakeStreamCreated(handshake_stream.get()); + + return handshake_stream.release(); } std::unique_ptr<WebSocketStream> WebSocketBasicHandshakeStream::Upgrade() {
diff --git a/net/websockets/websocket_basic_handshake_stream.h b/net/websockets/websocket_basic_handshake_stream.h index 8690ada..27e6f035 100644 --- a/net/websockets/websocket_basic_handshake_stream.h +++ b/net/websockets/websocket_basic_handshake_stream.h
@@ -28,7 +28,7 @@ class HttpStreamParser; class WebSocketEndpointLockManager; struct WebSocketExtensionParams; -class WebSocketStreamRequest; +class WebSocketStreamRequestAPI; class NET_EXPORT_PRIVATE WebSocketBasicHandshakeStream final : public WebSocketHandshakeStreamBase { @@ -43,7 +43,7 @@ bool using_proxy, std::vector<std::string> requested_sub_protocols, std::vector<std::string> requested_extensions, - WebSocketStreamRequest* request, + WebSocketStreamRequestAPI* request, WebSocketEndpointLockManager* websocket_endpoint_lock_manager); ~WebSocketBasicHandshakeStream() override; @@ -122,7 +122,7 @@ // Owned by another object. // |connect_delegate| will live during the lifetime of this object. - WebSocketStream::ConnectDelegate* connect_delegate_; + WebSocketStream::ConnectDelegate* const connect_delegate_; // This is stored in SendRequest() for use by ReadResponseHeaders(). HttpResponseInfo* http_response_info_; @@ -150,7 +150,7 @@ // to avoid including extension-related header files here. std::unique_ptr<WebSocketExtensionParams> extension_params_; - WebSocketStreamRequest* const stream_request_; + WebSocketStreamRequestAPI* const stream_request_; WebSocketEndpointLockManager* const websocket_endpoint_lock_manager_;
diff --git a/net/websockets/websocket_channel_test.cc b/net/websockets/websocket_channel_test.cc index 9e78ec0..f6921da 100644 --- a/net/websockets/websocket_channel_test.cc +++ b/net/websockets/websocket_channel_test.cc
@@ -54,6 +54,9 @@ namespace net { +class WebSocketBasicHandshakeStream; +class WebSocketHttp2HandshakeStream; + // Printing helpers to allow GoogleMock to print frames. These are explicitly // designed to look like the static initialisation format we use in these // tests. They have to live in the net namespace in order to be found by @@ -686,8 +689,10 @@ class MockWebSocketStreamRequest : public WebSocketStreamRequest { public: - MOCK_METHOD1(OnHandshakeStreamCreated, - void(WebSocketHandshakeStreamBase* handshake_stream)); + MOCK_METHOD1(OnBasicHandshakeStreamCreated, + void(WebSocketBasicHandshakeStream* handshake_stream)); + MOCK_METHOD1(OnHttp2HandshakeStreamCreated, + void(WebSocketHttp2HandshakeStream* handshake_stream)); MOCK_METHOD1(OnFailure, void(const std::string& message)); };
diff --git a/net/websockets/websocket_handshake_stream_create_helper.cc b/net/websockets/websocket_handshake_stream_create_helper.cc index 23718bc..6a09c212 100644 --- a/net/websockets/websocket_handshake_stream_create_helper.cc +++ b/net/websockets/websocket_handshake_stream_create_helper.cc
@@ -42,8 +42,7 @@ std::move(connection), connect_delegate_, using_proxy, requested_subprotocols_, extensions, request_, websocket_endpoint_lock_manager); - OnBasicStreamCreated(stream.get()); - request_->OnHandshakeStreamCreated(stream.get()); + request_->OnBasicHandshakeStreamCreated(stream.get()); return std::move(stream); } @@ -54,15 +53,11 @@ std::vector<std::string> extensions( 1, "permessage-deflate; client_max_window_bits"); - std::unique_ptr<WebSocketHandshakeStreamBase> stream = - std::make_unique<WebSocketHttp2HandshakeStream>( - session, connect_delegate_, requested_subprotocols_, extensions, - request_); - request_->OnHandshakeStreamCreated(stream.get()); + auto stream = std::make_unique<WebSocketHttp2HandshakeStream>( + session, connect_delegate_, requested_subprotocols_, extensions, + request_); + request_->OnHttp2HandshakeStreamCreated(stream.get()); return stream; } -void WebSocketHandshakeStreamCreateHelper::OnBasicStreamCreated( - WebSocketBasicHandshakeStream* stream) {} - } // namespace net
diff --git a/net/websockets/websocket_handshake_stream_create_helper.h b/net/websockets/websocket_handshake_stream_create_helper.h index 1139c1f..74403399 100644 --- a/net/websockets/websocket_handshake_stream_create_helper.h +++ b/net/websockets/websocket_handshake_stream_create_helper.h
@@ -16,7 +16,7 @@ namespace net { -class WebSocketStreamRequest; +class WebSocketStreamRequestAPI; class SpdySession; class WebSocketBasicHandshakeStream; class WebSocketEndpointLockManager; @@ -54,21 +54,16 @@ // This method must be called before calling CreateBasicStream() // or CreateHttp2Stream(). // The |request| pointer must remain valid as long as this object exists. - void set_stream_request(WebSocketStreamRequest* request) { + void set_stream_request(WebSocketStreamRequestAPI* request) { request_ = request; } - protected: - // This is used by TestWebSocketHandshakeStreamCreateHelper. - // The default implementation does nothing. - virtual void OnBasicStreamCreated(WebSocketBasicHandshakeStream* stream); - private: const std::vector<std::string> requested_subprotocols_; WebSocketStream::ConnectDelegate* connect_delegate_; - WebSocketStreamRequest* request_; + WebSocketStreamRequestAPI* request_; DISALLOW_COPY_AND_ASSIGN(WebSocketHandshakeStreamCreateHelper); };
diff --git a/net/websockets/websocket_handshake_stream_create_helper_test.cc b/net/websockets/websocket_handshake_stream_create_helper_test.cc index 4cc8396..a0b5b19 100644 --- a/net/websockets/websocket_handshake_stream_create_helper_test.cc +++ b/net/websockets/websocket_handshake_stream_create_helper_test.cc
@@ -99,12 +99,14 @@ bool fatal) override {} }; -class MockWebSocketStreamRequest : public WebSocketStreamRequest { +class MockWebSocketStreamRequestAPI : public WebSocketStreamRequestAPI { public: - ~MockWebSocketStreamRequest() override = default; + ~MockWebSocketStreamRequestAPI() override = default; - MOCK_METHOD1(OnHandshakeStreamCreated, - void(WebSocketHandshakeStreamBase* handshake_stream)); + MOCK_METHOD1(OnBasicHandshakeStreamCreated, + void(WebSocketBasicHandshakeStream* handshake_stream)); + MOCK_METHOD1(OnHttp2HandshakeStreamCreated, + void(WebSocketHttp2HandshakeStream* handshake_stream)); MOCK_METHOD1(OnFailure, void(const std::string& message)); }; @@ -125,7 +127,19 @@ sub_protocols); create_helper.set_stream_request(&stream_request_); - EXPECT_CALL(stream_request_, OnHandshakeStreamCreated(_)).Times(1); + switch (GetParam()) { + case BASIC_HANDSHAKE_STREAM: + EXPECT_CALL(stream_request_, OnBasicHandshakeStreamCreated(_)).Times(1); + break; + + case HTTP2_HANDSHAKE_STREAM: + EXPECT_CALL(stream_request_, OnHttp2HandshakeStreamCreated(_)).Times(1); + break; + + default: + NOTREACHED(); + } + EXPECT_CALL(stream_request_, OnFailure(_)).Times(0); HttpRequestInfo request_info; @@ -255,7 +269,7 @@ private: MockClientSocketHandleFactory socket_handle_factory_; TestConnectDelegate connect_delegate_; - StrictMock<MockWebSocketStreamRequest> stream_request_; + StrictMock<MockWebSocketStreamRequestAPI> stream_request_; WebSocketEndpointLockManager websocket_endpoint_lock_manager_; };
diff --git a/net/websockets/websocket_http2_handshake_stream.cc b/net/websockets/websocket_http2_handshake_stream.cc index 6b13a40..73f0a3a8 100644 --- a/net/websockets/websocket_http2_handshake_stream.cc +++ b/net/websockets/websocket_http2_handshake_stream.cc
@@ -41,7 +41,7 @@ WebSocketStream::ConnectDelegate* connect_delegate, std::vector<std::string> requested_sub_protocols, std::vector<std::string> requested_extensions, - WebSocketStreamRequest* request) + WebSocketStreamRequestAPI* request) : result_(HandshakeResult::HTTP2_INCOMPLETE), session_(session), connect_delegate_(connect_delegate),
diff --git a/net/websockets/websocket_http2_handshake_stream.h b/net/websockets/websocket_http2_handshake_stream.h index dd11070..f576f43 100644 --- a/net/websockets/websocket_http2_handshake_stream.h +++ b/net/websockets/websocket_http2_handshake_stream.h
@@ -58,7 +58,7 @@ WebSocketStream::ConnectDelegate* connect_delegate, std::vector<std::string> requested_sub_protocols, std::vector<std::string> requested_extensions, - WebSocketStreamRequest* request); + WebSocketStreamRequestAPI* request); ~WebSocketHttp2HandshakeStream() override; @@ -144,7 +144,7 @@ // The extensions we requested. std::vector<std::string> requested_extensions_; - WebSocketStreamRequest* const stream_request_; + WebSocketStreamRequestAPI* const stream_request_; const HttpRequestInfo* request_info_;
diff --git a/net/websockets/websocket_stream.cc b/net/websockets/websocket_stream.cc index 47ea8d4..301f1f1 100644 --- a/net/websockets/websocket_stream.cc +++ b/net/websockets/websocket_stream.cc
@@ -27,6 +27,7 @@ #include "net/websockets/websocket_handshake_constants.h" #include "net/websockets/websocket_handshake_stream_base.h" #include "net/websockets/websocket_handshake_stream_create_helper.h" +#include "net/websockets/websocket_http2_handshake_stream.h" #include "url/gurl.h" #include "url/origin.h" @@ -98,7 +99,7 @@ WebSocketStreamRequestImpl* owner_; }; -class WebSocketStreamRequestImpl : public WebSocketStreamRequest { +class WebSocketStreamRequestImpl : public WebSocketStreamRequestAPI { public: WebSocketStreamRequestImpl( const GURL& url, @@ -107,7 +108,8 @@ const GURL& site_for_cookies, const HttpRequestHeaders& additional_headers, std::unique_ptr<WebSocketStream::ConnectDelegate> connect_delegate, - std::unique_ptr<WebSocketHandshakeStreamCreateHelper> create_helper) + std::unique_ptr<WebSocketHandshakeStreamCreateHelper> create_helper, + std::unique_ptr<WebSocketStreamRequestAPI> api_delegate) : delegate_(std::make_unique<Delegate>(this)), url_request_(context->CreateRequest(url, DEFAULT_PRIORITY, @@ -116,7 +118,8 @@ connect_delegate_(std::move(connect_delegate)), handshake_stream_(nullptr), on_handshake_stream_created_has_been_called_(false), - perform_upgrade_has_been_called_(false) { + perform_upgrade_has_been_called_(false), + api_delegate_(std::move(api_delegate)) { create_helper->set_stream_request(this); HttpRequestHeaders headers = additional_headers; headers.SetHeader(websockets::kUpgrade, websockets::kWebSocketLowercase); @@ -156,17 +159,25 @@ // and so terminates the handshake if it is incomplete. ~WebSocketStreamRequestImpl() override = default; - void OnHandshakeStreamCreated( - WebSocketHandshakeStreamBase* handshake_stream) override { - // TODO(bnc): Change to DCHECK after https://crbug.com/842575 is fixed. - CHECK(handshake_stream); + void OnBasicHandshakeStreamCreated( + WebSocketBasicHandshakeStream* handshake_stream) override { + if (api_delegate_) { + api_delegate_->OnBasicHandshakeStreamCreated(handshake_stream); + } + OnHandshakeStreamCreated(handshake_stream); + } - on_handshake_stream_created_has_been_called_ = true; - - handshake_stream_ = handshake_stream; + void OnHttp2HandshakeStreamCreated( + WebSocketHttp2HandshakeStream* handshake_stream) override { + if (api_delegate_) { + api_delegate_->OnHttp2HandshakeStreamCreated(handshake_stream); + } + OnHandshakeStreamCreated(handshake_stream); } void OnFailure(const std::string& message) override { + if (api_delegate_) + api_delegate_->OnFailure(message); failure_message_ = message; } @@ -265,6 +276,16 @@ } private: + void OnHandshakeStreamCreated( + WebSocketHandshakeStreamBase* handshake_stream) { + // TODO(bnc): Change to DCHECK after https://crbug.com/842575 is fixed. + CHECK(handshake_stream); + + on_handshake_stream_created_has_been_called_ = true; + + handshake_stream_ = handshake_stream; + } + // |delegate_| needs to be declared before |url_request_| so that it gets // initialised first. std::unique_ptr<Delegate> delegate_; @@ -292,6 +313,9 @@ // A timer for handshake timeout. std::unique_ptr<base::Timer> timer_; + + // A delegate for On*HandshakeCreated and OnFailure calls. + std::unique_ptr<WebSocketStreamRequestAPI> api_delegate_; }; class SSLErrorCallbacks : public WebSocketEventInterface::SSLErrorCallbacks { @@ -440,8 +464,8 @@ std::unique_ptr<ConnectDelegate> connect_delegate) { auto request = std::make_unique<WebSocketStreamRequestImpl>( socket_url, url_request_context, origin, site_for_cookies, - additional_headers, std::move(connect_delegate), - std::move(create_helper)); + additional_headers, std::move(connect_delegate), std::move(create_helper), + nullptr); request->Start(std::make_unique<base::Timer>(false, false)); return std::move(request); } @@ -456,11 +480,12 @@ URLRequestContext* url_request_context, const NetLogWithSource& net_log, std::unique_ptr<WebSocketStream::ConnectDelegate> connect_delegate, - std::unique_ptr<base::Timer> timer) { + std::unique_ptr<base::Timer> timer, + std::unique_ptr<WebSocketStreamRequestAPI> api_delegate) { auto request = std::make_unique<WebSocketStreamRequestImpl>( socket_url, url_request_context, origin, site_for_cookies, - additional_headers, std::move(connect_delegate), - std::move(create_helper)); + additional_headers, std::move(connect_delegate), std::move(create_helper), + std::move(api_delegate)); request->Start(std::move(timer)); return std::move(request); }
diff --git a/net/websockets/websocket_stream.h b/net/websockets/websocket_stream.h index e7c78c2..b41a5f26 100644 --- a/net/websockets/websocket_stream.h +++ b/net/websockets/websocket_stream.h
@@ -37,20 +37,29 @@ class URLRequest; class URLRequestContext; struct WebSocketFrame; -class WebSocketHandshakeStreamBase; +class WebSocketBasicHandshakeStream; +class WebSocketHttp2HandshakeStream; class WebSocketHandshakeStreamCreateHelper; // WebSocketStreamRequest is the caller's handle to the process of creation of a -// WebSocketStream. Deleting the object before the OnSuccess or OnFailure -// callbacks are called will cancel the request (and neither callback will be -// called). After OnSuccess or OnFailure have been called, this object may be -// safely deleted without side-effects. +// WebSocketStream. Deleting the object before the ConnectDelegate OnSuccess or +// OnFailure callbacks are called will cancel the request (and neither callback +// will be called). After OnSuccess or OnFailure have been called, this object +// may be safely deleted without side-effects. class NET_EXPORT_PRIVATE WebSocketStreamRequest { public: virtual ~WebSocketStreamRequest(); +}; - virtual void OnHandshakeStreamCreated( - WebSocketHandshakeStreamBase* handshake_stream) = 0; +// A subclass of WebSocketStreamRequest that exposes methods that are used as +// part of the handshake. +class NET_EXPORT_PRIVATE WebSocketStreamRequestAPI + : public WebSocketStreamRequest { + public: + virtual void OnBasicHandshakeStreamCreated( + WebSocketBasicHandshakeStream* handshake_stream) = 0; + virtual void OnHttp2HandshakeStreamCreated( + WebSocketHttp2HandshakeStream* handshake_stream) = 0; virtual void OnFailure(const std::string& message) = 0; }; @@ -131,7 +140,9 @@ std::unique_ptr<ConnectDelegate> connect_delegate); // Alternate version of CreateAndConnectStream() for testing use only. It - // takes |timer| as the handshake timeout timer. + // takes |timer| as the handshake timeout timer, and for methods on + // WebSocketStreamRequestAPI calls the |api_delegate| object before the + // in-built behaviour if non-null. static std::unique_ptr<WebSocketStreamRequest> CreateAndConnectStreamForTesting( const GURL& socket_url, @@ -142,7 +153,8 @@ URLRequestContext* url_request_context, const NetLogWithSource& net_log, std::unique_ptr<ConnectDelegate> connect_delegate, - std::unique_ptr<base::Timer> timer); + std::unique_ptr<base::Timer> timer, + std::unique_ptr<WebSocketStreamRequestAPI> api_delegate); // Derived classes must make sure Close() is called when the stream is not // closed on destruction.
diff --git a/net/websockets/websocket_stream_create_test_base.cc b/net/websockets/websocket_stream_create_test_base.cc index 11311b98..cbcfcc4f 100644 --- a/net/websockets/websocket_stream_create_test_base.cc +++ b/net/websockets/websocket_stream_create_test_base.cc
@@ -89,14 +89,15 @@ std::unique_ptr<base::Timer> timer) { auto connect_delegate = std::make_unique<TestConnectDelegate>( this, connect_run_loop_.QuitClosure()); - auto create_helper = - std::make_unique<TestWebSocketHandshakeStreamCreateHelper>( - connect_delegate.get(), sub_protocols); + auto create_helper = std::make_unique<WebSocketHandshakeStreamCreateHelper>( + connect_delegate.get(), sub_protocols); + auto api_delegate = std::make_unique<TestWebSocketStreamRequestAPI>(); stream_request_ = WebSocketStream::CreateAndConnectStreamForTesting( socket_url, std::move(create_helper), origin, site_for_cookies, additional_headers, url_request_context_host_.GetURLRequestContext(), NetLogWithSource(), std::move(connect_delegate), - timer ? std::move(timer) : std::make_unique<base::Timer>(false, false)); + timer ? std::move(timer) : std::make_unique<base::Timer>(false, false), + std::move(api_delegate)); } std::vector<HeaderKeyValuePair>
diff --git a/net/websockets/websocket_stream_test.cc b/net/websockets/websocket_stream_test.cc index 4afdd58..1b972d3 100644 --- a/net/websockets/websocket_stream_test.cc +++ b/net/websockets/websocket_stream_test.cc
@@ -18,6 +18,7 @@ #include "base/run_loop.h" #include "base/strings/stringprintf.h" #include "base/test/histogram_tester.h" +#include "base/test/scoped_feature_list.h" #include "base/timer/mock_timer.h" #include "base/timer/timer.h" #include "net/base/net_errors.h" @@ -104,6 +105,12 @@ base::RunLoop().RunUntilIdle(); } + // Normally it's easier to use CreateAndConnectRawExpectations() instead. This + // method is only needed when multiple sockets are involved. + void AddRawExpectations(std::unique_ptr<SequencedSocketData> socket_data) { + url_request_context_host_.AddRawExpectations(std::move(socket_data)); + } + void AddSSLData() { auto ssl_data = std::make_unique<SSLSocketDataProvider>(ASYNC, OK); ssl_data->ssl_info.cert = @@ -269,7 +276,7 @@ auto socket_data = std::make_unique<SequencedSocketData>(reads_, writes_); socket_data->set_connect_data(MockConnect(SYNCHRONOUS, OK)); - url_request_context_host_.AddRawExpectations(std::move(socket_data)); + AddRawExpectations(std::move(socket_data)); // Send first request. This makes sure server's // spdy::SETTINGS_ENABLE_CONNECT_PROTOCOL advertisement is read. @@ -346,7 +353,7 @@ std::unique_ptr<SequencedSocketData> socket_data) { ASSERT_EQ(BASIC_HANDSHAKE_STREAM, stream_type_); - url_request_context_host_.AddRawExpectations(std::move(socket_data)); + AddRawExpectations(std::move(socket_data)); CreateAndConnectStream(GURL(url), sub_protocols, Origin(), SiteForCookies(), additional_headers, std::move(timer_)); } @@ -465,10 +472,9 @@ void CreateAndConnectAuthHandshake(const std::string& url, const std::string& base64_user_pass, const std::string& response2) { - url_request_context_host_.AddRawExpectations( - helper_.BuildSocketData1(kUnauthorizedResponse)); + AddRawExpectations(helper_.BuildSocketData1(kUnauthorizedResponse)); - static const char request2format[] = + static constexpr char request2format[] = "GET / HTTP/1.1\r\n" "Host: www.example.org\r\n" "Connection: Upgrade\r\n" @@ -1428,7 +1434,7 @@ std::move(ssl_socket_data)); url_request_context_host_.AddSSLSocketDataProvider( std::make_unique<SSLSocketDataProvider>(ASYNC, OK)); - url_request_context_host_.AddRawExpectations(BuildNullSocketData()); + AddRawExpectations(BuildNullSocketData()); CreateAndConnectStandard("wss://www.example.org/", NoSubProtocols(), {}, {}, {}); // WaitUntilConnectDone doesn't work in this case. @@ -1470,12 +1476,70 @@ EXPECT_TRUE(response_info_); } +TEST_P(WebSocketStreamCreateBasicAuthTest, SuccessfulConnectionReuse) { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature( + WebSocketBasicHandshakeStream ::kWebSocketHandshakeReuseConnection); + + std::string request1 = + "GET / HTTP/1.1\r\n" + "Host: www.example.org\r\n" + "Connection: Keep-Alive, Upgrade\r\n" + "Pragma: no-cache\r\n" + "Cache-Control: no-cache\r\n" + "Upgrade: websocket\r\n" + "Origin: http://www.example.org\r\n" + "Sec-WebSocket-Version: 13\r\n" + "User-Agent:\r\n" + "Accept-Encoding: gzip, deflate\r\n" + "Accept-Language: en-us,fr\r\n" + "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n" + "Sec-WebSocket-Extensions: permessage-deflate; " + "client_max_window_bits\r\n" + "\r\n"; + std::string response1 = kUnauthorizedResponse; + std::string request2 = + "GET / HTTP/1.1\r\n" + "Host: www.example.org\r\n" + "Connection: Keep-Alive, Upgrade\r\n" + "Pragma: no-cache\r\n" + "Cache-Control: no-cache\r\n" + "Authorization: Basic Zm9vOmJhcg==\r\n" + "Upgrade: websocket\r\n" + "Origin: http://www.example.org\r\n" + "Sec-WebSocket-Version: 13\r\n" + "User-Agent:\r\n" + "Accept-Encoding: gzip, deflate\r\n" + "Accept-Language: en-us,fr\r\n" + "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n" + "Sec-WebSocket-Extensions: permessage-deflate; " + "client_max_window_bits\r\n" + "\r\n"; + std::string response2 = WebSocketStandardResponse(std::string()); + MockWrite writes[] = { + MockWrite(SYNCHRONOUS, 0, request1.c_str()), + MockWrite(SYNCHRONOUS, 2, request2.c_str()), + }; + MockRead reads[3] = { + MockRead(SYNCHRONOUS, 1, response1.c_str()), + MockRead(SYNCHRONOUS, 3, response2.c_str()), + MockRead(SYNCHRONOUS, ERR_IO_PENDING, 4), + }; + CreateAndConnectRawExpectations("ws://foo:bar@www.example.org/", + NoSubProtocols(), HttpRequestHeaders(), + BuildSocketData(reads, writes)); + WaitUntilConnectDone(); + EXPECT_FALSE(has_failed()); + EXPECT_TRUE(stream_); + ASSERT_TRUE(response_info_); + EXPECT_EQ(101, response_info_->headers->response_code()); +} + // Digest auth has the same connection semantics as Basic auth, so we can // generally assume that whatever works for Basic auth will also work for // Digest. There's just one test here, to confirm that it works at all. TEST_P(WebSocketStreamCreateDigestAuthTest, DigestPasswordInUrl) { - url_request_context_host_.AddRawExpectations( - helper_.BuildSocketData1(kUnauthorizedResponse)); + AddRawExpectations(helper_.BuildSocketData1(kUnauthorizedResponse)); CreateAndConnectRawExpectations( "ws://FooBar:pass@www.example.org/", NoSubProtocols(),
diff --git a/net/websockets/websocket_test_util.cc b/net/websockets/websocket_test_util.cc index 17a5931..0182d70 100644 --- a/net/websockets/websocket_test_util.cc +++ b/net/websockets/websocket_test_util.cc
@@ -253,9 +253,12 @@ return &url_request_context_; } -void TestWebSocketHandshakeStreamCreateHelper::OnBasicStreamCreated( - WebSocketBasicHandshakeStream* stream) { - stream->SetWebSocketKeyForTesting("dGhlIHNhbXBsZSBub25jZQ=="); +void TestWebSocketStreamRequestAPI::OnBasicHandshakeStreamCreated( + WebSocketBasicHandshakeStream* handshake_stream) { + handshake_stream->SetWebSocketKeyForTesting("dGhlIHNhbXBsZSBub25jZQ=="); } +void TestWebSocketStreamRequestAPI::OnHttp2HandshakeStreamCreated( + WebSocketHttp2HandshakeStream* handshake_stream) {} + } // namespace net
diff --git a/net/websockets/websocket_test_util.h b/net/websockets/websocket_test_util.h index ba5de5fd..d746429a 100644 --- a/net/websockets/websocket_test_util.h +++ b/net/websockets/websocket_test_util.h
@@ -190,23 +190,26 @@ bool fatal) override {} }; -// WebSocketStreamRequest implementation that does nothing. -class DummyWebSocketStreamRequest : public WebSocketStreamRequest { +// WebSocketStreamRequestAPI implementation that sets the value of +// Sec-WebSocket-Key to the deterministic key that is used by tests. +class TestWebSocketStreamRequestAPI : public WebSocketStreamRequestAPI { public: - DummyWebSocketStreamRequest() = default; - ~DummyWebSocketStreamRequest() override = default; - void OnHandshakeStreamCreated( - WebSocketHandshakeStreamBase* handshake_stream) override {} + TestWebSocketStreamRequestAPI() = default; + ~TestWebSocketStreamRequestAPI() override = default; + void OnBasicHandshakeStreamCreated( + WebSocketBasicHandshakeStream* handshake_stream) override; + void OnHttp2HandshakeStreamCreated( + WebSocketHttp2HandshakeStream* handshake_stream) override; void OnFailure(const std::string& message) override {} }; // A sub-class of WebSocketHandshakeStreamCreateHelper which sets a -// deterministic key to use in the WebSocket handshake, and optionally uses a -// dummy ConnectDelegate and a dummy WebSocketStreamRequest. +// deterministic key to use in the WebSocket handshake, and uses a dummy +// ConnectDelegate and WebSocketStreamRequestAPI. class TestWebSocketHandshakeStreamCreateHelper : public WebSocketHandshakeStreamCreateHelper { public: - // Constructor for using dummy ConnectDelegate and WebSocketStreamRequest. + // Constructor for using dummy ConnectDelegate and WebSocketStreamRequestAPI. TestWebSocketHandshakeStreamCreateHelper() : WebSocketHandshakeStreamCreateHelper( &connect_delegate_, @@ -214,22 +217,11 @@ WebSocketHandshakeStreamCreateHelper::set_stream_request(&request_); } - // Constructor for using custom ConnectDelegate and subprotocols. - // Caller must call set_stream_request() with a WebSocketStreamRequest before - // calling CreateBasicStream(). - TestWebSocketHandshakeStreamCreateHelper( - WebSocketStream::ConnectDelegate* connect_delegate, - const std::vector<std::string>& requested_subprotocols) - : WebSocketHandshakeStreamCreateHelper(connect_delegate, - requested_subprotocols) {} - ~TestWebSocketHandshakeStreamCreateHelper() override = default; - void OnBasicStreamCreated(WebSocketBasicHandshakeStream* stream) override; - private: DummyConnectDelegate connect_delegate_; - DummyWebSocketStreamRequest request_; + TestWebSocketStreamRequestAPI request_; DISALLOW_COPY_AND_ASSIGN(TestWebSocketHandshakeStreamCreateHelper); };
diff --git a/services/identity/public/cpp/identity_manager.h b/services/identity/public/cpp/identity_manager.h index 60aa33b7..4f5a03d 100644 --- a/services/identity/public/cpp/identity_manager.h +++ b/services/identity/public/cpp/identity_manager.h
@@ -148,11 +148,9 @@ private: // These clients need to call SetPrimaryAccountSynchronouslyForTests(). - friend void MakePrimaryAccountAvailable( - SigninManagerBase* signin_manager, - ProfileOAuth2TokenService* token_service, - IdentityManager* identity_manager, - const std::string& email); + friend std::string SetPrimaryAccount(SigninManagerBase* signin_manager, + IdentityManager* identity_manager, + const std::string& email); friend MultiProfileDownloadNotificationTest; friend ProfileSyncServiceHarness; friend file_manager::MultiProfileFileManagerBrowserTest;
diff --git a/services/identity/public/cpp/identity_test_environment.cc b/services/identity/public/cpp/identity_test_environment.cc index 916fd0f..887e275 100644 --- a/services/identity/public/cpp/identity_test_environment.cc +++ b/services/identity/public/cpp/identity_test_environment.cc
@@ -97,10 +97,23 @@ return internals_->identity_manager(); } -void IdentityTestEnvironment::MakePrimaryAccountAvailable(std::string email) { - identity::MakePrimaryAccountAvailable(internals_->signin_manager(), - internals_->token_service(), - internals_->identity_manager(), email); +std::string IdentityTestEnvironment::SetPrimaryAccount( + const std::string& email) { + return identity::SetPrimaryAccount(internals_->signin_manager(), + internals_->identity_manager(), email); +} + +void IdentityTestEnvironment::SetRefreshTokenForAccount( + const std::string& account_id) { + identity::SetRefreshTokenForAccount( + internals_->token_service(), internals_->identity_manager(), account_id); +} + +std::string IdentityTestEnvironment::MakePrimaryAccountAvailable( + const std::string& email) { + return identity::MakePrimaryAccountAvailable( + internals_->signin_manager(), internals_->token_service(), + internals_->identity_manager(), email); } void IdentityTestEnvironment::ClearPrimaryAccount() {
diff --git a/services/identity/public/cpp/identity_test_environment.h b/services/identity/public/cpp/identity_test_environment.h index cd65ebc2..be5fccb 100644 --- a/services/identity/public/cpp/identity_test_environment.h +++ b/services/identity/public/cpp/identity_test_environment.h
@@ -23,12 +23,23 @@ // The IdentityManager instance created and owned by this instance. IdentityManager* identity_manager(); + // Sets the primary account for the given email address, generating a GAIA ID + // that corresponds uniquely to that email address. On non-ChromeOS, results + // in the firing of the IdentityManager and SigninManager callbacks for signin + // success. Blocks until the primary account is set. Returns the account ID + // of the newly-set account. + std::string SetPrimaryAccount(const std::string& email); + + // Sets a refresh token that corresponds uniquely to |account_id|. Blocks + // until the refresh token is set. + void SetRefreshTokenForAccount(const std::string& account_id); + // Makes the primary account available for the given email address, generating // a GAIA ID and refresh token that correspond uniquely to that email address. // On non-ChromeOS platforms, this will also result in the firing of the // IdentityManager and SigninManager callbacks for signin success. On all // platforms, this method blocks until the primary account is available. - void MakePrimaryAccountAvailable(std::string email); + std::string MakePrimaryAccountAvailable(const std::string& email); // Clears the primary account. On non-ChromeOS, results in the firing of the // IdentityManager and SigninManager callbacks for signout. Blocks until the
diff --git a/services/identity/public/cpp/identity_test_utils.cc b/services/identity/public/cpp/identity_test_utils.cc index 905ce4b..462ef13 100644 --- a/services/identity/public/cpp/identity_test_utils.cc +++ b/services/identity/public/cpp/identity_test_utils.cc
@@ -59,20 +59,19 @@ } // namespace -void MakePrimaryAccountAvailable(SigninManagerBase* signin_manager, - ProfileOAuth2TokenService* token_service, - IdentityManager* identity_manager, - const std::string& email) { +std::string SetPrimaryAccount(SigninManagerBase* signin_manager, + IdentityManager* identity_manager, + const std::string& email) { DCHECK(!signin_manager->IsAuthenticated()); DCHECK(!identity_manager->HasPrimaryAccount()); std::string gaia_id = "gaia_id_for_" + email; - std::string refresh_token = "refresh_token_for_" + email; #if defined(OS_CHROMEOS) // ChromeOS has no real notion of signin, so just plumb the information - // through. - identity_manager->SetPrimaryAccountSynchronouslyForTests(gaia_id, email, - refresh_token); + // through (note: supply an empty string as the refresh token so that no + // refresh token is set). + identity_manager->SetPrimaryAccountSynchronously(gaia_id, email, + /*refresh_token=*/""); #else base::RunLoop run_loop; @@ -85,15 +84,37 @@ // callback) to make this work with both SigninManager and FakeSigninManager. // If we would pass a null callback, then SigninManager would call // CompletePendingSignin directly, but FakeSigninManager never does that. + // Note: pass an empty string as the refresh token so that no refresh token is + // set. real_signin_manager->StartSignInWithRefreshToken( - refresh_token, gaia_id, email, /*password=*/"", + /*refresh_token=*/"", gaia_id, email, /*password=*/"", /*oauth_fetched_callback=*/base::DoNothing()); real_signin_manager->CompletePendingSignin(); - token_service->UpdateCredentials( - real_signin_manager->GetAuthenticatedAccountId(), refresh_token); run_loop.Run(); #endif + + DCHECK(signin_manager->IsAuthenticated()); + DCHECK(identity_manager->HasPrimaryAccount()); + return identity_manager->GetPrimaryAccountInfo().account_id; +} + +void SetRefreshTokenForAccount(ProfileOAuth2TokenService* token_service, + IdentityManager* identity_manager, + const std::string& account_id) { + std::string refresh_token = "refresh_token_for_" + account_id; + token_service->UpdateCredentials(account_id, refresh_token); +} + +std::string MakePrimaryAccountAvailable( + SigninManagerBase* signin_manager, + ProfileOAuth2TokenService* token_service, + IdentityManager* identity_manager, + const std::string& email) { + std::string account_id = + SetPrimaryAccount(signin_manager, identity_manager, email); + SetRefreshTokenForAccount(token_service, identity_manager, account_id); + return account_id; } void ClearPrimaryAccount(SigninManagerForTest* signin_manager,
diff --git a/services/identity/public/cpp/identity_test_utils.h b/services/identity/public/cpp/identity_test_utils.h index 3b92a43..17f7d3a 100644 --- a/services/identity/public/cpp/identity_test_utils.h +++ b/services/identity/public/cpp/identity_test_utils.h
@@ -32,15 +32,34 @@ class IdentityManager; +// Sets the primary account for the given email address, generating a GAIA ID +// that corresponds uniquely to that email address. On non-ChromeOS, results in +// the firing of the IdentityManager and SigninManager callbacks for signin +// success. Blocks until the primary account is set. Returns the account ID +// of the newly-set account. +// NOTE: See disclaimer at top of file re: direct usage. +std::string SetPrimaryAccount(SigninManagerBase* signin_manager, + IdentityManager* identity_manager, + const std::string& email); + +// Sets a refresh token that corresponds uniquely to |account_id|. Blocks until +// the refresh token is set. +// NOTE: See disclaimer at top of file re: direct usage. +void SetRefreshTokenForAccount(ProfileOAuth2TokenService* token_service, + IdentityManager* identity_manager, + const std::string& account_id); + // Makes the primary account available for the given email address, generating a // GAIA ID and refresh token that correspond uniquely to that email address. On // non-ChromeOS, results in the firing of the IdentityManager and SigninManager // callbacks for signin success. Blocks until the primary account is available. +// Returns the account ID of the newly-available account. // NOTE: See disclaimer at top of file re: direct usage. -void MakePrimaryAccountAvailable(SigninManagerBase* signin_manager, - ProfileOAuth2TokenService* token_service, - IdentityManager* identity_manager, - const std::string& email); +std::string MakePrimaryAccountAvailable( + SigninManagerBase* signin_manager, + ProfileOAuth2TokenService* token_service, + IdentityManager* identity_manager, + const std::string& email); // Clears the primary account. On non-ChromeOS, results in the firing of the // IdentityManager and SigninManager callbacks for signout. Blocks until the
diff --git a/services/identity/public/cpp/primary_account_access_token_fetcher_unittest.cc b/services/identity/public/cpp/primary_account_access_token_fetcher_unittest.cc index 86ae466..2e74ed8 100644 --- a/services/identity/public/cpp/primary_account_access_token_fetcher_unittest.cc +++ b/services/identity/public/cpp/primary_account_access_token_fetcher_unittest.cc
@@ -37,6 +37,7 @@ namespace identity { namespace { + void OnAccessTokenFetchComplete(base::OnceClosure done_closure, const GoogleServiceAuthError& expected_error, const std::string& expected_access_token, @@ -98,12 +99,15 @@ FakeProfileOAuth2TokenService* token_service() { return &token_service_; } SigninManagerForTest* signin_manager() { return signin_manager_.get(); } - void SignIn(const std::string& account) { + // Signs the user in to the primary account, returning the account ID. + const std::string& SignIn() { #if defined(OS_CHROMEOS) - signin_manager_->SignIn(account); + signin_manager_->SignIn("me@gmail.com"); #else - signin_manager_->SignIn(account, "user", "pass"); + signin_manager_->SignIn("my_gaia_id", "me@gmail.com", "my_password"); #endif // OS_CHROMEOS + + return signin_manager_->GetAuthenticatedAccountId(); } void set_on_access_token_request_callback(base::OnceClosure callback) { @@ -136,8 +140,8 @@ base::RunLoop run_loop; set_on_access_token_request_callback(run_loop.QuitClosure()); - SignIn("account"); - token_service()->UpdateCredentials("account", "refresh token"); + std::string account_id = SignIn(); + token_service()->UpdateCredentials(account_id, "refresh token"); // Signed in and refresh token already exists, so this should result in a // request for an access token. @@ -151,7 +155,7 @@ EXPECT_CALL(callback, Run(GoogleServiceAuthError::AuthErrorNone(), "access token")); token_service()->IssueAllTokensForAccount( - "account", "access token", + account_id, "access token", base::Time::Now() + base::TimeDelta::FromHours(1)); } @@ -162,8 +166,8 @@ base::RunLoop run_loop; set_on_access_token_request_callback(run_loop.QuitClosure()); - SignIn("account"); - token_service()->UpdateCredentials("account", "refresh token"); + std::string account_id = SignIn(); + token_service()->UpdateCredentials(account_id, "refresh token"); // Signed in and refresh token already exists, so this should result in a // request for an access token. @@ -178,7 +182,7 @@ EXPECT_CALL(callback, Run(GoogleServiceAuthError::AuthErrorNone(), "access token")); token_service()->IssueAllTokensForAccount( - "account", "access token", + account_id, "access token", base::Time::Now() + base::TimeDelta::FromHours(1)); } @@ -188,8 +192,8 @@ base::RunLoop run_loop; set_on_access_token_request_callback(run_loop.QuitClosure()); - SignIn("account"); - token_service()->UpdateCredentials("account", "refresh token"); + std::string account_id = SignIn(); + token_service()->UpdateCredentials(account_id, "refresh token"); // Signed in and refresh token already exists, so this should result in a // request for an access token. @@ -203,7 +207,7 @@ // Now fulfilling the access token request should have no effect. token_service()->IssueAllTokensForAccount( - "account", "access token", + account_id, "access token", base::Time::Now() + base::TimeDelta::FromHours(1)); } @@ -225,7 +229,7 @@ OneShotCallsBackWhenNoRefreshToken) { base::RunLoop run_loop; - SignIn("account"); + SignIn(); // Signed in, but there is no refresh token -> we should get called back. auto fetcher = CreateFetcher( @@ -264,9 +268,9 @@ callback.Get(), PrimaryAccountAccessTokenFetcher::Mode::kWaitUntilAvailable); - SignIn("account"); + std::string account_id = SignIn(); - token_service()->UpdateCredentials("account", "refresh token"); + token_service()->UpdateCredentials(account_id, "refresh token"); run_loop.Run(); @@ -275,60 +279,10 @@ EXPECT_CALL(callback, Run(GoogleServiceAuthError::AuthErrorNone(), "access token")); token_service()->IssueAllTokensForAccount( - "account", "access token", + account_id, "access token", base::Time::Now() + base::TimeDelta::FromHours(1)); } -TEST_F(PrimaryAccountAccessTokenFetcherTest, ShouldWaitForSignInInProgress) { - base::RunLoop run_loop; - set_on_access_token_request_callback(run_loop.QuitClosure()); - - TestTokenCallback callback; - - signin_manager()->set_auth_in_progress("account"); - - // A sign-in is currently in progress, so this should wait for the sign-in to - // complete. - auto fetcher = CreateFetcher( - callback.Get(), - PrimaryAccountAccessTokenFetcher::Mode::kWaitUntilAvailable); - - SignIn("account"); - token_service()->UpdateCredentials("account", "refresh token"); - - run_loop.Run(); - - // Once the access token request is fulfilled, we should get called back with - // the access token. - EXPECT_CALL(callback, - Run(GoogleServiceAuthError::AuthErrorNone(), "access token")); - token_service()->IssueAllTokensForAccount( - "account", "access token", - base::Time::Now() + base::TimeDelta::FromHours(1)); -} - -TEST_F(PrimaryAccountAccessTokenFetcherTest, ShouldWaitForFailedSignIn) { - TestTokenCallback callback; - - signin_manager()->set_auth_in_progress("account"); - - // A sign-in is currently in progress, so this should wait for the sign-in to - // complete. - auto fetcher = CreateFetcher( - callback.Get(), - PrimaryAccountAccessTokenFetcher::Mode::kWaitUntilAvailable); - - // The fetcher should detect the failed sign-in and call us with an empty - // access token. - EXPECT_CALL( - callback, - Run(GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED), - std::string())); - - signin_manager()->FailSignin( - GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED)); -} - #endif // !OS_CHROMEOS TEST_F(PrimaryAccountAccessTokenFetcherTest, ShouldWaitForRefreshToken) { @@ -337,7 +291,7 @@ TestTokenCallback callback; - SignIn("account"); + std::string account_id = SignIn(); // Signed in, but there is no refresh token -> we should not get called back // (yet). @@ -346,7 +300,7 @@ PrimaryAccountAccessTokenFetcher::Mode::kWaitUntilAvailable); // Getting a refresh token should result in a request for an access token. - token_service()->UpdateCredentials("account", "refresh token"); + token_service()->UpdateCredentials(account_id, "refresh token"); run_loop.Run(); @@ -355,7 +309,7 @@ EXPECT_CALL(callback, Run(GoogleServiceAuthError::AuthErrorNone(), "access token")); token_service()->IssueAllTokensForAccount( - "account", "access token", + account_id, "access token", base::Time::Now() + base::TimeDelta::FromHours(1)); } @@ -363,10 +317,10 @@ ShouldIgnoreRefreshTokensForOtherAccounts) { TestTokenCallback callback; - // Signed-in to "account", but there's only a refresh token for a different + // Signed-in to account_id, but there's only a refresh token for a different // account. - SignIn("account"); - token_service()->UpdateCredentials("account 2", "refresh"); + std::string account_id = SignIn(); + token_service()->UpdateCredentials(account_id + "2", "refresh"); // The fetcher should wait for the correct refresh token. auto fetcher = CreateFetcher( @@ -374,14 +328,14 @@ PrimaryAccountAccessTokenFetcher::Mode::kWaitUntilAvailable); // A refresh token for yet another account shouldn't matter either. - token_service()->UpdateCredentials("account 3", "refresh"); + token_service()->UpdateCredentials(account_id + "3", "refresh"); } TEST_F(PrimaryAccountAccessTokenFetcherTest, ShouldNotReturnEarlyWhenRefreshTokensLoaded) { TestTokenCallback callback; - SignIn("account"); + std::string account_id = SignIn(); // Signed in, but there is no refresh token -> we should not get called back // (yet). @@ -392,7 +346,7 @@ // Getting a refresh token for some other account should have no effect. // TODO(blundell): Move this into its own test case; while a useful check, // it's orthogonal to the main purpose of this test case. - token_service()->UpdateCredentials("different account", "refresh token"); + token_service()->UpdateCredentials(account_id + "2", "refresh token"); // The notification that all refresh tokens have been loaded by the token // service should have no effect either. @@ -406,7 +360,7 @@ set_on_access_token_request_callback(run_loop.QuitClosure()); // Getting a refresh token should result in a request for an access token. - token_service()->UpdateCredentials("account", "refresh token"); + token_service()->UpdateCredentials(account_id, "refresh token"); run_loop.Run(); // Once the access token request is fulfilled, we should get called back with @@ -414,7 +368,7 @@ EXPECT_CALL(callback, Run(GoogleServiceAuthError::AuthErrorNone(), "access token")); token_service()->IssueAllTokensForAccount( - "account", "access token", + account_id, "access token", base::Time::Now() + base::TimeDelta::FromHours(1)); } @@ -423,8 +377,8 @@ base::RunLoop run_loop; set_on_access_token_request_callback(run_loop.QuitClosure()); - SignIn("account"); - token_service()->UpdateCredentials("account", "refresh token"); + std::string account_id = SignIn(); + token_service()->UpdateCredentials(account_id, "refresh token"); base::RunLoop run_loop2; @@ -440,7 +394,7 @@ // A canceled access token request should result in a callback. token_service()->IssueErrorForAllPendingRequestsForAccount( - "account", + account_id, GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED)); run_loop2.Run(); @@ -453,8 +407,8 @@ TestTokenCallback callback; - SignIn("account"); - token_service()->UpdateCredentials("account", "refresh token"); + std::string account_id = SignIn(); + token_service()->UpdateCredentials(account_id, "refresh token"); // Signed in and refresh token already exists, so this should result in a // request for an access token. @@ -470,7 +424,7 @@ // A canceled access token request should get retried once. token_service()->IssueErrorForAllPendingRequestsForAccount( - "account", + account_id, GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED)); run_loop2.Run(); @@ -480,7 +434,7 @@ EXPECT_CALL(callback, Run(GoogleServiceAuthError::AuthErrorNone(), "access token")); token_service()->IssueAllTokensForAccount( - "account", "access token", + account_id, "access token", base::Time::Now() + base::TimeDelta::FromHours(1)); } @@ -491,8 +445,8 @@ TestTokenCallback callback; - SignIn("account"); - token_service()->UpdateCredentials("account", "refresh token"); + std::string account_id = SignIn(); + token_service()->UpdateCredentials(account_id, "refresh token"); // Signed in and refresh token already exists, so this should result in a // request for an access token. @@ -508,7 +462,7 @@ // A canceled access token request should get retried once. token_service()->IssueErrorForAllPendingRequestsForAccount( - "account", + account_id, GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED)); run_loop2.Run(); @@ -520,7 +474,7 @@ Run(GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED), std::string())); token_service()->IssueErrorForAllPendingRequestsForAccount( - "account", + account_id, GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED)); } @@ -533,8 +487,8 @@ TestTokenCallback callback; - SignIn("account"); - token_service()->UpdateCredentials("account", "refresh token"); + std::string account_id = SignIn(); + token_service()->UpdateCredentials(account_id, "refresh token"); // Signed in and refresh token already exists, so this should result in a // request for an access token. @@ -553,7 +507,7 @@ Run(GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED), std::string())); token_service()->IssueErrorForAllPendingRequestsForAccount( - "account", + account_id, GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED)); } @@ -566,8 +520,8 @@ TestTokenCallback callback; - SignIn("account"); - token_service()->UpdateCredentials("account", "refresh token"); + std::string account_id = SignIn(); + token_service()->UpdateCredentials(account_id, "refresh token"); // Signed in and refresh token already exists, so this should result in a // request for an access token. @@ -579,13 +533,13 @@ // Simulate the refresh token getting invalidated. In this case, pending // access token requests get canceled, and the fetcher should *not* retry. - token_service()->RevokeCredentials("account"); + token_service()->RevokeCredentials(account_id); EXPECT_CALL( callback, Run(GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED), std::string())); token_service()->IssueErrorForAllPendingRequestsForAccount( - "account", + account_id, GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED)); } @@ -596,8 +550,8 @@ TestTokenCallback callback; - SignIn("account"); - token_service()->UpdateCredentials("account", "refresh token"); + std::string account_id = SignIn(); + token_service()->UpdateCredentials(account_id, "refresh token"); // Signed in and refresh token already exists, so this should result in a // request for an access token. @@ -614,7 +568,7 @@ Run(GoogleServiceAuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE), std::string())); token_service()->IssueErrorForAllPendingRequestsForAccount( - "account", + account_id, GoogleServiceAuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE)); }
diff --git a/services/shape_detection/BUILD.gn b/services/shape_detection/BUILD.gn index e5e1b90..cebf738 100644 --- a/services/shape_detection/BUILD.gn +++ b/services/shape_detection/BUILD.gn
@@ -8,7 +8,7 @@ source_set("lib") { sources = [ - "barcode_detection_impl.h", + "barcode_detection_provider_impl.h", "shape_detection_service.cc", "shape_detection_service.h", "text_detection_impl.h", @@ -32,7 +32,7 @@ libs = [ "QuartzCore.framework" ] } else if (is_win) { sources += [ - "barcode_detection_impl.cc", + "barcode_detection_provider_impl.cc", "detection_utils_win.cc", "detection_utils_win.h", "face_detection_impl_win.cc", @@ -44,7 +44,7 @@ ] } else { sources += [ - "barcode_detection_impl.cc", + "barcode_detection_provider_impl.cc", "face_detection_provider_impl.cc", "face_detection_provider_impl.h", "text_detection_impl.cc", @@ -80,6 +80,7 @@ android_library("shape_detection_java") { java_files = [ "android/java/src/org/chromium/shape_detection/BarcodeDetectionImpl.java", + "android/java/src/org/chromium/shape_detection/BarcodeDetectionProviderImpl.java", "android/java/src/org/chromium/shape_detection/FaceDetectionImpl.java", "android/java/src/org/chromium/shape_detection/FaceDetectionImplGmsCore.java", "android/java/src/org/chromium/shape_detection/FaceDetectionProviderImpl.java",
diff --git a/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionImpl.java b/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionImpl.java index 8198154..2d34df7 100644 --- a/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionImpl.java +++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionImpl.java
@@ -8,8 +8,6 @@ import android.graphics.Rect; import android.util.SparseArray; -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.GoogleApiAvailability; import com.google.android.gms.vision.Frame; import com.google.android.gms.vision.barcode.Barcode; import com.google.android.gms.vision.barcode.BarcodeDetector; @@ -19,9 +17,9 @@ import org.chromium.gfx.mojom.PointF; import org.chromium.gfx.mojom.RectF; import org.chromium.mojo.system.MojoException; -import org.chromium.services.service_manager.InterfaceFactory; import org.chromium.shape_detection.mojom.BarcodeDetection; import org.chromium.shape_detection.mojom.BarcodeDetectionResult; +import org.chromium.shape_detection.mojom.BarcodeDetectorOptions; /** * Implementation of mojo BarcodeDetection, using Google Play Services vision package. @@ -31,7 +29,10 @@ private BarcodeDetector mBarcodeDetector; - public BarcodeDetectionImpl() { + public BarcodeDetectionImpl(BarcodeDetectorOptions options) { + // TODO(mcasas): extract the barcode formats to hunt for out of + // |options| and use them for building |mBarcodeDetector|. + // https://crbug.com/582266. mBarcodeDetector = new BarcodeDetector.Builder(ContextUtils.getApplicationContext()).build(); } @@ -88,22 +89,4 @@ public void onConnectionError(MojoException e) { close(); } - - /** - * A factory class to register BarcodeDetection interface. - */ - public static class Factory implements InterfaceFactory<BarcodeDetection> { - public Factory() {} - - @Override - public BarcodeDetection createImpl() { - if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable( - ContextUtils.getApplicationContext()) - != ConnectionResult.SUCCESS) { - Log.e(TAG, "Google Play Services not available"); - return null; - } - return new BarcodeDetectionImpl(); - } - } }
diff --git a/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionProviderImpl.java b/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionProviderImpl.java new file mode 100644 index 0000000..f4410a8 --- /dev/null +++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionProviderImpl.java
@@ -0,0 +1,65 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.shape_detection; + +import com.google.android.gms.common.ConnectionResult; +import com.google.android.gms.common.GoogleApiAvailability; +import com.google.android.gms.vision.barcode.Barcode; + +import org.chromium.base.ContextUtils; +import org.chromium.base.Log; +import org.chromium.mojo.bindings.InterfaceRequest; +import org.chromium.mojo.system.MojoException; +import org.chromium.services.service_manager.InterfaceFactory; +import org.chromium.shape_detection.mojom.BarcodeDetection; +import org.chromium.shape_detection.mojom.BarcodeDetectionProvider; +import org.chromium.shape_detection.mojom.BarcodeDetectorOptions; + +/** + * Service provider to create BarcodeDetection services + */ +public class BarcodeDetectionProviderImpl implements BarcodeDetectionProvider { + private static final String TAG = "BarcodeProviderImpl"; + + public BarcodeDetectionProviderImpl() {} + + @Override + public void createBarcodeDetection( + InterfaceRequest<BarcodeDetection> request, BarcodeDetectorOptions options) { + BarcodeDetection.MANAGER.bind(new BarcodeDetectionImpl(options), request); + } + + @Override + public void enumerateSupportedFormats(EnumerateSupportedFormatsResponse callback) { + int[] supportedFormats = {Barcode.AZTEC, Barcode.CODE_128, Barcode.CODE_39, Barcode.CODE_93, + Barcode.CODABAR, Barcode.DATA_MATRIX, Barcode.EAN_13, Barcode.EAN_8, Barcode.ITF, + Barcode.PDF417, Barcode.QR_CODE, Barcode.UPC_A, Barcode.UPC_E}; + callback.call(supportedFormats); + } + + @Override + public void close() {} + + @Override + public void onConnectionError(MojoException e) {} + + /** + * A factory class to register BarcodeDetectionProvider interface. + */ + public static class Factory implements InterfaceFactory<BarcodeDetectionProvider> { + public Factory() {} + + @Override + public BarcodeDetectionProvider createImpl() { + if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable( + ContextUtils.getApplicationContext()) + != ConnectionResult.SUCCESS) { + Log.e(TAG, "Google Play Services not available"); + return null; + } + return new BarcodeDetectionProviderImpl(); + } + } +}
diff --git a/services/shape_detection/android/java/src/org/chromium/shape_detection/InterfaceRegistrar.java b/services/shape_detection/android/java/src/org/chromium/shape_detection/InterfaceRegistrar.java index c52e2279..fd6b559e 100644 --- a/services/shape_detection/android/java/src/org/chromium/shape_detection/InterfaceRegistrar.java +++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/InterfaceRegistrar.java
@@ -8,7 +8,7 @@ import org.chromium.base.annotations.JNINamespace; import org.chromium.mojo.system.impl.CoreImpl; import org.chromium.services.service_manager.InterfaceRegistry; -import org.chromium.shape_detection.mojom.BarcodeDetection; +import org.chromium.shape_detection.mojom.BarcodeDetectionProvider; import org.chromium.shape_detection.mojom.FaceDetectionProvider; import org.chromium.shape_detection.mojom.TextDetection; @@ -20,7 +20,8 @@ // is not necessary to hold on to a reference to it explicitly. InterfaceRegistry registry = InterfaceRegistry.create( CoreImpl.getInstance().acquireNativeHandle(nativeHandle).toMessagePipeHandle()); - registry.addInterface(BarcodeDetection.MANAGER, new BarcodeDetectionImpl.Factory()); + registry.addInterface( + BarcodeDetectionProvider.MANAGER, new BarcodeDetectionProviderImpl.Factory()); registry.addInterface( FaceDetectionProvider.MANAGER, new FaceDetectionProviderImpl.Factory()); registry.addInterface(TextDetection.MANAGER, new TextDetectionImpl.Factory());
diff --git a/services/shape_detection/android/javatests/src/org/chromium/shape_detection/BarcodeDetectionImplTest.java b/services/shape_detection/android/javatests/src/org/chromium/shape_detection/BarcodeDetectionImplTest.java index d4c7254..cfdc07f 100644 --- a/services/shape_detection/android/javatests/src/org/chromium/shape_detection/BarcodeDetectionImplTest.java +++ b/services/shape_detection/android/javatests/src/org/chromium/shape_detection/BarcodeDetectionImplTest.java
@@ -14,6 +14,7 @@ import org.chromium.base.test.util.Feature; import org.chromium.shape_detection.mojom.BarcodeDetection; import org.chromium.shape_detection.mojom.BarcodeDetectionResult; +import org.chromium.shape_detection.mojom.BarcodeDetectorOptions; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.TimeUnit; @@ -27,7 +28,8 @@ TestUtils.mojoBitmapFromFile("qr_code.png"); private static BarcodeDetectionResult[] detect(org.chromium.skia.mojom.Bitmap mojoBitmap) { - BarcodeDetection detector = new BarcodeDetectionImpl(); + BarcodeDetectorOptions options = new BarcodeDetectorOptions(); + BarcodeDetection detector = new BarcodeDetectionImpl(options); final ArrayBlockingQueue<BarcodeDetectionResult[]> queue = new ArrayBlockingQueue<>(1); detector.detect(mojoBitmap, new BarcodeDetection.DetectResponse() {
diff --git a/services/shape_detection/barcode_detection_impl.cc b/services/shape_detection/barcode_detection_impl.cc deleted file mode 100644 index edfb6b4d..0000000 --- a/services/shape_detection/barcode_detection_impl.cc +++ /dev/null
@@ -1,15 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "services/shape_detection/barcode_detection_impl.h" - -namespace shape_detection { - -// static -void BarcodeDetectionImpl::Create( - shape_detection::mojom::BarcodeDetectionRequest request) { - DLOG(ERROR) << "Platform not supported for Barcode Detection Service."; -} - -} // namespace shape_detection
diff --git a/services/shape_detection/barcode_detection_impl.h b/services/shape_detection/barcode_detection_impl.h deleted file mode 100644 index 8c550bc..0000000 --- a/services/shape_detection/barcode_detection_impl.h +++ /dev/null
@@ -1,24 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SERVICES_SHAPE_DETECTION_BARCODE_DETECTION_IMPL_H_ -#define SERVICES_SHAPE_DETECTION_BARCODE_DETECTION_IMPL_H_ - -#include "services/shape_detection/public/mojom/barcodedetection.mojom.h" - -namespace shape_detection { - -class BarcodeDetectionImpl { - public: - static void Create(shape_detection::mojom::BarcodeDetectionRequest request); - - private: - ~BarcodeDetectionImpl() = default; - - DISALLOW_COPY_AND_ASSIGN(BarcodeDetectionImpl); -}; - -} // namespace shape_detection - -#endif // SERVICES_SHAPE_DETECTION_BARCODE_DETECTION_IMPL_H_
diff --git a/services/shape_detection/barcode_detection_impl_mac.mm b/services/shape_detection/barcode_detection_impl_mac.mm index 99c8287..c851e1cb 100644 --- a/services/shape_detection/barcode_detection_impl_mac.mm +++ b/services/shape_detection/barcode_detection_impl_mac.mm
@@ -9,14 +9,15 @@ #include "base/mac/sdk_forward_declarations.h" #include "base/strings/sys_string_conversions.h" #include "mojo/public/cpp/bindings/strong_binding.h" -#include "services/shape_detection/barcode_detection_impl.h" +#include "services/shape_detection/barcode_detection_provider_impl.h" #include "services/shape_detection/detection_utils_mac.h" namespace shape_detection { // static -void BarcodeDetectionImpl::Create( - shape_detection::mojom::BarcodeDetectionRequest request) { +void BarcodeDetectionProviderImpl::CreateBarcodeDetection( + shape_detection::mojom::BarcodeDetectionRequest request, + shape_detection::mojom::BarcodeDetectorOptionsPtr options) { // Barcode detection needs at least MAC OS X 10.10. if (@available(macOS 10.10, *)) { mojo::MakeStrongBinding(std::make_unique<BarcodeDetectionImplMac>(), @@ -24,6 +25,12 @@ } } +void BarcodeDetectionProviderImpl::EnumerateSupportedFormats( + EnumerateSupportedFormatsCallback callback) { + // Mac implementation supports only one BarcodeFormat. + std::move(callback).Run({mojom::BarcodeFormat::QR_CODE}); +} + BarcodeDetectionImplMac::BarcodeDetectionImplMac() { NSDictionary* const options = @{CIDetectorAccuracy : CIDetectorAccuracyHigh}; detector_.reset([[CIDetector detectorOfType:CIDetectorTypeQRCode
diff --git a/services/shape_detection/barcode_detection_impl_mac_unittest.mm b/services/shape_detection/barcode_detection_impl_mac_unittest.mm index 386dbe9..104b0a1 100644 --- a/services/shape_detection/barcode_detection_impl_mac_unittest.mm +++ b/services/shape_detection/barcode_detection_impl_mac_unittest.mm
@@ -46,7 +46,7 @@ } if (@available(macOS 10.10, *)) { - impl_.reset(new BarcodeDetectionImplMac); + impl_.reset(new BarcodeDetectionImplMac()); const std::string kInfoString = "https://www.chromium.org"; // Generate a QR code image as a CIImage by using |qr_code_generator|. NSData* const qr_code_data =
diff --git a/services/shape_detection/barcode_detection_provider_impl.cc b/services/shape_detection/barcode_detection_provider_impl.cc new file mode 100644 index 0000000..518f7f5d --- /dev/null +++ b/services/shape_detection/barcode_detection_provider_impl.cc
@@ -0,0 +1,23 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "services/shape_detection/barcode_detection_provider_impl.h" + +#include "base/logging.h" + +namespace shape_detection { + +void BarcodeDetectionProviderImpl::CreateBarcodeDetection( + shape_detection::mojom::BarcodeDetectionRequest request, + shape_detection::mojom::BarcodeDetectorOptionsPtr options) { + DLOG(ERROR) << "Platform not supported for Barcode Detection Service."; +} + +void BarcodeDetectionProviderImpl::EnumerateSupportedFormats( + EnumerateSupportedFormatsCallback callback) { + DLOG(ERROR) << "Platform not supported for Barcode Detection Service."; + std::move(callback).Run({}); +} + +} // namespace shape_detection
diff --git a/services/shape_detection/barcode_detection_provider_impl.h b/services/shape_detection/barcode_detection_provider_impl.h new file mode 100644 index 0000000..1a16b87 --- /dev/null +++ b/services/shape_detection/barcode_detection_provider_impl.h
@@ -0,0 +1,36 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SERVICES_SHAPE_DETECTION_BARCODE_DETECTION_PROVIDER_IMPL_H_ +#define SERVICES_SHAPE_DETECTION_BARCODE_DETECTION_PROVIDER_IMPL_H_ + +#include <memory> +#include <utility> + +#include "mojo/public/cpp/bindings/strong_binding.h" +#include "services/shape_detection/public/mojom/barcodedetection_provider.mojom.h" + +namespace shape_detection { + +class BarcodeDetectionProviderImpl + : public shape_detection::mojom::BarcodeDetectionProvider { + public: + ~BarcodeDetectionProviderImpl() override = default; + + static void Create( + shape_detection::mojom::BarcodeDetectionProviderRequest request) { + mojo::MakeStrongBinding(std::make_unique<BarcodeDetectionProviderImpl>(), + std::move(request)); + } + + void CreateBarcodeDetection( + shape_detection::mojom::BarcodeDetectionRequest request, + shape_detection::mojom::BarcodeDetectorOptionsPtr options) override; + void EnumerateSupportedFormats( + EnumerateSupportedFormatsCallback callback) override; +}; + +} // namespace shape_detection + +#endif // SERVICES_SHAPE_DETECTION_BARCODE_DETECTION_PROVIDER_IMPL_H_
diff --git a/services/shape_detection/manifest.json b/services/shape_detection/manifest.json index 1f67f8dd..17669ed3 100644 --- a/services/shape_detection/manifest.json +++ b/services/shape_detection/manifest.json
@@ -5,7 +5,7 @@ "service_manager:connector": { "provides": { "face_detection": [ "shape_detection.mojom.FaceDetectionProvider" ], - "barcode_detection": [ "shape_detection.mojom.BarcodeDetection" ], + "barcode_detection": [ "shape_detection.mojom.BarcodeDetectionProvider" ], "text_detection": [ "shape_detection.mojom.TextDetection" ] }, "requires": {
diff --git a/services/shape_detection/public/mojom/BUILD.gn b/services/shape_detection/public/mojom/BUILD.gn index 52292ab..bdc895a88 100644 --- a/services/shape_detection/public/mojom/BUILD.gn +++ b/services/shape_detection/public/mojom/BUILD.gn
@@ -7,6 +7,7 @@ mojom("mojom") { sources = [ "barcodedetection.mojom", + "barcodedetection_provider.mojom", "constants.mojom", "facedetection.mojom", "facedetection_provider.mojom",
diff --git a/services/shape_detection/public/mojom/barcodedetection_provider.mojom b/services/shape_detection/public/mojom/barcodedetection_provider.mojom new file mode 100644 index 0000000..20c57e5b --- /dev/null +++ b/services/shape_detection/public/mojom/barcodedetection_provider.mojom
@@ -0,0 +1,39 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://wicg.github.io/shape-detection-api/#api + +module shape_detection.mojom; + +import "services/shape_detection/public/mojom/barcodedetection.mojom"; + +// https://wicg.github.io/shape-detection-api/#barcodeformat-section +enum BarcodeFormat { + AZTEC, + CODE_128, + CODE_39, + CODE_93, + CODABAR, + DATA_MATRIX, + EAN_13, + EAN_8, + ITF, + PDF417, + QR_CODE, + UNKNOWN, + UPC_A, + UPC_E +}; + +// https://wicg.github.io/shape-detection-api/#barcodedetectoroptions-section +struct BarcodeDetectorOptions { + array<BarcodeFormat> formats; +}; + +interface BarcodeDetectionProvider { + CreateBarcodeDetection(BarcodeDetection& request, + BarcodeDetectorOptions options); + + EnumerateSupportedFormats() => (array<BarcodeFormat> supported_formats); +};
diff --git a/services/shape_detection/shape_detection_service.cc b/services/shape_detection/shape_detection_service.cc index 27809ed..b240183 100644 --- a/services/shape_detection/shape_detection_service.cc +++ b/services/shape_detection/shape_detection_service.cc
@@ -11,7 +11,7 @@ #include "base/macros.h" #include "build/build_config.h" #include "services/service_manager/public/cpp/service_context.h" -#include "services/shape_detection/barcode_detection_impl.h" +#include "services/shape_detection/barcode_detection_provider_impl.h" #if defined(OS_WIN) #include "services/shape_detection/face_detection_provider_win.h" #elif defined(OS_MACOSX) @@ -42,24 +42,25 @@ #if defined(OS_ANDROID) registry_.AddInterface( - GetJavaInterfaces()->CreateInterfaceFactory<mojom::BarcodeDetection>()); + GetJavaInterfaces() + ->CreateInterfaceFactory<mojom::BarcodeDetectionProvider>()); registry_.AddInterface( GetJavaInterfaces() ->CreateInterfaceFactory<mojom::FaceDetectionProvider>()); registry_.AddInterface( GetJavaInterfaces()->CreateInterfaceFactory<mojom::TextDetection>()); #elif defined(OS_WIN) - registry_.AddInterface(base::Bind(&BarcodeDetectionImpl::Create)); + registry_.AddInterface(base::Bind(&BarcodeDetectionProviderImpl::Create)); registry_.AddInterface(base::Bind(&TextDetectionImpl::Create)); registry_.AddInterface(base::Bind(&FaceDetectionProviderWin::Create)); #elif defined(OS_MACOSX) - registry_.AddInterface(base::Bind(&BarcodeDetectionImpl::Create)); + registry_.AddInterface(base::Bind(&BarcodeDetectionProviderImpl::Create)); registry_.AddInterface(base::Bind(&TextDetectionImpl::Create)); registry_.AddInterface(base::Bind(&FaceDetectionProviderMac::Create)); #else - registry_.AddInterface(base::Bind(&BarcodeDetectionImpl::Create)); - registry_.AddInterface(base::Bind(&TextDetectionImpl::Create)); + registry_.AddInterface(base::Bind(&BarcodeDetectionProviderImpl::Create)); registry_.AddInterface(base::Bind(&FaceDetectionProviderImpl::Create)); + registry_.AddInterface(base::Bind(&TextDetectionImpl::Create)); #endif }
diff --git a/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter b/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter index c86b57e..a789439 100644 --- a/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter +++ b/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter
@@ -5,11 +5,6 @@ # https://crbug.com/715640 -ServiceWorkerNavigationPreloadTest.CanceledByInterceptor -ServiceWorkerNavigationPreloadTest.RespondWithNavigationPreloadWithMimeSniffing --ServiceWorkerV8CodeCacheForCacheStorageTest.V8CacheOnCacheStorage - -# ServiceWorker restart needs to read installed scripts. -# https://crbug.com/756312 --ServiceWorkerVersionBrowserV8CacheTest.Restart # https://crbug.com/721398 -ClearSiteDataThrottleBrowserTest.CacheIntegrationTest @@ -70,6 +65,9 @@ # https://crbug.com/797292. Still failing, cause unknown. -BlockedSchemeNavigationBrowserTest.WindowOpenRedirectAndBack/1 +# https://crbug.com/842563 +-ServiceWorkerVersionBrowserTest.UpdateBypassesCacheAfter24Hours + # NOTE: if adding an exclusion for an existing failure (e.g. additional test for # feature X that is already not working), please add it beside the existing # failures. Otherwise please reach out to network-service-dev@.
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG index fd8e86d..db16ac7 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -1043,9 +1043,6 @@ crbug.com/591099 paint/invalidation/scroll/fixed-with-border-under-composited-absolute-scrolled.html [ Crash ] crbug.com/591099 paint/invalidation/scroll/invalidate-after-composited-scroll-of-window.html [ Failure ] crbug.com/591099 paint/invalidation/scroll/line-in-scrolled-clipped-block.html [ Failure ] -crbug.com/591099 paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-lr.html [ Failure Pass ] -crbug.com/591099 paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-rl.html [ Failure Pass ] -crbug.com/591099 paint/invalidation/selection/invalidation-rect-with-br-includes-newline.html [ Failure Pass ] crbug.com/591099 paint/invalidation/selection/japanese-rl-selection-clear.html [ Failure ] crbug.com/591099 paint/invalidation/selection/japanese-rl-selection-repaint.html [ Failure ] crbug.com/591099 paint/invalidation/selection/selection-change-in-iframe-with-relative-parent.html [ Failure ] @@ -1126,7 +1123,6 @@ crbug.com/708452 paint/selection/text-selection-inline-block-rtl.html [ Failure ] crbug.com/708452 paint/selection/text-selection-inline-block.html [ Failure ] crbug.com/591099 paint/selection/text-selection-newline-rtl-double-linebreak.html [ Failure ] -crbug.com/591099 paint/selection/text-selection-newline-vertical-lr.html [ Failure Pass ] crbug.com/591099 paint/text/selection-no-clip-text.html [ Failure ] crbug.com/714962 paint/text/text-match-highlights-big-line-height.html [ Failure ] crbug.com/591099 printing/absolute-position-headers-and-footers.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index e15c5de..a0e9b138 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1889,7 +1889,7 @@ crbug.com/846237 virtual/service-worker-servicification/external/wpt/service-workers/service-worker/import-scripts-updated-flag.https.html [ Crash ] -crbug.com/847565 [ Mac ] virtual/service-worker-servicification/external/wpt/service-workers/service-worker/fetch-event.https.html [ Pass Timeout ] +crbug.com/847565 [ Mac Linux ] virtual/service-worker-servicification/external/wpt/service-workers/service-worker/fetch-event.https.html [ Pass Timeout ] crbug.com/492664 [ Linux ] external/wpt/css/css-writing-modes/box-offsets-rel-pos-vlr-005.xht [ Failure ] crbug.com/492664 [ Linux ] external/wpt/css/css-writing-modes/box-offsets-rel-pos-vrl-004.xht [ Failure ] @@ -2840,6 +2840,7 @@ crbug.com/832071 virtual/navigation-mojo-response/external/wpt/service-workers/service-worker/worker-client-id.https.html [ Failure ] # ====== New tests from wpt-importer added here ====== +crbug.com/626703 [ Mac10.13 ] external/wpt/accelerometer/Accelerometer.https.html [ Timeout ] crbug.com/626703 external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/navigation.sub.html?encoding=x-cp1251 [ Timeout ] crbug.com/626703 external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/navigation.sub.html?encoding=utf8 [ Timeout ] crbug.com/626703 external/wpt/css/css-animations/set-animation-play-state-to-paused-002.html [ Failure ] @@ -2890,11 +2891,8 @@ crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-022.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-020.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-046.html [ Failure ] -crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-046.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-042.html [ Failure ] -crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-040.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-039.html [ Failure ] -crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-049.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-051.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-043.html [ Failure ] @@ -2909,7 +2907,6 @@ crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-038.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-content-box-border-radius-002.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-margin-box-border-radius-004.html [ Failure ] -crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-border-box-border-radius-005.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-049.html [ Failure ] crbug.com/626703 external/wpt/css/css-masking/clip-path/clip-path-polygon-007.html [ Failure ] @@ -3343,11 +3340,8 @@ crbug.com/626703 external/wpt/html/browsers/windows/noreferrer-window-name.html [ Timeout ] crbug.com/626703 external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/utf-16be.html [ Timeout Crash ] crbug.com/626703 external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/utf-16le.html [ Timeout ] -crbug.com/626703 [ Mac10.10 Mac10.13 ] external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/windows-1251.html [ Timeout ] crbug.com/626703 external/wpt/html/semantics/embedded-content/the-embed-element/embed-represent-nothing-02.html [ Failure ] crbug.com/626703 external/wpt/html/semantics/embedded-content/the-embed-element/embed-represent-nothing-04.html [ Failure ] -crbug.com/626703 external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-1.html [ Timeout ] -crbug.com/626703 external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-3.html [ Timeout ] crbug.com/626703 external/wpt/html/semantics/embedded-content/the-img-element/relevant-mutations.html [ Timeout ] crbug.com/626703 external/wpt/html/semantics/embedded-content/the-video-element/video_initially_paused.html [ Failure ] crbug.com/626703 external/wpt/html/semantics/grouping-content/the-li-element/grouping-li-reftest-list-owner-menu.html [ Failure ] @@ -4731,14 +4725,14 @@ # Sheriff 2018-04-11 crbug.com/831796 fast/events/autoscroll-in-textfield.html [ Failure Pass ] -crbug.com/831686 [ Linux ] fast/webgl/texImage-imageBitmap-from-offscreen-canvas-resize.html [ Pass Timeout ] +crbug.com/831686 [ Linux Mac ] fast/webgl/texImage-imageBitmap-from-offscreen-canvas-resize.html [ Pass Timeout ] crbug.com/831685 [ Linux ] external/wpt/2dcontext/compositing/2d.composite.canvas.lighter.html [ Pass Timeout ] crbug.com/831673 http/tests/devtools/reveal-objects.js [ Pass Timeout ] crbug.com/831496 [ Linux ] virtual/gpu/fast/canvas/fillrect_gradient.html [ Pass Timeout ] crbug.com/831482 [ Linux ] virtual/gpu-rasterization/images/cross-fade-background-size.html [ Pass Timeout ] crbug.com/831249 [ Linux ] virtual/gpu/fast/canvas/canvas-filter-svg-inline.html [ Pass Timeout ] crbug.com/831230 [ Linux ] virtual/threaded/compositing/webgl/webgl-reflection.html [ Pass Timeout ] -crbug.com/829952 [ Linux Mac ] fast/webgl/texImage-imageBitmap-from-image-resize.html [ Pass Timeout ] +crbug.com/829952 fast/webgl/texImage-imageBitmap-from-image-resize.html [ Pass Timeout ] crbug.com/829938 [ Linux ] css3/filters/blur-filter-page-scroll.html [ Pass Timeout ] crbug.com/818426 [ Linux ] virtual/gpu/fast/canvas/canvas-lost-gpu-context.html [ Pass Timeout ] crbug.com/818324 [ Linux ] external/wpt/content-security-policy/embedded-enforcement/required_csp-header.html [ Pass Timeout ] @@ -4830,3 +4824,8 @@ crbug.com/848006 [ Mac ] virtual/threaded/animations/responsive/zoom-responsive-translate-animation.html [ Crash Failure Pass ] crbug.com/849040 [ Mac ] virtual/threaded/http/tests/devtools/tracing/timeline-paint/paint-profiler-update.js [ Crash Timeout Pass ] crbug.com/841567 fast/scrolling/scrollbar-tickmarks-hittest.html [ Failure Pass ] + +# Flakes 2018-06-04 +crbug.com/847870 fast/webgl/texImage-imageBitmap-from-canvas-resize.html [ Timeout Pass ] +crbug.com/847787 external/wpt/service-workers/service-worker/fetch-event.https.html [ Timeout Pass ] +crbug.com/847697 virtual/video-surface-layer/media/controls/overflow-menu-always-visible.html [ Pass Failure ]
diff --git a/third_party/WebKit/LayoutTests/W3CImportExpectations b/third_party/WebKit/LayoutTests/W3CImportExpectations index dbf5d71..450695e 100644 --- a/third_party/WebKit/LayoutTests/W3CImportExpectations +++ b/third_party/WebKit/LayoutTests/W3CImportExpectations
@@ -81,6 +81,7 @@ external/wpt/css/CSS2/visuren [ Skip ] external/wpt/css/CSS2/zindex [ Skip ] external/wpt/css/CSS2/zorder [ Skip ] +external/wpt/css/WOFF2 [ Skip ] external/wpt/css/compositing [ Skip ] external/wpt/css/css-counter-styles [ Skip ] external/wpt/css/css-display/run-in [ Skip ]
diff --git a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json index 5b32f8b..b01f518 100644 --- a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json +++ b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json
@@ -45709,6 +45709,330 @@ {} ] ], + "css/css-layout-api/constraints-fixed-block-size-absolute-left-right-vrl.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-absolute-left-right-vrl.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-absolute-none.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-absolute-none.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-absolute-top-bottom.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-absolute-top-bottom.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-block-none-vrl.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-block-none-vrl.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-block-none.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-block-none.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-fixed-max.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-fixed-max.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-fixed-min.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-fixed-min.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-fixed-vrl.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-fixed-vrl.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-fixed.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-fixed.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-flex-basis-vrl.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-flex-basis-vrl.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-flex-column-basis.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-flex-column-basis.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-flex-column-grow.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-flex-column-grow.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-flex-column-none.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-flex-column-none.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-flex-column-stretch-vrl.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-flex-column-stretch-vrl.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-flex-grow-vrl.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-flex-grow-vrl.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-flex-none.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-flex-none.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-flex-percentage-indefinite.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-flex-percentage-indefinite.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-flex-stretch-max.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-flex-stretch-max.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-flex-stretch.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-flex-stretch.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-grid-none.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-grid-none.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-grid-stretch-max.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-grid-stretch-max.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-grid-stretch.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-grid-stretch.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-grid-vrl.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-grid-vrl.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-percentage-indefinite.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-percentage-indefinite.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-percentage-vrl.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-percentage-vrl.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-percentage.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-percentage.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-layout-api/constraints-fixed-block-size-quirky-body.https.html": [ + [ + "/css/css-layout-api/constraints-fixed-block-size-quirky-body.https.html", + [ + [ + "/css/css-layout-api/green-square-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-layout-api/constraints-fixed-inline-size-absolute-left-right.https.html": [ [ "/css/css-layout-api/constraints-fixed-inline-size-absolute-left-right.https.html", @@ -87317,30 +87641,6 @@ {} ] ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039.html": [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039.html", - [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039-ref.html", - "==" - ] - ], - {} - ] - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-040.html": [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-040.html", - [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039-ref.html", - "==" - ] - ], - {} - ] - ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-041.html": [ [ "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-041.html", @@ -87389,30 +87689,6 @@ {} ] ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045.html": [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045.html", - [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045-ref.html", - "==" - ] - ], - {} - ] - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-046.html": [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-046.html", - [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045-ref.html", - "==" - ] - ], - {} - ] - ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-047.html": [ [ "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-047.html", @@ -87857,30 +88133,6 @@ {} ] ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-018.html": [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-018.html", - [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-018-ref.html", - "==" - ] - ], - {} - ] - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-019.html": [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-019.html", - [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-019-ref.html", - "==" - ] - ], - {} - ] - ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-020.html": [ [ "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-020.html", @@ -88241,78 +88493,6 @@ {} ] ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-026.html": [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-026.html", - [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-026-ref.html", - "==" - ] - ], - {} - ] - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-027.html": [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-027.html", - [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-027-ref.html", - "==" - ] - ], - {} - ] - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-028.html": [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-028.html", - [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-026-ref.html", - "==" - ] - ], - {} - ] - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-029.html": [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-029.html", - [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-027-ref.html", - "==" - ] - ], - {} - ] - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-030.html": [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-030.html", - [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-030-ref.html", - "==" - ] - ], - {} - ] - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-031.html": [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-031.html", - [ - [ - "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-031-ref.html", - "==" - ] - ], - {} - ] - ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-032.html": [ [ "/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-032.html", @@ -121359,6 +121539,16 @@ {} ] ], + "css/css-layout-api/support/constraints-fixed-block-size-quirky-body-iframe.html": [ + [ + {} + ] + ], + "css/css-layout-api/support/constraints-fixed-block-size.js": [ + [ + {} + ] + ], "css/css-layout-api/support/constraints-fixed-inline-size.js": [ [ {} @@ -128394,6 +128584,11 @@ {} ] ], + "css/css-ui/outline-018-expected.txt": [ + [ + {} + ] + ], "css/css-ui/parsing/outline-color-valid-optional-expected.txt": [ [ {} @@ -136814,11 +137009,6 @@ {} ] ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039-ref.html": [ - [ - {} - ] - ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-041-ref.html": [ [ {} @@ -136829,11 +137019,6 @@ {} ] ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045-ref.html": [ - [ - {} - ] - ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-047-ref.html": [ [ {} @@ -137009,16 +137194,6 @@ {} ] ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-018-ref.html": [ - [ - {} - ] - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-019-ref.html": [ - [ - {} - ] - ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-020-ref.html": [ [ {} @@ -137169,26 +137344,6 @@ {} ] ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-026-ref.html": [ - [ - {} - ] - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-027-ref.html": [ - [ - {} - ] - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-030-ref.html": [ - [ - {} - ] - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-031-ref.html": [ - [ - {} - ] - ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-032-ref.html": [ [ {} @@ -150119,6 +150274,11 @@ {} ] ], + "html/infrastructure/urls/resolving-urls/query-encoding/windows-1251-expected.txt": [ + [ + {} + ] + ], "html/infrastructure/urls/resolving-urls/query-encoding/windows-1252-expected.txt": [ [ {} @@ -151884,11 +152044,6 @@ {} ] ], - "html/semantics/embedded-content/resources/test_page.html": [ - [ - {} - ] - ], "html/semantics/embedded-content/svg/.gitkeep": [ [ {} @@ -152214,6 +152369,16 @@ {} ] ], + "html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-1-expected.txt": [ + [ + {} + ] + ], + "html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-3-expected.txt": [ + [ + {} + ] + ], "html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_helper-1.html": [ [ {} @@ -152404,6 +152569,11 @@ {} ] ], + "html/semantics/embedded-content/the-iframe-element/support/load-into-the-iframe.html": [ + [ + {} + ] + ], "html/semantics/embedded-content/the-iframe-element/support/navigation-changed-iframe.html": [ [ {} @@ -157019,6 +157189,11 @@ {} ] ], + "mediacapture-fromelement/historical-expected.txt": [ + [ + {} + ] + ], "mediacapture-fromelement/idlharness-expected.txt": [ [ {} @@ -158174,6 +158349,11 @@ {} ] ], + "payment-handler/can-make-payment-event-constructor.https.serviceworker.js": [ + [ + {} + ] + ], "payment-handler/can-make-payment-event.https-expected.txt": [ [ {} @@ -158204,6 +158384,11 @@ {} ] ], + "payment-handler/payment-request-event-constructor.https.serviceworker.js": [ + [ + {} + ] + ], "payment-handler/payment-request-event.https-expected.txt": [ [ {} @@ -164544,6 +164729,11 @@ {} ] ], + "service-workers/service-worker/resources/service-worker-header.py": [ + [ + {} + ] + ], "service-workers/service-worker/resources/service-worker-interception-dynamic-import-worker.js": [ [ {} @@ -213251,12 +213441,6 @@ {} ] ], - "html/semantics/embedded-content/the-embed-element/detach-frame-on-src-change.html": [ - [ - "/html/semantics/embedded-content/the-embed-element/detach-frame-on-src-change.html", - {} - ] - ], "html/semantics/embedded-content/the-embed-element/document-getters-return-null-for-cross-origin.html": [ [ "/html/semantics/embedded-content/the-embed-element/document-getters-return-null-for-cross-origin.html", @@ -213831,12 +214015,6 @@ {} ] ], - "html/semantics/embedded-content/the-object-element/detach-frame-on-data-change.html": [ - [ - "/html/semantics/embedded-content/the-object-element/detach-frame-on-data-change.html", - {} - ] - ], "html/semantics/embedded-content/the-object-element/document-getters-return-null-for-cross-origin.html": [ [ "/html/semantics/embedded-content/the-object-element/document-getters-return-null-for-cross-origin.html", @@ -220161,6 +220339,12 @@ {} ] ], + "mediacapture-fromelement/historical.html": [ + [ + "/mediacapture-fromelement/historical.html", + {} + ] + ], "mediacapture-fromelement/idlharness.html": [ [ "/mediacapture-fromelement/idlharness.html", @@ -231227,6 +231411,12 @@ {} ] ], + "payment-handler/can-make-payment-event-constructor.https.serviceworker.html": [ + [ + "/payment-handler/can-make-payment-event-constructor.https.serviceworker.html", + {} + ] + ], "payment-handler/can-make-payment-event-constructor.https.worker.js": [ [ "/payment-handler/can-make-payment-event-constructor.https.worker.html", @@ -231255,6 +231445,24 @@ {} ] ], + "payment-handler/payment-request-event-constructor.https.html": [ + [ + "/payment-handler/payment-request-event-constructor.https.html", + {} + ] + ], + "payment-handler/payment-request-event-constructor.https.serviceworker.html": [ + [ + "/payment-handler/payment-request-event-constructor.https.serviceworker.html", + {} + ] + ], + "payment-handler/payment-request-event-constructor.https.worker.js": [ + [ + "/payment-handler/payment-request-event-constructor.https.worker.html", + {} + ] + ], "payment-handler/payment-request-event.https.html": [ [ "/payment-handler/payment-request-event.https.html", @@ -242651,6 +242859,12 @@ {} ] ], + "service-workers/service-worker/service-worker-header.https.html": [ + [ + "/service-workers/service-worker/service-worker-header.https.html", + {} + ] + ], "service-workers/service-worker/serviceworker-message-event-historical.https.html": [ [ "/service-workers/service-worker/serviceworker-message-event-historical.https.html", @@ -305660,6 +305874,114 @@ "371958d97ba951172a283a653f2064def1327a32", "reftest" ], + "css/css-layout-api/constraints-fixed-block-size-absolute-left-right-vrl.https.html": [ + "ef743bb31278b2a9cb3fef53a1afa430bf347eaf", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-absolute-none.https.html": [ + "0eac283ecc975a020075ce274eeb61b9c456b375", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-absolute-top-bottom.https.html": [ + "ec737a097b1c43e87a75da98808630d87def3820", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-block-none-vrl.https.html": [ + "0f5b86acd6ed8acd65a9f0f42d6cc58a6647fa1a", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-block-none.https.html": [ + "59a141464e16d51ca3d80c5c4a8288ff8941a499", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-fixed-max.https.html": [ + "4e49d34d2fc28f15d52e83c27aa8e4fc49dc40f6", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-fixed-min.https.html": [ + "5785b9c3512c74fd297aa73bcdd6265c8008fd4c", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-fixed-vrl.https.html": [ + "a7eafe481062365a3367cedfd30ed3a3a21ec7ab", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-fixed.https.html": [ + "bb8c0b95f1d382cfce289a17d29dea571e938c2d", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-flex-basis-vrl.https.html": [ + "a1868fd28509931b4c447c866e7669b7129e8380", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-flex-column-basis.https.html": [ + "53458ee7f683668a621cf82ab30212ee74bad83f", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-flex-column-grow.https.html": [ + "04f4fdd074cf2726211d2718d4aa14b816ca0214", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-flex-column-none.https.html": [ + "166a66ce956b3b49b2d00ce88e808739065acc9d", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-flex-column-stretch-vrl.https.html": [ + "9bd9cccaea90f3c472a254ac41738716d921845d", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-flex-grow-vrl.https.html": [ + "8c82d4c094b1ff74f2638b2182880fc55c00737a", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-flex-none.https.html": [ + "b35d8ca45539171ff4a3360e223bb476b81e131e", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-flex-percentage-indefinite.https.html": [ + "c4a30e47f6758a2ec98d4c122b09caf8efb7244d", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-flex-stretch-max.https.html": [ + "07155efe3bf9a2a48f1e76180176dca76c2e0096", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-flex-stretch.https.html": [ + "9a34469e3eb5b89f76739b26082cc97f356c5d3d", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-grid-none.https.html": [ + "fda1fa1d2dc49d9b3721165a6f55eb680ed0d958", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-grid-stretch-max.https.html": [ + "8eb9641f5eba2aedcc4f8445ea55eff0574b07a2", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-grid-stretch.https.html": [ + "392a866a7fd24e58b28169f0aa23a58abceb4c6f", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-grid-vrl.https.html": [ + "e4e6a64e131de62dd18223bdffe0404f8e890464", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-percentage-indefinite.https.html": [ + "6bb68de285ec3eefeaf7ddd6a4bba6ea867865e4", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-percentage-vrl.https.html": [ + "20143f108250817b376b3be48d1569d83d305a08", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-percentage.https.html": [ + "9afd79b298034ada9c1d46c1c5ce90f40ce619b3", + "reftest" + ], + "css/css-layout-api/constraints-fixed-block-size-quirky-body.https.html": [ + "a6d5724f25ca05b3d205166a04e9a53f5b227527", + "reftest" + ], "css/css-layout-api/constraints-fixed-inline-size-absolute-left-right.https.html": [ "15f8dde88dd066b5525a6b8990206ac567f48b2a", "reftest" @@ -305876,6 +306198,14 @@ "361b3c82c37c0068d23ae23e96d8e9185d3765b0", "reftest" ], + "css/css-layout-api/support/constraints-fixed-block-size-quirky-body-iframe.html": [ + "874a80d6bc5e5cfa8f8fe6c224e7e3c999d81d1e", + "support" + ], + "css/css-layout-api/support/constraints-fixed-block-size.js": [ + "9e15bc74f332c532b149f43465851d79d9e9c850", + "support" + ], "css/css-layout-api/support/constraints-fixed-inline-size.js": [ "ed0224a380c50a7e83d23a95be5a4348ce5bf706", "support" @@ -308469,7 +308799,7 @@ "support" ], "css/css-paint-api/registered-properties-in-custom-paint.https.html": [ - "dc51ea1e448fc91b632363d5ea394f5a4a90bd06", + "199e7dc0b76ee3bb099cc9b560a9ed2458335011", "reftest" ], "css/css-paint-api/resources/html5.png": [ @@ -308849,11 +309179,11 @@ "testharness" ], "css/css-properties-values-api/registered-properties-inheritance.html": [ - "131676bfa0733a64b679473b411ef651a9df1ab0", + "bee1726786f02027c0c1564adee385e2265cb3d3", "testharness" ], "css/css-properties-values-api/registered-property-computation.html": [ - "875acfd6e6446e4cb14fcd19fe16e83630b5fe31", + "43bd84a7ea93849f2c08633e7246d5eb84ad84ce", "testharness" ], "css/css-properties-values-api/registered-property-cssom.html": [ @@ -308861,7 +309191,7 @@ "testharness" ], "css/css-properties-values-api/registered-property-initial.html": [ - "fc0b90f23ea8c8dab20baa3fecdd7d60863527b6", + "90a089424b1c884a4ce6fe1684eed3ca03055158", "testharness" ], "css/css-properties-values-api/var-reference-registered-properties-cycles.html": [ @@ -308869,7 +309199,7 @@ "testharness" ], "css/css-properties-values-api/var-reference-registered-properties.html": [ - "988badd19fd1880446db9827e3d96cb4961732a0", + "bdaa0efd1894244a44350f3001a2ae40c35c752b", "testharness" ], "css/css-pseudo/first-letter-001-ref.html": [ @@ -324629,11 +324959,15 @@ "reftest" ], "css/css-ui/outline-017.html": [ - "ea35906d51fbff221644d993c0f2ca3ca3fbdd71", + "ac0b5e2868e9c937cf1e9b603198108a63105e67", "testharness" ], + "css/css-ui/outline-018-expected.txt": [ + "b04e576173c73adeac94450b391c3c4f5980589d", + "support" + ], "css/css-ui/outline-018.html": [ - "3135c237dffc1408758b1c8dc6721921f9fb0279", + "6f966db0723027aa857bce91fd3dfe1939c09732", "testharness" ], "css/css-ui/outline-019.html": [ @@ -338504,18 +338838,6 @@ "61d2d2a07e2dcbd24a15b733f7c9d7dd3735ebd1", "reftest" ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039-ref.html": [ - "80ba877ecdbb12e5f000dee707c5af2df4629a9b", - "support" - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039.html": [ - "0dad5434390d2500568fab4ca82d98147995f2a4", - "reftest" - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-040.html": [ - "7eaa3c8183209024684ff9a15f6b332802d91cb6", - "reftest" - ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-041-ref.html": [ "dcdc6fdf1ff9c749b6ed0dabc9029e641336832b", "support" @@ -338540,18 +338862,6 @@ "c669e12f7d26e25364eab72272e5964bb989cad3", "reftest" ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045-ref.html": [ - "538d22bff3687524f756303205ad18dac9e182cf", - "support" - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045.html": [ - "8458a75aec990428264f039927377d683e4bfef9", - "reftest" - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-046.html": [ - "bfb735e59e22b55f8e3c42827ca8bcbe7a612774", - "reftest" - ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-047-ref.html": [ "4a138f3175f7d46a2a38643e9803ede5408db9cf", "support" @@ -338840,22 +339150,6 @@ "628ef0b6c08230db7fca6639be71c63c0001156f", "reftest" ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-018-ref.html": [ - "e32f844e70a6f1b7c5c25fa691ba77321b557213", - "support" - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-018.html": [ - "1d24d1acde6249154c8aecccf51c3f3d5bfc3f36", - "reftest" - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-019-ref.html": [ - "7c0b699db61f02c5f197133c66439f699a80fd70", - "support" - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-019.html": [ - "8ad1c65a27f12deb7b75865eb2b89905a4bbd4f0", - "reftest" - ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-020-ref.html": [ "8e109e72edb9cb0d3c97677db8a98462da83054f", "support" @@ -339096,46 +339390,6 @@ "9393c2e2250dfc1bf3ffdd68f2c352890d1e0ee8", "reftest" ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-026-ref.html": [ - "322ec7ee1fb932cb6f1908c376be2915d6e50459", - "support" - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-026.html": [ - "9fea24b92061f9f679b9565d9040e4b29a18b4c3", - "reftest" - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-027-ref.html": [ - "e91e35a1af0a2fa21e31f8ea3fa903f6d862ad13", - "support" - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-027.html": [ - "b27883660453186155c9b761402ae4c038f2394c", - "reftest" - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-028.html": [ - "6753ffe3a09c2a71fc67efcd1041ed90de12e87c", - "reftest" - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-029.html": [ - "de39a15da093018531838cac20c59494cb6050b2", - "reftest" - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-030-ref.html": [ - "05d0d53f6d038702733e4acd9562e35b2b992881", - "support" - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-030.html": [ - "0f653c07806f0064d1583a7ddaeb171734188062", - "reftest" - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-031-ref.html": [ - "7bbccdb15fdf67a67bbc243c342c668fbef23af8", - "support" - ], - "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-031.html": [ - "217e140bdd429d6889102e43253e6fb64dca4705", - "reftest" - ], "css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-032-ref.html": [ "890dd0754f2c985719c75200dd9ef70e8c1abe14", "support" @@ -340621,11 +340875,11 @@ "testharness" ], "dom/interfaces-expected.txt": [ - "c6d3db3104de23bc30c7f2bdc7b4fcb33351aedf", + "d854ca0f17746236bd2ef3237f7d0f13061c59ca", "support" ], "dom/interfaces.html": [ - "fc05c0e670c2b7ca72a958dc05dd34ffcaadadf5", + "5053c2d407ac6261313df3f9d9699f08e9f89d4d", "testharness" ], "dom/lists/DOMTokenList-Iterable.html": [ @@ -357436,6 +357690,10 @@ "e2e8de4a8cb424217fe3c6c4e6c7a0088cf0e154", "testharness" ], + "html/infrastructure/urls/resolving-urls/query-encoding/windows-1251-expected.txt": [ + "a0f2778e95a5c53bd935fcca7a4fa7b482c4dda5", + "support" + ], "html/infrastructure/urls/resolving-urls/query-encoding/windows-1251.html": [ "424312dc522d01f4ae0eedccc618451f13ca65fa", "testharness" @@ -360552,10 +360810,6 @@ "a1657fc9e655ad0a30ced47a1412b6c34ba964b9", "support" ], - "html/semantics/embedded-content/resources/test_page.html": [ - "7865ad89746586ea71fa92621192417de57223ca", - "support" - ], "html/semantics/embedded-content/svg/.gitkeep": [ "da39a3ee5e6b4b0d3255bfef95601890afd80709", "support" @@ -361280,10 +361534,6 @@ "da39a3ee5e6b4b0d3255bfef95601890afd80709", "support" ], - "html/semantics/embedded-content/the-embed-element/detach-frame-on-src-change.html": [ - "55e68ad2312d4079ce4be558ef361f6f56977d58", - "testharness" - ], "html/semantics/embedded-content/the-embed-element/document-getters-return-null-for-cross-origin.html": [ "3d75c8c998b3f98f2023311826dcd1d4c21d3361", "testharness" @@ -361432,16 +361682,24 @@ "de1766fc7f66dbb56d8d0ffd28645ca8a8840c9c", "testharness" ], + "html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-1-expected.txt": [ + "d0d251b199053fd05fd2570b73e01180ad86e3dd", + "support" + ], "html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-1.html": [ - "4010899a36a52436b56867762390e9b27768f706", + "5feddab3d35d2b430f8cc490539a44b45d3f9d2e", "testharness" ], "html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-2.html": [ - "9d640f248b376f6bc6a95d09b948e49a3f655954", + "b8713028abdcf1e30cd6d8b2bcbf4ce2d75aade9", "testharness" ], + "html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-3-expected.txt": [ + "8126d0499412ddaade10755b8c93e3ba13c73dc7", + "support" + ], "html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-3.html": [ - "96453a352d2bed1d208e203594bcb24ab8ee37cd", + "fbd0fec2032b0d8acb8d3ce7f15994a78c52437e", "testharness" ], "html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation_by_user_activation-manual.html": [ @@ -361808,6 +362066,10 @@ "508194946db6e8f892208a8b413565a4d76e6687", "support" ], + "html/semantics/embedded-content/the-iframe-element/support/load-into-the-iframe.html": [ + "f079e597fe12b27f9071e124b13d4e369abbdce0", + "support" + ], "html/semantics/embedded-content/the-iframe-element/support/navigation-changed-iframe.html": [ "9dd191a0b5d9c15972363e260228956f7f487c7d", "support" @@ -362048,10 +362310,6 @@ "da39a3ee5e6b4b0d3255bfef95601890afd80709", "support" ], - "html/semantics/embedded-content/the-object-element/detach-frame-on-data-change.html": [ - "c534d05044768f72015e9cea7dd45b582ecf0368", - "testharness" - ], "html/semantics/embedded-content/the-object-element/document-getters-return-null-for-cross-origin.html": [ "f9f22673579147c7591d5f71467d6655140702b9", "testharness" @@ -364841,7 +365099,7 @@ "support" ], "html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-nonce-classic.html": [ - "20a6c6de42fe72fe375ccd8c9c8763191afa78f9", + "d49f673f10045316bf897ded5d0cd24ab3933a5b", "testharness" ], "html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-nonce-module-expected.txt": [ @@ -364849,7 +365107,7 @@ "support" ], "html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-nonce-module.html": [ - "93f2cc8f3e88e0cbf508acd64f9a28bdcaff25b0", + "2566b1d80cd2617c62667c300fe9568a640fe1a5", "testharness" ], "html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-of-promise-result.html": [ @@ -369761,13 +370019,21 @@ "testharness" ], "mediacapture-fromelement/creation.html": [ - "18289cfde81c16db6d3e728623113be0bde3454f", + "7da9c5086e88c1cf97b492b1bedce6897602a5c8", "testharness" ], "mediacapture-fromelement/ended.html": [ "c816abe4302804f8e3ba65bad23443812111acb1", "testharness" ], + "mediacapture-fromelement/historical-expected.txt": [ + "7d4f0fd25a9060c1bd5143d02a66da151acb0a8a", + "support" + ], + "mediacapture-fromelement/historical.html": [ + "9fa955b3f3a20222b140db3e706967ddb3979e25", + "testharness" + ], "mediacapture-fromelement/idlharness-expected.txt": [ "4befc7133cb86ec98fba704361945f99415b077c", "support" @@ -378197,11 +378463,19 @@ "support" ], "payment-handler/can-make-payment-event-constructor.https.html": [ - "f48b21e7376a7a45b7e121a4331362ecd46f8dcd", + "5eeaa854caf0fb1acdf97bc5ff2ccf7124666e19", "testharness" ], + "payment-handler/can-make-payment-event-constructor.https.serviceworker.html": [ + "c9cc7e69b6d7c3e9c3534f35e2d00641907eff4a", + "testharness" + ], + "payment-handler/can-make-payment-event-constructor.https.serviceworker.js": [ + "458ed84353bd49b297e1631520f543191b27fc29", + "support" + ], "payment-handler/can-make-payment-event-constructor.https.worker.js": [ - "4a77b5b3444c490b673b7c08862f1565b705f0e2", + "e5fd666fc5cf21a62db0b7fd95ba669fcfbdb7ff", "testharness" ], "payment-handler/can-make-payment-event.https-expected.txt": [ @@ -378240,6 +378514,22 @@ "372d636227a5be6ede37e7d67cf24d03030eccf5", "testharness" ], + "payment-handler/payment-request-event-constructor.https.html": [ + "b07b93ae26288b6c8a25ddf008c7d12176fa81ef", + "testharness" + ], + "payment-handler/payment-request-event-constructor.https.serviceworker.html": [ + "b93e463283262caff46dd629164d98a785d7b58b", + "testharness" + ], + "payment-handler/payment-request-event-constructor.https.serviceworker.js": [ + "40e4245cc754e24c6ba757b8ab6ed67f16c6d1e8", + "support" + ], + "payment-handler/payment-request-event-constructor.https.worker.js": [ + "6f034b0c41cbcd5c21992d8650b015a1a7844eeb", + "testharness" + ], "payment-handler/payment-request-event.https-expected.txt": [ "5ccf0e310f13dbc0300198d5b328ad86b0976966", "support" @@ -390045,11 +390335,11 @@ "testharness" ], "service-workers/service-worker/import-scripts-updated-flag.https-expected.txt": [ - "5b8cd8a8e43c294d98873f6b01194314cf28666f", + "136f10ce7c5a4194a26819e3b19445220cc940af", "support" ], "service-workers/service-worker/import-scripts-updated-flag.https.html": [ - "e902940bec870cf548c576b5fd06d2e71fd3f97a", + "16cfa33f95de96bc0a2bc8b1102127f0e4922bd6", "testharness" ], "service-workers/service-worker/indexeddb.https.html": [ @@ -390925,7 +391215,7 @@ "support" ], "service-workers/service-worker/resources/import-scripts-updated-flag-worker.js": [ - "b83d48b7ed268293b4788e36bcd7293b1b15e751", + "979fca5a705f9794b898e2b3c2c75e7133487ee4", "support" ], "service-workers/service-worker/resources/import-scripts-version.py": [ @@ -391304,6 +391594,10 @@ "f7c6bb3ba222dc35a09ef806a7c6d145339f9eb2", "support" ], + "service-workers/service-worker/resources/service-worker-header.py": [ + "0ea0bf61c74be53838055f1c7e9288660cb2858d", + "support" + ], "service-workers/service-worker/resources/service-worker-interception-dynamic-import-worker.js": [ "4b123607e3cb215ed6ebcb1d6c88793c2245be50", "support" @@ -391504,6 +391798,10 @@ "134c6a60a7c9d5fadc0e5329cefe60626c0e63a3", "testharness" ], + "service-workers/service-worker/service-worker-header.https.html": [ + "0bdf9770be1487f24e1e314ff5c7a84a4defa2f8", + "testharness" + ], "service-workers/service-worker/serviceworker-message-event-historical.https.html": [ "2da35c47a5564eaf847a1fad4d9d2f837056b39b", "testharness"
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-paint-api/registered-properties-in-custom-paint.https.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-paint-api/registered-properties-in-custom-paint.https.html index 174bfbe0..01aac16 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-paint-api/registered-properties-in-custom-paint.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-paint-api/registered-properties-in-custom-paint.https.html
@@ -53,10 +53,15 @@ </script> <script> - CSS.registerProperty({name: '--length', syntax: '<length>', initialValue: '0px'}); - CSS.registerProperty({name: '--length-initial', syntax: '<length>', initialValue: '20px'}); - CSS.registerProperty({name: '--number', syntax: '<number>', initialValue: '0'}); - importWorkletAndTerminateTestAfterAsyncPaint(CSS.paintWorklet, document.getElementById('code').textContent); + try { + CSS.registerProperty({name: '--length', syntax: '<length>', initialValue: '0px'}); + CSS.registerProperty({name: '--length-initial', syntax: '<length>', initialValue: '20px'}); + CSS.registerProperty({name: '--number', syntax: '<number>', initialValue: '0'}); + importWorkletAndTerminateTestAfterAsyncPaint(CSS.paintWorklet, document.getElementById('code').textContent); + } catch(e) { + document.body.textContent = e; + takeScreenshot(); + } </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-properties-values-api/registered-properties-inheritance.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-properties-values-api/registered-properties-inheritance.html index 17074a6..393c0dc 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-properties-values-api/registered-properties-inheritance.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-properties-values-api/registered-properties-inheritance.html
@@ -20,14 +20,14 @@ </style> <div id=outer><div id=inner></div></div> <script> -CSS.registerProperty({name: '--inherited-length-1', syntax: '<length>', initialValue: '1px', inherits: true}); -CSS.registerProperty({name: '--inherited-length-2', syntax: '<length>', initialValue: '2px', inherits: true}); -CSS.registerProperty({name: '--inherited-length-3', syntax: '<length>', initialValue: '3px', inherits: true}); -CSS.registerProperty({name: '--non-inherited-length-1', syntax: '<length>', initialValue: '4px'}); -CSS.registerProperty({name: '--non-inherited-length-2', syntax: '<length>', initialValue: '5px'}); -CSS.registerProperty({name: '--non-inherited-length-3', syntax: '<length>', initialValue: '6px'}); - test(function() { + CSS.registerProperty({name: '--inherited-length-1', syntax: '<length>', initialValue: '1px', inherits: true}); + CSS.registerProperty({name: '--inherited-length-2', syntax: '<length>', initialValue: '2px', inherits: true}); + CSS.registerProperty({name: '--inherited-length-3', syntax: '<length>', initialValue: '3px', inherits: true}); + CSS.registerProperty({name: '--non-inherited-length-1', syntax: '<length>', initialValue: '4px'}); + CSS.registerProperty({name: '--non-inherited-length-2', syntax: '<length>', initialValue: '5px'}); + CSS.registerProperty({name: '--non-inherited-length-3', syntax: '<length>', initialValue: '6px'}); + outerComputedStyle = getComputedStyle(outer); assert_equals(outerComputedStyle.getPropertyValue('--inherited-length-1'), '10px'); assert_equals(outerComputedStyle.getPropertyValue('--inherited-length-2'), '22px');
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-properties-values-api/registered-property-computation.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-properties-values-api/registered-property-computation.html index 8f635e9..e204863 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-properties-values-api/registered-property-computation.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-properties-values-api/registered-property-computation.html
@@ -35,20 +35,22 @@ </div> <script> -CSS.registerProperty({name: '--length-1', syntax: '<length>', initialValue: '0px'}); -CSS.registerProperty({name: '--length-2', syntax: '<length>', initialValue: '0px'}); -CSS.registerProperty({name: '--length-3', syntax: '<length>', initialValue: '0px'}); -CSS.registerProperty({name: '--length-4', syntax: '<length>', initialValue: '0px'}); -CSS.registerProperty({name: '--length-5', syntax: '<length>', initialValue: '0px'}); -CSS.registerProperty({name: '--length-6', syntax: '<length>', initialValue: '0px'}); -CSS.registerProperty({name: '--length-percentage-1', syntax: '<length-percentage>', initialValue: '0px'}); -CSS.registerProperty({name: '--length-percentage-2', syntax: '<length-percentage>', initialValue: '0px'}); -CSS.registerProperty({name: '--length-percentage-3', syntax: '<length-percentage>', initialValue: '0px'}); -CSS.registerProperty({name: '--list-1', syntax: '<length>+', initialValue: '0px'}); -CSS.registerProperty({name: '--list-2', syntax: '<length>+', initialValue: '0px'}); -CSS.registerProperty({name: '--list-3', syntax: '<length-percentage>+', initialValue: '0px'}); -CSS.registerProperty({name: '--list-4', syntax: '<length-percentage>+', initialValue: '0px'}); -CSS.registerProperty({name: '--font-size', syntax: '<length>', initialValue: '0px'}); +test(() => { + CSS.registerProperty({name: '--length-1', syntax: '<length>', initialValue: '0px'}); + CSS.registerProperty({name: '--length-2', syntax: '<length>', initialValue: '0px'}); + CSS.registerProperty({name: '--length-3', syntax: '<length>', initialValue: '0px'}); + CSS.registerProperty({name: '--length-4', syntax: '<length>', initialValue: '0px'}); + CSS.registerProperty({name: '--length-5', syntax: '<length>', initialValue: '0px'}); + CSS.registerProperty({name: '--length-6', syntax: '<length>', initialValue: '0px'}); + CSS.registerProperty({name: '--length-percentage-1', syntax: '<length-percentage>', initialValue: '0px'}); + CSS.registerProperty({name: '--length-percentage-2', syntax: '<length-percentage>', initialValue: '0px'}); + CSS.registerProperty({name: '--length-percentage-3', syntax: '<length-percentage>', initialValue: '0px'}); + CSS.registerProperty({name: '--list-1', syntax: '<length>+', initialValue: '0px'}); + CSS.registerProperty({name: '--list-2', syntax: '<length>+', initialValue: '0px'}); + CSS.registerProperty({name: '--list-3', syntax: '<length-percentage>+', initialValue: '0px'}); + CSS.registerProperty({name: '--list-4', syntax: '<length-percentage>+', initialValue: '0px'}); + CSS.registerProperty({name: '--font-size', syntax: '<length>', initialValue: '0px'}); +}, "CSS.registerProperty"); for (var element of [divWithFontSizeSet, divWithFontSizeInherited]) { var id = element.id;
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-properties-values-api/registered-property-initial.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-properties-values-api/registered-property-initial.html index 22ea3c4..0e3e8545 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-properties-values-api/registered-property-initial.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-properties-values-api/registered-property-initial.html
@@ -11,14 +11,14 @@ </style> <div id=target></div> <script> -CSS.registerProperty({name: '--length', syntax: '<length>', initialValue: 'calc(10px + 15px)'}); -CSS.registerProperty({name: '--length-percentage', syntax: '<length-percentage>', initialValue: 'calc(1in + 10% + 4px)'}); -CSS.registerProperty({name: '--inherited-color', syntax: '<color>', initialValue: 'pink', inherits: true}); -CSS.registerProperty({name: '--non-inherited-color', syntax: '<color>', initialValue: 'purple'}); -CSS.registerProperty({name: '--single-transform-list', syntax: '<transform-list>', initialValue: 'scale(calc(2 + 2))'}); -CSS.registerProperty({name: '--multiple-transform-list', syntax: '<transform-list>', initialValue: 'scale(calc(2 + 1)) translateX(calc(3px + 1px))'}); - test(function() { + CSS.registerProperty({name: '--length', syntax: '<length>', initialValue: 'calc(10px + 15px)'}); + CSS.registerProperty({name: '--length-percentage', syntax: '<length-percentage>', initialValue: 'calc(1in + 10% + 4px)'}); + CSS.registerProperty({name: '--inherited-color', syntax: '<color>', initialValue: 'pink', inherits: true}); + CSS.registerProperty({name: '--non-inherited-color', syntax: '<color>', initialValue: 'purple'}); + CSS.registerProperty({name: '--single-transform-list', syntax: '<transform-list>', initialValue: 'scale(calc(2 + 2))'}); + CSS.registerProperty({name: '--multiple-transform-list', syntax: '<transform-list>', initialValue: 'scale(calc(2 + 1)) translateX(calc(3px + 1px))'}); + computedStyle = getComputedStyle(target); assert_equals(computedStyle.getPropertyValue('--length'), '25px'); assert_equals(computedStyle.getPropertyValue('--length-percentage'), 'calc(100px + 10%)');
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-properties-values-api/var-reference-registered-properties.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-properties-values-api/var-reference-registered-properties.html index 5dd1f0f..2eb2d86 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-properties-values-api/var-reference-registered-properties.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-properties-values-api/var-reference-registered-properties.html
@@ -26,21 +26,21 @@ </style> <div id=element></div> <script> -CSS.registerProperty({name: '--123px', syntax: '<length>', initialValue: '123px'}); - -CSS.registerProperty({name: '--registered-length-1', syntax: '<length>', initialValue: '0px'}); -CSS.registerProperty({name: '--registered-length-2', syntax: '<length>', initialValue: '0px'}); -CSS.registerProperty({name: '--registered-length-3', syntax: '<length>', initialValue: '0px'}); -CSS.registerProperty({name: '--registered-length-4', syntax: '<length>', initialValue: '0px'}); -CSS.registerProperty({name: '--registered-length-5', syntax: '<length>', initialValue: '0px'}); -CSS.registerProperty({name: '--registered-length-6', syntax: '<length>', initialValue: '0px'}); -CSS.registerProperty({name: '--registered-length-7', syntax: '<length>', initialValue: '0px'}); -CSS.registerProperty({name: '--registered-length-invalid', syntax: '<length>', initialValue: '15px'}); - -CSS.registerProperty({name: '--registered-token-stream-1', syntax: '*'}); -CSS.registerProperty({name: '--registered-token-stream-2', syntax: '*'}); - test(function() { + CSS.registerProperty({name: '--123px', syntax: '<length>', initialValue: '123px'}); + + CSS.registerProperty({name: '--registered-length-1', syntax: '<length>', initialValue: '0px'}); + CSS.registerProperty({name: '--registered-length-2', syntax: '<length>', initialValue: '0px'}); + CSS.registerProperty({name: '--registered-length-3', syntax: '<length>', initialValue: '0px'}); + CSS.registerProperty({name: '--registered-length-4', syntax: '<length>', initialValue: '0px'}); + CSS.registerProperty({name: '--registered-length-5', syntax: '<length>', initialValue: '0px'}); + CSS.registerProperty({name: '--registered-length-6', syntax: '<length>', initialValue: '0px'}); + CSS.registerProperty({name: '--registered-length-7', syntax: '<length>', initialValue: '0px'}); + CSS.registerProperty({name: '--registered-length-invalid', syntax: '<length>', initialValue: '15px'}); + + CSS.registerProperty({name: '--registered-token-stream-1', syntax: '*'}); + CSS.registerProperty({name: '--registered-token-stream-2', syntax: '*'}); + computedStyle = getComputedStyle(element); assert_equals(computedStyle.getPropertyValue('--registered-length-1'), '10px'); assert_equals(computedStyle.getPropertyValue('--registered-length-2'), '10px');
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-ui/outline-017.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-ui/outline-017.html index 54155e4..d3a350d 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-ui/outline-017.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-ui/outline-017.html
@@ -9,18 +9,18 @@ <style> @keyframes outline-anim { from { - outline: solid 1px rgb(1,0,0); + outline: solid 1px rgba(1, 0, 0, 0.5); outline-offset: 1px; } to { - outline: solid 3px rgb(3,0,0); + outline: solid 3px rgba(3, 0, 0, 0.5); outline-offset: 3px; } } #test { animation: outline-anim 3s -1.5s paused linear; - outline: solid 1px rgb(1,0,0); + outline: solid 1px rgba(1, 0, 0, 0.5); outline-offset: 1px; } </style> @@ -29,20 +29,27 @@ <div id=log></div> <script> - test( - function(){ - var test = document.getElementById("test"); - assert_equals(getComputedStyle(test).outlineColor, 'rgb(2, 0, 0)'); - }, "outline-color is animated as a color"); - test( - function(){ - var test = document.getElementById("test"); - assert_equals(getComputedStyle(test).outlineWidth, '2px'); - }, "outline-width is animated as a length"); - test( - function(){ - var test = document.getElementById("test"); - assert_equals(getComputedStyle(test).outlineOffset, '2px'); - }, "outline-offset is animated as a length"); + // outline being a render-only property, its animation can be done off the main thread + // checking the values after the first paint is safer, hence requestAnimationFrame + setup({explicit_done:true}); + requestAnimationFrame(function() { + // synchronous tests being run during the page's first paint + test( + function(){ + var test = document.getElementById("test"); + assert_equals(getComputedStyle(test).outlineColor, 'rgba(2, 0, 0, 0.5)'); + }, "outline-color is animated as a color"); + test( + function(){ + var test = document.getElementById("test"); + assert_equals(getComputedStyle(test).outlineWidth, '2px'); + }, "outline-width is animated as a length"); + test( + function(){ + var test = document.getElementById("test"); + assert_equals(getComputedStyle(test).outlineOffset, '2px'); + }, "outline-offset is animated as a length"); + done(); + }); </script> </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-ui/outline-018-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/css/css-ui/outline-018-expected.txt new file mode 100644 index 0000000..dd3fe0ad --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-ui/outline-018-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL outline-style is animated as a discrete type assert_equals: expected "dotted" but got "solid" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-ui/outline-018.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-ui/outline-018.html index 448a11f..ff79144 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-ui/outline-018.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-ui/outline-018.html
@@ -16,28 +16,46 @@ } } -#test { - animation: outline-anim 3s -1.5s paused linear; +#test1 { + animation: outline-anim 3s 0s paused linear; + outline: solid 1px black; +} +#test2 { + animation: outline-anim 3s -1s paused linear; + outline: solid 1px black; +} +#test3 { + animation: outline-anim 3s -2s paused linear; + outline: solid 1px black; +} +#test4 { + animation: outline-anim 3s 0s paused reverse-linear; outline: solid 1px black; } </style> <body> - <div id="test"></div> + <div id="test1"></div> + <div id="test2"></div> + <div id="test3"></div> + <div id="test4"></div> <div id=log></div> <script> - test( - function(){ - var test = document.getElementById("test"); - - test.style.animation = "outline-anim 3s 0s paused linear" - assert_equals(getComputedStyle(test).outlineStyle, 'solid'); - test.style.animation = "outline-anim 3s -1s paused linear" - assert_equals(getComputedStyle(test).outlineStyle, 'solid'); - test.style.animation = "outline-anim 3s -2s paused linear" - assert_equals(getComputedStyle(test).outlineStyle, 'dotted'); - test.style.animation = "outline-anim 3s 0s paused reverse-linear" - assert_equals(getComputedStyle(test).outlineStyle, 'dotted'); - }, "outline-style is animated as a discrete type"); + // outline being a render-only property, its animation can be done off the main thread + // checking the values after the first paint is safer, hence requestAnimationFrame + setup({explicit_done:true}); + requestAnimationFrame(function() { + // synchronous tests being run during the page's first paint + test( + function(){ + var tests = document.querySelectorAll("div[id^='test']"); + assert_equals(getComputedStyle(tests[0]).outlineStyle, 'solid'); + assert_equals(getComputedStyle(tests[1]).outlineStyle, 'solid'); + assert_equals(getComputedStyle(tests[2]).outlineStyle, 'dotted'); + assert_equals(getComputedStyle(tests[3]).outlineStyle, 'dotted'); + }, "outline-style is animated as a discrete type" + ); + done(); + }); </script> </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039-ref.html deleted file mode 100644 index eee9701e..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039-ref.html +++ /dev/null
@@ -1,46 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float left, circle(0%) border-box reference</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <style> - .container { - position: absolute; - width: 200px; - line-height: 0; - } - - .shape { - float: left; - /* Omit shape-outside */ - clip-path: circle(0%) border-box; - box-sizing: content-box; - height: 20px; - width: 20px; - padding: 20px; - border: 20px solid lightgreen; - margin: 10px; - background-color: orange; - } - - .box { - position: absolute; - width: 200px; - background-color: blue; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="box" style="height: 12px; top: 0px; left: 0px;"></div> - <div class="box" style="height: 12px; top: 12px; left: 0px;"></div> - <div class="box" style="height: 36px; top: 24px; left: 0px;"></div> - <div class="box" style="height: 36px; top: 60px; left: 0px;"></div> - <div class="box" style="height: 12px; top: 96px; left: 0px;"></div> - <div class="box" style="height: 12px; top: 108px; left: 0px;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039.html deleted file mode 100644 index 833e0a78..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039.html +++ /dev/null
@@ -1,49 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float left, circle(0%) border-box</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes"> - <link rel="match" href="shape-outside-circle-039-ref.html"> - <meta name="flags" content=""> - <meta name="assert" content="Test the left float shape defines an empty float area by the basic shape circle(0%) border-box value."> - <style> - .container { - width: 200px; - line-height: 0; - } - - .shape { - float: left; - shape-outside: circle(0%) border-box; - clip-path: circle(0%) border-box; - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - border: 20px solid lightgreen; - margin: 10px; - background-color: orange; - } - - .box { - display: inline-block; - width: 200px; - background-color: blue; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="box" style="height: 12px;"></div> - <div class="box" style="height: 12px;"></div> - <div class="box" style="height: 36px;"></div> - <div class="box" style="height: 36px;"></div> - <div class="box" style="height: 12px;"></div> - <div class="box" style="height: 12px;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-040.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-040.html deleted file mode 100644 index e1beda8..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-040.html +++ /dev/null
@@ -1,49 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float left, circle(closest-side at left center) border-box</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes"> - <link rel="match" href="shape-outside-circle-039-ref.html"> - <meta name="flags" content=""> - <meta name="assert" content="Test the left float shape defines an empty float area by the basic shape circle(closest-side at left center) border-box value."> - <style> - .container { - width: 200px; - line-height: 0; - } - - .shape { - float: left; - shape-outside: circle(closest-side at left center) border-box; - clip-path: circle(closest-side at left center) border-box; - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - border: 20px solid lightgreen; - margin: 10px; - background-color: orange; - } - - .box { - display: inline-block; - width: 200px; - background-color: blue; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="box" style="height: 12px;"></div> - <div class="box" style="height: 12px;"></div> - <div class="box" style="height: 36px;"></div> - <div class="box" style="height: 36px;"></div> - <div class="box" style="height: 12px;"></div> - <div class="box" style="height: 12px;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045-ref.html deleted file mode 100644 index 843c8ba..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045-ref.html +++ /dev/null
@@ -1,47 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float right, circle(0%) border-box reference</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <style> - .container { - direction: rtl; - position: absolute; - width: 200px; - line-height: 0; - } - - .shape { - float: right; - /* Omit shape-outside */ - clip-path: circle(0%) border-box; - box-sizing: content-box; - height: 20px; - width: 20px; - padding: 20px; - border: 20px solid lightgreen; - margin: 10px; - background-color: orange; - } - - .box { - position: absolute; - width: 200px; - background-color: blue; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="box" style="height: 12px; top: 0px; right: 0px;"></div> - <div class="box" style="height: 12px; top: 12px; right: 0px;"></div> - <div class="box" style="height: 36px; top: 24px; right: 0px;"></div> - <div class="box" style="height: 36px; top: 60px; right: 0px;"></div> - <div class="box" style="height: 12px; top: 96px; right: 0px;"></div> - <div class="box" style="height: 12px; top: 108px; right: 0px;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045.html deleted file mode 100644 index 42c73fd5fa..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045.html +++ /dev/null
@@ -1,50 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float right, circle(0%) border-box</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes"> - <link rel="match" href="shape-outside-circle-045-ref.html"> - <meta name="flags" content=""> - <meta name="assert" content="Test the right float shape defines an empty float area by the basic shape circle(0%) border-box value."> - <style> - .container { - direction: rtl; - width: 200px; - line-height: 0; - } - - .shape { - float: right; - shape-outside: circle(0%) border-box; - clip-path: circle(0%) border-box; - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - border: 20px solid lightgreen; - margin: 10px; - background-color: orange; - } - - .box { - display: inline-block; - width: 200px; - background-color: blue; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="box" style="height: 12px;"></div> - <div class="box" style="height: 12px;"></div> - <div class="box" style="height: 36px;"></div> - <div class="box" style="height: 36px;"></div> - <div class="box" style="height: 12px;"></div> - <div class="box" style="height: 12px;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-046.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-046.html deleted file mode 100644 index 7cfc4065..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-046.html +++ /dev/null
@@ -1,50 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float right, circle(closest-side at right center) border-box</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes"> - <link rel="match" href="shape-outside-circle-045-ref.html"> - <meta name="flags" content=""> - <meta name="assert" content="Test the right float shape defines an empty float area by the basic shape circle(closest-side at right center) border-box value."> - <style> - .container { - direction: rtl; - width: 200px; - line-height: 0; - } - - .shape { - float: right; - shape-outside: circle(closest-side at right center) border-box; - clip-path: circle(closest-side at right center) border-box; - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - border: 20px solid lightgreen; - margin: 10px; - background-color: orange; - } - - .box { - display: inline-block; - width: 200px; - background-color: blue; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="box" style="height: 12px;"></div> - <div class="box" style="height: 12px;"></div> - <div class="box" style="height: 36px;"></div> - <div class="box" style="height: 36px;"></div> - <div class="box" style="height: 12px;"></div> - <div class="box" style="height: 12px;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-018-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-018-ref.html deleted file mode 100644 index f4e4764..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-018-ref.html +++ /dev/null
@@ -1,44 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float left, inset(50%) reference</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <style> - .container { - position: absolute; - width: 200px; - line-height: 0; - } - - .shape { - float: left; - /* Omit shape-outside */ - clip-path: inset(50%); - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - border: 20px solid lightgreen; - margin: 20px; - background-color: orange; - } - - .box { - position: absolute; - width: 200px; - background-color: blue; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="box" style="height: 24px; top: 0; left: 0;"></div> - <div class="box" style="height: 36px; top: 24px; left: 0;"></div> - <div class="box" style="height: 36px; top: 60px; left: 0;"></div> - <div class="box" style="height: 24px; top: 96px; left: 0;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-018.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-018.html deleted file mode 100644 index b784677..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-018.html +++ /dev/null
@@ -1,47 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float left, inset(50%)</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes"> - <link rel="match" href="shape-outside-inset-018-ref.html"> - <meta name="flags" content=""> - <meta name="assert" content="Test the left float shape defines an empty float area by the basic shape inset(50%) value."> - <style> - .container { - width: 200px; - line-height: 0; - } - - .shape { - float: left; - shape-outside: inset(50%); - clip-path: inset(50%); - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - border: 20px solid lightgreen; - margin: 20px; - background-color: orange; - } - - .box { - display: inline-block; - width: 200px; - background-color: blue; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="box" style="height: 24px;"></div> - <div class="box" style="height: 36px;"></div> - <div class="box" style="height: 36px;"></div> - <div class="box" style="height: 24px;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-019-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-019-ref.html deleted file mode 100644 index 1e0a3f3..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-019-ref.html +++ /dev/null
@@ -1,45 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float right, inset(50%) reference</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <style> - .container { - direction: rtl; - position: absolute; - width: 200px; - line-height: 0; - } - - .shape { - float: right; - /* Omit shape-outside */ - clip-path: inset(50%); - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - border: 20px solid lightgreen; - margin: 20px; - background-color: orange; - } - - .box { - position: absolute; - width: 200px; - background-color: blue; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="box" style="height: 24px; top: 0; right: 0;"></div> - <div class="box" style="height: 36px; top: 24px; right: 0;"></div> - <div class="box" style="height: 36px; top: 60px; right: 0;"></div> - <div class="box" style="height: 24px; top: 96px; right: 0;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-019.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-019.html deleted file mode 100644 index c6eeb13..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-019.html +++ /dev/null
@@ -1,48 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float right, inset(50%)</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes"> - <link rel="match" href="shape-outside-inset-019-ref.html"> - <meta name="flags" content=""> - <meta name="assert" content="Test the right float shape defines an empty float area by the basic shape inset(50%) value."> - <style> - .container { - direction: rtl; - width: 200px; - line-height: 0; - } - - .shape { - float: right; - shape-outside: inset(50%); - clip-path: inset(50%); - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - border: 20px solid lightgreen; - margin: 20px; - background-color: orange; - } - - .box { - display: inline-block; - width: 200px; - background-color: blue; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="box" style="height: 24px;"></div> - <div class="box" style="height: 36px;"></div> - <div class="box" style="height: 36px;"></div> - <div class="box" style="height: 24px;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-026-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-026-ref.html deleted file mode 100644 index 3237b6dd..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-026-ref.html +++ /dev/null
@@ -1,50 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float left, polygon(60px 20px, 100px 60px) border-box reference</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <style> - .container { - position: absolute; - width: 200px; - line-height: 0; - } - - .shape { - float: left; - /* Omit shape-outside */ - clip-path: polygon(60px 20px, 100px 60px) border-box; - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - border: 20px solid lightgreen; - margin: 20px; - background-color: orange; - } - - .box { - position: absolute; - width: 80px; - background-color: blue; - } - - .long { - width: 200px; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="long box" style="height: 30px; top: 0; left: 0;"></div> - <div class="long box" style="height: 30px; top: 30px; left: 0;"></div> - <div class="long box" style="height: 20px; top: 60px; left: 0;"></div> - <div class="long box" style="height: 20px; top: 80px; left: 0;"></div> - <div class="long box" style="height: 30px; top: 100px; left: 0;"></div> - <div class="long box" style="height: 30px; top: 130px; left: 0;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-026.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-026.html deleted file mode 100644 index 29e4cca..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-026.html +++ /dev/null
@@ -1,54 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float left, polygon(60px 20px, 100px 60px) border-box</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes"> - <link rel="match" href="shape-outside-polygon-026-ref.html"> - <meta name="flags" content=""> - <meta name="assert" content="Test the left float shape defines an empty float area by the polygon(60px 20px, 100px 60px) border-box value."> - <style> - .container { - width: 200px; - line-height: 0; - } - - .shape { - float: left; - /* Less than three vertices, resulting an empty area. */ - shape-outside: polygon(60px 20px, 100px 60px) border-box; - clip-path: polygon(60px 20px, 100px 60px) border-box; - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - margin: 20px; - border: 20px solid lightgreen; - background-color: orange; - } - - .box { - display: inline-block; - width: 80px; - background-color: blue; - } - - .long { - width: 200px; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="long box" style="height: 30px;"></div> - <div class="long box" style="height: 30px;"></div> - <div class="long box" style="height: 20px;"></div> - <div class="long box" style="height: 20px;"></div> - <div class="long box" style="height: 30px;"></div> - <div class="long box" style="height: 30px;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-027-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-027-ref.html deleted file mode 100644 index bbc9af6a..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-027-ref.html +++ /dev/null
@@ -1,50 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float right, polygon(60px 20px, 100px 60px) border-box reference</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <style> - .container { - position: absolute; - width: 200px; - line-height: 0; - } - - .shape { - float: right; - /* Omit shape-outside */ - clip-path: polygon(60px 20px, 100px 60px) border-box; - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - border: 20px solid lightgreen; - margin: 20px; - background-color: orange; - } - - .box { - position: absolute; - width: 80px; - background-color: blue; - } - - .long { - width: 200px; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="long box" style="height: 30px; top: 0; right: 0;"></div> - <div class="long box" style="height: 30px; top: 30px; right: 0;"></div> - <div class="long box" style="height: 20px; top: 60px; right: 0;"></div> - <div class="long box" style="height: 20px; top: 80px; right: 0;"></div> - <div class="long box" style="height: 30px; top: 100px; right: 0;"></div> - <div class="long box" style="height: 30px; top: 130px; right: 0;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-027.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-027.html deleted file mode 100644 index 6507b04..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-027.html +++ /dev/null
@@ -1,54 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float right, polygon(60px 20px, 100px 60px) border-box</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes"> - <link rel="match" href="shape-outside-polygon-027-ref.html"> - <meta name="flags" content=""> - <meta name="assert" content="Test the right float shape defines an empty float area by the polygon(60px 20px, 100px 60px) border-box value."> - <style> - .container { - width: 200px; - line-height: 0; - } - - .shape { - float: right; - /* Less than three vertices, resulting an empty area. */ - shape-outside: polygon(60px 20px, 100px 60px) border-box; - clip-path: polygon(60px 20px, 100px 60px) border-box; - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - margin: 20px; - border: 20px solid lightgreen; - background-color: orange; - } - - .box { - display: inline-block; - width: 80px; - background-color: blue; - } - - .long { - width: 200px; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="long box" style="height: 30px;"></div> - <div class="long box" style="height: 30px;"></div> - <div class="long box" style="height: 20px;"></div> - <div class="long box" style="height: 20px;"></div> - <div class="long box" style="height: 30px;"></div> - <div class="long box" style="height: 30px;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-028.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-028.html deleted file mode 100644 index 4695a377..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-028.html +++ /dev/null
@@ -1,54 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float left, polygon(50% 50%, 0% 0%, 20% 20%, 100% 100%) border-box</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes"> - <link rel="match" href="shape-outside-polygon-026-ref.html"> - <meta name="flags" content=""> - <meta name="assert" content="Test the left float shape defines an empty float area by the polygon(50% 50%, 0% 0%, 20% 20%, 100% 100%) border-box value."> - <style> - .container { - width: 200px; - line-height: 0; - } - - .shape { - float: left; - /* All vertices are collinear, resulting an empty area. */ - shape-outside: polygon(50% 50%, 0% 0%, 20% 20%, 100% 100%) border-box; - clip-path: polygon(50% 50%, 0% 0%, 20% 20%, 100% 100%) border-box; - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - margin: 20px; - border: 20px solid lightgreen; - background-color: orange; - } - - .box { - display: inline-block; - width: 80px; - background-color: blue; - } - - .long { - width: 200px; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="long box" style="height: 30px;"></div> - <div class="long box" style="height: 30px;"></div> - <div class="long box" style="height: 20px;"></div> - <div class="long box" style="height: 20px;"></div> - <div class="long box" style="height: 30px;"></div> - <div class="long box" style="height: 30px;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-029.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-029.html deleted file mode 100644 index ac94bf1..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-029.html +++ /dev/null
@@ -1,55 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float right, polygon(50% 50%, 0% 0%, 20% 20%, 100% 100%) border-box</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes"> - <link rel="match" href="shape-outside-polygon-027-ref.html"> - <meta name="flags" content=""> - <meta name="assert" content="Test the right float shape defines an empty float area by the polygon(50% 50%, 0% 0%, 20% 20%, 100% 100%) border-box value."> - <style> - .container { - direction: rtl; - width: 200px; - line-height: 0; - } - - .shape { - float: right; - /* All vertices are collinear, resulting an empty area. */ - shape-outside: polygon(50% 50%, 0% 0%, 20% 20%, 100% 100%) border-box; - clip-path: polygon(50% 50%, 0% 0%, 20% 20%, 100% 100%) border-box; - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - margin: 20px; - border: 20px solid lightgreen; - background-color: orange; - } - - .box { - display: inline-block; - width: 80px; - background-color: blue; - } - - .long { - width: 200px; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="long box" style="height: 30px;"></div> - <div class="long box" style="height: 30px;"></div> - <div class="long box" style="height: 20px;"></div> - <div class="long box" style="height: 20px;"></div> - <div class="long box" style="height: 30px;"></div> - <div class="long box" style="height: 30px;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-030-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-030-ref.html deleted file mode 100644 index 3ea0025..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-030-ref.html +++ /dev/null
@@ -1,46 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float left, polygon(0% 0%, 50% 0%, 100% 0%, 50% 0%, 50% 100%, 100% 100%, 50% 100%) border-box reference</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <style> - .container { - position: absolute; - width: 200px; - line-height: 0; - } - - .shape { - float: left; - /* Omit shape-outside */ - clip-path: polygon(0% 0%, 50% 0%, 100% 0%, 50% 0%, 50% 100%, 100% 100%, 50% 100%) border-box; - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - border: 20px solid lightgreen; - margin: 20px; - background-color: orange; - } - - .box { - position: absolute; - width: 80px; - background-color: blue; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="box" style="height: 30px; top: 0; left: 80px;"></div> - <div class="box" style="height: 30px; top: 30px; left: 80px;"></div> - <div class="box" style="height: 20px; top: 60px; left: 80px;"></div> - <div class="box" style="height: 20px; top: 80px; left: 80px;"></div> - <div class="box" style="height: 30px; top: 100px; left: 80px;"></div> - <div class="box" style="height: 30px; top: 130px; left: 80px;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-030.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-030.html deleted file mode 100644 index 5e98fc3..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-030.html +++ /dev/null
@@ -1,50 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float left, polygon(0% 0%, 50% 0%, 100% 0%, 50% 0%, 50% 100%, 100% 100%, 50% 100%) border-box</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes"> - <link rel="match" href="shape-outside-polygon-030-ref.html"> - <meta name="flags" content=""> - <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the polygon(0% 0%, 50% 0%, 100% 0%, 50% 0%, 50% 100%, 100% 100%, 50% 100%) border-box value."> - <style> - .container { - width: 200px; - line-height: 0; - } - - .shape { - float: left; - /* polygon contains horizontal lines. */ - shape-outside: polygon(0% 0%, 50% 0%, 100% 0%, 50% 0%, 50% 100%, 100% 100%, 50% 100%) border-box; - clip-path: polygon(0% 0%, 50% 0%, 100% 0%, 50% 0%, 50% 100%, 100% 100%, 50% 100%) border-box; - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - margin: 20px; - border: 20px solid lightgreen; - background-color: orange; - } - - .box { - display: inline-block; - width: 80px; - background-color: blue; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="box" style="height: 30px;"></div> - <div class="box" style="height: 30px;"></div> - <div class="box" style="height: 20px;"></div> - <div class="box" style="height: 20px;"></div> - <div class="box" style="height: 30px;"></div> - <div class="box" style="height: 30px;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-031-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-031-ref.html deleted file mode 100644 index 5412c77d..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-031-ref.html +++ /dev/null
@@ -1,47 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float right, polygon(100% 0%, 50% 0%, 0% 0%, 50% 0%, 50% 100%, 0% 100%, 50% 100%) border-box reference</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <style> - .container { - direction: rtl; - position: absolute; - width: 200px; - line-height: 0; - } - - .shape { - float: right; - /* Omit shape-outside */ - clip-path: polygon(100% 0%, 50% 0%, 0% 0%, 50% 0%, 50% 100%, 0% 100%, 50% 100%) border-box; - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - border: 20px solid lightgreen; - margin: 20px; - background-color: orange; - } - - .box { - position: absolute; - width: 80px; - background-color: blue; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="box" style="height: 30px; top: 0; right: 80px;"></div> - <div class="box" style="height: 30px; top: 30px; right: 80px;"></div> - <div class="box" style="height: 20px; top: 60px; right: 80px;"></div> - <div class="box" style="height: 20px; top: 80px; right: 80px;"></div> - <div class="box" style="height: 30px; top: 100px; right: 80px;"></div> - <div class="box" style="height: 30px; top: 130px; right: 80px;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-031.html b/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-031.html deleted file mode 100644 index 747248ea..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-031.html +++ /dev/null
@@ -1,51 +0,0 @@ -<!DOCTYPE html> -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<html> - <meta charset="utf-8"> - <title>CSS Shape Test: float right, polygon(100% 0%, 50% 0%, 0% 0%, 50% 0%, 50% 100%, 0% 100%, 50% 100%) border-box</title> - <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> - <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> - <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes"> - <link rel="match" href="shape-outside-polygon-031-ref.html"> - <meta name="flags" content=""> - <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the polygon(100% 0%, 50% 0%, 0% 0%, 50% 0%, 50% 100%, 0% 100%, 50% 100%) border-box value."> - <style> - .container { - direction: rtl; - width: 200px; - line-height: 0; - } - - .shape { - float: right; - /* polygon contains horizontal lines. */ - shape-outside: polygon(100% 0%, 50% 0%, 0% 0%, 50% 0%, 50% 100%, 0% 100%, 50% 100%) border-box; - clip-path: polygon(100% 0%, 50% 0%, 0% 0%, 50% 0%, 50% 100%, 0% 100%, 50% 100%) border-box; - box-sizing: content-box; - height: 40px; - width: 40px; - padding: 20px; - margin: 20px; - border: 20px solid lightgreen; - background-color: orange; - } - - .box { - display: inline-block; - width: 80px; - background-color: blue; - } - </style> - - <body class="container"> - <div class="shape"></div> - <div class="box" style="height: 30px;"></div> - <div class="box" style="height: 30px;"></div> - <div class="box" style="height: 20px;"></div> - <div class="box" style="height: 20px;"></div> - <div class="box" style="height: 30px;"></div> - <div class="box" style="height: 30px;"></div> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/dom/interfaces-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/dom/interfaces-expected.txt index 8fea51e..d1cf0c88 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/dom/interfaces-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/dom/interfaces-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 1972 tests; 1951 PASS, 21 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 1972 tests; 1952 PASS, 20 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS Test driver PASS Event interface: existence and properties of interface object PASS Event interface object length @@ -185,7 +185,7 @@ PASS AbortSignal must be primary interface of new AbortController().signal PASS Stringification of new AbortController().signal PASS AbortSignal interface: new AbortController().signal must inherit property "aborted" with the proper type -FAIL AbortSignal interface: new AbortController().signal must inherit property "onabort" with the proper type Unrecognized type EventHandler +PASS AbortSignal interface: new AbortController().signal must inherit property "onabort" with the proper type PASS EventTarget interface: new AbortController().signal must inherit property "addEventListener(DOMString, EventListener, [object Object],[object Object])" with the proper type PASS EventTarget interface: calling addEventListener(DOMString, EventListener, [object Object],[object Object]) on new AbortController().signal with too few arguments must throw TypeError PASS EventTarget interface: new AbortController().signal must inherit property "removeEventListener(DOMString, EventListener, [object Object],[object Object])" with the proper type
diff --git a/third_party/WebKit/LayoutTests/external/wpt/dom/interfaces.html b/third_party/WebKit/LayoutTests/external/wpt/dom/interfaces.html index 9168e73..c0fab01 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/dom/interfaces.html +++ b/third_party/WebKit/LayoutTests/external/wpt/dom/interfaces.html
@@ -19,8 +19,8 @@ var idlArray = new IdlArray(); function doTest([html, dom]) { - idlArray.add_dependency_idls(html); idlArray.add_idls(dom); + idlArray.add_dependency_idls(html); idlArray.add_objects({ EventTarget: ['new EventTarget()'], Event: ['document.createEvent("Event")', 'new Event("foo")'],
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/windows-1251-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/windows-1251-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/platform/win/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/windows-1251-expected.txt rename to third_party/WebKit/LayoutTests/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/windows-1251-expected.txt
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-1-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-1-expected.txt new file mode 100644 index 0000000..17ffcf3 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-1-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Frames with `allow-top-navigation` should be able to navigate the top frame. assert_equals: expected "can navigate" but got "cannot navigate" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-1.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-1.html index b0875ec6..feb8766 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-1.html +++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-1.html
@@ -10,25 +10,15 @@ <body> <iframe sandbox="allow-top-navigation allow-scripts"></iframe> <script> - if (opener) { - // We're the popup (i.e. a top frame). Load into the iframe the page - // trying to modifying the top frame and transmit the result to our - // opener. - onmessage = function(e) { - opener.postMessage(e.data, "*") - } - document.querySelector("iframe").src = "support/iframe-that-performs-top-navigation-on-popup.html"; - } else { - // We are the main test page. Open ourselves as a popup, so that we can - // can experiment navigation of the top frame. - async_test(t => { - window.addEventListener("message", t.step_func_done(e => { - assert_equals(e.data, "can navigate"); - e.source.close(); - })); - window.open(location.href); - }, "Frames with `allow-top-navigation` should be able to navigate the top frame."); - } + // We are the main test page. Open a popup, so that we can + // can experiment navigation of the top frame. + async_test(t => { + window.addEventListener("message", t.step_func_done(e => { + assert_equals(e.data, "can navigate"); + e.source.close(); + })); + window.open("support/load-into-the-iframe.html"); + }, "Frames with `allow-top-navigation` should be able to navigate the top frame."); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-2.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-2.html index 6113c6c..bd7d92c 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-2.html +++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-2.html
@@ -8,27 +8,16 @@ <script src="/resources/testharnessreport.js"></script> </head> <body> - <iframe sandbox="allow-scripts"></iframe> <script> - if (opener) { - // We're the popup (i.e. a top frame). Load into the iframe the page - // trying to modifying the top frame and transmit the result to our - // opener. - onmessage = function(e) { - opener.postMessage(e.data, "*") - } - document.querySelector("iframe").src = "support/iframe-that-performs-top-navigation-on-popup.html"; - } else { - // We are the main test page. Open ourselves as a popup, so that we can - // can experiment navigation of the top frame. - async_test(t => { - window.addEventListener("message", t.step_func_done(e => { - assert_equals(e.data, "cannot navigate"); - e.source.close(); - })); - window.open(location.href); - }, "Frames without `allow-top-navigation` should not be able to navigate the top frame."); - } + // We are the main test page. Open a popup, so that we can + // can experiment navigation of the top frame. + async_test(t => { + window.addEventListener("message", t.step_func_done(e => { + assert_equals(e.data, "cannot navigate"); + e.source.close(); + })); + window.open('support/load-into-the-iframe.html'); + }, "Frames without `allow-top-navigation` should not be able to navigate the top frame."); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-3-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-3-expected.txt new file mode 100644 index 0000000..c7156339 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-3-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Frames with `allow-top-navigation` should be able to navigate the top frame even when `allow-top-navigation-by-user-activation` is set. assert_equals: expected "can navigate" but got "cannot navigate" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-3.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-3.html index 9de5d53..c7c56d6 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-3.html +++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-3.html
@@ -14,25 +14,15 @@ error: allow-top-navigation-by-user-activation will have no effect. --> <iframe sandbox="allow-top-navigation allow-top-navigation-by-user-activation allow-scripts"></iframe> <script> - if (opener) { - // We're the popup (i.e. a top frame). Load into the iframe the page - // trying to modifying the top frame and transmit the result to our - // opener. - onmessage = function(e) { - opener.postMessage(e.data, "*") - } - document.querySelector("iframe").src = "support/iframe-that-performs-top-navigation-on-popup.html"; - } else { - // We are the main test page. Open ourselves as a popup, so that we can - // can experiment navigation of the top frame. - async_test(t => { - window.addEventListener("message", t.step_func_done(e => { - assert_equals(e.data, "can navigate"); - e.source.close(); - })); - window.open(location.href); - }, "Frames with `allow-top-navigation` should be able to navigate the top frame even when `allow-top-navigation-by-user-activation` is set."); - } + // We are the main test page. Open a popup, so that we can + // can experiment navigation of the top frame. + async_test(t => { + window.addEventListener("message", t.step_func_done(e => { + assert_equals(e.data, "can navigate"); + e.source.close(); + })); + window.open("support/load-into-the-iframe.html"); + }, "Frames with `allow-top-navigation` should be able to navigate the top frame even when `allow-top-navigation-by-user-activation` is set."); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/support/load-into-the-iframe.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/support/load-into-the-iframe.html new file mode 100644 index 0000000..05a80be --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/support/load-into-the-iframe.html
@@ -0,0 +1,19 @@ + +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + </head> + <body> + <iframe sandbox="allow-scripts"></iframe> + <script> + // We're the popup (i.e. a top frame). Load into the iframe the page + // trying to modifying the top frame and transmit the result to our + // opener. + onmessage = function(e) { + opener.postMessage(e.data, "*") + } + document.querySelector("iframe").src = "iframe-that-performs-top-navigation-on-popup.html"; + </script> + </body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-nonce-classic.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-nonce-classic.html index ba82fe8..6191827 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-nonce-classic.html +++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-nonce-classic.html
@@ -96,6 +96,7 @@ "onclick", `import('../imports-a.js?label=inline event handlers triggered via UA code').then(window.continueTest, window.errorTest)` ); + assert_equals(typeof dummyDiv.onclick, "function", "the browser must be able to parse a string containing the import() syntax into a function"); dummyDiv.click(); // different from **on**click() return promise.then(assertSuccessful);
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-nonce-module.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-nonce-module.html index 889628f..3e09dd6d 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-nonce-module.html +++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-nonce-module.html
@@ -95,6 +95,7 @@ "onclick", `import('../imports-a.js?label=inline event handlers triggered via UA code').then(window.continueTest, window.errorTest)` ); + assert_equals(typeof dummyDiv.onclick, 'function', "the browser must be able to parse a string containing the import() syntax into a function"); dummyDiv.click(); // different from **on**click() return promise.then(assertSuccessful);
diff --git a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-fromelement/creation.html b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-fromelement/creation.html index 338611ac0..b025a3a 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-fromelement/creation.html +++ b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-fromelement/creation.html
@@ -14,15 +14,20 @@ var video = document.createElement('video'); video.src = "/media/" + filename; video.onerror = this.unreached_func("<video> error"); - video.play(); assert_true('captureStream' in video); var stream = video.captureStream(); assert_not_equals(stream, null, "error generating stream"); - // onactive event is marked for deprecation (https://crbug.com/649328) - stream.onactive = this.step_func_done(function() { + stream.onaddtrack = this.step_func_done(function() { + var tracks = stream.getTracks(); + var idx; + + for (idx = 0; idx < tracks.length; idx += 1) { + assert_equals(tracks[idx].readyState, 'live') + } + // The stream got a (number of) MediaStreamTracks added. assert_equals(stream.getVideoTracks().length, numTracks['vid'], 'video'); assert_equals(stream.getAudioTracks().length, numTracks['aud'], 'audio');
diff --git a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-fromelement/historical-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-fromelement/historical-expected.txt new file mode 100644 index 0000000..404b6a7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-fromelement/historical-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL the deprecated MediaStream `onactive` event handler property is not available assert_false: expected false got true +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-fromelement/historical.html b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-fromelement/historical.html new file mode 100644 index 0000000..3b86e9d --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-fromelement/historical.html
@@ -0,0 +1,17 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <title>Historical features</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> +</head> +<body> + <script> + // https://lists.w3.org/Archives/Public/public-media-capture/2015Nov/0012.html + test(function() { + assert_false(MediaStream.prototype.hasOwnProperty('onactive')); + }, 'the deprecated MediaStream `onactive` event handler property is not available'); + </script> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/GUM-invalid-facing-mode.https.html b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/GUM-invalid-facing-mode.https.html new file mode 100644 index 0000000..d29caeb --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/GUM-invalid-facing-mode.https.html
@@ -0,0 +1,31 @@ +<!doctype html> +<html> +<head> +<title>Invalid facingMode in getUserMedia</title> +<link rel="help" href="https://w3c.github.io/mediacapture-main/#def-constraint-facingMode"> +</head> +<body> +<h1 class="instructions">Description</h1> +<p class="instructions">This test checks that trying to set an empty facingMode + value in getUserMedia results in an OverconstrainedError. +</p> + +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script> +var t = async_test( + "Tests that setting an invalid facingMode constraint in getUserMedia fails"); +t.step(function() { + navigator.mediaDevices.getUserMedia({video: {facingMode: {exact: ''}}}) + .then(t.step_func(function (stream) { + assert_unreached("The empty string is not a valid facingMode"); + t.done(); + }), t.step_func(function(error) { + assert_equals(error.name, "OverconstrainedError"); + assert_equals(error.constraint, "facingMode"); + t.done(); + })); +}); +</script> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/import-scripts-updated-flag.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/import-scripts-updated-flag.https-expected.txt index 0e50082..98a161a 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/import-scripts-updated-flag.https-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/import-scripts-updated-flag.https-expected.txt
@@ -2,7 +2,7 @@ PASS initialize global state PASS import script previously imported at worker evaluation time PASS import script previously imported at worker install time -FAIL import script not previously imported assert_equals: expected (string) "TypeError" but got (object) null +FAIL import script not previously imported assert_equals: expected (string) "NetworkError" but got (object) null PASS Tests for importScripts: import scripts updated flag Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/import-scripts-updated-flag.https.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/import-scripts-updated-flag.https.html index 506827f..09b4496 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/import-scripts-updated-flag.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/import-scripts-updated-flag.https.html
@@ -75,7 +75,7 @@ return post_and_wait_for_reply(worker, 'message'); }) .then(result => { - assert_equals(result.error, 'TypeError'); + assert_equals(result.error, 'NetworkError'); assert_equals(result.value, null); }); }, 'import script not previously imported');
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/import-scripts-updated-flag-worker.js b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/import-scripts-updated-flag-worker.js index 0f5005d..e016646 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/import-scripts-updated-flag-worker.js +++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/import-scripts-updated-flag-worker.js
@@ -4,6 +4,7 @@ // Tests importing a script that sets |echo_output| to the query string. function test_import(str) { + echo_output = null; importScripts('import-scripts-echo.py?msg=' + str); assert_equals(echo_output, str); } @@ -18,6 +19,7 @@ self.addEventListener('message', e => { var error = null; + echo_output = null; try { importScripts('import-scripts-echo.py?msg=' + e.data);
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/service-worker-header.py b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/service-worker-header.py new file mode 100644 index 0000000..2e82e78 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/service-worker-header.py
@@ -0,0 +1,7 @@ +def main(request, response): + service_worker_header = request.headers.get('service-worker') + if service_worker_header == 'script': + body = '// Request has `Service-Worker: script` header' + return 200, [('Content-Type', 'application/javascript')], body + else: + return 400, [('Content-Type', 'text/plain')], 'Bad Request'
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/service-worker-header.https.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/service-worker-header.https.html new file mode 100644 index 0000000..2584485 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/service-worker-header.https.html
@@ -0,0 +1,18 @@ +<!DOCTYPE html> +<title>Service Worker: Service-Worker header</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/test-helpers.sub.js"></script> +<script> + +promise_test(t => { + const script = 'resources/service-worker-header.py'; + const scope = 'resources/service-worker-header'; + return service_worker_unregister_and_register(t, script, scope) + .then(registration => { + assert_true(registration instanceof ServiceWorkerRegistration); + return registration.unregister(); + }); +}, 'A request to fetch service worker script should have Service-Worker header'); + +</script>
diff --git a/third_party/WebKit/LayoutTests/fast/events/download-on-alt-click-expected.txt b/third_party/WebKit/LayoutTests/fast/events/download-on-alt-click-expected.txt new file mode 100644 index 0000000..ceab4981 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/events/download-on-alt-click-expected.txt
@@ -0,0 +1,4 @@ +Download started +Tests that hitting alt-click results in downloading link. Test passes if a download is observed. + +link
diff --git a/third_party/WebKit/LayoutTests/fast/events/download-on-alt-click.html b/third_party/WebKit/LayoutTests/fast/events/download-on-alt-click.html new file mode 100644 index 0000000..6690aba5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/events/download-on-alt-click.html
@@ -0,0 +1,20 @@ +<!doctype html> +<script> +function test() +{ + if (window.testRunner) { + testRunner.dumpAsText(); + testRunner.waitUntilDone(); + testRunner.waitUntilExternalURLLoad(); + + var a = document.querySelector("#link"); + eventSender.mouseMoveTo(a.offsetLeft + 10, a.offsetTop + 10); + eventSender.mouseDown(0, ['altKey']); + eventSender.mouseUp(0, ['altKey']); + } +} +</script> +<body onload="test()"> +<p>Tests that hitting alt-click results in downloading link. Test passes if a download is observed.</p> +<a href="resources/notify-done.html" id="link">link</a> +</body>
diff --git a/third_party/WebKit/LayoutTests/fast/events/download-on-synthesized-alt-click-expected.txt b/third_party/WebKit/LayoutTests/fast/events/download-on-synthesized-alt-click-expected.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/events/download-on-synthesized-alt-click-expected.txt
@@ -0,0 +1 @@ +
diff --git a/third_party/WebKit/LayoutTests/fast/events/download-on-synthesized-alt-click.html b/third_party/WebKit/LayoutTests/fast/events/download-on-synthesized-alt-click.html new file mode 100644 index 0000000..8d9e570c --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/events/download-on-synthesized-alt-click.html
@@ -0,0 +1,19 @@ +<!doctype html> +<script> +function test() +{ + if (window.testRunner) { + testRunner.dumpAsText(); + testRunner.waitUntilDone(); + testRunner.waitUntilExternalURLLoad(); + + var a = document.querySelector("#link"); + var evt = new MouseEvent("click", { altKey: true }); + a.dispatchEvent(evt); + } +} +</script> +<body onload="test()"> +<p>Tests that synthesizing alt-click does not result in downloading link. Test passes if no download is observed.</p> +<a href="resources/notify-done.html" id="link">link</a> +</body>
diff --git a/third_party/WebKit/LayoutTests/fast/events/resources/notify-done.html b/third_party/WebKit/LayoutTests/fast/events/resources/notify-done.html new file mode 100644 index 0000000..1fdf496 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/events/resources/notify-done.html
@@ -0,0 +1,5 @@ +<!doctype html> +<script> + if (window.testRunner) + testRunner.notifyDone(); +</script>
diff --git a/third_party/WebKit/LayoutTests/fast/forms/color/color-suggestion-picker-appearance-value-attribute-expected.html b/third_party/WebKit/LayoutTests/fast/forms/color/color-suggestion-picker-appearance-value-attribute-expected.html new file mode 100644 index 0000000..da8b9ddf --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/forms/color/color-suggestion-picker-appearance-value-attribute-expected.html
@@ -0,0 +1,40 @@ +<!DOCTYPE html> +<html> +<head> +<script> +window.enablePixelTesting = true; +</script> +<script src="../../../resources/js-test.js"></script> +<script src="../../forms/resources/picker-common.js"></script> +</head> +<body> +<input type=color id=color value="#ff0000" list=gray focus> +<datalist id=gray> + <option>#ffffff</option> + <option>#eeeeee</option> + <option>#dddddd</option> + <option>#cccccc</option> + <option>#bbbbbb</option> + <option>#aaaaaa</option> + <option>#999999</option> + <option>#880088</option> + <option>#777700</option> + <option>#006666</option> + <option>#555555</option> + <option>#444444</option> + <option>#333333</option> + <option>#222222</option> + <option>#111111</option> + <option>#000000</option> + <option>#F00</option> <!--invalid--> + <option>red</option> <!--invalid--> +</datalist> + +<p id="description" style="opacity: 0"></p> +<div id="console" style="opacity: 0"></div> + +<script> +openPicker(document.getElementById('color'), finishJSTest); +</script> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/fast/forms/color/color-suggestion-picker-appearance-value-attribute.html b/third_party/WebKit/LayoutTests/fast/forms/color/color-suggestion-picker-appearance-value-attribute.html new file mode 100644 index 0000000..befee78 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/forms/color/color-suggestion-picker-appearance-value-attribute.html
@@ -0,0 +1,40 @@ +<!DOCTYPE html> +<html> +<head> +<script> +window.enablePixelTesting = true; +</script> +<script src="../../../resources/js-test.js"></script> +<script src="../../forms/resources/picker-common.js"></script> +</head> +<body> +<input type=color id=color value="#ff0000" list=gray focus> +<datalist id=gray> + <option value="#ffffff">F</option> + <option value="#eeeeee">E</option> + <option value="#dddddd">D</option> + <option value="#cccccc">C</option> + <option value="#bbbbbb">B</option> + <option value="#aaaaaa">A</option> + <option value="#999999">9</option> + <option value="#880088">8</option> + <option value="#777700">7</option> + <option value="#006666">6</option> + <option value="#555555">5</option> + <option value="#444444">4</option> + <option value="#333333">3</option> + <option value="#222222">2</option> + <option value="#111111">1</option> + <option value="#000000">0</option> + <option value="#F00">f00</option> <!--invalid--> + <option value="red">red</option> <!--invalid--> +</datalist> + +<p id="description" style="opacity: 0"></p> +<div id="console" style="opacity: 0"></div> + +<script> +openPicker(document.getElementById('color'), finishJSTest); +</script> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/fast/lists/list-with-image-display-changed-expected.html b/third_party/WebKit/LayoutTests/fast/lists/list-with-image-display-changed-expected.html new file mode 100644 index 0000000..31c2a79d --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/lists/list-with-image-display-changed-expected.html
@@ -0,0 +1,11 @@ +<!DOCTYPE html> +<style> +li { border: 3px solid red; margin: 3px; } +img { display: block; } +</style> +<ul> + <li> + <a href="#"><img src="./resources/white.gif" width=32 height=32 /></a> + Some other text + </li> +</ul>
diff --git a/third_party/WebKit/LayoutTests/fast/lists/list-with-image-display-changed.html b/third_party/WebKit/LayoutTests/fast/lists/list-with-image-display-changed.html new file mode 100644 index 0000000..99218067 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/lists/list-with-image-display-changed.html
@@ -0,0 +1,19 @@ +<!DOCTYPE html> +<style> +li { border: 3px solid red; margin: 3px; } +img { display: block; } +</style> +<ul> + <li> + <a href="#"><img src="./resources/white.gif" width=32 height=32 /></a> + Some other text + </li> +</ul> +<script> + document.body.offsetTop; + var img = document.querySelector('a img'); + img.style.display = 'inline'; + img.offsetWidth; + img.style.display = 'block'; +</script> +
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/squashing/selection-repaint-with-gaps-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/squashing/selection-repaint-with-gaps-expected.png index 61fd818..cb888ea 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/squashing/selection-repaint-with-gaps-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/squashing/selection-repaint-with-gaps-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/squashing/selection-repaint-with-gaps-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/squashing/selection-repaint-with-gaps-expected.txt index 98724093..dbcf55f4 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/squashing/selection-repaint-with-gaps-expected.txt +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/squashing/selection-repaint-with-gaps-expected.txt
@@ -34,12 +34,12 @@ "paintInvalidations": [ { "object": "NGPaintFragment", - "rect": [0, 80, 40, 19], + "rect": [0, 80, 40, 20], "reason": "selection" }, { "object": "NGPaintFragment", - "rect": [0, 100, 39, 39], + "rect": [0, 100, 39, 40], "reason": "selection" } ] @@ -104,17 +104,17 @@ "paintInvalidations": [ { "object": "NGPaintFragment", - "rect": [0, 100, 42, 39], + "rect": [0, 100, 42, 40], "reason": "selection" }, { "object": "NGPaintFragment", - "rect": [0, 160, 40, 19], + "rect": [0, 160, 40, 20], "reason": "selection" }, { "object": "NGPaintFragment", - "rect": [0, 80, 40, 19], + "rect": [0, 80, 40, 20], "reason": "selection" }, {
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/execCommand/findString-2-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/execCommand/findString-2-expected.png new file mode 100644 index 0000000..163e383 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/execCommand/findString-2-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-expected.png index 292b97d..eabc2707 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-ltr-mixed-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-ltr-mixed-expected.png index 3463ec9..1bfe1cd3 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-ltr-mixed-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-ltr-mixed-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-rtl-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-rtl-expected.png index dc12a158..de139e8 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-rtl-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-rtl-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-rtl-mixed-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-rtl-mixed-expected.png index e696a58..c0609290 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-rtl-mixed-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-rtl-mixed-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/inline-closest-leaf-child-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/inline-closest-leaf-child-expected.png new file mode 100644 index 0000000..e2c7c09 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/inline-closest-leaf-child-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/line-wrap-1-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/line-wrap-1-expected.png new file mode 100644 index 0000000..7586d1b8 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/line-wrap-1-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/line-wrap-2-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/line-wrap-2-expected.png index 3311291..74f62785 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/line-wrap-2-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/line-wrap-2-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/linux_selection_color-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/linux_selection_color-expected.png index f8eb74a..e2f38acb 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/linux_selection_color-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/linux_selection_color-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/range-between-block-and-inline-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/range-between-block-and-inline-expected.png new file mode 100644 index 0000000..929c5d67 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/range-between-block-and-inline-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-expected.png index ba8b385..aba5cd77 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-mixed-in-ltr-2-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-mixed-in-ltr-2-expected.png index f4efa33..989b720 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-mixed-in-ltr-2-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-mixed-in-ltr-2-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-mixed-in-ltr-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-mixed-in-ltr-expected.png index f9f2107c..d5df4ac 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-mixed-in-ltr-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-mixed-in-ltr-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-mixed-in-rtl-2-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-mixed-in-rtl-2-expected.png index 6d2d8a8..4cb6fb0 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-mixed-in-rtl-2-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-mixed-in-rtl-2-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-mixed-in-rtl-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-mixed-in-rtl-expected.png index d46423a..9b03a9a 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-mixed-in-rtl-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/select-text-overflow-ellipsis-mixed-in-rtl-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/selection-background-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/selection-background-expected.png new file mode 100644 index 0000000..84f0895 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/selection-background-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/selection-button-text-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/selection-button-text-expected.png index 13cc41b..d446f5e 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/selection-button-text-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/selection-button-text-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/transformed-selection-rects-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/transformed-selection-rects-expected.png index ba7aae7..1af763e4 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/transformed-selection-rects-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/editing/selection/transformed-selection-rects-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/backgrounds/selection-background-color-of-list-style-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/backgrounds/selection-background-color-of-list-style-expected.png new file mode 100644 index 0000000..4b6bf23 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/backgrounds/selection-background-color-of-list-style-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/dynamic/fast/overflow/image-selection-highlight-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/dynamic/fast/overflow/image-selection-highlight-expected.png deleted file mode 100644 index 3d426b62..0000000 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/dynamic/fast/overflow/image-selection-highlight-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/dynamic/fast/text/selection/flexbox-selection-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/dynamic/fast/text/selection/flexbox-selection-expected.png deleted file mode 100644 index 407b4b3..0000000 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/dynamic/fast/text/selection/flexbox-selection-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/dynamic/selection-highlight-adjust-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/dynamic/selection-highlight-adjust-expected.png index 56b9188..25c27b6d 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/dynamic/selection-highlight-adjust-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/dynamic/selection-highlight-adjust-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/lists/markers-in-selection-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/lists/markers-in-selection-expected.png index a023c90..1123ea84 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/lists/markers-in-selection-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/lists/markers-in-selection-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/overflow/image-selection-highlight-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/overflow/image-selection-highlight-expected.png index 3d426b62..c0641a6 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/overflow/image-selection-highlight-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/overflow/image-selection-highlight-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/reflections/inline-crash-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/reflections/inline-crash-expected.png new file mode 100644 index 0000000..1976d7d --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/reflections/inline-crash-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/selectors/159-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/selectors/159-expected.png new file mode 100644 index 0000000..c7a6286f --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/selectors/159-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/selectors/177a-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/selectors/177a-expected.png new file mode 100644 index 0000000..a95d92d --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/selectors/177a-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/selectors/selection-window-inactive-expected.html b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/selectors/selection-window-inactive-expected.html new file mode 100644 index 0000000..e64a90d0 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/selectors/selection-window-inactive-expected.html
@@ -0,0 +1,9 @@ +<!DOCTYPE html> +<style> +span { + background-color: rgba(63, 128, 33, 0.95); + color: black; + padding-bottom: 1px; +} +</style> +<span>Any textual selection in this sentence should have a green background when the window is inactive.</span>
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/selectors/shadow-host-div-with-span-expected.html b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/selectors/shadow-host-div-with-span-expected.html new file mode 100644 index 0000000..2fc7c85 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/selectors/shadow-host-div-with-span-expected.html
@@ -0,0 +1,20 @@ +<!DOCTYPE html> +<style> + .class1 { + background-color: rgba(63, 128, 33, 0.95); + color: yellow; + padding-bottom: 1px; + } + .class2 { + background-color: rgba(255, 0, 0, 0.95); + color: green; + padding-bottom: 1px; + } +</style> +<span class='class1'>DOM </span> +<span class='class2'>Shadow DOM </span> +<span class='class1'>DOM</span> +<div> + Above Textual Selection should have Green background and yellow color on "DOM" <br> + and Red background, Green color on "Shadow DOM". +</div> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/selectors/shadow-host-div-with-text-expected.html b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/selectors/shadow-host-div-with-text-expected.html new file mode 100644 index 0000000..f8f43cb --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/selectors/shadow-host-div-with-text-expected.html
@@ -0,0 +1,23 @@ +<!doctype html> +<html> +<head> +<style type="text/css"> + .reset { + border: 0; + margin: 0; + padding: 0; + + font: 16px sans-serif; + } + .beauty { + background-color: rgba(255, 0, 0, 0.95); + padding-bottom: 1px; + } +</style> +</head> +<body class="reset"> + <div> + <span class="beauty">Some hearts are diamonds some hearts are stones</span> + </div> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/atsui-kerning-and-ligatures-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/atsui-kerning-and-ligatures-expected.png new file mode 100644 index 0000000..3e43620 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/atsui-kerning-and-ligatures-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/atsui-rtl-override-selection-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/atsui-rtl-override-selection-expected.png new file mode 100644 index 0000000..14e19ebb --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/atsui-rtl-override-selection-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/complex-text-rtl-selection-repaint-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/complex-text-rtl-selection-repaint-expected.png new file mode 100644 index 0000000..501f6ec8 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/complex-text-rtl-selection-repaint-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/flexbox-selection-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/flexbox-selection-expected.png index 407b4b3..cd18fbb9 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/flexbox-selection-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/flexbox-selection-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/flexbox-selection-nested-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/flexbox-selection-nested-expected.png new file mode 100644 index 0000000..f2524d2d --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/flexbox-selection-nested-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/justified-selection-at-edge-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/justified-selection-at-edge-expected.png index f72da77..e235ec6 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/justified-selection-at-edge-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/justified-selection-at-edge-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/justified-selection-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/justified-selection-expected.png new file mode 100644 index 0000000..45b260f4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/justified-selection-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/khmer-selection-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/khmer-selection-expected.png index e90eab2..c591b39 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/khmer-selection-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/khmer-selection-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/selection-multiple-runs-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/selection-multiple-runs-expected.png new file mode 100644 index 0000000..7d48c5a --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/selection-multiple-runs-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/selection-painting-hidpi-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/selection-painting-hidpi-expected.png new file mode 100644 index 0000000..ce00f7b --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/selection-painting-hidpi-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/selection-rect-line-height-too-big-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/selection-rect-line-height-too-big-expected.png new file mode 100644 index 0000000..45986e1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/selection-rect-line-height-too-big-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/selection-rect-line-height-too-small-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/selection-rect-line-height-too-small-expected.png new file mode 100644 index 0000000..04f9505 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/selection-rect-line-height-too-small-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/shaping-selection-rect-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/shaping-selection-rect-expected.png new file mode 100644 index 0000000..52202de11 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/shaping-selection-rect-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/should-use-atsui-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/should-use-atsui-expected.png new file mode 100644 index 0000000..f36fee21 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/fast/text/selection/should-use-atsui-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/selection/text-selection-newline-clipped-by-overflow-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/selection/text-selection-newline-clipped-by-overflow-expected.png index 8ed2c2d..70591b58 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/selection/text-selection-newline-clipped-by-overflow-expected.png +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/selection/text-selection-newline-clipped-by-overflow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/selection/text-selection-newline-mixed-ltr-rtl-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/selection/text-selection-newline-mixed-ltr-rtl-expected.png new file mode 100644 index 0000000..b737e7f9 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/selection/text-selection-newline-mixed-ltr-rtl-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/svg/text/foreignObject-text-clipping-bug-expected.png b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/svg/text/foreignObject-text-clipping-bug-expected.png new file mode 100644 index 0000000..c5ce752 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/svg/text/foreignObject-text-clipping-bug-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/windows-1251-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/windows-1251-expected.txt deleted file mode 100644 index 929efda0..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/windows-1251-expected.txt +++ /dev/null
@@ -1,105 +0,0 @@ -This is a testharness.js-based test. -Found 101 tests; 50 PASS, 51 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS load nested browsing context <frame src> -PASS load nested browsing context <iframe src> -PASS load nested browsing context <object data> -PASS load nested browsing context <embed src> -PASS loading css <link> -PASS loading js <script> -FAIL loading image <img src> assert_equals: expected substring %26%23229%3B got unknown query expected (undefined) undefined but got (number) 256 -FAIL loading image <embed src> assert_equals: expected substring %26%23229%3B got default intrinsic width expected (undefined) undefined but got (number) 300 -FAIL loading image <object data> assert_equals: expected substring %26%23229%3B got default intrinsic width expected (undefined) undefined but got (number) 300 -FAIL loading image <input src> assert_equals: expected substring %26%23229%3B got unknown query expected (undefined) undefined but got (number) 256 -FAIL loading image <video poster> assert_equals: expected substring %26%23229%3B got unknown query expected (undefined) undefined but got (number) 256 -FAIL loading video <video> assert_equals: expected substring %26%23229%3B got undefined expected (undefined) undefined but got (number) 614 -FAIL loading video <video><source> assert_equals: expected substring %26%23229%3B got undefined expected (undefined) undefined but got (number) 614 -FAIL loading video <audio> assert_equals: expected substring %26%23229%3B got undefined expected (undefined) undefined but got (number) 614 -FAIL loading video <audio><source> assert_equals: expected substring %26%23229%3B got undefined expected (undefined) undefined but got (number) 614 -PASS loading webvtt <track> -PASS submit form <form action> -PASS submit form <input formaction> -PASS submit form <button formaction> -FAIL <base href> assert_true: expected substring %26%23229%3B got http://web-platform.test:8001/html/infrastructure/urls/resolving-urls/query-encoding/resources/resource.py?q=%C3%A5&encoding=windows-1251&type= expected true got false -PASS Worker constructor -PASS SharedWorker constructor -PASS EventSource constructor -PASS EventSource#url -FAIL XMLDocument#load() doc.load is not a function -PASS window.open() -FAIL <a>.search assert_true: href content attribute expected substring %26%23229%3B got http://web-platform.test:8001/html/infrastructure/urls/resolving-urls/query-encoding/resources/resource.py?q=%C3%A5&encoding=windows-1251&type=html expected true got false -FAIL <area>.search assert_true: href content attribute expected substring %26%23229%3B got http://web-platform.test:8001/html/infrastructure/urls/resolving-urls/query-encoding/resources/resource.py?q=%C3%A5&encoding=windows-1251&type=html expected true got false -FAIL history.pushState assert_true: expected substring %26%23229%3B got http://web-platform.test:8001/html/infrastructure/urls/resolving-urls/query-encoding/resources/resources/resource.py?q=%C3%A5&encoding=windows-1251&type=html expected true got false -FAIL history.replaceState assert_true: expected substring %26%23229%3B got http://web-platform.test:8001/html/infrastructure/urls/resolving-urls/query-encoding/resources/resources/resource.py?q=%C3%A5&encoding=windows-1251&type=html expected true got false -PASS SVG <a> -FAIL SVG <feImage> poll_for_stash is not defined -FAIL SVG <image> poll_for_stash is not defined -FAIL SVG <use> poll_for_stash is not defined -FAIL XMLHttpRequest#open() assert_equals: expected "%C3%A5" but got "%26%23229%3B" -PASS importScripts() in a dedicated worker -FAIL Worker() in a dedicated worker assert_equals: expected "%C3%A5" but got "ReferenceError: Worker is not defined" -FAIL SharedWorker() in a dedicated worker assert_equals: expected "%C3%A5" but got "ReferenceError: SharedWorker is not defined" -FAIL importScripts() in a shared worker assert_equals: expected "%C3%A5" but got "importScripts failed to run" -FAIL Worker() in a shared worker assert_equals: expected "%C3%A5" but got "ReferenceError: Worker is not defined" -FAIL SharedWorker() in a shared worker assert_equals: expected "%C3%A5" but got "ReferenceError: SharedWorker is not defined" -PASS WebSocket constructor -PASS WebSocket#url -FAIL Parsing cache manifest (CACHE) poll_for_stash is not defined -FAIL Parsing cache manifest (FALLBACK) poll_for_stash is not defined -FAIL Parsing cache manifest (NETWORK) poll_for_stash is not defined -FAIL CSS <link> (windows-1251) #<id> { background-image:<url> } poll_for_stash is not defined -FAIL CSS <link> (utf-8) #<id> { background-image:<url> } poll_for_stash is not defined -FAIL CSS <style> #<id> { background-image:<url> } poll_for_stash is not defined -FAIL CSS <link> (windows-1251) #<id> { border-image-source:<url> } poll_for_stash is not defined -FAIL CSS <link> (utf-8) #<id> { border-image-source:<url> } poll_for_stash is not defined -FAIL CSS <style> #<id> { border-image-source:<url> } poll_for_stash is not defined -FAIL CSS <link> (windows-1251) #<id>::before { content:<url> } poll_for_stash is not defined -FAIL CSS <link> (utf-8) #<id>::before { content:<url> } poll_for_stash is not defined -FAIL CSS <style> #<id>::before { content:<url> } poll_for_stash is not defined -FAIL CSS <link> (windows-1251) @font-face { font-family:<id>; src:<url> } #<id> { font-family:<id> } poll_for_stash is not defined -FAIL CSS <link> (utf-8) @font-face { font-family:<id>; src:<url> } #<id> { font-family:<id> } poll_for_stash is not defined -FAIL CSS <style> @font-face { font-family:<id>; src:<url> } #<id> { font-family:<id> } poll_for_stash is not defined -FAIL CSS <link> (windows-1251) #<id> { display:list-item; list-style-image:<url> } poll_for_stash is not defined -FAIL CSS <link> (utf-8) #<id> { display:list-item; list-style-image:<url> } poll_for_stash is not defined -FAIL CSS <style> #<id> { display:list-item; list-style-image:<url> } poll_for_stash is not defined -FAIL CSS <link> (windows-1251) @import <url>; poll_for_stash is not defined -FAIL CSS <link> (utf-8) @import <url>; poll_for_stash is not defined -FAIL CSS <style> @import <url>; poll_for_stash is not defined -FAIL CSS <link> (windows-1251) #<id> { cursor:<url>, pointer } poll_for_stash is not defined -FAIL CSS <link> (utf-8) #<id> { cursor:<url>, pointer } poll_for_stash is not defined -FAIL CSS <style> #<id> { cursor:<url>, pointer } poll_for_stash is not defined -FAIL <?xml-stylesheet?> (CSS) assert_equals: expected "\"%C3%A5\"" but got "\"%26%23229%3B\"" -PASS URL constructor, url -PASS URL constructor, base -PASS Scheme ftp (getting <a>.href) -PASS Scheme file (getting <a>.href) -PASS Scheme gopher (getting <a>.href) -PASS Scheme http (getting <a>.href) -PASS Scheme https (getting <a>.href) -FAIL Scheme ws (getting <a>.href) assert_true: expected substring %C3%A5 got ws://example.invalid/?x=%26%23229%3B expected true got false -FAIL Scheme wss (getting <a>.href) assert_true: expected substring %C3%A5 got wss://example.invalid/?x=%26%23229%3B expected true got false -PASS Scheme mailto (getting <a>.href) -PASS Scheme data (getting <a>.href) -PASS Scheme javascript (getting <a>.href) -PASS Scheme ftps (getting <a>.href) -PASS Scheme httpbogus (getting <a>.href) -PASS Scheme bitcoin (getting <a>.href) -PASS Scheme geo (getting <a>.href) -PASS Scheme im (getting <a>.href) -PASS Scheme irc (getting <a>.href) -PASS Scheme ircs (getting <a>.href) -PASS Scheme magnet (getting <a>.href) -PASS Scheme mms (getting <a>.href) -PASS Scheme news (getting <a>.href) -PASS Scheme nntp (getting <a>.href) -PASS Scheme sip (getting <a>.href) -PASS Scheme sms (getting <a>.href) -PASS Scheme smsto (getting <a>.href) -PASS Scheme ssh (getting <a>.href) -PASS Scheme tel (getting <a>.href) -PASS Scheme urn (getting <a>.href) -PASS Scheme webcal (getting <a>.href) -PASS Scheme wtai (getting <a>.href) -PASS Scheme xmpp (getting <a>.href) -PASS Scheme web+http (getting <a>.href) -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLCanvasElement.html b/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLCanvasElement.html index a100423f..2c07c4f 100644 --- a/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLCanvasElement.html +++ b/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLCanvasElement.html
@@ -4,6 +4,7 @@ <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script> <script src="file:///gen/mojo/public/mojom/base/big_buffer.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/barcodedetection.mojom.js"></script> +<script src="file:///gen/services/shape_detection/public/mojom/barcodedetection_provider.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/facedetection.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/facedetection_provider.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/textdetection.mojom.js"></script> @@ -94,14 +95,14 @@ "Barcode - detect(HTMLCanvasElement)", () => { return new BarcodeDetector(); }, () => { return document.createElement("canvas"); }, - mockBarcodeDetection, + mockBarcodeDetectionProvider, BarcodeDetectorDetectionResultTest ], [ "Barcode - detect(OffscreenCanvas)", () => { return new BarcodeDetector(); }, () => { return new OffscreenCanvas(300, 150); }, - mockBarcodeDetection, + mockBarcodeDetectionProvider, BarcodeDetectorDetectionResultTest ], [
diff --git a/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLImageElement.html b/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLImageElement.html index fa832a6..3e0ea812 100644 --- a/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLImageElement.html +++ b/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLImageElement.html
@@ -4,6 +4,7 @@ <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script> <script src="file:///gen/mojo/public/mojom/base/big_buffer.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/barcodedetection.mojom.js"></script> +<script src="file:///gen/services/shape_detection/public/mojom/barcodedetection_provider.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/facedetection.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/facedetection_provider.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/textdetection.mojom.js"></script> @@ -82,7 +83,7 @@ [ "Barcode - detect(HTMLImageElement)", () => { return new BarcodeDetector(); }, - mockBarcodeDetection, + mockBarcodeDetectionProvider, BarcodeDetectorDetectionResultTest ], [
diff --git a/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLVideoElement.html b/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLVideoElement.html index 3c82158..0a3fa39a 100644 --- a/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLVideoElement.html +++ b/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLVideoElement.html
@@ -4,6 +4,7 @@ <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script> <script src="file:///gen/mojo/public/mojom/base/big_buffer.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/barcodedetection.mojom.js"></script> +<script src="file:///gen/services/shape_detection/public/mojom/barcodedetection_provider.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/facedetection.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/facedetection_provider.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/textdetection.mojom.js"></script> @@ -66,7 +67,7 @@ [ "Barcode - detect(HTMLVideoElement)", () => { return new BarcodeDetector(); }, - mockBarcodeDetection, + mockBarcodeDetectionProvider, BarcodeDetectorDetectionResultTest ], [
diff --git a/third_party/WebKit/LayoutTests/shapedetection/detection-ImageBitmap.html b/third_party/WebKit/LayoutTests/shapedetection/detection-ImageBitmap.html index ec45089..ba6e07b9 100644 --- a/third_party/WebKit/LayoutTests/shapedetection/detection-ImageBitmap.html +++ b/third_party/WebKit/LayoutTests/shapedetection/detection-ImageBitmap.html
@@ -4,6 +4,7 @@ <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script> <script src="file:///gen/mojo/public/mojom/base/big_buffer.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/barcodedetection.mojom.js"></script> +<script src="file:///gen/services/shape_detection/public/mojom/barcodedetection_provider.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/facedetection.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/facedetection_provider.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/textdetection.mojom.js"></script> @@ -66,7 +67,7 @@ [ "Barcode - detect(ImageBitmap)", () => { return new BarcodeDetector(); }, - mockBarcodeDetection, + mockBarcodeDetectionProvider, BarcodeDetectorDetectionResultTest ], [
diff --git a/third_party/WebKit/LayoutTests/shapedetection/detection-ImageData.html b/third_party/WebKit/LayoutTests/shapedetection/detection-ImageData.html index b236d1b..4120dcd 100644 --- a/third_party/WebKit/LayoutTests/shapedetection/detection-ImageData.html +++ b/third_party/WebKit/LayoutTests/shapedetection/detection-ImageData.html
@@ -4,6 +4,7 @@ <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script> <script src="file:///gen/mojo/public/mojom/base/big_buffer.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/barcodedetection.mojom.js"></script> +<script src="file:///gen/services/shape_detection/public/mojom/barcodedetection_provider.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/facedetection.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/facedetection_provider.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/textdetection.mojom.js"></script> @@ -70,7 +71,7 @@ [ "Barcode - detect(ImageData)", () => { return new BarcodeDetector(); }, - mockBarcodeDetection, + mockBarcodeDetectionProvider, BarcodeDetectorDetectionResultTest ], [
diff --git a/third_party/WebKit/LayoutTests/shapedetection/detection-options.html b/third_party/WebKit/LayoutTests/shapedetection/detection-options.html index 9cd9e81..557043e 100644 --- a/third_party/WebKit/LayoutTests/shapedetection/detection-options.html +++ b/third_party/WebKit/LayoutTests/shapedetection/detection-options.html
@@ -12,8 +12,8 @@ </body> <script> promise_test(async function() { - var img = document.getElementById("img"); var mock = mockFaceDetectionProvider; + var img = document.getElementById("img"); var detectorWithDefault = new FaceDetector(); var faceDetectionResult = await detectorWithDefault.detect(img);
diff --git a/third_party/WebKit/LayoutTests/shapedetection/detection-security-test.html b/third_party/WebKit/LayoutTests/shapedetection/detection-security-test.html index f9b2250..c43802e 100644 --- a/third_party/WebKit/LayoutTests/shapedetection/detection-security-test.html +++ b/third_party/WebKit/LayoutTests/shapedetection/detection-security-test.html
@@ -4,6 +4,7 @@ <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script> <script src="file:///gen/mojo/public/mojom/base/big_buffer.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/barcodedetection.mojom.js"></script> +<script src="file:///gen/services/shape_detection/public/mojom/barcodedetection_provider.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/facedetection.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/facedetection_provider.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/textdetection.mojom.js"></script>
diff --git a/third_party/WebKit/LayoutTests/shapedetection/detector-same-object.html b/third_party/WebKit/LayoutTests/shapedetection/detector-same-object.html index ba15601..67751d8 100644 --- a/third_party/WebKit/LayoutTests/shapedetection/detector-same-object.html +++ b/third_party/WebKit/LayoutTests/shapedetection/detector-same-object.html
@@ -4,6 +4,7 @@ <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script> <script src="file:///gen/mojo/public/mojom/base/big_buffer.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/barcodedetection.mojom.js"></script> +<script src="file:///gen/services/shape_detection/public/mojom/barcodedetection_provider.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/facedetection.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/facedetection_provider.mojom.js"></script> <script src="file:///gen/services/shape_detection/public/mojom/textdetection.mojom.js"></script> @@ -16,7 +17,6 @@ var createTestForImageData = function(createDetector, mock, detectionResultTest) { async_test(function(t) { - var img = new Image(); img.onload = async function() { @@ -69,7 +69,7 @@ [ "Barcode - detect(ImageData), [SameObject]", () => { return new BarcodeDetector(); }, - mockBarcodeDetection, + mockBarcodeDetectionProvider, CheckDetectedBarcodesSameObjects ], [
diff --git a/third_party/WebKit/LayoutTests/shapedetection/resources/mock-barcodedetection.js b/third_party/WebKit/LayoutTests/shapedetection/resources/mock-barcodedetection.js index f86c55b..21ea5f55 100644 --- a/third_party/WebKit/LayoutTests/shapedetection/resources/mock-barcodedetection.js +++ b/third_party/WebKit/LayoutTests/shapedetection/resources/mock-barcodedetection.js
@@ -1,17 +1,37 @@ "use strict"; -class MockBarcodeDetection { +class MockBarcodeDetectionProvider { constructor() { this.bindingSet_ = new mojo.BindingSet( - shapeDetection.mojom.BarcodeDetection); + shapeDetection.mojom.BarcodeDetectionProvider); this.interceptor_ = new MojoInterfaceInterceptor( - shapeDetection.mojom.BarcodeDetection.name); + shapeDetection.mojom.BarcodeDetectionProvider.name); this.interceptor_.oninterfacerequest = e => this.bindingSet_.addBinding(this, e.handle); this.interceptor_.start(); } + createBarcodeDetection(request, options) { + this.mockService_ = new MockBarcodeDetection(request, options); + } + + getFrameData() { + return this.mockService_.bufferData_; + } + + getFormats() { + return this.mockService_.options_.formats; + } +} + +class MockBarcodeDetection { + constructor(request, options) { + this.options_ = options; + this.binding_ = + new mojo.Binding(shapeDetection.mojom.BarcodeDetection, this, request); + } + detect(bitmapData) { this.bufferData_ = new Uint32Array(getArrayBufferFromBigBuffer(bitmapData.pixelData)); @@ -40,10 +60,6 @@ ], }); } - - getFrameData() { - return this.bufferData_; - } } -let mockBarcodeDetection = new MockBarcodeDetection(); +let mockBarcodeDetectionProvider = new MockBarcodeDetectionProvider();
diff --git a/third_party/WebKit/LayoutTests/shapedetection/resources/worker.js b/third_party/WebKit/LayoutTests/shapedetection/resources/worker.js index 848f229a..badd55b 100644 --- a/third_party/WebKit/LayoutTests/shapedetection/resources/worker.js +++ b/third_party/WebKit/LayoutTests/shapedetection/resources/worker.js
@@ -5,6 +5,7 @@ importScripts("file:///gen/skia/public/interfaces/bitmap.mojom.js"); importScripts("file:///gen/ui/gfx/geometry/mojo/geometry.mojom.js"); importScripts("file:///gen/services/shape_detection/public/mojom/barcodedetection.mojom.js"); +importScripts("file:///gen/services/shape_detection/public/mojom/barcodedetection_provider.mojom.js"); importScripts("file:///gen/services/shape_detection/public/mojom/facedetection.mojom.js"); importScripts("file:///gen/services/shape_detection/public/mojom/facedetection_provider.mojom.js"); importScripts("file:///gen/services/shape_detection/public/mojom/textdetection.mojom.js");
diff --git a/third_party/blink/renderer/bindings/core/v8/dictionary_helper_for_core.cc b/third_party/blink/renderer/bindings/core/v8/dictionary_helper_for_core.cc index 46ceb88e..728a7c6 100644 --- a/third_party/blink/renderer/bindings/core/v8/dictionary_helper_for_core.cc +++ b/third_party/blink/renderer/bindings/core/v8/dictionary_helper_for_core.cc
@@ -174,7 +174,7 @@ double double_value; if (!v8_value->NumberValue(dictionary.V8Context()).To(&double_value)) return false; - doubleToInteger(double_value, value); + value = DoubleToInteger(double_value); return true; }
diff --git a/third_party/blink/renderer/bindings/core/v8/exception_state.cc b/third_party/blink/renderer/bindings/core/v8/exception_state.cc index b06db42..7fbda3d9 100644 --- a/third_party/blink/renderer/bindings/core/v8/exception_state.cc +++ b/third_party/blink/renderer/bindings/core/v8/exception_state.cc
@@ -31,11 +31,20 @@ #include "third_party/blink/renderer/bindings/core/v8/exception_state.h" #include "third_party/blink/renderer/bindings/core/v8/exception_messages.h" -#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h" namespace blink { +ExceptionState::CreateDOMExceptionFunction + ExceptionState::s_create_dom_exception_func_ = nullptr; + +// static +void ExceptionState::SetCreateDOMExceptionFunction( + CreateDOMExceptionFunction func) { + DCHECK(!s_create_dom_exception_func_); + s_create_dom_exception_func_ = func; + DCHECK(s_create_dom_exception_func_); +} + void ExceptionState::ThrowDOMException(ExceptionCode ec, const char* message) { ThrowDOMException(ec, String(message)); } @@ -63,7 +72,7 @@ const String& processed_message = AddExceptionContext(message); SetException( ec, processed_message, - V8ThrowDOMException::CreateDOMException(isolate_, ec, processed_message)); + s_create_dom_exception_func_(isolate_, ec, processed_message, String())); } void ExceptionState::ThrowRangeError(const String& message) { @@ -78,8 +87,8 @@ const String& final_unsanitized = AddExceptionContext(unsanitized_message); SetException( kSecurityError, final_sanitized, - V8ThrowDOMException::CreateDOMException( - isolate_, kSecurityError, final_sanitized, final_unsanitized)); + s_create_dom_exception_func_(isolate_, kSecurityError, final_sanitized, + final_unsanitized)); } void ExceptionState::ThrowTypeError(const String& message) {
diff --git a/third_party/blink/renderer/bindings/core/v8/exception_state.h b/third_party/blink/renderer/bindings/core/v8/exception_state.h index af170ed0..c4be145 100644 --- a/third_party/blink/renderer/bindings/core/v8/exception_state.h +++ b/third_party/blink/renderer/bindings/core/v8/exception_state.h
@@ -67,6 +67,16 @@ // API. }; + // A function pointer type that creates a DOMException. + using CreateDOMExceptionFunction = + v8::Local<v8::Value> (*)(v8::Isolate*, + ExceptionCode, + const String& sanitized_message, + const String& unsanitized_message); + + // Sets the function to create a DOMException. Must be called only once. + static void SetCreateDOMExceptionFunction(CreateDOMExceptionFunction); + ExceptionState(v8::Isolate* isolate, ContextType context_type, const char* interface_name, @@ -138,6 +148,10 @@ void SetException(ExceptionCode, const String&, v8::Local<v8::Value>); private: + // Since DOMException is defined in core/, we need a dependency injection in + // order to create a DOMException in platform/. + static CreateDOMExceptionFunction s_create_dom_exception_func_; + ExceptionCode code_; ContextType context_; String message_;
diff --git a/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.cc b/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.cc index 0dc1998..0e572db 100644 --- a/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.cc
@@ -475,7 +475,7 @@ v8::Local<v8::String> v8_message) { DCHECK(exception_state_); String message = exception_state_->AddExceptionContext( - V8StringToWebCoreString<String>(v8_message, kDoNotExternalize)); + ToBlinkString<String>(v8_message, kDoNotExternalize)); V8ThrowDOMException::ThrowDOMException(script_state_->GetIsolate(), kDataCloneError, message); }
diff --git a/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc b/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc index 4426e7d..1185189 100644 --- a/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc +++ b/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc
@@ -107,7 +107,7 @@ } String ToJSON(v8::Local<v8::Object> object, const V8TestingScope& scope) { - return V8StringToWebCoreString<String>( + return ToBlinkString<String>( v8::JSON::Stringify(scope.GetContext(), object).ToLocalChecked(), kDoNotExternalize); }
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc b/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc index 3ddf440..1fa846c 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc
@@ -412,13 +412,7 @@ "long long", exception_state); } - if (std::isnan(number_value) || std::isinf(number_value)) - return 0; - - // NaNs and +/-Infinity should be 0, otherwise modulo 2^64. - unsigned long long integer; - doubleToInteger(number_value, integer); - return integer; + return DoubleToInteger(number_value); } uint64_t ToUInt64Slow(v8::Isolate* isolate, @@ -462,13 +456,7 @@ if (configuration == kClamp) return clampTo<uint64_t>(number_value); - if (std::isinf(number_value)) - return 0; - - // NaNs and +/-Infinity should be 0, otherwise modulo 2^64. - unsigned long long integer; - doubleToInteger(number_value, integer); - return integer; + return DoubleToInteger(number_value); } float ToRestrictedFloat(v8::Isolate* isolate,
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h b/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h index f7400321..27f45be 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h +++ b/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h
@@ -345,6 +345,30 @@ return ToUInt64Slow(isolate, value, configuration, exception_state); } +// NaNs and +/-Infinity should be 0, otherwise modulo 2^64. +// Step 8 - 12 of https://heycam.github.io/webidl/#abstract-opdef-converttoint +inline unsigned long long DoubleToInteger(double d) { + if (std::isnan(d) || std::isinf(d)) + return 0; + constexpr unsigned long long kMaxULL = + std::numeric_limits<unsigned long long>::max(); + + // -2^{64} < fmod_value < 2^{64}. + double fmod_value = fmod(trunc(d), kMaxULL + 1.0); + if (fmod_value >= 0) { + // 0 <= fmod_value < 2^{64}. + // 0 <= value < 2^{64}. This cast causes no loss. + return static_cast<unsigned long long>(fmod_value); + } + // -2^{64} < fmod_value < 0. + // 0 < fmod_value_in_unsigned_long_long < 2^{64}. This cast causes no loss. + unsigned long long fmod_value_in_unsigned_long_long = + static_cast<unsigned long long>(-fmod_value); + // -1 < (kMaxULL - fmod_value_in_unsigned_long_long) < 2^{64} - 1. + // 0 < value < 2^{64}. + return kMaxULL - fmod_value_in_unsigned_long_long + 1; +} + // Convert a value to a double precision float, which might fail. CORE_EXPORT double ToDoubleSlow(v8::Isolate*, v8::Local<v8::Value>,
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_object_builder_test.cc b/third_party/blink/renderer/bindings/core/v8/v8_object_builder_test.cc index e4cd8cc..1e2f145b 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_object_builder_test.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_object_builder_test.cc
@@ -20,7 +20,7 @@ ScriptValue json_object = builder.GetScriptValue(); EXPECT_TRUE(json_object.IsObject()); - String json_string = V8StringToWebCoreString<String>( + String json_string = ToBlinkString<String>( v8::JSON::Stringify(scope.GetContext(), json_object.V8Value().As<v8::Object>()) .ToLocalChecked(), @@ -39,7 +39,7 @@ ScriptValue json_object = builder.GetScriptValue(); EXPECT_TRUE(json_object.IsObject()); - String json_string = V8StringToWebCoreString<String>( + String json_string = ToBlinkString<String>( v8::JSON::Stringify(scope.GetContext(), json_object.V8Value().As<v8::Object>()) .ToLocalChecked(), @@ -58,7 +58,7 @@ ScriptValue json_object = builder.GetScriptValue(); EXPECT_TRUE(json_object.IsObject()); - String json_string = V8StringToWebCoreString<String>( + String json_string = ToBlinkString<String>( v8::JSON::Stringify(scope.GetContext(), json_object.V8Value().As<v8::Object>()) .ToLocalChecked(), @@ -85,7 +85,7 @@ ScriptValue json_object = builder.GetScriptValue(); EXPECT_TRUE(json_object.IsObject()); - String json_string = V8StringToWebCoreString<String>( + String json_string = ToBlinkString<String>( v8::JSON::Stringify(scope.GetContext(), json_object.V8Value().As<v8::Object>()) .ToLocalChecked(), @@ -110,7 +110,7 @@ EXPECT_TRUE(builder_json_object.IsObject()); EXPECT_TRUE(result_json_object.IsObject()); - String json_string = V8StringToWebCoreString<String>( + String json_string = ToBlinkString<String>( v8::JSON::Stringify(scope.GetContext(), result_json_object.V8Value().As<v8::Object>()) .ToLocalChecked(),
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_string_resource.h b/third_party/blink/renderer/bindings/core/v8/v8_string_resource.h index 729474d..18bd869 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_string_resource.h +++ b/third_party/blink/renderer/bindings/core/v8/v8_string_resource.h
@@ -97,7 +97,7 @@ return true; if (LIKELY(v8_object_->IsInt32())) { - SetString(Int32ToWebCoreString(v8_object_.As<v8::Int32>()->Value())); + SetString(ToBlinkString(v8_object_.As<v8::Int32>()->Value())); return true; } @@ -126,7 +126,7 @@ template <class StringType> StringType ToString() const { if (LIKELY(!v8_object_.IsEmpty())) - return V8StringToWebCoreString<StringType>( + return ToBlinkString<StringType>( const_cast<v8::Local<v8::Value>*>(&v8_object_)->As<v8::String>(), mode_);
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.cc b/third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.cc index bd83aa2..1f6451c 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.cc
@@ -4,6 +4,7 @@ #include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h" +#include "third_party/blink/renderer/bindings/core/v8/exception_state.h" #include "third_party/blink/renderer/bindings/core/v8/to_v8_for_core.h" #include "third_party/blink/renderer/core/dom/dom_exception.h" #include "third_party/blink/renderer/platform/bindings/v8_private_property.h" @@ -11,6 +12,12 @@ namespace blink { +// static +void V8ThrowDOMException::Init() { + ExceptionState::SetCreateDOMExceptionFunction( + V8ThrowDOMException::CreateDOMException); +} + namespace { void DomExceptionStackGetter(v8::Local<v8::Name> name,
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h b/third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h index 19590706..cac47ef6 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h +++ b/third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h
@@ -18,6 +18,9 @@ STATIC_ONLY(V8ThrowDOMException); public: + // Per-process initializer. Must be called in CoreInitializer. + static void Init(); + // Creates and returns an exception object, or returns an empty handle if // failed. |unsanitizedMessage| should not be specified unless it's // SecurityError.
diff --git a/third_party/blink/renderer/core/core_initializer.cc b/third_party/blink/renderer/core/core_initializer.cc index ca0a69e7..2737c9b2 100644 --- a/third_party/blink/renderer/core/core_initializer.cc +++ b/third_party/blink/renderer/core/core_initializer.cc
@@ -32,6 +32,7 @@ #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/bindings/core/v8/script_streamer_thread.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h" #include "third_party/blink/renderer/core/css/media_feature_names.h" #include "third_party/blink/renderer/core/css/media_query_evaluator.h" #include "third_party/blink/renderer/core/css/parser/css_parser_token_range.h" @@ -143,6 +144,8 @@ StringImpl::FreezeStaticStrings(); + V8ThrowDOMException::Init(); + ScriptStreamerThread::Init(); }
diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc index 42929bff..81a2141b8 100644 --- a/third_party/blink/renderer/core/dom/element.cc +++ b/third_party/blink/renderer/core/dom/element.cc
@@ -2465,14 +2465,22 @@ DCHECK(!GetShadowRoot()); ShadowRoot* shadow_root = ShadowRoot::Create(GetDocument(), type); + + if (type != ShadowRootType::V0) { + // Detach the host's children here for v1 (including UA shadow root), + // because we skip SetNeedsDistributionRecalc() in attaching v1 shadow root. + // See https://crrev.com/2822113002 for details. + // We need to call child.LazyReattachIfAttached() before setting a shadow + // root to the element because detach must use the original flat tree + // structure before attachShadow happens. + for (Node& child : NodeTraversal::ChildrenOf(*this)) + child.LazyReattachIfAttached(); + } EnsureElementRareData().SetShadowRoot(*shadow_root); shadow_root->SetParentOrShadowHostNode(this); shadow_root->SetParentTreeScope(GetTreeScope()); if (type == ShadowRootType::V0) { shadow_root->SetNeedsDistributionRecalc(); - } else { - for (Node& child : NodeTraversal::ChildrenOf(*this)) - child.LazyReattachIfAttached(); } shadow_root->InsertedInto(this);
diff --git a/third_party/blink/renderer/core/dom/events/event_queue.h b/third_party/blink/renderer/core/dom/events/event_queue.h index a095e485..aa7696d 100644 --- a/third_party/blink/renderer/core/dom/events/event_queue.h +++ b/third_party/blink/renderer/core/dom/events/event_queue.h
@@ -42,7 +42,7 @@ virtual ~EventQueue() = default; virtual void Trace(blink::Visitor* visitor) {} virtual bool EnqueueEvent(const base::Location&, Event*) = 0; - virtual bool CancelEvent(Event*) = 0; + virtual void CancelAllEvents() = 0; // The accumulated and all the future events will be discarded, no events will // be dispatched anymore. virtual void Close() = 0;
diff --git a/third_party/blink/renderer/core/dom/events/event_queue_impl.cc b/third_party/blink/renderer/core/dom/events/event_queue_impl.cc index c40446a..4891bc6 100644 --- a/third_party/blink/renderer/core/dom/events/event_queue_impl.cc +++ b/third_party/blink/renderer/core/dom/events/event_queue_impl.cc
@@ -74,22 +74,17 @@ return true; } -bool EventQueueImpl::CancelEvent(Event* event) { - if (!RemoveEvent(event)) - return false; - probe::AsyncTaskCanceled(event->target()->GetExecutionContext(), event); - return true; +void EventQueueImpl::CancelAllEvents() { + for (const auto& queued_event : queued_events_) { + probe::AsyncTaskCanceled(queued_event->target()->GetExecutionContext(), + queued_event); + } + queued_events_.clear(); } void EventQueueImpl::Close() { is_closed_ = true; - for (const auto& queued_event : queued_events_) { - if (queued_event) { - probe::AsyncTaskCanceled(queued_event->target()->GetExecutionContext(), - queued_event); - } - } - queued_events_.clear(); + CancelAllEvents(); } bool EventQueueImpl::RemoveEvent(Event* event) {
diff --git a/third_party/blink/renderer/core/dom/events/event_queue_impl.h b/third_party/blink/renderer/core/dom/events/event_queue_impl.h index 7dbff48..3374d24 100644 --- a/third_party/blink/renderer/core/dom/events/event_queue_impl.h +++ b/third_party/blink/renderer/core/dom/events/event_queue_impl.h
@@ -36,7 +36,7 @@ class Event; class ExecutionContext; -class EventQueueImpl final : public EventQueue { +class CORE_EXPORT EventQueueImpl final : public EventQueue { public: // TODO(hajimehoshi): TaskType should be determined based on an event instead // of specifying here. @@ -46,7 +46,7 @@ // EventQueue void Trace(blink::Visitor*) override; bool EnqueueEvent(const base::Location&, Event*) override; - bool CancelEvent(Event*) override; + void CancelAllEvents() override; void Close() override; private:
diff --git a/third_party/blink/renderer/core/dom/events/media_element_event_queue.cc b/third_party/blink/renderer/core/dom/events/media_element_event_queue.cc index cd648b9..e4d0aee 100644 --- a/third_party/blink/renderer/core/dom/events/media_element_event_queue.cc +++ b/third_party/blink/renderer/core/dom/events/media_element_event_queue.cc
@@ -55,9 +55,6 @@ if (is_closed_) return false; - if (event->target() == owner_) - event->SetTarget(nullptr); - TRACE_EVENT_ASYNC_BEGIN1("event", "MediaElementEventQueue:enqueueEvent", event, "type", event->type().Ascii()); EventTarget* target = event->target() ? event->target() : owner_.Get();
diff --git a/third_party/blink/renderer/core/editing/inline_box_traversal.cc b/third_party/blink/renderer/core/editing/inline_box_traversal.cc index 626100a..9363783 100644 --- a/third_party/blink/renderer/core/editing/inline_box_traversal.cc +++ b/third_party/blink/renderer/core/editing/inline_box_traversal.cc
@@ -441,49 +441,6 @@ start, bidi_level, TraversalStrategy::ForwardIgnoringLineBreak); } -// Shorthands for InlineBoxTraversal - -template <typename TraversalStrategy> -const InlineBox* FindBidiRun(const InlineBox& start, unsigned bidi_level) { - const AbstractInlineBox& result = - FindBidiRun<TraversalStrategy>(AbstractInlineBox(start), bidi_level); - if (result.IsNull()) - return nullptr; - DCHECK(result.IsOldLayout()); - return &result.GetInlineBox(); -} - -template <typename TraversalStrategy> -const InlineBox& FindBoundaryOfBidiRunIgnoringLineBreak(const InlineBox& start, - unsigned bidi_level) { - const AbstractInlineBox& result = - FindBoundaryOfBidiRunIgnoringLineBreak<TraversalStrategy>( - AbstractInlineBox(start), bidi_level); - DCHECK(result.IsOldLayout()); - return result.GetInlineBox(); -} - -template <typename TraversalStrategy> -const InlineBox& FindBoundaryOfEntireBidiRun(const InlineBox& start, - unsigned bidi_level) { - const AbstractInlineBox& result = - FindBoundaryOfEntireBidiRun<TraversalStrategy>(AbstractInlineBox(start), - bidi_level); - DCHECK(result.IsOldLayout()); - return result.GetInlineBox(); -} - -template <typename TraversalStrategy> -const InlineBox& FindBoundaryOfEntireBidiRunIgnoringLineBreak( - const InlineBox& start, - unsigned bidi_level) { - const AbstractInlineBox& result = - FindBoundaryOfEntireBidiRunIgnoringLineBreak<TraversalStrategy>( - AbstractInlineBox(start), bidi_level); - DCHECK(result.IsOldLayout()); - return result.GetInlineBox(); -} - // Adjustment algorithm at the end of caret position resolution. template <typename TraversalStrategy> class CaretPositionResolutionAdjuster { @@ -845,55 +802,40 @@ const InlineBox* InlineBoxTraversal::FindLeftBidiRun(const InlineBox& box, unsigned bidi_level) { - return FindBidiRun<TraverseLeft>(box, bidi_level); + const AbstractInlineBox& result = + FindBidiRun<TraverseLeft>(AbstractInlineBox(box), bidi_level); + if (result.IsNull()) + return nullptr; + DCHECK(result.IsOldLayout()); + return &result.GetInlineBox(); } const InlineBox* InlineBoxTraversal::FindRightBidiRun(const InlineBox& box, unsigned bidi_level) { - return FindBidiRun<TraverseRight>(box, bidi_level); -} - -const InlineBox& InlineBoxTraversal::FindLeftBoundaryOfBidiRunIgnoringLineBreak( - const InlineBox& inline_box, - unsigned bidi_level) { - return FindBoundaryOfBidiRunIgnoringLineBreak<TraverseLeft>(inline_box, - bidi_level); + const AbstractInlineBox& result = + FindBidiRun<TraverseRight>(AbstractInlineBox(box), bidi_level); + if (result.IsNull()) + return nullptr; + DCHECK(result.IsOldLayout()); + return &result.GetInlineBox(); } const InlineBox& InlineBoxTraversal::FindLeftBoundaryOfEntireBidiRun( - const InlineBox& inline_box, + const InlineBox& box, unsigned bidi_level) { - return FindBoundaryOfEntireBidiRun<TraverseLeft>(inline_box, bidi_level); -} - -const InlineBox& -InlineBoxTraversal::FindLeftBoundaryOfEntireBidiRunIgnoringLineBreak( - const InlineBox& inline_box, - unsigned bidi_level) { - return FindBoundaryOfEntireBidiRunIgnoringLineBreak<TraverseLeft>(inline_box, - bidi_level); -} - -const InlineBox& -InlineBoxTraversal::FindRightBoundaryOfBidiRunIgnoringLineBreak( - const InlineBox& inline_box, - unsigned bidi_level) { - return FindBoundaryOfBidiRunIgnoringLineBreak<TraverseRight>(inline_box, - bidi_level); + const AbstractInlineBox& result = FindBoundaryOfEntireBidiRun<TraverseLeft>( + AbstractInlineBox(box), bidi_level); + DCHECK(result.IsOldLayout()); + return result.GetInlineBox(); } const InlineBox& InlineBoxTraversal::FindRightBoundaryOfEntireBidiRun( - const InlineBox& inline_box, + const InlineBox& box, unsigned bidi_level) { - return FindBoundaryOfEntireBidiRun<TraverseRight>(inline_box, bidi_level); -} - -const InlineBox& -InlineBoxTraversal::FindRightBoundaryOfEntireBidiRunIgnoringLineBreak( - const InlineBox& inline_box, - unsigned bidi_level) { - return FindBoundaryOfEntireBidiRunIgnoringLineBreak<TraverseRight>( - inline_box, bidi_level); + const AbstractInlineBox& result = FindBoundaryOfEntireBidiRun<TraverseRight>( + AbstractInlineBox(box), bidi_level); + DCHECK(result.IsOldLayout()); + return result.GetInlineBox(); } InlineBoxPosition BidiAdjustment::AdjustForCaretPositionResolution(
diff --git a/third_party/blink/renderer/core/editing/inline_box_traversal.h b/third_party/blink/renderer/core/editing/inline_box_traversal.h index ae22544..351d060 100644 --- a/third_party/blink/renderer/core/editing/inline_box_traversal.h +++ b/third_party/blink/renderer/core/editing/inline_box_traversal.h
@@ -62,29 +62,12 @@ static const InlineBox* FindRightBidiRun(const InlineBox& box, unsigned bidi_level); - // Traverses left/right from |box|, and returns the last non-linebreak box - // with bidi level greater than |bidi_level| (including |box| itself). - static const InlineBox& FindLeftBoundaryOfBidiRunIgnoringLineBreak( - const InlineBox& box, - unsigned bidi_level); - static const InlineBox& FindRightBoundaryOfBidiRunIgnoringLineBreak( - const InlineBox& box, - unsigned bidi_level); - // Traverses left/right from |box|, and returns the last box with bidi level // greater than or equal to |bidi_level| (including |box| itself). static const InlineBox& FindLeftBoundaryOfEntireBidiRun(const InlineBox& box, unsigned bidi_level); static const InlineBox& FindRightBoundaryOfEntireBidiRun(const InlineBox& box, unsigned bidi_level); - - // Variants of the above two where line break boxes are ignored. - static const InlineBox& FindLeftBoundaryOfEntireBidiRunIgnoringLineBreak( - const InlineBox&, - unsigned bidi_level); - static const InlineBox& FindRightBoundaryOfEntireBidiRunIgnoringLineBreak( - const InlineBox&, - unsigned bidi_level); }; } // namespace blink
diff --git a/third_party/blink/renderer/core/editing/visible_units_sentence.cc b/third_party/blink/renderer/core/editing/visible_units_sentence.cc index 7e38f34..870e8c0 100644 --- a/third_party/blink/renderer/core/editing/visible_units_sentence.cc +++ b/third_party/blink/renderer/core/editing/visible_units_sentence.cc
@@ -40,17 +40,6 @@ namespace { -unsigned NextSentencePositionBoundary(const UChar* characters, - unsigned length, - unsigned, - BoundarySearchContextAvailability, - bool&) { - // FIXME: This is identical to endSentenceBoundary. This isn't right, it needs - // to move to the equivlant position in the following sentence. - TextBreakIterator* iterator = SentenceBreakIterator(characters, length); - return iterator->following(0); -} - unsigned PreviousSentencePositionBoundary(const UChar* characters, unsigned length, unsigned, @@ -106,6 +95,52 @@ return TextSegments::FindBoundaryForward(position, &finder); } +PositionInFlatTree NextSentencePositionInternal( + const PositionInFlatTree& position) { + class Finder final : public TextSegments::Finder { + STACK_ALLOCATED(); + + private: + Position Find(const String text, unsigned offset) final { + DCHECK_LE(offset, text.length()); + if (should_stop_finding_) { + DCHECK_EQ(offset, 0u); + return Position::Before(0); + } + if (IsImplicitEndOfSentence(text, offset)) { + // Since each block is separated by newline == end of sentence code, + // |Find()| will stop at start of next block rater than between blocks. + should_stop_finding_ = true; + return Position(); + } + TextBreakIterator* it = + SentenceBreakIterator(text.Characters16(), text.length()); + const int result = it->following(offset); + if (result == kTextBreakDone) + return Position(); + return result == 0 ? Position::Before(0) : Position::After(result - 1); + } + + static bool IsImplicitEndOfSentence(const String text, unsigned offset) { + DCHECK_LE(offset, text.length()); + if (offset == text.length()) { + // "extend-by-sentence-002.html" reaches here. + // Example: <p>abc|</p><p>def</p> => <p>abc</p><p>|def</p> + return true; + } + if (offset + 1 == text.length() && text[offset] == '\n') { + // "move_forward_sentence_empty_line_break.html" reaches here. + // foo<div>|<br></div>bar -> foo<div><br></div>|bar + return true; + } + return false; + } + + bool should_stop_finding_ = false; + } finder; + return TextSegments::FindBoundaryForward(position, &finder); +} + template <typename Strategy> VisiblePositionTemplate<Strategy> StartOfSentenceAlgorithm( const VisiblePositionTemplate<Strategy>& c) { @@ -168,15 +203,36 @@ range.EndPosition())); } -VisiblePosition NextSentencePosition(const VisiblePosition& c) { - DCHECK(c.IsValid()) << c; - VisiblePosition next = - CreateVisiblePosition(NextBoundary(c, NextSentencePositionBoundary), - TextAffinity::kUpstreamIfPossible); +// ---- + +PositionInFlatTreeWithAffinity NextSentencePosition( + const PositionInFlatTree& start) { + const PositionInFlatTree result = NextSentencePositionInternal(start); return AdjustForwardPositionToAvoidCrossingEditingBoundaries( - next, c.DeepEquivalent()); + PositionInFlatTreeWithAffinity(result), start); } +PositionWithAffinity NextSentencePosition(const Position& start) { + const PositionInFlatTreeWithAffinity result = + NextSentencePosition(ToPositionInFlatTree(start)); + return ToPositionInDOMTreeWithAffinity(result); +} + +VisiblePosition NextSentencePosition(const VisiblePosition& c) { + return CreateVisiblePosition( + NextSentencePosition(c.DeepEquivalent()).GetPosition(), + TextAffinity::kUpstreamIfPossible); +} + +VisiblePositionInFlatTree NextSentencePosition( + const VisiblePositionInFlatTree& c) { + return CreateVisiblePosition( + NextSentencePosition(c.DeepEquivalent()).GetPosition(), + TextAffinity::kUpstreamIfPossible); +} + +// ---- + VisiblePosition PreviousSentencePosition(const VisiblePosition& c) { DCHECK(c.IsValid()) << c; VisiblePosition prev = CreateVisiblePosition(
diff --git a/third_party/blink/renderer/core/frame/frame.h b/third_party/blink/renderer/core/frame/frame.h index 9b83abe..3a30775d 100644 --- a/third_party/blink/renderer/core/frame/frame.h +++ b/third_party/blink/renderer/core/frame/frame.h
@@ -81,12 +81,23 @@ virtual bool IsLocalFrame() const = 0; virtual bool IsRemoteFrame() const = 0; - virtual void Navigate(Document& origin_document, - const KURL&, - bool replace_current_item, - UserGestureStatus) = 0; - // This version of Frame::navigate assumes the resulting navigation is not - // to be started on a timer. Use the method above in such cases. + // Asynchronously schedules a task to begin a navigation: this roughly + // corresponds to "queue a task to navigate the target browsing context to + // resource" in https://whatwg.org/C/links.html#following-hyperlinks. + // + // Note that there's currently an exception for same-origin same-document + // navigations: these are never scheduled and are always synchronously + // processed. + // + // TODO(dcheng): Note that despite the comment, most navigations in the spec + // are *not* currently queued. See https://github.com/whatwg/html/issues/3730. + // How this discussion is resolved will affect how https://crbug.com/848171 is + // eventually fixed. + virtual void ScheduleNavigation(Document& origin_document, + const KURL&, + bool replace_current_item, + UserGestureStatus) = 0; + // Synchronously begins a navigation. virtual void Navigate(const FrameLoadRequest&) = 0; virtual void Reload(FrameLoadType, ClientRedirectPolicy) = 0;
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc index 093f2cd3..ec60ffb 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
@@ -1614,8 +1614,8 @@ if (url_string.IsEmpty()) return target_frame->DomWindow(); - target_frame->Navigate(*active_document, completed_url, false, - UserGestureStatus::kNone); + target_frame->ScheduleNavigation(*active_document, completed_url, false, + UserGestureStatus::kNone); return target_frame->DomWindow(); }
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc index aa09a6b..8c1c20d 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -301,10 +301,10 @@ return Tree().Parent()->IsRemoteFrame(); } -void LocalFrame::Navigate(Document& origin_document, - const KURL& url, - bool replace_current_item, - UserGestureStatus user_gesture_status) { +void LocalFrame::ScheduleNavigation(Document& origin_document, + const KURL& url, + bool replace_current_item, + UserGestureStatus user_gesture_status) { navigation_scheduler_->ScheduleFrameNavigation(&origin_document, url, replace_current_item); }
diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h index 1820524..de03f96 100644 --- a/third_party/blink/renderer/core/frame/local_frame.h +++ b/third_party/blink/renderer/core/frame/local_frame.h
@@ -117,10 +117,10 @@ // Frame overrides: ~LocalFrame() override; void Trace(blink::Visitor*) override; - void Navigate(Document& origin_document, - const KURL&, - bool replace_current_item, - UserGestureStatus) override; + void ScheduleNavigation(Document& origin_document, + const KURL&, + bool replace_current_item, + UserGestureStatus) override; void Navigate(const FrameLoadRequest&) override; void Reload(FrameLoadType, ClientRedirectPolicy) override; void Detach(FrameDetachType) override;
diff --git a/third_party/blink/renderer/core/frame/location.cc b/third_party/blink/renderer/core/frame/location.cc index 4b4a006b..f4413b9 100644 --- a/third_party/blink/renderer/core/frame/location.cc +++ b/third_party/blink/renderer/core/frame/location.cc
@@ -301,7 +301,7 @@ argv.push_back(completed_url); activity_logger->LogEvent("blinkSetAttribute", argv.size(), argv.data()); } - dom_window_->GetFrame()->Navigate( + dom_window_->GetFrame()->ScheduleNavigation( *current_window->document(), completed_url, set_location_policy == SetLocationPolicy::kReplaceThisFrame, UserGestureStatus::kNone);
diff --git a/third_party/blink/renderer/core/frame/remote_frame.cc b/third_party/blink/renderer/core/frame/remote_frame.cc index 1e700939..cc2970e 100644 --- a/third_party/blink/renderer/core/frame/remote_frame.cc +++ b/third_party/blink/renderer/core/frame/remote_frame.cc
@@ -54,10 +54,10 @@ Frame::Trace(visitor); } -void RemoteFrame::Navigate(Document& origin_document, - const KURL& url, - bool replace_current_item, - UserGestureStatus user_gesture_status) { +void RemoteFrame::ScheduleNavigation(Document& origin_document, + const KURL& url, + bool replace_current_item, + UserGestureStatus user_gesture_status) { FrameLoadRequest frame_request(&origin_document, ResourceRequest(url)); frame_request.SetReplacesCurrentItem(replace_current_item); frame_request.GetResourceRequest().SetHasUserGesture(
diff --git a/third_party/blink/renderer/core/frame/remote_frame.h b/third_party/blink/renderer/core/frame/remote_frame.h index a04b4332..ba56c6b 100644 --- a/third_party/blink/renderer/core/frame/remote_frame.h +++ b/third_party/blink/renderer/core/frame/remote_frame.h
@@ -29,10 +29,10 @@ // Frame overrides: void Trace(blink::Visitor*) override; - void Navigate(Document& origin_document, - const KURL&, - bool replace_current_item, - UserGestureStatus) override; + void ScheduleNavigation(Document& origin_document, + const KURL&, + bool replace_current_item, + UserGestureStatus) override; void Navigate(const FrameLoadRequest& passed_request) override; void Reload(FrameLoadType, ClientRedirectPolicy) override; void Detach(FrameDetachType) override;
diff --git a/third_party/blink/renderer/core/html/forms/color_chooser_popup_ui_controller.cc b/third_party/blink/renderer/core/html/forms/color_chooser_popup_ui_controller.cc index 129853b..3ea98fad9 100644 --- a/third_party/blink/renderer/core/html/forms/color_chooser_popup_ui_controller.cc +++ b/third_party/blink/renderer/core/html/forms/color_chooser_popup_ui_controller.cc
@@ -83,7 +83,7 @@ void ColorChooserPopupUIController::WriteDocument(SharedBuffer* data) { Vector<String> suggestion_values; for (auto& suggestion : client_->Suggestions()) - suggestion_values.push_back(suggestion->label); + suggestion_values.push_back(Color(suggestion->color).Serialized()); IntRect anchor_rect_in_screen = chrome_client_->ViewportToScreen( client_->ElementRectRelativeToViewport(), frame_->View());
diff --git a/third_party/blink/renderer/core/html/html_frame_owner_element.cc b/third_party/blink/renderer/core/html/html_frame_owner_element.cc index b02a5df..e3def7d 100644 --- a/third_party/blink/renderer/core/html/html_frame_owner_element.cc +++ b/third_party/blink/renderer/core/html/html_frame_owner_element.cc
@@ -391,8 +391,8 @@ if (ContentFrame()) { // TODO(sclittle): Support lazily loading frame navigations. - ContentFrame()->Navigate(GetDocument(), url, replace_current_item, - UserGestureStatus::kNone); + ContentFrame()->ScheduleNavigation(GetDocument(), url, replace_current_item, + UserGestureStatus::kNone); return true; }
diff --git a/third_party/blink/renderer/core/html/list_item_ordinal.cc b/third_party/blink/renderer/core/html/list_item_ordinal.cc index 0bfadeac..4b051a6a 100644 --- a/third_party/blink/renderer/core/html/list_item_ordinal.cc +++ b/third_party/blink/renderer/core/html/list_item_ordinal.cc
@@ -278,10 +278,7 @@ return; Node* list_node = EnclosingList(item_node); - // TODO(kochi): Change this to CHECK(list_node) once crbug.com/734908 - // is resolved. - if (!list_node) - return; + CHECK(list_node); bool is_list_reversed = false; if (auto* o_list_element = ToHTMLOListElementOrNull(list_node)) {
diff --git a/third_party/blink/renderer/core/layout/layout_list_item.cc b/third_party/blink/renderer/core/layout/layout_list_item.cc index 9be563b..741e6dd 100644 --- a/third_party/blink/renderer/core/layout/layout_list_item.cc +++ b/third_party/blink/renderer/core/layout/layout_list_item.cc
@@ -213,7 +213,7 @@ // Create marker_container, set its height to 0px, and add it to li. if (!marker_parent) { LayoutObject* before_child = FirstNonMarkerChild(this); - if (!marker_->IsInside() && before_child && before_child->IsLayoutBlock()) { + if (!marker_->IsInside() && before_child && !before_child->IsInline()) { // Create marker_container and set its LogicalHeight to 0px. LayoutBlock* marker_container = CreateAnonymousBlock(); if (line_box_parent) @@ -297,19 +297,26 @@ // Align marker_inline_box in block direction according to line_box_root's // baseline. void LayoutListItem::AlignMarkerInBlockDirection() { + // Specify wether need to restore to the original baseline which is the + // baseline of marker parent. Because we might adjust the position at the last + // layout pass. So if there's no line box in line_box_parent make sure it + // back to its original position. + bool back_to_original_baseline = false; LayoutObject* line_box_parent = GetParentOfFirstLineBox(this, marker_); - if (!line_box_parent || !line_box_parent->IsBox()) - return; - - LayoutBox* line_box_parent_block = ToLayoutBox(line_box_parent); - // Don't align marker if line_box_parent has a different writing-mode. - // Just let marker positioned at the left-top of line_box_parent. - if (line_box_parent_block->IsWritingModeRoot()) - return; + LayoutBox* line_box_parent_block = nullptr; + if (!line_box_parent || !line_box_parent->IsBox()) { + back_to_original_baseline = true; + } else { + line_box_parent_block = ToLayoutBox(line_box_parent); + // Don't align marker if line_box_parent has a different writing-mode. + // Just let marker positioned at the left-top of line_box_parent. + if (line_box_parent_block->IsWritingModeRoot()) + back_to_original_baseline = true; + } InlineBox* marker_inline_box = marker_->InlineBoxWrapper(); RootInlineBox& marker_root = marker_inline_box->Root(); - if (line_box_parent_block->IsLayoutBlockFlow()) { + if (line_box_parent_block && line_box_parent_block->IsLayoutBlockFlow()) { // If marker_ and line_box_parent_block share a same RootInlineBox, no need // to align marker. if (ToLayoutBlockFlow(line_box_parent_block)->FirstRootBox() == @@ -317,7 +324,15 @@ return; } - LayoutUnit offset = line_box_parent_block->FirstLineBoxBaseline(); + LayoutUnit offset; + if (!back_to_original_baseline) + offset = line_box_parent_block->FirstLineBoxBaseline(); + + if (back_to_original_baseline || offset == -1) { + line_box_parent_block = marker_->ContainingBlock(); + offset = line_box_parent_block->FirstLineBoxBaseline(); + } + if (offset != -1) { for (LayoutBox* o = line_box_parent_block; o != this; o = o->ParentBox()) offset += o->LogicalTop(); @@ -345,7 +360,8 @@ offset -= o->LogicalTop(); } - marker_inline_box->MoveInBlockDirection(offset); + if (offset) + marker_inline_box->MoveInBlockDirection(offset); } }
diff --git a/third_party/blink/renderer/core/layout/layout_object.cc b/third_party/blink/renderer/core/layout/layout_object.cc index d9f2396..e2535ea 100644 --- a/third_party/blink/renderer/core/layout/layout_object.cc +++ b/third_party/blink/renderer/core/layout/layout_object.cc
@@ -114,8 +114,6 @@ namespace { -static bool g_modify_layout_tree_structure_any_state = false; - inline bool ShouldUseNewLayout(const ComputedStyle& style) { return RuntimeEnabledFeatures::LayoutNGEnabled() && !style.ForceLegacyLayout(); @@ -3827,18 +3825,7 @@ } bool LayoutObject::IsAllowedToModifyLayoutTreeStructure(Document& document) { - return DeprecatedDisableModifyLayoutTreeStructureAsserts:: - CanModifyLayoutTreeStateInAnyState() || - document.Lifecycle().StateAllowsLayoutTreeMutations(); -} - -DeprecatedDisableModifyLayoutTreeStructureAsserts:: - DeprecatedDisableModifyLayoutTreeStructureAsserts() - : disabler_(&g_modify_layout_tree_structure_any_state, true) {} - -bool DeprecatedDisableModifyLayoutTreeStructureAsserts:: - CanModifyLayoutTreeStateInAnyState() { - return g_modify_layout_tree_structure_any_state; + return document.Lifecycle().StateAllowsLayoutTreeMutations(); } void LayoutObject::
diff --git a/third_party/blink/renderer/core/layout/layout_object.h b/third_party/blink/renderer/core/layout/layout_object.h index fc143fe..b4998f5 100644 --- a/third_party/blink/renderer/core/layout/layout_object.h +++ b/third_party/blink/renderer/core/layout/layout_object.h
@@ -2663,21 +2663,6 @@ DISALLOW_COPY_AND_ASSIGN(LayoutObject); }; -// FIXME: remove this once the layout object lifecycle ASSERTS are no longer -// hit. -class DeprecatedDisableModifyLayoutTreeStructureAsserts { - STACK_ALLOCATED(); - - public: - DeprecatedDisableModifyLayoutTreeStructureAsserts(); - - static bool CanModifyLayoutTreeStateInAnyState(); - - private: - base::AutoReset<bool> disabler_; - DISALLOW_COPY_AND_ASSIGN(DeprecatedDisableModifyLayoutTreeStructureAsserts); -}; - // Allow equality comparisons of LayoutObjects by reference or pointer, // interchangeably. DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(LayoutObject)
diff --git a/third_party/blink/renderer/core/layout/layout_text_test.cc b/third_party/blink/renderer/core/layout/layout_text_test.cc index a3cab38..090fa08a 100644 --- a/third_party/blink/renderer/core/layout/layout_text_test.cc +++ b/third_party/blink/renderer/core/layout/layout_text_test.cc
@@ -679,4 +679,39 @@ "f^oo ba|r baz</div>")); } +TEST_P(ParameterizedLayoutTextTest, LocalSelectionRectLineHeight) { + LoadAhem(); + EXPECT_EQ(LayoutNGEnabled() ? LayoutRect(10, 0, 10, 50) + : LayoutRect(10, 20, 10, 10), + GetSelectionRectFor("<div style='line-height: 50px; width:1em;'>" + "f^o|o bar baz</div>")); + EXPECT_EQ(LayoutNGEnabled() ? LayoutRect(10, 50, 10, 50) + : LayoutRect(10, 30, 10, 50), + GetSelectionRectFor("<div style='line-height: 50px; width:1em;'>" + "foo b^a|r baz</div>")); + EXPECT_EQ(LayoutNGEnabled() ? LayoutRect(10, 100, 10, 50) + : LayoutRect(10, 80, 10, 50), + GetSelectionRectFor("<div style='line-height: 50px; width:1em;'>" + "foo bar b^a|</div>")); +} + +TEST_P(ParameterizedLayoutTextTest, LocalSelectionRectLineHeightVertical) { + LoadAhem(); + EXPECT_EQ(LayoutNGEnabled() ? LayoutRect(0, 10, 50, 10) + : LayoutRect(20, 10, 50, 10), + GetSelectionRectFor("<div style='line-height: 50px; height:1em; " + "writing-mode:vertical-lr'>" + "f^o|o bar baz</div>")); + EXPECT_EQ(LayoutNGEnabled() ? LayoutRect(50, 10, 50, 10) + : LayoutRect(70, 10, 50, 10), + GetSelectionRectFor("<div style='line-height: 50px; height:1em; " + "writing-mode:vertical-lr'>" + "foo b^a|r baz</div>")); + EXPECT_EQ(LayoutNGEnabled() ? LayoutRect(100, 10, 50, 10) + : LayoutRect(120, 10, 10, 10), + GetSelectionRectFor("<div style='line-height: 50px; height:1em; " + "writing-mode:vertical-lr'>" + "foo bar b^a|z</div>")); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/loader/appcache/application_cache_host.cc b/third_party/blink/renderer/core/loader/appcache/application_cache_host.cc index 8410f306..51c3155 100644 --- a/third_party/blink/renderer/core/loader/appcache/application_cache_host.cc +++ b/third_party/blink/renderer/core/loader/appcache/application_cache_host.cc
@@ -165,7 +165,8 @@ // navigation algorithm. The navigation will not result in the same resource // being loaded, because "foreign" entries are never picked during // navigation. see ApplicationCacheGroup::selectCache() - frame->Navigate(*document, document->Url(), true, UserGestureStatus::kNone); + frame->ScheduleNavigation(*document, document->Url(), true, + UserGestureStatus::kNone); } }
diff --git a/third_party/blink/renderer/core/loader/empty_clients.cc b/third_party/blink/renderer/core/loader/empty_clients.cc index 838d797..1172702 100644 --- a/third_party/blink/renderer/core/loader/empty_clients.cc +++ b/third_party/blink/renderer/core/loader/empty_clients.cc
@@ -41,7 +41,6 @@ #include "third_party/blink/renderer/core/html/forms/file_chooser.h" #include "third_party/blink/renderer/core/html/forms/html_form_element.h" #include "third_party/blink/renderer/core/loader/document_loader.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy.h" namespace blink {
diff --git a/third_party/blink/renderer/core/loader/frame_loader.cc b/third_party/blink/renderer/core/loader/frame_loader.cc index f0ae35b..42b6eae 100644 --- a/third_party/blink/renderer/core/loader/frame_loader.cc +++ b/third_party/blink/renderer/core/loader/frame_loader.cc
@@ -51,6 +51,7 @@ #include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/dom/events/event.h" #include "third_party/blink/renderer/core/dom/viewport_description.h" +#include "third_party/blink/renderer/core/events/current_input_event.h" #include "third_party/blink/renderer/core/events/gesture_event.h" #include "third_party/blink/renderer/core/events/keyboard_event.h" #include "third_party/blink/renderer/core/events/mouse_event.h" @@ -805,16 +806,8 @@ return WebURLRequest::kRequestContextHyperlink; } -static NavigationPolicy NavigationPolicyForRequest( - const FrameLoadRequest& request) { +static NavigationPolicy NavigationPolicyForEvent(Event* event) { NavigationPolicy policy = kNavigationPolicyCurrentTab; - Event* event = request.TriggeringEvent(); - if (!event) - return policy; - - if (request.Form() && event->UnderlyingEvent()) - event = event->UnderlyingEvent(); - if (event->IsMouseEvent()) { MouseEvent* mouse_event = ToMouseEvent(event); NavigationPolicyFromMouseEvent( @@ -836,6 +829,27 @@ return policy; } +static NavigationPolicy NavigationPolicyForRequest( + const FrameLoadRequest& request) { + NavigationPolicy policy = kNavigationPolicyCurrentTab; + Event* event = request.TriggeringEvent(); + if (!event) + return policy; + + if (request.Form() && event->UnderlyingEvent()) + event = event->UnderlyingEvent(); + + policy = NavigationPolicyForEvent(event); + + if (policy == kNavigationPolicyDownload && + EffectiveNavigationPolicy(policy, CurrentInputEvent::Get(), + WebWindowFeatures()) != + kNavigationPolicyDownload) { + return kNavigationPolicyCurrentTab; + } + return policy; +} + void FrameLoader::StartNavigation(const FrameLoadRequest& passed_request, FrameLoadType frame_load_type, HistoryItem* history_item) {
diff --git a/third_party/blink/renderer/core/page/create_window.cc b/third_party/blink/renderer/core/page/create_window.cc index ffd35a27..db1d5b5 100644 --- a/third_party/blink/renderer/core/page/create_window.cc +++ b/third_party/blink/renderer/core/page/create_window.cc
@@ -98,12 +98,6 @@ NavigationPolicyFromMouseEvent(button_number, ctrl, shift, alt, meta, &user_policy); - // When the input event suggests a download, but the navigation was initiated - // by script, we should not override it. - if (user_policy == kNavigationPolicyDownload && - *policy != kNavigationPolicyIgnore) - return; - // User and app agree that we want a new window; let the app override the // decorations. if (user_policy == kNavigationPolicyNewWindow && @@ -112,33 +106,48 @@ *policy = user_policy; } -NavigationPolicy GetNavigationPolicy(const WebInputEvent* current_event, - const WebWindowFeatures& features) { +} // anonymous namespace + +// Check that the desired NavigationPolicy |policy| is compatible with the +// observed input event |current_event|. +NavigationPolicy EffectiveNavigationPolicy(NavigationPolicy policy, + const WebInputEvent* current_event, + const WebWindowFeatures& features) { // If our default configuration was modified by a script or wasn't // created by a user gesture, then show as a popup. Else, let this // new window be opened as a toplevel window. bool as_popup = !features.tool_bar_visible || !features.status_bar_visible || !features.scrollbars_visible || !features.menu_bar_visible || !features.resizable; - NavigationPolicy policy = + NavigationPolicy user_policy = as_popup ? kNavigationPolicyNewPopup : kNavigationPolicyNewForegroundTab; - UpdatePolicyForEvent(current_event, &policy); - return policy; -} + UpdatePolicyForEvent(current_event, &user_policy); -} // anonymous namespace + if (policy == kNavigationPolicyIgnore) { + // When the input event suggests a download, but the navigation was + // initiated by script, we should not override it. + if (user_policy == kNavigationPolicyDownload) { + return as_popup ? kNavigationPolicyNewPopup + : kNavigationPolicyNewForegroundTab; + } + return user_policy; + } -NavigationPolicy EffectiveNavigationPolicy(NavigationPolicy policy, - const WebInputEvent* current_event, - const WebWindowFeatures& features) { - if (policy == kNavigationPolicyIgnore) - return GetNavigationPolicy(current_event, features); if (policy == kNavigationPolicyNewBackgroundTab && - GetNavigationPolicy(current_event, features) != - kNavigationPolicyNewBackgroundTab && + user_policy != kNavigationPolicyNewBackgroundTab && !UIEventWithKeyState::NewTabModifierSetFromIsolatedWorld()) { + // Don't allow background tabs to be opened via script setting the + // event modifiers. return kNavigationPolicyNewForegroundTab; } + + if (policy == kNavigationPolicyDownload && + user_policy != kNavigationPolicyDownload) { + // Don't allow downloads to be triggered via script setting the event + // modifiers. + return kNavigationPolicyNewForegroundTab; + } + return policy; } @@ -494,9 +503,10 @@ request.GetResourceRequest().SetHasUserGesture(has_user_gesture); new_frame->Navigate(request); } else if (!url_string.IsEmpty()) { - new_frame->Navigate(*calling_window.document(), completed_url, false, - has_user_gesture ? UserGestureStatus::kActive - : UserGestureStatus::kNone); + new_frame->ScheduleNavigation(*calling_window.document(), completed_url, + false, + has_user_gesture ? UserGestureStatus::kActive + : UserGestureStatus::kNone); } return window_features.noopener ? nullptr : new_frame->DomWindow(); }
diff --git a/third_party/blink/renderer/core/paint/find_paint_offset_and_visual_rect_needing_update.h b/third_party/blink/renderer/core/paint/find_paint_offset_and_visual_rect_needing_update.h index b319147..60ad1d1 100644 --- a/third_party/blink/renderer/core/paint/find_paint_offset_and_visual_rect_needing_update.h +++ b/third_party/blink/renderer/core/paint/find_paint_offset_and_visual_rect_needing_update.h
@@ -56,7 +56,7 @@ const FragmentData& fragment_data_; const bool& is_actually_needed_; LayoutPoint old_paint_offset_; - std::unique_ptr<TransformPaintPropertyNode> old_paint_offset_translation_; + scoped_refptr<TransformPaintPropertyNode> old_paint_offset_translation_; }; class FindVisualRectNeedingUpdateScopeBase {
diff --git a/third_party/blink/renderer/core/paint/fragment_data.h b/third_party/blink/renderer/core/paint/fragment_data.h index ea2a2d7c..eca26cb 100644 --- a/third_party/blink/renderer/core/paint/fragment_data.h +++ b/third_party/blink/renderer/core/paint/fragment_data.h
@@ -7,7 +7,7 @@ #include "base/optional.h" #include "third_party/blink/renderer/core/paint/object_paint_properties.h" -#include "third_party/blink/renderer/platform/graphics/paint/property_tree_state.h" +#include "third_party/blink/renderer/platform/graphics/paint/ref_counted_property_tree_state.h" namespace blink { @@ -147,9 +147,9 @@ // node. Even though the div has no transform, its local border box // properties would have a transform node that points to the div's // ancestor transform space. - const PropertyTreeState& LocalBorderBoxProperties() const { + PropertyTreeState LocalBorderBoxProperties() const { DCHECK(HasLocalBorderBoxProperties()); - return *rare_data_->local_border_box_properties; + return rare_data_->local_border_box_properties->GetPropertyTreeState(); } bool HasLocalBorderBoxProperties() const { return rare_data_ && rare_data_->local_border_box_properties; @@ -162,7 +162,7 @@ EnsureRareData(); if (!rare_data_->local_border_box_properties) { rare_data_->local_border_box_properties = - std::make_unique<PropertyTreeState>(state); + std::make_unique<RefCountedPropertyTreeState>(state); } else { *rare_data_->local_border_box_properties = state; } @@ -226,7 +226,7 @@ LayoutPoint pagination_offset; LayoutUnit logical_top_in_flow_thread; std::unique_ptr<ObjectPaintProperties> paint_properties; - std::unique_ptr<PropertyTreeState> local_border_box_properties; + std::unique_ptr<RefCountedPropertyTreeState> local_border_box_properties; bool is_clip_path_cache_valid = false; base::Optional<IntRect> clip_path_bounding_box; scoped_refptr<const RefCountedPath> clip_path_path;
diff --git a/third_party/blink/renderer/core/paint/ng/ng_paint_fragment.cc b/third_party/blink/renderer/core/paint/ng/ng_paint_fragment.cc index ff7605d9..635d8da 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_paint_fragment.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_paint_fragment.cc
@@ -36,7 +36,7 @@ .ResolvedDirection(); const NGPhysicalSize outer_size = paint_fragment.Size(); const NGLogicalOffset logical_offset = physical_rect.offset.ConvertToLogical( - writing_mode, text_direction, outer_size, paint_fragment.Size()); + writing_mode, text_direction, outer_size, physical_rect.size); const NGLogicalSize logical_size = physical_rect.size.ConvertToLogical(writing_mode); return {logical_offset, logical_size}; @@ -59,8 +59,8 @@ return {physical_offset, physical_size}; } -NGPhysicalOffsetRect ExpandedSelectionRectForLineBreakIfNeeded( - const NGPhysicalOffsetRect& rect, +NGLogicalRect ExpandedSelectionRectForLineBreakIfNeeded( + const NGLogicalRect& rect, const NGPaintFragment& paint_fragment, const LayoutSelectionStatus& selection_status) { // Expand paint rect if selection covers multiple lines and @@ -71,16 +71,26 @@ ->EnclosingNGBlockFlow() ->ShouldTruncateOverflowingText()) return rect; - // Copy from InlineTextBoxPainter. - const NGLogicalRect logical_rect = - ComputeLogicalRectFor(rect, paint_fragment); + // Copy from InlineTextBoxPainter::PaintSelection. const LayoutUnit space_width(paint_fragment.Style().GetFont().SpaceWidth()); - const NGLogicalSize logical_expanded_size( - logical_rect.size.inline_size + space_width, - logical_rect.size.block_size); - const NGPhysicalOffsetRect physical_rect = ComputePhysicalRectFor( - {logical_rect.offset, logical_expanded_size}, paint_fragment); - return physical_rect; + return {rect.offset, + {rect.size.inline_size + space_width, rect.size.block_size}}; +} + +// Expands selection height so that the selection rect fills entire line. +NGLogicalRect ExpandSelectionRectToLineHeight( + const NGLogicalRect& rect, + const NGPaintFragment& paint_fragment) { + const NGPaintFragment* current_line = paint_fragment.ContainerLineBox(); + DCHECK(current_line); + const NGPhysicalOffsetRect line_physical_rect( + current_line->InlineOffsetToContainerBox() - + paint_fragment.InlineOffsetToContainerBox(), + current_line->Size()); + const NGLogicalRect line_logical_rect = + ComputeLogicalRectFor(line_physical_rect, paint_fragment); + return {{rect.offset.inline_offset, line_logical_rect.offset.block_offset}, + {rect.size.inline_size, line_logical_rect.size.block_size}}; } NGLogicalOffset ChildLogicalOffsetInParent(const NGPaintFragment& child) { @@ -376,10 +386,16 @@ const NGPhysicalOffsetRect& selection_rect = ToNGPhysicalTextFragmentOrDie(PhysicalFragment()) .LocalRect(selection_status.start, selection_status.end); - const NGPhysicalOffsetRect line_break_extended_rect = - ExpandedSelectionRectForLineBreakIfNeeded(selection_rect, *this, + const NGLogicalRect logical_rect = + ComputeLogicalRectFor(selection_rect, *this); + const NGLogicalRect line_break_extended_rect = + ExpandedSelectionRectForLineBreakIfNeeded(logical_rect, *this, selection_status); - return line_break_extended_rect; + const NGLogicalRect line_height_expanded_rect = + ExpandSelectionRectToLineHeight(line_break_extended_rect, *this); + const NGPhysicalOffsetRect physical_rect = + ComputePhysicalRectFor(line_height_expanded_rect, *this); + return physical_rect; } PositionWithAffinity NGPaintFragment::PositionForPointInText(
diff --git a/third_party/blink/renderer/core/paint/object_paint_properties.h b/third_party/blink/renderer/core/paint/object_paint_properties.h index c0bc162..bb5ef98 100644 --- a/third_party/blink/renderer/core/paint/object_paint_properties.h +++ b/third_party/blink/renderer/core/paint/object_paint_properties.h
@@ -325,7 +325,7 @@ // deleted), and false otherwise. See the class-level comment ("update & clear // implementation note") for details about why this is needed for efficiency. template <typename PaintPropertyNode> - bool Clear(std::unique_ptr<PaintPropertyNode>& field) { + bool Clear(scoped_refptr<PaintPropertyNode>& field) { if (field) { field = nullptr; return true; @@ -337,7 +337,7 @@ // created), and false otherwise. See the class-level comment ("update & clear // implementation note") for details about why this is needed for efficiency. template <typename PaintPropertyNode> - UpdateResult Update(std::unique_ptr<PaintPropertyNode>& field, + UpdateResult Update(scoped_refptr<PaintPropertyNode>& field, const PaintPropertyNode& parent, typename PaintPropertyNode::State&& state) { if (field) { @@ -351,26 +351,25 @@ // ATTENTION! Make sure to keep FindPropertiesNeedingUpdate.h in sync when // new properites are added! - std::unique_ptr<TransformPaintPropertyNode> paint_offset_translation_; - std::unique_ptr<TransformPaintPropertyNode> transform_; - std::unique_ptr<EffectPaintPropertyNode> effect_; - std::unique_ptr<EffectPaintPropertyNode> filter_; - std::unique_ptr<EffectPaintPropertyNode> mask_; - std::unique_ptr<EffectPaintPropertyNode> clip_path_; - std::unique_ptr<ClipPaintPropertyNode> fragment_clip_; - std::unique_ptr<ClipPaintPropertyNode> clip_path_clip_; - std::unique_ptr<ClipPaintPropertyNode> mask_clip_; - std::unique_ptr<ClipPaintPropertyNode> css_clip_; - std::unique_ptr<ClipPaintPropertyNode> css_clip_fixed_position_; - std::unique_ptr<ClipPaintPropertyNode> overflow_controls_clip_; - std::unique_ptr<ClipPaintPropertyNode> inner_border_radius_clip_; - std::unique_ptr<ClipPaintPropertyNode> overflow_clip_; - std::unique_ptr<TransformPaintPropertyNode> perspective_; + scoped_refptr<TransformPaintPropertyNode> paint_offset_translation_; + scoped_refptr<TransformPaintPropertyNode> transform_; + scoped_refptr<EffectPaintPropertyNode> effect_; + scoped_refptr<EffectPaintPropertyNode> filter_; + scoped_refptr<EffectPaintPropertyNode> mask_; + scoped_refptr<EffectPaintPropertyNode> clip_path_; + scoped_refptr<ClipPaintPropertyNode> fragment_clip_; + scoped_refptr<ClipPaintPropertyNode> clip_path_clip_; + scoped_refptr<ClipPaintPropertyNode> mask_clip_; + scoped_refptr<ClipPaintPropertyNode> css_clip_; + scoped_refptr<ClipPaintPropertyNode> css_clip_fixed_position_; + scoped_refptr<ClipPaintPropertyNode> overflow_controls_clip_; + scoped_refptr<ClipPaintPropertyNode> inner_border_radius_clip_; + scoped_refptr<ClipPaintPropertyNode> overflow_clip_; + scoped_refptr<TransformPaintPropertyNode> perspective_; // TODO(pdr): Only LayoutSVGRoot needs this and it should be moved there. - std::unique_ptr<TransformPaintPropertyNode> - svg_local_to_border_box_transform_; - std::unique_ptr<ScrollPaintPropertyNode> scroll_; - std::unique_ptr<TransformPaintPropertyNode> scroll_translation_; + scoped_refptr<TransformPaintPropertyNode> svg_local_to_border_box_transform_; + scoped_refptr<ScrollPaintPropertyNode> scroll_; + scoped_refptr<TransformPaintPropertyNode> scroll_translation_; DISALLOW_COPY_AND_ASSIGN(ObjectPaintProperties); };
diff --git a/third_party/blink/renderer/core/testing/null_execution_context.cc b/third_party/blink/renderer/core/testing/null_execution_context.cc index 2a61cc4..709642b 100644 --- a/third_party/blink/renderer/core/testing/null_execution_context.cc +++ b/third_party/blink/renderer/core/testing/null_execution_context.cc
@@ -18,7 +18,7 @@ NullEventQueue() = default; ~NullEventQueue() override = default; bool EnqueueEvent(const base::Location&, Event*) override { return true; } - bool CancelEvent(Event*) override { return true; } + void CancelAllEvents() override {} void Close() override {} };
diff --git a/third_party/blink/renderer/core/workers/main_thread_worklet_global_scope.cc b/third_party/blink/renderer/core/workers/main_thread_worklet_global_scope.cc index 6d4c202..9ba18f0d 100644 --- a/third_party/blink/renderer/core/workers/main_thread_worklet_global_scope.cc +++ b/third_party/blink/renderer/core/workers/main_thread_worklet_global_scope.cc
@@ -29,7 +29,9 @@ frame->GetFrameScheduler()->GetTaskRunner(TaskType::kInternalLoading), frame->GetFrameScheduler()->GetTaskRunner( TaskType::kInternalLoading)), - ContextClient(frame) {} + ContextClient(frame) { + BindContentSecurityPolicyToExecutionContext(); +} MainThreadWorkletGlobalScope::~MainThreadWorkletGlobalScope() = default;
diff --git a/third_party/blink/renderer/core/workers/main_thread_worklet_test.cc b/third_party/blink/renderer/core/workers/main_thread_worklet_test.cc index c17755b..12ede97 100644 --- a/third_party/blink/renderer/core/workers/main_thread_worklet_test.cc +++ b/third_party/blink/renderer/core/workers/main_thread_worklet_test.cc
@@ -46,6 +46,9 @@ class MainThreadWorkletTest : public PageTestBase { public: void SetUp() override { + SetUpScope("script-src 'self' https://allowed.example.com"); + } + void SetUpScope(const String& csp_header) { PageTestBase::SetUp(IntSize()); Document* document = &GetDocument(); document->SetURL(KURL("https://example.com/")); @@ -54,8 +57,7 @@ // Set up the CSP for Document before starting MainThreadWorklet because // MainThreadWorklet inherits the owner Document's CSP. ContentSecurityPolicy* csp = ContentSecurityPolicy::Create(); - csp->DidReceiveHeader("script-src 'self' https://allowed.example.com", - kContentSecurityPolicyHeaderTypeEnforce, + csp->DidReceiveHeader(csp_header, kContentSecurityPolicyHeaderTypeEnforce, kContentSecurityPolicyHeaderSourceHTTP); document->InitContentSecurityPolicy(csp); @@ -80,6 +82,11 @@ Persistent<MainThreadWorkletGlobalScope> global_scope_; }; +class MainThreadWorkletInvalidCSPTest : public MainThreadWorkletTest { + public: + void SetUp() override { SetUpScope("invalid-csp"); } +}; + TEST_F(MainThreadWorkletTest, SecurityOrigin) { // The SecurityOrigin for a worklet should be a unique opaque origin, while // the owner Document's SecurityOrigin shouldn't. @@ -139,4 +146,16 @@ EXPECT_TRUE(task_runner->RunsTasksInCurrentSequence()); } +// Test that having an invalid CSP does not result in an exception. +// See bugs: 844383,844317 +TEST_F(MainThreadWorkletInvalidCSPTest, InvalidContentSecurityPolicy) { + ContentSecurityPolicy* csp = global_scope_->GetContentSecurityPolicy(); + + // At this point check that the CSP that was set is indeed invalid. + EXPECT_EQ(1ul, csp->Headers().size()); + EXPECT_EQ("invalid-csp", csp->Headers().at(0).first); + EXPECT_EQ(kContentSecurityPolicyHeaderTypeEnforce, + csp->Headers().at(0).second); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/workers/threaded_worklet_global_scope.cc b/third_party/blink/renderer/core/workers/threaded_worklet_global_scope.cc index edec77d..f00aca81 100644 --- a/third_party/blink/renderer/core/workers/threaded_worklet_global_scope.cc +++ b/third_party/blink/renderer/core/workers/threaded_worklet_global_scope.cc
@@ -31,7 +31,9 @@ thread->GetParentExecutionContextTaskRunners()->Get( TaskType::kInternalLoading), thread->GetTaskRunner(TaskType::kInternalLoading)), - thread_(thread) {} + thread_(thread) { + BindContentSecurityPolicyToExecutionContext(); +} ThreadedWorkletGlobalScope::~ThreadedWorkletGlobalScope() { DCHECK(!thread_);
diff --git a/third_party/blink/renderer/core/workers/threaded_worklet_test.cc b/third_party/blink/renderer/core/workers/threaded_worklet_test.cc index 1fa8cde..28a13f0 100644 --- a/third_party/blink/renderer/core/workers/threaded_worklet_test.cc +++ b/third_party/blink/renderer/core/workers/threaded_worklet_test.cc
@@ -116,6 +116,23 @@ FROM_HERE, CrossThreadBind(&test::ExitRunLoop)); } + // Test that having an invalid CSP does not result in an exception. + // See bugs: 844383,844317 + void TestInvalidContentSecurityPolicy() { + EXPECT_TRUE(IsCurrentThread()); + + // At this point check that the CSP that was set is indeed invalid. + ContentSecurityPolicy* csp = GlobalScope()->GetContentSecurityPolicy(); + EXPECT_EQ(1ul, csp->Headers().size()); + EXPECT_EQ("invalid-csp", csp->Headers().at(0).first); + EXPECT_EQ(kContentSecurityPolicyHeaderTypeEnforce, + csp->Headers().at(0).second); + + PostCrossThreadTask( + *GetParentExecutionContextTaskRunners()->Get(TaskType::kInternalTest), + FROM_HERE, CrossThreadBind(&test::ExitRunLoop)); + } + // Emulates API use on ThreadedWorkletGlobalScope. void CountFeature(WebFeature feature) { EXPECT_TRUE(IsCurrentThread()); @@ -266,6 +283,22 @@ test::EnterRunLoop(); } +TEST_F(ThreadedWorkletTest, InvalidContentSecurityPolicy) { + ContentSecurityPolicy* csp = ContentSecurityPolicy::Create(); + csp->DidReceiveHeader("invalid-csp", kContentSecurityPolicyHeaderTypeEnforce, + kContentSecurityPolicyHeaderSourceHTTP); + GetDocument().InitContentSecurityPolicy(csp); + + MessagingProxy()->Start(); + + PostCrossThreadTask( + *GetWorkerThread()->GetTaskRunner(TaskType::kInternalTest), FROM_HERE, + CrossThreadBind( + &ThreadedWorkletThreadForTest::TestInvalidContentSecurityPolicy, + CrossThreadUnretained(GetWorkerThread()))); + test::EnterRunLoop(); +} + TEST_F(ThreadedWorkletTest, UseCounter) { Page::InsertOrdinaryPageForTesting(GetDocument().GetPage()); MessagingProxy()->Start();
diff --git a/third_party/blink/renderer/core/workers/worker_global_scope.cc b/third_party/blink/renderer/core/workers/worker_global_scope.cc index adcc8d1..04ce8fd 100644 --- a/third_party/blink/renderer/core/workers/worker_global_scope.cc +++ b/third_party/blink/renderer/core/workers/worker_global_scope.cc
@@ -352,8 +352,9 @@ creation_params->starter_origin->CreatePrivilegeData()); } SetSecurityOrigin(std::move(security_origin)); - ApplyContentSecurityPolicyFromVector( + InitContentSecurityPolicyFromVector( creation_params->content_security_policy_parsed_headers); + BindContentSecurityPolicyToExecutionContext(); SetWorkerSettings(std::move(creation_params->worker_settings)); SetReferrerPolicy(creation_params->referrer_policy); SetAddressSpace(creation_params->address_space);
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 bed279d..4cbe2e14 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
@@ -188,7 +188,7 @@ return GetThread()->GetTaskRunner(type); } -void WorkerOrWorkletGlobalScope::ApplyContentSecurityPolicyFromVector( +void WorkerOrWorkletGlobalScope::InitContentSecurityPolicyFromVector( const Vector<CSPHeaderAndType>& headers) { if (!GetContentSecurityPolicy()) { ContentSecurityPolicy* csp = ContentSecurityPolicy::Create(); @@ -199,6 +199,10 @@ policy_and_type.first, policy_and_type.second, kContentSecurityPolicyHeaderSourceHTTP); } +} + +void WorkerOrWorkletGlobalScope::BindContentSecurityPolicyToExecutionContext() { + DCHECK(IsContextThread()); GetContentSecurityPolicy()->BindToExecutionContext(GetExecutionContext()); }
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 3438baee..2aa43f9 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
@@ -15,7 +15,7 @@ #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" #include "third_party/blink/renderer/core/frame/web_feature_forward.h" #include "third_party/blink/renderer/core/workers/worker_clients.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_scheduler.h" +#include "third_party/blink/renderer/platform/scheduler/public/worker_scheduler.h" #include "third_party/blink/renderer/platform/wtf/bit_vector.h" namespace blink { @@ -108,8 +108,9 @@ scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner(TaskType) override; protected: - void ApplyContentSecurityPolicyFromVector( + void InitContentSecurityPolicyFromVector( const Vector<CSPHeaderAndType>& headers); + virtual void BindContentSecurityPolicyToExecutionContext(); // Implementation of the "fetch a module worker script graph" algorithm in the // HTML spec:
diff --git a/third_party/blink/renderer/core/workers/worker_thread.cc b/third_party/blink/renderer/core/workers/worker_thread.cc index 307c33bf..f590141e 100644 --- a/third_party/blink/renderer/core/workers/worker_thread.cc +++ b/third_party/blink/renderer/core/workers/worker_thread.cc
@@ -52,7 +52,7 @@ #include "third_party/blink/renderer/platform/histogram.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/scheduler/child/webthread_impl_for_worker_scheduler.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_scheduler.h" +#include "third_party/blink/renderer/platform/scheduler/public/worker_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler.h" #include "third_party/blink/renderer/platform/waitable_event.h" #include "third_party/blink/renderer/platform/web_thread_supporting_gc.h"
diff --git a/third_party/blink/renderer/core/workers/worker_thread.h b/third_party/blink/renderer/core/workers/worker_thread.h index 96c465c..2984875 100644 --- a/third_party/blink/renderer/core/workers/worker_thread.h +++ b/third_party/blink/renderer/core/workers/worker_thread.h
@@ -45,7 +45,7 @@ #include "third_party/blink/renderer/core/workers/worker_inspector_proxy.h" #include "third_party/blink/renderer/core/workers/worker_thread_lifecycle_context.h" #include "third_party/blink/renderer/core/workers/worker_thread_lifecycle_observer.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_scheduler.h" +#include "third_party/blink/renderer/platform/scheduler/public/worker_scheduler.h" #include "third_party/blink/renderer/platform/waitable_event.h" #include "third_party/blink/renderer/platform/web_task_runner.h" #include "third_party/blink/renderer/platform/wtf/forward.h"
diff --git a/third_party/blink/renderer/core/workers/worklet_global_scope.cc b/third_party/blink/renderer/core/workers/worklet_global_scope.cc index f93dd49..4eb774aa 100644 --- a/third_party/blink/renderer/core/workers/worklet_global_scope.cc +++ b/third_party/blink/renderer/core/workers/worklet_global_scope.cc
@@ -52,17 +52,8 @@ // https://drafts.css-houdini.org/worklets/#creating-a-workletglobalscope // Step 6: "Invoke the initialize a global object's CSP list algorithm given // workletGlobalScope." - ApplyContentSecurityPolicyFromVector( + InitContentSecurityPolicyFromVector( creation_params->content_security_policy_parsed_headers); - // CSP checks should resolve self based on the 'fetch client settings object' - // (i.e., the document's origin), not the 'module map settings object' (i.e., - // the opaque origin of this worklet global scope). The current implementation - // doesn't have separate CSP objects for these two contexts. Therefore, - // we initialize the worklet global scope's CSP object (which would naively - // appear to be a CSP object for the 'module map settings object') entirely - // based on state from the document (the origin and CSP headers it passed - // here), and use the document's origin for 'self' CSP checks. - GetContentSecurityPolicy()->SetupSelf(*document_security_origin_); OriginTrialContext::AddTokens(this, creation_params->origin_trial_tokens.get()); @@ -128,6 +119,20 @@ return KURL(BaseURL(), url); } +void WorkletGlobalScope::BindContentSecurityPolicyToExecutionContext() { + WorkerOrWorkletGlobalScope::BindContentSecurityPolicyToExecutionContext(); + + // CSP checks should resolve self based on the 'fetch client settings object' + // (i.e., the document's origin), not the 'module map settings object' (i.e., + // the opaque origin of this worklet global scope). The current implementation + // doesn't have separate CSP objects for these two contexts. Therefore, + // we initialize the worklet global scope's CSP object (which would naively + // appear to be a CSP object for the 'module map settings object') entirely + // based on state from the document (the origin and CSP headers it passed + // here), and use the document's origin for 'self' CSP checks. + GetContentSecurityPolicy()->SetupSelf(*document_security_origin_); +} + void WorkletGlobalScope::Trace(blink::Visitor* visitor) { WorkerOrWorkletGlobalScope::Trace(visitor); }
diff --git a/third_party/blink/renderer/core/workers/worklet_global_scope.h b/third_party/blink/renderer/core/workers/worklet_global_scope.h index 37fce2bb..ee05f1dc 100644 --- a/third_party/blink/renderer/core/workers/worklet_global_scope.h +++ b/third_party/blink/renderer/core/workers/worklet_global_scope.h
@@ -97,6 +97,8 @@ scoped_refptr<base::SingleThreadTaskRunner> document_loading_task_runner, scoped_refptr<base::SingleThreadTaskRunner> worklet_loading_task_runner); + void BindContentSecurityPolicyToExecutionContext() override; + private: EventTarget* ErrorEventTarget() final { return nullptr; }
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_database.cc b/third_party/blink/renderer/modules/indexeddb/idb_database.cc index 003a6a0d..e74e9b3a 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_database.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_database.cc
@@ -35,7 +35,7 @@ #include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_idb_observer_callback.h" -#include "third_party/blink/renderer/core/dom/events/event_queue.h" +#include "third_party/blink/renderer/core/dom/events/event_queue_impl.h" #include "third_party/blink/renderer/core/dom/exception_code.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/modules/indexeddb/idb_any.h" @@ -108,6 +108,8 @@ v8::Isolate* isolate) : ContextLifecycleObserver(context), backend_(std::move(backend)), + event_queue_( + EventQueueImpl::Create(context, TaskType::kInternalIndexedDB)), database_callbacks_(callbacks), isolate_(isolate) { database_callbacks_->Connect(this); @@ -122,7 +124,7 @@ visitor->Trace(version_change_transaction_); visitor->Trace(transactions_); visitor->Trace(observers_); - visitor->Trace(enqueued_events_); + visitor->Trace(event_queue_); visitor->Trace(database_callbacks_); EventTargetWithInlineData::Trace(visitor); ContextLifecycleObserver::Trace(visitor); @@ -461,15 +463,11 @@ if (!GetExecutionContext()) return; - EventQueue* event_queue = GetExecutionContext()->GetEventQueue(); // Remove any pending versionchange events scheduled to fire on this // connection. They would have been scheduled by the backend when another // connection attempted an upgrade, but the frontend connection is being // closed before they could fire. - for (size_t i = 0; i < enqueued_events_.size(); ++i) { - bool removed = event_queue->CancelEvent(enqueued_events_[i].Get()); - DCHECK(removed); - } + event_queue_->CancelAllEvents(); } void IDBDatabase::OnVersionChange(int64_t old_version, int64_t new_version) { @@ -495,10 +493,8 @@ void IDBDatabase::EnqueueEvent(Event* event) { DCHECK(GetExecutionContext()); - EventQueue* event_queue = GetExecutionContext()->GetEventQueue(); event->SetTarget(this); - event_queue->EnqueueEvent(FROM_HERE, event); - enqueued_events_.push_back(event); + event_queue_->EnqueueEvent(FROM_HERE, event); } DispatchEventResult IDBDatabase::DispatchEventInternal(Event* event) { @@ -507,10 +503,6 @@ return DispatchEventResult::kCanceledBeforeDispatch; DCHECK(event->type() == EventTypeNames::versionchange || event->type() == EventTypeNames::close); - for (size_t i = 0; i < enqueued_events_.size(); ++i) { - if (enqueued_events_[i].Get() == event) - enqueued_events_.EraseAt(i); - } DispatchEventResult dispatch_result = EventTarget::DispatchEventInternal(event);
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_database.h b/third_party/blink/renderer/modules/indexeddb/idb_database.h index 82eb428..183bfbd 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_database.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_database.h
@@ -197,9 +197,7 @@ bool close_pending_ = false; - // Keep track of the versionchange events waiting to be fired on this - // database so that we can cancel them if the database closes. - HeapVector<Member<Event>> enqueued_events_; + Member<EventQueue> event_queue_; Member<IDBDatabaseCallbacks> database_callbacks_; // Maintain the isolate so that all externally allocated memory can be
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_open_db_request.cc b/third_party/blink/renderer/modules/indexeddb/idb_open_db_request.cc index d8806e7..cc4e5fb 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_open_db_request.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_open_db_request.cc
@@ -193,7 +193,6 @@ if (event->type() == EventTypeNames::success && ResultAsAny()->GetType() == IDBAny::kIDBDatabaseType && ResultAsAny()->IdbDatabase()->IsClosePending()) { - DequeueEvent(event); SetResult(nullptr); HandleResponse( DOMException::Create(kAbortError, "The connection was closed."));
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_request.cc b/third_party/blink/renderer/modules/indexeddb/idb_request.cc index bda14b6..e8be3545 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_request.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_request.cc
@@ -39,7 +39,7 @@ #include "third_party/blink/renderer/bindings/modules/v8/to_v8_for_modules.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.h" #include "third_party/blink/renderer/core/dom/dom_exception.h" -#include "third_party/blink/renderer/core/dom/events/event_queue.h" +#include "third_party/blink/renderer/core/dom/events/event_queue_impl.h" #include "third_party/blink/renderer/core/dom/exception_code.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/modules/indexed_db_names.h" @@ -138,7 +138,9 @@ transaction_(transaction), isolate_(script_state->GetIsolate()), metrics_(std::move(metrics)), - source_(source) {} + source_(source), + event_queue_(EventQueueImpl::Create(ExecutionContext::From(script_state), + TaskType::kInternalIndexedDB)) {} IDBRequest::~IDBRequest() { DCHECK((ready_state_ == DONE && metrics_.IsEmpty()) || @@ -150,7 +152,7 @@ visitor->Trace(source_); visitor->Trace(result_); visitor->Trace(error_); - visitor->Trace(enqueued_events_); + visitor->Trace(event_queue_); visitor->Trace(pending_cursor_); EventTargetWithInlineData::Trace(visitor); PausableObject::Trace(visitor); @@ -225,12 +227,7 @@ if (ready_state_ == DONE) return; - EventQueue* event_queue = GetExecutionContext()->GetEventQueue(); - for (size_t i = 0; i < enqueued_events_.size(); ++i) { - bool removed = event_queue->CancelEvent(enqueued_events_[i].Get()); - DCHECK(removed); - } - enqueued_events_.clear(); + event_queue_->CancelAllEvents(); error_.Clear(); result_.Clear(); @@ -613,7 +610,7 @@ transaction_->UnregisterRequest(this); } - enqueued_events_.clear(); + event_queue_->CancelAllEvents(); if (source_.IsIDBCursor()) source_.GetAsIDBCursor()->ContextWillBeDestroyed(); if (result_) @@ -640,12 +637,10 @@ return DispatchEventResult::kCanceledBeforeDispatch; DCHECK_EQ(ready_state_, PENDING); DCHECK(has_pending_activity_); - DCHECK(enqueued_events_.size()); DCHECK_EQ(event->target(), this); if (event->type() != EventTypeNames::blocked) ready_state_ = DONE; - DequeueEvent(event); HeapVector<Member<EventTarget>> targets; targets.push_back(this); @@ -763,21 +758,9 @@ << "When queueing event " << event->type() << ", ready_state_ was " << ready_state_; - EventQueue* event_queue = GetExecutionContext()->GetEventQueue(); event->SetTarget(this); - // Keep track of enqueued events in case we need to abort prior to dispatch, - // in which case these must be cancelled. If the events not dispatched for - // other reasons they must be removed from this list via DequeueEvent(). - if (event_queue->EnqueueEvent(FROM_HERE, event)) - enqueued_events_.push_back(event); -} - -void IDBRequest::DequeueEvent(Event* event) { - for (size_t i = 0; i < enqueued_events_.size(); ++i) { - if (enqueued_events_[i].Get() == event) - enqueued_events_.EraseAt(i); - } + event_queue_->EnqueueEvent(FROM_HERE, event); } } // namespace blink
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_request.h b/third_party/blink/renderer/modules/indexeddb/idb_request.h index 8ce4b0d8..51017b0 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_request.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_request.h
@@ -42,6 +42,7 @@ #include "third_party/blink/renderer/bindings/modules/v8/idb_object_store_or_idb_index_or_idb_cursor.h" #include "third_party/blink/renderer/core/dom/dom_string_list.h" #include "third_party/blink/renderer/core/dom/events/event_listener.h" +#include "third_party/blink/renderer/core/dom/events/event_queue.h" #include "third_party/blink/renderer/core/dom/events/event_target.h" #include "third_party/blink/renderer/core/dom/pausable_object.h" #include "third_party/blink/renderer/modules/event_modules.h" @@ -335,7 +336,6 @@ protected: IDBRequest(ScriptState*, const Source&, IDBTransaction*, AsyncTraceState); void EnqueueEvent(Event*); - void DequeueEvent(Event*); virtual bool ShouldEnqueueEvent() const; void EnqueueResultInternal(IDBAny*); void SetResult(IDBAny*); @@ -388,7 +388,7 @@ Member<DOMException> error_; bool has_pending_activity_ = true; - HeapVector<Member<Event>> enqueued_events_; + Member<EventQueue> event_queue_; // Only used if the result type will be a cursor. IndexedDB::CursorType cursor_type_ = IndexedDB::kCursorKeyAndValue;
diff --git a/third_party/blink/renderer/modules/nfc/nfc.cc b/third_party/blink/renderer/modules/nfc/nfc.cc index 45ab9e4..3c66418 100644 --- a/third_party/blink/renderer/modules/nfc/nfc.cc +++ b/third_party/blink/renderer/modules/nfc/nfc.cc
@@ -205,8 +205,8 @@ return base::nullopt; } - String string = blink::V8StringToWebCoreString<String>( - jsonString, blink::kDoNotExternalize); + String string = + blink::ToBlinkString<String>(jsonString, blink::kDoNotExternalize); return mojo::ConvertTo<Vector<uint8_t>>(string); }
diff --git a/third_party/blink/renderer/modules/payments/payment_event_data_conversion_test.cc b/third_party/blink/renderer/modules/payments/payment_event_data_conversion_test.cc index a01e3ec..c541cc8 100644 --- a/third_party/blink/renderer/modules/payments/payment_event_data_conversion_test.cc +++ b/third_party/blink/renderer/modules/payments/payment_event_data_conversion_test.cc
@@ -82,7 +82,7 @@ .front()); ASSERT_TRUE(data.methodData().front().hasData()); ASSERT_TRUE(data.methodData().front().data().IsObject()); - String stringified_data = V8StringToWebCoreString<String>( + String stringified_data = ToBlinkString<String>( v8::JSON::Stringify( scope.GetContext(), data.methodData().front().data().V8Value().As<v8::Object>()) @@ -123,7 +123,7 @@ .front()); ASSERT_TRUE(data.methodData().front().hasData()); ASSERT_TRUE(data.methodData().front().data().IsObject()); - String stringified_data = V8StringToWebCoreString<String>( + String stringified_data = ToBlinkString<String>( v8::JSON::Stringify( scope.GetContext(), data.methodData().front().data().V8Value().As<v8::Object>())
diff --git a/third_party/blink/renderer/modules/payments/payment_request.cc b/third_party/blink/renderer/modules/payments/payment_request.cc index 58900ce..0b5c8563 100644 --- a/third_party/blink/renderer/modules/payments/payment_request.cc +++ b/third_party/blink/renderer/modules/payments/payment_request.cc
@@ -433,8 +433,7 @@ return; } - output->stringified_data = - V8StringToWebCoreString<String>(value, kDoNotExternalize); + output->stringified_data = ToBlinkString<String>(value, kDoNotExternalize); if (output->stringified_data.length() > PaymentRequest::kMaxJSONStringLength) {
diff --git a/third_party/blink/renderer/modules/payments/payment_response_test.cc b/third_party/blink/renderer/modules/payments/payment_response_test.cc index 97d0175..95829ac1 100644 --- a/third_party/blink/renderer/modules/payments/payment_response_test.cc +++ b/third_party/blink/renderer/modules/payments/payment_response_test.cc
@@ -151,7 +151,7 @@ ScriptValue json_object = output->toJSONForBinding(scope.GetScriptState()); EXPECT_TRUE(json_object.IsObject()); - String json_string = V8StringToWebCoreString<String>( + String json_string = ToBlinkString<String>( v8::JSON::Stringify(scope.GetContext(), json_object.V8Value().As<v8::Object>()) .ToLocalChecked(),
diff --git a/third_party/blink/renderer/modules/push_messaging/push_subscription_test.cc b/third_party/blink/renderer/modules/push_messaging/push_subscription_test.cc index e6fd6e2..f547d844 100644 --- a/third_party/blink/renderer/modules/push_messaging/push_subscription_test.cc +++ b/third_party/blink/renderer/modules/push_messaging/push_subscription_test.cc
@@ -45,7 +45,7 @@ subscription.toJSONForBinding(v8_testing_scope.GetScriptState()); EXPECT_TRUE(json_object.IsObject()); - String json_string = V8StringToWebCoreString<String>( + String json_string = ToBlinkString<String>( v8::JSON::Stringify(v8_testing_scope.GetContext(), json_object.V8Value().As<v8::Object>()) .ToLocalChecked(),
diff --git a/third_party/blink/renderer/modules/shapedetection/barcode_detector.cc b/third_party/blink/renderer/modules/shapedetection/barcode_detector.cc index dce4777..6dba0319 100644 --- a/third_party/blink/renderer/modules/shapedetection/barcode_detector.cc +++ b/third_party/blink/renderer/modules/shapedetection/barcode_detector.cc
@@ -5,6 +5,7 @@ #include "third_party/blink/renderer/modules/shapedetection/barcode_detector.h" #include "services/service_manager/public/cpp/interface_provider.h" +#include "services/shape_detection/public/mojom/barcodedetection_provider.mojom-blink.h" #include "third_party/blink/renderer/core/dom/dom_exception.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/geometry/dom_rect.h" @@ -20,10 +21,14 @@ } BarcodeDetector::BarcodeDetector(ExecutionContext* context) : ShapeDetector() { - auto request = mojo::MakeRequest(&barcode_service_); + shape_detection::mojom::blink::BarcodeDetectionProviderPtr provider; + auto request = mojo::MakeRequest(&provider); if (auto* interface_provider = context->GetInterfaceProvider()) { interface_provider->GetInterface(std::move(request)); } + provider->CreateBarcodeDetection( + mojo::MakeRequest(&barcode_service_), + shape_detection::mojom::blink::BarcodeDetectorOptions::New()); barcode_service_.set_connection_error_handler( WTF::Bind(&BarcodeDetector::OnBarcodeServiceConnectionError,
diff --git a/third_party/blink/renderer/modules/webdatabase/sql_transaction_backend.cc b/third_party/blink/renderer/modules/webdatabase/sql_transaction_backend.cc index c54c17d..9376297 100644 --- a/third_party/blink/renderer/modules/webdatabase/sql_transaction_backend.cc +++ b/third_party/blink/renderer/modules/webdatabase/sql_transaction_backend.cc
@@ -398,7 +398,6 @@ } void SQLTransactionBackend::Trace(blink::Visitor* visitor) { - visitor->Trace(database_); visitor->Trace(wrapper_); }
diff --git a/third_party/blink/renderer/modules/webdatabase/sql_transaction_backend.h b/third_party/blink/renderer/modules/webdatabase/sql_transaction_backend.h index 5e6d7d8d..bd98c35 100644 --- a/third_party/blink/renderer/modules/webdatabase/sql_transaction_backend.h +++ b/third_party/blink/renderer/modules/webdatabase/sql_transaction_backend.h
@@ -121,7 +121,7 @@ CrossThreadPersistent<SQLTransaction> frontend_; CrossThreadPersistent<SQLStatementBackend> current_statement_backend_; - Member<Database> database_; + CrossThreadPersistent<Database> database_; Member<SQLTransactionWrapper> wrapper_; std::unique_ptr<SQLErrorData> transaction_error_;
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index f3f0bc4..917d166 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -1061,6 +1061,8 @@ "graphics/paint/property_tree_state.h", "graphics/paint/raster_invalidation_tracking.cc", "graphics/paint/raster_invalidation_tracking.h", + "graphics/paint/ref_counted_property_tree_state.cc", + "graphics/paint/ref_counted_property_tree_state.h", "graphics/paint/scoped_display_item_fragment.h", "graphics/paint/scoped_paint_chunk_properties.h", "graphics/paint/scroll_display_item.cc",
diff --git a/third_party/blink/renderer/platform/bindings/string_resource.cc b/third_party/blink/renderer/platform/bindings/string_resource.cc index 3d973cda4..862bf64 100644 --- a/third_party/blink/renderer/platform/bindings/string_resource.cc +++ b/third_party/blink/renderer/platform/bindings/string_resource.cc
@@ -18,7 +18,7 @@ template <> struct StringTraits<String> { static const String& FromStringResource(StringResourceBase* resource) { - return resource->WebcoreString(); + return resource->GetWTFString(); } template <typename V8StringTrait> static String FromV8String(v8::Local<v8::String>, int); @@ -80,8 +80,8 @@ } template <typename StringType> -StringType V8StringToWebCoreString(v8::Local<v8::String> v8_string, - ExternalMode external) { +StringType ToBlinkString(v8::Local<v8::String> v8_string, + ExternalMode external) { { // This portion of this function is very hot in certain Dromeao benchmarks. v8::String::Encoding encoding; @@ -125,14 +125,12 @@ // Explicitly instantiate the above template with the expected // parameterizations, to ensure the compiler generates the code; otherwise link // errors can result in GCC 4.4. -template String V8StringToWebCoreString<String>(v8::Local<v8::String>, - ExternalMode); -template AtomicString V8StringToWebCoreString<AtomicString>( - v8::Local<v8::String>, - ExternalMode); +template String ToBlinkString<String>(v8::Local<v8::String>, ExternalMode); +template AtomicString ToBlinkString<AtomicString>(v8::Local<v8::String>, + ExternalMode); // Fast but non thread-safe version. -String Int32ToWebCoreStringFast(int value) { +static String ToBlinkStringFast(int value) { // Caching of small strings below is not thread safe: newly constructed // AtomicString are not safely published. DCHECK(IsMainThread()); @@ -155,11 +153,11 @@ return web_core_string; } -String Int32ToWebCoreString(int value) { +String ToBlinkString(int value) { // If we are on the main thread (this should always true for non-workers), // call the faster one. if (IsMainThread()) - return Int32ToWebCoreStringFast(value); + return ToBlinkStringFast(value); return String::Number(value); }
diff --git a/third_party/blink/renderer/platform/bindings/string_resource.h b/third_party/blink/renderer/platform/bindings/string_resource.h index 9a8a6b6..e56acc5b 100644 --- a/third_party/blink/renderer/platform/bindings/string_resource.h +++ b/third_party/blink/renderer/platform/bindings/string_resource.h
@@ -51,7 +51,7 @@ -reduced_external_memory); } - const String& WebcoreString() { return plain_string_; } + const String& GetWTFString() { return plain_string_; } const AtomicString& GetAtomicString() { #if DCHECK_IS_ON() @@ -131,9 +131,8 @@ enum ExternalMode { kExternalize, kDoNotExternalize }; template <typename StringType> -PLATFORM_EXPORT StringType V8StringToWebCoreString(v8::Local<v8::String>, - ExternalMode); -PLATFORM_EXPORT String Int32ToWebCoreString(int value); +PLATFORM_EXPORT StringType ToBlinkString(v8::Local<v8::String>, ExternalMode); +PLATFORM_EXPORT String ToBlinkString(int value); } // namespace blink
diff --git a/third_party/blink/renderer/platform/bindings/trace_wrapper_v8_string.cc b/third_party/blink/renderer/platform/bindings/trace_wrapper_v8_string.cc index 3fd53edc..ccbeddc 100644 --- a/third_party/blink/renderer/platform/bindings/trace_wrapper_v8_string.cc +++ b/third_party/blink/renderer/platform/bindings/trace_wrapper_v8_string.cc
@@ -22,8 +22,7 @@ return String(); DCHECK(isolate); v8::HandleScope handle_scope(isolate); - return V8StringToWebCoreString<String>(string_.NewLocal(isolate), - kExternalize); + return ToBlinkString<String>(string_.NewLocal(isolate), kExternalize); } } // namespace blink
diff --git a/third_party/blink/renderer/platform/bindings/v8_binding.h b/third_party/blink/renderer/platform/bindings/v8_binding.h index 54b6db4..219cd19 100644 --- a/third_party/blink/renderer/platform/bindings/v8_binding.h +++ b/third_party/blink/renderer/platform/bindings/v8_binding.h
@@ -217,7 +217,7 @@ // an external string then it is transformed into an external string at this // point to avoid repeated conversions. inline String ToCoreString(v8::Local<v8::String> value) { - return V8StringToWebCoreString<String>(value, kExternalize); + return ToBlinkString<String>(value, kExternalize); } inline String ToCoreStringWithNullCheck(v8::Local<v8::String> value) { @@ -234,7 +234,7 @@ } inline AtomicString ToCoreAtomicString(v8::Local<v8::String> value) { - return V8StringToWebCoreString<AtomicString>(value, kExternalize); + return ToBlinkString<AtomicString>(value, kExternalize); } // This method will return a null String if the v8::Value does not contain a
diff --git a/third_party/blink/renderer/platform/graphics/compositing/chunk_to_layer_mapper.cc b/third_party/blink/renderer/platform/graphics/compositing/chunk_to_layer_mapper.cc index 83deea6..70f2a59 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/chunk_to_layer_mapper.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/chunk_to_layer_mapper.cc
@@ -12,7 +12,7 @@ void ChunkToLayerMapper::SwitchToChunk(const PaintChunk& chunk) { outset_for_raster_effects_ = chunk.outset_for_raster_effects; - const auto& new_chunk_state = chunk.properties; + const auto& new_chunk_state = chunk.properties.GetPropertyTreeState(); if (new_chunk_state == chunk_state_) return;
diff --git a/third_party/blink/renderer/platform/graphics/compositing/chunk_to_layer_mapper_test.cc b/third_party/blink/renderer/platform/graphics/compositing/chunk_to_layer_mapper_test.cc index 79c1bf3..44ffb1a 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/chunk_to_layer_mapper_test.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/chunk_to_layer_mapper_test.cc
@@ -47,9 +47,9 @@ return mapper.has_filter_that_moves_pixels_; } - std::unique_ptr<TransformPaintPropertyNode> layer_transform_; - std::unique_ptr<ClipPaintPropertyNode> layer_clip_; - std::unique_ptr<EffectPaintPropertyNode> layer_effect_; + scoped_refptr<TransformPaintPropertyNode> layer_transform_; + scoped_refptr<ClipPaintPropertyNode> layer_clip_; + scoped_refptr<EffectPaintPropertyNode> layer_effect_; }; TEST_F(ChunkToLayerMapperTest, OneChunkUsingLayerState) {
diff --git a/third_party/blink/renderer/platform/graphics/compositing/composited_layer_raster_invalidator.cc b/third_party/blink/renderer/platform/graphics/compositing/composited_layer_raster_invalidator.cc index b84d8ad..f6df3bc11 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/composited_layer_raster_invalidator.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/composited_layer_raster_invalidator.cc
@@ -56,7 +56,7 @@ PaintInvalidationReason CompositedLayerRasterInvalidator::ChunkPropertiesChanged( - const PropertyTreeState& new_chunk_state, + const RefCountedPropertyTreeState& new_chunk_state, const PaintChunkInfo& new_chunk, const PaintChunkInfo& old_chunk, const PropertyTreeState& layer_state) const {
diff --git a/third_party/blink/renderer/platform/graphics/compositing/composited_layer_raster_invalidator.h b/third_party/blink/renderer/platform/graphics/compositing/composited_layer_raster_invalidator.h index 02529e4..cdf1daf 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/composited_layer_raster_invalidator.h +++ b/third_party/blink/renderer/platform/graphics/compositing/composited_layer_raster_invalidator.h
@@ -114,7 +114,7 @@ PaintInvalidationReason, const String* debug_name = nullptr); PaintInvalidationReason ChunkPropertiesChanged( - const PropertyTreeState& new_chunk_state, + const RefCountedPropertyTreeState& new_chunk_state, const PaintChunkInfo& new_chunk, const PaintChunkInfo& old_chunk, const PropertyTreeState& layer_state) const;
diff --git a/third_party/blink/renderer/platform/graphics/compositing/composited_layer_raster_invalidator_test.cc b/third_party/blink/renderer/platform/graphics/compositing/composited_layer_raster_invalidator_test.cc index adb969c..3988fff 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/composited_layer_raster_invalidator_test.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/composited_layer_raster_invalidator_test.cc
@@ -45,6 +45,12 @@ } CompositedLayerRasterInvalidatorTest& Properties( + const RefCountedPropertyTreeState& state) { + data_.chunks.back().properties = state.GetPropertyTreeState(); + return *this; + } + + CompositedLayerRasterInvalidatorTest& Properties( const TransformPaintPropertyNode& t, const ClipPaintPropertyNode& c, const EffectPaintPropertyNode& e) {
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 edf0e16..1c6c178 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
@@ -285,7 +285,7 @@ : bounds(first_paint_chunk.bounds), rect_known_to_be_opaque( first_paint_chunk.known_to_be_opaque ? bounds : FloatRect()), - property_tree_state(first_paint_chunk.properties), + property_tree_state(first_paint_chunk.properties.GetPropertyTreeState()), requires_own_layer(chunk_requires_own_layer) { paint_chunk_indices.push_back(chunk_index); }
diff --git a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor_test.cc b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor_test.cc index 56df523..de20c956 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor_test.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor_test.cc
@@ -579,7 +579,7 @@ } TEST_F(PaintArtifactCompositorTest, DeeplyNestedClips) { - Vector<std::unique_ptr<ClipPaintPropertyNode>> clips; + Vector<scoped_refptr<ClipPaintPropertyNode>> clips; for (unsigned i = 1; i <= 10; i++) { clips.push_back(CreateClip(clips.IsEmpty() ? c0() : *clips.back(), &t0(), FloatRoundedRect(5 * i, 0, 100, 200 - 10 * i))); @@ -750,7 +750,7 @@ return state; } -static std::unique_ptr<ScrollPaintPropertyNode> CreateScroll( +static scoped_refptr<ScrollPaintPropertyNode> CreateScroll( const ScrollPaintPropertyNode& parent, const ScrollPaintPropertyNode::State& state_arg, MainThreadScrollingReasons main_thread_scrolling_reasons = @@ -1689,7 +1689,7 @@ EXPECT_EQ(pending_layer.bounds, pending_layer.rect_known_to_be_opaque); } -std::unique_ptr<EffectPaintPropertyNode> CreateSampleEffectNodeWithElementId() { +scoped_refptr<EffectPaintPropertyNode> CreateSampleEffectNodeWithElementId() { EffectPaintPropertyNode::State state; state.local_transform_space = &t0(); state.output_clip = &c0(); @@ -1699,7 +1699,7 @@ return EffectPaintPropertyNode::Create(e0(), std::move(state)); } -std::unique_ptr<TransformPaintPropertyNode> +scoped_refptr<TransformPaintPropertyNode> CreateSampleTransformNodeWithElementId() { TransformPaintPropertyNode::State state; state.matrix.Rotate(90);
diff --git a/third_party/blink/renderer/platform/graphics/paint/clip_paint_property_node.cc b/third_party/blink/renderer/platform/graphics/paint/clip_paint_property_node.cc index adf29b91..6095270f 100644 --- a/third_party/blink/renderer/platform/graphics/paint/clip_paint_property_node.cc +++ b/third_party/blink/renderer/platform/graphics/paint/clip_paint_property_node.cc
@@ -9,11 +9,12 @@ namespace blink { const ClipPaintPropertyNode& ClipPaintPropertyNode::Root() { - DEFINE_STATIC_LOCAL( + DEFINE_STATIC_REF( ClipPaintPropertyNode, root, - (nullptr, State{&TransformPaintPropertyNode::Root(), - FloatRoundedRect(LayoutRect::InfiniteIntRect())})); - return root; + base::AdoptRef(new ClipPaintPropertyNode( + nullptr, State{&TransformPaintPropertyNode::Root(), + FloatRoundedRect(LayoutRect::InfiniteIntRect())}))); + return *root; } std::unique_ptr<JSONObject> ClipPaintPropertyNode::ToJSON() const { @@ -21,7 +22,7 @@ if (Parent()) json->SetString("parent", String::Format("%p", Parent())); json->SetString("localTransformSpace", - String::Format("%p", state_.local_transform_space)); + String::Format("%p", state_.local_transform_space.get())); json->SetString("rect", state_.clip_rect.ToString()); if (state_.clip_rect_excluding_overlay_scrollbars) { json->SetString("rectExcludingOverlayScrollbars",
diff --git a/third_party/blink/renderer/platform/graphics/paint/clip_paint_property_node.h b/third_party/blink/renderer/platform/graphics/paint/clip_paint_property_node.h index 8cc614e..6adf672 100644 --- a/third_party/blink/renderer/platform/graphics/paint/clip_paint_property_node.h +++ b/third_party/blink/renderer/platform/graphics/paint/clip_paint_property_node.h
@@ -30,7 +30,7 @@ // To make it less verbose and more readable to construct and update a node, // a struct with default values is used to represent the state. struct State { - const TransformPaintPropertyNode* local_transform_space = nullptr; + scoped_refptr<const TransformPaintPropertyNode> local_transform_space; FloatRoundedRect clip_rect; base::Optional<FloatRoundedRect> clip_rect_excluding_overlay_scrollbars; scoped_refptr<const RefCountedPath> clip_path; @@ -56,11 +56,10 @@ // This node is really a sentinel, and does not represent a real clip space. static const ClipPaintPropertyNode& Root(); - static std::unique_ptr<ClipPaintPropertyNode> Create( + static scoped_refptr<ClipPaintPropertyNode> Create( const ClipPaintPropertyNode& parent, State&& state) { - return base::WrapUnique( - new ClipPaintPropertyNode(&parent, std::move(state))); + return base::AdoptRef(new ClipPaintPropertyNode(&parent, std::move(state))); } bool Update(const ClipPaintPropertyNode& parent, State&& state) { @@ -79,7 +78,7 @@ } const TransformPaintPropertyNode* LocalTransformSpace() const { - return state_.local_transform_space; + return state_.local_transform_space.get(); } const FloatRoundedRect& ClipRect() const { return state_.clip_rect; } const FloatRoundedRect& ClipRectExcludingOverlayScrollbars() const { @@ -97,8 +96,8 @@ #if DCHECK_IS_ON() // The clone function is used by FindPropertiesNeedingUpdate.h for recording // a clip node before it has been updated, to later detect changes. - std::unique_ptr<ClipPaintPropertyNode> Clone() const { - return base::WrapUnique(new ClipPaintPropertyNode(Parent(), State(state_))); + scoped_refptr<ClipPaintPropertyNode> Clone() const { + return base::AdoptRef(new ClipPaintPropertyNode(Parent(), State(state_))); } // The equality operator is used by FindPropertiesNeedingUpdate.h for checking
diff --git a/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.cc b/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.cc index 0750252..7b83ca1b 100644 --- a/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.cc +++ b/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.cc
@@ -7,10 +7,11 @@ namespace blink { const EffectPaintPropertyNode& EffectPaintPropertyNode::Root() { - DEFINE_STATIC_LOCAL(EffectPaintPropertyNode, root, - (nullptr, State{&TransformPaintPropertyNode::Root(), - &ClipPaintPropertyNode::Root()})); - return root; + DEFINE_STATIC_REF(EffectPaintPropertyNode, root, + base::AdoptRef(new EffectPaintPropertyNode( + nullptr, State{&TransformPaintPropertyNode::Root(), + &ClipPaintPropertyNode::Root()}))); + return *root; } FloatRect EffectPaintPropertyNode::MapRect(const FloatRect& input_rect) const { @@ -26,8 +27,8 @@ if (Parent()) json->SetString("parent", String::Format("%p", Parent())); json->SetString("localTransformSpace", - String::Format("%p", state_.local_transform_space)); - json->SetString("outputClip", String::Format("%p", state_.output_clip)); + String::Format("%p", state_.local_transform_space.get())); + json->SetString("outputClip", String::Format("%p", state_.output_clip.get())); if (state_.color_filter != kColorFilterNone) json->SetInteger("colorFilter", state_.color_filter); if (!state_.filter.IsEmpty())
diff --git a/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h b/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h index 753e862..c95b8e0 100644 --- a/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h +++ b/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h
@@ -32,10 +32,10 @@ // and effects under the same parent. // 2. Some effects are spatial (namely blur filter and reflection), the // effect parameters will be specified in the local space. - const TransformPaintPropertyNode* local_transform_space = nullptr; + scoped_refptr<const TransformPaintPropertyNode> local_transform_space; // The output of the effect can be optionally clipped when composited onto // the current backdrop. - const ClipPaintPropertyNode* output_clip = nullptr; + scoped_refptr<const ClipPaintPropertyNode> output_clip; // Optionally a number of effects can be applied to the composited output. // The chain of effects will be applied in the following order: // === Begin of effects === @@ -65,10 +65,10 @@ // This node is really a sentinel, and does not represent a real effect. static const EffectPaintPropertyNode& Root(); - static std::unique_ptr<EffectPaintPropertyNode> Create( + static scoped_refptr<EffectPaintPropertyNode> Create( const EffectPaintPropertyNode& parent, State&& state) { - return base::WrapUnique( + return base::AdoptRef( new EffectPaintPropertyNode(&parent, std::move(state))); } @@ -83,9 +83,11 @@ } const TransformPaintPropertyNode* LocalTransformSpace() const { - return state_.local_transform_space; + return state_.local_transform_space.get(); } - const ClipPaintPropertyNode* OutputClip() const { return state_.output_clip; } + const ClipPaintPropertyNode* OutputClip() const { + return state_.output_clip.get(); + } SkBlendMode BlendMode() const { return state_.blend_mode; } float Opacity() const { return state_.opacity; } @@ -118,9 +120,8 @@ #if DCHECK_IS_ON() // The clone function is used by FindPropertiesNeedingUpdate.h for recording // an effect node before it has been updated, to later detect changes. - std::unique_ptr<EffectPaintPropertyNode> Clone() const { - return base::WrapUnique( - new EffectPaintPropertyNode(Parent(), State(state_))); + scoped_refptr<EffectPaintPropertyNode> Clone() const { + return base::AdoptRef(new EffectPaintPropertyNode(Parent(), State(state_))); } // The equality operator is used by FindPropertiesNeedingUpdate.h for checking
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_chunk.h b/third_party/blink/renderer/platform/graphics/paint/paint_chunk.h index c0a28b6..4504b5e2 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_chunk.h +++ b/third_party/blink/renderer/platform/graphics/paint/paint_chunk.h
@@ -10,8 +10,8 @@ #include "third_party/blink/renderer/platform/geometry/float_rect.h" #include "third_party/blink/renderer/platform/graphics/paint/display_item.h" #include "third_party/blink/renderer/platform/graphics/paint/hit_test_data.h" -#include "third_party/blink/renderer/platform/graphics/paint/property_tree_state.h" #include "third_party/blink/renderer/platform/graphics/paint/raster_invalidation_tracking.h" +#include "third_party/blink/renderer/platform/graphics/paint/ref_counted_property_tree_state.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" #include "third_party/blink/renderer/platform/wtf/forward.h" @@ -100,7 +100,7 @@ Id id; // The paint properties which apply to this chunk. - PropertyTreeState properties; + RefCountedPropertyTreeState properties; // The total bounds of this paint chunk's contents, in the coordinate space of // the containing transform node.
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 bcfa96f..16706fc 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_controller.cc +++ b/third_party/blink/renderer/platform/graphics/paint/paint_controller.cc
@@ -517,7 +517,7 @@ properties_before_subsequence = new_paint_chunks_.CurrentPaintChunkProperties(); UpdateCurrentPaintChunkPropertiesUsingIdWithFragment( - cached_chunk->id, cached_chunk->properties); + cached_chunk->id, cached_chunk->properties.GetPropertyTreeState()); } else { // Avoid uninitialized variable error on Windows. cached_chunk = current_paint_artifact_.PaintChunks().begin(); @@ -537,7 +537,7 @@ DCHECK(cached_chunk != current_paint_artifact_.PaintChunks().end()); new_paint_chunks_.ForceNewChunk(); UpdateCurrentPaintChunkPropertiesUsingIdWithFragment( - cached_chunk->id, cached_chunk->properties); + cached_chunk->id, cached_chunk->properties.GetPropertyTreeState()); } #if DCHECK_IS_ON()
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_property_node.h b/third_party/blink/renderer/platform/graphics/paint/paint_property_node.h index 4f4cd57..983b653 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_property_node.h +++ b/third_party/blink/renderer/platform/graphics/paint/paint_property_node.h
@@ -5,8 +5,10 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_PAINT_PROPERTY_NODE_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_PAINT_PROPERTY_NODE_H_ +#include "base/memory/scoped_refptr.h" #include "third_party/blink/renderer/platform/json/json_values.h" #include "third_party/blink/renderer/platform/platform_export.h" +#include "third_party/blink/renderer/platform/wtf/ref_counted.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #if DCHECK_IS_ON() @@ -53,12 +55,10 @@ const TransformPaintPropertyNode&); template <typename NodeType> -class PaintPropertyNode { - USING_FAST_MALLOC(NodeType); - +class PaintPropertyNode : public RefCounted<NodeType> { public: // Parent property node, or nullptr if this is the root node. - const NodeType* Parent() const { return parent_; } + const NodeType* Parent() const { return parent_.get(); } bool IsRoot() const { return !parent_; } bool IsAncestorOf(const NodeType& other) const { @@ -131,7 +131,7 @@ void SetChanged() { changed_ = true; } private: - const NodeType* parent_; + scoped_refptr<const NodeType> parent_; mutable bool changed_ = true; #if DCHECK_IS_ON()
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_property_node_test.cc b/third_party/blink/renderer/platform/graphics/paint/paint_property_node_test.cc index 072d424..c21f317 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_property_node_test.cc +++ b/third_party/blink/renderer/platform/graphics/paint/paint_property_node_test.cc
@@ -35,11 +35,11 @@ grandchild2->ClearChangedToRoot(); } - static void Update(std::unique_ptr<ClipPaintPropertyNode>& node, + static void Update(ClipPaintPropertyNode& node, const ClipPaintPropertyNode& new_parent, const FloatRoundedRect& new_clip_rect) { - node->Update(new_parent, - ClipPaintPropertyNode::State{nullptr, new_clip_rect}); + node.Update(new_parent, + ClipPaintPropertyNode::State{nullptr, new_clip_rect}); } void ExpectInitialState() { @@ -61,29 +61,29 @@ } const ClipPaintPropertyNode* root; - std::unique_ptr<ClipPaintPropertyNode> node; - std::unique_ptr<ClipPaintPropertyNode> child1; - std::unique_ptr<ClipPaintPropertyNode> child2; - std::unique_ptr<ClipPaintPropertyNode> grandchild1; - std::unique_ptr<ClipPaintPropertyNode> grandchild2; + scoped_refptr<ClipPaintPropertyNode> node; + scoped_refptr<ClipPaintPropertyNode> child1; + scoped_refptr<ClipPaintPropertyNode> child2; + scoped_refptr<ClipPaintPropertyNode> grandchild1; + scoped_refptr<ClipPaintPropertyNode> grandchild2; }; TEST_F(PaintPropertyNodeTest, LowestCommonAncestor) { - EXPECT_EQ(node.get(), &LowestCommonAncestor(*node, *node)); + EXPECT_EQ(node, &LowestCommonAncestor(*node, *node)); EXPECT_EQ(root, &LowestCommonAncestor(*root, *root)); - EXPECT_EQ(node.get(), &LowestCommonAncestor(*grandchild1, *grandchild2)); - EXPECT_EQ(node.get(), &LowestCommonAncestor(*grandchild1, *child2)); + EXPECT_EQ(node, &LowestCommonAncestor(*grandchild1, *grandchild2)); + EXPECT_EQ(node, &LowestCommonAncestor(*grandchild1, *child2)); EXPECT_EQ(root, &LowestCommonAncestor(*grandchild1, *root)); - EXPECT_EQ(child1.get(), &LowestCommonAncestor(*grandchild1, *child1)); + EXPECT_EQ(child1, &LowestCommonAncestor(*grandchild1, *child1)); - EXPECT_EQ(node.get(), &LowestCommonAncestor(*grandchild2, *grandchild1)); - EXPECT_EQ(node.get(), &LowestCommonAncestor(*grandchild2, *child1)); + EXPECT_EQ(node, &LowestCommonAncestor(*grandchild2, *grandchild1)); + EXPECT_EQ(node, &LowestCommonAncestor(*grandchild2, *child1)); EXPECT_EQ(root, &LowestCommonAncestor(*grandchild2, *root)); - EXPECT_EQ(child2.get(), &LowestCommonAncestor(*grandchild2, *child2)); + EXPECT_EQ(child2, &LowestCommonAncestor(*grandchild2, *child2)); - EXPECT_EQ(node.get(), &LowestCommonAncestor(*child1, *child2)); - EXPECT_EQ(node.get(), &LowestCommonAncestor(*child2, *child1)); + EXPECT_EQ(node, &LowestCommonAncestor(*child1, *child2)); + EXPECT_EQ(node, &LowestCommonAncestor(*child2, *child1)); } TEST_F(PaintPropertyNodeTest, InitialStateAndReset) { @@ -94,7 +94,7 @@ TEST_F(PaintPropertyNodeTest, ChangeNode) { ResetAllChanged(); - Update(node, *root, FloatRoundedRect(1, 2, 3, 4)); + Update(*node, *root, FloatRoundedRect(1, 2, 3, 4)); EXPECT_TRUE(node->Changed(*root)); EXPECT_FALSE(node->Changed(*node)); EXPECT_TRUE(child1->Changed(*root)); @@ -111,7 +111,7 @@ TEST_F(PaintPropertyNodeTest, ChangeOneChild) { ResetAllChanged(); - Update(child1, *node, FloatRoundedRect(1, 2, 3, 4)); + Update(*child1, *node, FloatRoundedRect(1, 2, 3, 4)); EXPECT_FALSE(node->Changed(*root)); EXPECT_FALSE(node->Changed(*node)); EXPECT_TRUE(child1->Changed(*root)); @@ -136,7 +136,7 @@ TEST_F(PaintPropertyNodeTest, Reparent) { ResetAllChanged(); - Update(child1, *child2, FloatRoundedRect(1, 2, 3, 4)); + Update(*child1, *child2, FloatRoundedRect(1, 2, 3, 4)); EXPECT_FALSE(node->Changed(*root)); EXPECT_TRUE(child1->Changed(*node)); EXPECT_TRUE(child1->Changed(*child2));
diff --git a/third_party/blink/renderer/platform/graphics/paint/property_tree_state_test.cc b/third_party/blink/renderer/platform/graphics/paint/property_tree_state_test.cc index 6a91f02..5202781 100644 --- a/third_party/blink/renderer/platform/graphics/paint/property_tree_state_test.cc +++ b/third_party/blink/renderer/platform/graphics/paint/property_tree_state_test.cc
@@ -10,7 +10,7 @@ class PropertyTreeStateTest : public testing::Test {}; -static std::unique_ptr<TransformPaintPropertyNode> +static scoped_refptr<TransformPaintPropertyNode> CreateTransformWithCompositorElementId( const CompositorElementId& compositor_element_id) { TransformPaintPropertyNode::State state; @@ -19,7 +19,7 @@ std::move(state)); } -static std::unique_ptr<EffectPaintPropertyNode> +static scoped_refptr<EffectPaintPropertyNode> CreateEffectWithCompositorElementId( const CompositorElementId& compositor_element_id) { EffectPaintPropertyNode::State state;
diff --git a/third_party/blink/renderer/platform/graphics/paint/ref_counted_property_tree_state.cc b/third_party/blink/renderer/platform/graphics/paint/ref_counted_property_tree_state.cc new file mode 100644 index 0000000..43fb4206 --- /dev/null +++ b/third_party/blink/renderer/platform/graphics/paint/ref_counted_property_tree_state.cc
@@ -0,0 +1,43 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/platform/graphics/paint/ref_counted_property_tree_state.h" + +#include <memory> + +namespace blink { + +const RefCountedPropertyTreeState& RefCountedPropertyTreeState::Root() { + DEFINE_STATIC_LOCAL( + std::unique_ptr<RefCountedPropertyTreeState>, root, + (std::make_unique<RefCountedPropertyTreeState>( + &TransformPaintPropertyNode::Root(), &ClipPaintPropertyNode::Root(), + &EffectPaintPropertyNode::Root()))); + return *root; +} + +const CompositorElementId RefCountedPropertyTreeState::GetCompositorElementId( + const CompositorElementIdSet& element_ids) const { + // The effect or transform nodes could have a compositor element id. The order + // doesn't matter as the element id should be the same on all that have a + // non-default CompositorElementId. + // + // Note that RefCountedPropertyTreeState acts as a context that accumulates + // state as we traverse the tree building layers. This means that we could see + // a compositor element id 'A' for a parent layer in conjunction with a + // compositor element id 'B' for a child layer. To preserve uniqueness of + // element ids, then, we check for presence in the |element_ids| set (which + // represents element ids already previously attached to a layer). This is an + // interim step while we pursue broader rework of animation subsystem noted in + // http://crbug.com/709137. + if (Effect()->GetCompositorElementId() && + !element_ids.Contains(Effect()->GetCompositorElementId())) + return Effect()->GetCompositorElementId(); + if (Transform()->GetCompositorElementId() && + !element_ids.Contains(Transform()->GetCompositorElementId())) + return Transform()->GetCompositorElementId(); + return CompositorElementId(); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/paint/ref_counted_property_tree_state.h b/third_party/blink/renderer/platform/graphics/paint/ref_counted_property_tree_state.h new file mode 100644 index 0000000..340d6e95 --- /dev/null +++ b/third_party/blink/renderer/platform/graphics/paint/ref_counted_property_tree_state.h
@@ -0,0 +1,88 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_REF_COUNTED_PROPERTY_TREE_STATE_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_REF_COUNTED_PROPERTY_TREE_STATE_H_ + +#include "third_party/blink/renderer/platform/graphics/paint/property_tree_state.h" +#include "third_party/blink/renderer/platform/wtf/hash_functions.h" +#include "third_party/blink/renderer/platform/wtf/hash_traits.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" + +namespace blink { + +// A complete set of paint properties including those that are inherited from +// other objects. RefPtrs are used to guard against use-after-free bugs. +class PLATFORM_EXPORT RefCountedPropertyTreeState { + USING_FAST_MALLOC(RefCountedPropertyTreeState); + + public: + RefCountedPropertyTreeState(const TransformPaintPropertyNode* transform, + const ClipPaintPropertyNode* clip, + const EffectPaintPropertyNode* effect) + : transform_(transform), clip_(clip), effect_(effect) {} + + RefCountedPropertyTreeState(const PropertyTreeState& property_tree_state) + : transform_(property_tree_state.Transform()), + clip_(property_tree_state.Clip()), + effect_(property_tree_state.Effect()) {} + + bool HasDirectCompositingReasons() const; + + const TransformPaintPropertyNode* Transform() const { + return transform_.get(); + } + void SetTransform(scoped_refptr<const TransformPaintPropertyNode> node) { + transform_ = std::move(node); + } + + const ClipPaintPropertyNode* Clip() const { return clip_.get(); } + void SetClip(scoped_refptr<const ClipPaintPropertyNode> node) { + clip_ = std::move(node); + } + + const EffectPaintPropertyNode* Effect() const { return effect_.get(); } + void SetEffect(scoped_refptr<const EffectPaintPropertyNode> node) { + effect_ = std::move(node); + } + + static const RefCountedPropertyTreeState& Root(); + + PropertyTreeState GetPropertyTreeState() const { + return PropertyTreeState(transform_.get(), clip_.get(), effect_.get()); + } + + // Returns the compositor element id, if any, for this property state. If + // neither the effect nor transform nodes have a compositor element id then a + // default instance is returned. + const CompositorElementId GetCompositorElementId( + const CompositorElementIdSet& element_ids) const; + + void ClearChangedToRoot() const { + Transform()->ClearChangedToRoot(); + Clip()->ClearChangedToRoot(); + Effect()->ClearChangedToRoot(); + } + + String ToString() const { return GetPropertyTreeState().ToString(); } +#if DCHECK_IS_ON() + // Dumps the tree from this state up to the root as a string. + String ToTreeString() const { return GetPropertyTreeState().ToTreeString(); } +#endif + + private: + scoped_refptr<const TransformPaintPropertyNode> transform_; + scoped_refptr<const ClipPaintPropertyNode> clip_; + scoped_refptr<const EffectPaintPropertyNode> effect_; +}; + +inline bool operator==(const RefCountedPropertyTreeState& a, + const RefCountedPropertyTreeState& b) { + return a.Transform() == b.Transform() && a.Clip() == b.Clip() && + a.Effect() == b.Effect(); +} + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_REF_COUNTED_PROPERTY_TREE_STATE_H_
diff --git a/third_party/blink/renderer/platform/graphics/paint/scroll_paint_property_node.cc b/third_party/blink/renderer/platform/graphics/paint/scroll_paint_property_node.cc index b66fedb2..81b810da 100644 --- a/third_party/blink/renderer/platform/graphics/paint/scroll_paint_property_node.cc +++ b/third_party/blink/renderer/platform/graphics/paint/scroll_paint_property_node.cc
@@ -7,8 +7,10 @@ namespace blink { const ScrollPaintPropertyNode& ScrollPaintPropertyNode::Root() { - DEFINE_STATIC_LOCAL(ScrollPaintPropertyNode, root, (nullptr, State{})); - return root; + DEFINE_STATIC_REF( + ScrollPaintPropertyNode, root, + base::AdoptRef(new ScrollPaintPropertyNode(nullptr, State{}))); + return *root; } std::unique_ptr<JSONObject> ScrollPaintPropertyNode::ToJSON() const {
diff --git a/third_party/blink/renderer/platform/graphics/paint/scroll_paint_property_node.h b/third_party/blink/renderer/platform/graphics/paint/scroll_paint_property_node.h index e1a27b6..b522a85c 100644 --- a/third_party/blink/renderer/platform/graphics/paint/scroll_paint_property_node.h +++ b/third_party/blink/renderer/platform/graphics/paint/scroll_paint_property_node.h
@@ -58,10 +58,10 @@ // This node is really a sentinel, and does not represent a real scroll. static const ScrollPaintPropertyNode& Root(); - static std::unique_ptr<ScrollPaintPropertyNode> Create( + static scoped_refptr<ScrollPaintPropertyNode> Create( const ScrollPaintPropertyNode& parent, State&& state) { - return base::WrapUnique( + return base::AdoptRef( new ScrollPaintPropertyNode(&parent, std::move(state))); } @@ -117,9 +117,8 @@ #if DCHECK_IS_ON() // The clone function is used by FindPropertiesNeedingUpdate.h for recording // a scroll node before it has been updated, to later detect changes. - std::unique_ptr<ScrollPaintPropertyNode> Clone() const { - return base::WrapUnique( - new ScrollPaintPropertyNode(Parent(), State(state_))); + scoped_refptr<ScrollPaintPropertyNode> Clone() const { + return base::AdoptRef(new ScrollPaintPropertyNode(Parent(), State(state_))); } // The equality operator is used by FindPropertiesNeedingUpdate.h for checking
diff --git a/third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.cc b/third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.cc index 4cdd6e5f..a6e220c 100644 --- a/third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.cc +++ b/third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.cc
@@ -9,13 +9,14 @@ // The root of the transform tree. The root transform node references the root // scroll node. const TransformPaintPropertyNode& TransformPaintPropertyNode::Root() { - DEFINE_STATIC_LOCAL( + DEFINE_STATIC_REF( TransformPaintPropertyNode, root, - (nullptr, - State{TransformationMatrix(), FloatPoint3D(), false, - BackfaceVisibility::kVisible, 0, CompositingReason::kNone, - CompositorElementId(), &ScrollPaintPropertyNode::Root()})); - return root; + base::AdoptRef(new TransformPaintPropertyNode( + nullptr, + State{TransformationMatrix(), FloatPoint3D(), false, + BackfaceVisibility::kVisible, 0, CompositingReason::kNone, + CompositorElementId(), &ScrollPaintPropertyNode::Root()}))); + return *root; } const TransformPaintPropertyNode& @@ -60,7 +61,7 @@ state_.compositor_element_id.ToString().c_str()); } if (state_.scroll) - json->SetString("scroll", String::Format("%p", state_.scroll)); + json->SetString("scroll", String::Format("%p", state_.scroll.get())); return json; }
diff --git a/third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h b/third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h index 4cd3696d..7422f38d 100644 --- a/third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h +++ b/third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h
@@ -48,7 +48,7 @@ unsigned rendering_context_id = 0; CompositingReasons direct_compositing_reasons = CompositingReason::kNone; CompositorElementId compositor_element_id; - const ScrollPaintPropertyNode* scroll = nullptr; + scoped_refptr<const ScrollPaintPropertyNode> scroll; bool operator==(const State& o) const { return matrix == o.matrix && origin == o.origin && @@ -65,10 +65,10 @@ // space. static const TransformPaintPropertyNode& Root(); - static std::unique_ptr<TransformPaintPropertyNode> Create( + static scoped_refptr<TransformPaintPropertyNode> Create( const TransformPaintPropertyNode& parent, State&& state) { - return base::WrapUnique( + return base::AdoptRef( new TransformPaintPropertyNode(&parent, std::move(state))); } @@ -87,7 +87,9 @@ const FloatPoint3D& Origin() const { return state_.origin; } // The associated scroll node, or nullptr otherwise. - const ScrollPaintPropertyNode* ScrollNode() const { return state_.scroll; } + const ScrollPaintPropertyNode* ScrollNode() const { + return state_.scroll.get(); + } // If this is a scroll offset translation (i.e., has an associated scroll // node), returns this. Otherwise, returns the transform node that this node @@ -126,8 +128,8 @@ #if DCHECK_IS_ON() // The clone function is used by FindPropertiesNeedingUpdate.h for recording // a transform node before it has been updated, to later detect changes. - std::unique_ptr<TransformPaintPropertyNode> Clone() const { - return base::WrapUnique( + scoped_refptr<TransformPaintPropertyNode> Clone() const { + return base::AdoptRef( new TransformPaintPropertyNode(Parent(), State(state_))); }
diff --git a/third_party/blink/renderer/platform/scheduler/BUILD.gn b/third_party/blink/renderer/platform/scheduler/BUILD.gn index e26f4e2..0c02e8a45 100644 --- a/third_party/blink/renderer/platform/scheduler/BUILD.gn +++ b/third_party/blink/renderer/platform/scheduler/BUILD.gn
@@ -38,16 +38,12 @@ "base/work_queue_sets.h", "child/cancelable_closure_holder.cc", "child/cancelable_closure_holder.h", - "child/compositor_metrics_helper.cc", - "child/compositor_metrics_helper.h", "child/default_params.h", "child/features.h", "child/idle_canceled_delayed_task_sweeper.cc", "child/idle_canceled_delayed_task_sweeper.h", "child/idle_helper.cc", "child/idle_helper.h", - "child/metrics_helper.cc", - "child/metrics_helper.h", "child/page_visibility_state.cc", "child/page_visibility_state.h", "child/pollable_thread_safe_flag.cc", @@ -60,15 +56,9 @@ "child/webthread_base.cc", "child/webthread_impl_for_worker_scheduler.cc", "child/webthread_impl_for_worker_scheduler.h", - "child/worker_metrics_helper.cc", - "child/worker_metrics_helper.h", - "child/worker_scheduler.cc", - "child/worker_scheduler.h", - "child/worker_scheduler_proxy.cc", - "child/worker_scheduler_proxy.h", - "child/worker_task_queue.cc", - "child/worker_task_queue.h", "common/frame_or_worker_scheduler.cc", + "common/metrics_helper.cc", + "common/metrics_helper.h", "common/scheduler_helper.cc", "common/scheduler_helper.h", "common/thread_scheduler.cc", @@ -117,6 +107,7 @@ "public/frame_scheduler.h", "public/page_scheduler.h", "public/thread_scheduler.h", + "public/worker_scheduler.h", "renderer/frame_status.cc", "renderer/frame_status.h", "renderer/web_scoped_virtual_time_pauser.cc", @@ -134,12 +125,21 @@ "util/tracing_helper.h", "utility/webthread_impl_for_utility_thread.cc", "utility/webthread_impl_for_utility_thread.h", + "worker/compositor_metrics_helper.cc", + "worker/compositor_metrics_helper.h", "worker/compositor_thread_scheduler.cc", "worker/compositor_thread_scheduler.h", "worker/non_main_thread_scheduler_helper.cc", "worker/non_main_thread_scheduler_helper.h", "worker/non_main_thread_scheduler_impl.cc", "worker/non_main_thread_scheduler_impl.h", + "worker/non_main_thread_task_queue.cc", + "worker/non_main_thread_task_queue.h", + "worker/worker_metrics_helper.cc", + "worker/worker_metrics_helper.h", + "worker/worker_scheduler.cc", + "worker/worker_scheduler_proxy.cc", + "worker/worker_scheduler_proxy.h", "worker/worker_thread_scheduler.cc", "worker/worker_thread_scheduler.h", ] @@ -196,10 +196,8 @@ "base/work_queue_unittest.cc", "child/idle_canceled_delayed_task_sweeper_unittest.cc", "child/idle_helper_unittest.cc", - "child/metrics_helper_unittest.cc", "child/webthread_impl_for_worker_scheduler_unittest.cc", - "child/worker_scheduler_proxy_unittest.cc", - "child/worker_scheduler_unittest.cc", + "common/metrics_helper_unittest.cc", "common/scheduler_helper_unittest.cc", "common/throttling/budget_pool_unittest.cc", "common/throttling/task_queue_throttler_unittest.cc", @@ -218,6 +216,8 @@ "util/task_duration_metric_reporter_unittest.cc", "util/thread_load_tracker_unittest.cc", "util/tracing_helper_unittest.cc", + "worker/worker_scheduler_proxy_unittest.cc", + "worker/worker_scheduler_unittest.cc", "worker/worker_thread_scheduler_unittest.cc", ]
diff --git a/third_party/blink/renderer/platform/scheduler/child/compositor_metrics_helper.h b/third_party/blink/renderer/platform/scheduler/child/compositor_metrics_helper.h deleted file mode 100644 index f1e07b28..0000000 --- a/third_party/blink/renderer/platform/scheduler/child/compositor_metrics_helper.h +++ /dev/null
@@ -1,32 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_CHILD_COMPOSITOR_METRICS_HELPER_H_ -#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_CHILD_COMPOSITOR_METRICS_HELPER_H_ - -#include "third_party/blink/renderer/platform/scheduler/child/metrics_helper.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_task_queue.h" - -namespace blink { -namespace scheduler { - -class PLATFORM_EXPORT CompositorMetricsHelper : public MetricsHelper { - public: - CompositorMetricsHelper(); - ~CompositorMetricsHelper(); - - void RecordTaskMetrics(WorkerTaskQueue* queue, - const base::sequence_manager::TaskQueue::Task& task, - base::TimeTicks start_time, - base::TimeTicks end_time, - base::Optional<base::TimeDelta> thread_time); - - private: - DISALLOW_COPY_AND_ASSIGN(CompositorMetricsHelper); -}; - -} // namespace scheduler -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_CHILD_COMPOSITOR_METRICS_HELPER_H_
diff --git a/third_party/blink/renderer/platform/scheduler/child/idle_helper_unittest.cc b/third_party/blink/renderer/platform/scheduler/child/idle_helper_unittest.cc index 2e7b506..1a6d650b 100644 --- a/third_party/blink/renderer/platform/scheduler/child/idle_helper_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/child/idle_helper_unittest.cc
@@ -212,7 +212,7 @@ scheduler_helper_.get(), required_quiescence_duration_before_long_idle_period, scheduler_helper_->NewTaskQueue(TaskQueue::Spec("idle_test"))); - default_task_runner_ = scheduler_helper_->DefaultWorkerTaskQueue(); + default_task_runner_ = scheduler_helper_->DefaultNonMainThreadTaskQueue(); idle_task_runner_ = idle_helper_->IdleTaskRunner(); clock_.Advance(base::TimeDelta::FromMicroseconds(5000)); }
diff --git a/third_party/blink/renderer/platform/scheduler/child/webthread_impl_for_worker_scheduler.cc b/third_party/blink/renderer/platform/scheduler/child/webthread_impl_for_worker_scheduler.cc index 76dcba8a..0493005 100644 --- a/third_party/blink/renderer/platform/scheduler/child/webthread_impl_for_worker_scheduler.cc +++ b/third_party/blink/renderer/platform/scheduler/child/webthread_impl_for_worker_scheduler.cc
@@ -13,7 +13,7 @@ #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/renderer/platform/scheduler/base/task_queue.h" #include "third_party/blink/renderer/platform/scheduler/child/task_queue_with_task_type.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy.h" +#include "third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy.h" #include "third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/scheduler/child/metrics_helper.cc b/third_party/blink/renderer/platform/scheduler/common/metrics_helper.cc similarity index 97% rename from third_party/blink/renderer/platform/scheduler/child/metrics_helper.cc rename to third_party/blink/renderer/platform/scheduler/common/metrics_helper.cc index 2cccc61..0ed4ce8 100644 --- a/third_party/blink/renderer/platform/scheduler/child/metrics_helper.cc +++ b/third_party/blink/renderer/platform/scheduler/common/metrics_helper.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 "third_party/blink/renderer/platform/scheduler/child/metrics_helper.h" +#include "third_party/blink/renderer/platform/scheduler/common/metrics_helper.h" #include "third_party/blink/renderer/platform/scheduler/child/process_state.h"
diff --git a/third_party/blink/renderer/platform/scheduler/child/metrics_helper.h b/third_party/blink/renderer/platform/scheduler/common/metrics_helper.h similarity index 91% rename from third_party/blink/renderer/platform/scheduler/child/metrics_helper.h rename to third_party/blink/renderer/platform/scheduler/common/metrics_helper.h index e22f12a0..a6ce89a 100644 --- a/third_party/blink/renderer/platform/scheduler/child/metrics_helper.h +++ b/third_party/blink/renderer/platform/scheduler/common/metrics_helper.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 THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_CHILD_METRICS_HELPER_H_ -#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_CHILD_METRICS_HELPER_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_COMMON_METRICS_HELPER_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_COMMON_METRICS_HELPER_H_ #include "base/optional.h" #include "base/time/time.h" @@ -70,4 +70,4 @@ } // namespace scheduler } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_CHILD_METRICS_HELPER_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_COMMON_METRICS_HELPER_H_
diff --git a/third_party/blink/renderer/platform/scheduler/child/metrics_helper_unittest.cc b/third_party/blink/renderer/platform/scheduler/common/metrics_helper_unittest.cc similarity index 97% rename from third_party/blink/renderer/platform/scheduler/child/metrics_helper_unittest.cc rename to third_party/blink/renderer/platform/scheduler/common/metrics_helper_unittest.cc index a1d54dc..76ed4896 100644 --- a/third_party/blink/renderer/platform/scheduler/child/metrics_helper_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/common/metrics_helper_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 "third_party/blink/renderer/platform/scheduler/child/metrics_helper.h" +#include "third_party/blink/renderer/platform/scheduler/common/metrics_helper.h" #include "base/test/histogram_tester.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/blink/renderer/platform/scheduler/common/scheduler_helper_unittest.cc b/third_party/blink/renderer/platform/scheduler/common/scheduler_helper_unittest.cc index 011f4a9..cf11225 100644 --- a/third_party/blink/renderer/platform/scheduler/common/scheduler_helper_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/common/scheduler_helper_unittest.cc
@@ -63,7 +63,7 @@ task_queue_manager_ = task_queue_manager.get(); scheduler_helper_ = std::make_unique<NonMainThreadSchedulerHelper>( std::move(task_queue_manager), nullptr, TaskType::kInternalTest); - default_task_runner_ = scheduler_helper_->DefaultWorkerTaskQueue(); + default_task_runner_ = scheduler_helper_->DefaultNonMainThreadTaskQueue(); } ~SchedulerHelperTest() override = default; @@ -132,11 +132,11 @@ TEST_F(SchedulerHelperTest, GetNumberOfPendingTasks) { std::vector<std::string> run_order; - scheduler_helper_->DefaultWorkerTaskQueue()->PostTask( + scheduler_helper_->DefaultNonMainThreadTaskQueue()->PostTask( FROM_HERE, base::BindOnce(&AppendToVectorTestTask, &run_order, "D1")); - scheduler_helper_->DefaultWorkerTaskQueue()->PostTask( + scheduler_helper_->DefaultNonMainThreadTaskQueue()->PostTask( FROM_HERE, base::BindOnce(&AppendToVectorTestTask, &run_order, "D2")); - scheduler_helper_->ControlWorkerTaskQueue()->PostTask( + scheduler_helper_->ControlNonMainThreadTaskQueue()->PostTask( FROM_HERE, base::BindOnce(&AppendToVectorTestTask, &run_order, "C1")); EXPECT_EQ(3U, task_queue_manager_->PendingTasksCount()); task_environment_.RunUntilIdle(); @@ -157,7 +157,7 @@ MockTaskObserver observer; scheduler_helper_->AddTaskObserver(&observer); - scheduler_helper_->DefaultWorkerTaskQueue()->PostTask( + scheduler_helper_->DefaultNonMainThreadTaskQueue()->PostTask( FROM_HERE, base::BindOnce(&NopTask)); EXPECT_CALL(observer, WillProcessTask(_)).Times(1); @@ -169,7 +169,7 @@ MockTaskObserver observer; scheduler_helper_->AddTaskObserver(&observer); - scheduler_helper_->ControlWorkerTaskQueue()->PostTask( + scheduler_helper_->ControlNonMainThreadTaskQueue()->PostTask( FROM_HERE, base::BindOnce(&NopTask)); EXPECT_CALL(observer, WillProcessTask(_)).Times(0);
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/auto_advancing_virtual_time_domain_unittest.cc b/third_party/blink/renderer/platform/scheduler/main_thread/auto_advancing_virtual_time_domain_unittest.cc index 3e96a0b..5067192 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/auto_advancing_virtual_time_domain_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/auto_advancing_virtual_time_domain_unittest.cc
@@ -39,7 +39,7 @@ nullptr, TaskType::kInternalTest)); scheduler_helper_->AddTaskTimeObserver(&test_task_time_observer_); - task_queue_ = scheduler_helper_->DefaultWorkerTaskQueue(); + task_queue_ = scheduler_helper_->DefaultNonMainThreadTaskQueue(); initial_time_ = base::Time::FromJsTime(100000.0); initial_time_ticks_ = test_task_runner_->NowTicks(); auto_advancing_time_domain_.reset(new AutoAdvancingVirtualTimeDomain(
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 a6f8990..bf70b13 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
@@ -16,12 +16,12 @@ #include "third_party/blink/renderer/platform/scheduler/child/features.h" #include "third_party/blink/renderer/platform/scheduler/child/page_visibility_state.h" #include "third_party/blink/renderer/platform/scheduler/child/task_queue_with_task_type.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy.h" #include "third_party/blink/renderer/platform/scheduler/common/throttling/budget_pool.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/auto_advancing_virtual_time_domain.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/page_scheduler_impl.h" #include "third_party/blink/renderer/platform/scheduler/util/tracing_helper.h" +#include "third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.h b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.h index fdf54e8..3b8aa50 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.h +++ b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.h
@@ -15,10 +15,10 @@ #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/scheduler/base/task_queue.h" #include "third_party/blink/renderer/platform/scheduler/child/page_visibility_state.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/frame_origin_type.h" #include "third_party/blink/renderer/platform/scheduler/public/frame_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/util/tracing_helper.h" +#include "third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy.h" namespace base { namespace sequence_manager {
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_metrics_helper.h b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_metrics_helper.h index 0e851539..489ec0c 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_metrics_helper.h +++ b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_metrics_helper.h
@@ -11,7 +11,7 @@ #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/web_thread_type.h" #include "third_party/blink/renderer/platform/platform_export.h" -#include "third_party/blink/renderer/platform/scheduler/child/metrics_helper.h" +#include "third_party/blink/renderer/platform/scheduler/common/metrics_helper.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/main_thread_task_queue.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/use_case.h" #include "third_party/blink/renderer/platform/scheduler/renderer/frame_status.h"
diff --git a/third_party/blink/renderer/platform/scheduler/child/worker_scheduler.h b/third_party/blink/renderer/platform/scheduler/public/worker_scheduler.h similarity index 90% rename from third_party/blink/renderer/platform/scheduler/child/worker_scheduler.h rename to third_party/blink/renderer/platform/scheduler/public/worker_scheduler.h index f0f5ca02..9f5dea8 100644 --- a/third_party/blink/renderer/platform/scheduler/child/worker_scheduler.h +++ b/third_party/blink/renderer/platform/scheduler/public/worker_scheduler.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 THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_CHILD_WORKER_SCHEDULER_H_ -#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_CHILD_WORKER_SCHEDULER_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_PUBLIC_WORKER_SCHEDULER_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_PUBLIC_WORKER_SCHEDULER_H_ #include "base/memory/weak_ptr.h" #include "base/single_thread_task_runner.h" @@ -75,4 +75,4 @@ } // namespace scheduler } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_CHILD_WORKER_SCHEDULER_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_PUBLIC_WORKER_SCHEDULER_H_
diff --git a/third_party/blink/renderer/platform/scheduler/test/fake_frame_scheduler.h b/third_party/blink/renderer/platform/scheduler/test/fake_frame_scheduler.h index b020458c..eff2e3b 100644 --- a/third_party/blink/renderer/platform/scheduler/test/fake_frame_scheduler.h +++ b/third_party/blink/renderer/platform/scheduler/test/fake_frame_scheduler.h
@@ -7,9 +7,9 @@ #include <deque> -#include "third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/main_thread_task_queue.h" #include "third_party/blink/renderer/platform/scheduler/public/frame_scheduler.h" +#include "third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy.h" namespace blink { namespace scheduler {
diff --git a/third_party/blink/renderer/platform/scheduler/child/compositor_metrics_helper.cc b/third_party/blink/renderer/platform/scheduler/worker/compositor_metrics_helper.cc similarity index 86% rename from third_party/blink/renderer/platform/scheduler/child/compositor_metrics_helper.cc rename to third_party/blink/renderer/platform/scheduler/worker/compositor_metrics_helper.cc index 1f221201..56a47ee 100644 --- a/third_party/blink/renderer/platform/scheduler/child/compositor_metrics_helper.cc +++ b/third_party/blink/renderer/platform/scheduler/worker/compositor_metrics_helper.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 "third_party/blink/renderer/platform/scheduler/child/compositor_metrics_helper.h" +#include "third_party/blink/renderer/platform/scheduler/worker/compositor_metrics_helper.h" namespace blink { namespace scheduler { @@ -13,7 +13,7 @@ CompositorMetricsHelper::~CompositorMetricsHelper() {} void CompositorMetricsHelper::RecordTaskMetrics( - WorkerTaskQueue* queue, + NonMainThreadTaskQueue* queue, const base::sequence_manager::TaskQueue::Task& task, base::TimeTicks start_time, base::TimeTicks end_time,
diff --git a/third_party/blink/renderer/platform/scheduler/worker/compositor_metrics_helper.h b/third_party/blink/renderer/platform/scheduler/worker/compositor_metrics_helper.h new file mode 100644 index 0000000..3c1b6422 --- /dev/null +++ b/third_party/blink/renderer/platform/scheduler/worker/compositor_metrics_helper.h
@@ -0,0 +1,32 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_WORKER_COMPOSITOR_METRICS_HELPER_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_WORKER_COMPOSITOR_METRICS_HELPER_H_ + +#include "third_party/blink/renderer/platform/scheduler/common/metrics_helper.h" +#include "third_party/blink/renderer/platform/scheduler/worker/non_main_thread_task_queue.h" + +namespace blink { +namespace scheduler { + +class PLATFORM_EXPORT CompositorMetricsHelper : public MetricsHelper { + public: + CompositorMetricsHelper(); + ~CompositorMetricsHelper(); + + void RecordTaskMetrics(NonMainThreadTaskQueue* queue, + const base::sequence_manager::TaskQueue::Task& task, + base::TimeTicks start_time, + base::TimeTicks end_time, + base::Optional<base::TimeDelta> thread_time); + + private: + DISALLOW_COPY_AND_ASSIGN(CompositorMetricsHelper); +}; + +} // namespace scheduler +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_WORKER_COMPOSITOR_METRICS_HELPER_H_
diff --git a/third_party/blink/renderer/platform/scheduler/worker/compositor_thread_scheduler.cc b/third_party/blink/renderer/platform/scheduler/worker/compositor_thread_scheduler.cc index 6d0f055..f27f9091 100644 --- a/third_party/blink/renderer/platform/scheduler/worker/compositor_thread_scheduler.cc +++ b/third_party/blink/renderer/platform/scheduler/worker/compositor_thread_scheduler.cc
@@ -34,14 +34,15 @@ CompositorThreadScheduler::~CompositorThreadScheduler() = default; -scoped_refptr<WorkerTaskQueue> CompositorThreadScheduler::DefaultTaskQueue() { - return helper_->DefaultWorkerTaskQueue(); +scoped_refptr<NonMainThreadTaskQueue> +CompositorThreadScheduler::DefaultTaskQueue() { + return helper_->DefaultNonMainThreadTaskQueue(); } void CompositorThreadScheduler::InitImpl() {} void CompositorThreadScheduler::OnTaskCompleted( - WorkerTaskQueue* worker_task_queue, + NonMainThreadTaskQueue* worker_task_queue, const base::sequence_manager::TaskQueue::Task& task, base::TimeTicks start, base::TimeTicks end,
diff --git a/third_party/blink/renderer/platform/scheduler/worker/compositor_thread_scheduler.h b/third_party/blink/renderer/platform/scheduler/worker/compositor_thread_scheduler.h index fd97ac6e..f1b084c6 100644 --- a/third_party/blink/renderer/platform/scheduler/worker/compositor_thread_scheduler.h +++ b/third_party/blink/renderer/platform/scheduler/worker/compositor_thread_scheduler.h
@@ -11,8 +11,8 @@ #include "third_party/blink/public/platform/scheduler/single_thread_idle_task_runner.h" #include "third_party/blink/public/platform/web_thread_type.h" #include "third_party/blink/renderer/platform/platform_export.h" -#include "third_party/blink/renderer/platform/scheduler/child/compositor_metrics_helper.h" #include "third_party/blink/renderer/platform/scheduler/util/task_duration_metric_reporter.h" +#include "third_party/blink/renderer/platform/scheduler/worker/compositor_metrics_helper.h" #include "third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_impl.h" namespace base { @@ -34,8 +34,8 @@ ~CompositorThreadScheduler() override; // NonMainThreadSchedulerImpl: - scoped_refptr<WorkerTaskQueue> DefaultTaskQueue() override; - void OnTaskCompleted(WorkerTaskQueue* worker_task_queue, + scoped_refptr<NonMainThreadTaskQueue> DefaultTaskQueue() override; + void OnTaskCompleted(NonMainThreadTaskQueue* worker_task_queue, const base::sequence_manager::TaskQueue::Task& task, base::TimeTicks start, base::TimeTicks end,
diff --git a/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_helper.cc b/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_helper.cc index 793d255..f9d8d5d1 100644 --- a/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_helper.cc +++ b/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_helper.cc
@@ -6,7 +6,7 @@ #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/renderer/platform/scheduler/child/task_queue_with_task_type.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_task_queue.h" +#include "third_party/blink/renderer/platform/scheduler/worker/non_main_thread_task_queue.h" namespace blink { namespace scheduler { @@ -33,8 +33,8 @@ default_task_queue_->ShutdownTaskQueue(); } -scoped_refptr<WorkerTaskQueue> -NonMainThreadSchedulerHelper::DefaultWorkerTaskQueue() { +scoped_refptr<NonMainThreadTaskQueue> +NonMainThreadSchedulerHelper::DefaultNonMainThreadTaskQueue() { return default_task_queue_; } @@ -42,8 +42,8 @@ return default_task_queue_; } -scoped_refptr<WorkerTaskQueue> -NonMainThreadSchedulerHelper::ControlWorkerTaskQueue() { +scoped_refptr<NonMainThreadTaskQueue> +NonMainThreadSchedulerHelper::ControlNonMainThreadTaskQueue() { return control_task_queue_; } @@ -51,9 +51,9 @@ return control_task_queue_; } -scoped_refptr<WorkerTaskQueue> NonMainThreadSchedulerHelper::NewTaskQueue( - const TaskQueue::Spec& spec) { - return task_queue_manager_->CreateTaskQueue<WorkerTaskQueue>( +scoped_refptr<NonMainThreadTaskQueue> +NonMainThreadSchedulerHelper::NewTaskQueue(const TaskQueue::Spec& spec) { + return task_queue_manager_->CreateTaskQueue<NonMainThreadTaskQueue>( spec, non_main_thread_scheduler_); }
diff --git a/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_helper.h b/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_helper.h index 8441e45..57598945 100644 --- a/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_helper.h +++ b/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_helper.h
@@ -8,7 +8,7 @@ #include "third_party/blink/renderer/platform/scheduler/common/scheduler_helper.h" #include "third_party/blink/public/platform/task_type.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_task_queue.h" +#include "third_party/blink/renderer/platform/scheduler/worker/non_main_thread_task_queue.h" namespace blink { namespace scheduler { @@ -23,11 +23,11 @@ TaskType default_task_type); ~NonMainThreadSchedulerHelper() override; - scoped_refptr<WorkerTaskQueue> NewTaskQueue( + scoped_refptr<NonMainThreadTaskQueue> NewTaskQueue( const base::sequence_manager::TaskQueue::Spec& spec); - scoped_refptr<WorkerTaskQueue> DefaultWorkerTaskQueue(); - scoped_refptr<WorkerTaskQueue> ControlWorkerTaskQueue(); + scoped_refptr<NonMainThreadTaskQueue> DefaultNonMainThreadTaskQueue(); + scoped_refptr<NonMainThreadTaskQueue> ControlNonMainThreadTaskQueue(); protected: scoped_refptr<base::sequence_manager::TaskQueue> DefaultTaskQueue() override; @@ -35,8 +35,8 @@ private: NonMainThreadSchedulerImpl* non_main_thread_scheduler_; // NOT OWNED - const scoped_refptr<WorkerTaskQueue> default_task_queue_; - const scoped_refptr<WorkerTaskQueue> control_task_queue_; + const scoped_refptr<NonMainThreadTaskQueue> default_task_queue_; + const scoped_refptr<NonMainThreadTaskQueue> control_task_queue_; DISALLOW_COPY_AND_ASSIGN(NonMainThreadSchedulerHelper); };
diff --git a/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_impl.cc b/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_impl.cc index d5f31d9..aacbc38e 100644 --- a/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_impl.cc +++ b/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_impl.cc
@@ -36,7 +36,8 @@ InitImpl(); } -scoped_refptr<WorkerTaskQueue> NonMainThreadSchedulerImpl::CreateTaskRunner() { +scoped_refptr<NonMainThreadTaskQueue> +NonMainThreadSchedulerImpl::CreateTaskRunner() { helper_->CheckOnValidThread(); return helper_->NewTaskQueue( base::sequence_manager::TaskQueue::Spec("worker_tq") @@ -94,7 +95,7 @@ scoped_refptr<base::SingleThreadTaskRunner> NonMainThreadSchedulerImpl::ControlTaskRunner() { - return helper_->ControlWorkerTaskQueue(); + return helper_->ControlNonMainThreadTaskQueue(); } void NonMainThreadSchedulerImpl::RegisterTimeDomain(
diff --git a/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_impl.h b/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_impl.h index f496b57..7536cf2 100644 --- a/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_impl.h +++ b/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_impl.h
@@ -13,11 +13,11 @@ #include "third_party/blink/public/platform/web_thread_type.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/scheduler/base/task_queue.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_task_queue.h" #include "third_party/blink/renderer/platform/scheduler/common/thread_scheduler_impl.h" #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/util/tracing_helper.h" #include "third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_helper.h" +#include "third_party/blink/renderer/platform/scheduler/worker/non_main_thread_task_queue.h" namespace blink { namespace scheduler { @@ -37,14 +37,14 @@ // Blink should use NonMainThreadSchedulerImpl::DefaultTaskQueue instead of // WebThreadScheduler::DefaultTaskRunner. - virtual scoped_refptr<WorkerTaskQueue> DefaultTaskQueue() = 0; + virtual scoped_refptr<NonMainThreadTaskQueue> DefaultTaskQueue() = 0; // Must be called before the scheduler can be used. Does any post construction // initialization needed such as initializing idle period detection. void Init(); virtual void OnTaskCompleted( - WorkerTaskQueue* worker_task_queue, + NonMainThreadTaskQueue* worker_task_queue, const base::sequence_manager::TaskQueue::Task& task, base::TimeTicks start, base::TimeTicks end, @@ -88,7 +88,7 @@ // // virtual void Shutdown(); - scoped_refptr<WorkerTaskQueue> CreateTaskRunner(); + scoped_refptr<NonMainThreadTaskQueue> CreateTaskRunner(); // TaskQueueThrottler might be null if throttling is not enabled or // not supported.
diff --git a/third_party/blink/renderer/platform/scheduler/child/worker_task_queue.cc b/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_task_queue.cc similarity index 79% rename from third_party/blink/renderer/platform/scheduler/child/worker_task_queue.cc rename to third_party/blink/renderer/platform/scheduler/worker/non_main_thread_task_queue.cc index 85a4a9ed..74274ac6 100644 --- a/third_party/blink/renderer/platform/scheduler/child/worker_task_queue.cc +++ b/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_task_queue.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 "third_party/blink/renderer/platform/scheduler/child/worker_task_queue.h" +#include "third_party/blink/renderer/platform/scheduler/worker/non_main_thread_task_queue.h" #include "third_party/blink/renderer/platform/scheduler/base/task_queue_impl.h" #include "third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_impl.h" @@ -12,7 +12,7 @@ using base::sequence_manager::TaskQueue; -WorkerTaskQueue::WorkerTaskQueue( +NonMainThreadTaskQueue::NonMainThreadTaskQueue( std::unique_ptr<base::sequence_manager::internal::TaskQueueImpl> impl, const TaskQueue::Spec& spec, NonMainThreadSchedulerImpl* non_main_thread_scheduler) @@ -21,13 +21,13 @@ if (GetTaskQueueImpl()) { // TaskQueueImpl may be null for tests. GetTaskQueueImpl()->SetOnTaskCompletedHandler(base::BindRepeating( - &WorkerTaskQueue::OnTaskCompleted, base::Unretained(this))); + &NonMainThreadTaskQueue::OnTaskCompleted, base::Unretained(this))); } } -WorkerTaskQueue::~WorkerTaskQueue() = default; +NonMainThreadTaskQueue::~NonMainThreadTaskQueue() = default; -void WorkerTaskQueue::OnTaskCompleted( +void NonMainThreadTaskQueue::OnTaskCompleted( const TaskQueue::Task& task, base::TimeTicks start, base::TimeTicks end,
diff --git a/third_party/blink/renderer/platform/scheduler/child/worker_task_queue.h b/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_task_queue.h similarity index 70% rename from third_party/blink/renderer/platform/scheduler/child/worker_task_queue.h rename to third_party/blink/renderer/platform/scheduler/worker/non_main_thread_task_queue.h index 8d1b8b1..7042124 100644 --- a/third_party/blink/renderer/platform/scheduler/child/worker_task_queue.h +++ b/third_party/blink/renderer/platform/scheduler/worker/non_main_thread_task_queue.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 THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_CHILD_WORKER_TASK_QUEUE_H_ -#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_CHILD_WORKER_TASK_QUEUE_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_WORKER_NON_MAIN_THREAD_TASK_QUEUE_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_WORKER_NON_MAIN_THREAD_TASK_QUEUE_H_ #include "third_party/blink/renderer/platform/scheduler/base/task_queue.h" @@ -12,14 +12,14 @@ class NonMainThreadSchedulerImpl; -class PLATFORM_EXPORT WorkerTaskQueue +class PLATFORM_EXPORT NonMainThreadTaskQueue : public base::sequence_manager::TaskQueue { public: - WorkerTaskQueue( + NonMainThreadTaskQueue( std::unique_ptr<base::sequence_manager::internal::TaskQueueImpl> impl, const Spec& spec, NonMainThreadSchedulerImpl* non_main_thread_scheduler); - ~WorkerTaskQueue() override; + ~NonMainThreadTaskQueue() override; void OnTaskCompleted(const base::sequence_manager::TaskQueue::Task& task, base::TimeTicks start, @@ -34,4 +34,4 @@ } // namespace scheduler } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_CHILD_WORKER_TASK_QUEUE_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_WORKER_NON_MAIN_THREAD_TASK_QUEUE_H_
diff --git a/third_party/blink/renderer/platform/scheduler/child/worker_metrics_helper.cc b/third_party/blink/renderer/platform/scheduler/worker/worker_metrics_helper.cc similarity index 94% rename from third_party/blink/renderer/platform/scheduler/child/worker_metrics_helper.cc rename to third_party/blink/renderer/platform/scheduler/worker/worker_metrics_helper.cc index 577c6287..b7c776b 100644 --- a/third_party/blink/renderer/platform/scheduler/child/worker_metrics_helper.cc +++ b/third_party/blink/renderer/platform/scheduler/worker/worker_metrics_helper.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 "third_party/blink/renderer/platform/scheduler/child/worker_metrics_helper.h" +#include "third_party/blink/renderer/platform/scheduler/worker/worker_metrics_helper.h" #include "third_party/blink/renderer/platform/scheduler/child/process_state.h" @@ -28,7 +28,7 @@ } void WorkerMetricsHelper::RecordTaskMetrics( - WorkerTaskQueue* queue, + NonMainThreadTaskQueue* queue, const base::sequence_manager::TaskQueue::Task& task, base::TimeTicks start_time, base::TimeTicks end_time,
diff --git a/third_party/blink/renderer/platform/scheduler/child/worker_metrics_helper.h b/third_party/blink/renderer/platform/scheduler/worker/worker_metrics_helper.h similarity index 75% rename from third_party/blink/renderer/platform/scheduler/child/worker_metrics_helper.h rename to third_party/blink/renderer/platform/scheduler/worker/worker_metrics_helper.h index 5b1cd73..7fbb2c4 100644 --- a/third_party/blink/renderer/platform/scheduler/child/worker_metrics_helper.h +++ b/third_party/blink/renderer/platform/scheduler/worker/worker_metrics_helper.h
@@ -2,14 +2,14 @@ // 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_SCHEDULER_CHILD_WORKER_METRICS_HELPER_H_ -#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_CHILD_WORKER_METRICS_HELPER_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_WORKER_WORKER_METRICS_HELPER_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_WORKER_WORKER_METRICS_HELPER_H_ #include "third_party/blink/public/platform/task_type.h" -#include "third_party/blink/renderer/platform/scheduler/child/metrics_helper.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_task_queue.h" +#include "third_party/blink/renderer/platform/scheduler/common/metrics_helper.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/frame_origin_type.h" #include "third_party/blink/renderer/platform/scheduler/util/thread_load_tracker.h" +#include "third_party/blink/renderer/platform/scheduler/worker/non_main_thread_task_queue.h" namespace blink { namespace scheduler { @@ -19,7 +19,7 @@ explicit WorkerMetricsHelper(WebThreadType thread_type); ~WorkerMetricsHelper(); - void RecordTaskMetrics(WorkerTaskQueue* queue, + void RecordTaskMetrics(NonMainThreadTaskQueue* queue, const base::sequence_manager::TaskQueue::Task& task, base::TimeTicks start_time, base::TimeTicks end_time, @@ -45,4 +45,4 @@ } // namespace scheduler } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_CHILD_WORKER_METRICS_HELPER_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_WORKER_WORKER_METRICS_HELPER_H_
diff --git a/third_party/blink/renderer/platform/scheduler/child/worker_scheduler.cc b/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler.cc similarity index 96% rename from third_party/blink/renderer/platform/scheduler/child/worker_scheduler.cc rename to third_party/blink/renderer/platform/scheduler/worker/worker_scheduler.cc index f115585f4..e4cdd0c 100644 --- a/third_party/blink/renderer/platform/scheduler/child/worker_scheduler.cc +++ b/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler.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 "third_party/blink/renderer/platform/scheduler/child/worker_scheduler.h" +#include "third_party/blink/renderer/platform/scheduler/public/worker_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/child/task_queue_with_task_type.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy.h" #include "third_party/blink/renderer/platform/scheduler/common/throttling/task_queue_throttler.h" #include "third_party/blink/renderer/platform/scheduler/common/throttling/wake_up_budget_pool.h" +#include "third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy.h" #include "third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy.cc b/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy.cc similarity index 91% rename from third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy.cc rename to third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy.cc index 9a3f273..d0818376 100644 --- a/third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy.cc +++ b/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy.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 "third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy.h" +#include "third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.h" +#include "third_party/blink/renderer/platform/scheduler/public/worker_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy.h b/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy.h similarity index 90% rename from third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy.h rename to third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy.h index ec629dc..721ccaa6 100644 --- a/third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy.h +++ b/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy.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 THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_CHILD_WORKER_SCHEDULER_PROXY_H_ -#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_CHILD_WORKER_SCHEDULER_PROXY_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_WORKER_WORKER_SCHEDULER_PROXY_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_WORKER_WORKER_SCHEDULER_PROXY_H_ #include "base/macros.h" #include "base/memory/ref_counted.h" @@ -78,4 +78,4 @@ } // namespace scheduler } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_CHILD_WORKER_SCHEDULER_PROXY_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_WORKER_WORKER_SCHEDULER_PROXY_H_
diff --git a/third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy_unittest.cc b/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy_unittest.cc similarity index 97% rename from third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy_unittest.cc rename to third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy_unittest.cc index 87df4001..a4cb7a2 100644 --- a/third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy_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 "third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy.h" +#include "third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy.h" #include "base/run_loop.h" #include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" @@ -10,10 +10,10 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/scheduler/base/test/task_queue_manager_for_test.h" #include "third_party/blink/renderer/platform/scheduler/child/webthread_impl_for_worker_scheduler.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/page_scheduler_impl.h" +#include "third_party/blink/renderer/platform/scheduler/public/worker_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler.h" #include "third_party/blink/renderer/platform/waitable_event.h"
diff --git a/third_party/blink/renderer/platform/scheduler/child/worker_scheduler_unittest.cc b/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_unittest.cc similarity index 98% rename from third_party/blink/renderer/platform/scheduler/child/worker_scheduler_unittest.cc rename to third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_unittest.cc index da54a89d..3f61ff6a 100644 --- a/third_party/blink/renderer/platform/scheduler/child/worker_scheduler_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_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 "third_party/blink/renderer/platform/scheduler/child/worker_scheduler.h" +#include "third_party/blink/renderer/platform/scheduler/public/worker_scheduler.h" #include <memory> #include "base/macros.h"
diff --git a/third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler.cc b/third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler.cc index 3dd49da0..93a0a69d 100644 --- a/third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler.cc +++ b/third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler.cc
@@ -19,10 +19,10 @@ #include "third_party/blink/renderer/platform/scheduler/child/default_params.h" #include "third_party/blink/renderer/platform/scheduler/child/features.h" #include "third_party/blink/renderer/platform/scheduler/child/task_queue_with_task_type.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_scheduler.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_scheduler_proxy.h" #include "third_party/blink/renderer/platform/scheduler/common/throttling/task_queue_throttler.h" +#include "third_party/blink/renderer/platform/scheduler/public/worker_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_helper.h" +#include "third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy.h" namespace blink { namespace scheduler { @@ -124,7 +124,7 @@ : FrameScheduler::ThrottlingState::kNotThrottled), worker_metrics_helper_(thread_type), default_task_runner_(TaskQueueWithTaskType::Create( - helper_->DefaultWorkerTaskQueue(), + helper_->DefaultNonMainThreadTaskQueue(), TaskType::kWorkerThreadTaskQueueDefault)) { thread_start_time_ = helper_->NowTicks(); load_tracker_.Resume(thread_start_time_); @@ -215,9 +215,10 @@ helper_->Shutdown(); } -scoped_refptr<WorkerTaskQueue> WorkerThreadScheduler::DefaultTaskQueue() { +scoped_refptr<NonMainThreadTaskQueue> +WorkerThreadScheduler::DefaultTaskQueue() { DCHECK(initialized_); - return helper_->DefaultWorkerTaskQueue(); + return helper_->DefaultNonMainThreadTaskQueue(); } void WorkerThreadScheduler::InitImpl() { @@ -231,7 +232,7 @@ } void WorkerThreadScheduler::OnTaskCompleted( - WorkerTaskQueue* worker_task_queue, + NonMainThreadTaskQueue* worker_task_queue, const TaskQueue::Task& task, base::TimeTicks start, base::TimeTicks end, @@ -284,8 +285,9 @@ worker_scheduler->OnThrottlingStateChanged(throttling_state_); } -scoped_refptr<WorkerTaskQueue> WorkerThreadScheduler::ControlTaskQueue() { - return helper_->ControlWorkerTaskQueue(); +scoped_refptr<NonMainThreadTaskQueue> +WorkerThreadScheduler::ControlTaskQueue() { + return helper_->ControlNonMainThreadTaskQueue(); } void WorkerThreadScheduler::CreateTaskQueueThrottler() {
diff --git a/third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler.h b/third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler.h index d423ca9d6..2d3a5a6e 100644 --- a/third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler.h +++ b/third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler.h
@@ -12,11 +12,11 @@ #include "third_party/blink/renderer/platform/scheduler/base/task_time_observer.h" #include "third_party/blink/renderer/platform/scheduler/child/idle_canceled_delayed_task_sweeper.h" #include "third_party/blink/renderer/platform/scheduler/child/idle_helper.h" -#include "third_party/blink/renderer/platform/scheduler/child/worker_metrics_helper.h" #include "third_party/blink/renderer/platform/scheduler/public/frame_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/util/task_duration_metric_reporter.h" #include "third_party/blink/renderer/platform/scheduler/util/thread_load_tracker.h" #include "third_party/blink/renderer/platform/scheduler/worker/non_main_thread_scheduler_impl.h" +#include "third_party/blink/renderer/platform/scheduler/worker/worker_metrics_helper.h" namespace base { namespace sequence_manager { @@ -55,8 +55,8 @@ void Shutdown() override; // NonMainThreadSchedulerImpl implementation: - scoped_refptr<WorkerTaskQueue> DefaultTaskQueue() override; - void OnTaskCompleted(WorkerTaskQueue* worker_task_queue, + scoped_refptr<NonMainThreadTaskQueue> DefaultTaskQueue() override; + void OnTaskCompleted(NonMainThreadTaskQueue* worker_task_queue, const base::sequence_manager::TaskQueue::Task& task, base::TimeTicks start, base::TimeTicks end, @@ -82,7 +82,7 @@ // Returns the control task queue. Tasks posted to this queue are executed // with the highest priority. Care must be taken to avoid starvation of other // task queues. - scoped_refptr<WorkerTaskQueue> ControlTaskQueue(); + scoped_refptr<NonMainThreadTaskQueue> ControlTaskQueue(); protected: // NonMainThreadScheduler implementation: @@ -109,7 +109,7 @@ ThreadLoadTracker load_tracker_; bool initialized_; base::TimeTicks thread_start_time_; - scoped_refptr<WorkerTaskQueue> control_task_queue_; + scoped_refptr<NonMainThreadTaskQueue> control_task_queue_; scoped_refptr<base::SingleThreadTaskRunner> v8_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; FrameScheduler::ThrottlingState throttling_state_;
diff --git a/third_party/blink/renderer/platform/testing/paint_property_test_helpers.h b/third_party/blink/renderer/platform/testing/paint_property_test_helpers.h index 945dbf1..5d852e9 100644 --- a/third_party/blink/renderer/platform/testing/paint_property_test_helpers.h +++ b/third_party/blink/renderer/platform/testing/paint_property_test_helpers.h
@@ -23,7 +23,7 @@ return EffectPaintPropertyNode::Root(); } -inline std::unique_ptr<EffectPaintPropertyNode> CreateOpacityEffect( +inline scoped_refptr<EffectPaintPropertyNode> CreateOpacityEffect( const EffectPaintPropertyNode& parent, const TransformPaintPropertyNode* local_transform_space, const ClipPaintPropertyNode* output_clip, @@ -37,7 +37,7 @@ return EffectPaintPropertyNode::Create(parent, std::move(state)); } -inline std::unique_ptr<EffectPaintPropertyNode> CreateOpacityEffect( +inline scoped_refptr<EffectPaintPropertyNode> CreateOpacityEffect( const EffectPaintPropertyNode& parent, float opacity, CompositingReasons compositing_reasons = CompositingReason::kNone) { @@ -45,7 +45,7 @@ parent.OutputClip(), opacity, compositing_reasons); } -inline std::unique_ptr<EffectPaintPropertyNode> CreateFilterEffect( +inline scoped_refptr<EffectPaintPropertyNode> CreateFilterEffect( const EffectPaintPropertyNode& parent, const TransformPaintPropertyNode* local_transform_space, const ClipPaintPropertyNode* output_clip, @@ -61,7 +61,7 @@ return EffectPaintPropertyNode::Create(parent, std::move(state)); } -inline std::unique_ptr<EffectPaintPropertyNode> CreateFilterEffect( +inline scoped_refptr<EffectPaintPropertyNode> CreateFilterEffect( const EffectPaintPropertyNode& parent, CompositorFilterOperations filter, const FloatPoint& paint_offset = FloatPoint(), @@ -71,7 +71,7 @@ compositing_reasons); } -inline std::unique_ptr<ClipPaintPropertyNode> CreateClip( +inline scoped_refptr<ClipPaintPropertyNode> CreateClip( const ClipPaintPropertyNode& parent, const TransformPaintPropertyNode* local_transform_space, const FloatRoundedRect& clip_rect, @@ -83,7 +83,7 @@ return ClipPaintPropertyNode::Create(parent, std::move(state)); } -inline std::unique_ptr<ClipPaintPropertyNode> CreateClipPathClip( +inline scoped_refptr<ClipPaintPropertyNode> CreateClipPathClip( const ClipPaintPropertyNode& parent, const TransformPaintPropertyNode* local_transform_space, const FloatRoundedRect& clip_rect) { @@ -94,7 +94,7 @@ return ClipPaintPropertyNode::Create(parent, std::move(state)); } -inline std::unique_ptr<TransformPaintPropertyNode> CreateTransform( +inline scoped_refptr<TransformPaintPropertyNode> CreateTransform( const TransformPaintPropertyNode& parent, const TransformationMatrix& matrix, const FloatPoint3D& origin = FloatPoint3D(), @@ -106,7 +106,7 @@ return TransformPaintPropertyNode::Create(parent, std::move(state)); } -inline std::unique_ptr<TransformPaintPropertyNode> CreateScrollTranslation( +inline scoped_refptr<TransformPaintPropertyNode> CreateScrollTranslation( const TransformPaintPropertyNode& parent, float offset_x, float offset_y,
diff --git a/third_party/blink/renderer/platform/wtf/math_extras.h b/third_party/blink/renderer/platform/wtf/math_extras.h index ac4a6f32..c090e11 100644 --- a/third_party/blink/renderer/platform/wtf/math_extras.h +++ b/third_party/blink/renderer/platform/wtf/math_extras.h
@@ -337,31 +337,4 @@ return a && b ? a / greatestCommonDivisor(a, b) * b : 0; } -// Calculate d % 2^{64}. -inline void doubleToInteger(double d, unsigned long long& value) { - if (std::isnan(d) || std::isinf(d)) { - value = 0; - } else { - // -2^{64} < fmodValue < 2^{64}. - double fmodValue = - fmod(trunc(d), std::numeric_limits<unsigned long long>::max() + 1.0); - if (fmodValue >= 0) { - // 0 <= fmodValue < 2^{64}. - // 0 <= value < 2^{64}. This cast causes no loss. - value = static_cast<unsigned long long>(fmodValue); - } else { - // -2^{64} < fmodValue < 0. - // 0 < fmodValueInUnsignedLongLong < 2^{64}. This cast causes no loss. - unsigned long long fmodValueInUnsignedLongLong = - static_cast<unsigned long long>(-fmodValue); - // -1 < (std::numeric_limits<unsigned long long>::max() - - // fmodValueInUnsignedLongLong) - // < 2^{64} - 1. - // 0 < value < 2^{64}. - value = std::numeric_limits<unsigned long long>::max() - - fmodValueInUnsignedLongLong + 1; - } - } -} - #endif // #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_MATH_EXTRAS_H_
diff --git a/third_party/blink/renderer/platform/wtf/threading_primitives.h b/third_party/blink/renderer/platform/wtf/threading_primitives.h index 12c24ab..f112896 100644 --- a/third_party/blink/renderer/platform/wtf/threading_primitives.h +++ b/third_party/blink/renderer/platform/wtf/threading_primitives.h
@@ -161,14 +161,6 @@ DISALLOW_COPY_AND_ASSIGN(ThreadCondition); }; -#if defined(OS_WIN) -// The absoluteTime is in seconds, starting on January 1, 1970. The time is -// assumed to use the same time zone as WTF::currentTime(). -// Returns an interval in milliseconds suitable for passing to one of the Win32 -// wait functions (e.g., ::WaitForSingleObject). -DWORD AbsoluteTimeToWaitTimeoutInterval(double absolute_time); -#endif - } // namespace WTF using WTF::MutexBase; @@ -179,8 +171,4 @@ using WTF::RecursiveMutexLocker; using WTF::ThreadCondition; -#if defined(OS_WIN) -using WTF::AbsoluteTimeToWaitTimeoutInterval; -#endif - #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_THREADING_PRIMITIVES_H_
diff --git a/third_party/blink/renderer/platform/wtf/threading_win.cc b/third_party/blink/renderer/platform/wtf/threading_win.cc index 76bef7f..09cc847 100644 --- a/third_party/blink/renderer/platform/wtf/threading_win.cc +++ b/third_party/blink/renderer/platform/wtf/threading_win.cc
@@ -255,14 +255,22 @@ } bool ThreadCondition::TimedWait(Mutex& mutex, double absolute_time) { - DWORD interval = AbsoluteTimeToWaitTimeoutInterval(absolute_time); + double current_time = WTF::CurrentTime(); - if (!interval) { + // Time is in the past - return immediately. + if (absolute_time <= current_time) { // Consider the wait to have timed out, even if our condition has already // been signaled, to match the pthreads implementation. return false; } + // If time is too far in the future (and would overflow unsigned long), wait + // forever. + DWORD interval = + (absolute_time - current_time > static_cast<double>(INT_MAX) / 1000.0) + ? INFINITE + : ((absolute_time - current_time) * 1000.0); + PlatformMutex& platform_mutex = mutex.Impl(); BOOL result = SleepConditionVariableCS( &condition_, &platform_mutex.internal_mutex_, interval); @@ -279,21 +287,6 @@ WakeAllConditionVariable(&condition_); } -DWORD AbsoluteTimeToWaitTimeoutInterval(double absolute_time) { - double current_time = WTF::CurrentTime(); - - // Time is in the past - return immediately. - if (absolute_time < current_time) - return 0; - - // Time is too far in the future (and would overflow unsigned long) - wait - // forever. - if (absolute_time - current_time > static_cast<double>(INT_MAX) / 1000.0) - return INFINITE; - - return static_cast<DWORD>((absolute_time - current_time) * 1000.0); -} - #if DCHECK_IS_ON() static bool g_thread_created = false;
diff --git a/tools/clang/blink_gc_plugin/RecordInfo.cpp b/tools/clang/blink_gc_plugin/RecordInfo.cpp index 5f4f7ca4..dc4349f 100644 --- a/tools/clang/blink_gc_plugin/RecordInfo.cpp +++ b/tools/clang/blink_gc_plugin/RecordInfo.cpp
@@ -78,6 +78,35 @@ return Config::IsGCCollection(name_); } +bool RecordInfo::HasOptionalFinalizer() { + if (!IsHeapAllocatedCollection()) + return false; + // Heap collections may have a finalizer but it is optional (i.e. may be + // delayed until FinalizeGarbageCollectedObject() gets called), unless there + // is an inline buffer. Vector, Deque, and ListHashSet can have an inline + // buffer. + if (name_ != "Vector" && name_ != "Deque" && name_ != "ListHashSet" && + name_ != "HeapVector" && name_ != "HeapDeque" && + name_ != "HeapListHashSet") + return true; + ClassTemplateSpecializationDecl* tmpl = + dyn_cast<ClassTemplateSpecializationDecl>(record_); + // These collections require template specialization so tmpl should always be + // non-null for valid code. + if (!tmpl) + return false; + const TemplateArgumentList& args = tmpl->getTemplateArgs(); + if (args.size() < 2) + return true; + TemplateArgument arg = args[1]; + // The second template argument must be void or 0 so there is no inline + // buffer. + return (arg.getKind() == TemplateArgument::Type && + arg.getAsType()->isVoidType()) || + (arg.getKind() == TemplateArgument::Integral && + arg.getAsIntegral().getExtValue() == 0); +} + // Test if a record is derived from a garbage collected base. bool RecordInfo::IsGCDerived() { // If already computed, return the known result. @@ -579,6 +608,11 @@ // TODO: Add classes with a finalize() method that specialize FinalizerTrait. bool RecordInfo::NeedsFinalization() { if (does_need_finalization_ == kNotComputed) { + if (HasOptionalFinalizer()) { + does_need_finalization_ = kFalse; + return does_need_finalization_; + } + // Rely on hasNonTrivialDestructor(), but if the only // identifiable reason for it being true is the presence // of a safely ignorable class as a direct base,
diff --git a/tools/clang/blink_gc_plugin/RecordInfo.h b/tools/clang/blink_gc_plugin/RecordInfo.h index 8ec92ec..f241de8 100644 --- a/tools/clang/blink_gc_plugin/RecordInfo.h +++ b/tools/clang/blink_gc_plugin/RecordInfo.h
@@ -150,6 +150,8 @@ Edge* CreateEdge(const clang::Type* type); Edge* CreateEdgeFromOriginalType(const clang::Type* type); + bool HasOptionalFinalizer(); + RecordCache* cache_; clang::CXXRecordDecl* record_; const std::string name_;
diff --git a/tools/clang/blink_gc_plugin/tests/class_requires_finalization_field.cpp b/tools/clang/blink_gc_plugin/tests/class_requires_finalization_field.cpp index 7b8ac0a..25b4acb 100644 --- a/tools/clang/blink_gc_plugin/tests/class_requires_finalization_field.cpp +++ b/tools/clang/blink_gc_plugin/tests/class_requires_finalization_field.cpp
@@ -24,11 +24,4 @@ A::Trace(visitor); } -void AlsoDoesNotNeedFinalizer::Trace(Visitor* visitor) -{ - visitor->Trace(m_as); - visitor->Trace(m_cs); - A::Trace(visitor); -} - }
diff --git a/tools/clang/blink_gc_plugin/tests/class_requires_finalization_field.h b/tools/clang/blink_gc_plugin/tests/class_requires_finalization_field.h index a585f3f..f627394 100644 --- a/tools/clang/blink_gc_plugin/tests/class_requires_finalization_field.h +++ b/tools/clang/blink_gc_plugin/tests/class_requires_finalization_field.h
@@ -29,15 +29,6 @@ } // blink namespace -namespace WTF { - -template<> -struct VectorTraits<blink::C> { - static const bool needsDestruction = false; -}; - -} // WTF namespace - namespace blink { // Off-heap vectors always need to be finalized. @@ -65,16 +56,6 @@ HeapVector<B> m_bs; }; -// On-heap vectors with inlined objects that don't need destruction -// don't need to be finalized. -class AlsoDoesNotNeedFinalizer : public A { -public: - void Trace(Visitor*); -private: - HeapVector<Member<A>, 10> m_as; - HeapVector<C, 10> m_cs; -}; - } #endif
diff --git a/tools/clang/blink_gc_plugin/tests/class_requires_finalization_field.txt b/tools/clang/blink_gc_plugin/tests/class_requires_finalization_field.txt index 9e37c46..8fc15a1 100644 --- a/tools/clang/blink_gc_plugin/tests/class_requires_finalization_field.txt +++ b/tools/clang/blink_gc_plugin/tests/class_requires_finalization_field.txt
@@ -1,14 +1,8 @@ In file included from class_requires_finalization_field.cpp:5: -./class_requires_finalization_field.h:44:1: warning: [blink-gc] Class 'NeedsFinalizer' requires finalization. +./class_requires_finalization_field.h:35:1: warning: [blink-gc] Class 'NeedsFinalizer' requires finalization. class NeedsFinalizer : public A { ^ -./class_requires_finalization_field.h:48:5: note: [blink-gc] Field 'm_as' requiring finalization declared here: +./class_requires_finalization_field.h:39:5: note: [blink-gc] Field 'm_as' requiring finalization declared here: Vector<Member<A> > m_as; ^ -./class_requires_finalization_field.h:53:1: warning: [blink-gc] Class 'AlsoNeedsFinalizer' requires finalization. -class AlsoNeedsFinalizer : public A { -^ -./class_requires_finalization_field.h:57:5: note: [blink-gc] Field 'm_bs' requiring finalization declared here: - HeapVector<B, 10> m_bs; - ^ -2 warnings generated. +1 warning generated.
diff --git a/tools/clang/blink_gc_plugin/tests/heap/stubs.h b/tools/clang/blink_gc_plugin/tests/heap/stubs.h index 735af486..c77369d 100644 --- a/tools/clang/blink_gc_plugin/tests/heap/stubs.h +++ b/tools/clang/blink_gc_plugin/tests/heap/stubs.h
@@ -37,30 +37,19 @@ static const bool isGarbageCollected = false; }; -template<typename T> -struct VectorTraits { - static const bool needsDestruction = true; +template <bool noDestructor> +class ConditionalDestructor { + public: + ~ConditionalDestructor() {} }; -template<size_t inlineCapacity, bool isGarbageCollected, bool tNeedsDestruction> -class VectorDestructorBase { -public: - ~VectorDestructorBase() {} -}; +template <> +class ConditionalDestructor<true> {}; -template<size_t inlineCapacity> -class VectorDestructorBase<inlineCapacity, true, false> {}; - -template<> -class VectorDestructorBase<0, true, true> {}; - -template< - typename T, - size_t inlineCapacity = 0, - typename Allocator = DefaultAllocator> -class Vector : public VectorDestructorBase<inlineCapacity, - Allocator::isGarbageCollected, - VectorTraits<T>::needsDestruction> { +template <typename T, + size_t inlineCapacity = 0, + typename Allocator = DefaultAllocator> +class Vector : public ConditionalDestructor<Allocator::isGarbageCollected> { public: using iterator = T*; using const_iterator = const T*; @@ -74,7 +63,7 @@ template <typename T, size_t inlineCapacity = 0, typename Allocator = DefaultAllocator> -class Deque { +class Deque : public ConditionalDestructor<Allocator::isGarbageCollected> { public: using iterator = T*; using const_iterator = const T*; @@ -86,7 +75,7 @@ typename HashArg = void, typename TraitsArg = void, typename Allocator = DefaultAllocator> -class HashSet { +class HashSet : public ConditionalDestructor<Allocator::isGarbageCollected> { public: typedef ValueArg* iterator; typedef const ValueArg* const_iterator; @@ -98,7 +87,8 @@ typename HashArg = void, typename TraitsArg = void, typename Allocator = DefaultAllocator> -class ListHashSet { +class ListHashSet + : public ConditionalDestructor<Allocator::isGarbageCollected> { public: typedef ValueArg* iterator; typedef const ValueArg* const_iterator; @@ -110,7 +100,8 @@ typename HashArg = void, typename TraitsArg = void, typename Allocator = DefaultAllocator> -class LinkedHashSet { +class LinkedHashSet + : public ConditionalDestructor<Allocator::isGarbageCollected> { public: typedef ValueArg* iterator; typedef const ValueArg* const_iterator; @@ -118,12 +109,12 @@ typedef const ValueArg* const_reverse_iterator; }; -template< - typename ValueArg, - typename HashArg = void, - typename TraitsArg = void, - typename Allocator = DefaultAllocator> -class HashCountedSet {}; +template <typename ValueArg, + typename HashArg = void, + typename TraitsArg = void, + typename Allocator = DefaultAllocator> +class HashCountedSet + : public ConditionalDestructor<Allocator::isGarbageCollected> {}; template <typename KeyArg, typename MappedArg, @@ -131,7 +122,7 @@ typename KeyTraitsArg = void, typename MappedTraitsArg = void, typename Allocator = DefaultAllocator> -class HashMap { +class HashMap : public ConditionalDestructor<Allocator::isGarbageCollected> { public: typedef MappedArg* iterator; typedef const MappedArg* const_iterator; @@ -320,13 +311,4 @@ }; } -namespace WTF { - -template<typename T> -struct VectorTraits<blink::Member<T> > { - static const bool needsDestruction = false; -}; - -} - #endif
diff --git a/tools/clang/blink_gc_plugin/tests/stack_allocated.txt b/tools/clang/blink_gc_plugin/tests/stack_allocated.txt index 0fbb42f..be40b444 100644 --- a/tools/clang/blink_gc_plugin/tests/stack_allocated.txt +++ b/tools/clang/blink_gc_plugin/tests/stack_allocated.txt
@@ -23,7 +23,7 @@ ./stack_allocated.h:43:3: warning: [blink-gc] Garbage collected class 'DerivedHeapObject2' is not permitted to override its new operator. STACK_ALLOCATED(); ^ -./heap/stubs.h:188:5: note: expanded from macro 'STACK_ALLOCATED' +./heap/stubs.h:179:5: note: expanded from macro 'STACK_ALLOCATED' __attribute__((annotate("blink_stack_allocated"))) \ ^ stack_allocated.cpp:12:1: warning: [blink-gc] Class 'AnonStackObject' contains invalid fields.
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 2667b76..67c91ed 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -16257,6 +16257,24 @@ <int value="3" label="Unfused; lot ID NZVR7"/> </enum> +<enum name="FactoryPingEmbargoEndDateValidity"> + <summary> + Defines the validity of the factory ping embargo end date in RW_VPD. + </summary> + <int value="0" label="Malformed"> + The value does not have a correct format. + </int> + <int value="1" label="Invalid"> + The value has a correct format, but it is semantically invalid. This means + that it is more than 14 days in the future. + </int> + <int value="2" label="Valid"> + The value is present and valid. This could either mean that the device is in + the factory ping embargo period, or that the factory ping embargo period has + passed. + </int> +</enum> + <enum name="FallbackDNSTestResult"> <int value="0" label="Success"/> <int value="1" label="Failure"/> @@ -44473,6 +44491,7 @@ <int value="38" label="Reading List"/> <int value="39" label="User Events"/> <int value="40" label="Mountain Shares"/> + <int value="41" label="User Consents"/> </enum> <enum name="SyncModelTypeStoreInitResult">
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 1bd1420a..4f34058 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -28817,6 +28817,17 @@ </summary> </histogram> +<histogram name="FactoryPingEmbargo.EndDateValidity" + enum="FactoryPingEmbargoEndDateValidity"> + <owner>pmarko@chromium.org</owner> + <owner>rogerta@chromium.org</owner> + <summary> + Record the validity of |rlz_embargo_end_date| in RW_VPD. This is recorded + when the VPD value is accessed, which may be multiple times in the same + chrome invocation. This is not recorded when the VPD value is missing. + </summary> +</histogram> + <histogram name="FaultTolerantHeap" enum="FaultTolerantHeap"> <owner>brucedawson@chromium.org</owner> <summary> @@ -29085,6 +29096,16 @@ </summary> </histogram> +<histogram name="FileBrowser.MountCrostiniContainer" units="ms" + expires_after="2019-05-30"> + <owner>joelhockey@google.com</owner> + <owner>sashab@google.com</owner> + <summary> + Chrome OS File Browser: time to start and mount the crostini container in + order to show Linux Files. + </summary> +</histogram> + <histogram name="FileBrowser.OpenFiles.RootType" enum="FileManagerRootType"> <owner>fukino@chromium.org</owner> <summary> @@ -121662,6 +121683,7 @@ label="SYNCED_NOTIFICATION_APP_INFO"/> <suffix name="THEME" label="THEME"/> <suffix name="TYPED_URL" label="TYPED_URL"/> + <suffix name="USER_CONSENT" label="USER_CONSENT"/> <suffix name="USER_EVENT" label="USER_EVENT"/> <suffix name="WIFI_CREDENTIAL" label="WIFI_CREDENTIAL"/> <affected-histogram name="Sync.ModelTypeCount"/>
diff --git a/tools/metrics/ukm/ukm.xml b/tools/metrics/ukm/ukm.xml index be86def..9049c14 100644 --- a/tools/metrics/ukm/ukm.xml +++ b/tools/metrics/ukm/ukm.xml
@@ -3639,6 +3639,13 @@ </metric> </event> +<event name="TrustedWebActivity.Open" singular="True"> + <owner>peconn@chromium.org</owner> + <summary> + Collected when a page is opened in a Trusted Web Activity. + </summary> +</event> + <event name="UserActivity"> <owner>jiameng@chromium.org</owner> <summary>
diff --git a/ui/accelerated_widget_mac/ca_transaction_observer.h b/ui/accelerated_widget_mac/ca_transaction_observer.h index d3e0a2dd..955b469 100644 --- a/ui/accelerated_widget_mac/ca_transaction_observer.h +++ b/ui/accelerated_widget_mac/ca_transaction_observer.h
@@ -19,6 +19,30 @@ namespace ui { +// CATransactionCoordinator is an interface to undocumented macOS APIs which +// run callbacks at different stages of committing a CATransaction to the +// window server. There is no guarantee that it will call registered observers +// at all: it does nothing on macOS older than 10.11. +// +// - Pre-commit: After all outstanding CATransactions have committed and after +// layout, but before the new layer tree has been sent to the window server. +// Safe to block here waiting for drawing/layout in other processes (but +// you're on the main thread, so be reasonable). +// +// - Post-commit: After the new layer tree has been sent to the server but +// before the transaction has been finalized. In post-commit, the screen area +// occupied by the window and its shadow are frozen, so it's important to +// block as briefly as possible (well under a frame) or else artifacts will +// be visible around affected windows if screen content is changing behind +// them (think resizing a browser window while a video plays in a second +// window behind it). This is a great place to call -[CATransaction commit] +// (or otherwise flush pending changes to the screen) in other processes, +// because their updates will appear atomically. +// +// It has been observed that committing a CATransaction in the GPU process +// which changes which IOSurfaces are assigned to layers' contents is *faster* +// if done during the browser's post-commit phase vs. its pre-commit phase. + class ACCELERATED_WIDGET_MAC_EXPORT CATransactionCoordinator { public: class PreCommitObserver { @@ -36,7 +60,10 @@ static CATransactionCoordinator& Get(); - void Synchronize(); + void Synchronize() { + if (@available(macos 10.11, *)) + SynchronizeImpl(); + } void AddPreCommitObserver(PreCommitObserver*); void RemovePreCommitObserver(PreCommitObserver*); @@ -49,6 +76,9 @@ CATransactionCoordinator(); ~CATransactionCoordinator(); + API_AVAILABLE(macos(10.11)) + void SynchronizeImpl(); + bool active_ = false; base::ObserverList<PreCommitObserver> pre_commit_observers_; base::ObserverList<PostCommitObserver> post_commit_observers_;
diff --git a/ui/accelerated_widget_mac/ca_transaction_observer.mm b/ui/accelerated_widget_mac/ca_transaction_observer.mm index d48ce87..d24de62 100644 --- a/ui/accelerated_widget_mac/ca_transaction_observer.mm +++ b/ui/accelerated_widget_mac/ca_transaction_observer.mm
@@ -16,6 +16,7 @@ kCATransactionPhasePostCommit, } CATransactionPhase; +API_AVAILABLE(macos(10.11)) @interface CATransaction () + (void)addCommitHandler:(void (^)(void))block forPhase:(CATransactionPhase)phase; @@ -32,7 +33,7 @@ return *instance; } -void CATransactionCoordinator::Synchronize() { +void CATransactionCoordinator::SynchronizeImpl() { if (active_) return; active_ = true;
diff --git a/ui/file_manager/file_manager/foreground/js/directory_contents.js b/ui/file_manager/file_manager/foreground/js/directory_contents.js index 3216c76..53de727 100644 --- a/ui/file_manager/file_manager/foreground/js/directory_contents.js +++ b/ui/file_manager/file_manager/foreground/js/directory_contents.js
@@ -345,6 +345,7 @@ */ CrostiniMounter.prototype.scan = function( entriesCallback, successCallback, errorCallback) { + metrics.startInterval('MountCrostiniContainer'); chrome.fileManagerPrivate.mountCrostiniContainer(() => { if (chrome.runtime.lastError) { console.error( @@ -354,6 +355,7 @@ chrome.runtime.lastError.message)); return; } + metrics.recordInterval('MountCrostiniContainer'); successCallback(); }); }; @@ -383,7 +385,7 @@ /** * @param {string} name Filter identifier. - * @param {function(Entry)} callback A filter — a function receiving an Entry, + * @param {function(Entry)} callback A filter - a function receiving an Entry, * and returning bool. */ FileFilter.prototype.addFilter = function(name, callback) {
diff --git a/ui/file_manager/file_manager/test/js/chrome_api_test_impl.js b/ui/file_manager/file_manager/test/js/chrome_api_test_impl.js index e45357c..60360af 100644 --- a/ui/file_manager/file_manager/test/js/chrome_api_test_impl.js +++ b/ui/file_manager/file_manager/test/js/chrome_api_test_impl.js
@@ -70,15 +70,18 @@ metricsPrivate: { userActions_: [], + times_: [], MetricTypeType: { HISTOGRAM_LINEAR: 'histogram-linear', }, recordMediumCount: () => {}, recordPercentage: () => {}, recordSmallCount: () => {}, - recordTime: () => {}, - recordUserAction: (action) => { - chrome.metricsPrivate.userActions_.push(action); + recordTime: function(metricName, value) { + this.times_.push([metricName, value]); + }, + recordUserAction: function(action) { + this.userActions_.push(action); }, recordValue: () => {}, },
diff --git a/ui/keyboard/resources/inputview_adapter.js b/ui/keyboard/resources/inputview_adapter.js index eedf564..d030a61 100644 --- a/ui/keyboard/resources/inputview_adapter.js +++ b/ui/keyboard/resources/inputview_adapter.js
@@ -359,13 +359,8 @@ else defaultSendMessage(message); }); - - registerFunction('chrome.runtime.setContainerMode', function(mode, callback) { - chrome.virtualKeyboardPrivate.setMode(mode, callback); - }); } - registerFunction('chrome.runtime.getBackgroundPage', function() { var callback = arguments[0]; callback(); @@ -380,7 +375,6 @@ } } - /** * Trigger loading the virtual keyboard on completion of page load. */