diff --git a/DEPS b/DEPS index 9c2de55e..a4a422b 100644 --- a/DEPS +++ b/DEPS
@@ -126,11 +126,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '60ea40c210490f10871c8f7305472f8140a04c77', + 'skia_revision': '66f09a72995a761bb9bde11b0e378ce84b84bae9', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': 'd8d2ae289beb851e316e010c2d6c73bea93b5e2e', + 'v8_revision': '91594a65bbcc29d1691d68ec8273dd01f3bb7341', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -138,7 +138,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': 'd3fac74a236e5acc44e4f35372f7214eec0c5f16', + 'angle_revision': '983e446921946734fe47217c345a8fe2f079319d', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -146,7 +146,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': 'faee4b7be598c7cb43d8a9d3231cf2b2d5ca7b2c', + 'pdfium_revision': 'bff397d7343e011bb3033404440fbe8cd537e560', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling openmax_dl # and whatever else without interference from each other. @@ -189,7 +189,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '40bc713e023fd5bade417b9d93d027b61712f684', + 'catapult_revision': 'ed0a2fef2475995b6f3c3e62cc98313465f8b296', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -732,7 +732,7 @@ # Build tools for Chrome OS. Note: This depends on third_party/pyelftools. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '7073bb3d53887a693b1fec50a91a4a6bc1460298', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '9a7a9053e8f7f5a6eea2ccaa7964732ba95ef642', 'condition': 'checkout_linux', }, @@ -747,7 +747,7 @@ # For Linux and Chromium OS. 'src/third_party/cros_system_api': { - 'url': Var('chromium_git') + '/chromiumos/platform2/system_api.git' + '@' + '3cf556ebeb2d5e152cefb8ccee3754c87c2fb5ee', + 'url': Var('chromium_git') + '/chromiumos/platform2/system_api.git' + '@' + '5949b3349dedf7558fd3dbca0c2d9e3e04aed039', 'condition': 'checkout_linux', }, @@ -757,7 +757,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '5a525870308e2b51d53bfd4d78236a3c03f464d0', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'ae2acf7bf9979c062eff118a60438968406d4ea4', 'src/third_party/devtools-node-modules': Var('chromium_git') + '/external/github.com/ChromeDevTools/devtools-node-modules' + '@' + Var('devtools_node_modules_revision'), @@ -1296,7 +1296,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@625c12a448876870cb43f2e4001f0981b35ead30', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@44ab56b963a431e8e4743ef0c06a2e45f45f21d8', 'condition': 'checkout_src_internal', },
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 522fef8..17ec90db 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -1024,6 +1024,12 @@ "wm/default_state.h", "wm/default_window_resizer.cc", "wm/default_window_resizer.h", + "wm/desks/desks_bar_view.cc", + "wm/desks/desks_bar_view.h", + "wm/desks/desks_controller.cc", + "wm/desks/desks_controller.h", + "wm/desks/new_desk_button.cc", + "wm/desks/new_desk_button.h", "wm/drag_details.cc", "wm/drag_details.h", "wm/drag_window_controller.cc", @@ -1696,6 +1702,7 @@ "system/message_center/session_state_notification_blocker_unittest.cc", "system/message_center/unified_message_center_view_unittest.cc", "system/message_center/unified_message_list_view_unittest.cc", + "system/network/active_network_icon_unittest.cc", "system/network/auto_connect_notifier_unittest.cc", "system/network/network_icon_unittest.cc", "system/network/sms_observer_unittest.cc",
diff --git a/ash/app_list/views/app_list_view.cc b/ash/app_list/views/app_list_view.cc index 274071cd..2558adb9 100644 --- a/ash/app_list/views/app_list_view.cc +++ b/ash/app_list/views/app_list_view.cc
@@ -42,6 +42,7 @@ #include "ui/gfx/canvas.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/image/image_skia.h" +#include "ui/gfx/interpolated_transform.h" #include "ui/gfx/skia_util.h" #include "ui/keyboard/keyboard_controller.h" #include "ui/strings/grit/ui_strings.h" @@ -273,6 +274,49 @@ DISALLOW_COPY_AND_ASSIGN(AppListBackgroundShieldView); }; +// Animation used to translate AppListView as well as its child views. +class AppListAnimation : public ui::LayerAnimationElement { + public: + AppListAnimation(gfx::PointF start_pos, + gfx::PointF end_pos, + base::TimeDelta duration, + gfx::Tween::Type tween_type, + AppListView* view) + : ui::LayerAnimationElement(ui::LayerAnimationElement::TRANSFORM, + duration), + transform_( + std::make_unique<ui::InterpolatedTranslation>(start_pos, end_pos)), + view_(view), + tween_type_(tween_type) {} + + ~AppListAnimation() override = default; + + // ui::LayerAnimationElement: + void OnStart(ui::LayerAnimationDelegate* delegate) override {} + bool OnProgress(double current, + ui::LayerAnimationDelegate* delegate) override { + const double progress = gfx::Tween::CalculateValue(tween_type_, current); + delegate->SetTransformFromAnimation( + transform_->Interpolate(progress), + ui::PropertyChangeReason::FROM_ANIMATION); + + // Update child views' layout at each animation frame because child views' + // padding changes along with the app list view's bounds. + view_->app_list_main_view()->contents_view()->UpdateYPositionAndOpacity(); + + return true; + } + void OnGetTarget(TargetValue* target) const override {} + void OnAbort(ui::LayerAnimationDelegate* delegate) override {} + + private: + std::unique_ptr<ui::InterpolatedTransform> transform_; + AppListView* view_; + gfx::Tween::Type tween_type_; + + DISALLOW_COPY_AND_ASSIGN(AppListAnimation); +}; + //////////////////////////////////////////////////////////////////////////////// // AppListView::TestApi @@ -1284,7 +1328,8 @@ ui::Layer* layer = fullscreen_widget_->GetLayer(); layer->SetBounds(target_bounds); gfx::Transform transform; - transform.Translate(0, original_state_y - target_state_y); + const int y_offset = original_state_y - target_state_y; + transform.Translate(0, y_offset); layer->SetTransform(transform); ui::LayerAnimator* animator = layer->GetAnimator(); @@ -1298,12 +1343,11 @@ settings.SetAnimationMetricsReporter(state_animation_metrics_reporter_.get()); settings.AddObserver(transition_animation_observer_.get()); - layer->SetTransform(gfx::Transform()); - - // In transition animation, layout is only performed after it is complete, - // which makes the child views jump. So update y positions in advance here to - // avoid that. - app_list_main_view_->contents_view()->UpdateYPositionAndOpacity(); + animator->StartAnimation( + new ui::LayerAnimationSequence(std::make_unique<AppListAnimation>( + gfx::PointF(0, y_offset), gfx::PointF(), + base::TimeDelta::FromMilliseconds(animation_duration), + gfx::Tween::EASE_OUT, this))); } void AppListView::StartCloseAnimation(base::TimeDelta animation_duration) {
diff --git a/ash/app_list/views/search_result_actions_view.cc b/ash/app_list/views/search_result_actions_view.cc index 2358ab7..fc9b8a3 100644 --- a/ash/app_list/views/search_result_actions_view.cc +++ b/ash/app_list/views/search_result_actions_view.cc
@@ -102,6 +102,8 @@ void SearchResultImageButton::OnFocus() { parent_->ActionButtonStateChanged(); SchedulePaint(); + if (visible()) + NotifyAccessibilityEvent(ax::mojom::Event::kFocus, true); } void SearchResultImageButton::OnBlur() {
diff --git a/ash/app_list/views/search_result_list_view.cc b/ash/app_list/views/search_result_list_view.cc index 65a0385..4731f98 100644 --- a/ash/app_list/views/search_result_list_view.cc +++ b/ash/app_list/views/search_result_list_view.cc
@@ -20,6 +20,7 @@ #include "ui/gfx/animation/linear_animation.h" #include "ui/gfx/geometry/insets.h" #include "ui/views/background.h" +#include "ui/views/controls/textfield/textfield.h" #include "ui/views/layout/box_layout.h" namespace { @@ -146,4 +147,39 @@ main_view_->OnResultInstalled(view->result()); } +bool SearchResultListView::HandleVerticalFocusMovement(SearchResultView* view, + bool arrow_up) { + int view_index = -1; + for (int i = 0; i < num_results(); ++i) { + if (view == search_result_views_[i]) { + view_index = i; + break; + } + } + + if (view_index == -1) { + // Not found in the result list. + NOTREACHED(); + return false; + } + + if (arrow_up) { // VKEY_UP + if (view_index > 0) { + // Move to the previous result if the current one is not the first result. + search_result_views_[view_index - 1]->RequestFocus(); + return true; + } + } else { // VKEY_DOWN + // Move down to the next result if the currernt one is not the last result; + // otherwise, move focus to search box. + if (view_index == num_results() - 1) + main_view_->search_box_view()->search_box()->RequestFocus(); + else + search_result_views_[view_index + 1]->RequestFocus(); + return true; + } + + return false; +} + } // namespace app_list
diff --git a/ash/app_list/views/search_result_list_view.h b/ash/app_list/views/search_result_list_view.h index 2e51d9c..e68b046e 100644 --- a/ash/app_list/views/search_result_list_view.h +++ b/ash/app_list/views/search_result_list_view.h
@@ -41,6 +41,9 @@ void OnSearchResultInstalled(SearchResultView* view); + // Handles vertical focus movement triggered by VKEY_UP/VKEY_DOWN. + bool HandleVerticalFocusMovement(SearchResultView* view, bool arrow_up); + // Overridden from views::View: gfx::Size CalculatePreferredSize() const override; const char* GetClassName() const override;
diff --git a/ash/app_list/views/search_result_view.cc b/ash/app_list/views/search_result_view.cc index b4ae13d9..ae38cddb 100644 --- a/ash/app_list/views/search_result_view.cc +++ b/ash/app_list/views/search_result_view.cc
@@ -267,6 +267,14 @@ } return true; } + case ui::VKEY_UP: + case ui::VKEY_DOWN: { + if (actions_view_->has_children()) { + return list_view_->HandleVerticalFocusMovement( + this, event.key_code() == ui::VKEY_UP); + } + break; + } default: break; }
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index 12c3e4d..605f2e9 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd
@@ -689,6 +689,11 @@ No recent items </message> + <!-- Virtual Desks --> + <message name="IDS_ASH_DESKS_NEW_DESK_BUTTON" desc="The label of the new virtual desk (a.k.a. workspaces) button."> + New Desk + </message> + <!-- Status tray charging strings. --> <message name="IDS_ASH_STATUS_TRAY_LOW_POWER_CHARGER_TITLE" desc="The title of a notification indicating that a low-current USB charger has been connected."> Low-power charger connected
diff --git a/ash/ash_strings_grd/IDS_ASH_DESKS_NEW_DESK_BUTTON.png.sha1 b/ash/ash_strings_grd/IDS_ASH_DESKS_NEW_DESK_BUTTON.png.sha1 new file mode 100644 index 0000000..030473f --- /dev/null +++ b/ash/ash_strings_grd/IDS_ASH_DESKS_NEW_DESK_BUTTON.png.sha1
@@ -0,0 +1 @@ +8254d07d8a4676a52a79a98e0287ea5f80843262 \ No newline at end of file
diff --git a/ash/public/cpp/ash_features.cc b/ash/public/cpp/ash_features.cc index 809caaa..168b592 100644 --- a/ash/public/cpp/ash_features.cc +++ b/ash/public/cpp/ash_features.cc
@@ -57,6 +57,9 @@ const base::Feature kViewsLogin{"ViewsLogin", base::FEATURE_ENABLED_BY_DEFAULT}; +const base::Feature kVirtualDesks{"VirtualDesks", + base::FEATURE_DISABLED_BY_DEFAULT}; + const base::Feature kUseBluetoothSystemInAsh{"UseBluetoothSystemInAsh", base::FEATURE_DISABLED_BY_DEFAULT}; @@ -98,6 +101,10 @@ return use_trilinear_filtering; } +bool IsVirtualDesksEnabled() { + return base::FeatureList::IsEnabled(kVirtualDesks); +} + bool IsViewsLoginEnabled() { // Always show webui login if --show-webui-login is present, which is passed // by session manager for automatic recovery. Otherwise, only show views
diff --git a/ash/public/cpp/ash_features.h b/ash/public/cpp/ash_features.h index fbedd751..ef3b438 100644 --- a/ash/public/cpp/ash_features.h +++ b/ash/public/cpp/ash_features.h
@@ -71,6 +71,9 @@ // Enables views login. ASH_PUBLIC_EXPORT extern const base::Feature kViewsLogin; +// Enables the Virtual Desks feature. +ASH_PUBLIC_EXPORT extern const base::Feature kVirtualDesks; + // Enables using the BluetoothSystem Mojo interface for Bluetooth operations. ASH_PUBLIC_EXPORT extern const base::Feature kUseBluetoothSystemInAsh; @@ -97,6 +100,8 @@ ASH_PUBLIC_EXPORT bool IsViewsLoginEnabled(); +ASH_PUBLIC_EXPORT bool IsVirtualDesksEnabled(); + ASH_PUBLIC_EXPORT bool IsSupervisedUserDeprecationNoticeEnabled(); } // namespace features
diff --git a/ash/public/cpp/shell_window_ids.cc b/ash/public/cpp/shell_window_ids.cc index fe1da849..e83b349 100644 --- a/ash/public/cpp/shell_window_ids.cc +++ b/ash/public/cpp/shell_window_ids.cc
@@ -12,18 +12,25 @@ // containers appearing earlier in the list are activated before windows in // containers appearing later in the list. const int32_t kActivatableShellWindowIds[] = { - kShellWindowId_OverlayContainer, kShellWindowId_LockSystemModalContainer, + kShellWindowId_OverlayContainer, + kShellWindowId_LockSystemModalContainer, kShellWindowId_AccessibilityPanelContainer, - kShellWindowId_SettingBubbleContainer, kShellWindowId_PowerMenuContainer, + kShellWindowId_SettingBubbleContainer, + kShellWindowId_PowerMenuContainer, kShellWindowId_LockActionHandlerContainer, - kShellWindowId_LockScreenContainer, kShellWindowId_SystemModalContainer, - kShellWindowId_AlwaysOnTopContainer, kShellWindowId_AppListContainer, - kShellWindowId_DefaultContainer, kShellWindowId_AppListTabletModeContainer, + kShellWindowId_LockScreenContainer, + kShellWindowId_SystemModalContainer, + kShellWindowId_AlwaysOnTopContainer, + kShellWindowId_AppListContainer, + kShellWindowId_DefaultContainer, + kShellWindowId_AppListTabletModeContainer, // Launcher and status are intentionally checked after other containers // even though these layers are higher. The user expects their windows // to be focused before these elements. - kShellWindowId_ShelfContainer, kShellWindowId_ShelfBubbleContainer, + kShellWindowId_PipContainer, + kShellWindowId_ShelfContainer, + kShellWindowId_ShelfBubbleContainer, kShellWindowId_StatusContainer, };
diff --git a/ash/public/cpp/shell_window_ids.h b/ash/public/cpp/shell_window_ids.h index 1ad8e33..c53a0ab2 100644 --- a/ash/public/cpp/shell_window_ids.h +++ b/ash/public/cpp/shell_window_ids.h
@@ -60,6 +60,9 @@ // The container for the app list in tablet mode. kShellWindowId_AppListTabletModeContainer, + // The container for the PIP window. + kShellWindowId_PipContainer, + // The parent container that holds the ARC IME container and windows created // by ARC IME other than the virtual keyboard window. // This container window is to ensure that the ARC IME window is stacked above
diff --git a/ash/resources/vector_icons/BUILD.gn b/ash/resources/vector_icons/BUILD.gn index c81cda8..e55eb8d2 100644 --- a/ash/resources/vector_icons/BUILD.gn +++ b/ash/resources/vector_icons/BUILD.gn
@@ -54,6 +54,7 @@ "network_ethernet.icon", "network_mobile_not_connected_x.icon", "network_vpn.icon", + "new_desk_button.icon", "notification_accessibility.icon", "notification_accessibility_braille.icon", "notification_battery_critical.icon",
diff --git a/ash/resources/vector_icons/new_desk_button.icon b/ash/resources/vector_icons/new_desk_button.icon new file mode 100644 index 0000000..bc219a43 --- /dev/null +++ b/ash/resources/vector_icons/new_desk_button.icon
@@ -0,0 +1,18 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +CANVAS_DIMENSIONS, 12, +MOVE_TO, 7, 5, +R_H_LINE_TO, 5, +R_V_LINE_TO, 2, +H_LINE_TO, 7, +R_V_LINE_TO, 5, +H_LINE_TO, 5, +V_LINE_TO, 7, +H_LINE_TO, 0, +V_LINE_TO, 5, +R_H_LINE_TO, 5, +V_LINE_TO, 0, +R_H_LINE_TO, 2, +CLOSE
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index 5bbf827..682976d5 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc
@@ -212,6 +212,7 @@ const int kContainerIdsToMove[] = { kShellWindowId_DefaultContainer, kShellWindowId_AlwaysOnTopContainer, + kShellWindowId_PipContainer, kShellWindowId_SystemModalContainer, kShellWindowId_LockSystemModalContainer, kShellWindowId_UnparentedControlContainer, @@ -789,9 +790,11 @@ aura::Window* always_on_top_container = GetContainer(kShellWindowId_AlwaysOnTopContainer); + aura::Window* pip_container = GetContainer(kShellWindowId_PipContainer); DCHECK(always_on_top_container); - always_on_top_controller_ = - std::make_unique<AlwaysOnTopController>(always_on_top_container); + DCHECK(pip_container); + always_on_top_controller_ = std::make_unique<AlwaysOnTopController>( + always_on_top_container, pip_container); wm::WmSnapToPixelLayoutManager::InstallOnContainers(root); @@ -879,6 +882,12 @@ wm::SetSnapsChildrenToPhysicalPixelBoundary(app_list_container); app_list_container->SetProperty(::wm::kUsesScreenCoordinatesKey, true); + aura::Window* pip_container = CreateContainer( + kShellWindowId_PipContainer, "PipContainer", non_lock_screen_containers); + ::wm::SetChildWindowVisibilityChangesAnimated(pip_container); + wm::SetSnapsChildrenToPhysicalPixelBoundary(pip_container); + pip_container->SetProperty(::wm::kUsesScreenCoordinatesKey, true); + aura::Window* arc_ime_parent_container = CreateContainer( kShellWindowId_ArcImeWindowParentContainer, "ArcImeWindowParentContainer", non_lock_screen_containers);
diff --git a/ash/shelf/shelf_background_animator.cc b/ash/shelf/shelf_background_animator.cc index 162baff..e9619baeb 100644 --- a/ash/shelf/shelf_background_animator.cc +++ b/ash/shelf/shelf_background_animator.cc
@@ -273,10 +273,8 @@ shelf_target_color = darken_wallpaper(kShelfTranslucentColorDarkenAlpha); break; case SHELF_BACKGROUND_MAXIMIZED: - shelf_target_color = darken_wallpaper(kShelfOpaqueColorDarkenAlpha); - break; case SHELF_BACKGROUND_SPLIT_VIEW: - shelf_target_color = darken_wallpaper(ShelfBackgroundAnimator::kMaxAlpha); + shelf_target_color = darken_wallpaper(kShelfOpaqueColorDarkenAlpha); break; case SHELF_BACKGROUND_OOBE: shelf_target_color = SK_ColorTRANSPARENT;
diff --git a/ash/shell.cc b/ash/shell.cc index 693a8736..7c61054 100644 --- a/ash/shell.cc +++ b/ash/shell.cc
@@ -131,6 +131,7 @@ #include "ash/wm/ash_focus_rules.h" #include "ash/wm/container_finder.h" #include "ash/wm/cursor_manager_chromeos.h" +#include "ash/wm/desks/desks_controller.h" #include "ash/wm/event_client_impl.h" #include "ash/wm/immersive_context_ash.h" #include "ash/wm/lock_state_controller.h" @@ -790,6 +791,8 @@ // |overview_controller_|. split_view_controller_.reset(); + desks_controller_.reset(); + // Stop dispatching events (e.g. synthesized mouse exits from window close). // https://crbug.com/874156 for (RootWindowController* rwc : GetAllRootWindowControllers()) @@ -1226,6 +1229,9 @@ split_view_controller_.reset(new SplitViewController()); + if (features::IsVirtualDesksEnabled()) + desks_controller_ = std::make_unique<DesksController>(); + key_accessibility_enabler_ = std::make_unique<KeyAccessibilityEnabler>(); // The compositor thread and main message loop have to be running in
diff --git a/ash/shell.h b/ash/shell.h index 53ab4a3f..5995f35a 100644 --- a/ash/shell.h +++ b/ash/shell.h
@@ -109,6 +109,7 @@ class DisplayOutputProtection; class ContainedShellController; class CrosDisplayConfig; +class DesksController; class DetachableBaseHandler; class DetachableBaseNotificationController; class DisplayColorManager; @@ -370,6 +371,7 @@ return cros_display_config_.get(); } ::wm::CursorManager* cursor_manager() { return cursor_manager_.get(); } + DesksController* desks_controller() { return desks_controller_.get(); } DetachableBaseHandler* detachable_base_handler() { return detachable_base_handler_.get(); } @@ -713,6 +715,7 @@ std::unique_ptr<CrosDisplayConfig> cros_display_config_; service_manager::Connector* const connector_; std::unique_ptr<ContainedShellController> contained_shell_controller_; + std::unique_ptr<DesksController> desks_controller_; std::unique_ptr<DetachableBaseHandler> detachable_base_handler_; std::unique_ptr<DetachableBaseNotificationController> detachable_base_notification_controller_;
diff --git a/ash/system/message_center/ash_message_center_lock_screen_controller.cc b/ash/system/message_center/ash_message_center_lock_screen_controller.cc index 02fcf07..524f10b 100644 --- a/ash/system/message_center/ash_message_center_lock_screen_controller.cc +++ b/ash/system/message_center/ash_message_center_lock_screen_controller.cc
@@ -22,22 +22,38 @@ namespace ash { +// static private +base::Optional<AshMessageCenterLockScreenController::Mode> + AshMessageCenterLockScreenController::overridden_mode_for_testing_; + // static bool AshMessageCenterLockScreenController::IsEnabled() { - return GetMode() != Mode::HIDE; + auto mode = GetMode(); + bool is_showing = (mode == Mode::SHOW || mode == Mode::HIDE_SENSITIVE); + // If |isAllowed()| is false, must return false; + DCHECK(!is_showing || IsAllowed()); + return is_showing; } // static +bool AshMessageCenterLockScreenController::IsAllowed() { + return GetMode() != Mode::PROHIBITED; +} + +// static, private AshMessageCenterLockScreenController::Mode AshMessageCenterLockScreenController::GetMode() { + if (overridden_mode_for_testing_.has_value()) + return *overridden_mode_for_testing_; + if (!features::IsLockScreenNotificationsEnabled()) - return Mode::HIDE; + return Mode::PROHIBITED; // User prefs may be null in some tests. PrefService* user_prefs = Shell::Get()->session_controller()->GetLastActiveUserPrefService(); if (!user_prefs) - return Mode::HIDE; + return Mode::PROHIBITED; const std::string& mode = user_prefs->GetString(prefs::kMessageCenterLockScreenMode); @@ -50,6 +66,12 @@ return Mode::HIDE; } +// static, only for testing +void AshMessageCenterLockScreenController::OverrideModeForTest( + base::Optional<AshMessageCenterLockScreenController::Mode> new_mode) { + overridden_mode_for_testing_ = new_mode; +} + namespace { const char kToastId[] = "ash-lock-screen-manager"; } // anonymous namespace
diff --git a/ash/system/message_center/ash_message_center_lock_screen_controller.h b/ash/system/message_center/ash_message_center_lock_screen_controller.h index 1c33856..d5e4b6b 100644 --- a/ash/system/message_center/ash_message_center_lock_screen_controller.h +++ b/ash/system/message_center/ash_message_center_lock_screen_controller.h
@@ -7,6 +7,7 @@ #include "ash/ash_export.h" #include "ash/session/session_observer.h" +#include "base/optional.h" #include "components/account_id/account_id.h" #include "ui/message_center/lock_screen/lock_screen_controller.h" @@ -17,15 +18,14 @@ : public message_center::LockScreenController, public SessionObserver { public: - // Modes of the lock screen notification. - enum class Mode { HIDE, SHOW, HIDE_SENSITIVE }; - // Returns if the message center shows the notifications on the lock screen // or not. True if it shows, false if doesn't. static ASH_EXPORT bool IsEnabled(); - // Returns the current mode of the lock screen notification. - static Mode GetMode(); + // Returns if the message center on the lock screen is forcibly disabled, + // due to the policy or the corrupt state. + // When this returns true, |IsEnabled()| must return false. + static ASH_EXPORT bool IsAllowed(); AshMessageCenterLockScreenController(); ~AshMessageCenterLockScreenController() override; @@ -36,6 +36,27 @@ bool IsScreenLocked() const override; private: + FRIEND_TEST_ALL_PREFIXES(UnifiedSystemTrayControllerTest, + NotificationHiddenView_ModeShow); + FRIEND_TEST_ALL_PREFIXES(UnifiedSystemTrayControllerTest, + NotificationHiddenView_ModeHide); + FRIEND_TEST_ALL_PREFIXES(UnifiedSystemTrayControllerTest, + NotificationHiddenView_ModeHideSensitive); + FRIEND_TEST_ALL_PREFIXES(UnifiedSystemTrayControllerTest, + NotificationHiddenView_ModeProhibited); + + // Modes of the lock screen notification. + enum class Mode { PROHIBITED, HIDE, SHOW, HIDE_SENSITIVE }; + + // Returns the current mode of the lock screen notification. + static Mode GetMode(); + + // Override the current mode for tests. + // Exporting for test. + static ASH_EXPORT void OverrideModeForTest(base::Optional<Mode> new_mode); + + static base::Optional<Mode> overridden_mode_for_testing_; + // SessionObserver: void OnLockStateChanged(bool locked) override; void OnActiveUserSessionChanged(const AccountId& account_id) override;
diff --git a/ash/system/network/active_network_icon.cc b/ash/system/network/active_network_icon.cc index 784371b6..d7c2997 100644 --- a/ash/system/network/active_network_icon.cc +++ b/ash/system/network/active_network_icon.cc
@@ -55,18 +55,14 @@ ActiveNetworkIcon::ActiveNetworkIcon() { // NetworkHandler may not be initialized in tests. - if (!chromeos::NetworkHandler::IsInitialized()) - return; - network_state_handler_ = - chromeos::NetworkHandler::Get()->network_state_handler(); - DCHECK(network_state_handler_); - network_state_handler_->AddObserver(this, FROM_HERE); - UpdateActiveNetworks(); + if (chromeos::NetworkHandler::IsInitialized()) { + InitializeNetworkStateHandler( + chromeos::NetworkHandler::Get()->network_state_handler()); + } } ActiveNetworkIcon::~ActiveNetworkIcon() { - if (network_state_handler_) - network_state_handler_->RemoveObserver(this, FROM_HERE); + ShutdownNetworkStateHandler(); } base::string16 ActiveNetworkIcon::GetDefaultLabel( @@ -139,13 +135,33 @@ active_cellular_, icon_type, false /* show_vpn_badge */, animating); } +void ActiveNetworkIcon::InitForTesting( + chromeos::NetworkStateHandler* network_state_handler) { + ShutdownNetworkStateHandler(); + InitializeNetworkStateHandler(network_state_handler); +} + +void ActiveNetworkIcon::InitializeNetworkStateHandler( + chromeos::NetworkStateHandler* handler) { + DCHECK(!network_state_handler_); + DCHECK(handler); + network_state_handler_ = handler; + network_state_handler_->AddObserver(this, FROM_HERE); + UpdateActiveNetworks(); +} + +void ActiveNetworkIcon::ShutdownNetworkStateHandler() { + if (!network_state_handler_) + return; + network_state_handler_->RemoveObserver(this, FROM_HERE); +} + gfx::ImageSkia ActiveNetworkIcon::GetDefaultImageImpl( const NetworkState* default_network, network_icon::IconType icon_type, bool* animating) { if (!default_network_) return GetDefaultImageForNoNetwork(icon_type, animating); - // Don't show connected Ethernet in the tray unless a VPN is present. if (default_network->Matches(NetworkTypePattern::Ethernet()) && IsTrayIcon(icon_type) && !active_vpn_) { @@ -254,8 +270,8 @@ } continue; } - if (network->Matches(NetworkTypePattern::Wireless()) && - network->IsActive()) { + // Active non connected networks are connecting. + if (network->Matches(NetworkTypePattern::Wireless())) { if (!connecting_network) connecting_network = network; if (!connecting_non_cellular &&
diff --git a/ash/system/network/active_network_icon.h b/ash/system/network/active_network_icon.h index d0cf999..79422c5e 100644 --- a/ash/system/network/active_network_icon.h +++ b/ash/system/network/active_network_icon.h
@@ -34,8 +34,10 @@ // a technology badge is used to represent the network. // ** Cellular (enabled devices only): The state of the Cellular connection if // available regardless of whether it is the active network. -// NOTE : GetSingleDefaultImage and GetDefaultLabel are tested in -// network_icon_unittest.cc. TODO(stevenjb): Test other public methods. +// NOTE : GetSingleDefaultImage and GetDefaultLabel are partially tested in +// network_icon_unittest.cc, and partially in active_network_icon_unittest.cc. +// TODO(stevenjb): Move all test coverage to active_network_icon_unittest.cc and +// test Dual icon methods. class ASH_EXPORT ActiveNetworkIcon : public chromeos::NetworkStateHandlerObserver { public: @@ -60,11 +62,12 @@ gfx::ImageSkia GetDualImageCellular(network_icon::IconType icon_type, bool* animating); - int cellular_uninitialized_msg_for_test() const { - return cellular_uninitialized_msg_; - } + void InitForTesting(chromeos::NetworkStateHandler* network_state_handler); private: + void InitializeNetworkStateHandler(chromeos::NetworkStateHandler* handler); + void ShutdownNetworkStateHandler(); + gfx::ImageSkia GetDefaultImageImpl( const chromeos::NetworkState* default_network, network_icon::IconType icon_type,
diff --git a/ash/system/network/active_network_icon_unittest.cc b/ash/system/network/active_network_icon_unittest.cc new file mode 100644 index 0000000..97f126f --- /dev/null +++ b/ash/system/network/active_network_icon_unittest.cc
@@ -0,0 +1,264 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/system/network/active_network_icon.h" + +#include <memory> +#include <string> + +#include "ash/strings/grit/ash_strings.h" +#include "ash/system/network/network_icon.h" +#include "base/message_loop/message_loop.h" +#include "base/strings/stringprintf.h" +#include "base/strings/utf_string_conversions.h" +#include "chromeos/network/network_state_test_helper.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/cros_system_api/dbus/shill/dbus-constants.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/gfx/image/image_unittest_util.h" + +namespace ash { + +namespace { + +const char kShillManagerClientStubCellularDevice[] = + "/device/stub_cellular_device"; + +} // namespace + +class ActiveNetworkIconTest : public testing::Test { + public: + ActiveNetworkIconTest() = default; + ~ActiveNetworkIconTest() override = default; + + void SetUp() override { + active_network_icon_ = std::make_unique<ActiveNetworkIcon>(); + active_network_icon_->InitForTesting(helper().network_state_handler()); + } + + void TearDown() override { active_network_icon_.reset(); } + + void SetupEthernet() { + if (eth_path_.empty()) { + helper().device_test()->AddDevice("/device/stub_eth_device", + shill::kTypeWifi, "stub_eth_device"); + eth_path_ = ConfigureService( + R"({"GUID": "eth_guid", "Type": "ethernet", "State": "online"})"); + } + base::RunLoop().RunUntilIdle(); + } + + void SetupWiFi(const char* state) { + if (wifi_path_.empty()) { + // WiFi device already exists. + wifi_path_ = ConfigureService( + R"({"GUID": "wifi_guid", "Type": "wifi", "State": "idle"})"); + } + SetServiceProperty(wifi_path_, shill::kStateProperty, base::Value(state)); + SetServiceProperty(wifi_path_, shill::kSignalStrengthProperty, + base::Value(100)); + base::RunLoop().RunUntilIdle(); + } + + void SetupCellular(const char* state) { + if (cellular_path_.empty()) { + helper_.manager_test()->AddTechnology(shill::kTypeCellular, + true /* enabled */); + helper().device_test()->AddDevice(kShillManagerClientStubCellularDevice, + shill::kTypeCellular, + "stub_cellular_device"); + cellular_path_ = ConfigureService( + R"({"GUID": "cellular_guid", "Type": "cellular", "Technology": "LTE", + "State": "idle"})"); + } + SetServiceProperty(cellular_path_, shill::kStateProperty, + base::Value(state)); + SetServiceProperty(cellular_path_, shill::kSignalStrengthProperty, + base::Value(100)); + base::RunLoop().RunUntilIdle(); + } + + void SetCellularUninitialized(bool scanning) { + const bool enabled = scanning; + helper_.manager_test()->RemoveTechnology(shill::kTypeCellular); + helper_.manager_test()->AddTechnology(shill::kTypeCellular, enabled); + helper().device_test()->AddDevice(kShillManagerClientStubCellularDevice, + shill::kTypeCellular, + "stub_cellular_device"); + if (scanning) { + helper().device_test()->SetDeviceProperty( + kShillManagerClientStubCellularDevice, shill::kScanningProperty, + base::Value(true), true /* notify_changed */); + } else { + helper_.manager_test()->SetTechnologyInitializing(shill::kTypeCellular, + true); + } + base::RunLoop().RunUntilIdle(); + } + + gfx::ImageSkia ImageForNetwork(const chromeos::NetworkState* network) { + return network_icon::GetImageForNonVirtualNetwork( + network, icon_type_, false /* show_vpn_badge */); + } + + bool AreImagesEqual(const gfx::ImageSkia& image, + const gfx::ImageSkia& reference) { + return gfx::test::AreBitmapsEqual(*image.bitmap(), *reference.bitmap()); + } + + std::string ConfigureService(const std::string& shill_json_string) { + return helper_.ConfigureService(shill_json_string); + } + + void SetServiceProperty(const std::string& service_path, + const std::string& key, + const base::Value& value) { + helper_.SetServiceProperty(service_path, key, value); + } + + std::unique_ptr<chromeos::NetworkState> CreateStandaloneNetworkState( + const std::string& type, + const std::string& connection_state, + int signal_strength = 100) { + std::string id = base::StringPrintf("reference_%d", reference_count_++); + return helper_.CreateStandaloneNetworkState(id, type, connection_state, + signal_strength); + } + + chromeos::NetworkStateTestHelper& helper() { return helper_; } + + ActiveNetworkIcon* active_network_icon() { + return active_network_icon_.get(); + } + + const std::string& eth_path() const { return eth_path_; } + const std::string& wifi_path() const { return wifi_path_; } + const std::string& cellular_path() const { return cellular_path_; } + + network_icon::IconType icon_type() { return icon_type_; } + + private: + const base::MessageLoop message_loop_; + chromeos::NetworkStateTestHelper helper_{ + false /* use_default_devices_and_services */}; + std::unique_ptr<ActiveNetworkIcon> active_network_icon_; + + std::string eth_path_; + std::string wifi_path_; + std::string cellular_path_; + + network_icon::IconType icon_type_ = network_icon::ICON_TYPE_TRAY_REGULAR; + // Counter to provide unique ids for reference networks. + int reference_count_ = 0; + + DISALLOW_COPY_AND_ASSIGN(ActiveNetworkIconTest); +}; + +TEST_F(ActiveNetworkIconTest, GetDefaultLabel) { + SetupCellular(shill::kStateOnline); + base::string16 label = active_network_icon()->GetDefaultLabel(icon_type()); + // Note: The guid is used for the name in ConfigureService. + EXPECT_EQ(l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_NETWORK_CONNECTED, + base::UTF8ToUTF16("cellular_guid")), + label); + + SetupWiFi(shill::kStateIdle); + helper().network_state_handler()->SetNetworkConnectRequested(wifi_path(), + true); + base::RunLoop().RunUntilIdle(); + label = active_network_icon()->GetDefaultLabel(icon_type()); + // Note: The guid is used for the name in ConfigureService. + EXPECT_EQ(l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_NETWORK_CONNECTING, + base::UTF8ToUTF16("wifi_guid")), + label); +} + +TEST_F(ActiveNetworkIconTest, GetSingleImage) { + // Cellular only = Cellular icon + SetupCellular(shill::kStateOnline); + bool animating; + gfx::ImageSkia image = + active_network_icon()->GetSingleImage(icon_type(), &animating); + std::unique_ptr<chromeos::NetworkState> reference_network = + CreateStandaloneNetworkState(shill::kTypeCellular, shill::kStateOnline); + EXPECT_TRUE(AreImagesEqual(image, ImageForNetwork(reference_network.get()))); + EXPECT_FALSE(animating); + + // Cellular + WiFi connected = WiFi connected icon + SetupWiFi(shill::kStateOnline); + image = active_network_icon()->GetSingleImage(icon_type(), &animating); + reference_network = + CreateStandaloneNetworkState(shill::kTypeWifi, shill::kStateOnline); + EXPECT_TRUE(AreImagesEqual(image, ImageForNetwork(reference_network.get()))); + EXPECT_FALSE(animating); + + // Cellular + WiFi connecting = WiFi connecting icon + SetupWiFi(shill::kStateAssociation); + helper().network_state_handler()->SetNetworkConnectRequested(wifi_path(), + true); + SetServiceProperty(wifi_path(), shill::kSignalStrengthProperty, + base::Value(50)); + base::RunLoop().RunUntilIdle(); + image = active_network_icon()->GetSingleImage(icon_type(), &animating); + reference_network = CreateStandaloneNetworkState( + shill::kTypeWifi, shill::kStateAssociation, 50); + EXPECT_TRUE(AreImagesEqual(image, ImageForNetwork(reference_network.get()))); + EXPECT_TRUE(animating); + + // Cellular + WiFi connecting + Ethernet = WiFi connecting icon + SetupEthernet(); + image = active_network_icon()->GetSingleImage(icon_type(), &animating); + EXPECT_TRUE(AreImagesEqual(image, ImageForNetwork(reference_network.get()))); + EXPECT_TRUE(animating); + + // Cellular + WiFi connected + Ethernet = No icon + SetupWiFi(shill::kStateOnline); + helper().network_state_handler()->SetNetworkConnectRequested(wifi_path(), + false); + image = active_network_icon()->GetSingleImage(icon_type(), &animating); + EXPECT_TRUE(image.isNull()); + EXPECT_FALSE(animating); +} + +TEST_F(ActiveNetworkIconTest, CellularUninitialized) { + SetCellularUninitialized(false /* scanning */); + + base::string16 label = active_network_icon()->GetDefaultLabel(icon_type()); + EXPECT_EQ( + l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_INITIALIZING_CELLULAR), + label); + + bool animating; + gfx::ImageSkia image = + active_network_icon()->GetSingleImage(icon_type(), &animating); + std::unique_ptr<chromeos::NetworkState> reference_network = + CreateStandaloneNetworkState(shill::kTypeCellular, + shill::kStateAssociation); + EXPECT_TRUE(AreImagesEqual(image, ImageForNetwork(reference_network.get()))); + EXPECT_TRUE(animating); +} + +TEST_F(ActiveNetworkIconTest, CellularScanning) { + SetCellularUninitialized(true /* scanning */); + + ASSERT_TRUE(helper().network_state_handler()->GetScanningByType( + chromeos::NetworkTypePattern::Cellular())); + + base::string16 label = active_network_icon()->GetDefaultLabel(icon_type()); + EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_MOBILE_SCANNING), + label); + + bool animating; + gfx::ImageSkia image = + active_network_icon()->GetSingleImage(icon_type(), &animating); + std::unique_ptr<chromeos::NetworkState> reference_network = + CreateStandaloneNetworkState(shill::kTypeCellular, + shill::kStateAssociation); + EXPECT_TRUE(AreImagesEqual(image, ImageForNetwork(reference_network.get()))); + EXPECT_TRUE(animating); +} + +// TODO(stevenjb): Test GetDualImagePrimary, GetDualImageCellular. + +} // namespace ash
diff --git a/ash/system/network/network_icon_unittest.cc b/ash/system/network/network_icon_unittest.cc index 86aa0eb2..76304dc 100644 --- a/ash/system/network/network_icon_unittest.cc +++ b/ash/system/network/network_icon_unittest.cc
@@ -29,13 +29,6 @@ namespace network_icon { -namespace { - -const char kShillManagerClientStubCellularDevice[] = - "/device/stub_cellular_device1"; - -} // namespace - class NetworkIconTest : public testing::Test { public: NetworkIconTest() = default; @@ -44,6 +37,7 @@ void SetUp() override { SetUpDefaultNetworkState(); active_network_icon_ = std::make_unique<ActiveNetworkIcon>(); + active_network_icon_->InitForTesting(helper().network_state_handler()); } void TearDown() override { @@ -64,9 +58,9 @@ void SetUpDefaultNetworkState() { // NetworkStateTestHelper default has a wifi device only and no services. - helper_.device_test()->AddDevice(kShillManagerClientStubCellularDevice, + helper_.device_test()->AddDevice("/device/stub_cellular_device", shill::kTypeCellular, - "stub_cellular_device1"); + "stub_cellular_device"); base::RunLoop().RunUntilIdle(); wifi1_path_ = ConfigureService( @@ -86,12 +80,8 @@ const std::string& type, const std::string& connection_state, int signal_strength) { - auto network = std::make_unique<chromeos::NetworkState>(id); - network->set_type(type); - network->set_visible(true); - network->set_connection_state_for_testing(connection_state); - network->set_signal_strength(signal_strength); - return network; + return helper_.CreateStandaloneNetworkState(id, type, connection_state, + signal_strength); } std::unique_ptr<chromeos::NetworkState> @@ -120,10 +110,6 @@ *label = active_network_icon_->GetDefaultLabel(icon_type); } - int GetCellularUninitializedMsg() { - return active_network_icon_->cellular_uninitialized_msg_for_test(); - } - // The icon for a Tether network should be the same as one for a cellular // network. The icon for a Tether network should be different from one for a // Wi-Fi network. The icon for a cellular network should be different from one @@ -165,20 +151,6 @@ chromeos::NetworkTypePattern::Cellular())); } - void SetCellularUninitialized() { - helper_.manager_test()->RemoveTechnology(shill::kTypeCellular); - helper_.manager_test()->AddTechnology(shill::kTypeCellular, false); - helper_.manager_test()->SetTechnologyInitializing(shill::kTypeCellular, - true); - - base::RunLoop().RunUntilIdle(); - - ASSERT_EQ(chromeos::NetworkStateHandler::TechnologyState:: - TECHNOLOGY_UNINITIALIZED, - helper_.network_state_handler()->GetTechnologyState( - chromeos::NetworkTypePattern::Cellular())); - } - chromeos::NetworkStateTestHelper& helper() { return helper_; } const std::string& wifi1_path() const { return wifi1_path_; } @@ -282,49 +254,6 @@ wifi_tether_network.get()); } -TEST_F(NetworkIconTest, - GetCellularUninitializedMsg_NoUninitializedMessageExpected) { - EXPECT_EQ(0, GetCellularUninitializedMsg()); -} - -TEST_F(NetworkIconTest, GetCellularUninitializedMsg_CellularUninitialized) { - SetCellularUninitialized(); - - EXPECT_EQ(IDS_ASH_STATUS_TRAY_INITIALIZING_CELLULAR, - GetCellularUninitializedMsg()); - - gfx::ImageSkia default_image; - base::string16 label; - bool animating = false; - GetDefaultNetworkImageAndLabel(icon_type_, &default_image, &label, - &animating); - ASSERT_FALSE(default_image.isNull()); - EXPECT_TRUE(animating); - EXPECT_EQ( - l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_INITIALIZING_CELLULAR), - label); - std::unique_ptr<chromeos::NetworkState> reference_network = - CreateStandaloneNetworkState("reference", shill::kTypeCellular, - shill::kStateAssociation, 45); - EXPECT_TRUE(gfx::test::AreImagesEqual( - gfx::Image(default_image), ImageForNetwork(reference_network.get()))); -} - -TEST_F(NetworkIconTest, GetCellularUninitializedMsg_CellularScanning) { - SetCellularUninitialized(); - - helper().manager_test()->AddTechnology(shill::kTypeCellular, true); - helper().device_test()->SetDeviceProperty( - kShillManagerClientStubCellularDevice, shill::kScanningProperty, - base::Value(true), - /*notify_changed=*/true); - base::RunLoop().RunUntilIdle(); - ASSERT_TRUE(helper().network_state_handler()->GetScanningByType( - chromeos::NetworkTypePattern::Cellular())); - - EXPECT_EQ(IDS_ASH_STATUS_TRAY_MOBILE_SCANNING, GetCellularUninitializedMsg()); -} - TEST_F(NetworkIconTest, NetworkSignalStrength) { using ss = SignalStrength;
diff --git a/ash/system/session/logout_confirmation_controller.cc b/ash/system/session/logout_confirmation_controller.cc index 9947af16..1644bb4 100644 --- a/ash/system/session/logout_confirmation_controller.cc +++ b/ash/system/session/logout_confirmation_controller.cc
@@ -29,7 +29,8 @@ // Shell window containers monitored for when the last window closes. const int kLastWindowClosedContainerIds[] = { - kShellWindowId_DefaultContainer, kShellWindowId_AlwaysOnTopContainer}; + kShellWindowId_DefaultContainer, kShellWindowId_AlwaysOnTopContainer, + kShellWindowId_PipContainer}; void SignOut(LogoutConfirmationController::Source source) { if (Shell::Get()->session_controller()->IsDemoSession() &&
diff --git a/ash/system/unified/notification_hidden_view.cc b/ash/system/unified/notification_hidden_view.cc index 799a0122..e83f781d 100644 --- a/ash/system/unified/notification_hidden_view.cc +++ b/ash/system/unified/notification_hidden_view.cc
@@ -7,6 +7,7 @@ #include "ash/public/cpp/ash_features.h" #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" +#include "ash/system/message_center/ash_message_center_lock_screen_controller.h" #include "ash/system/message_center/message_center_controller.h" #include "ash/system/tray/tray_constants.h" #include "ash/system/unified/sign_out_button.h" @@ -34,9 +35,6 @@ } // namespace NotificationHiddenView::NotificationHiddenView() { - const bool lock_screen_notification_enabled = - features::IsLockScreenNotificationsEnabled(); - auto* label = new views::Label; label->SetEnabledColor(kUnifiedMenuTextColor); label->SetAutoColorReadabilityEnabled(false); @@ -57,14 +55,16 @@ container->AddChildView(label); layout->SetFlexForView(label, 1); - if (lock_screen_notification_enabled) { - auto* change_button = new RoundedLabelButton( + // Shows the "Change" button, unless the locks screen notification is + // prohibited by policy or flag. + if (AshMessageCenterLockScreenController::IsAllowed()) { + change_button_ = new RoundedLabelButton( this, l10n_util::GetStringUTF16(IDS_ASH_MESSAGE_CENTER_LOCKSCREEN_CHANGE)); - change_button->SetTooltipText(l10n_util::GetStringUTF16( + change_button_->SetTooltipText(l10n_util::GetStringUTF16( IDS_ASH_MESSAGE_CENTER_LOCKSCREEN_CHANGE_TOOLTIP)); - container->AddChildView(change_button); + container->AddChildView(change_button_); } SetBorder(
diff --git a/ash/system/unified/notification_hidden_view.h b/ash/system/unified/notification_hidden_view.h index c7ae7784..6ea96b92 100644 --- a/ash/system/unified/notification_hidden_view.h +++ b/ash/system/unified/notification_hidden_view.h
@@ -21,7 +21,11 @@ // views::ButtonListener: void ButtonPressed(views::Button* sender, const ui::Event& event) override; + views::Button* change_button_for_testing() { return change_button_; } + private: + views::Button* change_button_ = nullptr; + DISALLOW_COPY_AND_ASSIGN(NotificationHiddenView); };
diff --git a/ash/system/unified/unified_system_tray_controller_unittest.cc b/ash/system/unified/unified_system_tray_controller_unittest.cc index faad210..8f6c3f17 100644 --- a/ash/system/unified/unified_system_tray_controller_unittest.cc +++ b/ash/system/unified/unified_system_tray_controller_unittest.cc
@@ -4,7 +4,12 @@ #include "ash/system/unified/unified_system_tray_controller.h" +#include "ash/public/cpp/ash_features.h" +#include "ash/public/interfaces/session_controller.mojom.h" +#include "ash/session/session_controller.h" #include "ash/shell.h" +#include "ash/system/message_center/ash_message_center_lock_screen_controller.h" +#include "ash/system/unified/notification_hidden_view.h" #include "ash/system/unified/unified_system_tray_model.h" #include "ash/system/unified/unified_system_tray_view.h" #include "ash/test/ash_test_base.h" @@ -17,6 +22,17 @@ namespace ash { +namespace { + +void SetSessionState(const session_manager::SessionState& state) { + mojom::SessionInfoPtr info_ptr = mojom::SessionInfo::New(); + info_ptr->state = state; + SessionController* session_controller = Shell::Get()->session_controller(); + session_controller->SetSessionInfo(std::move(info_ptr)); +} + +} // anonymous namespace + class UnifiedSystemTrayControllerTest : public AshTestBase, public views::ViewObserver { public: @@ -36,15 +52,11 @@ model_ = std::make_unique<UnifiedSystemTrayModel>(); controller_ = std::make_unique<UnifiedSystemTrayController>(model()); - view_.reset(controller_->CreateView()); - - view_->AddObserver(this); - OnViewPreferredSizeChanged(view()); - - preferred_size_changed_count_ = 0; } void TearDown() override { + DCHECK(view_) << "Must call InitializeView() during the tests"; + view_->RemoveObserver(this); view_.reset(); @@ -75,6 +87,15 @@ return preferred_size_changed_count_; } + void InitializeView() { + view_.reset(controller_->CreateView()); + + view_->AddObserver(this); + OnViewPreferredSizeChanged(view()); + + preferred_size_changed_count_ = 0; + } + UnifiedSystemTrayModel* model() { return model_.get(); } UnifiedSystemTrayController* controller() { return controller_.get(); } UnifiedSystemTrayView* view() { return view_.get(); } @@ -93,6 +114,8 @@ }; TEST_F(UnifiedSystemTrayControllerTest, ToggleExpanded) { + InitializeView(); + EXPECT_TRUE(model()->IsExpandedOnOpen()); const int expanded_height = view()->GetPreferredSize().height(); @@ -105,6 +128,8 @@ } TEST_F(UnifiedSystemTrayControllerTest, PreferredSizeChanged) { + InitializeView(); + // Checks PreferredSizeChanged is not called too frequently. EXPECT_EQ(0, preferred_size_changed_count()); view()->SetExpandedAmount(0.0); @@ -117,4 +142,55 @@ EXPECT_EQ(4, preferred_size_changed_count()); } +TEST_F(UnifiedSystemTrayControllerTest, NotificationHiddenView_ModeShow) { + AshMessageCenterLockScreenController::OverrideModeForTest( + AshMessageCenterLockScreenController::Mode::SHOW); + SetSessionState(session_manager::SessionState::LOCKED); + InitializeView(); + + EXPECT_TRUE(AshMessageCenterLockScreenController::IsAllowed()); + EXPECT_TRUE(AshMessageCenterLockScreenController::IsEnabled()); + EXPECT_FALSE(view()->notification_hidden_view_for_testing()->visible()); +} + +TEST_F(UnifiedSystemTrayControllerTest, NotificationHiddenView_ModeHide) { + AshMessageCenterLockScreenController::OverrideModeForTest( + AshMessageCenterLockScreenController::Mode::HIDE); + SetSessionState(session_manager::SessionState::LOCKED); + InitializeView(); + + EXPECT_TRUE(AshMessageCenterLockScreenController::IsAllowed()); + EXPECT_FALSE(AshMessageCenterLockScreenController::IsEnabled()); + EXPECT_TRUE(view()->notification_hidden_view_for_testing()->visible()); + EXPECT_NE(nullptr, view() + ->notification_hidden_view_for_testing() + ->change_button_for_testing()); +} + +TEST_F(UnifiedSystemTrayControllerTest, + NotificationHiddenView_ModeHideSensitive) { + AshMessageCenterLockScreenController::OverrideModeForTest( + AshMessageCenterLockScreenController::Mode::HIDE_SENSITIVE); + SetSessionState(session_manager::SessionState::LOCKED); + InitializeView(); + + EXPECT_TRUE(AshMessageCenterLockScreenController::IsAllowed()); + EXPECT_TRUE(AshMessageCenterLockScreenController::IsEnabled()); + EXPECT_FALSE(view()->notification_hidden_view_for_testing()->visible()); +} + +TEST_F(UnifiedSystemTrayControllerTest, NotificationHiddenView_ModeProhibited) { + AshMessageCenterLockScreenController::OverrideModeForTest( + AshMessageCenterLockScreenController::Mode::PROHIBITED); + SetSessionState(session_manager::SessionState::LOCKED); + InitializeView(); + + EXPECT_FALSE(AshMessageCenterLockScreenController::IsAllowed()); + EXPECT_FALSE(AshMessageCenterLockScreenController::IsEnabled()); + EXPECT_TRUE(view()->notification_hidden_view_for_testing()->visible()); + EXPECT_EQ(nullptr, view() + ->notification_hidden_view_for_testing() + ->change_button_for_testing()); +} + } // namespace ash
diff --git a/ash/system/unified/unified_system_tray_view.h b/ash/system/unified/unified_system_tray_view.h index 6e4640de..1b48c74 100644 --- a/ash/system/unified/unified_system_tray_view.h +++ b/ash/system/unified/unified_system_tray_view.h
@@ -14,6 +14,7 @@ class FeaturePodButton; class FeaturePodsContainerView; class TopShortcutsView; +class NotificationHiddenView; class UnifiedMessageCenterView; class UnifiedSystemInfoView; class UnifiedSystemTrayController; @@ -110,6 +111,10 @@ views::FocusTraversable* GetFocusTraversableParent() override; views::View* GetFocusTraversableParentView() override; + NotificationHiddenView* notification_hidden_view_for_testing() { + return notification_hidden_view_; + } + private: class FocusSearch; @@ -119,7 +124,7 @@ UnifiedSystemTrayController* const controller_; // Owned by views hierarchy. - views::View* const notification_hidden_view_; + NotificationHiddenView* const notification_hidden_view_; TopShortcutsView* const top_shortcuts_view_; FeaturePodsContainerView* const feature_pods_container_; UnifiedSlidersContainerView* const sliders_container_;
diff --git a/ash/wallpaper/wallpaper_controller.cc b/ash/wallpaper/wallpaper_controller.cc index 843b0e6..0efde9fd 100644 --- a/ash/wallpaper/wallpaper_controller.cc +++ b/ash/wallpaper/wallpaper_controller.cc
@@ -234,25 +234,18 @@ // Returns true if a color should be extracted from the wallpaper based on the // command kAshShelfColor line arg. bool IsShelfColoringEnabled() { - const bool kDefaultValue = true; - - if (!base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kAshShelfColor)) { - return kDefaultValue; - } - - const std::string switch_value = + const std::string explicit_switch_value = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( switches::kAshShelfColor); - if (switch_value != switches::kAshShelfColorEnabled && - switch_value != switches::kAshShelfColorDisabled) { - LOG(WARNING) << "Invalid '--" << switches::kAshShelfColor << "' value of '" - << switch_value << "'. Defaulting to " - << (kDefaultValue ? "enabled." : "disabled."); - return kDefaultValue; + + // Always enabled, unless explicitly disabled. + if (explicit_switch_value == switches::kAshShelfColorDisabled) { + LOG(WARNING) << "Shelf coloring explicitly disabled. " + << "This should only happen in tests."; + return false; } - return switch_value == switches::kAshShelfColorEnabled; + return true; } // Gets the color profiles for extracting wallpaper prominent colors.
diff --git a/ash/wallpaper/wallpaper_view.cc b/ash/wallpaper/wallpaper_view.cc index 684b8d2..d40ed09 100644 --- a/ash/wallpaper/wallpaper_view.cc +++ b/ash/wallpaper/wallpaper_view.cc
@@ -12,8 +12,6 @@ #include "ash/shell.h" #include "ash/wallpaper/wallpaper_controller.h" #include "ash/wallpaper/wallpaper_widget_controller.h" -#include "ash/wm/overview/overview_controller.h" -#include "ash/wm/overview/overview_utils.h" #include "ui/aura/window.h" #include "ui/display/display.h" #include "ui/display/manager/display_manager.h" @@ -95,58 +93,18 @@ } // namespace -// This event handler receives events in the pre-target phase and takes care of -// the following: -// - Disabling overview mode on touch release. -// - Disabling overview mode on mouse release. -class PreEventDispatchHandler : public ui::EventHandler { - public: - PreEventDispatchHandler() = default; - ~PreEventDispatchHandler() override = default; - - private: - // ui::EventHandler: - void OnMouseEvent(ui::MouseEvent* event) override { - if (event->type() == ui::ET_MOUSE_RELEASED) - HandleClickOrTap(event); - } - - void OnGestureEvent(ui::GestureEvent* event) override { - if (event->type() == ui::ET_GESTURE_TAP) - HandleClickOrTap(event); - } - - void HandleClickOrTap(ui::Event* event) { - CHECK_EQ(ui::EP_PRETARGET, event->phase()); - OverviewController* controller = Shell::Get()->overview_controller(); - if (!controller->IsSelecting()) - return; - // Events that happen while app list is sliding out during overview should - // be ignored to prevent overview from disappearing out from under the user. - if (!IsSlidingOutOverviewFromShelf()) - controller->ToggleOverview(); - event->StopPropagation(); - } - - DISALLOW_COPY_AND_ASSIGN(PreEventDispatchHandler); -}; - //////////////////////////////////////////////////////////////////////////////// // WallpaperView, public: -WallpaperView::WallpaperView() - : pre_dispatch_handler_(new PreEventDispatchHandler()) { +WallpaperView::WallpaperView() { set_context_menu_controller(this); - AddPreTargetHandler(pre_dispatch_handler_.get()); tablet_mode_observer_.Add(Shell::Get()->tablet_mode_controller()); is_tablet_mode_ = Shell::Get() ->tablet_mode_controller() ->IsTabletModeWindowManagerEnabled(); } -WallpaperView::~WallpaperView() { - RemovePreTargetHandler(pre_dispatch_handler_.get()); -} +WallpaperView::~WallpaperView() = default; void WallpaperView::OnTabletModeStarted() { is_tablet_mode_ = true;
diff --git a/ash/wallpaper/wallpaper_view.h b/ash/wallpaper/wallpaper_view.h index 17ee2210..52abdf19 100644 --- a/ash/wallpaper/wallpaper_view.h +++ b/ash/wallpaper/wallpaper_view.h
@@ -19,8 +19,6 @@ namespace ash { -class PreEventDispatchHandler; - class WallpaperView : public views::View, public views::ContextMenuController, TabletModeObserver { @@ -49,8 +47,6 @@ tablet_mode_observer_{this}; bool is_tablet_mode_ = false; - std::unique_ptr<PreEventDispatchHandler> pre_dispatch_handler_; - DISALLOW_COPY_AND_ASSIGN(WallpaperView); };
diff --git a/ash/wm/always_on_top_controller.cc b/ash/wm/always_on_top_controller.cc index acebe04..752554f 100644 --- a/ash/wm/always_on_top_controller.cc +++ b/ash/wm/always_on_top_controller.cc
@@ -5,39 +5,50 @@ #include "ash/wm/always_on_top_controller.h" #include "ash/public/cpp/shell_window_ids.h" +#include "ash/public/cpp/window_properties.h" +#include "ash/wm/window_state.h" #include "ash/wm/workspace/workspace_layout_manager.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" namespace ash { -AlwaysOnTopController::AlwaysOnTopController(aura::Window* viewport) - : always_on_top_container_(viewport) { - DCHECK_NE(kShellWindowId_DefaultContainer, viewport->id()); +AlwaysOnTopController::AlwaysOnTopController( + aura::Window* always_on_top_container, + aura::Window* pip_container) + : always_on_top_container_(always_on_top_container), + pip_container_(pip_container) { + DCHECK_NE(kShellWindowId_DefaultContainer, always_on_top_container_->id()); + DCHECK_NE(kShellWindowId_DefaultContainer, pip_container_->id()); always_on_top_container_->SetLayoutManager( - new WorkspaceLayoutManager(viewport)); + new WorkspaceLayoutManager(always_on_top_container_)); + pip_container_->SetLayoutManager(new WorkspaceLayoutManager(pip_container_)); // Container should be empty. DCHECK(always_on_top_container_->children().empty()); + DCHECK(pip_container_->children().empty()); always_on_top_container_->AddObserver(this); + pip_container->AddObserver(this); } AlwaysOnTopController::~AlwaysOnTopController() { - if (always_on_top_container_) - always_on_top_container_->RemoveObserver(this); + // At this point, all windows should be removed and AlwaysOnTopController + // will have removed itself as an observer in OnWindowDestroying. + DCHECK(!always_on_top_container_); + DCHECK(!pip_container_); } aura::Window* AlwaysOnTopController::GetContainer(aura::Window* window) const { DCHECK(always_on_top_container_); - if (window->GetProperty(aura::client::kAlwaysOnTopKey)) - return always_on_top_container_; - return always_on_top_container_->GetRootWindow()->GetChildById( - kShellWindowId_DefaultContainer); -} + DCHECK(pip_container_); -// TODO(rsadam@): Refactor so that this cast is unneeded. -WorkspaceLayoutManager* AlwaysOnTopController::GetLayoutManager() const { - return static_cast<WorkspaceLayoutManager*>( - always_on_top_container_->layout_manager()); + if (!window->GetProperty(aura::client::kAlwaysOnTopKey)) { + return always_on_top_container_->GetRootWindow()->GetChildById( + kShellWindowId_DefaultContainer); + } + if (window->parent() && wm::GetWindowState(window)->IsPip()) + return pip_container_; + + return always_on_top_container_; } void AlwaysOnTopController::SetLayoutManagerForTest( @@ -45,24 +56,43 @@ always_on_top_container_->SetLayoutManager(layout_manager.release()); } +void AlwaysOnTopController::AddWindow(aura::Window* window) { + window->AddObserver(this); + wm::GetWindowState(window)->AddObserver(this); +} + +void AlwaysOnTopController::RemoveWindow(aura::Window* window) { + window->RemoveObserver(this); + wm::GetWindowState(window)->RemoveObserver(this); +} + +void AlwaysOnTopController::ReparentWindow(aura::Window* window) { + DCHECK(window->type() == aura::client::WINDOW_TYPE_NORMAL || + window->type() == aura::client::WINDOW_TYPE_POPUP); + aura::Window* container = GetContainer(window); + if (window->parent() != container) + container->AddChild(window); +} + void AlwaysOnTopController::OnWindowHierarchyChanged( const HierarchyChangeParams& params) { - if (params.old_parent == always_on_top_container_) - params.target->RemoveObserver(this); - else if (params.new_parent == always_on_top_container_) - params.target->AddObserver(this); + if (params.old_parent == always_on_top_container_ || + params.old_parent == pip_container_) { + RemoveWindow(params.target); + } + + if (params.new_parent == always_on_top_container_ || + params.new_parent == pip_container_) { + AddWindow(params.target); + } } void AlwaysOnTopController::OnWindowPropertyChanged(aura::Window* window, const void* key, intptr_t old) { - if (window != always_on_top_container_ && + if (window != always_on_top_container_ && window != pip_container_ && key == aura::client::kAlwaysOnTopKey) { - DCHECK(window->type() == aura::client::WINDOW_TYPE_NORMAL || - window->type() == aura::client::WINDOW_TYPE_POPUP); - aura::Window* container = GetContainer(window); - if (window->parent() != container) - container->AddChild(window); + ReparentWindow(window); } } @@ -70,7 +100,18 @@ if (window == always_on_top_container_) { always_on_top_container_->RemoveObserver(this); always_on_top_container_ = nullptr; + } else if (window == pip_container_) { + pip_container_->RemoveObserver(this); + pip_container_ = nullptr; + } else { + RemoveWindow(window); } } +void AlwaysOnTopController::OnPreWindowStateTypeChange( + wm::WindowState* window_state, + mojom::WindowStateType old_type) { + ReparentWindow(window_state->window()); +} + } // namespace ash
diff --git a/ash/wm/always_on_top_controller.h b/ash/wm/always_on_top_controller.h index 44a26ea2..3bd5b0fc 100644 --- a/ash/wm/always_on_top_controller.h +++ b/ash/wm/always_on_top_controller.h
@@ -8,6 +8,7 @@ #include <memory> #include "ash/ash_export.h" +#include "ash/wm/window_state_observer.h" #include "base/macros.h" #include "ui/aura/window_observer.h" @@ -19,20 +20,24 @@ // 'AlwaysOnTop' property. That is, putting a window into the worskpace // container if its "AlwaysOnTop" property is false. Otherwise, put it in // |always_on_top_container_|. -class ASH_EXPORT AlwaysOnTopController : public aura::WindowObserver { +class ASH_EXPORT AlwaysOnTopController : public aura::WindowObserver, + wm::WindowStateObserver { public: - explicit AlwaysOnTopController(aura::Window* viewport); + explicit AlwaysOnTopController(aura::Window* always_on_top_container, + aura::Window* pip_container); ~AlwaysOnTopController() override; // Gets container for given |window| based on its "AlwaysOnTop" property. aura::Window* GetContainer(aura::Window* window) const; - WorkspaceLayoutManager* GetLayoutManager() const; - void SetLayoutManagerForTest( std::unique_ptr<WorkspaceLayoutManager> layout_manager); private: + void AddWindow(aura::Window* window); + void RemoveWindow(aura::Window* window); + void ReparentWindow(aura::Window* window); + // Overridden from aura::WindowObserver: void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override; void OnWindowPropertyChanged(aura::Window* window, @@ -40,11 +45,16 @@ intptr_t old) override; void OnWindowDestroying(aura::Window* window) override; + // Overridden from wm::WindowStateObserver: + void OnPreWindowStateTypeChange(wm::WindowState* window_state, + mojom::WindowStateType old_type) override; + aura::Window* always_on_top_container_; + aura::Window* pip_container_; DISALLOW_COPY_AND_ASSIGN(AlwaysOnTopController); }; -} // namepsace ash +} // namespace ash #endif // ASH_WM_ALWAYS_ON_TOP_CONTROLLER_H_
diff --git a/ash/wm/always_on_top_controller_unittest.cc b/ash/wm/always_on_top_controller_unittest.cc index 5832032..9d562e4 100644 --- a/ash/wm/always_on_top_controller_unittest.cc +++ b/ash/wm/always_on_top_controller_unittest.cc
@@ -9,9 +9,12 @@ #include "ash/root_window_controller.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" +#include "ash/wm/window_state.h" +#include "ash/wm/wm_event.h" #include "ash/wm/workspace/workspace_layout_manager.h" #include "base/command_line.h" #include "base/memory/ptr_util.h" +#include "ui/aura/client/aura_constants.h" #include "ui/keyboard/keyboard_controller.h" #include "ui/keyboard/keyboard_ui.h" #include "ui/keyboard/public/keyboard_switches.h" @@ -19,10 +22,10 @@ namespace ash { -class VirtualKeyboardAlwaysOnTopControllerTest : public AshTestBase { +class AlwaysOnTopControllerTest : public AshTestBase { public: - VirtualKeyboardAlwaysOnTopControllerTest() = default; - ~VirtualKeyboardAlwaysOnTopControllerTest() override = default; + AlwaysOnTopControllerTest() = default; + ~AlwaysOnTopControllerTest() override = default; void SetUp() override { base::CommandLine::ForCurrentProcess()->AppendSwitch( @@ -31,7 +34,7 @@ } private: - DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardAlwaysOnTopControllerTest); + DISALLOW_COPY_AND_ASSIGN(AlwaysOnTopControllerTest); }; class TestLayoutManager : public WorkspaceLayoutManager { @@ -56,7 +59,7 @@ // Verifies that the always on top controller is notified of keyboard bounds // changing events. -TEST_F(VirtualKeyboardAlwaysOnTopControllerTest, NotifyKeyboardBoundsChanging) { +TEST_F(AlwaysOnTopControllerTest, NotifyKeyboardBoundsChanging) { aura::Window* root_window = Shell::GetPrimaryRootWindow(); aura::Window* always_on_top_container = Shell::GetContainer(root_window, kShellWindowId_AlwaysOnTopContainer); @@ -76,4 +79,81 @@ ASSERT_TRUE(manager->keyboard_bounds_changed()); } +TEST_F(AlwaysOnTopControllerTest, + AlwaysOnTopContainerReturnedForAlwaysOnTopWindow) { + RootWindowController* controller = Shell::GetPrimaryRootWindowController(); + AlwaysOnTopController* always_on_top_controller = + controller->always_on_top_controller(); + + const gfx::Rect bounds(100, 100, 200, 200); + std::unique_ptr<aura::Window> always_on_top_window( + CreateTestWindowInShellWithBounds(bounds)); + always_on_top_window->SetProperty(aura::client::kAlwaysOnTopKey, true); + + aura::Window* container = + always_on_top_controller->GetContainer(always_on_top_window.get()); + ASSERT_TRUE(container); + EXPECT_EQ(kShellWindowId_AlwaysOnTopContainer, container->id()); +} + +TEST_F(AlwaysOnTopControllerTest, PipContainerReturnedForAlwaysOnTopPipWindow) { + RootWindowController* controller = Shell::GetPrimaryRootWindowController(); + AlwaysOnTopController* always_on_top_controller = + controller->always_on_top_controller(); + + const gfx::Rect bounds(100, 100, 200, 200); + std::unique_ptr<aura::Window> pip_window( + CreateTestWindowInShellWithBounds(bounds)); + + wm::WindowState* window_state = wm::GetWindowState(pip_window.get()); + const wm::WMEvent enter_pip(wm::WM_EVENT_PIP); + window_state->OnWMEvent(&enter_pip); + pip_window->SetProperty(aura::client::kAlwaysOnTopKey, true); + EXPECT_TRUE(window_state->IsPip()); + + aura::Window* container = + always_on_top_controller->GetContainer(pip_window.get()); + ASSERT_TRUE(container); + EXPECT_EQ(kShellWindowId_PipContainer, container->id()); +} + +TEST_F(AlwaysOnTopControllerTest, + DefaultContainerReturnedForWindowNotAlwaysOnTop) { + RootWindowController* controller = Shell::GetPrimaryRootWindowController(); + AlwaysOnTopController* always_on_top_controller = + controller->always_on_top_controller(); + + const gfx::Rect bounds(100, 100, 200, 200); + std::unique_ptr<aura::Window> window( + CreateTestWindowInShellWithBounds(bounds)); + + aura::Window* container = + always_on_top_controller->GetContainer(window.get()); + ASSERT_TRUE(container); + EXPECT_EQ(kShellWindowId_DefaultContainer, container->id()); +} + +TEST_F(AlwaysOnTopControllerTest, + AlwaysOnTopWindowMovedBetweenContainersWhenPipStateChanges) { + const gfx::Rect bounds(100, 100, 200, 200); + std::unique_ptr<aura::Window> window( + CreateTestWindowInShellWithBounds(bounds)); + window->SetProperty(aura::client::kAlwaysOnTopKey, true); + + EXPECT_EQ(kShellWindowId_AlwaysOnTopContainer, window->parent()->id()); + + wm::WindowState* window_state = wm::GetWindowState(window.get()); + const wm::WMEvent enter_pip(wm::WM_EVENT_PIP); + window_state->OnWMEvent(&enter_pip); + EXPECT_TRUE(window_state->IsPip()); + + EXPECT_EQ(kShellWindowId_PipContainer, window->parent()->id()); + + const wm::WMEvent enter_normal(wm::WM_EVENT_NORMAL); + window_state->OnWMEvent(&enter_normal); + EXPECT_FALSE(window_state->IsPip()); + + EXPECT_EQ(kShellWindowId_AlwaysOnTopContainer, window->parent()->id()); +} + } // namespace ash
diff --git a/ash/wm/desks/desks_bar_view.cc b/ash/wm/desks/desks_bar_view.cc new file mode 100644 index 0000000..88ce533 --- /dev/null +++ b/ash/wm/desks/desks_bar_view.cc
@@ -0,0 +1,62 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/wm/desks/desks_bar_view.h" + +#include "ash/wm/desks/desks_controller.h" +#include "ash/wm/desks/new_desk_button.h" +#include "third_party/skia/include/core/SkColor.h" +#include "ui/gfx/geometry/insets.h" + +namespace ash { + +DesksBarView::DesksBarView() : new_desk_button_(new NewDeskButton(this)) { + SetPaintToLayer(ui::LAYER_SOLID_COLOR); + layer()->SetFillsBoundsOpaquely(false); + layer()->SetColor(SkColorSetARGB(60, 0, 0, 0)); + + AddChildView(new_desk_button_); + new_desk_button_->SetEnabled(DesksController::Get()->CanCreateDesks()); +} + +// static +int DesksBarView::GetBarHeight() { + // TODO(afakhry): Bar expands when we add the second desk. + return 48; +} + +const char* DesksBarView::GetClassName() const { + return "DesksBarView"; +} + +void DesksBarView::Layout() { + constexpr int kButtonRightMargin = 36; + constexpr int kIconAndTextHorizontalPadding = 16; + constexpr int kIconAndTextVerticalPadding = 8; + + gfx::Size new_desk_button_size = new_desk_button_->GetPreferredSize(); + new_desk_button_size.Enlarge(2 * kIconAndTextHorizontalPadding, + 2 * kIconAndTextVerticalPadding); + + const gfx::Rect button_bounds{ + bounds().right() - new_desk_button_size.width() - kButtonRightMargin, + (bounds().height() - new_desk_button_size.height()) / 2, + new_desk_button_size.width(), new_desk_button_size.height()}; + new_desk_button_->SetBoundsRect(button_bounds); + + // TODO(afakhry): Layout thumbnails. +} + +void DesksBarView::ButtonPressed(views::Button* sender, + const ui::Event& event) { + auto* controller = DesksController::Get(); + if (sender == new_desk_button_ && controller->CanCreateDesks()) { + controller->NewDesk(); + return; + } + + // TODO(afakhry): Handle thumbnail presses. +} + +} // namespace ash
diff --git a/ash/wm/desks/desks_bar_view.h b/ash/wm/desks/desks_bar_view.h new file mode 100644 index 0000000..77594a37 --- /dev/null +++ b/ash/wm/desks/desks_bar_view.h
@@ -0,0 +1,39 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_WM_DESKS_DESKS_BAR_VIEW_H_ +#define ASH_WM_DESKS_DESKS_BAR_VIEW_H_ + +#include "base/macros.h" +#include "ui/views/controls/button/button.h" + +namespace ash { + +class NewDeskButton; + +// A bar that resides at the top portion of the overview mode's ShieldView, +// which contains the virtual desks thumbnails, as well as the new desk button. +class DesksBarView : public views::View, public views::ButtonListener { + public: + DesksBarView(); + ~DesksBarView() override = default; + + static int GetBarHeight(); + + // views::View: + const char* GetClassName() const override; + void Layout() override; + + // views::ButtonListener: + void ButtonPressed(views::Button* sender, const ui::Event& event) override; + + private: + NewDeskButton* new_desk_button_; + + DISALLOW_COPY_AND_ASSIGN(DesksBarView); +}; + +} // namespace ash + +#endif // ASH_WM_DESKS_DESKS_BAR_VIEW_H_
diff --git a/ash/wm/desks/desks_controller.cc b/ash/wm/desks/desks_controller.cc new file mode 100644 index 0000000..4be7a05 --- /dev/null +++ b/ash/wm/desks/desks_controller.cc
@@ -0,0 +1,26 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/wm/desks/desks_controller.h" + +#include "ash/shell.h" +#include "base/logging.h" + +namespace ash { + +// static +DesksController* DesksController::Get() { + return Shell::Get()->desks_controller(); +} + +bool DesksController::CanCreateDesks() const { + // TODO(afakhry): Maximum of four desks. + return true; +} + +void DesksController::NewDesk() { + NOTIMPLEMENTED(); +} + +} // namespace ash
diff --git a/ash/wm/desks/desks_controller.h b/ash/wm/desks/desks_controller.h new file mode 100644 index 0000000..6d69c98 --- /dev/null +++ b/ash/wm/desks/desks_controller.h
@@ -0,0 +1,34 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_WM_DESKS_DESKS_CONTROLLER_H_ +#define ASH_WM_DESKS_DESKS_CONTROLLER_H_ + +#include "base/macros.h" + +namespace ash { + +// Defines a controller for creating, destroying and managing virtual desks and +// their windows. +class DesksController { + public: + DesksController() = default; + ~DesksController() = default; + + // Convenience method for returning the DesksController instance. The actual + // instance is created and owned by Shell. + static DesksController* Get(); + + // Returns true if we haven't reached the maximum allowed number of desks. + bool CanCreateDesks() const; + + void NewDesk(); + + private: + DISALLOW_COPY_AND_ASSIGN(DesksController); +}; + +} // namespace ash + +#endif // ASH_WM_DESKS_DESKS_CONTROLLER_H_
diff --git a/ash/wm/desks/new_desk_button.cc b/ash/wm/desks/new_desk_button.cc new file mode 100644 index 0000000..9c72659 --- /dev/null +++ b/ash/wm/desks/new_desk_button.cc
@@ -0,0 +1,95 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/wm/desks/new_desk_button.h" + +#include <utility> + +#include "ash/resources/vector_icons/vector_icons.h" +#include "ash/strings/grit/ash_strings.h" +#include "base/strings/utf_string_conversions.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/gfx/color_palette.h" +#include "ui/gfx/paint_vector_icon.h" +#include "ui/views/animation/ink_drop_impl.h" +#include "ui/views/animation/ink_drop_mask.h" +#include "ui/views/background.h" +#include "ui/views/controls/button/label_button_border.h" +#include "ui/views/style/platform_style.h" + +namespace ash { + +namespace { + +constexpr int kCornerRadius = 16; + +constexpr int kImageLabelSpacing = 8; + +constexpr float kInkDropVisibleOpacity = 0.2f; + +constexpr float kInkDropHighlightVisibleOpacity = 0.3f; + +constexpr SkColor kHighlightBackgroundColor = SkColorSetARGB(60, 255, 255, 255); + +} // namespace + +NewDeskButton::NewDeskButton(views::ButtonListener* listener) + : LabelButton(listener, + l10n_util::GetStringUTF16(IDS_ASH_DESKS_NEW_DESK_BUTTON)) { + SetPaintToLayer(); + layer()->SetFillsBoundsOpaquely(false); + SetHorizontalAlignment(gfx::ALIGN_CENTER); + SetImage(views::Button::STATE_NORMAL, + gfx::CreateVectorIcon(kNewDeskButtonIcon, SK_ColorWHITE)); + SetImage(views::Button::STATE_DISABLED, + gfx::CreateVectorIcon(kNewDeskButtonIcon, SK_ColorGRAY)); + SetTextColor(views::Button::STATE_NORMAL, SK_ColorWHITE); + SetTextColor(views::Button::STATE_HOVERED, SK_ColorWHITE); + SetTextColor(views::Button::STATE_PRESSED, SK_ColorWHITE); + SetTextColor(views::Button::STATE_DISABLED, SK_ColorGRAY); + SetImageLabelSpacing(kImageLabelSpacing); + SetInkDropMode(InkDropMode::ON); + set_has_ink_drop_action_on_click(true); + set_ink_drop_visible_opacity(kInkDropVisibleOpacity); + SetFocusPainter(nullptr); + SetBackground( + CreateBackgroundFromPainter(views::Painter::CreateSolidRoundRectPainter( + kHighlightBackgroundColor, kCornerRadius))); +} + +const char* NewDeskButton::GetClassName() const { + return "NewDeskButton"; +} + +std::unique_ptr<views::InkDrop> NewDeskButton::CreateInkDrop() { + auto ink_drop = CreateDefaultFloodFillInkDropImpl(); + ink_drop->SetShowHighlightOnHover(true); + ink_drop->SetShowHighlightOnFocus(!views::PlatformStyle::kPreferFocusRings); + return std::move(ink_drop); +} + +std::unique_ptr<views::InkDropHighlight> NewDeskButton::CreateInkDropHighlight() + const { + auto highlight = LabelButton::CreateInkDropHighlight(); + highlight->set_visible_opacity(kInkDropHighlightVisibleOpacity); + return highlight; +} + +SkColor NewDeskButton::GetInkDropBaseColor() const { + return SK_ColorWHITE; +} + +std::unique_ptr<views::InkDropMask> NewDeskButton::CreateInkDropMask() const { + return std::make_unique<views::RoundRectInkDropMask>(size(), gfx::Insets(), + kCornerRadius); +} + +std::unique_ptr<views::LabelButtonBorder> NewDeskButton::CreateDefaultBorder() + const { + std::unique_ptr<views::LabelButtonBorder> border = + std::make_unique<views::LabelButtonBorder>(); + return border; +} + +} // namespace ash
diff --git a/ash/wm/desks/new_desk_button.h b/ash/wm/desks/new_desk_button.h new file mode 100644 index 0000000..696ca40 --- /dev/null +++ b/ash/wm/desks/new_desk_button.h
@@ -0,0 +1,38 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_WM_DESKS_NEW_DESK_BUTTON_H_ +#define ASH_WM_DESKS_NEW_DESK_BUTTON_H_ + +#include <memory> + +#include "base/macros.h" +#include "ui/views/controls/button/label_button.h" + +namespace ash { + +// A button view that shows up in the top-right corner of the screen when +// overview mode is on, which is used to create a new virtual desk. +class NewDeskButton : public views::LabelButton { + public: + NewDeskButton(views::ButtonListener* listener); + ~NewDeskButton() override = default; + + // LabelButton: + const char* GetClassName() const override; + std::unique_ptr<views::InkDrop> CreateInkDrop() override; + std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() + const override; + SkColor GetInkDropBaseColor() const override; + std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override; + std::unique_ptr<views::LabelButtonBorder> CreateDefaultBorder() + const override; + + private: + DISALLOW_COPY_AND_ASSIGN(NewDeskButton); +}; + +} // namespace ash + +#endif // ASH_WM_DESKS_NEW_DESK_BUTTON_H_
diff --git a/ash/wm/overview/overview_controller.cc b/ash/wm/overview/overview_controller.cc index ad1bb4c..6c08d80 100644 --- a/ash/wm/overview/overview_controller.cc +++ b/ash/wm/overview/overview_controller.cc
@@ -448,10 +448,8 @@ aura::Window* active_window = wm::GetActiveWindow(); while (::wm::GetTransientParent(active_window)) active_window = ::wm::GetTransientParent(active_window); - if (active_window != split_view_controller->left_window() && - active_window != split_view_controller->right_window()) { + if (!split_view_controller->IsWindowInSplitView(active_window)) active_window = split_view_controller->GetDefaultSnappedWindow(); - } DCHECK(active_window); split_view_controller->EndSplitView(); if (IsSelecting())
diff --git a/ash/wm/overview/overview_grid.cc b/ash/wm/overview/overview_grid.cc index 925df668..18bc21e 100644 --- a/ash/wm/overview/overview_grid.cc +++ b/ash/wm/overview/overview_grid.cc
@@ -8,6 +8,7 @@ #include <functional> #include <utility> +#include "ash/public/cpp/ash_features.h" #include "ash/public/cpp/shelf_types.h" #include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/wallpaper_types.h" @@ -22,6 +23,7 @@ #include "ash/strings/grit/ash_strings.h" #include "ash/wallpaper/wallpaper_controller.h" #include "ash/wallpaper/wallpaper_widget_controller.h" +#include "ash/wm/desks/desks_bar_view.h" #include "ash/wm/overview/cleanup_animation_observer.h" #include "ash/wm/overview/drop_target_view.h" #include "ash/wm/overview/overview_constants.h" @@ -187,6 +189,9 @@ // ShieldView contains the background for overview mode. It also contains text // which is shown if there are no windows to be displayed. +// This view also takes care of disabling overview mode on: +// - Gesture tap. +// - Mouse release. class OverviewGrid::ShieldView : public views::View { public: ShieldView() { @@ -223,6 +228,11 @@ AddChildView(background_view_); AddChildView(label_container_); + + if (features::IsVirtualDesksEnabled()) { + desks_bar_view_ = new DesksBarView; + AddChildView(desks_bar_view_); + } } ~ShieldView() override = default; @@ -249,19 +259,70 @@ label_container_bounds.ClampToCenteredSize( gfx::Size(label_width, kNoItemsIndicatorHeightDp)); label_container_->SetBoundsRect(label_container_bounds); + + UpdateDesksBarBounds(); } bool IsLabelVisible() const { return label_container_->visible(); } protected: // views::View: - void Layout() override { background_view_->SetBoundsRect(GetLocalBounds()); } + void Layout() override { + background_view_->SetBoundsRect(GetLocalBounds()); + UpdateDesksBarBounds(); + } private: + // ui::EventHandler: + void OnMouseEvent(ui::MouseEvent* event) override { + if (event->type() == ui::ET_MOUSE_PRESSED) { + // In order to receive subsequent mouse release events in this view, we + // must mark the event as handled in this view. + event->SetHandled(); + return; + } + + HandleClickReleaseOrTap(event); + } + + void OnGestureEvent(ui::GestureEvent* event) override { + HandleClickReleaseOrTap(event); + } + + void HandleClickReleaseOrTap(ui::Event* event) { + if (event->type() != ui::ET_MOUSE_RELEASED && + event->type() != ui::ET_GESTURE_TAP) { + return; + } + + OverviewController* controller = Shell::Get()->overview_controller(); + if (!controller->IsSelecting()) + return; + + // Events that happen while app list is sliding out during overview should + // be ignored to prevent overview from disappearing out from under the user. + if (!IsSlidingOutOverviewFromShelf()) + controller->ToggleOverview(); + + event->StopPropagation(); + } + + void UpdateDesksBarBounds() { + if (!desks_bar_view_) + return; + + // TODO: Make the ShieldView's bounds match the overview grid bounds rather + // than the entire screen? + const auto bar_bounds = + gfx::Rect{bounds().width(), DesksBarView::GetBarHeight()}; + desks_bar_view_->SetBoundsRect(bar_bounds); + } + // Owned by views heirarchy. views::View* background_view_ = nullptr; RoundedRectView* label_container_ = nullptr; views::Label* label_ = nullptr; + DesksBarView* desks_bar_view_ = nullptr; DISALLOW_COPY_AND_ASSIGN(ShieldView); }; @@ -1211,7 +1272,7 @@ shield_widget_ = CreateBackgroundWidget( root_window_, ui::LAYER_NOT_DRAWN, SK_ColorTRANSPARENT, 0, 0, SK_ColorTRANSPARENT, initial_opacity, /*parent=*/nullptr, - /*stack_on_top=*/true); + /*stack_on_top=*/true, /*accept_events=*/true); aura::Window* widget_window = shield_widget_->GetNativeWindow(); aura::Window* parent_window = widget_window->parent(); const gfx::Rect bounds = ash::screen_util::SnapBoundsToDisplayEdge( @@ -1221,9 +1282,9 @@ // Create |shield_view_| and animate its background and label if needed. shield_view_ = new ShieldView(); + shield_widget_->SetContentsView(shield_view_); shield_view_->SetBackgroundColor(GetShieldColor()); shield_view_->SetGridBounds(bounds_); - shield_widget_->SetContentsView(shield_view_); if (animate) { shield_widget_->SetOpacity(initial_opacity); @@ -1239,7 +1300,7 @@ selection_widget_ = CreateBackgroundWidget( root_window_, ui::LAYER_TEXTURED, kWindowSelectionColor, 0, kWindowSelectionRadius, SK_ColorTRANSPARENT, 0.f, /*parent=*/nullptr, - /*stack_on_top=*/true); + /*stack_on_top=*/true, /*accept_events=*/false); aura::Window* widget_window = selection_widget_->GetNativeWindow(); gfx::Rect target_bounds = SelectedWindow()->target_bounds(); ::wm::ConvertRectFromScreen(root_window_, &target_bounds); @@ -1330,6 +1391,10 @@ std::vector<gfx::Rect> OverviewGrid::GetWindowRects( OverviewItem* ignored_item) { gfx::Rect total_bounds = bounds_; + + if (features::IsVirtualDesksEnabled()) + total_bounds.Inset(0, DesksBarView::GetBarHeight(), 0, 0); + // Windows occupy vertically centered area with additional vertical insets. int horizontal_inset = gfx::ToFlooredInt(std::min(kOverviewInsetRatio * total_bounds.width(),
diff --git a/ash/wm/overview/overview_item.cc b/ash/wm/overview/overview_item.cc index ef7863a..c2f6c14 100644 --- a/ash/wm/overview/overview_item.cc +++ b/ash/wm/overview/overview_item.cc
@@ -69,7 +69,7 @@ /*root_window=*/nullptr, ui::LAYER_TEXTURED, kBackdropColor, /*border_thickness=*/0, kBackdropRoundingDp, kBackdropColor, /*initial_opacity=*/1.f, parent, - /*stack_on_top=*/false); + /*stack_on_top=*/false, /*accept_events=*/false); widget->GetNativeWindow()->SetName("OverviewBackdrop"); return widget; }
diff --git a/ash/wm/overview/overview_utils.cc b/ash/wm/overview/overview_utils.cc index 2f42102..ce0f9d3 100644 --- a/ash/wm/overview/overview_utils.cc +++ b/ash/wm/overview/overview_utils.cc
@@ -186,7 +186,8 @@ SkColor border_color, float initial_opacity, aura::Window* parent, - bool stack_on_top) { + bool stack_on_top, + bool accept_events) { std::unique_ptr<views::Widget> widget = std::make_unique<views::Widget>(); views::Widget::InitParams params; params.type = views::Widget::InitParams::TYPE_POPUP; @@ -194,7 +195,7 @@ params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; params.layer_type = layer_type; - params.accept_events = false; + params.accept_events = accept_events; widget->set_focus_on_creation(false); // Parenting in kShellWindowId_WallpaperContainer allows proper layering of // the shield and selection widgets. Since that container is created with
diff --git a/ash/wm/overview/overview_utils.h b/ash/wm/overview/overview_utils.h index a93f7c1a..cfdc97a0 100644 --- a/ash/wm/overview/overview_utils.h +++ b/ash/wm/overview/overview_utils.h
@@ -50,7 +50,8 @@ // The new background widget starts with |initial_opacity| and then fades in. // If |parent| is prvoided the return widget will be parented to that window, // otherwise its parent will be in kShellWindowId_WallpaperContainer of -// |root_window|. +// |root_window|. |accept_events| is true if the newly-created widget should +// handle events. std::unique_ptr<views::Widget> CreateBackgroundWidget(aura::Window* root_window, ui::LayerType layer_type, SkColor background_color, @@ -59,7 +60,8 @@ SkColor border_color, float initial_opacity, aura::Window* parent, - bool stack_on_top); + bool stack_on_top, + bool accept_events); // Calculates the bounds of the |transformed_window|. Those bounds are a union // of all regular (normal and panel) windows in the |transformed_window|'s
diff --git a/ash/wm/splitview/split_view_controller.cc b/ash/wm/splitview/split_view_controller.cc index 5d207ce..0526923 100644 --- a/ash/wm/splitview/split_view_controller.cc +++ b/ash/wm/splitview/split_view_controller.cc
@@ -547,7 +547,7 @@ void SplitViewController::OnWindowDragStarted(aura::Window* dragged_window) { DCHECK(dragged_window); - if (dragged_window == left_window_ || dragged_window == right_window_) + if (IsWindowInSplitView(dragged_window)) OnSnappedWindowDetached(dragged_window); // OnSnappedWindowDetached() may end split view mode. @@ -592,7 +592,7 @@ void SplitViewController::OnWindowDestroyed(aura::Window* window) { DCHECK(IsSplitViewModeActive()); - DCHECK(window == left_window_ || window == right_window_); + DCHECK(IsWindowInSplitView(window)); auto iter = snapping_window_transformed_bounds_map_.find(window); if (iter != snapping_window_transformed_bounds_map_.end()) snapping_window_transformed_bounds_map_.erase(iter); @@ -1168,8 +1168,7 @@ } void SplitViewController::OnSnappedWindowDetached(aura::Window* window) { - DCHECK(window); - DCHECK(window == left_window_ || window == right_window_); + DCHECK(IsWindowInSplitView(window)); if (left_window_ == window) { StopObserving(LEFT); } else { @@ -1281,7 +1280,7 @@ } int SplitViewController::GetWindowComponentForResize(aura::Window* window) { - if (window && (window == left_window_ || window == right_window_)) { + if (IsWindowInSplitView(window)) { switch (GetCurrentScreenOrientation()) { case OrientationLockType::kLandscapePrimary: return (window == left_window_) ? HTRIGHT : HTLEFT; @@ -1302,7 +1301,7 @@ aura::Window* window, const gfx::Point& location_in_screen) { gfx::Point end_location(location_in_screen); - if (!window || (window != left_window_ && window != right_window_)) + if (!IsWindowInSplitView(window)) return end_location; const gfx::Rect bounds = (window == left_window_) @@ -1329,7 +1328,7 @@ } void SplitViewController::RestoreTransformIfApplicable(aura::Window* window) { - DCHECK(window == left_window_ || window == right_window_); + DCHECK(IsWindowInSplitView(window)); // If the transform of the window has been changed, calculate a good starting // transform based on its transformed bounds before to be snapped.
diff --git a/ash/wm/tablet_mode/tablet_mode_browser_window_drag_delegate.cc b/ash/wm/tablet_mode/tablet_mode_browser_window_drag_delegate.cc index 8cdacc0d..b51b1f9b 100644 --- a/ash/wm/tablet_mode/tablet_mode_browser_window_drag_delegate.cc +++ b/ash/wm/tablet_mode/tablet_mode_browser_window_drag_delegate.cc
@@ -158,7 +158,7 @@ shield_widget_ = CreateBackgroundWidget( root_window, ui::LAYER_SOLID_COLOR, SK_ColorTRANSPARENT, 0, 0, SK_ColorTRANSPARENT, /*initial_opacity*/ 1.f, /*parent=*/nullptr, - /*stack_on_top=*/true); + /*stack_on_top=*/true, /*accept_events=*/false); aura::Window* widget_window = shield_widget_->GetNativeWindow(); const gfx::Rect bounds = widget_window->parent()->bounds(); widget_window->SetBounds(bounds); @@ -305,8 +305,7 @@ aura::Window* source_window = dragged_window_->GetProperty(ash::kTabDraggingSourceWindowKey); if (!source_window || source_window == dragged_window_ || - source_window == split_view_controller_->left_window() || - source_window == split_view_controller_->right_window() || + split_view_controller_->IsWindowInSplitView(source_window) || source_window->GetProperty(ash::kIsShowingInOverviewKey)) { return; }
diff --git a/ash/wm/tablet_mode/tablet_mode_controller_test_api.cc b/ash/wm/tablet_mode/tablet_mode_controller_test_api.cc index 26fa3319..0f56c03b 100644 --- a/ash/wm/tablet_mode/tablet_mode_controller_test_api.cc +++ b/ash/wm/tablet_mode/tablet_mode_controller_test_api.cc
@@ -5,6 +5,8 @@ #include "ash/wm/tablet_mode/tablet_mode_controller_test_api.h" #include "ash/shell.h" +#include "ash/wm/tablet_mode/tablet_mode_window_manager.h" +#include "ash/wm/tablet_mode/tablet_mode_window_state.h" #include "base/run_loop.h" #include "base/time/default_tick_clock.h" #include "services/ws/public/cpp/input_devices/input_device_client_test_api.h" @@ -83,4 +85,14 @@ tick_clock()->NowTicks()); } +bool TabletModeControllerTestApi::GetDeferBoundsUpdates(aura::Window* window) { + TabletModeWindowManager* window_manager = tablet_mode_window_manager(); + if (window_manager == nullptr) + return false; + TabletModeWindowManager::WindowToState window_state_map = + window_manager->window_state_map_; + auto iter = window_state_map.find(window); + return iter != window_state_map.end() && iter->second->defer_bounds_updates_; +} + } // namespace ash
diff --git a/ash/wm/tablet_mode/tablet_mode_controller_test_api.h b/ash/wm/tablet_mode/tablet_mode_controller_test_api.h index f6be0ae..8a403d3 100644 --- a/ash/wm/tablet_mode/tablet_mode_controller_test_api.h +++ b/ash/wm/tablet_mode/tablet_mode_controller_test_api.h
@@ -45,6 +45,8 @@ void CloseLid(); void SetTabletMode(bool on); + bool GetDeferBoundsUpdates(aura::Window* window); + // Sets the event blocker on the tablet mode controller. void set_event_blocker( std::unique_ptr<InternalInputDevicesEventBlocker> blocker) {
diff --git a/ash/wm/tablet_mode/tablet_mode_controller_unittest.cc b/ash/wm/tablet_mode/tablet_mode_controller_unittest.cc index c7d13eb..a87b3c9 100644 --- a/ash/wm/tablet_mode/tablet_mode_controller_unittest.cc +++ b/ash/wm/tablet_mode/tablet_mode_controller_unittest.cc
@@ -142,6 +142,10 @@ base::UserActionTester* user_action_tester() { return &user_action_tester_; } + bool GetDeferBoundsUpdates(aura::Window* window) { + return test_api_->GetDeferBoundsUpdates(window); + } + // Creates a test window snapped on the left in desktop mode. std::unique_ptr<aura::Window> CreateDesktopWindowSnappedLeft() { std::unique_ptr<aura::Window> window = CreateTestWindow(); @@ -1115,6 +1119,7 @@ tablet_mode_controller()->EnableTabletModeWindowManager(true); EXPECT_EQ(SplitViewController::NO_SNAP, split_view_controller->state()); EXPECT_FALSE(Shell::Get()->overview_controller()->IsSelecting()); + EXPECT_FALSE(GetDeferBoundsUpdates(window.get())); } // Test that if the active window is snapped on the left before tablet mode, @@ -1128,6 +1133,7 @@ EXPECT_EQ(SplitViewController::LEFT_SNAPPED, split_view_controller->state()); EXPECT_EQ(window.get(), split_view_controller->left_window()); EXPECT_TRUE(Shell::Get()->overview_controller()->IsSelecting()); + EXPECT_FALSE(GetDeferBoundsUpdates(window.get())); } // Test that if the active window is snapped on the right before tablet mode, @@ -1141,6 +1147,7 @@ EXPECT_EQ(SplitViewController::RIGHT_SNAPPED, split_view_controller->state()); EXPECT_EQ(window.get(), split_view_controller->right_window()); EXPECT_TRUE(Shell::Get()->overview_controller()->IsSelecting()); + EXPECT_FALSE(GetDeferBoundsUpdates(window.get())); } // Test that if before tablet mode, the active window is snapped on the left and @@ -1158,6 +1165,8 @@ EXPECT_EQ(left_window.get(), split_view_controller->left_window()); EXPECT_EQ(right_window.get(), split_view_controller->right_window()); EXPECT_FALSE(Shell::Get()->overview_controller()->IsSelecting()); + EXPECT_FALSE(GetDeferBoundsUpdates(left_window.get())); + EXPECT_FALSE(GetDeferBoundsUpdates(right_window.get())); } // Test that if before tablet mode, the active window is snapped on the right @@ -1175,6 +1184,8 @@ EXPECT_EQ(left_window.get(), split_view_controller->left_window()); EXPECT_EQ(right_window.get(), split_view_controller->right_window()); EXPECT_FALSE(Shell::Get()->overview_controller()->IsSelecting()); + EXPECT_FALSE(GetDeferBoundsUpdates(left_window.get())); + EXPECT_FALSE(GetDeferBoundsUpdates(right_window.get())); } // Test that if before tablet mode, the active window is an ARC window snapped @@ -1193,6 +1204,8 @@ tablet_mode_controller()->EnableTabletModeWindowManager(true); EXPECT_EQ(SplitViewController::NO_SNAP, split_view_controller->state()); EXPECT_FALSE(Shell::Get()->overview_controller()->IsSelecting()); + EXPECT_FALSE(GetDeferBoundsUpdates(left_window.get())); + EXPECT_FALSE(GetDeferBoundsUpdates(right_window.get())); } // Test that if before tablet mode, the active window is snapped on the left, @@ -1216,6 +1229,9 @@ EXPECT_EQ(SplitViewController::LEFT_SNAPPED, split_view_controller->state()); EXPECT_EQ(left_window.get(), split_view_controller->left_window()); EXPECT_TRUE(Shell::Get()->overview_controller()->IsSelecting()); + EXPECT_FALSE(GetDeferBoundsUpdates(left_window.get())); + EXPECT_TRUE(GetDeferBoundsUpdates(right_window.get())); + EXPECT_TRUE(GetDeferBoundsUpdates(extra_right_window.get())); } // Test that if overview is triggered on entering tablet mode, then the app list @@ -1230,4 +1246,41 @@ EXPECT_TRUE(app_list_controller->IsVisible()); } +// Test that bounds updates are deferred for windows in overview. +TEST_F(TabletModeControllerTest, DeferBoundsUpdatesForWindowsInOverview) { + tablet_mode_controller()->EnableTabletModeWindowManager(true); + std::unique_ptr<aura::Window> window1 = CreateTestWindow(); + std::unique_ptr<aura::Window> window2 = CreateTestWindow(); + std::unique_ptr<aura::Window> window3 = CreateTestWindow(); + ASSERT_FALSE(GetDeferBoundsUpdates(window1.get())); + ASSERT_FALSE(GetDeferBoundsUpdates(window2.get())); + ASSERT_FALSE(GetDeferBoundsUpdates(window3.get())); + Shell::Get()->overview_controller()->ToggleOverview(); + EXPECT_TRUE(GetDeferBoundsUpdates(window1.get())); + EXPECT_TRUE(GetDeferBoundsUpdates(window2.get())); + EXPECT_TRUE(GetDeferBoundsUpdates(window3.get())); +} + +// Test that bounds updates are deferred for windows in overview, in the case +// that there are two snapped windows when overview is started. +TEST_F(TabletModeControllerTest, + DeferBoundsUpdatesForWindowsInOverviewEnteredFromSplitView) { + SplitViewController* split_view_controller = + Shell::Get()->split_view_controller(); + tablet_mode_controller()->EnableTabletModeWindowManager(true); + std::unique_ptr<aura::Window> window1 = CreateTestWindow(); + std::unique_ptr<aura::Window> window2 = CreateTestWindow(); + std::unique_ptr<aura::Window> window3 = CreateTestWindow(); + split_view_controller->SnapWindow(window1.get(), SplitViewController::LEFT); + split_view_controller->SnapWindow(window2.get(), SplitViewController::RIGHT); + ASSERT_FALSE(GetDeferBoundsUpdates(window1.get())); + ASSERT_FALSE(GetDeferBoundsUpdates(window2.get())); + ASSERT_FALSE(GetDeferBoundsUpdates(window3.get())); + Shell::Get()->overview_controller()->ToggleOverview(); + ASSERT_EQ(SplitViewController::LEFT_SNAPPED, split_view_controller->state()); + EXPECT_FALSE(GetDeferBoundsUpdates(window1.get())); + EXPECT_TRUE(GetDeferBoundsUpdates(window2.get())); + EXPECT_TRUE(GetDeferBoundsUpdates(window3.get())); +} + } // namespace ash
diff --git a/ash/wm/tablet_mode/tablet_mode_window_manager.cc b/ash/wm/tablet_mode/tablet_mode_window_manager.cc index f8da6635..5ec6055 100644 --- a/ash/wm/tablet_mode/tablet_mode_window_manager.cc +++ b/ash/wm/tablet_mode/tablet_mode_window_manager.cc
@@ -115,8 +115,33 @@ } void TabletModeWindowManager::OnOverviewModeStarting() { - for (auto& pair : window_state_map_) - SetDeferBoundsUpdates(pair.first, /*defer_bounds_updates=*/true); + SplitViewController* split_view_controller = + Shell::Get()->split_view_controller(); + aura::Window* left_snapped_window = split_view_controller->left_window(); + aura::Window* right_snapped_window = split_view_controller->right_window(); + // Defer bounds updates for windows in overview. + for (auto& pair : window_state_map_) { + aura::Window* window = pair.first; + // If |overview_upcoming_for_split_view_| is true, then overview is starting + // because a snapped active window from desktop mode was carried over to + // split view on entering tablet mode. Then that window should be skipped + // (see https://crbug.com/926602). If |overview_upcoming_for_split_view_| is + // false and split view is active, then there are two snapped windows of + // which one is about to enter overview and therefore should not be skipped. + // In that case, there is no simple way to determine which of the two + // snapped windows will be put in overview, but fortunately, an upcoming + // call to OnSplitViewStateChanged() can be relied upon to set + // |defer_bounds_updates| to false in the window that remains snapped, and + // so here we can simply set |defer_bounds_updates| to true in all windows. + // Finally, if |overview_upcoming_for_split_view_| is false and split view + // is not active, then, of course, there are no snapped windows to skip. + if (overview_upcoming_for_split_view_ && + (window == left_snapped_window || window == right_snapped_window)) + continue; + SetDeferBoundsUpdates(window, /*defer_bounds_updates=*/true); + } + + overview_upcoming_for_split_view_ = false; } void TabletModeWindowManager::OnOverviewModeEnding( @@ -361,7 +386,9 @@ SplitViewController* split_view_controller = Shell::Get()->split_view_controller(); split_view_controller->SnapWindow(windows[0], curr_win_snap_pos); - if (prev_win_snap_pos != SplitViewController::NONE) + if (prev_win_snap_pos == SplitViewController::NONE) + overview_upcoming_for_split_view_ = true; + else split_view_controller->SnapWindow(windows[1], prev_win_snap_pos); for (auto* window : windows)
diff --git a/ash/wm/tablet_mode/tablet_mode_window_manager.h b/ash/wm/tablet_mode/tablet_mode_window_manager.h index a2c93af..44fbcc7 100644 --- a/ash/wm/tablet_mode/tablet_mode_window_manager.h +++ b/ash/wm/tablet_mode/tablet_mode_window_manager.h
@@ -97,6 +97,8 @@ TabletModeWindowManager(); private: + friend class TabletModeControllerTestApi; + using WindowToState = std::map<aura::Window*, TabletModeWindowState*>; // Maximize all windows, except that a snapped active window shall become @@ -157,6 +159,10 @@ // True if overview exit type is |kWindowDragged|. bool exit_overview_by_window_drag_ = false; + // True if overview is going to be started because a snapped active window + // from desktop mode was carried over to split view on entering tablet mode. + bool overview_upcoming_for_split_view_ = false; + DISALLOW_COPY_AND_ASSIGN(TabletModeWindowManager); };
diff --git a/ash/wm/tablet_mode/tablet_mode_window_state.h b/ash/wm/tablet_mode/tablet_mode_window_state.h index 2d5af86..41b367a 100644 --- a/ash/wm/tablet_mode/tablet_mode_window_state.h +++ b/ash/wm/tablet_mode/tablet_mode_window_state.h
@@ -54,6 +54,8 @@ } private: + friend class TabletModeControllerTestApi; + // Updates the window to |new_state_type| and resulting bounds: // Either full screen, maximized centered or minimized. If the state does not // change, only the bounds will be changed. If |animate| is set, the bound
diff --git a/ash/wm/top_level_window_factory.cc b/ash/wm/top_level_window_factory.cc index e1941ac..7aaab71 100644 --- a/ash/wm/top_level_window_factory.cc +++ b/ash/wm/top_level_window_factory.cc
@@ -155,7 +155,7 @@ window_delegate->set_window(window); aura::SetWindowType(window, window_type); ApplyProperties(window, property_converter, *properties); - window->Init(ui::LAYER_TEXTURED); + window->Init(ui::LAYER_NOT_DRAWN); if (container_window) { // |bounds| are in local coordinates.
diff --git a/ash/wm/window_state.cc b/ash/wm/window_state.cc index 50cd282..853eaab7 100644 --- a/ash/wm/window_state.cc +++ b/ash/wm/window_state.cc
@@ -308,7 +308,7 @@ } void WindowState::DisableAlwaysOnTop(aura::Window* window_on_top) { - if (GetAlwaysOnTop()) { + if (GetAlwaysOnTop() && !IsPip()) { // |window_| is hidden first to avoid canceling fullscreen mode when it is // no longer always on top and gets added to default container. This avoids // sending redundant OnFullscreenStateChanged to the layout manager. The
diff --git a/ash/wm/wm_shadow_controller_delegate.cc b/ash/wm/wm_shadow_controller_delegate.cc index 08ba76e..9d19241 100644 --- a/ash/wm/wm_shadow_controller_delegate.cc +++ b/ash/wm/wm_shadow_controller_delegate.cc
@@ -25,8 +25,7 @@ SplitViewController* split_view_controller = Shell::Get()->split_view_controller(); if (split_view_controller && - (window == split_view_controller->left_window() || - window == split_view_controller->right_window())) { + split_view_controller->IsWindowInSplitView(window)) { return false; }
diff --git a/ash/wm/workspace/workspace_layout_manager_unittest.cc b/ash/wm/workspace/workspace_layout_manager_unittest.cc index 574d2c1..0a9189a 100644 --- a/ash/wm/workspace/workspace_layout_manager_unittest.cc +++ b/ash/wm/workspace/workspace_layout_manager_unittest.cc
@@ -863,6 +863,35 @@ EXPECT_EQ(nullptr, wm::GetWindowForFullscreenMode(fullscreen_window.get())); } +TEST_F(WorkspaceLayoutManagerSoloTest, + FullscreenDoesNotSuspendAlwaysOnTopForPip) { + gfx::Rect bounds(100, 100, 200, 200); + std::unique_ptr<aura::Window> fullscreen_window( + CreateTestWindowInShellWithBounds(bounds)); + std::unique_ptr<aura::Window> pip_window( + CreateTestWindowInShellWithBounds(bounds)); + + wm::WindowState* window_state = wm::GetWindowState(pip_window.get()); + const wm::WMEvent enter_pip(wm::WM_EVENT_PIP); + window_state->OnWMEvent(&enter_pip); + pip_window->SetProperty(aura::client::kAlwaysOnTopKey, true); + EXPECT_TRUE(window_state->IsPip()); + EXPECT_TRUE(pip_window->GetProperty(aura::client::kAlwaysOnTopKey)); + + // Making a window fullscreen temporarily suspends always on top state, but + // should not do so for PIP. + fullscreen_window->SetProperty(aura::client::kShowStateKey, + ui::SHOW_STATE_FULLSCREEN); + EXPECT_TRUE(pip_window->GetProperty(aura::client::kAlwaysOnTopKey)); + EXPECT_NE(nullptr, wm::GetWindowForFullscreenMode(fullscreen_window.get())); + + // Making fullscreen window normal does not affect PIP. + fullscreen_window->SetProperty(aura::client::kShowStateKey, + ui::SHOW_STATE_NORMAL); + EXPECT_TRUE(pip_window->GetProperty(aura::client::kAlwaysOnTopKey)); + EXPECT_EQ(nullptr, wm::GetWindowForFullscreenMode(fullscreen_window.get())); +} + // Similary, pinned window causes always_on_top_ windows to stack below. TEST_F(WorkspaceLayoutManagerSoloTest, PinnedSuspendsAlwaysOnTop) { gfx::Rect bounds(100, 100, 200, 200); @@ -900,6 +929,45 @@ always_on_top_window3->GetProperty(aura::client::kAlwaysOnTopKey)); } +TEST_F(WorkspaceLayoutManagerSoloTest, PinnedDoesNotSuspendAlwaysOnTopForPip) { + gfx::Rect bounds(100, 100, 200, 200); + std::unique_ptr<aura::Window> pinned_window( + CreateTestWindowInShellWithBounds(bounds)); + std::unique_ptr<aura::Window> pip_window( + CreateTestWindowInShellWithBounds(bounds)); + { + wm::WindowState* window_state = wm::GetWindowState(pip_window.get()); + const wm::WMEvent enter_pip(wm::WM_EVENT_PIP); + window_state->OnWMEvent(&enter_pip); + pip_window->SetProperty(aura::client::kAlwaysOnTopKey, true); + EXPECT_TRUE(window_state->IsPip()); + EXPECT_TRUE(pip_window->GetProperty(aura::client::kAlwaysOnTopKey)); + } + + // Making a window pinned temporarily suspends always on top state, except + // for PIP. + const bool trusted = false; + wm::PinWindow(pinned_window.get(), trusted); + EXPECT_TRUE(pip_window->GetProperty(aura::client::kAlwaysOnTopKey)); + + // Adding a new PIP window should still end up always on top. + std::unique_ptr<aura::Window> pip_window2( + CreateTestWindowInShellWithBounds(bounds)); + { + wm::WindowState* window_state = wm::GetWindowState(pip_window2.get()); + const wm::WMEvent enter_pip(wm::WM_EVENT_PIP); + window_state->OnWMEvent(&enter_pip); + pip_window2->SetProperty(aura::client::kAlwaysOnTopKey, true); + EXPECT_TRUE(window_state->IsPip()); + EXPECT_TRUE(pip_window2->GetProperty(aura::client::kAlwaysOnTopKey)); + } + + // Making pinned window normal should not affect existing PIP windows. + wm::GetWindowState(pinned_window.get())->Restore(); + EXPECT_TRUE(pip_window->GetProperty(aura::client::kAlwaysOnTopKey)); + EXPECT_TRUE(pip_window2->GetProperty(aura::client::kAlwaysOnTopKey)); +} + // Tests fullscreen window size during root window resize. TEST_F(WorkspaceLayoutManagerSoloTest, FullscreenRootWindowResize) { gfx::Rect bounds(100, 100, 200, 200);
diff --git a/base/containers/unique_any.h b/base/containers/unique_any.h index abc63c0f..55d839b 100644 --- a/base/containers/unique_any.h +++ b/base/containers/unique_any.h
@@ -118,15 +118,15 @@ std::is_move_constructible<T>::value; }; - // Constructs a base::unique_any containing |value| as long as |T| is move or - // copy constructible and it isn't base::unique_any or - // base::in_place_type_t<>. - // E.g. base::unique_any a(123); - template <typename T, - typename VT = std::decay_t<T>, - std::enable_if_t<is_move_or_copy_constructible<VT>::value && - !internal::is_unique_any<VT>::value && - !is_in_place_type_t<VT>::value>* = nullptr> + // Constructs a base::unique_any containing |value| as long as |T| isn't + // base::unique_any nor base::in_place_type_t<> and |T| is move or copy + // constructible. E.g. base::unique_any a(123); + template < + typename T, + typename VT = std::decay_t<T>, + std::enable_if_t<!internal::is_unique_any<VT>::value>* = nullptr, + std::enable_if_t<!is_in_place_type_t<VT>::value>* = nullptr, + std::enable_if_t<is_move_or_copy_constructible<VT>::value>* = nullptr> unique_any(T&& value) noexcept : internal_(&TypeOpsHelper<VT>::type_ops) { ConstructHelper<VT, InlineStorageHelper<VT>::kUseInlineStorage>::Construct( &internal_, std::forward<T>(value));
diff --git a/base/metrics/histogram_unittest.cc b/base/metrics/histogram_unittest.cc index 0eec32b0..e5d97e0 100644 --- a/base/metrics/histogram_unittest.cc +++ b/base/metrics/histogram_unittest.cc
@@ -110,8 +110,7 @@ }; // Run all HistogramTest cases with both heap and persistent memory. -INSTANTIATE_TEST_CASE_P(HeapAndPersistent, HistogramTest, testing::Bool()); - +INSTANTIATE_TEST_SUITE_P(HeapAndPersistent, HistogramTest, testing::Bool()); // Check for basic syntax and use. TEST_P(HistogramTest, BasicTest) {
diff --git a/base/metrics/sparse_histogram_unittest.cc b/base/metrics/sparse_histogram_unittest.cc index 7271cf4..510cfeb 100644 --- a/base/metrics/sparse_histogram_unittest.cc +++ b/base/metrics/sparse_histogram_unittest.cc
@@ -86,10 +86,9 @@ }; // Run all HistogramTest cases with both heap and persistent memory. -INSTANTIATE_TEST_CASE_P(HeapAndPersistent, - SparseHistogramTest, - testing::Bool()); - +INSTANTIATE_TEST_SUITE_P(HeapAndPersistent, + SparseHistogramTest, + testing::Bool()); TEST_P(SparseHistogramTest, BasicTest) { std::unique_ptr<SparseHistogram> histogram(NewSparseHistogram("Sparse"));
diff --git a/base/metrics/statistics_recorder_unittest.cc b/base/metrics/statistics_recorder_unittest.cc index a65283c..01fea05f 100644 --- a/base/metrics/statistics_recorder_unittest.cc +++ b/base/metrics/statistics_recorder_unittest.cc
@@ -126,7 +126,7 @@ }; // Run all HistogramTest cases with both heap and persistent memory. -INSTANTIATE_TEST_CASE_P(Allocator, StatisticsRecorderTest, testing::Bool()); +INSTANTIATE_TEST_SUITE_P(Allocator, StatisticsRecorderTest, testing::Bool()); TEST_P(StatisticsRecorderTest, NotInitialized) { UninitializeStatisticsRecorder();
diff --git a/base/process/process_iterator_linux.cc b/base/process/process_iterator_linux.cc index 9fea70e..39313b2 100644 --- a/base/process/process_iterator_linux.cc +++ b/base/process/process_iterator_linux.cc
@@ -33,7 +33,7 @@ return proc_stats[field_num]; NOTREACHED(); - return nullptr; + return std::string(); } // Reads /proc/<pid>/cmdline and populates |proc_cmd_line_args| with the command
diff --git a/base/task/sequence_manager/sequence_manager_impl_unittest.cc b/base/task/sequence_manager/sequence_manager_impl_unittest.cc index 95d7bc3..1b4a4a6 100644 --- a/base/task/sequence_manager/sequence_manager_impl_unittest.cc +++ b/base/task/sequence_manager/sequence_manager_impl_unittest.cc
@@ -398,14 +398,14 @@ void SetUp() override { ASSERT_EQ(GetParam(), TestType::kCustom); } }; -INSTANTIATE_TEST_CASE_P(, - SequenceManagerTestWithMessageLoop, - testing::Values(TestType::kUseMessageLoop, - TestType::kUseMessagePump)); +INSTANTIATE_TEST_SUITE_P(, + SequenceManagerTestWithMessageLoop, + testing::Values(TestType::kUseMessageLoop, + TestType::kUseMessagePump)); -INSTANTIATE_TEST_CASE_P(, - SequenceManagerTestWithCustomInitialization, - testing::Values(TestType::kCustom)); +INSTANTIATE_TEST_SUITE_P(, + SequenceManagerTestWithCustomInitialization, + testing::Values(TestType::kCustom)); void PostFromNestedRunloop(scoped_refptr<TestTaskQueue> runner, std::vector<std::pair<OnceClosure, bool>>* tasks) {
diff --git a/base/task/sequence_manager/sequence_manager_perftest.cc b/base/task/sequence_manager/sequence_manager_perftest.cc index 0ade7975..4c40f64a 100644 --- a/base/task/sequence_manager/sequence_manager_perftest.cc +++ b/base/task/sequence_manager/sequence_manager_perftest.cc
@@ -681,7 +681,7 @@ std::unique_ptr<PerfTestDelegate> delegate_; }; -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , SequenceManagerPerfTest, testing::Values(
diff --git a/base/task/sequence_manager/task_queue_selector_unittest.cc b/base/task/sequence_manager/task_queue_selector_unittest.cc index 0cd86e3..9893ba2 100644 --- a/base/task/sequence_manager/task_queue_selector_unittest.cc +++ b/base/task/sequence_manager/task_queue_selector_unittest.cc
@@ -788,9 +788,9 @@ GetParam().expected_did_starve_immediate_queue); } -INSTANTIATE_TEST_CASE_P(ChooseOldestWithPriorityTest, - ChooseOldestWithPriorityTest, - testing::ValuesIn(kChooseOldestWithPriorityTestCases)); +INSTANTIATE_TEST_SUITE_P(ChooseOldestWithPriorityTest, + ChooseOldestWithPriorityTest, + testing::ValuesIn(kChooseOldestWithPriorityTestCases)); class SmallPriorityQueueTest : public testing::Test { public:
diff --git a/base/task/task_scheduler/scheduler_single_thread_task_runner_manager_unittest.cc b/base/task/task_scheduler/scheduler_single_thread_task_runner_manager_unittest.cc index 3c2ed44..f33be2fb 100644 --- a/base/task/task_scheduler/scheduler_single_thread_task_runner_manager_unittest.cc +++ b/base/task/task_scheduler/scheduler_single_thread_task_runner_manager_unittest.cc
@@ -393,7 +393,7 @@ EXPECT_FALSE(task_runner->PostTask(FROM_HERE, BindOnce(&ShouldNotRun))); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( AllModes, TaskSchedulerSingleThreadTaskRunnerManagerCommonTest, ::testing::Values(SingleThreadTaskRunnerThreadMode::SHARED,
diff --git a/base/task/task_scheduler/scheduler_worker_pool_impl_unittest.cc b/base/task/task_scheduler/scheduler_worker_pool_impl_unittest.cc index 6b0a472..bc96cfd3 100644 --- a/base/task/task_scheduler/scheduler_worker_pool_impl_unittest.cc +++ b/base/task/task_scheduler/scheduler_worker_pool_impl_unittest.cc
@@ -323,12 +323,12 @@ } #endif // defined(OS_WIN) -INSTANTIATE_TEST_CASE_P(Parallel, - TaskSchedulerWorkerPoolImplTestParam, - ::testing::Values(test::ExecutionMode::PARALLEL)); -INSTANTIATE_TEST_CASE_P(Sequenced, - TaskSchedulerWorkerPoolImplTestParam, - ::testing::Values(test::ExecutionMode::SEQUENCED)); +INSTANTIATE_TEST_SUITE_P(Parallel, + TaskSchedulerWorkerPoolImplTestParam, + ::testing::Values(test::ExecutionMode::PARALLEL)); +INSTANTIATE_TEST_SUITE_P(Sequenced, + TaskSchedulerWorkerPoolImplTestParam, + ::testing::Values(test::ExecutionMode::SEQUENCED)); #if defined(OS_WIN) @@ -377,12 +377,12 @@ worker_pool_->WaitForAllWorkersIdleForTesting(); } -INSTANTIATE_TEST_CASE_P(Parallel, - TaskSchedulerWorkerPoolImplTestCOMMTAParam, - ::testing::Values(test::ExecutionMode::PARALLEL)); -INSTANTIATE_TEST_CASE_P(Sequenced, - TaskSchedulerWorkerPoolImplTestCOMMTAParam, - ::testing::Values(test::ExecutionMode::SEQUENCED)); +INSTANTIATE_TEST_SUITE_P(Parallel, + TaskSchedulerWorkerPoolImplTestCOMMTAParam, + ::testing::Values(test::ExecutionMode::PARALLEL)); +INSTANTIATE_TEST_SUITE_P(Sequenced, + TaskSchedulerWorkerPoolImplTestCOMMTAParam, + ::testing::Values(test::ExecutionMode::SEQUENCED)); #endif // defined(OS_WIN) @@ -1243,7 +1243,7 @@ task_tracker_.FlushForTesting(); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , TaskSchedulerWorkerPoolBlockingTest, ::testing::Values(NestedBlockingType(BlockingType::MAY_BLOCK, @@ -1791,11 +1791,11 @@ task_tracker_.FlushForTesting(); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( MayBlock, TaskSchedulerWorkerPoolBlockingCallAndMaxBestEffortTasksTest, ::testing::Values(BlockingType::MAY_BLOCK)); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( WillBlock, TaskSchedulerWorkerPoolBlockingCallAndMaxBestEffortTasksTest, ::testing::Values(BlockingType::WILL_BLOCK));
diff --git a/base/task/task_scheduler/scheduler_worker_pool_unittest.cc b/base/task/task_scheduler/scheduler_worker_pool_unittest.cc index 861e22cd..945481b7 100644 --- a/base/task/task_scheduler/scheduler_worker_pool_unittest.cc +++ b/base/task/task_scheduler/scheduler_worker_pool_unittest.cc
@@ -334,26 +334,28 @@ task_tracker_.FlushForTesting(); } -INSTANTIATE_TEST_CASE_P(GenericParallel, - TaskSchedulerWorkerPoolTest, - ::testing::Values(PoolExecutionType{ - PoolType::GENERIC, test::ExecutionMode::PARALLEL})); -INSTANTIATE_TEST_CASE_P(GenericSequenced, - TaskSchedulerWorkerPoolTest, - ::testing::Values(PoolExecutionType{ - PoolType::GENERIC, - test::ExecutionMode::SEQUENCED})); +INSTANTIATE_TEST_SUITE_P(GenericParallel, + TaskSchedulerWorkerPoolTest, + ::testing::Values(PoolExecutionType{ + PoolType::GENERIC, + test::ExecutionMode::PARALLEL})); +INSTANTIATE_TEST_SUITE_P(GenericSequenced, + TaskSchedulerWorkerPoolTest, + ::testing::Values(PoolExecutionType{ + PoolType::GENERIC, + test::ExecutionMode::SEQUENCED})); #if defined(OS_WIN) -INSTANTIATE_TEST_CASE_P(WinParallel, - TaskSchedulerWorkerPoolTest, - ::testing::Values(PoolExecutionType{ - PoolType::WINDOWS, test::ExecutionMode::PARALLEL})); -INSTANTIATE_TEST_CASE_P(WinSequenced, - TaskSchedulerWorkerPoolTest, - ::testing::Values(PoolExecutionType{ - PoolType::WINDOWS, - test::ExecutionMode::SEQUENCED})); +INSTANTIATE_TEST_SUITE_P(WinParallel, + TaskSchedulerWorkerPoolTest, + ::testing::Values(PoolExecutionType{ + PoolType::WINDOWS, + test::ExecutionMode::PARALLEL})); +INSTANTIATE_TEST_SUITE_P(WinSequenced, + TaskSchedulerWorkerPoolTest, + ::testing::Values(PoolExecutionType{ + PoolType::WINDOWS, + test::ExecutionMode::SEQUENCED})); #endif } // namespace internal
diff --git a/base/task/task_scheduler/scheduler_worker_unittest.cc b/base/task/task_scheduler/scheduler_worker_unittest.cc index 0473c327..a830fdaf 100644 --- a/base/task/task_scheduler/scheduler_worker_unittest.cc +++ b/base/task/task_scheduler/scheduler_worker_unittest.cc
@@ -365,12 +365,12 @@ } } -INSTANTIATE_TEST_CASE_P(OneTaskPerSequence, - TaskSchedulerWorkerTest, - ::testing::Values(1)); -INSTANTIATE_TEST_CASE_P(TwoTasksPerSequence, - TaskSchedulerWorkerTest, - ::testing::Values(2)); +INSTANTIATE_TEST_SUITE_P(OneTaskPerSequence, + TaskSchedulerWorkerTest, + ::testing::Values(1)); +INSTANTIATE_TEST_SUITE_P(TwoTasksPerSequence, + TaskSchedulerWorkerTest, + ::testing::Values(2)); namespace {
diff --git a/base/task/task_scheduler/task_scheduler_impl_unittest.cc b/base/task/task_scheduler/task_scheduler_impl_unittest.cc index 0e7388bf..864805cf 100644 --- a/base/task/task_scheduler/task_scheduler_impl_unittest.cc +++ b/base/task/task_scheduler/task_scheduler_impl_unittest.cc
@@ -465,9 +465,9 @@ flush_event.Wait(); } -INSTANTIATE_TEST_CASE_P(OneTaskSchedulerImplTestParams, - TaskSchedulerImplTest, - ::testing::ValuesIn(GetTaskSchedulerImplTestParams())); +INSTANTIATE_TEST_SUITE_P(OneTaskSchedulerImplTestParams, + TaskSchedulerImplTest, + ::testing::ValuesIn(GetTaskSchedulerImplTestParams())); // Spawns threads that simultaneously post Tasks to TaskRunners with various // TaskTraits and ExecutionModes. Verifies that each Task runs on a thread with
diff --git a/base/task/task_scheduler/task_tracker_unittest.cc b/base/task/task_scheduler/task_tracker_unittest.cc index 71d65a9..5183636f 100644 --- a/base/task/task_scheduler/task_tracker_unittest.cc +++ b/base/task/task_scheduler/task_tracker_unittest.cc
@@ -866,15 +866,15 @@ tracker_.Shutdown(); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ContinueOnShutdown, TaskSchedulerTaskTrackerTest, ::testing::Values(TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SkipOnShutdown, TaskSchedulerTaskTrackerTest, ::testing::Values(TaskShutdownBehavior::SKIP_ON_SHUTDOWN)); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( BlockShutdown, TaskSchedulerTaskTrackerTest, ::testing::Values(TaskShutdownBehavior::BLOCK_SHUTDOWN));
diff --git a/build/config/fuchsia/testing_sandbox_policy b/build/config/fuchsia/testing_sandbox_policy index 51946e8f..2f1327f5 100644 --- a/build/config/fuchsia/testing_sandbox_policy +++ b/build/config/fuchsia/testing_sandbox_policy
@@ -15,7 +15,6 @@ "fuchsia.ui.input.ImeVisibilityService", "fuchsia.ui.policy.Presenter", "fuchsia.ui.scenic.Scenic", - "fuchsia.ui.viewsv1.ViewManager", "fuchsia.vulkan.loader.Loader" ] }
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 84c781a..93ab678 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -e9b630cce9b6602293613dd32852599dbc48198e \ No newline at end of file +bb35f192cd364696268d4c71d5f76111799929a8 \ No newline at end of file
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index ff2878ec..0d0c78e 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -2a404570a08c9e1687c7b896cb63af773fc88b42 \ No newline at end of file +e26140d9cbd06b18d77aa0bba44d40b60524b749 \ No newline at end of file
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index 7d07aa39..fcdef58 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc
@@ -158,10 +158,13 @@ visible_layer_rect(), layer_to_content_scale_x, layer_to_content_scale_y); scaled_visible_layer_rect.Intersect(gfx::Rect(scaled_bounds)); + EffectNode* effect_node = GetEffectTree().Node(effect_tree_index_); state->SetAll(scaled_draw_transform, gfx::Rect(scaled_bounds), scaled_visible_layer_rect, draw_properties().clip_rect, draw_properties().is_clipped, contents_opaque, - draw_properties().opacity, SkBlendMode::kSrcOver, + draw_properties().opacity, + effect_node->has_render_surface ? SkBlendMode::kSrcOver + : effect_node->blend_mode, GetSortingContextId()); }
diff --git a/cc/test/layer_tree_pixel_resource_test.cc b/cc/test/layer_tree_pixel_resource_test.cc index 0050c722..72c00d9 100644 --- a/cc/test/layer_tree_pixel_resource_test.cc +++ b/cc/test/layer_tree_pixel_resource_test.cc
@@ -116,6 +116,13 @@ RunPixelTest(test_type_, content_root, expected_bitmap); } +void LayerTreeHostPixelResourceTest::RunPixelResourceTestWithLayerList( + scoped_refptr<Layer> root_layer, + base::FilePath file_name, + PropertyTrees* property_trees) { + RunPixelTestWithLayerList(test_type_, root_layer, file_name, property_trees); +} + ParameterizedPixelResourceTest::ParameterizedPixelResourceTest() : LayerTreeHostPixelResourceTest(::testing::get<0>(GetParam()), ::testing::get<1>(GetParam())) {}
diff --git a/cc/test/layer_tree_pixel_resource_test.h b/cc/test/layer_tree_pixel_resource_test.h index 543e5c6..e5a16f2 100644 --- a/cc/test/layer_tree_pixel_resource_test.h +++ b/cc/test/layer_tree_pixel_resource_test.h
@@ -31,6 +31,10 @@ void RunPixelResourceTest(scoped_refptr<Layer> content_root, const SkBitmap& expected_bitmap); + void RunPixelResourceTestWithLayerList(scoped_refptr<Layer> root_layer, + base::FilePath file_name, + PropertyTrees* property_trees); + protected: PixelResourceTestCase test_case_; Layer::LayerMaskType mask_type_;
diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc index 1f09c01..8526bd0 100644 --- a/cc/test/layer_tree_pixel_test.cc +++ b/cc/test/layer_tree_pixel_test.cc
@@ -17,6 +17,7 @@ #include "cc/test/pixel_test_output_surface.h" #include "cc/test/pixel_test_utils.h" #include "cc/test/test_in_process_context_provider.h" +#include "cc/trees/effect_node.h" #include "cc/trees/layer_tree_impl.h" #include "components/viz/common/frame_sinks/copy_output_request.h" #include "components/viz/common/frame_sinks/copy_output_result.h" @@ -33,6 +34,7 @@ LayerTreePixelTest::LayerTreePixelTest() : pixel_comparator_(new ExactPixelComparator(true)), test_type_(PIXEL_TEST_GL), + property_trees_(nullptr), pending_texture_mailbox_callbacks_(0) {} LayerTreePixelTest::~LayerTreePixelTest() = default; @@ -118,7 +120,16 @@ void LayerTreePixelTest::BeginTest() { Layer* target = readback_target_ ? readback_target_ : layer_tree_host()->root_layer(); - target->RequestCopyOfOutput(CreateCopyOutputRequest()); + if (!property_trees_) { + target->RequestCopyOfOutput(CreateCopyOutputRequest()); + } else { + layer_tree_host()->property_trees()->effect_tree.AddCopyRequest( + target->effect_tree_index(), CreateCopyOutputRequest()); + layer_tree_host() + ->property_trees() + ->effect_tree.Node(target->effect_tree_index()) + ->has_copy_request = true; + } PostSetNeedsCommitToMainThread(); } @@ -150,6 +161,8 @@ layer->SetIsDrawable(true); layer->SetBounds(rect.size()); layer->SetPosition(gfx::PointF(rect.origin())); + layer->SetOffsetToTransformParent( + gfx::Vector2dF(rect.origin().x(), rect.origin().y())); layer->SetBackgroundColor(color); return layer; } @@ -205,10 +218,9 @@ return layer; } -void LayerTreePixelTest::RunPixelTest( - PixelTestType test_type, - scoped_refptr<Layer> content_root, - base::FilePath file_name) { +void LayerTreePixelTest::RunPixelTest(PixelTestType test_type, + scoped_refptr<Layer> content_root, + base::FilePath file_name) { test_type_ = test_type; content_root_ = content_root; readback_target_ = nullptr; @@ -227,6 +239,48 @@ RunTest(CompositorMode::THREADED); } +void LayerTreePixelTest::RunPixelTestWithLayerList( + PixelTestType test_type, + scoped_refptr<Layer> root_layer, + base::FilePath file_name, + PropertyTrees* property_trees) { + test_type_ = test_type; + content_root_ = root_layer; + property_trees_ = property_trees; + readback_target_ = nullptr; + ref_file_ = file_name; + RunTest(CompositorMode::THREADED); +} + +void LayerTreePixelTest::InitializeForLayerListMode( + scoped_refptr<Layer>* root_layer, + PropertyTrees* property_trees) { + ClipNode clip_node; + property_trees->clip_tree.Insert(clip_node, 0); + + EffectNode root_effect; + root_effect.clip_id = 1; + root_effect.stable_id = 1; + root_effect.transform_id = 1; + root_effect.has_render_surface = true; + property_trees->effect_tree.Insert(root_effect, 0); + + ScrollNode scroll_node; + property_trees->scroll_tree.Insert(scroll_node, 0); + + TransformNode transform_node; + property_trees->transform_tree.Insert(transform_node, 0); + + *root_layer = Layer::Create(); + (*root_layer)->SetBounds(gfx::Size(100, 100)); + (*root_layer)->SetEffectTreeIndex(1); + (*root_layer)->SetClipTreeIndex(1); + (*root_layer)->SetScrollTreeIndex(1); + (*root_layer)->SetTransformTreeIndex(1); + (*root_layer) + ->set_property_tree_sequence_number(property_trees->sequence_number); +} + void LayerTreePixelTest::RunSingleThreadedPixelTest( PixelTestType test_type, scoped_refptr<Layer> content_root, @@ -251,10 +305,15 @@ } void LayerTreePixelTest::SetupTree() { - scoped_refptr<Layer> root = Layer::Create(); - root->SetBounds(content_root_->bounds()); - root->AddChild(content_root_); - layer_tree_host()->SetRootLayer(root); + if (property_trees_) { + layer_tree_host()->SetRootLayer(content_root_); + layer_tree_host()->SetPropertyTreesForTesting(property_trees_); + } else { + scoped_refptr<Layer> root = Layer::Create(); + root->SetBounds(content_root_->bounds()); + root->AddChild(content_root_); + layer_tree_host()->SetRootLayer(root); + } LayerTreeTest::SetupTree(); }
diff --git a/cc/test/layer_tree_pixel_test.h b/cc/test/layer_tree_pixel_test.h index 3c95b739..4c37dc66 100644 --- a/cc/test/layer_tree_pixel_test.h +++ b/cc/test/layer_tree_pixel_test.h
@@ -11,6 +11,10 @@ #include "base/files/file_path.h" #include "base/memory/ref_counted.h" #include "cc/test/layer_tree_test.h" +#include "cc/trees/clip_node.h" +#include "cc/trees/effect_node.h" +#include "cc/trees/scroll_node.h" +#include "cc/trees/transform_node.h" #include "components/viz/common/resources/single_release_callback.h" #include "ui/gl/gl_implementation.h" @@ -71,6 +75,12 @@ int border_width, SkColor border_color); + // Initializes the root layer and root PropertyTrees for layer list mode. + // In this mode, all other layers are direct children of |root_layer| and + // any property nodes are descendants of node id 1 in the respective trees. + void InitializeForLayerListMode(scoped_refptr<Layer>* root_layer, + PropertyTrees* property_trees); + void RunPixelTest(PixelTestType type, scoped_refptr<Layer> content_root, base::FilePath file_name); @@ -78,6 +88,11 @@ scoped_refptr<Layer> content_root, const SkBitmap& expected_bitmap); + void RunPixelTestWithLayerList(PixelTestType type, + scoped_refptr<Layer> root_layer, + base::FilePath file_name, + PropertyTrees* property_trees); + void RunSingleThreadedPixelTest(PixelTestType test_type, scoped_refptr<Layer> content_root, base::FilePath file_name); @@ -111,6 +126,7 @@ std::unique_ptr<PixelComparator> pixel_comparator_; PixelTestType test_type_; scoped_refptr<Layer> content_root_; + PropertyTrees* property_trees_; Layer* readback_target_; base::FilePath ref_file_; SkBitmap expected_bitmap_;
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index 9c5737e..447726f 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc
@@ -743,10 +743,6 @@ !content_has_slow_paths_); UMA_HISTOGRAM_BOOLEAN("Renderer4.GpuRasterizationSlowPathsWithNonAAPaint", content_has_slow_paths_ && content_has_non_aa_paint_); - // Record how many pages actually get gpu rasterization when enabled. - UMA_HISTOGRAM_BOOLEAN( - "Renderer4.GpuRasterizationUsed", - (has_gpu_rasterization_trigger_ && !content_has_slow_paths_)); } gpu_rasterization_histogram_recorded_ = true; @@ -1843,6 +1839,11 @@ return LayerListReverseIterator<Layer>(nullptr); } +void LayerTreeHost::SetPropertyTreesForTesting( + const PropertyTrees* property_trees) { + property_trees_ = *property_trees; +} + void LayerTreeHost::SetNeedsDisplayOnAllLayers() { for (auto* layer : *this) layer->SetNeedsDisplay();
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index 51dcb19..2dfc651f 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h
@@ -491,6 +491,8 @@ PropertyTrees* property_trees() { return &property_trees_; } const PropertyTrees* property_trees() const { return &property_trees_; } + void SetPropertyTreesForTesting(const PropertyTrees* property_trees); + void SetNeedsDisplayOnAllLayers(); void RegisterLayer(Layer* layer);
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 781a2066..26366a83 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -5187,12 +5187,13 @@ // UIResource will be copied into it. std::unique_ptr<base::SharedMemory> shared_memory; viz::SharedBitmapId shared_bitmap_id; + bool overlay_candidate = false; if (layer_tree_frame_sink_->context_provider()) { viz::ContextProvider* context_provider = layer_tree_frame_sink_->context_provider(); const auto& caps = context_provider->ContextCapabilities(); - bool overlay_candidate = + overlay_candidate = settings_.resource_settings.use_gpu_memory_buffer_resources && caps.texture_storage_image && viz::IsGpuMemoryBufferFormatSupported(format); @@ -5303,7 +5304,8 @@ ->GenUnverifiedSyncToken(); transferable = viz::TransferableResource::MakeGLOverlay( - mailbox, GL_LINEAR, texture_target, sync_token, upload_size, false); + mailbox, GL_LINEAR, texture_target, sync_token, upload_size, + overlay_candidate); transferable.format = format; } else { mojo::ScopedSharedBufferHandle memory_handle =
diff --git a/cc/trees/layer_tree_host_pixeltest_masks.cc b/cc/trees/layer_tree_host_pixeltest_masks.cc index 46807685..5ba2606 100644 --- a/cc/trees/layer_tree_host_pixeltest_masks.cc +++ b/cc/trees/layer_tree_host_pixeltest_masks.cc
@@ -93,6 +93,205 @@ base::FilePath(FILE_PATH_LITERAL("mask_of_layer.png"))); } +class LayerTreeHostLayerListPixelTest : public ParameterizedPixelResourceTest { + void InitializeSettings(LayerTreeSettings* settings) override { + settings->use_layer_lists = true; + } +}; + +INSTANTIATE_PIXEL_RESOURCE_TEST_CASE_P(LayerTreeHostLayerListPixelTest); + +TEST_P(LayerTreeHostLayerListPixelTest, MaskWithEffect) { + PropertyTrees property_trees; + scoped_refptr<Layer> root_layer; + InitializeForLayerListMode(&root_layer, &property_trees); + + EffectNode isolation_effect; + isolation_effect.clip_id = 1; + isolation_effect.stable_id = 2; + isolation_effect.has_render_surface = true; + isolation_effect.transform_id = 1; + property_trees.effect_tree.Insert(isolation_effect, 1); + + EffectNode mask_effect; + mask_effect.clip_id = 1; + mask_effect.stable_id = 2; + mask_effect.transform_id = 1; + mask_effect.blend_mode = SkBlendMode::kDstIn; + property_trees.effect_tree.Insert(mask_effect, 2); + + scoped_refptr<SolidColorLayer> background = + CreateSolidColorLayer(gfx::Rect(100, 100), SK_ColorWHITE); + background->set_property_tree_sequence_number(property_trees.sequence_number); + background->SetClipTreeIndex(1); + background->SetEffectTreeIndex(1); + background->SetScrollTreeIndex(1); + background->SetTransformTreeIndex(1); + root_layer->AddChild(background); + + scoped_refptr<SolidColorLayer> green = + CreateSolidColorLayer(gfx::Rect(25, 25, 50, 50), kCSSGreen); + green->set_property_tree_sequence_number(property_trees.sequence_number); + green->SetClipTreeIndex(1); + green->SetEffectTreeIndex(2); + green->SetScrollTreeIndex(1); + green->SetTransformTreeIndex(1); + + root_layer->AddChild(green); + + gfx::Size mask_bounds(50, 50); + MaskContentLayerClient client(mask_bounds); + + scoped_refptr<PictureLayer> mask = PictureLayer::Create(&client); + mask->SetOffsetToTransformParent(gfx::Vector2dF(25, 25)); + mask->set_property_tree_sequence_number(property_trees.sequence_number); + mask->SetBounds(mask_bounds); + mask->SetIsDrawable(true); + mask->SetClipTreeIndex(1); + mask->SetEffectTreeIndex(3); + mask->SetScrollTreeIndex(1); + mask->SetTransformTreeIndex(1); + root_layer->AddChild(mask); + + RunPixelResourceTestWithLayerList( + root_layer, base::FilePath(FILE_PATH_LITERAL("mask_with_effect.png")), + &property_trees); +} + +TEST_P(LayerTreeHostLayerListPixelTest, MaskWithEffectDifferentSize) { + PropertyTrees property_trees; + scoped_refptr<Layer> root_layer; + InitializeForLayerListMode(&root_layer, &property_trees); + + EffectNode isolation_effect; + isolation_effect.clip_id = 1; + isolation_effect.stable_id = 2; + isolation_effect.has_render_surface = true; + isolation_effect.transform_id = 1; + property_trees.effect_tree.Insert(isolation_effect, 1); + + EffectNode mask_effect; + mask_effect.clip_id = 1; + mask_effect.stable_id = 2; + mask_effect.transform_id = 1; + mask_effect.blend_mode = SkBlendMode::kDstIn; + property_trees.effect_tree.Insert(mask_effect, 2); + + scoped_refptr<SolidColorLayer> background = + CreateSolidColorLayer(gfx::Rect(100, 100), SK_ColorWHITE); + background->set_property_tree_sequence_number(property_trees.sequence_number); + background->SetClipTreeIndex(1); + background->SetEffectTreeIndex(1); + background->SetScrollTreeIndex(1); + background->SetTransformTreeIndex(1); + root_layer->AddChild(background); + + scoped_refptr<SolidColorLayer> green = + CreateSolidColorLayer(gfx::Rect(25, 25, 50, 50), kCSSGreen); + green->set_property_tree_sequence_number(property_trees.sequence_number); + green->SetClipTreeIndex(1); + green->SetEffectTreeIndex(2); + green->SetScrollTreeIndex(1); + green->SetTransformTreeIndex(1); + + root_layer->AddChild(green); + + gfx::Size mask_bounds(25, 25); + MaskContentLayerClient client(mask_bounds); + + scoped_refptr<PictureLayer> mask = PictureLayer::Create(&client); + mask->SetOffsetToTransformParent(gfx::Vector2dF(25, 25)); + mask->set_property_tree_sequence_number(property_trees.sequence_number); + mask->SetBounds(mask_bounds); + mask->SetIsDrawable(true); + mask->SetClipTreeIndex(1); + mask->SetEffectTreeIndex(3); + mask->SetScrollTreeIndex(1); + mask->SetTransformTreeIndex(1); + root_layer->AddChild(mask); + + // The mask is half the size of thing it's masking. In layer-list mode, + // the mask is not automatically scaled to match the other layer. + RunPixelResourceTestWithLayerList( + root_layer, + base::FilePath(FILE_PATH_LITERAL("mask_with_effect_different_size.png")), + &property_trees); +} + +TEST_P(LayerTreeHostLayerListPixelTest, ImageMaskWithEffect) { + PropertyTrees property_trees; + scoped_refptr<Layer> root_layer; + InitializeForLayerListMode(&root_layer, &property_trees); + + EffectNode isolation_effect; + isolation_effect.clip_id = 1; + isolation_effect.stable_id = 2; + isolation_effect.has_render_surface = true; + isolation_effect.transform_id = 1; + property_trees.effect_tree.Insert(isolation_effect, 1); + + EffectNode mask_effect; + mask_effect.clip_id = 1; + mask_effect.stable_id = 2; + mask_effect.transform_id = 1; + mask_effect.blend_mode = SkBlendMode::kDstIn; + property_trees.effect_tree.Insert(mask_effect, 2); + + scoped_refptr<SolidColorLayer> background = + CreateSolidColorLayer(gfx::Rect(100, 100), SK_ColorWHITE); + background->set_property_tree_sequence_number(property_trees.sequence_number); + background->SetClipTreeIndex(1); + background->SetEffectTreeIndex(1); + background->SetScrollTreeIndex(1); + background->SetTransformTreeIndex(1); + root_layer->AddChild(background); + + scoped_refptr<SolidColorLayer> green = + CreateSolidColorLayer(gfx::Rect(25, 25, 50, 50), kCSSGreen); + green->set_property_tree_sequence_number(property_trees.sequence_number); + green->SetClipTreeIndex(1); + green->SetEffectTreeIndex(2); + green->SetScrollTreeIndex(1); + green->SetTransformTreeIndex(1); + + root_layer->AddChild(green); + + gfx::Size mask_bounds(50, 50); + MaskContentLayerClient client(mask_bounds); + + scoped_refptr<PictureImageLayer> mask = PictureImageLayer::Create(); + mask->SetOffsetToTransformParent(gfx::Vector2dF(25, 25)); + mask->set_property_tree_sequence_number(property_trees.sequence_number); + mask->SetBounds(mask_bounds); + mask->SetIsDrawable(true); + mask->SetClipTreeIndex(1); + mask->SetEffectTreeIndex(3); + mask->SetScrollTreeIndex(1); + mask->SetTransformTreeIndex(1); + + sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(200, 200); + SkCanvas* canvas = surface->getCanvas(); + canvas->scale(SkIntToScalar(4), SkIntToScalar(4)); + scoped_refptr<DisplayItemList> mask_display_list = + client.PaintContentsToDisplayList( + ContentLayerClient::PAINTING_BEHAVIOR_NORMAL); + mask_display_list->Raster(canvas); + mask->SetImage(PaintImageBuilder::WithDefault() + .set_id(PaintImage::GetNextId()) + .set_image(surface->makeImageSnapshot(), + PaintImage::GetNextContentId()) + .TakePaintImage(), + SkMatrix::I(), false); + root_layer->AddChild(mask); + + // The mask is half the size of thing it's masking. In layer-list mode, + // the mask is not automatically scaled to match the other layer. + RunPixelResourceTestWithLayerList( + root_layer, + base::FilePath(FILE_PATH_LITERAL("image_mask_with_effect.png")), + &property_trees); +} + TEST_P(LayerTreeHostMasksPixelTest, ImageMaskOfLayer) { scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer(gfx::Rect(100, 100), SK_ColorWHITE);
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index b3e3819..b3fa34ce 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc
@@ -1469,9 +1469,7 @@ } void LayerTreeImpl::RegisterLayer(LayerImpl* layer) { - // TODO(bokan): Temporarily and speculatively CHECK in release builds to see - // if this is the cause of crbug.com/924068. - CHECK(!LayerById(layer->id())); + DCHECK(!LayerById(layer->id())); layer_id_map_[layer->id()] = layer; }
diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc index aca25d8..80d8738 100644 --- a/cc/trees/occlusion_tracker_unittest.cc +++ b/cc/trees/occlusion_tracker_unittest.cc
@@ -352,7 +352,7 @@ } }; -ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestIdentityTransforms); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestIdentityTransforms) class OcclusionTrackerTestRotatedChild : public OcclusionTrackerTest { protected: @@ -386,7 +386,7 @@ } }; -ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestRotatedChild); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestRotatedChild) class OcclusionTrackerTestTranslatedChild : public OcclusionTrackerTest { protected: @@ -418,7 +418,7 @@ } }; -ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTranslatedChild); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTranslatedChild) class OcclusionTrackerTestChildInRotatedChild : public OcclusionTrackerTest { protected: @@ -509,7 +509,7 @@ } }; -ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestChildInRotatedChild); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestChildInRotatedChild) class OcclusionTrackerTestScaledRenderSurface : public OcclusionTrackerTest { protected: @@ -547,7 +547,7 @@ } }; -ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestScaledRenderSurface); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestScaledRenderSurface) class OcclusionTrackerTestVisitTargetTwoTimes : public OcclusionTrackerTest { protected: @@ -604,7 +604,7 @@ } }; -ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestVisitTargetTwoTimes); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestVisitTargetTwoTimes) class OcclusionTrackerTestSurfaceRotatedOffAxis : public OcclusionTrackerTest { protected: @@ -652,7 +652,7 @@ } }; -ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceRotatedOffAxis); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceRotatedOffAxis) class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public OcclusionTrackerTest { @@ -729,7 +729,7 @@ } }; -ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithTwoOpaqueChildren); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithTwoOpaqueChildren) class OcclusionTrackerTestOverlappingSurfaceSiblings : public OcclusionTrackerTest { @@ -783,7 +783,7 @@ } }; -ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestOverlappingSurfaceSiblings); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestOverlappingSurfaceSiblings) class OcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms : public OcclusionTrackerTest { @@ -880,7 +880,7 @@ }; ALL_OCCLUSIONTRACKER_TEST( - OcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms); + OcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms) class OcclusionTrackerTestFilters : public OcclusionTrackerTest { protected: @@ -971,7 +971,7 @@ } }; -ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestFilters); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestFilters) class OcclusionTrackerTestOpaqueContentsRegionEmpty : public OcclusionTrackerTest { @@ -1001,7 +1001,7 @@ } }; -ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestOpaqueContentsRegionEmpty); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestOpaqueContentsRegionEmpty) class OcclusionTrackerTestOpaqueContentsRegionNonEmpty : public OcclusionTrackerTest { @@ -1051,7 +1051,7 @@ } }; -ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestOpaqueContentsRegionNonEmpty); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestOpaqueContentsRegionNonEmpty) class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public OcclusionTrackerTest { @@ -1134,7 +1134,7 @@ }; ALL_OCCLUSIONTRACKER_TEST( - OcclusionTrackerTestSurfaceOcclusionTranslatesToParent); + OcclusionTrackerTestSurfaceOcclusionTranslatesToParent) class OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public OcclusionTrackerTest { @@ -1165,7 +1165,7 @@ }; ALL_OCCLUSIONTRACKER_TEST( - OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping); + OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping) class OcclusionTrackerTestSurfaceChildOfSurface : public OcclusionTrackerTest { protected: @@ -1253,7 +1253,7 @@ } }; -ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfSurface); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfSurface) class OcclusionTrackerTestDontOccludePixelsNeededForBackdropFilter : public OcclusionTrackerTest { @@ -1367,7 +1367,7 @@ }; ALL_OCCLUSIONTRACKER_TEST( - OcclusionTrackerTestDontOccludePixelsNeededForBackdropFilter); + OcclusionTrackerTestDontOccludePixelsNeededForBackdropFilter) class OcclusionTrackerTestPixelsNeededForDropShadowBackdropFilter : public OcclusionTrackerTest { @@ -1488,7 +1488,7 @@ }; ALL_OCCLUSIONTRACKER_TEST( - OcclusionTrackerTestPixelsNeededForDropShadowBackdropFilter); + OcclusionTrackerTestPixelsNeededForDropShadowBackdropFilter) class OcclusionTrackerTestTwoBackdropFiltersReduceOcclusionTwice : public OcclusionTrackerTest { @@ -1554,7 +1554,7 @@ }; ALL_OCCLUSIONTRACKER_TEST( - OcclusionTrackerTestTwoBackdropFiltersReduceOcclusionTwice); + OcclusionTrackerTestTwoBackdropFiltersReduceOcclusionTwice) class OcclusionTrackerTestDontReduceOcclusionBelowBackdropFilter : public OcclusionTrackerTest { @@ -1616,7 +1616,7 @@ }; ALL_OCCLUSIONTRACKER_TEST( - OcclusionTrackerTestDontReduceOcclusionBelowBackdropFilter); + OcclusionTrackerTestDontReduceOcclusionBelowBackdropFilter) class OcclusionTrackerTestDontReduceOcclusionIfBackdropFilterIsOccluded : public OcclusionTrackerTest { @@ -1681,7 +1681,7 @@ }; ALL_OCCLUSIONTRACKER_TEST( - OcclusionTrackerTestDontReduceOcclusionIfBackdropFilterIsOccluded); + OcclusionTrackerTestDontReduceOcclusionIfBackdropFilterIsOccluded) class OcclusionTrackerTestReduceOcclusionWhenBkgdFilterIsPartiallyOccluded : public OcclusionTrackerTest { @@ -1756,7 +1756,7 @@ }; ALL_OCCLUSIONTRACKER_TEST( - OcclusionTrackerTestReduceOcclusionWhenBkgdFilterIsPartiallyOccluded); + OcclusionTrackerTestReduceOcclusionWhenBkgdFilterIsPartiallyOccluded) class OcclusionTrackerTestBlendModeDoesNotOcclude : public OcclusionTrackerTest { @@ -1804,7 +1804,7 @@ } }; -ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestBlendModeDoesNotOcclude); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestBlendModeDoesNotOcclude) class OcclusionTrackerTestMinimumTrackingSize : public OcclusionTrackerTest { protected: @@ -1844,7 +1844,7 @@ } }; -ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); +ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize) class OcclusionTrackerTestScaledLayerIsClipped : public OcclusionTrackerTest { protected:
diff --git a/chrome/VERSION b/chrome/VERSION index 82604b4..90773828 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=74 MINOR=0 -BUILD=3704 +BUILD=3705 PATCH=0
diff --git a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedImageLoaderBridge.java b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedImageLoaderBridge.java deleted file mode 100644 index 2747b08..0000000 --- a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedImageLoaderBridge.java +++ /dev/null
@@ -1,56 +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. - -package org.chromium.chrome.browser.feed; - -import android.graphics.Bitmap; - -import org.chromium.base.Callback; -import org.chromium.base.annotations.JNINamespace; -import org.chromium.chrome.browser.profiles.Profile; - -/** - * Provides access to native implementations of image loader. - */ -@JNINamespace("feed") -public class FeedImageLoaderBridge { - private long mNativeFeedImageLoaderBridge; - - /** - * Creates a FeedImageLoaderBridge for accessing native image loader implementation for the - * current user. - */ - public FeedImageLoaderBridge() {} - - /** - * Inits native side bridge. - * - * @param profile Profile of the user we are rendering the Feed for. - */ - public void init(Profile profile) { - mNativeFeedImageLoaderBridge = nativeInit(profile); - } - - /** Cleans up native half of this bridge. */ - public void destroy() { - assert mNativeFeedImageLoaderBridge != 0; - nativeDestroy(mNativeFeedImageLoaderBridge); - mNativeFeedImageLoaderBridge = 0; - } - - /** - * Fetches images for feed. A {@code null} Bitmap is returned if no image is available. The - * callback is never called synchronously. - */ - public void fetchImage(String url, int widthPx, int heightPx, Callback<Bitmap> callback) { - assert mNativeFeedImageLoaderBridge != 0; - nativeFetchImage(mNativeFeedImageLoaderBridge, url, widthPx, heightPx, callback); - } - - // Native methods - private native long nativeInit(Profile profile); - private native void nativeDestroy(long nativeFeedImageLoaderBridge); - private native void nativeFetchImage(long nativeFeedImageLoaderBridge, String url, int widthPx, - int heightPx, Callback<Bitmap> callback); -}
diff --git a/chrome/android/feed/feed_java_sources.gni b/chrome/android/feed/feed_java_sources.gni index cf85a82..588ad8e 100644 --- a/chrome/android/feed/feed_java_sources.gni +++ b/chrome/android/feed/feed_java_sources.gni
@@ -15,7 +15,6 @@ "//chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedContentBridge.java", "//chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedContentStorage.java", "//chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedImageLoader.java", - "//chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedImageLoaderBridge.java", "//chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedJournalBridge.java", "//chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedJournalStorage.java", "//chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedLifecycleBridge.java",
diff --git a/chrome/android/java/res/layout/location_bar_base.xml b/chrome/android/java/res/layout/location_bar_base.xml index 829752f..489d313 100644 --- a/chrome/android/java/res/layout/location_bar_base.xml +++ b/chrome/android/java/res/layout/location_bar_base.xml
@@ -7,8 +7,7 @@ This file is used for different LocationBarLayout subclasses and should remain generic. --> <merge - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto"> + xmlns:android="http://schemas.android.com/apk/res/android" > <include layout="@layout/location_status" />
diff --git a/chrome/android/java/res/layout/new_tab_page_layout.xml b/chrome/android/java/res/layout/new_tab_page_layout.xml index f8ae0af..372f4dd9 100644 --- a/chrome/android/java/res/layout/new_tab_page_layout.xml +++ b/chrome/android/java/res/layout/new_tab_page_layout.xml
@@ -58,10 +58,7 @@ android:singleLine="true" /> <!-- Padding start is applied so that microphone icon appears in the same location as it does in the main url bar. The microphone button in the url bar is - location_bar_icon_width (28dp) wide with 4dp start padding. It is placed - location_bar_lateral_padding (10dp) from the edge of the omnibox background. - The 4dp start padding effectively leaves 44dp for a 24dp icon, so it will end up - 10dp from the edge as well ((44 - 24) / 2). --> + 48dp wide with 4dp start padding. --> <org.chromium.ui.widget.ChromeImageView android:id="@+id/voice_search_button" android:layout_width="48dp"
diff --git a/chrome/android/java/res/layout/selectable_list_layout.xml b/chrome/android/java/res/layout/selectable_list_layout.xml index 1884854..b13b3517 100644 --- a/chrome/android/java/res/layout/selectable_list_layout.xml +++ b/chrome/android/java/res/layout/selectable_list_layout.xml
@@ -12,7 +12,7 @@ android:layout_height="@dimen/toolbar_height_no_shadow" android:background="@color/default_primary_color" /> - <FrameLayout + <org.chromium.chrome.browser.gesturenav.HistoryNavigationLayout android:id="@+id/list_content" android:layout_width="match_parent" android:layout_height="match_parent" @@ -25,21 +25,27 @@ android:clipToPadding="false" android:visibility="gone" /> - <TextView - android:id="@+id/empty_view" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:drawablePadding="3dp" - android:textAppearance="@style/TextAppearance.BlackDisabledText1" - android:visibility="gone" /> + <FrameLayout + android:id="@+id/empty_view_wrapper" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:visibility="gone" > + <TextView + android:id="@+id/empty_view" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:drawablePadding="3dp" + android:visibility="gone" + android:textAppearance="@style/TextAppearance.BlackDisabledText1" /> + </FrameLayout> <org.chromium.chrome.browser.widget.LoadingView android:id="@+id/loading_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" /> - </FrameLayout> + </org.chromium.chrome.browser.gesturenav.HistoryNavigationLayout> <org.chromium.chrome.browser.widget.FadingShadowView android:id="@+id/shadow"
diff --git a/chrome/android/java/res/layout/url_action_container.xml b/chrome/android/java/res/layout/url_action_container.xml index a319b1d..0c84cbf 100644 --- a/chrome/android/java/res/layout/url_action_container.xml +++ b/chrome/android/java/res/layout/url_action_container.xml
@@ -10,7 +10,8 @@ android:layout_width="wrap_content" android:layout_height="@dimen/toolbar_height_no_shadow" android:layout_gravity="end|center_vertical" - android:orientation="horizontal" > + android:orientation="horizontal" + android:layout_marginEnd="@dimen/location_bar_url_action_offset"> <org.chromium.ui.widget.ChromeImageButton android:id="@+id/delete_button"
diff --git a/chrome/android/java/res/values-sw600dp/dimens.xml b/chrome/android/java/res/values-sw600dp/dimens.xml index 2adfd2c..4a2215a 100644 --- a/chrome/android/java/res/values-sw600dp/dimens.xml +++ b/chrome/android/java/res/values-sw600dp/dimens.xml
@@ -29,6 +29,8 @@ <dimen name="tab_strip_and_toolbar_height">96dp</dimen> <dimen name="location_bar_icon_width">40dp</dimen> + <dimen name="location_bar_action_icon_width">40dp</dimen> + <dimen name="location_bar_url_action_offset">0dp</dimen> <dimen name="omnibox_suggestion_start_offset">@dimen/location_bar_icon_width</dimen> <!-- NTP dimensions -->
diff --git a/chrome/android/java/res/values-v17/styles.xml b/chrome/android/java/res/values-v17/styles.xml index 9218420b..980a7c8c 100644 --- a/chrome/android/java/res/values-v17/styles.xml +++ b/chrome/android/java/res/values-v17/styles.xml
@@ -603,7 +603,7 @@ <item name="android:background">@null</item> </style> <style name="LocationBarActionButton" parent="LocationBarButton"> - <item name="android:layout_width">@dimen/location_bar_icon_width</item> + <item name="android:layout_width">@dimen/location_bar_action_icon_width</item> <item name="android:layout_height">match_parent</item> <item name="android:paddingStart">4dp</item> <item name="android:scaleType">center</item>
diff --git a/chrome/android/java/res/values/dimens.xml b/chrome/android/java/res/values/dimens.xml index 3c05032..bd9e249 100644 --- a/chrome/android/java/res/values/dimens.xml +++ b/chrome/android/java/res/values/dimens.xml
@@ -265,8 +265,13 @@ <dimen name="location_bar_vertical_margin">8dp</dimen> <dimen name="location_bar_url_text_size">16sp</dimen> <dimen name="location_bar_icon_width">28dp</dimen> + <dimen name="location_bar_action_icon_width">48dp</dimen> <dimen name="location_bar_start_icon_width">28dp</dimen> <dimen name="location_bar_lateral_padding">10dp</dimen> + <!-- When the url action container is shown, the location bar end padding is built in to its + actions, so the action container itself uses a negative offset to properly align with the end + of the location bar. --> + <dimen name="location_bar_url_action_offset">-10dp</dimen> <dimen name="location_bar_status_separator_width">1dp</dimen> <dimen name="location_bar_status_separator_spacer">8dp</dimen> <dimen name="location_bar_min_url_width">68dp</dimen>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java index d0bd7b2..1045c60 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
@@ -1629,6 +1629,7 @@ @Override public final void onAccessibilityStateChanged(boolean enabled) { + AccessibilityUtil.resetAccessibilityEnabled(); checkAccessibility(); } @@ -2244,8 +2245,10 @@ } } else if (id == R.id.request_desktop_site_id || id == R.id.request_desktop_site_check_id) { final boolean reloadOnChange = !currentTab.isNativePage(); - final boolean usingDesktopUserAgent = currentTab.getUseDesktopUserAgent(); - currentTab.setUseDesktopUserAgent(!usingDesktopUserAgent, reloadOnChange); + final boolean usingDesktopUserAgent = + currentTab.getWebContents().getNavigationController().getUseDesktopUserAgent(); + currentTab.getWebContents().getNavigationController().setUseDesktopUserAgent( + !usingDesktopUserAgent, reloadOnChange); RecordUserAction.record("MobileMenuRequestDesktopSite"); } else if (id == R.id.reader_mode_prefs_id) { DomDistillerUIUtils.openSettings(currentTab.getWebContents());
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java index f549a57..afc33c4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
@@ -386,7 +386,7 @@ || TextUtils.equals( componentName, MultiInstanceChromeTabbedActivity.class.getName()) || TextUtils.equals(componentName, ChromeTabbedActivity2.class.getName()) - || TextUtils.equals(componentName, "com.google.android.apps.chrome.Main"); + || TextUtils.equals(componentName, MAIN_LAUNCHER_ACTIVITY_NAME); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java index a190cdd..36c49a57 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java
@@ -438,7 +438,8 @@ requestMenuRow.setVisible(itemVisible); if (!itemVisible) return; - boolean isRds = currentTab.getUseDesktopUserAgent(); + boolean isRds = + currentTab.getWebContents().getNavigationController().getUseDesktopUserAgent(); // Mark the checkbox if RDS is activated on this page. requestMenuCheck.setChecked(isRds);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/ephemeraltab/EphemeralTabPanel.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/ephemeraltab/EphemeralTabPanel.java index 04cb29c..fae8ab9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/ephemeraltab/EphemeralTabPanel.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/ephemeraltab/EphemeralTabPanel.java
@@ -48,7 +48,7 @@ private String mUrl; /** - * Checks if this feature (a.k.a. "Sneak peek") for html and image is supported. + * Checks if this feature (a.k.a. "Preview page/image") is supported. * @return {@code true} if the feature is enabled. */ public static boolean isSupported() {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManager.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManager.java index fd3954e17..f507480e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManager.java
@@ -36,6 +36,7 @@ import org.chromium.chrome.browser.contextualsearch.ContextualSearchManagementDelegate; import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager; import org.chromium.chrome.browser.fullscreen.FullscreenManager; +import org.chromium.chrome.browser.native_page.NativePageFactory; import org.chromium.chrome.browser.ntp.NewTabPage; import org.chromium.chrome.browser.tab.SadTab; import org.chromium.chrome.browser.tab.Tab; @@ -645,7 +646,7 @@ boolean isNtp = tab.getNativePage() instanceof NewTabPage; boolean isLocationBarShownInNtp = isNtp ? ((NewTabPage) tab.getNativePage()).isLocationBarShownInNTP() : false; - boolean needsUpdate = layoutTab.initFromHost(tab.getBackgroundColor(), tab.shouldStall(), + boolean needsUpdate = layoutTab.initFromHost(tab.getBackgroundColor(), shouldStall(tab), canUseLiveTexture, themeColor, ColorUtils.getTextBoxColorForToolbarBackground( mContext.getResources(), isLocationBarShownInNtp, themeColor), @@ -655,6 +656,12 @@ mHost.requestRender(); } + // Whether the tab is ready to display or it should be faded in as it loads. + private static boolean shouldStall(Tab tab) { + return (tab.isFrozen() || tab.needsReload()) + && !NativePageFactory.isNativePageUrl(tab.getUrl(), tab.isIncognito()); + } + @Override public LayoutTab createLayoutTab(int id, boolean incognito, boolean showCloseButton, boolean isTitleNeeded, float maxContentWidth, float maxContentHeight) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationFactory.java index 3aa3f00..e8ee6619 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationFactory.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationFactory.java
@@ -78,9 +78,12 @@ .createChromeNotificationBuilder(true /* preferCompat */, ChannelDefinitions.ChannelId.DOWNLOADS, null /* remoteAppPackageName */, - new NotificationMetadata( - NotificationUmaTracker.SystemNotificationType - .DOWNLOAD_FILES, + new NotificationMetadata(LegacyHelpers.isLegacyDownload( + downloadUpdate.getContentId()) + ? NotificationUmaTracker.SystemNotificationType + .DOWNLOAD_FILES + : NotificationUmaTracker.SystemNotificationType + .DOWNLOAD_PAGES, null /* tag */, notificationId)) .setLocalOnly(true) .setGroup(NotificationConstants.GROUP_DOWNLOADS) @@ -88,6 +91,18 @@ String contentText; int iconId; + @NotificationUmaTracker.ActionType + int cancelActionType, + pauseActionType, resumeActionType; + if (LegacyHelpers.isLegacyDownload(downloadUpdate.getContentId())) { + cancelActionType = NotificationUmaTracker.ActionType.DOWNLOAD_CANCEL; + pauseActionType = NotificationUmaTracker.ActionType.DOWNLOAD_PAUSE; + resumeActionType = NotificationUmaTracker.ActionType.DOWNLOAD_RESUME; + } else { + cancelActionType = NotificationUmaTracker.ActionType.DOWNLOAD_PAGE_CANCEL; + pauseActionType = NotificationUmaTracker.ActionType.DOWNLOAD_PAGE_PAUSE; + resumeActionType = NotificationUmaTracker.ActionType.DOWNLOAD_PAGE_RESUME; + } switch (downloadStatus) { case DownloadNotificationService.DownloadStatus.IN_PROGRESS: @@ -138,13 +153,13 @@ R.string.download_notification_pause_button), buildPendingIntentProvider( context, pauseIntent, downloadUpdate.getNotificationId()), - NotificationUmaTracker.ActionType.DOWNLOAD_PAUSE) + pauseActionType) .addAction(R.drawable.btn_close_white, context.getResources().getString( R.string.download_notification_cancel_button), buildPendingIntentProvider( context, cancelIntent, downloadUpdate.getNotificationId()), - NotificationUmaTracker.ActionType.DOWNLOAD_CANCEL); + cancelActionType); if (!downloadUpdate.getIsOffTheRecord()) builder.setLargeIcon(downloadUpdate.getIcon()); @@ -191,13 +206,13 @@ R.string.download_notification_resume_button), buildPendingIntentProvider( context, resumeIntent, downloadUpdate.getNotificationId()), - NotificationUmaTracker.ActionType.DOWNLOAD_RESUME) + resumeActionType) .addAction(R.drawable.btn_close_white, context.getResources().getString( R.string.download_notification_cancel_button), buildPendingIntentProvider( context, cancelIntent, downloadUpdate.getNotificationId()), - NotificationUmaTracker.ActionType.DOWNLOAD_CANCEL); + cancelActionType); if (!downloadUpdate.getIsOffTheRecord()) builder.setLargeIcon(downloadUpdate.getIcon());
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/home/DownloadManagerCoordinatorImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/download/home/DownloadManagerCoordinatorImpl.java index 4ee209e4..a71250c5 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/home/DownloadManagerCoordinatorImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/home/DownloadManagerCoordinatorImpl.java
@@ -7,7 +7,6 @@ import android.app.Activity; import android.view.Gravity; import android.view.View; -import android.view.ViewGroup; import android.widget.FrameLayout; import org.chromium.base.ApiCompatibilityUtils; @@ -21,6 +20,7 @@ import org.chromium.chrome.browser.download.home.snackbars.DeleteUndoCoordinator; import org.chromium.chrome.browser.download.home.toolbar.ToolbarCoordinator; import org.chromium.chrome.browser.download.items.OfflineContentAggregatorFactory; +import org.chromium.chrome.browser.gesturenav.HistoryNavigationLayout; import org.chromium.chrome.browser.preferences.PreferencesLauncher; import org.chromium.chrome.browser.preferences.download.DownloadPreferences; import org.chromium.chrome.browser.profiles.Profile; @@ -42,10 +42,11 @@ private final ToolbarCoordinator mToolbarCoordinator; private final SelectionDelegate<ListItem> mSelectionDelegate; + private SelectionDelegate.SelectionObserver<ListItem> mNavigationCanceller; private final Activity mActivity; - private ViewGroup mMainView; + private HistoryNavigationLayout mMainView; private boolean mMuteFilterChanges; @@ -71,7 +72,7 @@ * TODO(crbug.com/880468) : Investigate if it is better to do in XML. */ private void initializeView() { - mMainView = new FrameLayout(mActivity); + mMainView = new HistoryNavigationLayout(mActivity); mMainView.setBackgroundColor(ApiCompatibilityUtils.getColor( mActivity.getResources(), R.color.modern_primary_color)); @@ -81,6 +82,10 @@ mActivity.getResources().getDimensionPixelOffset(R.dimen.toolbar_height_no_shadow), 0, 0); mMainView.addView(mListCoordinator.getView(), listParams); + mNavigationCanceller = (selectedItems) -> { + if (!selectedItems.isEmpty()) mMainView.release(); + }; + mSelectionDelegate.addObserver(mNavigationCanceller); FrameLayout.LayoutParams toolbarParams = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT); @@ -110,6 +115,7 @@ mDeleteCoordinator.destroy(); mListCoordinator.destroy(); mToolbarCoordinator.destroy(); + mSelectionDelegate.removeObserver(mNavigationCanceller); } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/HistoryNavigationLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/HistoryNavigationLayout.java index aad6529..35e9e5a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/HistoryNavigationLayout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/HistoryNavigationLayout.java
@@ -59,8 +59,6 @@ if (context instanceof ChromeActivity) { mTabProvider = ((ChromeActivity) context).getActivityTabProvider(); mDetector = new GestureDetector(getContext(), new SideNavGestureListener()); - } else { - throw new IllegalStateException("This native page should be under ChromeActivity"); } } @@ -161,9 +159,21 @@ /** * Reset navigation UI in action. */ - public void reset() { - cancelStopNavigatingRunnable(); - if (mSideSlideLayout != null) mSideSlideLayout.reset(); + private void reset() { + if (mSideSlideLayout != null) { + cancelStopNavigatingRunnable(); + mSideSlideLayout.reset(); + } + } + + /** + * Cancel navigation UI with animation effect. + */ + public void release() { + if (mSideSlideLayout != null) { + cancelStopNavigatingRunnable(); + mSideSlideLayout.release(false); + } } private void cancelStopNavigatingRunnable() {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUmaTracker.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUmaTracker.java index fd8ac96..bdc718c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUmaTracker.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUmaTracker.java
@@ -85,8 +85,14 @@ int DOWNLOAD_RESUME = 1; // Cancel button on user download notification. int DOWNLOAD_CANCEL = 2; + // Pause button on page download notification. + int DOWNLOAD_PAGE_PAUSE = 3; + // Resume button on page download notification. + int DOWNLOAD_PAGE_RESUME = 4; + // Cancel button on page download notification. + int DOWNLOAD_PAGE_CANCEL = 5; - int NUM_ENTRIES = 3; + int NUM_ENTRIES = 6; } private static final String LAST_SHOWN_NOTIFICATION_TYPE_KEY =
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java index 3dd4409..1ab748dd 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java
@@ -606,6 +606,13 @@ + MarginLayoutParamsCompat.getMarginStart(childLayoutParams) + MarginLayoutParamsCompat.getMarginEnd(childLayoutParams); } + if (mUrlActionContainer != null && mUrlActionContainer.getVisibility() == View.VISIBLE) { + ViewGroup.MarginLayoutParams urlActionContainerLayoutParams = + (ViewGroup.MarginLayoutParams) mUrlActionContainer.getLayoutParams(); + urlContainerMarginEnd += + MarginLayoutParamsCompat.getMarginStart(urlActionContainerLayoutParams) + + MarginLayoutParamsCompat.getMarginEnd(urlActionContainerLayoutParams); + } return urlContainerMarginEnd; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/status/StatusMediator.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/status/StatusMediator.java index 47b96a1b..56b8568 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/status/StatusMediator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/status/StatusMediator.java
@@ -11,6 +11,7 @@ import org.chromium.base.VisibleForTesting; import org.chromium.chrome.R; +import org.chromium.chrome.browser.previews.PreviewsUma; import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.ui.modelutil.PropertyModel; @@ -71,6 +72,9 @@ mPageIsPreview = pageIsPreview; updateStatusVisibility(); updateColorTheme(); + if (mPageIsPreview) { + PreviewsUma.recordVerboseStatusTextShown(mVerboseStatusSpaceAvailable); + } } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/previews/PreviewsUma.java b/chrome/android/java/src/org/chromium/chrome/browser/previews/PreviewsUma.java index e8386a3..8ae81d0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/previews/PreviewsUma.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/previews/PreviewsUma.java
@@ -75,4 +75,14 @@ public static void recordLitePageAtLoadFinish(final String previewType) { recordHistogram(previewType, ACTION_LITE_PAGE_AT_FINISH); } + + /** + * Records whether the "Lite" verbose status string is shown when the + * Previews icon is shown. + * + * @param shown Whether the Lite string was shown. + */ + public static void recordVerboseStatusTextShown(final boolean shown) { + RecordHistogram.recordBooleanHistogram("Previews.OmniboxLiteStringShown", shown); + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/printing/TabPrinter.java b/chrome/android/java/src/org/chromium/chrome/browser/printing/TabPrinter.java index b97c89d9..829fae5 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/printing/TabPrinter.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/printing/TabPrinter.java
@@ -8,8 +8,11 @@ import org.chromium.base.ContextUtils; import org.chromium.base.Log; +import org.chromium.base.annotations.CalledByNative; +import org.chromium.base.annotations.JNINamespace; import org.chromium.chrome.R; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.content_public.browser.WebContents; import org.chromium.printing.Printable; import java.lang.ref.WeakReference; @@ -20,12 +23,18 @@ * This class doesn't have any lifetime expectations with regards to Tab, since we keep a weak * reference. */ +@JNINamespace("printing") public class TabPrinter implements Printable { private static final String TAG = "printing"; private final WeakReference<Tab> mTab; private final String mDefaultTitle; + @CalledByNative + private static TabPrinter getPrintable(Tab tab) { + return new TabPrinter(tab); + } + public TabPrinter(Tab tab) { mTab = new WeakReference<Tab>(tab); mDefaultTitle = ContextUtils.getApplicationContext().getResources().getString( @@ -37,7 +46,7 @@ if (!canPrint()) return false; Tab tab = mTab.get(); assert tab != null && tab.isInitialized(); - return tab.print(renderProcessId, renderFrameId); + return nativePrint(tab.getWebContents(), renderProcessId, renderFrameId); } @Override @@ -64,4 +73,7 @@ } return true; } + + private static native boolean nativePrint( + WebContents webContents, int renderProcessId, int renderFrameId); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java index 2c0e7cb9..a21ae60e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
@@ -72,7 +72,6 @@ import org.chromium.chrome.browser.policy.PolicyAuditor; import org.chromium.chrome.browser.prerender.ExternalPrerenderHandler; import org.chromium.chrome.browser.previews.PreviewsAndroidBridge; -import org.chromium.chrome.browser.printing.TabPrinter; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.rlz.RevenueStats; import org.chromium.chrome.browser.ssl.SecurityStateModel; @@ -106,9 +105,6 @@ import org.chromium.content_public.common.BrowserControlsState; import org.chromium.content_public.common.Referrer; import org.chromium.content_public.common.ResourceRequestBody; -import org.chromium.printing.PrintManagerDelegateImpl; -import org.chromium.printing.PrintingController; -import org.chromium.printing.PrintingControllerImpl; import org.chromium.ui.base.LocalizationUtils; import org.chromium.ui.base.PageTransition; import org.chromium.ui.base.WindowAndroid; @@ -264,11 +260,6 @@ private WebContentsState mFrozenContentsState; /** - * Whether the restoration from frozen state failed. - */ - private boolean mFailedToRestore; - - /** * URL load to be performed lazily when the Tab is next shown. */ private LoadUrlParams mPendingLoadParams; @@ -824,25 +815,6 @@ } /** - * Prints the current page. - * - * @return Whether the printing process is started successfully. - **/ - public boolean print(int renderProcessId, int renderFrameId) { - assert mNativeTabAndroid != 0; - return nativePrint(mNativeTabAndroid, renderProcessId, renderFrameId); - } - - @CalledByNative - public void setPendingPrint(int renderProcessId, int renderFrameId) { - PrintingController printingController = PrintingControllerImpl.getInstance(); - if (printingController == null) return; - - printingController.setPendingPrint(new TabPrinter(this), - new PrintManagerDelegateImpl(getActivity()), renderProcessId, renderFrameId); - } - - /** * Reloads the current page content. */ public void reload() { @@ -868,6 +840,7 @@ /** * @return Whether or not the loading and rendering of the page is done. + * TODO(jinsukkim): Delete this method once the refactoring is finished. */ @VisibleForTesting public boolean isLoadingAndRenderingDone() { @@ -982,27 +955,6 @@ } /** - * Set whether or not the content layer should be using a desktop user agent for the - * currently loaded page. - * @param useDesktop If {@code true}, use a desktop user agent. Otherwise use a mobile one. - * @param reloadOnChange Reload the page if the user agent has changed. - */ - public void setUseDesktopUserAgent(boolean useDesktop, boolean reloadOnChange) { - if (getWebContents() != null) { - getWebContents().getNavigationController().setUseDesktopUserAgent( - useDesktop, reloadOnChange); - } - } - - /** - * @return Whether or not the content layer is using a desktop user agent. - */ - public boolean getUseDesktopUserAgent() { - return getWebContents() != null - && getWebContents().getNavigationController().getUseDesktopUserAgent(); - } - - /** * @return The current {@link ConnectionSecurityLevel} for the tab. */ // TODO(tedchoc): Remove this and transition all clients to use LocationBarModel directly. @@ -1047,14 +999,6 @@ } /** - * @return Whether the tab is ready to display or it should be faded in as it loads. - */ - public boolean shouldStall() { - return (isFrozen() || needsReload()) - && !NativePageFactory.isNativePageUrl(getUrl(), isIncognito()); - } - - /** * Prepares the tab to be shown. This method is supposed to be called before the tab is * displayed. It restores the ContentView if it is not available after the cold start and * reloads the tab if its renderer has crashed. @@ -1244,23 +1188,6 @@ } /** - * Reparents this Tab to the provided Activity. Unlike {@link #detachAndStartReparenting} which - * launches the target Activity which can then reparent the Tab with - * {@link #attachAndFinishReparenting}, this method should be called from the target Activity on - * a Tab that belongs to a different one. - * @param activity - The ChromeActivity that will own the Tab. - * @param tabDelegateFactory - The TabDelegateFactory from the Activity for that Tab. - */ - public void reparent(ChromeActivity activity, TabDelegateFactory tabDelegateFactory) { - detach(); - // TODO(peconn): Figure out why this is necessary - it is something to do with - // Tab.mIsDetached being true and TabModelSelectorImpl#requestToShowTab not calling - // |mVisibleTab.hide()| because of it. - hide(TabHidingType.REPARENTED); - attachAndFinishReparenting(activity, tabDelegateFactory, null); - } - - /** * Begins the tab reparenting process. Detaches the tab from its current activity and fires * an Intent to reparent the tab into its new host activity. * @@ -1671,16 +1598,6 @@ } /** - * @return The ID of the renderer process that backs this tab or - * {@link #INVALID_RENDER_PROCESS_PID} if there is none. - */ - @VisibleForTesting - public int getCurrentRenderProcessIdForTesting() { - assert mNativeTabAndroid != 0; - return nativeGetCurrentRenderProcessId(mNativeTabAndroid); - } - - /** * Calls onContentChanged on all TabObservers and updates accessibility visibility. */ void notifyContentChanged() { @@ -1889,20 +1806,21 @@ * frozen with a saved TabState, and NOT if it was frozen for a lazy load. * @return Whether or not the restoration was successful. */ - protected boolean unfreezeContents() { + private void unfreezeContents() { try { TraceEvent.begin("Tab.unfreezeContents"); assert mFrozenContentsState != null; WebContents webContents = mFrozenContentsState.restoreContentsFromByteBuffer(isHidden()); + boolean failedToRestore = false; if (webContents == null) { // State restore failed, just create a new empty web contents as that is the best // that can be done at this point. TODO(jcivelli) http://b/5910521 - we should show // an error page instead of a blank page in that case (and the last loaded URL). webContents = WebContentsFactory.createWebContents(isIncognito(), isHidden()); TabUma.create(this, TabCreationState.FROZEN_ON_RESTORE_FAILED); - mFailedToRestore = true; + failedToRestore = true; } View compositorView = getActivity().getCompositorViewHolder(); webContents.setSize(compositorView.getWidth(), compositorView.getHeight()); @@ -1910,24 +1828,16 @@ mFrozenContentsState = null; initWebContents(webContents); - if (mFailedToRestore) { + if (failedToRestore) { String url = TextUtils.isEmpty(mUrl) ? UrlConstants.NTP_URL : mUrl; loadUrl(new LoadUrlParams(url, PageTransition.GENERATED)); } - return !mFailedToRestore; } finally { TraceEvent.end("Tab.unfreezeContents"); } } /** - * @return Whether the unfreeze attempt from a saved tab state failed. - */ - public boolean didFailToRestore() { - return mFailedToRestore; - } - - /** * @return Whether or not the tab is hidden. */ public boolean isHidden() { @@ -2988,8 +2898,6 @@ long intentReceivedTimestamp); private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTabAndroid, String url, String title); - private native boolean nativePrint( - long nativeTabAndroid, int renderProcessId, int renderFrameId); private native Bitmap nativeGetFavicon(long nativeTabAndroid); private native void nativeCreateHistoricalTab(long nativeTabAndroid); private native void nativeUpdateBrowserControlsState( @@ -3007,6 +2915,5 @@ private native void nativeEnableEmbeddedMediaExperience(long nativeTabAndroid, boolean enabled); private native void nativeAttachDetachedTab(long nativeTabAndroid); private native void nativeMediaDownloadInProductHelpDismissed(long nativeTabAndroid); - private native int nativeGetCurrentRenderProcessId(long nativeTabAndroid); private native boolean nativeAreRendererInputEventsIgnored(long nativeTabAndroid); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/util/AccessibilityUtil.java b/chrome/android/java/src/org/chromium/chrome/browser/util/AccessibilityUtil.java index d79a126..eabe577 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/util/AccessibilityUtil.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/util/AccessibilityUtil.java
@@ -6,6 +6,7 @@ import android.accessibilityservice.AccessibilityServiceInfo; import android.annotation.SuppressLint; +import android.app.Activity; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; @@ -16,6 +17,9 @@ import android.view.View; import android.view.accessibility.AccessibilityManager; +import org.chromium.base.ActivityState; +import org.chromium.base.ApplicationStatus; +import org.chromium.base.ApplicationStatus.ActivityStateListener; import org.chromium.base.ContextUtils; import org.chromium.base.PackageUtils; import org.chromium.base.TraceEvent; @@ -43,6 +47,9 @@ // KitKat, from fall 2013. Versions older than that should be updated. private static final int MIN_TALKBACK_VERSION = 105; + private static Boolean sIsAccessibilityEnabled; + private static ActivityStateListener sActivityStateListener; + private AccessibilityUtil() { } /** @@ -51,26 +58,58 @@ */ public static boolean isAccessibilityEnabled() { TraceEvent.begin("AccessibilityManager::isAccessibilityEnabled"); + if (sIsAccessibilityEnabled != null) return sIsAccessibilityEnabled; + AccessibilityManager manager = (AccessibilityManager) ContextUtils.getApplicationContext().getSystemService( Context.ACCESSIBILITY_SERVICE); - boolean retVal = + boolean accessibilityEnabled = manager != null && manager.isEnabled() && manager.isTouchExplorationEnabled(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && manager != null - && manager.isEnabled() && !retVal) { + && manager.isEnabled() && !accessibilityEnabled) { List<AccessibilityServiceInfo> services = manager.getEnabledAccessibilityServiceList( AccessibilityServiceInfo.FEEDBACK_ALL_MASK); for (AccessibilityServiceInfo service : services) { if (canPerformGestures(service)) { - retVal = true; + accessibilityEnabled = true; break; } } } + sIsAccessibilityEnabled = accessibilityEnabled; + + sActivityStateListener = new ApplicationStatus.ActivityStateListener() { + @Override + public void onActivityStateChange(Activity activity, int newState) { + // If an activity is being resumed, it's possible the user changed accessibility + // settings while not in a Chrome activity. Reset the accessibility enabled state + // so that the next time #isAccessibilityEnabled is called the accessibility state + // is recalculated. Also, if all activities are destroyed, remove the activity + // state listener to avoid leaks. + if (newState == ActivityState.RESUMED + || ApplicationStatus.isEveryActivityDestroyed()) { + resetAccessibilityEnabled(); + } + } + }; + ApplicationStatus.registerStateListenerForAllActivities(sActivityStateListener); + TraceEvent.end("AccessibilityManager::isAccessibilityEnabled"); - return retVal; + return sIsAccessibilityEnabled; + } + + /** + * Reset the static used to determine whether accessibility is enabled. + * TODO(twellington): Make this private and have classes that care about accessibility state + * observe this class rather than observing the AccessibilityManager + * directly. + */ + public static void resetAccessibilityEnabled() { + ApplicationStatus.unregisterActivityStateListener(sActivityStateListener); + sActivityStateListener = null; + sIsAccessibilityEnabled = null; } /**
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 885b114..e6e4b4d 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
@@ -500,6 +500,8 @@ mWebappInfo.id(), new WebappRegistry.FetchWebappDataStorageCallback() { @Override public void onWebappDataStorageRetrieved(WebappDataStorage storage) { + if (isActivityFinishingOrDestroyed()) return; + onDeferredStartupWithStorage(storage); // Set force == true to indicate that we need to show a privacy // disclosure for the newly installed unbound WebAPKs which
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/ThumbnailProviderImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/ThumbnailProviderImpl.java index dc101dd..f00c98c6 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/ThumbnailProviderImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/ThumbnailProviderImpl.java
@@ -86,6 +86,7 @@ public void destroy() { ThreadUtils.assertOnUiThread(); mStorage.destroy(); + mBitmapCache.destroy(); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableItemViewBase.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableItemViewBase.java index 6dc9d03..795285b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableItemViewBase.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableItemViewBase.java
@@ -6,9 +6,11 @@ import android.content.Context; import android.util.AttributeSet; +import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnLongClickListener; +import android.view.View.OnTouchListener; import android.widget.Checkable; import android.widget.FrameLayout; @@ -26,8 +28,13 @@ * * @param <E> The type of the item associated with this SelectableItemViewBase. */ -public abstract class SelectableItemViewBase<E> extends FrameLayout - implements Checkable, OnClickListener, OnLongClickListener, SelectionObserver<E> { +public abstract class SelectableItemViewBase<E> + extends FrameLayout implements Checkable, OnClickListener, OnLongClickListener, + OnTouchListener, SelectionObserver<E> { + // Heuristic value used to rule out long clicks preceded by long horizontal move. A long click + // is ignored if finger was moved horizontally more than this threshold. + private static final float LONG_CLICK_SLIDE_THRESHOLD_PX = 100.f; + private SelectionDelegate<E> mSelectionDelegate; private E mItem; private boolean mIsChecked; @@ -35,6 +42,11 @@ // Controls whether selection should happen during onLongClick. private boolean mSelectOnLongClick = true; + // X position of touch events to detect the amount of horizontal movement between touch down + // and the position where long click is triggered. + private float mAnchorX; + private float mCurrentX; + /** * Constructor for inflating from XML. */ @@ -93,6 +105,7 @@ protected void onFinishInflate() { super.onFinishInflate(); + setOnTouchListener(this); setOnClickListener(this); setOnLongClickListener(this); } @@ -111,6 +124,20 @@ setChecked(false); } + // OnTouchListener implementation. + @Override + public final boolean onTouch(View view, MotionEvent event) { + int action = event.getActionMasked(); + if (action == MotionEvent.ACTION_DOWN) { + // mCurrentX needs init here as well, since we might not get ACTION_MOVE + // for a simple click turning into a long click when selection mode is on. + mAnchorX = mCurrentX = event.getX(); + } else if (action == MotionEvent.ACTION_MOVE) { + mCurrentX = event.getX(); + } + return false; + } + // OnClickListener implementation. @Override public final void onClick(View view) { @@ -132,7 +159,7 @@ @Override public boolean onLongClick(View view) { assert view == this; - handleSelection(); + if (Math.abs(mCurrentX - mAnchorX) < LONG_CLICK_SLIDE_THRESHOLD_PX) handleSelection(); return true; } @@ -193,4 +220,4 @@ * that case. */ protected abstract void onClick(); -} \ No newline at end of file +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableListLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableListLayout.java index d073c8fe..b25adca 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableListLayout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableListLayout.java
@@ -27,6 +27,7 @@ import org.chromium.base.ApiCompatibilityUtils; import org.chromium.chrome.R; +import org.chromium.chrome.browser.gesturenav.HistoryNavigationLayout; import org.chromium.chrome.browser.widget.FadingShadow; import org.chromium.chrome.browser.widget.FadingShadowView; import org.chromium.chrome.browser.widget.LoadingView; @@ -54,6 +55,7 @@ private RecyclerView.Adapter mAdapter; private ViewStub mToolbarStub; private TextView mEmptyView; + private View mEmptyViewWrapper; private LoadingView mLoadingView; private RecyclerView mRecyclerView; private ItemAnimator mItemAnimator; @@ -70,11 +72,10 @@ @Override public void onChanged() { super.onChanged(); + updateEmptyViewVisibility(); if (mAdapter.getItemCount() == 0) { - mEmptyView.setVisibility(View.VISIBLE); mRecyclerView.setVisibility(View.GONE); } else { - mEmptyView.setVisibility(View.GONE); mRecyclerView.setVisibility(View.VISIBLE); } // At inflation, the RecyclerView is set to gone, and the loading view is visible. As @@ -108,6 +109,7 @@ LayoutInflater.from(getContext()).inflate(R.layout.selectable_list_layout, this); mEmptyView = (TextView) findViewById(R.id.empty_view); + mEmptyViewWrapper = findViewById(R.id.empty_view_wrapper); mLoadingView = (LoadingView) findViewById(R.id.loading_view); mLoadingView.showLoadingUI(); @@ -244,6 +246,9 @@ mEmptyView.setCompoundDrawablesWithIntrinsicBounds(null, emptyDrawable, null, null); mEmptyView.setText(mEmptyStringResId); + // Dummy listener to have the touch events dispatched to this view tree for navigation UI. + mEmptyViewWrapper.setOnTouchListener((v, event) -> true); + return mEmptyView; } @@ -290,6 +295,9 @@ @Override public void onSelectionStateChange(List<E> selectedItems) { setToolbarShadowVisibility(); + if (!selectedItems.isEmpty()) { + ((HistoryNavigationLayout) findViewById(R.id.list_content)).release(); + } } /** @@ -340,7 +348,9 @@ * view implementation. We need to check it ourselves. */ private void updateEmptyViewVisibility() { - mEmptyView.setVisibility(mAdapter.getItemCount() == 0 ? View.VISIBLE : View.GONE); + int visible = mAdapter.getItemCount() == 0 ? View.VISIBLE : View.GONE; + mEmptyView.setVisibility(visible); + mEmptyViewWrapper.setVisibility(visible); } @VisibleForTesting @@ -368,4 +378,4 @@ return false; } -} \ No newline at end of file +}
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd index 53495b6..37ea711 100644 --- a/chrome/android/java/strings/android_chrome_strings.grd +++ b/chrome/android/java/strings/android_chrome_strings.grd
@@ -2101,8 +2101,8 @@ <message name="IDS_CONTEXTMENU_OPEN_IMAGE_IN_NEW_TAB" desc="Context sensitive menu item for opening/viewing the selected image in a new tab. [CHAR-LIMIT=30]"> Open image in new tab </message> - <message name="IDS_CONTEXTMENU_OPEN_IMAGE_IN_EPHEMERAL_TAB" desc="Context-sensitive menu item to open a quick preview of the selected image. This is an 'image' variation of the plain 'Sneak peek' menu item. In English we're currently calling this 'Sneak peek image' which implies that it's a quick preview without commitment (to making a new Tab). We're also labeling it *New* to draw attention to it when first released. The selected image link will open in an overlay panel on top of the current tab which will go away easily too. [CHAR-LIMIT=30]"> - Sneak peek image <ph name="BEGIN_NEW"><new></ph>New<ph name="END_NEW"></new></ph> + <message name="IDS_CONTEXTMENU_OPEN_IMAGE_IN_EPHEMERAL_TAB" desc="Context-sensitive menu item to open a quick preview of the selected image. Note that 'preview' is a verb, not a noun. We're also labeling it *New* to draw attention to it when first released. The selected image link will open in an overlay panel on top of the current tab which will go away easily too. [CHAR-LIMIT=30]"> + Preview image <ph name="BEGIN_NEW"><new></ph>New<ph name="END_NEW"></new></ph> </message> <message name="IDS_CONTEXTMENU_LOAD_ORIGINAL_IMAGE" desc="Context sensitive menu item for Data Saver low fidelity placeholder images that loads the original version in place. [CHAR-LIMIT=30]"> Load image @@ -2128,8 +2128,8 @@ <message name="IDS_CONTEXTMENU_OPEN_IN_CHROME_PRIVATE_TAB" desc="Context sensitive menu item to open the selected link in a Chrome private tab from Chrome Custom Tab. [CHAR-LIMIT=30]"> Open in private tab </message> - <message name="IDS_CONTEXTMENU_OPEN_IN_EPHEMERAL_TAB" desc="Context-sensitive menu item to open a quick preview of the selected link. In English we're currently calling this 'Sneak peek' which implies that it's a quick preview without commitment (to making a new Tab). We're also labeling it *New* to draw attention to it when first released. The selected link will open in an overlay panel on top of the current tab which will go away easily too. [CHAR-LIMIT=30]"> - Sneak peek <ph name="BEGIN_NEW"><new></ph>New<ph name="END_NEW"></new></ph> + <message name="IDS_CONTEXTMENU_OPEN_IN_EPHEMERAL_TAB" desc="Context-sensitive menu item to open a quick preview of the selected linked page. Note that 'preview' is a verb, not a noun. We're also labeling it *New* to draw attention to it when first released. The selected link will open in an overlay panel on top of the current tab which will go away easily too. [CHAR-LIMIT=30]"> + Preview page <ph name="BEGIN_NEW"><new></ph>New<ph name="END_NEW"></new></ph> </message> <!-- Swipe refresh -->
diff --git a/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTMENU_OPEN_IMAGE_IN_EPHEMERAL_TAB.png.sha1 b/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTMENU_OPEN_IMAGE_IN_EPHEMERAL_TAB.png.sha1 index 08480f1e..fcdc184 100644 --- a/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTMENU_OPEN_IMAGE_IN_EPHEMERAL_TAB.png.sha1 +++ b/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTMENU_OPEN_IMAGE_IN_EPHEMERAL_TAB.png.sha1
@@ -1 +1 @@ -b76e9e3bdf35eaa7484958f29ce9da4e3a0c6b30 \ No newline at end of file +356a49f842261f6e6d5e36f6e22d42def9c883b1 \ No newline at end of file
diff --git a/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTMENU_OPEN_IN_EPHEMERAL_TAB.png.sha1 b/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTMENU_OPEN_IN_EPHEMERAL_TAB.png.sha1 index 32a6d99..fcdc184 100644 --- a/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTMENU_OPEN_IN_EPHEMERAL_TAB.png.sha1 +++ b/chrome/android/java/strings/android_chrome_strings_grd/IDS_CONTEXTMENU_OPEN_IN_EPHEMERAL_TAB.png.sha1
@@ -1 +1 @@ -1d97b6460747c21b975fe2dd3f756d1aa266f5ef \ No newline at end of file +356a49f842261f6e6d5e36f6e22d42def9c883b1 \ No newline at end of file
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/NavigateTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/NavigateTest.java index cb618ce4..56557339 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/NavigateTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/NavigateTest.java
@@ -260,13 +260,18 @@ final Tab tab = mActivityTestRule.getActivity().getActivityTab(); ThreadUtils.runOnUiThreadBlocking( - () -> tab.setUseDesktopUserAgent(true /* useDesktop */, true /* reloadOnChange */)); + () -> tab.getWebContents().getNavigationController().setUseDesktopUserAgent( + true /* useDesktop */, true /* reloadOnChange */)); ChromeTabUtils.waitForTabPageLoaded(tab, url1); DOMUtils.clickNode(tab.getWebContents(), "aboutLink"); ChromeTabUtils.waitForTabPageLoaded(tab, url2); Assert.assertEquals("Request Desktop site setting should stay turned on", true, - mActivityTestRule.getActivity().getActivityTab().getUseDesktopUserAgent()); + mActivityTestRule.getActivity() + .getActivityTab() + .getWebContents() + .getNavigationController() + .getUseDesktopUserAgent()); } /**
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java index f25bc7f..2ec1d799 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
@@ -1475,7 +1475,7 @@ @Override public boolean isSatisfied() { final Tab currentTab = mCustomTabActivityTestRule.getActivity().getActivityTab(); - return currentTab.isLoadingAndRenderingDone(); + return ChromeTabUtils.isLoadingAndRenderingDone(currentTab); } }); Assert.assertTrue(connection.postMessage(token, "Message", null)
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadActivityTest.java index fb4f910..125cbdf 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadActivityTest.java
@@ -144,6 +144,7 @@ features.put(ChromeFeatureList.DOWNLOADS_LOCATION_CHANGE, false); features.put(ChromeFeatureList.DOWNLOAD_HOME_SHOW_STORAGE_INFO, false); features.put(ChromeFeatureList.DOWNLOAD_HOME_V2, false); + features.put(ChromeFeatureList.OVERSCROLL_HISTORY_NAVIGATION, false); ChromeFeatureList.setTestFeatures(features); mStubbedProvider = new StubbedProvider();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/home/DownloadActivityV2Test.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/home/DownloadActivityV2Test.java index e8878c74..f544ea7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/home/DownloadActivityV2Test.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/home/DownloadActivityV2Test.java
@@ -87,6 +87,7 @@ features.put(ChromeFeatureList.DOWNLOAD_HOME_SHOW_STORAGE_INFO, true); features.put(ChromeFeatureList.DOWNLOAD_HOME_V2, true); features.put(ChromeFeatureList.OFFLINE_PAGES_PREFETCHING, true); + features.put(ChromeFeatureList.OVERSCROLL_HISTORY_NAVIGATION, false); ChromeFeatureList.setTestFeatures(features); }
diff --git a/chrome/app/app_management_strings.grdp b/chrome/app/app_management_strings.grdp index 41b3eeda..40ffb96f 100644 --- a/chrome/app/app_management_strings.grdp +++ b/chrome/app/app_management_strings.grdp
@@ -22,6 +22,9 @@ <message name="IDS_APP_MANAGEMENT_CAMERA" desc="Label for the camera permission toggle."> Camera </message> + <message name="IDS_APP_MANAGEMENT_EXTENSIONS_SETTINGS" desc="Label for the open Extensions settings button on the Chrome app permissions page."> + Open Extensions settings + </message> <message name="IDS_APP_MANAGEMENT_LESS_APPS" desc="Label for showing less apps."> Show less </message>
diff --git a/chrome/app/printing_strings.grdp b/chrome/app/printing_strings.grdp index 71329f5f..be4b876 100644 --- a/chrome/app/printing_strings.grdp +++ b/chrome/app/printing_strings.grdp
@@ -79,6 +79,12 @@ <message name="IDS_PRINT_PREVIEW_SCALING_LABEL" desc="Scaling option label."> Scale </message> + <message name="IDS_PRINT_PREVIEW_OPTION_DEFAULT_SCALING" desc="Option to print with default (100%) scaling."> + Default + </message> + <message name="IDS_PRINT_PREVIEW_OPTION_CUSTOM_SCALING" desc="Option to print with custom scaling."> + Custom + </message> <message name="IDS_PRINT_PREVIEW_PAGES_PER_SHEET_LABEL" desc="Pages per sheet option label."> Pages per sheet </message>
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 0f8bcaa..21dbdd93 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -2479,6 +2479,8 @@ "android/subresource_filter/test_subresource_filter_publisher.cc", "android/tab_android.cc", "android/tab_android.h", + "android/tab_printer.cc", + "android/tab_printer.h", "android/tab_state.cc", "android/tab_state.h", "android/tab_web_contents_delegate_android.cc", @@ -4218,8 +4220,6 @@ "android/feed/feed_content_bridge.h", "android/feed/feed_host_service_factory.cc", "android/feed/feed_host_service_factory.h", - "android/feed/feed_image_loader_bridge.cc", - "android/feed/feed_image_loader_bridge.h", "android/feed/feed_journal_bridge.cc", "android/feed/feed_journal_bridge.h", "android/feed/feed_lifecycle_bridge.cc", @@ -5060,6 +5060,7 @@ "../android/java/src/org/chromium/chrome/browser/preferences/website/WebsitePreferenceBridge.java", "../android/java/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandler.java", "../android/java/src/org/chromium/chrome/browser/previews/PreviewsAndroidBridge.java", + "../android/java/src/org/chromium/chrome/browser/printing/TabPrinter.java", "../android/java/src/org/chromium/chrome/browser/profiles/Profile.java", "../android/java/src/org/chromium/chrome/browser/profiles/ProfileDownloader.java", "../android/java/src/org/chromium/chrome/browser/profiles/ProfileManagerUtils.java", @@ -5116,7 +5117,6 @@ if (enable_feed_in_chrome) { sources += [ "../android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedContentBridge.java", - "../android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedImageLoaderBridge.java", "../android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedJournalBridge.java", "../android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedLifecycleBridge.java", "../android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedLoggingBridge.java",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index f785c50..dfc4cc0 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -1890,10 +1890,6 @@ feature_engagement::kIPHDemoMode, feature_engagement::kIPHDemoModeChoiceVariations, "IPH_DemoMode")}, - {"disable-cast-streaming-hw-encoding", - flag_descriptions::kCastStreamingHwEncodingName, - flag_descriptions::kCastStreamingHwEncodingDescription, kOsAll, - SINGLE_DISABLE_VALUE_TYPE(switches::kDisableCastStreamingHWEncoding)}, {"disable-threaded-scrolling", flag_descriptions::kThreadedScrollingName, flag_descriptions::kThreadedScrollingDescription, kOsAll, SINGLE_DISABLE_VALUE_TYPE(switches::kDisableThreadedScrolling)}, @@ -2974,6 +2970,10 @@ {"omnibox-reverse-answers", flag_descriptions::kOmniboxReverseAnswersName, flag_descriptions::kOmniboxReverseAnswersDescription, kOsDesktop, FEATURE_VALUE_TYPE(omnibox::kOmniboxReverseAnswers)}, + {"omnibox-reverse-tab-switch-logic", + flag_descriptions::kOmniboxReverseTabSwitchLogicName, + flag_descriptions::kOmniboxReverseTabSwitchLogicDescription, kOsDesktop, + FEATURE_VALUE_TYPE(omnibox::kOmniboxReverseTabSwitchLogic)}, {"omnibox-tail-suggestions", flag_descriptions::kOmniboxTailSuggestionsName, flag_descriptions::kOmniboxTailSuggestionsDescription, kOsDesktop, FEATURE_VALUE_TYPE(omnibox::kOmniboxTailSuggestions)},
diff --git a/chrome/browser/android/content/content_utils.cc b/chrome/browser/android/content/content_utils.cc index bfe0e9c..4334db0 100644 --- a/chrome/browser/android/content/content_utils.cc +++ b/chrome/browser/android/content/content_utils.cc
@@ -2,9 +2,7 @@ // 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 "base/android/jni_string.h" -#include "base/android/scoped_java_ref.h" #include "chrome/browser/chrome_content_browser_client.h" #include "components/version_info/version_info.h" #include "content/public/browser/web_contents.h"
diff --git a/chrome/browser/android/download/download_controller.cc b/chrome/browser/android/download/download_controller.cc index f569dcd..7e5006d 100644 --- a/chrome/browser/android/download/download_controller.cc +++ b/chrome/browser/android/download/download_controller.cc
@@ -388,6 +388,9 @@ } void DownloadController::OnDownloadUpdated(DownloadItem* item) { + if (item->IsTemporary() || item->IsTransient()) + return; + if (item->IsDangerous() && (item->GetState() != DownloadItem::CANCELLED)) { // Dont't show notification for a dangerous download, as user can resume // the download after browser crash through notification.
diff --git a/chrome/browser/android/download/download_manager_service.cc b/chrome/browser/android/download/download_manager_service.cc index f602d3f..e501b0e 100644 --- a/chrome/browser/android/download/download_manager_service.cc +++ b/chrome/browser/android/download/download_manager_service.cc
@@ -72,6 +72,12 @@ item->GetFileExternallyRemoved()); } +// For download that doesn't require full browser process, origin security check +// is skipped as the download is either resumption or from a secure source. +bool IgnoreOriginSecurityCheck(const GURL& url) { + return true; +} + } // namespace // static @@ -293,9 +299,9 @@ bool is_off_the_record, bool has_user_gesture) { std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid); - if (is_pending_downloads_loaded_ || is_off_the_record) + if (is_pending_downloads_loaded_ || is_off_the_record) { ResumeDownloadInternal(download_guid, is_off_the_record, has_user_gesture); - else { + } else { EnqueueDownloadAction(download_guid, DownloadActionParams(RESUME, has_user_gesture)); } @@ -652,7 +658,7 @@ base::android::GetDataDirectory(&data_dir); in_progress_manager_ = std::make_unique<download::InProgressDownloadManager>( nullptr, data_dir.Append(chrome::kInitialProfile), - download::InProgressDownloadManager::IsOriginSecureCallback(), + base::BindRepeating(&IgnoreOriginSecurityCheck), base::BindRepeating(&content::DownloadRequestUtils::IsURLSafe)); content::GetNetworkServiceFromConnector(service_binding_.GetConnector()); scoped_refptr<network::SharedURLLoaderFactory> factory =
diff --git a/chrome/browser/android/feed/feed_host_service_factory.cc b/chrome/browser/android/feed/feed_host_service_factory.cc index cd6c3aa..280f3de 100644 --- a/chrome/browser/android/feed/feed_host_service_factory.cc +++ b/chrome/browser/android/feed/feed_host_service_factory.cc
@@ -18,18 +18,15 @@ #include "chrome/browser/offline_pages/offline_page_model_factory.h" #include "chrome/browser/offline_pages/prefetch/prefetch_service_factory.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/search/suggestions/image_decoder_impl.h" #include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/common/channel_info.h" #include "components/feed/content/feed_host_service.h" #include "components/feed/content/feed_offline_host.h" #include "components/feed/core/feed_content_database.h" -#include "components/feed/core/feed_image_manager.h" #include "components/feed/core/feed_journal_database.h" #include "components/feed/core/feed_logging_metrics.h" #include "components/feed/core/feed_networking_host.h" #include "components/feed/core/feed_scheduler_host.h" -#include "components/image_fetcher/core/image_fetcher_impl.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/version_info/version_info.h" #include "content/public/browser/browser_context.h" @@ -92,21 +89,11 @@ storage_partition->GetURLLoaderFactoryForBrowserProcess(), base::DefaultTickClock::GetInstance()); - auto image_fetcher = std::make_unique<image_fetcher::ImageFetcherImpl>( - std::make_unique<suggestions::ImageDecoderImpl>(), - content::BrowserContext::GetDefaultStoragePartition(profile) - ->GetURLLoaderFactoryForBrowserProcess()); - - base::FilePath feed_dir(profile->GetPath().Append(kFeedFolder)); - auto image_database = std::make_unique<FeedImageDatabase>(feed_dir); - - auto image_manager = std::make_unique<FeedImageManager>( - std::move(image_fetcher), std::move(image_database)); - auto scheduler_host = std::make_unique<FeedSchedulerHost>( profile->GetPrefs(), g_browser_process->local_state(), base::DefaultClock::GetInstance()); + base::FilePath feed_dir(profile->GetPath().Append(kFeedFolder)); auto content_database = std::make_unique<FeedContentDatabase>(feed_dir); auto journal_database = std::make_unique<FeedJournalDatabase>(feed_dir); @@ -134,10 +121,9 @@ base::DefaultClock::GetInstance()); return new FeedHostService( - std::move(logging_metrics), std::move(image_manager), - std::move(networking_host), std::move(scheduler_host), - std::move(content_database), std::move(journal_database), - std::move(offline_host)); + std::move(logging_metrics), std::move(networking_host), + std::move(scheduler_host), std::move(content_database), + std::move(journal_database), std::move(offline_host)); } content::BrowserContext* FeedHostServiceFactory::GetBrowserContextToUse(
diff --git a/chrome/browser/android/feed/feed_image_loader_bridge.cc b/chrome/browser/android/feed/feed_image_loader_bridge.cc deleted file mode 100644 index ff6264f..0000000 --- a/chrome/browser/android/feed/feed_image_loader_bridge.cc +++ /dev/null
@@ -1,81 +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 "chrome/browser/android/feed/feed_image_loader_bridge.h" - -#include <jni.h> - -#include <string> -#include <utility> - -#include "base/android/callback_android.h" -#include "base/android/jni_string.h" -#include "base/bind.h" -#include "chrome/browser/android/feed/feed_host_service_factory.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/profiles/profile_android.h" -#include "components/feed/content/feed_host_service.h" -#include "components/feed/core/feed_image_manager.h" -#include "jni/FeedImageLoaderBridge_jni.h" -#include "ui/gfx/android/java_bitmap.h" -#include "ui/gfx/image/image.h" - -using base::android::JavaParamRef; -using base::android::JavaRef; -using base::android::ScopedJavaGlobalRef; -using base::android::ScopedJavaLocalRef; - -namespace feed { - -static jlong JNI_FeedImageLoaderBridge_Init( - JNIEnv* env, - const JavaParamRef<jobject>& j_this, - const JavaParamRef<jobject>& j_profile) { - Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile); - FeedHostService* host_service = - FeedHostServiceFactory::GetForBrowserContext(profile); - FeedImageManager* feed_image_manager = host_service->GetImageManager(); - DCHECK(feed_image_manager); - FeedImageLoaderBridge* native_image_loader_bridge = - new FeedImageLoaderBridge(feed_image_manager); - return reinterpret_cast<intptr_t>(native_image_loader_bridge); -} - -FeedImageLoaderBridge::FeedImageLoaderBridge( - FeedImageManager* feed_image_manager) - : feed_image_manager_(feed_image_manager), weak_ptr_factory_(this) {} - -FeedImageLoaderBridge::~FeedImageLoaderBridge() = default; - -void FeedImageLoaderBridge::Destroy(JNIEnv* env, - const JavaRef<jobject>& j_this) { - delete this; -} - -void FeedImageLoaderBridge::FetchImage(JNIEnv* j_env, - const JavaRef<jobject>& j_this, - const JavaRef<jstring>& j_url, - const jint width_px, - const jint height_px, - const JavaRef<jobject>& j_callback) { - ScopedJavaGlobalRef<jobject> callback(j_callback); - std::string url = base::android::ConvertJavaStringToUTF8(j_url); - feed_image_manager_->FetchImage( - {std::move(url)}, width_px, height_px, - base::BindOnce(&FeedImageLoaderBridge::OnImageFetched, - weak_ptr_factory_.GetWeakPtr(), callback)); -} - -void FeedImageLoaderBridge::OnImageFetched( - ScopedJavaGlobalRef<jobject> callback, - const gfx::Image& image, - size_t ignored) { - ScopedJavaLocalRef<jobject> j_bitmap; - if (!image.IsEmpty()) { - j_bitmap = gfx::ConvertToJavaBitmap(image.ToSkBitmap()); - } - RunObjectCallbackAndroid(callback, j_bitmap); -} - -} // namespace feed
diff --git a/chrome/browser/android/feed/feed_image_loader_bridge.h b/chrome/browser/android/feed/feed_image_loader_bridge.h deleted file mode 100644 index b21d07b..0000000 --- a/chrome/browser/android/feed/feed_image_loader_bridge.h +++ /dev/null
@@ -1,47 +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 CHROME_BROWSER_ANDROID_FEED_FEED_IMAGE_LOADER_BRIDGE_H_ -#define CHROME_BROWSER_ANDROID_FEED_FEED_IMAGE_LOADER_BRIDGE_H_ - -#include "base/android/scoped_java_ref.h" -#include "base/memory/weak_ptr.h" -#include "ui/gfx/image/image.h" - -namespace feed { - -class FeedImageManager; - -// Native counterpart of FeedImageLoaderBridge.java. Holds non-owning pointers -// to native implementation, to which operations are delegated. This bridge is -// instantiated, owned, and destroyed from Java. -class FeedImageLoaderBridge { - public: - explicit FeedImageLoaderBridge(FeedImageManager* feed_image_manager); - ~FeedImageLoaderBridge(); - - void Destroy(JNIEnv* j_env, const base::android::JavaRef<jobject>& j_this); - - void FetchImage(JNIEnv* j_env, - const base::android::JavaRef<jobject>& j_this, - const base::android::JavaRef<jstring>& j_url, - const jint width_px, - const jint height_px, - const base::android::JavaRef<jobject>& j_callback); - - private: - void OnImageFetched(base::android::ScopedJavaGlobalRef<jobject> callback, - const gfx::Image& image, - size_t ignored); - - FeedImageManager* feed_image_manager_; - - base::WeakPtrFactory<FeedImageLoaderBridge> weak_ptr_factory_; - - DISALLOW_COPY_AND_ASSIGN(FeedImageLoaderBridge); -}; - -} // namespace feed - -#endif // CHROME_BROWSER_ANDROID_FEED_FEED_IMAGE_LOADER_BRIDGE_H_
diff --git a/chrome/browser/android/tab_android.cc b/chrome/browser/android/tab_android.cc index c76352f..43cb179 100644 --- a/chrome/browser/android/tab_android.cc +++ b/chrome/browser/android/tab_android.cc
@@ -16,6 +16,7 @@ #include "chrome/browser/android/background_tab_manager.h" #include "chrome/browser/android/compositor/tab_content_manager.h" #include "chrome/browser/android/metrics/uma_utils.h" +#include "chrome/browser/android/tab_printer.h" #include "chrome/browser/android/tab_web_contents_delegate_android.h" #include "chrome/browser/android/trusted_cdn.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" @@ -27,8 +28,6 @@ #include "chrome/browser/prerender/prerender_contents.h" #include "chrome/browser/prerender/prerender_manager.h" #include "chrome/browser/prerender/prerender_manager_factory.h" -#include "chrome/browser/printing/print_view_manager_basic.h" -#include "chrome/browser/printing/print_view_manager_common.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_android.h" #include "chrome/browser/profiles/profile_manager.h" @@ -629,35 +628,6 @@ entry->SetTitle(title); } -bool TabAndroid::Print(JNIEnv* env, - const JavaParamRef<jobject>& obj, - jint render_process_id, - jint render_frame_id) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - - if (!web_contents()) - return false; - - content::RenderFrameHost* rfh = - content::RenderFrameHost::FromID(render_process_id, render_frame_id); - - if (!rfh) - rfh = printing::GetFrameToPrint(web_contents()); - - content::WebContents* contents = - content::WebContents::FromRenderFrameHost(rfh); - - printing::PrintViewManagerBasic* print_view_manager = - printing::PrintViewManagerBasic::FromWebContents(contents); - return print_view_manager && print_view_manager->PrintNow(rfh); -} - -void TabAndroid::SetPendingPrint(int render_process_id, int render_frame_id) { - JNIEnv* env = base::android::AttachCurrentThread(); - Java_Tab_setPendingPrint(env, weak_java_tab_.get(env), render_process_id, - render_frame_id); -} - ScopedJavaLocalRef<jobject> TabAndroid::GetFavicon( JNIEnv* env, const JavaParamRef<jobject>& obj) { @@ -901,17 +871,6 @@ tab_content_manager_->NativeRemoveTabThumbnail(GetAndroidId()); } -jint TabAndroid::GetCurrentRenderProcessId(JNIEnv* env, - const JavaParamRef<jobject>& obj) { - content::RenderViewHost* host = web_contents_->GetRenderViewHost(); - DCHECK(host); - content::RenderProcessHost* render_process = host->GetProcess(); - DCHECK(render_process); - if (render_process->IsInitializedAndNotDead()) - return render_process->GetProcess().Handle(); - return 0; -} - void TabAndroid::OnInterfaceRequestFromFrame( content::RenderFrameHost* render_frame_host, const std::string& interface_name,
diff --git a/chrome/browser/android/tab_android.h b/chrome/browser/android/tab_android.h index 394a0f2..80a1805 100644 --- a/chrome/browser/android/tab_android.h +++ b/chrome/browser/android/tab_android.h
@@ -180,13 +180,6 @@ const base::android::JavaParamRef<jobject>& obj, const base::android::JavaParamRef<jstring>& jurl, const base::android::JavaParamRef<jstring>& jtitle); - bool Print(JNIEnv* env, - const base::android::JavaParamRef<jobject>& obj, - jint render_process_id, - jint render_frame_id); - - // Sets the tab as content to be printed through JNI. - void SetPendingPrint(int render_process_id, int render_frame_id); // Called to get default favicon of current tab, return null if no // favicon is avaliable for current tab. @@ -229,10 +222,6 @@ JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); - jint GetCurrentRenderProcessId( - JNIEnv* env, - const base::android::JavaParamRef<jobject>& obj); - bool HasPrerenderedUrl(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj, const base::android::JavaParamRef<jstring>& url);
diff --git a/chrome/browser/android/tab_printer.cc b/chrome/browser/android/tab_printer.cc new file mode 100644 index 0000000..486ad9e --- /dev/null +++ b/chrome/browser/android/tab_printer.cc
@@ -0,0 +1,48 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/android/tab_printer.h" + +#include "chrome/browser/printing/print_view_manager_basic.h" +#include "chrome/browser/printing/print_view_manager_common.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/render_frame_host.h" +#include "jni/TabPrinter_jni.h" + +using base::android::ScopedJavaLocalRef; + +namespace printing { + +ScopedJavaLocalRef<jobject> GetPrintableForTab( + const ScopedJavaLocalRef<jobject>& java_tab) { + JNIEnv* env = base::android::AttachCurrentThread(); + return Java_TabPrinter_getPrintable(env, java_tab); +} + +static jboolean JNI_TabPrinter_Print( + JNIEnv* env, + const base::android::JavaParamRef<jobject>& jweb_contents, + jint render_process_id, + jint render_frame_id) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + content::WebContents* web_contents = + content::WebContents::FromJavaWebContents(jweb_contents); + if (!web_contents) + return false; + + content::RenderFrameHost* rfh = + content::RenderFrameHost::FromID(render_process_id, render_frame_id); + if (!rfh) + rfh = GetFrameToPrint(web_contents); + + content::WebContents* contents = + content::WebContents::FromRenderFrameHost(rfh); + + PrintViewManagerBasic* print_view_manager = + PrintViewManagerBasic::FromWebContents(contents); + return print_view_manager && print_view_manager->PrintNow(rfh); +} + +} // namespace printing
diff --git a/chrome/browser/android/tab_printer.h b/chrome/browser/android/tab_printer.h new file mode 100644 index 0000000..f143d778 --- /dev/null +++ b/chrome/browser/android/tab_printer.h
@@ -0,0 +1,18 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ANDROID_TAB_PRINTER_H_ +#define CHROME_BROWSER_ANDROID_TAB_PRINTER_H_ + +#include "base/android/jni_android.h" +#include "base/android/scoped_java_ref.h" + +namespace printing { + +base::android::ScopedJavaLocalRef<jobject> GetPrintableForTab( + const base::android::ScopedJavaLocalRef<jobject>& java_tab); + +} // namespace printing + +#endif // CHROME_BROWSER_ANDROID_TAB_PRINTER_H_
diff --git a/chrome/browser/apps/app_service/arc_apps.cc b/chrome/browser/apps/app_service/arc_apps.cc index 7eb9f0eda..83c11de471 100644 --- a/chrome/browser/apps/app_service/arc_apps.cc +++ b/chrome/browser/apps/app_service/arc_apps.cc
@@ -419,6 +419,7 @@ : apps::mojom::OptionalBool::kFalse; app->show_in_launcher = show; app->show_in_search = show; + app->show_in_management = show; return app; }
diff --git a/chrome/browser/apps/app_service/built_in_chromeos_apps.cc b/chrome/browser/apps/app_service/built_in_chromeos_apps.cc index 43dc0bb..aa10f848 100644 --- a/chrome/browser/apps/app_service/built_in_chromeos_apps.cc +++ b/chrome/browser/apps/app_service/built_in_chromeos_apps.cc
@@ -49,6 +49,7 @@ app->show_in_search = internal_app.searchable ? apps::mojom::OptionalBool::kTrue : apps::mojom::OptionalBool::kFalse; + app->show_in_management = apps::mojom::OptionalBool::kFalse; return app; }
diff --git a/chrome/browser/apps/app_service/crostini_apps.cc b/chrome/browser/apps/app_service/crostini_apps.cc index 4e51b4a3c..a9c6cdd 100644 --- a/chrome/browser/apps/app_service/crostini_apps.cc +++ b/chrome/browser/apps/app_service/crostini_apps.cc
@@ -188,6 +188,7 @@ : apps::mojom::OptionalBool::kFalse; app->show_in_launcher = show; app->show_in_search = show; + app->show_in_management = show; return app; }
diff --git a/chrome/browser/apps/app_service/extension_apps.cc b/chrome/browser/apps/app_service/extension_apps.cc index e6a28fe..2c70697 100644 --- a/chrome/browser/apps/app_service/extension_apps.cc +++ b/chrome/browser/apps/app_service/extension_apps.cc
@@ -29,6 +29,7 @@ #include "components/content_settings/core/common/content_settings_types.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" +#include "extensions/common/switches.h" #include "mojo/public/cpp/bindings/interface_request.h" // TODO(crbug.com/826982): life cycle events. Extensions can be installed and @@ -361,6 +362,21 @@ return app_id == arc::kPlayStoreAppId; } +// static +apps::mojom::OptionalBool ExtensionApps::ShouldShowInAppManagement( + const extensions::Extension* extension) { + // Component extensions should not show up in App Management as they + // are only extensions as an implementation detail of Chrome, and have + // no meaningful settings. + if (extensions::Manifest::IsComponentLocation(extension->location()) && + !base::CommandLine::ForCurrentProcess()->HasSwitch( + extensions::switches::kShowComponentExtensionOptions)) { + return apps::mojom::OptionalBool::kFalse; + } else { + return apps::mojom::OptionalBool::kTrue; + } +} + void ExtensionApps::PopulatePermissions( const extensions::Extension* extension, std::vector<mojom::PermissionPtr>* target) { @@ -450,6 +466,7 @@ : apps::mojom::OptionalBool::kFalse; app->show_in_launcher = show; app->show_in_search = show; + app->show_in_management = ShouldShowInAppManagement(extension); return app; }
diff --git a/chrome/browser/apps/app_service/extension_apps.h b/chrome/browser/apps/app_service/extension_apps.h index 51477ef2..0f093be 100644 --- a/chrome/browser/apps/app_service/extension_apps.h +++ b/chrome/browser/apps/app_service/extension_apps.h
@@ -86,6 +86,8 @@ bool RunExtensionEnableFlow(const std::string& app_id); static bool IsBlacklisted(const std::string& app_id); + static apps::mojom::OptionalBool ShouldShowInAppManagement( + const extensions::Extension* extension); void PopulatePermissions(const extensions::Extension* extension, std::vector<mojom::PermissionPtr>* target); apps::mojom::AppPtr Convert(const extensions::Extension* extension,
diff --git a/chrome/browser/apps/platform_apps/api/arc_apps_private/arc_apps_private_api.cc b/chrome/browser/apps/platform_apps/api/arc_apps_private/arc_apps_private_api.cc index f6f0e98..a4f1f9c 100644 --- a/chrome/browser/apps/platform_apps/api/arc_apps_private/arc_apps_private_api.cc +++ b/chrome/browser/apps/platform_apps/api/arc_apps_private/arc_apps_private_api.cc
@@ -9,6 +9,7 @@ #include "base/logging.h" #include "base/no_destructor.h" +#include "chrome/browser/chromeos/login/demo_mode/demo_session.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" #include "chrome/common/apps/platform_apps/api/arc_apps_private.h" @@ -112,11 +113,16 @@ const std::string app_id = prefs->GetAppIdByPackageName(params->package_name); if (app_id.empty()) return RespondNow(Error("App not found")); + if (!arc::LaunchApp( browser_context(), app_id, ui::EF_NONE, arc::UserInteractionType::APP_STARTED_FROM_EXTENSION_API)) { return RespondNow(Error("Launch failed")); } + + chromeos::DemoSession::RecordAppLaunchSourceIfInDemoMode( + chromeos::DemoSession::AppLaunchSource::kExtensionApi); + return RespondNow(NoArguments()); }
diff --git a/chrome/browser/apps/platform_apps/api/arc_apps_private/arc_apps_private_apitest.cc b/chrome/browser/apps/platform_apps/api/arc_apps_private/arc_apps_private_apitest.cc index 41a475b..300b740 100644 --- a/chrome/browser/apps/platform_apps/api/arc_apps_private/arc_apps_private_apitest.cc +++ b/chrome/browser/apps/platform_apps/api/arc_apps_private/arc_apps_private_apitest.cc
@@ -6,7 +6,9 @@ #include "base/macros.h" #include "base/path_service.h" +#include "base/test/metrics/histogram_tester.h" #include "chrome/browser/chromeos/arc/arc_util.h" +#include "chrome/browser/chromeos/login/demo_mode/demo_session.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" #include "chrome/common/chrome_paths.h" @@ -132,3 +134,54 @@ ASSERT_EQ(1u, app_instance->launch_requests().size()); EXPECT_TRUE(app_instance->launch_requests()[0]->IsForApp(launchable_app)); } + +IN_PROC_BROWSER_TEST_F(ArcAppsPrivateApiTest, + NoDemoModeAppLaunchSourceReported) { + // Not in Demo mode + EXPECT_FALSE(chromeos::DemoSession::IsDeviceInDemoMode()); + + base::HistogramTester histogram_tester; + + // Should see 0 apps launched from the Launcher in the histogram at first. + histogram_tester.ExpectTotalCount("DemoMode.AppLaunchSource", 0); + + // Launch an arc app as done in the tests above. + ArcAppListPrefs* prefs = ArcAppListPrefs::Get(browser()->profile()); + ASSERT_TRUE(prefs); + std::unique_ptr<arc::FakeAppInstance> app_instance = CreateAppInstance(prefs); + arc::mojom::AppInfo launchable_app("App_0", "Package_0", "Dummy_activity_0"); + app_instance->SendRefreshAppList({launchable_app}); + EXPECT_TRUE( + RunPlatformAppTestWithArg("arc_app_launcher/launch_app", "Package_0")) + << message_; + + // Should still see no apps launched in the histogram. + histogram_tester.ExpectTotalCount("DemoMode.AppLaunchSource", 0); +} + +IN_PROC_BROWSER_TEST_F(ArcAppsPrivateApiTest, DemoModeAppLaunchSourceReported) { + // Set Demo mode + chromeos::DemoSession::SetDemoConfigForTesting( + chromeos::DemoSession::DemoModeConfig::kOnline); + EXPECT_TRUE(chromeos::DemoSession::IsDeviceInDemoMode()); + + base::HistogramTester histogram_tester; + + // Should see 0 apps launched from the Launcher in the histogram at first. + histogram_tester.ExpectTotalCount("DemoMode.AppLaunchSource", 0); + + // Launch an arc app as done in the tests above. + ArcAppListPrefs* prefs = ArcAppListPrefs::Get(browser()->profile()); + ASSERT_TRUE(prefs); + std::unique_ptr<arc::FakeAppInstance> app_instance = CreateAppInstance(prefs); + arc::mojom::AppInfo launchable_app("App_0", "Package_0", "Dummy_activity_0"); + app_instance->SendRefreshAppList({launchable_app}); + EXPECT_TRUE( + RunPlatformAppTestWithArg("arc_app_launcher/launch_app", "Package_0")) + << message_; + + // Should see 1 app launched from the highlights app in the histogram. + histogram_tester.ExpectUniqueSample( + "DemoMode.AppLaunchSource", + chromeos::DemoSession::AppLaunchSource::kExtensionApi, 1); +}
diff --git a/chrome/browser/apps/platform_apps/app_browsertest.cc b/chrome/browser/apps/platform_apps/app_browsertest.cc index db833683..14db9cd 100644 --- a/chrome/browser/apps/platform_apps/app_browsertest.cc +++ b/chrome/browser/apps/platform_apps/app_browsertest.cc
@@ -1420,10 +1420,7 @@ ASSERT_TRUE(content::ExecuteScriptAndExtractBool( web_contents, "exitPictureInPicture();", &result)); EXPECT_TRUE(result); - // TODO(mlamouri): this check is relying on IPC timing. The timing will be - // fixed with - // https://chromium-review.googlesource.com/c/chromium/src/+/1409544 - // EXPECT_FALSE(window_controller->GetWindowForTesting()->IsVisible()); + EXPECT_FALSE(window_controller->GetWindowForTesting()->IsVisible()); } } // namespace extensions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 2695447..a35b82e4 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -2147,7 +2147,6 @@ switches::kCloudPrintURL, switches::kCloudPrintXmppEndpoint, switches::kDisableBundledPpapiFlash, - switches::kDisableCastStreamingHWEncoding, switches::kDisableJavaScriptHarmonyShipping, variations::switches::kEnableBenchmarking, switches::kEnableDistillabilityService,
diff --git a/chrome/browser/chromeos/arc/boot_phase_monitor/arc_instance_throttle.cc b/chrome/browser/chromeos/arc/boot_phase_monitor/arc_instance_throttle.cc index 74797d0..6c20153 100644 --- a/chrome/browser/chromeos/arc/boot_phase_monitor/arc_instance_throttle.cc +++ b/chrome/browser/chromeos/arc/boot_phase_monitor/arc_instance_throttle.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/chromeos/arc/boot_phase_monitor/arc_instance_throttle.h" +#include "ash/public/cpp/shell_window_ids.h" #include "ash/shell.h" #include "ash/wm/window_util.h" #include "components/arc/arc_util.h" @@ -13,7 +14,17 @@ namespace { -void ThrottleInstance(aura::Window* active) { +// Returns true if the window is in the app list window container. +bool IsAppListWindow(const aura::Window* window) { + if (!window) + return false; + + const aura::Window* parent = window->parent(); + return parent && + parent->id() == ash::ShellWindowId::kShellWindowId_AppListContainer; +} + +void ThrottleInstance(const aura::Window* active) { SetArcCpuRestriction(!IsArcAppWindow(active)); } @@ -35,6 +46,21 @@ void ArcInstanceThrottle::OnWindowActivated(ActivationReason reason, aura::Window* gained_active, aura::Window* lost_active) { + // On launching an app from the app list on Chrome OS the following events + // happen - + // + // 1. When app list is brought up it's treated as a Chrome window and the + // instance is throttled. + // + // 2. When an app icon is clicked the instance is unthrottled. + // + // 3. Between the time the app opens there is a narrow slice of time where + // this callback is triggered with |lost_active| equal to the app list window + // and the gained active possibly a native window. Without the check below the + // instance will be throttled again, further delaying the app launch. If the + // app was a native one then the instance was throttled anyway in step 1. + if (IsAppListWindow(lost_active)) + return; ThrottleInstance(gained_active); }
diff --git a/chrome/browser/chromeos/crostini/crostini_manager.cc b/chrome/browser/chromeos/crostini/crostini_manager.cc index b3aa550..9addacfc 100644 --- a/chrome/browser/chromeos/crostini/crostini_manager.cc +++ b/chrome/browser/chromeos/crostini/crostini_manager.cc
@@ -44,14 +44,15 @@ #include "components/prefs/pref_service.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/network_service_instance.h" #include "content/public/common/service_manager_connection.h" #include "dbus/message.h" #include "device/usb/public/mojom/device.mojom.h" #include "device/usb/public/mojom/device_enumeration_options.mojom.h" #include "extensions/browser/extension_registry.h" #include "net/base/escape.h" -#include "net/base/network_change_notifier.h" #include "services/device/public/mojom/constants.mojom.h" +#include "services/network/public/cpp/network_connection_tracker.h" #include "services/service_manager/public/cpp/connector.h" #include "storage/browser/fileapi/external_mount_points.h" @@ -241,6 +242,12 @@ void CreateDiskImageAfterSizeCheck(int64_t disk_space_taken, int64_t free_disk_bytes) { + // Unlike other functions, this isn't called from a crostini_manager_ + // function, so crostini_manager_ could have been deleted. + if (!crostini_manager_) { + return; + } + int64_t disk_size_available = (free_disk_bytes * 9) / 10; // If there's no existing disk image, need enough space to create one. if (disk_space_taken == 0) { @@ -638,7 +645,7 @@ return; } termina_update_check_needed_ = true; - if (net::NetworkChangeNotifier::IsOffline()) { + if (content::GetNetworkConnectionTracker()->IsOffline()) { // Can't do a component Load with kForce when offline. VLOG(1) << "Not online, so can't check now for cros-termina upgrade."; return; @@ -667,7 +674,7 @@ cros_component_manager ->GetCompatiblePath(imageloader::kTerminaComponentName) .empty(); - bool is_offline = net::NetworkChangeNotifier::IsOffline(); + bool is_offline = content::GetNetworkConnectionTracker()->IsOffline(); if (major_update_required) { termina_update_check_needed_ = false; @@ -946,6 +953,67 @@ request.container_name(), std::move(callback))); } +void CrostiniManager::DeleteLxdContainer(std::string vm_name, + std::string container_name, + CrostiniResultCallback callback) { + if (vm_name.empty()) { + LOG(ERROR) << "vm_name is required"; + std::move(callback).Run(CrostiniResult::CLIENT_ERROR); + return; + } + if (container_name.empty()) { + LOG(ERROR) << "container_name is required"; + std::move(callback).Run(CrostiniResult::CLIENT_ERROR); + return; + } + if (!GetCiceroneClient()->IsLxdContainerDeletedSignalConnected()) { + LOG(ERROR) + << "Async call to DeleteLxdContainer can't complete when signals " + "are not connected."; + std::move(callback).Run(CrostiniResult::CLIENT_ERROR); + return; + } + + vm_tools::cicerone::DeleteLxdContainerRequest request; + request.set_vm_name(std::move(vm_name)); + request.set_container_name(std::move(container_name)); + request.set_owner_id(owner_id_); + GetCiceroneClient()->DeleteLxdContainer( + std::move(request), + base::BindOnce(&CrostiniManager::OnDeleteLxdContainer, + weak_ptr_factory_.GetWeakPtr(), request.vm_name(), + request.container_name(), std::move(callback))); +} + +void CrostiniManager::OnDeleteLxdContainer( + std::string vm_name, + std::string container_name, + CrostiniResultCallback callback, + base::Optional<vm_tools::cicerone::DeleteLxdContainerResponse> reply) { + if (!reply.has_value()) { + LOG(ERROR) << "Failed to delete lxd container in vm. Empty response."; + std::move(callback).Run(CrostiniResult::UNKNOWN_ERROR); + return; + } + vm_tools::cicerone::DeleteLxdContainerResponse response = reply.value(); + if (response.status() == + vm_tools::cicerone::DeleteLxdContainerResponse::DELETING) { + VLOG(1) << "Awaiting LxdContainerDeletedSignal for " << vm_name << ", " + << container_name; + delete_lxd_container_callbacks_.emplace( + std::make_tuple(vm_name, container_name), std::move(callback)); + + } else if (response.status() == + vm_tools::cicerone::DeleteLxdContainerResponse::DOES_NOT_EXIST) { + RemoveLxdContainerFromPrefs(profile_, vm_name, container_name); + std::move(callback).Run(CrostiniResult::SUCCESS); + + } else { + LOG(ERROR) << "Failed to delete container: " << response.failure_reason(); + std::move(callback).Run(CrostiniResult::UNKNOWN_ERROR); + } +} + void CrostiniManager::StartLxdContainer(std::string vm_name, std::string container_name, CrostiniResultCallback callback) { @@ -2143,7 +2211,37 @@ } void CrostiniManager::OnLxdContainerDeleted( - const vm_tools::cicerone::LxdContainerDeletedSignal& signal) {} + const vm_tools::cicerone::LxdContainerDeletedSignal& signal) { + if (signal.owner_id() != owner_id_) + return; + CrostiniResult result; + + switch (signal.status()) { + case vm_tools::cicerone::LxdContainerDeletedSignal::UNKNOWN: + result = CrostiniResult::UNKNOWN_ERROR; + break; + case vm_tools::cicerone::LxdContainerDeletedSignal::DELETED: + result = CrostiniResult::SUCCESS; + RemoveLxdContainerFromPrefs(profile_, signal.vm_name(), + signal.container_name()); + break; + case vm_tools::cicerone::LxdContainerDeletedSignal::CANCELLED: + case vm_tools::cicerone::LxdContainerDeletedSignal::FAILED: + default: + result = CrostiniResult::UNKNOWN_ERROR; + LOG(ERROR) << "Failed to delete container (" << signal.vm_name() << "," + << signal.container_name() + << ") : " << signal.failure_reason(); + break; + } + // Find the callbacks to call, then erase them from the map. + auto range = delete_lxd_container_callbacks_.equal_range( + std::make_tuple(signal.vm_name(), signal.container_name())); + for (auto it = range.first; it != range.second; ++it) { + std::move(it->second).Run(result); + } + delete_lxd_container_callbacks_.erase(range.first, range.second); +} void CrostiniManager::OnLxdContainerDownloading( const vm_tools::cicerone::LxdContainerDownloadingSignal& signal) {
diff --git a/chrome/browser/chromeos/crostini/crostini_manager.h b/chrome/browser/chromeos/crostini/crostini_manager.h index aad3531..62669cb 100644 --- a/chrome/browser/chromeos/crostini/crostini_manager.h +++ b/chrome/browser/chromeos/crostini/crostini_manager.h
@@ -365,6 +365,13 @@ std::string container_name, CrostiniResultCallback callback); + // Checks the arguments for deleting an Lxd container via + // CiceroneClient::DeleteLxdContainer. |callback| is called immediately if the + // arguments are bad, or once the container has been deleted. + void DeleteLxdContainer(std::string vm_name, + std::string container_name, + CrostiniResultCallback callback); + // Checks the arguments for starting an Lxd container via // CiceroneClient::StartLxdContainer. |callback| is called immediately if the // arguments are bad, or once the container has been created. @@ -662,6 +669,13 @@ CrostiniResultCallback callback, base::Optional<vm_tools::cicerone::CreateLxdContainerResponse> reply); + // Callback for CiceroneClient::DeleteLxdContainer. + void OnDeleteLxdContainer( + std::string vm_name, + std::string container_name, + CrostiniResultCallback callback, + base::Optional<vm_tools::cicerone::DeleteLxdContainerResponse> reply); + // Callback for CiceroneClient::StartLxdContainer. void OnStartLxdContainer( std::string vm_name, @@ -807,6 +821,12 @@ std::multimap<ContainerId, CrostiniResultCallback> create_lxd_container_callbacks_; + // Pending DeleteLxdContainer callbacks are keyed by <vm_name, container_name> + // string pairs. These are used if DeleteLxdContainer indicates we need to + // wait for an LxdContainerDelete signal. + std::multimap<std::pair<std::string, std::string>, CrostiniResultCallback> + delete_lxd_container_callbacks_; + // Pending StartLxdContainer callbacks are keyed by <vm_name, container_name> // string pairs. These are used if StartLxdContainer indicates we need to // wait for an LxdContainerStarting signal.
diff --git a/chrome/browser/chromeos/crostini/crostini_mime_types_service.cc b/chrome/browser/chromeos/crostini/crostini_mime_types_service.cc index a3e7c34..c17d232 100644 --- a/chrome/browser/chromeos/crostini/crostini_mime_types_service.cc +++ b/chrome/browser/chromeos/crostini/crostini_mime_types_service.cc
@@ -67,12 +67,17 @@ ->GetString(); } -void CrostiniMimeTypesService::ClearMimeTypes(const std::string& vm_name) { +void CrostiniMimeTypesService::ClearMimeTypes( + const std::string& vm_name, + const std::string& container_name) { DictionaryPrefUpdate update(prefs_, prefs::kCrostiniMimeTypes); base::DictionaryValue* mime_type_mappings = update.Get(); std::vector<std::string> removed_ids; for (const auto& item : mime_type_mappings->DictItems()) { - if (item.second.FindKey(kAppVmNameKey)->GetString() == vm_name) { + if (item.second.FindKey(kAppVmNameKey)->GetString() == vm_name && + (container_name.empty() || + item.second.FindKey(kAppContainerNameKey)->GetString() == + container_name)) { removed_ids.push_back(item.first); } }
diff --git a/chrome/browser/chromeos/crostini/crostini_mime_types_service.h b/chrome/browser/chromeos/crostini/crostini_mime_types_service.h index b1a9f7a..552e7c7e 100644 --- a/chrome/browser/chromeos/crostini/crostini_mime_types_service.h +++ b/chrome/browser/chromeos/crostini/crostini_mime_types_service.h
@@ -39,7 +39,8 @@ // Remove all MIME type associations for the named VM. Used in the // uninstall process. - void ClearMimeTypes(const std::string& vm_name); + void ClearMimeTypes(const std::string& vm_name, + const std::string& container_name); // The existing list of MIME type mappings is replaced by // |mime_type_mappings|.
diff --git a/chrome/browser/chromeos/crostini/crostini_mime_types_service_unittest.cc b/chrome/browser/chromeos/crostini/crostini_mime_types_service_unittest.cc index e9f39a7..94f17db 100644 --- a/chrome/browser/chromeos/crostini/crostini_mime_types_service_unittest.cc +++ b/chrome/browser/chromeos/crostini/crostini_mime_types_service_unittest.cc
@@ -123,7 +123,7 @@ EXPECT_EQ("foobar/mime", service()->GetMimeType(base::FilePath("test.foobar"), "vm 2", "container 1")); - service()->ClearMimeTypes("vm 2"); + service()->ClearMimeTypes("vm 2", ""); EXPECT_EQ("foo/mime", service()->GetMimeType(base::FilePath("test.foo"), "vm 1", "container 1"));
diff --git a/chrome/browser/chromeos/crostini/crostini_pref_names.cc b/chrome/browser/chromeos/crostini/crostini_pref_names.cc index 6e43048..2087d9a 100644 --- a/chrome/browser/chromeos/crostini/crostini_pref_names.cc +++ b/chrome/browser/chromeos/crostini/crostini_pref_names.cc
@@ -25,6 +25,8 @@ // enabled state for use with Crostini. const char kCrostiniSharedUsbDevices[] = "crostini.shared_usb_devices"; const char kCrostiniContainers[] = "crostini.containers"; +const char kVmKey[] = "vm_name"; +const char kContainerKey[] = "container_name"; // A boolean preference representing a user level enterprise policy to enable // Crostini use. @@ -53,8 +55,8 @@ // preference should not be accessed unless crostini is installed // (i.e. kCrostiniEnabled is true). base::Value default_container(base::Value::Type::DICTIONARY); - default_container.SetKey("vm_name", base::Value(kCrostiniDefaultVmName)); - default_container.SetKey("container_name", + default_container.SetKey(kVmKey, base::Value(kCrostiniDefaultVmName)); + default_container.SetKey(kContainerKey, base::Value(kCrostiniDefaultContainerName)); base::Value::ListStorage default_containers_list;
diff --git a/chrome/browser/chromeos/crostini/crostini_pref_names.h b/chrome/browser/chromeos/crostini/crostini_pref_names.h index eba65bbb..cea4cec 100644 --- a/chrome/browser/chromeos/crostini/crostini_pref_names.h +++ b/chrome/browser/chromeos/crostini/crostini_pref_names.h
@@ -16,6 +16,8 @@ extern const char kCrostiniSharedPaths[]; extern const char kCrostiniSharedUsbDevices[]; extern const char kCrostiniContainers[]; +extern const char kVmKey[]; +extern const char kContainerKey[]; extern const char kUserCrostiniAllowedByPolicy[];
diff --git a/chrome/browser/chromeos/crostini/crostini_registry_service.cc b/chrome/browser/chromeos/crostini/crostini_registry_service.cc index e725cea..87c2bc03 100644 --- a/chrome/browser/chromeos/crostini/crostini_registry_service.cc +++ b/chrome/browser/chromeos/crostini/crostini_registry_service.cc
@@ -136,6 +136,35 @@ return result; } +// Construct a registration based on the given App proto. +// |name| should be |app.name()| in Dictionary form. +base::Value AppPrefRegistrationFromApp( + const vm_tools::apps::App& app, + base::Value name, + const vm_tools::apps::ApplicationList& app_list) { + base::Value pref_registration(base::Value::Type::DICTIONARY); + pref_registration.SetKey(kAppDesktopFileIdKey, + base::Value(app.desktop_file_id())); + pref_registration.SetKey(kAppVmNameKey, base::Value(app_list.vm_name())); + pref_registration.SetKey(kAppContainerNameKey, + base::Value(app_list.container_name())); + pref_registration.SetKey(kAppNameKey, std::move(name)); + pref_registration.SetKey(kAppCommentKey, ProtoToDictionary(app.comment())); + pref_registration.SetKey(kAppExecutableFileNameKey, + base::Value(app.executable_file_name())); + pref_registration.SetKey(kAppMimeTypesKey, ProtoToList(app.mime_types())); + pref_registration.SetKey(kAppKeywordsKey, + LocaleStringsProtoToDictionary(app.keywords())); + pref_registration.SetKey(kAppNoDisplayKey, base::Value(app.no_display())); + pref_registration.SetKey(kAppStartupWMClassKey, + base::Value(app.startup_wm_class())); + pref_registration.SetKey(kAppStartupNotifyKey, + base::Value(app.startup_notify())); + pref_registration.SetKey(kAppPackageIdKey, base::Value(app.package_id())); + + return pref_registration; +} + // This is the companion to CrostiniRegistryService::SetCurrentTime(). base::Time GetTime(const base::Value& pref, const char* key) { if (!pref.is_dict()) @@ -660,7 +689,9 @@ RequestIcon(app_id, scale_factor); } -void CrostiniRegistryService::ClearApplicationList(const std::string& vm_name) { +void CrostiniRegistryService::ClearApplicationList( + const std::string& vm_name, + const std::string& container_name) { std::vector<std::string> removed_apps; // The DictionaryPrefUpdate should be destructed before calling the observer. { @@ -670,7 +701,10 @@ for (const auto& item : apps->DictItems()) { if (item.first == kCrostiniTerminalId) continue; - if (item.second.FindKey(kAppVmNameKey)->GetString() == vm_name) + if (item.second.FindKey(kAppVmNameKey)->GetString() == vm_name && + (container_name.empty() || + item.second.FindKey(kAppContainerNameKey)->GetString() == + container_name)) removed_apps.push_back(item.first); } for (const std::string& removed_app : removed_apps) { @@ -727,26 +761,8 @@ app.desktop_file_id(), app_list.vm_name(), app_list.container_name()); new_app_ids.insert(app_id); - base::Value pref_registration(base::Value::Type::DICTIONARY); - pref_registration.SetKey(kAppDesktopFileIdKey, - base::Value(app.desktop_file_id())); - pref_registration.SetKey(kAppVmNameKey, base::Value(app_list.vm_name())); - pref_registration.SetKey(kAppContainerNameKey, - base::Value(app_list.container_name())); - pref_registration.SetKey(kAppNameKey, std::move(name)); - pref_registration.SetKey(kAppCommentKey, - ProtoToDictionary(app.comment())); - pref_registration.SetKey(kAppExecutableFileNameKey, - base::Value(app.executable_file_name())); - pref_registration.SetKey(kAppMimeTypesKey, ProtoToList(app.mime_types())); - pref_registration.SetKey(kAppKeywordsKey, - LocaleStringsProtoToDictionary(app.keywords())); - pref_registration.SetKey(kAppNoDisplayKey, base::Value(app.no_display())); - pref_registration.SetKey(kAppStartupWMClassKey, - base::Value(app.startup_wm_class())); - pref_registration.SetKey(kAppStartupNotifyKey, - base::Value(app.startup_notify())); - pref_registration.SetKey(kAppPackageIdKey, base::Value(app.package_id())); + base::Value pref_registration = + AppPrefRegistrationFromApp(app, std::move(name), app_list); base::Value* old_app = apps->FindKey(app_id); if (old_app && EqualsExcludingTimestamps(pref_registration, *old_app))
diff --git a/chrome/browser/chromeos/crostini/crostini_registry_service.h b/chrome/browser/chromeos/crostini/crostini_registry_service.h index c1c1ab5..0b7ec83d 100644 --- a/chrome/browser/chromeos/crostini/crostini_registry_service.h +++ b/chrome/browser/chromeos/crostini/crostini_registry_service.h
@@ -166,8 +166,16 @@ void MaybeRequestIcon(const std::string& app_id, ui::ScaleFactor scale_factor); - // Remove all apps from the named VM. Used in the uninstall process. - void ClearApplicationList(const std::string& vm_name); + // Remove all apps from the named VM and container. If |container_name| is an + // empty string, this function removes all apps associated with the VM, + // regardless of container. Used in the uninstall process. + void ClearApplicationList(const std::string& vm_name, + const std::string& container_name); + + // Remove all apps from the named container. Used when deleting a container + // without deleting the whole VM. + void ClearApplicationListForContainer(const std::string& vm_name, + const std::string& container_name); // The existing list of apps is replaced by |application_list|. void UpdateApplicationList(const vm_tools::apps::ApplicationList& app_list);
diff --git a/chrome/browser/chromeos/crostini/crostini_registry_service_unittest.cc b/chrome/browser/chromeos/crostini/crostini_registry_service_unittest.cc index be93fe8..a6b1cbb 100644 --- a/chrome/browser/chromeos/crostini/crostini_registry_service_unittest.cc +++ b/chrome/browser/chromeos/crostini/crostini_registry_service_unittest.cc
@@ -309,7 +309,7 @@ testing::UnorderedElementsAre(app_id_1, app_id_2, app_id_3, app_id_4, kCrostiniTerminalId)); - service()->ClearApplicationList("vm 2"); + service()->ClearApplicationList("vm 2", ""); EXPECT_THAT( service()->GetRegisteredAppIds(),
diff --git a/chrome/browser/chromeos/crostini/crostini_remover.cc b/chrome/browser/chromeos/crostini/crostini_remover.cc index 8f41942..7664142 100644 --- a/chrome/browser/chromeos/crostini/crostini_remover.cc +++ b/chrome/browser/chromeos/crostini/crostini_remover.cc
@@ -70,9 +70,9 @@ } CrostiniRegistryServiceFactory::GetForProfile(profile_)->ClearApplicationList( - vm_name_); + vm_name_, ""); CrostiniMimeTypesServiceFactory::GetForProfile(profile_)->ClearMimeTypes( - vm_name_); + vm_name_, ""); CrostiniManager::GetForProfile(profile_)->DestroyDiskImage( base::FilePath(vm_name_), vm_tools::concierge::StorageLocation::STORAGE_CRYPTOHOME_ROOT,
diff --git a/chrome/browser/chromeos/crostini/crostini_util.cc b/chrome/browser/chromeos/crostini/crostini_util.cc index 8db37b44..0c09058 100644 --- a/chrome/browser/chromeos/crostini/crostini_util.cc +++ b/chrome/browser/chromeos/crostini/crostini_util.cc
@@ -17,6 +17,8 @@ #include "base/timer/timer.h" #include "chrome/browser/chromeos/crostini/crostini_app_launch_observer.h" #include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/chromeos/crostini/crostini_mime_types_service.h" +#include "chrome/browser/chromeos/crostini/crostini_mime_types_service_factory.h" #include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_registry_service.h" #include "chrome/browser/chromeos/crostini/crostini_registry_service_factory.h" @@ -422,11 +424,33 @@ auto* pref_service = profile->GetPrefs(); base::Value new_container(base::Value::Type::DICTIONARY); - new_container.SetKey("vm_name", base::Value(vm_name)); - new_container.SetKey("container_name", base::Value(container_name)); + new_container.SetKey(prefs::kVmKey, base::Value(vm_name)); + new_container.SetKey(prefs::kContainerKey, base::Value(container_name)); ListPrefUpdate updater(pref_service, crostini::prefs::kCrostiniContainers); updater->GetList().emplace_back(std::move(new_container)); } +void RemoveLxdContainerFromPrefs(Profile* profile, + std::string vm_name, + std::string container_name) { + auto* pref_service = profile->GetPrefs(); + ListPrefUpdate updater(pref_service, crostini::prefs::kCrostiniContainers); + + for (auto it = updater->GetList().begin(); it != updater->GetList().end(); + it++) { + auto* vm_name_test = it->FindKey(prefs::kVmKey); + auto* container_name_test = it->FindKey(prefs::kContainerKey); + if (vm_name_test->GetString() == vm_name && + container_name_test->GetString() == container_name) { + updater->GetList().erase(it); + break; + } + } + CrostiniRegistryServiceFactory::GetForProfile(profile)->ClearApplicationList( + vm_name, container_name); + CrostiniMimeTypesServiceFactory::GetForProfile(profile)->ClearMimeTypes( + vm_name, container_name); +} + } // namespace crostini
diff --git a/chrome/browser/chromeos/crostini/crostini_util.h b/chrome/browser/chromeos/crostini/crostini_util.h index 9c72276c..ef33dd6 100644 --- a/chrome/browser/chromeos/crostini/crostini_util.h +++ b/chrome/browser/chromeos/crostini/crostini_util.h
@@ -151,6 +151,12 @@ std::string vm_name, std::string container_name); +// Remove a newly deleted LXD container from the kCrostiniContainers pref, and +// deregister its apps and mime types. +void RemoveLxdContainerFromPrefs(Profile* profile, + std::string vm_name, + std::string container_name); + } // namespace crostini #endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_UTIL_H_
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc index f56ec2690..665e83e 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
@@ -510,6 +510,7 @@ TestCase("openQuickViewAndroid"), TestCase("openQuickViewCrostini"), TestCase("openQuickViewUsb"), + TestCase("openQuickViewRemovablePartitions"), TestCase("openQuickViewMtp"), TestCase("pressEnterOnInfoBoxToOpenClose"), TestCase("closeQuickView"),
diff --git a/chrome/browser/chromeos/login/chrome_restart_request.cc b/chrome/browser/chromeos/login/chrome_restart_request.cc index 0be55f4..90152c59b 100644 --- a/chrome/browser/chromeos/login/chrome_restart_request.cc +++ b/chrome/browser/chromeos/login/chrome_restart_request.cc
@@ -89,7 +89,6 @@ ::switches::kDisableAcceleratedVideoDecode, ::switches::kDisableAcceleratedVideoEncode, ::switches::kDisableBlinkFeatures, - ::switches::kDisableCastStreamingHWEncoding, ::switches::kDisableGpu, ::switches::kDisableGpuMemoryBufferVideoFrames, ::switches::kDisableGpuShaderDiskCache,
diff --git a/chrome/browser/chromeos/login/demo_mode/demo_session.cc b/chrome/browser/chromeos/login/demo_mode/demo_session.cc index 5506594..c958497 100644 --- a/chrome/browser/chromeos/login/demo_mode/demo_session.cc +++ b/chrome/browser/chromeos/login/demo_mode/demo_session.cc
@@ -14,6 +14,7 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/logging.h" +#include "base/metrics/histogram_macros.h" #include "base/optional.h" #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" @@ -340,6 +341,12 @@ demo_resources_->EnsureLoaded(std::move(load_callback)); } +// static +void DemoSession::RecordAppLaunchSourceIfInDemoMode(AppLaunchSource source) { + if (IsDeviceInDemoMode()) + UMA_HISTOGRAM_ENUMERATION("DemoMode.AppLaunchSource", source); +} + bool DemoSession::ShouldIgnorePinPolicy(const std::string& app_id_or_package) { if (!g_demo_session || !g_demo_session->started()) return false;
diff --git a/chrome/browser/chromeos/login/demo_mode/demo_session.h b/chrome/browser/chromeos/login/demo_mode/demo_session.h index f96866f..91f55a9 100644 --- a/chrome/browser/chromeos/login/demo_mode/demo_session.h +++ b/chrome/browser/chromeos/login/demo_mode/demo_session.h
@@ -50,6 +50,22 @@ kLast = kOffline, }; + // Indicates the source of an app launch when in Demo mode for UMA + // stat reporting purposes. Because they are used for a UMA stat, + // these values should not be changed or moved. + enum class AppLaunchSource { + // Logged when apps are launched from the Shelf in Demo Mode. + kShelf = 0, + // Logged when apps are launched from the App List in Demo Mode. + kAppList = 1, + // Logged by any Extension APIs used by the Highlights App to launch apps in + // Demo Mode. + kExtensionApi = 2, + // Add future entries above this comment, in sync with enums.xml. + // Update kMaxValue to the last value. + kMaxValue = kExtensionApi + }; + static std::string DemoConfigToString(DemoModeConfig config); // Whether the device is set up to run demo sessions. @@ -91,6 +107,9 @@ static void RegisterLocalStatePrefs(PrefRegistrySimple* registry); + // Records the launch of an app in Demo mode from the specified source. + static void RecordAppLaunchSourceIfInDemoMode(AppLaunchSource source); + // Ensures that the load of offline demo session resources is requested. // |load_callback| will be run once the offline resource load finishes. void EnsureOfflineResourcesLoaded(base::OnceClosure load_callback);
diff --git a/chrome/browser/chromeos/tether/tether_service_unittest.cc b/chrome/browser/chromeos/tether/tether_service_unittest.cc index b31afc6..e0655e2 100644 --- a/chrome/browser/chromeos/tether/tether_service_unittest.cc +++ b/chrome/browser/chromeos/tether/tether_service_unittest.cc
@@ -29,14 +29,16 @@ #include "chromeos/components/tether/tether_host_fetcher_impl.h" #include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_switches.h" +#include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/fake_power_manager_client.h" #include "chromeos/dbus/power_manager/suspend.pb.h" #include "chromeos/dbus/power_manager_client.h" #include "chromeos/dbus/shill_device_client.h" +#include "chromeos/dbus/shill_manager_client.h" +#include "chromeos/dbus/shill_service_client.h" #include "chromeos/network/network_connect.h" #include "chromeos/network/network_handler.h" #include "chromeos/network/network_state_handler.h" -#include "chromeos/network/network_state_test_helper.h" #include "chromeos/network/network_type_pattern.h" #include "chromeos/services/device_sync/cryptauth_device_manager.h" #include "chromeos/services/device_sync/cryptauth_enroller.h" @@ -326,10 +328,12 @@ fake_notification_presenter_ = nullptr; mock_timer_ = nullptr; - network_state_test_helper_ = - std::make_unique<chromeos::NetworkStateTestHelper>( - false /* use_default_devices_and_services */); + chromeos::DBusThreadManager::Initialize(); + manager_test_ = chromeos::DBusThreadManager::Get() + ->GetShillManagerClient() + ->GetTestInterface(); + chromeos::NetworkHandler::Initialize(); chromeos::NetworkConnect::Initialize(nullptr); TestingProfile::Builder builder; @@ -415,8 +419,8 @@ ShutdownTetherService(); if (tether_service_) { - // As of crbug.com/798605, SHUT_DOWN should not be logged since it does not - // contribute meaningful data. + // As of crbug.com/798605, SHUT_DOWN should not be logged since it does + // not contribute meaningful data. histogram_tester_.ExpectBucketCount( "InstantTethering.FeatureState", TetherService::TetherFeatureState::SHUT_DOWN, 0 /* count */); @@ -427,7 +431,8 @@ shutdown_reason_verified_); chromeos::NetworkConnect::Shutdown(); - network_state_test_helper_.reset(); + chromeos::NetworkHandler::Shutdown(); + chromeos::DBusThreadManager::Shutdown(); } void SetPrimaryUserLoggedIn() { @@ -508,17 +513,19 @@ bool IsBluetoothPowered() { return is_adapter_powered_; } void RemoveWifiFromSystem() { - network_state_test_helper_->manager_test()->RemoveTechnology( - shill::kTypeWifi); + manager_test_->RemoveTechnology(shill::kTypeWifi); base::RunLoop().RunUntilIdle(); } void DisconnectDefaultShillNetworks() { const chromeos::NetworkState* default_state; while ((default_state = network_state_handler()->DefaultNetwork())) { - network_state_test_helper_->SetServiceProperty( - default_state->path(), shill::kStateProperty, - base::Value(shill::kStateIdle)); + chromeos::DBusThreadManager::Get() + ->GetShillServiceClient() + ->GetTestInterface() + ->SetServiceProperty(default_state->path(), shill::kStateProperty, + base::Value(shill::kStateIdle)); + base::RunLoop().RunUntilIdle(); } } @@ -544,18 +551,17 @@ shutdown_reason_verified_ = true; } - chromeos::NetworkStateTestHelper& network_state_test_helper() { - return *network_state_test_helper_.get(); + chromeos::ShillManagerClient::TestInterface* manager_test() { + return manager_test_; } chromeos::NetworkStateHandler* network_state_handler() { - return network_state_test_helper_->network_state_handler(); + return chromeos::NetworkHandler::Get()->network_state_handler(); } const chromeos::multidevice::RemoteDeviceRefList test_devices_; const content::TestBrowserThreadBundle thread_bundle_; - std::unique_ptr<chromeos::NetworkStateTestHelper> network_state_test_helper_; std::unique_ptr<TestingProfile> profile_; chromeos::FakeChromeUserManager* fake_chrome_user_manager_; std::unique_ptr<user_manager::ScopedUserManager> scoped_user_manager_; @@ -598,6 +604,8 @@ base::HistogramTester histogram_tester_; + chromeos::ShillManagerClient::TestInterface* manager_test_ = nullptr; + private: DISALLOW_COPY_AND_ASSIGN(TetherServiceTest); }; @@ -1154,8 +1162,7 @@ // TODO(https://crbug.com/893878): Fix disabled test. TEST_F(TetherServiceTest, DISABLED_TestCellularIsUnavailable) { - network_state_test_helper().manager_test()->RemoveTechnology( - shill::kTypeCellular); + manager_test()->RemoveTechnology(shill::kTypeCellular); ASSERT_EQ( chromeos::NetworkStateHandler::TechnologyState::TECHNOLOGY_UNAVAILABLE, network_state_handler()->GetTechnologyState( @@ -1186,10 +1193,8 @@ TEST_F(TetherServiceTest, DISABLED_TestCellularIsAvailable) { // TODO (lesliewatkins): Investigate why cellular needs to be removed and // re-added for NetworkStateHandler to return the correct TechnologyState. - network_state_test_helper().manager_test()->RemoveTechnology( - shill::kTypeCellular); - network_state_test_helper().manager_test()->AddTechnology( - shill::kTypeCellular, false); + manager_test()->RemoveTechnology(shill::kTypeCellular); + manager_test()->AddTechnology(shill::kTypeCellular, false); CreateTetherService();
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index 27d64b1c..9f157580 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn
@@ -302,10 +302,14 @@ "api/resources_private/resources_private_api.h", "api/runtime/chrome_runtime_api_delegate.cc", "api/runtime/chrome_runtime_api_delegate.h", + "api/safe_browsing_private/safe_browsing_private_api.cc", + "api/safe_browsing_private/safe_browsing_private_api.h", "api/safe_browsing_private/safe_browsing_private_event_router.cc", "api/safe_browsing_private/safe_browsing_private_event_router.h", "api/safe_browsing_private/safe_browsing_private_event_router_factory.cc", "api/safe_browsing_private/safe_browsing_private_event_router_factory.h", + "api/safe_browsing_private/safe_browsing_util.cc", + "api/safe_browsing_private/safe_browsing_util.h", "api/sessions/session_id.cc", "api/sessions/session_id.h", "api/sessions/sessions_api.cc", @@ -960,6 +964,7 @@ } deps += [ "//ash/public/cpp", + "//chrome/browser/resources/chromeos/camera:chrome_camera_app", "//chromeos/attestation", "//chromeos/components/proximity_auth", "//chromeos/cryptohome",
diff --git a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc index e3dd038..883ce717 100644 --- a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc +++ b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc
@@ -39,6 +39,10 @@ #include "extensions/common/extension.h" #include "services/data_decoder/public/cpp/safe_json_parser.h" +#if defined(OS_CHROMEOS) +#include "chrome/browser/chromeos/login/demo_mode/demo_session.h" +#endif + namespace { class ManagementSetEnabledFunctionInstallPromptDelegate @@ -195,6 +199,12 @@ extension, launch_container, WindowOpenDisposition::NEW_FOREGROUND_TAB, extensions::SOURCE_MANAGEMENT_API)); + +#if defined(OS_CHROMEOS) + chromeos::DemoSession::RecordAppLaunchSourceIfInDemoMode( + chromeos::DemoSession::AppLaunchSource::kExtensionApi); +#endif + extensions::RecordAppLaunchType(extension_misc::APP_LAUNCH_EXTENSION_API, extension->GetType()); }
diff --git a/chrome/browser/extensions/api/management/management_api_browsertest.cc b/chrome/browser/extensions/api/management/management_api_browsertest.cc index 63f3124ab..c06d409 100644 --- a/chrome/browser/extensions/api/management/management_api_browsertest.cc +++ b/chrome/browser/extensions/api/management/management_api_browsertest.cc
@@ -8,6 +8,7 @@ #include "base/strings/pattern.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" +#include "base/test/metrics/histogram_tester.h" #include "build/build_config.h" #include "chrome/browser/extensions/extension_browsertest.h" #include "chrome/browser/extensions/extension_function_test_utils.h" @@ -30,6 +31,10 @@ #include "extensions/common/extension_builder.h" #include "extensions/test/extension_test_message_listener.h" +#if defined(OS_CHROMEOS) +#include "chrome/browser/chromeos/login/demo_mode/demo_session.h" +#endif + namespace keys = extension_management_api_constants; namespace util = extension_function_test_utils; @@ -78,6 +83,52 @@ ASSERT_TRUE(listener2.WaitUntilSatisfied()); } +#if defined(OS_CHROMEOS) + +IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, + NoDemoModeAppLaunchSourceReported) { + EXPECT_FALSE(chromeos::DemoSession::IsDeviceInDemoMode()); + + base::HistogramTester histogram_tester; + // Should see 0 apps launched from the API in the histogram at first. + histogram_tester.ExpectTotalCount("DemoMode.AppLaunchSource", 0); + + ExtensionTestMessageListener app_launched_listener("app_launched", false); + ASSERT_TRUE( + LoadExtension(test_data_dir_.AppendASCII("management/packaged_app"))); + ASSERT_TRUE( + LoadExtension(test_data_dir_.AppendASCII("management/launch_app"))); + ASSERT_TRUE(app_launched_listener.WaitUntilSatisfied()); + + // Should still see 0 apps launched from the API in the histogram. + histogram_tester.ExpectTotalCount("DemoMode.AppLaunchSource", 0); +} + +IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, + DemoModeAppLaunchSourceReported) { + chromeos::DemoSession::SetDemoConfigForTesting( + chromeos::DemoSession::DemoModeConfig::kOnline); + EXPECT_TRUE(chromeos::DemoSession::IsDeviceInDemoMode()); + + base::HistogramTester histogram_tester; + // Should see 0 apps launched from the Launcher in the histogram at first. + histogram_tester.ExpectTotalCount("DemoMode.AppLaunchSource", 0); + + ExtensionTestMessageListener app_launched_listener("app_launched", false); + ASSERT_TRUE( + LoadExtension(test_data_dir_.AppendASCII("management/packaged_app"))); + ASSERT_TRUE( + LoadExtension(test_data_dir_.AppendASCII("management/launch_app"))); + ASSERT_TRUE(app_launched_listener.WaitUntilSatisfied()); + + // Should see 1 app launched from the highlights app in the histogram. + histogram_tester.ExpectUniqueSample( + "DemoMode.AppLaunchSource", + chromeos::DemoSession::AppLaunchSource::kExtensionApi, 1); +} + +#endif + IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, LaunchAppFromBackground) { ExtensionTestMessageListener listener1("success", false);
diff --git a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api.cc b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api.cc new file mode 100644 index 0000000..f51e118 --- /dev/null +++ b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api.cc
@@ -0,0 +1,92 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api.h" + +#include <memory> +#include <utility> + +#include "chrome/browser/browser_process.h" +#include "chrome/browser/extensions/api/safe_browsing_private/safe_browsing_util.h" +#include "chrome/browser/extensions/extension_tab_util.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h" +#include "chrome/browser/safe_browsing/safe_browsing_service.h" +#include "chrome/common/extensions/api/safe_browsing_private.h" +#include "content/public/browser/web_contents.h" +#include "extensions/browser/extension_function.h" + +using safe_browsing::SafeBrowsingNavigationObserverManager; + +namespace extensions { + +namespace GetReferrerChain = api::safe_browsing_private::GetReferrerChain; + +namespace { + +// The number of user gestures we trace back for the referrer chain. +const int kReferrerUserGestureLimit = 2; + +} // namespace + +//////////////////////////////////////////////////////////////////////////////// +// SafeBrowsingPrivateGetReferrerChainFunction + +SafeBrowsingPrivateGetReferrerChainFunction:: + SafeBrowsingPrivateGetReferrerChainFunction() {} + +SafeBrowsingPrivateGetReferrerChainFunction:: + ~SafeBrowsingPrivateGetReferrerChainFunction() {} + +ExtensionFunction::ResponseAction +SafeBrowsingPrivateGetReferrerChainFunction::Run() { + std::unique_ptr<GetReferrerChain::Params> params = + GetReferrerChain::Params::Create(*args_); + EXTENSION_FUNCTION_VALIDATE(params.get()); + + content::WebContents* contents = nullptr; + + if (!ExtensionTabUtil::GetTabById(params->tab_id, browser_context(), + include_incognito_information(), nullptr, + nullptr, &contents, nullptr)) { + return RespondNow(Error( + base::StringPrintf("Could not find tab with id %d.", params->tab_id))); + } + + Profile* profile = Profile::FromBrowserContext(browser_context()); + if (!SafeBrowsingNavigationObserverManager::IsEnabledAndReady(profile)) + return RespondNow(NoArguments()); + + scoped_refptr<SafeBrowsingNavigationObserverManager> + navigation_observer_manager = g_browser_process->safe_browsing_service() + ->navigation_observer_manager(); + + safe_browsing::ReferrerChain referrer_chain; + SafeBrowsingNavigationObserverManager::AttributionResult result = + navigation_observer_manager->IdentifyReferrerChainByWebContents( + contents, kReferrerUserGestureLimit, &referrer_chain); + + // If the referrer chain is incomplete we'll append the most recent + // navigations to referrer chain for diagnostic purposes. This only happens if + // the user is not in incognito mode and has opted into extended reporting or + // Scout reporting. Otherwise, |CountOfRecentNavigationsToAppend| returns 0. + int recent_navigations_to_collect = + SafeBrowsingNavigationObserverManager::CountOfRecentNavigationsToAppend( + *profile, result); + if (recent_navigations_to_collect > 0) { + navigation_observer_manager->AppendRecentNavigations( + recent_navigations_to_collect, &referrer_chain); + } + + std::vector<api::safe_browsing_private::ReferrerChainEntry> referrer_entries; + referrer_entries.reserve(referrer_chain.size()); + for (const auto& entry : referrer_chain) { + referrer_entries.emplace_back( + safe_browsing_util::ReferrerToReferrerChainEntry(entry)); + } + return RespondNow( + ArgumentList(GetReferrerChain::Results::Create(referrer_entries))); +} + +} // namespace extensions
diff --git a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api.h b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api.h new file mode 100644 index 0000000..d28ce05 --- /dev/null +++ b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api.h
@@ -0,0 +1,31 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_EXTENSIONS_API_SAFE_BROWSING_PRIVATE_SAFE_BROWSING_PRIVATE_API_H_ +#define CHROME_BROWSER_EXTENSIONS_API_SAFE_BROWSING_PRIVATE_SAFE_BROWSING_PRIVATE_API_H_ + +#include "extensions/browser/extension_function.h" + +namespace extensions { + +class SafeBrowsingPrivateGetReferrerChainFunction + : public UIThreadExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("safeBrowsingPrivate.getReferrerChain", + SAFEBROWSINGPRIVATE_GETREFERRERCHAIN) + + SafeBrowsingPrivateGetReferrerChainFunction(); + + protected: + ~SafeBrowsingPrivateGetReferrerChainFunction() override; + + // ExtensionFunction: + ResponseAction Run() override; + + DISALLOW_COPY_AND_ASSIGN(SafeBrowsingPrivateGetReferrerChainFunction); +}; + +} // namespace extensions + +#endif // CHROME_BROWSER_EXTENSIONS_API_SAFE_BROWSING_PRIVATE_SAFE_BROWSING_PRIVATE_API_H_
diff --git a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api_unittest.cc b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api_unittest.cc new file mode 100644 index 0000000..3c29f4d --- /dev/null +++ b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api_unittest.cc
@@ -0,0 +1,164 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api.h" + +#include <memory> +#include <string> +#include <utility> +#include <vector> + +#include "base/task/post_task.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/extensions/extension_function_test_utils.h" +#include "chrome/browser/extensions/extension_service_test_base.h" +#include "chrome/browser/extensions/extension_tab_util.h" +#include "chrome/browser/safe_browsing/test_safe_browsing_service.h" +#include "chrome/browser/sessions/session_tab_helper.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/test/base/test_browser_window.h" +#include "chrome/test/base/testing_browser_process.h" +#include "content/public/browser/browser_task_traits.h" +#include "content/public/browser/navigation_entry.h" +#include "content/public/test/browser_side_navigation_test_utils.h" +#include "content/public/test/test_browser_thread_bundle.h" +#include "content/public/test/web_contents_tester.h" +#include "net/url_request/url_request_context_getter.h" +#include "net/url_request/url_request_test_util.h" + +namespace extensions { + +namespace { + +std::unique_ptr<base::Value> RunGetReferrerChainFunction(Browser* browser, + int tab_id) { + scoped_refptr<SafeBrowsingPrivateGetReferrerChainFunction> function( + base::MakeRefCounted<SafeBrowsingPrivateGetReferrerChainFunction>()); + std::unique_ptr<base::Value> value( + extension_function_test_utils::RunFunctionAndReturnSingleResult( + function.get(), "[" + std::to_string(tab_id) + "]", browser)); + return value; +} + +// Creates WebContents with |urls| as history. +std::unique_ptr<content::WebContents> CreateWebContentsWithHistory( + Profile* profile, + const std::vector<GURL>& urls) { + std::unique_ptr<content::WebContents> web_contents = + content::WebContentsTester::CreateTestWebContents(profile, nullptr); + + for (const auto& url : urls) { + web_contents->GetController().LoadURL( + url, content::Referrer(), + ui::PageTransitionFromInt(ui::PAGE_TRANSITION_LINK), std::string()); + + content::RenderFrameHostTester::CommitPendingLoad( + &web_contents->GetController()); + EXPECT_EQ(url, web_contents->GetLastCommittedURL()); + EXPECT_EQ(url, web_contents->GetVisibleURL()); + } + + return web_contents; +} + +} // namespace + +class SafeBrowsingPrivateApiUnitTest : public ExtensionServiceTestBase { + protected: + SafeBrowsingPrivateApiUnitTest() {} + ~SafeBrowsingPrivateApiUnitTest() override {} + + Browser* browser() { return browser_.get(); } + + private: + void SetUp() override; + void TearDown() override; + + std::unique_ptr<TestBrowserWindow> browser_window_; + std::unique_ptr<Browser> browser_; + scoped_refptr<net::URLRequestContextGetter> system_request_context_getter_; + + DISALLOW_COPY_AND_ASSIGN(SafeBrowsingPrivateApiUnitTest); +}; + +void SafeBrowsingPrivateApiUnitTest::SetUp() { + ExtensionServiceTestBase::SetUp(); + InitializeEmptyExtensionService(); + content::BrowserSideNavigationSetUp(); + + browser_window_ = std::make_unique<TestBrowserWindow>(); + Browser::CreateParams params(profile(), true); + params.type = Browser::TYPE_TABBED; + params.window = browser_window_.get(); + browser_ = std::make_unique<Browser>(params); + + // Initialize Safe Browsing service. + safe_browsing::TestSafeBrowsingServiceFactory sb_service_factory; + auto* safe_browsing_service = sb_service_factory.CreateSafeBrowsingService(); + system_request_context_getter_ = + base::MakeRefCounted<net::TestURLRequestContextGetter>( + base::CreateSingleThreadTaskRunnerWithTraits( + {content::BrowserThread::IO})); + TestingBrowserProcess::GetGlobal()->SetSystemRequestContext( + system_request_context_getter_.get()); + TestingBrowserProcess::GetGlobal()->SetSafeBrowsingService( + safe_browsing_service); + g_browser_process->safe_browsing_service()->Initialize(); + safe_browsing_service->AddPrefService(profile()->GetPrefs()); +} + +void SafeBrowsingPrivateApiUnitTest::TearDown() { + while (!browser()->tab_strip_model()->empty()) + browser()->tab_strip_model()->DetachWebContentsAt(0); + browser_window_.reset(); + content::BrowserSideNavigationTearDown(); + ExtensionServiceTestBase::TearDown(); +} + +// Tests that chrome.safeBrowsingPrivate.getReferrerChain returns a result. +// Actual contents tested with util unit test. +// TODO(livvielin): Look into simulating navigation event so that we can test +// the size of the result. +TEST_F(SafeBrowsingPrivateApiUnitTest, GetReferrerChain) { + const std::vector<GURL> urls = {GURL("http://www.foo.test"), + GURL("http://www.bar.test")}; + std::unique_ptr<content::WebContents> web_contents = + CreateWebContentsWithHistory(profile(), urls); + content::WebContents* raw_web_contents = web_contents.get(); + ASSERT_TRUE(raw_web_contents); + + SessionTabHelper::CreateForWebContents(raw_web_contents); + int tab_id = SessionTabHelper::IdForTab(raw_web_contents).id(); + browser()->tab_strip_model()->AppendWebContents(std::move(web_contents), + true); + + std::unique_ptr<base::Value> referrer_chain( + RunGetReferrerChainFunction(browser(), tab_id)); + ASSERT_TRUE(referrer_chain); +} + +TEST_F(SafeBrowsingPrivateApiUnitTest, GetReferrerChainForNonSafeBrowsingUser) { + // Disable Safe Browsing. + browser()->profile()->GetPrefs()->SetBoolean(prefs::kSafeBrowsingEnabled, + false); + + const std::vector<GURL> urls = {GURL("http://www.foo.test"), + GURL("http://www.bar.test")}; + std::unique_ptr<content::WebContents> web_contents = + CreateWebContentsWithHistory(profile(), urls); + content::WebContents* raw_web_contents = web_contents.get(); + ASSERT_TRUE(raw_web_contents); + + SessionTabHelper::CreateForWebContents(raw_web_contents); + int tab_id = SessionTabHelper::IdForTab(raw_web_contents).id(); + browser()->tab_strip_model()->AppendWebContents(std::move(web_contents), + true); + + std::unique_ptr<base::Value> referrer_chain( + RunGetReferrerChainFunction(browser(), tab_id)); + ASSERT_FALSE(referrer_chain); +} + +} // namespace extensions
diff --git a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_util.cc b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_util.cc new file mode 100644 index 0000000..22375ab --- /dev/null +++ b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_util.cc
@@ -0,0 +1,117 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/extensions/api/safe_browsing_private/safe_browsing_util.h" + +#include <string> +#include <utility> + +#include "chrome/common/extensions/api/safe_browsing_private.h" + +namespace safe_browsing_private = extensions::api::safe_browsing_private; + +namespace extensions { + +namespace safe_browsing_util { + +safe_browsing_private::ReferrerChainEntry ReferrerToReferrerChainEntry( + const safe_browsing::ReferrerChainEntry& referrer) { + safe_browsing_private::ReferrerChainEntry entry; + // Add all referrer chain entry fields to the entry. + entry.url = referrer.url(); + if (referrer.has_main_frame_url()) { + entry.main_frame_url = + std::make_unique<std::string>(referrer.main_frame_url()); + } + // This url type value is deprecated and should not be used. + DCHECK_NE( + referrer.type(), + safe_browsing::ReferrerChainEntry_URLType_DEPRECATED_SERVER_REDIRECT); + switch (referrer.type()) { + case safe_browsing::ReferrerChainEntry_URLType_EVENT_URL: + entry.url_type = safe_browsing_private::URLType::URL_TYPE_EVENT_URL; + break; + case safe_browsing::ReferrerChainEntry_URLType_LANDING_PAGE: + entry.url_type = safe_browsing_private::URLType::URL_TYPE_LANDING_PAGE; + break; + case safe_browsing::ReferrerChainEntry_URLType_LANDING_REFERRER: + entry.url_type = + safe_browsing_private::URLType::URL_TYPE_LANDING_REFERRER; + break; + case safe_browsing::ReferrerChainEntry_URLType_CLIENT_REDIRECT: + entry.url_type = safe_browsing_private::URLType::URL_TYPE_CLIENT_REDIRECT; + break; + case safe_browsing::ReferrerChainEntry_URLType_RECENT_NAVIGATION: + entry.url_type = + safe_browsing_private::URLType::URL_TYPE_RECENT_NAVIGATION; + break; + case safe_browsing::ReferrerChainEntry_URLType_REFERRER: + entry.url_type = safe_browsing_private::URLType::URL_TYPE_REFERRER; + break; + case safe_browsing::ReferrerChainEntry_URLType_DEPRECATED_SERVER_REDIRECT: + NOTREACHED(); + } + if (referrer.ip_addresses_size() > 0) { + entry.ip_addresses = std::make_unique<std::vector<std::string>>(); + entry.ip_addresses->reserve(referrer.ip_addresses_size()); + for (const std::string& ip_address : referrer.ip_addresses()) + entry.ip_addresses->emplace_back(ip_address); + } + if (referrer.has_referrer_url()) { + entry.referrer_url = std::make_unique<std::string>(referrer.referrer_url()); + } + if (referrer.has_referrer_main_frame_url()) { + entry.referrer_main_frame_url = + std::make_unique<std::string>(referrer.referrer_main_frame_url()); + } + if (referrer.has_is_retargeting()) + entry.is_retargeting = std::make_unique<bool>(referrer.is_retargeting()); + if (referrer.has_navigation_time_msec()) { + entry.navigation_time_ms = + std::make_unique<double>(referrer.navigation_time_msec()); + } + if (referrer.server_redirect_chain_size() > 0) { + entry.server_redirect_chain = + std::make_unique<std::vector<safe_browsing_private::ServerRedirect>>(); + entry.server_redirect_chain->reserve(referrer.server_redirect_chain_size()); + for (const auto& server_redirect : referrer.server_redirect_chain()) { + safe_browsing_private::ServerRedirect result; + result.url = std::make_unique<std::string>(server_redirect.url()); + entry.server_redirect_chain->emplace_back(std::move(result)); + } + } + if (referrer.has_navigation_initiation()) { + DCHECK_NE(referrer.navigation_initiation(), + safe_browsing::ReferrerChainEntry_NavigationInitiation_UNDEFINED); + switch (referrer.navigation_initiation()) { + case safe_browsing:: + ReferrerChainEntry_NavigationInitiation_BROWSER_INITIATED: + entry.navigation_initiation = + safe_browsing_private::NAVIGATION_INITIATION_BROWSER_INITIATED; + break; + case safe_browsing:: + ReferrerChainEntry_NavigationInitiation_RENDERER_INITIATED_WITHOUT_USER_GESTURE: + entry.navigation_initiation = safe_browsing_private:: + NAVIGATION_INITIATION_RENDERER_INITIATED_WITHOUT_USER_GESTURE; + break; + case safe_browsing:: + ReferrerChainEntry_NavigationInitiation_RENDERER_INITIATED_WITH_USER_GESTURE: + entry.navigation_initiation = safe_browsing_private:: + NAVIGATION_INITIATION_RENDERER_INITIATED_WITH_USER_GESTURE; + break; + case safe_browsing::ReferrerChainEntry_NavigationInitiation_UNDEFINED: + NOTREACHED(); + } + } + if (referrer.has_maybe_launched_by_external_application()) { + entry.maybe_launched_by_external_app = std::make_unique<bool>( + referrer.maybe_launched_by_external_application()); + } + + return entry; +} + +} // namespace safe_browsing_util + +} // namespace extensions
diff --git a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_util.h b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_util.h new file mode 100644 index 0000000..35a46ad --- /dev/null +++ b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_util.h
@@ -0,0 +1,25 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_EXTENSIONS_API_SAFE_BROWSING_PRIVATE_SAFE_BROWSING_UTIL_H_ +#define CHROME_BROWSER_EXTENSIONS_API_SAFE_BROWSING_PRIVATE_SAFE_BROWSING_UTIL_H_ + +#include <vector> + +#include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h" +#include "chrome/common/extensions/api/safe_browsing_private.h" + +namespace extensions { + +namespace safe_browsing_util { + +// Convert referrer to proper format. +api::safe_browsing_private::ReferrerChainEntry ReferrerToReferrerChainEntry( + const safe_browsing::ReferrerChainEntry& referrer); + +} // namespace safe_browsing_util + +} // namespace extensions + +#endif // CHROME_BROWSER_EXTENSIONS_API_SAFE_BROWSING_PRIVATE_SAFE_BROWSING_UTIL_H_
diff --git a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_util_unittest.cc b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_util_unittest.cc new file mode 100644 index 0000000..bb88888 --- /dev/null +++ b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_util_unittest.cc
@@ -0,0 +1,72 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/extensions/api/safe_browsing_private/safe_browsing_util.h" + +#include <string> + +#include "chrome/common/extensions/api/safe_browsing_private.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace safe_browsing_private = extensions::api::safe_browsing_private; + +namespace extensions { + +namespace { + +const char kMainFrameUrl[] = "https://www.example.com/info"; +const char kIpAddress[] = "localhost"; +const char kReferrerUrl[] = "https://www.example.com"; +const bool kIsRetargeting = false; +const double kNavTime = 12345; +const char kServerRedirectUrl[] = "https://example.com/redirect"; +const bool kMaybeLaunched = false; + +void InitializeFakeReferrerChainEntry( + std::string url, + safe_browsing::ReferrerChainEntry* referrer) { + referrer->set_url(url); + referrer->set_main_frame_url(kMainFrameUrl); + referrer->set_type(safe_browsing::ReferrerChainEntry_URLType_LANDING_PAGE); + referrer->add_ip_addresses(kIpAddress); + referrer->set_referrer_url(kReferrerUrl); + referrer->set_is_retargeting(kIsRetargeting); + referrer->set_navigation_time_msec(kNavTime); + safe_browsing::ReferrerChainEntry_ServerRedirect* server_redirect = + referrer->add_server_redirect_chain(); + server_redirect->set_url(kServerRedirectUrl); + referrer->set_navigation_initiation( + safe_browsing::ReferrerChainEntry_NavigationInitiation_BROWSER_INITIATED); + referrer->set_maybe_launched_by_external_application(kMaybeLaunched); +} + +void ValidateReferrerChain( + const safe_browsing_private::ReferrerChainEntry& referrer) { + ASSERT_FALSE(referrer.url.empty()); + EXPECT_EQ(*referrer.main_frame_url, kMainFrameUrl); + EXPECT_EQ(referrer.url_type, + safe_browsing_private::URLType::URL_TYPE_LANDING_PAGE); + EXPECT_EQ(referrer.ip_addresses->at(0), kIpAddress); + EXPECT_EQ(*referrer.referrer_url, kReferrerUrl); + EXPECT_EQ(*referrer.is_retargeting, kIsRetargeting); + EXPECT_EQ(*referrer.navigation_time_ms, kNavTime); + EXPECT_EQ(*referrer.server_redirect_chain->at(0).url, kServerRedirectUrl); + EXPECT_EQ(referrer.navigation_initiation, + safe_browsing_private::NAVIGATION_INITIATION_BROWSER_INITIATED); + EXPECT_EQ(*referrer.maybe_launched_by_external_app, kMaybeLaunched); +} + +} // namespace + +// Tests that we correctly convert referrer chain entries from proto to idl. +TEST(SafeBrowsingUtilUnitTest, ReferrerToReferrerChainEntry) { + safe_browsing::ReferrerChainEntry entry; + InitializeFakeReferrerChainEntry("https://foo.com", &entry); + safe_browsing_private::ReferrerChainEntry landing_referrer_result = + safe_browsing_util::ReferrerToReferrerChainEntry(entry); + ValidateReferrerChain(landing_referrer_result); + EXPECT_EQ(landing_referrer_result.url, "https://foo.com"); +} + +} // namespace extensions
diff --git a/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc b/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc index 274405b..46aa36bb 100644 --- a/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc +++ b/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc
@@ -36,6 +36,7 @@ extension_misc::kSelectToSpeakExtensionId, extension_misc::kSwitchAccessExtensionId, extension_misc::kZipArchiverExtensionId, + extension_misc::kChromeCameraAppId, #endif };
diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc index 29b9f2c..c991230a 100644 --- a/chrome/browser/extensions/component_loader.cc +++ b/chrome/browser/extensions/component_loader.cc
@@ -20,8 +20,8 @@ #include "chrome/browser/extensions/component_extensions_whitelist/whitelist.h" #include "chrome/browser/extensions/data_deleter.h" #include "chrome/browser/extensions/extension_service.h" +#include "chrome/browser/extensions/launch_util.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/common/buildflags.h" #include "chrome/common/channel_info.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" @@ -294,84 +294,18 @@ return false; } -void ComponentLoader::AddFileManagerExtension() { -#if defined(OS_CHROMEOS) - AddWithNameAndDescription( - IDR_FILEMANAGER_MANIFEST, - base::FilePath(FILE_PATH_LITERAL("file_manager")), - l10n_util::GetStringUTF8(IDS_FILEMANAGER_APP_NAME), - l10n_util::GetStringUTF8(IDS_FILEMANAGER_APP_DESCRIPTION)); -#endif // defined(OS_CHROMEOS) -} - -void ComponentLoader::AddVideoPlayerExtension() { -#if defined(OS_CHROMEOS) - Add(IDR_VIDEO_PLAYER_MANIFEST, - base::FilePath(FILE_PATH_LITERAL("video_player"))); -#endif // defined(OS_CHROMEOS) -} - -void ComponentLoader::AddAudioPlayerExtension() { -#if defined(OS_CHROMEOS) - Add(IDR_AUDIO_PLAYER_MANIFEST, - base::FilePath(FILE_PATH_LITERAL("audio_player"))); -#endif // defined(OS_CHROMEOS) -} - -void ComponentLoader::AddGalleryExtension() { -#if defined(OS_CHROMEOS) - Add(IDR_GALLERY_MANIFEST, base::FilePath(FILE_PATH_LITERAL("gallery"))); -#endif -} - -void ComponentLoader::AddZipArchiverExtension() { -#if defined(OS_CHROMEOS) && BUILDFLAG(ENABLE_NACL) - base::FilePath resources_path; - if (base::PathService::Get(chrome::DIR_RESOURCES, &resources_path)) { - AddWithNameAndDescriptionFromDir( - resources_path.Append(extension_misc::kZipArchiverExtensionPath), - extension_misc::kZipArchiverExtensionId, - l10n_util::GetStringUTF8(IDS_ZIP_ARCHIVER_NAME), - l10n_util::GetStringUTF8(IDS_ZIP_ARCHIVER_DESCRIPTION)); - } -#endif // defined(OS_CHROMEOS) && BUILDFLAG(ENABLE_NACL) -} - -void ComponentLoader::AddHangoutServicesExtension() { #if BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION) +void ComponentLoader::AddHangoutServicesExtension() { Add(IDR_HANGOUT_SERVICES_MANIFEST, base::FilePath(FILE_PATH_LITERAL("hangout_services"))); -#endif } - -void ComponentLoader::AddImageLoaderExtension() { -#if defined(OS_CHROMEOS) - Add(IDR_IMAGE_LOADER_MANIFEST, - base::FilePath(FILE_PATH_LITERAL("image_loader"))); -#endif // defined(OS_CHROMEOS) -} +#endif // BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION) void ComponentLoader::AddNetworkSpeechSynthesisExtension() { Add(IDR_NETWORK_SPEECH_SYNTHESIS_MANIFEST, base::FilePath(FILE_PATH_LITERAL("network_speech_synthesis"))); } -#if defined(OS_CHROMEOS) -void ComponentLoader::AddChromeOsSpeechSynthesisExtensions() { - AddComponentFromDir( - base::FilePath(extension_misc::kGoogleSpeechSynthesisExtensionPath), - extension_misc::kGoogleSpeechSynthesisExtensionId, - base::BindRepeating(&ComponentLoader::EnableFileSystemInGuestMode, - weak_factory_.GetWeakPtr(), - extension_misc::kGoogleSpeechSynthesisExtensionId)); - - AddComponentFromDir( - base::FilePath(extension_misc::kEspeakSpeechSynthesisExtensionPath), - extension_misc::kEspeakSpeechSynthesisExtensionId, - base::RepeatingClosure()); -} -#endif - void ComponentLoader::AddWithNameAndDescription( int manifest_resource_id, const base::FilePath& root_directory, @@ -397,20 +331,14 @@ } } -void ComponentLoader::AddChromeApp() { #if BUILDFLAG(ENABLE_APP_LIST) +void ComponentLoader::AddChromeApp() { AddWithNameAndDescription( IDR_CHROME_APP_MANIFEST, base::FilePath(FILE_PATH_LITERAL("chrome_app")), l10n_util::GetStringUTF8(IDS_SHORT_PRODUCT_NAME), l10n_util::GetStringUTF8(IDS_CHROME_SHORTCUT_DESCRIPTION)); -#endif } - -void ComponentLoader::AddKeyboardApp() { -#if defined(OS_CHROMEOS) - Add(IDR_KEYBOARD_MANIFEST, base::FilePath(FILE_PATH_LITERAL("keyboard"))); -#endif -} +#endif // BUILDFLAG(ENABLE_APP_LIST) void ComponentLoader::AddWebStoreApp() { #if defined(OS_CHROMEOS) @@ -424,6 +352,59 @@ l10n_util::GetStringUTF8(IDS_WEBSTORE_APP_DESCRIPTION)); } +#if defined(OS_CHROMEOS) +void ComponentLoader::AddFileManagerExtension() { + AddWithNameAndDescription( + IDR_FILEMANAGER_MANIFEST, + base::FilePath(FILE_PATH_LITERAL("file_manager")), + l10n_util::GetStringUTF8(IDS_FILEMANAGER_APP_NAME), + l10n_util::GetStringUTF8(IDS_FILEMANAGER_APP_DESCRIPTION)); +} + +void ComponentLoader::AddVideoPlayerExtension() { + Add(IDR_VIDEO_PLAYER_MANIFEST, + base::FilePath(FILE_PATH_LITERAL("video_player"))); +} + +void ComponentLoader::AddAudioPlayerExtension() { + Add(IDR_AUDIO_PLAYER_MANIFEST, + base::FilePath(FILE_PATH_LITERAL("audio_player"))); +} + +void ComponentLoader::AddGalleryExtension() { + Add(IDR_GALLERY_MANIFEST, base::FilePath(FILE_PATH_LITERAL("gallery"))); +} + +void ComponentLoader::AddImageLoaderExtension() { + Add(IDR_IMAGE_LOADER_MANIFEST, + base::FilePath(FILE_PATH_LITERAL("image_loader"))); +} + +void ComponentLoader::AddKeyboardApp() { + Add(IDR_KEYBOARD_MANIFEST, base::FilePath(FILE_PATH_LITERAL("keyboard"))); +} + +void ComponentLoader::AddChromeCameraApp() { + base::FilePath resources_path; + if (base::PathService::Get(chrome::DIR_RESOURCES, &resources_path)) { + AddComponentFromDir( + resources_path.Append(extension_misc::kChromeCameraAppPath), + extension_misc::kChromeCameraAppId, base::RepeatingClosure()); + } +} + +void ComponentLoader::AddZipArchiverExtension() { + base::FilePath resources_path; + if (base::PathService::Get(chrome::DIR_RESOURCES, &resources_path)) { + AddWithNameAndDescriptionFromDir( + resources_path.Append(extension_misc::kZipArchiverExtensionPath), + extension_misc::kZipArchiverExtensionId, + l10n_util::GetStringUTF8(IDS_ZIP_ARCHIVER_NAME), + l10n_util::GetStringUTF8(IDS_ZIP_ARCHIVER_DESCRIPTION)); + } +} +#endif // defined(OS_CHROMEOS) + scoped_refptr<const Extension> ComponentLoader::CreateExtension( const ComponentExtensionInfo& info, std::string* utf8_error) { // TODO(abarth): We should REQUIRE_MODERN_MANIFEST_VERSION once we've updated @@ -462,6 +443,8 @@ Add(IDR_CROSH_BUILTIN_MANIFEST, base::FilePath(FILE_PATH_LITERAL( "/usr/share/chromeos-assets/crosh_builtin"))); } + + AddKeyboardApp(); #else // defined(OS_CHROMEOS) DCHECK(!skip_session_components); #if BUILDFLAG(ENABLE_PRINTING) @@ -473,11 +456,11 @@ if (!skip_session_components) { AddWebStoreApp(); +#if BUILDFLAG(ENABLE_APP_LIST) AddChromeApp(); +#endif // BUILDFLAG(ENABLE_APP_LIST) } - AddKeyboardApp(); - AddDefaultComponentExtensionsWithBackgroundPages(skip_session_components); #if BUILDFLAG(ENABLE_PDF) @@ -495,11 +478,13 @@ if (skip_session_components) return; +#if defined(OS_CHROMEOS) // Component extensions needed for kiosk apps. AddFileManagerExtension(); // Add virtual keyboard. AddKeyboardApp(); +#endif // defined(OS_CHROMEOS) AddDefaultComponentExtensionsWithBackgroundPagesForKioskMode(); @@ -535,15 +520,22 @@ #endif if (!skip_session_components) { +#if defined(OS_CHROMEOS) + AddChromeCameraApp(); AddVideoPlayerExtension(); AddAudioPlayerExtension(); AddFileManagerExtension(); AddGalleryExtension(); - AddZipArchiverExtension(); - - AddHangoutServicesExtension(); AddImageLoaderExtension(); +#if BUILDFLAG(ENABLE_NACL) + AddZipArchiverExtension(); +#endif // BUILDFLAG(ENABLE_NACL) +#endif // defined(OS_CHROMEOS) + +#if BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION) + AddHangoutServicesExtension(); +#endif // BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION) bool install_feedback = enable_background_extensions_during_testing; #if defined(GOOGLE_CHROME_BUILD) install_feedback = true; @@ -614,7 +606,9 @@ return; } +#if BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION) AddHangoutServicesExtension(); +#endif // BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION) } void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { @@ -624,25 +618,6 @@ } } -void ComponentLoader::EnableFileSystemInGuestMode(const std::string& id) { -#if defined(OS_CHROMEOS) - if (!IsNormalSession()) { - // TODO(dpolukhin): Hack to enable HTML5 temporary file system for - // the extension. Some component extensions don't work without temporary - // file system access. Make sure temporary file system is enabled in the off - // the record browser context (as that is the one used in guest session). - content::BrowserContext* off_the_record_context = - ExtensionsBrowserClient::Get()->GetOffTheRecordContext(profile_); - GURL site = content::SiteInstance::GetSiteForURL( - off_the_record_context, Extension::GetBaseURLFromExtensionId(id)); - storage::FileSystemContext* file_system_context = - content::BrowserContext::GetStoragePartitionForSite( - off_the_record_context, site)->GetFileSystemContext(); - file_system_context->EnableTemporaryFileSystemInIncognito(); - } -#endif -} - #if defined(OS_CHROMEOS) void ComponentLoader::AddComponentFromDir( const base::FilePath& root_directory, @@ -677,6 +652,38 @@ name_string, description_string, base::Closure())); } +void ComponentLoader::AddChromeOsSpeechSynthesisExtensions() { + AddComponentFromDir( + base::FilePath(extension_misc::kGoogleSpeechSynthesisExtensionPath), + extension_misc::kGoogleSpeechSynthesisExtensionId, + base::BindRepeating(&ComponentLoader::EnableFileSystemInGuestMode, + weak_factory_.GetWeakPtr(), + extension_misc::kGoogleSpeechSynthesisExtensionId)); + + AddComponentFromDir( + base::FilePath(extension_misc::kEspeakSpeechSynthesisExtensionPath), + extension_misc::kEspeakSpeechSynthesisExtensionId, + base::RepeatingClosure()); +} + +void ComponentLoader::EnableFileSystemInGuestMode(const std::string& id) { + if (!IsNormalSession()) { + // TODO(dpolukhin): Hack to enable HTML5 temporary file system for + // the extension. Some component extensions don't work without temporary + // file system access. Make sure temporary file system is enabled in the off + // the record browser context (as that is the one used in guest session). + content::BrowserContext* off_the_record_context = + ExtensionsBrowserClient::Get()->GetOffTheRecordContext(profile_); + GURL site = content::SiteInstance::GetSiteForURL( + off_the_record_context, Extension::GetBaseURLFromExtensionId(id)); + storage::FileSystemContext* file_system_context = + content::BrowserContext::GetStoragePartitionForSite( + off_the_record_context, site) + ->GetFileSystemContext(); + file_system_context->EnableTemporaryFileSystemInIncognito(); + } +} + void ComponentLoader::FinishAddComponentFromDir( const base::FilePath& root_directory, const char* extension_id,
diff --git a/chrome/browser/extensions/component_loader.h b/chrome/browser/extensions/component_loader.h index 8a78a56..332f7ec 100644 --- a/chrome/browser/extensions/component_loader.h +++ b/chrome/browser/extensions/component_loader.h
@@ -20,6 +20,7 @@ #include "base/optional.h" #include "base/values.h" #include "build/build_config.h" +#include "chrome/common/buildflags.h" class PrefService; class Profile; @@ -161,33 +162,44 @@ void AddDefaultComponentExtensionsWithBackgroundPages( bool skip_session_components); void AddDefaultComponentExtensionsWithBackgroundPagesForKioskMode(); - void AddFileManagerExtension(); - void AddVideoPlayerExtension(); - void AddAudioPlayerExtension(); - void AddGalleryExtension(); - void AddZipArchiverExtension(); + +#if BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION) void AddHangoutServicesExtension(); - void AddImageLoaderExtension(); +#endif // BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION) + void AddNetworkSpeechSynthesisExtension(); void AddWithNameAndDescription(int manifest_resource_id, const base::FilePath& root_directory, const std::string& name_string, const std::string& description_string); +#if BUILDFLAG(ENABLE_APP_LIST) void AddChromeApp(); - void AddKeyboardApp(); +#endif // BUILDFLAG(ENABLE_APP_LIST) + void AddWebStoreApp(); +#if defined(OS_CHROMEOS) + void AddFileManagerExtension(); + void AddVideoPlayerExtension(); + void AddAudioPlayerExtension(); + void AddGalleryExtension(); + void AddImageLoaderExtension(); + void AddKeyboardApp(); + void AddChromeCameraApp(); + void AddZipArchiverExtension(); +#endif // defined(OS_CHROMEOS) + scoped_refptr<const Extension> CreateExtension( const ComponentExtensionInfo& info, std::string* utf8_error); // Unloads |component| from the memory. void UnloadComponent(ComponentExtensionInfo* component); +#if defined(OS_CHROMEOS) // Enable HTML5 FileSystem for given component extension in Guest mode. void EnableFileSystemInGuestMode(const std::string& id); -#if defined(OS_CHROMEOS) // Used as a reply callback by |AddComponentFromDir|. // Called with a |root_directory| and parsed |manifest| and invokes // |done_cb| after adding the extension. @@ -198,7 +210,7 @@ const base::Optional<std::string>& description_string, const base::Closure& done_cb, std::unique_ptr<base::DictionaryValue> manifest); -#endif +#endif // defined(OS_CHROMEOS) PrefService* profile_prefs_; PrefService* local_state_;
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 3a921da2..478fd1cc 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -543,11 +543,6 @@ "expiry_milestone": 76 }, { - "name": "disable-cast-streaming-hw-encoding", - "owners": [ "miu" ], - "expiry_milestone": 76 - }, - { "name": "disable-cloud-import", // "owners": [ "your-team" ], "expiry_milestone": 76 @@ -1504,8 +1499,8 @@ }, { "name": "enable-ntp-button", - // "owners": [ "your-team" ], - "expiry_milestone": 76 + "owners": [ "twellington" ], + "expiry_milestone": 78 }, { "name": "enable-ntp-offline-page-download-suggestions", @@ -2587,6 +2582,11 @@ "expiry_milestone": 76 }, { + "name": "omnibox-reverse-tab-switch-logic", + "owners": [ "krb", "chrome-omnibox-team" ], + "expiry_milestone": 77 + }, + { "name": "omnibox-rich-entity-suggestions", "owners": [ "chrome-omnibox-team" ], "expiry_milestone": 76
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index cc71a189..6c3748e8 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -232,12 +232,6 @@ const char kCanvas2DImageChromiumDescription[] = "Allows for using CHROMIUM_image GLES2 extension for HTML Canvas Contexts"; -const char kCastStreamingHwEncodingName[] = - "Cast Streaming hardware video encoding"; -const char kCastStreamingHwEncodingDescription[] = - "This option enables support in Cast Streaming for encoding video streams " - "using platform hardware."; - const char kClickToOpenPDFName[] = "Click to open embedded PDFs"; const char kClickToOpenPDFDescription[] = "When the PDF plugin is unavailable, show a click-to-open placeholder for " @@ -2485,7 +2479,7 @@ const char kEphemeralTabName[] = "An Ephemeral Tab in an Overlay Panel"; const char kEphemeralTabDescription[] = - "Enable a 'sneak peek' at a linked page in an overlay."; + "Enable a 'Preview page/image' at a linked page into an overlay."; const char kExploreSitesName[] = "Explore websites"; const char kExploreSitesDescription[] = @@ -2894,6 +2888,12 @@ "effect unless either the #upcoming-ui-features flag is Enabled or the " "#top-chrome-md flag is set to Refresh or Touchable Refresh."; +const char kOmniboxReverseTabSwitchLogicName[] = + "Omnibox reverse tab switch logic"; +const char kOmniboxReverseTabSwitchLogicDescription[] = + "Reverse the logic of suggestions that have a tab switch button: Have " + "them switch by default, and have the button navigate."; + const char kOmniboxTabSwitchSuggestionsName[] = "Omnibox tab switch suggestions"; const char kOmniboxTabSwitchSuggestionsDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index b06cf56..18ae44d 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -167,9 +167,6 @@ extern const char kCanvas2DImageChromiumName[]; extern const char kCanvas2DImageChromiumDescription[]; -extern const char kCastStreamingHwEncodingName[]; -extern const char kCastStreamingHwEncodingDescription[]; - extern const char kClickToOpenPDFName[]; extern const char kClickToOpenPDFDescription[]; @@ -1708,6 +1705,9 @@ extern const char kOmniboxReverseAnswersName[]; extern const char kOmniboxReverseAnswersDescription[]; +extern const char kOmniboxReverseTabSwitchLogicName[]; +extern const char kOmniboxReverseTabSwitchLogicDescription[]; + extern const char kOmniboxTabSwitchSuggestionsName[]; extern const char kOmniboxTabSwitchSuggestionsDescription[];
diff --git a/chrome/browser/media/webrtc/desktop_media_list_ash.cc b/chrome/browser/media/webrtc/desktop_media_list_ash.cc index f5ae6c7..3c82f8b0 100644 --- a/chrome/browser/media/webrtc/desktop_media_list_ash.cc +++ b/chrome/browser/media/webrtc/desktop_media_list_ash.cc
@@ -112,6 +112,8 @@ sources, root_windows[i], ash::kShellWindowId_DefaultContainer); EnumerateWindowsForRoot( sources, root_windows[i], ash::kShellWindowId_AlwaysOnTopContainer); + EnumerateWindowsForRoot( + sources, root_windows[i], ash::kShellWindowId_PipContainer); } } }
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc index 961e156..691c4767 100644 --- a/chrome/browser/printing/print_job_worker.cc +++ b/chrome/browser/printing/print_job_worker.cc
@@ -34,6 +34,8 @@ #if defined(OS_ANDROID) #include "chrome/browser/android/tab_android.h" +#include "chrome/browser/android/tab_printer.h" +#include "printing/printing_context_android.h" #endif #if defined(OS_WIN) @@ -291,8 +293,11 @@ // call will return since startPendingPrint will make it return immediately // in case of error. if (tab) { - tab->SetPendingPrint(printing_context_delegate->render_process_id(), - printing_context_delegate->render_frame_id()); + PrintingContextAndroid::SetPendingPrint( + web_contents->GetTopLevelNativeWindow(), + GetPrintableForTab(tab->GetJavaObject()), + printing_context_delegate->render_process_id(), + printing_context_delegate->render_frame_id()); } } #endif
diff --git a/chrome/browser/resources/app_management/BUILD.gn b/chrome/browser/resources/app_management/BUILD.gn index d08ea2c..09e156c 100644 --- a/chrome/browser/resources/app_management/BUILD.gn +++ b/chrome/browser/resources/app_management/BUILD.gn
@@ -22,6 +22,7 @@ ":metadata_view", ":notifications_view", ":permission_item", + ":permission_toggle", ":permission_view_header", ":pwa_permission_view", ":reducers", @@ -154,11 +155,18 @@ js_library("permission_item") { deps = [ ":fake_page_handler", + ":permission_toggle", ":store_client", ":util", ] } + js_library("permission_toggle") { + deps = [ + ":util", + ] + } + js_library("permission_view_header") { deps = [ ":browser_proxy", @@ -180,6 +188,7 @@ js_library("reducers") { deps = [ ":types", + ":util", "//ui/webui/resources/js:cr", ] }
diff --git a/chrome/browser/resources/app_management/actions.js b/chrome/browser/resources/app_management/actions.js index efa4e9a..b4a69cd 100644 --- a/chrome/browser/resources/app_management/actions.js +++ b/chrome/browser/resources/app_management/actions.js
@@ -19,12 +19,12 @@ } /** - * @param {App} update + * @param {App} app */ - function changeApp(update) { + function changeApp(app) { return { name: 'change-app', - update: update, + app: app, }; }
diff --git a/chrome/browser/resources/app_management/app.html b/chrome/browser/resources/app_management/app.html index 8fe97d0f..1cc85b41 100644 --- a/chrome/browser/resources/app_management/app.html +++ b/chrome/browser/resources/app_management/app.html
@@ -20,12 +20,22 @@ <template> <style include="app-management-shared-css"> :host { + display: flex; + flex-direction: column; font-size: var(--app-management-font-size); + height: 100%; line-height: var(--app-management-line-height); + overflow: hidden; } cr-toolbar { background: var(--md-toolbar-color); + min-height: var(--toolbar-height); + } + + #main-container { + overflow: auto; + padding: 0 40px; } </style> <cr-toolbar @@ -33,24 +43,26 @@ search-prompt="$i18n{searchPrompt}" on-search-changed="onSearchChanged_"> </cr-toolbar> - <app-management-dom-switch id="view-selector" - route="[[selectedRouteId_(currentPage_, searchTerm_)]]"> - <template> - <app-management-main-view route-id="main-view"> - </app-management-main-view> - <app-management-notifications-view route-id="notifications-view"> - </app-management-notifications-view> - <app-management-pwa-permission-view route-id="pwa-permission-view"> - </app-management-pwa-permission-view> - <app-management-chrome-app-permission-view - route-id="chrome-app-permission-view"> - </app-management-chrome-app-permission-view> - <app-management-arc-permission-view route-id="arc-permission-view"> - </app-management-arc-permission-view> - <app-management-search-view route-id="search-view"> - </app-management-search-view> - </template> - </app-management-dom-switch> + <div id="main-container"> + <app-management-dom-switch id="view-selector" + route="[[selectedRouteId_(currentPage_, searchTerm_)]]"> + <template> + <app-management-main-view route-id="main-view"> + </app-management-main-view> + <app-management-notifications-view route-id="notifications-view"> + </app-management-notifications-view> + <app-management-pwa-permission-view route-id="pwa-permission-view"> + </app-management-pwa-permission-view> + <app-management-chrome-app-permission-view + route-id="chrome-app-permission-view"> + </app-management-chrome-app-permission-view> + <app-management-arc-permission-view route-id="arc-permission-view"> + </app-management-arc-permission-view> + <app-management-search-view route-id="search-view"> + </app-management-search-view> + </template> + </app-management-dom-switch> + </div> <app-management-router></app-management-router> </template> <script src="app.js"></script>
diff --git a/chrome/browser/resources/app_management/app_item.html b/chrome/browser/resources/app_management/app_item.html index 0a79469..a9683bf2 100644 --- a/chrome/browser/resources/app_management/app_item.html +++ b/chrome/browser/resources/app_management/app_item.html
@@ -14,6 +14,7 @@ align-items: center; border-top: var(--card-separator); color: var(--primary-text-color); + cursor: pointer; display: flex; flex-direction: row; font-weight: 400;
diff --git a/chrome/browser/resources/app_management/chrome_app_permission_view.html b/chrome/browser/resources/app_management/chrome_app_permission_view.html index 92c891c..25da997 100644 --- a/chrome/browser/resources/app_management/chrome_app_permission_view.html +++ b/chrome/browser/resources/app_management/chrome_app_permission_view.html
@@ -4,10 +4,12 @@ <link rel="import" href="store_client.html"> <link rel="import" href="util.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html"> +<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html"> +<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html"> <dom-module id="app-management-chrome-app-permission-view"> <template> - <style include="app-management-shared-css"> + <style include="app-management-shared-css paper-button-style"> ul { list-style: none; margin: 0; @@ -31,6 +33,22 @@ } </style> <app-management-permission-view-header> + <div slot="extra-right-buttons" class="extra-permission-header-button"> +<!-- TODO(crbug.com/906508): For apps which are hosted apps but not + bookmark apps, this button will actually open the site settings page + corresponding to the app, since hosted apps are not listed in + chrome://extensions. + This is not a long-term problem since hosted apps are being replaced, + but in the mean time it might be necessary to change the text of the + button depending on whether or not it is a hosted app. --> + <paper-button class="native-settings-button secondary-text" + on-click="onClickExtensionsSettingsButton_"> + $i18n{openExtensionsSettings} + <paper-icon-button-light class="native-settings-icon icon-external"> + <button></button> + </paper-icon-button-light> + </paper-button> + </div> </app-management-permission-view-header> <div class="card-container"> <div id="app-info">
diff --git a/chrome/browser/resources/app_management/chrome_app_permission_view.js b/chrome/browser/resources/app_management/chrome_app_permission_view.js index e6eff99..dc52e91 100644 --- a/chrome/browser/resources/app_management/chrome_app_permission_view.js +++ b/chrome/browser/resources/app_management/chrome_app_permission_view.js
@@ -40,6 +40,11 @@ this.messages_ = messages; }, + onClickExtensionsSettingsButton_: function() { + app_management.BrowserProxy.getInstance().handler.openNativeSettings( + this.app_.id); + }, + /** * @param {!Array<ExtensionAppPermissionMessage>} messages * @return {Array<string>}
diff --git a/chrome/browser/resources/app_management/main_view.html b/chrome/browser/resources/app_management/main_view.html index 50347e4..d00cae4 100644 --- a/chrome/browser/resources/app_management/main_view.html +++ b/chrome/browser/resources/app_management/main_view.html
@@ -54,6 +54,7 @@ .notification-row { align-items: center; + cursor: pointer; display: inline-flex; justify-content: space-between; padding: 0 24px; @@ -89,7 +90,7 @@ <div id="expander-row" class="expander-list-row" on-click="toggleListExpanded_"> - <span>[[moreAppsString_(apps_.length,listExpanded_)]]</span> + <span>[[moreAppsString_(apps_, listExpanded_)]]</span> <paper-icon-button-light class="expand-button"> <button> <iron-icon icon="[[getCollapsedIcon_(listExpanded_)]]"> @@ -100,15 +101,14 @@ </div> <div class="card-container"> - <span class="notification-row"> + <span class="notification-row" on-click="onClickNotificationSublabel_"> <div class="notification-row-sublabel"> <div class="header-text"> $i18n{notifications} </div> <div id="notifications-sublabel" class="secondary-text"></div> </div> - <paper-icon-button-light class="subpage-arrow" actionable - on-click="onClickNotificationSublabel_"> + <paper-icon-button-light class="subpage-arrow" actionable> <button></button> </paper-icon-button-light> </span>
diff --git a/chrome/browser/resources/app_management/main_view.js b/chrome/browser/resources/app_management/main_view.js index 5d1059d1..f84e00a 100644 --- a/chrome/browser/resources/app_management/main_view.js +++ b/chrome/browser/resources/app_management/main_view.js
@@ -11,12 +11,10 @@ properties: { /** - * List of all apps. - * @private {Array<App>} + * @private {AppMap} */ apps_: { - type: Array, - value: () => [], + type: Object, observer: 'onAppsChanged_', }, @@ -47,28 +45,33 @@ }, /** - * List of apps with the notification permission. - * @private {Array<App>} + * A set containing the ids of all the apps with notifications enabled. + * @private {!Set<string>} */ - notificationApps_: { - type: Array, - value: () => [], + notificationAppIds_: { + type: Object, observer: 'getNotificationSublabel_', }, }, attached: function() { - this.watch('apps_', state => Object.values(state.apps)); + this.watch('apps_', state => state.apps); + this.watch('notificationAppIds_', state => state.notifications.allowedIds); this.updateFromStore(); }, /** - * @param {number} numApps + * @param {AppMap} apps * @param {boolean} listExpanded - * @return {string} + * @return {?string} * @private */ - moreAppsString_: function(numApps, listExpanded) { + moreAppsString_: function(apps, listExpanded) { + if (apps === undefined || listExpanded === undefined) { + return null; + } + + const numApps = Object.keys(apps).length; return listExpanded ? loadTimeData.getString('lessApps') : loadTimeData.getStringF( @@ -87,15 +90,12 @@ * @private */ onAppsChanged_: function() { + const appList = Object.values(this.apps_); this.$['expander-row'].hidden = - this.apps_.length <= NUMBER_OF_APPS_DISPLAYED_DEFAULT; - this.displayedApps_ = this.apps_.slice(0, NUMBER_OF_APPS_DISPLAYED_DEFAULT); + appList.length <= NUMBER_OF_APPS_DISPLAYED_DEFAULT; + this.displayedApps_ = appList.slice(0, NUMBER_OF_APPS_DISPLAYED_DEFAULT); this.collapsedApps_ = - this.apps_.slice(NUMBER_OF_APPS_DISPLAYED_DEFAULT, this.apps_.length); - - const [notificationsAllowed, notificationsBlocked] = - app_management.util.splitByNotificationPermission(); - this.notificationApps_ = notificationsAllowed; + appList.slice(NUMBER_OF_APPS_DISPLAYED_DEFAULT, appList.length); }, /** @@ -118,20 +118,21 @@ * @private */ getNotificationSublabelPieces_: async function() { + const notificationApps = + Array.from(this.notificationAppIds_, id => this.getState().apps[id]); + const /** @type {string} */ label = await cr.sendWithPromise( - 'getPluralString', 'appListPreview', this.notificationApps_.length); + 'getPluralString', 'appListPreview', notificationApps.length); const substitutions = []; for (let i = 0; - i < APP_LIST_PREVIEW_APP_TITLES && i < this.notificationApps_.length; - i++) { - substitutions.push(this.notificationApps_[i].title); + i < APP_LIST_PREVIEW_APP_TITLES && i < notificationApps.length; i++) { + substitutions.push(notificationApps[i].title); } // Add X more apps if the length is more than APP_LIST_PREVIEW_APP_TITLES. - if (this.notificationApps_.length >= APP_LIST_PREVIEW_APP_TITLES + 1) { - substitutions.push( - this.notificationApps_.length - APP_LIST_PREVIEW_APP_TITLES); + if (notificationApps.length >= APP_LIST_PREVIEW_APP_TITLES + 1) { + substitutions.push(notificationApps.length - APP_LIST_PREVIEW_APP_TITLES); } // Only APP_LIST_PREVIEW_APP_TITLES of apps' titles get ellipsised // if too long. the element after that is "X other apps"
diff --git a/chrome/browser/resources/app_management/notifications_view.js b/chrome/browser/resources/app_management/notifications_view.js index 1665fbf..2220170 100644 --- a/chrome/browser/resources/app_management/notifications_view.js +++ b/chrome/browser/resources/app_management/notifications_view.js
@@ -48,21 +48,29 @@ }, attached: function() { - this.onViewLoaded_(); - this.watch('apps_', state => state.apps); this.updateFromStore(); + + this.onViewLoaded_(); }, /** + * Creates arrays of displayed and collapsed apps based on the sets of apps + * with notifications allowed and blocked in the Store. The orders of apps + * in these arrays should then remain fixed while this view is showing. + * * If all the apps have / don't have notification permission, display the * whole list, else display those with notification permission before * expanding. * @private */ onViewLoaded_: function() { - [this.displayedApps_, this.collapsedApps_] = - app_management.util.splitByNotificationPermission(); + const state = this.getState(); + this.displayedApps_ = + Array.from(state.notifications.allowedIds, id => state.apps[id]); + this.collapsedApps_ = + Array.from(state.notifications.blockedIds, id => state.apps[id]); + if (this.displayedApps_.length === 0) { this.displayedApps_ = this.collapsedApps_; this.collapsedApps_ = []; @@ -86,17 +94,16 @@ // If any new apps have been added, append them to the appropriate list. for (const appId of unhandledAppIds) { const app = this.apps_[appId]; - switch (app_management.util.notificationsValue(app)) { - case OptionalBool.kUnknown: - break; - case OptionalBool.kFalse: - this.collapsedApps_.push(app); - break; - case OptionalBool.kTrue: - this.displayedApps_.push(app); - break; - default: - assertNotReached(); + const allowed = app_management.util.notificationsAllowed(app); + + if (allowed === OptionalBool.kUnknown) { + continue; + } + + if (allowed === OptionalBool.kTrue) { + this.displayedApps_.push(app); + } else { + this.collapsedApps_.push(app); } } },
diff --git a/chrome/browser/resources/app_management/permission_item.html b/chrome/browser/resources/app_management/permission_item.html index 3b41326..55b8054 100644 --- a/chrome/browser/resources/app_management/permission_item.html +++ b/chrome/browser/resources/app_management/permission_item.html
@@ -10,6 +10,7 @@ <style include="app-management-shared-css"> :host { align-items: center; + cursor: pointer; display: flex; justify-content: space-between; } @@ -27,7 +28,7 @@ </template> <div id="permission-label">[[permissionLabel]]</div> </div> - <app-management-permission-toggle + <app-management-permission-toggle id="permission-toggle" app="[[app_]]" permission-type="[[permissionType]]"> </app-management-permission-toggle> </template>
diff --git a/chrome/browser/resources/app_management/permission_item.js b/chrome/browser/resources/app_management/permission_item.js index c0664f01..5700c4b 100644 --- a/chrome/browser/resources/app_management/permission_item.js +++ b/chrome/browser/resources/app_management/permission_item.js
@@ -34,8 +34,23 @@ icon: String, }, + listeners: { + 'click': 'onClick_', + }, + attached: function() { this.watch('app_', state => app_management.util.getSelectedApp(state)); this.updateFromStore(); }, + + /** + * @private + */ + onClick_: function(e) { + e.preventDefault(); + + const /** @type {AppManagementPermissionToggleElement} */ toggle = + this.$['permission-toggle']; + toggle.togglePermission_(); + }, });
diff --git a/chrome/browser/resources/app_management/permission_toggle.js b/chrome/browser/resources/app_management/permission_toggle.js index 3d60d26f..77c3060 100644 --- a/chrome/browser/resources/app_management/permission_toggle.js +++ b/chrome/browser/resources/app_management/permission_toggle.js
@@ -34,9 +34,7 @@ return app_management.util.getPermissionValueBool(app, permissionType); }, - /** - * @private - */ + togglePermission_: function() { assert(this.app);
diff --git a/chrome/browser/resources/app_management/pwa_permission_view.js b/chrome/browser/resources/app_management/pwa_permission_view.js index 77790af..bc475ed9 100644 --- a/chrome/browser/resources/app_management/pwa_permission_view.js +++ b/chrome/browser/resources/app_management/pwa_permission_view.js
@@ -30,6 +30,9 @@ this.listExpanded_ = false; }, + /** + * @private + */ onClickSiteSettingsButton_: function() { app_management.BrowserProxy.getInstance().handler.openNativeSettings( this.app_.id);
diff --git a/chrome/browser/resources/app_management/reducers.js b/chrome/browser/resources/app_management/reducers.js index a81e36c..3e8a04e01 100644 --- a/chrome/browser/resources/app_management/reducers.js +++ b/chrome/browser/resources/app_management/reducers.js
@@ -31,10 +31,10 @@ * @return {AppMap} */ AppState.changeApp = function(apps, action) { - assert(apps[action.update.id]); + assert(apps[action.app.id]); const changedAppEntry = {}; - changedAppEntry[action.update.id] = action.update; + changedAppEntry[action.app.id] = action.app; return Object.assign({}, apps, changedAppEntry); }; @@ -94,7 +94,6 @@ } }; - /** * @param {Page} currentPage * @param {Object} action @@ -175,6 +174,87 @@ } }; + const NotificationsState = {}; + + /** + * @param {NotificationsState} notifications + * @param {Object} action + * @return {NotificationsState} + */ + NotificationsState.addApp = function(notifications, action) { + let {allowedIds, blockedIds} = notifications; + const allowed = app_management.util.notificationsAllowed(action.app); + + if (allowed === OptionalBool.kUnknown) { + return {allowedIds, blockedIds}; + } + + if (allowed === OptionalBool.kTrue) { + allowedIds = app_management.util.addIfNeeded(allowedIds, action.app.id); + } else { + blockedIds = app_management.util.addIfNeeded(blockedIds, action.app.id); + } + + return {allowedIds, blockedIds}; + }; + + /** + * @param {NotificationsState} notifications + * @param {Object} action + * @return {NotificationsState} + */ + NotificationsState.changeApp = function(notifications, action) { + let {allowedIds, blockedIds} = notifications; + const allowed = app_management.util.notificationsAllowed(action.app); + const id = action.app.id; + + if (allowed === OptionalBool.kUnknown) { + assert(!blockedIds.has(id) && !allowedIds.has(id)); + return {allowedIds, blockedIds}; + } + + if (allowed === OptionalBool.kTrue) { + allowedIds = app_management.util.addIfNeeded(allowedIds, id); + blockedIds = app_management.util.removeIfNeeded(blockedIds, id); + } else { + allowedIds = app_management.util.removeIfNeeded(allowedIds, id); + blockedIds = app_management.util.addIfNeeded(blockedIds, id); + } + + return {allowedIds, blockedIds}; + }; + + /** + * @param {NotificationsState} notifications + * @param {Object} action + * @return {NotificationsState} + */ + NotificationsState.removeApp = function(notifications, action) { + let {allowedIds, blockedIds} = notifications; + allowedIds = app_management.util.removeIfNeeded(allowedIds, action.id); + blockedIds = app_management.util.removeIfNeeded(blockedIds, action.id); + + return {allowedIds, blockedIds}; + }; + + /** + * @param {NotificationsState} notifications + * @param {Object} action + * @return {NotificationsState} + */ + NotificationsState.updateNotifications = function(notifications, action) { + switch (action.name) { + case 'add-app': + return NotificationsState.addApp(notifications, action); + case 'change-app': + return NotificationsState.changeApp(notifications, action); + case 'remove-app': + return NotificationsState.removeApp(notifications, action); + default: + return notifications; + } + }; + /** * Root reducer for the App Management page. This is called by the store in * response to an action, and the return value is used to update the UI. @@ -185,9 +265,11 @@ function reduceAction(state, action) { return { apps: AppState.updateApps(state.apps, action), - search: SearchState.updateSearch(state.apps, state.search, action), currentPage: CurrentPageState.updateCurrentPage( state.apps, state.currentPage, action), + search: SearchState.updateSearch(state.apps, state.search, action), + notifications: + NotificationsState.updateNotifications(state.notifications, action), }; } @@ -195,6 +277,7 @@ reduceAction: reduceAction, AppState: AppState, CurrentPageState: CurrentPageState, + NotificationsState: NotificationsState, SearchState: SearchState, }; });
diff --git a/chrome/browser/resources/app_management/shared_style.html b/chrome/browser/resources/app_management/shared_style.html index 7cfc0a8..9193bb4 100644 --- a/chrome/browser/resources/app_management/shared_style.html +++ b/chrome/browser/resources/app_management/shared_style.html
@@ -13,7 +13,8 @@ display: flex; flex-direction: column; margin: 24px auto; - width: var(--card-width); + max-width: var(--card-width); + min-width: 550px; } .separated-row { @@ -56,6 +57,7 @@ .native-settings-button { --paper-button-ink-color: none; + --hover-bg-color: var(--google-grey-refresh-100); border: none; display: flex; font-size: 12px;
diff --git a/chrome/browser/resources/app_management/shared_vars.html b/chrome/browser/resources/app_management/shared_vars.html index 860c609..1d62aba 100644 --- a/chrome/browser/resources/app_management/shared_vars.html +++ b/chrome/browser/resources/app_management/shared_vars.html
@@ -20,6 +20,7 @@ --primary-text-color: rgba(0, 0, 0, 0.87); --secondary-font-weight: 400; --secondary-text-color: rgba(0, 0, 0, 0.54); + --toolbar-height: 56px; } </style> </custom-style>
diff --git a/chrome/browser/resources/app_management/types.js b/chrome/browser/resources/app_management/types.js index afeb469c..882b47c 100644 --- a/chrome/browser/resources/app_management/types.js +++ b/chrome/browser/resources/app_management/types.js
@@ -37,17 +37,26 @@ /** * @typedef {{ - * apps: AppMap, - * currentPage: Page, - * search: SearchState, - * }} - */ -let AppManagementPageState; - -/** - * @typedef {{ * term: ?string, * results: ?Array<App>, * }} */ let SearchState; + +/** + * @typedef {{ + * allowedIds: !Set<string>, + * blockedIds: !Set<string>, + * }} + */ +let NotificationsState; + +/** + * @typedef {{ + * apps: !AppMap, + * currentPage: !Page, + * search: !SearchState, + * notifications: !NotificationsState, + * }} + */ +let AppManagementPageState;
diff --git a/chrome/browser/resources/app_management/util.js b/chrome/browser/resources/app_management/util.js index 98aee48..e995007 100644 --- a/chrome/browser/resources/app_management/util.js +++ b/chrome/browser/resources/app_management/util.js
@@ -21,6 +21,10 @@ term: null, results: null, }, + notifications: { + allowedIds: new Set(), + blockedIds: new Set(), + }, }; } @@ -33,6 +37,18 @@ for (const app of apps) { initialState.apps[app.id] = app; + + const allowed = notificationsAllowed(app); + + if (allowed === OptionalBool.kUnknown) { + continue; + } + + if (allowed === OptionalBool.kTrue) { + initialState.notifications.allowedIds.add(app.id); + } else { + initialState.notifications.blockedIds.add(app.id); + } } return initialState; @@ -61,37 +77,53 @@ } /** - * @return {!Array<!Array<App>>} + * If the given value is not in the set, returns a new set with the value + * added, otherwise returns the old set. + * @template T + * @param {!Set<T>} set + * @param {T} value + * @return {!Set<T>} */ - function splitByNotificationPermission() { - const apps = Object.values(app_management.Store.getInstance().data.apps); - const notificationsAllowed = []; - const notificationsBlocked = []; - - for (const app of apps) { - switch (notificationsValue(app)) { - case OptionalBool.kUnknown: - break; - case OptionalBool.kFalse: - notificationsBlocked.push(app); - break; - case OptionalBool.kTrue: - notificationsAllowed.push(app); - break; - default: - assertNotReached(); - } + function addIfNeeded(set, value) { + if (!set.has(value)) { + set = new Set(set); + set.add(value); } - - return [notificationsAllowed, notificationsBlocked]; + return set; } + /** + * If the given value is in the set, returns a new set without the value, + * otherwise returns the old set. + * @template T + * @param {!Set<T>} set + * @param {T} value + * @return {!Set<T>} + */ + function removeIfNeeded(set, value) { + if (set.has(value)) { + set = new Set(set); + set.delete(value); + } + return set; + } /** + * This function determines whether the given app should be treated by the + * notifications view as having notifications allowed or blocked, or not + * having a notifications permission at all. + * + * There are three possible cases: + * - kUnknown is returned if the given app does not have a notifications + * permission, due to how permissions work for its AppType. + * - kTrue is returned if the notifications permission of the app is allowed. + * - kFalse is returned if the notifications permission of the app is + * - blocked, or set to ask in the case of a tristate permission. + * * @param {App} app * @return {OptionalBool} */ - function notificationsValue(app) { + function notificationsAllowed(app) { const permissionType = notificationsPermissionType(app); if (!permissionType) { @@ -177,6 +209,7 @@ } return { + addIfNeeded: addIfNeeded, createEmptyState: createEmptyState, createInitialState: createInitialState, createPermission: createPermission, @@ -184,9 +217,9 @@ getPermission: getPermission, getPermissionValueBool: getPermissionValueBool, getSelectedApp: getSelectedApp, + notificationsAllowed: notificationsAllowed, notificationsPermissionType: notificationsPermissionType, - notificationsValue: notificationsValue, permissionTypeHandle: permissionTypeHandle, - splitByNotificationPermission: splitByNotificationPermission, + removeIfNeeded: removeIfNeeded, }; });
diff --git a/chrome/browser/resources/chromeos/camera/BUILD.gn b/chrome/browser/resources/chromeos/camera/BUILD.gn new file mode 100644 index 0000000..1acc259 --- /dev/null +++ b/chrome/browser/resources/chromeos/camera/BUILD.gn
@@ -0,0 +1,27 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +chrome_camera_app_dir = "$root_out_dir/resources/chromeos/camera" + +group("chrome_camera_app") { + deps = [ + ":chrome_camera_app_base", + "//chrome/browser/resources/chromeos/camera/src/strings:camera_strings", + ] +} + +copy("chrome_camera_app_base") { + sources = [ + "src/css", + "src/images", + "src/js", + "src/manifest.json", + "src/sounds", + "src/views", + ] + + outputs = [ + "$chrome_camera_app_dir/{{source_file_part}}", + ] +}
diff --git a/chrome/browser/resources/chromeos/camera/src/manifest.json b/chrome/browser/resources/chromeos/camera/src/manifest.json index 221569f..b01339e 100644 --- a/chrome/browser/resources/chromeos/camera/src/manifest.json +++ b/chrome/browser/resources/chromeos/camera/src/manifest.json
@@ -1,4 +1,5 @@ { + "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC3oA1Ox8PiRORjuFDgJeWcwnzZDPHUzuH6fymTrx8KPybhfd6XIYFXvilSsRnsGKPslN+BXke3HWC4/MoB2HM2pNGmsQ+jNyTh2dgk4ISdZYRLfqjxr846/245dkznCJLYAZr72Lk+vRZUyYBcLNNox8jRV5ZF16+8uPPUsUiqbQIDAQAB", "manifest_version": 2, "name": "__MSG_name__", "description": "__MSG_description__",
diff --git a/chrome/browser/resources/print_preview/new/model.js b/chrome/browser/resources/print_preview/new/model.js index 7497283..5c646ae 100644 --- a/chrome/browser/resources/print_preview/new/model.js +++ b/chrome/browser/resources/print_preview/new/model.js
@@ -87,6 +87,7 @@ 'layout', 'margins', 'mediaSize', + 'customScaling', 'scaling', 'fitToPage', 'vendorItems', @@ -208,6 +209,14 @@ setByPolicy: false, key: 'scaling', }, + customScaling: { + value: false, + unavailableValue: false, + valid: true, + available: true, + setByPolicy: false, + key: 'customScaling', + }, duplex: { value: true, unavailableValue: false, @@ -326,9 +335,10 @@ 'settings.collate.value, settings.layout.value, settings.color.value,' + 'settings.mediaSize.value, settings.margins.value, ' + 'settings.customMargins.value, settings.dpi.value, ' + - 'settings.fitToPage.value, settings.scaling.value, ' + - 'settings.duplex.value, settings.headerFooter.value, ' + - 'settings.cssBackground.value, settings.vendorItems.value)', + 'settings.fitToPage.value, settings.customScaling.value, ' + + 'settings.scaling.value, settings.duplex.value, ' + + 'settings.headerFooter.value, settings.cssBackground.value, ' + + 'settings.vendorItems.value)', ], /** @private {boolean} */ @@ -711,6 +721,11 @@ const value = this.stickySettings_[setting.key]; if (value != undefined) { this.setSetting(settingName, value); + } else if (settingName === 'customScaling') { + // Use the stored scaling value instead of resetting users with an + // older set of sticky settings. + this.setSetting( + settingName, this.stickySettings_['scaling'] !== '100'); } }); } @@ -820,7 +835,9 @@ printWithPrivet: destination.isPrivet, printWithExtension: destination.isExtension, rasterizePDF: this.getSettingValue('rasterize'), - scaleFactor: parseInt(this.getSettingValue('scaling'), 10), + scaleFactor: this.getSettingValue('customScaling') ? + parseInt(this.getSettingValue('scaling'), 10) : + 100, pagesPerSheet: this.getSettingValue('pagesPerSheet'), dpiHorizontal: (dpi && 'horizontal_dpi' in dpi) ? dpi.horizontal_dpi : 0, dpiVertical: (dpi && 'vertical_dpi' in dpi) ? dpi.vertical_dpi : 0,
diff --git a/chrome/browser/resources/print_preview/new/preview_area.js b/chrome/browser/resources/print_preview/new/preview_area.js index c7d2c51..b13c40f 100644 --- a/chrome/browser/resources/print_preview/new/preview_area.js +++ b/chrome/browser/resources/print_preview/new/preview_area.js
@@ -89,8 +89,8 @@ 'onSettingsChanged_(settings.color.value, settings.cssBackground.value, ' + 'settings.fitToPage.value, settings.headerFooter.value, ' + 'settings.layout.value, settings.ranges.value, ' + - 'settings.selectionOnly.value, settings.scaling.value, ' + - 'settings.rasterize.value, destination)', + 'settings.selectionOnly.value, settings.customScaling.value, ' + + 'settings.scaling.value, settings.rasterize.value, destination)', 'onMarginsChanged_(settings.margins.value)', 'onCustomMarginsChanged_(settings.customMargins.value)', 'onMediaSizeChanged_(settings.mediaSize.value)', @@ -625,7 +625,9 @@ requestID: this.inFlightRequestId_, previewModifiable: this.documentModifiable, fitToPageEnabled: this.getSettingValue('fitToPage'), - scaleFactor: parseInt(this.getSettingValue('scaling'), 10), + scaleFactor: this.getSettingValue('customScaling') ? + parseInt(this.getSettingValue('scaling'), 10) : + 100, shouldPrintBackgrounds: this.getSettingValue('cssBackground'), shouldPrintSelectionOnly: this.getSettingValue('selectionOnly'), // NOTE: Even though the remaining fields don't directly relate to the
diff --git a/chrome/browser/resources/print_preview/new/scaling_settings.html b/chrome/browser/resources/print_preview/new/scaling_settings.html index 29fac7a4..3d1b792 100644 --- a/chrome/browser/resources/print_preview/new/scaling_settings.html +++ b/chrome/browser/resources/print_preview/new/scaling_settings.html
@@ -1,31 +1,43 @@ <link rel="import" href="chrome://resources/html/polymer.html"> -<link rel="import" href="chrome://resources/cr_elements/cr_checkbox/cr_checkbox.html"> +<link rel="import" href="chrome://resources/html/md_select_css.html"> <link rel="import" href="number_settings_section.html"> <link rel="import" href="print_preview_shared_css.html"> +<link rel="import" href="select_behavior.html"> <link rel="import" href="settings_behavior.html"> <link rel="import" href="settings_section.html"> <dom-module id="print-preview-scaling-settings"> <template> - <style include="print-preview-shared"> + <style include="print-preview-shared md-select"> </style> - <print-preview-settings-section hidden$="[[!settings.fitToPage.available]]"> - <span slot="title">$i18n{scalingLabel}</span> - <div slot="controls" class="checkbox"> - <cr-checkbox id="fit-to-page-checkbox" tabindex="1" - disabled$="[[getDisabled_(disabled, currentState_)]]" - on-change="onFitToPageChange_" aria-live="polite"> - $i18n{optionFitToPage} - </cr-checkbox> + <print-preview-settings-section> + <span slot="title" id="scaling-label">$i18n{scalingLabel}</span> + <div slot="controls"> + <select class="md-select" aria-labelledby="scaling-label" + disabled$="[[dropdownDisabled_(disabled, inputValid_)]]" + value="{{selectedValue::change}}"> + <option value="[[scalingValueEnum_.DEFAULT]]"> + $i18n{optionDefaultScaling} + </option> + <option value="[[scalingValueEnum_.FIT_TO_PAGE]]" + hidden$="[[!settings.fitToPage.available]]"> + $i18n{optionFitToPage} + </option> + <option value="[[scalingValueEnum_.CUSTOM]]"> + $i18n{optionCustomScaling} + </option> + </select> </div> </print-preview-settings-section> - <print-preview-number-settings-section max-value="200" min-value="10" - default-value="100" input-aria-label="$i18n{scalingLabel}" - input-label="[[getScalingInputLabel_(settings.fitToPage.available)]]" - disabled="[[disabled]]" current-value="{{currentValue_}}" - input-valid="{{inputValid_}}" hint-message="$i18n{scalingInstruction}"> - </print-preview-number-settings-section> + <iron-collapse opened="[[customSelected_]]"> + <print-preview-number-settings-section + max-value="200" min-value="10" default-value="100" + disabled$="[[inputDisabled_(disabled, inputValid_, customSelected_)]]" + current-value="{{currentValue_}}" input-valid="{{inputValid_}}" + hint-message="$i18n{scalingInstruction}"> + </print-preview-number-settings-section> + </iron-collapse> </template> <script src="scaling_settings.js"></script> </dom-module>
diff --git a/chrome/browser/resources/print_preview/new/scaling_settings.js b/chrome/browser/resources/print_preview/new/scaling_settings.js index b69e116..a891b32 100644 --- a/chrome/browser/resources/print_preview/new/scaling_settings.js +++ b/chrome/browser/resources/print_preview/new/scaling_settings.js
@@ -5,11 +5,10 @@ cr.exportPath('print_preview_new'); /** @enum {number} */ -print_preview_new.ScalingState = { - INIT: 0, - VALID: 1, - INVALID: 2, - FIT_TO_PAGE: 3, +const ScalingValue = { + DEFAULT: 0, + FIT_TO_PAGE: 1, + CUSTOM: 2, }; /* @@ -23,13 +22,10 @@ Polymer({ is: 'print-preview-scaling-settings', - behaviors: [SettingsBehavior], + behaviors: [SettingsBehavior, print_preview_new.SelectBehavior], properties: { - fitToPageScaling: { - type: Number, - observer: 'onFitToPageScalingSet_', - }, + disabled: Boolean, /** @private {string} */ currentValue_: { @@ -38,83 +34,84 @@ }, /** @private {boolean} */ - inputValid_: Boolean, + customSelected_: { + type: Boolean, + computed: 'computeCustomSelected_(selectedValue)', + }, /** @private {boolean} */ - hideInput_: Boolean, + inputValid_: Boolean, - disabled: Boolean, - - /** @private {!print_preview_new.ScalingState} */ - currentState_: { - type: Number, - value: print_preview_new.ScalingState.INIT, - observer: 'onStateChange_', + /** + * Mirroring the enum so that it can be used from HTML bindings. + * @private + */ + scalingValueEnum_: { + type: Object, + value: ScalingValue, }, }, observers: [ 'onFitToPageSettingChange_(settings.fitToPage.value)', 'onScalingSettingChanged_(settings.scaling.value)', - 'onScalingValidChanged_(settings.scaling.valid)', + 'onCustomScalingSettingChanged_(settings.customScaling.value)', ], - /** - * Timeout used to delay processing of the checkbox input. - * @private {?number} - */ - fitToPageTimeout_: null, - - /** @private {boolean} */ - ignoreFtp_: false, - - /** @private {boolean} */ - ignoreValid_: false, - - /** @private {boolean} */ - ignoreValue_: false, - /** @private {string} */ - lastValidScaling_: '100', + lastValidScaling_: '', - /** @private {?boolean} */ - lastFitToPageValue_: null, + onProcessSelectChange: function(value) { + if (value === ScalingValue.FIT_TO_PAGE.toString()) { + this.setSetting('fitToPage', true); + return; + } + + const fitToPageAvailable = this.getSetting('fitToPage').available; + if (fitToPageAvailable) { + this.setSetting('fitToPage', false); + } + const isCustom = value === ScalingValue.CUSTOM.toString(); + this.setSetting('customScaling', isCustom); + if (isCustom) { + this.setSetting('scaling', this.currentValue_); + } + }, + + /** @private */ + updateScalingToValid_: function() { + if (!this.getSetting('scaling').valid) { + this.currentValue_ = this.lastValidScaling_; + } else { + this.lastValidScaling_ = this.currentValue_; + } + }, /** @private */ onFitToPageSettingChange_: function() { - if (this.ignoreFtp_ || !this.getSetting('fitToPage').available) { + if (!this.getSettingValue('fitToPage') || + !this.getSetting('fitToPage').available) { return; } - const fitToPage = this.getSetting('fitToPage').value; - - if (fitToPage) { - this.currentState_ = print_preview_new.ScalingState.FIT_TO_PAGE; - return; - } - - this.currentState_ = this.getSetting('scaling').valid ? - print_preview_new.ScalingState.VALID : - print_preview_new.ScalingState.INVALID; - }, - - /** - * @return {string} The value to display for fit to page scling. - * @private - */ - getFitToPageScalingDisplayValue_: function() { - return this.fitToPageScaling > 0 ? this.fitToPageScaling.toString() : ''; + this.updateScalingToValid_(); + this.selectedValue = ScalingValue.FIT_TO_PAGE.toString(); }, /** @private */ - onFitToPageScalingSet_: function() { - if (this.currentState_ != print_preview_new.ScalingState.FIT_TO_PAGE) { + onCustomScalingSettingChanged_: function() { + if (this.getSettingValue('fitToPage') && + this.getSetting('fitToPage').available) { return; } - this.ignoreValue_ = true; - this.currentValue_ = this.getFitToPageScalingDisplayValue_(); - this.ignoreValue_ = false; + const isCustom = + /** @type {boolean} */ (this.getSetting('customScaling').value); + if (!isCustom) { + this.updateScalingToValid_(); + } + this.selectedValue = isCustom ? ScalingValue.CUSTOM.toString() : + ScalingValue.DEFAULT.toString(); }, /** @@ -122,25 +119,9 @@ * @private */ onScalingSettingChanged_: function() { - // Update last valid scaling and ensure input string matches. - this.lastValidScaling_ = - /** @type {string} */ (this.getSetting('scaling').value); - this.currentValue_ = this.lastValidScaling_; - this.currentState_ = print_preview_new.ScalingState.VALID; - }, - - /** - * Updates the state of the UI when scaling validity is set. - * @private - */ - onScalingValidChanged_: function() { - if (this.ignoreValid_) { - return; - } - - this.currentState_ = this.getSetting('scaling').valid ? - print_preview_new.ScalingState.VALID : - print_preview_new.ScalingState.INVALID; + const value = /** @type {string} */ (this.getSetting('scaling').value); + this.lastValidScaling_ = value; + this.currentValue_ = value; }, /** @@ -149,10 +130,6 @@ * @private */ onInputChanged_: function() { - if (this.ignoreValue_) { - return; - } - if (this.currentValue_ !== '') { this.setSettingValid('scaling', this.inputValid_); } @@ -162,84 +139,27 @@ } }, - /** @private */ - onFitToPageChange_: function() { - const newValue = this.$$('#fit-to-page-checkbox').checked; - - if (this.fitToPageTimeout_ !== null) { - clearTimeout(this.fitToPageTimeout_); - } - - this.fitToPageTimeout_ = setTimeout(() => { - this.fitToPageTimeout_ = null; - - if (newValue === this.lastFitToPageValue_) { - return; - } - - this.lastFitToPageValue_ = newValue; - this.setSetting('fitToPage', newValue); - - if (newValue == false) { - this.currentValue_ = this.lastValidScaling_; - } else { - this.currentState_ = print_preview_new.ScalingState.FIT_TO_PAGE; - } - - // For tests only - this.fire('update-checkbox-setting', 'fitToPage'); - }, 200); + /** + * @return {boolean} Whether the dropdown should be disabled. + * @private + */ + dropdownDisabled_: function() { + return this.disabled && this.inputValid_; }, /** * @return {boolean} Whether the input should be disabled. * @private */ - getDisabled_: function() { - return this.disabled && - this.currentState_ !== print_preview_new.ScalingState.INVALID; + inputDisabled_: function() { + return !this.customSelected_ || (this.disabled && this.inputValid_); }, /** - * @param {!print_preview_new.ScalingState} current - * @param {!print_preview_new.ScalingState} previous + * @return {boolean} Whether the custom scaling option is selected. * @private */ - onStateChange_: function(current, previous) { - if (previous == print_preview_new.ScalingState.FIT_TO_PAGE) { - this.ignoreFtp_ = true; - this.$$('#fit-to-page-checkbox').checked = false; - this.lastFitToPageValue_ = false; - if (current == print_preview_new.ScalingState.VALID) { - this.setSetting('fitToPage', false); - } - this.ignoreFtp_ = false; - } - if (current == print_preview_new.ScalingState.FIT_TO_PAGE) { - if (previous == print_preview_new.ScalingState.INVALID) { - this.ignoreValid_ = true; - this.setSettingValid('scaling', true); - this.ignoreValid_ = false; - } - this.$$('#fit-to-page-checkbox').checked = true; - this.ignoreValue_ = true; - this.currentValue_ = this.getFitToPageScalingDisplayValue_(); - this.ignoreValue_ = false; - } - if (current == print_preview_new.ScalingState.VALID && - previous == print_preview_new.ScalingState.INVALID && - this.getSetting('fitToPage').available) { - this.setSetting('fitToPage', false); - } - }, - - /** - * @return {string} The label to use on the scaling input. - * @private - */ - getScalingInputLabel_: function() { - return this.getSetting('fitToPage').available ? - '' : - loadTimeData.getString('scalingLabel'); + computeCustomSelected_: function() { + return this.selectedValue === ScalingValue.CUSTOM.toString(); }, });
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h index 0d6d8cf..70ca47ae 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.h +++ b/chrome/browser/safe_browsing/safe_browsing_service.h
@@ -59,6 +59,10 @@ } } // namespace prefs +namespace extensions { +class SafeBrowsingPrivateApiUnitTest; +} // namespace extensions + namespace safe_browsing { class PingManager; class ClientSideDetectionService; @@ -223,6 +227,7 @@ friend class base::DeleteHelper<SafeBrowsingService>; friend class SafeBrowsingBlockingPageTestBase; friend class SafeBrowsingBlockingQuietPageTest; + friend class extensions::SafeBrowsingPrivateApiUnitTest; friend class SafeBrowsingServerTest; friend class SafeBrowsingUIManagerTest; friend class SafeBrowsingURLRequestContextGetter;
diff --git a/chrome/browser/ui/app_list/app_list_client_impl.cc b/chrome/browser/ui/app_list/app_list_client_impl.cc index 9e1e5aa..b3254c9 100644 --- a/chrome/browser/ui/app_list/app_list_client_impl.cc +++ b/chrome/browser/ui/app_list/app_list_client_impl.cc
@@ -333,6 +333,10 @@ return search_controller_.get(); } +AppListModelUpdater* AppListClientImpl::GetModelUpdaterForTest() { + return model_updater_; +} + void AppListClientImpl::OnTemplateURLServiceChanged() { DCHECK(model_updater_);
diff --git a/chrome/browser/ui/app_list/app_list_client_impl.h b/chrome/browser/ui/app_list/app_list_client_impl.h index 4502f65..8721360 100644 --- a/chrome/browser/ui/app_list/app_list_client_impl.h +++ b/chrome/browser/ui/app_list/app_list_client_impl.h
@@ -129,6 +129,8 @@ app_list::SearchController* GetSearchControllerForTest(); + AppListModelUpdater* GetModelUpdaterForTest(); + // Flushes all pending mojo call to Ash for testing. void FlushMojoForTesting();
diff --git a/chrome/browser/ui/app_list/app_list_client_impl_browsertest.cc b/chrome/browser/ui/app_list/app_list_client_impl_browsertest.cc index 8ef7969d..1814eb5 100644 --- a/chrome/browser/ui/app_list/app_list_client_impl_browsertest.cc +++ b/chrome/browser/ui/app_list/app_list_client_impl_browsertest.cc
@@ -4,6 +4,8 @@ #include <stddef.h> +#include <memory> + #include "ash/public/cpp/app_list/app_list_features.h" #include "ash/public/cpp/app_list/app_list_switches.h" #include "base/command_line.h" @@ -12,10 +14,12 @@ #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "base/test/bind_test_util.h" +#include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "build/build_config.h" #include "chrome/browser/apps/platform_apps/app_browsertest_util.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/chromeos/login/demo_mode/demo_session.h" #include "chrome/browser/extensions/extension_browsertest.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" @@ -291,3 +295,66 @@ client->ShowAppList(); EXPECT_EQ(browser()->profile(), client->GetCurrentAppListProfile()); } + +class AppListAppLaunchTest : public extensions::ExtensionBrowserTest { + protected: + AppListAppLaunchTest() : extensions::ExtensionBrowserTest() { + histogram_tester_ = std::make_unique<base::HistogramTester>(); + } + ~AppListAppLaunchTest() override = default; + + // InProcessBrowserTest: + void SetUpOnMainThread() override { + extensions::ExtensionBrowserTest::SetUpOnMainThread(); + + AppListClientImpl* app_list = AppListClientImpl::GetInstance(); + EXPECT_TRUE(app_list != nullptr); + + // Need to set the profile to get the model updater. + app_list->UpdateProfile(); + model_updater_ = app_list->GetModelUpdaterForTest(); + EXPECT_TRUE(model_updater_ != nullptr); + } + + void LaunchChromeAppListItem(const std::string& id) { + model_updater_->FindItem(id)->PerformActivate(ui::EF_NONE); + } + + // Captures histograms. + std::unique_ptr<base::HistogramTester> histogram_tester_; + + private: + AppListModelUpdater* model_updater_; + + DISALLOW_COPY_AND_ASSIGN(AppListAppLaunchTest); +}; + +IN_PROC_BROWSER_TEST_F(AppListAppLaunchTest, + NoDemoModeAppLaunchSourceReported) { + EXPECT_FALSE(chromeos::DemoSession::IsDeviceInDemoMode()); + LaunchChromeAppListItem(extension_misc::kChromeAppId); + + // Should see 0 apps launched from the Launcher in the histogram when not in + // Demo mode. + histogram_tester_->ExpectTotalCount("DemoMode.AppLaunchSource", 0); +} + +IN_PROC_BROWSER_TEST_F(AppListAppLaunchTest, DemoModeAppLaunchSourceReported) { + chromeos::DemoSession::SetDemoConfigForTesting( + chromeos::DemoSession::DemoModeConfig::kOnline); + EXPECT_TRUE(chromeos::DemoSession::IsDeviceInDemoMode()); + + // Should see 0 apps launched from the Launcher in the histogram at first. + histogram_tester_->ExpectTotalCount("DemoMode.AppLaunchSource", 0); + + // Launch chrome browser from the Launcher. The same mechanism + // (ChromeAppListItem) is used for all types of apps + // (ARC, extension, etc), so launching just the browser suffices + // to test all these cases. + LaunchChromeAppListItem(extension_misc::kChromeAppId); + + // Should see 1 app launched from the Launcher in the histogram. + histogram_tester_->ExpectUniqueSample( + "DemoMode.AppLaunchSource", + chromeos::DemoSession::AppLaunchSource::kAppList, 1); +}
diff --git a/chrome/browser/ui/app_list/arc/arc_app_utils.cc b/chrome/browser/ui/app_list/arc/arc_app_utils.cc index 21e65f78..17e696cd 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_utils.cc +++ b/chrome/browser/ui/app_list/arc/arc_app_utils.cc
@@ -6,6 +6,7 @@ #include <memory> #include <string> +#include <utility> #include "base/json/json_writer.h" #include "base/metrics/histogram_macros.h" @@ -141,6 +142,10 @@ kIntentHelperClassName, extras_string); } + // Unthrottle the ARC instance before launching an ARC app. This is done + // to minimize lag on an app launch. + SetArcCpuRestriction(false /* do_restrict */); + if (app_info->shortcut || intent.has_value()) { const std::string intent_uri = intent.value_or(app_info->intent_uri); if (auto* app_instance = GET_APP_INSTANCE(LaunchIntent)) { @@ -326,7 +331,7 @@ // default to avoid slowing down Chrome's user session restoration. // However, the restriction should be lifted once the user explicitly // tries to launch an ARC app. - SetArcCpuRestriction(false); + SetArcCpuRestriction(false /* do_restrict */); } prefs->SetLastLaunchTime(app_id); return true;
diff --git a/chrome/browser/ui/app_list/chrome_app_list_item.cc b/chrome/browser/ui/app_list/chrome_app_list_item.cc index 400d285..82aa22d4 100644 --- a/chrome/browser/ui/app_list/chrome_app_list_item.cc +++ b/chrome/browser/ui/app_list/chrome_app_list_item.cc
@@ -16,6 +16,10 @@ #include "ui/gfx/color_utils.h" #include "ui/gfx/image/image_skia_operations.h" +#if defined(OS_CHROMEOS) +#include "chrome/browser/chromeos/login/demo_mode/demo_session.h" +#endif + namespace { AppListControllerDelegate* g_controller_for_test = nullptr; @@ -92,6 +96,11 @@ } void ChromeAppListItem::PerformActivate(int event_flags) { +#if defined(OS_CHROMEOS) + // Handle recording app launch source from the AppList in Demo Mode. + chromeos::DemoSession::RecordAppLaunchSourceIfInDemoMode( + chromeos::DemoSession::AppLaunchSource::kAppList); +#endif Activate(event_flags); MaybeDismissAppList(); }
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 index 4db8472..3626519 100644 --- 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
@@ -298,7 +298,7 @@ // The uninstall flow removes all apps before setting the CrostiniEnabled pref // to false, so we need to do that explicitly too. - RegistryService()->ClearApplicationList(crostini::kCrostiniDefaultVmName); + RegistryService()->ClearApplicationList(crostini::kCrostiniDefaultVmName, ""); CrostiniTestHelper::DisableCrostini(profile()); // Root folder is left. We rely on default handling of empty folder. EXPECT_EQ(1u, GetModelItemCount());
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc index 2d9407d..72d50fd 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
@@ -24,8 +24,10 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/test/bind_test_util.h" +#include "base/test/metrics/histogram_tester.h" #include "chrome/browser/apps/platform_apps/app_browsertest_util.h" #include "chrome/browser/chrome_notification_types.h" +#include "chrome/browser/chromeos/login/demo_mode/demo_session.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_browsertest.h" #include "chrome/browser/extensions/extension_function_test_utils.h" @@ -1004,6 +1006,47 @@ EXPECT_EQ(++tab_count, tab_strip->count()); } +// Launching an app from the shelf when not in Demo Mode should not record app +// launch stat. +IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, NoDemoModeAppLaunchSourceReported) { + EXPECT_FALSE(chromeos::DemoSession::IsDeviceInDemoMode()); + + base::HistogramTester histogram_tester; + + // Should see 0 apps launched from the Shelf in the histogram at first. + histogram_tester.ExpectTotalCount("DemoMode.AppLaunchSource", 0); + + ash::ShelfID id(LoadExtension(test_data_dir_.AppendASCII("app1"))->id()); + controller_->LaunchApp(id, ash::LAUNCH_FROM_SHELF, 0, + display::kInvalidDisplayId); + + // Should still see 0 apps launched from the Shelf in the histogram. + histogram_tester.ExpectTotalCount("DemoMode.AppLaunchSource", 0); +} + +// Launching an app from the shelf in Demo Mode should record app +// launch stat. +IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, DemoModeAppLaunchSourceReported) { + // Set Demo mode + chromeos::DemoSession::SetDemoConfigForTesting( + chromeos::DemoSession::DemoModeConfig::kOnline); + EXPECT_TRUE(chromeos::DemoSession::IsDeviceInDemoMode()); + + base::HistogramTester histogram_tester; + + // Should see 0 apps launched from the Shelf in the histogram at first. + histogram_tester.ExpectTotalCount("DemoMode.AppLaunchSource", 0); + + ash::ShelfID id(LoadExtension(test_data_dir_.AppendASCII("app1"))->id()); + controller_->LaunchApp(id, ash::LAUNCH_FROM_SHELF, 0, + display::kInvalidDisplayId); + + // Should see 1 app launched from the shelf in the histogram. + histogram_tester.ExpectUniqueSample( + "DemoMode.AppLaunchSource", + chromeos::DemoSession::AppLaunchSource::kShelf, 1); +} + // Confirm that a page can be navigated from and to while maintaining the // correct running state. IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, Navigation) {
diff --git a/chrome/browser/ui/ash/launcher/launcher_controller_helper.cc b/chrome/browser/ui/ash/launcher/launcher_controller_helper.cc index a8201af..4b28e031 100644 --- a/chrome/browser/ui/ash/launcher/launcher_controller_helper.cc +++ b/chrome/browser/ui/ash/launcher/launcher_controller_helper.cc
@@ -13,6 +13,7 @@ #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_util.h" +#include "chrome/browser/chromeos/login/demo_mode/demo_session.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/extensions/launch_util.h" @@ -205,6 +206,12 @@ ash::ShelfLaunchSource source, int event_flags, int64_t display_id) { + // Handle recording app launch source from the Shelf in Demo Mode. + if (source == ash::ShelfLaunchSource::LAUNCH_FROM_SHELF) { + chromeos::DemoSession::RecordAppLaunchSourceIfInDemoMode( + chromeos::DemoSession::AppLaunchSource::kShelf); + } + const std::string& app_id = id.app_id; const ArcAppListPrefs* arc_prefs = GetArcAppListPrefs(); if (arc_prefs && arc_prefs->IsRegistered(app_id)) {
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 4ab52f4..8e7a0ae 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc
@@ -1625,7 +1625,7 @@ if (window_->IsFullscreen()) return blink::kWebDisplayModeFullscreen; - if (is_type_popup()) + if (is_app() && is_type_popup()) return blink::kWebDisplayModeStandalone; return blink::kWebDisplayModeBrowser;
diff --git a/chrome/browser/ui/browser_focus_uitest.cc b/chrome/browser/ui/browser_focus_uitest.cc index ab1a141..f1c8c770 100644 --- a/chrome/browser/ui/browser_focus_uitest.cc +++ b/chrome/browser/ui/browser_focus_uitest.cc
@@ -652,7 +652,7 @@ // Simulate an alt-enter. controller->OnAutocompleteAccept( - url2, WindowOpenDisposition::NEW_FOREGROUND_TAB, + url2, nullptr, WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_TYPED, AutocompleteMatchType::URL_WHAT_YOU_TYPED, base::TimeTicks());
diff --git a/chrome/browser/ui/login/login_handler_browsertest.cc b/chrome/browser/ui/login/login_handler_browsertest.cc index 408b3ec..dd3d822 100644 --- a/chrome/browser/ui/login/login_handler_browsertest.cc +++ b/chrome/browser/ui/login/login_handler_browsertest.cc
@@ -72,6 +72,55 @@ return interstitial_page->GetDelegateForTesting(); } +// Tests that a cross origin navigation triggering a login prompt should cause: +// - A blank login interstitial being displayed. +// - The destination URL being shown in the omnibox. +// Navigates to |visit_url| which triggers an HTTP auth dialog, and checks if +// the URL displayed in the omnibox is equal to |expected_url| after all +// navigations including page redirects are completed. +// If |cancel_prompt| is true, the auth dialog is cancelled at the end. +void TestCrossOriginPrompt(Browser* browser, + const GURL& visit_url, + const std::string& expected_hostname, + bool cancel_prompt) { + content::WebContents* contents = + browser->tab_strip_model()->GetActiveWebContents(); + NavigationController* controller = &contents->GetController(); + LoginPromptBrowserTestObserver observer; + + observer.Register(content::Source<NavigationController>(controller)); + + // Load a page which will trigger a login prompt. + WindowedAuthNeededObserver auth_needed_waiter(controller); + browser->OpenURL(OpenURLParams(visit_url, Referrer(), + WindowOpenDisposition::CURRENT_TAB, + ui::PAGE_TRANSITION_TYPED, false)); + ASSERT_EQ(visit_url.host(), contents->GetVisibleURL().host()); + auth_needed_waiter.Wait(); + ASSERT_EQ(1u, observer.handlers().size()); + content::WaitForInterstitialAttach(contents); + + // The omnibox should show the correct origin for the new page when the + // login prompt is shown. + EXPECT_EQ(expected_hostname, contents->GetVisibleURL().host()); + EXPECT_TRUE(contents->ShowingInterstitialPage()); + EXPECT_EQ(LoginInterstitialDelegate::kTypeForTesting, + contents->GetInterstitialPage() + ->GetDelegateForTesting() + ->GetTypeForTesting()); + + if (cancel_prompt) { + // Cancel and wait for the interstitial to detach. + LoginHandler* handler = *observer.handlers().begin(); + content::RunTaskAndWaitForInterstitialDetach( + contents, + base::BindOnce(&LoginHandler::CancelAuth, base::Unretained(handler))); + + EXPECT_EQ(expected_hostname, contents->GetVisibleURL().host()); + EXPECT_FALSE(contents->ShowingInterstitialPage()); + } +} + class LoginPromptBrowserTest : public InProcessBrowserTest { public: LoginPromptBrowserTest() @@ -105,14 +154,6 @@ void SetAuthFor(LoginHandler* handler); - // Navigates to |visit_url| which triggers an HTTP auth dialog, and checks if - // the URL displayed in the omnibox is equal to |expected_url| after all - // navigations including page redirects are completed. - // If |cancel_prompt| is true, the auth dialog is cancelled at the end. - void TestCrossOriginPrompt(const GURL& visit_url, - const std::string& expected_hostname, - bool cancel_prompt) const; - AuthMap auth_map_; std::string bad_password_; std::string bad_username_; @@ -1239,50 +1280,6 @@ EXPECT_EQ(1, observer.auth_cancelled_count()); } -// If a cross origin navigation triggers a login prompt, the destination URL -// should be shown in the omnibox. -void LoginPromptBrowserTest::TestCrossOriginPrompt( - const GURL& visit_url, - const std::string& expected_hostname, - bool cancel_prompt) const { - content::WebContents* contents = - browser()->tab_strip_model()->GetActiveWebContents(); - NavigationController* controller = &contents->GetController(); - LoginPromptBrowserTestObserver observer; - - observer.Register(content::Source<NavigationController>(controller)); - - // Load a page which will trigger a login prompt. - WindowedAuthNeededObserver auth_needed_waiter(controller); - browser()->OpenURL(OpenURLParams(visit_url, Referrer(), - WindowOpenDisposition::CURRENT_TAB, - ui::PAGE_TRANSITION_TYPED, false)); - ASSERT_EQ(visit_url.host(), contents->GetVisibleURL().host()); - auth_needed_waiter.Wait(); - ASSERT_EQ(1u, observer.handlers().size()); - content::WaitForInterstitialAttach(contents); - - // The omnibox should show the correct origin for the new page when the - // login prompt is shown. - EXPECT_EQ(expected_hostname, contents->GetVisibleURL().host()); - EXPECT_TRUE(contents->ShowingInterstitialPage()); - EXPECT_EQ(LoginInterstitialDelegate::kTypeForTesting, - contents->GetInterstitialPage() - ->GetDelegateForTesting() - ->GetTypeForTesting()); - - if (cancel_prompt) { - // Cancel and wait for the interstitial to detach. - LoginHandler* handler = *observer.handlers().begin(); - content::RunTaskAndWaitForInterstitialDetach( - contents, - base::BindOnce(&LoginHandler::CancelAuth, base::Unretained(handler))); - - EXPECT_EQ(expected_hostname, contents->GetVisibleURL().host()); - EXPECT_FALSE(contents->ShowingInterstitialPage()); - } -} - // If a cross origin direct navigation triggers a login prompt, the login // interstitial should be shown. IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, @@ -1292,7 +1289,20 @@ GURL test_page = embedded_test_server()->GetURL(kAuthBasicPage); ASSERT_EQ("127.0.0.1", test_page.host()); std::string auth_host("127.0.0.1"); - TestCrossOriginPrompt(test_page, auth_host, true); + TestCrossOriginPrompt(browser(), test_page, auth_host, true); +} + +// Same as ShowCorrectUrlForCrossOriginMainFrameRequests, but happening in a +// popup window. +IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, + ShowCorrectUrlForCrossOriginMainFrameRequests_Popup) { + ASSERT_TRUE(embedded_test_server()->Start()); + + Browser* popup = CreateBrowserForPopup(browser()->profile()); + const GURL test_page = embedded_test_server()->GetURL(kAuthBasicPage); + ASSERT_EQ("127.0.0.1", test_page.host()); + const std::string auth_host("127.0.0.1"); + TestCrossOriginPrompt(popup, test_page, auth_host, true); } // If a cross origin redirect triggers a login prompt, the destination URL @@ -1305,7 +1315,7 @@ GURL test_page = embedded_test_server()->GetURL(kTestPage); ASSERT_EQ("127.0.0.1", test_page.host()); std::string auth_host("www.a.com"); - TestCrossOriginPrompt(test_page, auth_host, true); + TestCrossOriginPrompt(browser(), test_page, auth_host, true); } // Same as above, but instead of cancelling the prompt for www.a.com at the end, @@ -1346,7 +1356,7 @@ // Load the test page. It should end up on www.a.com with the auth dialog // open. - TestCrossOriginPrompt(test_page, "www.a.com", false); + TestCrossOriginPrompt(browser(), test_page, "www.a.com", false); ASSERT_EQ(1u, observer.handlers().size()); // While the auth dialog is open for www.a.com, redirect to www.b.com which
diff --git a/chrome/browser/ui/omnibox/chrome_omnibox_edit_controller.cc b/chrome/browser/ui/omnibox/chrome_omnibox_edit_controller.cc index 56d25ad92..3d5d03aa 100644 --- a/chrome/browser/ui/omnibox/chrome_omnibox_edit_controller.cc +++ b/chrome/browser/ui/omnibox/chrome_omnibox_edit_controller.cc
@@ -20,13 +20,14 @@ void ChromeOmniboxEditController::OnAutocompleteAccept( const GURL& destination_url, + TemplateURLRef::PostContent* post_content, WindowOpenDisposition disposition, ui::PageTransition transition, AutocompleteMatchType::Type match_type, base::TimeTicks match_selection_timestamp) { - OmniboxEditController::OnAutocompleteAccept(destination_url, disposition, - transition, match_type, - match_selection_timestamp); + OmniboxEditController::OnAutocompleteAccept( + destination_url, post_content, disposition, transition, match_type, + match_selection_timestamp); if (command_updater_) command_updater_->ExecuteCommand(IDC_OPEN_CURRENT_URL);
diff --git a/chrome/browser/ui/omnibox/chrome_omnibox_edit_controller.h b/chrome/browser/ui/omnibox/chrome_omnibox_edit_controller.h index d0b84d9..c26fd96 100644 --- a/chrome/browser/ui/omnibox/chrome_omnibox_edit_controller.h +++ b/chrome/browser/ui/omnibox/chrome_omnibox_edit_controller.h
@@ -19,6 +19,7 @@ public: // OmniboxEditController: void OnAutocompleteAccept(const GURL& destination_url, + TemplateURLRef::PostContent* post_content, WindowOpenDisposition disposition, ui::PageTransition transition, AutocompleteMatchType::Type type,
diff --git a/chrome/browser/ui/views/crostini/crostini_browser_test_util.cc b/chrome/browser/ui/views/crostini/crostini_browser_test_util.cc index 18a042de..b1d571ac 100644 --- a/chrome/browser/ui/views/crostini/crostini_browser_test_util.cc +++ b/chrome/browser/ui/views/crostini/crostini_browser_test_util.cc
@@ -17,31 +17,24 @@ #include "chrome/common/chrome_features.h" #include "components/component_updater/component_updater_paths.h" #include "components/prefs/pref_service.h" -#include "net/base/mock_network_change_notifier.h" -#include "net/base/network_change_notifier_factory.h" +#include "content/public/test/network_connection_change_simulator.h" #include "third_party/cros_system_api/dbus/service_constants.h" -// ChromeBrowserMainExtraParts used to install a MockNetworkChangeNotifier and -// FakeCrOSComponentManager. +// ChromeBrowserMainExtraParts used to install a FakeCrOSComponentManager. class CrostiniBrowserTestChromeBrowserMainExtraParts : public ChromeBrowserMainExtraParts { public: explicit CrostiniBrowserTestChromeBrowserMainExtraParts(bool register_termina) : register_termina_(register_termina) {} - ~CrostiniBrowserTestChromeBrowserMainExtraParts() override { - // |network_change_notifier_| needs to be destroyed before |net_installer_|. - network_change_notifier_.reset(); - } - - net::test::MockNetworkChangeNotifier* network_change_notifier() { - return network_change_notifier_.get(); - } - component_updater::FakeCrOSComponentManager* cros_component_manager() { return cros_component_manager_ptr_; } + content::NetworkConnectionChangeSimulator* connection_change_simulator() { + return &connection_change_simulator_; + } + // ChromeBrowserMainExtraParts: void PostEarlyInitialization() override { auto cros_component_manager = @@ -66,14 +59,10 @@ browser_process_platform_part_test_api_->InitializeCrosComponentManager( std::move(cros_component_manager)); } - void PostMainMessageLoopStart() override { - ASSERT_TRUE(net::NetworkChangeNotifier::HasNetworkChangeNotifier()); - net_installer_ = - std::make_unique<net::NetworkChangeNotifier::DisableForTest>(); - network_change_notifier_ = - std::make_unique<net::test::MockNetworkChangeNotifier>(); - network_change_notifier_->SetConnectionType( - net::NetworkChangeNotifier::CONNECTION_WIFI); + void ServiceManagerConnectionStarted( + content::ServiceManagerConnection* connection) override { + connection_change_simulator_.SetConnectionType( + network::mojom::ConnectionType::CONNECTION_WIFI); } void PostMainMessageLoopRun() override { cros_component_manager_ptr_ = nullptr; @@ -89,9 +78,7 @@ component_updater::FakeCrOSComponentManager* cros_component_manager_ptr_ = nullptr; - std::unique_ptr<net::test::MockNetworkChangeNotifier> - network_change_notifier_; - std::unique_ptr<net::NetworkChangeNotifier::DisableForTest> net_installer_; + content::NetworkConnectionChangeSimulator connection_change_simulator_; DISALLOW_COPY_AND_ASSIGN(CrostiniBrowserTestChromeBrowserMainExtraParts); }; @@ -122,8 +109,9 @@ } void CrostiniDialogBrowserTest::SetConnectionType( - net::NetworkChangeNotifier::ConnectionType connection_type) { - extra_parts_->network_change_notifier()->SetConnectionType(connection_type); + network::mojom::ConnectionType connection_type) { + extra_parts_->connection_change_simulator()->SetConnectionType( + connection_type); } void CrostiniDialogBrowserTest::UnregisterTermina() {
diff --git a/chrome/browser/ui/views/crostini/crostini_browser_test_util.h b/chrome/browser/ui/views/crostini/crostini_browser_test_util.h index 0c370dc..14f9825 100644 --- a/chrome/browser/ui/views/crostini/crostini_browser_test_util.h +++ b/chrome/browser/ui/views/crostini/crostini_browser_test_util.h
@@ -10,7 +10,7 @@ #include "base/test/scoped_feature_list.h" #include "chrome/browser/ui/test/test_browser_dialog.h" #include "chrome/test/base/browser_process_platform_part_test_api_chromeos.h" -#include "net/base/network_change_notifier.h" +#include "services/network/public/mojom/network_change_manager.mojom.h" class CrostiniBrowserTestChromeBrowserMainExtraParts; @@ -27,8 +27,7 @@ void SetUp() override; void SetUpOnMainThread() override; - void SetConnectionType( - net::NetworkChangeNotifier::ConnectionType connection_type); + void SetConnectionType(network::mojom::ConnectionType connection_type); void UnregisterTermina();
diff --git a/chrome/browser/ui/views/crostini/crostini_installer_view.cc b/chrome/browser/ui/views/crostini/crostini_installer_view.cc index d531a70..83dc9ed 100644 --- a/chrome/browser/ui/views/crostini/crostini_installer_view.cc +++ b/chrome/browser/ui/views/crostini/crostini_installer_view.cc
@@ -30,7 +30,8 @@ #include "components/strings/grit/components_strings.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" -#include "net/base/network_change_notifier.h" +#include "content/public/browser/network_service_instance.h" +#include "services/network/public/cpp/network_connection_tracker.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/text/bytes_formatting.h" @@ -166,7 +167,7 @@ // HandleError needs the |progress_bar_|, so we delay our Offline check until // it exists. - if (net::NetworkChangeNotifier::IsOffline()) { + if (content::GetNetworkConnectionTracker()->IsOffline()) { const base::string16 device_type = ui::GetChromeOSDeviceName(); HandleError(l10n_util::GetStringFUTF16(IDS_CROSTINI_INSTALLER_OFFLINE_ERROR, device_type),
diff --git a/chrome/browser/ui/views/crostini/crostini_installer_view_browsertest.cc b/chrome/browser/ui/views/crostini/crostini_installer_view_browsertest.cc index 11e19cf..e4aa597 100644 --- a/chrome/browser/ui/views/crostini/crostini_installer_view_browsertest.cc +++ b/chrome/browser/ui/views/crostini/crostini_installer_view_browsertest.cc
@@ -23,8 +23,6 @@ #include "chromeos/dbus/fake_cros_disks_client.h" #include "chromeos/disks/disk_mount_manager.h" #include "components/crx_file/id_util.h" -#include "net/base/mock_network_change_notifier.h" -#include "net/base/network_change_notifier_factory.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/l10n/l10n_util.h" #include "ui/views/window/dialog_client_view.h" @@ -171,7 +169,7 @@ IN_PROC_BROWSER_TEST_F(CrostiniInstallerViewBrowserTest, InstallFlow_Offline) { base::HistogramTester histogram_tester; - SetConnectionType(net::NetworkChangeNotifier::CONNECTION_NONE); + SetConnectionType(network::mojom::ConnectionType::CONNECTION_NONE); ShowUi("default"); EXPECT_NE(nullptr, ActiveView());
diff --git a/chrome/browser/ui/views/crostini/crostini_uninstaller_view_browsertest.cc b/chrome/browser/ui/views/crostini/crostini_uninstaller_view_browsertest.cc index c5bc47dc..0665285 100644 --- a/chrome/browser/ui/views/crostini/crostini_uninstaller_view_browsertest.cc +++ b/chrome/browser/ui/views/crostini/crostini_uninstaller_view_browsertest.cc
@@ -136,8 +136,7 @@ OfflineUninstallFlowWithoutTermina) { base::HistogramTester histogram_tester; - SetConnectionType(net::NetworkChangeNotifier::CONNECTION_NONE); - base::RunLoop().RunUntilIdle(); + SetConnectionType(network::mojom::ConnectionType::CONNECTION_NONE); ShowUi("default"); EXPECT_NE(nullptr, ActiveView());
diff --git a/chrome/browser/ui/views/crostini/crostini_upgrade_view_browsertest.cc b/chrome/browser/ui/views/crostini/crostini_upgrade_view_browsertest.cc index 576ddc85..8166ea9 100644 --- a/chrome/browser/ui/views/crostini/crostini_upgrade_view_browsertest.cc +++ b/chrome/browser/ui/views/crostini/crostini_upgrade_view_browsertest.cc
@@ -110,7 +110,7 @@ IN_PROC_BROWSER_TEST_F(CrostiniUpgradeViewBrowserTest, LaunchAppOffline_UpgradeNeeded) { base::HistogramTester histogram_tester; - SetConnectionType(net::NetworkChangeNotifier::CONNECTION_NONE); + SetConnectionType(network::mojom::ConnectionType::CONNECTION_NONE); crostini::CrostiniManager::GetForProfile(browser()->profile()) ->MaybeUpgradeCrostini();
diff --git a/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.cc b/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.cc index b80752a..452b7fb 100644 --- a/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.cc +++ b/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.cc
@@ -195,7 +195,7 @@ } void UpdateDoBrowserControlsShrinkRendererSize() { - shrink_renderer_size_ = shown_ratio_ > 0; + shrink_renderer_size_ = shown_ratio_ == 1.f; } // content::WebContentsObserver: @@ -282,9 +282,11 @@ float shown_ratio_ = 1.f; // Indicates whether the renderer's viewport size should be shrunk by the - // height of the browser's top controls. This value should only be updated at - // the end of sliding, and should never change while sliding or scrolling are - // in progress. https://crbug.com/885223. + // height of the browser's top controls. This value never changes while + // sliding is in progress. It is updated only once right before sliding begins + // and remains unchanged until sliding ends, at which point it is updated + // right before the final layout of the BrowserView. + // https://crbug.com/885223. bool shrink_renderer_size_ = true; DISALLOW_COPY_AND_ASSIGN(TopControlsSlideTabObserver); @@ -348,27 +350,23 @@ // disabled, so that we're always synchronized with the renderer. DCHECK(observed_tabs_.count(contents)); - // Note that there are two small windows of intervals between: - // 1- When |is_gesture_scrolling_in_progress_| is set to true (i.e. received - // ET_GESTURE_SCROLL_BEGIN) and when |is_sliding_in_progress_| is set to - // true (i.e. top-chrome actually starts moving), and - // 2- When |is_gesture_scrolling_in_progress_| is set to false (i.e. - // ET_GESTURE_SCROLL_END was received) and when |is_sliding_in_progress_| - // is set to false (i.e. top-chrome stopped moving) which can happen as the - // renderer continues to animate top-chrome towards fully-shown or - // fully-hidden after the user had lifted their fingers while the - // shown_ratio is still a fractional value. - // Even during those two small windows, the - // `DoBrowserControlsShrinkRendererSize` bit should remain unchanged from its - // current value until sliding reaches a steady state. - // Make sure it doesn't get updated if sliding is about to start. + // The only times the `DoBrowserControlsShrinkRendererSize` bit is allowed to + // change are: + // 1) Right before we begin sliding the controls, which happens immediately + // after we set a fractional shown ratio. + // 2) As soon as both gesture scrolling has finished and controls reach a + // terminal value (1 or 0). Note that a scroll might finish but controls + // might still be animating. In this case, + // `DoBrowserControlsShrinkRendererSize` is changed when the animation + // finishes. + const bool is_enabled = IsEnabled(); const bool sliding_or_scrolling_in_progress = is_gesture_scrolling_in_progress_ || is_sliding_in_progress_ || - (IsEnabled() && ratio != 0.f && ratio != 1.f); + (is_enabled && ratio != 0.f && ratio != 1.f); observed_tabs_[contents]->SetShownRatio(ratio, sliding_or_scrolling_in_progress); - if (!IsEnabled()) { + if (!is_enabled) { // However, if sliding is disabled, we don't update |shown_ratio_|, which is // the current value for the entire browser, and it must always be 1.f (i.e. // the top controls are fully shown). @@ -567,15 +565,22 @@ } void TopControlsSlideControllerChromeOS::Refresh() { - if (!is_gesture_scrolling_in_progress_ && - (shown_ratio_ == 1.f || shown_ratio_ == 0.f)) { + const bool got_a_terminal_shown_ratio = + (shown_ratio_ == 1.f || shown_ratio_ == 0.f); + if (!is_gesture_scrolling_in_progress_ && got_a_terminal_shown_ratio) { // Reached a terminal value and gesture scrolling is not in progress. OnEndSliding(); return; } - if (!is_sliding_in_progress_) + if (!is_sliding_in_progress_) { + if (got_a_terminal_shown_ratio) { + // Don't start sliding until we receive a fractional shown ratio. + return; + } + OnBeginSliding(); + } // Using |shown_ratio_|, translate the browser top controls (using the root // view layer), as well as the layer of page contents native view's container @@ -616,6 +621,15 @@ // It should never be called again. DCHECK(!is_sliding_in_progress_); + // Explicitly update the `DoBrowserControlsShrinkRendererSize` bit here before + // we begin sliding, and before we resize the browser view below, which will + // result in changing the bounds of the `BrowserView::contents_web_view_`, + // causing the RednerWidgetHost to request the new value of the + // `DoBrowserControlsShrinkRendererSize` bit, which should be false from now + // on, during and after sliding, until only sliding ends and the top controls + // are fully shown. + UpdateDoBrowserControlsShrinkRendererSize(); + is_sliding_in_progress_ = true; BrowserFrame* browser_frame = browser_view_->frame(); @@ -728,10 +742,7 @@ void TopControlsSlideControllerChromeOS:: UpdateDoBrowserControlsShrinkRendererSize() { - // It should never be called while gesture scrolling is still in progress. - DCHECK(!is_gesture_scrolling_in_progress_); - - // Nor should it be called while sliding is in progress. + // It should never be called while sliding is in progress. DCHECK(!is_sliding_in_progress_); content::WebContents* active_contents = browser_view_->GetActiveWebContents();
diff --git a/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos_browsertest.cc b/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos_browsertest.cc index 78422d1..a7f5040 100644 --- a/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos_browsertest.cc +++ b/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos_browsertest.cc
@@ -1084,9 +1084,12 @@ { // We will start scrolling while top-chrome is fully shown, in which case - // the `DoBrowserControlsShrinkRendererSize` bit is true. It should remain - // true while sliding is in progress. - const bool expected_shrink_renderer_size = true; + // the `DoBrowserControlsShrinkRendererSize` bit is true ... + EXPECT_TRUE( + browser_view()->DoBrowserControlsShrinkRendererSize(active_contents)); + // ... It should change to false at the beginning of sliding and remain + // false while sliding is in progress. + const bool expected_shrink_renderer_size = false; TopControlsShownRatioWaiter waiter(top_controls_slide_controller()); IntermediateShownRatioWaiter fractional_ratio_waiter( @@ -1102,7 +1105,7 @@ CheckBrowserLayout(browser_view(), TopChromeShownState::kFullyHidden); // Now that sliding ended, and top-chrome is fully hidden, the - // `DoBrowserControlsShrinkRendererSize` bit should be false ... + // `DoBrowserControlsShrinkRendererSize` bit should remain false ... EXPECT_FALSE( browser_view()->DoBrowserControlsShrinkRendererSize(active_contents)); } @@ -1179,6 +1182,7 @@ views::Widget::GetWidgetForNativeView(permission_manager->GetBubbleWindow()) ->CloseNow(); EXPECT_FALSE(permission_manager->IsBubbleVisible()); + content::WaitForResizeComplete(active_contents); // Now it is possible to hide top-chrome again. ScrollAndExpectTopChromeToBe(ScrollDirection::kDown,
diff --git a/chrome/browser/ui/views/location_bar/custom_tab_bar_view.cc b/chrome/browser/ui/views/location_bar/custom_tab_bar_view.cc index 154eedef..5df909b8 100644 --- a/chrome/browser/ui/views/location_bar/custom_tab_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/custom_tab_bar_view.cc
@@ -114,8 +114,11 @@ title_label_->SetEnabledColor(foreground_color); title_label_->SetBackgroundColor(background_color); + title_label_->SetElideBehavior(gfx::ElideBehavior::ELIDE_TAIL); + location_label_->SetEnabledColor(foreground_color); - title_label_->SetBackgroundColor(background_color); + location_label_->SetBackgroundColor(background_color); + location_label_->SetElideBehavior(gfx::ElideBehavior::ELIDE_TAIL); AddChildView(title_label_); AddChildView(location_label_); @@ -132,6 +135,18 @@ location_label_->SetText(location); } + // views::View: + gfx::Size GetMinimumSize() const override { + // As labels are not multi-line, the layout will calculate a minimum size + // that would fit the entire text (potentially a long url). Instead, set a + // minimum number of characters we want to display and elide the text if it + // overflows. + constexpr int kMinCharacters = 20; + return gfx::Size( + title_label_->font_list().GetExpectedTextWidth(kMinCharacters), + GetPreferredSize().height()); + } + private: views::Label* title_label_; views::Label* location_label_; @@ -218,6 +233,17 @@ Layout(); } +gfx::Size CustomTabBarView::CalculatePreferredSize() const { + // ToolbarView::GetMinimumSize() uses the preferred size of its children, so + // tell it the minimum size this control will fit into (its layout will + // automatically have this control fill available space). + return gfx::Size(GetInsets().width() + + title_origin_view_->GetMinimumSize().width() + + close_button_->GetPreferredSize().width() + + location_icon_view_->GetPreferredSize().width(), + GetLayoutManager()->GetPreferredSize(this).height()); +} + void CustomTabBarView::OnPaintBackground(gfx::Canvas* canvas) { views::View::OnPaintBackground(canvas);
diff --git a/chrome/browser/ui/views/location_bar/custom_tab_bar_view.h b/chrome/browser/ui/views/location_bar/custom_tab_bar_view.h index 9818a55..3f76641 100644 --- a/chrome/browser/ui/views/location_bar/custom_tab_bar_view.h +++ b/chrome/browser/ui/views/location_bar/custom_tab_bar_view.h
@@ -45,6 +45,7 @@ TabChangeType change_type) override; // views::View: + gfx::Size CalculatePreferredSize() const override; void OnPaintBackground(gfx::Canvas* canvas) override; // LocationIconView::Delegate:
diff --git a/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.cc b/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.cc index 0d5ffea..9ac96887 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.cc
@@ -68,6 +68,17 @@ gfx::Insets GetMarginInsets(int text_height, bool is_two_line) { int vertical_margin = is_two_line ? kTwoLineRowMarginHeight : kOneLineRowMarginHeight; + + if (base::FeatureList::IsEnabled(omnibox::kUIExperimentVerticalMargin)) { + // If the vertical margin experiment is on, we purposely set both the + // one-line and two-line suggestions to have the same vertical margin. + // + // There is no vertical margin value we could set to make the new answer + // style look anything similar to the pre-Refresh style, but setting them to + // be the same looks reasonable, and is a sane place to start experimenting. + vertical_margin = OmniboxFieldTrial::GetSuggestionVerticalMargin(); + } + return gfx::Insets(vertical_margin, kMarginLeft, vertical_margin, OmniboxMatchCellView::kMarginRight); }
diff --git a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc index 9f9b248..133305b0 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
@@ -393,6 +393,14 @@ // interior between each row of text. popup_height += RoundedOmniboxResultsFrame::GetNonResultSectionHeight(); + if (base::FeatureList::IsEnabled(omnibox::kUIExperimentVerticalMargin)) { + // If the vertical margin experiment uses a very small value (like a value + // similar to pre-Refresh), we need to pad up the popup height at the + // bottom (just like pre-Refresh) to prevent it from looking very bad. + if (OmniboxFieldTrial::GetSuggestionVerticalMargin() < 4) + popup_height += 4; + } + // The rounded popup is always offset the same amount from the omnibox. gfx::Rect content_rect = location_bar_view_->GetBoundsInScreen(); content_rect.Inset(
diff --git a/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.cc b/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.cc index 964f81c..5630014 100644 --- a/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.cc +++ b/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.h" #include <algorithm> +#include <memory> #include "base/strings/utf_string_conversions.h" #include "chrome/browser/browser_features.h" @@ -14,9 +15,10 @@ #include "chrome/browser/ui/views/tabs/tab_style.h" #include "components/url_formatter/url_formatter.h" #include "ui/gfx/image/image_skia.h" +#include "ui/views/bubble/bubble_frame_view.h" #include "ui/views/controls/image_view.h" #include "ui/views/controls/label.h" -#include "ui/views/layout/box_layout.h" +#include "ui/views/layout/flex_layout.h" #include "ui/views/layout/layout_provider.h" #include "ui/views/view_properties.h" #include "ui/views/widget/widget.h" @@ -29,11 +31,15 @@ base::TimeDelta::FromMilliseconds(1000); // Hover card and preview image dimensions. -constexpr int kPreferredTabHoverCardWidth = 240; -constexpr float kTabHoverCardPreviewImageAspectRatio = 16.0f / 9.0f; -constexpr gfx::Size kTabHoverCardPreviewImageSize = gfx::Size( - kPreferredTabHoverCardWidth, - kPreferredTabHoverCardWidth / kTabHoverCardPreviewImageAspectRatio); +int GetPreferredTabHoverCardWidth() { + return TabStyle::GetStandardWidth(); +} + +gfx::Size GetTabHoverCardPreviewImageSize() { + constexpr float kTabHoverCardPreviewImageAspectRatio = 16.0f / 9.0f; + const int width = GetPreferredTabHoverCardWidth(); + return gfx::Size(width, width / kTabHoverCardPreviewImageAspectRatio); +} bool AreHoverCardImagesEnabled() { return base::FeatureList::IsEnabled(features::kTabHoverCardImages); @@ -43,8 +49,10 @@ TabHoverCardBubbleView::TabHoverCardBubbleView(Tab* tab) : BubbleDialogDelegateView(tab, views::BubbleBorder::TOP_LEFT) { - SetLayoutManager( - std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical)); + // We'll do all of our own layout inside the bubble, so no need to inset this + // view inside the client view. + set_margins(gfx::Insets()); + // Set so that when hovering over a tab in a inactive window that window will // not become active. Setting this to false creates the need to explicitly // hide the hovercard on press, touch, and keyboard events. @@ -67,12 +75,25 @@ preview_image_ = new views::ImageView(); preview_image_->SetVisible(AreHoverCardImagesEnabled()); preview_image_->SetHorizontalAlignment(views::ImageViewBase::LEADING); - constexpr gfx::Insets kPreviewImageMargins(12, 0, 0, 0); - preview_image_->SetProperty(views::kMarginsKey, - new gfx::Insets(kPreviewImageMargins)); AddChildView(preview_image_); } + views::FlexLayout* const layout = + SetLayoutManager(std::make_unique<views::FlexLayout>()); + layout->SetOrientation(views::LayoutOrientation::kVertical); + layout->SetMainAxisAlignment(views::LayoutAlignment::kStart); + layout->SetCrossAxisAlignment(views::LayoutAlignment::kStretch); + layout->SetCollapseMargins(true); + + constexpr int kOuterMargin = 12; + constexpr int kLineSpacing = 8; + title_label_->SetProperty( + views::kMarginsKey, + new gfx::Insets(kOuterMargin, kOuterMargin, kLineSpacing, kOuterMargin)); + domain_label_->SetProperty( + views::kMarginsKey, + new gfx::Insets(kLineSpacing, kOuterMargin, kOuterMargin, kOuterMargin)); + widget_ = views::BubbleDialogDelegateView::CreateBubble(this); } @@ -160,22 +181,25 @@ preview_image_->SetImage(max_favicon); const gfx::Size favicon_size = max_favicon.size(); + const gfx::Size preferred_size = GetTabHoverCardPreviewImageSize(); + // Scale the favicon to an appropriate size for the tab hover card. // // This is reasonably aesthetic for favicons, though it does not necessarily // fill up the entire width of the hover card. When we move to using // og:images or screenshots, we'll have to do something more sophisticated. if (!favicon_size.IsEmpty()) { - float scale = float{kTabHoverCardPreviewImageSize.height()} / - float{favicon_size.height()}; - preview_image_->SetImageSize( - gfx::Size(std::roundf(scale * favicon_size.width()), - kTabHoverCardPreviewImageSize.height())); + float scale = + float{preferred_size.height()} / float{favicon_size.height()}; + preview_image_->SetImageSize(gfx::Size( + std::roundf(scale * favicon_size.width()), preferred_size.height())); } } } gfx::Size TabHoverCardBubbleView::CalculatePreferredSize() const { - const gfx::Size size = BubbleDialogDelegateView::CalculatePreferredSize(); - return gfx::Size(kPreferredTabHoverCardWidth, size.height()); + gfx::Size preferred_size = GetLayoutManager()->GetPreferredSize(this); + preferred_size.set_width(GetPreferredTabHoverCardWidth()); + DCHECK(!preferred_size.IsEmpty()); + return preferred_size; }
diff --git a/chrome/browser/ui/webui/app_management/app_management_page_handler.cc b/chrome/browser/ui/webui/app_management/app_management_page_handler.cc index c75cfe4..3de9d3e 100644 --- a/chrome/browser/ui/webui/app_management/app_management_page_handler.cc +++ b/chrome/browser/ui/webui/app_management/app_management_page_handler.cc
@@ -95,9 +95,7 @@ std::vector<app_management::mojom::AppPtr> apps; proxy->Cache().ForEachApp([this, &apps](const apps::AppUpdate& update) { - // TODO(crbug.com/906508): Decide on a better way to stop - // built-in apps showing up on the app management page. - if (update.AppType() != apps::mojom::AppType::kBuiltIn) { + if (update.ShowInManagement() == apps::mojom::OptionalBool::kTrue) { apps.push_back(CreateUIAppPtr(update)); } }); @@ -193,9 +191,7 @@ } void AppManagementPageHandler::OnAppUpdate(const apps::AppUpdate& update) { - // TODO(crbug.com/906508): Decide on a better way to stop - // built-in apps showing up on the app management page. - if (update.AppType() == apps::mojom::AppType::kBuiltIn) { + if (update.ShowInManagement() != apps::mojom::OptionalBool::kTrue) { return; }
diff --git a/chrome/browser/ui/webui/app_management/app_management_ui.cc b/chrome/browser/ui/webui/app_management/app_management_ui.cc index d6758b6c..30350d68 100644 --- a/chrome/browser/ui/webui/app_management/app_management_ui.cc +++ b/chrome/browser/ui/webui/app_management/app_management_ui.cc
@@ -43,6 +43,8 @@ source->AddLocalizedString("notifications", IDS_APP_MANAGEMENT_NOTIFICATIONS); source->AddLocalizedString("openAndroidSettings", IDS_APP_MANAGEMENT_ANDROID_SETTINGS); + source->AddLocalizedString("openExtensionsSettings", + IDS_APP_MANAGEMENT_EXTENSIONS_SETTINGS); source->AddLocalizedString("openSiteSettings", IDS_APP_MANAGEMENT_SITE_SETTING); source->AddLocalizedString("permissions", IDS_APP_MANAGEMENT_PERMISSIONS);
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc index b32db77a..30af1405 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
@@ -217,6 +217,8 @@ {"optionCollate", IDS_PRINT_PREVIEW_OPTION_COLLATE}, {"optionColor", IDS_PRINT_PREVIEW_OPTION_COLOR}, {"optionCustomPages", IDS_PRINT_PREVIEW_OPTION_CUSTOM_PAGES}, + {"optionCustomScaling", IDS_PRINT_PREVIEW_OPTION_CUSTOM_SCALING}, + {"optionDefaultScaling", IDS_PRINT_PREVIEW_OPTION_DEFAULT_SCALING}, {"optionFitToPage", IDS_PRINT_PREVIEW_OPTION_FIT_TO_PAGE}, {"optionHeaderFooter", IDS_PRINT_PREVIEW_OPTION_HEADER_FOOTER}, {"optionLandscape", IDS_PRINT_PREVIEW_OPTION_LANDSCAPE},
diff --git a/chrome/browser/ui/webui/settings/about_handler.cc b/chrome/browser/ui/webui/settings/about_handler.cc index 46f45b57..31eabcc 100644 --- a/chrome/browser/ui/webui/settings/about_handler.cc +++ b/chrome/browser/ui/webui/settings/about_handler.cc
@@ -80,7 +80,8 @@ #if defined(OS_CHROMEOS) -// Directory containing the regulatory labels for supported regions. +// The default directory containing the regulatory labels for +// supported regions, relative to chromeos-assets directory const char kRegulatoryLabelsDirectory[] = "regulatory_labels"; // File names of the image file and the file containing alt text for the label. @@ -164,27 +165,30 @@ return service && service->IsOwner(); } -// Returns the path of the regulatory labels directory for a given region, if -// found. Must be called from the blocking pool. +// Returns the absolute path to the directory of regulatory labels +// for a given region, if found. +// (e.g. "/usr/share/chromeos-assets/regulatory_labels/us".) +// Must be called from the blocking pool. base::FilePath GetRegulatoryLabelDirForRegion(const std::string& region) { - // Generate the path under the asset dir or URL host to the regulatory files - // for the region, e.g., "regulatory_labels/us/". - const base::FilePath region_path = - base::FilePath(kRegulatoryLabelsDirectory).AppendASCII(region); - - // Check for file existence starting in /usr/share/chromeos-assets/, e.g., - // "/usr/share/chromeos-assets/regulatory_labels/us/label.png". - const base::FilePath asset_dir(chrome::kChromeOSAssetPath); - if (base::PathExists(asset_dir.Append(region_path) - .AppendASCII(kRegulatoryLabelImageFilename))) { - return region_path; + // Allow the regulatory label path to be overriden by a flag. + base::FilePath base_dir = + base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( + chromeos::switches::kRegulatoryLabelDir); + if (base_dir.empty()) { + base_dir = base::FilePath(chrome::kChromeOSAssetPath) + .Append(kRegulatoryLabelsDirectory); } + const base::FilePath region_dir = base_dir.AppendASCII(region); + const base::FilePath image_path = + region_dir.AppendASCII(kRegulatoryLabelImageFilename); - return base::FilePath(); + // Check if the label image file exists in the path. + return base::PathExists(image_path) ? region_dir : base::FilePath(); } -// Finds the directory for the regulatory label, using the VPD region code. -// Also tries "us" as a fallback region. Must be called from the blocking pool. +// Finds the absolute path to the directory of regulatory labels, +// using the VPD region code. Also tries "us" as a fallback region. +// Must be called from the blocking pool. base::FilePath FindRegulatoryLabelDir() { std::string region; base::FilePath region_path; @@ -202,12 +206,12 @@ return region_path; } -// Reads the file containing the regulatory label text, if found, relative to -// the asset directory. Must be called from the blocking pool. +// Reads the file containing the regulatory label text, if found in +// the given path to the directory of regulatory labels. Must be called +// from the blocking pool. std::string ReadRegulatoryLabelText(const base::FilePath& label_dir_path) { - base::FilePath text_path(chrome::kChromeOSAssetPath); - text_path = text_path.Append(label_dir_path); - text_path = text_path.AppendASCII(kRegulatoryLabelTextFilename); + base::FilePath text_path = + label_dir_path.AppendASCII(kRegulatoryLabelTextFilename); std::string contents; if (base::ReadFileToString(text_path, &contents))
diff --git a/chrome/browser/web_applications/bookmark_apps/bookmark_app_install_manager.h b/chrome/browser/web_applications/bookmark_apps/bookmark_app_install_manager.h index 54afbbd..9fd01c8 100644 --- a/chrome/browser/web_applications/bookmark_apps/bookmark_app_install_manager.h +++ b/chrome/browser/web_applications/bookmark_apps/bookmark_app_install_manager.h
@@ -15,7 +15,7 @@ BookmarkAppInstallManager(); ~BookmarkAppInstallManager() override; - // InstallManager interface implementation. + // InstallManager: bool CanInstallWebApp(content::WebContents* web_contents) override; void InstallWebApp(content::WebContents* web_contents, bool force_shortcut_app,
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.cc b/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.cc index bb2b4b2..be5869f3 100644 --- a/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.cc +++ b/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.cc
@@ -10,26 +10,35 @@ #include "base/callback.h" #include "chrome/browser/extensions/crx_installer.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/web_applications/components/web_app_constants.h" +#include "chrome/browser/web_applications/components/web_app_helpers.h" #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" #include "chrome/common/web_application_info.h" #include "extensions/common/extension.h" +#include "extensions/common/extension_id.h" #include "url/gurl.h" namespace extensions { BookmarkAppInstallFinalizer::BookmarkAppInstallFinalizer(Profile* profile) - : crx_installer_(CrxInstaller::CreateSilent( - ExtensionSystem::Get(profile)->extension_service())) {} + : profile_(profile) {} BookmarkAppInstallFinalizer::~BookmarkAppInstallFinalizer() = default; -void BookmarkAppInstallFinalizer::Install( - const WebApplicationInfo& web_app_info, - ResultCallback callback) { +void BookmarkAppInstallFinalizer::FinalizeInstall( + std::unique_ptr<WebApplicationInfo> web_app_info, + InstallFinalizedCallback callback) { + if (!crx_installer_) { + ExtensionService* extension_service = + ExtensionSystem::Get(profile_)->extension_service(); + DCHECK(extension_service); + crx_installer_ = CrxInstaller::CreateSilent(extension_service); + } + crx_installer_->set_installer_callback(base::BindOnce( &BookmarkAppInstallFinalizer::OnInstall, weak_ptr_factory_.GetWeakPtr(), - std::move(callback), web_app_info.app_url)); - crx_installer_->InstallWebApp(web_app_info); + std::move(callback), web_app_info->app_url)); + crx_installer_->InstallWebApp(*web_app_info); } void BookmarkAppInstallFinalizer::SetCrxInstallerForTesting( @@ -38,11 +47,12 @@ } void BookmarkAppInstallFinalizer::OnInstall( - ResultCallback callback, + InstallFinalizedCallback callback, const GURL& app_url, const base::Optional<CrxInstallError>& error) { if (error) { - std::move(callback).Run(std::string()); + std::move(callback).Run(web_app::AppId(), + web_app::InstallResultCode::kFailedUnknownReason); return; } @@ -50,7 +60,8 @@ DCHECK(installed_extension); DCHECK_EQ(AppLaunchInfo::GetLaunchWebURL(installed_extension), app_url); - std::move(callback).Run(installed_extension->id()); + std::move(callback).Run(installed_extension->id(), + web_app::InstallResultCode::kSuccess); } } // namespace extensions
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.h b/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.h index ea9d659..6c5db547 100644 --- a/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.h +++ b/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.h
@@ -5,12 +5,11 @@ #ifndef CHROME_BROWSER_WEB_APPLICATIONS_EXTENSIONS_BOOKMARK_APP_INSTALL_FINALIZER_H_ #define CHROME_BROWSER_WEB_APPLICATIONS_EXTENSIONS_BOOKMARK_APP_INSTALL_FINALIZER_H_ -#include "base/callback_forward.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/optional.h" -#include "extensions/common/extension_id.h" +#include "chrome/browser/web_applications/components/install_finalizer.h" class GURL; class Profile; @@ -23,28 +22,26 @@ class CrxInstallError; // Class used to actually install the Bookmark App in the system. -class BookmarkAppInstallFinalizer { +class BookmarkAppInstallFinalizer : public web_app::InstallFinalizer { public: - using ResultCallback = base::OnceCallback<void(const ExtensionId&)>; - // Constructs a BookmarkAppInstallFinalizer that will install the Bookmark App // in |profile|. explicit BookmarkAppInstallFinalizer(Profile* profile); - virtual ~BookmarkAppInstallFinalizer(); + ~BookmarkAppInstallFinalizer() override; - // TODO(crbug.com/864904): This should take more options e.g. what container - // to launch the app in, should the app sync, etc. - virtual void Install(const WebApplicationInfo& web_app_info, - ResultCallback callback); + // InstallFinalizer: + void FinalizeInstall(std::unique_ptr<WebApplicationInfo> web_app_info, + InstallFinalizedCallback callback) override; void SetCrxInstallerForTesting(scoped_refptr<CrxInstaller> crx_installer); private: - void OnInstall(ResultCallback callback, + void OnInstall(InstallFinalizedCallback callback, const GURL& app_url, const base::Optional<CrxInstallError>& error); scoped_refptr<CrxInstaller> crx_installer_; + Profile* profile_; // We need a WeakPtr because CrxInstaller is refcounted and it can run its // callback after this class has been destroyed.
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer_unittest.cc b/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer_unittest.cc index 297d5c50..93a44ae 100644 --- a/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer_unittest.cc +++ b/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer_unittest.cc
@@ -14,6 +14,7 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/browser/extensions/crx_installer.h" #include "chrome/browser/extensions/test_extension_system.h" +#include "chrome/browser/web_applications/components/web_app_helpers.h" #include "chrome/common/web_application_info.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/testing_profile.h" @@ -83,8 +84,9 @@ } void InstallCallback(base::OnceClosure quit_closure, - const ExtensionId& extension_id) { - app_installed_ = !extension_id.empty(); + const web_app::AppId& app_id, + web_app::InstallResultCode code) { + app_installed_ = !app_id.empty(); std::move(quit_closure).Run(); } @@ -100,20 +102,22 @@ TEST_F(BookmarkAppInstallFinalizerTest, BasicInstallSucceeds) { BookmarkAppInstallFinalizer installer(profile()); - WebApplicationInfo info; - info.app_url = GURL(kWebAppUrl); - info.title = base::ASCIIToUTF16(kWebAppTitle); + auto info = std::make_unique<WebApplicationInfo>(); + info->app_url = GURL(kWebAppUrl); + info->title = base::ASCIIToUTF16(kWebAppTitle); base::RunLoop run_loop; - installer.Install( - info, base::BindOnce(&BookmarkAppInstallFinalizerTest::InstallCallback, - base::Unretained(this), run_loop.QuitClosure())); + installer.FinalizeInstall( + std::move(info), + base::BindOnce(&BookmarkAppInstallFinalizerTest::InstallCallback, + base::Unretained(this), run_loop.QuitClosure())); run_loop.Run(); EXPECT_TRUE(app_installed()); } TEST_F(BookmarkAppInstallFinalizerTest, BasicInstallFails) { BookmarkAppInstallFinalizer installer(profile()); + auto fake_crx_installer = base::MakeRefCounted<BookmarkAppInstallFinalizerTest::FakeCrxInstaller>( profile()); @@ -121,12 +125,13 @@ base::RunLoop run_loop; - WebApplicationInfo info; - info.app_url = GURL(kWebAppUrl); - info.title = base::ASCIIToUTF16(kWebAppTitle); - installer.Install( - info, base::BindOnce(&BookmarkAppInstallFinalizerTest::InstallCallback, - base::Unretained(this), run_loop.QuitClosure())); + auto info = std::make_unique<WebApplicationInfo>(); + info->app_url = GURL(kWebAppUrl); + info->title = base::ASCIIToUTF16(kWebAppTitle); + installer.FinalizeInstall( + std::move(info), + base::BindOnce(&BookmarkAppInstallFinalizerTest::InstallCallback, + base::Unretained(this), run_loop.QuitClosure())); fake_crx_installer->WaitForInstallToTrigger(); fake_crx_installer->SimulateInstallFailed();
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 52f91f4..ceb84e9 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc
@@ -176,10 +176,6 @@ // Disables the bundled PPAPI version of Flash. const char kDisableBundledPpapiFlash[] = "disable-bundled-ppapi-flash"; -// Disables hardware encoding support for Cast Streaming. -const char kDisableCastStreamingHWEncoding[] = - "disable-cast-streaming-hw-encoding"; - // Disables the client-side phishing detection feature. Note that even if // client-side phishing detection is enabled, it will only be active if the // user has opted in to UMA stats and SafeBrowsing is enabled in the
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 12d77455..fc24c377 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h
@@ -66,7 +66,6 @@ extern const char kDiagnosticsRecovery[]; extern const char kDisableBackgroundNetworking[]; extern const char kDisableBundledPpapiFlash[]; -extern const char kDisableCastStreamingHWEncoding[]; extern const char kDisableClientSidePhishingDetection[]; extern const char kDisableComponentExtensionsWithBackgroundPages[]; extern const char kDisableComponentUpdate[];
diff --git a/chrome/common/extensions/api/safe_browsing_private.idl b/chrome/common/extensions/api/safe_browsing_private.idl index db44b9b3..c7935da5 100644 --- a/chrome/common/extensions/api/safe_browsing_private.idl +++ b/chrome/common/extensions/api/safe_browsing_private.idl
@@ -2,9 +2,43 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Use the <code>chrome.safeBrowsingPrivate</code> API to observe events. +// Use the <code>chrome.safeBrowsingPrivate</code> API to observe events +// or retrieve referrer chain. namespace safeBrowsingPrivate { + enum URLType { + // Ends with the final URL of the referrer chain. + EVENT_URL, + + // One gesture away from the EVENT_URL, i.e. the user will click on the + // LANDING_PAGE, go through zero or more CLIENT_REDIRECTS, then end up + // at EVENT_URL. + LANDING_PAGE, + + // One gesture away from LANDING_PAGE. + LANDING_REFERRER, + + // The navigation is RENDER_INITIATED_WITHOUT_USER_GESTURE. + CLIENT_REDIRECT, + + // Doesn't directly lead to the EVENT_URL, but the navigation occurred + // recently, so it might be involved in the event. + RECENT_NAVIGATION, + + // Triggered by a user gesture and precedes the LANDING_REFERRER. + REFERRER + }; + + enum NavigationInitiation { + // Typically from Chrome UI, e.g. bookmarks or omnibox. + BROWSER_INITIATED, + + // Renderer initiated navigations involve interactions with the content + // area, such as link clicks or JS. + RENDERER_INITIATED_WITHOUT_USER_GESTURE, + RENDERER_INITIATED_WITH_USER_GESTURE + }; + dictionary PolicySpecifiedPasswordReuse { // URL where this reuse happened. DOMString url; @@ -44,6 +78,55 @@ DOMString userName; }; + dictionary ServerRedirect { + // Server redirect URL. + DOMString? url; + }; + + // From ReferrerChainEntry in //src/components/safe_browsing/proto/csd.proto + dictionary ReferrerChainEntry { + // URL of this entry. + DOMString url; + + // Only set if different from |url|. + DOMString? mainFrameUrl; + + // Types of URLs, such as event url, landing page, etc. + URLType urlType; + + // IP addresses corresponding to this host. + DOMString[]? ipAddresses; + + // Referrer URL of this entry. + DOMString? referrerUrl; + + // Main frame URL of referrer. Only set if different from |referrer_url|. + DOMString? referrerMainFrameUrl; + + // If this URL loads in a different tab/frame from previous one. + boolean? isRetargeting; + + double? navigationTimeMs; + + // Set only if server redirects happened in navigation. + ServerRedirect[]? serverRedirectChain; + + // How this navigation is initiated. + NavigationInitiation? navigationInitiation; + + // Whether this entry may have been launched by an external application. + boolean? maybeLaunchedByExternalApp; + }; + + callback GetReferrerChainCallback = void(ReferrerChainEntry[] entries); + + interface Functions { + // Gets referrer chain for the specified tab. + // |tabId|: Id of the tab from which to retrieve the referrer. + // |callback|: Called with the list of referrer chain entries. + static void getReferrerChain(long tabId, GetReferrerChainCallback callback); + }; + interface Events { // Fired when Chrome detects a reuse of a policy specified password. //
diff --git a/chrome/common/extensions/extension_constants.cc b/chrome/common/extensions/extension_constants.cc index b3c65002..94d72fe 100644 --- a/chrome/common/extensions/extension_constants.cc +++ b/chrome/common/extensions/extension_constants.cc
@@ -71,6 +71,7 @@ const char kZipArchiverExtensionId[] = "dmboannefpncccogfdikhmhpmdnddgoe"; const char kZipArchiverExtensionPath[] = "chromeos/zip_archiver"; const char kChromeCameraAppId[] = "hfhhnacclhffhdffklopdkcgdhifgngh"; +const char kChromeCameraAppPath[] = "chromeos/camera"; const char kContainedHomeAppId[] = "nbaolgedfgoedkjbfmpediclncanmpbc"; #endif
diff --git a/chrome/common/extensions/extension_constants.h b/chrome/common/extensions/extension_constants.h index 48de342..4ae3582b 100644 --- a/chrome/common/extensions/extension_constants.h +++ b/chrome/common/extensions/extension_constants.h
@@ -231,6 +231,8 @@ extern const char kZipArchiverExtensionPath[]; // The app ID of Chrome camera app. extern const char kChromeCameraAppId[]; +// Path to preinstalled Chrome camera app. +extern const char kChromeCameraAppPath[]; // The app ID of the contained home app. extern const char kContainedHomeAppId[]; #endif
diff --git a/chrome/renderer/media/cast_receiver_session_delegate.h b/chrome/renderer/media/cast_receiver_session_delegate.h index 0e1c001..187dc61a 100644 --- a/chrome/renderer/media/cast_receiver_session_delegate.h +++ b/chrome/renderer/media/cast_receiver_session_delegate.h
@@ -10,9 +10,9 @@ #include "base/macros.h" #include "chrome/renderer/media/cast_receiver_audio_valve.h" #include "chrome/renderer/media/cast_session_delegate.h" -#include "content/public/renderer/media_stream_video_sink.h" #include "media/capture/video_capture_types.h" #include "media/cast/cast_receiver.h" +#include "third_party/blink/public/common/media/video_capture.h" class CastReceiverSessionDelegate : public CastSessionDelegateBase { public:
diff --git a/chrome/renderer/media/cast_rtp_stream.cc b/chrome/renderer/media/cast_rtp_stream.cc index 0263fb3..5f825ce 100644 --- a/chrome/renderer/media/cast_rtp_stream.cc +++ b/chrome/renderer/media/cast_rtp_stream.cc
@@ -13,7 +13,6 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback_helpers.h" -#include "base/command_line.h" #include "base/logging.h" #include "base/macros.h" #include "base/memory/ref_counted.h" @@ -26,7 +25,6 @@ #include "chrome/renderer/media/cast_session.h" #include "chrome/renderer/media/cast_udp_transport.h" #include "content/public/renderer/media_stream_utils.h" -#include "content/public/renderer/media_stream_video_sink.h" #include "content/public/renderer/render_thread.h" #include "content/public/renderer/video_encode_accelerator.h" #include "media/base/audio_bus.h" @@ -40,6 +38,7 @@ #include "media/cast/cast_sender.h" #include "media/cast/net/cast_transport_config.h" #include "third_party/blink/public/platform/modules/mediastream/web_media_stream_audio_sink.h" +#include "third_party/blink/public/platform/modules/mediastream/web_media_stream_sink.h" #include "third_party/blink/public/platform/web_media_stream_source.h" #include "ui/gfx/geometry/size.h" @@ -167,18 +166,21 @@ // handles this. Otherwise, all methods and member variables of the outer class // must only be accessed on the render thread. class CastVideoSink : public base::SupportsWeakPtr<CastVideoSink>, - public content::MediaStreamVideoSink { + public blink::WebMediaStreamSink { public: // |track| provides data for this sink. // |error_callback| is called if video formats don't match. CastVideoSink(const blink::WebMediaStreamTrack& track, const CastRtpStream::ErrorCallback& error_callback) - : track_(track), deliverer_(new Deliverer(error_callback)), + : track_(track), + deliverer_(new Deliverer(error_callback)), consecutive_refresh_count_(0), - expecting_a_refresh_frame_(false) {} + expecting_a_refresh_frame_(false), + is_connected_to_track_(false) {} ~CastVideoSink() override { - MediaStreamVideoSink::DisconnectFromTrack(); + if (is_connected_to_track_) + content::RemoveSinkFromMediaStreamTrack(track_, this); } // Attach this sink to a video track represented by |track_|. @@ -193,9 +195,10 @@ base::TimeDelta::FromMilliseconds(kRefreshIntervalMilliseconds), base::Bind(&CastVideoSink::OnRefreshTimerFired, base::Unretained(this))); - MediaStreamVideoSink::ConnectToTrack( - track_, base::Bind(&Deliverer::OnVideoFrame, deliverer_), + content::AddSinkToMediaStreamTrack( + track_, this, base::BindRepeating(&Deliverer::OnVideoFrame, deliverer_), is_sink_secure); + is_connected_to_track_ = true; } private: @@ -266,7 +269,7 @@ DVLOG(1) << "CastVideoSink is requesting another refresh frame " "(consecutive count=" << consecutive_refresh_count_ << ")."; expecting_a_refresh_frame_ = true; - content::RequestRefreshFrameFromVideoTrack(connected_track()); + content::RequestRefreshFrameFromVideoTrack(track_); } void DidReceiveFrame() { @@ -298,6 +301,8 @@ // cleared once the next frame is received. bool expecting_a_refresh_frame_; + bool is_connected_to_track_; + DISALLOW_COPY_AND_ASSIGN(CastVideoSink); }; @@ -433,12 +438,6 @@ }; bool CastRtpStream::IsHardwareVP8EncodingSupported() { - const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); - if (cmd_line->HasSwitch(switches::kDisableCastStreamingHWEncoding)) { - DVLOG(1) << "Disabled hardware VP8 support for Cast Streaming."; - return false; - } - // Query for hardware VP8 encoder support. const std::vector<media::VideoEncodeAccelerator::SupportedProfile> vea_profiles = content::GetSupportedVideoEncodeAcceleratorProfiles(); @@ -452,12 +451,6 @@ } bool CastRtpStream::IsHardwareH264EncodingSupported() { - const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); - if (cmd_line->HasSwitch(switches::kDisableCastStreamingHWEncoding)) { - DVLOG(1) << "Disabled hardware h264 support for Cast Streaming."; - return false; - } - // Query for hardware H.264 encoder support. // // TODO(miu): Look into why H.264 hardware encoder on MacOS is broken.
diff --git a/chrome/services/app_service/public/cpp/app_update.cc b/chrome/services/app_service/public/cpp/app_update.cc index 7ee4e64..d6b8c303 100644 --- a/chrome/services/app_service/public/cpp/app_update.cc +++ b/chrome/services/app_service/public/cpp/app_update.cc
@@ -72,6 +72,9 @@ if (delta->show_in_search != apps::mojom::OptionalBool::kUnknown) { state->show_in_search = delta->show_in_search; } + if (delta->show_in_management != apps::mojom::OptionalBool::kUnknown) { + state->show_in_management = delta->show_in_management; + } // When adding new fields to the App Mojo type, this function should also be // updated. @@ -276,4 +279,22 @@ (!state_ || (delta_->show_in_search != state_->show_in_search)); } +apps::mojom::OptionalBool AppUpdate::ShowInManagement() const { + if (delta_ && + (delta_->show_in_management != apps::mojom::OptionalBool::kUnknown)) { + return delta_->show_in_management; + } + if (state_) { + return state_->show_in_management; + } + return apps::mojom::OptionalBool::kUnknown; +} + +bool AppUpdate::ShowInManagementChanged() const { + return delta_ && + (delta_->show_in_management != apps::mojom::OptionalBool::kUnknown) && + (!state_ || + (delta_->show_in_management != state_->show_in_management)); +} + } // namespace apps
diff --git a/chrome/services/app_service/public/cpp/app_update.h b/chrome/services/app_service/public/cpp/app_update.h index aedcea5..dc693ecd 100644 --- a/chrome/services/app_service/public/cpp/app_update.h +++ b/chrome/services/app_service/public/cpp/app_update.h
@@ -91,6 +91,9 @@ apps::mojom::OptionalBool ShowInSearch() const; bool ShowInSearchChanged() const; + apps::mojom::OptionalBool ShowInManagement() const; + bool ShowInManagementChanged() const; + private: const apps::mojom::App* state_; const apps::mojom::App* delta_;
diff --git a/chrome/services/app_service/public/cpp/app_update_unittest.cc b/chrome/services/app_service/public/cpp/app_update_unittest.cc index 1ba673e..935f4e77 100644 --- a/chrome/services/app_service/public/cpp/app_update_unittest.cc +++ b/chrome/services/app_service/public/cpp/app_update_unittest.cc
@@ -47,6 +47,9 @@ apps::mojom::OptionalBool expect_show_in_search_; bool expect_show_in_search_changed_; + apps::mojom::OptionalBool expect_show_in_management_; + bool expect_show_in_management_changed_; + static constexpr uint32_t kPermissionTypeLocation = 100; static constexpr uint32_t kPermissionTypeNotification = 200; @@ -71,6 +74,7 @@ expect_is_platform_app_changed_ = false; expect_show_in_launcher_changed_ = false; expect_show_in_search_changed_ = false; + expect_show_in_management_changed_ = false; } void CheckExpects(const apps::AppUpdate& u) { @@ -107,6 +111,9 @@ EXPECT_EQ(expect_show_in_search_, u.ShowInSearch()); EXPECT_EQ(expect_show_in_search_changed_, u.ShowInSearchChanged()); + + EXPECT_EQ(expect_show_in_management_, u.ShowInManagement()); + EXPECT_EQ(expect_show_in_management_changed_, u.ShowInManagementChanged()); } void TestAppUpdate(apps::mojom::App* state, apps::mojom::App* delta) { @@ -127,6 +134,7 @@ expect_is_platform_app_ = apps::mojom::OptionalBool::kUnknown; expect_show_in_launcher_ = apps::mojom::OptionalBool::kUnknown; expect_show_in_search_ = apps::mojom::OptionalBool::kUnknown; + expect_show_in_management_ = apps::mojom::OptionalBool::kUnknown; ExpectNoChange(); CheckExpects(u); @@ -330,6 +338,28 @@ CheckExpects(u); } + // ShowInManagement tests. + + if (state) { + state->show_in_management = apps::mojom::OptionalBool::kFalse; + expect_show_in_management_ = apps::mojom::OptionalBool::kFalse; + expect_show_in_management_changed_ = false; + CheckExpects(u); + } + + if (delta) { + delta->show_in_management = apps::mojom::OptionalBool::kTrue; + expect_show_in_management_ = apps::mojom::OptionalBool::kTrue; + expect_show_in_management_changed_ = true; + CheckExpects(u); + } + + if (state) { + apps::AppUpdate::Merge(state, delta); + ExpectNoChange(); + CheckExpects(u); + } + // Permission tests. if (state) {
diff --git a/chrome/services/app_service/public/mojom/types.mojom b/chrome/services/app_service/public/mojom/types.mojom index 8ba3cce..237a99a 100644 --- a/chrome/services/app_service/public/mojom/types.mojom +++ b/chrome/services/app_service/public/mojom/types.mojom
@@ -39,6 +39,7 @@ // show_in_yyy fields? OptionalBool show_in_launcher; OptionalBool show_in_search; + OptionalBool show_in_management; // When adding new fields, also update the Merge method and other helpers in // chrome/services/app_service/public/cpp/app_update.*
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index e03f039..30e9d34 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -3787,7 +3787,9 @@ "../browser/extensions/api/preference/preference_api_prefs_unittest.cc", "../browser/extensions/api/proxy/proxy_api_helpers_unittest.cc", "../browser/extensions/api/runtime/chrome_runtime_api_delegate_unittest.cc", + "../browser/extensions/api/safe_browsing_private/safe_browsing_private_api_unittest.cc", "../browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router_unittest.cc", + "../browser/extensions/api/safe_browsing_private/safe_browsing_util_unittest.cc", "../browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc", "../browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc", "../browser/extensions/api/signed_in_devices/signed_in_devices_manager_unittest.cc",
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestRule.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestRule.java index f0aa4164..9c5328a 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestRule.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestRule.java
@@ -19,6 +19,7 @@ import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver; import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelSelector; import org.chromium.chrome.test.util.ApplicationTestUtils; +import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.chrome.test.util.browser.tabmodel.document.MockStorageDelegate; import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.CriteriaHelper; @@ -51,7 +52,7 @@ CriteriaHelper.pollUiThread(new Criteria() { @Override public boolean isSatisfied() { - if (!tab.isLoadingAndRenderingDone()) return false; + if (!ChromeTabUtils.isLoadingAndRenderingDone(tab)) return false; if (!TextUtils.equals(expectedTitle, tab.getTitle())) return false; return true; }
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ChromeTabUtils.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ChromeTabUtils.java index c418102e..52d5f0e 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ChromeTabUtils.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ChromeTabUtils.java
@@ -53,6 +53,13 @@ public class ChromeTabUtils { private static final String TAG = "cr_ChromeTabUtils"; public static final int TITLE_UPDATE_TIMEOUT_MS = 3000; + + /** + * The required page load percentage for the page to be considered ready assuming the + * TextureView is also ready. + */ + private static final int CONSIDERED_READY_LOAD_PERCENTAGE = 100; + /** * An observer that waits for a Tab to load a page. * @@ -759,4 +766,11 @@ "Tab title didn't update to %s in time.", newTitle)); } } + + /** + * @return Whether or not the loading and rendering of the page is done. + */ + public static boolean isLoadingAndRenderingDone(Tab tab) { + return tab.isReady() && tab.getProgress() >= CONSIDERED_READY_LOAD_PERCENTAGE; + } }
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/TabLoadObserver.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/TabLoadObserver.java index c47b6d2..509fa3f 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/TabLoadObserver.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/TabLoadObserver.java
@@ -12,6 +12,7 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.content_public.browser.test.util.Coordinates; import org.chromium.content_public.browser.test.util.Criteria; @@ -95,7 +96,7 @@ CriteriaHelper.pollUiThread(new Criteria() { @Override public boolean isSatisfied() { - if (!mTab.isLoadingAndRenderingDone()) { + if (!ChromeTabUtils.isLoadingAndRenderingDone(mTab)) { updateFailureReason("load and rendering never completed"); return false; }
diff --git a/chrome/test/chromedriver/test/run_py_tests.py b/chrome/test/chromedriver/test/run_py_tests.py index f9c1d1f..355094d4 100755 --- a/chrome/test/chromedriver/test/run_py_tests.py +++ b/chrome/test/chromedriver/test/run_py_tests.py
@@ -85,6 +85,8 @@ 'ChromeDriverAndroidTest.testScreenOrientationAcrossMultipleTabs', # https://bugs.chromium.org/p/chromedriver/issues/detail?id=833 'ChromeDriverTest.testAlertOnNewWindow', + # https://bugs.chromium.org/p/chromedriver/issues/detail?id=2777 + 'ChromeDriverTest.testActionsTouchStart', ] _VERSION_SPECIFIC_FILTER = {}
diff --git a/chrome/test/chromedriver/window_commands.cc b/chrome/test/chromedriver/window_commands.cc index 89cb6be..da132b1 100644 --- a/chrome/test/chromedriver/window_commands.cc +++ b/chrome/test/chromedriver/window_commands.cc
@@ -681,9 +681,9 @@ std::unique_ptr<base::Value>* value, Timeout* timeout) { const char kGetPageSource[] = - "function() {" - " return new XMLSerializer().serializeToString(document);" - "}"; + " () => document.documentElement" + " ? document.documentElement.outerHTML : ''"; + base::ListValue args; return web_view->CallFunction( session->GetCurrentFrameId(), kGetPageSource, args, value);
diff --git a/chrome/test/data/webui/app_management/reducers_test.js b/chrome/test/data/webui/app_management/reducers_test.js index 48201121..9ba3f21 100644 --- a/chrome/test/data/webui/app_management/reducers_test.js +++ b/chrome/test/data/webui/app_management/reducers_test.js
@@ -6,24 +6,12 @@ suite('app state', function() { let apps; - let state; - - function createApp(id, config) { - return app_management.FakePageHandler.createApp(id, config); - } setup(function() { - // Create an initial AppMap. apps = { '1': createApp('1'), '2': createApp('2'), }; - - // Create an initial state. - state = app_management.util.createInitialState([ - createApp('1'), - createApp('2'), - ]); }); test('updates when an app is added', function() { @@ -67,6 +55,17 @@ // Check that other app is unaffected. assertTrue(!!apps['2']); }); +}); + +suite('current page state', function() { + let state; + + setup(function() { + state = app_management.util.createInitialState([ + createApp('1'), + createApp('2'), + ]); + }); test( 'returns to main page if an app is removed while in its detail page', @@ -92,7 +91,7 @@ assertEquals(PageType.DETAIL, state.currentPage.pageType); }); - test('state updates when changing to main page', function() { + test('current page updates when changing to main page', function() { // Returning to main page results in no selected app. state.currentPage.selectedAppId = '1'; state.currentPage.pageType = PageType.DETAIL; @@ -111,7 +110,7 @@ assertEquals(PageType.MAIN, state.currentPage.pageType); }); - test('state updates when changing to app detail page', function() { + test('current page updates when changing to app detail page', function() { // State updates when a valid app detail page is selected. let action = app_management.actions.changePage(PageType.DETAIL, '2'); state = app_management.reduceAction(state, action); @@ -130,6 +129,24 @@ assertEquals(PageType.MAIN, state.currentPage.pageType); }); + test('current page updates when changing to notifications page', function() { + const action = app_management.actions.changePage(PageType.NOTIFICATIONS); + state = app_management.reduceAction(state, action); + + assertEquals(PageType.NOTIFICATIONS, state.currentPage.pageType); + }); +}); + +suite('search state', function() { + let state; + + setup(function() { + state = app_management.util.createInitialState([ + createApp('1'), + createApp('2'), + ]); + }); + test('state updates when search starts', function() { // State updates when a search term has been typed in. let action = app_management.actions.setSearchTerm('searchTerm'); @@ -144,11 +161,131 @@ assertEquals(null, state.search.term); }); +}); - test('state updates when changing to notifications page', function() { - const action = app_management.actions.changePage(PageType.NOTIFICATIONS); - state = app_management.reduceAction(state, action); +suite('notifications state', function() { + let state; - assertEquals(PageType.NOTIFICATIONS, state.currentPage.pageType); + function createAppWithNotifications(id, allowed) { + const permissionValue = allowed ? TriState.kAllow : TriState.kBlock; + const notificationsPermissionType = + PwaPermissionType.CONTENT_SETTINGS_TYPE_NOTIFICATIONS; + + const notificationsPermission = app_management.util.createPermission( + notificationsPermissionType, PermissionValueType.kTriState, + permissionValue); + + const permissions = {}; + permissions[notificationsPermissionType] = notificationsPermission; + return createApp(id, {permissions: permissions}); + } + + setup(function() { + state = app_management.util.createInitialState([ + createAppWithNotifications('1', false), + createAppWithNotifications('2', true), + ]); + }); + + test('notifications state updates when an app is added', function() { + // Check that the sets are initialised correctly. + let {allowedIds, blockedIds} = state.notifications; + + assertEquals(1, allowedIds.size); + assertTrue(allowedIds.has('2')); + + assertEquals(1, blockedIds.size); + assertTrue(blockedIds.has('1')); + + // Add an app and update the sets. + let newApp = createAppWithNotifications('3', true); + let action = app_management.actions.addApp(newApp); + let {allowedIds: newAllowedIds, blockedIds: newBlockedIds} = + app_management.NotificationsState.updateNotifications( + {allowedIds, blockedIds}, action); + + // Check that the new id was added to the allowed set, and its reference + // has changed. + assertEquals(2, newAllowedIds.size); + assertTrue(newAllowedIds.has('3')); + assertNotEquals(newAllowedIds, allowedIds); + + // Check that the blocked set hasn't changed, and that its reference is + // the same. + assertEquals(1, newBlockedIds.size); + assertEquals(newBlockedIds, blockedIds); + + // If the added doesn't have a notifications permission, the sets don't + // change. + allowedIds = newAllowedIds; + blockedIds = newBlockedIds; + + newApp = createApp('4', {type: AppType.kUnknown, permissions: {}}); + action = app_management.actions.addApp(newApp); + ({allowedIds: newAllowedIds, blockedIds: newBlockedIds} = + app_management.NotificationsState.updateNotifications( + {allowedIds, blockedIds}, action)); + + assertEquals(2, newAllowedIds.size); + assertEquals(newAllowedIds, allowedIds); + + assertEquals(1, newBlockedIds.size); + assertEquals(newBlockedIds, blockedIds); + }); + + test('notifications state updates when an app is changed', function() { + // If the change doesn't affect the notifications permission, the sets + // are unchanged and still have the same references. + let {allowedIds, blockedIds} = state.notifications; + + let changedApp = createAppWithNotifications('2', true); + changedApp.title = 'New App Title'; + let action = app_management.actions.changeApp(changedApp); + let {allowedIds: newAllowedIds, blockedIds: newBlockedIds} = + app_management.NotificationsState.updateNotifications( + {allowedIds, blockedIds}, action); + + assertEquals(1, newAllowedIds.size); + assertTrue(newAllowedIds.has('2')); + assertEquals(newAllowedIds, allowedIds); + + assertEquals(1, newBlockedIds.size); + assertTrue(newBlockedIds.has('1')); + assertEquals(newBlockedIds, blockedIds); + + // If the notifications permission value of an app is changed, the sets + // update correctly. + blockedIds = newBlockedIds; + allowedIds = newAllowedIds; + + changedApp = createAppWithNotifications('1', true); + action = app_management.actions.changeApp(changedApp); + ({allowedIds: newAllowedIds, blockedIds: newBlockedIds} = + app_management.NotificationsState.updateNotifications( + {allowedIds, blockedIds}, action)); + + assertEquals(2, newAllowedIds.size); + assertTrue(newAllowedIds.has('1')); + assertNotEquals(newAllowedIds, allowedIds); + + assertEquals(0, newBlockedIds.size); + assertNotEquals(newBlockedIds, blockedIds); + }); + + test('notifications state updates when an app is removed', function() { + // When an app is removed, the sets update correctly. + const {allowedIds, blockedIds} = state.notifications; + + const action = app_management.actions.removeApp('1'); + const {allowedIds: newAllowedIds, blockedIds: newBlockedIds} = + app_management.NotificationsState.updateNotifications( + {allowedIds, blockedIds}, action); + + assertEquals(1, newAllowedIds.size); + assertTrue(newAllowedIds.has('2')); + assertEquals(newAllowedIds, allowedIds); + + assertEquals(0, newBlockedIds.size); + assertNotEquals(newBlockedIds, blockedIds); }); });
diff --git a/chrome/test/data/webui/app_management/test_util.js b/chrome/test/data/webui/app_management/test_util.js index d11716b..f0482197 100644 --- a/chrome/test/data/webui/app_management/test_util.js +++ b/chrome/test/data/webui/app_management/test_util.js
@@ -5,6 +5,15 @@ 'use strict'; /** + * @param {string} id + * @param {Object=} optConfig + * @return {!App} + */ +function createApp(id, config) { + return app_management.FakePageHandler.createApp(id, config); +} + +/** * @return {app_management.FakePageHandler} */ function setupFakeHandler() {
diff --git a/chrome/test/data/webui/print_preview/invalid_settings_browsertest.js b/chrome/test/data/webui/print_preview/invalid_settings_browsertest.js index cd854ac..46b056f 100644 --- a/chrome/test/data/webui/print_preview/invalid_settings_browsertest.js +++ b/chrome/test/data/webui/print_preview/invalid_settings_browsertest.js
@@ -257,6 +257,9 @@ return nativeLayer.whenCalled('getInitialSettings') .then(function() { + // Set this to enable the scaling input. + page.setSetting('customScaling', true); + page.destinationStore_.startLoadCloudDestinations(); // FooDevice will be selected since it is the most recently used
diff --git a/chrome/test/data/webui/print_preview/model_test.js b/chrome/test/data/webui/print_preview/model_test.js index 7f90b01a..9a4b65e0 100644 --- a/chrome/test/data/webui/print_preview/model_test.js +++ b/chrome/test/data/webui/print_preview/model_test.js
@@ -35,6 +35,7 @@ dpi: {}, mediaSize: {width_microns: 215900, height_microns: 279400}, marginsType: 0, /* default */ + customScaling: false, scaling: '100', isHeaderFooterEnabled: true, isCssBackgroundEnabled: false, @@ -53,6 +54,7 @@ dpi: {horizontal_dpi: 1000, vertical_dpi: 500}, mediaSize: {width_microns: 43180, height_microns: 21590}, marginsType: 2, /* none */ + customScaling: true, scaling: '85', isHeaderFooterEnabled: false, isCssBackgroundEnabled: true, @@ -112,6 +114,7 @@ .then(() => testStickySetting('layout', 'isLandscapeEnabled')) .then(() => testStickySetting('margins', 'marginsType')) .then(() => testStickySetting('mediaSize', 'mediaSize')) + .then(() => testStickySetting('customScaling', 'customScaling')) .then(() => testStickySetting('scaling', 'scaling')) .then(() => testStickySetting('fitToPage', 'isFitToPageEnabled')) .then(() => testStickySetting('vendorItems', 'vendorOptions')); @@ -170,6 +173,7 @@ vertical_dpi: 100, }, fitToPage: true, + customScaling: true, scaling: '90', duplex: false, cssBackground: true,
diff --git a/chrome/test/data/webui/print_preview/preview_generation_test.js b/chrome/test/data/webui/print_preview/preview_generation_test.js index c20103ec..c310bb75 100644 --- a/chrome/test/data/webui/print_preview/preview_generation_test.js +++ b/chrome/test/data/webui/print_preview/preview_generation_test.js
@@ -277,7 +277,58 @@ /** Validate changing the scaling updates the preview. */ test(assert(TestNames.Scaling), function() { - return testSimpleSetting('scaling', '100', '90', 'scaleFactor', 100, 90); + return initialize() + .then(function(args) { + const ticket = JSON.parse(args.printTicket); + assertEquals(0, ticket.requestID); + assertEquals(100, ticket.scaleFactor); + nativeLayer.resetResolver('getPreview'); + assertEquals('100', page.getSettingValue('scaling')); + assertEquals(false, page.getSettingValue('customScaling')); + page.setSetting('customScaling', true); + return nativeLayer.whenCalled('getPreview'); + }) + .then(function(args) { + const ticket = JSON.parse(args.printTicket); + // No change since custom value is 100 by default. + assertEquals(100, ticket.scaleFactor); + assertEquals(1, ticket.requestID); + nativeLayer.resetResolver('getPreview'); + assertEquals('100', page.getSettingValue('scaling')); + assertEquals(true, page.getSettingValue('customScaling')); + page.setSetting('scaling', '90'); + return nativeLayer.whenCalled('getPreview'); + }) + .then(function(args) { + const ticket = JSON.parse(args.printTicket); + // Ticket updates with new custom value. + assertEquals(90, ticket.scaleFactor); + assertEquals(2, ticket.requestID); + nativeLayer.resetResolver('getPreview'); + assertEquals('90', page.getSettingValue('scaling')); + assertEquals(true, page.getSettingValue('customScaling')); + page.setSetting('customScaling', false); + return nativeLayer.whenCalled('getPreview'); + }) + .then(function(args) { + const ticket = JSON.parse(args.printTicket); + // Back to 100 for default + assertEquals(100, ticket.scaleFactor); + assertEquals(3, ticket.requestID); + nativeLayer.resetResolver('getPreview'); + assertEquals('90', page.getSettingValue('scaling')); + assertEquals(false, page.getSettingValue('customScaling')); + page.setSetting('customScaling', true); + return nativeLayer.whenCalled('getPreview'); + }) + .then(function(args) { + const ticket = JSON.parse(args.printTicket); + // Back to 90, since custom scaling value is now 90. + assertEquals(90, ticket.scaleFactor); + assertEquals(4, ticket.requestID); + assertEquals('90', page.getSettingValue('scaling')); + assertEquals(true, page.getSettingValue('customScaling')); + }); }); /**
diff --git a/chrome/test/data/webui/print_preview/restore_state_test.js b/chrome/test/data/webui/print_preview/restore_state_test.js index 4d0cce8..652fbdf 100644 --- a/chrome/test/data/webui/print_preview/restore_state_test.js +++ b/chrome/test/data/webui/print_preview/restore_state_test.js
@@ -51,11 +51,15 @@ stickySettings.vendorOptions.printArea, page.settings.vendorItems.value.printArea); - [['margins', 'marginsType'], ['color', 'isColorEnabled'], + [['margins', 'marginsType'], + ['color', 'isColorEnabled'], ['headerFooter', 'isHeaderFooterEnabled'], - ['layout', 'isLandscapeEnabled'], ['collate', 'isCollateEnabled'], + ['layout', 'isLandscapeEnabled'], + ['collate', 'isCollateEnabled'], ['fitToPage', 'isFitToPageEnabled'], - ['cssBackground', 'isCssBackgroundEnabled'], ['scaling', 'scaling'], + ['cssBackground', 'isCssBackgroundEnabled'], + ['scaling', 'scaling'], + ['customScaling', 'customScaling'], ].forEach(keys => { assertEquals(stickySettings[keys[1]], page.settings[keys[0]].value); }); @@ -111,6 +115,7 @@ printArea: 6, }, marginsType: 3, /* custom */ + customScaling: true, scaling: '90', isHeaderFooterEnabled: true, isCssBackgroundEnabled: true, @@ -145,6 +150,7 @@ printArea: 4, }, marginsType: 0, /* default */ + customScaling: false, scaling: '120', isHeaderFooterEnabled: false, isCssBackgroundEnabled: false, @@ -209,6 +215,12 @@ }, { section: 'print-preview-scaling-settings', + settingName: 'customScaling', + key: 'customScaling', + value: true, + }, + { + section: 'print-preview-scaling-settings', settingName: 'scaling', key: 'scaling', value: '85',
diff --git a/chrome/test/data/webui/print_preview/settings_section_test.js b/chrome/test/data/webui/print_preview/settings_section_test.js index d8c3235..0a9c454 100644 --- a/chrome/test/data/webui/print_preview/settings_section_test.js +++ b/chrome/test/data/webui/print_preview/settings_section_test.js
@@ -377,23 +377,25 @@ toggleMoreSettings(); assertFalse(scalingElement.hidden); - // HTML to non-PDF destination -> only input shown + // HTML to non-PDF destination -> No fit to page option. initDocumentInfo(false, false); - const fitToPageSection = - scalingElement.$$('print-preview-settings-section'); - const scalingInputWrapper = - scalingElement.$$('print-preview-number-settings-section') - .$$('.input-wrapper'); assertFalse(scalingElement.hidden); - assertTrue(fitToPageSection.hidden); - assertFalse(scalingInputWrapper.hidden); + const fitToPageOption = scalingElement.$$( + `[value="${scalingElement.scalingValueEnum_.FIT_TO_PAGE}"]`); + const defaultOption = scalingElement.$$( + `[value="${scalingElement.scalingValueEnum_.DEFAULT}"]`); + const customOption = scalingElement.$$( + `[value="${scalingElement.scalingValueEnum_.CUSTOM}"]`); + assertTrue(fitToPageOption.hidden); + assertFalse(defaultOption.hidden); + assertFalse(customOption.hidden); - // PDF to non-PDF destination -> checkbox and input shown. Check that if - // more settings is collapsed the section is hidden. + // PDF to non-PDF destination -> All 3 options. initDocumentInfo(true, false); assertFalse(scalingElement.hidden); - assertFalse(fitToPageSection.hidden); - assertFalse(scalingInputWrapper.hidden); + assertFalse(fitToPageOption.hidden); + assertFalse(defaultOption.hidden); + assertFalse(customOption.hidden); // PDF to PDF destination -> section disappears. setPdfDestination(); @@ -907,22 +909,39 @@ const scalingInput = scalingElement.$$('print-preview-number-settings-section') .$.userValue.inputElement; - const fitToPageCheckbox = scalingElement.$$('#fit-to-page-checkbox'); + const collapse = scalingElement.$$('iron-collapse'); + const scalingDropdown = scalingElement.$$('.md-select'); + /** + * @param {boolean} isCustom Whether custom scaling is selected. + * @param {string} scalingValue The value of the scaling setting. + * @param {string} scalingDisplayValue The value displayed in the scaling + * input. + * @param {boolean} scalingValid Whether the scaling setting is valid. + * @param {boolean} fitToPage Whether fit to page is selected. + */ const validateScalingState = - (scalingValue, scalingValid, fitToPage, fitToPageDisplay) => { - // Invalid scalings are always set directly in the input, so no need - // to verify that the input matches them. - if (scalingValid) { - const scalingDisplay = fitToPage ? - page.documentSettings_.fitToPageScaling.toString() : - scalingValue; - assertEquals(scalingDisplay, scalingInput.value); + (isCustom, scalingValue, scalingDisplayValue, scalingValid, + fitToPage) => { + if (fitToPage) { + assertEquals( + scalingElement.scalingValueEnum_.FIT_TO_PAGE.toString(), + scalingDropdown.value); + } else if (isCustom) { + assertEquals( + scalingElement.scalingValueEnum_.CUSTOM.toString(), + scalingDropdown.value); + } else { + assertEquals( + scalingElement.scalingValueEnum_.DEFAULT.toString(), + scalingDropdown.value); } + assertEquals(isCustom && !fitToPage, collapse.opened); + assertEquals(scalingDisplayValue, scalingInput.value); assertEquals(scalingValue, page.settings.scaling.value); assertEquals(scalingValid, page.settings.scaling.valid); - assertEquals(fitToPageDisplay, fitToPageCheckbox.checked); assertEquals(fitToPage, page.settings.fitToPage.value); + assertEquals(isCustom, page.settings.customScaling.value); }; // Set PDF so both scaling and fit to page are active. @@ -930,32 +949,41 @@ assertFalse(scalingElement.hidden); // Default is 100 - validateScalingState('100', true, false, false); + validateScalingState(false, '100', '100', true, false); - // Change to 105 - print_preview_test_utils.triggerInputEvent(scalingInput, '105'); - return test_util.eventToPromise('input-change', scalingElement) + // Select custom + scalingDropdown.value = + scalingElement.scalingValueEnum_.CUSTOM.toString(); + scalingDropdown.dispatchEvent(new CustomEvent('change')); + return test_util.eventToPromise('process-select-change', scalingElement) .then(function() { - validateScalingState('105', true, false, false); + validateScalingState(true, '100', '100', true, false); - // Change to fit to page. Should display fit to page scaling but not - // alter the scaling setting. - fitToPageCheckbox.checked = true; - fitToPageCheckbox.dispatchEvent(new CustomEvent('change')); - return test_util.eventToPromise( - 'update-checkbox-setting', scalingElement); - }) - .then(function(event) { - assertEquals('fitToPage', event.detail); - validateScalingState('105', true, true, true); - - // Set scaling. Should uncheck fit to page and set the settings for - // scaling and fit to page. - print_preview_test_utils.triggerInputEvent(scalingInput, '95'); + print_preview_test_utils.triggerInputEvent(scalingInput, '105'); return test_util.eventToPromise('input-change', scalingElement); }) .then(function() { - validateScalingState('95', true, false, false); + validateScalingState(true, '105', '105', true, false); + + // Change to fit to page. + scalingDropdown.value = + scalingElement.scalingValueEnum_.FIT_TO_PAGE.toString(); + scalingDropdown.dispatchEvent(new CustomEvent('change')); + return test_util.eventToPromise( + 'process-select-change', scalingElement); + }) + .then(function(event) { + validateScalingState(true, '105', '105', true, true); + + // Go back to custom. Restores 105 value. + scalingDropdown.value = + scalingElement.scalingValueEnum_.CUSTOM.toString(); + scalingDropdown.dispatchEvent(new CustomEvent('change')); + return test_util.eventToPromise( + 'process-select-change', scalingElement); + }) + .then(function() { + validateScalingState(true, '105', '105', true, false); // Set scaling to something invalid. Should change setting validity // but not value. @@ -963,48 +991,55 @@ return test_util.eventToPromise('input-change', scalingElement); }) .then(function() { - validateScalingState('95', false, false, false); + validateScalingState(true, '105', '5', false, false); - // Check fit to page. Should set scaling valid. - fitToPageCheckbox.checked = true; - fitToPageCheckbox.dispatchEvent(new CustomEvent('change')); + // Select fit to page. Should clear the invalid value. + scalingDropdown.value = + scalingElement.scalingValueEnum_.FIT_TO_PAGE.toString(); + scalingDropdown.dispatchEvent(new CustomEvent('change')); return test_util.eventToPromise( - 'update-checkbox-setting', scalingElement); + 'process-select-change', scalingElement); }) .then(function(event) { - assertEquals('fitToPage', event.detail); - validateScalingState('95', true, true, true); + validateScalingState(true, '105', '105', true, true); - // Uncheck fit to page. Should reset scaling to last valid. - fitToPageCheckbox.checked = false; - fitToPageCheckbox.dispatchEvent(new CustomEvent('change')); + // Custom scaling should set to last valid. + scalingDropdown.value = + scalingElement.scalingValueEnum_.CUSTOM.toString(); + scalingDropdown.dispatchEvent(new CustomEvent('change')); return test_util.eventToPromise( - 'update-checkbox-setting', scalingElement); + 'process-select-change', scalingElement); }) .then(function(event) { - assertEquals('fitToPage', event.detail); - validateScalingState('95', true, false, false); + validateScalingState(true, '105', '105', true, false); - // Change to fit to page. Should display fit to page scaling but not - // alter the scaling setting. - fitToPageCheckbox.checked = true; - fitToPageCheckbox.dispatchEvent(new CustomEvent('change')); - return test_util.eventToPromise( - 'update-checkbox-setting', scalingElement); - }) - .then(function(event) { - assertEquals('fitToPage', event.detail); - validateScalingState('95', true, true, true); - - // Enter something invalid in the scaling field. This should not - // change the stored value of scaling or fit to page, to avoid an - // unnecessary preview regeneration, but should display fit to page - // as unchecked. - print_preview_test_utils.triggerInputEvent(scalingInput, '9'); + // Set scaling to something invalid. Should change setting validity + // but not value. + print_preview_test_utils.triggerInputEvent(scalingInput, '500'); return test_util.eventToPromise('input-change', scalingElement); }) .then(function() { - validateScalingState('95', false, true, false); + validateScalingState(true, '105', '500', false, false); + + // Pick default scaling. This should clear the error. + scalingDropdown.value = + scalingElement.scalingValueEnum_.DEFAULT.toString(); + scalingDropdown.dispatchEvent(new CustomEvent('change')); + return test_util.eventToPromise( + 'process-select-change', scalingElement); + }) + .then(function(event) { + validateScalingState(false, '105', '105', true, false); + + // Custom scaling should set to last valid. + scalingDropdown.value = + scalingElement.scalingValueEnum_.CUSTOM.toString(); + scalingDropdown.dispatchEvent(new CustomEvent('change')); + return test_util.eventToPromise( + 'process-select-change', scalingElement); + }) + .then(function() { + validateScalingState(true, '105', '105', true, false); // Enter a blank value in the scaling field. This should not // change the stored value of scaling or fit to page, to avoid an @@ -1013,15 +1048,7 @@ return test_util.eventToPromise('input-change', scalingElement); }) .then(function() { - validateScalingState('95', false, true, false); - - // Entering something valid unsets fit to page and sets scaling - // valid to true. - print_preview_test_utils.triggerInputEvent(scalingInput, '90'); - return test_util.eventToPromise('input-change', scalingElement); - }) - .then(function() { - validateScalingState('90', true, false, false); + validateScalingState(true, '105', '', true, false); }); });
diff --git a/chrome/test/data/webui/print_preview/system_dialog_browsertest.js b/chrome/test/data/webui/print_preview/system_dialog_browsertest.js index bf376b5..237ebba 100644 --- a/chrome/test/data/webui/print_preview/system_dialog_browsertest.js +++ b/chrome/test/data/webui/print_preview/system_dialog_browsertest.js
@@ -83,21 +83,29 @@ assertFalse(scalingSettings.hidden); nativeLayer.resetResolver('getPreview'); - // Set scaling settings to a bad value - const scalingSettingsInput = - scalingSettings.$$('print-preview-number-settings-section') - .$.userValue.inputElement; - scalingSettingsInput.value = '0'; - scalingSettingsInput.dispatchEvent( - new CustomEvent('input', {composed: true, bubbles: true})); + // Set scaling settings to custom. + scalingSettings.$$('.md-select').value = + scalingSettings.scalingValueEnum_.CUSTOM; + scalingSettings.$$('.md-select').dispatchEvent(new CustomEvent('change')); + return nativeLayer.whenCalled('getPreview') + .then(() => { + nativeLayer.resetResolver('getPreview'); + // Set an invalid input. + const scalingSettingsInput = + scalingSettings.$$('print-preview-number-settings-section') + .$.userValue.inputElement; + scalingSettingsInput.value = '0'; + scalingSettingsInput.dispatchEvent( + new CustomEvent('input', {composed: true, bubbles: true})); - // No new preview - nativeLayer.whenCalled('getPreview').then(function() { - assertTrue(false); - }); + // No new preview + nativeLayer.whenCalled('getPreview').then(function() { + assertTrue(false); + }); - return test_util.eventToPromise('input-change', scalingSettings) - .then(function() { + return test_util.eventToPromise('input-change', scalingSettings); + }) + .then(() => { // Expect disabled print button const header = page.$$('print-preview-header'); const printButton = header.$$('.action-button');
diff --git a/chrome/test/data/xr/e2e_test_files/html/test_webxr_poses.html b/chrome/test/data/xr/e2e_test_files/html/test_webxr_poses.html index 9e02b4c..866a3e50 100644 --- a/chrome/test/data/xr/e2e_test_files/html/test_webxr_poses.html +++ b/chrome/test/data/xr/e2e_test_files/html/test_webxr_poses.html
@@ -50,11 +50,8 @@ let frame_data = frame_data_array[frame_id]; let pose = frame_data.getViewerPose(cached_frame_of_ref); if (!pose) { - // We can intermittently get null poses. For now treat them as passing, - // even though this should be fixed. - // TODO(https://crbug.com/859700): Make it so we don't get null poses unexpectedly. - console.log("null pose - unexpected, but pass"); - return true; + console.log("unexpected - null pose"); + return false; } console.log("checkFramePose: " + pose.transform.matrix + "\n" + expected);
diff --git a/chromecast/browser/cast_media_blocker.h b/chromecast/browser/cast_media_blocker.h index e7f228c..784878b 100644 --- a/chromecast/browser/cast_media_blocker.h +++ b/chromecast/browser/cast_media_blocker.h
@@ -38,6 +38,10 @@ void MediaSessionActionsChanged( const std::vector<media_session::mojom::MediaSessionAction>& action) override {} + void MediaSessionImagesChanged( + const base::flat_map<media_session::mojom::MediaSessionImageType, + std::vector<media_session::MediaImage>>& images) + override {} protected: bool media_loading_blocked() const { return blocked_; }
diff --git a/chromecast/browser/cast_web_view_default.cc b/chromecast/browser/cast_web_view_default.cc index 5dc61d5..da5b8639 100644 --- a/chromecast/browser/cast_web_view_default.cc +++ b/chromecast/browser/cast_web_view_default.cc
@@ -111,8 +111,7 @@ } void CastWebViewDefault::LoadUrl(GURL url) { - web_contents_->GetController().LoadURL(url, content::Referrer(), - ui::PAGE_TRANSITION_TYPED, ""); + cast_web_contents_.LoadUrl(url); } void CastWebViewDefault::ClosePage(const base::TimeDelta& shutdown_delay) {
diff --git a/chromecast/cast_shell_sandbox_policy b/chromecast/cast_shell_sandbox_policy index c0814ffd..6e36b50 100644 --- a/chromecast/cast_shell_sandbox_policy +++ b/chromecast/cast_shell_sandbox_policy
@@ -16,7 +16,6 @@ "fuchsia.ui.input.ImeVisibilityService", "fuchsia.ui.policy.Presenter", "fuchsia.ui.scenic.Scenic", - "fuchsia.ui.viewsv1.ViewManager", "fuchsia.vulkan.loader.Loader", "fuchsia.wlan.service.Wlan" ],
diff --git a/chromeos/BUILD.gn b/chromeos/BUILD.gn index 2b31d0f..17e520e 100644 --- a/chromeos/BUILD.gn +++ b/chromeos/BUILD.gn
@@ -278,7 +278,7 @@ # To diagnose tast failures or disable tests, see go/tast-failures tast_test("chrome_all_tast_tests") { # To disable a specific test, add it the following list. - tast_disabled_tests = [] + tast_disabled_tests = [ "security.Mtab" ] # crbug.com/931431 } tast_test("chrome_kevin_tast_tests") { # Tests that fail on Kevin devices.
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index 6de2a75..56e4b7ca 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -11668.0.0 \ No newline at end of file +11750.0.0 \ No newline at end of file
diff --git a/chromeos/constants/chromeos_switches.cc b/chromeos/constants/chromeos_switches.cc index e1d3d8a..580afe4 100644 --- a/chromeos/constants/chromeos_switches.cc +++ b/chromeos/constants/chromeos_switches.cc
@@ -519,6 +519,11 @@ // If true, files in Android internal storage will be hidden in Files app. const char kHideAndroidFilesInFilesApp[] = "hide-android-files-in-files-app"; +// This directory contains per-region subdirectories with regulatory label +// files. If this is not set, we fall back to the default directory +// '/usr/share/chromeos-assets/regulatory_labels' +const char kRegulatoryLabelDir[] = "regulatory-label-dir"; + // If true, the developer tool overlay will be shown for the login/lock screen. // This makes it easier to test layout logic. const char kShowLoginDevOverlay[] = "show-login-dev-overlay";
diff --git a/chromeos/constants/chromeos_switches.h b/chromeos/constants/chromeos_switches.h index 96c7e2f..b82b59dd 100644 --- a/chromeos/constants/chromeos_switches.h +++ b/chromeos/constants/chromeos_switches.h
@@ -140,6 +140,7 @@ CHROMEOS_EXPORT extern const char kOobeSkipToLogin[]; CHROMEOS_EXPORT extern const char kOobeTimerInterval[]; CHROMEOS_EXPORT extern const char kProfileRequiresPolicy[]; +CHROMEOS_EXPORT extern const char kRegulatoryLabelDir[]; CHROMEOS_EXPORT extern const char kRlzPingDelay[]; CHROMEOS_EXPORT extern const char kShelfHoverPreviews[]; CHROMEOS_EXPORT extern const char kShowAndroidFilesInFilesApp[];
diff --git a/chromeos/network/managed_state.h b/chromeos/network/managed_state.h index 1798c15..bb4058b 100644 --- a/chromeos/network/managed_state.h +++ b/chromeos/network/managed_state.h
@@ -14,12 +14,6 @@ #include "base/component_export.h" #include "base/macros.h" -namespace ash { -namespace network_icon { -class NetworkIconTest; -} // namespace network_icon -} // namesapce ash - namespace base { class Value; } @@ -124,7 +118,7 @@ private: friend class NetworkStateHandler; - friend class ash::network_icon::NetworkIconTest; + friend class NetworkStateTestHelper; friend class chromeos::tether::NetworkListSorterTest; ManagedType managed_type_;
diff --git a/chromeos/network/network_state_handler.cc b/chromeos/network/network_state_handler.cc index 853637e..4a2e1d2 100644 --- a/chromeos/network/network_state_handler.cc +++ b/chromeos/network/network_state_handler.cc
@@ -98,12 +98,14 @@ explicit ActiveNetworkState(const NetworkState* network) : guid_(network->guid()), connection_state_(network->connection_state()), - activation_state_(network->activation_state()) {} + activation_state_(network->activation_state()), + connect_requested_(network->connect_requested()) {} bool MatchesNetworkState(const NetworkState* network) { return guid_ == network->guid() && connection_state_ == network->connection_state() && - activation_state_ == network->activation_state(); + activation_state_ == network->activation_state() && + connect_requested_ == network->connect_requested(); } private: @@ -115,6 +117,8 @@ // Activating Cellular networks are frequently treated like connecting // networks in the UI, so we also track changes to Cellular activation state. const std::string activation_state_; + // The connect_requested state affects 'connecting' in the UI. + const bool connect_requested_; }; const char NetworkStateHandler::kDefaultCheckPortalList[] = @@ -1881,12 +1885,13 @@ void NetworkStateHandler::NotifyIfActiveNetworksChanged() { SCOPED_NET_LOG_IF_SLOW(); - NET_LOG(EVENT) << "NOTIFY:ActiveNetworksChanged"; NetworkStateList active_networks; GetActiveNetworkListByType(NetworkTypePattern::Default(), &active_networks); if (!ActiveNetworksChanged(active_networks)) return; + NET_LOG(EVENT) << "NOTIFY:ActiveNetworksChanged"; + active_network_list_.clear(); active_network_list_.reserve(active_networks.size()); for (const NetworkState* network : active_networks)
diff --git a/chromeos/network/network_state_handler.h b/chromeos/network/network_state_handler.h index 073e0c2f..7b7a467 100644 --- a/chromeos/network/network_state_handler.h +++ b/chromeos/network/network_state_handler.h
@@ -175,7 +175,7 @@ // network. Note: O(N). const NetworkState* FirstNetworkByType(const NetworkTypePattern& type); - // Sets the |connect_reqyested_| property of a NetworkState for + // Sets the |connect_requested_| property of a NetworkState for // |service_path| if it exists. This is used to inform the UI that a network // is connecting before the state is set in Shill. If |connect_requested| is // true, NetworkState::IsConnectingState() will return true. This will cause
diff --git a/chromeos/network/network_state_test_helper.cc b/chromeos/network/network_state_test_helper.cc index 1256204..078f577 100644 --- a/chromeos/network/network_state_test_helper.cc +++ b/chromeos/network/network_state_test_helper.cc
@@ -48,7 +48,6 @@ profile_test_->AddProfile("user_profile_path", kUserHash); base::RunLoop().RunUntilIdle(); - NetworkHandler::Initialize(); network_state_handler_ = NetworkStateHandler::InitializeForTest(); if (!use_default_devices_and_services) @@ -57,7 +56,6 @@ NetworkStateTestHelper::~NetworkStateTestHelper() { ShutdownNetworkState(); - NetworkHandler::Shutdown(); if (dbus_thread_manager_initialized_) DBusThreadManager::Shutdown(); } @@ -141,6 +139,21 @@ base::RunLoop().RunUntilIdle(); } +std::unique_ptr<NetworkState> +NetworkStateTestHelper::CreateStandaloneNetworkState( + const std::string& id, + const std::string& type, + const std::string& connection_state, + int signal_strength) { + auto network = std::make_unique<NetworkState>(id); + network->SetGuid(id); + network->set_type(type); + network->set_visible(true); + network->SetConnectionState(connection_state); + network->set_signal_strength(signal_strength); + return network; +} + const char* NetworkStateTestHelper::UserHash() { return kUserHash; }
diff --git a/chromeos/network/network_state_test_helper.h b/chromeos/network/network_state_test_helper.h index d5db0e7..068c42d0 100644 --- a/chromeos/network/network_state_test_helper.h +++ b/chromeos/network/network_state_test_helper.h
@@ -19,6 +19,10 @@ // Helper class for tests that use NetworkStateHandler. Handles initialization, // shutdown, and adds default profiles and a wifi device (but no services). +// NOTE: This is not intended to be used with NetworkHandler::Initialize() +// which constructs its own NetworkStateHandler instance. When testing code that +// accesses NetworkHandler::Get() directly, use +// NetworkHandler::Get()->network_state_handler() directly instead. class NetworkStateTestHelper { public: // If |use_default_devices_and_services| is false, the default devices and @@ -40,7 +44,8 @@ // Configures a new service using Shill properties from |shill_json_string| // which must include a GUID and Type. Returns the service path, or "" if the - // service could not be configured. + // service could not be configured. Note: the 'GUID' key is also used as the + // name of the service if no 'Name' key is provided. std::string ConfigureService(const std::string& shill_json_string); // Returns a string value for property |key| associated with |service_path|. @@ -52,6 +57,12 @@ const std::string& key, const base::Value& value); + std::unique_ptr<NetworkState> CreateStandaloneNetworkState( + const std::string& id, + const std::string& type, + const std::string& connection_state, + int signal_strength); + // Returns the hash used for the user profile. const char* UserHash();
diff --git a/chromeos/network/proxy/proxy_config_service_impl_unittest.cc b/chromeos/network/proxy/proxy_config_service_impl_unittest.cc index 7c30f72..646128a 100644 --- a/chromeos/network/proxy/proxy_config_service_impl_unittest.cc +++ b/chromeos/network/proxy/proxy_config_service_impl_unittest.cc
@@ -9,7 +9,8 @@ #include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "base/values.h" -#include "chromeos/network/network_state_test_helper.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/network/network_handler.h" #include "components/prefs/pref_service.h" #include "components/prefs/testing_pref_service.h" #include "components/proxy_config/pref_proxy_config_tracker_impl.h" @@ -47,17 +48,18 @@ class ProxyConfigServiceImplTest : public testing::Test { void SetUp() override { - helper_ = std::make_unique<NetworkStateTestHelper>( - true /* use_default_devices_and_services */); - // Ensure NetworkStateHandler::InitializeForTest() has completed. + DBusThreadManager::Initialize(); + chromeos::NetworkHandler::Initialize(); base::RunLoop().RunUntilIdle(); } - void TearDown() override { helper_.reset(); } + void TearDown() override { + chromeos::NetworkHandler::Shutdown(); + DBusThreadManager::Shutdown(); + } protected: base::test::ScopedTaskEnvironment environment_; - std::unique_ptr<NetworkStateTestHelper> helper_; }; // By default, ProxyConfigServiceImpl should ignore the state of the nested
diff --git a/chromeos/network/proxy/ui_proxy_config_service_unittest.cc b/chromeos/network/proxy/ui_proxy_config_service_unittest.cc index e63df92..28c8c76 100644 --- a/chromeos/network/proxy/ui_proxy_config_service_unittest.cc +++ b/chromeos/network/proxy/ui_proxy_config_service_unittest.cc
@@ -7,11 +7,16 @@ #include <memory> #include <utility> +#include "base/bind.h" +#include "base/bind_helpers.h" #include "base/json/json_reader.h" #include "base/strings/string_util.h" #include "base/test/scoped_task_environment.h" #include "base/values.h" -#include "chromeos/network/network_state_test_helper.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/shill_manager_client.h" +#include "chromeos/network/network_handler.h" +#include "chromeos/network/onc/onc_utils.h" #include "components/onc/onc_pref_names.h" #include "components/prefs/testing_pref_service.h" #include "components/proxy_config/pref_proxy_config_tracker_impl.h" @@ -97,20 +102,36 @@ base::test::ScopedTaskEnvironment::MainThreadType::UI) { PrefProxyConfigTrackerImpl::RegisterProfilePrefs(user_prefs_.registry()); PrefProxyConfigTrackerImpl::RegisterPrefs(local_state_.registry()); - onc::RegisterProfilePrefs(user_prefs_.registry()); - onc::RegisterPrefs(local_state_.registry()); + ::onc::RegisterProfilePrefs(user_prefs_.registry()); + ::onc::RegisterPrefs(local_state_.registry()); } void SetUp() override { - helper_.ConfigureService(kTestUserWifiConfig); - helper_.ConfigureService(kTestSharedWifiConfig); - helper_.ConfigureService(kTestUnconfiguredWifiConfig); + DBusThreadManager::Initialize(); + NetworkHandler::Initialize(); + ConfigureService(kTestUserWifiConfig); + ConfigureService(kTestSharedWifiConfig); + ConfigureService(kTestUnconfiguredWifiConfig); } - void TearDown() override {} + void TearDown() override { + NetworkHandler::Shutdown(); + DBusThreadManager::Shutdown(); + } ~UIProxyConfigServiceTest() override = default; + void ConfigureService(const std::string& shill_json_string) { + std::unique_ptr<base::DictionaryValue> shill_json_dict = + base::DictionaryValue::From( + onc::ReadDictionaryFromJson(shill_json_string)); + ASSERT_TRUE(shill_json_dict); + DBusThreadManager::Get()->GetShillManagerClient()->ConfigureService( + *shill_json_dict, base::DoNothing(), + base::Bind([](const std::string& name, const std::string& msg) {})); + base::RunLoop().RunUntilIdle(); + } + std::unique_ptr<UIProxyConfigService> CreateServiceOffLocalState() { return std::make_unique<UIProxyConfigService>(nullptr, &local_state_); } @@ -125,7 +146,6 @@ private: base::test::ScopedTaskEnvironment scoped_task_environment_; - NetworkStateTestHelper helper_{false /* use_default_devices_and_services */}; }; TEST_F(UIProxyConfigServiceTest, UnknownNetwork) {
diff --git a/components/download/internal/common/download_item_impl.cc b/components/download/internal/common/download_item_impl.cc index 3298533..831324a 100644 --- a/components/download/internal/common/download_item_impl.cc +++ b/components/download/internal/common/download_item_impl.cc
@@ -1278,6 +1278,10 @@ delegate_->Attach(); } +void DownloadItemImpl::SetDownloadId(uint32_t download_id) { + download_id_ = download_id; +} + // **** Download progression cascade void DownloadItemImpl::Init(bool active,
diff --git a/components/download/internal/common/download_stats.cc b/components/download/internal/common/download_stats.cc index fe44b54..ac8dc4c 100644 --- a/components/download/internal/common/download_stats.cc +++ b/components/download/internal/common/download_stats.cc
@@ -1204,4 +1204,9 @@ UMA_HISTOGRAM_ENUMERATION("Download.InProgressDB.Counts", type); } +void RecordDuplicateInProgressDownloadIdCount(int count) { + UMA_HISTOGRAM_CUSTOM_COUNTS("Download.DuplicateInProgressDownloadIdCount", + count, 1, 10, 11); +} + } // namespace download
diff --git a/components/download/internal/common/in_progress_download_manager.cc b/components/download/internal/common/in_progress_download_manager.cc index f2ddba9..a16657c 100644 --- a/components/download/internal/common/in_progress_download_manager.cc +++ b/components/download/internal/common/in_progress_download_manager.cc
@@ -171,6 +171,28 @@ url_download_handlers_.push_back(std::move(downloader)); } +bool InProgressDownloadManager::DownloadUrl( + std::unique_ptr<DownloadUrlParameters> params) { + DCHECK(!delegate_); + DCHECK(params->is_transient()); + + if (!url_loader_factory_getter_) + return false; + + if (params->require_safety_checks()) + return false; + + if (params->file_path().empty()) + return false; + + // Start the new download, the download should be saved to the file path + // specifcied in the |params|. + BeginDownload(std::move(params), url_loader_factory_getter_, + true /* is_new_download */, GURL() /* site_url */, + GURL() /* tab_url */, GURL() /* tab_referral_url */); + return true; +} + void InProgressDownloadManager::BeginDownload( std::unique_ptr<DownloadUrlParameters> params, scoped_refptr<DownloadURLLoaderFactoryGetter> url_loader_factory_getter, @@ -322,6 +344,10 @@ std::move(url_loader_factory_getter))); } else { std::string guid = info->guid; + if (info->is_new_download) { + in_progress_downloads_.push_back(std::make_unique<DownloadItemImpl>( + this, DownloadItem::kInvalidId, *info)); + } StartDownloadWithItem(std::move(stream), std::move(url_loader_factory_getter), std::move(info), GetInProgressDownload(guid), false); @@ -389,6 +415,8 @@ void InProgressDownloadManager::OnInitialized( bool success, std::unique_ptr<std::vector<DownloadDBEntry>> entries) { + std::set<uint32_t> download_ids; + int num_duplicates = 0; for (const auto& entry : *entries) { base::Optional<DownloadEntry> download_entry = CreateDownloadEntryFromDownloadDBEntry(entry); @@ -398,10 +426,21 @@ auto item = CreateDownloadItemImpl(this, entry); if (!item) continue; + uint32_t download_id = item->GetId(); + // Remove entries with duplicate ids. + if (download_id != DownloadItem::kInvalidId && + base::ContainsKey(download_ids, download_id)) { + RemoveInProgressDownload(item->GetGuid()); + num_duplicates++; + continue; + } item->AddObserver(download_db_cache_.get()); in_progress_downloads_.emplace_back(std::move(item)); + download_ids.insert(download_id); } } + if (num_duplicates > 0) + RecordDuplicateInProgressDownloadIdCount(num_duplicates); if (base::FeatureList::IsEnabled(features::kDownloadDBForNewDownloads)) OnAllInprogressDownloadsLoaded(); is_initialized_ = true;
diff --git a/components/download/public/common/download_item_impl.h b/components/download/public/common/download_item_impl.h index 4ede432..f92a018 100644 --- a/components/download/public/common/download_item_impl.h +++ b/components/download/public/common/download_item_impl.h
@@ -349,6 +349,8 @@ void SetDelegate(DownloadItemImplDelegate* delegate); + void SetDownloadId(uint32_t download_id); + const DownloadUrlParameters::RequestHeadersType& request_headers() const { return request_headers_; }
diff --git a/components/download/public/common/download_stats.h b/components/download/public/common/download_stats.h index 017084c..b01123d1 100644 --- a/components/download/public/common/download_stats.h +++ b/components/download/public/common/download_stats.h
@@ -408,6 +408,8 @@ COMPONENTS_DOWNLOAD_EXPORT void RecordInProgressDBCount( InProgressDBCountTypes type); +COMPONENTS_DOWNLOAD_EXPORT void RecordDuplicateInProgressDownloadIdCount( + int count); } // namespace download #endif // COMPONENTS_DOWNLOAD_PUBLIC_COMMON_DOWNLOAD_STATS_H_
diff --git a/components/download/public/common/download_url_parameters.cc b/components/download/public/common/download_url_parameters.cc index c7c6897..fd465914 100644 --- a/components/download/public/common/download_url_parameters.cc +++ b/components/download/public/common/download_url_parameters.cc
@@ -39,7 +39,8 @@ fetch_error_body_(false), transient_(false), traffic_annotation_(traffic_annotation), - download_source_(DownloadSource::UNKNOWN) {} + download_source_(DownloadSource::UNKNOWN), + require_safety_checks_(true) {} DownloadUrlParameters::~DownloadUrlParameters() = default;
diff --git a/components/download/public/common/download_url_parameters.h b/components/download/public/common/download_url_parameters.h index 214d419..eb9422c 100644 --- a/components/download/public/common/download_url_parameters.h +++ b/components/download/public/common/download_url_parameters.h
@@ -245,6 +245,12 @@ upload_callback_ = upload_callback; } + // Sets whether the download will require safety checks for its URL chain and + // downloaded content. + void set_require_safety_checks(bool require_safety_checks) { + require_safety_checks_ = require_safety_checks; + } + const OnStartedCallback& callback() const { return callback_; } bool content_initiated() const { return content_initiated_; } const std::string& last_modified() const { return last_modified_; } @@ -297,6 +303,7 @@ bool fetch_error_body() const { return fetch_error_body_; } bool is_transient() const { return transient_; } std::string guid() const { return guid_; } + bool require_safety_checks() const { return require_safety_checks_; } // STATE CHANGING: All save_info_ sub-objects will be in an indeterminate // state following this call. @@ -343,6 +350,7 @@ std::string request_origin_; DownloadSource download_source_; UploadProgressCallback upload_callback_; + bool require_safety_checks_; DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); };
diff --git a/components/download/public/common/in_progress_download_manager.h b/components/download/public/common/in_progress_download_manager.h index 563d97d..b72ef72 100644 --- a/components/download/public/common/in_progress_download_manager.h +++ b/components/download/public/common/in_progress_download_manager.h
@@ -76,6 +76,11 @@ const IsOriginSecureCallback& is_origin_secure_cb, const URLSecurityPolicy& url_security_policy); ~InProgressDownloadManager() override; + + // Download a URL given by the |params|. Returns true if the download could + // take place, or false otherwise. + bool DownloadUrl(std::unique_ptr<DownloadUrlParameters> params); + // Called to start a download. void BeginDownload( std::unique_ptr<DownloadUrlParameters> params,
diff --git a/components/drive/chromeos/drive_test_util.cc b/components/drive/chromeos/drive_test_util.cc index 62ff7b9e..15134271 100644 --- a/components/drive/chromeos/drive_test_util.cc +++ b/components/drive/chromeos/drive_test_util.cc
@@ -21,19 +21,5 @@ true); } -FakeNetworkChangeNotifier::FakeNetworkChangeNotifier() - : type_(CONNECTION_WIFI) { -} - -void FakeNetworkChangeNotifier::SetConnectionType(ConnectionType type) { - type_ = type; - NotifyObserversOfConnectionTypeChange(); -} - -net::NetworkChangeNotifier::ConnectionType -FakeNetworkChangeNotifier::GetCurrentConnectionType() const { - return type_; -} - } // namespace test_util } // namespace drive
diff --git a/components/drive/chromeos/drive_test_util.h b/components/drive/chromeos/drive_test_util.h index 81e37d04..e2b12ea 100644 --- a/components/drive/chromeos/drive_test_util.h +++ b/components/drive/chromeos/drive_test_util.h
@@ -67,20 +67,6 @@ // unregistered preference is referenced. void RegisterDrivePrefs(PrefRegistrySimple* pref_registry); -// Fake NetworkChangeNotifier implementation. -class FakeNetworkChangeNotifier : public net::NetworkChangeNotifier { - public: - FakeNetworkChangeNotifier(); - - void SetConnectionType(ConnectionType type); - - // NetworkChangeNotifier override. - ConnectionType GetCurrentConnectionType() const override; - - private: - net::NetworkChangeNotifier::ConnectionType type_; -}; - } // namespace test_util } // namespace drive
diff --git a/components/feed/content/feed_host_service.cc b/components/feed/content/feed_host_service.cc index d90e7f2..91ee794 100644 --- a/components/feed/content/feed_host_service.cc +++ b/components/feed/content/feed_host_service.cc
@@ -10,14 +10,12 @@ FeedHostService::FeedHostService( std::unique_ptr<FeedLoggingMetrics> logging_metrics, - std::unique_ptr<FeedImageManager> image_manager, std::unique_ptr<FeedNetworkingHost> networking_host, std::unique_ptr<FeedSchedulerHost> scheduler_host, std::unique_ptr<FeedContentDatabase> content_database, std::unique_ptr<FeedJournalDatabase> journal_database, std::unique_ptr<FeedOfflineHost> offline_host) : logging_metrics_(std::move(logging_metrics)), - image_manager_(std::move(image_manager)), networking_host_(std::move(networking_host)), scheduler_host_(std::move(scheduler_host)), content_database_(std::move(content_database)), @@ -26,10 +24,6 @@ FeedHostService::~FeedHostService() = default; -FeedImageManager* FeedHostService::GetImageManager() { - return image_manager_.get(); -} - FeedNetworkingHost* FeedHostService::GetNetworkingHost() { return networking_host_.get(); }
diff --git a/components/feed/content/feed_host_service.h b/components/feed/content/feed_host_service.h index bae43d5a..0550994 100644 --- a/components/feed/content/feed_host_service.h +++ b/components/feed/content/feed_host_service.h
@@ -10,7 +10,6 @@ #include "base/macros.h" #include "components/feed/content/feed_offline_host.h" #include "components/feed/core/feed_content_database.h" -#include "components/feed/core/feed_image_manager.h" #include "components/feed/core/feed_journal_database.h" #include "components/feed/core/feed_logging_metrics.h" #include "components/feed/core/feed_networking_host.h" @@ -27,7 +26,6 @@ class FeedHostService : public KeyedService { public: FeedHostService(std::unique_ptr<FeedLoggingMetrics> logging_metrics, - std::unique_ptr<FeedImageManager> image_manager, std::unique_ptr<FeedNetworkingHost> networking_host, std::unique_ptr<FeedSchedulerHost> scheduler_host, std::unique_ptr<FeedContentDatabase> content_database, @@ -36,7 +34,6 @@ ~FeedHostService() override; FeedLoggingMetrics* GetLoggingMetrics(); - FeedImageManager* GetImageManager(); FeedNetworkingHost* GetNetworkingHost(); FeedSchedulerHost* GetSchedulerHost(); FeedContentDatabase* GetContentDatabase(); @@ -45,7 +42,6 @@ private: std::unique_ptr<FeedLoggingMetrics> logging_metrics_; - std::unique_ptr<FeedImageManager> image_manager_; std::unique_ptr<FeedNetworkingHost> networking_host_; std::unique_ptr<FeedSchedulerHost> scheduler_host_; std::unique_ptr<FeedContentDatabase> content_database_;
diff --git a/components/feed/core/BUILD.gn b/components/feed/core/BUILD.gn index 68e34e0..4d7b5a3 100644 --- a/components/feed/core/BUILD.gn +++ b/components/feed/core/BUILD.gn
@@ -16,10 +16,6 @@ "feed_content_mutation.h", "feed_content_operation.cc", "feed_content_operation.h", - "feed_image_database.cc", - "feed_image_database.h", - "feed_image_manager.cc", - "feed_image_manager.h", "feed_journal_database.cc", "feed_journal_database.h", "feed_journal_mutation.cc", @@ -46,7 +42,6 @@ "//base", "//components/feed:feature_list", "//components/feed/core/proto", - "//components/image_fetcher/core:core", "//components/leveldb_proto", "//net", "//ui/base/mojo:mojo", @@ -80,8 +75,6 @@ sources = [ "feed_content_database_unittest.cc", "feed_content_mutation_unittest.cc", - "feed_image_database_unittest.cc", - "feed_image_manager_unittest.cc", "feed_journal_database_unittest.cc", "feed_journal_mutation_unittest.cc", "feed_logging_metrics_unittest.cc",
diff --git a/components/feed/core/feed_image_database.cc b/components/feed/core/feed_image_database.cc deleted file mode 100644 index 57601876..0000000 --- a/components/feed/core/feed_image_database.cc +++ /dev/null
@@ -1,247 +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/feed/core/feed_image_database.h" - -#include "base/bind.h" -#include "base/logging.h" -#include "base/sequenced_task_runner.h" -#include "base/system/sys_info.h" -#include "base/task/post_task.h" -#include "base/task/task_traits.h" -#include "base/threading/thread_task_runner_handle.h" -#include "base/time/clock.h" -#include "base/time/default_clock.h" -#include "base/time/time.h" -#include "components/feed/core/proto/cached_image.pb.h" -#include "components/feed/core/time_serialization.h" -#include "components/leveldb_proto/public/proto_database_provider.h" - -namespace feed { - -namespace { -// Statistics are logged to UMA with this string as part of histogram name. They -// can all be found under LevelDB.*.FeedImageDatabase. Changing this needs to -// synchronize with histograms.xml, AND will also become incompatible with older -// browsers still reporting the previous values. -const char kImageDatabaseUMAClientName[] = "FeedImageDatabase"; - -const char kImageDatabaseFolder[] = "images"; - -const size_t kDatabaseWriteBufferSizeBytes = 512 * 1024; -const size_t kDatabaseWriteBufferSizeBytesForLowEndDevice = 128 * 1024; -} // namespace - -FeedImageDatabase::FeedImageDatabase(const base::FilePath& database_dir) - : FeedImageDatabase( - database_dir, - leveldb_proto::ProtoDatabaseProvider::CreateUniqueDB< - CachedImageProto>(base::CreateSequencedTaskRunnerWithTraits( - {base::MayBlock(), base::TaskPriority::BEST_EFFORT, - base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})), - base::DefaultClock::GetInstance()) {} - -FeedImageDatabase::FeedImageDatabase( - const base::FilePath& database_dir, - std::unique_ptr<leveldb_proto::ProtoDatabase<CachedImageProto>> - image_database, - base::Clock* clock) - : database_status_(UNINITIALIZED), - image_database_(std::move(image_database)), - clock_(clock), - weak_ptr_factory_(this) { - leveldb_env::Options options = leveldb_proto::CreateSimpleOptions(); - if (base::SysInfo::IsLowEndDevice()) { - options.write_buffer_size = kDatabaseWriteBufferSizeBytesForLowEndDevice; - } else { - options.write_buffer_size = kDatabaseWriteBufferSizeBytes; - } - base::FilePath image_dir = database_dir.AppendASCII(kImageDatabaseFolder); - image_database_->Init( - kImageDatabaseUMAClientName, image_dir, options, - base::BindOnce(&FeedImageDatabase::OnDatabaseInitialized, - weak_ptr_factory_.GetWeakPtr())); -} - -FeedImageDatabase::~FeedImageDatabase() = default; - -bool FeedImageDatabase::IsInitialized() { - return INITIALIZED == database_status_; -} - -void FeedImageDatabase::SaveImage(const std::string& url, - const std::string& image_data) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - - // If database is not ready, ignore the request. - if (!IsInitialized()) - return; - - CachedImageProto image_proto; - image_proto.set_url(url); - image_proto.set_data(image_data); - image_proto.set_last_used_time(ToDatabaseTime(clock_->Now())); - - SaveImageImpl(url, image_proto); -} - -void FeedImageDatabase::LoadImage(const std::string& url, - FeedImageDatabaseCallback callback) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - - switch (database_status_) { - case INITIALIZED: - case INIT_FAILURE: - LoadImageImpl(url, std::move(callback)); - break; - case UNINITIALIZED: - pending_image_callbacks_.emplace_back(url, std::move(callback)); - break; - default: - NOTREACHED(); - } -} - -void FeedImageDatabase::DeleteImage(const std::string& url) { - DeleteImageImpl(url, base::BindOnce(&FeedImageDatabase::OnImageUpdated, - weak_ptr_factory_.GetWeakPtr())); -} - -void FeedImageDatabase::GarbageCollectImages( - base::Time expired_time, - FeedImageDatabaseOperationCallback callback) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - - // If database is not initialized yet, ignore the request. - if (!IsInitialized()) { - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), false)); - return; - } - - image_database_->LoadEntries(base::BindOnce( - &FeedImageDatabase::GarbageCollectImagesImpl, - weak_ptr_factory_.GetWeakPtr(), expired_time, std::move(callback))); -} - -void FeedImageDatabase::OnDatabaseInitialized(bool success) { - DCHECK_EQ(database_status_, UNINITIALIZED); - - if (success) { - database_status_ = INITIALIZED; - } else { - database_status_ = INIT_FAILURE; - DVLOG(1) << "FeedImageDatabase init failed."; - } - - ProcessPendingImageLoads(); -} - -void FeedImageDatabase::ProcessPendingImageLoads() { - DCHECK_NE(database_status_, UNINITIALIZED); - - for (auto& image_callback : pending_image_callbacks_) - LoadImageImpl(image_callback.first, std::move(image_callback.second)); - - pending_image_callbacks_.clear(); -} - -void FeedImageDatabase::SaveImageImpl(std::string url, - const CachedImageProto& image_proto) { - auto entries_to_save = std::make_unique<ImageKeyEntryVector>(); - entries_to_save->emplace_back(std::move(url), image_proto); - - image_database_->UpdateEntries( - std::move(entries_to_save), std::make_unique<std::vector<std::string>>(), - base::BindOnce(&FeedImageDatabase::OnImageUpdated, - weak_ptr_factory_.GetWeakPtr())); -} - -void FeedImageDatabase::OnImageLoaded(std::string url, - FeedImageDatabaseCallback callback, - bool success, - std::unique_ptr<CachedImageProto> entry) { - if (!success || !entry) { - DVLOG_IF(1, !success) << "FeedImageDatabase load failed."; - std::move(callback).Run(std::string()); - return; - } - - DCHECK_EQ(url, entry->url()); - std::move(callback).Run(entry->data()); - - // Update timestamp for image. - entry->set_last_used_time(ToDatabaseTime(clock_->Now())); - SaveImageImpl(std::move(url), *entry); -} - -void FeedImageDatabase::LoadImageImpl(const std::string& url, - FeedImageDatabaseCallback callback) { - DCHECK_NE(database_status_, UNINITIALIZED); - - if (IsInitialized()) { - image_database_->GetEntry( - url, base::BindOnce(&FeedImageDatabase::OnImageLoaded, - weak_ptr_factory_.GetWeakPtr(), url, - std::move(callback))); - } else { - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), std::string())); - } -} - -void FeedImageDatabase::OnImageUpdated(bool success) { - DVLOG_IF(1, !success) << "FeedImageDatabase update failed."; -} - -void FeedImageDatabase::DeleteImageImpl( - const std::string& url, - FeedImageDatabaseOperationCallback callback) { - image_database_->UpdateEntries( - std::make_unique<ImageKeyEntryVector>(), - std::make_unique<std::vector<std::string>>(1, url), std::move(callback)); -} - -void FeedImageDatabase::GarbageCollectImagesImpl( - base::Time expired_time, - FeedImageDatabaseOperationCallback callback, - bool load_entries_success, - std::unique_ptr<std::vector<CachedImageProto>> image_entries) { - if (!load_entries_success) { - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(&FeedImageDatabase::OnGarbageCollectionDone, - weak_ptr_factory_.GetWeakPtr(), - std::move(callback), false)); - return; - } - - int64_t expired_database_time = ToDatabaseTime(expired_time); - auto keys_to_remove = std::make_unique<std::vector<std::string>>(); - for (const CachedImageProto& image : *image_entries) { - if (image.last_used_time() < expired_database_time) { - keys_to_remove->emplace_back(image.url()); - } - } - - if (keys_to_remove->empty()) { - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), true)); - return; - } - - image_database_->UpdateEntries( - std::make_unique<ImageKeyEntryVector>(), std::move(keys_to_remove), - base::BindOnce(&FeedImageDatabase::OnGarbageCollectionDone, - weak_ptr_factory_.GetWeakPtr(), std::move(callback))); -} - -void FeedImageDatabase::OnGarbageCollectionDone( - FeedImageDatabaseOperationCallback callback, - bool success) { - DVLOG_IF(1, !success) << "FeedImageDatabase garbage collection failed."; - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), success)); -} - -} // namespace feed
diff --git a/components/feed/core/feed_image_database.h b/components/feed/core/feed_image_database.h deleted file mode 100644 index 90c8a39..0000000 --- a/components/feed/core/feed_image_database.h +++ /dev/null
@@ -1,136 +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 COMPONENTS_FEED_CORE_FEED_IMAGE_DATABASE_H_ -#define COMPONENTS_FEED_CORE_FEED_IMAGE_DATABASE_H_ - -#include <memory> -#include <string> -#include <utility> -#include <vector> - -#include "base/memory/weak_ptr.h" -#include "components/leveldb_proto/public/proto_database.h" - -namespace base { -class Clock; -} // namespace base - -namespace feed { - -class CachedImageProto; - -// FeedImageDatabase is leveldb backed store for feed's image data. -// FeedImageDatabase keeps images identified by URLs. -// Save and Load operations are asynchronous, every load operation will update -// last_used_time for the image for garbage collection purpose. -class FeedImageDatabase { - public: - enum State { - UNINITIALIZED, - INITIALIZED, - INIT_FAILURE, - }; - - // Returns the resulting raw image data as std::string of a |LoadImage| call. - using FeedImageDatabaseCallback = - base::OnceCallback<void(const std::string&)>; - - using FeedImageDatabaseOperationCallback = base::OnceCallback<void(bool)>; - - // Initializes the database with |database_dir|. - explicit FeedImageDatabase(const base::FilePath& database_dir); - // Initializes the database with |database_dir|. Creates storage using the - // given |image_database| for local storage. Useful for testing. - FeedImageDatabase( - const base::FilePath& database_dir, - std::unique_ptr<leveldb_proto::ProtoDatabase<CachedImageProto>> - image_database, - base::Clock* clock); - ~FeedImageDatabase(); - - // Returns true if initialization has finished successfully, else false. - // While this is false, initialization may already started, or initialization - // failed. - bool IsInitialized(); - - // Adds or updates the image data for the |url|. - // If the database is not initialized or in some error status, the call will - // be ignored. - void SaveImage(const std::string& url, const std::string& image_data); - - // Loads the image data for the |url| and passes it to |callback|. - // |callback| will be called in the same thread as this function called. - // If the image cannot be found in database, or database error, returns an - // empty CachedImageProto. If the database is not initialized yet, the - // request will be pending until the database has been initialized. - void LoadImage(const std::string& url, FeedImageDatabaseCallback callback); - - // Deletes the image data for the |url|. - void DeleteImage(const std::string& url); - - // Delete all images whose |last_used_time| is older than |expired_time| and - // passes the result to |callback|. |callback| will be called in the same - // thread as this function called. If database is not initialized, or failed - // to delete expired entry, false will be passed to |callback|. - void GarbageCollectImages(base::Time expired_time, - FeedImageDatabaseOperationCallback callback); - - private: - friend class FeedImageDatabaseTest; - - using ImageKeyEntryVector = - leveldb_proto::ProtoDatabase<CachedImageProto>::KeyEntryVector; - - // Initialization - void OnDatabaseInitialized(bool success); - void ProcessPendingImageLoads(); - - // Saving - void SaveImageImpl(std::string url, const CachedImageProto& image_proto); - void OnImageUpdated(bool success); - - // Loading - void LoadImageImpl(const std::string& url, - FeedImageDatabaseCallback callback); - void OnImageLoaded(std::string url, - FeedImageDatabaseCallback callback, - bool success, - std::unique_ptr<CachedImageProto> entry); - - // Deleting - void DeleteImageImpl(const std::string& url, - FeedImageDatabaseOperationCallback callback); - - // Garbage collection - void GarbageCollectImagesImpl( - base::Time expired_time, - FeedImageDatabaseOperationCallback callback, - bool load_entries_success, - std::unique_ptr<std::vector<CachedImageProto>> image_entries); - void OnGarbageCollectionDone(FeedImageDatabaseOperationCallback callback, - bool success); - - State database_status_; - - std::unique_ptr<leveldb_proto::ProtoDatabase<CachedImageProto>> - image_database_; - - // Used to access current time, injected for testing. - base::Clock* clock_; - - std::vector<std::pair<std::string, FeedImageDatabaseCallback>> - pending_image_callbacks_; - - // Used to check that functions are called on the correct sequence. - SEQUENCE_CHECKER(sequence_checker_); - - base::WeakPtrFactory<FeedImageDatabase> weak_ptr_factory_; - - DISALLOW_COPY_AND_ASSIGN(FeedImageDatabase); -}; - -} // namespace feed - -#endif // COMPONENTS_FEED_CORE_FEED_IMAGE_DATABASE_H_
diff --git a/components/feed/core/feed_image_database_unittest.cc b/components/feed/core/feed_image_database_unittest.cc deleted file mode 100644 index 62aea7b..0000000 --- a/components/feed/core/feed_image_database_unittest.cc +++ /dev/null
@@ -1,303 +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/feed/core/feed_image_database.h" - -#include <map> - -#include "base/bind.h" -#include "base/test/scoped_task_environment.h" -#include "base/test/simple_test_clock.h" -#include "components/feed/core/proto/cached_image.pb.h" -#include "components/feed/core/time_serialization.h" -#include "components/leveldb_proto/testing/fake_db.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -using leveldb_proto::test::FakeDB; -using testing::Mock; -using testing::_; - -namespace feed { - -namespace { - -// Fixed "now" to make tests more deterministic. -char kNowString[] = "2018-06-11 15:41"; - -constexpr char kImageURL[] = "http://pie.com/"; -constexpr char kImageData[] = "pie image"; - -} // namespace - -class FeedImageDatabaseTest : public testing::Test { - public: - FeedImageDatabaseTest() : image_db_(nullptr) { - base::Time now; - EXPECT_TRUE(base::Time::FromUTCString(kNowString, &now)); - test_clock_.SetNow(now); - } - - void CreateDatabase() { - // The FakeDBs are owned by |feed_db_|, so clear our pointers before - // resetting |feed_db_| itself. - image_db_ = nullptr; - // Explicitly destroy any existing database before creating a new one. - feed_db_.reset(); - - auto image_db = - std::make_unique<FakeDB<CachedImageProto>>(&image_db_storage_); - - image_db_ = image_db.get(); - feed_db_ = std::make_unique<FeedImageDatabase>( - base::FilePath(), std::move(image_db), &test_clock_); - } - - int64_t GetImageLastUsedTime(const std::string& url) { - return image_db_storage_[kImageURL].last_used_time(); - } - - void InjectImageProto(const std::string& url, - const std::string& data, - base::Time time) { - CachedImageProto image_proto; - image_proto.set_url(url); - image_proto.set_data(data); - image_proto.set_last_used_time(ToDatabaseTime(time)); - image_db_storage_[url] = image_proto; - } - - FakeDB<CachedImageProto>* image_db() { return image_db_; } - FeedImageDatabase* db() { return feed_db_.get(); } - base::SimpleTestClock* test_clock() { return &test_clock_; } - - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } - - MOCK_METHOD1(OnImageLoaded, void(const std::string&)); - MOCK_METHOD1(OnGarbageCollected, void(bool)); - - private: - base::test::ScopedTaskEnvironment scoped_task_environment_; - - std::map<std::string, CachedImageProto> image_db_storage_; - - // Owned by |feed_db_|. - FakeDB<CachedImageProto>* image_db_; - - base::SimpleTestClock test_clock_; - - std::unique_ptr<FeedImageDatabase> feed_db_; - - DISALLOW_COPY_AND_ASSIGN(FeedImageDatabaseTest); -}; - -TEST_F(FeedImageDatabaseTest, Init) { - ASSERT_FALSE(db()); - - CreateDatabase(); - EXPECT_FALSE(db()->IsInitialized()); - - image_db()->InitCallback(true); - - EXPECT_TRUE(db()->IsInitialized()); -} - -TEST_F(FeedImageDatabaseTest, LoadBeforeInitSuccess) { - CreateDatabase(); - EXPECT_FALSE(db()->IsInitialized()); - - // Start an image load before the database is initialized. - db()->LoadImage(kImageURL, - base::BindOnce(&FeedImageDatabaseTest::OnImageLoaded, - base::Unretained(this))); - - EXPECT_CALL(*this, OnImageLoaded(_)); - - image_db()->InitCallback(true); - EXPECT_TRUE(db()->IsInitialized()); - image_db()->GetCallback(true); -} - -TEST_F(FeedImageDatabaseTest, LoadBeforeInitFailed) { - CreateDatabase(); - EXPECT_FALSE(db()->IsInitialized()); - - // Start an image load before the database is initialized. - db()->LoadImage(kImageURL, - base::BindOnce(&FeedImageDatabaseTest::OnImageLoaded, - base::Unretained(this))); - - EXPECT_CALL(*this, OnImageLoaded(_)); - - image_db()->InitCallback(false); - EXPECT_FALSE(db()->IsInitialized()); - RunUntilIdle(); -} - -TEST_F(FeedImageDatabaseTest, LoadAfterInitSuccess) { - CreateDatabase(); - EXPECT_FALSE(db()->IsInitialized()); - - EXPECT_CALL(*this, OnImageLoaded(_)).Times(0); - - image_db()->InitCallback(true); - EXPECT_TRUE(db()->IsInitialized()); - - Mock::VerifyAndClearExpectations(this); - - EXPECT_CALL(*this, OnImageLoaded(_)); - db()->LoadImage(kImageURL, - base::BindOnce(&FeedImageDatabaseTest::OnImageLoaded, - base::Unretained(this))); - image_db()->GetCallback(true); -} - -TEST_F(FeedImageDatabaseTest, LoadAfterInitFailed) { - CreateDatabase(); - EXPECT_FALSE(db()->IsInitialized()); - - EXPECT_CALL(*this, OnImageLoaded(_)).Times(0); - - image_db()->InitCallback(false); - EXPECT_FALSE(db()->IsInitialized()); - - Mock::VerifyAndClearExpectations(this); - - EXPECT_CALL(*this, OnImageLoaded(_)); - db()->LoadImage(kImageURL, - base::BindOnce(&FeedImageDatabaseTest::OnImageLoaded, - base::Unretained(this))); - RunUntilIdle(); -} - -TEST_F(FeedImageDatabaseTest, Save) { - CreateDatabase(); - image_db()->InitCallback(true); - ASSERT_TRUE(db()->IsInitialized()); - - // Store an image. - db()->SaveImage(kImageURL, kImageData); - image_db()->UpdateCallback(true); - - // Make sure they're there. - EXPECT_CALL(*this, OnImageLoaded(kImageData)); - db()->LoadImage(kImageURL, - base::BindOnce(&FeedImageDatabaseTest::OnImageLoaded, - base::Unretained(this))); - image_db()->GetCallback(true); -} - -TEST_F(FeedImageDatabaseTest, SavePersist) { - CreateDatabase(); - image_db()->InitCallback(true); - ASSERT_TRUE(db()->IsInitialized()); - - // Store an image. - db()->SaveImage(kImageURL, kImageData); - image_db()->UpdateCallback(true); - - // They should still exist after recreating the database. - CreateDatabase(); - image_db()->InitCallback(true); - ASSERT_TRUE(db()->IsInitialized()); - - EXPECT_CALL(*this, OnImageLoaded(kImageData)); - db()->LoadImage(kImageURL, - base::BindOnce(&FeedImageDatabaseTest::OnImageLoaded, - base::Unretained(this))); - image_db()->GetCallback(true); -} - -TEST_F(FeedImageDatabaseTest, LoadUpdatesTime) { - CreateDatabase(); - image_db()->InitCallback(true); - ASSERT_TRUE(db()->IsInitialized()); - - // Store an image. - InjectImageProto(kImageURL, kImageData, base::Time::UnixEpoch()); - - int64_t old_time = GetImageLastUsedTime(kImageURL); - // Make sure they're there. - EXPECT_CALL(*this, OnImageLoaded(kImageData)); - db()->LoadImage(kImageURL, - base::BindOnce(&FeedImageDatabaseTest::OnImageLoaded, - base::Unretained(this))); - image_db()->GetCallback(true); - image_db()->UpdateCallback(true); - EXPECT_TRUE(old_time != GetImageLastUsedTime(kImageURL)); -} - -TEST_F(FeedImageDatabaseTest, Delete) { - CreateDatabase(); - image_db()->InitCallback(true); - ASSERT_TRUE(db()->IsInitialized()); - - // Store the image. - db()->SaveImage(kImageURL, kImageData); - image_db()->UpdateCallback(true); - - // Make sure the image is there. - EXPECT_CALL(*this, OnImageLoaded(kImageData)); - db()->LoadImage(kImageURL, - base::BindOnce(&FeedImageDatabaseTest::OnImageLoaded, - base::Unretained(this))); - image_db()->GetCallback(true); - - Mock::VerifyAndClearExpectations(this); - - // Delete the image. - db()->DeleteImage(kImageURL); - image_db()->UpdateCallback(true); - - // Make sure the image is gone. - EXPECT_CALL(*this, OnImageLoaded(std::string())); - db()->LoadImage(kImageURL, - base::BindOnce(&FeedImageDatabaseTest::OnImageLoaded, - base::Unretained(this))); - image_db()->GetCallback(true); -} - -TEST_F(FeedImageDatabaseTest, GarbageCollectImagesTest) { - CreateDatabase(); - image_db()->InitCallback(true); - ASSERT_TRUE(db()->IsInitialized()); - - base::Time now = test_clock()->Now(); - base::Time expired_time = now - base::TimeDelta::FromDays(30); - base::Time very_old_time = now - base::TimeDelta::FromDays(100); - - // Store images. - InjectImageProto("url1", "data1", very_old_time); - InjectImageProto("url2", "data2", now); - InjectImageProto("url3", "data3", very_old_time); - - // Garbage collect all except the second. - EXPECT_CALL(*this, OnGarbageCollected(true)); - db()->GarbageCollectImages( - expired_time, base::BindOnce(&FeedImageDatabaseTest::OnGarbageCollected, - base::Unretained(this))); - // This will first load all images, then delete the expired ones. - image_db()->LoadCallback(true); - image_db()->UpdateCallback(true); - RunUntilIdle(); - - // Make sure the images are gone. - EXPECT_CALL(*this, OnImageLoaded(std::string())); - db()->LoadImage("url1", base::BindOnce(&FeedImageDatabaseTest::OnImageLoaded, - base::Unretained(this))); - image_db()->GetCallback(true); - - EXPECT_CALL(*this, OnImageLoaded(std::string())); - db()->LoadImage("url3", base::BindOnce(&FeedImageDatabaseTest::OnImageLoaded, - base::Unretained(this))); - image_db()->GetCallback(true); - - // Make sure the second still exists. - EXPECT_CALL(*this, OnImageLoaded("data2")); - db()->LoadImage("url2", base::BindOnce(&FeedImageDatabaseTest::OnImageLoaded, - base::Unretained(this))); - image_db()->GetCallback(true); -} - -} // namespace feed
diff --git a/components/feed/core/feed_image_manager.cc b/components/feed/core/feed_image_manager.cc deleted file mode 100644 index 33e7a6a..0000000 --- a/components/feed/core/feed_image_manager.cc +++ /dev/null
@@ -1,300 +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/feed/core/feed_image_manager.h" - -#include <utility> - -#include "base/bind.h" -#include "base/metrics/histogram_macros.h" -#include "base/threading/thread_task_runner_handle.h" -#include "base/timer/elapsed_timer.h" -#include "components/feed/core/time_serialization.h" -#include "components/image_fetcher/core/image_decoder.h" -#include "components/image_fetcher/core/image_fetcher.h" -#include "ui/gfx/geometry/size.h" -#include "ui/gfx/image/image.h" - -namespace feed { - -namespace { - -// Keep in sync with DIMENSION_UNKNOWN in third_party/feed/src/main/java/com/ -// google/android/libraries/feed/host/imageloader/ImageLoaderApi.java. -const int DIMENSION_UNKNOWN = -1; - -const int kDefaultGarbageCollectionExpiredDays = 30; -const int kLongGarbageCollectionInterval = 12 * 60 * 60; // 12 hours -const int kShortGarbageCollectionInterval = 5 * 60; // 5 minutes - -const char kImageFetcherUmaClient[] = "FeedImageManager"; - -constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation = - net::DefineNetworkTrafficAnnotation("feed_image_fetcher", R"( - semantics { - sender: "Feed Library Image Fetch" - description: - "Retrieves images for content suggestions, for display on the " - "New Tab page." - trigger: - "Triggered when the user looks at a content suggestion (and its " - "thumbnail isn't cached yet)." - data: "None." - destination: GOOGLE_OWNED_SERVICE - } - policy { - cookies_allowed: NO - setting: - "This can be disabled from the New Tab Page by collapsing the " - "articles section." - chrome_policy { - NTPContentSuggestionsEnabled { - NTPContentSuggestionsEnabled: false - } - } - })"); - -void ReportFetchResult(FeedImageFetchResult result) { - UMA_HISTOGRAM_ENUMERATION("ContentSuggestions.Feed.Image.FetchResult", - result); -} - -gfx::Size CreateGfxSize(int width_px, int height_px) { - DCHECK_GE(width_px, DIMENSION_UNKNOWN); - DCHECK_GE(height_px, DIMENSION_UNKNOWN); - - // Only resize the image when both |width_px| and |height_px| are available. - if (width_px == DIMENSION_UNKNOWN || height_px == DIMENSION_UNKNOWN) { - return gfx::Size(); - } - return gfx::Size(width_px, height_px); -} - -} // namespace - -FeedImageManager::FeedImageManager( - std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher, - std::unique_ptr<FeedImageDatabase> image_database) - : image_garbage_collected_day_(FromDatabaseTime(0)), - image_fetcher_(std::move(image_fetcher)), - image_database_(std::move(image_database)), - weak_ptr_factory_(this) { - DoGarbageCollectionIfNeeded(); -} - -FeedImageManager::~FeedImageManager() { - StopGarbageCollection(); -} - -void FeedImageManager::FetchImage(std::vector<std::string> urls, - int width_px, - int height_px, - ImageFetchedCallback callback) { - DCHECK(image_database_); - - FetchImagesFromDatabase(0, std::move(urls), width_px, height_px, - std::move(callback)); -} - -void FeedImageManager::FetchImagesFromDatabase(size_t url_index, - std::vector<std::string> urls, - int width_px, - int height_px, - ImageFetchedCallback callback) { - if (url_index >= urls.size()) { - // Already reached the last entry. Return an empty image. - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), gfx::Image(), -1)); - return; - } - - const std::string& image_id = urls[url_index]; - // Only take the first instance of the url so we get the worst-case time. - if (url_timers_.find(image_id) == url_timers_.end()) { - url_timers_.insert(std::make_pair(image_id, base::ElapsedTimer())); - } - image_database_->LoadImage( - image_id, - base::BindOnce(&FeedImageManager::OnImageFetchedFromDatabase, - weak_ptr_factory_.GetWeakPtr(), url_index, std::move(urls), - width_px, height_px, std::move(callback))); -} - -void FeedImageManager::OnImageFetchedFromDatabase( - size_t url_index, - std::vector<std::string> urls, - int width_px, - int height_px, - ImageFetchedCallback callback, - const std::string& image_data) { - if (image_data.empty()) { - // Fetching from the DB failed; start a network fetch. - FetchImageFromNetwork(url_index, std::move(urls), width_px, height_px, - std::move(callback)); - return; - } - - image_fetcher_->GetImageDecoder()->DecodeImage( - image_data, CreateGfxSize(width_px, height_px), - base::BindRepeating(&FeedImageManager::OnImageDecodedFromDatabase, - weak_ptr_factory_.GetWeakPtr(), url_index, - std::move(urls), width_px, height_px, - base::Passed(std::move(callback)))); -} - -void FeedImageManager::OnImageDecodedFromDatabase(size_t url_index, - std::vector<std::string> urls, - int width_px, - int height_px, - ImageFetchedCallback callback, - const gfx::Image& image) { - const std::string& image_id = urls[url_index]; - if (image.IsEmpty()) { - // If decoding the image failed, delete the DB entry. - image_database_->DeleteImage(image_id); - FetchImageFromNetwork(url_index, std::move(urls), width_px, height_px, - std::move(callback)); - return; - } - - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), image, url_index)); - - // Report success if the url exists. - // This check is for concurrent access to the same url. - if (url_timers_.find(image_id) != url_timers_.end()) { - UMA_HISTOGRAM_TIMES("ContentSuggestions.Feed.Image.LoadFromCacheTime", - url_timers_[image_id].Elapsed()); - ClearUmaTimer(image_id); - ReportFetchResult(FeedImageFetchResult::kSuccessCached); - } -} - -void FeedImageManager::FetchImageFromNetwork(size_t url_index, - std::vector<std::string> urls, - int width_px, - int height_px, - ImageFetchedCallback callback) { - const std::string& image_id = urls[url_index]; - GURL url(image_id); - if (!url.is_valid()) { - // Report failure. - ReportFetchResult(FeedImageFetchResult::kFailure); - ClearUmaTimer(image_id); - - // url is not valid, go to next URL. - FetchImagesFromDatabase(url_index + 1, std::move(urls), width_px, height_px, - std::move(callback)); - return; - } - - image_fetcher::ImageFetcherParams params(kTrafficAnnotation, - kImageFetcherUmaClient); - image_fetcher_->FetchImageData( - url, - base::BindOnce(&FeedImageManager::OnImageFetchedFromNetwork, - weak_ptr_factory_.GetWeakPtr(), url_index, std::move(urls), - width_px, height_px, std::move(callback)), - params); -} - -void FeedImageManager::OnImageFetchedFromNetwork( - size_t url_index, - std::vector<std::string> urls, - int width_px, - int height_px, - ImageFetchedCallback callback, - const std::string& image_data, - const image_fetcher::RequestMetadata& request_metadata) { - if (image_data.empty()) { - // Report failure. - ReportFetchResult(FeedImageFetchResult::kFailure); - ClearUmaTimer(urls[url_index]); - - // Fetching image failed, let's move to the next url. - FetchImagesFromDatabase(url_index + 1, std::move(urls), width_px, height_px, - std::move(callback)); - return; - } - - image_fetcher_->GetImageDecoder()->DecodeImage( - image_data, CreateGfxSize(width_px, height_px), - base::BindRepeating(&FeedImageManager::OnImageDecodedFromNetwork, - weak_ptr_factory_.GetWeakPtr(), url_index, - std::move(urls), width_px, height_px, - base::Passed(std::move(callback)), image_data)); -} - -void FeedImageManager::OnImageDecodedFromNetwork(size_t url_index, - std::vector<std::string> urls, - int width_px, - int height_px, - ImageFetchedCallback callback, - const std::string& image_data, - const gfx::Image& image) { - std::string image_id = urls[url_index]; - if (image.IsEmpty()) { - // Report failure. - ReportFetchResult(FeedImageFetchResult::kFailure); - ClearUmaTimer(image_id); - - // Decoding failed, let's move to the next url. - FetchImagesFromDatabase(url_index + 1, std::move(urls), width_px, height_px, - std::move(callback)); - return; - } - - image_database_->SaveImage(image_id, image_data); - - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), image, url_index)); - - // Report success if the url exists. - // This check is for concurrent access to the same url. - if (url_timers_.find(image_id) != url_timers_.end()) { - UMA_HISTOGRAM_TIMES("ContentSuggestions.Feed.Image.LoadFromNetworkTime", - url_timers_[image_id].Elapsed()); - ClearUmaTimer(image_id); - ReportFetchResult(FeedImageFetchResult::kSuccessFetched); - } -} - -void FeedImageManager::DoGarbageCollectionIfNeeded() { - // For saving resource purpose(ex. cpu, battery), We round up garbage - // collection age to day, so we only run GC once a day. - base::Time to_be_expired = - base::Time::Now().LocalMidnight() - - base::TimeDelta::FromDays(kDefaultGarbageCollectionExpiredDays); - if (image_garbage_collected_day_ != to_be_expired) { - image_database_->GarbageCollectImages( - to_be_expired, - base::BindOnce(&FeedImageManager::OnGarbageCollectionDone, - weak_ptr_factory_.GetWeakPtr(), to_be_expired)); - } -} - -void FeedImageManager::OnGarbageCollectionDone(base::Time garbage_collected_day, - bool success) { - base::TimeDelta gc_delay = - base::TimeDelta::FromSeconds(kShortGarbageCollectionInterval); - if (success) { - if (image_garbage_collected_day_ < garbage_collected_day) - image_garbage_collected_day_ = garbage_collected_day; - gc_delay = base::TimeDelta::FromSeconds(kLongGarbageCollectionInterval); - } - - garbage_collection_timer_.Start( - FROM_HERE, gc_delay, this, - &FeedImageManager::DoGarbageCollectionIfNeeded); -} - -void FeedImageManager::StopGarbageCollection() { - garbage_collection_timer_.Stop(); -} - -void FeedImageManager::ClearUmaTimer(const std::string& url) { - url_timers_.erase(url); -} - -} // namespace feed
diff --git a/components/feed/core/feed_image_manager.h b/components/feed/core/feed_image_manager.h deleted file mode 100644 index a900d31a..0000000 --- a/components/feed/core/feed_image_manager.h +++ /dev/null
@@ -1,138 +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 COMPONENTS_FEED_CORE_FEED_IMAGE_MANAGER_H_ -#define COMPONENTS_FEED_CORE_FEED_IMAGE_MANAGER_H_ - -#include <memory> -#include <string> -#include <vector> - -#include "base/containers/flat_map.h" -#include "base/memory/weak_ptr.h" -#include "base/timer/timer.h" -#include "components/feed/core/feed_image_database.h" - -namespace base { -class ElapsedTimer; -} // namespace base - -namespace gfx { -class Image; -} // namespace gfx - -namespace image_fetcher { -class ImageFetcher; -struct RequestMetadata; -} // namespace image_fetcher - -namespace feed { - -using ImageFetchedCallback = - base::OnceCallback<void(const gfx::Image&, size_t)>; - -// Enum for the result of the fetch, reported through UMA. -// New values should be added at the end and things should not be renumbered. -enum class FeedImageFetchResult { - kSuccessCached = 0, - kSuccessFetched = 1, - kFailure = 2, - kMaxValue = kFailure, -}; - -// FeedImageManager takes care of fetching images from the network and caching -// them in the database. -class FeedImageManager { - public: - FeedImageManager(std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher, - std::unique_ptr<FeedImageDatabase> image_database); - ~FeedImageManager(); - - // Fetches an image from |urls|, and resize the image with |width_px| and - // |height_px|. FeedImageManager will go through URLs in |urls| one by one - // trying to fetch and decode them in order. If |width_px| and |height_px| are - // not available/legal, FeedImageManager will not resize the image. Upon - // success, a decoded image will be passed to |callback| as well as cached - // locally. |urls| should be supplied in priority order, and the first success - // will prevent any further processing. Failure to fetch or decode an image - // will cause FeedImageManager to process the next URL in |urls|. If - // FeedImageManager failed to fetch and decode all the URLs in |urls|, it will - // pass an empty image to |callback|. |callback| will be called exactly once. - void FetchImage(std::vector<std::string> urls, - int width_px, - int height_px, - ImageFetchedCallback callback); - - private: - friend class FeedImageManagerTest; - - // Database - void FetchImagesFromDatabase(size_t url_index, - std::vector<std::string> urls, - int width_px, - int height_px, - ImageFetchedCallback callback); - void OnImageFetchedFromDatabase(size_t url_index, - std::vector<std::string> urls, - int width_px, - int height_px, - ImageFetchedCallback callback, - const std::string& image_data); - void OnImageDecodedFromDatabase(size_t url_index, - std::vector<std::string> urls, - int width_px, - int height_px, - ImageFetchedCallback callback, - const gfx::Image& image); - - // Network - void FetchImageFromNetwork(size_t url_index, - std::vector<std::string> urls, - int width_px, - int height_px, - ImageFetchedCallback callback); - void OnImageFetchedFromNetwork( - size_t url_index, - std::vector<std::string> urls, - int width_px, - int height_px, - ImageFetchedCallback callback, - const std::string& image_data, - const image_fetcher::RequestMetadata& request_metadata); - void OnImageDecodedFromNetwork(size_t url_index, - std::vector<std::string> urls, - int width_px, - int height_px, - ImageFetchedCallback callback, - const std::string& image_data, - const gfx::Image& image); - - // Garbage collection will be run when FeedImageManager starts up, and then - // once a day. Garbage collection will remove images, that have not been - // touched for 30 days. - void DoGarbageCollectionIfNeeded(); - void OnGarbageCollectionDone(base::Time garbage_collected_day, bool success); - void StopGarbageCollection(); - - void ClearUmaTimer(const std::string& url); - - // The day which image database already ran garbage collection against on. - base::Time image_garbage_collected_day_; - - base::OneShotTimer garbage_collection_timer_; - - std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_; - std::unique_ptr<FeedImageDatabase> image_database_; - - // Track time it takes to get images. - base::flat_map<std::string, base::ElapsedTimer> url_timers_; - - base::WeakPtrFactory<FeedImageManager> weak_ptr_factory_; - - DISALLOW_COPY_AND_ASSIGN(FeedImageManager); -}; - -} // namespace feed - -#endif // COMPONENTS_FEED_CORE_FEED_IMAGE_MANAGER_H_
diff --git a/components/feed/core/proto/BUILD.gn b/components/feed/core/proto/BUILD.gn index 2dfff8a..3a0b51b 100644 --- a/components/feed/core/proto/BUILD.gn +++ b/components/feed/core/proto/BUILD.gn
@@ -6,7 +6,6 @@ proto_library("proto") { sources = [ - "cached_image.proto", "content_storage.proto", "journal_storage.proto", ]
diff --git a/components/feed/core/proto/cached_image.proto b/components/feed/core/proto/cached_image.proto deleted file mode 100644 index 9601436..0000000 --- a/components/feed/core/proto/cached_image.proto +++ /dev/null
@@ -1,20 +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. - -syntax = "proto2"; - -option optimize_for = LITE_RUNTIME; - -package feed; - -message CachedImageProto { - // The URL of the original source, ex. https://www.chromium.org/image.png. - optional string url = 1; - - // Raw image data fetched from network. - optional bytes data = 2; - - // Last used time (in microseconds since the origin (or "zero") point.). - optional int64 last_used_time = 3; -}
diff --git a/components/image_fetcher/core/image_data_fetcher.cc b/components/image_fetcher/core/image_data_fetcher.cc index 90929f6..855058e 100644 --- a/components/image_fetcher/core/image_data_fetcher.cc +++ b/components/image_fetcher/core/image_data_fetcher.cc
@@ -20,6 +20,8 @@ const char kContentLocationHeader[] = "Content-Location"; +const int kDownloadTimeoutSeconds = 30; + } // namespace namespace image_fetcher { @@ -92,6 +94,9 @@ // body will get thrown out anyway, though. loader->SetAllowHttpErrorResults(true); + loader->SetTimeoutDuration( + base::TimeDelta::FromSeconds(kDownloadTimeoutSeconds)); + if (max_download_bytes_.has_value()) { loader->DownloadToString( url_loader_factory_.get(),
diff --git a/components/network_time/network_time_test_utils.h b/components/network_time/network_time_test_utils.h index 656ed47..b99cf7a 100644 --- a/components/network_time/network_time_test_utils.h +++ b/components/network_time/network_time_test_utils.h
@@ -14,7 +14,7 @@ namespace base { namespace test { class ScopedFeatureList; -}; // namespace test +} // namespace test class FieldTrialList; } // namespace base
diff --git a/components/omnibox/browser/BUILD.gn b/components/omnibox/browser/BUILD.gn index cb3e0a9..c08b300 100644 --- a/components/omnibox/browser/BUILD.gn +++ b/components/omnibox/browser/BUILD.gn
@@ -424,6 +424,7 @@ "//testing/gmock", "//testing/gtest", "//ui/base:test_support", + "//ui/gfx:test_support", "//url", ] }
diff --git a/components/omnibox/browser/autocomplete_controller.cc b/components/omnibox/browser/autocomplete_controller.cc index a187a69..5ba6319 100644 --- a/components/omnibox/browser/autocomplete_controller.cc +++ b/components/omnibox/browser/autocomplete_controller.cc
@@ -264,7 +264,7 @@ // create a ClipboardRecentContent as above (for both Chrome and tests). if (ClipboardRecentContent::GetInstance()) { providers_.push_back(new ClipboardURLProvider( - provider_client_.get(), history_url_provider_, + provider_client_.get(), this, history_url_provider_, ClipboardRecentContent::GetInstance())); } }
diff --git a/components/omnibox/browser/autocomplete_match.cc b/components/omnibox/browser/autocomplete_match.cc index 5a9ebff..22b7ee6c 100644 --- a/components/omnibox/browser/autocomplete_match.cc +++ b/components/omnibox/browser/autocomplete_match.cc
@@ -148,6 +148,9 @@ match.search_terms_args ? new TemplateURLRef::SearchTermsArgs(*match.search_terms_args) : nullptr), + post_content(match.post_content + ? new TemplateURLRef::PostContent(*match.post_content) + : nullptr), additional_info(match.additional_info), duplicate_matches(match.duplicate_matches) {} @@ -193,6 +196,9 @@ match.search_terms_args ? new TemplateURLRef::SearchTermsArgs(*match.search_terms_args) : nullptr); + post_content.reset(match.post_content + ? new TemplateURLRef::PostContent(*match.post_content) + : nullptr); additional_info = match.additional_info; duplicate_matches = match.duplicate_matches; return *this; @@ -741,7 +747,9 @@ } void AutocompleteMatch::InlineTailPrefix(const base::string16& common_prefix) { - if (type == AutocompleteMatchType::SEARCH_SUGGEST_TAIL) { + // Prevent re-addition of prefix. + if (type == AutocompleteMatchType::SEARCH_SUGGEST_TAIL && + tail_suggest_common_prefix.empty()) { tail_suggest_common_prefix = common_prefix; // Insert an ellipsis before uncommon part. const auto ellipsis = base::ASCIIToUTF16(kEllipsis);
diff --git a/components/omnibox/browser/autocomplete_match.h b/components/omnibox/browser/autocomplete_match.h index 07e1f8ce..6bd42ffb 100644 --- a/components/omnibox/browser/autocomplete_match.h +++ b/components/omnibox/browser/autocomplete_match.h
@@ -510,6 +510,10 @@ // AutocompleteController to do no additional transformations. std::unique_ptr<TemplateURLRef::SearchTermsArgs> search_terms_args; + // Optional post content. If this is set, the request to load the destination + // url will pass this post content as well. + std::unique_ptr<TemplateURLRef::PostContent> post_content; + // Information dictionary into which each provider can optionally record a // property and associated value and which is presented in chrome://omnibox. AdditionalInfo additional_info;
diff --git a/components/omnibox/browser/autocomplete_match_type.cc b/components/omnibox/browser/autocomplete_match_type.cc index 05979020..f2ae4a0 100644 --- a/components/omnibox/browser/autocomplete_match_type.cc +++ b/components/omnibox/browser/autocomplete_match_type.cc
@@ -136,20 +136,19 @@ // NAVSUGGEST_PERSONALIZED is like SEARCH_SUGGEST_PERSONALIZED, but it's a // URL instead of a search query. - IDS_ACC_AUTOCOMPLETE_HISTORY, // NAVSUGGEST_PERSONALIZED - 0, // CALCULATOR - IDS_ACC_AUTOCOMPLETE_CLIPBOARD, // CLIPBOARD_URL - 0, // VOICE_SUGGEST - 0, // PHYSICAL_WEB_DEPRECATED - 0, // PHYSICAL_WEB_OVERFLOW_DEPRECATED - IDS_ACC_AUTOCOMPLETE_HISTORY, // TAB_SEARCH_DEPRECATED - 0, // DOCUMENT_SUGGESTION + IDS_ACC_AUTOCOMPLETE_HISTORY, // NAVSUGGEST_PERSONALIZED + 0, // CALCULATOR + IDS_ACC_AUTOCOMPLETE_CLIPBOARD_URL, // CLIPBOARD_URL + 0, // VOICE_SUGGEST + 0, // PHYSICAL_WEB_DEPRECATED + 0, // PHYSICAL_WEB_OVERFLOW_DEPRECATED + IDS_ACC_AUTOCOMPLETE_HISTORY, // TAB_SEARCH_DEPRECATED + 0, // DOCUMENT_SUGGESTION // TODO(orinj): Determine appropriate accessibility labels for Pedals - 0, // PEDAL - // TODO(rgibson): Determine appropriate accessibility labels for clipboard - 0, // CLIPBOARD_TEXT - 0, // CLIPBOARD_IMAGE + 0, // PEDAL + IDS_ACC_AUTOCOMPLETE_CLIPBOARD_TEXT, // CLIPBOARD_TEXT + IDS_ACC_AUTOCOMPLETE_CLIPBOARD_IMAGE, // CLIPBOARD_IMAGE }; static_assert(base::size(message_ids) == AutocompleteMatchType::NUM_TYPES, "message_ids must have NUM_TYPES elements"); @@ -193,12 +192,21 @@ break; case IDS_ACC_AUTOCOMPLETE_HISTORY: case IDS_ACC_AUTOCOMPLETE_BOOKMARK: - case IDS_ACC_AUTOCOMPLETE_CLIPBOARD: // History match. // May have descriptive text for the title of the page. description = match.description; has_description = true; break; + case IDS_ACC_AUTOCOMPLETE_CLIPBOARD_URL: + case IDS_ACC_AUTOCOMPLETE_CLIPBOARD_TEXT: + // Clipboard match. + // Description contains clipboard content + description = match.description; + has_description = true; + break; + case IDS_ACC_AUTOCOMPLETE_CLIPBOARD_IMAGE: + // Clipboard match with no textual clipboard content. + break; default: NOTREACHED(); break;
diff --git a/components/omnibox/browser/autocomplete_provider_unittest.cc b/components/omnibox/browser/autocomplete_provider_unittest.cc index 4be9ef55..a992d95 100644 --- a/components/omnibox/browser/autocomplete_provider_unittest.cc +++ b/components/omnibox/browser/autocomplete_provider_unittest.cc
@@ -28,6 +28,7 @@ #include "components/omnibox/browser/keyword_provider.h" #include "components/omnibox/browser/mock_autocomplete_provider_client.h" #include "components/omnibox/browser/search_provider.h" +#include "components/open_from_clipboard/fake_clipboard_recent_content.h" #include "components/search_engines/search_engines_switches.h" #include "components/search_engines/template_url.h" #include "components/search_engines/template_url_service.h" @@ -35,6 +36,8 @@ #include "net/url_request/url_request.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/metrics_proto/omnibox_event.pb.h" +#include "ui/gfx/image/image_unittest_util.h" +#include "ui/gfx/image/image_util.h" static std::ostream& operator<<(std::ostream& os, const AutocompleteResult::const_iterator& it) { @@ -248,7 +251,9 @@ // Registers a test TemplateURL under the given keyword. void RegisterTemplateURL(const base::string16 keyword, - const std::string& template_url); + const std::string& template_url, + const std::string& image_url, + const std::string& image_url_post_params); // Resets |controller_| with two TestProviders. |provider1_ptr| and // |provider2_ptr| are updated to point to the new providers if non-NULL. @@ -282,9 +287,13 @@ // Returns match.destination_url as it would be set by // AutocompleteController::UpdateMatchDestinationURL(). - GURL GetDestinationURL(AutocompleteMatch match, + GURL GetDestinationURL(AutocompleteMatch& match, base::TimeDelta query_formulation_time) const; + // Returns the image from the clipboard as it would be from + // AutocompleteController::GetImageFromClipboard(). + base::Optional<gfx::Image> GetImageFromClipboard() const; + void set_search_provider_field_trial_triggered_in_session(bool val) { controller_->search_provider_->set_field_trial_triggered_in_session(val); } @@ -328,11 +337,15 @@ void AutocompleteProviderTest::RegisterTemplateURL( const base::string16 keyword, - const std::string& template_url) { + const std::string& template_url, + const std::string& image_url = "", + const std::string& image_url_post_params = "") { TemplateURLData data; data.SetURL(template_url); data.SetShortName(keyword); data.SetKeyword(keyword); + data.image_url = image_url; + data.image_url_post_params = image_url_post_params; TemplateURLService* turl_model = client_->GetTemplateURLService(); TemplateURL* default_turl = turl_model->Add(std::make_unique<TemplateURL>(data)); @@ -556,7 +569,7 @@ } GURL AutocompleteProviderTest::GetDestinationURL( - AutocompleteMatch match, + AutocompleteMatch& match, base::TimeDelta query_formulation_time) const { controller_->UpdateMatchDestinationURLWithQueryFormulationTime( query_formulation_time, &match);
diff --git a/components/omnibox/browser/autocomplete_result_unittest.cc b/components/omnibox/browser/autocomplete_result_unittest.cc index 1203bac..e0b1b93 100644 --- a/components/omnibox/browser/autocomplete_result_unittest.cc +++ b/components/omnibox/browser/autocomplete_result_unittest.cc
@@ -1092,6 +1092,14 @@ EXPECT_TRUE(EqualClassifications(result.match_at(i)->contents_class, cases[i].after_contents_class)); } + // Run twice and make sure that it doesn't re-prepend ellipsis. + result.InlineTailPrefixes(); + for (size_t i = 0; i < base::size(cases); ++i) { + EXPECT_EQ(result.match_at(i)->contents, + base::UTF8ToUTF16(cases[i].after_contents)); + EXPECT_TRUE(EqualClassifications(result.match_at(i)->contents_class, + cases[i].after_contents_class)); + } } TEST_F(AutocompleteResultTest, ConvertsOpenTabsCorrectly) {
diff --git a/components/omnibox/browser/clipboard_url_provider.cc b/components/omnibox/browser/clipboard_url_provider.cc index 406786e..b0772ff 100644 --- a/components/omnibox/browser/clipboard_url_provider.cc +++ b/components/omnibox/browser/clipboard_url_provider.cc
@@ -5,15 +5,24 @@ #include "components/omnibox/browser/clipboard_url_provider.h" #include <algorithm> +#include <memory> +#include <utility> +#include "base/bind.h" #include "base/feature_list.h" #include "base/logging.h" +#include "base/memory/ref_counted_memory.h" +#include "base/memory/weak_ptr.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/optional.h" #include "base/strings/utf_string_conversions.h" +#include "base/task/post_task.h" +#include "base/task/task_traits.h" #include "components/omnibox/browser/autocomplete_input.h" +#include "components/omnibox/browser/autocomplete_match.h" #include "components/omnibox/browser/autocomplete_provider_client.h" +#include "components/omnibox/browser/autocomplete_provider_listener.h" #include "components/omnibox/browser/omnibox_field_trial.h" #include "components/omnibox/browser/verbatim_match.h" #include "components/open_from_clipboard/clipboard_recent_content.h" @@ -21,16 +30,20 @@ #include "components/strings/grit/components_strings.h" #include "components/url_formatter/url_formatter.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/gfx/image/image_util.h" ClipboardURLProvider::ClipboardURLProvider( AutocompleteProviderClient* client, + AutocompleteProviderListener* listener, HistoryURLProvider* history_url_provider, ClipboardRecentContent* clipboard_content) : AutocompleteProvider(AutocompleteProvider::TYPE_CLIPBOARD_URL), client_(client), + listener_(listener), clipboard_content_(clipboard_content), history_url_provider_(history_url_provider), - current_url_suggested_times_(0) { + current_url_suggested_times_(0), + callback_weak_ptr_factory_(this) { DCHECK(clipboard_content_); } @@ -41,13 +54,15 @@ matches_.clear(); // If the user started typing, do not offer clipboard based match. - if (!input.from_omnibox_focus()) + if (!input.from_omnibox_focus()) { return; - - base::Optional<AutocompleteMatch> optional_match = CreateImageMatch(input); - if (!optional_match) { - optional_match = CreateURLMatch(input); } + + // Image matched was kicked off asynchronously, so proceed when that ends. + if (CreateImageMatch(input)) { + return; + } + base::Optional<AutocompleteMatch> optional_match = CreateURLMatch(input); if (!optional_match) { optional_match = CreateTextMatch(input); } @@ -56,13 +71,25 @@ return; } + AddCreatedMatchWithTracking(input, std::move(optional_match).value()); +} + +void ClipboardURLProvider::Stop(bool clear_cached_results, + bool due_to_user_inactivity) { + callback_weak_ptr_factory_.InvalidateWeakPtrs(); + AutocompleteProvider::Stop(clear_cached_results, due_to_user_inactivity); +} + +void ClipboardURLProvider::AddCreatedMatchWithTracking( + const AutocompleteInput& input, + const AutocompleteMatch& match) { // Record the number of times the currently-offered URL has been suggested. // This only works over this run of Chrome; if the URL was in the clipboard // on a previous run, those offerings will not be counted. - if (optional_match.value().destination_url == current_url_suggested_) { + if (match.destination_url == current_url_suggested_) { current_url_suggested_times_++; } else { - current_url_suggested_ = optional_match.value().destination_url; + current_url_suggested_ = match.destination_url; current_url_suggested_times_ = 1; } @@ -87,7 +114,7 @@ UMA_HISTOGRAM_LONG_TIMES_100("Omnibox.ClipboardSuggestionShownAge", clipboard_content_->GetClipboardContentAge()); - matches_.emplace_back(std::move(optional_match).value()); + matches_.emplace_back(match); } base::Optional<AutocompleteMatch> ClipboardURLProvider::CreateURLMatch( @@ -173,15 +200,17 @@ base::string16::npos, 0, match.description.length(), ACMatchClassification::NONE, &match.description_class); + match.keyword = default_url->keyword(); + match.transition = ui::PAGE_TRANSITION_GENERATED; + return match; } -base::Optional<AutocompleteMatch> ClipboardURLProvider::CreateImageMatch( - const AutocompleteInput& input) { +bool ClipboardURLProvider::CreateImageMatch(const AutocompleteInput& input) { // Only try image match if feature is enabled if (!base::FeatureList::IsEnabled( omnibox::kEnableClipboardProviderImageSuggestions)) { - return base::nullopt; + return false; } // Make sure current provider supports image search @@ -190,13 +219,37 @@ if (!default_url || default_url->image_url().empty() || !default_url->image_url_ref().IsValid(url_service->search_terms_data())) { - return base::nullopt; + return false; } - if (!clipboard_content_->GetRecentImageFromClipboard()) { - return base::nullopt; + base::Optional<gfx::Image> optional_image = + clipboard_content_->GetRecentImageFromClipboard(); + if (!optional_image) { + return false; } + done_ = false; + PostTaskAndReplyWithResult( + FROM_HERE, + base::BindOnce(&ClipboardURLProvider::EncodeClipboardImage, + optional_image.value()), + base::BindOnce(&ClipboardURLProvider::ConstructImageMatchCallback, + callback_weak_ptr_factory_.GetWeakPtr(), input, + url_service)); + return true; +} + +scoped_refptr<base::RefCountedMemory> +ClipboardURLProvider::EncodeClipboardImage(gfx::Image image) { + gfx::Image resized_image = gfx::ResizedImageForSearchByImage(image); + return resized_image.As1xPNGBytes(); +} + +void ClipboardURLProvider::ConstructImageMatchCallback( + const AutocompleteInput& input, + TemplateURLService* url_service, + scoped_refptr<base::RefCountedMemory> image_bytes) { + const TemplateURL* default_url = url_service->GetDefaultSearchProvider(); // Add the clipboard match. The relevance is 800 to beat ZeroSuggest results. AutocompleteMatch match(this, 800, false, AutocompleteMatchType::CLIPBOARD_IMAGE); @@ -212,7 +265,21 @@ base::string16::npos, 0, match.contents.length(), ACMatchClassification::NONE, &match.contents_class); - return match; + TemplateURLRef::SearchTermsArgs search_args(base::ASCIIToUTF16("")); + search_args.image_thumbnail_content.assign(image_bytes->front_as<char>(), + image_bytes->size()); + TemplateURLRef::PostContent post_content; + GURL result(default_url->image_url_ref().ReplaceSearchTerms( + search_args, url_service->search_terms_data(), &post_content)); + match.destination_url = result; + match.post_content = + std::make_unique<TemplateURLRef::PostContent>(post_content); + + match.transition = ui::PAGE_TRANSITION_GENERATED; + + AddCreatedMatchWithTracking(input, match); + listener_->OnProviderUpdate(true); + done_ = true; } void ClipboardURLProvider::AddProviderInfo(ProvidersInfo* provider_info) const {
diff --git a/components/omnibox/browser/clipboard_url_provider.h b/components/omnibox/browser/clipboard_url_provider.h index c461bcb..781f209c 100644 --- a/components/omnibox/browser/clipboard_url_provider.h +++ b/components/omnibox/browser/clipboard_url_provider.h
@@ -5,6 +5,7 @@ #ifndef COMPONENTS_OMNIBOX_BROWSER_CLIPBOARD_URL_PROVIDER_H_ #define COMPONENTS_OMNIBOX_BROWSER_CLIPBOARD_URL_PROVIDER_H_ +#include "base/gtest_prod_util.h" #include "base/macros.h" #include "components/omnibox/browser/autocomplete_provider.h" #include "components/omnibox/browser/history_url_provider.h" @@ -17,16 +18,25 @@ class ClipboardURLProvider : public AutocompleteProvider { public: ClipboardURLProvider(AutocompleteProviderClient* client, + AutocompleteProviderListener* listener, HistoryURLProvider* history_url_provider, ClipboardRecentContent* clipboard_content); // AutocompleteProvider implementation. void Start(const AutocompleteInput& input, bool minimal_changes) override; + void Stop(bool clear_cached_results, bool due_to_user_inactivity) override; void AddProviderInfo(ProvidersInfo* provider_info) const override; private: + FRIEND_TEST_ALL_PREFIXES(ClipboardURLProviderTest, MatchesImage); + ~ClipboardURLProvider() override; + // Handle the match created from one of the match creation methods and do + // extra tracking and match adding. + void AddCreatedMatchWithTracking(const AutocompleteInput& input, + const AutocompleteMatch& match); + // If there is a url copied to the clipboard, use it to create a match. base::Optional<AutocompleteMatch> CreateURLMatch( const AutocompleteInput& input); @@ -34,10 +44,25 @@ base::Optional<AutocompleteMatch> CreateTextMatch( const AutocompleteInput& input); // If there is an image copied to the clipboard, use it to create a match. - base::Optional<AutocompleteMatch> CreateImageMatch( - const AutocompleteInput& input); + // The image match is asynchronous (because constructing the image post data + // takes time), so instead of returning an optional match like the other + // Create functions, it returns a boolean indicating whether there will be a + // match. + bool CreateImageMatch(const AutocompleteInput& input); + + // Resize and encode the image data into bytes. This can take some time if the + // image is large, so this should happen on a background thread. + static scoped_refptr<base::RefCountedMemory> EncodeClipboardImage( + gfx::Image image); + // Construct the actual image match once the image has been encoded into + // bytes. This should be called back on the main thread. + void ConstructImageMatchCallback( + const AutocompleteInput& input, + TemplateURLService* url_service, + scoped_refptr<base::RefCountedMemory> image_bytes); AutocompleteProviderClient* client_; + AutocompleteProviderListener* listener_; ClipboardRecentContent* clipboard_content_; // Used for efficiency when creating the verbatim match. Can be NULL. @@ -48,6 +73,10 @@ GURL current_url_suggested_; size_t current_url_suggested_times_; + // Used to cancel image construction callbacks if autocomplete Stop() is + // called. + base::WeakPtrFactory<ClipboardURLProvider> callback_weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(ClipboardURLProvider); };
diff --git a/components/omnibox/browser/clipboard_url_provider_unittest.cc b/components/omnibox/browser/clipboard_url_provider_unittest.cc index 49f1cc8..f5e809e 100644 --- a/components/omnibox/browser/clipboard_url_provider_unittest.cc +++ b/components/omnibox/browser/clipboard_url_provider_unittest.cc
@@ -6,12 +6,14 @@ #include <memory> #include <string> +#include <utility> #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/strings/utf_string_conversions.h" #include "base/test/scoped_feature_list.h" #include "components/omnibox/browser/autocomplete_input.h" +#include "components/omnibox/browser/autocomplete_provider_listener.h" #include "components/omnibox/browser/mock_autocomplete_provider_client.h" #include "components/omnibox/browser/test_scheme_classifier.h" #include "components/open_from_clipboard/fake_clipboard_recent_content.h" @@ -19,6 +21,8 @@ #include "components/search_engines/template_url_service_client.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/gfx/image/image.h" +#include "ui/gfx/image/image_unittest_util.h" #include "url/gurl.h" namespace { @@ -28,11 +32,15 @@ const char kClipboardText[] = "Search for me"; const char kClipboardTitleText[] = "\"Search for me\""; -class ClipboardURLProviderTest : public testing::Test { +} // namespace + +class ClipboardURLProviderTest : public testing::Test, + public AutocompleteProviderListener { public: ClipboardURLProviderTest() : client_(new MockAutocompleteProviderClient()), provider_(new ClipboardURLProvider(client_.get(), + this, nullptr, &clipboard_content_)) { SetClipboardUrl(GURL(kClipboardURL)); @@ -50,6 +58,11 @@ clipboard_content_.SetClipboardText(text, base::TimeDelta::FromMinutes(10)); } + void SetClipboardImage(const gfx::Image& image) { + clipboard_content_.SetClipboardImage(image, + base::TimeDelta::FromMinutes(10)); + } + AutocompleteInput CreateAutocompleteInput(bool from_omnibox_focus) { AutocompleteInput input(base::string16(), metrics::OmniboxEventProto::OTHER, classifier_); @@ -59,12 +72,19 @@ } protected: + // AutocompleteProviderListener: + void OnProviderUpdate(bool updated_matches) override; + TestSchemeClassifier classifier_; FakeClipboardRecentContent clipboard_content_; std::unique_ptr<MockAutocompleteProviderClient> client_; scoped_refptr<ClipboardURLProvider> provider_; }; +void ClipboardURLProviderTest::OnProviderUpdate(bool updated_matches) { + // No action required. +} + TEST_F(ClipboardURLProviderTest, NotFromOmniboxFocus) { provider_->Start(CreateAutocompleteInput(false), false); EXPECT_TRUE(provider_->matches().empty()); @@ -102,4 +122,19 @@ provider_->matches().back().contents); } -} // namespace +TEST_F(ClipboardURLProviderTest, MatchesImage) { + base::test::ScopedFeatureList feature_list; + base::Feature imageFeature = + omnibox::kEnableClipboardProviderImageSuggestions; + feature_list.InitAndEnableFeature(imageFeature); + TemplateURLService template_url_service(/*initializers=*/nullptr, + /*count=*/0); + + gfx::Image test_image = gfx::test::CreateImage(/*height=*/10, /*width=*/10); + scoped_refptr<base::RefCountedMemory> image_bytes = + provider_->EncodeClipboardImage(test_image); + ASSERT_TRUE(image_bytes); + provider_->ConstructImageMatchCallback(CreateAutocompleteInput(true), + &template_url_service, image_bytes); + ASSERT_GE(provider_->matches().size(), 1U); +}
diff --git a/components/omnibox/browser/omnibox_edit_controller.cc b/components/omnibox/browser/omnibox_edit_controller.cc index 9c96103..a674be8b 100644 --- a/components/omnibox/browser/omnibox_edit_controller.cc +++ b/components/omnibox/browser/omnibox_edit_controller.cc
@@ -8,11 +8,13 @@ void OmniboxEditController::OnAutocompleteAccept( const GURL& destination_url, + TemplateURLRef::PostContent* post_content, WindowOpenDisposition disposition, ui::PageTransition transition, AutocompleteMatchType::Type type, base::TimeTicks match_selection_timestamp) { destination_url_ = destination_url; + post_content_ = post_content; disposition_ = disposition; transition_ = transition; match_selection_timestamp_ = match_selection_timestamp;
diff --git a/components/omnibox/browser/omnibox_edit_controller.h b/components/omnibox/browser/omnibox_edit_controller.h index c34a333..dff9de9 100644 --- a/components/omnibox/browser/omnibox_edit_controller.h +++ b/components/omnibox/browser/omnibox_edit_controller.h
@@ -8,6 +8,7 @@ #include "base/macros.h" #include "base/time/time.h" #include "components/omnibox/browser/autocomplete_match_type.h" +#include "components/search_engines/template_url.h" #include "ui/base/page_transition_types.h" #include "ui/base/window_open_disposition.h" #include "url/gurl.h" @@ -17,6 +18,7 @@ class OmniboxEditController { public: virtual void OnAutocompleteAccept(const GURL& destination_url, + TemplateURLRef::PostContent* post_content, WindowOpenDisposition disposition, ui::PageTransition transition, AutocompleteMatchType::Type match_type, @@ -40,6 +42,7 @@ virtual ~OmniboxEditController(); GURL destination_url() const { return destination_url_; } + TemplateURLRef::PostContent* post_content() const { return post_content_; } WindowOpenDisposition disposition() const { return disposition_; } ui::PageTransition transition() const { return transition_; } base::TimeTicks match_selection_timestamp() const { @@ -49,6 +52,7 @@ private: // The details necessary to open the user's desired omnibox match. GURL destination_url_; + TemplateURLRef::PostContent* post_content_; WindowOpenDisposition disposition_; ui::PageTransition transition_; base::TimeTicks match_selection_timestamp_;
diff --git a/components/omnibox/browser/omnibox_edit_model.cc b/components/omnibox/browser/omnibox_edit_model.cc index 428d0c7..88f83ec 100644 --- a/components/omnibox/browser/omnibox_edit_model.cc +++ b/components/omnibox/browser/omnibox_edit_model.cc
@@ -835,8 +835,9 @@ if (match.destination_url.is_valid()) { // This calls RevertAll again. base::AutoReset<bool> tmp(&in_revert_, true); + controller_->OnAutocompleteAccept( - match.destination_url, disposition, + match.destination_url, match.post_content.get(), disposition, ui::PageTransitionFromInt(match.transition | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR), match.type, match_selection_timestamp);
diff --git a/components/omnibox/browser/omnibox_field_trial.cc b/components/omnibox/browser/omnibox_field_trial.cc index 9020544c..717e463 100644 --- a/components/omnibox/browser/omnibox_field_trial.cc +++ b/components/omnibox/browser/omnibox_field_trial.cc
@@ -234,6 +234,11 @@ #endif }; +// Feature used for the vertical margin UI experiment, currently only used on +// desktop platforms. +const base::Feature kUIExperimentVerticalMargin{ + "OmniboxUIExperimentVerticalMargin", base::FEATURE_DISABLED_BY_DEFAULT}; + // Feature used to enable speculatively starting a service worker associated // with the destination of the default match when the user's input looks like a // query. @@ -824,6 +829,14 @@ base::FeatureList::IsEnabled(features::kExperimentalUi); } +int OmniboxFieldTrial::GetSuggestionVerticalMargin() { + // When the vertical margin is set to 2dp, the suggestion height is the + // closest to the pre-Refresh height. In fact it's 1dp taller than the + // pre-Refresh height on Linux. + return base::GetFieldTrialParamByFeatureAsInt( + omnibox::kUIExperimentVerticalMargin, kUIVerticalMarginParam, 2); +} + bool OmniboxFieldTrial::IsExperimentalKeywordModeEnabled() { return base::FeatureList::IsEnabled(omnibox::kExperimentalKeywordMode); } @@ -898,6 +911,7 @@ const char OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam[] = "UIMaxAutocompleteMatches"; +const char OmniboxFieldTrial::kUIVerticalMarginParam[] = "UIVerticalMargin"; const char OmniboxFieldTrial::kPedalSuggestionModeParam[] = "PedalSuggestionMode";
diff --git a/components/omnibox/browser/omnibox_field_trial.h b/components/omnibox/browser/omnibox_field_trial.h index 75681a4..60980e1 100644 --- a/components/omnibox/browser/omnibox_field_trial.h +++ b/components/omnibox/browser/omnibox_field_trial.h
@@ -457,6 +457,10 @@ // subdomains or the #upcoming-ui-features flag is enabled. static bool IsHideSteadyStateUrlTrivialSubdomainsEnabled(); + // Returns the size of the vertical margin that should be used in the + // suggestion view. + static int GetSuggestionVerticalMargin(); + // Simply a convenient wrapper for testing a flag. Used downstream for an // assortment of keyword mode experiments. static bool IsExperimentalKeywordModeEnabled();
diff --git a/components/omnibox/browser/omnibox_pedal.cc b/components/omnibox/browser/omnibox_pedal.cc index a12c2bd7..e74c054 100644 --- a/components/omnibox/browser/omnibox_pedal.cc +++ b/components/omnibox/browser/omnibox_pedal.cc
@@ -141,6 +141,7 @@ void OmniboxPedal::OpenURL(OmniboxPedal::ExecutionContext& context, const GURL& url) const { context.controller_.OnAutocompleteAccept( - url, WindowOpenDisposition::CURRENT_TAB, ui::PAGE_TRANSITION_GENERATED, - AutocompleteMatchType::PEDAL, context.match_selection_timestamp_); + url, nullptr, WindowOpenDisposition::CURRENT_TAB, + ui::PAGE_TRANSITION_GENERATED, AutocompleteMatchType::PEDAL, + context.match_selection_timestamp_); }
diff --git a/components/omnibox_strings.grdp b/components/omnibox_strings.grdp index 661d9db8..a72a746d 100644 --- a/components/omnibox_strings.grdp +++ b/components/omnibox_strings.grdp
@@ -194,8 +194,14 @@ <message name="IDS_ACC_AUTOCOMPLETE_BOOKMARK" desc="Text for screenreaders describing a URL from a bookmark."> <ph name="LOCATION_TITLE">$2<ex>The Chromium Projects</ex></ph> <ph name="SHORT_URL">$1<ex>www.chromium.org</ex> bookmark</ph> </message> - <message name="IDS_ACC_AUTOCOMPLETE_CLIPBOARD" desc="Text for screenreaders describing a URL from a clipboard."> - <ph name="LOCATION_TITLE">$2<ex>The Chromium Projects</ex></ph> <ph name="SHORT_URL">$1<ex>www.chromium.org</ex> location from clipboard</ph> + <message name="IDS_ACC_AUTOCOMPLETE_CLIPBOARD_IMAGE" desc="Text for screenreaders describing an image from a clipboard."> + Search for clipboard image + </message> + <message name="IDS_ACC_AUTOCOMPLETE_CLIPBOARD_TEXT" desc="Text for screenreaders describing text from a clipboard."> + Search for clipboard text, <ph name="TEXT">$2<ex>Paris, france</ex></ph> + </message> + <message name="IDS_ACC_AUTOCOMPLETE_CLIPBOARD_URL" desc="Text for screenreaders describing a URL from a clipboard."> + Search for clipboard URL, <ph name="SHORT_URL">$2<ex>www.chromium.org</ex></ph> </message> <message name="IDS_ACC_SEARCH_ICON" desc="Text for screenreaders describing a search icon image."> Search icon
diff --git a/components/safe_browsing/proto/PRESUBMIT.py b/components/safe_browsing/proto/PRESUBMIT.py index 0e73812..1b4c0c8 100644 --- a/components/safe_browsing/proto/PRESUBMIT.py +++ b/components/safe_browsing/proto/PRESUBMIT.py
@@ -3,18 +3,29 @@ # found in the LICENSE file. def CheckChangeOnUpload(input_api, output_api): + results = [] + # Warn if the proto file is not modified without also modifying - # the WebUI. + # the WebUI and extension API idl file. proto_path = 'components/safe_browsing/proto/csd.proto' web_ui_path = 'components/safe_browsing/web_ui/safe_browsing_ui.cc' + idl_path = 'chrome/common/extensions/api/safe_browsing_private.idl' - if proto_path in input_api.change.LocalPaths() and \ - not web_ui_path in input_api.change.LocalPaths(): - return [ - output_api.PresubmitPromptWarning( - 'You modified the one or more of the CSD protos in: \n' - ' ' + proto_path + '\n' - 'without changing the WebUI in: \n' - ' ' + web_ui_path + '\n') - ] - return [] + if proto_path in input_api.change.LocalPaths(): + if web_ui_path not in input_api.change.LocalPaths(): + results.append( + output_api.PresubmitPromptWarning( + 'You modified the one or more of the CSD protos in: \n' + ' ' + proto_path + '\n' + 'without changing the WebUI in: \n' + ' ' + web_ui_path + '\n') + ) + if idl_path not in input_api.change.LocalPaths(): + results.append( + output_api.PresubmitPromptWarning( + 'You modified the one or more of the CSD protos in: \n' + ' ' + proto_path + '\n' + 'without changing the API definition in: \n' + ' ' + idl_path + '\n') + ) + return results
diff --git a/components/signin/core/browser/oauth2_token_service_delegate_android.cc b/components/signin/core/browser/oauth2_token_service_delegate_android.cc index 0d872ed..1a4be90 100644 --- a/components/signin/core/browser/oauth2_token_service_delegate_android.cc +++ b/components/signin/core/browser/oauth2_token_service_delegate_android.cc
@@ -490,6 +490,13 @@ } } +void OAuth2TokenServiceDelegateAndroid::ReloadAccountsFromSystem( + const std::string& primary_account_id) { + // ValidateAccounts() effectively synchronizes the accounts in the Token + // Service with those present at the system level. + ValidateAccounts(primary_account_id, /*force_notifications=*/true); +} + std::string OAuth2TokenServiceDelegateAndroid::MapAccountIdToAccountName( const std::string& account_id) const { return account_tracker_service_->GetAccountInfo(account_id).email;
diff --git a/components/signin/core/browser/oauth2_token_service_delegate_android.h b/components/signin/core/browser/oauth2_token_service_delegate_android.h index 9ecb1dbb..dc050d5 100644 --- a/components/signin/core/browser/oauth2_token_service_delegate_android.h +++ b/components/signin/core/browser/oauth2_token_service_delegate_android.h
@@ -74,6 +74,8 @@ void LoadCredentials(const std::string& primary_account_id) override; + void ReloadAccountsFromSystem(const std::string& primary_account_id) override; + protected: OAuth2AccessTokenFetcher* CreateAccessTokenFetcher( const std::string& account_id,
diff --git a/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.h b/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.h index 69168d8..ae9c2d5 100644 --- a/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.h +++ b/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.h
@@ -49,6 +49,8 @@ // Subsequent calls to |RefreshTokenIsAvailable| will return |false|. void RevokeAllCredentials() override; + void ReloadAccountsFromSystem(const std::string& primary_account_id) override; + // Reloads accounts from the provider. Fires |OnRefreshTokenAvailable| for // each new account. Fires |OnRefreshTokenRevoked| for each account that was // removed.
diff --git a/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.mm b/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.mm index ad6e03d..9ee4a20a 100644 --- a/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.mm +++ b/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.mm
@@ -270,6 +270,14 @@ ClearExcludedSecondaryAccounts(); } +void ProfileOAuth2TokenServiceIOSDelegate::ReloadAccountsFromSystem( + const std::string& primary_account_id) { + if (primary_account_id.empty()) + return; + + ReloadCredentials(primary_account_id); +} + OAuth2AccessTokenFetcher* ProfileOAuth2TokenServiceIOSDelegate::CreateAccessTokenFetcher( const std::string& account_id,
diff --git a/components/viz/common/quads/draw_quad.h b/components/viz/common/quads/draw_quad.h index 4cbe49f..ab160c3 100644 --- a/components/viz/common/quads/draw_quad.h +++ b/components/viz/common/quads/draw_quad.h
@@ -73,7 +73,8 @@ bool IsDebugQuad() const { return material == DEBUG_BORDER; } bool ShouldDrawWithBlending() const { - return needs_blending || shared_quad_state->opacity < 1.0f; + return needs_blending || shared_quad_state->opacity < 1.0f || + shared_quad_state->blend_mode != SkBlendMode::kSrcOver; } // Is the left edge of this tile aligned with the originating layer's
diff --git a/components/viz/service/display/gl_renderer.cc b/components/viz/service/display/gl_renderer.cc index 7d50893..7764f9e 100644 --- a/components/viz/service/display/gl_renderer.cc +++ b/components/viz/service/display/gl_renderer.cc
@@ -1956,6 +1956,7 @@ fragment_tex_translate_x, fragment_tex_translate_y, fragment_tex_scale_x, fragment_tex_scale_y); + DCHECK_EQ(quad->shared_quad_state->blend_mode, SkBlendMode::kSrcOver); // Blending is required for antialiasing. SetBlendEnabled(true); SetShaderOpacity(quad->shared_quad_state->opacity); @@ -2044,7 +2045,9 @@ tex_coord_rect.x(), tex_coord_rect.y(), tex_coord_rect.width(), tex_coord_rect.height()); + DCHECK(CanApplyBlendModeUsingBlendFunc(quad->shared_quad_state->blend_mode)); SetBlendEnabled(quad->ShouldDrawWithBlending()); + ApplyBlendModeUsingBlendFunc(quad->shared_quad_state->blend_mode); SetShaderOpacity(quad->shared_quad_state->opacity); @@ -2086,6 +2089,7 @@ gl_->DrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, nullptr); num_triangles_drawn_ += 2; + RestoreBlendFuncToDefault(quad->shared_quad_state->blend_mode); } void GLRenderer::DrawYUVVideoQuad(const YUVVideoDrawQuad* quad,
diff --git a/components/viz/test/data/image_mask_with_effect.png b/components/viz/test/data/image_mask_with_effect.png new file mode 100644 index 0000000..8414527 --- /dev/null +++ b/components/viz/test/data/image_mask_with_effect.png Binary files differ
diff --git a/components/viz/test/data/mask_with_effect.png b/components/viz/test/data/mask_with_effect.png new file mode 100644 index 0000000..8414527 --- /dev/null +++ b/components/viz/test/data/mask_with_effect.png Binary files differ
diff --git a/components/viz/test/data/mask_with_effect_different_size.png b/components/viz/test/data/mask_with_effect_different_size.png new file mode 100644 index 0000000..82917eb --- /dev/null +++ b/components/viz/test/data/mask_with_effect_different_size.png Binary files differ
diff --git a/content/browser/accessibility/accessibility_tree_formatter.cc b/content/browser/accessibility/accessibility_tree_formatter.cc index f314509b..7186571 100644 --- a/content/browser/accessibility/accessibility_tree_formatter.cc +++ b/content/browser/accessibility/accessibility_tree_formatter.cc
@@ -60,9 +60,10 @@ else formatter = Create(); base::string16 accessibility_contents_utf16; - std::vector<Filter> filters; - filters.push_back(Filter(base::ASCIIToUTF16("*"), Filter::ALLOW)); - formatter->SetFilters(filters); + std::vector<PropertyFilter> property_filters; + property_filters.push_back( + PropertyFilter(base::ASCIIToUTF16("*"), PropertyFilter::ALLOW)); + formatter->SetPropertyFilters(property_filters); formatter->FormatAccessibilityTree(ax_mgr->GetRoot(), &accessibility_contents_utf16); return accessibility_contents_utf16; @@ -89,6 +90,11 @@ void AccessibilityTreeFormatter::RecursiveFormatAccessibilityTree( const base::DictionaryValue& dict, base::string16* contents, int depth) { + // Check dictionary against node filters, may require us to skip this node + // and its children. + if (MatchesNodeFilters(dict)) + return; + base::string16 indent = base::string16(depth * kIndentSymbolCount, kIndentSymbol); base::string16 line = indent + ProcessTreeForOutput(dict); @@ -115,27 +121,32 @@ } } -void AccessibilityTreeFormatter::SetFilters( - const std::vector<Filter>& filters) { - filters_ = filters; +void AccessibilityTreeFormatter::SetPropertyFilters( + const std::vector<PropertyFilter>& property_filters) { + property_filters_ = property_filters; +} + +void AccessibilityTreeFormatter::SetNodeFilters( + const std::vector<NodeFilter>& node_filters) { + node_filters_ = node_filters; } // static -bool AccessibilityTreeFormatter::MatchesFilters( - const std::vector<Filter>& filters, +bool AccessibilityTreeFormatter::MatchesPropertyFilters( + const std::vector<PropertyFilter>& property_filters, const base::string16& text, bool default_result) { bool allow = default_result; - for (const auto& filter : filters) { + for (const auto& filter : property_filters) { if (base::MatchPattern(text, filter.match_str)) { switch (filter.type) { - case Filter::ALLOW_EMPTY: + case PropertyFilter::ALLOW_EMPTY: allow = true; break; - case Filter::ALLOW: + case PropertyFilter::ALLOW: allow = (!base::MatchPattern(text, base::UTF8ToUTF16("*=''"))); break; - case Filter::DENY: + case PropertyFilter::DENY: allow = false; break; } @@ -144,9 +155,30 @@ return allow; } -bool AccessibilityTreeFormatter::MatchesFilters( - const base::string16& text, bool default_result) const { - return MatchesFilters(filters_, text, default_result); +bool AccessibilityTreeFormatter::MatchesNodeFilters( + const std::vector<NodeFilter>& node_filters, + const base::DictionaryValue& dict) { + for (const auto& filter : node_filters) { + base::string16 value; + if (!dict.GetString(filter.property, &value)) { + continue; + } + if (base::MatchPattern(value, filter.pattern)) { + return true; + } + } + return false; +} + +bool AccessibilityTreeFormatter::MatchesPropertyFilters( + const base::string16& text, + bool default_result) const { + return MatchesPropertyFilters(property_filters_, text, default_result); +} + +bool AccessibilityTreeFormatter::MatchesNodeFilters( + const base::DictionaryValue& dict) const { + return MatchesNodeFilters(node_filters_, dict); } base::string16 AccessibilityTreeFormatter::FormatCoordinates( @@ -171,7 +203,7 @@ base::string16* line) { if (attr.empty()) return false; - if (!MatchesFilters(attr, include_by_default)) + if (!MatchesPropertyFilters(attr, include_by_default)) return false; if (!line->empty()) *line += base::ASCIIToUTF16(" ");
diff --git a/content/browser/accessibility/accessibility_tree_formatter.h b/content/browser/accessibility/accessibility_tree_formatter.h index 9e41ca92..7dbe695c3f 100644 --- a/content/browser/accessibility/accessibility_tree_formatter.h +++ b/content/browser/accessibility/accessibility_tree_formatter.h
@@ -35,9 +35,9 @@ explicit AccessibilityTreeFormatter(); virtual ~AccessibilityTreeFormatter(); - // A single filter specification. See GetAllowString() and GetDenyString() - // for more information. - struct Filter { + // A single property filter specification. See GetAllowString() and + // GetDenyString() for more information. + struct PropertyFilter { enum Type { ALLOW, ALLOW_EMPTY, @@ -46,18 +46,37 @@ base::string16 match_str; Type type; - Filter(base::string16 match_str, Type type) + PropertyFilter(base::string16 match_str, Type type) : match_str(match_str), type(type) {} }; + // A single node filter specification which will exclude any node where the + // value of the named property matches the given pattern. + // + // This can be used to exclude nodes based on properties like role, for + // example to exclude all inlineTextBox nodes under blink we would use a + // NodeFilter of the form: + // {property='internalRole', pattern='inlineTextBox'}; + struct NodeFilter { + std::string property; + base::string16 pattern; + + NodeFilter(std::string property, base::string16 pattern) + : property(property), pattern(pattern) {} + }; + // Create the appropriate native subclass of AccessibilityTreeFormatter. static std::unique_ptr<AccessibilityTreeFormatter> Create(); - static bool MatchesFilters( - const std::vector<Filter>& filters, + static bool MatchesPropertyFilters( + const std::vector<PropertyFilter>& property_filters, const base::string16& text, bool default_result); + // Check if the given dictionary matches any of the supplied NodeFilter(s). + static bool MatchesNodeFilters(const std::vector<NodeFilter>& node_filters, + const base::DictionaryValue& dict); + // Populates the given DictionaryValue with the accessibility tree. // The dictionary contains a key/value pair for each attribute of the node, // plus a "children" attribute containing a list of all child nodes. @@ -95,7 +114,8 @@ virtual std::unique_ptr<base::DictionaryValue> BuildAccessibilityTreeForPattern(const base::StringPiece& pattern) = 0; - // Returns a filtered accesibility tree using the current filters. + // Returns a filtered accesibility tree using the current property and node + // filters. std::unique_ptr<base::DictionaryValue> FilterAccessibilityTree( const base::DictionaryValue& dict); @@ -109,9 +129,12 @@ BrowserAccessibilityManager* ax_mgr, bool internal); - // Set regular expression filters that apply to each component of every - // line before it's output. - void SetFilters(const std::vector<Filter>& filters); + // Set regular expression filters that apply to each property of every node + // before it's output. + void SetPropertyFilters(const std::vector<PropertyFilter>& property_filters); + + // Set regular expression filters that apply to every node before output. + void SetNodeFilters(const std::vector<NodeFilter>& node_filters); // If true, the internal accessibility id of each node will be included // in its output. @@ -130,16 +153,19 @@ // GetAllowEmptyString() -> "@MAC-ALLOW-EMPTY:" // GetAllowString() -> "@MAC-ALLOW:" // GetDenyString() -> "@MAC-DENY:" + // GetDenyNodeString() -> "@MAC-DENY-NODE:" // Example html: // <!-- // @MAC-ALLOW-EMPTY:description* // @MAC-ALLOW:roleDescription* // @MAC-DENY:subrole* + // @BLINK-DENY-NODE:internalRole=inlineTextBox // --> // <p>Text</p> virtual const std::string GetAllowEmptyString() = 0; virtual const std::string GetAllowString() = 0; virtual const std::string GetDenyString() = 0; + virtual const std::string GetDenyNodeString() = 0; protected: // @@ -148,7 +174,8 @@ // Process accessibility tree with filters for output. // Given a dictionary that contains a platform-specific dictionary - // representing an accessibility tree, and utilizing filters_: + // representing an accessibility tree, and utilizing property_filters_ and + // node_filters_: // - Returns a filtered text view as one large string. // - Provides a filtered version of the dictionary in an out param, // (only if the out param is provided). @@ -165,7 +192,8 @@ const char* y_name, const base::DictionaryValue& value); - // Writes the given attribute string out to |line| if it matches the filters. + // Writes the given attribute string out to |line| if it matches the property + // filters. // Returns false if the attribute was filtered out. bool WriteAttribute(bool include_by_default, const base::string16& attr, @@ -184,10 +212,18 @@ base::string16* contents, int depth = 0); - bool MatchesFilters(const base::string16& text, bool default_result) const; + bool MatchesPropertyFilters(const base::string16& text, + bool default_result) const; + bool MatchesNodeFilters(const base::DictionaryValue& dict) const; - // Filters used when formatting the accessibility tree as text. - std::vector<Filter> filters_; + // Property filters used when formatting the accessibility tree as text. + // Any property which matches a property filter will be skipped. + std::vector<PropertyFilter> property_filters_; + + // Node filters used when formatting the accessibility tree as text. + // Any node which matches a node wilder will be skipped, along with all its + // children. + std::vector<NodeFilter> node_filters_; // Whether or not node ids should be included in the dump. bool show_ids_;
diff --git a/content/browser/accessibility/accessibility_tree_formatter_android.cc b/content/browser/accessibility/accessibility_tree_formatter_android.cc index 7d2e18a5..33fb318 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_android.cc +++ b/content/browser/accessibility/accessibility_tree_formatter_android.cc
@@ -72,6 +72,7 @@ const std::string GetAllowEmptyString() override; const std::string GetAllowString() override; const std::string GetDenyString() override; + const std::string GetDenyNodeString() override; void AddProperties(const BrowserAccessibility& node, base::DictionaryValue* dict) override; base::string16 ProcessTreeForOutput( @@ -235,4 +236,8 @@ return "@ANDROID-DENY:"; } +const std::string AccessibilityTreeFormatterAndroid::GetDenyNodeString() { + return "@ANDROID-DENY-NODE:"; +} + } // namespace content
diff --git a/content/browser/accessibility/accessibility_tree_formatter_auralinux.cc b/content/browser/accessibility/accessibility_tree_formatter_auralinux.cc index 21d0e1d..dda48cb 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_auralinux.cc +++ b/content/browser/accessibility/accessibility_tree_formatter_auralinux.cc
@@ -36,6 +36,7 @@ const std::string GetAllowEmptyString() override; const std::string GetAllowString() override; const std::string GetDenyString() override; + const std::string GetDenyNodeString() override; void AddProperties(const BrowserAccessibility& node, base::DictionaryValue* dict) override; @@ -340,4 +341,8 @@ return "@AURALINUX-DENY:"; } +const std::string AccessibilityTreeFormatterAuraLinux::GetDenyNodeString() { + return "@AURALINUX-DENY-NODE:"; +} + } // namespace content
diff --git a/content/browser/accessibility/accessibility_tree_formatter_blink.cc b/content/browser/accessibility/accessibility_tree_formatter_blink.cc index 8dbd3a3..da6578c 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_blink.cc +++ b/content/browser/accessibility/accessibility_tree_formatter_blink.cc
@@ -504,4 +504,8 @@ return "@BLINK-DENY:"; } +const std::string AccessibilityTreeFormatterBlink::GetDenyNodeString() { + return "@BLINK-DENY-NODE:"; +} + } // namespace content
diff --git a/content/browser/accessibility/accessibility_tree_formatter_blink.h b/content/browser/accessibility/accessibility_tree_formatter_blink.h index 28ae7e34..796d73f 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_blink.h +++ b/content/browser/accessibility/accessibility_tree_formatter_blink.h
@@ -6,6 +6,7 @@ #define CONTENT_BROWSER_ACCESSIBILITY_ACCESSIBILITY_TREE_FORMATTER_BLINK_H_ #include <stdint.h> +#include <string> #include "content/browser/accessibility/accessibility_tree_formatter_browser.h" @@ -22,6 +23,7 @@ const std::string GetAllowEmptyString() override; const std::string GetAllowString() override; const std::string GetDenyString() override; + const std::string GetDenyNodeString() override; uint32_t ChildCount(const BrowserAccessibility& node) const override; BrowserAccessibility* GetChild(const BrowserAccessibility& node, uint32_t i) const override;
diff --git a/content/browser/accessibility/accessibility_tree_formatter_mac.mm b/content/browser/accessibility/accessibility_tree_formatter_mac.mm index a36d69e..4a6e915 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_mac.mm +++ b/content/browser/accessibility/accessibility_tree_formatter_mac.mm
@@ -224,6 +224,7 @@ const std::string GetAllowEmptyString() override; const std::string GetAllowString() override; const std::string GetDenyString() override; + const std::string GetDenyNodeString() override; void AddProperties(const BrowserAccessibility& node, base::DictionaryValue* dict) override; base::string16 ProcessTreeForOutput(const base::DictionaryValue& node, @@ -365,6 +366,10 @@ return "@MAC-DENY:"; } +const string AccessibilityTreeFormatterMac::GetDenyNodeString() { + return "@MAC-DENY-NODE:"; +} + } // namespace content #pragma clang diagnostic pop
diff --git a/content/browser/accessibility/accessibility_tree_formatter_stub.cc b/content/browser/accessibility/accessibility_tree_formatter_stub.cc index cb7bb0a4d..9e6dbcf 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_stub.cc +++ b/content/browser/accessibility/accessibility_tree_formatter_stub.cc
@@ -18,6 +18,7 @@ const std::string GetAllowEmptyString() override; const std::string GetAllowString() override; const std::string GetDenyString() override; + const std::string GetDenyNodeString() override; void AddProperties(const BrowserAccessibility& node, base::DictionaryValue* dict) override; base::string16 ProcessTreeForOutput( @@ -70,4 +71,8 @@ return std::string(); } +const std::string AccessibilityTreeFormatterStub::GetDenyNodeString() { + return std::string(); +} + } // namespace content
diff --git a/content/browser/accessibility/accessibility_tree_formatter_win.cc b/content/browser/accessibility/accessibility_tree_formatter_win.cc index fa5b650b..aa2315e 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_win.cc +++ b/content/browser/accessibility/accessibility_tree_formatter_win.cc
@@ -89,6 +89,7 @@ const std::string GetAllowEmptyString() override; const std::string GetAllowString() override; const std::string GetDenyString() override; + const std::string GetDenyNodeString() override; void AddProperties(const Microsoft::WRL::ComPtr<IAccessible>, base::DictionaryValue* dict, LONG root_x, @@ -983,4 +984,8 @@ return "@WIN-DENY:"; } +const std::string AccessibilityTreeFormatterWin::GetDenyNodeString() { + return "@WIN-DENY-NODE:"; +} + } // namespace content
diff --git a/content/browser/accessibility/accessibility_win_browsertest.cc b/content/browser/accessibility/accessibility_win_browsertest.cc index 12d8e998..169065b 100644 --- a/content/browser/accessibility/accessibility_win_browsertest.cc +++ b/content/browser/accessibility/accessibility_win_browsertest.cc
@@ -150,8 +150,8 @@ AccessibilityTreeFormatter::Create()); DCHECK(formatter); formatter->set_show_ids(true); - formatter->SetFilters({AccessibilityTreeFormatter::Filter( - L"*", AccessibilityTreeFormatter::Filter::ALLOW)}); + formatter->SetPropertyFilters({AccessibilityTreeFormatter::PropertyFilter( + L"*", AccessibilityTreeFormatter::PropertyFilter::ALLOW)}); base::string16 str; formatter->FormatAccessibilityTree(
diff --git a/content/browser/accessibility/dump_accessibility_browsertest_base.cc b/content/browser/accessibility/dump_accessibility_browsertest_base.cc index 85730c7f..1d38171 100644 --- a/content/browser/accessibility/dump_accessibility_browsertest_base.cc +++ b/content/browser/accessibility/dump_accessibility_browsertest_base.cc
@@ -76,7 +76,8 @@ } // namespace -typedef AccessibilityTreeFormatter::Filter Filter; +typedef AccessibilityTreeFormatter::PropertyFilter PropertyFilter; +typedef AccessibilityTreeFormatter::NodeFilter NodeFilter; DumpAccessibilityTestBase::DumpAccessibilityTestBase() : is_blink_pass_(false), @@ -101,9 +102,10 @@ DumpAccessibilityTestBase::DumpUnfilteredAccessibilityTreeAsString() { std::unique_ptr<AccessibilityTreeFormatter> formatter( CreateAccessibilityTreeFormatter()); - std::vector<Filter> filters; - filters.push_back(Filter(base::ASCIIToUTF16("*"), Filter::ALLOW)); - formatter->SetFilters(filters); + std::vector<PropertyFilter> property_filters; + property_filters.push_back( + PropertyFilter(base::ASCIIToUTF16("*"), PropertyFilter::ALLOW)); + formatter->SetPropertyFilters(property_filters); formatter->set_show_ids(true); WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( shell()->web_contents()); @@ -149,25 +151,35 @@ const std::string& allow_empty_str = formatter_->GetAllowEmptyString(); const std::string& allow_str = formatter_->GetAllowString(); const std::string& deny_str = formatter_->GetDenyString(); + const std::string& deny_node_str = formatter_->GetDenyNodeString(); const std::string& wait_str = "@WAIT-FOR:"; const std::string& until_str = "@RUN-UNTIL-EVENT:"; if (base::StartsWith(line, allow_empty_str, base::CompareCase::SENSITIVE)) { - filters_.push_back( - Filter(base::UTF8ToUTF16(line.substr(allow_empty_str.size())), - Filter::ALLOW_EMPTY)); + property_filters_.push_back( + PropertyFilter(base::UTF8ToUTF16(line.substr(allow_empty_str.size())), + PropertyFilter::ALLOW_EMPTY)); } else if (base::StartsWith(line, allow_str, base::CompareCase::SENSITIVE)) { - filters_.push_back(Filter(base::UTF8ToUTF16( - line.substr(allow_str.size())), - Filter::ALLOW)); + property_filters_.push_back( + PropertyFilter(base::UTF8ToUTF16(line.substr(allow_str.size())), + PropertyFilter::ALLOW)); } else if (base::StartsWith(line, deny_str, base::CompareCase::SENSITIVE)) { - filters_.push_back(Filter(base::UTF8ToUTF16( - line.substr(deny_str.size())), - Filter::DENY)); - } else if (base::StartsWith(line, wait_str, + property_filters_.push_back( + PropertyFilter(base::UTF8ToUTF16(line.substr(deny_str.size())), + PropertyFilter::DENY)); + } else if (base::StartsWith(line, deny_node_str, base::CompareCase::SENSITIVE)) { + const auto& node_filter = line.substr(deny_node_str.size()); + const auto& parts = base::SplitString( + node_filter, "=", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); + // Silently skip over parsing errors like the rest of the enclosing code. + if (parts.size() == 2) { + node_filters_.push_back( + NodeFilter(parts[0], base::UTF8ToUTF16(parts[1]))); + } + } else if (base::StartsWith(line, wait_str, base::CompareCase::SENSITIVE)) { wait_for->push_back(line.substr(wait_str.size())); } else if (base::StartsWith(line, until_str, base::CompareCase::SENSITIVE)) { @@ -259,8 +271,9 @@ // Parse filters and other directives in the test file. std::vector<std::string> wait_for; std::vector<std::string> run_until; - filters_.clear(); - AddDefaultFilters(&filters_); + property_filters_.clear(); + node_filters_.clear(); + AddDefaultFilters(&property_filters_); ParseHtmlForExtraDirectives(html_contents, &wait_for, &run_until); // Get the test URL.
diff --git a/content/browser/accessibility/dump_accessibility_browsertest_base.h b/content/browser/accessibility/dump_accessibility_browsertest_base.h index 9db6c25..058fe0b 100644 --- a/content/browser/accessibility/dump_accessibility_browsertest_base.h +++ b/content/browser/accessibility/dump_accessibility_browsertest_base.h
@@ -52,7 +52,8 @@ // Add the default filters that are applied to all tests. virtual void AddDefaultFilters( - std::vector<AccessibilityTreeFormatter::Filter>* filters) = 0; + std::vector<AccessibilityTreeFormatter::PropertyFilter>* + property_filters) = 0; // This gets called if the diff didn't match; the test can print // additional useful info. @@ -75,10 +76,10 @@ // beginning with an '@' and inside an HTML comment, that control how the // test is run and how the results are interpreted. // - // When the accessibility tree is dumped as text, each attribute is - // run through filters before being appended to the string. An "allow" + // When the accessibility tree is dumped as text, each node and each attribute + // is run through filters before being appended to the string. An "allow" // filter specifies attribute strings that should be dumped, and a "deny" - // filter specifies strings that should be suppressed. As an example, + // filter specifies strings or nodes that should be suppressed. As an example, // @MAC-ALLOW:AXSubrole=* means that the AXSubrole attribute should be // printed, while @MAC-ALLOW:AXSubrole=AXList* means that any subrole // beginning with the text "AXList" should be printed. @@ -101,8 +102,12 @@ void RunTestForPlatform(const base::FilePath file_path, const char* file_dir); - // The default filters plus the filters loaded from the test file. - std::vector<AccessibilityTreeFormatter::Filter> filters_; + // The default property filters plus the property filters loaded from the test + // file. + std::vector<AccessibilityTreeFormatter::PropertyFilter> property_filters_; + + // The node filters loaded from the test file. + std::vector<AccessibilityTreeFormatter::NodeFilter> node_filters_; #if defined(LEAK_SANITIZER) && !defined(OS_NACL) // http://crbug.com/568674
diff --git a/content/browser/accessibility/dump_accessibility_events_browsertest.cc b/content/browser/accessibility/dump_accessibility_events_browsertest.cc index 4437c98fa..fb483fb 100644 --- a/content/browser/accessibility/dump_accessibility_events_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_events_browsertest.cc
@@ -27,7 +27,7 @@ namespace content { -typedef AccessibilityTreeFormatter::Filter Filter; +typedef AccessibilityTreeFormatter::PropertyFilter PropertyFilter; // See content/test/data/accessibility/readme.md for an overview. // @@ -63,10 +63,12 @@ // the end of the test; anything received after that is too late. class DumpAccessibilityEventsTest : public DumpAccessibilityTestBase { public: - void AddDefaultFilters(std::vector<Filter>* filters) override { + void AddDefaultFilters( + std::vector<PropertyFilter>* property_filters) override { // Suppress spurious focus events on the document object. - filters->push_back(Filter( - base::ASCIIToUTF16("EVENT_OBJECT_FOCUS*DOCUMENT*"), Filter::DENY)); + property_filters->push_back( + PropertyFilter(base::ASCIIToUTF16("EVENT_OBJECT_FOCUS*DOCUMENT*"), + PropertyFilter::DENY)); } std::vector<std::string> Dump(std::vector<std::string>& run_until) override; @@ -148,8 +150,8 @@ std::vector<std::string> event_logs = event_recorder->event_logs(); std::vector<std::string> result; for (size_t i = 0; i < event_logs.size(); ++i) { - if (AccessibilityTreeFormatter::MatchesFilters( - filters_, base::UTF8ToUTF16(event_logs[i]), true)) { + if (AccessibilityTreeFormatter::MatchesPropertyFilters( + property_filters_, base::UTF8ToUTF16(event_logs[i]), true)) { result.push_back(event_logs[i]); } }
diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc index 3603e0d..b56e5a95 100644 --- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
@@ -43,7 +43,7 @@ namespace content { -typedef AccessibilityTreeFormatter::Filter Filter; +typedef AccessibilityTreeFormatter::PropertyFilter PropertyFilter; // See content/test/data/accessibility/readme.md for an overview. // @@ -59,11 +59,13 @@ // exactly match. class DumpAccessibilityTreeTest : public DumpAccessibilityTestBase { public: - void AddDefaultFilters(std::vector<Filter>* filters) override; - void AddFilter(std::vector<Filter>* filters, - std::string filter, - Filter::Type type = Filter::ALLOW) { - filters->push_back(Filter(base::ASCIIToUTF16(filter), type)); + void AddDefaultFilters( + std::vector<PropertyFilter>* property_filters) override; + void AddPropertyFilter(std::vector<PropertyFilter>* property_filters, + std::string filter, + PropertyFilter::Type type = PropertyFilter::ALLOW) { + property_filters->push_back( + PropertyFilter(base::ASCIIToUTF16(filter), type)); } void SetUpCommandLine(base::CommandLine* command_line) override { @@ -130,7 +132,8 @@ std::vector<std::string> Dump(std::vector<std::string>& unused) override { std::unique_ptr<AccessibilityTreeFormatter> formatter( CreateAccessibilityTreeFormatter()); - formatter->SetFilters(filters_); + formatter->SetPropertyFilters(property_filters_); + formatter->SetNodeFilters(node_filters_); base::string16 actual_contents_utf16; WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( shell()->web_contents()); @@ -155,10 +158,23 @@ RunTest(language_detection_file, "accessibility/language-detection"); } + + // Testing of the Test Harness itself. + void RunTestHarnessTest(const base::FilePath::CharType* file_path) { + base::FilePath test_path = GetTestFilePath("accessibility", "test-harness"); + { + base::ScopedAllowBlockingForTesting allow_blocking; + ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName(); + } + base::FilePath test_harness_file = + test_path.Append(base::FilePath(file_path)); + + RunTest(test_harness_file, "accessibility/test-harness"); + } }; void DumpAccessibilityTreeTest::AddDefaultFilters( - std::vector<Filter>* filters) { + std::vector<PropertyFilter>* property_filters) { // TODO(aleventhal) Each platform deserves separate default filters. // @@ -170,50 +186,50 @@ // IA2_STATE_SINGLE_LINE, IA2_STATE_VERTICAL. // Too unpredictible: OFFSCREEN // Windows states to log by default: - AddFilter(filters, "ALERT*"); - AddFilter(filters, "ANIMATED*"); - AddFilter(filters, "BUSY"); - AddFilter(filters, "CHECKED"); - AddFilter(filters, "COLLAPSED"); - AddFilter(filters, "EXPANDED"); - AddFilter(filters, "FLOATING"); - AddFilter(filters, "FOCUSABLE"); - AddFilter(filters, "HASPOPUP"); - AddFilter(filters, "INVISIBLE"); - AddFilter(filters, "MARQUEED"); - AddFilter(filters, "MIXED"); - AddFilter(filters, "MOVEABLE"); - AddFilter(filters, "MULTISELECTABLE"); - AddFilter(filters, "PRESSED"); - AddFilter(filters, "PROTECTED"); - AddFilter(filters, "READONLY"); - AddFilter(filters, "SELECTED"); - AddFilter(filters, "SIZEABLE"); - AddFilter(filters, "TRAVERSED"); - AddFilter(filters, "UNAVAILABLE"); - AddFilter(filters, "IA2_STATE_ACTIVE"); - AddFilter(filters, "IA2_STATE_ARMED"); - AddFilter(filters, "IA2_STATE_CHECKABLE"); - AddFilter(filters, "IA2_STATE_DEFUNCT"); - AddFilter(filters, "IA2_STATE_HORIZONTAL"); - AddFilter(filters, "IA2_STATE_ICONIFIED"); - AddFilter(filters, "IA2_STATE_INVALID_ENTRY"); - AddFilter(filters, "IA2_STATE_MODAL"); - AddFilter(filters, "IA2_STATE_MULTI_LINE"); - AddFilter(filters, "IA2_STATE_PINNED"); - AddFilter(filters, "IA2_STATE_REQUIRED"); - AddFilter(filters, "IA2_STATE_STALE"); - AddFilter(filters, "IA2_STATE_TRANSIENT"); + AddPropertyFilter(property_filters, "ALERT*"); + AddPropertyFilter(property_filters, "ANIMATED*"); + AddPropertyFilter(property_filters, "BUSY"); + AddPropertyFilter(property_filters, "CHECKED"); + AddPropertyFilter(property_filters, "COLLAPSED"); + AddPropertyFilter(property_filters, "EXPANDED"); + AddPropertyFilter(property_filters, "FLOATING"); + AddPropertyFilter(property_filters, "FOCUSABLE"); + AddPropertyFilter(property_filters, "HASPOPUP"); + AddPropertyFilter(property_filters, "INVISIBLE"); + AddPropertyFilter(property_filters, "MARQUEED"); + AddPropertyFilter(property_filters, "MIXED"); + AddPropertyFilter(property_filters, "MOVEABLE"); + AddPropertyFilter(property_filters, "MULTISELECTABLE"); + AddPropertyFilter(property_filters, "PRESSED"); + AddPropertyFilter(property_filters, "PROTECTED"); + AddPropertyFilter(property_filters, "READONLY"); + AddPropertyFilter(property_filters, "SELECTED"); + AddPropertyFilter(property_filters, "SIZEABLE"); + AddPropertyFilter(property_filters, "TRAVERSED"); + AddPropertyFilter(property_filters, "UNAVAILABLE"); + AddPropertyFilter(property_filters, "IA2_STATE_ACTIVE"); + AddPropertyFilter(property_filters, "IA2_STATE_ARMED"); + AddPropertyFilter(property_filters, "IA2_STATE_CHECKABLE"); + AddPropertyFilter(property_filters, "IA2_STATE_DEFUNCT"); + AddPropertyFilter(property_filters, "IA2_STATE_HORIZONTAL"); + AddPropertyFilter(property_filters, "IA2_STATE_ICONIFIED"); + AddPropertyFilter(property_filters, "IA2_STATE_INVALID_ENTRY"); + AddPropertyFilter(property_filters, "IA2_STATE_MODAL"); + AddPropertyFilter(property_filters, "IA2_STATE_MULTI_LINE"); + AddPropertyFilter(property_filters, "IA2_STATE_PINNED"); + AddPropertyFilter(property_filters, "IA2_STATE_REQUIRED"); + AddPropertyFilter(property_filters, "IA2_STATE_STALE"); + AddPropertyFilter(property_filters, "IA2_STATE_TRANSIENT"); // Reduce flakiness. - AddFilter(filters, "FOCUSED", Filter::DENY); - AddFilter(filters, "HOTTRACKED", Filter::DENY); - AddFilter(filters, "OFFSCREEN", Filter::DENY); - AddFilter(filters, "value='*'"); + AddPropertyFilter(property_filters, "FOCUSED", PropertyFilter::DENY); + AddPropertyFilter(property_filters, "HOTTRACKED", PropertyFilter::DENY); + AddPropertyFilter(property_filters, "OFFSCREEN", PropertyFilter::DENY); + AddPropertyFilter(property_filters, "value='*'"); // The value attribute on the document object contains the URL of the current // page which will not be the same every time the test is run. - AddFilter(filters, "value='http*'", Filter::DENY); + AddPropertyFilter(property_filters, "value='http*'", PropertyFilter::DENY); // Object attributes.value - AddFilter(filters, "layout-guess:*", Filter::ALLOW); + AddPropertyFilter(property_filters, "layout-guess:*", PropertyFilter::ALLOW); // // Blink @@ -223,61 +239,62 @@ // editable, focus*, horizontal, linked, richlyEditable, vertical // Too flaky: hovered, offscreen // States - AddFilter(filters, "check*"); - AddFilter(filters, "descript*"); - AddFilter(filters, "collapsed"); - AddFilter(filters, "haspopup"); - AddFilter(filters, "horizontal"); - AddFilter(filters, "invisible"); - AddFilter(filters, "multiline"); - AddFilter(filters, "multiselectable"); - AddFilter(filters, "protected"); - AddFilter(filters, "required"); - AddFilter(filters, "select*"); - AddFilter(filters, "visited"); + AddPropertyFilter(property_filters, "check*"); + AddPropertyFilter(property_filters, "descript*"); + AddPropertyFilter(property_filters, "collapsed"); + AddPropertyFilter(property_filters, "haspopup"); + AddPropertyFilter(property_filters, "horizontal"); + AddPropertyFilter(property_filters, "invisible"); + AddPropertyFilter(property_filters, "multiline"); + AddPropertyFilter(property_filters, "multiselectable"); + AddPropertyFilter(property_filters, "protected"); + AddPropertyFilter(property_filters, "required"); + AddPropertyFilter(property_filters, "select*"); + AddPropertyFilter(property_filters, "visited"); // Other attributes - AddFilter(filters, "busy=true"); - AddFilter(filters, "valueForRange*"); - AddFilter(filters, "minValueForRange*"); - AddFilter(filters, "maxValueForRange*"); - AddFilter(filters, "hierarchicalLevel*"); - AddFilter(filters, "autoComplete*"); - AddFilter(filters, "restriction*"); - AddFilter(filters, "keyShortcuts*"); - AddFilter(filters, "activedescendantId*"); - AddFilter(filters, "controlsIds*"); - AddFilter(filters, "flowtoIds*"); - AddFilter(filters, "detailsIds*"); - AddFilter(filters, "invalidState=*"); - AddFilter(filters, "invalidState=false", - Filter::DENY); // Don't show false value - AddFilter(filters, "roleDescription=*"); - AddFilter(filters, "errormessageId=*"); + AddPropertyFilter(property_filters, "busy=true"); + AddPropertyFilter(property_filters, "valueForRange*"); + AddPropertyFilter(property_filters, "minValueForRange*"); + AddPropertyFilter(property_filters, "maxValueForRange*"); + AddPropertyFilter(property_filters, "hierarchicalLevel*"); + AddPropertyFilter(property_filters, "autoComplete*"); + AddPropertyFilter(property_filters, "restriction*"); + AddPropertyFilter(property_filters, "keyShortcuts*"); + AddPropertyFilter(property_filters, "activedescendantId*"); + AddPropertyFilter(property_filters, "controlsIds*"); + AddPropertyFilter(property_filters, "flowtoIds*"); + AddPropertyFilter(property_filters, "detailsIds*"); + AddPropertyFilter(property_filters, "invalidState=*"); + AddPropertyFilter(property_filters, "invalidState=false", + PropertyFilter::DENY); // Don't show false value + AddPropertyFilter(property_filters, "roleDescription=*"); + AddPropertyFilter(property_filters, "errormessageId=*"); // // OS X // - AddFilter(filters, "AXValueAutofill*"); - AddFilter(filters, "AXAutocomplete*"); + AddPropertyFilter(property_filters, "AXValueAutofill*"); + AddPropertyFilter(property_filters, "AXAutocomplete*"); // // Android // - AddFilter(filters, "hint=*"); - AddFilter(filters, "interesting", Filter::DENY); - AddFilter(filters, "has_character_locations", Filter::DENY); - AddFilter(filters, "has_image", Filter::DENY); + AddPropertyFilter(property_filters, "hint=*"); + AddPropertyFilter(property_filters, "interesting", PropertyFilter::DENY); + AddPropertyFilter(property_filters, "has_character_locations", + PropertyFilter::DENY); + AddPropertyFilter(property_filters, "has_image", PropertyFilter::DENY); // // General // // Deny most empty values - AddFilter(filters, "*=''", Filter::DENY); + AddPropertyFilter(property_filters, "*=''", PropertyFilter::DENY); // After denying empty values, because we want to allow name='' - AddFilter(filters, "name=*", Filter::ALLOW_EMPTY); + AddPropertyFilter(property_filters, "name=*", PropertyFilter::ALLOW_EMPTY); } IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCSSColor) { @@ -1993,4 +2010,17 @@ RunLanguageDetectionTest(FILE_PATH_LITERAL("lang-attribute-switching.html")); } +IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, + LanguageDetectionLangDetectionBasic) { + RunLanguageDetectionTest(FILE_PATH_LITERAL("lang-detection-basic.html")); +} + +// +// These tests cover features of the testing infrastructure itself. +// + +IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, DenyNode) { + RunTestHarnessTest(FILE_PATH_LITERAL("deny-node.html")); +} + } // namespace content
diff --git a/content/browser/appcache/appcache_request_handler_unittest.cc b/content/browser/appcache/appcache_request_handler_unittest.cc index 37996ee3..63fca92 100644 --- a/content/browser/appcache/appcache_request_handler_unittest.cc +++ b/content/browser/appcache/appcache_request_handler_unittest.cc
@@ -1061,8 +1061,8 @@ RunTestOnIOThread(&AppCacheRequestHandlerTest::MainResource_Blocked); } -INSTANTIATE_TEST_CASE_P(, - AppCacheRequestHandlerTest, - ::testing::Values(URLREQUEST, URLLOADER)); +INSTANTIATE_TEST_SUITE_P(, + AppCacheRequestHandlerTest, + ::testing::Values(URLREQUEST, URLLOADER)); } // namespace content
diff --git a/content/browser/appcache/appcache_subresource_url_factory.cc b/content/browser/appcache/appcache_subresource_url_factory.cc index 835b0762..6a50fbf9 100644 --- a/content/browser/appcache/appcache_subresource_url_factory.cc +++ b/content/browser/appcache/appcache_subresource_url_factory.cc
@@ -369,8 +369,7 @@ if (request.request_initiator.has_value() && !request.request_initiator.value().opaque() && appcache_host_ && !ChildProcessSecurityPolicyImpl::GetInstance()->CanAccessDataForOrigin( - appcache_host_->process_id(), - request.request_initiator.value().GetURL())) { + appcache_host_->process_id(), request.request_initiator.value())) { const char* scheme_exception = GetContentClient() ->browser()
diff --git a/content/browser/blob_storage/blob_url_browsertest.cc b/content/browser/blob_storage/blob_url_browsertest.cc index e07b0de..4950a49 100644 --- a/content/browser/blob_storage/blob_url_browsertest.cc +++ b/content/browser/blob_storage/blob_url_browsertest.cc
@@ -43,7 +43,7 @@ DISALLOW_COPY_AND_ASSIGN(BlobUrlBrowserTest); }; -INSTANTIATE_TEST_CASE_P(_, BlobUrlBrowserTest, ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(_, BlobUrlBrowserTest, ::testing::Bool()); IN_PROC_BROWSER_TEST_P(BlobUrlBrowserTest, LinkToUniqueOriginBlob) { // Use a data URL to obtain a test page in a unique origin. The page
diff --git a/content/browser/blob_storage/blob_url_unittest.cc b/content/browser/blob_storage/blob_url_unittest.cc index a63695e9..9e53c46e3 100644 --- a/content/browser/blob_storage/blob_url_unittest.cc +++ b/content/browser/blob_storage/blob_url_unittest.cc
@@ -688,7 +688,7 @@ } // The parameter's value determines whether BlobURLLoaderFactory is used. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( BlobURLRequestJobTest, BlobURLRequestJobTest, ::testing::Values(RequestTestType::kNetRequest,
diff --git a/content/browser/broadcast_channel/broadcast_channel_provider.cc b/content/browser/broadcast_channel/broadcast_channel_provider.cc index 8e7ddea5..ba5a5d85 100644 --- a/content/browser/broadcast_channel/broadcast_channel_provider.cc +++ b/content/browser/broadcast_channel/broadcast_channel_provider.cc
@@ -79,7 +79,7 @@ blink::mojom::BroadcastChannelClientAssociatedRequest connection) { RenderProcessHostId process_id = bindings_.dispatch_context(); auto* policy = ChildProcessSecurityPolicyImpl::GetInstance(); - if (!policy->CanAccessDataForOrigin(process_id, origin.GetURL())) { + if (!policy->CanAccessDataForOrigin(process_id, origin)) { mojo::ReportBadMessage("BROADCAST_CHANNEL_INVALID_ORIGIN"); return; }
diff --git a/content/browser/cache_storage/cache_storage_cache_unittest.cc b/content/browser/cache_storage/cache_storage_cache_unittest.cc index 0da10b1..e4455b5f 100644 --- a/content/browser/cache_storage/cache_storage_cache_unittest.cc +++ b/content/browser/cache_storage/cache_storage_cache_unittest.cc
@@ -2305,9 +2305,9 @@ EXPECT_EQ(expected_keys, callback_strings_); } -INSTANTIATE_TEST_CASE_P(CacheStorageCacheTest, - CacheStorageCacheTestP, - ::testing::Values(false, true)); +INSTANTIATE_TEST_SUITE_P(CacheStorageCacheTest, + CacheStorageCacheTestP, + ::testing::Values(false, true)); } // namespace cache_storage_cache_unittest } // namespace content
diff --git a/content/browser/cache_storage/cache_storage_manager_unittest.cc b/content/browser/cache_storage/cache_storage_manager_unittest.cc index 4770727..172a80b 100644 --- a/content/browser/cache_storage/cache_storage_manager_unittest.cc +++ b/content/browser/cache_storage/cache_storage_manager_unittest.cc
@@ -2240,13 +2240,13 @@ EXPECT_FALSE(QuotaDoesSupport(StorageType::kUnknown)); } -INSTANTIATE_TEST_CASE_P(CacheStorageManagerTests, - CacheStorageManagerTestP, - ::testing::Values(false, true)); +INSTANTIATE_TEST_SUITE_P(CacheStorageManagerTests, + CacheStorageManagerTestP, + ::testing::Values(false, true)); -INSTANTIATE_TEST_CASE_P(CacheStorageQuotaClientTests, - CacheStorageQuotaClientTestP, - ::testing::Values(false, true)); +INSTANTIATE_TEST_SUITE_P(CacheStorageQuotaClientTests, + CacheStorageQuotaClientTestP, + ::testing::Values(false, true)); } // namespace cache_storage_manager_unittest } // namespace content
diff --git a/content/browser/child_process_security_policy_impl.cc b/content/browser/child_process_security_policy_impl.cc index 7347cd4e..28e5c544 100644 --- a/content/browser/child_process_security_policy_impl.cc +++ b/content/browser/child_process_security_policy_impl.cc
@@ -121,6 +121,12 @@ return false; } +base::debug::CrashKeyString* GetRequestedOriginCrashKey() { + static auto* requested_origin_key = base::debug::AllocateCrashKeyString( + "requested_origin", base::debug::CrashKeySize::Size256); + return requested_origin_key; +} + } // namespace // The SecurityState class is used to maintain per-child process security state @@ -1236,6 +1242,18 @@ return state->second->HasPermissionsForFile(file, permissions); } +bool ChildProcessSecurityPolicyImpl::CanAccessDataForOrigin( + int child_id, + const url::Origin& origin) { + bool success = CanAccessDataForOrigin(child_id, origin.GetURL()); + if (success) + return true; + + auto* requested_origin_key = GetRequestedOriginCrashKey(); + base::debug::SetCrashKeyString(requested_origin_key, origin.GetDebugString()); + return false; +} + bool ChildProcessSecurityPolicyImpl::CanAccessDataForOrigin(int child_id, const GURL& url) { DCHECK(IsRunningOnExpectedThread()); @@ -1277,8 +1295,7 @@ base::debug::SetCrashKeyString(bad_message::GetKilledProcessOriginLockKey(), killed_process_origin_lock); - static auto* requested_origin_key = base::debug::AllocateCrashKeyString( - "requested_origin", base::debug::CrashKeySize::Size64); + auto* requested_origin_key = GetRequestedOriginCrashKey(); base::debug::SetCrashKeyString(requested_origin_key, url.GetOrigin().spec()); }
diff --git a/content/browser/child_process_security_policy_impl.h b/content/browser/child_process_security_policy_impl.h index 994aebf..f9b73ce 100644 --- a/content/browser/child_process_security_policy_impl.h +++ b/content/browser/child_process_security_policy_impl.h
@@ -100,6 +100,9 @@ void GrantSendMidiSysExMessage(int child_id) override; bool CanAccessDataForOrigin(int child_id, const GURL& url) override; + // Identical to the above method, but takes url::Origin as input. + bool CanAccessDataForOrigin(int child_id, const url::Origin& origin); + // This function will check whether |origin| requires process isolation // within |isolation_context|, and if so, it will return true and put the // most specific matching isolated origin into |result|.
diff --git a/content/browser/cookie_store/cookie_store_manager_unittest.cc b/content/browser/cookie_store/cookie_store_manager_unittest.cc index 587cda44..5981dd12 100644 --- a/content/browser/cookie_store/cookie_store_manager_unittest.cc +++ b/content/browser/cookie_store/cookie_store_manager_unittest.cc
@@ -908,9 +908,9 @@ EXPECT_FALSE(wrong_subscriptions_opt.has_value()); } -INSTANTIATE_TEST_CASE_P(CookieStoreManagerTest, - CookieStoreManagerTest, - testing::Bool() /* reset_storage_during_test */); +INSTANTIATE_TEST_SUITE_P(CookieStoreManagerTest, + CookieStoreManagerTest, + testing::Bool() /* reset_storage_during_test */); } // namespace
diff --git a/content/browser/devtools/devtools_agent_host_impl.cc b/content/browser/devtools/devtools_agent_host_impl.cc index a5a60cf..e2678a5db 100644 --- a/content/browser/devtools/devtools_agent_host_impl.cc +++ b/content/browser/devtools/devtools_agent_host_impl.cc
@@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/lazy_instance.h" #include "base/observer_list.h" +#include "base/stl_util.h" #include "content/browser/devtools/devtools_manager.h" #include "content/browser/devtools/forwarding_agent_host.h" #include "content/browser/devtools/protocol/page.h" @@ -174,7 +175,7 @@ DCHECK_EQ(session, session_owned.get()); // Make sure we dispose session prior to reporting it to the host. session->Dispose(); - sessions_.erase(std::remove(sessions_.begin(), sessions_.end(), session)); + base::Erase(sessions_, session); session_by_client_.erase(session->client()); DetachSession(session); DevToolsManager* manager = DevToolsManager::GetInstance();
diff --git a/content/browser/dom_storage/session_storage_context_mojo.cc b/content/browser/dom_storage/session_storage_context_mojo.cc index 408b6138..2696fe9 100644 --- a/content/browser/dom_storage/session_storage_context_mojo.cc +++ b/content/browser/dom_storage/session_storage_context_mojo.cc
@@ -16,6 +16,7 @@ #include "base/memory/ptr_util.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" +#include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/system/sys_info.h" @@ -187,9 +188,9 @@ std::unique_ptr<SessionStorageNamespaceImplMojo> namespace_impl = CreateSessionStorageNamespaceImplMojo(clone_namespace_id); + auto clone_from_ns = namespaces_.find(namespace_id_to_clone); switch (clone_type) { case CloneType::kImmediate: { - auto clone_from_ns = namespaces_.find(namespace_id_to_clone); // If the namespace doesn't exist or it's not populated yet, just create // an empty session storage. if (clone_from_ns == namespaces_.end() || @@ -200,7 +201,32 @@ return; } case CloneType::kWaitForCloneOnNamespace: - namespace_impl->SetWaitingForClonePopulation(); + if (clone_from_ns != namespaces_.end()) { + // The namespace exists and is in-use, so wait until receiving a clone + // call on that mojo binding. + namespace_impl->SetWaitingForClonePopulation(); + clone_from_ns->second->AddNamespacesWaitingForClone(clone_namespace_id); + } else if (base::ContainsKey(metadata_.namespace_origin_map(), + namespace_id_to_clone)) { + // The namespace exists on disk but is not in-use, so do the appropriate + // metadata operations to clone the namespace and set up the new object. + std::vector<leveldb::mojom::BatchedOperationPtr> save_operations; + auto source_namespace_entry = + metadata_.GetOrCreateNamespaceEntry(namespace_id_to_clone); + auto namespace_entry = + metadata_.GetOrCreateNamespaceEntry(clone_namespace_id); + metadata_.RegisterShallowClonedNamespace( + source_namespace_entry, namespace_entry, &save_operations); + if (database_) { + database_->Write( + std::move(save_operations), + base::BindOnce(&SessionStorageContextMojo::OnCommitResult, + base::Unretained(this))); + } + namespace_impl->PopulateFromMetadata(database_.get(), namespace_entry); + } + // If there is no sign of a source namespace, just run with an empty + // namespace. break; default: NOTREACHED(); @@ -213,9 +239,14 @@ void SessionStorageContextMojo::DeleteSessionNamespace( const std::string& namespace_id, bool should_persist) { + auto namespace_it = namespaces_.find(namespace_id); + // If the namespace has pending clones, do the clone now before destroying it. + if (namespace_it->second->HasNamespacesWaitingForClone()) { + namespace_it->second->CloneAllNamespacesWaitingForClone(); + } // The object hierarchy uses iterators bound to the metadata object, so make // sure to delete the object hierarchy first. - namespaces_.erase(namespace_id); + namespaces_.erase(namespace_it); if (!has_scavenged_ && should_persist) protected_namespaces_from_scavenge_.insert(namespace_id); @@ -981,7 +1012,7 @@ void SessionStorageContextMojo::LogDatabaseOpenResult(OpenResult result) { if (result != OpenResult::kSuccess) { - LOG(ERROR) << "Got error when openning: " << static_cast<int>(result); + LOG(ERROR) << "Got error when opening: " << static_cast<int>(result); UMA_HISTOGRAM_ENUMERATION("SessionStorageContext.OpenError", result); } if (open_result_histogram_) {
diff --git a/content/browser/dom_storage/session_storage_context_mojo_unittest.cc b/content/browser/dom_storage/session_storage_context_mojo_unittest.cc index 7c1e0d6..7d5e7005 100644 --- a/content/browser/dom_storage/session_storage_context_mojo_unittest.cc +++ b/content/browser/dom_storage/session_storage_context_mojo_unittest.cc
@@ -1192,4 +1192,122 @@ EXPECT_EQ(leveldb::StringPieceToUint8Vector("value2"), opt_value2.value()); } +TEST_F(SessionStorageContextMojoTest, DeleteWithPersistBeforeBrowserClone) { + std::string namespace_id1 = base::GenerateGUID(); + std::string namespace_id2 = base::GenerateGUID(); + url::Origin origin1 = url::Origin::Create(GURL("http://foobar.com")); + context()->CreateSessionNamespace(namespace_id1); + blink::mojom::SessionStorageNamespacePtr ss_namespace1; + context()->OpenSessionStorage( + kTestProcessId, namespace_id1, GetBadMessageCallback(), + mojo::MakeRequest(&ss_namespace1), base::DoNothing()); + blink::mojom::StorageAreaAssociatedPtr leveldb_n1_o1; + ss_namespace1->OpenArea(origin1, mojo::MakeRequest(&leveldb_n1_o1)); + + // Put some data. + EXPECT_TRUE(test::PutSync( + leveldb_n1_o1.get(), leveldb::StringPieceToUint8Vector("key1"), + leveldb::StringPieceToUint8Vector("value1"), base::nullopt, "source1")); + + // Delete the origin namespace, but save it. + context()->DeleteSessionNamespace(namespace_id1, true); + + // Do the browser-side clone. + context()->CloneSessionNamespace( + namespace_id1, namespace_id2, + SessionStorageContextMojo::CloneType::kWaitForCloneOnNamespace); + + // Open the second namespace. + blink::mojom::SessionStorageNamespacePtr ss_namespace2; + context()->OpenSessionStorage( + kTestProcessId, namespace_id2, GetBadMessageCallback(), + mojo::MakeRequest(&ss_namespace2), base::DoNothing()); + blink::mojom::StorageAreaAssociatedPtr leveldb_n2_o1; + ss_namespace2->OpenArea(origin1, mojo::MakeRequest(&leveldb_n2_o1)); + + // The data should be in namespace 2. + std::vector<blink::mojom::KeyValuePtr> data; + EXPECT_TRUE(test::GetAllSync(leveldb_n2_o1.get(), &data)); + EXPECT_EQ(1ul, data.size()); +} + +TEST_F(SessionStorageContextMojoTest, DeleteWithoutPersistBeforeBrowserClone) { + std::string namespace_id1 = base::GenerateGUID(); + std::string namespace_id2 = base::GenerateGUID(); + url::Origin origin1 = url::Origin::Create(GURL("http://foobar.com")); + context()->CreateSessionNamespace(namespace_id1); + blink::mojom::SessionStorageNamespacePtr ss_namespace1; + context()->OpenSessionStorage( + kTestProcessId, namespace_id1, GetBadMessageCallback(), + mojo::MakeRequest(&ss_namespace1), base::DoNothing()); + blink::mojom::StorageAreaAssociatedPtr leveldb_n1_o1; + ss_namespace1->OpenArea(origin1, mojo::MakeRequest(&leveldb_n1_o1)); + + // Put some data. + EXPECT_TRUE(test::PutSync( + leveldb_n1_o1.get(), leveldb::StringPieceToUint8Vector("key1"), + leveldb::StringPieceToUint8Vector("value1"), base::nullopt, "source1")); + + // Delete the origin namespace and don't save it. + context()->DeleteSessionNamespace(namespace_id1, false); + + // Do the browser-side clone. + context()->CloneSessionNamespace( + namespace_id1, namespace_id2, + SessionStorageContextMojo::CloneType::kWaitForCloneOnNamespace); + + // Open the second namespace. + blink::mojom::SessionStorageNamespacePtr ss_namespace2; + context()->OpenSessionStorage( + kTestProcessId, namespace_id2, GetBadMessageCallback(), + mojo::MakeRequest(&ss_namespace2), base::DoNothing()); + blink::mojom::StorageAreaAssociatedPtr leveldb_n2_o1; + ss_namespace2->OpenArea(origin1, mojo::MakeRequest(&leveldb_n2_o1)); + + // The data should be gone, because the first namespace wasn't saved to disk. + std::vector<blink::mojom::KeyValuePtr> data; + EXPECT_TRUE(test::GetAllSync(leveldb_n2_o1.get(), &data)); + EXPECT_EQ(0ul, data.size()); +} + +TEST_F(SessionStorageContextMojoTest, DeleteAfterCloneWithoutMojoClone) { + std::string namespace_id1 = base::GenerateGUID(); + std::string namespace_id2 = base::GenerateGUID(); + url::Origin origin1 = url::Origin::Create(GURL("http://foobar.com")); + context()->CreateSessionNamespace(namespace_id1); + blink::mojom::SessionStorageNamespacePtr ss_namespace1; + context()->OpenSessionStorage( + kTestProcessId, namespace_id1, GetBadMessageCallback(), + mojo::MakeRequest(&ss_namespace1), base::DoNothing()); + blink::mojom::StorageAreaAssociatedPtr leveldb_n1_o1; + ss_namespace1->OpenArea(origin1, mojo::MakeRequest(&leveldb_n1_o1)); + + // Put some data. + EXPECT_TRUE(test::PutSync( + leveldb_n1_o1.get(), leveldb::StringPieceToUint8Vector("key1"), + leveldb::StringPieceToUint8Vector("value1"), base::nullopt, "source1")); + + // Do the browser-side clone. + context()->CloneSessionNamespace( + namespace_id1, namespace_id2, + SessionStorageContextMojo::CloneType::kWaitForCloneOnNamespace); + + // Delete the origin namespace and don't save it. + context()->DeleteSessionNamespace(namespace_id1, false); + + // Open the second namespace. + blink::mojom::SessionStorageNamespacePtr ss_namespace2; + context()->OpenSessionStorage( + kTestProcessId, namespace_id2, GetBadMessageCallback(), + mojo::MakeRequest(&ss_namespace2), base::DoNothing()); + blink::mojom::StorageAreaAssociatedPtr leveldb_n2_o1; + ss_namespace2->OpenArea(origin1, mojo::MakeRequest(&leveldb_n2_o1)); + + // The data should be there, as the namespace should clone to all pending + // namespaces on destruction if it didn't get a 'Clone' from mojo. + std::vector<blink::mojom::KeyValuePtr> data; + EXPECT_TRUE(test::GetAllSync(leveldb_n2_o1.get(), &data)); + EXPECT_EQ(1ul, data.size()); +} + } // namespace content
diff --git a/content/browser/dom_storage/session_storage_namespace_impl_mojo.cc b/content/browser/dom_storage/session_storage_namespace_impl_mojo.cc index 94b48e4..f163725c 100644 --- a/content/browser/dom_storage/session_storage_namespace_impl_mojo.cc +++ b/content/browser/dom_storage/session_storage_namespace_impl_mojo.cc
@@ -10,7 +10,7 @@ #include "base/bind.h" #include "components/services/leveldb/public/cpp/util.h" -#include "content/public/browser/child_process_security_policy.h" +#include "content/browser/child_process_security_policy_impl.h" namespace content { @@ -30,7 +30,9 @@ register_new_map_callback_(std::move(register_new_map_callback)), delegate_(delegate) {} -SessionStorageNamespaceImplMojo::~SessionStorageNamespaceImplMojo() = default; +SessionStorageNamespaceImplMojo::~SessionStorageNamespaceImplMojo() { + DCHECK(namespaces_waiting_for_clone_call_.empty()); +} bool SessionStorageNamespaceImplMojo::HasAreaForOrigin( const url::Origin& origin) const { @@ -144,8 +146,8 @@ DCHECK(IsPopulated()); DCHECK(!bindings_.empty()); int process_id = bindings_.dispatch_context(); - if (!ChildProcessSecurityPolicy::GetInstance()->CanAccessDataForOrigin( - process_id, origin.GetURL())) { + if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanAccessDataForOrigin( + process_id, origin)) { bindings_.ReportBadMessage("Access denied for sessionStorage request"); return; } @@ -181,6 +183,7 @@ void SessionStorageNamespaceImplMojo::Clone( const std::string& clone_to_namespace) { + namespaces_waiting_for_clone_call_.erase(clone_to_namespace); delegate_->RegisterShallowClonedNamespace(namespace_entry_, clone_to_namespace, origin_areas_); } @@ -195,4 +198,13 @@ it->second->data_map()->storage_area()->ScheduleImmediateCommit(); } +void SessionStorageNamespaceImplMojo::CloneAllNamespacesWaitingForClone() { + for (const std::string& waiting_namespace_id : + namespaces_waiting_for_clone_call_) { + delegate_->RegisterShallowClonedNamespace( + namespace_entry_, waiting_namespace_id, origin_areas_); + } + namespaces_waiting_for_clone_call_.clear(); +} + } // namespace content
diff --git a/content/browser/dom_storage/session_storage_namespace_impl_mojo.h b/content/browser/dom_storage/session_storage_namespace_impl_mojo.h index de5b9c1..d0e2b12 100644 --- a/content/browser/dom_storage/session_storage_namespace_impl_mojo.h +++ b/content/browser/dom_storage/session_storage_namespace_impl_mojo.h
@@ -6,9 +6,10 @@ #include <map> #include <memory> +#include <vector> #include "base/callback.h" -#include "base/containers/flat_map.h" +#include "base/containers/flat_set.h" #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" #include "content/browser/dom_storage/session_storage_area_impl.h" @@ -148,6 +149,15 @@ void FlushOriginForTesting(const url::Origin& origin); + void AddNamespacesWaitingForClone(const std::string& namespace_id) { + namespaces_waiting_for_clone_call_.insert(namespace_id); + } + + bool HasNamespacesWaitingForClone() const { + return !namespaces_waiting_for_clone_call_.empty(); + } + void CloneAllNamespacesWaitingForClone(); + private: FRIEND_TEST_ALL_PREFIXES(SessionStorageContextMojoTest, PurgeMemoryDoesNotCrashOrHang); @@ -165,6 +175,10 @@ bool waiting_on_clone_population_ = false; bool bind_waiting_on_clone_population_ = false; std::vector<base::OnceClosure> run_after_clone_population_; + // Namespaces that are waiting for the |Clone| call to be called on this + // namespace. If this namespace is destructed, then these namespaces are still + // waiting and should be unblocked. + base::flat_set<std::string> namespaces_waiting_for_clone_call_; bool populated_ = false; OriginAreas origin_areas_;
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc index 11316e3..97e526d 100644 --- a/content/browser/download/download_manager_impl.cc +++ b/content/browser/download/download_manager_impl.cc
@@ -551,15 +551,12 @@ } void DownloadManagerImpl::OnInProgressDownloadManagerInitialized() { - std::vector<std::unique_ptr<download::DownloadItemImpl>> - in_progress_downloads = in_progress_manager_->TakeInProgressDownloads(); + in_progress_downloads_ = in_progress_manager_->TakeInProgressDownloads(); uint32_t max_id = download::DownloadItem::kInvalidId; - for (auto& download : in_progress_downloads) { + for (auto it = in_progress_downloads_.begin(); + it != in_progress_downloads_.end();) { + download::DownloadItemImpl* download = it->get(); uint32_t id = download->GetId(); - if (base::ContainsKey(in_progress_downloads_, id)) { - in_progress_manager_->RemoveInProgressDownload(download->GetGuid()); - continue; - } if (id > max_id) max_id = id; #if defined(OS_ANDROID) @@ -568,10 +565,11 @@ download->GetLastReason())) { cleared_download_guids_on_startup_.insert(download->GetGuid()); DeleteDownloadedFileOnUIThread(download->GetFullPath()); + it = in_progress_downloads_.erase(it); continue; } #endif // defined(OS_ANDROID) - in_progress_downloads_[id] = std::move(download); + ++it; } PostInitialization(DOWNLOAD_INITIALIZATION_DEPENDENCY_IN_PROGRESS_CACHE); SetNextId(max_id + 1); @@ -1057,19 +1055,37 @@ } #endif - // If there are still downloads in |in_progress_downloads_|, import them - // now. - for (auto& download : in_progress_downloads_) { - auto item = std::move(download.second); - item->SetDelegate(this); - DownloadItemUtils::AttachInfo(item.get(), GetBrowserContext(), nullptr); - OnDownloadCreated(std::move(item)); + if (in_progress_downloads_.empty()) { + OnDownloadManagerInitialized(); + } else { + GetNextId(base::BindOnce(&DownloadManagerImpl::ImportInProgressDownloads, + weak_factory_.GetWeakPtr())); } - in_progress_downloads_.clear(); +} - in_progress_manager_->OnAllInprogressDownloadsLoaded(); - for (auto& observer : observers_) - observer.OnManagerInitialized(); +void DownloadManagerImpl::ImportInProgressDownloads(uint32_t id) { + for (auto& download : in_progress_downloads_) { + auto item = std::move(download); + // If the in-progress download doesn't have an ID, generate new IDs for it. + if (item->GetId() == download::DownloadItem::kInvalidId) { + item->SetDownloadId(id++); + next_download_id_++; + if (!should_persist_new_download_) + in_progress_manager_->RemoveInProgressDownload(item->GetGuid()); + } + item->SetDelegate(this); + DownloadItemUtils::AttachInfo(item.get(), GetBrowserContext(), nullptr); + OnDownloadCreated(std::move(item)); + } + in_progress_downloads_.clear(); + + OnDownloadManagerInitialized(); +} + +void DownloadManagerImpl::OnDownloadManagerInitialized() { + in_progress_manager_->OnAllInprogressDownloadsLoaded(); + for (auto& observer : observers_) + observer.OnManagerInitialized(); } bool DownloadManagerImpl::IsManagerInitialized() const { @@ -1379,11 +1395,19 @@ std::unique_ptr<download::DownloadItemImpl> DownloadManagerImpl::RetrieveInProgressDownload(uint32_t id) { - if (base::ContainsKey(in_progress_downloads_, id)) { - auto download = std::move(in_progress_downloads_[id]); - in_progress_downloads_.erase(id); - return download; + // In case the history DB has some invalid IDs, skip them. + if (id == download::DownloadItem::kInvalidId) + return nullptr; + + for (auto it = in_progress_downloads_.begin(); + it != in_progress_downloads_.end(); ++it) { + if ((*it)->GetId() == id) { + auto download = std::move(*it); + in_progress_downloads_.erase(it); + return download; + } } + return nullptr; }
diff --git a/content/browser/download/download_manager_impl.h b/content/browser/download/download_manager_impl.h index b94e85cf..1aba08024 100644 --- a/content/browser/download/download_manager_impl.h +++ b/content/browser/download/download_manager_impl.h
@@ -295,6 +295,13 @@ std::unique_ptr<download::DownloadItemImpl> RetrieveInProgressDownload( uint32_t id); + // Import downloads from |in_progress_downloads_| into |downloads_|, resolve + // missing download IDs. + void ImportInProgressDownloads(uint32_t next_id); + + // Called when this object is considered initialized. + void OnDownloadManagerInitialized(); + #if defined(OS_ANDROID) // Check whether a download should be cleared from history. On Android, // cancelled and non-resumable interrupted download will be cleaned up to @@ -372,8 +379,10 @@ int interrupted_download_cleared_from_history_; // In progress downloads returned by |in_progress_manager_| that are not yet - // added to |downloads_|. - std::unordered_map<uint32_t, std::unique_ptr<download::DownloadItemImpl>> + // added to |downloads_|. If a download was started without launching full + // browser process, its ID will be invalid. DownloadManager will assign new + // ID to it when importing all downloads. + std::vector<std::unique_ptr<download::DownloadItemImpl>> in_progress_downloads_; // Callbacks to run once download ID is determined.
diff --git a/content/browser/download/download_manager_impl_unittest.cc b/content/browser/download/download_manager_impl_unittest.cc index c5cfc6c..7f9ee72 100644 --- a/content/browser/download/download_manager_impl_unittest.cc +++ b/content/browser/download/download_manager_impl_unittest.cc
@@ -761,6 +761,8 @@ OnInProgressDownloadManagerInitialized(); ASSERT_FALSE(download_manager_->GetDownloadByGuid(kGuid)); + EXPECT_CALL(GetMockDownloadManagerDelegate(), GetNextId(_)) + .WillOnce(RunCallback<0>(1)); OnHistoryDBInitialized(); ASSERT_TRUE(download_manager_->GetDownloadByGuid(kGuid)); download::DownloadItem* download =
diff --git a/content/browser/frame_host/blocked_scheme_navigation_browsertest.cc b/content/browser/frame_host/blocked_scheme_navigation_browsertest.cc index aba284d..4c78d65 100644 --- a/content/browser/frame_host/blocked_scheme_navigation_browsertest.cc +++ b/content/browser/frame_host/blocked_scheme_navigation_browsertest.cc
@@ -579,10 +579,10 @@ DISALLOW_COPY_AND_ASSIGN(BlockedSchemeNavigationBrowserTest); }; -INSTANTIATE_TEST_CASE_P(, - BlockedSchemeNavigationBrowserTest, - ::testing::Values(url::kDataScheme, - url::kFileSystemScheme)); +INSTANTIATE_TEST_SUITE_P(, + BlockedSchemeNavigationBrowserTest, + ::testing::Values(url::kDataScheme, + url::kFileSystemScheme)); //////////////////////////////////////////////////////////////////////////////// // Blocked schemes with HTML mimetype
diff --git a/content/browser/frame_host/ipc_utils.cc b/content/browser/frame_host/ipc_utils.cc index 47bfd1e..7fa9e97 100644 --- a/content/browser/frame_host/ipc_utils.cc +++ b/content/browser/frame_host/ipc_utils.cc
@@ -52,7 +52,7 @@ return true; auto* policy = ChildProcessSecurityPolicyImpl::GetInstance(); - if (!policy->CanAccessDataForOrigin(process_id, initiator_origin.GetURL())) { + if (!policy->CanAccessDataForOrigin(process_id, initiator_origin)) { bad_message::ReceivedBadMessage(process_id, bad_message::INVALID_INITIATOR_ORIGIN); return false;
diff --git a/content/browser/frame_host/navigation_handle_impl_browsertest.cc b/content/browser/frame_host/navigation_handle_impl_browsertest.cc index f3a9c1e..dc3bc52 100644 --- a/content/browser/frame_host/navigation_handle_impl_browsertest.cc +++ b/content/browser/frame_host/navigation_handle_impl_browsertest.cc
@@ -2454,7 +2454,7 @@ url, action, TestNavigationThrottleInstaller::WILL_PROCESS_RESPONSE); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, NavigationHandleImplThrottleResultWithErrorPageBrowserTest, testing::Range(NavigationThrottle::ThrottleAction::FIRST,
diff --git a/content/browser/frame_host/navigation_throttle_runner_unittest.cc b/content/browser/frame_host/navigation_throttle_runner_unittest.cc index e5c52c8..01e6492 100644 --- a/content/browser/frame_host/navigation_throttle_runner_unittest.cc +++ b/content/browser/frame_host/navigation_throttle_runner_unittest.cc
@@ -256,7 +256,7 @@ EXPECT_FALSE(was_delegate_notified()); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( AllEvents, NavigationThrottleRunnerTestWithEvent, ::testing::Values(NavigationThrottleRunner::Event::WillStartRequest, @@ -368,7 +368,7 @@ EXPECT_EQ(event(), observer_last_event()); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( AllEvents, NavigationThrottleRunnerTestWithEventAndAction, ::testing::Combine( @@ -447,7 +447,7 @@ CheckNotified(test_throttle); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( AllEvents, NavigationThrottleRunnerTestWithEventAndError, ::testing::Combine(
diff --git a/content/browser/frame_host/origin_policy_throttle_unittest.cc b/content/browser/frame_host/origin_policy_throttle_unittest.cc index f082c51a..96b03927 100644 --- a/content/browser/frame_host/origin_policy_throttle_unittest.cc +++ b/content/browser/frame_host/origin_policy_throttle_unittest.cc
@@ -55,9 +55,9 @@ base::test::ScopedFeatureList features_; }; -INSTANTIATE_TEST_CASE_P(OriginPolicyThrottleTests, - OriginPolicyThrottleTest, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(OriginPolicyThrottleTests, + OriginPolicyThrottleTest, + testing::Bool()); TEST_P(OriginPolicyThrottleTest, ShouldRequestOriginPolicy) { struct {
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index fb7bb73..2d622736 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -4139,7 +4139,7 @@ GURL origin_url = origin.GetURL(); auto* policy = ChildProcessSecurityPolicyImpl::GetInstance(); - if (!policy->CanAccessDataForOrigin(GetProcess()->GetID(), origin.GetURL())) + if (!policy->CanAccessDataForOrigin(GetProcess()->GetID(), origin)) return false; // Verify that the origin is allowed to commit in this process. @@ -6120,7 +6120,7 @@ base::debug::AllocateCrashKeyString( "initiator_origin", base::debug::CrashKeySize::Size64), handle->GetInitiatorOrigin() - ? handle->GetInitiatorOrigin()->Serialize() + ? handle->GetInitiatorOrigin()->GetDebugString() : "none"); base::debug::SetCrashKeyString(
diff --git a/content/browser/indexed_db/indexed_db_browsertest.cc b/content/browser/indexed_db/indexed_db_browsertest.cc index 16e4b231..4632cd08 100644 --- a/content/browser/indexed_db/indexed_db_browsertest.cc +++ b/content/browser/indexed_db/indexed_db_browsertest.cc
@@ -831,14 +831,14 @@ SimpleTest(embedded_test_server()->GetURL(test_file)); } -INSTANTIATE_TEST_CASE_P(IndexedDBBrowserTestInstantiation, - IndexedDBBrowserTest, - ::testing::Values("failGetBlobJournal", - "get", - "getAll", - "iterate", - "failTransactionCommit", - "clearObjectStore")); +INSTANTIATE_TEST_SUITE_P(IndexedDBBrowserTestInstantiation, + IndexedDBBrowserTest, + ::testing::Values("failGetBlobJournal", + "get", + "getAll", + "iterate", + "failTransactionCommit", + "clearObjectStore")); IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DeleteCompactsBackingStore) { const GURL test_url = GetTestUrl("indexeddb", "delete_compact.html");
diff --git a/content/browser/indexed_db/indexed_db_tombstone_sweeper_unittest.cc b/content/browser/indexed_db/indexed_db_tombstone_sweeper_unittest.cc index f37faf3..982f4e7 100644 --- a/content/browser/indexed_db/indexed_db_tombstone_sweeper_unittest.cc +++ b/content/browser/indexed_db/indexed_db_tombstone_sweeper_unittest.cc
@@ -597,9 +597,9 @@ "WebCore.IndexedDB.TombstoneSweeper.IndexScanPercent", 1 * 20 / 3, 1); } -INSTANTIATE_TEST_CASE_P(/* No prefix needed */, - IndexedDBTombstoneSweeperTest, - testing::Values(Mode::STATISTICS, Mode::DELETION)); +INSTANTIATE_TEST_SUITE_P(/* No prefix needed */, + IndexedDBTombstoneSweeperTest, + testing::Values(Mode::STATISTICS, Mode::DELETION)); } // namespace indexed_db_tombstone_sweeper_unittest } // namespace content
diff --git a/content/browser/indexed_db/indexed_db_transaction_unittest.cc b/content/browser/indexed_db/indexed_db_transaction_unittest.cc index da69069..d277a49c 100644 --- a/content/browser/indexed_db/indexed_db_transaction_unittest.cc +++ b/content/browser/indexed_db/indexed_db_transaction_unittest.cc
@@ -507,9 +507,9 @@ blink::mojom::IDBTransactionMode::ReadWrite, blink::mojom::IDBTransactionMode::VersionChange}; -INSTANTIATE_TEST_CASE_P(IndexedDBTransactions, - IndexedDBTransactionTestMode, - ::testing::ValuesIn(kTestModes)); +INSTANTIATE_TEST_SUITE_P(IndexedDBTransactions, + IndexedDBTransactionTestMode, + ::testing::ValuesIn(kTestModes)); } // namespace indexed_db_transaction_unittest } // namespace content
diff --git a/content/browser/indexed_db/leveldb/leveldb_transaction_unittest.cc b/content/browser/indexed_db/leveldb/leveldb_transaction_unittest.cc index ca07c5d7..21902f4a 100644 --- a/content/browser/indexed_db/leveldb/leveldb_transaction_unittest.cc +++ b/content/browser/indexed_db/leveldb/leveldb_transaction_unittest.cc
@@ -431,10 +431,10 @@ EXPECT_EQ(Compare(key_after_range_, it->Key()), 0); } -INSTANTIATE_TEST_CASE_P(LevelDBTransactionRangeTests, - LevelDBTransactionRangeTest, - ::testing::Values(DataInMemory, - DataInDatabase, - DataMixed)); +INSTANTIATE_TEST_SUITE_P(LevelDBTransactionRangeTests, + LevelDBTransactionRangeTest, + ::testing::Values(DataInMemory, + DataInDatabase, + DataMixed)); } // namespace content
diff --git a/content/browser/loader/cors_file_origin_browsertest.cc b/content/browser/loader/cors_file_origin_browsertest.cc index 0aea60a5..29b84c1 100644 --- a/content/browser/loader/cors_file_origin_browsertest.cc +++ b/content/browser/loader/cors_file_origin_browsertest.cc
@@ -370,21 +370,21 @@ EXPECT_EQ(pass_string(), watcher->WaitAndGetTitle()); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* No test prefix */, CorsFileOriginBrowserTest, ::testing::Values(CorsTestMode::kInBlink, CorsTestMode::kInBrowserProcess, CorsTestMode::kInNetworkService)); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* No test prefix */, CorsFileOriginBrowserTestWithAllowFileAccessFromFiles, ::testing::Values(CorsTestMode::kInBlink, CorsTestMode::kInBrowserProcess, CorsTestMode::kInNetworkService)); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* No test prefix */, CorsFileOriginBrowserTestWithDisableWebSecurity, ::testing::Values(CorsTestMode::kInBlink,
diff --git a/content/browser/loader/cross_site_document_blocking_browsertest.cc b/content/browser/loader/cross_site_document_blocking_browsertest.cc index 84759db..3d30b399 100644 --- a/content/browser/loader/cross_site_document_blocking_browsertest.cc +++ b/content/browser/loader/cross_site_document_blocking_browsertest.cc
@@ -1401,13 +1401,13 @@ } } -INSTANTIATE_TEST_CASE_P(WithoutOutOfBlinkCors, - CrossSiteDocumentBlockingTest, - ::testing::Values(TestMode::kWithoutOutOfBlinkCors)); +INSTANTIATE_TEST_SUITE_P(WithoutOutOfBlinkCors, + CrossSiteDocumentBlockingTest, + ::testing::Values(TestMode::kWithoutOutOfBlinkCors)); -INSTANTIATE_TEST_CASE_P(WithOutOfBlinkCors, - CrossSiteDocumentBlockingTest, - ::testing::Values(TestMode::kWithOutOfBlinkCors)); +INSTANTIATE_TEST_SUITE_P(WithOutOfBlinkCors, + CrossSiteDocumentBlockingTest, + ::testing::Values(TestMode::kWithOutOfBlinkCors)); // This test class sets up a service worker that can be used to try to respond // to same-origin requests with cross-origin responses.
diff --git a/content/browser/loader/cross_site_document_resource_handler_unittest.cc b/content/browser/loader/cross_site_document_resource_handler_unittest.cc index 626614a..d5a90d2 100644 --- a/content/browser/loader/cross_site_document_resource_handler_unittest.cc +++ b/content/browser/loader/cross_site_document_resource_handler_unittest.cc
@@ -1864,8 +1864,8 @@ content::RunAllPendingInMessageLoop(); } -INSTANTIATE_TEST_CASE_P(, - CrossSiteDocumentResourceHandlerTest, - ::testing::ValuesIn(kScenarios)); +INSTANTIATE_TEST_SUITE_P(, + CrossSiteDocumentResourceHandlerTest, + ::testing::ValuesIn(kScenarios)); } // namespace content
diff --git a/content/browser/loader/data_pipe_to_source_stream_unittest.cc b/content/browser/loader/data_pipe_to_source_stream_unittest.cc index dc8c30c5..97a0bf9 100644 --- a/content/browser/loader/data_pipe_to_source_stream_unittest.cc +++ b/content/browser/loader/data_pipe_to_source_stream_unittest.cc
@@ -117,7 +117,7 @@ base::StringPiece message_; }; -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DataPipeToSourceStreamTests, DataPipeToSourceStreamTest, ::testing::Values(
diff --git a/content/browser/loader/detachable_resource_handler_unittest.cc b/content/browser/loader/detachable_resource_handler_unittest.cc index a477ded..77a2ad4 100644 --- a/content/browser/loader/detachable_resource_handler_unittest.cc +++ b/content/browser/loader/detachable_resource_handler_unittest.cc
@@ -337,19 +337,19 @@ MaybeAsyncDetachAt(DetachPhase::ON_RESPONSE_COMPLETED); } -INSTANTIATE_TEST_CASE_P(/* No prefix needed*/, - DetachableResourceHandlerTest, - testing::Values(DetachPhase::DETACHED_FROM_CREATION, - DetachPhase::ON_WILL_START, - DetachPhase::REQUEST_REDIRECTED, - DetachPhase::ON_RESPONSE_STARTED, - DetachPhase::FIRST_ON_WILL_READ, - DetachPhase::FIRST_ON_READ_COMPLETED, - DetachPhase::SECOND_ON_WILL_READ, - DetachPhase::SECOND_ON_READ_COMPLETED, - DetachPhase::ON_READ_EOF, - DetachPhase::ON_RESPONSE_COMPLETED, - DetachPhase::NEVER_DETACH)); +INSTANTIATE_TEST_SUITE_P(/* No prefix needed*/, + DetachableResourceHandlerTest, + testing::Values(DetachPhase::DETACHED_FROM_CREATION, + DetachPhase::ON_WILL_START, + DetachPhase::REQUEST_REDIRECTED, + DetachPhase::ON_RESPONSE_STARTED, + DetachPhase::FIRST_ON_WILL_READ, + DetachPhase::FIRST_ON_READ_COMPLETED, + DetachPhase::SECOND_ON_WILL_READ, + DetachPhase::SECOND_ON_READ_COMPLETED, + DetachPhase::ON_READ_EOF, + DetachPhase::ON_RESPONSE_COMPLETED, + DetachPhase::NEVER_DETACH)); } // namespace
diff --git a/content/browser/loader/merkle_integrity_source_stream_unittest.cc b/content/browser/loader/merkle_integrity_source_stream_unittest.cc index 1362d4e1..dd233e3 100644 --- a/content/browser/loader/merkle_integrity_source_stream_unittest.cc +++ b/content/browser/loader/merkle_integrity_source_stream_unittest.cc
@@ -125,7 +125,7 @@ std::unique_ptr<MerkleIntegritySourceStream> stream_; }; -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( MerkleIntegritySourceStreamTests, MerkleIntegritySourceStreamTest, ::testing::Values(
diff --git a/content/browser/loader/mojo_async_resource_handler_unittest.cc b/content/browser/loader/mojo_async_resource_handler_unittest.cc index 45587bf..2eef312 100644 --- a/content/browser/loader/mojo_async_resource_handler_unittest.cc +++ b/content/browser/loader/mojo_async_resource_handler_unittest.cc
@@ -1571,8 +1571,8 @@ url_loader_client_.body_transfer_size()); } -INSTANTIATE_TEST_CASE_P(MojoAsyncResourceHandlerWithAllocationSizeTest, - MojoAsyncResourceHandlerWithAllocationSizeTest, - ::testing::Values(8, 32 * 2014)); +INSTANTIATE_TEST_SUITE_P(MojoAsyncResourceHandlerWithAllocationSizeTest, + MojoAsyncResourceHandlerWithAllocationSizeTest, + ::testing::Values(8, 32 * 2014)); } // namespace } // namespace content
diff --git a/content/browser/loader/prefetch_browsertest.cc b/content/browser/loader/prefetch_browsertest.cc index 381ceb33..fc4cdd5 100644 --- a/content/browser/loader/prefetch_browsertest.cc +++ b/content/browser/loader/prefetch_browsertest.cc
@@ -387,9 +387,9 @@ EXPECT_EQ(1, preload_fetch_count); } -INSTANTIATE_TEST_CASE_P(PrefetchBrowserTest, - PrefetchBrowserTest, - testing::Values(PrefetchBrowserTestParam(true), - PrefetchBrowserTestParam(false))); +INSTANTIATE_TEST_SUITE_P(PrefetchBrowserTest, + PrefetchBrowserTest, + testing::Values(PrefetchBrowserTestParam(true), + PrefetchBrowserTestParam(false))); } // namespace content
diff --git a/content/browser/loader/resource_dispatcher_host_unittest.cc b/content/browser/loader/resource_dispatcher_host_unittest.cc index 617e603..e50e6dda 100644 --- a/content/browser/loader/resource_dispatcher_host_unittest.cc +++ b/content/browser/loader/resource_dispatcher_host_unittest.cc
@@ -2552,12 +2552,12 @@ return nullptr; } -INSTANTIATE_TEST_CASE_P(WithoutOutOfBlinkCors, - ResourceDispatcherHostTest, - ::testing::Values(TestMode::kWithoutOutOfBlinkCors)); +INSTANTIATE_TEST_SUITE_P(WithoutOutOfBlinkCors, + ResourceDispatcherHostTest, + ::testing::Values(TestMode::kWithoutOutOfBlinkCors)); -INSTANTIATE_TEST_CASE_P(WithOutOfBlinkCors, - ResourceDispatcherHostTest, - ::testing::Values(TestMode::kWithOutOfBlinkCors)); +INSTANTIATE_TEST_SUITE_P(WithOutOfBlinkCors, + ResourceDispatcherHostTest, + ::testing::Values(TestMode::kWithOutOfBlinkCors)); } // namespace content
diff --git a/content/browser/loader/source_stream_to_data_pipe_unittest.cc b/content/browser/loader/source_stream_to_data_pipe_unittest.cc index 970df4c..6214612 100644 --- a/content/browser/loader/source_stream_to_data_pipe_unittest.cc +++ b/content/browser/loader/source_stream_to_data_pipe_unittest.cc
@@ -115,7 +115,7 @@ base::Optional<int> callback_result_; }; -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SourceStreamToDataPipeTests, SourceStreamToDataPipeTest, ::testing::Values(
diff --git a/content/browser/loader/url_loader_factory_impl_unittest.cc b/content/browser/loader/url_loader_factory_impl_unittest.cc index 4ad0a600..0cd37b9f 100644 --- a/content/browser/loader/url_loader_factory_impl_unittest.cc +++ b/content/browser/loader/url_loader_factory_impl_unittest.cc
@@ -430,9 +430,9 @@ ASSERT_FALSE(rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId))); } -INSTANTIATE_TEST_CASE_P(URLLoaderFactoryImplTest, - URLLoaderFactoryImplTest, - ::testing::Values(128, 32 * 1024)); +INSTANTIATE_TEST_SUITE_P(URLLoaderFactoryImplTest, + URLLoaderFactoryImplTest, + ::testing::Values(128, 32 * 1024)); } // namespace
diff --git a/content/browser/media/capture/aura_window_video_capture_device_browsertest.cc b/content/browser/media/capture/aura_window_video_capture_device_browsertest.cc index 6291e70..e2e7e37 100644 --- a/content/browser/media/capture/aura_window_video_capture_device_browsertest.cc +++ b/content/browser/media/capture/aura_window_video_capture_device_browsertest.cc
@@ -324,7 +324,7 @@ }; #if defined(OS_CHROMEOS) -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , AuraWindowVideoCaptureDeviceBrowserTestP, testing::Combine( @@ -333,7 +333,7 @@ testing::Values(false /* variable aspect ratio */, true /* fixed aspect ratio */))); #else -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , AuraWindowVideoCaptureDeviceBrowserTestP, testing::Combine(testing::Values(false /* GPU-accelerated compositing */,
diff --git a/content/browser/media/capture/web_contents_audio_input_stream_unittest.cc b/content/browser/media/capture/web_contents_audio_input_stream_unittest.cc index 8846494e..9ff6d67 100644 --- a/content/browser/media/capture/web_contents_audio_input_stream_unittest.cc +++ b/content/browser/media/capture/web_contents_audio_input_stream_unittest.cc
@@ -543,6 +543,6 @@ RUN_ON_AUDIO_THREAD(Close); } -INSTANTIATE_TEST_CASE_P(, WebContentsAudioInputStreamTest, ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, WebContentsAudioInputStreamTest, ::testing::Bool()); } // namespace content
diff --git a/content/browser/media/capture/web_contents_video_capture_device_browsertest.cc b/content/browser/media/capture/web_contents_video_capture_device_browsertest.cc index 79d102e..1d1e1d36 100644 --- a/content/browser/media/capture/web_contents_video_capture_device_browsertest.cc +++ b/content/browser/media/capture/web_contents_video_capture_device_browsertest.cc
@@ -375,7 +375,7 @@ }; #if defined(OS_CHROMEOS) -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , WebContentsVideoCaptureDeviceBrowserTestP, testing::Combine( @@ -386,7 +386,7 @@ testing::Values(false /* page has only a main frame */, true /* page contains a cross-site iframe */))); #else -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , WebContentsVideoCaptureDeviceBrowserTestP, testing::Combine(
diff --git a/content/browser/media/session/media_session_android.h b/content/browser/media/session/media_session_android.h index 241fa69..80907781 100644 --- a/content/browser/media/session/media_session_android.h +++ b/content/browser/media/session/media_session_android.h
@@ -41,6 +41,10 @@ void MediaSessionActionsChanged( const std::vector<media_session::mojom::MediaSessionAction>& action) override; + void MediaSessionImagesChanged( + const base::flat_map<media_session::mojom::MediaSessionImageType, + std::vector<media_session::MediaImage>>& images) + override {} // MediaSession method wrappers. void Resume(JNIEnv* env, const base::android::JavaParamRef<jobject>& j_obj);
diff --git a/content/browser/media/session/media_session_controllers_manager_unittest.cc b/content/browser/media/session/media_session_controllers_manager_unittest.cc index 0ab1626..f5ae3edc 100644 --- a/content/browser/media/session/media_session_controllers_manager_unittest.cc +++ b/content/browser/media/session/media_session_controllers_manager_unittest.cc
@@ -222,8 +222,8 @@ // First bool is to indicate whether InternalMediaSession is enabled. // Second bool is to indicate whether AudioFocus is enabled. -INSTANTIATE_TEST_CASE_P(MediaSessionEnabledTestInstances, - MediaSessionControllersManagerTest, - ::testing::Combine(::testing::Bool(), - ::testing::Bool())); +INSTANTIATE_TEST_SUITE_P(MediaSessionEnabledTestInstances, + MediaSessionControllersManagerTest, + ::testing::Combine(::testing::Bool(), + ::testing::Bool())); } // namespace content
diff --git a/content/browser/media/session/media_session_impl.cc b/content/browser/media/session/media_session_impl.cc index f49a56e..45c89ec 100644 --- a/content/browser/media/session/media_session_impl.cc +++ b/content/browser/media/session/media_session_impl.cc
@@ -35,8 +35,9 @@ using blink::mojom::MediaSessionPlaybackState; using MediaSessionUserAction = MediaSessionUmaHelper::MediaSessionUserAction; -using media_session::mojom::MediaSessionInfo; using media_session::mojom::MediaPlaybackState; +using media_session::mojom::MediaSessionImageType; +using media_session::mojom::MediaSessionInfo; namespace { @@ -181,16 +182,7 @@ if (services_.count(rfh)) services_[rfh]->DidFinishNavigation(); - NotifyMediaSessionMetadataChange(); -} - -void MediaSessionImpl::NotifyMediaSessionMetadataChange() { - const media_session::MediaMetadata& metadata = GetMediaMetadata(); - - observers_.ForAllPtrs( - [&metadata](media_session::mojom::MediaSessionObserver* observer) { - observer->MediaSessionMetadataChanged(metadata); - }); + RebuildAndNotifyMetadataChanged(); } bool MediaSessionImpl::AddPlayer(MediaSessionPlayerObserver* observer, @@ -225,6 +217,8 @@ normal_players_.emplace(std::move(key), required_audio_focus_type); else iter->second = required_audio_focus_type; + + UpdateRoutedService(); return true; } } @@ -247,7 +241,6 @@ iter->second = required_audio_focus_type; UpdateRoutedService(); - RebuildAndNotifyMediaSessionInfoChanged(); RebuildAndNotifyActionsChanged(); @@ -622,6 +615,8 @@ #if defined(OS_ANDROID) session_android_.reset(new MediaSessionAndroid(this)); #endif // defined(OS_ANDROID) + + RebuildAndNotifyMetadataChanged(); } void MediaSessionImpl::Initialize() { @@ -718,7 +713,8 @@ void MediaSessionImpl::AddObserver( media_session::mojom::MediaSessionObserverPtr observer) { observer->MediaSessionInfoChanged(GetMediaSessionInfoSync()); - observer->MediaSessionMetadataChanged(GetMediaMetadata()); + observer->MediaSessionMetadataChanged(metadata_); + observer->MediaSessionImagesChanged(images_); std::vector<media_session::mojom::MediaSessionAction> actions( actions_.begin(), actions_.end()); @@ -860,18 +856,6 @@ return true; } -media_session::MediaMetadata MediaSessionImpl::GetMediaMetadata() const { - media_session::MediaMetadata metadata = - (routed_service_ && routed_service_->metadata()) - ? *routed_service_->metadata() - : media_session::MediaMetadata(); - - metadata.source_title = url_formatter::FormatOriginForSecurityDisplay( - url::Origin::Create(web_contents()->GetLastCommittedURL())); - - return metadata; -} - // MediaSessionService-related methods void MediaSessionImpl::OnServiceCreated(MediaSessionServiceImpl* service) { @@ -904,7 +888,7 @@ if (service != routed_service_) return; - NotifyMediaSessionMetadataChange(); + RebuildAndNotifyMetadataChanged(); } void MediaSessionImpl::OnMediaSessionActionsChanged( @@ -970,7 +954,7 @@ routed_service_ = new_service; - NotifyMediaSessionMetadataChange(); + RebuildAndNotifyMetadataChanged(); RebuildAndNotifyActionsChanged(); RebuildAndNotifyMediaSessionInfoChanged(); } @@ -1056,6 +1040,40 @@ }); } +void MediaSessionImpl::RebuildAndNotifyMetadataChanged() { + media_session::MediaMetadata metadata = + (routed_service_ && routed_service_->metadata()) + ? *routed_service_->metadata() + : media_session::MediaMetadata(); + + metadata.source_title = url_formatter::FormatOriginForSecurityDisplay( + url::Origin::Create(web_contents()->GetLastCommittedURL())); + + // If we have no artwork in |images_| or the arwork has changed then we should + // update it with the latest artwork from the routed service. + auto it = images_.find(MediaSessionImageType::kArtwork); + bool images_changed = it == images_.end() || it->second != metadata.artwork; + if (images_changed) + images_.insert_or_assign(MediaSessionImageType::kArtwork, metadata.artwork); + + bool metadata_changed = metadata_ != metadata; + if (metadata_changed) + metadata_ = metadata; + + if (!images_changed && !metadata_changed) + return; + + observers_.ForAllPtrs( + [this, metadata_changed, + images_changed](media_session::mojom::MediaSessionObserver* observer) { + if (metadata_changed) + observer->MediaSessionMetadataChanged(this->metadata_); + + if (images_changed) + observer->MediaSessionImagesChanged(this->images_); + }); +} + WEB_CONTENTS_USER_DATA_KEY_IMPL(MediaSessionImpl) } // namespace content
diff --git a/content/browser/media/session/media_session_impl.h b/content/browser/media/session/media_session_impl.h index 7326a1d..7e6921a 100644 --- a/content/browser/media/session/media_session_impl.h +++ b/content/browser/media/session/media_session_impl.h
@@ -11,7 +11,9 @@ #include <set> #include <unordered_map> #include <unordered_set> +#include <vector> +#include "base/containers/flat_map.h" #include "base/containers/id_map.h" #include "base/macros.h" #include "base/optional.h" @@ -315,9 +317,6 @@ CONTENT_EXPORT bool AddOneShotPlayer(MediaSessionPlayerObserver* observer, int player_id); - // Returns the current media metadata associated with this session. - media_session::MediaMetadata GetMediaMetadata() const; - // MediaSessionService-related methods // Called when the routed service may have changed. @@ -333,6 +332,10 @@ // Rebuilds |actions_| and notifies observers if they have changed. void RebuildAndNotifyActionsChanged(); + // Rebuilds |metadata_| and |images_| and notifies observers if they have + // changed. + void RebuildAndNotifyMetadataChanged(); + // A set of actions supported by |routed_service_| and the current media // session. std::set<media_session::mojom::MediaSessionAction> actions_; @@ -374,6 +377,12 @@ // MediaSessionService-related fields using ServicesMap = std::map<RenderFrameHost*, MediaSessionServiceImpl*>; + // The current metadata and images associated with the current media session. + media_session::MediaMetadata metadata_; + base::flat_map<media_session::mojom::MediaSessionImageType, + std::vector<media_session::MediaImage>> + images_; + // The collection of all managed services (non-owned pointers). The services // are owned by RenderFrameHost and should be registered on creation and // unregistered on destroy.
diff --git a/content/browser/media/session/media_session_impl_browsertest.cc b/content/browser/media/session/media_session_impl_browsertest.cc index 6bf0783..45b08cdd 100644 --- a/content/browser/media/session/media_session_impl_browsertest.cc +++ b/content/browser/media/session/media_session_impl_browsertest.cc
@@ -270,7 +270,7 @@ } }; -INSTANTIATE_TEST_CASE_P(, MediaSessionImplParamBrowserTest, testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, MediaSessionImplParamBrowserTest, testing::Bool()); IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, PlayersFromSameObserverDoNotStopEachOtherInSameSession) {
diff --git a/content/browser/media/session/media_session_impl_service_routing_unittest.cc b/content/browser/media/session/media_session_impl_service_routing_unittest.cc index 5e796af..fcccdf2 100644 --- a/content/browser/media/session/media_session_impl_service_routing_unittest.cc +++ b/content/browser/media/session/media_session_impl_service_routing_unittest.cc
@@ -28,6 +28,7 @@ using ::testing::NiceMock; using media_session::mojom::MediaSessionAction; +using media_session::mojom::MediaSessionImageType; namespace content { @@ -739,4 +740,114 @@ observer.WaitForExpectedActions(default_actions()); } +TEST_F(MediaSessionImplServiceRoutingTest, + NotifyObserverWithEmptyImagesWhenServiceNotPresent) { + StartPlayerForFrame(main_frame_); + EXPECT_EQ(nullptr, ComputeServiceForRouting()); + + { + media_session::test::MockMediaSessionMojoObserver observer( + *GetMediaSession()); + + std::vector<media_session::MediaImage> expected_images; + observer.WaitForExpectedImagesOfType(MediaSessionImageType::kArtwork, + expected_images); + } +} + +TEST_F(MediaSessionImplServiceRoutingTest, + NotifyObserverWithImagesWhenServicePresent) { + CreateServiceForFrame(main_frame_); + StartPlayerForFrame(main_frame_); + + EXPECT_EQ(services_[main_frame_].get(), ComputeServiceForRouting()); + + std::vector<media_session::MediaImage> expected_images; + + media_session::MediaImage test_image_1; + test_image_1.src = GURL("https://www.google.com"); + expected_images.push_back(test_image_1); + + media_session::MediaImage test_image_2; + test_image_2.src = GURL("https://www.example.org"); + expected_images.push_back(test_image_2); + + { + media_session::test::MockMediaSessionMojoObserver observer( + *GetMediaSession()); + + std::vector<media_session::MediaImage> empty_images; + observer.WaitForExpectedImagesOfType(MediaSessionImageType::kArtwork, + empty_images); + } + + { + media_session::test::MockMediaSessionMojoObserver observer( + *GetMediaSession()); + + blink::mojom::SpecMediaMetadataPtr spec_metadata( + blink::mojom::SpecMediaMetadata::New()); + spec_metadata->artwork.push_back(test_image_1); + spec_metadata->artwork.push_back(test_image_2); + + services_[main_frame_]->SetMetadata(std::move(spec_metadata)); + observer.WaitForExpectedImagesOfType(MediaSessionImageType::kArtwork, + expected_images); + } + + { + media_session::test::MockMediaSessionMojoObserver observer( + *GetMediaSession()); + observer.WaitForExpectedImagesOfType(MediaSessionImageType::kArtwork, + expected_images); + } + + { + media_session::test::MockMediaSessionMojoObserver observer( + *GetMediaSession()); + ClearPlayersForFrame(main_frame_); + + std::vector<media_session::MediaImage> empty_images; + observer.WaitForExpectedImagesOfType(MediaSessionImageType::kArtwork, + empty_images); + } +} + +TEST_F(MediaSessionImplServiceRoutingTest, + NotifyObserverWithImagesWhenMultipleServicesPresent) { + CreateServiceForFrame(sub_frame_); + StartPlayerForFrame(sub_frame_); + + EXPECT_EQ(services_[sub_frame_].get(), ComputeServiceForRouting()); + + media_session::test::MockMediaSessionMojoObserver observer( + *GetMediaSession()); + + media_session::MediaImage test_image; + test_image.src = GURL("https://www.google.com"); + + blink::mojom::SpecMediaMetadataPtr spec_metadata( + blink::mojom::SpecMediaMetadata::New()); + spec_metadata->artwork.push_back(test_image); + services_[sub_frame_]->SetMetadata(std::move(spec_metadata)); + + // Since |sub_frame_| is the routed service then we should see the artwork + // from that service. + std::vector<media_session::MediaImage> expected_images; + expected_images.push_back(test_image); + observer.WaitForExpectedImagesOfType(MediaSessionImageType::kArtwork, + expected_images); + + CreateServiceForFrame(main_frame_); + StartPlayerForFrame(main_frame_); + + EXPECT_EQ(services_[main_frame_].get(), ComputeServiceForRouting()); + + // Now that |main_frame_| is routed then only artwork from that frame should + // be used. + std::vector<media_session::MediaImage> empty_images; + observer.WaitForExpectedImagesOfType(MediaSessionImageType::kArtwork, + empty_images); +} + } // namespace content
diff --git a/content/browser/media/session/media_session_impl_visibility_browsertest.cc b/content/browser/media/session/media_session_impl_visibility_browsertest.cc index 60d28ecb..74131a59 100644 --- a/content/browser/media/session/media_session_impl_visibility_browsertest.cc +++ b/content/browser/media/session/media_session_impl_visibility_browsertest.cc
@@ -214,8 +214,8 @@ CheckSessionStateAfterHide(); } -INSTANTIATE_TEST_CASE_P(MediaSessionImplVisibilityBrowserTestInstances, - MediaSessionImplVisibilityBrowserTest, - ::testing::ValuesIn(kTestParams)); +INSTANTIATE_TEST_SUITE_P(MediaSessionImplVisibilityBrowserTestInstances, + MediaSessionImplVisibilityBrowserTest, + ::testing::ValuesIn(kTestParams)); } // namespace content
diff --git a/content/browser/picture_in_picture/picture_in_picture_window_controller_impl.h b/content/browser/picture_in_picture/picture_in_picture_window_controller_impl.h index 91701f7..c9da400 100644 --- a/content/browser/picture_in_picture/picture_in_picture_window_controller_impl.h +++ b/content/browser/picture_in_picture/picture_in_picture_window_controller_impl.h
@@ -76,9 +76,7 @@ // state of this object. void UpdateMediaPlayerId(); - void set_service(PictureInPictureServiceImpl* service) { - service_ = service; - }; + void set_service(PictureInPictureServiceImpl* service) { service_ = service; } private: friend class WebContentsUserData<PictureInPictureWindowControllerImpl>;
diff --git a/content/browser/renderer_host/compositor_impl_android_browsertest.cc b/content/browser/renderer_host/compositor_impl_android_browsertest.cc index 285ba9709..f9d84d4 100644 --- a/content/browser/renderer_host/compositor_impl_android_browsertest.cc +++ b/content/browser/renderer_host/compositor_impl_android_browsertest.cc
@@ -97,11 +97,11 @@ DISALLOW_COPY_AND_ASSIGN(CompositorImplBrowserTest); }; -INSTANTIATE_TEST_CASE_P(P, - CompositorImplBrowserTest, - ::testing::Values(CompositorImplMode::kNormal, - CompositorImplMode::kViz, - CompositorImplMode::kVizSkDDL)); +INSTANTIATE_TEST_SUITE_P(P, + CompositorImplBrowserTest, + ::testing::Values(CompositorImplMode::kNormal, + CompositorImplMode::kViz, + CompositorImplMode::kVizSkDDL)); class CompositorImplLowEndBrowserTest : public CompositorImplBrowserTest { public: @@ -115,9 +115,9 @@ // Viz on android is not yet compatible with in-process GPU. Only run in // kNormal mode. // TODO(ericrk): Make this work everywhere. https://crbug.com/851643 -INSTANTIATE_TEST_CASE_P(P, - CompositorImplLowEndBrowserTest, - ::testing::Values(CompositorImplMode::kNormal)); +INSTANTIATE_TEST_SUITE_P(P, + CompositorImplLowEndBrowserTest, + ::testing::Values(CompositorImplMode::kNormal)); // RunLoop implementation that calls glFlush() every second until it observes // OnContextLost().
diff --git a/content/browser/renderer_host/direct_manipulation_browsertest.cc b/content/browser/renderer_host/direct_manipulation_browsertest.cc index 9a266c8..d6dcec13 100644 --- a/content/browser/renderer_host/direct_manipulation_browsertest.cc +++ b/content/browser/renderer_host/direct_manipulation_browsertest.cc
@@ -84,9 +84,9 @@ DISALLOW_COPY_AND_ASSIGN(DirectManipulationBrowserTest); }; -INSTANTIATE_TEST_CASE_P(WithScrollEventPhase, - DirectManipulationBrowserTest, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(WithScrollEventPhase, + DirectManipulationBrowserTest, + testing::Bool()); // Ensure the AnimationObserver destroy when hwnd reparent to other hwnd. IN_PROC_BROWSER_TEST_P(DirectManipulationBrowserTest, HWNDReparent) {
diff --git a/content/browser/renderer_host/input/fling_controller_unittest.cc b/content/browser/renderer_host/input/fling_controller_unittest.cc index 3a1fa782..f52f544 100644 --- a/content/browser/renderer_host/input/fling_controller_unittest.cc +++ b/content/browser/renderer_host/input/fling_controller_unittest.cc
@@ -149,7 +149,7 @@ DISALLOW_COPY_AND_ASSIGN(FlingControllerTest); }; -INSTANTIATE_TEST_CASE_P(, FlingControllerTest, testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, FlingControllerTest, testing::Bool()); TEST_P(FlingControllerTest, ControllerSendsWheelEndOnTouchpadFlingWithZeroVelocity) {
diff --git a/content/browser/renderer_host/input/gesture_event_queue_unittest.cc b/content/browser/renderer_host/input/gesture_event_queue_unittest.cc index 336640ab..e5d7ffc 100644 --- a/content/browser/renderer_host/input/gesture_event_queue_unittest.cc +++ b/content/browser/renderer_host/input/gesture_event_queue_unittest.cc
@@ -272,10 +272,10 @@ EXPECT_EQ(1U, GetAndResetAckedGestureEventCount()); } -INSTANTIATE_TEST_CASE_P(AllSources, - GestureEventQueueWithSourceTest, - testing::Values(blink::kWebGestureDeviceTouchscreen, - blink::kWebGestureDeviceTouchpad)); +INSTANTIATE_TEST_SUITE_P(AllSources, + GestureEventQueueWithSourceTest, + testing::Values(blink::kWebGestureDeviceTouchscreen, + blink::kWebGestureDeviceTouchpad)); // Test that a GestureScrollEnd is deferred during the debounce interval, // that Scrolls are not and that the deferred events are sent after that
diff --git a/content/browser/renderer_host/input/input_router_impl_unittest.cc b/content/browser/renderer_host/input/input_router_impl_unittest.cc index 63ce90af..6754d9417 100644 --- a/content/browser/renderer_host/input/input_router_impl_unittest.cc +++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc
@@ -523,7 +523,7 @@ base::test::ScopedFeatureList touch_action_feature_list_; }; -INSTANTIATE_TEST_CASE_P(, InputRouterImplTest, ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, InputRouterImplTest, ::testing::Bool()); TEST_P(InputRouterImplTest, HandledInputEvent) { client_->set_filter_state(INPUT_EVENT_ACK_STATE_CONSUMED); @@ -1719,7 +1719,7 @@ DISALLOW_COPY_AND_ASSIGN(TouchpadPinchInputRouterImplTest); }; -INSTANTIATE_TEST_CASE_P(, TouchpadPinchInputRouterImplTest, ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, TouchpadPinchInputRouterImplTest, ::testing::Bool()); // Test that GesturePinchUpdate is handled specially for trackpad TEST_P(TouchpadPinchInputRouterImplTest, TouchpadPinchUpdate) {
diff --git a/content/browser/renderer_host/input/synthetic_gesture_controller_unittest.cc b/content/browser/renderer_host/input/synthetic_gesture_controller_unittest.cc index 3d618bf..d769105 100644 --- a/content/browser/renderer_host/input/synthetic_gesture_controller_unittest.cc +++ b/content/browser/renderer_host/input/synthetic_gesture_controller_unittest.cc
@@ -1398,9 +1398,9 @@ } } -INSTANTIATE_TEST_CASE_P(Single, - SyntheticGestureControllerTestWithParam, - testing::Values(TOUCH_SCROLL, TOUCH_DRAG)); +INSTANTIATE_TEST_SUITE_P(Single, + SyntheticGestureControllerTestWithParam, + testing::Values(TOUCH_SCROLL, TOUCH_DRAG)); TEST_F(SyntheticGestureControllerTest, SingleDragGestureMouseDiagonal) { CreateControllerAndTarget<MockDragMouseTarget>();
diff --git a/content/browser/renderer_host/input/touch_action_browsertest.cc b/content/browser/renderer_host/input/touch_action_browsertest.cc index 0e7a46ae..1f8d0e7 100644 --- a/content/browser/renderer_host/input/touch_action_browsertest.cc +++ b/content/browser/renderer_host/input/touch_action_browsertest.cc
@@ -456,7 +456,7 @@ DISALLOW_COPY_AND_ASSIGN(TouchActionBrowserTest); }; -INSTANTIATE_TEST_CASE_P(, TouchActionBrowserTest, testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, TouchActionBrowserTest, testing::Bool()); #if !defined(NDEBUG) || defined(ADDRESS_SANITIZER) || \ defined(MEMORY_SANITIZER) || defined(LEAK_SANITIZER) || \
diff --git a/content/browser/renderer_host/input/touch_action_filter_unittest.cc b/content/browser/renderer_host/input/touch_action_filter_unittest.cc index d540955..a9ce1d2 100644 --- a/content/browser/renderer_host/input/touch_action_filter_unittest.cc +++ b/content/browser/renderer_host/input/touch_action_filter_unittest.cc
@@ -241,7 +241,7 @@ base::test::ScopedFeatureList feature_list_; }; -INSTANTIATE_TEST_CASE_P(, TouchActionFilterTest, ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, TouchActionFilterTest, ::testing::Bool()); TEST_P(TouchActionFilterTest, SimpleFilter) { WebGestureEvent tap_down = SyntheticWebGestureEventBuilder::Build( @@ -755,7 +755,7 @@ base::test::ScopedFeatureList feature_list_; }; -INSTANTIATE_TEST_CASE_P(, TouchActionFilterPinchTest, ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, TouchActionFilterPinchTest, ::testing::Bool()); TEST_P(TouchActionFilterPinchTest, Pinch) { RunTest(false);
diff --git a/content/browser/renderer_host/input/touchpad_pinch_browsertest.cc b/content/browser/renderer_host/input/touchpad_pinch_browsertest.cc index 29917fd..1c942a0 100644 --- a/content/browser/renderer_host/input/touchpad_pinch_browsertest.cc +++ b/content/browser/renderer_host/input/touchpad_pinch_browsertest.cc
@@ -103,7 +103,7 @@ DISALLOW_COPY_AND_ASSIGN(TouchpadPinchBrowserTest); }; -INSTANTIATE_TEST_CASE_P(, TouchpadPinchBrowserTest, testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, TouchpadPinchBrowserTest, testing::Bool()); // Performing a touchpad pinch gesture should change the page scale. IN_PROC_BROWSER_TEST_P(TouchpadPinchBrowserTest,
diff --git a/content/browser/renderer_host/input/touchpad_pinch_event_queue_unittest.cc b/content/browser/renderer_host/input/touchpad_pinch_event_queue_unittest.cc index ec15b4c..3998605 100644 --- a/content/browser/renderer_host/input/touchpad_pinch_event_queue_unittest.cc +++ b/content/browser/renderer_host/input/touchpad_pinch_event_queue_unittest.cc
@@ -112,7 +112,7 @@ const bool async_events_enabled_; }; -INSTANTIATE_TEST_CASE_P(, TouchpadPinchEventQueueTest, ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, TouchpadPinchEventQueueTest, ::testing::Bool()); MATCHER_P(EventHasType, type,
diff --git a/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc b/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc index f0ded44..1699e96e0 100644 --- a/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc +++ b/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc
@@ -534,7 +534,7 @@ } } -INSTANTIATE_TEST_CASE_P(, - MediaDevicesDispatcherHostTest, - testing::Values(GURL(), GURL("https://test.com"))); +INSTANTIATE_TEST_SUITE_P(, + MediaDevicesDispatcherHostTest, + testing::Values(GURL(), GURL("https://test.com"))); } // namespace content
diff --git a/content/browser/renderer_host/media/media_devices_manager.cc b/content/browser/renderer_host/media/media_devices_manager.cc index de7a5a5c..995a1af8 100644 --- a/content/browser/renderer_host/media/media_devices_manager.cc +++ b/content/browser/renderer_host/media/media_devices_manager.cc
@@ -887,16 +887,13 @@ false /* ignore_group_id */); } - requests_.erase( - std::remove_if(requests_.begin(), requests_.end(), - [this](EnumerationRequest& request) { - if (IsEnumerationRequestReady(request)) { - std::move(request.callback).Run(current_snapshot_); - return true; - } - return false; - }), - requests_.end()); + base::EraseIf(requests_, [this](EnumerationRequest& request) { + if (IsEnumerationRequestReady(request)) { + std::move(request.callback).Run(current_snapshot_); + return true; + } + return false; + }); } bool MediaDevicesManager::IsEnumerationRequestReady(
diff --git a/content/browser/renderer_host/media/service_launched_video_capture_device.cc b/content/browser/renderer_host/media/service_launched_video_capture_device.cc index fbb563e0..947804866 100644 --- a/content/browser/renderer_host/media/service_launched_video_capture_device.cc +++ b/content/browser/renderer_host/media/service_launched_video_capture_device.cc
@@ -63,8 +63,7 @@ } void ServiceLaunchedVideoCaptureDevice::RequestRefreshFrame() { - DCHECK(sequence_checker_.CalledOnValidSequence()); - device_->RequestRefreshFrame(); + // Ignore this call. } void ServiceLaunchedVideoCaptureDevice::SetDesktopCaptureWindowIdAsync( @@ -79,8 +78,7 @@ void ServiceLaunchedVideoCaptureDevice::OnUtilizationReport( int frame_feedback_id, double utilization) { - DCHECK(sequence_checker_.CalledOnValidSequence()); - device_->OnReceiverReportingUtilization(frame_feedback_id, utilization); + // Ignore this call. } void ServiceLaunchedVideoCaptureDevice::OnLostConnectionToDevice() {
diff --git a/content/browser/renderer_host/media/video_capture_browsertest.cc b/content/browser/renderer_host/media/video_capture_browsertest.cc index 1baa97e..9e789cb 100644 --- a/content/browser/renderer_host/media/video_capture_browsertest.cc +++ b/content/browser/renderer_host/media/video_capture_browsertest.cc
@@ -335,12 +335,12 @@ } } -INSTANTIATE_TEST_CASE_P(, - VideoCaptureBrowserTest, - Combine(Values(0, 1, 2), // DeviceIndex - Values(gfx::Size(640, 480), // Resolution - gfx::Size(1280, 720)), - Bool(), // ExerciseAcceleratedJpegDecoding - Bool())); // UseMojoService +INSTANTIATE_TEST_SUITE_P(, + VideoCaptureBrowserTest, + Combine(Values(0, 1, 2), // DeviceIndex + Values(gfx::Size(640, 480), // Resolution + gfx::Size(1280, 720)), + Bool(), // ExerciseAcceleratedJpegDecoding + Bool())); // UseMojoService } // namespace content
diff --git a/content/browser/renderer_host/media/video_capture_controller_unittest.cc b/content/browser/renderer_host/media/video_capture_controller_unittest.cc index 49b6944..e3ee4ce 100644 --- a/content/browser/renderer_host/media/video_capture_controller_unittest.cc +++ b/content/browser/renderer_host/media/video_capture_controller_unittest.cc
@@ -494,10 +494,10 @@ Mock::VerifyAndClearExpectations(client_b_.get()); } -INSTANTIATE_TEST_CASE_P(, - VideoCaptureControllerTest, - ::testing::Values(media::PIXEL_FORMAT_I420, - media::PIXEL_FORMAT_Y16)); +INSTANTIATE_TEST_SUITE_P(, + VideoCaptureControllerTest, + ::testing::Values(media::PIXEL_FORMAT_I420, + media::PIXEL_FORMAT_Y16)); // Exercises the OnError() codepath of VideoCaptureController, and tests the // behavior of various operations after the error state has been signalled.
diff --git a/content/browser/renderer_host/render_widget_host_input_event_router.cc b/content/browser/renderer_host/render_widget_host_input_event_router.cc index 76db4e0b..d8c7fcd 100644 --- a/content/browser/renderer_host/render_widget_host_input_event_router.cc +++ b/content/browser/renderer_host/render_widget_host_input_event_router.cc
@@ -11,6 +11,7 @@ #include "base/debug/crash_logging.h" #include "base/debug/dump_without_crashing.h" #include "base/metrics/histogram_macros.h" +#include "base/stl_util.h" #include "base/strings/stringprintf.h" #include "components/viz/common/features.h" #include "components/viz/common/hit_test/hit_test_region_list.h" @@ -216,11 +217,9 @@ void TouchEventAckQueue::UpdateQueueAfterTargetDestroyed( RenderWidgetHostViewBase* target_view) { // If a queue entry's root view is being destroyed, just delete it. - ack_queue_.erase(remove_if(ack_queue_.begin(), ack_queue_.end(), - [target_view](AckData data) { - return data.root_view == target_view; - }), - ack_queue_.end()); + base::EraseIf(ack_queue_, [target_view](AckData data) { + return data.root_view == target_view; + }); // Otherwise, mark its status accordingly. for_each(ack_queue_.begin(), ack_queue_.end(), [target_view](AckData& data) {
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc index 3b46665..2fbfa3c0 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -5637,9 +5637,9 @@ DISALLOW_COPY_AND_ASSIGN(TouchpadRenderWidgetHostViewAuraTest); }; -INSTANTIATE_TEST_CASE_P(, - TouchpadRenderWidgetHostViewAuraTest, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, + TouchpadRenderWidgetHostViewAuraTest, + testing::Bool()); // Test that we elide touchpad pinch gesture steams consisting of only begin // and end events.
diff --git a/content/browser/renderer_host/render_widget_host_view_browsertest.cc b/content/browser/renderer_host/render_widget_host_view_browsertest.cc index f37ce689..3c1eec4 100644 --- a/content/browser/renderer_host/render_widget_host_view_browsertest.cc +++ b/content/browser/renderer_host/render_widget_host_view_browsertest.cc
@@ -828,19 +828,19 @@ testing::Values(GL_COMPOSITING, SOFTWARE_COMPOSITING); #endif -INSTANTIATE_TEST_CASE_P(GLAndSoftwareCompositing, - CompositingRenderWidgetHostViewBrowserTest, - kTestCompositingModes); -INSTANTIATE_TEST_CASE_P(GLAndSoftwareCompositing, - CompositingRenderWidgetHostViewBrowserTestTabCapture, - kTestCompositingModes); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P(GLAndSoftwareCompositing, + CompositingRenderWidgetHostViewBrowserTest, + kTestCompositingModes); +INSTANTIATE_TEST_SUITE_P(GLAndSoftwareCompositing, + CompositingRenderWidgetHostViewBrowserTestTabCapture, + kTestCompositingModes); +INSTANTIATE_TEST_SUITE_P( GLAndSoftwareCompositing, CompositingRenderWidgetHostViewBrowserTestTabCaptureHighDPI, kTestCompositingModes); -INSTANTIATE_TEST_CASE_P(GLAndSoftwareCompositing, - CompositingRenderWidgetHostViewBrowserTestHiDPI, - kTestCompositingModes); +INSTANTIATE_TEST_SUITE_P(GLAndSoftwareCompositing, + CompositingRenderWidgetHostViewBrowserTestHiDPI, + kTestCompositingModes); #endif // !defined(OS_ANDROID)
diff --git a/content/browser/renderer_host/web_database_host_impl.cc b/content/browser/renderer_host/web_database_host_impl.cc index 1966965..5405fef8 100644 --- a/content/browser/renderer_host/web_database_host_impl.cc +++ b/content/browser/renderer_host/web_database_host_impl.cc
@@ -52,7 +52,7 @@ return; if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanAccessDataForOrigin( - process_id, origin.GetURL())) { + process_id, origin)) { callback_task_runner->PostTask( FROM_HERE, base::BindOnce(std::move(error_callback), "Unauthorized origin."));
diff --git a/content/browser/renderer_host/web_database_host_impl_unittest.cc b/content/browser/renderer_host/web_database_host_impl_unittest.cc index cb9fb75..d0dc218b 100644 --- a/content/browser/renderer_host/web_database_host_impl_unittest.cc +++ b/content/browser/renderer_host/web_database_host_impl_unittest.cc
@@ -115,10 +115,10 @@ security_policy->AddIsolatedOrigins({correct_origin, incorrect_origin}); security_policy->LockToOrigin(IsolationContext(), process_id(), correct_origin.GetURL()); - ASSERT_TRUE(security_policy->CanAccessDataForOrigin(process_id(), - correct_origin.GetURL())); - ASSERT_FALSE(security_policy->CanAccessDataForOrigin( - process_id(), incorrect_origin.GetURL())); + ASSERT_TRUE( + security_policy->CanAccessDataForOrigin(process_id(), correct_origin)); + ASSERT_FALSE( + security_policy->CanAccessDataForOrigin(process_id(), incorrect_origin)); CheckUnauthorizedOrigin([&]() { host()->OpenFile(bad_vfs_file_name,
diff --git a/content/browser/service_worker/service_worker_provider_host.h b/content/browser/service_worker/service_worker_provider_host.h index cb560981..0f44fdd 100644 --- a/content/browser/service_worker/service_worker_provider_host.h +++ b/content/browser/service_worker/service_worker_provider_host.h
@@ -199,7 +199,7 @@ // Analogous to Blink's Document::IsSecureContext. Because of how service // worker intercepts main resource requests, this check must be done // browser-side once the URL is known (see comments in - // WebServiceWorkerNetworkProviderImplForFrame::Create). This function uses + // ServiceWorkerNetworkProviderForFrame::Create). This function uses // |url_| and |is_parent_frame_secure_| to determine context security, so they // must be set properly before calling this function. bool IsContextSecureForServiceWorker() const;
diff --git a/content/browser/shape_detection/shape_detection_browsertest.cc b/content/browser/shape_detection/shape_detection_browsertest.cc index 8b02c0f..05693956 100644 --- a/content/browser/shape_detection/shape_detection_browsertest.cc +++ b/content/browser/shape_detection/shape_detection_browsertest.cc
@@ -111,8 +111,8 @@ GetParam().expected_bounding_boxes); } -INSTANTIATE_TEST_CASE_P(, - ShapeDetectionBrowserTest, - testing::ValuesIn(kTestParameters)); +INSTANTIATE_TEST_SUITE_P(, + ShapeDetectionBrowserTest, + testing::ValuesIn(kTestParameters)); } // namespace content
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc index f524fd5..30360e3 100644 --- a/content/browser/site_per_process_browsertest.cc +++ b/content/browser/site_per_process_browsertest.cc
@@ -13703,11 +13703,11 @@ ASSERT_TRUE(fallback_visible); } -INSTANTIATE_TEST_CASE_P(SitePerProcess, - CrossProcessNavigationObjectElementTest, - testing::Values(std::make_tuple("a", "a", "b"), - std::make_tuple("a", "b", "b"), - std::make_tuple("a", "b", "c"))); +INSTANTIATE_TEST_SUITE_P(SitePerProcess, + CrossProcessNavigationObjectElementTest, + testing::Values(std::make_tuple("a", "a", "b"), + std::make_tuple("a", "b", "b"), + std::make_tuple("a", "b", "c"))); class ScrollingIntegrationTest : public SitePerProcessBrowserTest { public:
diff --git a/content/browser/site_per_process_hit_test_browsertest.cc b/content/browser/site_per_process_hit_test_browsertest.cc index 1554f9a9..30006c04 100644 --- a/content/browser/site_per_process_hit_test_browsertest.cc +++ b/content/browser/site_per_process_hit_test_browsertest.cc
@@ -6262,46 +6262,46 @@ static const int kHitTestOption[] = {0, 1, 2}; static const float kOneScale[] = {1.f}; -INSTANTIATE_TEST_CASE_P(/* no prefix */, - SitePerProcessHitTestBrowserTest, - testing::Combine(testing::ValuesIn(kHitTestOption), - testing::ValuesIn(kOneScale))); +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + SitePerProcessHitTestBrowserTest, + testing::Combine(testing::ValuesIn(kHitTestOption), + testing::ValuesIn(kOneScale))); // TODO(wjmaclean): Since the next two test fixtures only differ in DSF // values, should we combine them into one using kMultiScale? This // approach would make it more difficult to disable individual scales on // particular platforms. -INSTANTIATE_TEST_CASE_P(/* no prefix */, - SitePerProcessHighDPIHitTestBrowserTest, - testing::Combine(testing::ValuesIn(kHitTestOption), - testing::ValuesIn(kOneScale))); -INSTANTIATE_TEST_CASE_P(/* no prefix */, - SitePerProcessNonIntegerScaleFactorHitTestBrowserTest, - testing::Combine(testing::ValuesIn(kHitTestOption), - testing::ValuesIn(kOneScale))); -INSTANTIATE_TEST_CASE_P(/* no prefix */, - SitePerProcessEmulatedTouchBrowserTest, - testing::Combine(testing::ValuesIn(kHitTestOption), - testing::ValuesIn(kOneScale))); +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + SitePerProcessHighDPIHitTestBrowserTest, + testing::Combine(testing::ValuesIn(kHitTestOption), + testing::ValuesIn(kOneScale))); +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + SitePerProcessNonIntegerScaleFactorHitTestBrowserTest, + testing::Combine(testing::ValuesIn(kHitTestOption), + testing::ValuesIn(kOneScale))); +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + SitePerProcessEmulatedTouchBrowserTest, + testing::Combine(testing::ValuesIn(kHitTestOption), + testing::ValuesIn(kOneScale))); -INSTANTIATE_TEST_CASE_P(/* no prefix */, - SitePerProcessHitTestDataGenerationBrowserTest, - testing::Combine(testing::ValuesIn(kHitTestOption), - testing::ValuesIn(kOneScale))); +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + SitePerProcessHitTestDataGenerationBrowserTest, + testing::Combine(testing::ValuesIn(kHitTestOption), + testing::ValuesIn(kOneScale))); #if defined(USE_AURA) static const float kMultiScale[] = {1.f, 1.5f, 2.f}; -INSTANTIATE_TEST_CASE_P(/* no prefix */, - SitePerProcessInternalsHitTestBrowserTest, - testing::Combine(testing::ValuesIn(kHitTestOption), - testing::ValuesIn(kMultiScale))); -INSTANTIATE_TEST_CASE_P(/* no prefix */, - SitePerProcessMouseWheelHitTestBrowserTest, - testing::Combine(testing::ValuesIn(kHitTestOption), - testing::ValuesIn(kOneScale))); -INSTANTIATE_TEST_CASE_P(/* no prefix */, - SitePerProcessGestureHitTestBrowserTest, - testing::Combine(testing::ValuesIn(kHitTestOption), - testing::ValuesIn(kOneScale))); +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + SitePerProcessInternalsHitTestBrowserTest, + testing::Combine(testing::ValuesIn(kHitTestOption), + testing::ValuesIn(kMultiScale))); +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + SitePerProcessMouseWheelHitTestBrowserTest, + testing::Combine(testing::ValuesIn(kHitTestOption), + testing::ValuesIn(kOneScale))); +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + SitePerProcessGestureHitTestBrowserTest, + testing::Combine(testing::ValuesIn(kHitTestOption), + testing::ValuesIn(kOneScale))); #endif } // namespace content
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc index 78bc586..65edb19 100644 --- a/content/browser/storage_partition_impl.cc +++ b/content/browser/storage_partition_impl.cc
@@ -931,8 +931,8 @@ blink::mojom::StorageAreaRequest request, OpenLocalStorageCallback callback) { int process_id = bindings_.dispatch_context(); - if (!ChildProcessSecurityPolicy::GetInstance()->CanAccessDataForOrigin( - process_id, origin.GetURL())) { + if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanAccessDataForOrigin( + process_id, origin)) { SYSLOG(WARNING) << "Killing renderer: illegal localStorage request."; bindings_.ReportBadMessage("Access denied for localStorage request"); return;
diff --git a/content/browser/storage_partition_impl_browsertest.cc b/content/browser/storage_partition_impl_browsertest.cc index a1f42c9..d1f5c03 100644 --- a/content/browser/storage_partition_impl_browsertest.cc +++ b/content/browser/storage_partition_impl_browsertest.cc
@@ -249,12 +249,12 @@ // NetworkServiceState::kEnabled currently DCHECKs on Android, as Android isn't // expected to create extra processes. #if defined(OS_ANDROID) -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* No test prefix */, StoragePartititionImplBrowsertest, ::testing::Values(NetworkServiceState::kDisabled)); #else // !defined(OS_ANDROID) -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* No test prefix */, StoragePartititionImplBrowsertest, ::testing::Values(NetworkServiceState::kDisabled,
diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc index 74e086c0..dfc5758b 100644 --- a/content/browser/web_contents/web_contents_impl_unittest.cc +++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -3291,7 +3291,7 @@ DialogClosedCallback callback, bool* did_suppress_message) override { *did_suppress_message = true; - }; + } void RunBeforeUnloadDialog(WebContents* web_contents, RenderFrameHost* render_frame_host,
diff --git a/content/browser/web_package/signed_exchange_envelope_unittest.cc b/content/browser/web_package/signed_exchange_envelope_unittest.cc index 17e0286c..49a0e3f 100644 --- a/content/browser/web_package/signed_exchange_envelope_unittest.cc +++ b/content/browser/web_package/signed_exchange_envelope_unittest.cc
@@ -240,8 +240,8 @@ ASSERT_FALSE(header.has_value()); } -INSTANTIATE_TEST_CASE_P(SignedExchangeEnvelopeTests, - SignedExchangeEnvelopeTest, - ::testing::Values(SignedExchangeVersion::kB3)); +INSTANTIATE_TEST_SUITE_P(SignedExchangeEnvelopeTests, + SignedExchangeEnvelopeTest, + ::testing::Values(SignedExchangeVersion::kB3)); } // namespace content
diff --git a/content/browser/web_package/signed_exchange_handler_unittest.cc b/content/browser/web_package/signed_exchange_handler_unittest.cc index b7b7df4d..a8eb5ad 100644 --- a/content/browser/web_package/signed_exchange_handler_unittest.cc +++ b/content/browser/web_package/signed_exchange_handler_unittest.cc
@@ -1045,9 +1045,9 @@ EXPECT_EQ(static_cast<int>(expected_payload.size()), rv); } -INSTANTIATE_TEST_CASE_P(SignedExchangeHandlerTests, - SignedExchangeHandlerTest, - ::testing::Values(net::MockSourceStream::SYNC, - net::MockSourceStream::ASYNC)); +INSTANTIATE_TEST_SUITE_P(SignedExchangeHandlerTests, + SignedExchangeHandlerTest, + ::testing::Values(net::MockSourceStream::SYNC, + net::MockSourceStream::ASYNC)); } // namespace content
diff --git a/content/browser/web_package/signed_exchange_request_handler_browsertest.cc b/content/browser/web_package/signed_exchange_request_handler_browsertest.cc index c59d0be..d018088 100644 --- a/content/browser/web_package/signed_exchange_request_handler_browsertest.cc +++ b/content/browser/web_package/signed_exchange_request_handler_browsertest.cc
@@ -428,7 +428,7 @@ PrefetchIsEnabled() ? 2 : 1); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SignedExchangeRequestHandlerBrowserTest, SignedExchangeRequestHandlerBrowserTest, testing::Values( @@ -739,7 +739,7 @@ EXPECT_FALSE(result); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SignedExchangeRequestHandlerWithServiceWorkerBrowserTest, SignedExchangeRequestHandlerWithServiceWorkerBrowserTest, testing::Values( @@ -1179,7 +1179,7 @@ {enabled_prefetch_target, disabled_prefetch_target}); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SignedExchangeAcceptHeaderBrowserTest, SignedExchangeAcceptHeaderBrowserTest, testing::Values(
diff --git a/content/browser/web_package/signed_exchange_signature_verifier_unittest.cc b/content/browser/web_package/signed_exchange_signature_verifier_unittest.cc index 896df52..25d8ebc 100644 --- a/content/browser/web_package/signed_exchange_signature_verifier_unittest.cc +++ b/content/browser/web_package/signed_exchange_signature_verifier_unittest.cc
@@ -308,8 +308,8 @@ EXPECT_TRUE(ignore_both.ShouldIgnoreError(cert_ecdsap384)); } -INSTANTIATE_TEST_CASE_P(SignedExchangeSignatureVerifierTests, - SignedExchangeSignatureVerifierTest, - ::testing::Values(SignedExchangeVersion::kB3)); +INSTANTIATE_TEST_SUITE_P(SignedExchangeSignatureVerifierTests, + SignedExchangeSignatureVerifierTest, + ::testing::Values(SignedExchangeVersion::kB3)); } // namespace content
diff --git a/content/browser/webrtc/webrtc_audio_browsertest.cc b/content/browser/webrtc/webrtc_audio_browsertest.cc index 1b15aa6b..9dc33f7 100644 --- a/content/browser/webrtc/webrtc_audio_browsertest.cc +++ b/content/browser/webrtc/webrtc_audio_browsertest.cc
@@ -169,12 +169,12 @@ // removed after launch. #if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN) // Supported platforms. -INSTANTIATE_TEST_CASE_P(, WebRtcAudioBrowserTest, ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, WebRtcAudioBrowserTest, ::testing::Bool()); #elif defined(OS_ANDROID) && defined(ADDRESS_SANITIZER) // Renderer crashes under Android ASAN: https://crbug.com/408496. #else // Platforms where the out of process audio service isn't supported -INSTANTIATE_TEST_CASE_P(, WebRtcAudioBrowserTest, ::testing::Values(false)); +INSTANTIATE_TEST_SUITE_P(, WebRtcAudioBrowserTest, ::testing::Values(false)); #endif } // namespace content
diff --git a/content/browser/webrtc/webrtc_capture_from_element_browsertest.cc b/content/browser/webrtc/webrtc_capture_from_element_browsertest.cc index 3cddb0d..e654c4a 100644 --- a/content/browser/webrtc/webrtc_capture_from_element_browsertest.cc +++ b/content/browser/webrtc/webrtc_capture_from_element_browsertest.cc
@@ -168,7 +168,7 @@ kCanvasCaptureColorTestHtmlFile); } -INSTANTIATE_TEST_CASE_P(, - WebRtcCaptureFromElementBrowserTest, - testing::ValuesIn(kFileAndTypeParameters)); +INSTANTIATE_TEST_SUITE_P(, + WebRtcCaptureFromElementBrowserTest, + testing::ValuesIn(kFileAndTypeParameters)); } // namespace content
diff --git a/content/browser/webrtc/webrtc_constraints_browsertest.cc b/content/browser/webrtc/webrtc_constraints_browsertest.cc index 2a19b39..30f8ab0b 100644 --- a/content/browser/webrtc/webrtc_constraints_browsertest.cc +++ b/content/browser/webrtc/webrtc_constraints_browsertest.cc
@@ -78,8 +78,8 @@ ExecuteJavascriptAndWaitForOk(call); } -INSTANTIATE_TEST_CASE_P(UserMedia, - WebRtcConstraintsBrowserTest, - testing::ValuesIn(kAllUserMediaSizes)); +INSTANTIATE_TEST_SUITE_P(UserMedia, + WebRtcConstraintsBrowserTest, + testing::ValuesIn(kAllUserMediaSizes)); } // namespace content
diff --git a/content/browser/webrtc/webrtc_getusermedia_browsertest.cc b/content/browser/webrtc/webrtc_getusermedia_browsertest.cc index 53bb389..7a5d8cf 100644 --- a/content/browser/webrtc/webrtc_getusermedia_browsertest.cc +++ b/content/browser/webrtc/webrtc_getusermedia_browsertest.cc
@@ -881,12 +881,12 @@ #if (defined(OS_LINUX) && !defined(CHROME_OS)) || defined(OS_MACOSX) || \ defined(OS_WIN) // Supported platforms. -INSTANTIATE_TEST_CASE_P(, WebRtcGetUserMediaBrowserTest, ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, WebRtcGetUserMediaBrowserTest, ::testing::Bool()); #else // Platforms where the out of process audio service is not supported -INSTANTIATE_TEST_CASE_P(, - WebRtcGetUserMediaBrowserTest, - ::testing::Values(false)); +INSTANTIATE_TEST_SUITE_P(, + WebRtcGetUserMediaBrowserTest, + ::testing::Values(false)); #endif } // namespace content
diff --git a/content/browser/webrtc/webrtc_image_capture_browsertest.cc b/content/browser/webrtc/webrtc_image_capture_browsertest.cc index 3dbe27b..7137b79 100644 --- a/content/browser/webrtc/webrtc_image_capture_browsertest.cc +++ b/content/browser/webrtc/webrtc_image_capture_browsertest.cc
@@ -243,7 +243,7 @@ ASSERT_TRUE(RunImageCaptureTestCase("testManipulateFocusDistance()")); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , // Use no prefix, so that these get picked up when using // --gtest_filter=WebRtc* WebRtcImageCaptureSucceedsBrowserTest, @@ -267,7 +267,7 @@ #endif }; -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( UsingRealWebcam, // This prefix can be used with --gtest_filter to // distinguish the tests using a real camera from the ones // that don't. @@ -340,9 +340,9 @@ ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndGrabFrameSucceeds()")); } -INSTANTIATE_TEST_CASE_P(, - WebRtcImageCaptureGetPhotoStateFailsBrowserTest, - testing::ValuesIn(kTargetVideoCaptureStacks)); +INSTANTIATE_TEST_SUITE_P(, + WebRtcImageCaptureGetPhotoStateFailsBrowserTest, + testing::ValuesIn(kTargetVideoCaptureStacks)); struct SetPhotoOptionsFailsConfigTraits { static std::string config() { @@ -367,9 +367,9 @@ ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndGrabFrameSucceeds()")); } -INSTANTIATE_TEST_CASE_P(, - WebRtcImageCaptureSetPhotoOptionsFailsBrowserTest, - testing::ValuesIn(kTargetVideoCaptureStacks)); +INSTANTIATE_TEST_SUITE_P(, + WebRtcImageCaptureSetPhotoOptionsFailsBrowserTest, + testing::ValuesIn(kTargetVideoCaptureStacks)); struct TakePhotoFailsConfigTraits { static std::string config() { @@ -391,8 +391,8 @@ ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndGrabFrameSucceeds()")); } -INSTANTIATE_TEST_CASE_P(, - WebRtcImageCaptureTakePhotoFailsBrowserTest, - testing::ValuesIn(kTargetVideoCaptureStacks)); +INSTANTIATE_TEST_SUITE_P(, + WebRtcImageCaptureTakePhotoFailsBrowserTest, + testing::ValuesIn(kTargetVideoCaptureStacks)); } // namespace content
diff --git a/content/browser/webrtc/webrtc_media_recorder_browsertest.cc b/content/browser/webrtc/webrtc_media_recorder_browsertest.cc index 8c3c2c12..a490e1354 100644 --- a/content/browser/webrtc/webrtc_media_recorder_browsertest.cc +++ b/content/browser/webrtc/webrtc_media_recorder_browsertest.cc
@@ -233,8 +233,8 @@ kMediaRecorderHtmlFile); } -INSTANTIATE_TEST_CASE_P(, - MAYBE_WebRtcMediaRecorderTest, - testing::ValuesIn(kEncodingParameters)); +INSTANTIATE_TEST_SUITE_P(, + MAYBE_WebRtcMediaRecorderTest, + testing::ValuesIn(kEncodingParameters)); } // namespace content
diff --git a/content/browser/webrtc/webrtc_stress_image_capture_browsertest.cc b/content/browser/webrtc/webrtc_stress_image_capture_browsertest.cc index ef0f948..dc9b036 100644 --- a/content/browser/webrtc/webrtc_stress_image_capture_browsertest.cc +++ b/content/browser/webrtc/webrtc_stress_image_capture_browsertest.cc
@@ -115,7 +115,7 @@ #endif }; -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( UsingRealWebcam, // This prefix can be used with --gtest_filter to // distinguish the tests using a real camera from the ones // that don't.
diff --git a/content/public/renderer/BUILD.gn b/content/public/renderer/BUILD.gn index 2e66af98..ade3b20 100644 --- a/content/public/renderer/BUILD.gn +++ b/content/public/renderer/BUILD.gn
@@ -44,11 +44,8 @@ "fixed_received_data.h", "media_stream_audio_renderer.h", "media_stream_renderer_factory.h", - "media_stream_utils.cc", "media_stream_utils.h", "media_stream_video_renderer.h", - "media_stream_video_sink.cc", - "media_stream_video_sink.h", "pepper_plugin_instance.h", "plugin_instance_throttler.h", "render_accessibility.h",
diff --git a/content/public/renderer/media_stream_utils.h b/content/public/renderer/media_stream_utils.h index f2e273f..c7da1ba 100644 --- a/content/public/renderer/media_stream_utils.h +++ b/content/public/renderer/media_stream_utils.h
@@ -11,9 +11,11 @@ #include "content/common/content_export.h" #include "media/base/channel_layout.h" #include "media/capture/video_capture_types.h" +#include "third_party/blink/public/common/media/video_capture.h" namespace blink { class WebMediaStream; +class WebMediaStreamSink; class WebMediaStreamTrack; } @@ -52,6 +54,26 @@ CONTENT_EXPORT void RequestRefreshFrameFromVideoTrack( const blink::WebMediaStreamTrack& video_track); +// Calls to these methods must be done on the main render thread. +// Note that |callback| for frame delivery happens on the IO thread. +// Warning: Calling RemoveSinkFromMediaStreamTrack does not immediately stop +// frame delivery through the |callback|, since frames are being delivered on +// a different thread. +// |is_sink_secure| indicates if |sink| meets output protection requirement. +// Generally, this should be false unless you know what you are doing. +CONTENT_EXPORT void AddSinkToMediaStreamTrack( + const blink::WebMediaStreamTrack& track, + blink::WebMediaStreamSink* sink, + const blink::VideoCaptureDeliverFrameCB& callback, + bool is_sink_secure); +CONTENT_EXPORT void RemoveSinkFromMediaStreamTrack( + const blink::WebMediaStreamTrack& track, + blink::WebMediaStreamSink* sink); + +CONTENT_EXPORT void OnFrameDroppedAtMediaStreamSink( + const blink::WebMediaStreamTrack& track, + media::VideoCaptureFrameDropReason reason); + } // namespace content #endif // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_UTILS_H_
diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn index cb92cfa..2cd57dd 100644 --- a/content/renderer/BUILD.gn +++ b/content/renderer/BUILD.gn
@@ -417,6 +417,9 @@ "media_recorder/video_track_recorder.h", "media_recorder/vpx_encoder.cc", "media_recorder/vpx_encoder.h", + "media_stream_utils.cc", + "media_stream_video_sink.cc", + "media_stream_video_sink.h", "menu_item_builder.cc", "menu_item_builder.h", "mojo/blink_interface_provider_impl.cc", @@ -516,6 +519,8 @@ "service_worker/service_worker_context_client.h", "service_worker/service_worker_fetch_context_impl.cc", "service_worker/service_worker_fetch_context_impl.h", + "service_worker/service_worker_network_provider_for_frame.cc", + "service_worker/service_worker_network_provider_for_frame.h", "service_worker/service_worker_network_provider_for_service_worker.cc", "service_worker/service_worker_network_provider_for_service_worker.h", "service_worker/service_worker_provider_context.cc", @@ -530,8 +535,6 @@ "service_worker/service_worker_type_converters.h", "service_worker/service_worker_type_util.cc", "service_worker/service_worker_type_util.h", - "service_worker/web_service_worker_network_provider_impl_for_frame.cc", - "service_worker/web_service_worker_network_provider_impl_for_frame.h", "service_worker/web_service_worker_provider_impl.cc", "service_worker/web_service_worker_provider_impl.h", "skia_benchmarking_extension.cc", @@ -564,10 +567,10 @@ "worker/dedicated_worker_host_factory_client.h", "worker/embedded_shared_worker_stub.cc", "worker/embedded_shared_worker_stub.h", + "worker/service_worker_network_provider_for_worker.cc", + "worker/service_worker_network_provider_for_worker.h", "worker/shared_worker_factory_impl.cc", "worker/shared_worker_factory_impl.h", - "worker/web_service_worker_network_provider_impl_for_worker.cc", - "worker/web_service_worker_network_provider_impl_for_worker.h", "worker/worker_thread_registry.cc", "worker/worker_thread_registry.h", ]
diff --git a/content/renderer/categorized_worker_pool.cc b/content/renderer/categorized_worker_pool.cc index 3664ee2..ce1db96 100644 --- a/content/renderer/categorized_worker_pool.cc +++ b/content/renderer/categorized_worker_pool.cc
@@ -228,11 +228,9 @@ DCHECK(completed_tasks_.empty()); CollectCompletedTasksWithLockAcquired(namespace_token_, &completed_tasks_); - auto end = std::remove_if( - tasks_.begin(), tasks_.end(), [this](const scoped_refptr<cc::Task>& e) { - return base::ContainsValue(this->completed_tasks_, e); - }); - tasks_.erase(end, tasks_.end()); + base::EraseIf(tasks_, [this](const scoped_refptr<cc::Task>& e) { + return base::ContainsValue(this->completed_tasks_, e); + }); tasks_.push_back(base::MakeRefCounted<ClosureTask>(std::move(task))); graph_.Reset();
diff --git a/content/renderer/categorized_worker_pool_unittest.cc b/content/renderer/categorized_worker_pool_unittest.cc index f8da22c8..3852a0ee 100644 --- a/content/renderer/categorized_worker_pool_unittest.cc +++ b/content/renderer/categorized_worker_pool_unittest.cc
@@ -34,9 +34,9 @@ scoped_refptr<content::CategorizedWorkerPool> categorized_worker_pool_; }; -INSTANTIATE_TYPED_TEST_CASE_P(CategorizedWorkerPool, - TaskRunnerTest, - CategorizedWorkerPoolTestDelegate); +INSTANTIATE_TYPED_TEST_SUITE_P(CategorizedWorkerPool, + TaskRunnerTest, + CategorizedWorkerPoolTestDelegate); class CategorizedWorkerPoolSequencedTestDelegate { public: @@ -59,9 +59,9 @@ scoped_refptr<content::CategorizedWorkerPool> categorized_worker_pool_; }; -INSTANTIATE_TYPED_TEST_CASE_P(CategorizedWorkerPool, - SequencedTaskRunnerTest, - CategorizedWorkerPoolSequencedTestDelegate); +INSTANTIATE_TYPED_TEST_SUITE_P(CategorizedWorkerPool, + SequencedTaskRunnerTest, + CategorizedWorkerPoolSequencedTestDelegate); } // namespace } // namespace base @@ -92,29 +92,29 @@ }; // Multithreaded tests. -INSTANTIATE_TYPED_TEST_CASE_P( +INSTANTIATE_TYPED_TEST_SUITE_P( CategorizedWorkerPool_1_Threads, TaskGraphRunnerTest, CategorizedWorkerPoolTaskGraphRunnerTestDelegate<1>); -INSTANTIATE_TYPED_TEST_CASE_P( +INSTANTIATE_TYPED_TEST_SUITE_P( CategorizedWorkerPool_2_Threads, TaskGraphRunnerTest, CategorizedWorkerPoolTaskGraphRunnerTestDelegate<2>); -INSTANTIATE_TYPED_TEST_CASE_P( +INSTANTIATE_TYPED_TEST_SUITE_P( CategorizedWorkerPool_3_Threads, TaskGraphRunnerTest, CategorizedWorkerPoolTaskGraphRunnerTestDelegate<3>); -INSTANTIATE_TYPED_TEST_CASE_P( +INSTANTIATE_TYPED_TEST_SUITE_P( CategorizedWorkerPool_4_Threads, TaskGraphRunnerTest, CategorizedWorkerPoolTaskGraphRunnerTestDelegate<4>); -INSTANTIATE_TYPED_TEST_CASE_P( +INSTANTIATE_TYPED_TEST_SUITE_P( CategorizedWorkerPool_5_Threads, TaskGraphRunnerTest, CategorizedWorkerPoolTaskGraphRunnerTestDelegate<5>); // Single threaded tests. -INSTANTIATE_TYPED_TEST_CASE_P( +INSTANTIATE_TYPED_TEST_SUITE_P( CategorizedWorkerPool, SingleThreadTaskGraphRunnerTest, CategorizedWorkerPoolTaskGraphRunnerTestDelegate<1>);
diff --git a/content/renderer/image_capture/image_capture_frame_grabber.h b/content/renderer/image_capture/image_capture_frame_grabber.h index 3cd3e32f..2fcd6c0 100644 --- a/content/renderer/image_capture/image_capture_frame_grabber.h +++ b/content/renderer/image_capture/image_capture_frame_grabber.h
@@ -12,7 +12,7 @@ #include "base/memory/weak_ptr.h" #include "base/threading/thread_checker.h" #include "content/common/content_export.h" -#include "content/public/renderer/media_stream_video_sink.h" +#include "content/renderer/media_stream_video_sink.h" #include "third_party/blink/public/platform/scoped_web_callbacks.h" #include "third_party/blink/public/platform/web_image_capture_frame_grabber.h"
diff --git a/content/renderer/loader/web_worker_fetch_context_impl.cc b/content/renderer/loader/web_worker_fetch_context_impl.cc index 79c6c3efb..ac9541f 100644 --- a/content/renderer/loader/web_worker_fetch_context_impl.cc +++ b/content/renderer/loader/web_worker_fetch_context_impl.cc
@@ -28,7 +28,7 @@ #include "content/renderer/service_worker/controller_service_worker_connector.h" #include "content/renderer/service_worker/service_worker_provider_context.h" #include "content/renderer/service_worker/service_worker_subresource_loader.h" -#include "content/renderer/worker/web_service_worker_network_provider_impl_for_worker.h" +#include "content/renderer/worker/service_worker_network_provider_for_worker.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "services/network/public/cpp/wrapper_shared_url_loader_factory.h" @@ -118,7 +118,7 @@ private: bool CanCreateServiceWorkerURLLoader(const blink::WebURLRequest& request) { // TODO(horo): Unify this code path with - // WebServiceWorkerNetworkProviderImplForFrame::CreateURLLoader that is used + // ServiceWorkerNetworkProviderForFrame::CreateURLLoader that is used // for document cases. // We need the service worker loader factory populated in order to create
diff --git a/content/renderer/media/stream/media_stream_video_capturer_source_unittest.cc b/content/renderer/media/stream/media_stream_video_capturer_source_unittest.cc index 6e5993ba..2ce37b6 100644 --- a/content/renderer/media/stream/media_stream_video_capturer_source_unittest.cc +++ b/content/renderer/media/stream/media_stream_video_capturer_source_unittest.cc
@@ -11,10 +11,10 @@ #include "base/run_loop.h" #include "base/test/scoped_task_environment.h" #include "content/child/child_process.h" -#include "content/public/renderer/media_stream_video_sink.h" #include "content/renderer/media/stream/media_stream_video_track.h" #include "content/renderer/media/stream/mock_mojo_media_stream_dispatcher_host.h" #include "content/renderer/media/stream/video_track_adapter.h" +#include "content/renderer/media_stream_video_sink.h" #include "media/base/bind_to_current_loop.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/content/renderer/media/stream/media_stream_video_renderer_sink.h b/content/renderer/media/stream/media_stream_video_renderer_sink.h index ef9a87d..8801107 100644 --- a/content/renderer/media/stream/media_stream_video_renderer_sink.h +++ b/content/renderer/media/stream/media_stream_video_renderer_sink.h
@@ -11,7 +11,7 @@ #include "base/threading/thread_checker.h" #include "content/common/content_export.h" #include "content/public/renderer/media_stream_video_renderer.h" -#include "content/public/renderer/media_stream_video_sink.h" +#include "content/renderer/media_stream_video_sink.h" #include "third_party/blink/public/common/media/video_capture.h" #include "third_party/blink/public/platform/web_media_stream_track.h" #include "ui/gfx/geometry/size.h"
diff --git a/content/renderer/media/stream/media_stream_video_track.cc b/content/renderer/media/stream/media_stream_video_track.cc index 36920859..84c9319e 100644 --- a/content/renderer/media/stream/media_stream_video_track.cc +++ b/content/renderer/media/stream/media_stream_video_track.cc
@@ -42,7 +42,7 @@ class MediaStreamVideoTrack::FrameDeliverer : public base::RefCountedThreadSafe<FrameDeliverer> { public: - using VideoSinkId = MediaStreamVideoSink*; + using VideoSinkId = blink::WebMediaStreamSink*; FrameDeliverer( scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, @@ -361,7 +361,7 @@ } void MediaStreamVideoTrack::AddSink( - MediaStreamVideoSink* sink, + blink::WebMediaStreamSink* sink, const blink::VideoCaptureDeliverFrameCB& callback, bool is_sink_secure) { DCHECK_CALLED_ON_VALID_THREAD(main_render_thread_checker_); @@ -378,7 +378,7 @@ secure_tracker_.is_capturing_secure()); } -void MediaStreamVideoTrack::RemoveSink(MediaStreamVideoSink* sink) { +void MediaStreamVideoTrack::RemoveSink(blink::WebMediaStreamSink* sink) { DCHECK_CALLED_ON_VALID_THREAD(main_render_thread_checker_); auto it = std::find(sinks_.begin(), sinks_.end(), sink); DCHECK(it != sinks_.end());
diff --git a/content/renderer/media/stream/media_stream_video_track.h b/content/renderer/media/stream/media_stream_video_track.h index f79c09a..997d5b65 100644 --- a/content/renderer/media/stream/media_stream_video_track.h +++ b/content/renderer/media/stream/media_stream_video_track.h
@@ -14,9 +14,9 @@ #include "base/memory/weak_ptr.h" #include "base/threading/thread_checker.h" #include "content/common/content_export.h" -#include "content/public/renderer/media_stream_video_sink.h" #include "content/renderer/media/stream/media_stream_video_source.h" #include "third_party/blink/public/platform/modules/mediastream/secure_display_link_tracker.h" +#include "third_party/blink/public/platform/modules/mediastream/web_media_stream_sink.h" #include "third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_track.h" #include "third_party/blink/public/platform/web_media_stream_track.h" @@ -82,6 +82,14 @@ void StopAndNotify(base::OnceClosure callback) override; void GetSettings(blink::WebMediaStreamTrack::Settings& settings) override; + // Add |sink| to receive state changes on the main render thread and video + // frames in the |callback| method on the IO-thread. + // |callback| will be reset on the render thread. + void AddSink(blink::WebMediaStreamSink* sink, + const blink::VideoCaptureDeliverFrameCB& callback, + bool is_sink_secure); + void RemoveSink(blink::WebMediaStreamSink* sink); + void OnReadyStateChanged(blink::WebMediaStreamSource::ReadyState state); const base::Optional<bool>& noise_reduction() const { @@ -134,31 +142,17 @@ void OnFrameDropped(media::VideoCaptureFrameDropReason reason); private: - // MediaStreamVideoSink is a friend to allow it to call AddSink() and - // RemoveSink(). - friend class MediaStreamVideoSink; FRIEND_TEST_ALL_PREFIXES(MediaStreamRemoteVideoSourceTest, StartTrack); FRIEND_TEST_ALL_PREFIXES(MediaStreamRemoteVideoSourceTest, RemoteTrackStop); FRIEND_TEST_ALL_PREFIXES(MediaStreamRemoteVideoSourceTest, PreservesColorSpace); FRIEND_TEST_ALL_PREFIXES(PepperToVideoTrackAdapterTest, PutFrame); - // Add |sink| to receive state changes on the main render thread and video - // frames in the |callback| method on the IO-thread. - // |callback| will be reset on the render thread. - // These two methods are private such that no subclass can intercept and - // store the callback. This is important to ensure that we can release - // the callback on render thread without reference to it on the IO-thread. - void AddSink(MediaStreamVideoSink* sink, - const blink::VideoCaptureDeliverFrameCB& callback, - bool is_sink_secure); - void RemoveSink(MediaStreamVideoSink* sink); - // In debug builds, check that all methods that could cause object graph // or data flow changes are being called on the main thread. THREAD_CHECKER(main_render_thread_checker_); - std::vector<MediaStreamVideoSink*> sinks_; + std::vector<blink::WebMediaStreamSink*> sinks_; // |FrameDeliverer| is an internal helper object used for delivering video // frames on the IO-thread using callbacks to all registered tracks. @@ -176,7 +170,7 @@ base::WeakPtr<MediaStreamVideoSource> source_; // This is used for tracking if all connected video sinks are secure. - blink::SecureDisplayLinkTracker<MediaStreamVideoSink> secure_tracker_; + blink::SecureDisplayLinkTracker<blink::WebMediaStreamSink> secure_tracker_; // Remembering our desired video size and frame rate. int width_ = 0;
diff --git a/content/renderer/media/stream/mock_media_stream_video_sink.h b/content/renderer/media/stream/mock_media_stream_video_sink.h index f49999e..8d9c585 100644 --- a/content/renderer/media/stream/mock_media_stream_video_sink.h +++ b/content/renderer/media/stream/mock_media_stream_video_sink.h
@@ -5,7 +5,7 @@ #ifndef CONTENT_RENDERER_MEDIA_STREAM_MOCK_MEDIA_STREAM_VIDEO_SINK_H_ #define CONTENT_RENDERER_MEDIA_STREAM_MOCK_MEDIA_STREAM_VIDEO_SINK_H_ -#include "content/public/renderer/media_stream_video_sink.h" +#include "content/renderer/media_stream_video_sink.h" #include "base/memory/weak_ptr.h" #include "media/base/video_frame.h"
diff --git a/content/renderer/media/stream/webmediaplayer_ms.cc b/content/renderer/media/stream/webmediaplayer_ms.cc index 3b11c6d..87dd4633 100644 --- a/content/renderer/media/stream/webmediaplayer_ms.cc +++ b/content/renderer/media/stream/webmediaplayer_ms.cc
@@ -647,7 +647,7 @@ delegate_->DidPlayerMutedStatusChange(delegate_id_, volume == 0.0); } -void WebMediaPlayerMS::EnterPictureInPicture() { +void WebMediaPlayerMS::OnRequestPictureInPicture() { if (!bridge_) ActivateSurfaceLayerForVideo(); @@ -655,12 +655,6 @@ DCHECK(bridge_->GetSurfaceId().is_valid()); } -void WebMediaPlayerMS::ExitPictureInPicture() { - // Internal cleanups. - // TODO(mlamouri): remove the need for this. - OnPictureInPictureModeEnded(); -} - void WebMediaPlayerMS::SetPictureInPictureCustomControls( const std::vector<blink::PictureInPictureControlInfo>& controls) { delegate_->DidSetPictureInPictureCustomControls(delegate_id_, controls);
diff --git a/content/renderer/media/stream/webmediaplayer_ms.h b/content/renderer/media/stream/webmediaplayer_ms.h index 3fcc581..7b95d0e7 100644 --- a/content/renderer/media/stream/webmediaplayer_ms.h +++ b/content/renderer/media/stream/webmediaplayer_ms.h
@@ -116,8 +116,7 @@ void Seek(double seconds) override; void SetRate(double rate) override; void SetVolume(double volume) override; - void EnterPictureInPicture() override; - void ExitPictureInPicture() override; + void OnRequestPictureInPicture() override; void SetPictureInPictureCustomControls( const std::vector<blink::PictureInPictureControlInfo>&) override; void SetSinkId(
diff --git a/content/renderer/media/video_capture_impl_manager.h b/content/renderer/media/video_capture_impl_manager.h index a587f109..f09dc3e 100644 --- a/content/renderer/media/video_capture_impl_manager.h +++ b/content/renderer/media/video_capture_impl_manager.h
@@ -17,7 +17,6 @@ #include "base/synchronization/lock.h" #include "base/threading/thread_checker.h" #include "content/common/content_export.h" -#include "content/public/renderer/media_stream_video_sink.h" #include "media/capture/video_capture_types.h" #include "third_party/blink/public/common/media/video_capture.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h"
diff --git a/content/renderer/media/webrtc/media_stream_video_webrtc_sink.h b/content/renderer/media/webrtc/media_stream_video_webrtc_sink.h index a07c240..e2f703f 100644 --- a/content/renderer/media/webrtc/media_stream_video_webrtc_sink.h +++ b/content/renderer/media/webrtc/media_stream_video_webrtc_sink.h
@@ -8,7 +8,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/threading/thread_checker.h" -#include "content/public/renderer/media_stream_video_sink.h" +#include "content/renderer/media_stream_video_sink.h" #include "third_party/blink/public/platform/web_media_stream_track.h" #include "third_party/webrtc/api/media_stream_interface.h"
diff --git a/content/renderer/media/webrtc/mock_peer_connection_dependency_factory.cc b/content/renderer/media/webrtc/mock_peer_connection_dependency_factory.cc index ea7dedc..066421a 100644 --- a/content/renderer/media/webrtc/mock_peer_connection_dependency_factory.cc +++ b/content/renderer/media/webrtc/mock_peer_connection_dependency_factory.cc
@@ -37,7 +37,7 @@ } } return it; -}; +} MockWebRtcAudioSource::MockWebRtcAudioSource(bool is_remote) : is_remote_(is_remote) {}
diff --git a/content/renderer/media/webrtc/rtc_stats.cc b/content/renderer/media/webrtc/rtc_stats.cc index b84e4420..66c745d0 100644 --- a/content/renderer/media/webrtc/rtc_stats.cc +++ b/content/renderer/media/webrtc/rtc_stats.cc
@@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/logging.h" +#include "base/stl_util.h" #include "base/time/time.h" #include "third_party/webrtc/api/stats/rtcstats_objects.h" @@ -65,12 +66,10 @@ // Note that using "is_standarized" avoids having to maintain a whitelist of // every single standardized member, as we do at the "stats object" level // with "RTCStatsWhitelist". - stats_members.erase( - std::remove_if(stats_members.begin(), stats_members.end(), - [](const webrtc::RTCStatsMemberInterface* member) { - return !member->is_standardized(); - }), - stats_members.end()); + base::EraseIf(stats_members, + [](const webrtc::RTCStatsMemberInterface* member) { + return !member->is_standardized(); + }); return stats_members; }
diff --git a/content/renderer/media/webrtc/webrtc_set_description_observer_unittest.cc b/content/renderer/media/webrtc/webrtc_set_description_observer_unittest.cc index e3690b3..44e8fcc 100644 --- a/content/renderer/media/webrtc/webrtc_set_description_observer_unittest.cc +++ b/content/renderer/media/webrtc/webrtc_set_description_observer_unittest.cc
@@ -482,7 +482,7 @@ EXPECT_EQ(0u, observer_->states().transceiver_states.size()); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, WebRtcSetDescriptionObserverHandlerTest, ::testing::Values(std::make_tuple(ObserverHandlerType::kLocal,
diff --git a/content/renderer/media/webrtc/webrtc_uma_histograms_unittest.cc b/content/renderer/media/webrtc/webrtc_uma_histograms_unittest.cc index b0c44b8..780a7ae 100644 --- a/content/renderer/media/webrtc/webrtc_uma_histograms_unittest.cc +++ b/content/renderer/media/webrtc/webrtc_uma_histograms_unittest.cc
@@ -44,7 +44,7 @@ metrics.LogUsageOnlyOnce(api_name); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PerSessionWebRTCAPIMetricsTest, PerSessionWebRTCAPIMetricsTest, ::testing::ValuesIn({blink::WebRTCAPIName::kGetUserMedia,
diff --git a/content/renderer/media_capture_from_element/html_video_element_capturer_source_unittest.cc b/content/renderer/media_capture_from_element/html_video_element_capturer_source_unittest.cc index 510dff25..2df724d 100644 --- a/content/renderer/media_capture_from_element/html_video_element_capturer_source_unittest.cc +++ b/content/renderer/media_capture_from_element/html_video_element_capturer_source_unittest.cc
@@ -50,8 +50,7 @@ void Seek(double seconds) override {} void SetRate(double) override {} void SetVolume(double) override {} - void EnterPictureInPicture() override {} - void ExitPictureInPicture() override {} + void OnRequestPictureInPicture() override {} void SetPictureInPictureCustomControls( const std::vector<blink::PictureInPictureControlInfo>&) override {} blink::WebTimeRanges Buffered() const override {
diff --git a/content/renderer/media_recorder/video_track_recorder.h b/content/renderer/media_recorder/video_track_recorder.h index 63244ef..bd357b9 100644 --- a/content/renderer/media_recorder/video_track_recorder.h +++ b/content/renderer/media_recorder/video_track_recorder.h
@@ -13,7 +13,7 @@ #include "base/single_thread_task_runner.h" #include "base/threading/thread_checker.h" #include "content/public/common/buildflags.h" -#include "content/public/renderer/media_stream_video_sink.h" +#include "content/renderer/media_stream_video_sink.h" #include "media/muxers/webm_muxer.h" #include "third_party/blink/public/platform/web_media_stream_track.h" #include "third_party/skia/include/core/SkBitmap.h"
diff --git a/content/public/renderer/media_stream_utils.cc b/content/renderer/media_stream_utils.cc similarity index 81% rename from content/public/renderer/media_stream_utils.cc rename to content/renderer/media_stream_utils.cc index 4195dbcc..1237b6e3 100644 --- a/content/public/renderer/media_stream_utils.cc +++ b/content/renderer/media_stream_utils.cc
@@ -18,6 +18,7 @@ #include "content/renderer/media/stream/media_stream_video_track.h" #include "media/base/audio_capturer_source.h" #include "media/capture/video_capturer_source.h" +#include "third_party/blink/public/platform/modules/mediastream/web_media_stream_sink.h" #include "third_party/blink/public/platform/web_media_stream.h" #include "third_party/blink/public/platform/web_media_stream_source.h" @@ -120,4 +121,32 @@ source->RequestRefreshFrame(); } +void AddSinkToMediaStreamTrack( + const blink::WebMediaStreamTrack& track, + blink::WebMediaStreamSink* sink, + const blink::VideoCaptureDeliverFrameCB& callback, + bool is_sink_secure) { + MediaStreamVideoTrack* const video_track = + MediaStreamVideoTrack::GetVideoTrack(track); + DCHECK(video_track); + video_track->AddSink(sink, callback, is_sink_secure); +} + +void RemoveSinkFromMediaStreamTrack(const blink::WebMediaStreamTrack& track, + blink::WebMediaStreamSink* sink) { + MediaStreamVideoTrack* const video_track = + MediaStreamVideoTrack::GetVideoTrack(track); + if (video_track) + video_track->RemoveSink(sink); +} + +void OnFrameDroppedAtMediaStreamSink( + const blink::WebMediaStreamTrack& track, + media::VideoCaptureFrameDropReason reason) { + MediaStreamVideoTrack* const video_track = + MediaStreamVideoTrack::GetVideoTrack(track); + if (video_track) + video_track->OnFrameDropped(reason); +} + } // namespace content
diff --git a/content/public/renderer/media_stream_video_sink.cc b/content/renderer/media_stream_video_sink.cc similarity index 61% rename from content/public/renderer/media_stream_video_sink.cc rename to content/renderer/media_stream_video_sink.cc index d66ee53..82d3fcef 100644 --- a/content/public/renderer/media_stream_video_sink.cc +++ b/content/renderer/media_stream_video_sink.cc
@@ -2,8 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/public/renderer/media_stream_video_sink.h" +#include "content/renderer/media_stream_video_sink.h" +#include "content/public/renderer/media_stream_utils.h" #include "content/renderer/media/stream/media_stream_video_track.h" namespace content { @@ -21,27 +22,19 @@ bool is_sink_secure) { DCHECK(connected_track_.IsNull()); connected_track_ = track; - MediaStreamVideoTrack* const video_track = - MediaStreamVideoTrack::GetVideoTrack(connected_track_); - DCHECK(video_track); - video_track->AddSink(this, callback, is_sink_secure); + AddSinkToMediaStreamTrack(track, this, callback, is_sink_secure); } void MediaStreamVideoSink::DisconnectFromTrack() { - MediaStreamVideoTrack* const video_track = - MediaStreamVideoTrack::GetVideoTrack(connected_track_); - if (video_track) - video_track->RemoveSink(this); + RemoveSinkFromMediaStreamTrack(connected_track_, this); connected_track_.Reset(); } void MediaStreamVideoSink::OnFrameDropped( media::VideoCaptureFrameDropReason reason) { - MediaStreamVideoTrack* const video_track = - MediaStreamVideoTrack::GetVideoTrack(connected_track_); - if (!video_track) + if (connected_track_.IsNull()) return; - video_track->OnFrameDropped(reason); + OnFrameDroppedAtMediaStreamSink(connected_track_, reason); } } // namespace content
diff --git a/content/public/renderer/media_stream_video_sink.h b/content/renderer/media_stream_video_sink.h similarity index 71% rename from content/public/renderer/media_stream_video_sink.h rename to content/renderer/media_stream_video_sink.h index e84df90..31077294 100644 --- a/content/public/renderer/media_stream_video_sink.h +++ b/content/renderer/media_stream_video_sink.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 CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_ -#define CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_ +#ifndef CONTENT_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_ +#define CONTENT_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_ #include "base/callback.h" #include "base/compiler_specific.h" @@ -17,13 +17,13 @@ namespace content { -// MediaStreamVideoSink is an interface used for receiving video frames from a -// Video Stream Track or a Video Source. It should be extended by embedders, -// which connect/disconnect the sink implementation to a track to start/stop the -// flow of video frames. +// MediaStreamVideoSink is a base class that contains implementation commonly +// useful for implementations of blink::WebMediaStreamSink which +// connect/disconnect the sink implementation to a track to start/stop the flow +// of video frames. // // http://dev.w3.org/2011/webrtc/editor/getusermedia.html -// All methods calls will be done from the main render thread. +// All methods calls must be made from the main render thread. class CONTENT_EXPORT MediaStreamVideoSink : public blink::WebMediaStreamSink { public: void OnFrameDropped(media::VideoCaptureFrameDropReason reason); @@ -32,10 +32,9 @@ MediaStreamVideoSink(); ~MediaStreamVideoSink() override; - // An implementation of MediaStreamVideoSink should call ConnectToTrack when - // it is ready to receive data from a video track. Before the implementation - // is destroyed, DisconnectFromTrack must be called. This MediaStreamVideoSink - // base class holds a reference to the WebMediaStreamTrack until + // A subclass should call ConnectToTrack when it is ready to receive data from + // a video track. Before destruction, DisconnectFromTrack must be called. + // This base class holds a reference to the WebMediaStreamTrack until // DisconnectFromTrack is called. // // Calls to these methods must be done on the main render thread. @@ -65,4 +64,4 @@ } // namespace content -#endif // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_ +#endif // CONTENT_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_
diff --git a/content/renderer/pepper/pepper_media_stream_video_track_host.h b/content/renderer/pepper/pepper_media_stream_video_track_host.h index 36451d2..a479569 100644 --- a/content/renderer/pepper/pepper_media_stream_video_track_host.h +++ b/content/renderer/pepper/pepper_media_stream_video_track_host.h
@@ -10,7 +10,7 @@ #include "base/compiler_specific.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "content/public/renderer/media_stream_video_sink.h" +#include "content/renderer/media_stream_video_sink.h" #include "content/renderer/pepper/pepper_media_stream_track_host_base.h" #include "media/base/video_frame.h" #include "ppapi/c/ppb_video_frame.h"
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 5d1e5433..4cf6abb 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -143,7 +143,7 @@ #include "content/renderer/renderer_webapplicationcachehost_impl.h" #include "content/renderer/resource_timing_info_conversions.h" #include "content/renderer/savable_resources.h" -#include "content/renderer/service_worker/web_service_worker_network_provider_impl_for_frame.h" +#include "content/renderer/service_worker/service_worker_network_provider_for_frame.h" #include "content/renderer/service_worker/web_service_worker_provider_impl.h" #include "content/renderer/skia_benchmarking_extension.h" #include "content/renderer/stats_collection_controller.h" @@ -3945,8 +3945,8 @@ scoped_refptr<blink::WebWorkerFetchContext> RenderFrameImpl::CreateWorkerFetchContext() { - WebServiceWorkerNetworkProviderImplForFrame* provider = - static_cast<WebServiceWorkerNetworkProviderImplForFrame*>( + ServiceWorkerNetworkProviderForFrame* provider = + static_cast<ServiceWorkerNetworkProviderForFrame*>( frame_->GetDocumentLoader()->GetServiceWorkerNetworkProvider()); DCHECK(provider); @@ -4023,8 +4023,8 @@ // At this point we should have non-null data source. if (!ChildThreadImpl::current()) return nullptr; // May be null in some tests. - WebServiceWorkerNetworkProviderImplForFrame* provider = - static_cast<WebServiceWorkerNetworkProviderImplForFrame*>( + ServiceWorkerNetworkProviderForFrame* provider = + static_cast<ServiceWorkerNetworkProviderForFrame*>( frame_->GetDocumentLoader()->GetServiceWorkerNetworkProvider()); if (!provider->context()) { // The context can be null when the frame is sandboxed. @@ -7417,7 +7417,7 @@ scoped_refptr<network::SharedURLLoaderFactory> fallback_factory = network::SharedURLLoaderFactory::Create( GetLoaderFactoryBundle()->CloneWithoutAppCacheFactory()); - return WebServiceWorkerNetworkProviderImplForFrame::Create( + return ServiceWorkerNetworkProviderForFrame::Create( this, commit_params, std::move(controller_service_worker_info), std::move(fallback_factory)); }
diff --git a/content/renderer/render_thread_impl_browsertest.cc b/content/renderer/render_thread_impl_browsertest.cc index 01900800..c4970c9c 100644 --- a/content/renderer/render_thread_impl_browsertest.cc +++ b/content/renderer/render_thread_impl_browsertest.cc
@@ -480,7 +480,7 @@ buffer->Unmap(); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( RenderThreadImplGpuMemoryBufferBrowserTests, RenderThreadImplGpuMemoryBufferBrowserTest, ::testing::Combine(::testing::Values(kDisableNativeBuffers,
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc index 574dd82..2520da6 100644 --- a/content/renderer/render_view_browsertest.cc +++ b/content/renderer/render_view_browsertest.cc
@@ -51,7 +51,7 @@ #include "content/renderer/render_frame_proxy.h" #include "content/renderer/render_process.h" #include "content/renderer/render_view_impl.h" -#include "content/renderer/service_worker/web_service_worker_network_provider_impl_for_frame.h" +#include "content/renderer/service_worker/service_worker_network_provider_for_frame.h" #include "content/shell/browser/shell.h" #include "content/shell/browser/shell_browser_context.h" #include "content/test/fake_compositor_dependencies.h" @@ -2160,14 +2160,14 @@ // Service workers require https. GURL example_url("https://example.com"); - WebServiceWorkerNetworkProviderImplForFrame* provider = nullptr; + ServiceWorkerNetworkProviderForFrame* provider = nullptr; RequestExtraData* extra_data = nullptr; // Make sure each new document has a new provider and // that the main request is tagged with the provider's id. LoadHTMLWithUrlOverride("<b>A Document</b>", example_url.spec().c_str()); ASSERT_TRUE(GetMainFrame()->GetDocumentLoader()); - provider = static_cast<WebServiceWorkerNetworkProviderImplForFrame*>( + provider = static_cast<ServiceWorkerNetworkProviderForFrame*>( GetMainFrame()->GetDocumentLoader()->GetServiceWorkerNetworkProvider()); ASSERT_TRUE(provider); int provider1_id = provider->provider_id(); @@ -2175,7 +2175,7 @@ LoadHTMLWithUrlOverride("<b>New Document B Goes Here</b>", example_url.spec().c_str()); ASSERT_TRUE(GetMainFrame()->GetDocumentLoader()); - provider = static_cast<WebServiceWorkerNetworkProviderImplForFrame*>( + provider = static_cast<ServiceWorkerNetworkProviderForFrame*>( GetMainFrame()->GetDocumentLoader()->GetServiceWorkerNetworkProvider()); ASSERT_TRUE(provider); EXPECT_NE(provider1_id, provider->provider_id());
diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc index 2ed05ab..d96d88a 100644 --- a/content/renderer/service_worker/service_worker_context_client.cc +++ b/content/renderer/service_worker/service_worker_context_client.cc
@@ -446,6 +446,12 @@ context_->controller_impl = std::make_unique<ControllerServiceWorkerImpl>( std::move(pending_controller_request_), std::move(weak_ptr)); } + + // Create the idle timer. At this point the timer is not started. It will be + // started after the WorkerStarted message is sent. + context_->timeout_timer = + std::make_unique<ServiceWorkerTimeoutTimer>(base::BindRepeating( + &ServiceWorkerContextClient::OnIdleTimeout, base::Unretained(this))); } void ServiceWorkerContextClient::WillEvaluateScript() { @@ -1006,11 +1012,15 @@ int ServiceWorkerContextClient::WillStartTask() { DCHECK(worker_task_runner_->RunsTasksInCurrentSequence()); + DCHECK(context_); + DCHECK(context_->timeout_timer); return context_->timeout_timer->StartEvent(base::DoNothing()); } void ServiceWorkerContextClient::DidEndTask(int task_id) { DCHECK(worker_task_runner_->RunsTasksInCurrentSequence()); + DCHECK(context_); + DCHECK(context_->timeout_timer); context_->timeout_timer->EndEvent(task_id); } @@ -1250,13 +1260,12 @@ (*instance_host_) ->OnStarted(status, WorkerThread::GetCurrentId(), std::move(start_timing_)); + + DCHECK(context_); + DCHECK(context_->timeout_timer); + context_->timeout_timer->Start(); TRACE_EVENT_NESTABLE_ASYNC_END0("ServiceWorker", "ServiceWorkerContextClient", this); - - // Start the idle timer. - context_->timeout_timer = - std::make_unique<ServiceWorkerTimeoutTimer>(base::BindRepeating( - &ServiceWorkerContextClient::OnIdleTimeout, base::Unretained(this))); } void ServiceWorkerContextClient::DispatchActivateEvent(
diff --git a/content/renderer/service_worker/service_worker_context_client_unittest.cc b/content/renderer/service_worker/service_worker_context_client_unittest.cc index f8c28e54..e99cbdc2 100644 --- a/content/renderer/service_worker/service_worker_context_client_unittest.cc +++ b/content/renderer/service_worker/service_worker_context_client_unittest.cc
@@ -359,6 +359,7 @@ auto timer = std::make_unique<ServiceWorkerTimeoutTimer>( CreateCallbackWithCalledFlag(&is_idle_), task_runner()->GetMockTickClock()); + timer->Start(); context_client->SetTimeoutTimerForTesting(std::move(timer)); // Ensure the idle state. @@ -486,6 +487,7 @@ auto timer = std::make_unique<ServiceWorkerTimeoutTimer>( CreateCallbackWithCalledFlag(&is_idle), task_runner()->GetMockTickClock()); + timer->Start(); context_client->SetTimeoutTimerForTesting(std::move(timer)); // The dispatched fetch event should be recorded by |mock_proxy|.
diff --git a/content/renderer/service_worker/web_service_worker_network_provider_impl_for_frame.cc b/content/renderer/service_worker/service_worker_network_provider_for_frame.cc similarity index 86% rename from content/renderer/service_worker/web_service_worker_network_provider_impl_for_frame.cc rename to content/renderer/service_worker/service_worker_network_provider_for_frame.cc index 7ca7c55e..357104eb 100644 --- a/content/renderer/service_worker/web_service_worker_network_provider_impl_for_frame.cc +++ b/content/renderer/service_worker/service_worker_network_provider_for_frame.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 "content/renderer/service_worker/web_service_worker_network_provider_impl_for_frame.h" +#include "content/renderer/service_worker/service_worker_network_provider_for_frame.h" #include <utility> @@ -35,10 +35,10 @@ } } // namespace -class WebServiceWorkerNetworkProviderImplForFrame::NewDocumentObserver +class ServiceWorkerNetworkProviderForFrame::NewDocumentObserver : public RenderFrameObserver { public: - NewDocumentObserver(WebServiceWorkerNetworkProviderImplForFrame* owner, + NewDocumentObserver(ServiceWorkerNetworkProviderForFrame* owner, RenderFrameImpl* frame) : RenderFrameObserver(frame), owner_(owner) {} @@ -53,7 +53,7 @@ // service workers so created the network provider, but it turns out it is // not eligible because it is CSP sandboxed. web_loader->SetServiceWorkerNetworkProvider( - WebServiceWorkerNetworkProviderImplForFrame::CreateInvalidInstance()); + ServiceWorkerNetworkProviderForFrame::CreateInvalidInstance()); // |this| and its owner are destroyed. return; } @@ -67,12 +67,12 @@ } private: - WebServiceWorkerNetworkProviderImplForFrame* owner_; + ServiceWorkerNetworkProviderForFrame* owner_; }; // static -std::unique_ptr<WebServiceWorkerNetworkProviderImplForFrame> -WebServiceWorkerNetworkProviderImplForFrame::Create( +std::unique_ptr<ServiceWorkerNetworkProviderForFrame> +ServiceWorkerNetworkProviderForFrame::Create( RenderFrameImpl* frame, const CommitNavigationParams* commit_params, blink::mojom::ControllerServiceWorkerInfoPtr controller_info, @@ -118,7 +118,7 @@ provider_id = ServiceWorkerProviderContext::GetNextId(); auto provider = - base::WrapUnique(new WebServiceWorkerNetworkProviderImplForFrame(frame)); + base::WrapUnique(new ServiceWorkerNetworkProviderForFrame(frame)); auto host_info = blink::mojom::ServiceWorkerProviderHostInfo::New( provider_id, frame->GetRoutingID(), @@ -154,25 +154,23 @@ } // static -std::unique_ptr<WebServiceWorkerNetworkProviderImplForFrame> -WebServiceWorkerNetworkProviderImplForFrame::CreateInvalidInstance() { - return base::WrapUnique( - new WebServiceWorkerNetworkProviderImplForFrame(nullptr)); +std::unique_ptr<ServiceWorkerNetworkProviderForFrame> +ServiceWorkerNetworkProviderForFrame::CreateInvalidInstance() { + return base::WrapUnique(new ServiceWorkerNetworkProviderForFrame(nullptr)); } -WebServiceWorkerNetworkProviderImplForFrame:: - WebServiceWorkerNetworkProviderImplForFrame(RenderFrameImpl* frame) { +ServiceWorkerNetworkProviderForFrame::ServiceWorkerNetworkProviderForFrame( + RenderFrameImpl* frame) { if (frame) observer_ = std::make_unique<NewDocumentObserver>(this, frame); } -WebServiceWorkerNetworkProviderImplForFrame:: - ~WebServiceWorkerNetworkProviderImplForFrame() { +ServiceWorkerNetworkProviderForFrame::~ServiceWorkerNetworkProviderForFrame() { if (context()) context()->OnNetworkProviderDestroyed(); } -void WebServiceWorkerNetworkProviderImplForFrame::WillSendRequest( +void ServiceWorkerNetworkProviderForFrame::WillSendRequest( blink::WebURLRequest& request) { if (!request.GetExtraData()) request.SetExtraData(std::make_unique<RequestExtraData>()); @@ -203,22 +201,8 @@ request.SetFetchWindowId(context()->fetch_request_window_id()); } -blink::mojom::ControllerServiceWorkerMode -WebServiceWorkerNetworkProviderImplForFrame::IsControlledByServiceWorker() { - if (!context()) - return blink::mojom::ControllerServiceWorkerMode::kNoController; - return context()->IsControlledByServiceWorker(); -} - -int64_t -WebServiceWorkerNetworkProviderImplForFrame::ControllerServiceWorkerID() { - if (!context()) - return blink::mojom::kInvalidServiceWorkerVersionId; - return context()->GetControllerVersionId(); -} - std::unique_ptr<blink::WebURLLoader> -WebServiceWorkerNetworkProviderImplForFrame::CreateURLLoader( +ServiceWorkerNetworkProviderForFrame::CreateURLLoader( const blink::WebURLRequest& request, std::unique_ptr<blink::scheduler::WebResourceLoadingTaskRunnerHandle> task_runner_handle) { @@ -261,19 +245,32 @@ context()->GetSubresourceLoaderFactory())); } -void WebServiceWorkerNetworkProviderImplForFrame::DispatchNetworkQuiet() { +blink::mojom::ControllerServiceWorkerMode +ServiceWorkerNetworkProviderForFrame::IsControlledByServiceWorker() { + if (!context()) + return blink::mojom::ControllerServiceWorkerMode::kNoController; + return context()->IsControlledByServiceWorker(); +} + +int64_t ServiceWorkerNetworkProviderForFrame::ControllerServiceWorkerID() { + if (!context()) + return blink::mojom::kInvalidServiceWorkerVersionId; + return context()->GetControllerVersionId(); +} + +void ServiceWorkerNetworkProviderForFrame::DispatchNetworkQuiet() { if (!context()) return; context()->DispatchNetworkQuiet(); } -int WebServiceWorkerNetworkProviderImplForFrame::provider_id() const { +int ServiceWorkerNetworkProviderForFrame::provider_id() const { if (!context_) return kInvalidServiceWorkerProviderId; return context_->provider_id(); } -void WebServiceWorkerNetworkProviderImplForFrame::NotifyExecutionReady() { +void ServiceWorkerNetworkProviderForFrame::NotifyExecutionReady() { if (context()) context()->NotifyExecutionReady(); }
diff --git a/content/renderer/service_worker/web_service_worker_network_provider_impl_for_frame.h b/content/renderer/service_worker/service_worker_network_provider_for_frame.h similarity index 83% rename from content/renderer/service_worker/web_service_worker_network_provider_impl_for_frame.h rename to content/renderer/service_worker/service_worker_network_provider_for_frame.h index a742ee10..e4fd959 100644 --- a/content/renderer/service_worker/web_service_worker_network_provider_impl_for_frame.h +++ b/content/renderer/service_worker/service_worker_network_provider_for_frame.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 CONTENT_RENDERER_SERVICE_WORKER_WEB_SERVICE_WORKER_NETWORK_PROVIDER_IMPL_FOR_FRAME_H_ -#define CONTENT_RENDERER_SERVICE_WORKER_WEB_SERVICE_WORKER_NETWORK_PROVIDER_IMPL_FOR_FRAME_H_ +#ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_FOR_FRAME_H_ +#define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_FOR_FRAME_H_ #include <memory> @@ -19,7 +19,7 @@ class RenderFrameImpl; // The WebServiceWorkerNetworkProvider implementation used for frames. -class CONTENT_EXPORT WebServiceWorkerNetworkProviderImplForFrame final +class CONTENT_EXPORT ServiceWorkerNetworkProviderForFrame final : public blink::WebServiceWorkerNetworkProvider { public: // Creates a network provider for |frame|. @@ -41,7 +41,7 @@ // requests, and is used when we create a subresource loader for controllees. // This is non-null only if the provider is created for controllees, and if // the loading context, e.g. a frame, provides it. - static std::unique_ptr<WebServiceWorkerNetworkProviderImplForFrame> Create( + static std::unique_ptr<ServiceWorkerNetworkProviderForFrame> Create( RenderFrameImpl* frame, const CommitNavigationParams* commit_params, blink::mojom::ControllerServiceWorkerInfoPtr controller_info, @@ -49,20 +49,20 @@ // Creates an invalid instance. It has a null |context()|. // TODO(falken): Just use null instead of this. - static std::unique_ptr<WebServiceWorkerNetworkProviderImplForFrame> + static std::unique_ptr<ServiceWorkerNetworkProviderForFrame> CreateInvalidInstance(); - ~WebServiceWorkerNetworkProviderImplForFrame() override; + ~ServiceWorkerNetworkProviderForFrame() override; // Implements WebServiceWorkerNetworkProvider. void WillSendRequest(blink::WebURLRequest& request) override; - blink::mojom::ControllerServiceWorkerMode IsControlledByServiceWorker() - override; - int64_t ControllerServiceWorkerID() override; std::unique_ptr<blink::WebURLLoader> CreateURLLoader( const blink::WebURLRequest& request, std::unique_ptr<blink::scheduler::WebResourceLoadingTaskRunnerHandle> task_runner_handle) override; + blink::mojom::ControllerServiceWorkerMode IsControlledByServiceWorker() + override; + int64_t ControllerServiceWorkerID() override; void DispatchNetworkQuiet() override; int provider_id() const; @@ -71,7 +71,7 @@ private: class NewDocumentObserver; - explicit WebServiceWorkerNetworkProviderImplForFrame(RenderFrameImpl* frame); + explicit ServiceWorkerNetworkProviderForFrame(RenderFrameImpl* frame); void NotifyExecutionReady(); @@ -86,4 +86,4 @@ } // namespace content -#endif // CONTENT_RENDERER_SERVICE_WORKER_WEB_SERVICE_WORKER_NETWORK_PROVIDER_IMPL_FOR_FRAME_H_ +#endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_FOR_FRAME_H_
diff --git a/content/renderer/service_worker/service_worker_network_provider_for_service_worker.cc b/content/renderer/service_worker/service_worker_network_provider_for_service_worker.cc index c2ff0feb..f217b559 100644 --- a/content/renderer/service_worker/service_worker_network_provider_for_service_worker.cc +++ b/content/renderer/service_worker/service_worker_network_provider_for_service_worker.cc
@@ -15,6 +15,7 @@ #include "ipc/ipc_message.h" #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" #include "third_party/blink/public/common/service_worker/service_worker_utils.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom.h" #include "third_party/blink/public/platform/web_url.h" #include "third_party/blink/public/platform/web_url_request.h" @@ -81,4 +82,16 @@ return nullptr; } +blink::mojom::ControllerServiceWorkerMode +ServiceWorkerNetworkProviderForServiceWorker::IsControlledByServiceWorker() { + return blink::mojom::ControllerServiceWorkerMode::kNoController; +} + +int64_t +ServiceWorkerNetworkProviderForServiceWorker::ControllerServiceWorkerID() { + return blink::mojom::kInvalidServiceWorkerVersionId; +} + +void ServiceWorkerNetworkProviderForServiceWorker::DispatchNetworkQuiet() {} + } // namespace content
diff --git a/content/renderer/service_worker/service_worker_network_provider_for_service_worker.h b/content/renderer/service_worker/service_worker_network_provider_for_service_worker.h index 1aa9eea..6841e3c 100644 --- a/content/renderer/service_worker/service_worker_network_provider_for_service_worker.h +++ b/content/renderer/service_worker/service_worker_network_provider_for_service_worker.h
@@ -33,6 +33,10 @@ const blink::WebURLRequest& request, std::unique_ptr<blink::scheduler::WebResourceLoadingTaskRunnerHandle> task_runner_handle) override; + blink::mojom::ControllerServiceWorkerMode IsControlledByServiceWorker() + override; + int64_t ControllerServiceWorkerID() override; + void DispatchNetworkQuiet() override; network::mojom::URLLoaderFactory* script_loader_factory() { return script_loader_factory_.get();
diff --git a/content/renderer/service_worker/service_worker_provider_context.h b/content/renderer/service_worker/service_worker_provider_context.h index 8071e54..b41175e 100644 --- a/content/renderer/service_worker/service_worker_provider_context.h +++ b/content/renderer/service_worker/service_worker_provider_context.h
@@ -46,7 +46,7 @@ // ServiceWorkerProviderContext stores common state for "providers" for service // worker clients (currently WebServiceWorkerProviderImpl and -// WebServiceWorkerNetworkProviderImplFor{Frame,Worker}). Providers for the same +// ServiceWorkerNetworkProviderFor{Frame,Worker}). Providers for the same // underlying entity hold strong references to a shared instance of this class. // // ServiceWorkerProviderContext is also a
diff --git a/content/renderer/service_worker/service_worker_timeout_timer.cc b/content/renderer/service_worker/service_worker_timeout_timer.cc index fae365ce..4c3c0df 100644 --- a/content/renderer/service_worker/service_worker_timeout_timer.cc +++ b/content/renderer/service_worker/service_worker_timeout_timer.cc
@@ -63,11 +63,6 @@ : idle_callback_(std::move(idle_callback)), tick_clock_(tick_clock), weak_factory_(this) { - // |idle_callback_| will be invoked if no event happens in |kIdleDelay|. - idle_time_ = tick_clock_->NowTicks() + kIdleDelay; - timer_.Start(FROM_HERE, kUpdateInterval, - base::BindRepeating(&ServiceWorkerTimeoutTimer::UpdateStatus, - base::Unretained(this))); } ServiceWorkerTimeoutTimer::~ServiceWorkerTimeoutTimer() { @@ -76,6 +71,17 @@ std::move(event.abort_callback).Run(); } +void ServiceWorkerTimeoutTimer::Start() { + DCHECK(!timer_.IsRunning()); + DCHECK(idle_time_.is_null()); + // |idle_callback_| will be invoked if no event happens in |kIdleDelay|. + if (!HasInflightEvent()) + idle_time_ = tick_clock_->NowTicks() + kIdleDelay; + timer_.Start(FROM_HERE, kUpdateInterval, + base::BindRepeating(&ServiceWorkerTimeoutTimer::UpdateStatus, + base::Unretained(this))); +} + int ServiceWorkerTimeoutTimer::StartEvent( base::OnceCallback<void(int /* event_id */)> abort_callback) { return StartEventWithCustomTimeout(std::move(abort_callback), kEventTimeout);
diff --git a/content/renderer/service_worker/service_worker_timeout_timer.h b/content/renderer/service_worker/service_worker_timeout_timer.h index fcfefc1c..7451546 100644 --- a/content/renderer/service_worker/service_worker_timeout_timer.h +++ b/content/renderer/service_worker/service_worker_timeout_timer.h
@@ -62,6 +62,9 @@ const base::TickClock* tick_clock); ~ServiceWorkerTimeoutTimer(); + // Starts the timer. + void Start(); + // StartEvent() should be called at the beginning of an event. It returns an // event id, which is unique among threads in the same process. // The event id should be passed to EndEvent() when the event has finished.
diff --git a/content/renderer/service_worker/service_worker_timeout_timer_unittest.cc b/content/renderer/service_worker/service_worker_timeout_timer_unittest.cc index 30ae57e..38d5ebb 100644 --- a/content/renderer/service_worker/service_worker_timeout_timer_unittest.cc +++ b/content/renderer/service_worker/service_worker_timeout_timer_unittest.cc
@@ -111,6 +111,11 @@ ServiceWorkerTimeoutTimer timer(CreateReceiverWithCalledFlag(&is_idle), task_runner()->GetMockTickClock()); task_runner()->FastForwardBy(kIdleInterval); + // Nothing should happen since the timer has not started yet. + EXPECT_FALSE(is_idle); + + timer.Start(); + task_runner()->FastForwardBy(kIdleInterval); // |idle_callback| should be fired since there is no event. EXPECT_TRUE(is_idle); @@ -155,11 +160,30 @@ EXPECT_TRUE(is_idle); } +TEST_F(ServiceWorkerTimeoutTimerTest, InflightEventBeforeStart) { + EnableServicification(); + + const base::TimeDelta kIdleInterval = + ServiceWorkerTimeoutTimer::kIdleDelay + + ServiceWorkerTimeoutTimer::kUpdateInterval + + base::TimeDelta::FromSeconds(1); + + bool is_idle = false; + ServiceWorkerTimeoutTimer timer(CreateReceiverWithCalledFlag(&is_idle), + task_runner()->GetMockTickClock()); + timer.StartEvent(base::DoNothing()); + timer.Start(); + task_runner()->FastForwardBy(kIdleInterval); + // Nothing happens since there is an inflight event. + EXPECT_FALSE(is_idle); +} + TEST_F(ServiceWorkerTimeoutTimerTest, EventTimer) { EnableServicification(); ServiceWorkerTimeoutTimer timer(base::DoNothing(), task_runner()->GetMockTickClock()); + timer.Start(); MockEvent event1, event2; int event_id1 = timer.StartEvent(event1.CreateAbortCallback()); @@ -184,6 +208,7 @@ ServiceWorkerTimeoutTimer timer(base::DoNothing(), task_runner()->GetMockTickClock()); + timer.Start(); MockEvent event1, event2; int event_id1 = timer.StartEventWithCustomTimeout( event1.CreateAbortCallback(), ServiceWorkerTimeoutTimer::kUpdateInterval - @@ -212,6 +237,7 @@ bool is_idle = false; ServiceWorkerTimeoutTimer timer(CreateReceiverWithCalledFlag(&is_idle), task_runner()->GetMockTickClock()); + timer.Start(); MockEvent event; int event_id = timer.StartEvent(event.CreateAbortCallback()); @@ -233,6 +259,7 @@ { ServiceWorkerTimeoutTimer timer(base::DoNothing(), task_runner()->GetMockTickClock()); + timer.Start(); int event_id1 = timer.StartEvent(event1.CreateAbortCallback()); int event_id2 = timer.StartEvent(event2.CreateAbortCallback()); @@ -253,6 +280,7 @@ EnableServicification(); ServiceWorkerTimeoutTimer timer(base::DoNothing(), task_runner()->GetMockTickClock()); + timer.Start(); task_runner()->FastForwardBy(ServiceWorkerTimeoutTimer::kIdleDelay + ServiceWorkerTimeoutTimer::kUpdateInterval + base::TimeDelta::FromSeconds(1)); @@ -275,6 +303,7 @@ EnableServicification(); ServiceWorkerTimeoutTimer timer(base::DoNothing(), task_runner()->GetMockTickClock()); + timer.Start(); timer.SetIdleTimerDelayToZero(); EXPECT_TRUE(timer.did_idle_timeout()); @@ -300,6 +329,7 @@ bool is_idle = false; ServiceWorkerTimeoutTimer timer(CreateReceiverWithCalledFlag(&is_idle), task_runner()->GetMockTickClock()); + timer.Start(); EXPECT_FALSE(is_idle); timer.SetIdleTimerDelayToZero(); @@ -311,6 +341,7 @@ bool is_idle = false; ServiceWorkerTimeoutTimer timer(CreateReceiverWithCalledFlag(&is_idle), task_runner()->GetMockTickClock()); + timer.Start(); int event_id = timer.StartEvent(base::BindOnce([](int) {})); timer.SetIdleTimerDelayToZero(); // Nothing happens since there is an inflight event. @@ -325,6 +356,7 @@ bool is_idle = false; ServiceWorkerTimeoutTimer timer(CreateReceiverWithCalledFlag(&is_idle), task_runner()->GetMockTickClock()); + timer.Start(); int event_id_1 = timer.StartEvent(base::BindOnce([](int) {})); int event_id_2 = timer.StartEvent(base::BindOnce([](int) {})); timer.SetIdleTimerDelayToZero(); @@ -345,6 +377,7 @@ bool is_idle = false; ServiceWorkerTimeoutTimer timer(CreateReceiverWithCalledFlag(&is_idle), task_runner()->GetMockTickClock()); + timer.Start(); std::unique_ptr<StayAwakeToken> token_1 = timer.CreateStayAwakeToken(); std::unique_ptr<StayAwakeToken> token_2 = timer.CreateStayAwakeToken(); timer.SetIdleTimerDelayToZero(); @@ -372,6 +405,7 @@ base::BindRepeating([](bool* out_is_idle) { *out_is_idle = true; }, &is_idle), task_runner()->GetMockTickClock()); + timer.Start(); int event_id = timer.StartEvent(event.CreateAbortCallback()); event.set_event_id(event_id);
diff --git a/content/renderer/worker/embedded_shared_worker_stub.cc b/content/renderer/worker/embedded_shared_worker_stub.cc index b6f3e8d0..2f91ff90 100644 --- a/content/renderer/worker/embedded_shared_worker_stub.cc +++ b/content/renderer/worker/embedded_shared_worker_stub.cc
@@ -24,7 +24,7 @@ #include "content/renderer/render_thread_impl.h" #include "content/renderer/renderer_blink_platform_impl.h" #include "content/renderer/service_worker/service_worker_provider_context.h" -#include "content/renderer/worker/web_service_worker_network_provider_impl_for_worker.h" +#include "content/renderer/worker/service_worker_network_provider_for_worker.h" #include "ipc/ipc_message_macros.h" #include "services/network/public/cpp/features.h" #include "services/network/public/cpp/shared_url_loader_factory.h" @@ -259,7 +259,7 @@ // CreateWorkerFetchContext() and consumed during off-the-main-thread // shared worker script fetch. DCHECK(response_override_); - return WebServiceWorkerNetworkProviderImplForWorker::Create( + return ServiceWorkerNetworkProviderForWorker::Create( std::move(service_worker_provider_info_), std::move(main_script_loader_factory_), std::move(controller_info_), subresource_loader_factories_, IsOriginSecure(url_), @@ -280,7 +280,7 @@ } #endif // DCHECK_IS_ON() - return WebServiceWorkerNetworkProviderImplForWorker::Create( + return ServiceWorkerNetworkProviderForWorker::Create( std::move(service_worker_provider_info_), std::move(main_script_loader_factory_), std::move(controller_info_), subresource_loader_factories_, IsOriginSecure(url_), @@ -291,8 +291,7 @@ blink::WebServiceWorkerNetworkProvider* web_network_provider, base::OnceClosure callback) { ServiceWorkerProviderContext* context = - static_cast<WebServiceWorkerNetworkProviderImplForWorker*>( - web_network_provider) + static_cast<ServiceWorkerNetworkProviderForWorker*>(web_network_provider) ->context(); context->PingContainerHost(std::move(callback)); } @@ -301,9 +300,8 @@ EmbeddedSharedWorkerStub::CreateWorkerFetchContext( blink::WebServiceWorkerNetworkProvider* web_network_provider) { DCHECK(web_network_provider); - WebServiceWorkerNetworkProviderImplForWorker* network_provider = - static_cast<WebServiceWorkerNetworkProviderImplForWorker*>( - web_network_provider); + ServiceWorkerNetworkProviderForWorker* network_provider = + static_cast<ServiceWorkerNetworkProviderForWorker*>(web_network_provider); // Make the factory used for service worker network fallback (that should // skip AppCache if it is provided).
diff --git a/content/renderer/worker/web_service_worker_network_provider_impl_for_worker.cc b/content/renderer/worker/service_worker_network_provider_for_worker.cc similarity index 84% rename from content/renderer/worker/web_service_worker_network_provider_impl_for_worker.cc rename to content/renderer/worker/service_worker_network_provider_for_worker.cc index be31986..8e4fe41 100644 --- a/content/renderer/worker/web_service_worker_network_provider_impl_for_worker.cc +++ b/content/renderer/worker/service_worker_network_provider_for_worker.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 "content/renderer/worker/web_service_worker_network_provider_impl_for_worker.h" +#include "content/renderer/worker/service_worker_network_provider_for_worker.h" #include <utility> @@ -16,11 +16,12 @@ #include "services/network/public/cpp/features.h" #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" #include "third_party/blink/public/common/service_worker/service_worker_utils.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom.h" namespace content { -std::unique_ptr<WebServiceWorkerNetworkProviderImplForWorker> -WebServiceWorkerNetworkProviderImplForWorker::Create( +std::unique_ptr<ServiceWorkerNetworkProviderForWorker> +ServiceWorkerNetworkProviderForWorker::Create( blink::mojom::ServiceWorkerProviderInfoForWorkerPtr info, network::mojom::URLLoaderFactoryAssociatedPtrInfo script_loader_factory_info, @@ -28,9 +29,8 @@ scoped_refptr<network::SharedURLLoaderFactory> fallback_loader_factory, bool is_secure_context, std::unique_ptr<NavigationResponseOverrideParameters> response_override) { - auto provider = - base::WrapUnique(new WebServiceWorkerNetworkProviderImplForWorker( - is_secure_context, std::move(response_override))); + auto provider = base::WrapUnique(new ServiceWorkerNetworkProviderForWorker( + is_secure_context, std::move(response_override))); if (blink::ServiceWorkerUtils::IsServicificationEnabled()) { DCHECK(info); provider->context_ = base::MakeRefCounted<ServiceWorkerProviderContext>( @@ -79,13 +79,13 @@ return provider; } -WebServiceWorkerNetworkProviderImplForWorker:: - ~WebServiceWorkerNetworkProviderImplForWorker() { +ServiceWorkerNetworkProviderForWorker:: + ~ServiceWorkerNetworkProviderForWorker() { if (context()) context()->OnNetworkProviderDestroyed(); } -void WebServiceWorkerNetworkProviderImplForWorker::WillSendRequest( +void ServiceWorkerNetworkProviderForWorker::WillSendRequest( blink::WebURLRequest& request) { auto extra_data = std::make_unique<RequestExtraData>(); extra_data->set_service_worker_provider_id(provider_id()); @@ -97,22 +97,8 @@ request.SetExtraData(std::move(extra_data)); } -blink::mojom::ControllerServiceWorkerMode -WebServiceWorkerNetworkProviderImplForWorker::IsControlledByServiceWorker() { - if (!context()) - return blink::mojom::ControllerServiceWorkerMode::kNoController; - return context()->IsControlledByServiceWorker(); -} - -int64_t -WebServiceWorkerNetworkProviderImplForWorker::ControllerServiceWorkerID() { - if (!context()) - return blink::mojom::kInvalidServiceWorkerVersionId; - return context()->GetControllerVersionId(); -} - std::unique_ptr<blink::WebURLLoader> -WebServiceWorkerNetworkProviderImplForWorker::CreateURLLoader( +ServiceWorkerNetworkProviderForWorker::CreateURLLoader( const blink::WebURLRequest& request, std::unique_ptr<blink::scheduler::WebResourceLoadingTaskRunnerHandle> task_runner_handle) { @@ -151,16 +137,30 @@ return nullptr; } -int WebServiceWorkerNetworkProviderImplForWorker::provider_id() const { +blink::mojom::ControllerServiceWorkerMode +ServiceWorkerNetworkProviderForWorker::IsControlledByServiceWorker() { + if (!context()) + return blink::mojom::ControllerServiceWorkerMode::kNoController; + return context()->IsControlledByServiceWorker(); +} + +int64_t ServiceWorkerNetworkProviderForWorker::ControllerServiceWorkerID() { + if (!context()) + return blink::mojom::kInvalidServiceWorkerVersionId; + return context()->GetControllerVersionId(); +} + +void ServiceWorkerNetworkProviderForWorker::DispatchNetworkQuiet() {} + +int ServiceWorkerNetworkProviderForWorker::provider_id() const { if (!context_) return kInvalidServiceWorkerProviderId; return context_->provider_id(); } -WebServiceWorkerNetworkProviderImplForWorker:: - WebServiceWorkerNetworkProviderImplForWorker( - bool is_secure_context, - std::unique_ptr<NavigationResponseOverrideParameters> response_override) +ServiceWorkerNetworkProviderForWorker::ServiceWorkerNetworkProviderForWorker( + bool is_secure_context, + std::unique_ptr<NavigationResponseOverrideParameters> response_override) : is_secure_context_(is_secure_context), response_override_(std::move(response_override)) {}
diff --git a/content/renderer/worker/web_service_worker_network_provider_impl_for_worker.h b/content/renderer/worker/service_worker_network_provider_for_worker.h similarity index 86% rename from content/renderer/worker/web_service_worker_network_provider_impl_for_worker.h rename to content/renderer/worker/service_worker_network_provider_for_worker.h index b055c91..946f76c 100644 --- a/content/renderer/worker/web_service_worker_network_provider_impl_for_worker.h +++ b/content/renderer/worker/service_worker_network_provider_for_worker.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 CONTENT_RENDERER_WORKER_WEB_SERVICE_WORKER_NETWORK_PROVIDER_IMPL_FOR_WORKER_H_ -#define CONTENT_RENDERER_WORKER_WEB_SERVICE_WORKER_NETWORK_PROVIDER_IMPL_FOR_WORKER_H_ +#ifndef CONTENT_RENDERER_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_FOR_WORKER_H_ +#define CONTENT_RENDERER_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_FOR_WORKER_H_ #include <memory> @@ -23,7 +23,7 @@ // // This class is only used for the main script request from the shadow page. // Remove it when the shadow page is removed (https://crbug.com/538751). -class WebServiceWorkerNetworkProviderImplForWorker final +class ServiceWorkerNetworkProviderForWorker final : public blink::WebServiceWorkerNetworkProvider { public: // Creates a new instance. Some params might only be used in S13nServiceWorker @@ -37,7 +37,7 @@ // AppCache) // - |is_secure_context|: whether this context is secure // - |response_override|: the main script response - static std::unique_ptr<WebServiceWorkerNetworkProviderImplForWorker> Create( + static std::unique_ptr<ServiceWorkerNetworkProviderForWorker> Create( blink::mojom::ServiceWorkerProviderInfoForWorkerPtr info, network::mojom::URLLoaderFactoryAssociatedPtrInfo script_loader_factory_info, @@ -46,20 +46,21 @@ bool is_secure_context, std::unique_ptr<NavigationResponseOverrideParameters> response_override); - WebServiceWorkerNetworkProviderImplForWorker( + ServiceWorkerNetworkProviderForWorker( bool is_secure_context, std::unique_ptr<NavigationResponseOverrideParameters> response_override); - ~WebServiceWorkerNetworkProviderImplForWorker() override; + ~ServiceWorkerNetworkProviderForWorker() override; // Implements WebServiceWorkerNetworkProvider. void WillSendRequest(blink::WebURLRequest& request) override; - blink::mojom::ControllerServiceWorkerMode IsControlledByServiceWorker() - override; - int64_t ControllerServiceWorkerID() override; std::unique_ptr<blink::WebURLLoader> CreateURLLoader( const blink::WebURLRequest& request, std::unique_ptr<blink::scheduler::WebResourceLoadingTaskRunnerHandle> task_runner_handle) override; + blink::mojom::ControllerServiceWorkerMode IsControlledByServiceWorker() + override; + int64_t ControllerServiceWorkerID() override; + void DispatchNetworkQuiet() override; int provider_id() const; ServiceWorkerProviderContext* context() { return context_.get(); } @@ -81,4 +82,4 @@ } // namespace content -#endif // CONTENT_RENDERER_WORKER_WEB_SERVICE_WORKER_NETWORK_PROVIDER_IMPL_FOR_WORKER_H_ +#endif // CONTENT_RENDERER_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_FOR_WORKER_H_
diff --git a/content/shell/BUILD.gn b/content/shell/BUILD.gn index 6aa0176..1d731bd 100644 --- a/content/shell/BUILD.gn +++ b/content/shell/BUILD.gn
@@ -398,6 +398,7 @@ "//components/embedder_support/android:view", "//content/shell/android:content_shell_jni_headers", "//mojo/public/java/system:test_support", + "//ui/android", ] }
diff --git a/content/shell/browser/web_test/blink_test_controller.cc b/content/shell/browser/web_test/blink_test_controller.cc index 718be489..3df9828d 100644 --- a/content/shell/browser/web_test/blink_test_controller.cc +++ b/content/shell/browser/web_test/blink_test_controller.cc
@@ -84,6 +84,10 @@ #include "base/mac/foundation_util.h" #endif +#if defined(OS_ANDROID) +#include "ui/android/view_android.h" +#endif + namespace content { namespace { @@ -970,6 +974,17 @@ !base::ContainsKey(main_window_render_process_hosts_, process_host)) { main_window_render_process_hosts_.insert(process_host); +#if defined(OS_ANDROID) + // On Android the native view doesn't automatically know its size. This + // causes problems with Viz, where the view/renderer synchronize sizes + // frequently. Make sure the view hosting the renderer has the same size + // that we're about to send. + main_window_->web_contents()->GetNativeView()->OnSizeChanged( + initial_size_.width(), initial_size_.height()); + main_window_->web_contents()->GetNativeView()->OnPhysicalBackingSizeChanged( + initial_size_); +#endif + // Make sure the new renderer process_host has a test configuration shared // with other renderers. mojom::ShellTestConfigurationPtr params =
diff --git a/content/test/data/accessibility/aria/dpub-roles-expected-blink.txt b/content/test/data/accessibility/aria/dpub-roles-expected-blink.txt index fe29d8c..0791432 100644 --- a/content/test/data/accessibility/aria/dpub-roles-expected-blink.txt +++ b/content/test/data/accessibility/aria/dpub-roles-expected-blink.txt
@@ -1,40 +1,40 @@ rootWebArea -++docAbstractRole name='doc-abstract' -++docAcknowledgmentsRole name='doc-acknowledgments' -++docAfterwordRole name='doc-afterword' -++docAppendixRole name='doc-appendix' -++docBackLinkRole name='doc-backlink' -++docBiblioEntryRole name='doc-biblioentry' -++docBibliographyRole name='doc-bibliography' -++docBiblioRefRole name='doc-biblioref' -++docChapterRole name='doc-chapter' -++docColophonRole name='doc-colophon' -++docConclusionRole name='doc-conclusion' -++docCoverRole name='doc-cover' -++docCreditRole name='doc-credit' -++docCreditsRole name='doc-credits' -++docDedicationRole name='doc-dedication' -++docEndnoteRole name='doc-endnote' -++docEndnotesRole name='doc-endnotes' -++docEpigraphRole name='doc-epigraph' -++docEpilogueRole name='doc-epilogue' -++docErrataRole name='doc-errata' -++docExampleRole name='doc-example' -++docFootnoteRole name='doc-footnote' -++docForewordRole name='doc-foreword' -++docGlossaryRole name='doc-glossary' -++docGlossrefRole name='doc-glossref' -++docIndexRole name='doc-index' -++docIntroductionRole name='doc-introduction' -++docNoteRefRole name='doc-noteref' -++docNoticeRole name='doc-notice' -++docPageBreakRole name='doc-pagebreak' -++docPageListRole name='doc-pagelist' -++docPartRole name='doc-part' -++docPrefaceRole name='doc-preface' -++docPrologueRole name='doc-prologue' -++docPullquoteRole name='doc-pullquote' -++docQnaRole name='doc-qna' -++docSubtitleRole name='doc-subtitle' -++docTipRole name='doc-tip' -++docTocRole name='doc-toc' +++docAbstract name='doc-abstract' +++docAcknowledgments name='doc-acknowledgments' +++docAfterword name='doc-afterword' +++docAppendix name='doc-appendix' +++docBackLink name='doc-backlink' +++docBiblioEntry name='doc-biblioentry' +++docBibliography name='doc-bibliography' +++docBiblioRef name='doc-biblioref' +++docChapter name='doc-chapter' +++docColophon name='doc-colophon' +++docConclusion name='doc-conclusion' +++docCover name='doc-cover' +++docCredit name='doc-credit' +++docCredits name='doc-credits' +++docDedication name='doc-dedication' +++docEndnote name='doc-endnote' +++docEndnotes name='doc-endnotes' +++docEpigraph name='doc-epigraph' +++docEpilogue name='doc-epilogue' +++docErrata name='doc-errata' +++docExample name='doc-example' +++docFootnote name='doc-footnote' +++docForeword name='doc-foreword' +++docGlossary name='doc-glossary' +++docGlossref name='doc-glossref' +++docIndex name='doc-index' +++docIntroduction name='doc-introduction' +++docNoteRef name='doc-noteref' +++docNotice name='doc-notice' +++docPageBreak name='doc-pagebreak' +++docPageList name='doc-pagelist' +++docPart name='doc-part' +++docPreface name='doc-preface' +++docPrologue name='doc-prologue' +++docPullquote name='doc-pullquote' +++docQna name='doc-qna' +++docSubtitle name='doc-subtitle' +++docTip name='doc-tip' +++docToc name='doc-toc' \ No newline at end of file
diff --git a/content/test/data/accessibility/language-detection/lang-detection-basic-expected-blink.txt b/content/test/data/accessibility/language-detection/lang-detection-basic-expected-blink.txt new file mode 100644 index 0000000..cc35836 --- /dev/null +++ b/content/test/data/accessibility/language-detection/lang-detection-basic-expected-blink.txt
@@ -0,0 +1,5 @@ +rootWebArea language='en-US' +++genericContainer language='fr' +++++staticText language='fr' name='“The famous pipe. How people reproached me for it! And yet, could you stuff my pipe? No, it’s just a representation, is it not? So if I had written on my picture ‘This is a pipe,’ I’d have been lying!"' +++genericContainer language='en' +++++staticText language='en' name='« La fameuse pipe, me l’a-t-on assez reprochée ! Et pourtant, pouvez-vous la bourrer ma pipe ? Non, n’est-ce pas, elle n’est qu’une représentation. Donc si j’avais écrit sous mon tableau « ceci est une pipe », j’aurais menti ! »'
diff --git a/content/test/data/accessibility/language-detection/lang-detection-basic-expected-mac.txt b/content/test/data/accessibility/language-detection/lang-detection-basic-expected-mac.txt new file mode 100644 index 0000000..32d26a08 --- /dev/null +++ b/content/test/data/accessibility/language-detection/lang-detection-basic-expected-mac.txt
@@ -0,0 +1,5 @@ +AXWebArea AXLanguage='en-US' +++AXGroup AXLanguage='fr' +++++AXStaticText AXValue='“The famous pipe. How people reproached me for it! And yet, could you stuff my pipe? No, it’s just a representation, is it not? So if I had written on my picture ‘This is a pipe,’ I’d have been lying!"' +++AXGroup AXLanguage='en' +++++AXStaticText AXValue='« La fameuse pipe, me l’a-t-on assez reprochée ! Et pourtant, pouvez-vous la bourrer ma pipe ? Non, n’est-ce pas, elle n’est qu’une représentation. Donc si j’avais écrit sous mon tableau « ceci est une pipe », j’aurais menti ! »'
diff --git a/content/test/data/accessibility/language-detection/lang-detection-basic-expected-win.txt b/content/test/data/accessibility/language-detection/lang-detection-basic-expected-win.txt new file mode 100644 index 0000000..56c6608 --- /dev/null +++ b/content/test/data/accessibility/language-detection/lang-detection-basic-expected-win.txt
@@ -0,0 +1,5 @@ +ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE language:fr language:en +++IA2_ROLE_SECTION language:fr +++++ROLE_SYSTEM_STATICTEXT name='“The famous pipe. How people reproached me for it! And yet, could you stuff my pipe? No, it’s just a representation, is it not? So if I had written on my picture ‘This is a pipe,’ I’d have been lying!"' language:fr +++IA2_ROLE_SECTION language:en +++++ROLE_SYSTEM_STATICTEXT name='« La fameuse pipe, me l’a-t-on assez reprochée ! Et pourtant, pouvez-vous la bourrer ma pipe ? Non, n’est-ce pas, elle n’est qu’une représentation. Donc si j’avais écrit sous mon tableau « ceci est une pipe », j’aurais menti ! »' language:en
diff --git a/content/test/data/accessibility/language-detection/lang-detection-basic.html b/content/test/data/accessibility/language-detection/lang-detection-basic.html new file mode 100644 index 0000000..d01ecf2f --- /dev/null +++ b/content/test/data/accessibility/language-detection/lang-detection-basic.html
@@ -0,0 +1,17 @@ +<!-- +@BLINK-ALLOW:language=* +@BLINK-DENY-NODE:internalRole=inlineTextBox +@WIN-ALLOW:language:* +@MAC-ALLOW:AXLanguage* +--> +<!DOCTYPE html> +<html lang="en-GB"> +<head> + <meta charset="utf-8"> +</head> +<body> + <div lang="fr" class="magritte">“The famous pipe. How people reproached me for it! And yet, could you stuff my pipe? No, it’s just a representation, is it not? So if I had written on my picture ‘This is a pipe,’ I’d have been lying!"</div> + + <div lang="en" class="magritte">« La fameuse pipe, me l’a-t-on assez reprochée ! Et pourtant, pouvez-vous la bourrer ma pipe ? Non, n’est-ce pas, elle n’est qu’une représentation. Donc si j’avais écrit sous mon tableau « ceci est une pipe », j’aurais menti ! »</div> +</body> +</html>
diff --git a/content/test/data/accessibility/test-harness/deny-node-expected-blink.txt b/content/test/data/accessibility/test-harness/deny-node-expected-blink.txt new file mode 100644 index 0000000..07d2742 --- /dev/null +++ b/content/test/data/accessibility/test-harness/deny-node-expected-blink.txt
@@ -0,0 +1,15 @@ +rootWebArea language='en-US' +++genericContainer language='en' +++++staticText language='en' name='This is a very important form full of very important form related things to fill in, it is likely the most important form you will see within the next 100 milliseconds. You may think I am just rambling, but this is rambling with a purpose! We need enough content in this div to force splitting across multiple inlineTextBox-en which we can then ignore using *-DENY-NODE.' +++form language='en' +++++paragraph language='en' +++++++staticText language='en' name='Please provide your details:' +++++labelText language='en' +++++++staticText language='en' name='Quack:' +++++textField language='en' name='Quack:' +++++++genericContainer language='en' +++++labelText language='en' +++++++staticText language='en' name='Moo?:' +++++radioButton language='en' name='Mooooo!' checkedState=false +++++radioButton language='en' name='Mooooo?' checkedState=false +++++button language='en' name='Submit'
diff --git a/content/test/data/accessibility/test-harness/deny-node-expected-mac.txt b/content/test/data/accessibility/test-harness/deny-node-expected-mac.txt new file mode 100644 index 0000000..d59ec43 --- /dev/null +++ b/content/test/data/accessibility/test-harness/deny-node-expected-mac.txt
@@ -0,0 +1,17 @@ +AXWebArea AXLanguage='en-US' +++AXGroup AXLanguage='en' +++++AXStaticText AXValue='This is a very important form full of very important form related things to fill in, it is likely the most important form you will see within the next 100 milliseconds. You may think I am just rambling, but this is rambling with a purpose! We need enough content in this div to force splitting across multiple inlineTextBox-en which we can then ignore using *-DENY-NODE.' +++AXGroup AXLanguage='en' +++++AXGroup +++++++AXStaticText AXValue='Please provide your details:' +++++AXGroup +++++++AXStaticText AXValue='Quack:' +++++AXTextField AXTitle='Quack:' +++++AXGroup AXTitle='<newline>' +++++AXGroup +++++++AXStaticText AXValue='Moo?:' +++++AXRadioButton AXTitle='Mooooo!' AXValue='0' +++++AXRadioButton AXTitle='Mooooo?' AXValue='0' +++++AXGroup AXTitle='<newline>' +++++AXGroup AXTitle='<newline>' +++++AXButton AXTitle='Submit'
diff --git a/content/test/data/accessibility/test-harness/deny-node-expected-win.txt b/content/test/data/accessibility/test-harness/deny-node-expected-win.txt new file mode 100644 index 0000000..47b8ffe --- /dev/null +++ b/content/test/data/accessibility/test-harness/deny-node-expected-win.txt
@@ -0,0 +1,14 @@ +ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE language:en +++IA2_ROLE_SECTION language:en +++++ROLE_SYSTEM_STATICTEXT name='This is a very important form full of very important form related things to fill in, it is likely the most important form you will see within the next 100 milliseconds. You may think I am just rambling, but this is rambling with a purpose! We need enough content in this div to force splitting across multiple inlineTextBox-en which we can then ignore using *-DENY-NODE.' language:en +++IA2_ROLE_FORM language:en language:en language:en language:en language:en language:en language:en language:en +++++IA2_ROLE_PARAGRAPH language:en +++++++ROLE_SYSTEM_STATICTEXT name='Please provide your details:' language:en +++++IA2_ROLE_LABEL language:en +++++++ROLE_SYSTEM_STATICTEXT name='Quack:' language:en +++++ROLE_SYSTEM_TEXT name='Quack:' FOCUSABLE +++++IA2_ROLE_LABEL language:en +++++++ROLE_SYSTEM_STATICTEXT name='Moo?:' language:en +++++ROLE_SYSTEM_RADIOBUTTON name='Mooooo!' FOCUSABLE IA2_STATE_CHECKABLE checkable:true language:en +++++ROLE_SYSTEM_RADIOBUTTON name='Mooooo?' FOCUSABLE IA2_STATE_CHECKABLE checkable:true language:en +++++ROLE_SYSTEM_PUSHBUTTON name='Submit' FOCUSABLE language:en
diff --git a/content/test/data/accessibility/test-harness/deny-node.html b/content/test/data/accessibility/test-harness/deny-node.html new file mode 100644 index 0000000..ab325f1 --- /dev/null +++ b/content/test/data/accessibility/test-harness/deny-node.html
@@ -0,0 +1,47 @@ +<!-- + +@BLINK-ALLOW:language=* +@BLINK-DENY-NODE:internalRole=inlineTextBox +@BLINK-DENY-NODE:internalRole=checkBox +@BLINK-DENY-NODE:internalRole=lineBreak +@WIN-ALLOW:language:* +@WIN-DENY-NODE:role=ROLE_SYSTEM_CHECKBUTTON +@WIN-DENY-NODE:role=ROLE_SYSTEM_WHITESPACE +@MAC-ALLOW:AXLanguage* +@MAC-DENY-NODE:AXRole=AXCheckBox +--> +<!DOCTYPE html> +<html lang="en"> +<body> + <div> + This is a very important form full of very important form related things to + fill in, it is likely the most important form you will see within the next + 100 milliseconds. + + You may think I am just rambling, but this is rambling with a purpose! + We need enough content in this div to force splitting across multiple + inlineTextBox-en which we can then ignore using *-DENY-NODE. + </div> + + <form> + <p>Please provide your details:</p> + <label for='quack'>Quack:</label> + <input id='quack' name='quack' type='text'> + + <br /> + + <label>Moo?:</label> + <input id='mooo' name='moo' type='radio' value="Mooooo!"> + <label for='mooo'>Mooooo!</label> + <input id='moo' name='moo' type='radio' value="Mooooo?"> + <label for='moo'>Mooooo?</label> + + <br /> + <label for='unimportant'>This isn't a useful checkbox</label> + <input id='unimportant' name='unimportant' type='checkbox' value="unimportant"> + + <br /> + <button type="submit">Submit</button> + </form> +</body> +</html>
diff --git a/content/test/gpu/gpu_tests/cloud_storage_integration_test_base.py b/content/test/gpu/gpu_tests/cloud_storage_integration_test_base.py index 98531e2d..aa71200 100644 --- a/content/test/gpu/gpu_tests/cloud_storage_integration_test_base.py +++ b/content/test/gpu/gpu_tests/cloud_storage_integration_test_base.py
@@ -134,7 +134,8 @@ default='') def _CompareScreenshotSamples(self, tab, screenshot, expected_colors, - device_pixel_ratio, test_machine_name): + tolerance, device_pixel_ratio, + test_machine_name): # First scan through the expected_colors and see if there are any scale # factor overrides that would preempt the device pixel ratio. This # is mainly a workaround for complex tests like the Maps test. @@ -187,7 +188,7 @@ expectation["color"][0], expectation["color"][1], expectation["color"][2]) - if not actual_color.IsEqual(expected_color, expectation["tolerance"]): + if not actual_color.IsEqual(expected_color, tolerance): self.fail('Expected pixel at ' + str(location) + ' (actual pixel (' + str(x) + ', ' + str(y) + ')) ' + ' to be ' + @@ -384,8 +385,8 @@ 'view_test_results.html?%s for this run\'s test results') % ( error_image_cloud_storage_bucket, upload_dir) - def _ValidateScreenshotSamples(self, tab, url, - screenshot, expectations, device_pixel_ratio): + def _ValidateScreenshotSamples(self, tab, url, screenshot, expectations, + tolerance, device_pixel_ratio): """Samples the given screenshot and verifies pixel color values. The sample locations and expected color values are given in expectations. In case any of the samples do not match the expected color, it raises @@ -393,8 +394,7 @@ what machine the test is being run.""" try: self._CompareScreenshotSamples( - tab, screenshot, expectations, - device_pixel_ratio, + tab, screenshot, expectations, tolerance, device_pixel_ratio, self.GetParsedCommandLineOptions().test_machine_name) except Exception: # An exception raised from self.fail() indicates a failure. @@ -456,8 +456,8 @@ logging.error('goldctl failed with output: %s', e.output) raise Exception('goldctl command failed: ' + contents) - def _ValidateScreenshotSamplesWithSkiaGold(self, tab, page, - screenshot, expectations, + def _ValidateScreenshotSamplesWithSkiaGold(self, tab, page, screenshot, + expectations, tolerance, device_pixel_ratio, build_id_args): """Samples the given screenshot and verifies pixel color values. @@ -468,8 +468,7 @@ url = page.name try: self._CompareScreenshotSamples( - tab, screenshot, expectations, - device_pixel_ratio, + tab, screenshot, expectations, tolerance, device_pixel_ratio, self.GetParsedCommandLineOptions().test_machine_name) except Exception: # An exception raised from self.fail() indicates a failure.
diff --git a/content/test/gpu/gpu_tests/maps_integration_test.py b/content/test/gpu/gpu_tests/maps_integration_test.py index 45a40b10..dab73f6 100644 --- a/content/test/gpu/gpu_tests/maps_integration_test.py +++ b/content/test/gpu/gpu_tests/maps_integration_test.py
@@ -14,12 +14,14 @@ from py_utils import cloud_storage -maps_perf_test_path = os.path.join( +_MAPS_PERF_TEST_PATH = os.path.join( path_util.GetChromiumSrcDir(), 'tools', 'perf', 'page_sets', 'maps_perf_test') -data_path = os.path.join(path_util.GetChromiumSrcDir(), +_DATA_PATH = os.path.join(path_util.GetChromiumSrcDir(), 'content', 'test', 'gpu', 'gpu_tests') +_TOLERANCE = 3 + class MapsIntegrationTest( cloud_storage_integration_test_base.CloudStorageIntegrationTestBase): """Google Maps pixel tests. @@ -48,9 +50,9 @@ '--ensure-forced-color-profile'] cls.CustomizeBrowserArgs(browser_args) cloud_storage.GetIfChanged( - os.path.join(maps_perf_test_path, 'load_dataset'), + os.path.join(_MAPS_PERF_TEST_PATH, 'load_dataset'), cloud_storage.PUBLIC_BUCKET) - cls.SetStaticServerDirs([maps_perf_test_path]) + cls.SetStaticServerDirs([_MAPS_PERF_TEST_PATH]) cls.StartBrowser() @classmethod @@ -66,7 +68,7 @@ ('maps_pixel_expectations.json')) def _ReadPixelExpectations(self, expectations_file): - expectations_path = os.path.join(data_path, expectations_file) + expectations_path = os.path.join(_DATA_PATH, expectations_file) with open(expectations_path, 'r') as f: json_contents = json.load(f) return json_contents @@ -105,7 +107,8 @@ # the test-machine-name argument being specified on the command # line. expected = self._ReadPixelExpectations(pixel_expectations_file) - self._ValidateScreenshotSamples(tab, url, screenshot, expected, dpr) + self._ValidateScreenshotSamples( + tab, url, screenshot, expected, _TOLERANCE, dpr) def load_tests(loader, tests, pattern): del loader, tests, pattern # Unused.
diff --git a/content/test/gpu/gpu_tests/maps_pixel_expectations.json b/content/test/gpu/gpu_tests/maps_pixel_expectations.json index 396ff95..3da439c 100644 --- a/content/test/gpu/gpu_tests/maps_pixel_expectations.json +++ b/content/test/gpu/gpu_tests/maps_pixel_expectations.json
@@ -33,35 +33,30 @@ "comment": "light green", "location": [ 43, 247 ], "size": [ 1, 1 ], - "color": [ 214, 232, 186 ], - "tolerance": 3 + "color": [ 214, 232, 186 ] }, { "comment": "darker green", "location": [ 326, 111 ], "size": [ 1, 1 ], - "color": [ 203, 230, 163 ], - "tolerance": 3 + "color": [ 203, 230, 163 ] }, { "comment": "blue lake", "location": [ 593, 393 ], "size": [ 1, 1 ], - "color": [ 163, 205, 255 ], - "tolerance": 3 + "color": [ 163, 205, 255 ] }, { "comment": "gray", "location": [ 95, 117 ], "size": [ 1, 1 ], - "color": [ 232, 232, 232 ], - "tolerance": 3 + "color": [ 232, 232, 232 ] }, { "comment": "tan", "location": [ 344, 263 ], "size": [ 1, 1 ], - "color": [ 240, 237, 230 ], - "tolerance": 3 + "color": [ 240, 237, 230 ] } ]
diff --git a/content/test/gpu/gpu_tests/pixel_integration_test.py b/content/test/gpu/gpu_tests/pixel_integration_test.py index 2505cf7..45a204ce 100644 --- a/content/test/gpu/gpu_tests/pixel_integration_test.py +++ b/content/test/gpu/gpu_tests/pixel_integration_test.py
@@ -165,7 +165,8 @@ if page.expected_colors: # Use expected colors instead of ref images for validation. self._ValidateScreenshotSamples( - tab, page.name, screenshot, page.expected_colors, dpr) + tab, page.name, screenshot, page.expected_colors, page.tolerance, + dpr) return image_name = self._UrlToImageName(page.name) if self.GetParsedCommandLineOptions().upload_refimg_to_cloud_storage: @@ -256,7 +257,8 @@ if page.expected_colors: # Use expected colors instead of ref images for validation. self._ValidateScreenshotSamplesWithSkiaGold( - tab, page, screenshot, page.expected_colors, dpr, build_id_args) + tab, page, screenshot, page.expected_colors, page.tolerance, + dpr, build_id_args) return image_name = self._UrlToImageName(page.name) is_local_run = not (parsed_options.upload_refimg_to_cloud_storage or
diff --git a/content/test/gpu/gpu_tests/pixel_test_pages.py b/content/test/gpu/gpu_tests/pixel_test_pages.py index 4f5e41b1..0d0215b 100644 --- a/content/test/gpu/gpu_tests/pixel_test_pages.py +++ b/content/test/gpu/gpu_tests/pixel_test_pages.py
@@ -4,6 +4,34 @@ import sys +_FOUR_COLOR_VIDEO_240x135_EXPECTED_COLORS = [ + { + 'comment': 'top left video, yellow', + 'location': [5, 5], + 'size': [110, 57], + 'color': [255, 255, 15], + }, + { + 'comment': 'top right video, red', + 'location': [125, 5], + 'size': [110, 57], + 'color': [255, 17, 24], + }, + { + 'comment': 'bottom left video, blue', + 'location': [5, 72], + 'size': [110, 57], + 'color': [12, 12, 255], + }, + { + 'comment': 'bottom right video, green', + 'location': [125, 72], + 'size': [110, 57], + 'color': [44, 255, 16], + } +] + + class PixelTestPage(object): """A wrapper class mimicking the functionality of the PixelTestsStorySet from the old-style GPU tests. @@ -173,27 +201,25 @@ base_name + '_ScissorTestWithPreserveDrawingBuffer', test_rect=[0, 0, 300, 300], revision=0, # Golden image revision is not used + tolerance=3, expected_colors=[ { 'comment': 'red top', 'location': [1, 1], 'size': [198, 188], 'color': [255, 0, 0], - 'tolerance': 3 }, { 'comment': 'green bottom left', 'location': [1, 191], 'size': [8, 8], 'color': [0, 255, 0], - 'tolerance': 3 }, { 'comment': 'red bottom right', 'location': [11, 191], 'size': [188, 8], 'color': [255, 0, 0], - 'tolerance': 3 } ]), @@ -214,36 +240,8 @@ base_name + '_Video_MP4', test_rect=[0, 0, 240, 135], revision=0, # Golden image revision is not used - expected_colors=[ - { - 'comment': 'top left video, yellow', - 'location': [5, 5], - 'size': [110, 57], - 'color': [255, 255, 15], - 'tolerance': tolerance - }, - { - 'comment': 'top right video, red', - 'location': [125, 5], - 'size': [110, 57], - 'color': [255, 17, 24], - 'tolerance': tolerance - }, - { - 'comment': 'bottom left video, blue', - 'location': [5, 72], - 'size': [110, 57], - 'color': [12, 12, 255], - 'tolerance': tolerance - }, - { - 'comment': 'bottom right video, green', - 'location': [125, 72], - 'size': [110, 57], - 'color': [44, 255, 16], - 'tolerance': tolerance - } - ]), + tolerance=tolerance, + expected_colors=_FOUR_COLOR_VIDEO_240x135_EXPECTED_COLORS), PixelTestPage( 'pixel_video_mp4.html', @@ -251,84 +249,51 @@ browser_args=['--disable-features=D3D11VideoDecoder'], test_rect=[0, 0, 240, 135], revision=0, # Golden image revision is not used - expected_colors=[ - { - 'comment': 'top left video, yellow', - 'location': [5, 5], - 'size': [110, 57], - 'color': [255, 255, 15], - 'tolerance': tolerance - }, - { - 'comment': 'top right video, red', - 'location': [125, 5], - 'size': [110, 57], - 'color': [255, 17, 24], - 'tolerance': tolerance - }, - { - 'comment': 'bottom left video, blue', - 'location': [5, 72], - 'size': [110, 57], - 'color': [12, 12, 255], - 'tolerance': tolerance - }, - { - 'comment': 'bottom right video, green', - 'location': [125, 72], - 'size': [110, 57], - 'color': [44, 255, 16], - 'tolerance': tolerance - } - ]), + tolerance=tolerance, + expected_colors=_FOUR_COLOR_VIDEO_240x135_EXPECTED_COLORS), PixelTestPage( 'pixel_video_mp4_four_colors_aspect_4x3.html', base_name + '_Video_MP4_FourColors_Aspect_4x3', test_rect=[0, 0, 240, 135], revision=0, # Golden image revision is not used + tolerance=tolerance, expected_colors=[ { 'comment': 'outside video content, left side, white', 'location': [1, 1], 'size': [28, 133], 'color': [255, 255, 255], - 'tolerance': tolerance }, { 'comment': 'outside video content, right side, white', 'location': [211, 1], 'size': [28, 133], 'color': [255, 255, 255], - 'tolerance': tolerance }, { 'comment': 'top left video, yellow', 'location': [35, 5], 'size': [80, 57], 'color': [255, 255, 15], - 'tolerance': tolerance }, { 'comment': 'top right video, red', 'location': [125, 5], 'size': [80, 57], 'color': [255, 17, 24], - 'tolerance': tolerance }, { 'comment': 'bottom left video, blue', 'location': [35, 73], 'size': [80, 57], 'color': [12, 12, 255], - 'tolerance': tolerance }, { 'comment': 'bottom right video, green', 'location': [125, 73], 'size': [80, 57], 'color': [44, 255, 16], - 'tolerance': tolerance } ]), @@ -337,48 +302,43 @@ base_name + '_Video_MP4_FourColors_Rot_90', test_rect=[0, 0, 427, 240], revision=0, # Golden image revision is not used + tolerance=tolerance, expected_colors=[ { 'comment': 'outside video content, left side, white', 'location': [1, 1], 'size': [144, 238], 'color': [255, 255, 255], - 'tolerance': tolerance }, { 'comment': 'outside video content, right side, white', 'location': [282, 1], 'size': [144, 238], 'color': [255, 255, 255], - 'tolerance': tolerance }, { 'comment': 'top left video, red', 'location': [152, 5], 'size': [55, 110], 'color': [255, 17, 24], - 'tolerance': tolerance }, { 'comment': 'top right video, green', 'location': [220, 5], 'size': [55, 110], 'color': [44, 255, 16], - 'tolerance': tolerance }, { 'comment': 'bottom left video, yellow', 'location': [152, 125], 'size': [55, 110], 'color': [255, 255, 15], - 'tolerance': tolerance }, { 'comment': 'bottom right video, blue', 'location': [220, 125], 'size': [55, 110], 'color': [12, 12, 255], - 'tolerance': tolerance } ]), @@ -387,34 +347,31 @@ base_name + '_Video_MP4_FourColors_Rot_180', test_rect=[0, 0, 240, 135], revision=0, # Golden image revision is not used + tolerance=tolerance, expected_colors=[ { 'comment': 'top left video, green', 'location': [5, 5], 'size': [110, 57], 'color': [44, 255, 16], - 'tolerance': tolerance }, { 'comment': 'top right video, blue', 'location': [125, 5], 'size': [110, 57], 'color': [12, 12, 255], - 'tolerance': tolerance }, { 'comment': 'bottom left video, red', 'location': [5, 72], 'size': [110, 57], 'color': [255, 17, 24], - 'tolerance': tolerance }, { 'comment': 'bottom right video, yellow', 'location': [125, 72], 'size': [110, 57], 'color': [255, 255, 15], - 'tolerance': tolerance } ]), @@ -423,48 +380,43 @@ base_name + '_Video_MP4_FourColors_Rot_270', test_rect=[0, 0, 427, 240], revision=0, # Golden image revision is not used + tolerance=tolerance, expected_colors=[ { 'comment': 'outside video content, left side, white', 'location': [1, 1], 'size': [144, 238], 'color': [255, 255, 255], - 'tolerance': tolerance }, { 'comment': 'outside video content, right side, white', 'location': [282, 1], 'size': [144, 238], 'color': [255, 255, 255], - 'tolerance': tolerance }, { 'comment': 'top left video, blue', 'location': [152, 5], 'size': [55, 110], 'color': [12, 12, 255], - 'tolerance': tolerance }, { 'comment': 'top right video, yellow', 'location': [220, 5], 'size': [55, 110], 'color': [255, 255, 15], - 'tolerance': tolerance }, { 'comment': 'bottom left video, green', 'location': [152, 125], 'size': [55, 110], 'color': [44, 255, 16], - 'tolerance': tolerance }, { 'comment': 'bottom right video, red', 'location': [220, 125], 'size': [55, 110], 'color': [255, 17, 24], - 'tolerance': tolerance } ]), @@ -473,36 +425,8 @@ base_name + '_Video_VP9', test_rect=[0, 0, 240, 135], revision=0, # Golden image revision is not used - expected_colors=[ - { - 'comment': 'top left video, yellow', - 'location': [5, 5], - 'size': [110, 57], - 'color': [255, 255, 15], - 'tolerance': tolerance_vp9 - }, - { - 'comment': 'top right video, red', - 'location': [125, 5], - 'size': [110, 57], - 'color': [255, 17, 24], - 'tolerance': tolerance_vp9 - }, - { - 'comment': 'bottom left video, blue', - 'location': [5, 72], - 'size': [110, 57], - 'color': [12, 12, 255], - 'tolerance': tolerance_vp9 - }, - { - 'comment': 'bottom right video, green', - 'location': [125, 72], - 'size': [110, 57], - 'color': [44, 255, 16], - 'tolerance': tolerance_vp9 - } - ]), + tolerance=tolerance_vp9, + expected_colors=_FOUR_COLOR_VIDEO_240x135_EXPECTED_COLORS), PixelTestPage( 'pixel_video_vp9.html', @@ -510,36 +434,8 @@ browser_args=['--disable-features=D3D11VideoDecoder'], test_rect=[0, 0, 240, 135], revision=0, # Golden image revision is not used - expected_colors=[ - { - 'comment': 'top left video, yellow', - 'location': [5, 5], - 'size': [110, 57], - 'color': [255, 255, 15], - 'tolerance': tolerance_vp9 - }, - { - 'comment': 'top right video, red', - 'location': [125, 5], - 'size': [110, 57], - 'color': [255, 17, 24], - 'tolerance': tolerance_vp9 - }, - { - 'comment': 'bottom left video, blue', - 'location': [5, 72], - 'size': [110, 57], - 'color': [12, 12, 255], - 'tolerance': tolerance_vp9 - }, - { - 'comment': 'bottom right video, green', - 'location': [125, 72], - 'size': [110, 57], - 'color': [44, 255, 16], - 'tolerance': tolerance_vp9 - } - ]), + tolerance=tolerance_vp9, + expected_colors=_FOUR_COLOR_VIDEO_240x135_EXPECTED_COLORS), # The MP4 contains H.264 which is primarily hardware decoded on bots. PixelTestPage( @@ -547,36 +443,8 @@ base_name + '_Video_Context_Loss_MP4', test_rect=[0, 0, 240, 135], revision=0, # Golden image revision is not used - expected_colors=[ - { - 'comment': 'top left video, yellow', - 'location': [5, 5], - 'size': [110, 57], - 'color': [255, 255, 15], - 'tolerance': tolerance - }, - { - 'comment': 'top right video, red', - 'location': [125, 5], - 'size': [110, 57], - 'color': [255, 17, 24], - 'tolerance': tolerance - }, - { - 'comment': 'bottom left video, blue', - 'location': [5, 72], - 'size': [110, 57], - 'color': [12, 12, 255], - 'tolerance': tolerance - }, - { - 'comment': 'bottom right video, green', - 'location': [125, 72], - 'size': [110, 57], - 'color': [44, 255, 16], - 'tolerance': tolerance - } - ]), + tolerance=tolerance, + expected_colors=_FOUR_COLOR_VIDEO_240x135_EXPECTED_COLORS), # The VP9 test clip is primarily software decoded on bots. PixelTestPage( @@ -584,42 +452,15 @@ base_name + '_Video_Context_Loss_VP9', test_rect=[0, 0, 240, 135], revision=0, # Golden image revision is not used - expected_colors=[ - { - 'comment': 'top left video, yellow', - 'location': [5, 5], - 'size': [110, 57], - 'color': [255, 255, 15], - 'tolerance': tolerance_vp9 - }, - { - 'comment': 'top right video, red', - 'location': [125, 5], - 'size': [110, 57], - 'color': [255, 17, 24], - 'tolerance': tolerance_vp9 - }, - { - 'comment': 'bottom left video, blue', - 'location': [5, 72], - 'size': [110, 57], - 'color': [12, 12, 255], - 'tolerance': tolerance_vp9 - }, - { - 'comment': 'bottom right video, green', - 'location': [125, 72], - 'size': [110, 57], - 'color': [44, 255, 16], - 'tolerance': tolerance_vp9 - } - ]), + tolerance=tolerance_vp9, + expected_colors=_FOUR_COLOR_VIDEO_240x135_EXPECTED_COLORS), PixelTestPage( 'pixel_webgl_premultiplied_alpha_false.html', base_name + '_WebGL_PremultipliedAlpha_False', test_rect=[0, 0, 150, 150], revision=0, # Golden image revision is not used + tolerance=3, expected_colors=[ SCALE_FACTOR_OVERRIDES, { @@ -631,7 +472,6 @@ 'color': [102, 77, 0], # This is the color if it isn't. # 'color': [101, 76, 12], - 'tolerance': 3 }, ]), @@ -640,6 +480,7 @@ base_name + '_WebGL2_BlitFramebuffer_Result_Displayed', test_rect=[0, 0, 200, 200], revision=0, # Golden image revision is not used + tolerance=3, expected_colors=[ SCALE_FACTOR_OVERRIDES, { @@ -647,7 +488,6 @@ 'location': [1, 1], 'size': [180, 180], 'color': [0, 255, 0], - 'tolerance': 3 }, ]), @@ -656,6 +496,7 @@ base_name + '_WebGL2_ClearBufferfv_Result_Displayed', test_rect=[0, 0, 200, 200], revision=0, # Golden image revision is not used + tolerance=3, expected_colors=[ SCALE_FACTOR_OVERRIDES, { @@ -663,7 +504,6 @@ 'location': [1, 1], 'size': [180, 180], 'color': [0, 255, 0], - 'tolerance': 3 }, ]), @@ -672,6 +512,7 @@ base_name + '_RepeatedWebGLTo2D', test_rect=[0, 0, 256, 256], revision=0, # Golden image revision is not used + tolerance=3, expected_colors=[ SCALE_FACTOR_OVERRIDES, { @@ -680,7 +521,6 @@ 'location': [96, 96], 'size': [64, 64], 'color': [0, 255, 0], - 'tolerance': 3, }, ]), @@ -690,6 +530,7 @@ test_rect=[0, 0, 256, 256], revision=0, # Golden image revision is not used browser_args=sw_compositing_args, + tolerance=3, expected_colors=[ SCALE_FACTOR_OVERRIDES, { @@ -698,7 +539,6 @@ 'location': [96, 96], 'size': [64, 64], 'color': [0, 255, 0], - 'tolerance': 3 }, ]), ] @@ -714,90 +554,79 @@ test_rect=[0, 0, 220, 220], revision=0, # Golden image revision is not used browser_args=browser_args, + tolerance=0, expected_colors=[ { 'comment': 'body-t', 'location': [5, 5], 'size': [1, 1], 'color': [0, 128, 0], - 'tolerance': 0 }, { 'comment': 'body-r', 'location': [215, 5], 'size': [1, 1], 'color': [0, 128, 0], - 'tolerance': 0 }, { 'comment': 'body-b', 'location': [215, 215], 'size': [1, 1], 'color': [0, 128, 0], - 'tolerance': 0 }, { 'comment': 'body-l', 'location': [5, 215], 'size': [1, 1], 'color': [0, 128, 0], - 'tolerance': 0 }, { 'comment': 'background-t', 'location': [30, 30], 'size': [1, 1], 'color': [0, 0, 0], - 'tolerance': 0 }, { 'comment': 'background-r', 'location': [170, 30], 'size': [1, 1], 'color': [0, 0, 0], - 'tolerance': 0 }, { 'comment': 'background-b', 'location': [170, 170], 'size': [1, 1], 'color': [0, 0, 0], - 'tolerance': 0 }, { 'comment': 'background-l', 'location': [30, 170], 'size': [1, 1], 'color': [0, 0, 0], - 'tolerance': 0 }, { 'comment': 'box-t', 'location': [70, 70], 'size': [1, 1], 'color': [0, 0, 255], - 'tolerance': 0 }, { 'comment': 'box-r', 'location': [140, 70], 'size': [1, 1], 'color': [0, 0, 255], - 'tolerance': 0 }, { 'comment': 'box-b', 'location': [140, 140], 'size': [1, 1], 'color': [0, 0, 255], - 'tolerance': 0 }, { 'comment': 'box-l', 'location': [70, 140], 'size': [1, 1], 'color': [0, 0, 255], - 'tolerance': 0 } ]), PixelTestPage( @@ -806,34 +635,31 @@ test_rect=[0, 0, 100, 100], revision=0, # Golden image revision is not used browser_args=browser_args, + tolerance=0, expected_colors=[ { 'comment': 'outside', 'location': [80, 60], 'size': [1, 1], 'color': [255, 255, 255], - 'tolerance': 0 }, { 'comment': 'outside', 'location': [28, 20], 'size': [1, 1], 'color': [255, 255, 255], - 'tolerance': 0 }, { 'comment': 'inside', 'location': [32, 25], 'size': [1, 1], 'color': [255, 215, 0], - 'tolerance': 0 }, { 'comment': 'inside', 'location': [80, 80], 'size': [1, 1], 'color': [255, 215, 0], - 'tolerance': 0 } ]) ] @@ -867,6 +693,7 @@ test_rect=[0, 0, 200, 200], browser_args=browser_args, revision=0, # Golden image revision is not used + tolerance=0, expected_colors=[ SCALE_FACTOR_OVERRIDES, { @@ -874,14 +701,12 @@ 'location': [1, 1], 'size': [48, 98], 'color': [0, 255, 0], - 'tolerance': 0 }, { 'comment': 'outside resized area', 'location': [51, 1], 'size': [48, 98], 'color': [255, 255, 255], - 'tolerance': 0 }, ]), @@ -1024,6 +849,7 @@ test_rect=[0, 0, 200, 200], revision=0, # not used browser_args=browser_args, + tolerance=0, expected_colors=[ SCALE_FACTOR_OVERRIDES, { @@ -1031,7 +857,6 @@ 'location': [1, 1], 'size': [98, 98], 'color': [0, 255, 0], - 'tolerance': 0 }, ]), ] @@ -1069,6 +894,7 @@ test_rect=[0, 0, 256, 256], revision=0, # Golden image revision is not used browser_args=browser_args, + tolerance=3, expected_colors=[ SCALE_FACTOR_OVERRIDES, { @@ -1077,7 +903,6 @@ 'location': [96, 96], 'size': [64, 64], 'color': [0, 255, 0], - 'tolerance': 3 }, ]), ] @@ -1179,6 +1004,7 @@ test_rect=[0, 0, 150, 150], revision=0, # Golden image revision is not used browser_args=no_overlays_args, + tolerance=3, expected_colors=[ SCALE_FACTOR_OVERRIDES, { @@ -1190,7 +1016,6 @@ 'color': [102, 77, 0], # This is the color if it isn't. # 'color': [101, 76, 12], - 'tolerance': 3 }, ]), ] @@ -1214,7 +1039,7 @@ '--enable-features=DirectCompositionUnderlays', '--disable-features=D3D11VideoDecoder'] - tolerance_dc = 3 + tolerance_dc = 5 return [ PixelTestPage( @@ -1223,36 +1048,8 @@ test_rect=[0, 0, 240, 135], revision=0, # Golden image revision is not used browser_args=browser_args, - expected_colors=[ - { - 'comment': 'top left video, yellow', - 'location': [5, 5], - 'size': [110, 57], - 'color': [255, 255, 15], - 'tolerance': tolerance_dc - }, - { - 'comment': 'top right video, red', - 'location': [125, 5], - 'size': [110, 57], - 'color': [255, 17, 24], - 'tolerance': tolerance_dc - }, - { - 'comment': 'bottom left video, blue', - 'location': [5, 72], - 'size': [110, 57], - 'color': [12, 12, 255], - 'tolerance': tolerance_dc - }, - { - 'comment': 'bottom right video, green', - 'location': [125, 72], - 'size': [110, 57], - 'color': [44, 255, 16], - 'tolerance': tolerance_dc - } - ]), + tolerance=tolerance_dc, + expected_colors=_FOUR_COLOR_VIDEO_240x135_EXPECTED_COLORS), PixelTestPage( 'pixel_video_mp4.html', @@ -1260,36 +1057,8 @@ browser_args=browser_args_DXVA, test_rect=[0, 0, 240, 135], revision=0, # Golden image revision is not used - expected_colors=[ - { - 'comment': 'top left video, yellow', - 'location': [5, 5], - 'size': [110, 57], - 'color': [255, 255, 15], - 'tolerance': tolerance_dc - }, - { - 'comment': 'top right video, red', - 'location': [125, 5], - 'size': [110, 57], - 'color': [255, 17, 24], - 'tolerance': tolerance_dc - }, - { - 'comment': 'bottom left video, blue', - 'location': [5, 72], - 'size': [110, 57], - 'color': [12, 12, 255], - 'tolerance': tolerance_dc - }, - { - 'comment': 'bottom right video, green', - 'location': [125, 72], - 'size': [110, 57], - 'color': [44, 255, 16], - 'tolerance': tolerance_dc - } - ]), + tolerance=tolerance_dc, + expected_colors=_FOUR_COLOR_VIDEO_240x135_EXPECTED_COLORS), PixelTestPage( 'pixel_video_mp4_fullsize.html', @@ -1298,34 +1067,31 @@ test_rect=[0, 0, 960, 540], revision=0, # Golden image revision is not used other_args={'zero_copy': True}, + tolerance=tolerance_dc, expected_colors=[ { 'comment': 'top left video, yellow', 'location': [10, 10], 'size': [460, 250], 'color': [255, 255, 15], - 'tolerance': tolerance_dc }, { 'comment': 'top right video, red', 'location': [490, 10], 'size': [460, 250], 'color': [255, 17, 24], - 'tolerance': tolerance_dc }, { 'comment': 'bottom left video, blue', 'location': [10, 280], 'size': [460, 250], 'color': [12, 12, 255], - 'tolerance': tolerance_dc }, { 'comment': 'bottom right video, green', 'location': [490, 280], 'size': [460, 250], 'color': [44, 255, 16], - 'tolerance': tolerance_dc } ]), @@ -1336,36 +1102,8 @@ revision=0, # Golden image revision is not used browser_args=browser_args_YUY2, other_args={'expect_yuy2': True}, - expected_colors=[ - { - 'comment': 'top left video, yellow', - 'location': [5, 5], - 'size': [110, 57], - 'color': [255, 255, 15], - 'tolerance': tolerance_dc - }, - { - 'comment': 'top right video, red', - 'location': [125, 5], - 'size': [110, 57], - 'color': [255, 17, 24], - 'tolerance': tolerance_dc - }, - { - 'comment': 'bottom left video, blue', - 'location': [5, 72], - 'size': [110, 57], - 'color': [12, 12, 255], - 'tolerance': tolerance_dc - }, - { - 'comment': 'bottom right video, green', - 'location': [125, 72], - 'size': [110, 57], - 'color': [44, 255, 16], - 'tolerance': tolerance_dc - } - ]), + tolerance=tolerance_dc, + expected_colors=_FOUR_COLOR_VIDEO_240x135_EXPECTED_COLORS), PixelTestPage( 'pixel_video_mp4_four_colors_aspect_4x3.html', @@ -1373,48 +1111,43 @@ test_rect=[0, 0, 240, 135], revision=0, # Golden image revision is not used browser_args=browser_args, + tolerance=tolerance_dc, expected_colors=[ { 'comment': 'outside video content, left side, white', 'location': [1, 1], 'size': [28, 133], 'color': [255, 255, 255], - 'tolerance': tolerance_dc }, { 'comment': 'outside video content, right side, white', 'location': [211, 1], 'size': [28, 133], 'color': [255, 255, 255], - 'tolerance': tolerance_dc }, { 'comment': 'top left video, yellow', 'location': [35, 5], 'size': [80, 57], 'color': [255, 255, 15], - 'tolerance': tolerance_dc }, { 'comment': 'top right video, red', 'location': [125, 5], 'size': [80, 57], 'color': [255, 17, 24], - 'tolerance': tolerance_dc }, { 'comment': 'bottom left video, blue', 'location': [35, 73], 'size': [80, 57], 'color': [12, 12, 255], - 'tolerance': tolerance_dc }, { 'comment': 'bottom right video, green', 'location': [125, 73], 'size': [80, 57], 'color': [44, 255, 16], - 'tolerance': tolerance_dc } ]), @@ -1425,48 +1158,43 @@ revision=0, # Golden image revision is not used browser_args=browser_args, other_args={'video_is_rotated': True}, + tolerance=tolerance_dc, expected_colors=[ { 'comment': 'outside video content, left side, white', 'location': [1, 1], 'size': [144, 238], 'color': [255, 255, 255], - 'tolerance': tolerance_dc }, { 'comment': 'outside video content, right side, white', 'location': [282, 1], 'size': [144, 238], 'color': [255, 255, 255], - 'tolerance': tolerance_dc }, { 'comment': 'top left video, red', 'location': [152, 5], 'size': [55, 110], 'color': [255, 17, 24], - 'tolerance': tolerance_dc }, { 'comment': 'top right video, green', 'location': [220, 5], 'size': [55, 110], 'color': [44, 255, 16], - 'tolerance': tolerance_dc }, { 'comment': 'bottom left video, yellow', 'location': [152, 125], 'size': [55, 110], 'color': [255, 255, 15], - 'tolerance': tolerance_dc }, { 'comment': 'bottom right video, blue', 'location': [220, 125], 'size': [55, 110], 'color': [12, 12, 255], - 'tolerance': tolerance_dc }]), PixelTestPage( @@ -1476,34 +1204,31 @@ revision=0, # Golden image revision is not used browser_args=browser_args, other_args={'video_is_rotated': True}, + tolerance=tolerance_dc, expected_colors=[ { 'comment': 'top left video, green', 'location': [5, 5], 'size': [110, 57], 'color': [44, 255, 16], - 'tolerance': tolerance_dc }, { 'comment': 'top right video, blue', 'location': [125, 5], 'size': [110, 57], 'color': [12, 12, 255], - 'tolerance': tolerance_dc }, { 'comment': 'bottom left video, red', 'location': [5, 72], 'size': [110, 57], 'color': [255, 17, 24], - 'tolerance': tolerance_dc }, { 'comment': 'bottom right video, yellow', 'location': [125, 72], 'size': [110, 57], 'color': [255, 255, 15], - 'tolerance': tolerance_dc }]), PixelTestPage( @@ -1513,48 +1238,43 @@ revision=0, # Golden image revision is not used browser_args=browser_args, other_args={'video_is_rotated': True}, + tolerance=tolerance_dc, expected_colors=[ { 'comment': 'outside video content, left side, white', 'location': [1, 1], 'size': [144, 238], 'color': [255, 255, 255], - 'tolerance': tolerance_dc }, { 'comment': 'outside video content, right side, white', 'location': [282, 1], 'size': [144, 238], 'color': [255, 255, 255], - 'tolerance': tolerance_dc }, { 'comment': 'top left video, blue', 'location': [152, 5], 'size': [55, 110], 'color': [12, 12, 255], - 'tolerance': tolerance_dc }, { 'comment': 'top right video, yellow', 'location': [220, 5], 'size': [55, 110], 'color': [255, 255, 15], - 'tolerance': tolerance_dc }, { 'comment': 'bottom left video, green', 'location': [152, 125], 'size': [55, 110], 'color': [44, 255, 16], - 'tolerance': tolerance_dc }, { 'comment': 'bottom right video, red', 'location': [220, 125], 'size': [55, 110], 'color': [255, 17, 24], - 'tolerance': tolerance_dc }]), PixelTestPage( @@ -1563,36 +1283,8 @@ test_rect=[0, 0, 240, 135], revision=0, # Golden image revision is not used browser_args=browser_args, - expected_colors=[ - { - 'comment': 'top left video, yellow', - 'location': [5, 5], - 'size': [110, 57], - 'color': [255, 255, 15], - 'tolerance': tolerance_dc - }, - { - 'comment': 'top right video, red', - 'location': [125, 5], - 'size': [110, 57], - 'color': [255, 17, 24], - 'tolerance': tolerance_dc - }, - { - 'comment': 'bottom left video, blue', - 'location': [5, 72], - 'size': [110, 57], - 'color': [12, 12, 255], - 'tolerance': tolerance_dc - }, - { - 'comment': 'bottom right video, green', - 'location': [125, 72], - 'size': [110, 57], - 'color': [44, 255, 16], - 'tolerance': tolerance_dc - } - ]), + tolerance=tolerance_dc, + expected_colors=_FOUR_COLOR_VIDEO_240x135_EXPECTED_COLORS), PixelTestPage( 'pixel_video_vp9.html', @@ -1600,36 +1292,8 @@ browser_args=browser_args_DXVA, test_rect=[0, 0, 240, 135], revision=0, # Golden image revision is not used - expected_colors=[ - { - 'comment': 'top left video, yellow', - 'location': [5, 5], - 'size': [110, 57], - 'color': [255, 255, 15], - 'tolerance': tolerance_dc - }, - { - 'comment': 'top right video, red', - 'location': [125, 5], - 'size': [110, 57], - 'color': [255, 17, 24], - 'tolerance': tolerance_dc - }, - { - 'comment': 'bottom left video, blue', - 'location': [5, 72], - 'size': [110, 57], - 'color': [12, 12, 255], - 'tolerance': tolerance_dc - }, - { - 'comment': 'bottom right video, green', - 'location': [125, 72], - 'size': [110, 57], - 'color': [44, 255, 16], - 'tolerance': tolerance_dc - } - ]), + tolerance=tolerance_dc, + expected_colors=_FOUR_COLOR_VIDEO_240x135_EXPECTED_COLORS), PixelTestPage( 'pixel_video_vp9_fullsize.html', @@ -1638,34 +1302,31 @@ revision=0, # Golden image revision is not used browser_args=browser_args, other_args={'zero_copy': True}, + tolerance=tolerance_dc, expected_colors=[ { 'comment': 'top left video, yellow', 'location': [10, 10], 'size': [460, 250], 'color': [255, 255, 15], - 'tolerance': tolerance_dc }, { 'comment': 'top right video, red', 'location': [490, 10], 'size': [460, 250], 'color': [255, 17, 24], - 'tolerance': tolerance_dc }, { 'comment': 'bottom left video, blue', 'location': [10, 280], 'size': [460, 250], 'color': [12, 12, 255], - 'tolerance': tolerance_dc }, { 'comment': 'bottom right video, green', 'location': [490, 280], 'size': [460, 250], 'color': [44, 255, 16], - 'tolerance': tolerance_dc } ]), @@ -1676,36 +1337,8 @@ revision=0, # Golden image revision is not used browser_args=browser_args_YUY2, other_args={'expect_yuy2': True}, - expected_colors=[ - { - 'comment': 'top left video, yellow', - 'location': [5, 5], - 'size': [110, 57], - 'color': [255, 255, 15], - 'tolerance': tolerance_dc - }, - { - 'comment': 'top right video, red', - 'location': [125, 5], - 'size': [110, 57], - 'color': [255, 17, 24], - 'tolerance': tolerance_dc - }, - { - 'comment': 'bottom left video, blue', - 'location': [5, 72], - 'size': [110, 57], - 'color': [12, 12, 255], - 'tolerance': tolerance_dc - }, - { - 'comment': 'bottom right video, green', - 'location': [125, 72], - 'size': [110, 57], - 'color': [44, 255, 16], - 'tolerance': tolerance_dc - } - ]), + tolerance=tolerance_dc, + expected_colors=_FOUR_COLOR_VIDEO_240x135_EXPECTED_COLORS), PixelTestPage( 'pixel_video_underlay.html', @@ -1713,41 +1346,37 @@ test_rect=[0, 0, 240, 136], revision=0, # Golden image revision is not used browser_args=browser_args_Underlay, + tolerance=tolerance_dc, expected_colors=[ { 'comment': 'black top left', 'location': [4, 4], 'size': [20, 20], 'color': [0, 0, 0], - 'tolerance': tolerance_dc }, { 'comment': 'yellow top left quadrant', 'location': [4, 34], 'size': [110, 30], 'color': [255, 255, 15], - 'tolerance': tolerance_dc }, { 'comment': 'red top right quadrant', 'location': [124, 4], 'size': [110, 60], 'color': [255, 17, 24], - 'tolerance': tolerance_dc }, { 'comment': 'blue bottom left quadrant', 'location': [4, 72], 'size': [110, 60], 'color': [12, 12, 255], - 'tolerance': tolerance_dc }, { 'comment': 'green bottom right quadrant', 'location': [124, 72], 'size': [110, 60], 'color': [44, 255, 16], - 'tolerance': tolerance_dc } ]), @@ -1757,41 +1386,37 @@ test_rect=[0, 0, 240, 136], revision=0, # Golden image revision is not used browser_args=browser_args_Underlay_DXVA, + tolerance=tolerance_dc, expected_colors=[ { 'comment': 'black top left', 'location': [4, 4], 'size': [20, 20], 'color': [0, 0, 0], - 'tolerance': tolerance_dc }, { 'comment': 'yellow top left quadrant', 'location': [4, 34], 'size': [110, 30], 'color': [255, 255, 15], - 'tolerance': tolerance_dc }, { 'comment': 'red top right quadrant', 'location': [124, 4], 'size': [110, 60], 'color': [255, 17, 24], - 'tolerance': tolerance_dc }, { 'comment': 'blue bottom left quadrant', 'location': [4, 72], 'size': [110, 60], 'color': [12, 12, 255], - 'tolerance': tolerance_dc }, { 'comment': 'green bottom right quadrant', 'location': [124, 72], 'size': [110, 60], 'color': [44, 255, 16], - 'tolerance': tolerance_dc } ]), @@ -1802,41 +1427,37 @@ revision=0, # Golden image revision is not used browser_args=browser_args_Underlay, other_args={'zero_copy': True}, + tolerance=tolerance_dc, expected_colors=[ { 'comment': 'black top left', 'location': [4, 4], 'size': [20, 20], 'color': [0, 0, 0], - 'tolerance': tolerance_dc }, { 'comment': 'yellow top left quadrant', 'location': [10, 35], 'size': [460, 225], 'color': [255, 255, 15], - 'tolerance': tolerance_dc }, { 'comment': 'red top right quadrant', 'location': [490, 10], 'size': [460, 250], 'color': [255, 17, 24], - 'tolerance': tolerance_dc }, { 'comment': 'blue bottom left quadrant', 'location': [10, 280], 'size': [460, 250], 'color': [12, 12, 255], - 'tolerance': tolerance_dc }, { 'comment': 'green bottom right quadrant', 'location': [490, 290], 'size': [460, 250], 'color': [44, 255, 16], - 'tolerance': tolerance_dc } ]), @@ -1846,41 +1467,37 @@ test_rect=[0, 0, 240, 136], revision=0, # Golden image revision is not used browser_args=browser_args_Nonroot, + tolerance=tolerance_dc, expected_colors=[ { 'comment': 'black top left', 'location': [4, 4], 'size': [20, 20], 'color': [0, 0, 0], - 'tolerance': tolerance_dc }, { 'comment': 'yellow top left quadrant', 'location': [4, 34], 'size': [110, 30], 'color': [255, 255, 15], - 'tolerance': tolerance_dc }, { 'comment': 'red top right quadrant', 'location': [124, 4], 'size': [50, 60], 'color': [255, 17, 24], - 'tolerance': tolerance_dc }, { 'comment': 'blue bottom left quadrant', 'location': [4, 72], 'size': [110, 60], 'color': [12, 12, 255], - 'tolerance': tolerance_dc }, { 'comment': 'green bottom right quadrant', 'location': [124, 72], 'size': [50, 60], 'color': [44, 255, 16], - 'tolerance': tolerance_dc } ]), @@ -1891,40 +1508,36 @@ revision=0, # Golden image revision is not used browser_args=browser_args_Complex, other_args={'video_is_rotated': True}, + tolerance=tolerance_dc, expected_colors=[ { 'comment': 'black top left', 'location': [4, 4], 'size': [20, 20], 'color': [0, 0, 0], - 'tolerance': tolerance_dc }, { 'comment': 'yellow top left quadrant', 'location': [60, 10], 'size': [65, 30], 'color': [255, 255, 15], - 'tolerance': tolerance_dc }, { 'comment': 'red top right quadrant', 'location': [150, 45], 'size': [65, 30], 'color': [255, 17, 24], - 'tolerance': tolerance_dc }, { 'comment': 'blue bottom left quadrant', 'location': [30, 70], 'size': [65, 30], 'color': [12, 12, 255], - 'tolerance': tolerance_dc }, { 'comment': 'green bottom right quadrant', 'location': [130, 100], 'size': [65, 30], 'color': [44, 255, 16], - 'tolerance': tolerance_dc }]), ]
diff --git a/content/test/gpu/gpu_tests/power_measurement_integration_test.py b/content/test/gpu/gpu_tests/power_measurement_integration_test.py index 7198c2c..8b52a23d 100644 --- a/content/test/gpu/gpu_tests/power_measurement_integration_test.py +++ b/content/test/gpu/gpu_tests/power_measurement_integration_test.py
@@ -30,7 +30,17 @@ import os import sys -fullscreen_script = r""" +# Waits for [x] seconds after browser launch before measuring power to +# avoid startup tasks affecting results. +_POWER_MEASUREMENT_DELAY = 20 + +# Measures power for [x] seconds and calculates the average as results. +_POWER_MEASUREMENT_DURATION = 30 + +# Measures power in resolution of [x] milli-seconds. +_POWER_MEASUREMENT_RESOLUTION = 100 + +_FULLSCREEN_SCRIPT = r""" function locateElement(tag) { // return the element with largest width. var elements = document.getElementsByTagName(tag); @@ -120,14 +130,17 @@ @classmethod def AddCommandlineArgs(cls, parser): super(PowerMeasurementIntegrationTest, cls).AddCommandlineArgs(parser) - parser.add_option("--duration", default=60, type="int", + parser.add_option("--duration", default=_POWER_MEASUREMENT_DURATION, + type="int", help="specify how many seconds Intel Power Gadget " - "measures. By default, 60 seconds is selected.") - parser.add_option("--delay", default=10, type="int", + "measures. By default, %d seconds is selected." % + _POWER_MEASUREMENT_DURATION) + parser.add_option("--delay", default=_POWER_MEASUREMENT_DELAY, type="int", help="specify how many seconds we skip in the data " "Intel Power Gadget collects. This time is for starting " "video play, switching to fullscreen mode, etc. " - "By default, 10 seconds is selected.") + "By default, %d seconds is selected." % + _POWER_MEASUREMENT_DELAY) parser.add_option("--resolution", default=100, type="int", help="specify how often Intel Power Gadget samples " "data in milliseconds. By default, 100 ms is selected.") @@ -157,14 +170,20 @@ @classmethod def GenerateGpuTests(cls, options): - yield ('url', options.url, (options.repeat, - options.outliers, - options.fullscreen, - options.underlay, - options.logdir, - options.duration, - options.delay, - options.resolution)) + yield ('Basic', '-', {'test_func': 'Basic'}) + if options.url is not None: + # This is for local testing convenience only and is not to be added to + # any bots. + yield ('URL', options.url, + {'test_func': 'URL', + 'repeat': options.repeat, + 'outliers': options.outliers, + 'fullscreen': options.fullscreen, + 'underlay': options.underlay, + 'logdir': options.logdir, + 'duration': options.duration, + 'delay': options.delay, + 'resolution': options.resolution}) @classmethod def SetUpProcess(cls): @@ -178,15 +197,38 @@ ipg_path = ipg_utils.LocateIPG() if not ipg_path: self.fail("Fail to locate Intel Power Gadget") + test_params = args[0] + assert test_params is not None and 'test_func' in test_params + prefixed_test_func_name = '_RunTest_%s' % test_params['test_func'] + getattr(self, prefixed_test_func_name)(test_path, test_params) - repeat = args[0] - outliers = args[1] - fullscreen = args[2] - underlay = args[3] - ipg_logdir = args[4] - ipg_duration = args[5] - ipg_delay = args[6] - ipg_resolution = args[7] + @classmethod + def _CreateExpectations(cls): + return PowerMeasurementExpectations() + + ######################################### + # Actual test functions + + def _RunTest_Basic(self, test_path, params): + logfile = None # Use the default path + ipg_utils.RunIPG(_POWER_MEASUREMENT_DURATION + _POWER_MEASUREMENT_DELAY, + _POWER_MEASUREMENT_RESOLUTION, + logfile) + results = ipg_utils.AnalyzeIPGLogFile(logfile, _POWER_MEASUREMENT_DELAY) + # TODO(zmo): output in a way that the results can be tracked at + # chromeperf.appspot.com. + print "Results: ", results + + + def _RunTest_URL(self, test_path, params): + repeat = params['repeat'] + outliers = params['outliers'] + fullscreen = params['fullscreen'] + underlay = params['underlay'] + ipg_logdir = params['logdir'] + ipg_duration = params['duration'] + ipg_delay = params['delay'] + ipg_resolution = params['resolution'] print "" print "Total iterations: ", repeat @@ -195,7 +237,7 @@ run_label = "Iteration_%d" % iteration print run_label if test_path: - self.tab.action_runner.Navigate(test_path, fullscreen_script) + self.tab.action_runner.Navigate(test_path, _FULLSCREEN_SCRIPT) self.tab.WaitForDocumentReadyStateToBeComplete() code = "setupVideoElement(%s)" % ("true" if underlay else "false") if not self.tab.action_runner.EvaluateJavaScript(code): @@ -237,9 +279,6 @@ logfiles, ipg_delay, outliers, json_path) print 'Summary: ', summary - @classmethod - def _CreateExpectations(cls): - return PowerMeasurementExpectations() def load_tests(loader, tests, pattern): del loader, tests, pattern # Unused.
diff --git a/content/test/gpu/gpu_tests/trace_integration_test.py b/content/test/gpu/gpu_tests/trace_integration_test.py index fbb3440..6c5b691 100644 --- a/content/test/gpu/gpu_tests/trace_integration_test.py +++ b/content/test/gpu/gpu_tests/trace_integration_test.py
@@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import logging import os import sys @@ -370,7 +369,7 @@ presentation_mode_history))) valid_entry_found = True if not valid_entry_found: - logging.warning('No valid frame statistics being collected: %s', + self.fail('No valid frame statistics being collected: %s', TraceIntegrationTest._SwapChainPresentationModeListToStr( presentation_mode_history))
diff --git a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py index 2464d6d2..e1457f4 100644 --- a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py +++ b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
@@ -88,8 +88,6 @@ bug=660844) # WebGL 2.0.1 self.Fail('conformance/rendering/rendering-sampling-feedback-loop.html', bug=660844) # WebGL 2.0.1 - self.Fail('deqp/functional/gles3/negativevertexarrayapi.html', - bug=928987) self.Fail('conformance2/extensions/ext-float-blend.html', bug=930993) @@ -554,8 +552,8 @@ self.Fail('deqp/functional/gles3/pixelbufferobject.html', ['mac', ('nvidia', 0xfe9)], bug=483282) - # self.Fail('deqp/functional/gles3/negativevertexarrayapi.html', - # ['mac', ('nvidia', 0xfe9)], bug=483282) + self.Fail('deqp/functional/gles3/negativevertexarrayapi.html', + ['mac', ('nvidia', 0xfe9)], bug=483282) self.Fail('deqp/functional/gles3/shaderindexing/varying.html', ['mac', ('nvidia', 0xfe9)], bug=483282) self.Fail('deqp/functional/gles3/texturespecification/' + @@ -1340,8 +1338,6 @@ ['android', 'qualcomm'], bug=906739) self.Fail('conformance2/glsl3/compare-structs-containing-arrays.html', ['android', 'qualcomm'], bug=906742) - self.Fail('conformance2/rendering/uniform-block-buffer-size.html', - ['android', 'qualcomm'], bug=906743) self.Fail('conformance2/textures/misc/tex-new-formats.html', ['android', 'qualcomm'], bug=906740) self.Fail('conformance2/textures/misc/copy-texture-image-luma-format.html',
diff --git a/content/test/navigation_simulator_unittest.cc b/content/test/navigation_simulator_unittest.cc index 1699394..fdd5c75c 100644 --- a/content/test/navigation_simulator_unittest.cc +++ b/content/test/navigation_simulator_unittest.cc
@@ -267,7 +267,7 @@ simulator_->GetLastThrottleCheckResult()); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( CancelMethod, CancellingNavigationSimulatorTest, ::testing::Combine( @@ -305,7 +305,7 @@ EXPECT_EQ(response_headers_, header); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Fail, NavigationSimulatorTestCancelFail, ::testing::Combine( @@ -325,7 +325,7 @@ EXPECT_FALSE(will_fail_request_called_); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Fail, NavigationSimulatorTestCancelFailErrAborted, ::testing::Combine(
diff --git a/device/fido/BUILD.gn b/device/fido/BUILD.gn index 8572852..69e63c1 100644 --- a/device/fido/BUILD.gn +++ b/device/fido/BUILD.gn
@@ -104,6 +104,8 @@ "opaque_attestation_statement.h", "opaque_public_key.cc", "opaque_public_key.h", + "pin.cc", + "pin.h", "platform_credential_store.h", "public_key.cc", "public_key.h",
diff --git a/device/fido/fido_request_handler_base.h b/device/fido/fido_request_handler_base.h index 325b07e..6530de8 100644 --- a/device/fido/fido_request_handler_base.h +++ b/device/fido/fido_request_handler_base.h
@@ -186,8 +186,9 @@ } // Set the platform authenticator for this request, if one is available. - // |AuthenticatorImpl| must call this method after invoking |set_oberver| even - // if no platform authenticator is available, in which case it passes nullptr. + // |AuthenticatorImpl| must call this method after invoking |set_observer| + // even if no platform authenticator is available, in which case it passes + // nullptr. virtual void SetPlatformAuthenticatorOrMarkUnavailable( base::Optional<PlatformAuthenticatorInfo> platform_authenticator_info);
diff --git a/device/fido/make_credential_task.cc b/device/fido/make_credential_task.cc index f05f411..c24efb3 100644 --- a/device/fido/make_credential_task.cc +++ b/device/fido/make_credential_task.cc
@@ -59,6 +59,11 @@ !ShouldUseU2fBecauseCtapRequiresClientPin(device(), request_parameter_)) { MakeCredential(); } else { + // |device_info| should be present iff the device is CTAP2. This will be + // used in |MaybeRevertU2fFallback| to restore the protocol of CTAP2 devices + // once this task is complete. + DCHECK((device()->supported_protocol() == ProtocolVersion::kCtap) == + static_cast<bool>(device()->device_info())); device()->set_supported_protocol(ProtocolVersion::kU2f); U2fRegister(); } @@ -82,8 +87,24 @@ DCHECK_EQ(ProtocolVersion::kU2f, device()->supported_protocol()); register_operation_ = std::make_unique<U2fRegisterOperation>( - device(), request_parameter_, std::move(callback_)); + device(), request_parameter_, + base::BindOnce(&MakeCredentialTask::MaybeRevertU2fFallback, + weak_factory_.GetWeakPtr())); register_operation_->Start(); } +void MakeCredentialTask::MaybeRevertU2fFallback( + CtapDeviceResponseCode status, + base::Optional<AuthenticatorMakeCredentialResponse> response) { + DCHECK_EQ(ProtocolVersion::kU2f, device()->supported_protocol()); + if (device()->device_info()) { + // This was actually a CTAP2 device, but the protocol version was set to U2F + // because it had a PIN set and so, in order to make a credential, the U2F + // interface was used. + device()->set_supported_protocol(ProtocolVersion::kCtap); + } + + std::move(callback_).Run(status, std::move(response)); +} + } // namespace device
diff --git a/device/fido/make_credential_task.h b/device/fido/make_credential_task.h index 61e35f6..49a8e29b 100644 --- a/device/fido/make_credential_task.h +++ b/device/fido/make_credential_task.h
@@ -45,6 +45,9 @@ void MakeCredential(); void U2fRegister(); + void MaybeRevertU2fFallback( + CtapDeviceResponseCode status, + base::Optional<AuthenticatorMakeCredentialResponse> response); CtapMakeCredentialRequest request_parameter_; std::unique_ptr<RegisterOperation> register_operation_;
diff --git a/device/fido/make_credential_task_unittest.cc b/device/fido/make_credential_task_unittest.cc index b9401ff..2500651 100644 --- a/device/fido/make_credential_task_unittest.cc +++ b/device/fido/make_credential_task_unittest.cc
@@ -129,7 +129,6 @@ const auto task = CreateMakeCredentialTask(device.get()); make_credential_callback_receiver().WaitForCallback(); - EXPECT_EQ(ProtocolVersion::kU2f, device->supported_protocol()); EXPECT_EQ(CtapDeviceResponseCode::kSuccess, make_credential_callback_receiver().status()); EXPECT_TRUE(make_credential_callback_receiver().value()); @@ -188,7 +187,6 @@ EXPECT_EQ(CtapDeviceResponseCode::kSuccess, make_credential_callback_receiver().status()); EXPECT_TRUE(make_credential_callback_receiver().value()); - EXPECT_EQ(device->supported_protocol(), ProtocolVersion::kU2f); } } // namespace
diff --git a/device/fido/pin.cc b/device/fido/pin.cc new file mode 100644 index 0000000..26b7c03 --- /dev/null +++ b/device/fido/pin.cc
@@ -0,0 +1,401 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <string> +#include <utility> + +#include "base/i18n/char_iterator.h" +#include "base/strings/string_util.h" +#include "components/cbor/reader.h" +#include "components/cbor/values.h" +#include "components/cbor/writer.h" +#include "device/fido/fido_constants.h" +#include "device/fido/pin.h" +#include "third_party/boringssl/src/include/openssl/aes.h" +#include "third_party/boringssl/src/include/openssl/bn.h" +#include "third_party/boringssl/src/include/openssl/ec.h" +#include "third_party/boringssl/src/include/openssl/ec_key.h" +#include "third_party/boringssl/src/include/openssl/ecdh.h" +#include "third_party/boringssl/src/include/openssl/evp.h" +#include "third_party/boringssl/src/include/openssl/hmac.h" +#include "third_party/boringssl/src/include/openssl/obj.h" +#include "third_party/boringssl/src/include/openssl/sha.h" + +namespace device { +namespace pin { + +// kProtocolVersion is the version of the PIN protocol that this code +// implements. +constexpr int kProtocolVersion = 1; + +// Subcommand enumerates the subcommands to the main |authenticatorClientPIN| +// command. See +// https://fidoalliance.org/specs/fido-v2.0-rd-20180702/fido-client-to-authenticator-protocol-v2.0-rd-20180702.html#authenticatorClientPIN +enum class Subcommand : uint8_t { + kGetRetries = 0x01, + kGetKeyAgreement = 0x02, + kSetPIN = 0x03, + kChangePIN = 0x04, + kGetPINToken = 0x05, +}; + +// CommandKeys enumerates the keys in the top-level CBOR map for all PIN +// commands. +enum class CommandKeys : int { + kProtocol = 1, + kSubcommand = 2, + kKeyAgreement = 3, + kPINAuth = 4, + kNewPINEnc = 5, + kPINHashEnc = 6, +}; + +// HasAtLeastFourCodepoints returns true if |pin| is UTF-8 encoded and contains +// four or more code points. This reflects the "4 Unicode characters" +// requirement in CTAP2. +static bool HasAtLeastFourCodepoints(const std::string& pin) { + base::i18n::UTF8CharIterator it(&pin); + return it.Advance() && it.Advance() && it.Advance() && it.Advance(); +} + +bool IsValid(const std::string& pin) { + return pin.size() >= kMinBytes && pin.size() <= kMaxBytes && + pin.back() != 0 && base::IsStringUTF8(pin) && + HasAtLeastFourCodepoints(pin); +} + +// EncodePINCommand returns a serialised CTAP2 PIN command for the operation +// |subcommand|. Additional elements of the top-level CBOR map can be added with +// the optional |add_additional| callback. +static std::vector<uint8_t> EncodePINCommand( + Subcommand subcommand, + std::function<void(cbor::Value::MapValue*)> add_additional = nullptr) { + cbor::Value::MapValue map; + map.emplace(static_cast<int>(CommandKeys::kProtocol), kProtocolVersion); + map.emplace(static_cast<int>(CommandKeys::kSubcommand), + static_cast<int>(subcommand)); + + if (add_additional) { + add_additional(&map); + } + + auto serialized = cbor::Writer::Write(cbor::Value(map)); + serialized->insert( + serialized->begin(), + static_cast<uint8_t>(CtapRequestCommand::kAuthenticatorClientPin)); + return *serialized; +} + +std::vector<uint8_t> RetriesRequest::EncodeAsCBOR() const { + return EncodePINCommand(Subcommand::kGetRetries); +} + +RetriesResponse::RetriesResponse() = default; + +// static +base::Optional<RetriesResponse> RetriesResponse::Parse( + base::span<const uint8_t> buffer) { + // The response status code (the first byte) has already been processed by + // this point. + if (buffer.empty()) { + return base::nullopt; + } + + base::Optional<cbor::Value> decoded_response = + cbor::Reader::Read(buffer.subspan(1)); + if (!decoded_response || !decoded_response->is_map()) { + return base::nullopt; + } + const auto& response_map = decoded_response->GetMap(); + + auto it = response_map.find(cbor::Value(3)); + if (it == response_map.end() || !it->second.is_unsigned()) { + return base::nullopt; + } + + RetriesResponse ret; + ret.retries = it->second.GetUnsigned(); + return ret; +} + +std::vector<uint8_t> KeyAgreementRequest::EncodeAsCBOR() const { + return EncodePINCommand(Subcommand::kGetKeyAgreement); +} + +KeyAgreementResponse::KeyAgreementResponse() = default; + +// PointFromKeyAgreementResponse returns an |EC_POINT| that represents the same +// P-256 point as |response|. It returns |nullopt| if |response| encodes an +// invalid point. +static base::Optional<bssl::UniquePtr<EC_POINT>> PointFromKeyAgreementResponse( + const EC_GROUP* group, + const KeyAgreementResponse& response) { + bssl::UniquePtr<EC_POINT> ret(EC_POINT_new(group)); + + BIGNUM x_bn, y_bn; + BN_init(&x_bn); + BN_init(&y_bn); + BN_bin2bn(response.x, sizeof(response.x), &x_bn); + BN_bin2bn(response.y, sizeof(response.y), &y_bn); + const bool on_curve = + EC_POINT_set_affine_coordinates_GFp(group, ret.get(), &x_bn, &y_bn, + nullptr /* ctx */) == 1; + BN_clear(&x_bn); + BN_clear(&y_bn); + + if (!on_curve) { + return base::nullopt; + } + + return ret; +} + +// static +base::Optional<KeyAgreementResponse> KeyAgreementResponse::Parse( + base::span<const uint8_t> buffer) { + // The response status code (the first byte) has already been processed by + // this point. + if (buffer.empty()) { + return base::nullopt; + } + + base::Optional<cbor::Value> decoded_response = + cbor::Reader::Read(buffer.subspan(1)); + if (!decoded_response || !decoded_response->is_map()) { + return base::nullopt; + } + const auto& response_map = decoded_response->GetMap(); + + // The ephemeral key is encoded as a COSE structure under key 1. + auto it = response_map.find(cbor::Value(1)); + if (it == response_map.end() || !it->second.is_map()) { + return base::nullopt; + } + const auto& cose_key = it->second.GetMap(); + + // The COSE key must be a P-256 point. See + // https://tools.ietf.org/html/rfc8152#section-7.1 + for (const auto& pair : std::vector<std::pair<int, int>>({ + {1 /* key type */, 2 /* elliptic curve, uncompressed */}, + {3 /* algorithm */, -25 /* ECDH, ephemeral–static, HKDF-SHA-256 */}, + {-1 /* curve */, 1 /* P-256 */}, + })) { + auto it = cose_key.find(cbor::Value(pair.first)); + if (it == cose_key.end() || !it->second.is_integer() || + it->second.GetInteger() != pair.second) { + return base::nullopt; + } + } + + // See https://tools.ietf.org/html/rfc8152#section-13.1.1 + const auto& x_it = cose_key.find(cbor::Value(-2)); + const auto& y_it = cose_key.find(cbor::Value(-3)); + if (x_it == cose_key.end() || y_it == cose_key.end() || + !x_it->second.is_bytestring() || !y_it->second.is_bytestring()) { + return base::nullopt; + } + + const auto& x = x_it->second.GetBytestring(); + const auto& y = y_it->second.GetBytestring(); + KeyAgreementResponse ret; + if (x.size() != sizeof(ret.x) || y.size() != sizeof(ret.y)) { + return base::nullopt; + } + memcpy(ret.x, x.data(), sizeof(ret.x)); + memcpy(ret.y, y.data(), sizeof(ret.y)); + + bssl::UniquePtr<EC_GROUP> group( + EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1)); + + // Check that the point is on the curve. + auto point = PointFromKeyAgreementResponse(group.get(), ret); + if (!point) { + return base::nullopt; + } + + return ret; +} + +SetRequest::SetRequest(const std::string& pin, + const KeyAgreementResponse& peer_key) + : peer_key_(peer_key) { + DCHECK(IsValid(pin)); + memset(pin_, 0, sizeof(pin_)); + memcpy(pin_, pin.data(), pin.size()); +} + +// SHA256KDF implements CTAP2's KDF, which just runs SHA-256 on the x-coordinate +// of the result. The function signature is such that it fits into OpenSSL's +// ECDH API. +static void* SHA256KDF(const void* in, + size_t in_len, + void* out, + size_t* out_len) { + DCHECK_GE(*out_len, static_cast<size_t>(SHA256_DIGEST_LENGTH)); + SHA256(reinterpret_cast<const uint8_t*>(in), in_len, + reinterpret_cast<uint8_t*>(out)); + *out_len = SHA256_DIGEST_LENGTH; + return out; +} + +// CalculateSharedKey generates and returns an ephemeral key, and writes the +// shared key between that ephemeral key and the authenticator's ephemeral key +// (from |peers_key|) to |out_shared_key|. +static cbor::Value::MapValue CalculateSharedKey( + const KeyAgreementResponse& peers_key, + uint8_t out_shared_key[SHA256_DIGEST_LENGTH]) { + bssl::UniquePtr<EC_KEY> key(EC_KEY_new_by_curve_name(NID_X9_62_prime256v1)); + CHECK(EC_KEY_generate_key(key.get())); + auto peers_point = + PointFromKeyAgreementResponse(EC_KEY_get0_group(key.get()), peers_key); + CHECK_EQ(static_cast<int>(SHA256_DIGEST_LENGTH), + ECDH_compute_key(out_shared_key, SHA256_DIGEST_LENGTH, + peers_point->get(), key.get(), SHA256KDF)); + + // X9.62 is the standard for serialising elliptic-curve points. + uint8_t x962[1 /* type byte */ + 32 /* x */ + 32 /* y */]; + CHECK_EQ(sizeof(x962), + EC_POINT_point2oct(EC_KEY_get0_group(key.get()), + EC_KEY_get0_public_key(key.get()), + POINT_CONVERSION_UNCOMPRESSED, x962, sizeof(x962), + nullptr /* BN_CTX */)); + + cbor::Value::MapValue cose_key; + cose_key.emplace(1 /* key type */, 2 /* uncompressed elliptic curve */); + cose_key.emplace(3 /* algorithm */, + 2 /* ECDH, ephemeral–static, HKDF-SHA-256 */); + cose_key.emplace(-1 /* curve */, 1 /* P-256 */); + cose_key.emplace(-2 /* x */, base::span<const uint8_t>(x962 + 1, 32)); + cose_key.emplace(-3 /* y */, base::span<const uint8_t>(x962 + 33, 32)); + + return cose_key; +} + +std::vector<uint8_t> SetRequest::EncodeAsCBOR() const { + // See + // https://fidoalliance.org/specs/fido-v2.0-rd-20180702/fido-client-to-authenticator-protocol-v2.0-rd-20180702.html#settingNewPin + uint8_t shared_key[SHA256_DIGEST_LENGTH]; + auto cose_key = CalculateSharedKey(peer_key_, shared_key); + + EVP_CIPHER_CTX aes_ctx; + EVP_CIPHER_CTX_init(&aes_ctx); + const uint8_t kZeroIV[AES_BLOCK_SIZE] = {0}; + CHECK(EVP_EncryptInit_ex(&aes_ctx, EVP_aes_256_cbc(), nullptr, shared_key, + kZeroIV)); + + static_assert((sizeof(pin_) % AES_BLOCK_SIZE) == 0, + "pin_ is not a multiple of the AES block size"); + uint8_t encrypted_pin[sizeof(pin_) + AES_BLOCK_SIZE]; + CHECK(EVP_Cipher(&aes_ctx, encrypted_pin, pin_, sizeof(pin_))); + EVP_CIPHER_CTX_cleanup(&aes_ctx); + + uint8_t pin_auth[SHA256_DIGEST_LENGTH]; + unsigned hmac_bytes; + CHECK(HMAC(EVP_sha256(), shared_key, sizeof(shared_key), encrypted_pin, + sizeof(pin_), pin_auth, &hmac_bytes)); + DCHECK_EQ(sizeof(pin_auth), static_cast<size_t>(hmac_bytes)); + + return EncodePINCommand( + Subcommand::kSetPIN, + [&cose_key, &encrypted_pin, &pin_auth](cbor::Value::MapValue* map) { + map->emplace(static_cast<int>(CommandKeys::kKeyAgreement), + std::move(cose_key)); + map->emplace(static_cast<int>(CommandKeys::kNewPINEnc), + // Note that the final AES block of |encrypted_pin| is + // discarded because CTAP2 doesn't include any padding. + base::span<const uint8_t>(encrypted_pin, sizeof(pin_))); + map->emplace(static_cast<int>(CommandKeys::kPINAuth), + base::span<const uint8_t>(pin_auth)); + }); +} + +ChangeRequest::ChangeRequest(const std::string& old_pin, + const std::string& new_pin, + const KeyAgreementResponse& peer_key) + : peer_key_(peer_key) { + uint8_t digest[SHA256_DIGEST_LENGTH]; + SHA256(reinterpret_cast<const uint8_t*>(old_pin.data()), old_pin.size(), + digest); + memcpy(old_pin_hash_, digest, sizeof(old_pin_hash_)); + + DCHECK(IsValid(new_pin)); + memset(new_pin_, 0, sizeof(new_pin_)); + memcpy(new_pin_, new_pin.data(), new_pin.size()); +} + +// static +base::Optional<EmptyResponse> EmptyResponse::Parse( + base::span<const uint8_t> buffer) { + // The response status code (the first byte) has already been processed by + // this point. + if (buffer.size() != 1) { + return base::nullopt; + } + + EmptyResponse ret; + return ret; +} + +std::vector<uint8_t> ChangeRequest::EncodeAsCBOR() const { + // See + // https://fidoalliance.org/specs/fido-v2.0-rd-20180702/fido-client-to-authenticator-protocol-v2.0-rd-20180702.html#changingExistingPin + uint8_t shared_key[SHA256_DIGEST_LENGTH]; + auto cose_key = CalculateSharedKey(peer_key_, shared_key); + + EVP_CIPHER_CTX aes_ctx; + EVP_CIPHER_CTX_init(&aes_ctx); + const uint8_t kZeroIV[AES_BLOCK_SIZE] = {0}; + + CHECK(EVP_EncryptInit_ex(&aes_ctx, EVP_aes_256_cbc(), nullptr, shared_key, + kZeroIV)); + static_assert((sizeof(new_pin_) % AES_BLOCK_SIZE) == 0, + "new_pin_ is not a multiple of the AES block size"); + uint8_t encrypted_pin[sizeof(new_pin_) + AES_BLOCK_SIZE]; + CHECK(EVP_Cipher(&aes_ctx, encrypted_pin, new_pin_, sizeof(new_pin_))); + + CHECK(EVP_EncryptInit_ex(&aes_ctx, EVP_aes_256_cbc(), nullptr, shared_key, + kZeroIV)); + static_assert((sizeof(old_pin_hash_) % AES_BLOCK_SIZE) == 0, + "old_pin_hash_ is not a multiple of the AES block size"); + uint8_t old_pin_hash_enc[sizeof(old_pin_hash_) + AES_BLOCK_SIZE]; + CHECK(EVP_Cipher(&aes_ctx, old_pin_hash_enc, old_pin_hash_, + sizeof(old_pin_hash_))); + + EVP_CIPHER_CTX_cleanup(&aes_ctx); + + uint8_t ciphertexts_concat[sizeof(new_pin_) + sizeof(old_pin_hash_)]; + // Note that the final AES blocks of |encrypted_pin| and |old_pin_hash_enc| + // are discarded because CTAP2 doesn't include any padding. + memcpy(ciphertexts_concat, encrypted_pin, sizeof(new_pin_)); + memcpy(ciphertexts_concat + sizeof(new_pin_), old_pin_hash_enc, + sizeof(old_pin_hash_)); + + uint8_t pin_auth[SHA256_DIGEST_LENGTH]; + unsigned hmac_bytes; + CHECK(HMAC(EVP_sha256(), shared_key, sizeof(shared_key), ciphertexts_concat, + sizeof(ciphertexts_concat), pin_auth, &hmac_bytes)); + DCHECK_EQ(sizeof(pin_auth), static_cast<size_t>(hmac_bytes)); + + return EncodePINCommand( + Subcommand::kChangePIN, [&cose_key, &encrypted_pin, &old_pin_hash_enc, + &pin_auth](cbor::Value::MapValue* map) { + map->emplace(static_cast<int>(CommandKeys::kKeyAgreement), + std::move(cose_key)); + map->emplace( + static_cast<int>(CommandKeys::kPINHashEnc), + base::span<const uint8_t>(old_pin_hash_enc, sizeof(old_pin_hash_))); + map->emplace( + static_cast<int>(CommandKeys::kNewPINEnc), + base::span<const uint8_t>(encrypted_pin, sizeof(new_pin_))); + map->emplace(static_cast<int>(CommandKeys::kPINAuth), + base::span<const uint8_t>(pin_auth)); + }); +} + +std::vector<uint8_t> ResetRequest::EncodeAsCBOR() const { + return {static_cast<uint8_t>(CtapRequestCommand::kAuthenticatorReset)}; +} + +} // namespace pin +} // namespace device
diff --git a/device/fido/pin.h b/device/fido/pin.h new file mode 100644 index 0000000..100237e --- /dev/null +++ b/device/fido/pin.h
@@ -0,0 +1,124 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file contains structures to implement the CTAP2 PIN protocol, version +// one. See +// https://fidoalliance.org/specs/fido-v2.0-rd-20180702/fido-client-to-authenticator-protocol-v2.0-rd-20180702.html#authenticatorClientPIN + +#ifndef DEVICE_FIDO_PIN_H_ +#define DEVICE_FIDO_PIN_H_ + +#include <stdint.h> + +#include <string> +#include <vector> + +#include "base/containers/span.h" +#include "base/optional.h" + +namespace device { +namespace pin { + +// IsValid returns true if |pin|, which must be UTF-8, is a syntactically valid +// PIN. +bool IsValid(const std::string& pin); + +// kMinBytes is the minimum number of *bytes* of PIN data that a CTAP2 device +// will accept. Since the PIN is UTF-8 encoded, this could be a single code +// point. However, the platform is supposed to additionally enforce a 4 +// *character* minimum +constexpr size_t kMinBytes = 4; +// kMaxBytes is the maximum number of bytes of PIN data that a CTAP2 device will +// accept. +constexpr size_t kMaxBytes = 63; + +// RetriesRequest asks an authenticator for the number of remaining PIN attempts +// before the device is locked. +struct RetriesRequest { + std::vector<uint8_t> EncodeAsCBOR() const; +}; + +// RetriesResponse reflects an authenticator's response to a |RetriesRequest|. +struct RetriesResponse { + static base::Optional<RetriesResponse> Parse( + base::span<const uint8_t> buffer); + + // retries is the number of PIN attempts remaining before the authenticator + // locks. + int64_t retries; + + private: + RetriesResponse(); +}; + +// KeyAgreementRequest asks an authenticator for an ephemeral ECDH key for +// encrypting PIN material in future requests. +struct KeyAgreementRequest { + std::vector<uint8_t> EncodeAsCBOR() const; +}; + +// KeyAgreementResponse reflects an authenticator's response to a +// |KeyAgreementRequest| and is also used as representation of the +// authenticator's ephemeral key. +struct KeyAgreementResponse { + static base::Optional<KeyAgreementResponse> Parse( + base::span<const uint8_t> buffer); + + // x and y contain the big-endian coordinates of a P-256 point. It is ensured + // that this is a valid point on the curve. + uint8_t x[32], y[32]; + + private: + KeyAgreementResponse(); +}; + +// SetRequest sets an initial PIN on an authenticator. (This is distinct from +// changing a PIN.) +class SetRequest { + public: + // IsValid(pin) must be true. + SetRequest(const std::string& pin, const KeyAgreementResponse& peer_key); + + std::vector<uint8_t> EncodeAsCBOR() const; + + private: + const KeyAgreementResponse peer_key_; + uint8_t pin_[kMaxBytes + 1]; +}; + +struct EmptyResponse { + static base::Optional<EmptyResponse> Parse(base::span<const uint8_t> buffer); +}; + +// ChangeRequest changes the PIN on an authenticator that already has a PIN set. +// (This is distinct from setting an initial PIN.) +class ChangeRequest { + public: + // IsValid(new_pin) must be true. + ChangeRequest(const std::string& old_pin, + const std::string& new_pin, + const KeyAgreementResponse& peer_key); + + std::vector<uint8_t> EncodeAsCBOR() const; + + private: + const KeyAgreementResponse peer_key_; + uint8_t old_pin_hash_[16]; + uint8_t new_pin_[kMaxBytes + 1]; +}; + +// ResetRequest resets an authenticator, which should invalidate all +// credentials and clear any configured PIN. This is not strictly a +// PIN-related command, but is generally used to reset a PIN and so is +// included here. +struct ResetRequest { + std::vector<uint8_t> EncodeAsCBOR() const; +}; + +using ResetResponse = EmptyResponse; + +} // namespace pin +} // namespace device + +#endif // DEVICE_FIDO_PIN_H_
diff --git a/docs/gpu/gpu_testing_bot_details.md b/docs/gpu/gpu_testing_bot_details.md index 0e4a25e..6a4d76ea 100644 --- a/docs/gpu/gpu_testing_bot_details.md +++ b/docs/gpu/gpu_testing_bot_details.md
@@ -390,9 +390,9 @@ [bots.cfg]: https://chrome-internal.googlesource.com/infradata/config/+/master/configs/chromium-swarm/bots.cfg [infradata/config]: https://chrome-internal.googlesource.com/infradata/config/ -[cr-buildbucket.cfg]: https://chromium.googlesource.com/chromium/src/+/master/infra/config/global/cr-buildbucket.cfg -[luci-milo.cfg]: https://chromium.googlesource.com/chromium/src/+/master/infra/config/global/luci-milo.cfg -[luci-scheduler.cfg]: https://chromium.googlesource.com/chromium/src/+/master/infra/config/global/luci-scheduler.cfg +[cr-buildbucket.cfg]: https://chromium.googlesource.com/chromium/src/+/master/infra/config/cr-buildbucket.cfg +[luci-milo.cfg]: https://chromium.googlesource.com/chromium/src/+/master/infra/config/luci-milo.cfg +[luci-scheduler.cfg]: https://chromium.googlesource.com/chromium/src/+/master/infra/config/luci-scheduler.cfg [GPU FYI Win Builder]: https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/GPU%20FYI%20Win%20Builder ### How to start running tests on a new GPU type on an existing try bot
diff --git a/docs/infra/new_builder.md b/docs/infra/new_builder.md index 70e250f..1553e90 100644 --- a/docs/infra/new_builder.md +++ b/docs/infra/new_builder.md
@@ -14,7 +14,7 @@ 2. in [chromium/tools/build][17], modifying the chromium\_tests configuration. 3. in [chromium/src][18], modifying all of the following: - 1. LUCI service configurations in `//infra/config/global` + 1. LUCI service configurations in `//infra/config` 2. Compile configuration in `//tools/mb` 3. Test configuration in `//testing/buildbot` @@ -170,7 +170,7 @@ ### LUCI services -LUCI services used by chromium are configured in [//infra/config/global][6]. +LUCI services used by chromium are configured in [//infra/config][6]. #### Buildbucket @@ -322,13 +322,13 @@ [3]: https://bit.ly/chromium-build-naming [4]: https://luci-config.appspot.com/#/services/chromium-swarm [5]: https://chromium.googlesource.com/chromium/tools/build/+/master/scripts/slave/recipe_modules/chromium_tests -[6]: /infra/config/global +[6]: /infra/config [7]: https://luci-config.appspot.com/schemas/projects:cr-buildbucket.cfg -[8]: /infra/config/global/cr-buildbucket.cfg +[8]: /infra/config/cr-buildbucket.cfg [9]: http://luci-config.appspot.com/schemas/projects:luci-milo.cfg -[10]: /infra/config/global/luci-milo.cfg +[10]: /infra/config/luci-milo.cfg [11]: https://chromium.googlesource.com/infra/luci/luci-go/+/master/scheduler/appengine/messages/config.proto -[12]: /infra/config/global/luci-scheduler.cfg +[12]: /infra/config/luci-scheduler.cfg [13]: /tools/mb/README.md [14]: /tools/mb/docs/user_guide.md#the-mb_config_pyl-config-file [15]: /testing/buildbot/README.md
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h index 84f5d5b9..376ee04 100644 --- a/extensions/browser/extension_function_histogram_value.h +++ b/extensions/browser/extension_function_histogram_value.h
@@ -1377,6 +1377,7 @@ AUTOFILLPRIVATE_GETSERVERCREDITCARDLIST = 1314, PASSWORDSPRIVATE_CHANGESAVEDPASSWORD = 1315, AUTOTESTPRIVATE_SETWHITELISTEDPREF = 1316, + SAFEBROWSINGPRIVATE_GETREFERRERCHAIN = 1317, // Last entry: Add new entries above, then run: // python tools/metrics/histograms/update_extension_histograms.py ENUM_BOUNDARY
diff --git a/fuchsia/runners/cast/sandbox_policy b/fuchsia/runners/cast/sandbox_policy index 1b71af62..cc9f03e 100644 --- a/fuchsia/runners/cast/sandbox_policy +++ b/fuchsia/runners/cast/sandbox_policy
@@ -10,7 +10,6 @@ "fuchsia.ui.input.ImeService", "fuchsia.ui.input.ImeVisibilityService", "fuchsia.ui.scenic.Scenic", - "fuchsia.ui.viewsv1.ViewManager", "fuchsia.vulkan.loader.Loader" ] }
diff --git a/fuchsia/runners/web/sandbox_policy b/fuchsia/runners/web/sandbox_policy index 4038e53..0d084f2 100644 --- a/fuchsia/runners/web/sandbox_policy +++ b/fuchsia/runners/web/sandbox_policy
@@ -11,7 +11,6 @@ "fuchsia.ui.input.ImeService", "fuchsia.ui.input.ImeVisibilityService", "fuchsia.ui.scenic.Scenic", - "fuchsia.ui.viewsv1.ViewManager", "fuchsia.vulkan.loader.Loader" ] }
diff --git a/google_apis/gaia/oauth2_token_service_delegate.h b/google_apis/gaia/oauth2_token_service_delegate.h index 3d054a9..e49edad 100644 --- a/google_apis/gaia/oauth2_token_service_delegate.h +++ b/google_apis/gaia/oauth2_token_service_delegate.h
@@ -12,6 +12,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/observer_list.h" +#include "build/build_config.h" #include "google_apis/gaia/gaia_auth_util.h" #include "google_apis/gaia/oauth2_token_service.h" #include "net/base/backoff_entry.h" @@ -125,6 +126,13 @@ // and false otherwise. virtual bool FixRequestErrorIfPossible(); +#if defined(OS_ANDROID) || defined(OS_IOS) + // Triggers platform specific implementation for Android and IOS to reload + // accounts from system. + virtual void ReloadAccountsFromSystem(const std::string& primary_account_id) { + } +#endif + // ----------------------------------------------------------------------- // End of methods that are only used by ProfileOAuth2TokenService // -----------------------------------------------------------------------
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index 612f088c..6c470c3 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -6136,28 +6136,24 @@ "count less than 0."); return; } - if (count == 0) { - return; - } if (primcount < 0) { SetGLError(GL_INVALID_VALUE, "glDrawElementsInstancedANGLE", "primcount < 0"); return; } - if (primcount == 0) { - return; - } - if (vertex_array_object_manager_->bound_element_array_buffer() != 0 && - !ValidateOffset("glDrawElementsInstancedANGLE", - reinterpret_cast<GLintptr>(indices))) { - return; - } GLuint offset = 0; bool simulated = false; - if (!vertex_array_object_manager_->SetupSimulatedIndexAndClientSideBuffers( - "glDrawElementsInstancedANGLE", this, helper_, count, type, primcount, - indices, &offset, &simulated)) { - return; + if (count > 0 && primcount > 0) { + if (vertex_array_object_manager_->bound_element_array_buffer() != 0 && + !ValidateOffset("glDrawElementsInstancedANGLE", + reinterpret_cast<GLintptr>(indices))) { + return; + } + if (!vertex_array_object_manager_->SetupSimulatedIndexAndClientSideBuffers( + "glDrawElementsInstancedANGLE", this, helper_, count, type, + primcount, indices, &offset, &simulated)) { + return; + } } helper_->DrawElementsInstancedANGLE(mode, count, type, offset, primcount); RestoreElementAndArrayBuffers(simulated);
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index cd22fa43..faf7838 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -3623,7 +3623,8 @@ state_.indexed_uniform_buffer_bindings = base::MakeRefCounted<gles2::IndexedBufferBindingHost>( group_->max_uniform_buffer_bindings(), GL_UNIFORM_BUFFER, - needs_emulation); + needs_emulation, + workarounds().round_down_uniform_bind_buffer_range_size); state_.indexed_uniform_buffer_bindings->SetIsBound(true); state_.InitGenericAttribs(group_->max_vertex_attribs()); @@ -11234,6 +11235,14 @@ return error::kNoError; } + if (state_.bound_transform_feedback.get() && + state_.bound_transform_feedback->active() && + !state_.bound_transform_feedback->paused()) { + LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, + "transformfeedback is active and not paused"); + return error::kNoError; + } + GLuint total_max_vertex_accessed = 0; GLsizei total_max_primcount = 0; if (!CheckMultiDrawElementsVertices( @@ -11247,14 +11256,6 @@ return error::kNoError; } - if (state_.bound_transform_feedback.get() && - state_.bound_transform_feedback->active() && - !state_.bound_transform_feedback->paused()) { - LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, - "transformfeedback is active and not paused"); - return error::kNoError; - } - if (feature_info_->IsWebGL2OrES3Context()) { if (!AttribsTypeMatch()) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, @@ -11354,9 +11355,9 @@ *static_cast<const volatile gles2::cmds::DrawElements*>(cmd_data); GLsizei count = static_cast<GLsizei>(c.count); int32_t offset = static_cast<int32_t>(c.index_offset); - return DoMultiDrawElements("glDrawArrays", false, static_cast<GLenum>(c.mode), - &count, static_cast<GLenum>(c.type), &offset, - nullptr, 1); + return DoMultiDrawElements("glDrawElements", false, + static_cast<GLenum>(c.mode), &count, + static_cast<GLenum>(c.type), &offset, nullptr, 1); } error::Error GLES2DecoderImpl::HandleDrawElementsInstancedANGLE(
diff --git a/gpu/command_buffer/service/indexed_buffer_binding_host.cc b/gpu/command_buffer/service/indexed_buffer_binding_host.cc index ea5f032..07d0e92 100644 --- a/gpu/command_buffer/service/indexed_buffer_binding_host.cc +++ b/gpu/command_buffer/service/indexed_buffer_binding_host.cc
@@ -75,11 +75,15 @@ effective_full_buffer_size = 0; } -IndexedBufferBindingHost::IndexedBufferBindingHost(uint32_t max_bindings, - GLenum target, - bool needs_emulation) +IndexedBufferBindingHost::IndexedBufferBindingHost( + uint32_t max_bindings, + GLenum target, + bool needs_emulation, + bool round_down_uniform_bind_buffer_range_size) : is_bound_(false), needs_emulation_(needs_emulation), + round_down_uniform_bind_buffer_range_size_( + round_down_uniform_bind_buffer_range_size), max_non_null_binding_index_plus_one_(0u), target_(target) { DCHECK(needs_emulation); @@ -113,7 +117,8 @@ GLuint service_id = buffer ? buffer->service_id() : 0; if (buffer && needs_emulation_) { DoAdjustedBindBufferRange(target_, index, service_id, offset, size, - buffer->size()); + buffer->size(), + round_down_uniform_bind_buffer_range_size_); } else { glBindBufferRange(target_, index, service_id, offset, size); } @@ -130,8 +135,13 @@ // static void IndexedBufferBindingHost::DoAdjustedBindBufferRange( - GLenum target, GLuint index, GLuint service_id, GLintptr offset, - GLsizeiptr size, GLsizeiptr full_buffer_size) { + GLenum target, + GLuint index, + GLuint service_id, + GLintptr offset, + GLsizeiptr size, + GLsizeiptr full_buffer_size, + bool round_down_uniform_bind_buffer_range_size) { GLsizeiptr adjusted_size = size; if (offset >= full_buffer_size) { // Situation 1: We can't really call glBindBufferRange with reasonable @@ -142,7 +152,8 @@ // MacOSX with AMD/4.1. glBindBufferBase(target, index, service_id); return; - } else if (offset + size > full_buffer_size) { + } + if (offset + size > full_buffer_size) { adjusted_size = full_buffer_size - offset; // size needs to be a multiple of 4. adjusted_size = adjusted_size & ~3; @@ -153,6 +164,22 @@ return; } } + if (round_down_uniform_bind_buffer_range_size) { + adjusted_size = adjusted_size & ~3; + if (adjusted_size == 0) { + // This case is invalid and we shouldn't call the driver. + // Without rounding, this would generate INVALID_OPERATION + // at draw time because the size is not enough to fill the smallest + // possible uniform block (4 bytes). + // The size of the range is set in DoBindBufferRange and validated in + // BufferManager::RequestBuffersAccess. It is fine to not bind the buffer + // because any draw call with this buffer range binding will generate + // INVALID_OPERATION. + // Clear the buffer binding because it will not be used. + glBindBufferBase(target, index, 0); + return; + } + } glBindBufferRange(target, index, service_id, offset, adjusted_size); } @@ -168,7 +195,8 @@ buffer_bindings_[ii].effective_full_buffer_size != buffer->size()) { DoAdjustedBindBufferRange(target_, ii, buffer->service_id(), buffer_bindings_[ii].offset, - buffer_bindings_[ii].size, buffer->size()); + buffer_bindings_[ii].size, buffer->size(), + round_down_uniform_bind_buffer_range_size_); buffer_bindings_[ii].effective_full_buffer_size = buffer->size(); } } @@ -206,7 +234,8 @@ buffer_bindings_[ii].effective_full_buffer_size != buffer->size()) { DoAdjustedBindBufferRange(target_, ii, buffer->service_id(), buffer_bindings_[ii].offset, - buffer_bindings_[ii].size, buffer->size()); + buffer_bindings_[ii].size, buffer->size(), + round_down_uniform_bind_buffer_range_size_); buffer_bindings_[ii].effective_full_buffer_size = buffer->size(); } }
diff --git a/gpu/command_buffer/service/indexed_buffer_binding_host.h b/gpu/command_buffer/service/indexed_buffer_binding_host.h index af2f467..b28018d 100644 --- a/gpu/command_buffer/service/indexed_buffer_binding_host.h +++ b/gpu/command_buffer/service/indexed_buffer_binding_host.h
@@ -27,7 +27,8 @@ // out-of-bounds buffer accesses. IndexedBufferBindingHost(uint32_t max_bindings, GLenum target, - bool needs_emulation); + bool needs_emulation, + bool round_down_uniform_bind_buffer_range_size); // The following two functions do state update and call the underlying GL // function. All validations have been done already and the GL function is @@ -111,14 +112,20 @@ // This is called when |needs_emulation_| is true, where the range // (offset + size) can't go beyond the buffer's size. static void DoAdjustedBindBufferRange( - GLenum target, GLuint index, GLuint service_id, GLintptr offset, - GLsizeiptr size, GLsizeiptr full_buffer_size); + GLenum target, + GLuint index, + GLuint service_id, + GLintptr offset, + GLsizeiptr size, + GLsizeiptr full_buffer_size, + bool round_down_uniform_bind_buffer_range_size); void UpdateMaxNonNullBindingIndex(size_t changed_index); std::vector<IndexedBufferBinding> buffer_bindings_; bool needs_emulation_; + bool round_down_uniform_bind_buffer_range_size_; // This is used for optimization purpose in context switching. size_t max_non_null_binding_index_plus_one_;
diff --git a/gpu/command_buffer/service/indexed_buffer_binding_host_unittest.cc b/gpu/command_buffer/service/indexed_buffer_binding_host_unittest.cc index 3d37f16b..8bf24f1 100644 --- a/gpu/command_buffer/service/indexed_buffer_binding_host_unittest.cc +++ b/gpu/command_buffer/service/indexed_buffer_binding_host_unittest.cc
@@ -21,10 +21,12 @@ IndexedBufferBindingHostTest() : uniform_host_(new IndexedBufferBindingHost(kMaxBindings, GL_UNIFORM_BUFFER, - true)), + true, + false)), tf_host_(new IndexedBufferBindingHost(kMaxBindings, GL_TRANSFORM_FEEDBACK_BUFFER, - true)), + true, + false)), buffer_manager_(new BufferManager(nullptr, nullptr)) { buffer_manager_->CreateBuffer(kBufferClientId, kBufferServiceId); buffer_ = buffer_manager_->GetBuffer(kBufferClientId); @@ -140,7 +142,7 @@ uniform_host_->DoBindBufferBase(kIndex, buffer_.get()); // Set up the second host scoped_refptr<IndexedBufferBindingHost> other = - new IndexedBufferBindingHost(kMaxBindings, kTarget, true); + new IndexedBufferBindingHost(kMaxBindings, kTarget, true, false); EXPECT_CALL(*gl_, BindBufferRange(kTarget, kOtherIndex, kBufferServiceId, kOffset, clamped_size)) .Times(1)
diff --git a/gpu/command_buffer/service/transform_feedback_manager.cc b/gpu/command_buffer/service/transform_feedback_manager.cc index 95f7a57..90fa073c0 100644 --- a/gpu/command_buffer/service/transform_feedback_manager.cc +++ b/gpu/command_buffer/service/transform_feedback_manager.cc
@@ -17,7 +17,8 @@ : IndexedBufferBindingHost( manager->max_transform_feedback_separate_attribs(), GL_TRANSFORM_FEEDBACK_BUFFER, - manager->needs_emulation()), + manager->needs_emulation(), + false), manager_(manager), client_id_(client_id), service_id_(service_id),
diff --git a/gpu/config/gpu_driver_bug_list.json b/gpu/config/gpu_driver_bug_list.json index 6fadd9f7..e08d93ff 100644 --- a/gpu/config/gpu_driver_bug_list.json +++ b/gpu/config/gpu_driver_bug_list.json
@@ -3111,6 +3111,18 @@ "features": [ "disable_es3_gl_context_for_testing" ] + }, + { + "id": 290, + "description": "Round down glBindBufferRange size to a multiple of 4 on Qualcomm Adreno GPUs for uniform buffers", + "cr_bugs": [906743], + "os": { + "type": "android" + }, + "gl_renderer": "Adreno \\(TM\\) .*", + "features": [ + "round_down_uniform_bind_buffer_range_size" + ] } ] }
diff --git a/gpu/config/gpu_workaround_list.txt b/gpu/config/gpu_workaround_list.txt index 8998980..ba5f484 100644 --- a/gpu/config/gpu_workaround_list.txt +++ b/gpu/config/gpu_workaround_list.txt
@@ -87,6 +87,7 @@ rewrite_do_while_loops rewrite_float_unary_minus_operator rewrite_texelfetchoffset_to_texelfetch +round_down_uniform_bind_buffer_range_size scalarize_vec_and_mat_constructor_args set_zero_level_before_generating_mipmap simulate_out_of_memory_on_large_textures
diff --git a/infra/config/cr-buildbucket.cfg b/infra/config/cr-buildbucket.cfg index 35704bc..ead39111 100644 --- a/infra/config/cr-buildbucket.cfg +++ b/infra/config/cr-buildbucket.cfg
@@ -3308,12 +3308,6 @@ name: "linux-coverage-rel" auto_builder_dimension: NO } - # TODO(crbug.com/888810): Remove in Q2 2019 - builders { - mixins: "linux-try" - mixins: "goma-j150" - name: "linux_chromium_rel_ng" - } builders { mixins: "linux-try" mixins: "goma-j150" @@ -3376,12 +3370,6 @@ } builders { mixins: "mac-try" name: "mac_chromium_compile_rel_ng" } builders { mixins: "mac-try" name: "mac_chromium_dbg_ng" dimensions:"os:Mac-10.12"} - # TODO(crbug.com/888810): Remove in Q2 2019 - builders { - mixins: "mac-try" - mixins: "goma-j150" - name: "mac_chromium_rel_ng" - } builders { mixins: "mac-try" mixins: "goma-j150" @@ -3408,18 +3396,11 @@ name: "win10_chromium_x64_rel_ng" } builders { mixins: "win-try" name: "win10_chromium_x64_rel_ng_exp" } - # TODO(crbug.com/888810): Remove in Q2 2019 - builders { - mixins: "win-try" - mixins: "goma-j300" - name: "win7_chromium_rel_ng" - # TODO(crbug.com/914104): Remove once pool has sufficient capacity - execution_timeout_secs: 16200 # 4.5h - } builders { mixins: "win-try" mixins: "goma-j300" name: "win7-rel" + execution_timeout_secs: 16200 # 4.5h } builders { mixins: "win-try" name: "win7_chromium_rel_loc_exp" } builders { mixins: "win-try" name: "win-annotator-rel" }
diff --git a/infra/config/global/OWNERS b/infra/config/global/OWNERS deleted file mode 100644 index e299981..0000000 --- a/infra/config/global/OWNERS +++ /dev/null
@@ -1,20 +0,0 @@ -bpastene@chromium.org -dpranke@chromium.org -estaab@chromium.org -hans@chromium.org -hinoka@chromium.org -iannucci@chromium.org -jchinlee@chromium.org -martiniss@chromium.org -maruel@chromium.org -smut@google.com -tandrii@chromium.org -thakis@chromium.org -vadimsh@chromium.org - -# For build parallelism configs. -per-file cr-buildbucket.cfg=shinyak@chromium.org -per-file cr-buildbucket.cfg=sque@chromium.org -per-file cr-buildbucket.cfg=tikuta@chromium.org -per-file cr-buildbucket.cfg=ukai@chromium.org -per-file cr-buildbucket.cfg=yyanagisawa@chromium.org
diff --git a/infra/config/global/PRESUBMIT.py b/infra/config/global/PRESUBMIT.py deleted file mode 100644 index 1df9ce7a..0000000 --- a/infra/config/global/PRESUBMIT.py +++ /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. - -"""Enforces luci-milo.cfg consistency. - -See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts -for more details on the presubmit API built into depot_tools. -""" - - -def _CommonChecks(input_api, output_api): - commands = [] - - if ('infra/config/global/luci-milo.cfg' in input_api.LocalPaths() or - 'infra/config/global/lint-luci-milo.py' in input_api.LocalPaths()): - commands.append( - input_api.Command( - name='lint-luci-milo', - cmd=[input_api.python_executable, 'lint-luci-milo.py'], - kwargs={}, - message=output_api.PresubmitError)) - commands.append( - # Technically doesn't rely on lint-luci-milo.py, but is a lightweight - # enough check it should be fine to trigger. - input_api.Command( - name='testing/buildbot config checks', - cmd=[input_api.python_executable, input_api.os_path.join( - '..', '..', '..', 'testing', 'buildbot', - 'generate_buildbot_json.py',), - '--check'], - kwargs={}, message=output_api.PresubmitError)) - - if 'infra/config/global/commit-queue.cfg' in input_api.LocalPaths(): - commands.append( - input_api.Command( - name='commit-queue.cfg presubmit', cmd=[ - input_api.python_executable, input_api.os_path.join( - 'cq_cfg_presubmit.py'), - '--check'], - kwargs={}, message=output_api.PresubmitError), - ) - - commands.extend(input_api.canned_checks.GetUnitTestsRecursively( - input_api, output_api, - input_api.os_path.join(input_api.PresubmitLocalPath()), - whitelist=[r'.+_unittest\.py$'], blacklist=[])) - - results = [] - - results.extend(input_api.RunTests(commands)) - results.extend(input_api.canned_checks.CheckChangedLUCIConfigs( - input_api, output_api)) - - return results - - -def CheckChangeOnUpload(input_api, output_api): - return _CommonChecks(input_api, output_api) - -def CheckChangeOnCommit(input_api, output_api): - return _CommonChecks(input_api, output_api)
diff --git a/infra/config/global/README.md b/infra/config/global/README.md deleted file mode 100644 index 2824864..0000000 --- a/infra/config/global/README.md +++ /dev/null
@@ -1,13 +0,0 @@ -## Global configs. - -**IMPORTANT:** If you see this in a branch which is not `master`, -**this directory has no effect and should be ignored.** - -This branch contains chromium project-wide configurations -for chrome-infra services. -For example, [cr-buildbucket.cfg](cr-buildbucket.cfg) defines builders. - -**Remember** Change these configs on `master` branch only! - -Currently active version can be checked at -https://luci-config.appspot.com/#/projects/chromium .
diff --git a/infra/config/global/commit-queue.cfg b/infra/config/global/commit-queue.cfg deleted file mode 100644 index d836fc1d..0000000 --- a/infra/config/global/commit-queue.cfg +++ /dev/null
@@ -1,338 +0,0 @@ -# See http://luci-config.appspot.com/schemas/projects:commit-queue.cfg for the -# documentation of this file format. -# -# This file is also used to auto generate //docs/infra/cq_builders.md. If you -# change this file, run //infra/config/branch/cq_cfg_presubmit.py, which will -# generate that file. That script also requires that the builders in this file -# remain sorted. The script is invoked via presubmit, and will complain if this -# file is change but the documentation isn't. -# -# The auto generated file copies comments made to builders in this file. If you -# comment on the line directly above a builder, that comment will get copied to -# the documentation. -# -# The following comment will get copied. -# -# # This is a great builder! -# builders { name: "chromium_presubmit" } -# -# The following comment will not get copied. -# -# # This is a ok builder! -# -# builders { name: "chromium_presubmit" } - -cq_status_host: "chromium-cq-status.appspot.com" -submit_options { - max_burst: 2 - burst_delay { - seconds: 60 - } -} - -# NOTE: To add a new builder to the commit queue, see -# https://chromium.googlesource.com/chromium/src/+/HEAD/docs/infra/cq.md#how-do-i-add-a-new-builder-to-the-cq - -config_groups { - gerrit { - url: "https://chromium-review.googlesource.com" - projects { - name: "chromium/src" - ref_regexp: "refs/heads/.+" - } - } - verifiers { - gerrit_cq_ability { - committer_list: "project-chromium-committers" - dry_run_access_list: "project-chromium-tryjob-access" - } - tree_status { - url: "https://chromium-status.appspot.com/" - } - tryjob { - ############################# - # Always required builders. # - ############################# - - builders { - name: "chromium/try/android-binary-size" - } - builders { - name: "chromium/try/android-kitkat-arm-rel" - } - builders { - name: "chromium/try/android-marshmallow-arm64-rel" - } - builders { - name: "chromium/try/android_arm64_dbg_recipe" - } - builders { - name: "chromium/try/android_clang_dbg_recipe" - } - builders { - name: "chromium/try/android_compile_dbg" - } - builders { - name: "chromium/try/android_cronet" - } - builders { - name: "chromium/try/cast_shell_android" - } - builders { - name: "chromium/try/cast_shell_linux" - } - builders { - name: "chromium/try/chromeos-amd64-generic-rel" - } - builders { - name: "chromium/try/chromeos-daisy-rel" - } - builders { - name: "chromium/try/chromium_presubmit" - disable_reuse: true - } - builders { - name: "chromium/try/fuchsia_arm64" - } - builders { - name: "chromium/try/fuchsia_x64" - } - builders { - name: "chromium/try/ios-simulator" - } - builders { - name: "chromium/try/linux-chromeos-compile-dbg" - } - builders { - name: "chromium/try/linux-chromeos-rel" - } - builders { - name: "chromium/try/linux-jumbo-rel" - } - builders { - name: "chromium/try/linux-libfuzzer-asan-rel" - } - builders { - name: "chromium/try/linux-ozone-rel" - } - builders { - name: "chromium/try/linux-rel" - } - builders { - name: "chromium/try/linux_chromium_asan_rel_ng" - } - builders { - name: "chromium/try/linux_chromium_compile_dbg_ng" - } - builders { - name: "chromium/try/linux_chromium_tsan_rel_ng" - } - builders { - name: "chromium/try/mac-rel" - } - builders { - name: "chromium/try/mac_chromium_compile_dbg_ng" - } - builders { - name: "chromium/try/win-libfuzzer-asan-rel" - } - builders { - name: "chromium/try/win10_chromium_x64_rel_ng" - } - builders { - name: "chromium/try/win7-rel" - } - builders { - name: "chromium/try/win_chromium_compile_dbg_ng" - } - - ###################### - # Optional builders. # - ###################### - - builders { - name: "chromium/try/android_optional_gpu_tests_rel" - location_regexp: ".+/[+]/cc/.+" - location_regexp: ".+/[+]/chrome/browser/vr/.+" - location_regexp: ".+/[+]/components/viz/.+" - location_regexp: ".+/[+]/content/test/gpu/.+" - location_regexp: ".+/[+]/gpu/.+" - location_regexp: ".+/[+]/media/audio/.+" - location_regexp: ".+/[+]/media/filters/.+" - location_regexp: ".+/[+]/media/gpu/.+" - location_regexp: ".+/[+]/services/viz/.+" - location_regexp: ".+/[+]/testing/trigger_scripts/.+" - location_regexp: ".+/[+]/third_party/blink/renderer/modules/webgl/.+" - location_regexp: ".+/[+]/ui/gl/.+" - } - builders { - name: "chromium/try/chromeos-kevin-compile-rel" - location_regexp: ".+/[+]/chromeos/CHROMEOS_LKGM" - } - builders { - name: "chromium/try/closure_compilation" - location_regexp: ".+/[+]/third_party/closure_compiler/.+" - } - builders { - name: "chromium/try/ios-simulator-cronet" - location_regexp: ".+/[+]/components/cronet/.+" - location_regexp: ".+/[+]/components/grpc_support/.+" - location_regexp: ".+/[+]/ios/.+" - location_regexp_exclude: ".+/[+]/components/cronet/android/.+" - } - builders { - name: "chromium/try/ios-simulator-full-configs" - location_regexp: ".+/[+]/ios/.+" - } - builders { - name: "chromium/try/linux-blink-rel" - location_regexp: ".+/[+]/cc/.+" - location_regexp: ".+/[+]/third_party/blink/renderer/core/paint/.+" - location_regexp: ".+/[+]/third_party/blink/renderer/core/svg/.+" - location_regexp: ".+/[+]/third_party/blink/renderer/platform/graphics/.+" - location_regexp: ".+/[+]/third_party/blink/web_tests/FlagExpectations/enable-blink-features=CompositeAfterPaint" - location_regexp: ".+/[+]/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/.+" - } - builders { - name: "chromium/try/linux_chromium_dbg_ng" - location_regexp: ".+/[+]/build/.*check_gn_headers.*" - location_regexp: ".+/[+]/chrome/browser/resources/.+" - } - builders { - name: "chromium/try/linux_layout_tests_composite_after_paint" - location_regexp: ".+/[+]/third_party/blink/renderer/core/paint/.+" - location_regexp: ".+/[+]/third_party/blink/renderer/core/svg/.+" - location_regexp: ".+/[+]/third_party/blink/renderer/platform/graphics/.+" - location_regexp: ".+/[+]/third_party/blink/web_tests/FlagExpectations/enable-blink-features=CompositeAfterPaint" - location_regexp: ".+/[+]/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/.+" - } - builders { - name: "chromium/try/linux_layout_tests_layout_ng" - location_regexp: ".+/[+]/third_party/blink/renderer/core/editing/.+" - location_regexp: ".+/[+]/third_party/blink/renderer/core/layout/.+" - location_regexp: ".+/[+]/third_party/blink/renderer/core/paint/.+" - location_regexp: ".+/[+]/third_party/blink/renderer/core/svg/.+" - location_regexp: ".+/[+]/third_party/blink/renderer/platform/fonts/shaping/.+" - location_regexp: ".+/[+]/third_party/blink/renderer/platform/graphics/.+" - location_regexp: ".+/[+]/third_party/blink/web_tests/FlagExpectations/enable-blink-features=LayoutNG" - location_regexp: ".+/[+]/third_party/blink/web_tests/flag-specific/enable-blink-features=LayoutNG/.+" - } - builders { - name: "chromium/try/linux_mojo" - location_regexp: ".+/[+]/services/network/.+" - location_regexp: ".+/[+]/testing/buildbot/filters/mojo\\.fyi\\.network_.*" - location_regexp: ".+/[+]/third_party/blink/web_tests/FlagExpectations/enable-features=NetworkService" - } - builders { - name: "chromium/try/linux_optional_gpu_tests_rel" - location_regexp: ".+/[+]/chrome/browser/vr/.+" - location_regexp: ".+/[+]/content/test/gpu/.+" - location_regexp: ".+/[+]/gpu/.+" - location_regexp: ".+/[+]/media/audio/.+" - location_regexp: ".+/[+]/media/filters/.+" - location_regexp: ".+/[+]/media/gpu/.+" - location_regexp: ".+/[+]/testing/trigger_scripts/.+" - location_regexp: ".+/[+]/third_party/blink/renderer/modules/webgl/.+" - location_regexp: ".+/[+]/ui/gl/.+" - } - builders { - name: "chromium/try/linux_vr" - location_regexp: ".+/[+]/chrome/browser/vr/.+" - } - builders { - name: "chromium/try/mac_optional_gpu_tests_rel" - location_regexp: ".+/[+]/chrome/browser/vr/.+" - location_regexp: ".+/[+]/content/test/gpu/.+" - location_regexp: ".+/[+]/gpu/.+" - location_regexp: ".+/[+]/media/audio/.+" - location_regexp: ".+/[+]/media/filters/.+" - location_regexp: ".+/[+]/media/gpu/.+" - location_regexp: ".+/[+]/services/shape_detection/.+" - location_regexp: ".+/[+]/testing/trigger_scripts/.+" - location_regexp: ".+/[+]/third_party/blink/renderer/modules/webgl/.+" - location_regexp: ".+/[+]/ui/gl/.+" - } - builders { - name: "chromium/try/win_optional_gpu_tests_rel" - location_regexp: ".+/[+]/chrome/browser/vr/.+" - location_regexp: ".+/[+]/content/test/gpu/.+" - location_regexp: ".+/[+]/device/vr/.+" - location_regexp: ".+/[+]/gpu/.+" - location_regexp: ".+/[+]/media/audio/.+" - location_regexp: ".+/[+]/media/filters/.+" - location_regexp: ".+/[+]/media/gpu/.+" - location_regexp: ".+/[+]/testing/trigger_scripts/.+" - location_regexp: ".+/[+]/third_party/blink/renderer/modules/vr/.+" - location_regexp: ".+/[+]/third_party/blink/renderer/modules/webgl/.+" - location_regexp: ".+/[+]/third_party/blink/renderer/modules/xr/.+" - location_regexp: ".+/[+]/third_party/blink/renderer/platform/graphics/gpu/.+" - location_regexp: ".+/[+]/ui/gl/.+" - } - - ########################## - # Experimental builders. # - ########################## - - # https://crbug.com/739556; make this non-experimental ASAP. - builders { - name: "chromium/try/ios-device" - experiment_percentage: 10 - } - # https://crbug.com/739556 - builders { - name: "chromium/try/ios-device-xcode-clang" - experiment_percentage: 10 - } - # https://crbug.com/739556 - builders { - name: "chromium/try/ios-simulator-xcode-clang" - experiment_percentage: 10 - } - # https://crbug.com/833482 - builders { - name: "chromium/try/linux-dcheck-off-rel" - experiment_percentage: 10 - } - # https://crbug.com/855319 - builders { - name: "chromium/try/linux-goma-rbe-staging-rel" - experiment_percentage: 40 - } - builders { - name: "chromium/try/win7_chromium_rel_loc_exp" - experiment_percentage: 20 - } - - builders { - name: "*/master.tryserver.chromium.android/android_compile_x64_dbg" - location_regexp: ".+/[+]/sandbox/linux/seccomp-bpf/.+" - location_regexp: ".+/[+]/sandbox/linux/seccomp-bpf-helpers/.+" - location_regexp: ".+/[+]/sandbox/linux/system_headers/.+" - location_regexp: ".+/[+]/sandbox/linux/tests/.+" - } - builders { - name: "*/master.tryserver.chromium.android/android_compile_x86_dbg" - location_regexp: ".+/[+]/sandbox/linux/seccomp-bpf/.+" - location_regexp: ".+/[+]/sandbox/linux/seccomp-bpf-helpers/.+" - location_regexp: ".+/[+]/sandbox/linux/system_headers/.+" - location_regexp: ".+/[+]/sandbox/linux/tests/.+" - } - builders { - name: "*/master.tryserver.chromium.android/android_cronet_tester" - location_regexp: ".+/[+]/components/cronet/.+" - location_regexp: ".+/[+]/components/grpc_support/.+" - location_regexp_exclude: ".+/[+]/components/cronet/ios/.+" - } - retry_config { - single_quota: 1 - global_quota: 2 - failure_weight: 1 - transient_failure_weight: 1 - timeout_weight: 2 - } - } - } -} - -# NOTE: To add a new builder to the commit queue, see -# https://chromium.googlesource.com/chromium/src/+/HEAD/docs/infra/cq.md#how-do-i-add-a-new-builder-to-the-cq
diff --git a/infra/config/global/cq_cfg_presubmit.py b/infra/config/global/cq_cfg_presubmit.py deleted file mode 100755 index 4047d87..0000000 --- a/infra/config/global/cq_cfg_presubmit.py +++ /dev/null
@@ -1,385 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 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. - -import argparse -import difflib -import re -import os -import string -import sys - - -# Path to the root of the current chromium checkout. -CHROMIUM_DIR = os.path.abspath(os.path.join( - os.path.dirname(__file__), '..', '..', '..')) - - -MD_HEADER = """# List of CQ builders - -This page is auto generated using the script -//infra/config/cq_config_presubmit.py. Do not manually edit. - -[TOC] - -Each builder name links to that builder on Milo. The "Backing builders" links -point to the file used to determine which configurations a builder should copy -when running. These links might 404 or error; they are hard-coded right now, -using common assumptions about how builders are configured. -""" - - -REQUIRED_HEADER = """ -These builders must pass before a CL may land.""" - - -OPTIONAL_HEADER = """These builders optionally run, depending on the files in a -CL. For example, a CL which touches `//gpu/BUILD.gn` would trigger the builder -`android_optional_gpu_tests_rel`, due to the `location_regexp` values for that -builder.""" - - -EXPERIMENTAL_HEADER = """ -These builders are run on some percentage of builds. Their results are ignored -by CQ. These are often used to test new configurations before they are added -as required builders.""" - - -BUILDER_VIEW_URL = ( - 'https://ci.chromium.org/p/chromium/builders/luci.chromium.try/') - - -CODE_SEARCH_BASE = 'https://cs.chromium.org/' - - -TRYBOT_SOURCE_URL = CODE_SEARCH_BASE + 'search/?q=file:trybots.py+' - - -CQ_CONFIG_LOCATION_URL = ( - CODE_SEARCH_BASE + 'search/?q=package:%5Echromium$+file:commit-queue.cfg+') - - -REGEX_SEARCH_URL = CODE_SEARCH_BASE + 'search/?q=package:%5Echromium$+' - - -# Location regexps in commit-queue.cfg are expected to have this prefix. -REGEX_PREFIX = r'.+/[+]/' - - -def parse_text_proto_message(lines): - """Parses a text proto. LOW QUALITY, MAY EASILY BREAK. - - If you really need to parse text protos, use the actual python library for - protobufs. This exists because the .proto file for commit-queue.cfg lives in - another repository. - """ - data = {} - - linenum = 0 - # Tracks the current comment. Gets cleared if there's a blank line. Is added - # to submessages, to allow for builders to contain comments. - current_comment = None - while linenum < len(lines): - line = lines[linenum].strip() - if not line: - current_comment = None - linenum += 1 - elif line.startswith('#'): - if current_comment: - current_comment += '\n' + line[1:] - else: - current_comment = line[1:] - linenum += 1 - elif '{' in line: - # Sub message. Put before the ':' clause so that it correctly handles one - # line messages. - end = linenum - count = 0 - newlines = [] - while end < len(lines): - inner_line = lines[end] - if '{' in inner_line: - count += 1 - if '}' in inner_line: - count -= 1 - - if end == linenum: - newline = inner_line.split('{', 1)[1] - if count == 0: - newline = newline.split('}')[0] - newlines.append(newline) - elif count == 0: - newlines.append(inner_line.split('}')[0]) - else: - newlines.append(inner_line) - end += 1 - if count == 0: - break - name = line.split('{')[0].strip() - value = parse_text_proto_message(newlines) - if current_comment: - value['comment'] = current_comment - current_comment = None - - if name in data: - data[name].append(value) - else: - data[name] = [value] - linenum = end - elif ':' in line: - # It's a field - name, value = line.split(':', 1) - value = value.strip() - if value.startswith('"'): - value = value.strip('"') - - if name in data: - data[name].append(value) - else: - data[name] = [value] - linenum += 1 - else: - raise ValueError('Invalid line (number %d):\n%s' % (linenum, line)) - - return data - - -class BuilderList(object): - def __init__(self, builders): - self.builders = builders - - def sort(self): - """Sorts the builder list. - - Sorts the builders in place. Orders them into three groups: experimental, - required, and optional.""" - self.builders.sort(key=lambda b: '%s|%s|%s' % ( - 'z' if b.get('experiment_percentage') else 'a', - 'z' if b.get('location_regexp') else 'a', - b['name'])) - - def by_section(self): - required = [] - experimental = [] - optional = [] - for b in self.builders: - # Don't handle if something is both optional and experimental - if b.get('location_regexp'): - optional.append(b) - elif b.get('experiment_percentage'): - experimental.append(b) - else: - required.append(b) - - return required, optional, experimental - - -class CQConfig(object): - def __init__(self, lines): - parsed_value = parse_text_proto_message(lines) - - # Sanity check. - assert len(parsed_value['config_groups']) == 1, ( - 'Expected only one config group, found %d' % len( - parsed_value['config_groups'])) - grp = parsed_value['config_groups'][0] - gerrit = grp['gerrit'][0] - name = gerrit['projects'][0]['name'][0] - assert name == 'chromium/src', ( - 'Expected first config group to be chromium src, got %s' % name) - # The config group for chromium source refs/heads. - self._config_group = grp - - @staticmethod - def from_file(path): - with open(path) as f: - lines = f.readlines() - - return CQConfig(lines) - - def get_location_regexps(self): - _, opt, _ = self.builder_list().by_section() - for b in opt: - if 'location_regexp' in b: - for reg in b['location_regexp']: - yield reg - if 'location_regexp_exclude' in b: - for reg in b['location_regexp_exclude']: - yield reg - - def builder_list(self): - """Returns a list of builders.""" - items = [] - for b in self._config_group['verifiers'][0]['tryjob'][0]['builders']: - if not b['name'][0].startswith('chromium'): - # Buildbot builders, just ignore. - continue - items.append(b) - return BuilderList(items) - - def get_markdown_doc(self): - lines = [] - for l in MD_HEADER.split('\n'): - lines.append(l) - - bl = self.builder_list() - req, opt, exp = bl.by_section() - for title, header, builders in ( - ('Required builders', REQUIRED_HEADER, req), - ('Optional builders', OPTIONAL_HEADER, opt), - ('Experimental builders', EXPERIMENTAL_HEADER, exp), - ): - lines.append('## %s' % title) - lines.append('') - for l in header.strip().split('\n'): - lines.append(l) - lines.append('') - for b in builders: - buildername = b['name'][0].split('/')[-1] - lines.append( - '* [%s](%s) ([`commit-queue.cfg` entry](%s)) ' - '([matching builders](%s))' % ( - buildername, BUILDER_VIEW_URL + buildername, - CQ_CONFIG_LOCATION_URL + b['name'][0], - TRYBOT_SOURCE_URL + buildername)) - lines.append('') - if 'comment' in b: - for l in b['comment'].split('\n'): - lines.append(' ' + l.strip()) - lines.append('') - if 'location_regexp' in b: - lines.append(' Path regular expressions:') - for regex in b['location_regexp']: - url = None - if regex.startswith(REGEX_PREFIX): - regex = regex[len(REGEX_PREFIX):] - regex_title = '//' + regex.lstrip('/') - if regex.endswith('.+'): - regex = regex[:-len('.+')] - if all( - # Equals sign and dashes used by layout tests. - c in string.ascii_letters + string.digits + '/-_=' - for c in regex): - # Assume the regex is targeting a single path, direct link to - # it. Check to make sure we don't have weird characters, like - # ()|, which could mean it's a regex. - url = CODE_SEARCH_BASE + 'chromium/src/' + regex - lines.append(' * [`%s`](%s)' % ( - regex_title, url or REGEX_SEARCH_URL + 'file:' + regex)) - lines.append('') - if 'experiment_percentage' in b: - lines.append(' * Experimental percentage: %s' % ( - b['experiment_percentage'][0])) - lines.append('') - lines.append('') - - return '\n'.join(lines) - -def verify_location_regexps(regexps, verbose=True): - # Verify that all the regexps listed in the file have files which they could - # be triggered by. Failing this usually means they're old, and the code was - # moved somewhere, like the webkit->blink rename. - invalid_regexp = False - for regexp in regexps: - regexp = regexp.replace('\\\\', '') - assert regexp.startswith(REGEX_PREFIX) - regexp = regexp[len(REGEX_PREFIX):] - # Split by path name, so that we don't have to run os.walk on the entire - # source tree. commit-queue.cfg always uses '/' as the path separator. - parts = regexp.split('/') - # Dash and equal sign are used by layout tests. - simple_name_re = re.compile(r'^[a-zA-Z0-9_\-=]*$') - last_normal_path = 0 - while last_normal_path < len(parts): - itm = parts[last_normal_path] - if not simple_name_re.match(itm): - break - last_normal_path += 1 - path_to_search = ( - os.path.join(*parts[:last_normal_path]) if last_normal_path else '') - # Simple case. Regexp is just referencing a single file. Just check if the - # file exists. - if path_to_search == os.path.join(*parts) and os.path.exists( - os.path.join(CHROMIUM_DIR, path_to_search)): - continue - - if os.path.sep != '/': - # Regular expressions require backslashes to be escaped. Need to double - # escape it, since the path itself has a double backslash. - regexp = regexp.replace('/', '\\\\') - compiled_regexp = re.compile(regexp) - found = False - for root, _, files in os.walk(os.path.join(CHROMIUM_DIR, path_to_search)): - for fname in files: - fullname = os.path.relpath(os.path.join(root, fname), CHROMIUM_DIR) - if compiled_regexp.match(fullname): - found = True - break - if found: - break - if not found: - if verbose: - print ( - 'Regexp %s appears to have no valid files which could match it.' % ( - regexp)) - invalid_regexp = True - - return not invalid_regexp - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument( - '-c', '--check', action='store_true', help= - 'Do consistency checks of commit-queue.cfg and generated files. Used ' - 'during presubmit. Causes the tool to not generate any files.') - args = parser.parse_args() - - exit_code = 0 - - cfg = CQConfig.from_file(os.path.join( - CHROMIUM_DIR, 'infra', 'config', 'global', 'commit-queue.cfg')) - - # Only force sorting on luci.chromium.try builders. Others should go away soon - # anyways... - bl = cfg.builder_list() - assert len(bl.builders) > 0, ( - 'Builders in \'luci.chromium.try\' bucket are missing somehow...') - names = [b['name'][0] for b in bl.builders] - bl.sort() # Changes the bl, so the next line is sorted. - sorted_names = [b['name'][0] for b in bl.builders] - if sorted_names != names: - print 'ERROR: commit-queue.cfg is unsorted.', - if args.check: - print - else: - print ' Please sort as follows:' - for line in difflib.unified_diff( - names, - sorted_names, fromfile='current', tofile='sorted'): - print line - exit_code = 1 - - if args.check: - if not verify_location_regexps(cfg.get_location_regexps()): - exit_code = 1 - - with open(os.path.join( - CHROMIUM_DIR, 'docs', 'infra', 'cq_builders.md')) as f: - if cfg.get_markdown_doc() != f.read(): - print ( - 'Markdown file is out of date. Please run ' - '`//infra/config/global/cq_cfg_presubmit.py` to regenerate the ' - 'docs.') - exit_code = 1 - else: - with open(os.path.join( - CHROMIUM_DIR, 'docs', 'infra', 'cq_builders.md'), 'w') as f: - f.write(cfg.get_markdown_doc()) - - return exit_code - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/infra/config/global/cq_cfg_presubmit_unittest.py b/infra/config/global/cq_cfg_presubmit_unittest.py deleted file mode 100755 index 032d5ae..0000000 --- a/infra/config/global/cq_cfg_presubmit_unittest.py +++ /dev/null
@@ -1,50 +0,0 @@ -#!/usr/bin/env vpython -# Copyright (c) 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. -"""Tests for cq_cfg_presubmit.""" - -import mock -import os -import unittest - -import cq_cfg_presubmit - - -class CqCfgPresubmitTest(unittest.TestCase): - def test_verify_location_regexp_exists(self): - with mock.patch('cq_cfg_presubmit.os.path.exists') as exists: - exists.side_effect = [True] - self.assertTrue(cq_cfg_presubmit.verify_location_regexps([ - cq_cfg_presubmit.REGEX_PREFIX + 'simple/file', - ])) - - def test_verify_location_regexp_os_walk_found(self): - with mock.patch('cq_cfg_presubmit.os.walk') as walk: - walk.side_effect = [( - (os.path.join(cq_cfg_presubmit.CHROMIUM_DIR, 'random'), - None, ['test.txt'],), - (os.path.join(cq_cfg_presubmit.CHROMIUM_DIR, 'simple', 'file'), - None, ['test.txt'],), - )] - with mock.patch('cq_cfg_presubmit.os.path.exists') as exists: - exists.side_effect = [False] - self.assertTrue(cq_cfg_presubmit.verify_location_regexps([ - cq_cfg_presubmit.REGEX_PREFIX + 'simple/file/.+', - ], False)) - - def test_verify_location_regexp_os_walk_not_found(self): - with mock.patch('cq_cfg_presubmit.os.walk') as walk: - walk.side_effect = [( - (os.path.join(cq_cfg_presubmit.CHROMIUM_DIR, 'random'), - None, ['test.txt'],), - )] - with mock.patch('cq_cfg_presubmit.os.path.exists') as exists: - exists.side_effect = [False] - self.assertFalse(cq_cfg_presubmit.verify_location_regexps([ - cq_cfg_presubmit.REGEX_PREFIX + 'simple/file/.+', - ], False)) - - -if __name__ == '__main__': - unittest.main()
diff --git a/infra/config/global/cr-buildbucket-dev.cfg b/infra/config/global/cr-buildbucket-dev.cfg deleted file mode 100644 index b0458cc..0000000 --- a/infra/config/global/cr-buildbucket-dev.cfg +++ /dev/null
@@ -1,126 +0,0 @@ -# Defines buckets on cr-buildbucket-dev.appspot.com, used by to schedule builds -# on buildbot. In particular, CQ uses some of these buckets to schedule tryjobs. -# -# See http://luci-config.appspot.com/schemas/projects:buildbucket.cfg for -# schema of this file and documentation. Also see README.md in this dir. -# -# Please keep this list sorted by bucket name. - -acl_sets { - # This is pure-LUCI w/o buildbot. - name: "default" - acls { - role: READER - group: "all" - } - acls { - role: SCHEDULER - identity: "luci-scheduler-dev@appspot.gserviceaccount.com" - } -} - -builder_mixins { - name: "swarm-ci" - dimensions: "cpu:x86-64" - recipe { - name: "swarming/staging" - properties: "mastername:chromium.swarm" - } -} - -buckets { - name: "luci.chromium.ci" - - acl_sets: "default" - acls { - role: SCHEDULER - # Support builder triggering other builders in the same bucket. - identity: "chromium-ci-builder-dev@chops-service-accounts.iam.gserviceaccount.com" - } - acls { - # Allow task force to bump next build number. - role: WRITER - group: "google/luci-task-force@google.com" - } - - swarming { - hostname: "chromium-swarm-dev.appspot.com" - - builder_defaults { - category: "Chromium" - execution_timeout_secs: 10800 # 3h - service_account: "chromium-ci-builder-dev@chops-service-accounts.iam.gserviceaccount.com" - build_numbers: YES - recipe { - cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" - cipd_version: "refs/heads/master" - name: "chromium" - } - } - builders { - name: "Android N5 Swarm" - dimensions: "os:Ubuntu-14.04" - mixins: "swarm-ci" - } - builders { - name: "Android N5X Swarm" - dimensions: "os:Ubuntu-14.04" - mixins: "swarm-ci" - } - builders { - name: "ChromeOS Swarm" - dimensions: "os:Ubuntu-14.04" - mixins: "swarm-ci" - } - builders { - name: "Linux Swarm" - dimensions: "os:Ubuntu-14.04" - mixins: "swarm-ci" - } - builders { - name: "Mac Swarm" - dimensions: "os:Mac-10.13" - mixins: "swarm-ci" - } - builders { - name: "Windows Swarm" - dimensions: "os:Windows-10" - mixins: "swarm-ci" - } - } -} - -buckets { - name: "luci.chromium.cron" - acl_sets: "default" - acls { - role: SCHEDULER - identity: "snapshot-builder@chops-service-accounts.iam.gserviceaccount.com" - } - - swarming { - hostname: "chromium-swarm-dev.appspot.com" - - builders { - name: "Snapshot Builder" - dimensions: "os:Ubuntu-14.04" - execution_timeout_secs: 3600 - service_account: "snapshot-builder@chops-service-accounts.iam.gserviceaccount.com" - recipe { - cipd_package: "infra/recipe_bundles/chromium.googlesource.com/infra/infra" - cipd_version: "refs/heads/master" - name: "snapshots/builder" - } - } - - builders { - name: "Snapshots" - execution_timeout_secs: 3600 - recipe { - cipd_package: "infra/recipe_bundles/chromium.googlesource.com/infra/infra" - cipd_version: "refs/heads/master" - name: "snapshots/snapshot" - } - } - } -}
diff --git a/infra/config/global/cr-buildbucket.cfg b/infra/config/global/cr-buildbucket.cfg deleted file mode 100644 index ead39111..0000000 --- a/infra/config/global/cr-buildbucket.cfg +++ /dev/null
@@ -1,3673 +0,0 @@ -# Defines buckets on cr-buildbucket.appspot.com, used by to schedule builds -# on buildbot. In particular, CQ uses some of these buckets to schedule tryjobs. -# -# See http://luci-config.appspot.com/schemas/projects:buildbucket.cfg for -# schema of this file and documentation. Also see README.md in this dir. -# -# Please keep this list sorted by bucket name. - -acl_sets { - name: "waterfall" - acls { - role: READER - group: "all" - } - acls { - role: SCHEDULER - identity: "luci-scheduler@appspot.gserviceaccount.com" - } - acls { - role: WRITER - group: "service-account-chromium-master" - } -} - -acl_sets { - # This is pure-LUCI CI w/o buildbot. - name: "ci" - acls { - role: READER - group: "all" - } - acls { - role: SCHEDULER - identity: "luci-scheduler@appspot.gserviceaccount.com" - } - acls { - role: SCHEDULER - # Support builder triggering other builders in the same bucket. - identity: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" - } - acls { - # Allow task force to bump next build number. - role: WRITER - group: "google/luci-task-force@google.com" - } - acls { - # Allow luci-migration to bump next build number. - role: WRITER - identity: "luci-migration@appspot.gserviceaccount.com" - } -} - -acl_sets { - name: "tryserver" - acls { - role: READER - group: "all" - } - acls { - role: SCHEDULER - group: "project-chromium-tryjob-access" - } - acls { - role: SCHEDULER - group: "service-account-cq" - } - acls { - role: SCHEDULER - identity: "findit-for-me@appspot.gserviceaccount.com" - } - acls { - role: WRITER - group: "service-account-chromium-tryserver" - } - acls { - # Allow luci-migration to bump next build number. - role: WRITER - identity: "luci-migration@appspot.gserviceaccount.com" - } -} - -# CI builders (of which are few) may use high number of concurrent Goma jobs. -builder_mixins { - name: "goma-many-jobs-for-ci" - # IMPORTANT: when - # * bumping number of jobs below, or - # * adding this mixin to many builders at once, or - # * adding this mixin to a builder with many concurrent builds - # get review from Goma team. - recipe { - properties_j: "$build/goma:{\"jobs\": 500}" - } -} - -# This is for tryservers becoming slow and critical path of patch landing. -builder_mixins { - name: "goma-j150" - recipe { - properties_j: <<END - $build/goma: { - "jobs": 150 - } - END - } -} - -# This is for tryservers becoming very slow and critical path of patch landing. -builder_mixins { - name: "goma-j300" - recipe { - properties_j: <<END - $build/goma: { - "jobs": 300 - } - END - } -} - -# This is for 4 cores mac. -j40 is too small, especially for clobber builder. -builder_mixins { - name: "goma-j80" - recipe { - properties_j: <<END - $build/goma: { - "jobs": 80 - } - END - } -} - -builder_mixins { - name: "android" - dimensions: "os:Android" -} - -# The following android mixins don't nest the required swarming dimensions -# since some android recipes expect to run on machines with devices attached -# (os:Android) and some expect to run on device-less linux machines (os:Ubuntu) -builder_mixins { - name: "android-try" - recipe { - properties: "mastername:tryserver.chromium.android" - } -} -builder_mixins { - name: "android-ci" - # TODO(tandrii): migrate to this gradually (current value of - # goma-many-jobs-for-ci is 500). - # mixins: "goma-many-jobs-for-ci" - recipe { - properties: "mastername:chromium.android" - properties_j: "$build/goma:{\"jobs\": 150}" - } -} - -builder_mixins { - # We have limited tablet capacity and thus limited ability to run - # tests in parallel, hence the high timeout. - name: "android-tablet-ci" - execution_timeout_secs: 28800 # 8 hours -} - -builder_mixins { - name: "android-fyi-ci" - recipe { - properties: "mastername:chromium.android.fyi" - } -} - -builder_mixins { - name: "android-angle-try" - dimensions: "os:Ubuntu-14.04" - mixins: "angle-try" -} - -builder_mixins { - name: "android-gpu-ci" - dimensions: "os:Ubuntu-14.04" - recipe { - properties: "mastername:chromium.gpu" - } -} - -builder_mixins { - name: "android-gpu-fyi-ci" - dimensions: "os:Ubuntu-14.04" - mixins: "gpu-fyi-ci" -} - -builder_mixins { - name: "android-gpu-manual-try" - mixins: "android-optional-gpu-try" - # Increase timeout to allow tryjobs against small number of phones. - mixins: "gpu-slow-bot" -} - -builder_mixins { - name: "android-optional-gpu-try" - dimensions: "os:Ubuntu-14.04" - mixins: "gpu-optional-try" - mixins: "android-try" -} - -builder_mixins { - name: "angle-try" - service_account: "chromium-try-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" - recipe { - properties: "mastername:tryserver.chromium.angle" - } -} - -builder_mixins { - name: "blink-try" - recipe { - properties: "mastername:tryserver.blink" - } -} - -builder_mixins { - name: "clang-ci" - dimensions: "cores:" # Mac uses 24 cores, Linux/Win uses 32 cores. - # Because these run ToT Clang, goma is not used. - # Naturally the runtime will be ~4-8h on average, depending on config. - # CFI builds will take even longer - around 11h. - execution_timeout_secs: 43200 # 12h. - recipe { - properties: "mastername:chromium.clang" - # Used for the "sizes" step. - properties: "perf_dashboard_machine_group:ChromiumClang" - } -} - -builder_mixins { - name: "clang-coverage" - recipe { - name: "chromium_clang_coverage_tot" - } -} - -builder_mixins { - name: "chromedriver-ci" - recipe { - properties: "mastername:chromium.chromedriver" - } -} - -builder_mixins { - name: "chromeos-ci" - # All CrOS building is done via cross-compilation on linux hosts, so use the - # linux mixin. - mixins: "linux" - recipe { - properties: "mastername:chromium.chromiumos" - } -} - -builder_mixins { - name: "chromeos-try" - # All CrOS building is done via cross-compilation on linux hosts, so use the - # linux mixin. - mixins: "linux" - recipe { - properties: "mastername:tryserver.chromium.chromiumos" - } -} - -builder_mixins { - name: "chromium-ci" - recipe { - properties: "mastername:chromium" - } -} - -builder_mixins { - name: "code-coverage" - recipe { - name: "chromium" - } - mixins: "fyi-ci" - execution_timeout_secs: 72000 # 20h - service_account: "chromium-code-coverage-builder@chops-service-accounts.iam.gserviceaccount.com" -} - -builder_mixins { - name: "dawn-try" - service_account: "chromium-try-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" - recipe { - properties: "mastername:tryserver.chromium.dawn" - } -} - -builder_mixins { - name: "fuzz-ci" - recipe { - properties: "mastername:chromium.fuzz" - } -} - -builder_mixins { - name: "fyi-ci" - recipe { - properties: "mastername:chromium.fyi" - } - execution_timeout_secs: 36000 # 10h -} - -builder_mixins { - name: "libfuzzer" - recipe { - name: "chromium_libfuzzer" - } -} - -builder_mixins { - name: "deterministic" - recipe { - name: "swarming/deterministic_build" - } -} - -builder_mixins { - name: "goma-ci" - recipe { - properties: "mastername:chromium.goma" - } -} - -builder_mixins { - name: "experimental" - experimental: YES - luci_migration_host: "-" -} - -builder_mixins { - name: "gpu-fyi-ci" - service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" - recipe { - properties: "mastername:chromium.gpu.fyi" - } -} - -builder_mixins { - name: "gpu-optional-try" - service_account: "chromium-try-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" -} - -builder_mixins { - name: "linux" - dimensions: "os:Ubuntu-14.04" -} - -builder_mixins { - name: "linux-angle-try" - mixins: "linux" - mixins: "angle-try" -} - -builder_mixins { - name: "linux-dawn-try" - mixins: "linux" - mixins: "dawn-try" -} - -builder_mixins { - name: "linux-debug-cache" - caches: { - name: "builder" - path: "linux_debug" - } -} - -builder_mixins { - name: "linux-optional-gpu-try" - mixins: "linux" - mixins: "gpu-optional-try" - recipe { - properties: "mastername:tryserver.chromium.linux" - } -} - -builder_mixins { - name: "linux-try" - mixins: "linux" - recipe { - properties: "mastername:tryserver.chromium.linux" - } -} - -builder_mixins { - name: "memory-ci" - mixins: "goma-many-jobs-for-ci" - recipe { - properties: "mastername:chromium.memory" - } -} - -builder_mixins { - name: "linux-ci" - mixins: "linux" - mixins: "goma-many-jobs-for-ci" - recipe { - properties: "mastername:chromium.linux" - } -} - -builder_mixins { - name: "linux-gpu-ci" - mixins: "linux" - recipe { - properties: "mastername:chromium.gpu" - } -} - -builder_mixins { - name: "linux-gpu-fyi-ci" - mixins: "linux" - mixins: "gpu-fyi-ci" -} - -builder_mixins { - name: "mac" - dimensions: "os:Mac" - # Macs tend to have a variety of cores. - # Mac Minis - 4 cores. - # Mac VMs - 8 cores. - # Mac Pros - 24 cores. - # Pools often mix Minis and VMs together. - # Remove the cores dimensions for this mixin so that mixed pools work. - # This works here only because we use auto_builder_dimensions, - # so that only the bots that were earmarked for the builders - # will be allowed to use them anyways. - dimensions: "cores:" -} - -builder_mixins { - name: "mac-angle-try" - mixins: "mac" - mixins: "angle-try" - dimensions: "cores:4" -} - -builder_mixins { - name: "mac-dawn-try" - mixins: "mac" - mixins: "dawn-try" -} - -builder_mixins { - name: "mac-optional-gpu-try" - mixins: "mac" - mixins: "gpu-optional-try" - recipe { - properties: "mastername:tryserver.chromium.mac" - } -} - -builder_mixins { - name: "mac-try" - mixins: "mac" - # mac bots may run both on Mac Minis with cores:4 and VMs with cores:8. - dimensions: "cores:" - recipe { - properties: "mastername:tryserver.chromium.mac" - } -} - -builder_mixins { - name: "mac-ci" - mixins: "mac" - recipe { - properties: "mastername:chromium.mac" - } -} - -builder_mixins { - name: "xcode-caches" - caches: { - # Cache for Xcode 10.1 (build version 10b61) needed for iOS builds. - name: "xcode_ios_10b61" - path: "xcode_ios_10b61.app" - } -} - -builder_mixins { - name: "ios" - mixins: "mac" - mixins: "xcode-caches" -} - -builder_mixins { - name: "ios-ci" - mixins: "ios" - mixins: "mac-ci" - # ios bots may run both on Mac Minis with cores:4 and VMs with cores:8. - dimensions: "cores:" - recipe { - name: "ios/unified_builder_tester" - } -} - -builder_mixins { - name: "ios-try" - mixins: "ios" - mixins: "mac-try" - recipe { - name: "ios/try" - } -} - -builder_mixins { - name: "ios-webrtc" - dimensions: "os:Mac" - recipe { name: "webrtc/chromium_ios" } -} - -builder_mixins { - name: "mac-gpu-ci" - mixins: "mac" - recipe { - properties: "mastername:chromium.gpu" - } -} - -builder_mixins { - name: "mac-gpu-fyi-ci" - mixins: "mac" - mixins: "gpu-fyi-ci" - dimensions: "cores:4" -} - -builder_mixins { - name: "win" - dimensions: "os:Windows" -} - -builder_mixins { - name: "win-angle-try" - mixins: "win" - mixins: "angle-try" -} - -builder_mixins { - name: "win-optional-gpu-try" - mixins: "win" - mixins: "gpu-optional-try" - recipe { - properties: "mastername:tryserver.chromium.win" - } -} - -builder_mixins { - name: "win-try" - mixins: "win" - recipe { - properties: "mastername:tryserver.chromium.win" - } -} - -builder_mixins { - name: "win-ci" - mixins: "win" - recipe { - properties: "mastername:chromium.win" - } -} - -builder_mixins { - name: "win-dawn-try" - mixins: "win" - mixins: "dawn-try" -} - -builder_mixins { - name: "win-gpu-ci" - mixins: "win" - recipe { - properties: "mastername:chromium.gpu" - } -} - -# GPU bots sometimes run very long tests on a small number of machines -# or even a single tester. The regular timeout isn't enough on some of -# these so double the standard timeout. -builder_mixins { - name: "gpu-slow-bot" - execution_timeout_secs: 21600 # 2 x 3h for a double workload -} - -builder_mixins { - name: "win-gpu-fyi-ci" - mixins: "win" - mixins: "gpu-fyi-ci" - mixins: "gpu-slow-bot" -} - -builder_mixins { - name: "findit" - mixins: "goma-many-jobs-for-ci" - # This category is meant for Findit to trigger tryjobs on. - category: "Chromium Variable" - recipe { - name: "findit/chromium/compile" - } -} - -builder_mixins { - name: "upload_clang" - recipe { - name: "chromium_upload_clang" - } -} - -buckets { - name: "ci" - acl_sets: "ci" - - swarming { - hostname: "chromium-swarm.appspot.com" - builder_defaults { - dimensions: "cores:8" - dimensions: "cpu:x86-64" - service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" - execution_timeout_secs: 10800 # 3h - swarming_tags: "vpython:native-python-wrapper" - build_numbers: YES - # Adds dimension: "builder:<builder name>" to ensure builder affinity. - # To "assign" a bot to a builder, bot config of swarming service should - # add the same dimension to the bot. - auto_builder_dimension: YES - luci_migration_host: "luci-migration.appspot.com" - recipe { - cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" - cipd_version: "refs/heads/master" - name: "chromium" - properties_j: "$kitchen:{\"git_auth\": true, \"devshell\": true}" - } - } - - # Keep builders sorted by target OS, then name. - - # Android bots. - builders { - name: "Android arm Builder (dbg)" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - execution_timeout_secs: 14400 # 4h - } - - builders { - name: "Android arm64 Builder (dbg)" - mixins: "android-ci" - mixins: "goma-many-jobs-for-ci" - dimensions: "os:Ubuntu-14.04" - execution_timeout_secs: 14400 # 4h - } - - builders { - name: "Android ASAN (dbg)" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "Android Cronet Builder" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "Android FYI 32 dEQP Vk Release (Nexus 5X)" - mixins: "android-gpu-fyi-ci" - } - - builders { - name: "Android FYI 32 dEQP Vk Release (Pixel 2)" - mixins: "android-gpu-fyi-ci" - # Increase timeout to allow tryjobs against small number of phones. - mixins: "gpu-slow-bot" - } - - builders { - name: "Android FYI 32 dEQP Vk Release (Pixel XL)" - mixins: "android-gpu-fyi-ci" - # Increase timeout to allow tryjobs against small number of phones. - mixins: "gpu-slow-bot" - } - - builders { - name: "Android FYI 32 Vk Release (Nexus 5X)" - mixins: "android-gpu-fyi-ci" - } - - builders { - name: "Android FYI 32 Vk Release (Pixel 2)" - mixins: "android-gpu-fyi-ci" - # Increase timeout to allow tryjobs against small number of phones. - mixins: "gpu-slow-bot" - } - - builders { - name: "Android FYI 32 Vk Release (Pixel XL)" - mixins: "android-gpu-fyi-ci" - # Increase timeout to allow tryjobs against small number of phones. - mixins: "gpu-slow-bot" - } - - builders { - name: "Android FYI 64 dEQP Vk Release (Nexus 5X)" - mixins: "android-gpu-fyi-ci" - } - - builders { - name: "Android FYI 64 dEQP Vk Release (Pixel 2)" - mixins: "android-gpu-fyi-ci" - # Increase timeout to allow tryjobs against small number of phones. - mixins: "gpu-slow-bot" - } - - builders { - name: "Android FYI 64 dEQP Vk Release (Pixel XL)" - mixins: "android-gpu-fyi-ci" - # Increase timeout to allow tryjobs against small number of phones. - mixins: "gpu-slow-bot" - } - - builders { - name: "Android FYI 64 Vk Release (Nexus 5X)" - mixins: "android-gpu-fyi-ci" - } - - builders { - name: "Android FYI 64 Vk Release (Pixel 2)" - mixins: "android-gpu-fyi-ci" - # Increase timeout to allow tryjobs against small number of phones. - mixins: "gpu-slow-bot" - } - - builders { - name: "Android FYI 64 Vk Release (Pixel XL)" - mixins: "android-gpu-fyi-ci" - # Increase timeout to allow tryjobs against small number of phones. - mixins: "gpu-slow-bot" - } - - builders { - name: "Android FYI dEQP Release (Nexus 5X)" - mixins: "android-gpu-fyi-ci" - } - - builders { - name: "Android FYI Release (Nexus 5)" - mixins: "android-gpu-fyi-ci" - # Increase timeout to allow tryjobs against small number of phones. - mixins: "gpu-slow-bot" - } - - builders { - name: "Android FYI Release (Nexus 5X)" - mixins: "android-gpu-fyi-ci" - } - - builders { - name: "Android FYI Release (Nexus 6)" - mixins: "android-gpu-fyi-ci" - # Increase timeout to allow tryjobs against small number of phones. - mixins: "gpu-slow-bot" - } - - builders { - name: "Android FYI Release (Nexus 6P)" - mixins: "android-gpu-fyi-ci" - # Increase timeout to allow tryjobs against small number of phones. - mixins: "gpu-slow-bot" - } - - builders { - name: "Android FYI Release (Nexus 9)" - mixins: "android-gpu-fyi-ci" - # Increase timeout to allow tryjobs against small number of phones. - mixins: "gpu-slow-bot" - } - - builders { - name: "Android FYI Release (NVIDIA Shield TV)" - mixins: "android-gpu-fyi-ci" - # Increase timeout to allow tryjobs against small number of phones. - mixins: "gpu-slow-bot" - } - - builders { - name: "Android Release (Nexus 5X)" - mixins: "android-gpu-ci" - } - - builders { - name: "Android Tests (trial)(dbg)" - mixins: "android-fyi-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "Android Tests with Tracing" - mixins: "android-fyi-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "Android WebView L (dbg)" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "Android WebView M (dbg)" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "Android WebView N (dbg)" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "Android WebView O (dbg)" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "Android WebView O NetworkService (dbg)" - mixins: "android-fyi-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "Android x64 Builder (dbg)" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - execution_timeout_secs: 14400 # 4h - } - - builders { - name: "Android x86 Builder (dbg)" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "android-cronet-arm-dbg" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "android-cronet-arm-rel" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "android-cronet-arm64-dbg" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "android-cronet-arm64-rel" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "android-cronet-asan-arm-rel" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "android-cronet-kitkat-arm-rel" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "android-cronet-lollipop-arm-rel" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "android-cronet-marshmallow-arm64-rel" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "android-cronet-x86-dbg" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "android-cronet-x86-rel" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "android-incremental-dbg" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "android-jumbo-rel" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "android-kitkat-arm-rel" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "android-marshmallow-arm64-rel" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "android-mojo-webview-rel" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - - builders { - name: "Cast Android (dbg)" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "Deterministic Android" - mixins: "deterministic" - mixins: "android-ci" - } - - builders { - name: "Deterministic Android (dbg)" - mixins: "deterministic" - mixins: "android-ci" - } - - builders { - name: "Jelly Bean Tester" - mixins: "android-fyi-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "KitKat Phone Tester (dbg)" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "KitKat Tablet Tester" - mixins: "android-ci" - mixins: "android-tablet-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "Lollipop Low-end Tester" - mixins: "android-fyi-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "Lollipop Phone Tester" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "Lollipop Tablet Tester" - mixins: "android-ci" - mixins: "android-tablet-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "Marshmallow 64 bit Tester" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "Marshmallow Tablet Tester" - mixins: "android-ci" - mixins: "android-tablet-ci" - dimensions: "os:Ubuntu-14.04" - } - - builders { - name: "Nougat Phone Tester" - mixins: "android-ci" - dimensions: "os:Ubuntu-14.04" - } - - # ChromeOS bots. - builders { - name: "chromeos-amd64-generic-cfi-thin-lto-rel" - mixins: "chromeos-ci" - } - - builders { - name: "chromeos-amd64-generic-rel" - mixins: "chromeos-ci" - } - - builders { - name: "chromeos-amd64-generic-rel-vm-tests" - mixins: "fyi-ci" - mixins: "linux" - } - - builders { - name: "chromeos-kevin-rel-hw-tests" - mixins: "fyi-ci" - mixins: "linux" - } - - builders { - name: "chromeos-daisy-rel" - mixins: "chromeos-ci" - } - - builders { - name: "linux-chromeos-dbg" - mixins: "chromeos-ci" - } - - builders { - name: "linux-chromeos-rel" - mixins: "chromeos-ci" - } - - builders { - name: "Linux ChromiumOS Full" - mixins: "chromeos-ci" - } - - # Fuchsia bots. - builders { - name: "Fuchsia ARM64" - mixins: "linux-ci" - } - - builders { - name: "fuchsia-arm64-cast" - mixins: "linux-ci" - } - - builders { - name: "Fuchsia x64" - mixins: "linux-ci" - } - - builders { - name: "fuchsia-x64-cast" - mixins: "linux-ci" - } - - builders { - name: "fuchsia-fyi-arm64-rel" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - - builders { - name: "fuchsia-fyi-x64-dbg" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - - builders { - name: "fuchsia-fyi-x64-rel" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - - # Linux bots. - builders { - name: "Cast Audio Linux" - mixins: "linux-ci" - } - - builders { - name: "Cast Linux" - mixins: "linux-ci" - recipe { - properties_j: "$build/goma:{\"jobs\": 50}" - } - } - - builders { - name: "Deterministic Linux" - mixins: "deterministic" - mixins: "linux-ci" - } - - builders { - name: "Deterministic Linux (dbg)" - mixins: "deterministic" - mixins: "linux-ci" - } - - builders { - name: "Leak Detection Linux" - mixins: "linux-ci" - } - - builders { - name: "Linux ASan LSan Builder" - mixins: "linux" - mixins: "memory-ci" - } - - builders { - name: "Linux ASan LSan Tests (1)" - mixins: "linux" - mixins: "memory-ci" - } - - builders { - name: "Linux ASan Tests (sandboxed)" - mixins: "linux" - mixins: "memory-ci" - } - - builders { - name: "Linux Builder" - mixins: "linux-ci" - dimensions: "cores:32" - } - - builders { - name: "Linux Tests" - mixins: "linux-ci" - } - - builders { - name: "linux-blink-animation-use-time-delta" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - - builders { - name: "linux-blink-heap-incremental-marking" - mixins: "fyi-ci" - mixins: "linux" - } - - builders { - name: "linux-blink-heap-verification" - mixins: "fyi-ci" - mixins: "linux" - } - - builders { - name: "linux-blink-heap-unified-gc" - mixins: "fyi-ci" - mixins: "linux" - } - - builders { - name: "linux_chromium_component_updater" - mixins: "linux-ci" - recipe { - name: "findit/chromium/update_components" - } - service_account: "component-mapping-updater@chops-service-accounts.iam.gserviceaccount.com" - } - - builders { - name: "linux-chromium-tests-staging-builder" - mixins: "fyi-ci" - mixins: "linux" - } - - builders { - name: "linux-chromium-tests-staging-tests" - mixins: "fyi-ci" - mixins: "linux" - } - - builders { - name: "linux-gcc-rel" - mixins: "linux-ci" - } - - builders { - name: "linux-jumbo-rel" - mixins: "linux-ci" - } - - builders { - name: "linux-ozone-rel" - mixins: "linux-ci" - } - - builders { - name: "linux-xenial-rel" - mixins: "goma-many-jobs-for-ci" - dimensions: "os:Ubuntu-16.04" - recipe { - properties: "mastername:chromium.linux" - } - } - - builders { - name: "Linux Builder (dbg)" - mixins: "linux-ci" - dimensions: "cores:32" - } - - builders { - name: "Linux Builder (dbg)(32)" - mixins: "linux-ci" - dimensions: "cores:32" - } - - builders { - name: "Linux Tests (dbg)(1)" - mixins: "linux-ci" - } - - builders { - name: "Linux Tests (dbg)(1)(32)" - mixins: "linux-ci" - } - - builders { - name: "Linux TSan Builder" - mixins: "linux" - mixins: "memory-ci" - } - - builders { - name: "Linux TSan Tests" - mixins: "linux" - mixins: "memory-ci" - } - - # chromium.gpu - builders { - name: "GPU Linux Builder" - mixins: "linux-gpu-ci" - } - - builders { - name: "GPU Linux Builder (dbg)" - mixins: "linux-gpu-ci" - } - - builders { - name: "Linux Debug (NVIDIA)" - mixins: "linux-gpu-ci" - } - - builders { - name: "Linux Release (NVIDIA)" - mixins: "linux-gpu-ci" - } - - # chromium.gpu.fyi - builders { - name: "GPU FYI Linux Builder" - mixins: "linux-gpu-fyi-ci" - } - - builders { - name: "GPU FYI Linux Builder (dbg)" - mixins: "linux-gpu-fyi-ci" - } - - builders { - name: "GPU FYI Linux Ozone Builder" - mixins: "linux-gpu-fyi-ci" - } - - builders { - name: "GPU FYI Linux dEQP Builder" - mixins: "linux-gpu-fyi-ci" - } - - builders { - name: "Linux FYI Experimental Release (Intel HD 630)" - mixins: "gpu-slow-bot" - mixins: "linux-gpu-fyi-ci" - } - - builders { - name: "Linux FYI Release (NVIDIA)" - mixins: "linux-gpu-fyi-ci" - } - - builders { - name: "Linux FYI Experimental Release (NVIDIA)" - mixins: "linux-gpu-fyi-ci" - } - - builders { - name: "Linux FYI Debug (NVIDIA)" - mixins: "linux-gpu-fyi-ci" - } - - builders { - name: "Linux FYI dEQP Release (NVIDIA)" - mixins: "linux-gpu-fyi-ci" - } - - builders { - name: "Linux FYI Release (Intel HD 630)" - mixins: "linux-gpu-fyi-ci" - } - - builders { - name: "Linux FYI dEQP Release (Intel HD 630)" - mixins: "linux-gpu-fyi-ci" - } - - builders { - name: "Linux FYI GPU TSAN Release" - mixins: "linux-gpu-fyi-ci" - } - - builders { - name: "Linux FYI Release (AMD R7 240)" - mixins: "linux-gpu-fyi-ci" - mixins: "gpu-slow-bot" - } - - builders { - name: "Linux FYI Ozone (Intel)" - mixins: "linux-gpu-fyi-ci" - } - - # Mac bots. - builders { - name: "mac-jumbo-rel" - mixins: "mac-ci" - dimensions: "cores:4" - } - builders { - name: "mac-mojo-rel" - mixins: "mac" - mixins: "fyi-ci" - dimensions: "cores:4" - } - - builders { - name: "Mac Builder" - mixins: "mac-ci" - dimensions:"os:Mac-10.13" - } - builders { - name: "Mac10.10 Tests" - mixins: "mac-ci" - dimensions:"os:Mac-10.10" - } - builders { - name: "Mac10.11 Tests" - mixins: "mac-ci" - dimensions:"os:Mac-10.11" - } - builders { - name: "Mac10.12 Tests" - mixins: "mac-ci" - dimensions:"os:Mac-10.12" - } - builders { - name: "Mac10.13 Tests" - mixins: "mac-ci" - dimensions:"os:Mac-10.13" - } - builders { - name: "Mac Builder (dbg)" - mixins: "mac-ci" - } - builders { - name: "Mac10.13 Tests (dbg)" - mixins: "mac-ci" - } - - - builders { - name: "GPU Mac Builder" - mixins: "mac-gpu-ci" - } - builders { - name: "Mac Release (Intel)" - mixins: "mac-gpu-ci" - # TODO(tandrii,kbr): this builder doesn't actually run tests locally, - # and so can perhaps run on cheaper linux hardware. - } - builders { - name: "Mac Retina Release (AMD)" - mixins: "mac-gpu-ci" - # TODO(tandrii,kbr): this builder doesn't actually run tests locally, - # and so can perhaps run on cheaper linux hardware. - } - - builders { - name: "GPU Mac Builder (dbg)" - mixins: "mac-gpu-ci" - } - builders { - name: "Mac Debug (Intel)" - mixins: "mac-gpu-ci" - # TODO(tandrii,kbr): this builder doesn't actually run tests locally, - # and so can perhaps run on cheaper linux hardware. - } - builders { - name: "Mac Retina Debug (AMD)" - mixins: "mac-gpu-ci" - # TODO(tandrii,kbr): this builder doesn't actually run tests locally, - # and so can perhaps run on cheaper linux hardware. - } - - # chromium.gpu.fyi - builders { - name: "GPU FYI Mac Builder" - mixins: "mac-gpu-fyi-ci" - } - builders { - name: "GPU FYI Mac Builder (dbg)" - mixins: "mac-gpu-fyi-ci" - } - builders { - name: "GPU FYI Mac dEQP Builder" - mixins: "mac-gpu-fyi-ci" - } - builders { - name: "Mac FYI 10.14 Release (AMD)" - mixins: "mac-gpu-fyi-ci" - mixins: "gpu-slow-bot" - } - builders { - name: "Mac FYI 10.14 Release (Intel)" - mixins: "mac-gpu-fyi-ci" - mixins: "gpu-slow-bot" - } - builders { - name: "Mac FYI 10.14 Release (NVIDIA)" - mixins: "mac-gpu-fyi-ci" - mixins: "gpu-slow-bot" - } - builders { - name: "Mac FYI Release (Intel)" - mixins: "mac-gpu-fyi-ci" - } - builders { - name: "Mac FYI Debug (Intel)" - mixins: "mac-gpu-fyi-ci" - } - builders { - name: "Mac Pro FYI Release (AMD)" - mixins: "mac-gpu-fyi-ci" - mixins: "gpu-slow-bot" - } - builders { - name: "Mac FYI Retina Release (NVIDIA)" - mixins: "mac-gpu-fyi-ci" - } - builders { - name: "Mac FYI Retina Debug (NVIDIA)" - mixins: "mac-gpu-fyi-ci" - } - builders { - name: "Mac FYI Retina Release (AMD)" - mixins: "mac-gpu-fyi-ci" - } - builders { - name: "Mac FYI Retina Debug (AMD)" - mixins: "mac-gpu-fyi-ci" - } - builders { - name: "Mac FYI Experimental Release (Intel)" - mixins: "mac-gpu-fyi-ci" - } - builders { - name: "Mac FYI Experimental Retina Release (AMD)" - mixins: "mac-gpu-fyi-ci" - } - builders { - name: "Mac FYI Experimental Retina Release (NVIDIA)" - mixins: "mac-gpu-fyi-ci" - # This bot has one machine backing its tests at the moment. - # If it gets more, this should be switched back to gpu-slow-bot. - # See crbug.com/853307 for more context. - execution_timeout_secs: 43200 - } - builders { - name: "Mac FYI GPU ASAN Release" - mixins: "mac-gpu-fyi-ci" - execution_timeout_secs: 14400 # 4h - } - builders { - name: "Mac FYI dEQP Release AMD" - mixins: "mac-gpu-fyi-ci" - } - builders { - name: "Mac FYI dEQP Release Intel" - mixins: "mac-gpu-fyi-ci" - } - - # iOS bots. - builders { mixins: "ios-ci" name: "ios-device" } - builders { mixins: "ios-ci" name: "ios-device-xcode-clang" } - builders { mixins: "ios-ci" name: "ios-simulator" } - builders { mixins: "ios-ci" name: "ios-simulator-full-configs" } - builders { mixins: "ios-ci" name: "ios-simulator-xcode-clang" } - builders { mixins: "ios-ci" name: "ios-slimnav" } - builders { mixins: "ios-ci" name: "ios-uirefresh-simulator" } - builders { mixins: "ios-ci" name: "ios-webview" } - builders { mixins: "ios-ci" mixins: "fyi-ci" name: "ios-simulator-cronet" } - builders { mixins: "ios-ci" mixins: "fyi-ci" name: "ios12-beta-simulator" } - builders { mixins: "ios-ci" mixins: "fyi-ci" name: "ios12-sdk-device" } - builders { mixins: "ios-ci" mixins: "fyi-ci" name: "ios12-sdk-simulator" } - - # Win bots. - builders { - name: "win-asan" - dimensions: "os:Windows-10" - mixins: "memory-ci" - } - builders { - name: "win-jumbo-rel" - mixins: "win-ci" - } - builders { - name: "win32-arm64-rel" - dimensions: "os:Windows-10" - dimensions: "cpu:x86" - mixins: "fyi-ci" - } - - builders { - name: "Win Builder" - mixins: "win-ci" - dimensions: "cores:32" - } - builders { - name: "Win Builder (dbg)" - mixins: "win-ci" - dimensions: "cores:32" - } - builders { - name: "Win x64 Builder" - mixins: "win-ci" - dimensions: "os:Windows" - dimensions: "cpu:x86-64" - dimensions: "cores:32" - } - builders { - name: "Win x64 Builder (dbg)" - mixins: "win-ci" - dimensions: "cores:32" - dimensions: "os:Windows" - } - builders { - name: "Win7 (32) Tests" - mixins: "win-ci" - dimensions: "os:Windows-7" - } - builders { - name: "Win7 Tests (1)" - mixins: "win-ci" - dimensions: "os:Windows-7" - } - builders { - name: "Win7 Tests (dbg)(1)" - mixins: "win-ci" - dimensions: "os:Windows-7" - } - builders { - name: "Win 7 Tests x64 (1)" - mixins: "win-ci" - dimensions: "os:Windows-7" - dimensions: "cpu:x86-64" - dimensions: "cores:8" - } - builders { - name: "Win10 Tests x64" - mixins: "win-ci" - dimensions: "os:Windows-10" - dimensions: "cpu:x86-64" - dimensions: "cores:8" - } - builders { - name: "Win10 Tests x64 (dbg)" - mixins: "win-ci" - dimensions: "os:Windows-10" - dimensions: "cpu:x86-64" - dimensions: "cores:8" - } - builders { - name: "Windows deterministic" - dimensions: "os:Windows-10" - mixins: "win-ci" - mixins: "deterministic" - } - - # chromium.clang - builders { - name: "CFI Linux CF" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "CFI Linux ToT" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "CrWinAsan" - mixins: "clang-ci" - mixins: "win" - } - builders { - name: "CrWinAsan(dll)" - mixins: "clang-ci" - mixins: "win" - } - builders { - name: "CrWinAsanCov" - mixins: "clang-ci" - mixins: "win" - } - builders { - name: "ToTAndroid" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "ToTAndroid (dbg)" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "ToTAndroid x64" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "ToTAndroid64" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "ToTAndroidASan" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "ToTAndroidCFI" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "ToTAndroidOfficial" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "ToTLinux" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "ToTLinux (dbg)" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "ToTLinuxASan" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "ToTLinuxASanLibfuzzer" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "ToTLinuxCoverage" - mixins: "clang-ci" - mixins: "clang-coverage" - mixins: "linux" - } - builders { - name: "ToTLinuxMSan" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "ToTLinuxTSan" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "ToTLinuxThinLTO" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "ToTLinuxUBSanVptr" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "ToTMac" - mixins: "clang-ci" - mixins: "mac" - } - builders { - name: "ToTMac (dbg)" - mixins: "clang-ci" - mixins: "mac" - } - builders { - name: "ToTMacASan" - mixins: "clang-ci" - mixins: "mac" - } - builders { - name: "ToTMacCoverage" - mixins: "clang-ci" - mixins: "clang-coverage" - mixins: "mac" - } - builders { - name: "ToTWin(dbg)" - mixins: "clang-ci" - mixins: "win" - } - builders { - name: "ToTWin(dll)" - mixins: "clang-ci" - mixins: "win" - } - builders { - name: "ToTWin64(dbg)" - mixins: "clang-ci" - mixins: "win" - } - builders { - name: "ToTWin64(dll)" - mixins: "clang-ci" - mixins: "win" - } - builders { - name: "ToTWinASanLibfuzzer" - mixins: "clang-ci" - mixins: "win" - } - builders { - name: "ToTWinCFI" - mixins: "clang-ci" - mixins: "win" - } - builders { - name: "ToTWinCFI64" - mixins: "clang-ci" - mixins: "win" - } - builders { - name: "ToTWinLibcxx64" - mixins: "clang-ci" - mixins: "win" - } - builders { - name: "ToTiOS" - mixins: "clang-ci" - mixins: "ios" - recipe { - name: "ios/unified_builder_tester" - } - } - builders { - name: "ToTiOSDevice" - mixins: "clang-ci" - mixins: "ios" - recipe { - name: "ios/unified_builder_tester" - } - } - builders { - name: "UBSanVptr Linux" - mixins: "clang-ci" - mixins: "linux" - } - builders { - name: "linux-win_cross-rel" - mixins: "clang-ci" - mixins: "linux" - } - - # chromium.gpu - builders { - name: "GPU Win Builder" - mixins: "win-gpu-ci" - } - builders { - name: "GPU Win Builder (dbg)" - mixins: "win-gpu-ci" - } - builders { - name: "Win10 Debug (NVIDIA)" - mixins: "win-gpu-ci" - } - builders { - name: "Win10 Release (NVIDIA)" - mixins: "win-gpu-ci" - } - - # chromium.gpu.fyi - builders { - name: "GPU FYI Win Builder" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "GPU FYI Win Builder (dbg)" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "GPU FYI Win Clang Builder (dbg)" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "GPU FYI Win dEQP Builder" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "GPU FYI Win x64 Builder" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "GPU FYI Win x64 Builder (dbg)" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "GPU FYI Win x64 dEQP Builder" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "Win10 FYI Debug (NVIDIA)" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "Win10 FYI dEQP Release (NVIDIA)" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "Win10 FYI Exp Release (NVIDIA)" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "Win10 FYI Release (Intel HD 630)" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "Win10 FYI dEQP Release (Intel HD 630)" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "Win10 FYI Exp Release (Intel HD 630)" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "Win10 FYI Release (NVIDIA)" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "Win7 FYI Debug (AMD)" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "Win7 FYI dEQP Release (AMD)" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "Win7 FYI Release (AMD)" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "Win7 FYI Release (NVIDIA)" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "Win7 FYI x64 dEQP Release (NVIDIA)" - mixins: "win-gpu-fyi-ci" - } - builders { - name: "Win7 FYI x64 Release (NVIDIA)" - mixins: "win-gpu-fyi-ci" - } - - # Code coverage reports generation bots. - builders { - name: "linux-code-coverage" - mixins: "code-coverage" - dimensions: "cores:32" - } - - builders { - name: "mac-code-coverage-generation" - mixins: "code-coverage" - dimensions: "cores:24" - } - builders { - name: "MSAN Release (chained origins)" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - } - builders { - name: "Android Cronet Marshmallow 64bit Builder" - dimensions: "os:Ubuntu-14.04" - dimensions: "device_os:MMB29Q" - mixins: "android-ci" - } - builders { - name: "Win7" - dimensions: "os:Windows-7" - mixins: "chromedriver-ci" - } - builders { - name: "Android ChromeDriver Tests (dbg)" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "TSAN Release" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - } - builders { - name: "Linux CFI" - dimensions: "os:Ubuntu-14.04" - dimensions: "cores:32" - mixins: "memory-ci" - - # TODO(thakis): Remove once https://crbug.com/927738 is resolved. - execution_timeout_secs: 14400 # 4 hours - } - builders { - name: "Jumbo Win x64" - dimensions: "os:Windows-10" - mixins: "fyi-ci" - } - builders { - name: "WebKit Linux Trusty MSAN" - dimensions: "os:Ubuntu-14.04" - mixins: "memory-ci" - } - builders { - name: "Mac ASAN Release Media" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "fuzz-ci" - } - builders { - name: "Lollipop Consumer Tester" - dimensions: "os:Ubuntu-14.04" - mixins: "android-fyi-ci" - } - builders { - name: "Mac ASAN Debug" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "fuzz-ci" - } - builders { - name: "Libfuzzer Upload Linux MSan" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - mixins: "libfuzzer" - } - builders { - name: "TSAN Debug" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - } - builders { - name: "UBSan vptr Release" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - } - builders { - name: "Mac ASAN Release" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "fuzz-ci" - } - builders { - name: "WebKit Linux Trusty ASAN" - dimensions: "os:Ubuntu-14.04" - mixins: "memory-ci" - } - builders { - name: "Libfuzzer Upload Mac ASan" - dimensions: "os:Mac-10.13" - dimensions: "cores:24" - mixins: "fuzz-ci" - mixins: "libfuzzer" - execution_timeout_secs: 14400 # 4 hours - } - builders { - name: "Libfuzzer Upload Windows ASan" - dimensions: "os:Windows-10" - dimensions: "cores:8" - mixins: "fuzz-ci" - mixins: "libfuzzer" - } - builders { - name: "Mac ASan 64 Builder" - dimensions: "os:Mac-10.13" - dimensions: "cores:" # Swapping between 8 and 24 - mixins: "memory-ci" - # TODO(hinoka): Remove this after debugging. - recipe { - properties_j: "$build/goma:{\"debug\": true}" - } - } - builders { - name: "UBSan Release" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - } - builders { - name: "Android VR Tests" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "ChromiumOS ASAN Release" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - } - builders { - name: "ASAN Release Media" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - } - builders { - name: "win-dbg" - dimensions: "os:Windows-10" - dimensions: "cores:32" - mixins: "chromium-ci" - } - builders { - name: "win-rel" - dimensions: "os:Windows-10" - dimensions: "cores:32" - mixins: "chromium-ci" - } - builders { - name: "WebKit Linux Trusty Leak" - dimensions: "os:Ubuntu-14.04" - mixins: "memory-ci" - } - builders { - name: "Linux ChromiumOS MSan Tests" - dimensions: "os:Ubuntu-14.04" - mixins: "memory-ci" - } - builders { - name: "Android Cronet Lollipop Builder" - dimensions: "os:Ubuntu-14.04" - dimensions: "device_os:LMY48I" - mixins: "android-ci" - } - builders { - name: "android-dbg" - dimensions: "os:Ubuntu-14.04" - # Bump to 32 if needed. - dimensions: "cores:8" - mixins: "chromium-ci" - } - builders { - name: "android-rel" - dimensions: "os:Ubuntu-14.04" - dimensions: "cores:32" - mixins: "chromium-ci" - } - builders { - name: "Oreo Phone Tester" - dimensions: "os:Ubuntu-14.04" - mixins: "android-ci" - } - builders { - name: "Android Remoting Tests" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "ASan Debug (32-bit x86 with V8-ARM)" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - } - builders { - name: "Android Cronet x86 Builder" - dimensions: "os:Ubuntu-14.04" - mixins: "android-ci" - } - builders { - name: "Linux remote_run Tester" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "Android Cronet ARM64 Builder" - dimensions: "os:Ubuntu-14.04" - mixins: "android-ci" - } - builders { - name: "WebKit Mac10.13 (retina)" - dimensions: "os:Mac-10.13" - mixins: "mac-ci" - } - builders { - name: "Afl Upload Linux ASan" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - recipe { - name: "chromium_afl" - } - } - builders { - name: "Windows Clang deterministic" - dimensions: "os:Windows-10" - mixins: "fyi-ci" - mixins: "deterministic" - } - builders { - name: "Win 10 Fast Ring" - dimensions: "os:Windows-10" - mixins: "fyi-ci" - } - builders { - name: "Android Cronet Builder Asan" - dimensions: "os:Ubuntu-14.04" - mixins: "android-ci" - } - builders { - name: "Linux MSan Tests" - dimensions: "os:Ubuntu-14.04" - mixins: "memory-ci" - } - builders { - name: "Mac ASan 64 Tests (1)" - dimensions: "os:Mac-10.13" - mixins: "memory-ci" - } - builders { - name: "Win ASan Release" - dimensions: "os:Windows-10" - mixins: "fuzz-ci" - } - builders { - name: "ASAN Debug" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - } - builders { - name: "Mac deterministic" - dimensions: "os:Mac-10.13" - dimensions: "cores:" - mixins: "fyi-ci" - mixins: "deterministic" - } - builders { - name: "Site Isolation Android" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "MSAN Release (no origins)" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - } - builders { - name: "Linux Chromium OS ASan LSan Builder" - dimensions: "os:Ubuntu-14.04" - mixins: "memory-ci" - } - builders { - name: "linux-annotator-rel" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "win-annotator-rel" - dimensions: "os:Windows-10" - execution_timeout_secs: 57600 # 16h - mixins: "fyi-ci" - } - builders { - name: "Jumbo Mac" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "fyi-ci" - } - builders { - name: "Libfuzzer Upload Linux UBSan" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - mixins: "libfuzzer" - } - builders { - name: "VR Linux" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "linux-tcmalloc-rel" - dimensions: "os:Ubuntu-14.04" - dimensions: "cores:32" - mixins: "fyi-ci" - } - builders { - name: "Mac deterministic (dbg)" - dimensions: "os:Mac-10.13" - dimensions: "cores:" - mixins: "fyi-ci" - mixins: "deterministic" - } - builders { - name: "ASAN Release" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - } - builders { - name: "Libfuzzer Upload Linux ASan Debug" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - mixins: "libfuzzer" - } - builders { - name: "Libfuzzer Upload Linux V8-ARM64 ASan Debug" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - mixins: "libfuzzer" - } - builders { - name: "Closure Compilation Linux" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - recipe { - name: "closure_compilation" - } - } - builders { - name: "Mojo Windows" - dimensions: "os:Windows-10" - mixins: "fyi-ci" - } - builders { - name: "Chromium Mac 10.13" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "fyi-ci" - } - builders { - name: "Android Cronet KitKat Builder" - dimensions: "os:Ubuntu-14.04" - mixins: "android-fyi-ci" - } - builders { - name: "linux-dbg" - dimensions: "os:Ubuntu-14.04" - # Bump to 32 if needed. - dimensions: "cores:8" - mixins: "chromium-ci" - } - builders { - name: "linux-rel" - dimensions: "os:Ubuntu-14.04" - dimensions: "cores:32" - mixins: "chromium-ci" - } - builders { - name: "Libfuzzer Upload Linux ASan" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - mixins: "libfuzzer" - } - builders { - name: "Libfuzzer Upload Linux V8-ARM64 ASan" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - mixins: "libfuzzer" - } - builders { - name: "Libfuzzer Upload Linux32 ASan Debug" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - mixins: "libfuzzer" - } - builders { - name: "Libfuzzer Upload Linux32 ASan" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - mixins: "libfuzzer" - } - builders { - name: "Libfuzzer Upload Linux32 V8-ARM ASan Debug" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - mixins: "libfuzzer" - } - builders { - name: "Libfuzzer Upload Linux32 V8-ARM ASan" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - mixins: "libfuzzer" - } - builders { - name: "Libfuzzer Upload Chrome OS ASan" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - mixins: "libfuzzer" - } - builders { - name: "Mac 10.6" - dimensions: "os:Mac-10.12.2" - mixins: "chromedriver-ci" - } - builders { - name: "Android CFI" - dimensions: "os:Ubuntu-14.04" - dimensions: "cores:32" - # TODO(https://crbug.com/919430) Remove the larger timeout once compile - # times have been brought down to reasonable level - execution_timeout_secs: 16200 # 4.5h - mixins: "memory-ci" - } - builders { - name: "Android Cronet Marshmallow 64bit Perf" - dimensions: "os:Ubuntu-14.04" - mixins: "android-ci" - } - builders { - name: "Linux Clang Analyzer" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "Android Builder (dbg)" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "chromeos-amd64-generic-rel-goma-canary" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "x86 Emulator Tester" - dimensions: "os:Ubuntu-14.04" - mixins: "android-fyi-ci" - } - builders { - name: "Linux MSan Builder" - dimensions: "os:Ubuntu-14.04" - mixins: "memory-ci" - } - builders { - name: "ASan Release Media (32-bit x86 with V8-ARM)" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - } - builders { - name: "mac-hermetic-upgrade-rel" - dimensions: "os:Mac-10.13" - mixins: "fyi-ci" - } - builders { - name: "mac-osxbeta-rel" - mixins: "fyi-ci" - # This is launching & collecting entirely isolated tests. - # OS shouldn't matter. - dimensions: "os:Ubuntu-14.04" - } - builders { - name: "Android Find Annotated Test" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "Mojo ChromiumOS" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "Linux remote_run Builder" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "Android Cronet Builder (dbg)" - dimensions: "os:Ubuntu-14.04" - mixins: "android-fyi-ci" - } - builders { - name: "Android Cronet ARM64 Builder (dbg)" - dimensions: "os:Ubuntu-14.04" - mixins: "android-ci" - } - builders { - name: "Win ASan Release Media" - dimensions: "os:Windows-10" - mixins: "fuzz-ci" - } - builders { - name: "Android Cronet x86 Builder (dbg)" - dimensions: "os:Ubuntu-14.04" - mixins: "android-ci" - } - builders { - name: "mac-dbg" - dimensions: "os:Mac-10.13" - # Bump to 8 cores if needed. - dimensions: "cores:4" - mixins: "chromium-ci" - } - builders { - name: "mac-rel" - dimensions: "os:Mac-10.13" - mixins: "chromium-ci" - } - builders { - name: "Linux ChromiumOS MSan Builder" - dimensions: "os:Ubuntu-14.04" - mixins: "memory-ci" - } - builders { - name: "Mojo Linux" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "Linux Chromium OS ASan LSan Tests (1)" - dimensions: "os:Ubuntu-14.04" - mixins: "memory-ci" - } - builders { - name: "Memory Infra Tester" - dimensions: "os:Ubuntu-14.04" - mixins: "android-fyi-ci" - } - builders { - name: "Chromium Windows Analyze" - dimensions: "os:Windows-10" - mixins: "fyi-ci" - recipe { - name: "win_analyze" - } - } - builders { - name: "ios-device-goma-canary-clobber" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "fyi-ci" - recipe { - name: "ios/unified_builder_tester" - } - } - builders { - name: "ASan Release (32-bit x86 with V8-ARM)" - dimensions: "os:Ubuntu-14.04" - mixins: "fuzz-ci" - } - builders { - name: "WebKit Win10" - dimensions: "os:Windows-10" - mixins: "win-ci" - } - builders { - name: "win32-dbg" - dimensions: "os:Windows-10" - dimensions: "cores:32" - mixins: "chromium-ci" - } - builders { - name: "win32-rel" - dimensions: "os:Windows-10" - dimensions: "cores:32" - mixins: "chromium-ci" - } - builders { - name: "Linux Viz" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "Linux ARM" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "Linux" - dimensions: "os:Ubuntu-14.04" - mixins: "chromedriver-ci" - } - builders { - name: "Jumbo Linux x64" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "Mojo Android" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - # Goma Staging - builders { - name: "Chromium Linux Goma RBE Staging (dbg)" - dimensions: "os:Ubuntu-14.04" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "CrWinGomaStaging" - dimensions: "os:Windows-10" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "Chromium Linux Goma RBE ToT" - dimensions: "os:Ubuntu-14.04" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "Chromium Linux Goma RBE ToT (ATS)" - dimensions: "os:Ubuntu-14.04" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "Chromium Linux Goma RBE Staging" - dimensions: "os:Ubuntu-14.04" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "Chromium Linux Goma RBE Staging (clobber)" - dimensions: "os:Ubuntu-14.04" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "Chromium Linux Goma RBE Prod" - dimensions: "os:Ubuntu-14.04" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "Chromium Linux Goma RBE Prod (clobber)" - dimensions: "os:Ubuntu-14.04" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "Chromium Linux Goma RBE Prod (dbg)" - dimensions: "os:Ubuntu-14.04" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "Chromium Linux Goma RBE Prod (dbg) (clobber)" - dimensions: "os:Ubuntu-14.04" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "Chromium Mac Goma RBE Staging (clobber)" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "goma-ci" - mixins: "goma-j80" - mixins: "experimental" - } - builders { - name: "Chromium Mac Goma RBE Staging" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "goma-ci" - mixins: "goma-j80" - mixins: "experimental" - } - builders { - name: "Chromium Mac Goma RBE Staging (dbg)" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "goma-ci" - mixins: "goma-j80" - mixins: "experimental" - } - builders { - name: "Chromium Win Goma RBE ToT" - dimensions: "os:Windows-10" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "Chromium Android ARM 32-bit Goma RBE ToT" - dimensions: "os:Ubuntu-14.04" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "Chromium Android ARM 32-bit Goma RBE Staging" - dimensions: "os:Ubuntu-14.04" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "Chromium Android ARM 32-bit Goma RBE Prod" - dimensions: "os:Ubuntu-14.04" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "Chromium Android ARM 32-bit Goma RBE Prod (clobber)" - dimensions: "os:Ubuntu-14.04" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "Chromium Android ARM 32-bit Goma RBE Prod (dbg)" - dimensions: "os:Ubuntu-14.04" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "Chromium Android ARM 32-bit Goma RBE Prod (dbg) (clobber)" - dimensions: "os:Ubuntu-14.04" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "Chromium Linux Goma RBE Staging (dbg) (clobber)" - dimensions: "os:Ubuntu-14.04" - mixins: "goma-ci" - mixins: "experimental" - } - builders { - name: "Chromium Mac Goma Staging" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "goma-ci" - mixins: "goma-j80" - mixins: "experimental" - } - builders { - name: "Chromium Linux Goma Staging" - dimensions: "os:Ubuntu-14.04" - mixins: "goma-ci" - mixins: "experimental" - } - # Goma Canary - builders { - name: "Mac Builder (dbg) Goma Canary (clobber)" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "fyi-ci" - } - builders { - name: "Mac Goma Canary (clobber)" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "fyi-ci" - } - builders { - name: "Win Builder Goma Canary" - dimensions: "os:Windows-10" - mixins: "fyi-ci" - } - builders { - name: "Android Builder (dbg) Goma Canary" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "Mac Goma Canary LocalOutputCache" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "fyi-ci" - } - builders { - name: "Win7 Builder Goma Canary" - dimensions: "os:Windows-7" - mixins: "fyi-ci" - } - builders { - name: "Mac Builder (dbg) Goma Canary" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "fyi-ci" - } - builders { - name: "Win Builder (dbg) Goma Canary" - dimensions: "os:Windows-10" - mixins: "fyi-ci" - } - builders { - name: "Linux x64 Goma Canary LocalOutputCache" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "Linux Builder Goma Canary" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "Win cl.exe Goma Canary LocalOutputCache" - dimensions: "os:Windows-10" - mixins: "fyi-ci" - } - builders { - name: "Win7 Builder (dbg) Goma Canary" - dimensions: "os:Windows-7" - mixins: "fyi-ci" - } - builders { - name: "Win Goma Canary LocalOutputCache" - dimensions: "os:Windows-10" - mixins: "fyi-ci" - } - builders { - name: "Mac Builder Goma Canary" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "fyi-ci" - } - builders { - name: "WinMSVC64 Goma Canary" - dimensions: "os:Windows-10" - mixins: "fyi-ci" - } - builders { - name: "Linux x64 Goma Canary (clobber)" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - # Goma Latest Client - builders { - name: "Mac Builder (dbg) Goma Latest Client (clobber)" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "fyi-ci" - } - builders { - name: "Mac Goma Latest Client (clobber)" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "fyi-ci" - } - builders { - name: "Win Builder Goma Latest Client" - dimensions: "os:Windows-10" - mixins: "fyi-ci" - } - builders { - name: "Android Builder (dbg) Goma Latest Client" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "Mac Goma Latest Client LocalOutputCache" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "fyi-ci" - } - builders { - name: "Win7 Builder Goma Latest Client" - dimensions: "os:Windows-7" - mixins: "fyi-ci" - } - builders { - name: "Mac Builder (dbg) Goma Latest Client" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "fyi-ci" - } - builders { - name: "Win Builder (dbg) Goma Latest Client" - dimensions: "os:Windows-10" - mixins: "fyi-ci" - } - builders { - name: "Linux x64 Goma Latest Client LocalOutputCache" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "Linux Builder Goma Latest Client" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - builders { - name: "Win cl.exe Goma Latest Client LocalOutputCache" - dimensions: "os:Windows-10" - mixins: "fyi-ci" - } - builders { - name: "Win7 Builder (dbg) Goma Latest Client" - dimensions: "os:Windows-7" - mixins: "fyi-ci" - } - builders { - name: "Win Goma Latest Client LocalOutputCache" - dimensions: "os:Windows-10" - mixins: "fyi-ci" - } - builders { - name: "Mac Builder Goma Latest Client" - dimensions: "os:Mac-10.13" - dimensions: "cores:4" - mixins: "fyi-ci" - } - builders { - name: "WinMSVC64 Goma Latest Client" - dimensions: "os:Windows-10" - mixins: "fyi-ci" - } - builders { - name: "Linux x64 Goma Latest Client (clobber)" - dimensions: "os:Ubuntu-14.04" - mixins: "fyi-ci" - } - } -} - -buckets { - name: "findit" - acls { - role: SCHEDULER - group: "findit-tryjob-access" - } - acls { - role: SCHEDULER - identity: "luci-scheduler@appspot.gserviceaccount.com" - } - acls { - role: READER - group: "googlers" - } - acls { - role: READER - identity: "findit-builder@chops-service-accounts.iam.gserviceaccount.com" - } - - swarming { - hostname: "chromium-swarm.appspot.com" - builder_defaults { - category: "Chromium Variable" - dimensions: "pool:luci.chromium.findit" - service_account: "findit-builder@chops-service-accounts.iam.gserviceaccount.com" - execution_timeout_secs: 28800 # 8h - swarming_tags: "vpython:native-python-wrapper" - build_numbers: YES - caches { - path: "win_toolchain" - name: "win_toolchain" - } - # Findit app specifies these for each build it schedules. The reason why - # we specify them here is to pass validation of the buildbucket config. - # Also, to illustrate the typical use case of this bucket. - recipe { - cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" - cipd_version: "refs/heads/master" - name: "findit/chromium/compile" - properties_j: "$kitchen:{\"git_auth\": true, \"devshell\": true}" - } - } - - # Dimensionless trybot for findit. - # - # Findit will add appropriate dimensions and properties as needed based on - # the waterfall builder being analyzed. - # - # TODO(robertocn): Remove _variable trybot builders from "try" bucket - # after they have been configured to use this generic builder, as well as - # the findit 'mixin'. - builders { name: "findit_variable" } - builders { - name: "linux_chromium_bot_db_exporter" - mixins: "linux" - recipe { - name: "findit/chromium/export_bot_db" - properties: "gs_bucket:findit-for-me" - properties: "gs_object:bot_db.json" - } - } - } -} - -buckets { - name: "master.chromium.android.fyi" - acl_sets: "waterfall" -} - -buckets { - name: "master.chromium.perf" - acl_sets: "waterfall" -} - -buckets { - name: "master.chromium.perf.fyi" - acl_sets: "waterfall" -} - -# Defining blink build bucket in chromium/src repo because -# blink will merge to chromium/src. -# Also git admins are reluctant to create infra/config branches -# in svn-based git repos (crbug.com/513580). -buckets { - name: "master.tryserver.blink" - acl_sets: "tryserver" -} - -buckets { - name: "master.tryserver.chromium.android" - acl_sets: "tryserver" -} - -buckets { - name: "master.tryserver.chromium.chromiumos" - acl_sets: "tryserver" -} - -buckets { - name: "master.tryserver.chromium.gpu" - acl_sets: "tryserver" -} - -buckets { - name: "master.tryserver.chromium.linux" - acl_sets: "tryserver" -} - -buckets { - name: "master.tryserver.chromium.mac" - acl_sets: "tryserver" -} - -buckets { - name: "master.tryserver.chromium.perf" - acl_sets: "tryserver" - acls { - role: SCHEDULER - group: "service-account-chromium-bisect" - } - acls { - role: SCHEDULER - group: "service-account-chromeperf" - } -} - -buckets { - name: "master.tryserver.chromium.win" - acl_sets: "tryserver" -} - -buckets { - name: "try" - - # NOTE: these ACLs should be kept in sync with those in the other - # "master.tryserver.chromium.*" buckets. - acl_sets: "tryserver" - - swarming { - hostname: "chromium-swarm.appspot.com" - task_template_canary_percentage { value: 5 } - - builder_defaults { - category: "Chromium CQ" - dimensions: "cores:8" - dimensions: "cpu:x86-64" - service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" - # Max. pending time for builds. CQ considers builds pending >2h as timed - # out: http://shortn/_8PaHsdYmlq. Keep this in sync. - expiration_secs: 7200 # 2h - execution_timeout_secs: 10800 # 3h - swarming_tags: "vpython:native-python-wrapper" - build_numbers: YES - # Adds dimension: "builder:<builder name>" to ensure builder affinity. - # To "assign" a bot to a builder, bot config of swarming service should - # add the same dimension to the bot. - auto_builder_dimension: YES - caches { - path: "win_toolchain" - name: "win_toolchain" - } - recipe { - cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" - cipd_version: "refs/heads/master" - name: "chromium_trybot" - properties_j: "$kitchen:{\"git_auth\": true, \"devshell\": true}" - } - } - - # Keep builders sorted by OS, then name. - builders { mixins: "android-angle-try" name: "android_angle_deqp_rel_ng" } - builders { mixins: "android-angle-try" name: "android_angle_rel_ng" } - builders { mixins: "android-angle-try" name: "android_angle_vk32_deqp_rel_ng" } - builders { mixins: "android-angle-try" name: "android_angle_vk32_rel_ng" } - builders { mixins: "android-angle-try" name: "android_angle_vk64_deqp_rel_ng" } - builders { mixins: "android-angle-try" name: "android_angle_vk64_rel_ng" } - builders { - mixins: "android-try" - mixins: "goma-j150" - name: "android-kitkat-arm-rel" - dimensions: "os:Ubuntu-14.04" - } - builders { - mixins: "android-try" - mixins: "goma-j300" - name: "android-marshmallow-arm64-rel" - dimensions: "os:Ubuntu-14.04" - # TODO(hinoka): Make this 16 core after crbug.com/875708 - dimensions: "cores:" - } - builders { - mixins: "android-try" - name: "android-oreo-arm64-cts-networkservice-dbg" - dimensions: "os:Ubuntu-14.04" - } - # TODO(jbudorick): Remove this after fully migrating ANSR. - builders { - mixins: "android-try" - mixins: "goma-j150" - name: "android_n5x_swarming_rel" - auto_builder_dimension: NO - dimensions: "builder:android-marshmallow-arm64-rel" - dimensions: "os:Ubuntu-14.04" - # TODO(hinoka): Make this 16 core after crbug.com/875708 - dimensions: "cores:" - recipe { - properties: "buildername:android-marshmallow-arm64-rel" - } - } - builders { - mixins: "android-try" - mixins: "goma-j300" - name: "android_arm64_dbg_recipe" - dimensions: "os:Ubuntu-14.04" - } - builders { - name: "android-binary-size" - mixins: "android-try" - mixins: "goma-j150" - dimensions: "os:Ubuntu-14.04" - recipe { - name: "binary_size_trybot" - } - } - builders { - mixins: "android-try" - name: "android_blink_rel" - dimensions: "os:Ubuntu-14.04" - } - builders { - mixins: "android-try" - mixins: "goma-j300" - name: "android_clang_dbg_recipe" - dimensions: "os:Ubuntu-14.04" - } - builders { - mixins: "android-try" - mixins: "goma-j150" - name: "android_compile_dbg" - dimensions: "os:Ubuntu-14.04" - } - builders { - mixins: "android-try" - name: "android_cronet" - dimensions: "os:Ubuntu-14.04" - } - builders { - mixins: "android-try" - name: "android_n5x_swarming_dbg" - dimensions: "os:Ubuntu-14.04" - } - builders { - mixins: "android-try" - name: "cast_shell_android" - dimensions: "os:Ubuntu-14.04" - } - builders { mixins: "android-optional-gpu-try" name: "android_optional_gpu_tests_rel" } - builders { - mixins: "android-try" - name: "android_unswarmed_pixel_aosp" - dimensions: "os:Ubuntu-14.04" - } - builders { - mixins: "android-gpu-manual-try" - name: "gpu-manual-try-android-l-nexus-5-32" - } - builders { - mixins: "android-gpu-manual-try" - name: "gpu-manual-try-android-l-nexus-6-32" - } - builders { - mixins: "android-gpu-manual-try" - name: "gpu-manual-try-android-m-nexus-6p-64" - } - builders { - mixins: "android-gpu-manual-try" - name: "gpu-manual-try-android-m-nexus-9-64" - } - builders { - mixins: "android-gpu-manual-try" - name: "gpu-manual-try-android-n-nvidia-shield-tv-64" - } - builders { - mixins: "android-gpu-manual-try" - name: "gpu-manual-try-android-p-pixel-2-32" - } - builders { - mixins: "android-gpu-manual-try" - name: "gpu-manual-try-android-p-pixel-2-32-deqp" - } - builders { - mixins: "android-gpu-manual-try" - name: "gpu-manual-try-android-p-pixel-2-64" - } - builders { - mixins: "android-gpu-manual-try" - name: "gpu-manual-try-android-p-pixel-2-64-deqp" - } - builders { - mixins: "android-gpu-manual-try" - name: "gpu-manual-try-android-p-pixel-xl-32" - } - builders { - mixins: "android-gpu-manual-try" - name: "gpu-manual-try-android-p-pixel-xl-32-deqp" - } - builders { - mixins: "android-gpu-manual-try" - name: "gpu-manual-try-android-p-pixel-xl-64" - } - builders { - mixins: "android-gpu-manual-try" - name: "gpu-manual-try-android-p-pixel-xl-64-deqp" - } - builders { - mixins: "android-try" - mixins: "deterministic" - name: "android-deterministic-rel" - dimensions: "os:Ubuntu-14.04" - } - builders { - mixins: "android-try" - mixins: "deterministic" - name: "android-deterministic-dbg" - dimensions: "os:Ubuntu-14.04" - } - builders { - mixins: "android-try" - name: "try-nougat-phone-tester" - } - - builders { mixins: "chromeos-try" name: "chromeos-amd64-generic-cfi-thin-lto-rel" } - builders { mixins: "chromeos-try" name: "chromeos-amd64-generic-rel" } - builders { mixins: "chromeos-try" name: "chromeos-daisy-rel" } - builders { mixins: "chromeos-try" name: "chromeos-kevin-compile-rel" } - builders { mixins: "chromeos-try" name: "chromeos-kevin-rel" } - builders { mixins: "chromeos-try" name: "linux-chromeos-compile-dbg" } - builders { mixins: "chromeos-try" name: "linux-chromeos-dbg" } - builders { - mixins: "chromeos-try" - mixins: "goma-j150" - name: "linux-chromeos-rel" - } - - builders { mixins: "linux-angle-try" name: "linux_angle_compile_dbg_ng" } - builders { mixins: "linux-angle-try" name: "linux_angle_dbg_ng" } - builders { mixins: "linux-angle-try" name: "linux_angle_deqp_rel_ng" } - builders { mixins: "linux-angle-try" name: "linux_angle_ozone_rel_ng" } - builders { mixins: "linux-angle-try" name: "linux_angle_rel_ng" } - - builders { mixins: "linux-try" name: "cast_shell_audio_linux" } - builders { mixins: "linux-try" name: "cast_shell_linux" } - builders { mixins: "linux-try" name: "chromium_devtools" } - builders { - mixins: "linux-try" - name: "chromium_presubmit" - recipe { - name: "run_presubmit" - properties: "repo_name:chromium" - properties_j: "runhooks:true" - } - } - builders { - mixins: "linux-try" - name: "closure_compilation" - recipe { - name: "closure_compilation" - } - } - builders { mixins: "linux-try" name: "fuchsia_arm64" } - builders { mixins: "linux-try" name: "fuchsia-arm64-cast" } - builders { mixins: "linux-try" name: "fuchsia-fyi-arm64-rel" } - builders { mixins: "linux-try" name: "fuchsia-fyi-x64-dbg" } - builders { mixins: "linux-try" name: "fuchsia-fyi-x64-rel" } - builders { mixins: "linux-try" name: "fuchsia_x64" } - builders { mixins: "linux-try" name: "fuchsia-x64-cast" } - builders { mixins: "linux-try" name: "leak_detection_linux" } - builders { mixins: "linux-try" name: "linux-blink-heap-incremental-marking" } - builders { mixins: "linux-try" name: "linux-blink-heap-verification-try" } - builders { mixins: "linux-try" name: "linux-dcheck-off-rel" } - builders { - mixins: "linux-try" - mixins: "goma-j150" - name: "linux-goma-rbe-staging-rel" - } - builders { mixins: "linux-try" name: "linux-gcc-rel" } - builders { mixins: "linux-try" name: "linux-jumbo-rel" } - builders { - name: "linux-libfuzzer-asan-rel" - mixins: "linux-try" - recipe { - name: "chromium_libfuzzer_trybot" - } - } - builders { mixins: "linux-try" name: "linux-ozone-rel" } - builders { mixins: "linux-try" name: "linux-trusty-webkit-msan-rel" } - builders { - dimensions: "os:Ubuntu-16.04" - recipe { - properties: "mastername:tryserver.chromium.linux" - } - name: "linux-xenial-rel" - } - builders { mixins: "linux-try" name: "linux_arm" } - builders { mixins: "linux-try" name: "linux_chromium_analysis" } - builders { mixins: "linux-try" name: "linux_chromium_archive_rel_ng" } - builders { - mixins: "linux-try" - mixins: "goma-j150" - name: "linux_chromium_asan_rel_ng" - } - builders { - mixins: "linux-try" - name: "linux_chromium_cfi_rel_ng" - dimensions: "cores:32" - } - builders { - mixins: "linux-try" - mixins: "goma-j150" - name: "linux_chromium_chromeos_asan_rel_ng" - } - builders { - mixins: "linux-try" - mixins: "goma-j150" - name: "linux_chromium_chromeos_msan_rel_ng" - } - builders { - name: "linux_chromium_clobber_deterministic", - mixins: "linux-try" - mixins: "deterministic" - } - builders { mixins: "linux-try" name: "linux_chromium_clobber_rel_ng" } - builders { mixins: "linux-try" name: "linux_chromium_compile_dbg_32_ng" } - builders { - mixins: "linux-try" - mixins: "linux-debug-cache" - mixins: "goma-j150" - name: "linux_chromium_compile_dbg_ng" - } - builders { mixins: "linux-try" name: "linux_chromium_compile_rel_ng" } - builders { mixins: "linux-try" name: "linux_chromium_dbg_32_ng" } - builders { - mixins: "linux-try" - mixins: "linux-debug-cache" - name: "linux_chromium_dbg_ng" - } - builders { - mixins: "linux-try" - mixins: "goma-j150" - name: "linux_chromium_msan_rel_ng" - } - builders { - mixins: "linux-try" - mixins: "goma-j150" - name: "linux-coverage-rel" - auto_builder_dimension: NO - } - builders { - mixins: "linux-try" - mixins: "goma-j150" - name: "linux-rel" - } - builders { - mixins: "linux-try" - mixins: "goma-j150" - name: "linux_chromium_tsan_rel_ng" - } - builders { mixins: "linux-try" name: "linux_chromium_ubsan_rel_ng" } - builders { mixins: "linux-dawn-try" name: "linux-dawn-rel" } - builders { mixins: "linux-try" name: "linux_layout_tests_composite_after_paint" } - builders { mixins: "linux-try" name: "linux_layout_tests_layout_ng" } - builders { mixins: "linux-try" name: "linux_mojo" } - builders { mixins: "linux-try" name: "linux_mojo_chromeos" } - builders { mixins: "linux-optional-gpu-try" name: "linux_optional_gpu_tests_rel" } - builders { - mixins: "linux-try" - mixins: "upload_clang" - name: "linux_upload_clang" - dimensions: "cores:32" - } - builders { mixins: "ios-try" name: "ios-device" } - builders { mixins: "ios-try" name: "ios-device-xcode-clang" } - builders { mixins: "ios-try" name: "ios-simulator" } - builders { mixins: "ios-try" name: "ios-simulator-cronet" } - builders { mixins: "ios-try" name: "ios-uirefresh-simulator" } - builders { mixins: "ios-try" name: "ios12-sdk-simulator" } - builders { mixins: "ios-try" name: "ios-simulator-full-configs" } - builders { mixins: "ios-try" name: "ios-simulator-eg" } - builders { mixins: "ios-try" name: "ios-simulator-xcode-clang" } - builders { mixins: "ios-try" name: "ios-slimnav" } - builders { mixins: "ios-try" name: "ios-webview" } - builders { mixins: "mac-angle-try" name: "mac_angle_compile_dbg_ng" } - builders { mixins: "mac-angle-try" name: "mac_angle_dbg_ng" } - builders { mixins: "mac-angle-try" name: "mac_angle_rel_ng" } - builders { - mixins: "mac-try" - name: "mac-jumbo-rel" - dimensions: "cores:4" - } - # NOTE: the folliwing 3 trybots aren't sensitive to Mac version on which - # they are built, hence no additional dimension is specified. - # The 10.xx version translates to which bots will run isolated tests. - builders { mixins: "mac-try" name: "mac_chromium_10.10" } - builders { mixins: "mac-try" name: "mac_chromium_10.12_rel_ng" } - builders { mixins: "mac-try" name: "mac_chromium_10.13_rel_ng"} - builders { mixins: "mac-try" name: "mac_chromium_archive_rel_ng" } - builders { - mixins: "mac-try" - mixins: "goma-j150" - name: "mac_chromium_asan_rel_ng" - } - builders { - mixins: "mac-try" - mixins: "goma-j150" - name: "mac_chromium_compile_dbg_ng" - dimensions:"os:Mac-10.13.3" - } - builders { mixins: "mac-try" name: "mac_chromium_compile_rel_ng" } - builders { mixins: "mac-try" name: "mac_chromium_dbg_ng" dimensions:"os:Mac-10.12"} - builders { - mixins: "mac-try" - mixins: "goma-j150" - name: "mac-rel" - } - builders { mixins: "mac-dawn-try" name: "mac-dawn-rel" } - builders { - mixins: "mac-optional-gpu-try" - name: "mac_optional_gpu_tests_rel" - # Clear cores dimension requirement because build{103..105}-m9 are cores:4 - dimensions: "cores:" - } - builders { mixins: "mac-try" mixins: "upload_clang" name: "mac_upload_clang" } - - builders { - mixins: "win-optional-gpu-try" - name: "gpu_manual_try_win7_nvidia_rel" - execution_timeout_secs: 10800 # 3h - } - builders { mixins: "win-try" name: "win10_chromium_x64_dbg_ng" } - builders { - mixins: "win-try" - mixins: "goma-j150" - name: "win10_chromium_x64_rel_ng" - } - builders { mixins: "win-try" name: "win10_chromium_x64_rel_ng_exp" } - builders { - mixins: "win-try" - mixins: "goma-j300" - name: "win7-rel" - execution_timeout_secs: 16200 # 4.5h - } - builders { mixins: "win-try" name: "win7_chromium_rel_loc_exp" } - builders { mixins: "win-try" name: "win-annotator-rel" } - builders { - mixins: "win-try" - mixins: "goma-j150" - name: "win-asan" - } - builders { mixins: "win-try" name: "win-jumbo-rel" } - builders { - name: "win-libfuzzer-asan-rel" - mixins: "win-try" - recipe { - name: "chromium_libfuzzer_trybot" - } - } - builders { mixins: "win-angle-try" name: "win-angle-rel" } - builders { mixins: "win-angle-try" name: "win_angle_compile_x64_rel_ng" } - builders { mixins: "win-angle-try" name: "win_angle_compile_x64_dbg_ng" } - builders { mixins: "win-angle-try" name: "win_angle_compile_dbg_ng" } - builders { mixins: "win-angle-try" name: "win_angle_deqp_rel_ng" } - builders { mixins: "win-angle-try" name: "win_angle_x64_rel_ng" } - builders { mixins: "win-angle-try" name: "win_angle_x64_deqp_rel_ng" } - builders { mixins: "win-try" name: "win_archive" } - builders { - mixins: "win-try" - mixins: "goma-j150" - name: "win_chromium_compile_dbg_ng" - } - builders { mixins: "win-try" name: "win_chromium_compile_rel_ng" } - # TODO(crbug/794085): Revisit exceptional extra-long timeout when we speed - # up the builder. - builders { - mixins: "win-try" - name: "win_chromium_dbg_ng" - execution_timeout_secs: 14400 # 4h - } - builders { mixins: "win-try" name: "win_chromium_x64_rel_ng" } - builders { mixins: "win-dawn-try" name: "win-dawn-rel" } - builders { mixins: "win-try" name: "win_mojo" } - builders { mixins: "win-optional-gpu-try" name: "win_optional_gpu_tests_rel" } - builders { mixins: "win-try" mixins: "upload_clang" name: "win_upload_clang" } - builders { mixins: "win-try" name: "win_x64_archive" } - - builders { - name: "android_compile_x86_dbg" - dimensions: "os:Ubuntu-14.04" - mixins: "android-try" - } - builders { - name: "linux-annotator-rel" - dimensions: "os:Ubuntu-14.04" - mixins: "linux-try" - } - builders { - name: "linux_vr" - dimensions: "os:Ubuntu-14.04" - mixins: "linux-try" - } - builders { - name: "android_compile_rel" - dimensions: "os:Ubuntu-14.04" - mixins: "android-try" - } - builders { - name: "linux_android_dbg_ng" - dimensions: "os:Ubuntu-14.04" - mixins: "android-try" - } - builders { - name: "android_compile_x64_dbg" - dimensions: "os:Ubuntu-14.04" - mixins: "android-try" - } - builders { - name: "android_archive_rel_ng" - dimensions: "os:Ubuntu-14.04" - mixins: "android-try" - } - builders { - name: "layout_test_leak_detection" - dimensions: "os:Ubuntu-14.04" - mixins: "linux-try" - } - builders { - name: "android_cronet_tester" - dimensions: "os:Ubuntu-14.04" - mixins: "android-try" - } - builders { - name: "android_cfi_rel_ng" - dimensions: "os:Ubuntu-14.04" - dimensions: "cores:32" - mixins: "android-try" - } - builders { - name: "android_mojo" - dimensions: "os:Ubuntu-14.04" - mixins: "android-try" - } - - # Blink try builders. - builders { - name: "linux-blink-rel" - mixins: "linux" - mixins: "blink-try" - } - builders { - name: "mac10.10-blink-rel" - mixins: "mac" - mixins: "blink-try" - } - builders { - name: "mac10.11-blink-rel" - mixins: "mac" - mixins: "blink-try" - } - builders { - name: "mac10.12-blink-rel" - mixins: "mac" - mixins: "blink-try" - } - builders { - name: "mac10.13-blink-rel" - mixins: "mac" - mixins: "blink-try" - } - builders { - name: "mac10.13_retina-blink-rel" - mixins: "mac" - mixins: "blink-try" - } - builders { - name: "win10-blink-rel" - mixins: "win" - mixins: "blink-try" - } - builders { - name: "win7-blink-rel" - mixins: "win" - mixins: "blink-try" - } - } -} - -buckets { - name: "webrtc" - acl_sets: "ci" - - swarming { - hostname: "chromium-swarm.appspot.com" - url_format: "https://luci-milo.appspot.com/swarming/task/{task_id}" - builder_defaults { - # Automatically assigns a dimensions:<builder name> to each builder. - auto_builder_dimension: YES - build_numbers: YES - dimensions: "cpu:x86-64" - luci_migration_host: "luci-migration.appspot.com" - execution_timeout_secs: 7200 # 2h - recipe { - cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" - cipd_version: "refs/heads/master" - properties: "mastername:chromium.webrtc" - properties: "perf_dashboard_machine_group:ChromiumWebRTC" - name: "chromium" - } - service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" - swarming_tags: "vpython:native-python-wrapper" - } - - # Keep builders grouped by OS, then sorted by name. - - # Android - - builders { mixins: "linux" name: "WebRTC Chromium Android Builder" } - builders { mixins: "linux" name: "WebRTC Chromium Android Tester" } - - # Linux - - builders { mixins: "linux" name: "WebRTC Chromium Linux Builder" } - builders { mixins: "linux" name: "WebRTC Chromium Linux Builder (RBE)" } - builders { mixins: "linux" name: "WebRTC Chromium Linux Tester" } - - # Mac - - builders { - name: "WebRTC Chromium Mac Builder" - mixins: "mac" - dimensions: "cores:8" - } - builders { mixins: "mac" name: "WebRTC Chromium Mac Tester" } - - # Win - - builders { mixins: "win" name: "WebRTC Chromium Win Builder" } - builders { mixins: "win" name: "WebRTC Chromium Win10 Tester" } - builders { mixins: "win" name: "WebRTC Chromium Win7 Tester" } - builders { mixins: "win" name: "WebRTC Chromium Win8 Tester" } - } -} - -buckets { - name: "webrtc.fyi" - acl_sets: "ci" - - swarming { - hostname: "chromium-swarm.appspot.com" - url_format: "https://luci-milo.appspot.com/swarming/task/{task_id}" - builder_defaults { - build_numbers: YES - dimensions: "cpu:x86-64" - dimensions: "pool:luci.chromium.webrtc.fyi" - luci_migration_host: "luci-migration.appspot.com" - execution_timeout_secs: 7200 # 2h - recipe { - cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" - cipd_version: "refs/heads/master" - properties: "mastername:chromium.webrtc.fyi" - name: "chromium" - } - service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" - swarming_tags: "vpython:native-python-wrapper" - } - - # Keep builders grouped by OS, then sorted by name. - - # Android - - builders { mixins: "linux" name: "WebRTC Chromium FYI Android Builder" } - builders { mixins: "linux" name: "WebRTC Chromium FYI Android Builder (dbg)" } - builders { mixins: "linux" name: "WebRTC Chromium FYI Android Builder ARM64 (dbg)" } - builders { mixins: "linux" name: "WebRTC Chromium FYI Android Tests (dbg) (K Nexus5)" } - builders { mixins: "linux" name: "WebRTC Chromium FYI Android Tests (dbg) (M Nexus5X)" } - - # iOS - - builders { mixins: "ios-webrtc" name: "WebRTC Chromium FYI ios-device" } - builders { mixins: "ios-webrtc" name: "WebRTC Chromium FYI ios-simulator" } - - # Linux - - builders { mixins: "linux" name: "WebRTC Chromium FYI Linux Builder" } - builders { mixins: "linux" name: "WebRTC Chromium FYI Linux Builder (RBE)" } - builders { mixins: "linux" name: "WebRTC Chromium FYI Linux Builder (dbg)" } - builders { mixins: "linux" name: "WebRTC Chromium FYI Linux Builder (dbg) (RBE)" } - builders { mixins: "linux" name: "WebRTC Chromium FYI Linux Tester" } - - # Mac - - builders { - name: "WebRTC Chromium FYI Mac Builder" - mixins: "mac" - dimensions: "cores:8" - } - builders { - name: "WebRTC Chromium FYI Mac Builder (dbg)" - mixins: "mac" - dimensions: "cores:8" - } - builders { mixins: "mac" name: "WebRTC Chromium FYI Mac Tester" } - - # Win - - builders { mixins: "win" name: "WebRTC Chromium FYI Win Builder" } - builders { mixins: "win" name: "WebRTC Chromium FYI Win Builder (dbg)" } - builders { mixins: "win" name: "WebRTC Chromium FYI Win10 Tester" } - builders { mixins: "win" name: "WebRTC Chromium FYI Win7 Tester" } - builders { mixins: "win" name: "WebRTC Chromium FYI Win8 Tester" } - } -}
diff --git a/infra/config/global/lint-luci-milo.py b/infra/config/global/lint-luci-milo.py deleted file mode 100755 index 076a32ac..0000000 --- a/infra/config/global/lint-luci-milo.py +++ /dev/null
@@ -1,92 +0,0 @@ -#!/usr/bin/env python -# 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. - -"""Checks that the main console and subconsole configs are consistent.""" - -import collections -import difflib -import os -import sys - -THIS_DIR = os.path.dirname(os.path.abspath(__file__)) -SRC_ROOT = os.path.join(THIS_DIR, '..', '..', '..') -sys.path.insert(1, os.path.join( - SRC_ROOT, "third_party", "protobuf", "python")) - -import google.protobuf.text_format -import project_pb2 - - -def compare_builders(name, main_builders, sub_builders): - # Checks that the builders on a subwaterfall on the main waterfall - # are consistent with the builders on that subwaterfall's main page. - # For example, checks that the builders on the "chromium.win" section - # are the same as on the dedicated standalone chromium.win waterfall. - def to_list(builders, category_prefix=''): - desc_list = [] - for builder in builders: - desc_list.append('name: ' + ', '.join(builder.name)) - # A bot with "chromium.win|foo|bar" on the main waterfall should have - # a category of "foo|bar" on the "chromium.win" subwaterfall. - category = builder.category - if category_prefix: - if category: - category = category_prefix + '|' + category - else: - category = category_prefix - desc_list.append('category: ' + category) - desc_list.append('short_name: ' + builder.short_name) - return desc_list - main_desc = to_list(main_builders) - sub_desc = to_list(sub_builders, name) - - if main_desc != sub_desc: - print ('bot lists different between main waterfall ' + - 'and stand-alone %s waterfall:' % name) - print '\n'.join(difflib.unified_diff(main_desc, sub_desc, - fromfile='main', tofile=name, - lineterm='')) - print - return False - return True - - -def main(): - project = project_pb2.Project() - with open(os.path.join(THIS_DIR, 'luci-milo.cfg'), 'rb') as f: - google.protobuf.text_format.Parse(f.read(), project) - - # Maps subwaterfall name to list of builders on that subwaterfall - # on the main waterfall. - subwaterfalls = collections.defaultdict(list) - for console in project.consoles: - if console.id == 'main': - # Chromium main waterfall console. - for builder in console.builders: - subwaterfall = builder.category.split('|', 1)[0] - subwaterfalls[subwaterfall].append(builder) - - # subwaterfalls contains the waterfalls referenced by the main console - # Check that every referenced subwaterfall has its own console. - all_console_names = set([console.id for console in project.consoles]) - referenced_names = set(subwaterfalls.keys()) - missing_names = referenced_names - all_console_names - if missing_names: - print 'Missing subwaterfall console for', missing_names - return 1 - - # Check that the bots on a subwaterfall match the corresponding bots on the - # main waterfall - all_good = True - for console in project.consoles: - if console.id in subwaterfalls: - if not compare_builders(console.id, subwaterfalls[console.id], - console.builders): - all_good = False - return 0 if all_good else 1 - - -if __name__ == '__main__': - sys.exit(main())
diff --git a/infra/config/global/luci-logdog-dev.cfg b/infra/config/global/luci-logdog-dev.cfg deleted file mode 100644 index 7057d02..0000000 --- a/infra/config/global/luci-logdog-dev.cfg +++ /dev/null
@@ -1,16 +0,0 @@ -# Copyright (c) 2015 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -# -# For the schema of this file and documentation, see ProjectConfig message in -# https://luci-config.appspot.com/schemas/projects:luci-logdog.cfg - -# Auth groups who can read log streams. -reader_auth_groups: "all" -# Auth groups who can register and emit new log streams. -writer_auth_groups: "luci-logdog-chromium-dev-writers" - -# The base Google Storage archival path for this project. -# -# Archived LogDog logs will be written to this bucket/path. -archive_gs_bucket: "chromium-luci-logdog"
diff --git a/infra/config/global/luci-logdog.cfg b/infra/config/global/luci-logdog.cfg deleted file mode 100644 index 29302eb..0000000 --- a/infra/config/global/luci-logdog.cfg +++ /dev/null
@@ -1,16 +0,0 @@ -# Copyright (c) 2015 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -# -# For the schema of this file and documentation, see ProjectConfig message in -# https://luci-config.appspot.com/schemas/projects:luci-logdog.cfg - -# Auth groups who can read log streams. -reader_auth_groups: "all" -# Auth groups who can register and emit new log streams. -writer_auth_groups: "luci-logdog-chromium-writers" - -# The base Google Storage archival path for this project. -# -# Archived LogDog logs will be written to this bucket/path. -archive_gs_bucket: "chromium-luci-logdog"
diff --git a/infra/config/global/luci-milo-dev.cfg b/infra/config/global/luci-milo-dev.cfg deleted file mode 100644 index 3e8c9f3d..0000000 --- a/infra/config/global/luci-milo-dev.cfg +++ /dev/null
@@ -1,186 +0,0 @@ -logo_url: "https://storage.googleapis.com/chrome-infra-public/logo/chromium.svg" - -headers: { - id: "chromium" - oncalls: { - name: "Chromium" - url: "https://build.chromium.org/p/chromium/sheriff.json" - } - oncalls: { - name: "Android" - url: "https://build.chromium.org/p/chromium/sheriff_android.json" - } - oncalls: { - name: "iOS" - url: "https://build.chromium.org/p/chromium/sheriff_ios.json" - } - oncalls: { - name: "CrOS MTV" - url: "https://build.chromium.org/p/chromium/sheriff_cros_mtv.json" - } - oncalls: { - name: "CrOS non-MTV" - url: "https://build.chromium.org/p/chromium/sheriff_cros_nonmtv.json" - } - oncalls: { - name: "ChromeOS Gardener" - url: "https://build.chromium.org/p/chromium/sheriff_cr_cros_gardeners.json" - } - oncalls: { - name: "GPU" - url: "https://build.chromium.org/p/chromium/sheriff_gpu.json" - } - oncalls: { - name: "Angle" - url: "https://build.chromium.org/p/chromium/sheriff_angle.json" - } - oncalls: { - name: "Perf" - url: "https://build.chromium.org/p/chromium/sheriff_perf.json" - } - oncalls: { - name: "Perfbot" - url: "https://build.chromium.org/p/chromium/sheriff_perfbot.json" - } - oncalls: { - name: "V8" - url: "https://build.chromium.org/p/chromium/sheriff_v8.json" - } - oncalls: { - name: "Trooper" - url: "https://build.chromium.org/p/chromium/trooper.json" - } - - links: { - name: "Builds" - links: { - text: "continuous" - url: "https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html" - alt: "Continuous browser snapshots" - } - links: { - text: "symbols" - url: "https://www.chromium.org/developers/how-tos/debugging-on-windows" - alt: "Windows Symbols" - } - links: { - text: "status" - url: "https://chromium-status.appspot.com/" - alt: "Current tree status" - } - } - - links: { - name: "Dashboards" - links: { - text: "perf" - url: "https://chromeperf.appspot.com/" - alt: "Chrome perf dashboard" - } - links: { - text: "flakiness" - url: "https://test-results.appspot.com/dashboards/flakiness_dashboard.html" - alt: "Flakiness dashboard" - } - } - - links: { - name: "Chromium" - links: { - text: "source" - url: "https://chromium.googlesource.com/chromium/src" - alt: "Chromium source code repository" - } - links: { - text: "reviews" - url: "https://chromium-review.googlesource.com" - alt: "Chromium code review tool" - } - links: { - text: "bugs" - url: "https://crbug.com" - alt: "Chromium bug tracker" - } - links: { - text: "dev" - url: "https://dev.chromium.org/Home" - alt: "Chromium developer home page" - } - links: { - text: "support" - url: "https://support.google.com/chrome/#topic=7438008" - alt: "Google Chrome help center" - } - } - - links: { - name: "Consoles" - links: { - text: "swarm" - url: "/p/chromium/g/chromium.swarm" - alt: "Chromium Swarm console" - } - links: { - text: "prod" - url: "https://luci-milo.appspot.com/p/chromium/g/main/console" - alt: "Main luci-milo console" - } - } - - links: { - name: "Navigate" - links: { - text: "about" - url: "http://dev.chromium.org/developers/testing/chromium-build-infrastructure/tour-of-the-chromium-buildbot" - alt: "Tour of the console" - } - links: { - text: "customize" - url: "https://chromium.googlesource.com/chromium/src/+/master/infra/config/global/luci-milo-dev.cfg" - alt: "Customize this console" - } - } - - tree_status_host: "chromium-status.appspot.com" -} - -consoles { - header_id: "chromium" - id: "chromium.swarm" - name: "chromium.swarm" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.ci/Android N5 Swarm" - } - builders { - name: "buildbucket/luci.chromium.ci/Android N5X Swarm" - } - builders { - name: "buildbucket/luci.chromium.ci/ChromeOS Swarm" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Swarm" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Swarm" - } - builders { - name: "buildbucket/luci.chromium.ci/Windows Swarm" - } -} - -consoles { - id: "snapshots" - builder_view_only: true - header_id: "chromium" - manifest_name: "REVISION" - name: "Snapshot Builder" - builders { - name: "buildbucket/luci.chromium.cron/Snapshot Builder" - } - builders { - name: "buildbucket/luci.chromium.cron/Snapshots" - } -}
diff --git a/infra/config/global/luci-milo.cfg b/infra/config/global/luci-milo.cfg deleted file mode 100644 index b71b4683..0000000 --- a/infra/config/global/luci-milo.cfg +++ /dev/null
@@ -1,4800 +0,0 @@ -logo_url: "https://storage.googleapis.com/chrome-infra-public/logo/chromium.svg" - -headers { - id: "chromium" - oncalls { - name: "Chromium" - url: "https://rota-ng.appspot.com/legacy/sheriff.json" - } - oncalls { - name: "Android" - url: "https://rota-ng.appspot.com/legacy/sheriff_android.json" - } - oncalls { - name: "iOS" - url: "https://rota-ng.appspot.com/legacy/sheriff_ios.json" - } - oncalls { - name: "CrOS MTV" - url: "https://rota-ng.appspot.com/legacy/sheriff_cros_mtv.json" - } - oncalls { - name: "CrOS non-MTV" - url: "https://rota-ng.appspot.com/legacy/sheriff_cros_nonmtv.json" - } - oncalls { - name: "ChromeOS Gardener" - url: "https://rota-ng.appspot.com/legacy/sheriff_cr_cros_gardeners.json" - } - oncalls { - name: "GPU" - url: "https://rota-ng.appspot.com/legacy/sheriff_gpu.json" - } - oncalls { - name: "Angle" - url: "https://rota-ng.appspot.com/legacy/sheriff_angle.json" - } - oncalls { - name: "Perf" - url: "https://rota-ng.appspot.com/legacy/sheriff_perf.json" - } - oncalls { - name: "Perfbot" - url: "https://rota-ng.appspot.com/legacy/sheriff_perfbot.json" - } - oncalls { - name: "V8" - url: "https://rota-ng.appspot.com/legacy/sheriff_v8.json" - } - oncalls { - name: "Trooper" - url: "https://rota-ng.appspot.com/legacy/trooper.json" - } - links { - name: "Builds" - links { - text: "continuous" - url: "https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html" - alt: "Continuous browser snapshots" - } - links { - text: "symbols" - url: "https://www.chromium.org/developers/how-tos/debugging-on-windows" - alt: "Windows Symbols" - } - links { - text: "status" - url: "https://chromium-status.appspot.com/" - alt: "Current tree status" - } - } - links { - name: "Dashboards" - links { - text: "perf" - url: "https://chromeperf.appspot.com/" - alt: "Chrome perf dashboard" - } - links { - text: "flakiness" - url: "https://test-results.appspot.com/dashboards/flakiness_dashboard.html" - alt: "Flakiness dashboard" - } - } - links { - name: "Chromium" - links { - text: "source" - url: "https://chromium.googlesource.com/chromium/src" - alt: "Chromium source code repository" - } - links { - text: "reviews" - url: "https://chromium-review.googlesource.com" - alt: "Chromium code review tool" - } - links { - text: "bugs" - url: "https://crbug.com" - alt: "Chromium bug tracker" - } - links { - text: "coverage" - url: "https://chromium-coverage.appspot.com" - alt: "Chromium code coverage dashboard" - } - links { - text: "dev" - url: "https://dev.chromium.org/Home" - alt: "Chromium developer home page" - } - links { - text: "support" - url: "https://support.google.com/chrome/#topic=7438008" - alt: "Google Chrome help center" - } - } - links { - name: "Consoles" - links { - text: "android" - url: "/p/chromium/g/chromium.android" - alt: "Chromium Android console" - } - links { - text: "chromedriver" - url: "/p/chromium/g/chromium.chromedriver" - alt: "Chromium Chromedriver console" - } - links { - text: "fuzz" - url: "/p/chromium/g/chromium.fuzz" - alt: "Chromium Fuzz console" - } - links { - text: "fyi" - url: "/p/chromium/g/chromium.fyi" - alt: "Chromium FYI console" - } - links { - text: "gpu" - url: "/p/chromium/g/chromium.gpu" - alt: "Chromium GPU console" - } - links { - text: "perf" - url: "/p/chromium/g/chromium.perf" - alt: "Chromium Perf console" - } - links { - text: "perf.fyi" - url: "/p/chrome/g/chrome.perf.fyi/console" - alt: "Chromium Perf FYI console" - } - links { - text: "webrtc" - url: "/p/chromium/g/chromium.webrtc" - alt: "Chromium WebRTC console" - } - links { - text: "chromiumos" - url: "/p/chromium/g/chromium.chromiumos" - alt: "ChromiumOS console" - } - } - links { - name: "Tryservers" - links { - text: "android" - url: "/p/chromium/g/tryserver.chromium.android/builders" - alt: "Android" - } - links { - text: "angle" - url: "/p/chromium/g/angle.try/builders" - alt: "Angle" - } - links { - text: "blink" - url: "/p/chromium/g/tryserver.blink/builders" - alt: "Blink" - } - links { - text: "chromiumos" - url: "/p/chromium/g/tryserver.chromium.chromiumos/builders" - alt: "ChromiumOS" - } - links { - text: "linux" - url: "/p/chromium/g/tryserver.chromium.linux/builders" - alt: "Linux" - } - links { - text: "mac" - url: "/p/chromium/g/tryserver.chromium.mac/builders" - alt: "Mac" - } - links { - text: "win" - url: "/p/chromium/g/tryserver.chromium.win/builders" - alt: "Win" - } - } - links { - name: "Navigate" - links { - text: "about" - url: "http://dev.chromium.org/developers/testing/chromium-build-infrastructure/tour-of-the-chromium-buildbot" - alt: "Tour of the console" - } - links { - text: "customize" - url: "https://chromium.googlesource.com/chromium/src/+/master/infra/config/global/luci-milo.cfg" - alt: "Customize this console" - } - } - console_groups { - title { - text: "Tree Closers" - url: "https://chromium-status.appspot.com/" - } - console_ids: "chromium/chromium" - console_ids: "chromium/chromium.win" - console_ids: "chromium/chromium.mac" - console_ids: "chromium/chromium.linux" - console_ids: "chromium/chromium.chromiumos" - console_ids: "chromium/chromium.chrome" - console_ids: "chromium/chromium.memory" - console_ids: "chromium/chromium.gpu" - } - console_groups { - console_ids: "chromium/chromium.android" - console_ids: "chromium/chromium.perf" - console_ids: "chromium/chromium.gpu.fyi" - console_ids: "chromium/chromium.fuzz" - } - tree_status_host: "chromium-status.appspot.com" -} - -headers { - id: "chromiumos" - oncalls { - name: "Sheriff" - url: "https://rota-ng.appspot.com/legacy/sheriff.json" - } - oncalls { - name: "Sheriff 2" - url: "https://rota-ng.appspot.com/legacy/sheriff2.json" - } - oncalls { - name: "Gardeners" - url: "https://rota-ng.appspot.com/legacy/sheriff_cr_cros_gardeners.json" - } - links { - name: "Builds" - links { - text: "status" - url: "https://chromiumos-status.appspot.com/" - alt: "Chromium OS status page" - } - } - links { - name: "ChromiumOS" - links { - text: "sources" - url: "https://chromium.googlesource.com/" - alt: "Source code project" - } - links { - text: "reviews" - url: "https://chromium-review.googlesource.com" - alt: "Chromium code review tool" - } - links { - text: "bugs" - url: "https://crbug.com" - alt: "Chromium bug tracker" - } - links { - text: "dev" - url: "http://dev.chromium.org/chromium-os" - alt: "ChromiumOS developer home page" - } - } - links { - name: "Navigate" - links { - text: "about" - url: "http://dev.chromium.org/developers/testing/chromium-build-infrastructure/tour-of-the-chromium-buildbot" - alt: "Tour of the console" - } - links { - text: "customize" - url: "https://chromium.googlesource.com/infra/experimental/+/infra/config/luci-milo-dev.cfg" - alt: "Customize this console" - } - } - console_groups { - console_ids: "chromium/chromiumos-Closers" - console_ids: "chromium/chromiumos-Full" - console_ids: "chromium/chromiumos-Incremental" - console_ids: "chromium/chromiumos-ASAN" - console_ids: "chromium/chromiumos-CommitQueue" - console_ids: "chromium/chromiumos.chromium" - } - tree_status_host: "chromiumos-status.appspot.com" -} - -consoles { - header_id: "chromium" - id: "main" - name: "Chromium Main Console" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.ci/android-dbg" - category: "chromium|android" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/android-rel" - category: "chromium|android" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-dbg" - category: "chromium|linux" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-rel" - category: "chromium|linux" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/mac-dbg" - category: "chromium|mac" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/mac-rel" - category: "chromium|mac" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/win32-rel" - category: "chromium|win|32" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/win-rel" - category: "chromium|win|64" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Win Builder" - category: "chromium.win|release|builder" - short_name: "32" - } - builders { - name: "buildbucket/luci.chromium.ci/Win x64 Builder" - category: "chromium.win|release|builder" - short_name: "64" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 (32) Tests" - category: "chromium.win|release|tester" - short_name: "32" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 Tests (1)" - category: "chromium.win|release|tester" - short_name: "32" - } - builders { - name: "buildbucket/luci.chromium.ci/Win 7 Tests x64 (1)" - category: "chromium.win|release|tester" - short_name: "64" - } - builders { - name: "buildbucket/luci.chromium.ci/Win10 Tests x64" - category: "chromium.win|release|tester" - short_name: "w10" - } - builders { - name: "buildbucket/luci.chromium.ci/Win x64 Builder (dbg)" - category: "chromium.win|debug|builder" - short_name: "64" - } - builders { - name: "buildbucket/luci.chromium.ci/Win Builder (dbg)" - category: "chromium.win|debug|builder" - short_name: "32" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 Tests (dbg)(1)" - category: "chromium.win|debug|tester" - short_name: "7" - } - builders { - name: "buildbucket/luci.chromium.ci/Win10 Tests x64 (dbg)" - category: "chromium.win|debug|tester" - short_name: "10" - } - builders { - name: "buildbucket/luci.chromium.ci/Windows deterministic" - category: "chromium.win" - short_name: "det" - } - builders { - name: "buildbucket/luci.chromium.ci/WebKit Win10" - category: "chromium.win" - short_name: "wbk" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Builder" - category: "chromium.mac|release|builder" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac10.10 Tests" - category: "chromium.mac|release|tester" - short_name: "10" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac10.11 Tests" - category: "chromium.mac|release|tester" - short_name: "11" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac10.12 Tests" - category: "chromium.mac|release|tester" - short_name: "12" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac10.13 Tests" - category: "chromium.mac|release|tester" - short_name: "13" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Builder (dbg)" - category: "chromium.mac|debug" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac10.13 Tests (dbg)" - category: "chromium.mac|debug" - short_name: "13" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-device" - category: "chromium.mac|ios" - short_name: "dev" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-simulator" - category: "chromium.mac|ios" - short_name: "sim" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-simulator-full-configs" - category: "chromium.mac|ios" - short_name: "ful" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-device-xcode-clang" - category: "chromium.mac|ios|xcode" - short_name: "dev" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-simulator-xcode-clang" - category: "chromium.mac|ios|xcode" - short_name: "sim" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-uirefresh-simulator" - category: "chromium.mac|ios" - short_name: "ui" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-webview" - category: "chromium.mac|ios" - short_name: "web" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-slimnav" - category: "chromium.mac|ios" - short_name: "slim" - } - builders { - name: "buildbucket/luci.chromium.ci/WebKit Mac10.13 (retina)" - category: "chromium.mac|wbk" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Builder" - category: "chromium.linux|release" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Tests" - category: "chromium.linux|release" - short_name: "tst" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-gcc-rel" - category: "chromium.linux|release" - short_name: "gcc" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-xenial-rel" - category: "chromium.linux|release" - short_name: "xen" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-jumbo-rel" - category: "chromium.linux|release" - short_name: "jmb" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Builder (dbg)(32)" - category: "chromium.linux|debug|builder" - short_name: "32" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Builder (dbg)" - category: "chromium.linux|debug|builder" - short_name: "64" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Tests (dbg)(1)(32)" - category: "chromium.linux|debug|tester" - short_name: "32" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Tests (dbg)(1)" - category: "chromium.linux|debug|tester" - short_name: "64" - } - builders { - name: "buildbucket/luci.chromium.ci/Deterministic Linux (dbg)" - category: "chromium.linux|debug" - short_name: "det" - } - builders { - name: "buildbucket/luci.chromium.ci/Deterministic Linux" - category: "chromium.linux" - short_name: "det" - } - builders { - name: "buildbucket/luci.chromium.ci/Leak Detection Linux" - category: "chromium.linux" - short_name: "lk" - } - builders { - name: "buildbucket/luci.chromium.ci/Cast Linux" - category: "chromium.linux|cast" - short_name: "vid" - } - builders { - name: "buildbucket/luci.chromium.ci/Cast Audio Linux" - category: "chromium.linux|cast" - short_name: "aud" - } - builders { - name: "buildbucket/luci.chromium.ci/fuchsia-arm64-cast" - category: "chromium.linux|fuchsia|cast" - short_name: "a64" - } - builders { - name: "buildbucket/luci.chromium.ci/fuchsia-x64-cast" - category: "chromium.linux|fuchsia|cast" - short_name: "x64" - } - builders { - name: "buildbucket/luci.chromium.ci/Fuchsia ARM64" - category: "chromium.linux|fuchsia" - short_name: "a64" - } - builders { - name: "buildbucket/luci.chromium.ci/Fuchsia x64" - category: "chromium.linux|fuchsia" - short_name: "x64" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-ozone-rel" - category: "chromium.linux|ozone" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux ChromiumOS Full" - category: "chromium.chromiumos|default" - short_name: "ful" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-chromeos-rel" - category: "chromium.chromiumos|default" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-chromeos-dbg" - category: "chromium.chromiumos" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/chromeos-amd64-generic-cfi-thin-lto-rel" - category: "chromium.chromiumos|simple|release" - short_name: "x64" - } - builders { - name: "buildbucket/luci.chromium.ci/chromeos-amd64-generic-rel" - category: "chromium.chromiumos|simple|release" - short_name: "x64" - } - builders { - name: "buildbucket/luci.chromium.ci/chromeos-daisy-rel" - category: "chromium.chromiumos|simple|release" - short_name: "dsy" - } - builders { - name: "buildbot/chromium.chrome/Google Chrome Win" - category: "chromium.chrome" - short_name: "win" - } - builders { - name: "buildbot/chromium.chrome/Google Chrome Linux x64" - category: "chromium.chrome" - short_name: "lnx" - } - builders { - name: "buildbot/chromium.chrome/Google Chrome Mac" - category: "chromium.chrome" - short_name: "mac" - } - builders { - name: "buildbot/chromium.chrome/Google Chrome ChromeOS" - category: "chromium.chrome" - short_name: "cro" - } - builders { - name: "buildbot/chromium.memory/win-asan" - name: "buildbucket/luci.chromium.ci/win-asan" - category: "chromium.memory|win" - short_name: "asn" - } - builders { - name: "buildbot/chromium.memory/Mac ASan 64 Builder" - name: "buildbucket/luci.chromium.ci/Mac ASan 64 Builder" - category: "chromium.memory|mac" - short_name: "bld" - } - builders { - name: "buildbot/chromium.memory/Mac ASan 64 Tests (1)" - name: "buildbucket/luci.chromium.ci/Mac ASan 64 Tests (1)" - category: "chromium.memory|mac" - short_name: "tst" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux TSan Builder" - category: "chromium.memory|linux|TSan v2" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux TSan Tests" - category: "chromium.memory|linux|TSan v2" - short_name: "tst" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux ASan LSan Builder" - category: "chromium.memory|linux|asan lsan" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux ASan LSan Tests (1)" - category: "chromium.memory|linux|asan lsan" - short_name: "tst" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux ASan Tests (sandboxed)" - category: "chromium.memory|linux|asan lsan" - short_name: "sbx" - } - builders { - name: "buildbot/chromium.memory/Linux MSan Builder" - name: "buildbucket/luci.chromium.ci/Linux MSan Builder" - category: "chromium.memory|linux|msan" - short_name: "bld" - } - builders { - name: "buildbot/chromium.memory/Linux MSan Tests" - name: "buildbucket/luci.chromium.ci/Linux MSan Tests" - category: "chromium.memory|linux|msan" - short_name: "tst" - } - builders { - name: "buildbot/chromium.memory/Linux CFI" - name: "buildbucket/luci.chromium.ci/Linux CFI" - category: "chromium.memory|linux" - short_name: "cfi" - } - builders { - name: "buildbucket/luci.chromium.ci/WebKit Linux Trusty ASAN" - category: "chromium.memory|linux|webkit" - short_name: "asn" - } - builders { - name: "buildbucket/luci.chromium.ci/WebKit Linux Trusty MSAN" - category: "chromium.memory|linux|webkit" - short_name: "msn" - } - builders { - name: "buildbucket/luci.chromium.ci/WebKit Linux Trusty Leak" - category: "chromium.memory|linux|webkit" - short_name: "lk" - } - builders { - name: "buildbot/chromium.memory/Linux Chromium OS ASan LSan Builder" - name: "buildbucket/luci.chromium.ci/Linux Chromium OS ASan LSan Builder" - category: "chromium.memory|cros|asan" - short_name: "bld" - } - builders { - name: "buildbot/chromium.memory/Linux Chromium OS ASan LSan Tests (1)" - name: "buildbucket/luci.chromium.ci/Linux Chromium OS ASan LSan Tests (1)" - category: "chromium.memory|cros|asan" - short_name: "tst" - } - builders { - name: "buildbot/chromium.memory/Linux ChromiumOS MSan Builder" - name: "buildbucket/luci.chromium.ci/Linux ChromiumOS MSan Builder" - category: "chromium.memory|cros|msan" - short_name: "bld" - } - builders { - name: "buildbot/chromium.memory/Linux ChromiumOS MSan Tests" - name: "buildbucket/luci.chromium.ci/Linux ChromiumOS MSan Tests" - category: "chromium.memory|cros|msan" - short_name: "tst" - } - builders { - name: "buildbot/chromium.memory/Android CFI" - name: "buildbucket/luci.chromium.ci/Android CFI" - category: "chromium.memory|android" - short_name: "cfi" - } -} - -consoles { - header_id: "chromium" - id: "chromium.win" - name: "chromium.win" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.ci/Win Builder" - category: "release|builder" - short_name: "32" - } - builders { - name: "buildbucket/luci.chromium.ci/Win x64 Builder" - category: "release|builder" - short_name: "64" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 (32) Tests" - category: "release|tester" - short_name: "32" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 Tests (1)" - category: "release|tester" - short_name: "32" - } - builders { - name: "buildbucket/luci.chromium.ci/Win 7 Tests x64 (1)" - category: "release|tester" - short_name: "64" - } - builders { - name: "buildbucket/luci.chromium.ci/Win10 Tests x64" - category: "release|tester" - short_name: "w10" - } - builders { - name: "buildbucket/luci.chromium.ci/Win x64 Builder (dbg)" - category: "debug|builder" - short_name: "64" - } - builders { - name: "buildbucket/luci.chromium.ci/Win Builder (dbg)" - category: "debug|builder" - short_name: "32" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 Tests (dbg)(1)" - category: "debug|tester" - short_name: "7" - } - builders { - name: "buildbucket/luci.chromium.ci/Win10 Tests x64 (dbg)" - category: "debug|tester" - short_name: "10" - } - builders { - name: "buildbucket/luci.chromium.ci/Windows deterministic" - short_name: "det" - } - builders { - name: "buildbucket/luci.chromium.ci/WebKit Win10" - short_name: "wbk" - } -} - -consoles { - header_id: "chromium" - id: "chromium.mac" - name: "chromium.mac" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.ci/Mac Builder" - category: "release|builder" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac10.10 Tests" - category: "release|tester" - short_name: "10" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac10.11 Tests" - category: "release|tester" - short_name: "11" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac10.12 Tests" - category: "release|tester" - short_name: "12" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac10.13 Tests" - category: "release|tester" - short_name: "13" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Builder (dbg)" - category: "debug" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac10.13 Tests (dbg)" - category: "debug" - short_name: "13" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-device" - category: "ios" - short_name: "dev" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-simulator" - category: "ios" - short_name: "sim" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-simulator-full-configs" - category: "ios" - short_name: "ful" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-device-xcode-clang" - category: "ios|xcode" - short_name: "dev" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-simulator-xcode-clang" - category: "ios|xcode" - short_name: "sim" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-uirefresh-simulator" - category: "ios" - short_name: "ui" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-webview" - category: "ios" - short_name: "web" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-slimnav" - category: "ios" - short_name: "slim" - } - builders { - name: "buildbucket/luci.chromium.ci/WebKit Mac10.13 (retina)" - category: "wbk" - } -} - -consoles { - header_id: "chromium" - id: "chromium.linux" - name: "chromium.linux" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.ci/Linux Builder" - category: "release" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Tests" - category: "release" - short_name: "tst" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-gcc-rel" - category: "release" - short_name: "gcc" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-xenial-rel" - category: "release" - short_name: "xen" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-jumbo-rel" - category: "release" - short_name: "jmb" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Builder (dbg)(32)" - category: "debug|builder" - short_name: "32" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Builder (dbg)" - category: "debug|builder" - short_name: "64" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Tests (dbg)(1)(32)" - category: "debug|tester" - short_name: "32" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Tests (dbg)(1)" - category: "debug|tester" - short_name: "64" - } - builders { - name: "buildbucket/luci.chromium.ci/Deterministic Linux (dbg)" - category: "debug" - short_name: "det" - } - builders { - name: "buildbucket/luci.chromium.ci/Deterministic Linux" - short_name: "det" - } - builders { - name: "buildbucket/luci.chromium.ci/Leak Detection Linux" - short_name: "lk" - } - builders { - name: "buildbucket/luci.chromium.ci/Cast Linux" - category: "cast" - short_name: "vid" - } - builders { - name: "buildbucket/luci.chromium.ci/Cast Audio Linux" - category: "cast" - short_name: "aud" - } - builders { - name: "buildbucket/luci.chromium.ci/fuchsia-arm64-cast" - category: "fuchsia|cast" - short_name: "a64" - } - builders { - name: "buildbucket/luci.chromium.ci/fuchsia-x64-cast" - category: "fuchsia|cast" - short_name: "x64" - } - builders { - name: "buildbucket/luci.chromium.ci/Fuchsia ARM64" - category: "fuchsia" - short_name: "a64" - } - builders { - name: "buildbucket/luci.chromium.ci/Fuchsia x64" - category: "fuchsia" - short_name: "x64" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-ozone-rel" - category: "ozone" - short_name: "bld" - } -} - -consoles { - header_id: "chromium" - id: "chromium.chromiumos" - name: "chromium.chromiumos" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.ci/Linux ChromiumOS Full" - category: "default" - short_name: "ful" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-chromeos-rel" - category: "default" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-chromeos-dbg" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/chromeos-amd64-generic-cfi-thin-lto-rel" - category: "simple|release" - short_name: "x64" - } - builders { - name: "buildbucket/luci.chromium.ci/chromeos-amd64-generic-rel" - category: "simple|release" - short_name: "x64" - } - builders { - name: "buildbucket/luci.chromium.ci/chromeos-daisy-rel" - category: "simple|release" - short_name: "dsy" - } -} - -consoles { - header_id: "chromium" - id: "chromium.chrome" - name: "chromium.chrome" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbot/chromium.chrome/Google Chrome Win" - short_name: "win" - } - builders { - name: "buildbot/chromium.chrome/Google Chrome Linux x64" - short_name: "lnx" - } - builders { - name: "buildbot/chromium.chrome/Google Chrome Mac" - short_name: "mac" - } - builders { - name: "buildbot/chromium.chrome/Google Chrome ChromeOS" - short_name: "cro" - } -} - -consoles { - header_id: "chromium" - id: "chromium.memory" - name: "chromium.memory" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbot/chromium.memory/win-asan" - name: "buildbucket/luci.chromium.ci/win-asan" - category: "win" - short_name: "asn" - } - builders { - name: "buildbot/chromium.memory/Mac ASan 64 Builder" - name: "buildbucket/luci.chromium.ci/Mac ASan 64 Builder" - category: "mac" - short_name: "bld" - } - builders { - name: "buildbot/chromium.memory/Mac ASan 64 Tests (1)" - name: "buildbucket/luci.chromium.ci/Mac ASan 64 Tests (1)" - category: "mac" - short_name: "tst" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux TSan Builder" - category: "linux|TSan v2" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux TSan Tests" - category: "linux|TSan v2" - short_name: "tst" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux ASan LSan Builder" - category: "linux|asan lsan" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux ASan LSan Tests (1)" - category: "linux|asan lsan" - short_name: "tst" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux ASan Tests (sandboxed)" - category: "linux|asan lsan" - short_name: "sbx" - } - builders { - name: "buildbot/chromium.memory/Linux MSan Builder" - name: "buildbucket/luci.chromium.ci/Linux MSan Builder" - category: "linux|msan" - short_name: "bld" - } - builders { - name: "buildbot/chromium.memory/Linux MSan Tests" - name: "buildbucket/luci.chromium.ci/Linux MSan Tests" - category: "linux|msan" - short_name: "tst" - } - builders { - name: "buildbot/chromium.memory/Linux CFI" - name: "buildbucket/luci.chromium.ci/Linux CFI" - category: "linux" - short_name: "cfi" - } - builders { - name: "buildbucket/luci.chromium.ci/WebKit Linux Trusty ASAN" - category: "linux|webkit" - short_name: "asn" - } - builders { - name: "buildbucket/luci.chromium.ci/WebKit Linux Trusty MSAN" - category: "linux|webkit" - short_name: "msn" - } - builders { - name: "buildbucket/luci.chromium.ci/WebKit Linux Trusty Leak" - category: "linux|webkit" - short_name: "lk" - } - builders { - name: "buildbot/chromium.memory/Linux Chromium OS ASan LSan Builder" - name: "buildbucket/luci.chromium.ci/Linux Chromium OS ASan LSan Builder" - category: "cros|asan" - short_name: "bld" - } - builders { - name: "buildbot/chromium.memory/Linux Chromium OS ASan LSan Tests (1)" - name: "buildbucket/luci.chromium.ci/Linux Chromium OS ASan LSan Tests (1)" - category: "cros|asan" - short_name: "tst" - } - builders { - name: "buildbot/chromium.memory/Linux ChromiumOS MSan Builder" - name: "buildbucket/luci.chromium.ci/Linux ChromiumOS MSan Builder" - category: "cros|msan" - short_name: "bld" - } - builders { - name: "buildbot/chromium.memory/Linux ChromiumOS MSan Tests" - name: "buildbucket/luci.chromium.ci/Linux ChromiumOS MSan Tests" - category: "cros|msan" - short_name: "tst" - } - builders { - name: "buildbot/chromium.memory/Android CFI" - name: "buildbucket/luci.chromium.ci/Android CFI" - category: "android" - short_name: "cfi" - } -} - -consoles { - header_id: "chromium" - id: "chromium.perf" - name: "chromium.perf" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbot/chromium.perf/Android Builder Perf" - name: "buildbucket/luci.chrome.ci/Android Builder Perf" - category: "builder|android" - short_name: "arm" - } - builders { - name: "buildbot/chromium.perf/Android arm64 Builder Perf" - name: "buildbucket/luci.chrome.ci/Android arm64 Builder Perf" - category: "builder|android" - short_name: "a64" - } - builders { - name: "buildbucket/luci.chrome.ci/android-builder-perf" - category: "builder|android|compile" - short_name: "arm" - } - builders { - name: "buildbucket/luci.chrome.ci/android_arm64-builder-perf" - category: "builder|android|compile" - short_name: "a64" - } - builders { - name: "buildbucket/luci.chrome.ci/win32-builder-perf" - category: "builder|win" - short_name: "32" - } - builders { - name: "buildbucket/luci.chrome.ci/win64-builder-perf" - category: "builder|win" - short_name: "64" - } - builders { - name: "buildbucket/luci.chrome.ci/mac-builder-perf" - category: "builder" - short_name: "mac" - } - builders { - name: "buildbucket/luci.chrome.ci/linux-builder-perf" - category: "builder" - short_name: "lnx" - } - builders { - name: "buildbot/chromium.perf/Android Nexus5 Perf" - name: "buildbucket/luci.chrome.ci/Android Nexus5 Perf" - category: "perf|android" - short_name: "N5" - } - builders { - name: "buildbot/chromium.perf/android-nexus5x-perf" - name: "buildbucket/luci.chrome.ci/android-nexus5x-perf" - category: "perf|android" - short_name: "N5X" - } - builders { - name: "buildbucket/luci.chrome.ci/android-go-perf" - category: "perf|android" - short_name: "go" - } - builders { - name: "buildbot/chromium.perf/Android Nexus5X WebView Perf" - name: "buildbucket/luci.chrome.ci/Android Nexus5X WebView Perf" - category: "perf|android|webview" - short_name: "N5X" - } - builders { - name: "buildbot/chromium.perf/Android Nexus6 WebView Perf" - name: "buildbucket/luci.chrome.ci/Android Nexus6 WebView Perf" - category: "perf|android|webview" - short_name: "N6" - } - builders { - name: "buildbot/chromium.perf/win-10-perf" - name: "buildbucket/luci.chrome.ci/win-10-perf" - category: "perf|win|10" - short_name: "w10" - } - builders { - name: "buildbot/chromium.perf/Win 7 Perf" - name: "buildbucket/luci.chrome.ci/Win 7 Perf" - category: "perf|win|7" - short_name: "32" - } - builders { - name: "buildbot/chromium.perf/Win 7 Nvidia GPU Perf" - name: "buildbucket/luci.chrome.ci/Win 7 Nvidia GPU Perf" - category: "perf|win|7" - short_name: "nvi" - } - builders { - name: "buildbot/chromium.perf/mac-10_12_laptop_low_end-perf" - name: "buildbucket/luci.chrome.ci/mac-10_12_laptop_low_end-perf" - category: "perf|mac" - short_name: "low" - } - builders { - name: "buildbot/chromium.perf/mac-10_13_laptop_high_end-perf" - name: "buildbucket/luci.chrome.ci/mac-10_13_laptop_high_end-perf" - category: "perf|mac" - short_name: "high" - } - builders { - name: "buildbot/chromium.perf/linux-perf" - name: "buildbucket/luci.chrome.ci/linux-perf" - category: "perf" - short_name: "lnx" - } -} - -consoles { - header_id: "chromium" - id: "chromium.fuzz" - name: "chromium.fuzz" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.ci/Afl Upload Linux ASan" - category: "afl" - short_name: "afl" - } - builders { - name: "buildbucket/luci.chromium.ci/Win ASan Release" - category: "win asan" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Win ASan Release Media" - category: "win asan" - short_name: "med" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac ASAN Debug" - category: "mac asan" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac ASAN Release" - category: "mac asan" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac ASAN Release Media" - category: "mac asan" - short_name: "med" - } - builders { - name: "buildbucket/luci.chromium.ci/ChromiumOS ASAN Release" - short_name: "cro" - } - builders { - name: "buildbucket/luci.chromium.ci/ASAN Debug" - category: "linux asan" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/ASAN Release" - category: "linux asan" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/ASAN Release Media" - category: "linux asan" - short_name: "med" - } - builders { - name: "buildbucket/luci.chromium.ci/ASan Debug (32-bit x86 with V8-ARM)" - category: "linux asan|x64 v8-ARM" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/ASan Release (32-bit x86 with V8-ARM)" - category: "linux asan|x64 v8-ARM" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/ASan Release Media (32-bit x86 with V8-ARM)" - category: "linux asan|x64 v8-ARM" - short_name: "med" - } - builders { - name: "buildbucket/luci.chromium.ci/Libfuzzer Upload Chrome OS ASan" - category: "libfuzz" - short_name: "chromeos-asan" - } - builders { - name: "buildbucket/luci.chromium.ci/Libfuzzer Upload Linux32 ASan" - category: "libfuzz" - short_name: "linux32" - } - builders { - name: "buildbucket/luci.chromium.ci/Libfuzzer Upload Linux32 ASan Debug" - category: "libfuzz" - short_name: "linux32-dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/Libfuzzer Upload Linux ASan" - category: "libfuzz" - short_name: "linux" - } - builders { - name: "buildbucket/luci.chromium.ci/Libfuzzer Upload Linux ASan Debug" - category: "libfuzz" - short_name: "linux-dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/Libfuzzer Upload Linux MSan" - category: "libfuzz" - short_name: "linux-msan" - } - builders { - name: "buildbucket/luci.chromium.ci/Libfuzzer Upload Linux UBSan" - category: "libfuzz" - short_name: "linux-ubsan" - } - builders { - name: "buildbucket/luci.chromium.ci/Libfuzzer Upload Mac ASan" - category: "libfuzz" - short_name: "mac-asan" - } - builders { - name: "buildbucket/luci.chromium.ci/Libfuzzer Upload Windows ASan" - category: "libfuzz" - short_name: "win-asan" - } - builders { - name: "buildbucket/luci.chromium.ci/Libfuzzer Upload Linux32 V8-ARM ASan" - category: "libfuzz" - short_name: "arm" - } - builders { - name: "buildbucket/luci.chromium.ci/Libfuzzer Upload Linux32 V8-ARM ASan Debug" - category: "libfuzz" - short_name: "arm-dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/Libfuzzer Upload Linux V8-ARM64 ASan" - category: "libfuzz" - short_name: "arm64" - } - builders { - name: "buildbucket/luci.chromium.ci/Libfuzzer Upload Linux V8-ARM64 ASan Debug" - category: "libfuzz" - short_name: "arm64-dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/MSAN Release (chained origins)" - category: "linux msan" - short_name: "org" - } - builders { - name: "buildbucket/luci.chromium.ci/MSAN Release (no origins)" - category: "linux msan" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/TSAN Debug" - category: "linux tsan" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/TSAN Release" - category: "linux tsan" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/UBSan Release" - category: "linux UBSan" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/UBSan vptr Release" - category: "linux UBSan" - short_name: "vpt" - } -} - -consoles { - header_id: "chromium" - include_experimental_builds: true - id: "migration-side-by-side" - name: "LUCI CI Migration Comparison Console" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.ci/Cast Android (dbg)" - category: "android|cast" - short_name: "ci" - } - builders { - name: "buildbot/chromium.android/Cast Android (dbg)" - category: "android|cast" - short_name: "bb" - } -} - -consoles { - header_id: "chromium" - id: "chromium" - name: "chromium" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - include_experimental_builds: true - builders { - name: "buildbucket/luci.chromium.ci/android-dbg" - category: "android" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/android-rel" - category: "android" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-dbg" - category: "linux" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-rel" - category: "linux" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/mac-dbg" - category: "mac" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/mac-rel" - category: "mac" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/win32-rel" - category: "win|32" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/win-rel" - category: "win|64" - short_name: "rel" - } -} - -consoles { - header_id: "chromium" - id: "chromium.android" - name: "chromium.android" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.ci/Android Cronet Builder" - category: "cronet" - short_name: "rel" - } - builders { - name: "buildbot/chromium.android/Android Cronet Builder (dbg)" - name: "buildbucket/luci.chromium.ci/Android Cronet Builder (dbg)" - category: "cronet" - short_name: "dbg" - } - builders { - name: "buildbot/chromium.android/Android Cronet Builder Asan" - name: "buildbucket/luci.chromium.ci/Android Cronet Builder Asan" - category: "cronet" - short_name: "asn" - } - builders { - name: "buildbot/chromium.android/Android Cronet KitKat Builder" - name: "buildbucket/luci.chromium.ci/Android Cronet KitKat Builder" - category: "cronet" - short_name: "kit" - } - builders { - name: "buildbot/chromium.android/Android Cronet Lollipop Builder" - name: "buildbucket/luci.chromium.ci/Android Cronet Lollipop Builder" - category: "cronet" - short_name: "lol" - } - builders { - name: "buildbot/chromium.android/Android Cronet Marshmallow 64bit Builder" - name: "buildbucket/luci.chromium.ci/Android Cronet Marshmallow 64bit Builder" - category: "cronet" - short_name: "mar" - } - builders { - name: "buildbot/chromium.android/Android Cronet Marshmallow 64bit Perf" - name: "buildbucket/luci.chromium.ci/Android Cronet Marshmallow 64bit Perf" - category: "cronet" - short_name: "prf" - } - builders { - name: "buildbot/chromium.android/Android Cronet ARM64 Builder" - name: "buildbucket/luci.chromium.ci/Android Cronet ARM64 Builder" - category: "cronet|arm64" - short_name: "rel" - } - builders { - name: "buildbot/chromium.android/Android Cronet ARM64 Builder (dbg)" - name: "buildbucket/luci.chromium.ci/Android Cronet ARM64 Builder (dbg)" - category: "cronet|arm64" - short_name: "dbg" - } - builders { - name: "buildbot/chromium.android/Android Cronet x86 Builder" - name: "buildbucket/luci.chromium.ci/Android Cronet x86 Builder" - category: "cronet|x86" - short_name: "rel" - } - builders { - name: "buildbot/chromium.android/Android Cronet x86 Builder (dbg)" - name: "buildbucket/luci.chromium.ci/Android Cronet x86 Builder (dbg)" - category: "cronet|x86" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/android-cronet-arm-dbg" - category: "cronet|luci|arm" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/android-cronet-arm-rel" - category: "cronet|luci|arm" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/android-cronet-arm64-dbg" - category: "cronet|luci|arm64" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/android-cronet-arm64-rel" - category: "cronet|luci|arm64" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/android-cronet-asan-arm-rel" - category: "cronet|luci|asan" - } - builders { - name: "buildbucket/luci.chromium.ci/android-cronet-kitkat-arm-rel" - category: "cronet|luci|test" - short_name: "k" - } - builders { - name: "buildbucket/luci.chromium.ci/android-cronet-lollipop-arm-rel" - category: "cronet|luci|test" - short_name: "l" - } - builders { - name: "buildbucket/luci.chromium.ci/android-cronet-marshmallow-arm64-rel" - category: "cronet|luci|test" - short_name: "m" - } - builders { - name: "buildbucket/luci.chromium.ci/android-cronet-x86-dbg" - category: "cronet|luci|x86" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/android-cronet-x86-rel" - category: "cronet|luci|x86" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/android-jumbo-rel" - category: "builder" - } - builders { - name: "buildbucket/luci.chromium.ci/Android arm Builder (dbg)" - category: "builder|arm" - short_name: "32" - } - builders { - name: "buildbucket/luci.chromium.ci/Android arm64 Builder (dbg)" - category: "builder|arm" - short_name: "64" - } - builders { - name: "buildbucket/luci.chromium.ci/Android x86 Builder (dbg)" - category: "builder|x86" - short_name: "32" - } - builders { - name: "buildbucket/luci.chromium.ci/Android x64 Builder (dbg)" - category: "builder|x86" - short_name: "64" - } - builders { - name: "buildbucket/luci.chromium.ci/Deterministic Android" - category: "builder|det" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Deterministic Android (dbg)" - category: "builder|det" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/KitKat Phone Tester (dbg)" - category: "tester|phone" - short_name: "K" - } - builders { - name: "buildbucket/luci.chromium.ci/Lollipop Phone Tester" - category: "tester|phone" - short_name: "L" - } - builders { - name: "buildbucket/luci.chromium.ci/Marshmallow 64 bit Tester" - category: "tester|phone" - short_name: "M" - } - builders { - name: "buildbucket/luci.chromium.ci/Nougat Phone Tester" - category: "tester|phone" - short_name: "N" - } - builders { - name: "buildbucket/luci.chromium.ci/Oreo Phone Tester" - category: "tester|phone" - short_name: "O" - } - builders { - name: "buildbucket/luci.chromium.ci/KitKat Tablet Tester" - category: "tester|tablet" - short_name: "K" - } - builders { - name: "buildbucket/luci.chromium.ci/Lollipop Tablet Tester" - category: "tester|tablet" - short_name: "L" - } - builders { - name: "buildbucket/luci.chromium.ci/Marshmallow Tablet Tester" - category: "tester|tablet" - short_name: "M" - } - builders { - name: "buildbucket/luci.chromium.ci/android-incremental-dbg" - category: "tester|incremental" - } - builders { - name: "buildbucket/luci.chromium.ci/Android WebView L (dbg)" - category: "webview" - short_name: "L" - } - builders { - name: "buildbucket/luci.chromium.ci/Android WebView M (dbg)" - category: "webview" - short_name: "M" - } - builders { - name: "buildbucket/luci.chromium.ci/Android WebView N (dbg)" - category: "webview" - short_name: "N" - } - builders { - name: "buildbucket/luci.chromium.ci/Android WebView O (dbg)" - category: "webview" - short_name: "O" - } - builders { - name: "buildbucket/luci.chromium.ci/android-kitkat-arm-rel" - category: "on_cq" - short_name: "K" - } - builders { - name: "buildbucket/luci.chromium.ci/android-marshmallow-arm64-rel" - category: "on_cq" - short_name: "M" - } - builders { - name: "buildbot/chromium.android/Cast Android (dbg)" - name: "buildbucket/luci.chromium.ci/Cast Android (dbg)" - category: "on_cq" - short_name: "cst" - } - builders { - name: "buildbucket/luci.chromium.ci/Android ASAN (dbg)" - category: "on_cq" - short_name: "san" - } -} - -consoles { - header_id: "chromium" - id: "chromium.android.fyi" - name: "chromium.android.fyi" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.ci/Lollipop Consumer Tester" - category: "Testers" - short_name: "con" - } - builders { - name: "buildbucket/luci.chromium.ci/Lollipop Low-end Tester" - category: "Testers" - short_name: "low" - } - builders { - name: "buildbot/chromium.android.fyi/Nougat Phone Tester" - name: "buildbucket/luci.chromium.ci/Nougat Phone Tester" - category: "Testers" - short_name: "N" - } - builders { - name: "buildbot/chromium.android.fyi/Memory Infra Tester" - name: "buildbucket/luci.chromium.ci/Memory Infra Tester" - category: "Memory" - } - builders { - name: "buildbot/chromium.android.fyi/Android Cronet Builder (dbg)" - name: "buildbucket/luci.chromium.ci/Android Cronet Builder (dbg)" - category: "Cronet" - short_name: "dbg" - } - builders { - name: "buildbot/chromium.android.fyi/Android Cronet KitKat Builder" - name: "buildbucket/luci.chromium.ci/Android Cronet KitKat Builder" - category: "Cronet" - short_name: "K" - } - builders { - name: "buildbucket/luci.chromium.ci/Android Tests (trial)(dbg)" - } - builders { - name: "buildbucket/luci.chromium.ci/Jelly Bean Tester" - } - builders { - name: "buildbucket/luci.chromium.ci/x86 Emulator Tester" - } - builders { - name: "buildbucket/luci.chromium.ci/Android Tests with Tracing" - } - builders { - name: "buildbucket/luci.chromium.ci/Android WebView O NetworkService (dbg)" - } -} - -consoles { - header_id: "chromium" - id: "chromium.chromedriver" - name: "chromium.chromedriver" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbot/chromium.chromedriver/Linux" - name: "buildbucket/luci.chromium.ci/Linux" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux32" - } - builders { - name: "buildbot/chromium.chromedriver/Mac 10.6" - name: "buildbucket/luci.chromium.ci/Mac 10.6" - } - builders { - name: "buildbot/chromium.chromedriver/Win7" - name: "buildbucket/luci.chromium.ci/Win7" - } -} - -consoles { - header_id: "chromium" - id: "chromium.clang" - name: "chromium.clang" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - - builders { - name: "buildbucket/luci.chromium.ci/ToTLinux" - category: "ToT Linux" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chrome.ci/ToTLinuxOfficial" - category: "ToT Linux" - short_name: "ofi" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTLinux (dbg)" - category: "ToT Linux" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTLinuxASan" - category: "ToT Linux" - short_name: "asn" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTLinuxASanLibfuzzer" - category: "ToT Linux" - short_name: "fuz" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTLinuxMSan" - category: "ToT Linux" - short_name: "msn" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTLinuxTSan" - category: "ToT Linux" - short_name: "tsn" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTLinuxThinLTO" - category: "ToT Linux" - short_name: "lto" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTLinuxUBSanVptr" - category: "ToT Linux" - short_name: "usn" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTAndroid" - category: "ToT Android" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTAndroid (dbg)" - category: "ToT Android" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTAndroid x64" - category: "ToT Android" - short_name: "x64" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTAndroid64" - category: "ToT Android" - short_name: "a64" - } - builders { - name: "buildbot/chromium.clang/ToTAndroidASan" - name: "buildbucket/luci.chromium.ci/ToTAndroidASan" - category: "ToT Android" - short_name: "asn" - } - builders { - name: "buildbot/chromium.clang/ToTAndroidCFI" - name: "buildbucket/luci.chromium.ci/ToTAndroidCFI" - category: "ToT Android" - short_name: "cfi" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTAndroidOfficial" - category: "ToT Android" - short_name: "off" - } - builders { - name: "buildbot/chromium.clang/ToTMac" - name: "buildbucket/luci.chromium.ci/ToTMac" - category: "ToT Mac" - short_name: "rel" - } - builders { - name: "buildbot/chromium.clang/ToTMac (dbg)" - name: "buildbucket/luci.chromium.ci/ToTMac (dbg)" - category: "ToT Mac" - short_name: "dbg" - } - builders { - name: "buildbot/chromium.clang/ToTMacASan" - name: "buildbucket/luci.chromium.ci/ToTMacASan" - category: "ToT Mac" - short_name: "asn" - } - builders { - name: "buildbot/chromium.clang/ToTWin" - name: "buildbucket/luci.chrome.ci/ToTWin" - category: "ToT Windows" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTWin(dbg)" - category: "ToT Windows" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTWin(dll)" - category: "ToT Windows" - short_name: "dll" - } - builders { - name: "buildbot/chromium.clang/ToTWin64" - name: "buildbucket/luci.chrome.ci/ToTWin64" - category: "ToT Windows|x64" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTWin64(dbg)" - category: "ToT Windows|x64" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTWin64(dll)" - category: "ToT Windows|x64" - short_name: "dll" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTWinASanLibfuzzer" - category: "ToT Windows|x64" - short_name: "fuz" - } - builders { - name: "buildbot/chromium.clang/ToTWinThinLTO64" - name: "buildbucket/luci.chrome.ci/ToTWinThinLTO64" - category: "ToT Windows|x64" - short_name: "lto" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTWinLibcxx64" - category: "ToT Windows|x64" - short_name: "cxx" - } - builders { - name: "buildbucket/luci.chromium.ci/CrWinAsan" - category: "ToT Windows|Asan" - short_name: "asn" - } - builders { - name: "buildbot/chromium.clang/CrWinAsan(dll)" - name: "buildbucket/luci.chromium.ci/CrWinAsan(dll)" - category: "ToT Windows|Asan" - short_name: "dll" - } - builders { - name: "buildbucket/luci.chromium.ci/CrWinAsanCov" - category: "ToT Windows|Asan" - short_name: "cov" - } - builders { - name: "buildbot/chromium.clang/linux-win_cross-rel" - name: "buildbucket/luci.chromium.ci/linux-win_cross-rel" - category: "ToT Windows" - short_name: "lxw" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTLinuxCoverage" - category: "ToT Code Coverage" - short_name: "linux" - } - builders { - name: "buildbot/chromium.clang/ToTMacCoverage" - name: "buildbucket/luci.chromium.ci/ToTMacCoverage" - category: "ToT Code Coverage" - short_name: "mac" - } - builders { - name: "buildbucket/luci.chromium.ci/CFI Linux CF" - category: "CFI|Linux" - short_name: "CF" - } - builders { - name: "buildbucket/luci.chromium.ci/CFI Linux ToT" - category: "CFI|Linux" - short_name: "ToT" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTWinCFI" - category: "CFI|Win" - short_name: "x86" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTWinCFI64" - category: "CFI|Win" - short_name: "x64" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTiOS" - category: "iOS" - short_name: "sim" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTiOSDevice" - category: "iOS" - short_name: "dev" - } - builders { - name: "buildbucket/luci.chromium.ci/UBSanVptr Linux" - short_name: "usn" - } -} - -consoles { - header_id: "chromium" - id: "luci.chromium.clang" - name: "luci.chromium.clang" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - include_experimental_builds: true - - builders { - name: "buildbucket/luci.chromium.ci/ToTLinux" - category: "ToT Linux" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chrome.ci/ToTLinuxOfficial" - category: "ToT Linux" - short_name: "ofi" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTLinux (dbg)" - category: "ToT Linux" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTLinuxASan" - category: "ToT Linux" - short_name: "asn" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTLinuxASanLibfuzzer" - category: "ToT Linux" - short_name: "fuz" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTLinuxMSan" - category: "ToT Linux" - short_name: "msn" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTLinuxTSan" - category: "ToT Linux" - short_name: "tsn" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTLinuxThinLTO" - category: "ToT Linux" - short_name: "lto" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTLinuxUBSanVptr" - category: "ToT Linux" - short_name: "usn" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTAndroid" - category: "ToT Android" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTAndroid (dbg)" - category: "ToT Android" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTAndroid x64" - category: "ToT Android" - short_name: "x64" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTAndroid64" - category: "ToT Android" - short_name: "a64" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTAndroidASan" - category: "ToT Android" - short_name: "asn" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTAndroidCFI" - category: "ToT Android" - short_name: "cfi" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTAndroidOfficial" - category: "ToT Android" - short_name: "off" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTMac" - category: "ToT Mac" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTMac (dbg)" - category: "ToT Mac" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTMacASan" - category: "ToT Mac" - short_name: "asn" - } - builders { - name: "buildbucket/luci.chrome.ci/ToTWin" - category: "ToT Windows" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTWin(dbg)" - category: "ToT Windows" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTWin(dll)" - category: "ToT Windows" - short_name: "dll" - } - builders { - name: "buildbucket/luci.chrome.ci/ToTWin64" - category: "ToT Windows|x64" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTWin64(dbg)" - category: "ToT Windows|x64" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTWin64(dll)" - category: "ToT Windows|x64" - short_name: "dll" - } - builders { - name: "buildbucket/luci.chrome.ci/ToTWinThinLTO64" - category: "ToT Windows|x64" - short_name: "lto" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTWinLibcxx64" - category: "ToT Windows|x64" - short_name: "cxx" - } - builders { - name: "buildbucket/luci.chromium.ci/CrWinAsan" - category: "ToT Windows|Asan" - short_name: "asn" - } - builders { - name: "buildbucket/luci.chromium.ci/CrWinAsan(dll)" - category: "ToT Windows|Asan" - short_name: "dll" - } - builders { - name: "buildbucket/luci.chromium.ci/CrWinAsanCov" - category: "ToT Windows|Asan" - short_name: "cov" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-win_cross-rel" - category: "ToT Windows" - short_name: "lxw" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTLinuxCoverage" - category: "ToT Code Coverage" - short_name: "linux" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTMacCoverage" - category: "ToT Code Coverage" - short_name: "mac" - } - builders { - name: "buildbucket/luci.chromium.ci/CFI Linux CF" - category: "CFI|Linux" - short_name: "CF" - } - builders { - name: "buildbucket/luci.chromium.ci/CFI Linux ToT" - category: "CFI|Linux" - short_name: "ToT" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTWinCFI" - category: "CFI|Win" - short_name: "x86" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTWinCFI64" - category: "CFI|Win" - short_name: "x64" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTiOS" - category: "iOS" - short_name: "sim" - } - builders { - name: "buildbucket/luci.chromium.ci/ToTiOSDevice" - category: "iOS" - short_name: "dev" - } - builders { - name: "buildbucket/luci.chromium.ci/UBSanVptr Linux" - short_name: "usn" - } -} - - -consoles { - header_id: "chromium" - id: "chromium.fyi.goma" - name: "chromium.fyi.goma" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.ci/Win Builder Goma Canary" - category: "win|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Win Builder (dbg) Goma Canary" - category: "win|dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/Win Goma Canary LocalOutputCache" - category: "win|rel" - short_name: "loc" - } - builders { - name: "buildbucket/luci.chromium.ci/Win cl.exe Goma Canary LocalOutputCache" - category: "cl.exe|rel" - short_name: "loc" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 Builder Goma Canary" - category: "win7|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 Builder (dbg) Goma Canary" - category: "win7|dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/WinMSVC64 Goma Canary" - category: "cl.exe|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Builder Goma Canary" - category: "mac|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Builder (dbg) Goma Canary" - category: "mac|dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Goma Canary (clobber)" - category: "mac|rel" - short_name: "clb" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Builder (dbg) Goma Canary (clobber)" - category: "mac|dbg" - short_name: "clb" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Goma Canary LocalOutputCache" - category: "mac|rel" - short_name: "loc" - } - builders { - name: "buildbucket/luci.chromium.ci/chromeos-amd64-generic-rel-goma-canary" - category: "cros|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Builder Goma Canary" - category: "linux|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux x64 Goma Canary (clobber)" - category: "linux|rel" - short_name: "clb" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux x64 Goma Canary LocalOutputCache" - category: "linux|rel" - short_name: "loc" - } - builders { - name: "buildbucket/luci.chromium.ci/Android Builder (dbg) Goma Canary" - category: "android|dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-device-goma-canary-clobber" - category: "ios|rel" - short_name: "clb" - } -} - -consoles { - header_id: "chromium" - id: "goma.latest" - name: "goma.latest" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.ci/Win Builder Goma Latest Client" - category: "win|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Win Builder (dbg) Goma Latest Client" - category: "win|dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/Win Goma Latest Client LocalOutputCache" - category: "win|rel" - short_name: "loc" - } - builders { - name: "buildbucket/luci.chromium.ci/Win cl.exe Goma Latest Client LocalOutputCache" - category: "cl.exe|rel" - short_name: "loc" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 Builder Goma Latest Client" - category: "win7|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 Builder (dbg) Goma Latest Client" - category: "win7|dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/WinMSVC64 Goma Latest Client" - category: "cl.exe|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Builder Goma Latest Client" - category: "mac|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Builder (dbg) Goma Latest Client" - category: "mac|dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Goma Latest Client (clobber)" - category: "mac|rel" - short_name: "clb" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Builder (dbg) Goma Latest Client (clobber)" - category: "mac|dbg" - short_name: "clb" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Goma Latest Client LocalOutputCache" - category: "mac|rel" - short_name: "loc" - } - builders { - name: "buildbucket/luci.chromium.ci/chromeos-amd64-generic-rel-goma-latest-client" - category: "cros|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Builder Goma Latest Client" - category: "linux|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux x64 Goma Latest Client (clobber)" - category: "linux|rel" - short_name: "clb" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux x64 Goma Latest Client LocalOutputCache" - category: "linux|rel" - short_name: "loc" - } - builders { - name: "buildbucket/luci.chromium.ci/Android Builder (dbg) Goma Latest Client" - category: "android|dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-device-goma-latest-client-clobber" - category: "ios" - short_name: "clb" - } -} - -consoles { - header_id: "chromium" - id: "chromium.fyi" - name: "chromium.fyi" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.ci/Android Builder (dbg)" - category: "android_builder" - } - builders { - name: "buildbucket/luci.chromium.ci/Android Remoting Tests" - category: "android_tests" - } - builders { - name: "buildbucket/luci.chromium.ci/Android Find Annotated Test" - category: "android_tests" - } - builders { - name: "buildbucket/luci.chromium.ci/Android VR Tests" - category: "android_tests" - } - builders { - name: "buildbucket/luci.chromium.ci/Android ChromeDriver Tests (dbg)" - category: "android_tests" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Clang Analyzer" - category: "clang tot" - } - builders { - name: "buildbucket/luci.chromium.ci/Closure Compilation Linux" - category: "closure_compilation" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-code-coverage" - category: "code_coverage" - short_name: "lnx" - } - builders { - name: "buildbucket/luci.chromium.ci/mac-code-coverage-generation" - category: "code_coverage" - short_name: "mac" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-simulator-cronet" - category: "cronet" - } - builders { - name: "buildbucket/luci.chromium.ci/mac-hermetic-upgrade-rel" - category: "mac" - short_name: "herm" - } - builders { - name: "buildbucket/luci.chromium.ci/mac-osxbeta-rel" - category: "mac" - short_name: "beta" - } - builders { - name: "buildbucket/luci.chromium.ci/mac-jumbo-rel" - category: "mac" - short_name: "jmb" - } - builders { - name: "buildbucket/luci.chromium.ci/win-jumbo-rel" - category: "win" - short_name: "jmb" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Mac 10.13" - category: "default" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Windows Analyze" - category: "default" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac deterministic" - category: "deterministic" - } - builders { - name: "buildbucket/luci.chromium.ci/Windows Clang deterministic" - category: "deterministic" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac deterministic (dbg)" - category: "deterministic" - } - builders { - name: "buildbucket/luci.chromium.ci/fuchsia-fyi-arm64-rel" - category: "fuchsia" - } - builders { - name: "buildbucket/luci.chromium.ci/fuchsia-fyi-x64-dbg" - category: "fuchsia" - } - builders { - name: "buildbucket/luci.chromium.ci/fuchsia-fyi-x64-rel" - category: "fuchsia" - } - builders { - name: "buildbucket/luci.chromium.ci/Android Builder (dbg) Goma Canary" - category: "goma|android|debug" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Builder Goma Canary" - category: "goma|linux" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux x64 Goma Canary (clobber)" - category: "goma|linux" - short_name: "clb" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux x64 Goma Canary LocalOutputCache" - category: "goma|linux" - short_name: "loc" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Builder (dbg) Goma Canary" - category: "goma|mac|debug" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Builder (dbg) Goma Canary (clobber)" - category: "goma|mac|debug" - short_name: "clb" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Builder Goma Canary" - category: "goma|mac" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Goma Canary (clobber)" - category: "goma|mac" - short_name: "clb" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Goma Canary LocalOutputCache" - category: "goma|mac" - short_name: "loc" - } - builders { - name: "buildbucket/luci.chromium.ci/Win Builder (dbg) Goma Canary" - category: "goma|win|debug" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 Builder (dbg) Goma Canary" - category: "goma|win|debug" - short_name: "7" - } - builders { - name: "buildbucket/luci.chromium.ci/Win Builder Goma Canary" - category: "goma|win" - } - builders { - name: "buildbucket/luci.chromium.ci/Win Goma Canary LocalOutputCache" - category: "goma|win" - short_name: "loc" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 Builder Goma Canary" - category: "goma|win" - short_name: "7" - } - builders { - name: "buildbucket/luci.chromium.ci/Win cl.exe Goma Canary LocalOutputCache" - category: "goma|win|cl.exe" - short_name: "loc" - } - builders { - name: "buildbucket/luci.chromium.ci/WinMSVC64 Goma Canary" - category: "goma|win|cl.exe" - } - builders { - name: "buildbucket/luci.chromium.ci/chromeos-amd64-generic-rel-goma-canary" - category: "goma|chromeos" - } - builders { - name: "buildbucket/luci.chromium.ci/chromeos-amd64-generic-rel-vm-tests" - category: "chromeos" - } - builders { - name: "buildbucket/luci.chromium.ci/chromeos-kevin-rel-hw-tests" - category: "chromos" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-device-goma-canary-clobber" - category: "goma|ios" - } - builders { - name: "buildbucket/luci.chromium.ci/ios12-sdk-device" - category: "iOS|iOS12" - short_name: "dev" - } - builders { - name: "buildbucket/luci.chromium.ci/ios12-sdk-simulator" - category: "iOS|iOS12" - short_name: "sim" - } - builders { - name: "buildbucket/luci.chromium.ci/Jumbo Linux x64" - category: "jumbo" - } - builders { - name: "buildbucket/luci.chromium.ci/Jumbo Mac" - category: "jumbo" - } - builders { - name: "buildbucket/luci.chromium.ci/Jumbo Win x64" - category: "jumbo" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-blink-animation-use-time-delta" - category: "linux|blink" - short_name: "TD" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-blink-heap-incremental-marking" - category: "linux|blink" - short_name: "IM" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-blink-heap-unified-gc" - category: "linux|blink" - short_name: "UGC" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-blink-heap-verification" - category: "linux|blink" - short_name: "VF" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux ARM" - category: "linux" - } - builders { - name: "buildbucket/luci.chromium.ci/VR Linux" - category: "linux" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-tcmalloc-rel" - category: "linux" - } - builders { - name: "buildbucket/luci.chromium.ci/Mojo Android" - category: "mojo" - short_name: "and" - } - builders { - name: "buildbucket/luci.chromium.ci/android-mojo-webview-rel" - category: "mojo" - short_name: "aw" - } - builders { - name: "buildbucket/luci.chromium.ci/Mojo ChromiumOS" - category: "mojo" - short_name: "cr" - } - builders { - name: "buildbucket/luci.chromium.ci/Mojo Linux" - category: "mojo" - short_name: "lnx" - } - builders { - name: "buildbucket/luci.chromium.ci/mac-mojo-rel" - category: "mojo" - short_name: "mac" - } - builders { - name: "buildbucket/luci.chromium.ci/Mojo Windows" - category: "mojo" - short_name: "win" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-chromium-tests-staging-builder" - category: "recipe|staging|linux" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-chromium-tests-staging-tests" - category: "recipe|staging|linux" - short_name: "tst" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux remote_run Builder" - category: "remote_run" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux remote_run Tester" - category: "remote_run" - } - builders { - name: "buildbucket/luci.chromium.ci/Site Isolation Android" - category: "site_isolation" - } - builders { - name: "buildbucket/luci.chromium.ci/linux-annotator-rel" - category: "network|traffic|annotations" - short_name: "lnx" - } - builders { - name: "buildbucket/luci.chromium.ci/win-annotator-rel" - category: "network|traffic|annotations" - short_name: "win" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Viz" - category: "viz" - } - builders { - name: "buildbucket/luci.chromium.ci/Win 10 Fast Ring" - category: "win10" - } -} - -consoles { - header_id: "chromium" - id: "chromium.gatekeeper" - name: "chromium.gatekeeper" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbot/chromium.gatekeeper/Chromium Gatekeeper" - } - builders { - name: "buildbot/chromium.gatekeeper/Chromium Gatekeeper Failure" - } -} - -consoles { - header_id: "chromium" - id: "chromium.goma" - name: "chromium.goma" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - include_experimental_builds: true - builders { - name: "buildbucket/luci.chromium.ci/Chromium Linux Goma Staging" - category: "clients5" - short_name: "lnx" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Mac Goma Staging" - category: "clients5" - short_name: "mac" - } - builders { - name: "buildbucket/luci.chromium.ci/CrWinGomaStaging" - category: "clients5" - short_name: "win" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Linux Goma RBE ToT" - category: "rbe|tot|linux|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Linux Goma RBE ToT (ATS)" - category: "rbe|tot|linux|rel" - short_name: "ats" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Win Goma RBE ToT" - category: "rbe|tot|win|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Android ARM 32-bit Goma RBE ToT" - category: "rbe|tot|android arm|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Linux Goma RBE Staging (clobber)" - category: "rbe|staging|linux|rel" - short_name: "clb" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Linux Goma RBE Staging" - category: "rbe|staging|linux|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Linux Goma RBE Staging (dbg) (clobber)" - category: "rbe|staging|linux|debug" - short_name: "clb" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Linux Goma RBE Staging (dbg)" - category: "rbe|staging|linux|debug" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Mac Goma RBE Staging (clobber)" - category: "rbe|staging|mac|rel" - short_name: "clb" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Mac Goma RBE Staging" - category: "rbe|staging|mac|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Mac Goma RBE Staging (dbg)" - category: "rbe|staging|mac|debug" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Android ARM 32-bit Goma RBE Staging" - category: "rbe|staging|android arm|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Linux Goma RBE Prod" - category: "rbe|prod|linux|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Linux Goma RBE Prod (clobber)" - category: "rbe|prod|linux|rel" - short_name: "clb" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Linux Goma RBE Prod (dbg)" - category: "rbe|prod|linux|dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Linux Goma RBE Prod (dbg) (clobber)" - category: "rbe|prod|linux|dbg" - short_name: "clb" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Android ARM 32-bit Goma RBE Prod" - category: "rbe|prod|android arm|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Android ARM 32-bit Goma RBE Prod (clobber)" - category: "rbe|prod|android arm|rel" - short_name: "clb" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Android ARM 32-bit Goma RBE Prod (dbg)" - category: "rbe|prod|android arm|dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Android ARM 32-bit Goma RBE Prod (dbg) (clobber)" - category: "rbe|prod|android arm|dbg" - short_name: "clb" - } -} - -consoles { - header_id: "chromium" - include_experimental_builds: true - id: "luci.chromium.goma" - name: "luci.chromium.goma" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.ci/Chromium Linux Goma Staging" - category: "clients5" - short_name: "lnx" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Mac Goma Staging" - category: "clients5" - short_name: "mac" - } - builders { - name: "buildbucket/luci.chromium.ci/CrWinGomaStaging" - category: "clients5" - short_name: "win" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Linux Goma RBE Staging (clobber)" - category: "rbe|rel" - short_name: "clb" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Linux Goma RBE Staging" - category: "rbe|rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Linux Goma RBE Staging (dbg) (clobber)" - category: "rbe|debug" - short_name: "clb" - } - builders { - name: "buildbucket/luci.chromium.ci/Chromium Linux Goma RBE Staging (dbg)" - category: "rbe|debug" - } -} - -consoles { - header_id: "chromium" - id: "chromium.gpu" - name: "chromium.gpu" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.ci/GPU Win Builder" - category: "Windows" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU Win Builder (dbg)" - category: "Windows" - } - builders { - name: "buildbucket/luci.chromium.ci/Win10 Debug (NVIDIA)" - category: "Windows" - } - builders { - name: "buildbucket/luci.chromium.ci/Win10 Release (NVIDIA)" - category: "Windows" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU Mac Builder" - category: "Mac" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU Mac Builder (dbg)" - category: "Mac" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Debug (Intel)" - category: "Mac" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Release (Intel)" - category: "Mac" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Retina Debug (AMD)" - category: "Mac" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Retina Release (AMD)" - category: "Mac" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU Linux Builder" - category: "Linux" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU Linux Builder (dbg)" - category: "Linux" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Debug (NVIDIA)" - category: "Linux" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Release (NVIDIA)" - category: "Linux" - } - builders { - name: "buildbot/chromium.gpu/Android Release (Nexus 5X)" - name: "buildbucket/luci.chromium.ci/Android Release (Nexus 5X)" - category: "Android" - } -} - -consoles { - header_id: "chromium" - id: "chromium.gpu.fyi" - name: "chromium.gpu.fyi" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.ci/GPU FYI Win Builder" - category: "Windows|Builder" - short_name: "x86" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU FYI Win x64 Builder" - category: "Windows|Builder" - short_name: "x64" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU FYI Win dEQP Builder" - category: "Windows|Builder|dEQP" - short_name: "x86" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU FYI Win x64 dEQP Builder" - category: "Windows|Builder|dEQP" - short_name: "x64" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU FYI Win Builder (dbg)" - category: "Windows|Builder|Debug" - short_name: "x86" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU FYI Win x64 Builder (dbg)" - category: "Windows|Builder|Debug" - short_name: "x64" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU FYI Win Clang Builder (dbg)" - category: "Windows|Builder|Debug" - short_name: "clg" - } - builders { - name: "buildbucket/luci.chromium.ci/Win10 FYI Debug (NVIDIA)" - category: "Windows|10|Nvidia" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/Win10 FYI Release (Intel HD 630)" - category: "Windows|10|Intel" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Win10 FYI dEQP Release (Intel HD 630)" - category: "Windows|10|Intel" - short_name: "dqp" - } - builders { - name: "buildbucket/luci.chromium.ci/Win10 FYI Exp Release (Intel HD 630)" - category: "Windows|10|Intel" - short_name: "exp" - } - builders { - name: "buildbucket/luci.chromium.ci/Win10 FYI Release (NVIDIA)" - category: "Windows|10|Nvidia" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 FYI Debug (AMD)" - category: "Windows|7|AMD" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 FYI dEQP Release (AMD)" - category: "Windows|7|AMD" - short_name: "dqp" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 FYI Release (AMD)" - category: "Windows|7|AMD" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Win10 FYI Exp Release (NVIDIA)" - category: "Windows|10|Nvidia" - short_name: "exp" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 FYI Release (NVIDIA)" - category: "Windows|7|Nvidia" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Win10 FYI dEQP Release (NVIDIA)" - category: "Windows|10|Nvidia" - short_name: "dqp" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 FYI x64 Release (NVIDIA)" - category: "Windows|7|Nvidia|x64" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Win7 FYI x64 dEQP Release (NVIDIA)" - category: "Windows|7|Nvidia|x64" - short_name: "dqp" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU FYI Mac Builder" - category: "Mac|Builder" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU FYI Mac Builder (dbg)" - category: "Mac|Builder" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU FYI Mac dEQP Builder" - category: "Mac|Builder" - short_name: "dqp" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac FYI Debug (Intel)" - category: "Mac|Intel" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac FYI Experimental Release (Intel)" - category: "Mac|Intel" - short_name: "exp" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac FYI dEQP Release Intel" - category: "Mac|Intel" - short_name: "dqp" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac FYI Release (Intel)" - category: "Mac|Intel" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac FYI 10.14 Release (Intel)" - category: "Mac|Intel|10.14" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac Pro FYI Release (AMD)" - category: "Mac|AMD|Pro" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac FYI dEQP Release AMD" - category: "Mac|AMD" - short_name: "dqp" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac FYI Retina Debug (AMD)" - category: "Mac|AMD|Retina" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac FYI Retina Release (AMD)" - category: "Mac|AMD|Retina" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac FYI Experimental Retina Release (AMD)" - category: "Mac|AMD|Retina" - short_name: "exp" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac FYI 10.14 Release (AMD)" - category: "Mac|AMD|10.14" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac FYI Retina Debug (NVIDIA)" - category: "Mac|Nvidia" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac FYI Retina Release (NVIDIA)" - category: "Mac|Nvidia" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac FYI Experimental Retina Release (NVIDIA)" - category: "Mac|Nvidia" - short_name: "exp" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac FYI 10.14 Release (NVIDIA)" - category: "Mac|Nvidia|10.14" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Mac FYI GPU ASAN Release" - category: "Mac" - short_name: "asn" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU FYI Linux Builder" - category: "Linux|Builder" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU FYI Linux Builder (dbg)" - category: "Linux|Builder" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU FYI Linux Ozone Builder" - category: "Linux|Builder" - short_name: "ozn" - } - builders { - name: "buildbucket/luci.chromium.ci/GPU FYI Linux dEQP Builder" - category: "Linux|Builder" - short_name: "dqp" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux FYI Experimental Release (Intel HD 630)" - category: "Linux|Intel" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux FYI Release (Intel HD 630)" - category: "Linux|Intel" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux FYI dEQP Release (Intel HD 630)" - category: "Linux|Intel" - short_name: "dqp" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux FYI Ozone (Intel)" - category: "Linux|Intel" - short_name: "ozn" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux FYI Release (AMD R7 240)" - category: "Linux" - short_name: "amd" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux FYI Release (NVIDIA)" - category: "Linux|Nvidia" - short_name: "rel" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux FYI Experimental Release (NVIDIA)" - category: "Linux|Nvidia" - short_name: "exp" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux FYI Debug (NVIDIA)" - category: "Linux|Nvidia" - short_name: "dbg" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux FYI dEQP Release (NVIDIA)" - category: "Linux|Nvidia" - short_name: "dqp" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux FYI GPU TSAN Release" - category: "Linux" - short_name: "tsn" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI Release (Nexus 5)" - category: "Android|L32" - short_name: "N5" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI Release (Nexus 6)" - category: "Android|L32" - short_name: "N6" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI Release (Nexus 5X)" - category: "Android|M64|QCOM" - short_name: "N5X" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI Release (Nexus 6P)" - category: "Android|M64|QCOM" - short_name: "N6P" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI Release (Nexus 9)" - category: "Android|M64|NVDA" - short_name: "N9" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI Release (NVIDIA Shield TV)" - category: "Android|N64|NVDA" - short_name: "STV" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI 32 Vk Release (Nexus 5X)" - category: "Android|vk|O32" - short_name: "N5X" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI 64 Vk Release (Nexus 5X)" - category: "Android|vk|O64" - short_name: "N5X" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI 32 Vk Release (Pixel XL)" - category: "Android|vk|P32" - short_name: "PXL" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI 64 Vk Release (Pixel XL)" - category: "Android|vk|P64" - short_name: "PXL" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI 32 Vk Release (Pixel 2)" - category: "Android|vk|P32" - short_name: "P2" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI 64 Vk Release (Pixel 2)" - category: "Android|vk|P64" - short_name: "P2" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI dEQP Release (Nexus 5X)" - category: "Android|dqp|M64" - short_name: "N5X" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI 32 dEQP Vk Release (Nexus 5X)" - category: "Android|dqp|vk|O32" - short_name: "N5X" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI 64 dEQP Vk Release (Nexus 5X)" - category: "Android|dqp|vk|O64" - short_name: "N5X" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI 32 dEQP Vk Release (Pixel XL)" - category: "Android|dqp|vk|P32" - short_name: "PXL" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI 64 dEQP Vk Release (Pixel XL)" - category: "Android|dqp|vk|P64" - short_name: "PXL" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI 32 dEQP Vk Release (Pixel 2)" - category: "Android|dqp|vk|P32" - short_name: "P2" - } - builders { - name: "buildbucket/luci.chromium.ci/Android FYI 64 dEQP Vk Release (Pixel 2)" - category: "Android|dqp|vk|P64" - short_name: "P2" - } -} - -consoles { - header_id: "chromium" - id: "chromium.tools.build" - name: "chromium.tools.build" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbot/chromium.tools.build/build-repo-real-try_mac" - name: "buildbucket/luci.chromium.ci/build-repo-real-try_mac" - category: "real-try" - } - builders { - name: "buildbot/chromium.tools.build/build-repo-real-try_trusty64" - name: "buildbucket/luci.chromium.ci/build-repo-real-try_trusty64" - category: "real-try" - } - builders { - name: "buildbot/chromium.tools.build/build-repo-real-try_win64" - name: "buildbucket/luci.chromium.ci/build-repo-real-try_win64" - category: "real-try" - } - builders { - name: "buildbot/chromium.tools.build/recipe-simulation_mac" - name: "buildbucket/luci.chromium.ci/recipe-simulation_mac" - category: "simulation" - } - builders { - name: "buildbot/chromium.tools.build/recipe-simulation_trusty64" - name: "buildbucket/luci.chromium.ci/recipe-simulation_trusty64" - category: "simulation" - } - builders { - name: "buildbot/chromium.tools.build/v8-linux-end-to-end" - name: "buildbucket/luci.chromium.ci/v8-linux-end-to-end" - category: "v8" - } -} - -consoles { - header_id: "chromium" - id: "chromium.webrtc" - name: "chromium.webrtc" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.webrtc/WebRTC Chromium Android Builder" - category: "android" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.webrtc/WebRTC Chromium Android Tester" - category: "android" - short_name: "tst" - } - builders { - name: "buildbucket/luci.chromium.webrtc/WebRTC Chromium Linux Builder" - category: "linux" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.webrtc/WebRTC Chromium Linux Builder (RBE)" - category: "linux" - short_name: "rbe" - } - builders { - name: "buildbucket/luci.chromium.webrtc/WebRTC Chromium Linux Tester" - category: "linux" - short_name: "tst" - } - builders { - name: "buildbucket/luci.chromium.webrtc/WebRTC Chromium Mac Builder" - category: "mac" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.webrtc/WebRTC Chromium Mac Tester" - category: "mac" - short_name: "tst" - } - builders { - name: "buildbucket/luci.chromium.webrtc/WebRTC Chromium Win Builder" - category: "win" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.webrtc/WebRTC Chromium Win10 Tester" - category: "win" - short_name: "10" - } - builders { - name: "buildbucket/luci.chromium.webrtc/WebRTC Chromium Win7 Tester" - category: "win" - short_name: "7" - } - builders { - name: "buildbucket/luci.chromium.webrtc/WebRTC Chromium Win8 Tester" - category: "win" - short_name: "8" - } -} - -consoles { - header_id: "chromium" - id: "chromium.webrtc.fyi" - name: "chromium.webrtc.fyi" - repo_url: "https://webrtc.googlesource.com/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Android Builder (dbg)" - category: "android|debug|builder" - short_name: "32" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Android Builder ARM64 (dbg)" - category: "android|debug|builder" - short_name: "64" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Android Tests (dbg) (K Nexus5)" - category: "android|debug|tester" - short_name: "K" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Android Tests (dbg) (M Nexus5X)" - category: "android|debug|tester" - short_name: "M" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Android Builder" - category: "android|release" - short_name: "32" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Linux Builder (dbg)" - category: "linux|debug" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Linux Builder (dbg) (RBE)" - category: "linux|debug" - short_name: "rbe" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Linux Builder" - category: "linux|release" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Linux Builder (RBE)" - category: "linux|release" - short_name: "rbe" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Linux Tester" - category: "linux|release" - short_name: "tst" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Mac Builder (dbg)" - category: "mac|debug" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Mac Builder" - category: "mac|release" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Mac Tester" - category: "mac|release" - short_name: "tst" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Win Builder (dbg)" - category: "win|debug" - short_name: "bld" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Win Builder" - category: "win|release|builder" - short_name: "32" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Win10 Tester" - category: "win|release|tester" - short_name: "10" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Win7 Tester" - category: "win|release|tester" - short_name: "7" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Win8 Tester" - category: "win|release|tester" - short_name: "8" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI ios-device" - category: "ios" - short_name: "dev" - } - builders { - name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI ios-simulator" - category: "ios" - short_name: "sim" - } -} - -consoles { - header_id: "chromiumos" - id: "chromiumos-Closers" - name: "chromiumos: Closers" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbot/chromiumos/amd64-generic-incremental" - } - builders { - name: "buildbot/chromiumos/daisy-incremental" - } - builders { - name: "buildbot/chromiumos/amd64-generic-full" - } - builders { - name: "buildbot/chromiumos/arm-generic-full" - } - builders { - name: "buildbot/chromiumos/daisy-full" - } - builders { - name: "buildbot/chromiumos/lakitu-full" - } - builders { - name: "buildbot/chromiumos/oak-full" - } - builders { - name: "buildbot/chromiumos/tatl-paladin" - } - builders { - name: "buildbot/chromiumos/amd64-generic-asan" - } -} - -consoles { - header_id: "chromiumos" - id: "chromiumos-Full" - name: "chromiumos: Full" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbot/chromiumos/amd64-generic-full" - } - builders { - name: "buildbot/chromiumos/arm-generic-full" - } - builders { - name: "buildbot/chromiumos/daisy-full" - } - builders { - name: "buildbot/chromiumos/lakitu-full" - } - builders { - name: "buildbot/chromiumos/oak-full" - } - builders { - name: "buildbot/chromiumos/tatl-paladin" - } -} - -consoles { - header_id: "chromiumos" - id: "chromiumos-Incremental" - name: "chromiumos: Incremental" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbot/chromiumos/amd64-generic-incremental" - } - builders { - name: "buildbot/chromiumos/daisy-incremental" - } -} - -consoles { - header_id: "chromiumos" - id: "chromiumos-ASAN" - name: "chromiumos: ASAN" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbot/chromiumos/amd64-generic-asan" - } -} - -consoles { - header_id: "chromiumos" - id: "chromiumos-CommitQueue" - name: "chromiumos: Commit Queue" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbot/chromiumos/amd64-generic-paladin" - } - builders { - name: "buildbot/chromiumos/arm-generic-paladin" - } - builders { - name: "buildbot/chromiumos/moblab-generic-vm-paladin" - } - builders { - name: "buildbot/chromiumos/tatl-paladin" - } -} - -consoles { - header_id: "chromiumos" - id: "chromiumos" - name: "chromiumos" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbot/chromiumos/amd64-generic-asan" - } - builders { - name: "buildbot/chromiumos/amd64-generic-full" - } - builders { - name: "buildbot/chromiumos/amd64-generic-incremental" - } - builders { - name: "buildbot/chromiumos/amd64-generic-paladin" - } - builders { - name: "buildbot/chromiumos/amd64-generic-fuzzer" - } - builders { - name: "buildbot/chromiumos/arm-generic-full" - } - builders { - name: "buildbot/chromiumos/arm-generic-paladin" - } - builders { - name: "buildbot/chromiumos/chromeos-infra-go" - } - builders { - name: "buildbot/chromiumos/chromiumos-sdk" - } - builders { - name: "buildbot/chromiumos/daisy-full" - } - builders { - name: "buildbot/chromiumos/daisy-incremental" - } - builders { - name: "buildbot/chromiumos/lakitu-full" - } - builders { - name: "buildbot/chromiumos/moblab-generic-vm-paladin" - } - builders { - name: "buildbot/chromiumos/oak-full" - } - builders { - name: "buildbot/chromiumos/tatl-full" - } - builders { - name: "buildbot/chromiumos/tatl-paladin" - } - builders { - name: "buildbot/chromiumos/unallocated-slave-pool" - } -} - -consoles { - header_id: "chromiumos" - id: "chromiumos.chromium" - name: "chromiumos.chromium" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbot/chromiumos.chromium/amd64-generic-goma-canary-chromium-pfq-informational" - category: "goma" - } - builders { - name: "buildbot/chromiumos.chromium/amd64-generic-telemetry" - category: "chromiumos perf" - } - builders { - name: "buildbot/chromiumos.chromium/amd64-generic-tot-asan-informational" - category: "chromeos asan" - } - builders { - name: "buildbot/chromiumos.chromium/amd64-generic-tot-chromium-pfq-informational" - category: "chromium" - } - builders { - name: "buildbot/chromiumos.chromium/daisy-tot-chromium-pfq-informational" - category: "chromium" - } -} - -consoles { - header_id: "chromium" - id: "tryserver.chromium.android" - name: "tryserver.chromium.android" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbot/tryserver.chromium.android/android_archive_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/android-binary-size" - } - builders { - name: "buildbucket/luci.chromium.try/android_blink_rel" - } - builders { - name: "buildbot/tryserver.chromium.android/android_cfi_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/android_clang_dbg_recipe" - } - builders { - name: "buildbucket/luci.chromium.try/android_compile_dbg" - } - builders { - name: "buildbot/tryserver.chromium.android/android_compile_rel" - } - builders { - name: "buildbot/tryserver.chromium.android/android_compile_x64_dbg" - } - builders { - name: "buildbot/tryserver.chromium.android/android_compile_x86_dbg" - } - builders { - name: "buildbucket/luci.chromium.try/android_cronet" - } - builders { - name: "buildbot/tryserver.chromium.android/android_cronet_tester" - } - builders { - name: "buildbot/tryserver.chromium.android/android_mojo" - } - builders { - name: "buildbucket/luci.chromium.try/android-marshmallow-arm64-rel" - } - builders { - name: "buildbucket/luci.chromium.try/android_optional_gpu_tests_rel" - } - builders { - name: "buildbucket/luci.chromium.try/android_unswarmed_pixel_aosp" - } - builders { - name: "buildbucket/luci.chromium.try/cast_shell_android" - } - builders { - name: "buildbot/tryserver.chromium.android/linux_android_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/android-kitkat-arm-rel" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-l-nexus-5-32" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-l-nexus-6-32" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-m-nexus-6p-64" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-m-nexus-9-64" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-n-nvidia-shield-tv-64" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-p-pixel-2-32" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-p-pixel-2-32-deqp" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-p-pixel-2-64" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-p-pixel-2-64-deqp" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-p-pixel-xl-32" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-p-pixel-xl-32-deqp" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-p-pixel-xl-64" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-p-pixel-xl-64-deqp" - } - builders { - name: "buildbucket/luci.chromium.try/android-deterministic-rel" - } - builders { - name: "buildbucket/luci.chromium.try/android-deterministic-dbg" - } - builders { - name: "buildbucket/luci.chromium.try/try-nougat-phone-tester" - } - builder_view_only: true -} - -consoles { - header_id: "chromium" - id: "tryserver.chromium.chromiumos" - name: "tryserver.chromium.chromiumos" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.try/chromeos-amd64-generic-rel" - } - builders { - name: "buildbucket/luci.chromium.try/chromeos-daisy-rel" - } - builders { - name: "buildbucket/luci.chromium.try/chromeos-kevin-compile-rel" - } - builders { - name: "buildbucket/luci.chromium.try/chromeos-kevin-rel" - } - builders { - name: "buildbucket/luci.chromium.try/linux-chromeos-compile-dbg" - } - builders { - name: "buildbucket/luci.chromium.try/linux-chromeos-dbg" - } - builders { - name: "buildbucket/luci.chromium.try/linux-chromeos-rel" - } - builder_view_only: true -} - -consoles { - header_id: "chromium" - id: "tryserver.chromium.linux" - name: "tryserver.chromium.linux" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.try/cast_shell_audio_linux" - } - builders { - name: "buildbucket/luci.chromium.try/cast_shell_linux" - } - builders { - name: "buildbucket/luci.chromium.try/chromium_presubmit" - } - builders { - name: "buildbucket/luci.chromium.try/closure_compilation" - } - builders { - name: "buildbucket/luci.chromium.try/fuchsia_arm64" - } - builders { - name: "buildbucket/luci.chromium.try/fuchsia-arm64-cast" - } - builders { - name: "buildbucket/luci.chromium.try/fuchsia-fyi-arm64-rel" - } - builders { - name: "buildbucket/luci.chromium.try/fuchsia-fyi-x64-dbg" - } - builders { - name: "buildbucket/luci.chromium.try/fuchsia-fyi-x64-rel" - } - builders { - name: "buildbucket/luci.chromium.try/fuchsia_x64" - } - builders { - name: "buildbucket/luci.chromium.try/fuchsia-x64-cast" - } - builders { - name: "buildbucket/luci.chromium.try/leak_detection_linux" - } - builders { - name: "buildbucket/luci.chromium.try/linux_arm" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_analysis" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_archive_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_asan_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_cfi_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_chromeos_asan_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_chromeos_msan_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_clobber_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_compile_dbg_32_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_component_updater" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_dbg_32_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_msan_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux-ozone-rel" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_tsan_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_ubsan_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux-goma-rbe-prod-rel" - } - builders { - name: "buildbucket/luci.chromium.try/linux-goma-rbe-staging-rel" - } - builders { - name: "buildbucket/luci.chromium.try/linux-gcc-rel" - } - builders { - name: "buildbucket/luci.chromium.try/layout_test_leak_detection" - } - builders { - name: "buildbucket/luci.chromium.try/linux_layout_tests_composite_after_paint" - } - builders { - name: "buildbucket/luci.chromium.try/linux_layout_tests_layout_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux-libfuzzer-asan-rel" - } - builders { - name: "buildbucket/luci.chromium.try/linux_mojo" - } - builders { - name: "buildbucket/luci.chromium.try/linux_mojo_chromeos" - } - builders { - name: "buildbucket/luci.chromium.try/linux_optional_gpu_tests_rel" - } - builders { - name: "buildbucket/luci.chromium.try/linux_upload_clang" - } - builders { - name: "buildbucket/luci.chromium.try/linux_vr" - } - builders { - name: "buildbucket/luci.chromium.try/linux-annotator-rel" - } - builder_view_only: true -} - -consoles { - header_id: "chromium" - id: "tryserver.chromium.mac" - name: "tryserver.chromium.mac" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.try/ios-device" - } - builders { - name: "buildbucket/luci.chromium.try/ios-device-xcode-clang" - } - builders { - name: "buildbucket/luci.chromium.try/ios-simulator-cronet" - } - builders { - name: "buildbucket/luci.chromium.try/ios-simulator-full-configs" - } - builders { - name: "buildbucket/luci.chromium.try/ios-simulator-xcode-clang" - } - builders { - name: "buildbucket/luci.chromium.try/ios12-sdk-simulator" - } - builders { - name: "buildbucket/luci.chromium.try/ios-slimnav" - } - builders { - name: "buildbucket/luci.chromium.try/ios-webview" - } - builders { - name: "buildbucket/luci.chromium.try/mac-rel" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_10.10" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_10.10_macviews" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_10.12_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_10.13_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_archive_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_asan_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_compile_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_compile_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_dbg_ng" - } - # TODO(https://crbug.com/888810): Remove in Q2 2019 - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_10.13_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_optional_gpu_tests_rel" - } - builders { - name: "buildbot/tryserver.chromium.mac/mac_upload_clang" - } - builder_view_only: true -} - -consoles { - header_id: "chromium" - id: "tryserver.chromium.perf" - name: "tryserver.chromium.perf" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbot/tryserver.chromium.perf/Android Compile Perf" - } - builders { - name: "buildbot/tryserver.chromium.perf/Android arm64 Compile Perf" - } - builders { - name: "buildbot/tryserver.chromium.perf/Linux Builder Perf" - } - builders { - name: "buildbot/tryserver.chromium.perf/Mac Builder Perf" - } - builders { - name: "buildbot/tryserver.chromium.perf/Win Builder Perf" - } - builders { - name: "buildbot/tryserver.chromium.perf/Win x64 Builder Perf" - } - builders { - name: "buildbot/tryserver.chromium.perf/linux_fyi_perf_bisect" - } - builders { - name: "buildbot/tryserver.chromium.perf/linux_perf_bisect" - } - builders { - name: "buildbot/tryserver.chromium.perf/linux_perf_bisect_builder" - } - builders { - name: "buildbot/tryserver.chromium.perf/staging_linux_perf_bisect" - } - builder_view_only: true -} - -consoles { - header_id: "chromium" - id: "tryserver.chromium.win" - name: "tryserver.chromium.win" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.try/gpu_manual_try_win7_nvidia_rel" - } - builders { - name: "buildbucket/luci.chromium.try/win-libfuzzer-asan-rel" - } - builders { - name: "buildbucket/luci.chromium.try/win7-rel" - } - builders { - name: "buildbucket/luci.chromium.try/win10_chromium_x64_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win10_chromium_x64_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win7_chromium_rel_loc_exp" - } - # TODO(https://crbug.com/888810): Remove in Q2 2019 - builders { - name: "buildbucket/luci.chromium.try/win7_chromium_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_archive" - } - builders { - name: "buildbucket/luci.chromium.try/win_chromium_compile_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_chromium_compile_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_chromium_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_chromium_x64_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_mojo" - } - builders { - name: "buildbucket/luci.chromium.try/win_optional_gpu_tests_rel" - } - builders { - name: "buildbot/tryserver.chromium.win/win_upload_clang" - } - builders { - name: "buildbucket/luci.chromium.try/win_x64_archive" - } - builders { - name: "buildbucket/luci.chromium.try/win-annotator-rel" - } - builder_view_only: true -} - -consoles { - header_id: "" - id: "tryserver.blink" - name: "tryserver.blink" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbot/tryserver.blink/linux-blink-rel" - name: "buildbucket/luci.chromium.try/linux-blink-rel" - } - builders { - name: "buildbot/tryserver.blink/mac10.10-blink-rel" - name: "buildbucket/luci.chromium.try/mac10.10-blink-rel" - } - builders { - name: "buildbot/tryserver.blink/mac10.11-blink-rel" - name: "buildbucket/luci.chromium.try/mac10.11-blink-rel" - } - builders { - name: "buildbot/tryserver.blink/mac10.12-blink-rel" - name: "buildbucket/luci.chromium.try/mac10.12-blink-rel" - } - builders { - name: "buildbot/tryserver.blink/mac10.13-blink-rel" - name: "buildbucket/luci.chromium.try/mac10.13-blink-rel" - } - builders { - name: "buildbot/tryserver.blink/mac10.13_retina-blink-rel" - name: "buildbucket/luci.chromium.try/mac10.13_retina-blink-rel" - } - builders { - name: "buildbot/tryserver.blink/win10-blink-rel" - name: "buildbucket/luci.chromium.try/win10-blink-rel" - } - builders { - name: "buildbot/tryserver.blink/win7-blink-rel" - name: "buildbucket/luci.chromium.try/win7-blink-rel" - } - builder_view_only: true -} - -consoles { - header_id: "chromium" - id: "angle.try" - name: "angle.try" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.try/android_angle_deqp_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/android_angle_vk32_deqp_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/android_angle_vk64_deqp_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/android_angle_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/android_angle_vk32_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/android_angle_vk64_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_angle_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_angle_deqp_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_angle_ozone_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_angle_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_angle_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_angle_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win-angle-rel" - } - builders { - name: "buildbucket/luci.chromium.try/win_angle_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_angle_deqp_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_angle_x64_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_angle_x64_deqp_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_angle_x64_rel_ng" - } - builder_view_only: true -} - -consoles { - header_id: "chromium" - id: "luci.chromium.try" - name: "luci.chromium.try" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbucket/luci.chromium.try/android-kitkat-arm-rel" - } - builders { - name: "buildbucket/luci.chromium.try/android-marshmallow-arm64-rel" - } - builders { - name: "buildbucket/luci.chromium.try/android-oreo-arm64-cts-networkservice-dbg" - } - builders { - name: "buildbucket/luci.chromium.try/android_arm64_dbg_recipe" - } - builders { - name: "buildbucket/luci.chromium.try/android_angle_deqp_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/android_angle_vk32_deqp_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/android_angle_vk64_deqp_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/android_angle_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/android_angle_vk32_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/android_angle_vk64_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/android_compile_dbg" - } - builders { - name: "buildbucket/luci.chromium.try/android_n5x_swarming_dbg" - } - builders { - name: "buildbucket/luci.chromium.try/android_optional_gpu_tests_rel" - } - builders { - name: "buildbucket/luci.chromium.try/cast_shell_audio_linux" - } - builders { - name: "buildbucket/luci.chromium.try/cast_shell_linux" - } - builders { - name: "buildbucket/luci.chromium.try/chromeos-amd64-generic-cfi-thin-lto-rel" - } - builders { - name: "buildbucket/luci.chromium.try/chromeos-amd64-generic-rel" - } - builders { - name: "buildbucket/luci.chromium.try/chromeos-daisy-rel" - } - builders { - name: "buildbucket/luci.chromium.try/chromium_devtools" - } - builders { - name: "buildbucket/luci.chromium.try/chromium_presubmit" - } - builders { - name: "buildbucket/luci.chromium.try/closure_compilation" - } - builders { - name: "buildbucket/luci.chromium.try/fuchsia" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-l-nexus-5-32" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-l-nexus-6-32" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-m-nexus-6p-64" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-m-nexus-9-64" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-n-nvidia-shield-tv-64" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-p-pixel-2-32" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-p-pixel-2-32-deqp" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-p-pixel-2-64" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-p-pixel-2-64-deqp" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-p-pixel-xl-32" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-p-pixel-xl-32-deqp" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-p-pixel-xl-64" - } - builders { - name: "buildbucket/luci.chromium.try/gpu-manual-try-android-p-pixel-xl-64-deqp" - } - builders { - name: "buildbucket/luci.chromium.try/gpu_manual_try_win7_nvidia_rel" - } - builders { - name: "buildbucket/luci.chromium.try/linux-blink-heap-incremental-marking" - } - builders { - name: "buildbucket/luci.chromium.try/linux-blink-heap-verification-try" - } - builders { - name: "buildbucket/luci.chromium.try/linux-chromeos-rel" - } - builders { - name: "buildbucket/luci.chromium.try/linux-jumbo-rel" - } - builders { - name: "buildbucket/luci.chromium.try/linux-libfuzzer-asan-rel" - } - builders { - name: "buildbucket/luci.chromium.try/linux-ozone-rel" - } - builders { - name: "buildbucket/luci.chromium.try/linux_angle_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_angle_deqp_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_angle_ozone_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_angle_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_arm" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_analysis" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_archive_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_asan_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_cfi_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_chromeos_asan_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_chromeos_msan_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_clobber_deterministic" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_clobber_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_compile_dbg_32_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_compile_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_compile_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_component_updater" - } - builders { - name: "buildbucket/luci.chromium.try/linux-coverage-rel" - } - builders { - name: "buildbucket/luci.chromium.try/linux-rel" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_dbg_32_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_msan_rel_ng" - } - # TODO(https://crbug.com/888810): Remove in Q2 2019 - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_tsan_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_chromium_ubsan_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_layout_tests_composite_after_paint" - } - builders { - name: "buildbucket/luci.chromium.try/linux_layout_tests_layout_ng" - } - builders { - name: "buildbucket/luci.chromium.try/linux_mojo" - } - builders { - name: "buildbucket/luci.chromium.try/linux_mojo_chromeos" - } - builders { - name: "buildbucket/luci.chromium.try/linux_optional_gpu_tests_rel" - } - builders { - name: "buildbucket/luci.chromium.try/linux_upload_clang" - } - builders { - name: "buildbucket/luci.chromium.try/ios-device" - } - builders { - name: "buildbucket/luci.chromium.try/ios-device-xcode-clang" - } - builders { - name: "buildbucket/luci.chromium.try/ios-simulator" - } - builders { - name: "buildbucket/luci.chromium.try/ios-simulator-cronet" - } - builders { - name: "buildbucket/luci.chromium.try/ios-simulator-eg" - } - builders { - name: "buildbucket/luci.chromium.try/ios-simulator-xcode-clang" - } - builders { - name: "buildbucket/luci.chromium.try/ios-uirefresh-simulator" - } - builders { - name: "buildbucket/luci.chromium.try/ios12-sdk-simulator" - } - builders { - name: "buildbucket/luci.chromium.try/mac-jumbo-rel" - } - builders { - name: "buildbucket/luci.chromium.try/mac-rel" - } - builders { - name: "buildbucket/luci.chromium.try/mac_angle_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_angle_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_10.10_macviews" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_10.10" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_10.12_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_10.13_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_archive_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_asan_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_compile_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_compile_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_dbg_ng" - } - # TODO(https://crbug.com/888810): Remove in Q2 2019 - builders { - name: "buildbucket/luci.chromium.try/mac_chromium_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/mac_optional_gpu_tests_rel" - } - builders { - name: "buildbucket/luci.chromium.try/mac_upload_clang" - } - builders { - name: "buildbucket/luci.chromium.try/try-nougat-phone-tester" - } - builders { - name: "buildbucket/luci.chromium.try/win7-rel" - } - builders { - name: "buildbucket/luci.chromium.try/win10_chromium_x64_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win10_chromium_x64_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win10_chromium_x64_rel_ng_exp" - } - # TODO(https://crbug.com/888810): Remove in Q2 2019 - builders { - name: "buildbucket/luci.chromium.try/win7_chromium_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win7_chromium_rel_loc_exp" - } - builders { - name: "buildbucket/luci.chromium.try/win-angle-rel" - } - builders { - name: "buildbucket/luci.chromium.try/win-jumbo-rel" - } - builders { - name: "buildbucket/luci.chromium.try/win_angle_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_angle_deqp_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_angle_x64_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_angle_x64_deqp_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_angle_x64_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_archive" - } - builders { - name: "buildbucket/luci.chromium.try/win_chromium_compile_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_chromium_compile_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_chromium_dbg_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_chromium_x64_rel_ng" - } - builders { - name: "buildbucket/luci.chromium.try/win_mojo" - } - builders { - name: "buildbucket/luci.chromium.try/win_optional_gpu_tests_rel" - } - builders { - name: "buildbucket/luci.chromium.try/win_upload_clang" - } - builders { - name: "buildbucket/luci.chromium.try/win_x64_archive" - } - builder_view_only: true -} - -consoles { - header_id: "chromium" - id: "sheriff.ios" - name: "iOS Sheriff Console" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - - builders { - name: "buildbucket/luci.chromium.ci/ios-device" - category: "chromium.mac" - short_name: "dev" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-simulator" - category: "chromium.mac" - short_name: "sim" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-simulator-full-configs" - category: "chromium.mac" - short_name: "ful" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-device-xcode-clang" - category: "chromium.mac|xcode" - short_name: "dev" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-simulator-xcode-clang" - category: "chromium.mac|xcode" - short_name: "sim" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-uirefresh-simulator" - category: "chromium.mac" - short_name: "ui" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-webview" - category: "chromium.mac" - short_name: "web" - } - builders { - name: "buildbucket/luci.chromium.ci/ios-slimnav" - category: "chromium.mac" - short_name: "slim" - } - builders { - name: "buildbucket/luci.chromium.ci/ios12-sdk-device" - category: "chromium.fyi|12" - short_name: "dev" - } - builders { - name: "buildbucket/luci.chromium.ci/ios12-sdk-simulator" - category: "chromium.fyi|12" - short_name: "sim" - } -}
diff --git a/infra/config/global/luci-notify.cfg b/infra/config/global/luci-notify.cfg deleted file mode 100644 index d2993303..0000000 --- a/infra/config/global/luci-notify.cfg +++ /dev/null
@@ -1,186 +0,0 @@ -# Defines email notifications for builders. -# See schema at -# https://chromium.googlesource.com/infra/luci/luci-go/+/master/luci_notify/api/config/notify.proto -# -# Please keep this list sorted by name. - -notifiers { - name: "chromesec-lkgr-failures" - notifications { - on_change: true - on_success: false - on_failure: false - on_new_failure: false - email { - recipients: "chromesec-lkgr-failures@google.com" - } - } - builders { - name: "ASAN Debug" - bucket: "ci" - } - builders { - name: "ASAN Release" - bucket: "ci" - } - builders { - name: "ASAN Release Media" - bucket: "ci" - } - builders { - name: "ASan Debug (32-bit x86 with V8-ARM)" - bucket: "ci" - } - builders { - name: "ASan Release (32-bit x86 with V8-ARM)" - bucket: "ci" - } - builders { - name: "ASan Release Media (32-bit x86 with V8-ARM)" - bucket: "ci" - } - builders { - name: "Afl Upload Linux ASan" - bucket: "ci" - } - builders { - name: "ChromiumOS ASAN Release" - bucket: "ci" - } - builders { - name: "Libfuzzer Upload Chrome OS ASan" - bucket: "ci" - } - builders { - name: "Libfuzzer Upload Linux32 ASan" - bucket: "ci" - } - builders { - name: "Libfuzzer Upload Linux32 ASan Debug" - bucket: "ci" - } - builders { - name: "Libfuzzer Upload Linux32 V8-ARM ASan" - bucket: "ci" - } - builders { - name: "Libfuzzer Upload Linux32 V8-ARM ASan Debug" - bucket: "ci" - } - builders { - name: "Libfuzzer Upload Linux ASan" - bucket: "ci" - } - builders { - name: "Libfuzzer Upload Linux ASan Debug" - bucket: "ci" - } - builders { - name: "Libfuzzer Upload Linux V8-ARM64 ASan" - bucket: "ci" - } - builders { - name: "Libfuzzer Upload Linux V8-ARM64 ASan Debug" - bucket: "ci" - } - builders { - name: "Libfuzzer Upload Linux MSan" - bucket: "ci" - } - builders { - name: "Libfuzzer Upload Linux UBSan" - bucket: "ci" - } - # TODO(crbug.com/790372): Enable notifications for the mac bot when it gets - # flipped to luci. - #builders { - # name: "Libfuzzer Upload Mac ASan" - # bucket: "ci" - #} - builders { - name: "Libfuzzer Upload Windows ASan" - bucket: "ci" - } - builders { - name: "MSAN Release (chained origins)" - bucket: "ci" - } - builders { - name: "MSAN Release (no origins)" - bucket: "ci" - } - builders { - name: "Mac ASAN Debug" - bucket: "ci" - } - builders { - name: "Mac ASAN Release" - bucket: "ci" - } - builders { - name: "Mac ASAN Release Media" - bucket: "ci" - } - builders { - name: "TSAN Debug" - bucket: "ci" - } - builders { - name: "TSAN Release" - bucket: "ci" - } - builders { - name: "UBSan Release" - bucket: "ci" - } - builders { - name: "UBSan vptr Release" - bucket: "ci" - } - builders { - name: "Win ASan Release" - bucket: "ci" - } - builders { - name: "Win ASan Release Media" - bucket: "ci" - } -} - -notifiers { - name: "cr-fuchsia" - notifications { - on_change: true - email { - recipients: "cr-fuchsia+bot@chromium.org" - } - } - builders { - name: "Fuchsia ARM64" - bucket: "ci" - } - builders { - name: "Fuchsia x64" - bucket: "ci" - } - builders { - name: "fuchsia-arm64-cast" - bucket: "ci" - } - builders { - name: "fuchsia-fyi-arm64-rel" - bucket: "ci" - } - builders { - name: "fuchsia-fyi-x64-dbg" - bucket: "ci" - } - builders { - name: "fuchsia-fyi-x64-rel" - bucket: "ci" - } - builders { - name: "fuchsia-x64-cast" - bucket: "ci" - } -}
diff --git a/infra/config/global/luci-scheduler-dev.cfg b/infra/config/global/luci-scheduler-dev.cfg deleted file mode 100644 index aa26630..0000000 --- a/infra/config/global/luci-scheduler-dev.cfg +++ /dev/null
@@ -1,111 +0,0 @@ -# Defines jobs on luci-scheduler-dev.appspot.com. -# -# For schema of this file and documentation see ProjectConfig message in -# -# https://chromium.googlesource.com/infra/luci/luci-go/+/master/scheduler/appengine/messages/config.proto - - -acl_sets { - name: "default" - acls { - role: READER - granted_to: "group:all" - } - acls { - role: OWNER - granted_to: "group:project-chromium-admins" - } -} - -################################################################################ -# Master branch - -trigger { - id: "master-gitiles-trigger" - acl_sets: "default" - - gitiles: { - repo: "https://chromium.googlesource.com/chromium/src.git" - refs: "refs/heads/master" - } - - triggers: "Android N5 Swarm" - triggers: "Android N5X Swarm" - triggers: "ChromeOS Swarm" - triggers: "Linux Swarm" - triggers: "Mac Swarm" - triggers: "Windows Swarm" -} - -job { - id: "Android N5 Swarm" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket-dev.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android N5 Swarm" - } -} - -job { - id: "Android N5X Swarm" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket-dev.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android N5X Swarm" - } -} - -job { - id: "ChromeOS Swarm" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket-dev.appspot.com" - bucket: "luci.chromium.ci" - builder: "ChromeOS Swarm" - } -} - -job { - id: "Linux Swarm" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket-dev.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux Swarm" - } -} -job { - id: "Mac Swarm" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket-dev.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Swarm" - } -} -job { - id: "Windows Swarm" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket-dev.appspot.com" - bucket: "luci.chromium.ci" - builder: "Windows Swarm" - } -} - -################################################################################ -# Cron jobs - -job { - id: "Snapshot Builder" - acl_sets: "default" - buildbucket { - bucket: "luci.chromium.cron" - builder: "Snapshot Builder" - server: "cr-buildbucket-dev.appspot.com" - } - # TODO(smut): Adjust frequency. - schedule: "with 300s interval" -}
diff --git a/infra/config/global/luci-scheduler.cfg b/infra/config/global/luci-scheduler.cfg deleted file mode 100644 index 9c48a27..0000000 --- a/infra/config/global/luci-scheduler.cfg +++ /dev/null
@@ -1,5207 +0,0 @@ -# Defines jobs on luci-scheduler.appspot.com. -# -# For schema of this file and documentation see ProjectConfig message in -# -# https://chromium.googlesource.com/infra/luci/luci-go/+/master/scheduler/appengine/messages/config.proto - - -acl_sets { - name: "default" - acls { - role: READER - granted_to: "group:all" - } - acls { - role: OWNER - granted_to: "group:project-chromium-admins" - } -} - -acl_sets { - name: "webrtc" - acls { - # TODO(crbug.com/859222): Change to triggerer. - role: OWNER - granted_to: "group:project-webrtc-admins" - } -} - -acl_sets { - # ACLs for jobs which represent builders which run tests and are triggered by - # other so called "parent" builders. - name: "triggered-by-parent-builders" - acls { - role: READER - granted_to: "group:all" - } - acls { - role: TRIGGERER - granted_to: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" - } - acls { - role: TRIGGERER - granted_to: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" - } - acls { - role: OWNER - granted_to: "group:project-chromium-admins" - } -} - -################################################################################ -# Master branch - -trigger { - id: "master-gitiles-trigger" - acl_sets: "default" - - gitiles: { - repo: "https://chromium.googlesource.com/chromium/src.git" - refs: "refs/heads/master" - } - - triggers: "ASAN Debug" - triggers: "ASAN Release Media" - triggers: "ASAN Release" - triggers: "ASan Debug (32-bit x86 with V8-ARM)" - triggers: "ASan Release (32-bit x86 with V8-ARM)" - triggers: "ASan Release Media (32-bit x86 with V8-ARM)" - triggers: "Afl Upload Linux ASan" - triggers: "Android ASAN (dbg)" - triggers: "Android Builder (dbg) Goma Canary" - triggers: "Android Builder (dbg) Goma Latest Client" - triggers: "Android Builder (dbg)" - triggers: "Android CFI" - triggers: "Android Cronet Builder" - triggers: "Android FYI 32 Vk Release (Nexus 5X)" - triggers: "Android FYI 32 Vk Release (Pixel 2)" - triggers: "Android FYI 32 Vk Release (Pixel XL)" - triggers: "Android FYI 32 dEQP Vk Release (Nexus 5X)" - triggers: "Android FYI 32 dEQP Vk Release (Pixel 2)" - triggers: "Android FYI 32 dEQP Vk Release (Pixel XL)" - triggers: "Android FYI 64 Vk Release (Nexus 5X)" - triggers: "Android FYI 64 Vk Release (Pixel 2)" - triggers: "Android FYI 64 Vk Release (Pixel XL)" - triggers: "Android FYI 64 dEQP Vk Release (Nexus 5X)" - triggers: "Android FYI 64 dEQP Vk Release (Pixel 2)" - triggers: "Android FYI 64 dEQP Vk Release (Pixel XL)" - triggers: "Android FYI Release (NVIDIA Shield TV)" - triggers: "Android FYI Release (Nexus 5)" - triggers: "Android FYI Release (Nexus 5X)" - triggers: "Android FYI Release (Nexus 6)" - triggers: "Android FYI Release (Nexus 6P)" - triggers: "Android FYI Release (Nexus 9)" - triggers: "Android FYI dEQP Release (Nexus 5X)" - triggers: "Android Release (Nexus 5X)" - triggers: "Android arm Builder (dbg)" - triggers: "Android arm64 Builder (dbg)" - triggers: "Android x64 Builder (dbg)" - triggers: "Android x86 Builder (dbg)" - triggers: "CFI Linux CF" - triggers: "CFI Linux ToT" - triggers: "Cast Android (dbg)" - triggers: "Cast Audio Linux" - triggers: "Cast Linux" - triggers: "Chromium Android ARM 32-bit Goma RBE Prod" - triggers: "Chromium Android ARM 32-bit Goma RBE Prod (clobber)" - triggers: "Chromium Android ARM 32-bit Goma RBE Prod (dbg)" - triggers: "Chromium Android ARM 32-bit Goma RBE Prod (dbg) (clobber)" - triggers: "Chromium Android ARM 32-bit Goma RBE Staging" - triggers: "Chromium Android ARM 32-bit Goma RBE ToT" - triggers: "Chromium Linux Goma RBE Prod" - triggers: "Chromium Linux Goma RBE Prod (clobber)" - triggers: "Chromium Linux Goma RBE Prod (dbg)" - triggers: "Chromium Linux Goma RBE Prod (dbg) (clobber)" - triggers: "Chromium Linux Goma RBE Staging" - triggers: "Chromium Linux Goma RBE Staging (clobber)" - triggers: "Chromium Linux Goma RBE Staging (dbg) (clobber)" - triggers: "Chromium Linux Goma RBE Staging (dbg)" - triggers: "Chromium Linux Goma RBE ToT" - triggers: "Chromium Linux Goma RBE ToT (ATS)" - triggers: "Chromium Linux Goma Staging" - triggers: "Chromium Mac 10.13" - triggers: "Chromium Mac Goma RBE Staging" - triggers: "Chromium Mac Goma RBE Staging (clobber)" - triggers: "Chromium Mac Goma RBE Staging (dbg)" - triggers: "Chromium Mac Goma Staging" - triggers: "Chromium Win Goma RBE ToT" - triggers: "Chromium Windows Analyze" - triggers: "ChromiumOS ASAN Release" - triggers: "Closure Compilation Linux" - triggers: "CrWinAsan" - triggers: "CrWinAsan(dll)" - triggers: "CrWinAsanCov" - triggers: "CrWinGomaStaging" - triggers: "Deterministic Android (dbg)" - triggers: "Deterministic Android" - triggers: "Deterministic Linux (dbg)" - triggers: "Deterministic Linux" - triggers: "fuchsia-arm64-cast" - triggers: "Fuchsia ARM64" - triggers: "fuchsia-x64-cast" - triggers: "Fuchsia x64" - triggers: "GPU FYI Linux Builder (dbg)" - triggers: "GPU FYI Linux Builder" - triggers: "GPU FYI Linux Ozone Builder" - triggers: "GPU FYI Linux dEQP Builder" - triggers: "GPU FYI Mac Builder (dbg)" - triggers: "GPU FYI Mac Builder" - triggers: "GPU FYI Mac dEQP Builder" - triggers: "GPU FYI Win Builder (dbg)" - triggers: "GPU FYI Win Builder" - triggers: "GPU FYI Win Clang Builder (dbg)" - triggers: "GPU FYI Win dEQP Builder" - triggers: "GPU FYI Win x64 Builder (dbg)" - triggers: "GPU FYI Win x64 Builder" - triggers: "GPU FYI Win x64 dEQP Builder" - triggers: "GPU Linux Builder (dbg)" - triggers: "GPU Linux Builder" - triggers: "GPU Mac Builder (dbg)" - triggers: "GPU Mac Builder" - triggers: "GPU Win Builder (dbg)" - triggers: "GPU Win Builder" - triggers: "Jumbo Linux x64" - triggers: "Jumbo Mac" - triggers: "Jumbo Win x64" - triggers: "Leak Detection Linux" - triggers: "Libfuzzer Upload Chrome OS ASan" - triggers: "Libfuzzer Upload Linux32 ASan Debug" - triggers: "Libfuzzer Upload Linux32 ASan" - triggers: "Libfuzzer Upload Linux32 V8-ARM ASan Debug" - triggers: "Libfuzzer Upload Linux32 V8-ARM ASan" - triggers: "Libfuzzer Upload Linux ASan Debug" - triggers: "Libfuzzer Upload Linux ASan" - triggers: "Libfuzzer Upload Linux V8-ARM64 ASan Debug" - triggers: "Libfuzzer Upload Linux V8-ARM64 ASan" - triggers: "Libfuzzer Upload Linux MSan" - triggers: "Libfuzzer Upload Linux UBSan" - triggers: "Libfuzzer Upload Mac ASan" - triggers: "Libfuzzer Upload Windows ASan" - triggers: "Linux ARM" - triggers: "Linux ASan LSan Builder" - triggers: "Linux Builder (dbg)" - triggers: "Linux Builder (dbg)(32)" - triggers: "Linux Builder Goma Canary" - triggers: "Linux Builder Goma Latest Client" - triggers: "Linux Builder" - triggers: "Linux CFI" - triggers: "Linux Chromium OS ASan LSan Builder" - triggers: "Linux ChromiumOS Full" - triggers: "Linux ChromiumOS MSan Builder" - triggers: "Linux Clang Analyzer" - triggers: "Linux FYI GPU TSAN Release" - triggers: "Linux MSan Builder" - triggers: "Linux TSan Builder" - triggers: "Linux Viz" - triggers: "Linux remote_run Builder" - triggers: "Linux x64 Goma Canary (clobber)" - triggers: "Linux x64 Goma Canary LocalOutputCache" - triggers: "Linux x64 Goma Latest Client (clobber)" - triggers: "Linux x64 Goma Latest Client LocalOutputCache" - triggers: "MSAN Release (chained origins)" - triggers: "MSAN Release (no origins)" - triggers: "Mac ASAN Debug" - triggers: "Mac ASAN Release Media" - triggers: "Mac ASAN Release" - triggers: "Mac ASan 64 Builder" - triggers: "Mac Builder (dbg) Goma Canary (clobber)" - triggers: "Mac Builder (dbg) Goma Canary" - triggers: "Mac Builder (dbg) Goma Latest Client (clobber)" - triggers: "Mac Builder (dbg) Goma Latest Client" - triggers: "Mac Builder (dbg)" - triggers: "Mac Builder Goma Canary" - triggers: "Mac Builder Goma Latest Client" - triggers: "Mac Builder" - triggers: "Mac FYI GPU ASAN Release" - triggers: "Mac Goma Canary (clobber)" - triggers: "Mac Goma Canary LocalOutputCache" - triggers: "Mac Goma Latest Client (clobber)" - triggers: "Mac Goma Latest Client LocalOutputCache" - triggers: "Mac deterministic (dbg)" - triggers: "Mac deterministic" - triggers: "Mojo Android" - triggers: "Mojo ChromiumOS" - triggers: "Mojo Linux" - triggers: "Mojo Windows" - triggers: "Optional Android Release (Nexus 5X)" - triggers: "Site Isolation Android" - triggers: "TSAN Debug" - triggers: "TSAN Release" - triggers: "ToTAndroid (dbg)" - triggers: "ToTAndroid x64" - triggers: "ToTAndroid" - triggers: "ToTAndroid64" - triggers: "ToTAndroidASan" - triggers: "ToTAndroidCFI" - triggers: "ToTAndroidOfficial" - triggers: "ToTLinux (dbg)" - triggers: "ToTLinux" - triggers: "ToTLinuxASan" - triggers: "ToTLinuxASanLibfuzzer" - triggers: "ToTLinuxCoverage" - triggers: "ToTLinuxMSan" - triggers: "ToTLinuxTSan" - triggers: "ToTLinuxThinLTO" - triggers: "ToTLinuxUBSanVptr" - triggers: "ToTMac (dbg)" - triggers: "ToTMac" - triggers: "ToTMacASan" - triggers: "ToTMacCoverage" - triggers: "ToTWin(dbg)" - triggers: "ToTWin(dll)" - triggers: "ToTWin64(dbg)" - triggers: "ToTWin64(dll)" - triggers: "ToTWinASanLibfuzzer" - triggers: "ToTWinCFI" - triggers: "ToTWinCFI64" - triggers: "ToTWinLibcxx64" - triggers: "ToTiOS" - triggers: "ToTiOSDevice" - triggers: "UBSan Release" - triggers: "UBSan vptr Release" - triggers: "UBSanVptr Linux" - triggers: "VR Linux" - triggers: "WebKit Linux Trusty ASAN" - triggers: "WebKit Linux Trusty Leak" - triggers: "WebKit Linux Trusty MSAN" - triggers: "Win 10 Fast Ring" - triggers: "Win ASan Release Media" - triggers: "Win ASan Release" - triggers: "Win Builder (dbg) Goma Canary" - triggers: "Win Builder (dbg) Goma Latest Client" - triggers: "Win Builder (dbg)" - triggers: "Win Builder Goma Canary" - triggers: "Win Builder Goma Latest Client" - triggers: "Win Builder" - triggers: "Win Goma Canary LocalOutputCache" - triggers: "Win Goma Latest Client LocalOutputCache" - triggers: "Win cl.exe Goma Canary LocalOutputCache" - triggers: "Win cl.exe Goma Latest Client LocalOutputCache" - triggers: "Win x64 Builder (dbg)" - triggers: "Win x64 Builder" - triggers: "Win7 Builder (dbg) Goma Canary" - triggers: "Win7 Builder (dbg) Goma Latest Client" - triggers: "Win7 Builder Goma Canary" - triggers: "Win7 Builder Goma Latest Client" - triggers: "WinMSVC64 Goma Canary" - triggers: "WinMSVC64 Goma Latest Client" - triggers: "Windows Clang deterministic" - triggers: "Windows deterministic" - triggers: "android-cronet-arm-dbg" - triggers: "android-cronet-arm-rel" - triggers: "android-cronet-arm64-dbg" - triggers: "android-cronet-arm64-rel" - triggers: "android-cronet-asan-arm-rel" - triggers: "android-cronet-x86-dbg" - triggers: "android-cronet-x86-rel" - triggers: "android-dbg" - triggers: "android-incremental-dbg" - triggers: "android-jumbo-rel" - triggers: "android-kitkat-arm-rel" - triggers: "android-marshmallow-arm64-rel" - triggers: "android-mojo-webview-rel" - triggers: "android-rel" - triggers: "chromeos-amd64-generic-cfi-thin-lto-rel" - triggers: "chromeos-amd64-generic-rel" - triggers: "chromeos-amd64-generic-rel-goma-canary" - triggers: "chromeos-amd64-generic-rel-goma-latest-client" - triggers: "chromeos-amd64-generic-rel-vm-tests" - triggers: "chromeos-daisy-rel" - triggers: "chromeos-kevin-rel-hw-tests" - triggers: "fuchsia-fyi-arm64-rel" - triggers: "fuchsia-fyi-x64-dbg" - triggers: "fuchsia-fyi-x64-rel" - triggers: "ios-device" - triggers: "ios-device-goma-canary-clobber" - triggers: "ios-device-goma-latest-client-clobber" - triggers: "ios-device-xcode-clang" - triggers: "ios-simulator" - triggers: "ios-simulator-cronet" - triggers: "ios-simulator-full-configs" - triggers: "ios-simulator-xcode-clang" - triggers: "ios-slimnav" - triggers: "ios-uirefresh-simulator" - triggers: "ios-webview" - triggers: "ios12-beta-simulator" - triggers: "ios12-sdk-device" - triggers: "ios12-sdk-simulator" - triggers: "linux-annotator-rel" - triggers: "linux-blink-animation-use-time-delta" - triggers: "linux-blink-heap-incremental-marking" - triggers: "linux-blink-heap-verification" - triggers: "linux-chromeos-dbg" - triggers: "linux-chromeos-rel" - triggers: "linux-chromium-tests-staging-builder" - triggers: "linux-code-coverage" - triggers: "linux-dbg" - triggers: "linux-gcc-rel" - triggers: "linux-jumbo-rel" - triggers: "linux-ozone-rel" - triggers: "linux-rel" - triggers: "linux-tcmalloc-rel" - triggers: "linux-win_cross-rel" - triggers: "linux-xenial-rel" - triggers: "mac-code-coverage-generation" - triggers: "mac-dbg" - triggers: "mac-hermetic-upgrade-rel" - triggers: "mac-jumbo-rel" - triggers: "mac-mojo-rel" - triggers: "mac-rel" - triggers: "WebRTC Chromium Android Builder" - triggers: "WebRTC Chromium Linux Builder" - triggers: "WebRTC Chromium Linux Builder (RBE)" - triggers: "WebRTC Chromium Mac Builder" - triggers: "WebRTC Chromium Win Builder" - triggers: "win-annotator-rel" - triggers: "win-asan" - triggers: "win-dbg" - triggers: "win-jumbo-rel" - triggers: "win-rel" - triggers: "win32-dbg" - triggers: "win32-rel" -} - -# These bots tests running Chromium tests with WebRTC HEAD, so they should -# trigger when there is a WebRTC commit. -trigger { - id: "webrtc-gitiles-trigger-master" - acl_sets: "default" - gitiles: { - repo: "https://webrtc.googlesource.com/src/" - refs: "refs/heads/master" - } - - triggers: "WebRTC Chromium FYI Android Builder" - triggers: "WebRTC Chromium FYI Android Builder (dbg)" - triggers: "WebRTC Chromium FYI Android Builder ARM64 (dbg)" - - triggers: "WebRTC Chromium FYI ios-device" - triggers: "WebRTC Chromium FYI ios-simulator" - - triggers: "WebRTC Chromium FYI Linux Builder" - triggers: "WebRTC Chromium FYI Linux Builder (RBE)" - triggers: "WebRTC Chromium FYI Linux Builder (dbg)" - triggers: "WebRTC Chromium FYI Linux Builder (dbg) (RBE)" - - triggers: "WebRTC Chromium FYI Mac Builder" - triggers: "WebRTC Chromium FYI Mac Builder (dbg)" - - triggers: "WebRTC Chromium FYI Win Builder" - triggers: "WebRTC Chromium FYI Win Builder (dbg)" -} - - -################################################################################ -# Android Builders. Sorted alphabetically. -################################################################################ - -job { - id: "Android arm Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android arm Builder (dbg)" - } -} - -job { - id: "Android arm64 Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android arm64 Builder (dbg)" - } -} - -job { - id: "Android ASAN (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android ASAN (dbg)" - } -} - -job { - id: "Android Cronet Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Cronet Builder" - } -} - -job { - id: "Android FYI 32 dEQP Vk Release (Nexus 5X)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI 32 dEQP Vk Release (Nexus 5X)" - } -} - -job { - id: "Android FYI 32 dEQP Vk Release (Pixel 2)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI 32 dEQP Vk Release (Pixel 2)" - } -} - -job { - id: "Android FYI 32 dEQP Vk Release (Pixel XL)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI 32 dEQP Vk Release (Pixel XL)" - } -} - -job { - id: "Android FYI 32 Vk Release (Nexus 5X)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI 32 Vk Release (Nexus 5X)" - } -} - -job { - id: "Android FYI 32 Vk Release (Pixel 2)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI 32 Vk Release (Pixel 2)" - } -} - -job { - id: "Android FYI 32 Vk Release (Pixel XL)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI 32 Vk Release (Pixel XL)" - } -} - -job { - id: "Android FYI 64 dEQP Vk Release (Nexus 5X)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI 64 dEQP Vk Release (Nexus 5X)" - } -} - -job { - id: "Android FYI 64 dEQP Vk Release (Pixel 2)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI 64 dEQP Vk Release (Pixel 2)" - } -} - -job { - id: "Android FYI 64 dEQP Vk Release (Pixel XL)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI 64 dEQP Vk Release (Pixel XL)" - } -} - -job { - id: "Android FYI 64 Vk Release (Nexus 5X)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI 64 Vk Release (Nexus 5X)" - } -} - -job { - id: "Android FYI 64 Vk Release (Pixel 2)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI 64 Vk Release (Pixel 2)" - } -} - -job { - id: "Android FYI 64 Vk Release (Pixel XL)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI 64 Vk Release (Pixel XL)" - } -} - -job { - id: "Android FYI dEQP Release (Nexus 5X)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI dEQP Release (Nexus 5X)" - } -} - -job { - id: "Android FYI Release (Nexus 5)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI Release (Nexus 5)" - } -} - -job { - id: "Android FYI Release (Nexus 5X)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI Release (Nexus 5X)" - } -} - -job { - id: "Android FYI Release (Nexus 6)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI Release (Nexus 6)" - } -} - -job { - id: "Android FYI Release (Nexus 6P)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI Release (Nexus 6P)" - } -} - -job { - id: "Android FYI Release (Nexus 9)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI Release (Nexus 9)" - } -} - -job { - id: "Android FYI Release (NVIDIA Shield TV)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android FYI Release (NVIDIA Shield TV)" - } -} - -job { - id: "Android Release (Nexus 5X)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Release (Nexus 5X)" - } -} - -job { - id: "Android Tests (trial)(dbg)" - # triggered by "Android arm Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Tests (trial)(dbg)" - } -} - -job { - id: "Android Tests with Tracing" - # triggered by "Android arm Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Tests with Tracing" - } -} - -job { - id: "Android WebView L (dbg)" - # triggered by "Android arm Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android WebView L (dbg)" - } -} - -job { - id: "Android WebView M (dbg)" - # triggered by "Android arm Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android WebView M (dbg)" - } -} - -job { - id: "Android WebView N (dbg)" - # triggered by "Android arm64 Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android WebView N (dbg)" - } -} - -job { - id: "Android WebView O (dbg)" - # triggered by "Android arm64 Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android WebView O (dbg)" - } -} - -job { - id: "Android WebView O NetworkService (dbg)" - # triggered by "Android arm64 Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android WebView O NetworkService (dbg)" - } -} - -job { - id: "Android x64 Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android x64 Builder (dbg)" - } -} - -job { - id: "Android x86 Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android x86 Builder (dbg)" - } -} - -job { - id: "android-cronet-arm-dbg" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "android-cronet-arm-dbg" - } -} - -job { - id: "android-cronet-arm-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "android-cronet-arm-rel" - } -} - -job { - id: "android-cronet-kitkat-arm-rel" - # Triggered by "android-cronet-arm-rel". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "android-cronet-kitkat-arm-rel" - } -} - -job { - id: "android-cronet-lollipop-arm-rel" - # Triggered by "android-cronet-arm-rel". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "android-cronet-lollipop-arm-rel" - } -} - -job { - id: "android-cronet-arm64-dbg" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "android-cronet-arm64-dbg" - } -} - -job { - id: "android-cronet-arm64-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "android-cronet-arm64-rel" - } -} - -job { - id: "android-cronet-marshmallow-arm64-rel" - # Triggered by "android-cronet-arm64-rel". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "android-cronet-marshmallow-arm64-rel" - } -} - -job { - id: "android-cronet-asan-arm-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "android-cronet-asan-arm-rel" - } -} - -job { - id: "android-cronet-x86-dbg" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "android-cronet-x86-dbg" - } -} - -job { - id: "android-cronet-x86-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "android-cronet-x86-rel" - } -} - -job { - id: "android-incremental-dbg" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "android-incremental-dbg" - } -} - -job { - id: "android-jumbo-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "android-jumbo-rel" - } -} - -job { - id: "android-kitkat-arm-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "android-kitkat-arm-rel" - } -} - -job { - id: "android-marshmallow-arm64-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "android-marshmallow-arm64-rel" - } -} - -job { - id: "android-mojo-webview-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "android-mojo-webview-rel" - } -} - -job { - id: "Cast Android (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Cast Android (dbg)" - } -} - -job { - id: "Deterministic Android" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Deterministic Android" - } -} - -job { - id: "Deterministic Android (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Deterministic Android (dbg)" - } -} - -job { - id: "Jelly Bean Tester" - # triggered by "Android arm Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Jelly Bean Tester" - } -} - - -job { - id: "KitKat Phone Tester (dbg)" - # triggered by "Android arm Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "KitKat Phone Tester (dbg)" - } -} - -job { - id: "KitKat Tablet Tester" - # triggered by "Android arm Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "KitKat Tablet Tester" - } -} - -job { - id: "Lollipop Consumer Tester" - # triggered by "Android arm64 Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - # TODO(bpastene): s/noop/buildbucket. - noop: {} - # buildbucket: { - # server: "cr-buildbucket.appspot.com" - # bucket: "luci.chromium.ci" - # builder: "Lollipop Consumer Tester" - # } -} - -job { - id: "Lollipop Low-end Tester" - # triggered by "Android arm Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Lollipop Low-end Tester" - } -} - -job { - id: "Lollipop Phone Tester" - # triggered by "Android arm Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Lollipop Phone Tester" - } -} - -job { - id: "Lollipop Tablet Tester" - # triggered by "Android arm Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Lollipop Tablet Tester" - } -} - -job { - id: "Marshmallow 64 bit Tester" - # triggered by "Android arm64 Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Marshmallow 64 bit Tester" - } -} - -job { - id: "Marshmallow Tablet Tester" - # triggered by "Android arm Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Marshmallow Tablet Tester" - } -} - -job { - id: "Nougat Phone Tester" - # triggered by "Android arm64 Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Nougat Phone Tester" - } -} - -job { - id: "Nougat Phone Tester" - # triggered by "Android arm64 Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - # TODO(bpastene): s/noop/buildbucket. - noop: {} - # buildbucket: { - # server: "cr-buildbucket.appspot.com" - # bucket: "luci.chromium.ci" - # builder: "Nougat Phone Tester" - # } -} - -job { - id: "Optional Android Release (Nexus 5X)" - acl_sets: "default" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "Oreo Phone Tester" - # triggered by "Android arm64 Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Oreo Phone Tester" - } -} - -job { - id: "WebRTC Chromium Android Builder" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc" - builder: "WebRTC Chromium Android Builder" - } -} - -job { - id: "WebRTC Chromium Android Tester" - acl_sets: "triggered-by-parent-builders" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc" - builder: "WebRTC Chromium Android Tester" - } -} - -################################################################################ -# ChromeOS Builders. Sorted alphabetically. -################################################################################ - -job { - id: "chromeos-amd64-generic-cfi-thin-lto-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "chromeos-amd64-generic-cfi-thin-lto-rel" - } -} - -job { - id: "chromeos-amd64-generic-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "chromeos-amd64-generic-rel" - } -} - -job { - id: "chromeos-amd64-generic-rel-vm-tests" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "chromeos-amd64-generic-rel-vm-tests" - } -} - -job { - id: "chromeos-daisy-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "chromeos-daisy-rel" - } -} - -job { - id: "chromeos-kevin-rel-hw-tests" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "chromeos-kevin-rel-hw-tests" - } -} - -job { - id: "linux-chromeos-dbg" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-chromeos-dbg" - } -} - -job { - id: "linux-chromeos-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-chromeos-rel" - } -} - -job { - id: "Linux ChromiumOS Full" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux ChromiumOS Full" - } -} - -################################################################################ -# iOS Builders. Sorted alphabetically. -################################################################################ - -job { - id: "ios-device" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ios-device" - } -} - -job { - id: "ios-device-xcode-clang" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ios-device-xcode-clang" - } -} - -job { - id: "ios-simulator" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ios-simulator" - } -} - -job { - id: "ios-simulator-full-configs" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ios-simulator-full-configs" - } -} - -job { - id: "ios-slimnav" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ios-slimnav" - } -} - -job { - id: "ios-webview" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ios-webview" - } -} - -job { - id: "ios-simulator-xcode-clang" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ios-simulator-xcode-clang" - } -} - -job { - id: "ios12-beta-simulator" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ios12-beta-simulator" - } -} - -job { - id: "ios12-sdk-device" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ios12-sdk-device" - } -} - -job { - id: "ios12-sdk-simulator" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ios12-sdk-simulator" - } -} - -job { - id: "ios-uirefresh-simulator" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ios-uirefresh-simulator" - } -} - -################################################################################ -# Linux Builders. Sorted alphabetically except builder-Testers must follow their -# builder-Builders. -################################################################################ - -job { - id: "Cast Audio Linux" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Cast Audio Linux" - } -} - -job { - id: "Cast Linux" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Cast Linux" - } -} - -job { - id: "Dawn GPU Linux Release (Intel HD 630)" - # Triggered by "GPU FYI Linux Builder". - acl_sets: "triggered-by-parent-builders" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "Dawn GPU Linux Release (NVIDIA)" - # Triggered by "GPU FYI Linux Builder". - acl_sets: "triggered-by-parent-builders" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "Deterministic Linux" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Deterministic Linux" - } -} - -job { - id: "Deterministic Linux (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Deterministic Linux (dbg)" - } -} - -job { - id: "Fuchsia ARM64" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Fuchsia ARM64" - } -} - -job { - id: "fuchsia-arm64-cast" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "fuchsia-arm64-cast" - } -} - -job { - id: "Fuchsia x64" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Fuchsia x64" - } -} - -job { - id: "fuchsia-x64-cast" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "fuchsia-x64-cast" - } -} - -job { - id: "GPU FYI Linux Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU FYI Linux Builder" - } -} - -job { - id: "Linux FYI Experimental Release (Intel HD 630)" - # Triggered by "GPU FYI Linux Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux FYI Experimental Release (Intel HD 630)" - } -} - -job { - id: "Linux FYI Release (AMD R7 240)" - # Triggered by "GPU FYI Linux Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux FYI Release (AMD R7 240)" - } -} - -job { - id: "Linux FYI Release (Intel HD 630)" - # Triggered by "GPU FYI Linux Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux FYI Release (Intel HD 630)" - } -} - -job { - id: "Linux FYI dEQP Release (Intel HD 630)" - # Triggered by "GPU FYI Linux dEQP Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux FYI dEQP Release (Intel HD 630)" - } -} - -job { - id: "Linux FYI Release (NVIDIA)" - # Triggered by "GPU FYI Linux Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux FYI Release (NVIDIA)" - } -} - -job { - id: "Linux FYI Experimental Release (NVIDIA)" - # Triggered by "GPU FYI Linux Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux FYI Experimental Release (NVIDIA)" - } -} - -job { - id: "Optional Linux Release (Intel HD 630)" - # Triggered by "GPU FYI Linux Builder". - acl_sets: "triggered-by-parent-builders" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "Optional Linux Release (NVIDIA)" - # Triggered by "GPU FYI Linux Builder". - acl_sets: "triggered-by-parent-builders" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "GPU FYI Linux Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU FYI Linux Builder (dbg)" - } -} - -job { - id: "Linux FYI Debug (NVIDIA)" - # Triggered by "GPU FYI Linux Builder (dbg)". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux FYI Debug (NVIDIA)" - } -} - -job { - id: "GPU FYI Linux dEQP Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU FYI Linux dEQP Builder" - } -} - -job { - id: "Linux FYI dEQP Release (NVIDIA)" - # Triggered by "GPU FYI Linux dEQP Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux FYI dEQP Release (NVIDIA)" - } -} - -job { - id: "GPU FYI Linux Ozone Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU FYI Linux Ozone Builder" - } -} - -job { - id: "Linux FYI Ozone (Intel)" - # Triggered by "GPU FYI Linux Ozone Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux FYI Ozone (Intel)" - } -} - -job { - id: "GPU Linux Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU Linux Builder" - } -} - -job { - id: "Linux Release (NVIDIA)" - # Triggered by "GPU Linux Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux Release (NVIDIA)" - } -} - -job { - id: "GPU Linux Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU Linux Builder (dbg)" - } -} - -job { - id: "Linux Debug (NVIDIA)" - # Triggered by "GPU Linux Builder (dbg)". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux Debug (NVIDIA)" - } -} - -job { - id: "Leak Detection Linux" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Leak Detection Linux" - } -} - -job { - id: "linux-blink-animation-use-time-delta" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-blink-animation-use-time-delta" - } -} - -job { - id: "linux-blink-heap-incremental-marking" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-blink-heap-incremental-marking" - } -} - -job { - id: "linux-blink-heap-unified-gc" - # Triggered by "Linux Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-blink-heap-unified-gc" - } -} - -job { - id: "linux-blink-heap-verification" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-blink-heap-verification" - } -} - -job { - id: "linux-chromium-tests-staging-builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-chromium-tests-staging-builder" - } -} - -job { - id: "linux-chromium-tests-staging-tests" - # Triggered by "linux-chromium-tests-staging-builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-chromium-tests-staging-tests" - } -} - -job { - id: "linux-code-coverage" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-code-coverage" - } -} - -job { - id: "linux-dbg" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-dbg" - } -} - -job { - id: "linux-gcc-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-gcc-rel" - } -} - -job { - id: "linux-jumbo-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-jumbo-rel" - } -} - -job { - id: "linux-ozone-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-ozone-rel" - } -} - -job { - id: "linux-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-rel" - } -} - -job { - id: "linux-xenial-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-xenial-rel" - } -} - -job { - id: "Linux ASan LSan Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux ASan LSan Builder" - } -} - -job { - id: "Linux ASan LSan Tests (1)" - # Triggered by "Linux ASan LSan Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux ASan LSan Tests (1)" - } -} - -job { - id: "Linux ASan Tests (sandboxed)" - # Triggered by "Linux ASan LSan Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux ASan Tests (sandboxed)" - } -} - -job { - id: "Linux Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux Builder (dbg)" - } -} - -job { - id: "Linux Tests (dbg)(1)" - # Triggered by "Linux Builder (dbg)". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux Tests (dbg)(1)" - } -} - -job { - id: "Linux Builder (dbg)(32)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux Builder (dbg)(32)" - } -} - -# Triggered by "Linux Builder (dbg)(32)" -job { - id: "Linux Tests (dbg)(1)(32)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux Tests (dbg)(1)(32)" - } -} - -job { - id: "Linux Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux Builder" - } -} - -job { - id: "Linux FYI GPU TSAN Release" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux FYI GPU TSAN Release" - } -} - -job { - id: "Linux Tests" - # Triggered by "Linux Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux Tests" - } -} - -job { - id: "Linux TSan Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux TSan Builder" - } -} - -job { - id: "Linux TSan Tests" - # Triggered by "Linux TSan Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux TSan Tests" - } -} - -job { - id: "WebRTC Chromium Linux Builder" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc" - builder: "WebRTC Chromium Linux Builder" - } -} - -job { - id: "WebRTC Chromium Linux Builder (RBE)" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc" - builder: "WebRTC Chromium Linux Builder (RBE)" - } -} - -job { - id: "WebRTC Chromium Linux Tester" - acl_sets: "triggered-by-parent-builders" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc" - builder: "WebRTC Chromium Linux Tester" - } -} - -################################################################################ -# Mac Builders. Sorted alphabetically. -################################################################################ - -job { - id: "Dawn GPU Mac Release (Intel)" - # Triggered by "GPU FYI Mac Builder". - acl_sets: "triggered-by-parent-builders" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "Dawn GPU Mac Retina Release (NVIDIA)" - # Triggered by "GPU FYI Mac Builder". - acl_sets: "triggered-by-parent-builders" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "Dawn GPU Mac Retina Release (AMD)" - # Triggered by "GPU FYI Mac Builder". - acl_sets: "triggered-by-parent-builders" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "GPU FYI Mac Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU FYI Mac Builder" - } -} - -job { - id: "GPU Mac Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU Mac Builder" - } -} - -job { - id: "GPU Mac Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU Mac Builder (dbg)" - } -} - -job { - id: "mac-code-coverage-generation" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "mac-code-coverage-generation" - } -} - -job { - id: "mac-jumbo-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "mac-jumbo-rel" - } -} - -job { - id: "mac-mojo-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "mac-mojo-rel" - } -} - -job { - id: "Mac Debug (Intel)" - # Triggered by "GPU Mac Builder (dbg)". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Debug (Intel)" - } -} - -job { - id: "Mac FYI 10.14 Release (AMD)" - # Triggered by "GPU FYI Mac Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac FYI 10.14 Release (AMD)" - } -} - -job { - id: "Mac FYI 10.14 Release (Intel)" - # Triggered by "GPU FYI Mac Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac FYI 10.14 Release (Intel)" - } -} - -job { - id: "Mac FYI 10.14 Release (NVIDIA)" - # Triggered by "GPU FYI Mac Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac FYI 10.14 Release (NVIDIA)" - } -} - -job { - id: "Mac FYI Experimental Release (Intel)" - # Triggered by "GPU FYI Mac Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac FYI Experimental Release (Intel)" - } -} - -job { - id: "Mac FYI Experimental Retina Release (AMD)" - # Triggered by "GPU FYI Mac Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac FYI Experimental Retina Release (AMD)" - } -} - -job { - id: "Mac FYI Experimental Retina Release (NVIDIA)" - # Triggered by "GPU FYI Mac Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac FYI Experimental Retina Release (NVIDIA)" - } -} - -job { - id: "Mac FYI Release (Intel)" - # Triggered by "GPU FYI Mac Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac FYI Release (Intel)" - } -} - -job { - id: "Mac FYI Retina Release (AMD)" - # Triggered by "GPU FYI Mac Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac FYI Retina Release (AMD)" - } -} - -job { - id: "Mac FYI Retina Release (NVIDIA)" - # Triggered by "GPU FYI Mac Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac FYI Retina Release (NVIDIA)" - } -} - -job { - id: "Mac Pro FYI Release (AMD)" - # Triggered by "GPU FYI Mac Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Pro FYI Release (AMD)" - } -} - -job { - id: "Mac Release (Intel)" - # Triggered by "GPU Mac Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Release (Intel)" - } -} - -job { - id: "Mac Retina Debug (AMD)" - # Triggered by "GPU Mac Builder (dbg)". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Retina Debug (AMD)" - } -} - -job { - id: "Mac Retina Release (AMD)" - # Triggered by "GPU Mac Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Retina Release (AMD)" - } -} - -job { - id: "Optional Mac Release (Intel)" - # Triggered by "GPU FYI Mac Builder". - acl_sets: "triggered-by-parent-builders" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "Optional Mac Retina Release (NVIDIA)" - # Triggered by "GPU FYI Mac Builder". - acl_sets: "triggered-by-parent-builders" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "Optional Mac Retina Release (AMD)" - # Triggered by "GPU FYI Mac Builder". - acl_sets: "triggered-by-parent-builders" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "GPU FYI Mac Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU FYI Mac Builder (dbg)" - } -} - -job { - id: "mac-osxbeta-rel" - # Triggered by "Mac Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "mac-osxbeta-rel" - } -} - -job { - id: "Mac FYI Debug (Intel)" - # Triggered by "GPU FYI Mac Builder (dbg)". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac FYI Debug (Intel)" - } -} - -job { - id: "Mac FYI Retina Debug (AMD)" - # Triggered by "GPU FYI Mac Builder (dbg)". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac FYI Retina Debug (AMD)" - } -} - -job { - id: "Mac FYI Retina Debug (NVIDIA)" - # Triggered by "GPU FYI Mac Builder (dbg)". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac FYI Retina Debug (NVIDIA)" - } -} - -job { - id: "GPU FYI Mac dEQP Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU FYI Mac dEQP Builder" - } -} - -job { - id: "Mac FYI dEQP Release AMD" - # Triggered by "GPU FYI Mac dEQP Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac FYI dEQP Release AMD" - } -} - -job { - id: "Mac FYI dEQP Release Intel" - # Triggered by "GPU FYI Mac dEQP Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac FYI dEQP Release Intel" - } -} - -job { - id: "Mac Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Builder" - } -} - -job { - id: "Mac Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Builder (dbg)" - } -} - -job { - id: "Mac FYI GPU ASAN Release" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac FYI GPU ASAN Release" - } -} - -job { - id: "Mac10.10 Tests" - # Triggered by "Mac Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac10.10 Tests" - } -} - -job { - id: "Mac10.11 Tests" - # Triggered by "Mac Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac10.11 Tests" - } -} - -job { - id: "Mac10.12 Tests" - # Triggered by "Mac Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac10.12 Tests" - } -} - -job { - id: "Mac10.13 Tests" - # Triggered by "Mac Builder". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac10.13 Tests" - } -} - -job { - id: "Mac10.13 Tests (dbg)" - # Triggered by "Mac Builder (dbg)". - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac10.13 Tests (dbg)" - } -} - -job { - id: "WebRTC Chromium Mac Builder" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc" - builder: "WebRTC Chromium Mac Builder" - } -} - -job { - id: "WebRTC Chromium Mac Tester" - acl_sets: "triggered-by-parent-builders" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc" - builder: "WebRTC Chromium Mac Tester" - } -} - -################################################################################ -# Windows Builders. Sorted alphabetically. -################################################################################ - -job { - id: "ANGLE GPU Win10 Release (Intel HD 630)" - # Triggered by "GPU FYI Win Builder" - acl_sets: "triggered-by-parent-builders" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "ANGLE GPU Win10 Release (NVIDIA)" - # Triggered by "GPU FYI Win Builder" - acl_sets: "triggered-by-parent-builders" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "Dawn GPU Win10 Release (Intel HD 630)" - # Triggered by "GPU FYI Win Builder" - acl_sets: "triggered-by-parent-builders" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "Dawn GPU Win10 Release (NVIDIA)" - # Triggered by "GPU FYI Win Builder" - acl_sets: "triggered-by-parent-builders" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "GPU FYI Win Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU FYI Win Builder" - } -} - -job { - id: "Optional Win10 Release (Intel HD 630)" - # Triggered by "GPU FYI Win Builder" - acl_sets: "triggered-by-parent-builders" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "Optional Win10 Release (NVIDIA)" - # Triggered by "GPU FYI Win Builder" - acl_sets: "triggered-by-parent-builders" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "Win10 FYI Exp Release (Intel HD 630)" - # Triggered by "GPU FYI Win Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win10 FYI Exp Release (Intel HD 630)" - } -} - -job { - id: "Win10 FYI Exp Release (NVIDIA)" - # Triggered by "GPU FYI Win Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win10 FYI Exp Release (NVIDIA)" - } -} - -job { - id: "Win10 FYI Release (Intel HD 630)" - # Triggered by "GPU FYI Win Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win10 FYI Release (Intel HD 630)" - } -} - -job { - id: "Win10 FYI dEQP Release (Intel HD 630)" - # Triggered by "GPU FYI Win dEQP Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win10 FYI dEQP Release (Intel HD 630)" - } -} - -job { - id: "Win10 FYI Release (NVIDIA)" - # Triggered by "GPU FYI Win Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win10 FYI Release (NVIDIA)" - } -} - -job { - id: "Win7 ANGLE Tryserver (AMD)" - # Triggered by "GPU FYI Win Builder" - acl_sets: "triggered-by-parent-builders" - # This bot doesn't actually exist, so it's noop'ed out. crbug.com/819899 - noop: {} -} - -job { - id: "Win7 FYI Release (AMD)" - # Triggered by "GPU FYI Win Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win7 FYI Release (AMD)" - } -} - -job { - id: "Win7 FYI Release (NVIDIA)" - # Triggered by "GPU FYI Win Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win7 FYI Release (NVIDIA)" - } -} - -job { - id: "GPU FYI Win Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU FYI Win Builder (dbg)" - } -} - -job { - id: "Win10 FYI Debug (NVIDIA)" - # Triggered by "GPU FYI Win Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win10 FYI Debug (NVIDIA)" - } -} - -job { - id: "Win7 FYI Debug (AMD)" - # Triggered by "GPU FYI Win Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win7 FYI Debug (AMD)" - } -} - -job { - id: "GPU FYI Win Clang Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU FYI Win Clang Builder (dbg)" - } -} - -job { - id: "GPU FYI Win dEQP Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU FYI Win dEQP Builder" - } -} - -job { - id: "Win10 FYI dEQP Release (NVIDIA)" - # Triggered by "GPU FYI Win dEQP Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win10 FYI dEQP Release (NVIDIA)" - } -} - -job { - id: "Win7 FYI dEQP Release (AMD)" - # Triggered by "GPU FYI Win dEQP Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win7 FYI dEQP Release (AMD)" - } -} - -job { - id: "GPU FYI Win x64 Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU FYI Win x64 Builder" - } -} - -job { - id: "Win7 FYI x64 Release (NVIDIA)" - # Triggered by "GPU FYI Win x64 Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win7 FYI x64 Release (NVIDIA)" - } -} - -job { - id: "GPU FYI Win x64 Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU FYI Win x64 Builder (dbg)" - } -} - -job { - id: "GPU FYI Win x64 dEQP Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU FYI Win x64 dEQP Builder" - } -} - -job { - id: "WebRTC Chromium Win Builder" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc" - builder: "WebRTC Chromium Win Builder" - } -} - -job { - id: "WebRTC Chromium Win7 Tester" - acl_sets: "triggered-by-parent-builders" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc" - builder: "WebRTC Chromium Win7 Tester" - } -} - -job { - id: "WebRTC Chromium Win8 Tester" - acl_sets: "triggered-by-parent-builders" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc" - builder: "WebRTC Chromium Win8 Tester" - } -} - -job { - id: "WebRTC Chromium Win10 Tester" - acl_sets: "triggered-by-parent-builders" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc" - builder: "WebRTC Chromium Win10 Tester" - } -} - -job { - id: "Win7 FYI x64 dEQP Release (NVIDIA)" - # Triggered by "GPU FYI Win x64 dEQP Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win7 FYI x64 dEQP Release (NVIDIA)" - } -} - -job { - id: "GPU Win Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU Win Builder" - } -} - -job { - id: "Win10 Release (NVIDIA)" - # Triggered by "GPU Win Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win10 Release (NVIDIA)" - } -} - -job { - id: "GPU Win Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "GPU Win Builder (dbg)" - } -} - -job { - id: "Win10 Debug (NVIDIA)" - # Triggered by "GPU Win Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win10 Debug (NVIDIA)" - } -} - -job { - id: "Win Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win Builder (dbg)" - } -} - -job { - id: "Win x64 Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win x64 Builder" - } -} - -job { - id: "Win x64 Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win x64 Builder (dbg)" - } -} - -job { - id: "win-asan" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "win-asan" - } -} - -job { - id: "win-jumbo-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "win-jumbo-rel" - } -} - -job { - id: "Win Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win Builder" - } -} - -job { - id: "Win7 (32) Tests" - # Triggered by "Win Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win7 (32) Tests" - } -} - -job { - id: "Win7 Tests (1)" - # Triggered by "Win Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win7 Tests (1)" - } -} - -job { - id: "Win7 Tests (dbg)(1)" - # Triggered by "Win Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win7 Tests (dbg)(1)" - } -} - -job { - id: "Win10 Tests x64" - # Triggered by "Win x64 Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win10 Tests x64" - } -} - -job { - id: "Win 7 Tests x64 (1)" - # Triggered by "Win x64 Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win 7 Tests x64 (1)" - } -} - -job { - id: "Win10 Tests x64 (dbg)" - # Triggered by "Win x64 Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win10 Tests x64 (dbg)" - } -} - -################################################################################ -# Jobs below are managed by luci-check. If you wish to change them, please -# copy/paste them above this section. -################################################################################ - -job { - id: "ASAN Debug" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ASAN Debug" - } - triggering_policy: { - max_concurrent_invocations: 4 - } -} - -job { - id: "ASAN Release" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ASAN Release" - } - triggering_policy: { - max_concurrent_invocations: 5 - } -} - -job { - id: "ASAN Release Media" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ASAN Release Media" - } - triggering_policy: { - max_concurrent_invocations: 4 - } -} - -job { - id: "ASan Debug (32-bit x86 with V8-ARM)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ASan Debug (32-bit x86 with V8-ARM)" - } - triggering_policy: { - max_concurrent_invocations: 4 - } -} - -job { - id: "ASan Release (32-bit x86 with V8-ARM)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ASan Release (32-bit x86 with V8-ARM)" - } - triggering_policy: { - max_concurrent_invocations: 4 - } -} - -job { - id: "ASan Release Media (32-bit x86 with V8-ARM)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ASan Release Media (32-bit x86 with V8-ARM)" - } - triggering_policy: { - max_concurrent_invocations: 4 - } -} - -job { - id: "Afl Upload Linux ASan" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Afl Upload Linux ASan" - } - triggering_policy: { - max_concurrent_invocations: 4 - } -} - -job { - id: "android-dbg" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "android-dbg" - } -} - -job { - id: "android-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "android-rel" - } -} - -job { - id: "Android Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Builder (dbg)" - } -} - -job { - id: "Android ChromeDriver Tests (dbg)" - # Triggered by "Android Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android ChromeDriver Tests (dbg)" - } -} - -job { - id: "Android Find Annotated Test" - # Triggered by "Android Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Find Annotated Test" - } -} - -job { - id: "Android Remoting Tests" - # Triggered by "Android Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Remoting Tests" - } -} - -job { - id: "Android VR Tests" - # Triggered by "Android Builder (dbg)" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android VR Tests" - } -} - -job { - id: "Android Builder (dbg) Goma Canary" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Builder (dbg) Goma Canary" - } -} - -job { - id: "Android Builder (dbg) Goma Latest Client" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Builder (dbg) Goma Latest Client" - } -} - -job { - id: "Android CFI" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android CFI" - } -} - -job { - id: "Android Cronet ARM64 Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Cronet ARM64 Builder" - } -} - -job { - id: "Android Cronet ARM64 Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Cronet ARM64 Builder (dbg)" - } -} - -job { - id: "Android Cronet Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Cronet Builder (dbg)" - } -} - -job { - id: "Android Cronet Builder Asan" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Cronet Builder Asan" - } -} - -job { - id: "Android Cronet KitKat Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Cronet KitKat Builder" - } -} - -job { - id: "Android Cronet Lollipop Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Cronet Lollipop Builder" - } -} - -job { - id: "Android Cronet Marshmallow 64bit Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Cronet Marshmallow 64bit Builder" - } -} - -job { - id: "Android Cronet Marshmallow 64bit Perf" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Cronet Marshmallow 64bit Perf" - } -} - -job { - id: "Android Cronet x86 Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Cronet x86 Builder" - } -} - -job { - id: "Android Cronet x86 Builder (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Android Cronet x86 Builder (dbg)" - } -} - -job { - id: "Chromium Mac 10.13" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Mac 10.13" - } -} - -job { - id: "Chromium Windows Analyze" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Windows Analyze" - } -} - -job { - id: "ChromiumOS ASAN Release" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ChromiumOS ASAN Release" - } - triggering_policy: { - max_concurrent_invocations: 6 - } -} - -job { - id: "Closure Compilation Linux" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Closure Compilation Linux" - } -} - -job { - id: "fuchsia-fyi-arm64-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "fuchsia-fyi-arm64-rel" - } -} - -job { - id: "fuchsia-fyi-x64-dbg" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "fuchsia-fyi-x64-dbg" - } -} - -job { - id: "fuchsia-fyi-x64-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "fuchsia-fyi-x64-rel" - } -} - -job { - id: "Jumbo Linux x64" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Jumbo Linux x64" - } -} - -job { - id: "Jumbo Mac" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Jumbo Mac" - } -} - -job { - id: "Jumbo Win x64" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Jumbo Win x64" - } -} - -job { - id: "Libfuzzer Upload Chrome OS ASan" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Libfuzzer Upload Chrome OS ASan" - } - triggering_policy: { - max_concurrent_invocations: 3 - } -} - -job { - id: "Libfuzzer Upload Linux32 ASan" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Libfuzzer Upload Linux32 ASan" - } - triggering_policy: { - max_concurrent_invocations: 3 - } -} - -job { - id: "Libfuzzer Upload Linux32 ASan Debug" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Libfuzzer Upload Linux32 ASan Debug" - } - triggering_policy: { - max_concurrent_invocations: 3 - } -} - -job { - id: "Libfuzzer Upload Linux32 V8-ARM ASan" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Libfuzzer Upload Linux32 V8-ARM ASan" - } - triggering_policy: { - max_concurrent_invocations: 1 - } -} - -job { - id: "Libfuzzer Upload Linux32 V8-ARM ASan Debug" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Libfuzzer Upload Linux32 V8-ARM ASan Debug" - } - triggering_policy: { - max_concurrent_invocations: 1 - } -} - -job { - id: "Libfuzzer Upload Linux ASan" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Libfuzzer Upload Linux ASan" - } - triggering_policy: { - max_concurrent_invocations: 5 - } -} - -job { - id: "Libfuzzer Upload Linux ASan Debug" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Libfuzzer Upload Linux ASan Debug" - } - triggering_policy: { - max_concurrent_invocations: 5 - } -} - -job { - id: "Libfuzzer Upload Linux V8-ARM64 ASan" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Libfuzzer Upload Linux V8-ARM64 ASan" - } - triggering_policy: { - max_concurrent_invocations: 1 - } -} - -job { - id: "Libfuzzer Upload Linux V8-ARM64 ASan Debug" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Libfuzzer Upload Linux V8-ARM64 ASan Debug" - } - triggering_policy: { - max_concurrent_invocations: 1 - } -} - -job { - id: "Libfuzzer Upload Linux MSan" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Libfuzzer Upload Linux MSan" - } - triggering_policy: { - max_concurrent_invocations: 5 - } -} - -job { - id: "Libfuzzer Upload Linux UBSan" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Libfuzzer Upload Linux UBSan" - } - triggering_policy: { - max_concurrent_invocations: 5 - } -} - -job { - id: "Libfuzzer Upload Mac ASan" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Libfuzzer Upload Mac ASan" - } -} - -job { - id: "Libfuzzer Upload Windows ASan" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Libfuzzer Upload Windows ASan" - } - triggering_policy: { - max_concurrent_invocations: 3 - } -} - -job { - id: "Linux" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux" - } -} - -job { - id: "Linux ARM" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux ARM" - } -} - -job { - id: "Linux Builder Goma Canary" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux Builder Goma Canary" - } -} - -job { - id: "Linux Builder Goma Latest Client" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux Builder Goma Latest Client" - } -} - -job { - id: "Linux CFI" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux CFI" - } -} - -job { - id: "Linux Chromium OS ASan LSan Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux Chromium OS ASan LSan Builder" - } -} - -job { - id: "Linux Chromium OS ASan LSan Tests (1)" - # Triggered by "Linux Chromium OS ASan LSan Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux Chromium OS ASan LSan Tests (1)" - } -} - -job { - id: "Linux ChromiumOS MSan Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux ChromiumOS MSan Builder" - } -} - -job { - id: "Linux ChromiumOS MSan Tests" - # Triggered by "Linux ChromiumOS MSan Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux ChromiumOS MSan Tests" - } -} - -job { - id: "Linux Clang Analyzer" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux Clang Analyzer" - } -} - -job { - id: "Linux MSan Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux MSan Builder" - } -} - -job { - id: "Linux MSan Tests" - # Triggered by "Linux MSan Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux MSan Tests" - } -} - -job { - id: "Linux Viz" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux Viz" - } -} - -job { - id: "Linux remote_run Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux remote_run Builder" - } -} - -job { - id: "Linux remote_run Tester" - # Triggered by "Linux remote_run Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux remote_run Tester" - } -} - -job { - id: "Linux x64 Goma Canary (clobber)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux x64 Goma Canary (clobber)" - } -} - -job { - id: "Linux x64 Goma Canary LocalOutputCache" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux x64 Goma Canary LocalOutputCache" - } -} - -job { - id: "Linux x64 Goma Latest Client (clobber)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux x64 Goma Latest Client (clobber)" - } -} - -job { - id: "Linux x64 Goma Latest Client LocalOutputCache" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux x64 Goma Latest Client LocalOutputCache" - } -} - -job { - id: "MSAN Release (chained origins)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "MSAN Release (chained origins)" - } - triggering_policy: { - max_concurrent_invocations: 4 - } -} - -job { - id: "MSAN Release (no origins)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "MSAN Release (no origins)" - } - triggering_policy: { - max_concurrent_invocations: 4 - } -} - -job { - id: "mac-dbg" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "mac-dbg" - } -} - -job { - id: "mac-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "mac-rel" - } -} - -job { - id: "Mac 10.6" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac 10.6" - } -} - -job { - id: "Mac ASAN Debug" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac ASAN Debug" - } - triggering_policy: { - max_concurrent_invocations: 2 - } -} - -job { - id: "Mac ASAN Release" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac ASAN Release" - } - triggering_policy: { - max_concurrent_invocations: 2 - } -} - -job { - id: "Mac ASAN Release Media" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac ASAN Release Media" - } - triggering_policy: { - max_concurrent_invocations: 2 - } -} - -job { - id: "Mac ASan 64 Builder" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac ASan 64 Builder" - } - triggering_policy: { - max_concurrent_invocations: 2 - } -} - -job { - id: "Mac ASan 64 Tests (1)" - # Triggered by "Mac ASan 64 Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac ASan 64 Tests (1)" - } -} - -job { - id: "Mac Builder (dbg) Goma Canary" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Builder (dbg) Goma Canary" - } -} - -job { - id: "Mac Builder (dbg) Goma Canary (clobber)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Builder (dbg) Goma Canary (clobber)" - } -} - -job { - id: "Mac Builder (dbg) Goma Latest Client" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Builder (dbg) Goma Latest Client" - } -} - -job { - id: "Mac Builder (dbg) Goma Latest Client (clobber)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Builder (dbg) Goma Latest Client (clobber)" - } -} - -job { - id: "Mac Builder Goma Canary" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Builder Goma Canary" - } -} - -job { - id: "Mac Goma Canary (clobber)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Goma Canary (clobber)" - } -} - -job { - id: "Mac Goma Canary LocalOutputCache" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Goma Canary LocalOutputCache" - } -} - -job { - id: "Mac Builder Goma Latest Client" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Builder Goma Latest Client" - } -} - -job { - id: "Mac Goma Latest Client (clobber)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Goma Latest Client (clobber)" - } -} - -job { - id: "Mac Goma Latest Client LocalOutputCache" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac Goma Latest Client LocalOutputCache" - } -} - -job { - id: "Mac deterministic" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac deterministic" - } -} - -job { - id: "Mac deterministic (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mac deterministic (dbg)" - } -} - -job { - id: "Marshmallow Phone Tester (rel)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Marshmallow Phone Tester (rel)" - } -} - -job { - id: "Memory Infra Tester" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Memory Infra Tester" - } -} - -job { - id: "Mojo Android" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mojo Android" - } -} - -job { - id: "Mojo ChromiumOS" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mojo ChromiumOS" - } -} - -job { - id: "Mojo Linux" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mojo Linux" - } -} - -job { - id: "Mojo Windows" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Mojo Windows" - } -} - -job { - id: "Site Isolation Android" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Site Isolation Android" - } -} - -job { - id: "TSAN Debug" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "TSAN Debug" - } - triggering_policy: { - max_concurrent_invocations: 4 - } -} - -job { - id: "TSAN Release" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "TSAN Release" - } - triggering_policy: { - max_concurrent_invocations: 3 - } -} - -job { - id: "UBSan Release" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "UBSan Release" - } - triggering_policy: { - max_concurrent_invocations: 4 - } -} - -job { - id: "UBSan vptr Release" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "UBSan vptr Release" - } - triggering_policy: { - max_concurrent_invocations: 4 - } -} - -job { - id: "VR Linux" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "VR Linux" - } -} - -job { - id: "linux-tcmalloc-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-tcmalloc-rel" - } -} - -job { - id: "WebKit Linux Trusty ASAN" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "WebKit Linux Trusty ASAN" - } -} - -job { - id: "WebKit Linux Trusty Leak" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "WebKit Linux Trusty Leak" - } -} - -job { - id: "WebKit Linux Trusty MSAN" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "WebKit Linux Trusty MSAN" - } -} - -job { - id: "WebKit Mac10.13 (retina)" - # Triggered by "Mac Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "WebKit Mac10.13 (retina)" - } -} - -job { - id: "WebKit Win10" - # Triggered by "Win Builder" - acl_sets: "triggered-by-parent-builders" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "WebKit Win10" - } -} - -job { - id: "win32-dbg" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "win32-dbg" - } -} - -job { - id: "win32-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "win32-rel" - } -} - -job { - id: "Win 10 Fast Ring" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win 10 Fast Ring" - } -} - -job { - id: "Win ASan Release" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win ASan Release" - } - triggering_policy: { - max_concurrent_invocations: 7 - } -} - -job { - id: "Win ASan Release Media" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win ASan Release Media" - } - triggering_policy: { - max_concurrent_invocations: 6 - } -} - -job { - id: "Win Builder (dbg) Goma Canary" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win Builder (dbg) Goma Canary" - } -} - -job { - id: "Win Builder Goma Canary" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win Builder Goma Canary" - } -} - -job { - id: "Win Goma Canary LocalOutputCache" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win Goma Canary LocalOutputCache" - } -} - -job { - id: "Win cl.exe Goma Canary LocalOutputCache" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win cl.exe Goma Canary LocalOutputCache" - } -} - -job { - id: "Win Builder (dbg) Goma Latest Client" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win Builder (dbg) Goma Latest Client" - } -} - -job { - id: "Win Builder Goma Latest Client" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win Builder Goma Latest Client" - } -} - -job { - id: "Win Goma Latest Client LocalOutputCache" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win Goma Latest Client LocalOutputCache" - } -} - -job { - id: "Win cl.exe Goma Latest Client LocalOutputCache" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win cl.exe Goma Latest Client LocalOutputCache" - } -} - -job { - id: "win-dbg" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "win-dbg" - } -} - -job { - id: "win-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "win-rel" - } -} - -job { - id: "Win7" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win7" - } -} - -job { - id: "Win7 Builder (dbg) Goma Canary" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win7 Builder (dbg) Goma Canary" - } -} - -job { - id: "Win7 Builder Goma Canary" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win7 Builder Goma Canary" - } -} - -job { - id: "WinMSVC64 Goma Canary" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "WinMSVC64 Goma Canary" - } -} - -job { - id: "Win7 Builder (dbg) Goma Latest Client" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win7 Builder (dbg) Goma Latest Client" - } -} - -job { - id: "Win7 Builder Goma Latest Client" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Win7 Builder Goma Latest Client" - } -} - -job { - id: "WinMSVC64 Goma Latest Client" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "WinMSVC64 Goma Latest Client" - } -} - -job { - id: "Windows Clang deterministic" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Windows Clang deterministic" - } -} - -job { - id: "Windows deterministic" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Windows deterministic" - } -} - -job { - id: "chromeos-amd64-generic-rel-goma-canary" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "chromeos-amd64-generic-rel-goma-canary" - } -} - -job { - id: "ios-device-goma-canary-clobber" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ios-device-goma-canary-clobber" - } -} - -job { - id: "chromeos-amd64-generic-rel-goma-latest-client" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "chromeos-amd64-generic-rel-goma-latest-client" - } -} - -job { - id: "ios-device-goma-latest-client-clobber" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ios-device-goma-latest-client-clobber" - } -} - -job { - id: "ios-simulator-cronet" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ios-simulator-cronet" - } -} - -job { - id: "linux-annotator-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-annotator-rel" - } -} - -job { - id: "mac-hermetic-upgrade-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "mac-hermetic-upgrade-rel" - } -} - -job { - id: "win-annotator-rel" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "win-annotator-rel" - } -} - -job { - id: "x86 Emulator Tester" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "x86 Emulator Tester" - } -} - -job { - id: "Chromium Android ARM 32-bit Goma RBE ToT" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Android ARM 32-bit Goma RBE ToT" - } -} - -job { - id: "Chromium Android ARM 32-bit Goma RBE Staging" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Android ARM 32-bit Goma RBE Staging" - } -} - -job { - id: "Chromium Android ARM 32-bit Goma RBE Prod" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Android ARM 32-bit Goma RBE Prod" - } -} - -job { - id: "Chromium Android ARM 32-bit Goma RBE Prod (clobber)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Android ARM 32-bit Goma RBE Prod (clobber)" - } -} - -job { - id: "Chromium Android ARM 32-bit Goma RBE Prod (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Android ARM 32-bit Goma RBE Prod (dbg)" - } -} - -job { - id: "Chromium Android ARM 32-bit Goma RBE Prod (dbg) (clobber)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Android ARM 32-bit Goma RBE Prod (dbg) (clobber)" - } -} - -job { - id: "Chromium Linux Goma RBE ToT" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Linux Goma RBE ToT" - } -} - -job { - id: "Chromium Linux Goma RBE ToT (ATS)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Linux Goma RBE ToT (ATS)" - } -} - -job { - id: "Chromium Linux Goma RBE Staging" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Linux Goma RBE Staging" - } -} - -job { - id: "Chromium Linux Goma RBE Staging (clobber)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Linux Goma RBE Staging (clobber)" - } -} - -job { - id: "Chromium Linux Goma RBE Staging (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Linux Goma RBE Staging (dbg)" - } -} - -job { - id: "Chromium Linux Goma RBE Staging (dbg) (clobber)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Linux Goma RBE Staging (dbg) (clobber)" - } -} - -job { - id: "Chromium Linux Goma RBE Prod" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Linux Goma RBE Prod" - } -} - -job { - id: "Chromium Linux Goma RBE Prod (clobber)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Linux Goma RBE Prod (clobber)" - } -} - -job { - id: "Chromium Linux Goma RBE Prod (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Linux Goma RBE Prod (dbg)" - } -} - -job { - id: "Chromium Linux Goma RBE Prod (dbg) (clobber)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Linux Goma RBE Prod (dbg) (clobber)" - } -} - -job { - id: "Chromium Linux Goma Staging" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Linux Goma Staging" - } -} - -job { - id: "Chromium Mac Goma RBE Staging" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Mac Goma RBE Staging" - } -} - -job { - id: "Chromium Mac Goma RBE Staging (clobber)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Mac Goma RBE Staging (clobber)" - } -} - -job { - id: "Chromium Mac Goma RBE Staging (dbg)" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Mac Goma RBE Staging (dbg)" - } -} - -job { - id: "Chromium Win Goma RBE ToT" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Win Goma RBE ToT" - } -} - -job { - id: "Chromium Mac Goma Staging" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Chromium Mac Goma Staging" - } -} - -job { - id: "CrWinGomaStaging" - acl_sets: "default" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "CrWinGomaStaging" - } -} - -job { - id: "CFI Linux CF" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "CFI Linux CF" - } -} - -job { - id: "CFI Linux ToT" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "CFI Linux ToT" - } -} - -job { - id: "CrWinAsan" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "CrWinAsan" - } -} - -job { - id: "CrWinAsan(dll)" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "CrWinAsan(dll)" - } -} - -job { - id: "CrWinAsanCov" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "CrWinAsanCov" - } -} - -job { - id: "ToTAndroid" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTAndroid" - } -} - -job { - id: "ToTAndroid (dbg)" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTAndroid (dbg)" - } -} - -job { - id: "ToTAndroid x64" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTAndroid x64" - } -} - -job { - id: "ToTAndroid64" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTAndroid64" - } -} - -job { - id: "ToTAndroidASan" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTAndroidASan" - } -} - -job { - id: "ToTAndroidCFI" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTAndroidCFI" - } -} - -job { - id: "ToTAndroidOfficial" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTAndroidOfficial" - } -} - -job { - id: "ToTLinux" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTLinux" - } -} - -job { - id: "ToTLinux (dbg)" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTLinux (dbg)" - } -} - -job { - id: "ToTLinuxASan" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTLinuxASan" - } -} - -job { - id: "ToTLinuxASanLibfuzzer" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTLinuxASanLibfuzzer" - } -} - -job { - id: "ToTLinuxCoverage" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTLinuxCoverage" - } -} - -job { - id: "ToTLinuxMSan" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTLinuxMSan" - } -} - -job { - id: "ToTLinuxTSan" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTLinuxTSan" - } -} - -job { - id: "ToTLinuxThinLTO" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTLinuxThinLTO" - } -} - -job { - id: "ToTLinuxUBSanVptr" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTLinuxUBSanVptr" - } -} - -job { - id: "ToTMac" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTMac" - } -} - -job { - id: "ToTMac (dbg)" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTMac (dbg)" - } -} - -job { - id: "ToTMacASan" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTMacASan" - } -} - -job { - id: "ToTMacCoverage" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTMacCoverage" - } -} - -job { - id: "ToTWin(dbg)" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTWin(dbg)" - } -} - -job { - id: "ToTWin(dll)" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTWin(dll)" - } -} - -job { - id: "ToTWin64(dbg)" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTWin64(dbg)" - } -} - -job { - id: "ToTWin64(dll)" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTWin64(dll)" - } -} - -job { - id: "ToTWinASanLibfuzzer" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTWinASanLibfuzzer" - } -} - -job { - id: "ToTWinCFI" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTWinCFI" - } -} - -job { - id: "ToTWinCFI64" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTWinCFI64" - } -} - -job { - id: "ToTWinLibcxx64" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTWinLibcxx64" - } -} - -job { - id: "ToTiOS" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTiOS" - } -} - -job { - id: "ToTiOSDevice" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "ToTiOSDevice" - } -} - -job { - id: "UBSanVptr Linux" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "UBSanVptr Linux" - } -} - -job { - id: "linux-win_cross-rel" - acl_sets: "default" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux-win_cross-rel" - } -} - - -################################################################################ -# Cron Jobs. - -job { - id: "update-component-mapping" - acl_sets: "default" - # Run this every six hours - schedule: "0 0,6,12,18 * * * " - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "linux_chromium_component_updater" - } -} - -job { - id: "export-bot-db-to-findit-gs" - acl_sets: "default" - # Run this every six hours - schedule: "0 0,6,12,18 * * * " - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.findit" - builder: "linux_chromium_bot_db_exporter" - } -} - -########################################################################## -# WebRTC Chromium FYI Builders -########################################################################## - -job { - id: "WebRTC Chromium FYI Android Builder" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Android Builder" - } -} - -job { - id: "WebRTC Chromium FYI Android Builder (dbg)" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Android Builder (dbg)" - } -} - -job { - id: "WebRTC Chromium FYI Android Tests (dbg) (K Nexus5)" - acl_sets: "triggered-by-parent-builders" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Android Tests (dbg) (K Nexus5)" - } -} - -job { - id: "WebRTC Chromium FYI Android Tests (dbg) (M Nexus5X)" - acl_sets: "triggered-by-parent-builders" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Android Tests (dbg) (M Nexus5X)" - } -} - -job { - id: "WebRTC Chromium FYI Android Builder ARM64 (dbg)" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Android Builder ARM64 (dbg)" - } -} - -job { - id: "WebRTC Chromium FYI ios-device" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI ios-device" - } -} - -job { - id: "WebRTC Chromium FYI ios-simulator" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI ios-simulator" - } -} - -job { - id: "WebRTC Chromium FYI Linux Builder" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Linux Builder" - } -} - -job { - id: "WebRTC Chromium FYI Linux Builder (RBE)" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Linux Builder (RBE)" - } -} - -job { - id: "WebRTC Chromium FYI Linux Tester" - acl_sets: "triggered-by-parent-builders" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Linux Tester" - } -} - -job { - id: "WebRTC Chromium FYI Linux Builder (dbg)" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Linux Builder (dbg)" - } -} - -job { - id: "WebRTC Chromium FYI Linux Builder (dbg) (RBE)" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Linux Builder (dbg) (RBE)" - } -} - -job { - id: "WebRTC Chromium FYI Mac Builder" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Mac Builder" - } -} - -job { - id: "WebRTC Chromium FYI Mac Tester" - acl_sets: "triggered-by-parent-builders" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Mac Tester" - } -} - -job { - id: "WebRTC Chromium FYI Mac Builder (dbg)" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Mac Builder (dbg)" - } -} - -job { - id: "WebRTC Chromium FYI Win Builder" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Win Builder" - } -} - -job { - id: "WebRTC Chromium FYI Win10 Tester" - acl_sets: "triggered-by-parent-builders" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Win10 Tester" - } -} - -job { - id: "WebRTC Chromium FYI Win7 Tester" - acl_sets: "triggered-by-parent-builders" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Win7 Tester" - } -} - -job { - id: "WebRTC Chromium FYI Win8 Tester" - acl_sets: "triggered-by-parent-builders" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Win8 Tester" - } -} - -job { - id: "WebRTC Chromium FYI Win Builder (dbg)" - acl_sets: "default" - acl_sets: "webrtc" - buildbucket: { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Win Builder (dbg)" - } -}
diff --git a/infra/config/global/project.cfg b/infra/config/global/project.cfg deleted file mode 100644 index 606450c..0000000 --- a/infra/config/global/project.cfg +++ /dev/null
@@ -1,5 +0,0 @@ -# For the schema of this file and documentation, see ProjectCfg message in -# https://luci-config.appspot.com/schemas/projects:project.cfg - -name: "Chromium browser" -access: "group:all" # public
diff --git a/infra/config/global/project_pb2.py b/infra/config/global/project_pb2.py deleted file mode 100644 index 960ba3c7..0000000 --- a/infra/config/global/project_pb2.py +++ /dev/null
@@ -1,520 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: project.proto - -import sys -_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='project.proto', - package='milo', - syntax='proto3', - serialized_options=_b('Z\006config'), - serialized_pb=_b('\n\rproject.proto\x12\x04milo\"a\n\x07Project\x12\x1f\n\x08\x63onsoles\x18\x02 \x03(\x0b\x32\r.milo.Console\x12\x1d\n\x07headers\x18\x03 \x03(\x0b\x32\x0c.milo.Header\x12\x10\n\x08logo_url\x18\x04 \x01(\tJ\x04\x08\x01\x10\x02\".\n\x04Link\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t\x12\x0b\n\x03\x61lt\x18\x03 \x01(\t\"#\n\x06Oncall\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t\"4\n\tLinkGroup\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x19\n\x05links\x18\x02 \x03(\x0b\x32\n.milo.Link\"E\n\x13\x43onsoleSummaryGroup\x12\x19\n\x05title\x18\x01 \x01(\x0b\x32\n.milo.Link\x12\x13\n\x0b\x63onsole_ids\x18\x02 \x03(\t\"\xa0\x01\n\x06Header\x12\x1d\n\x07oncalls\x18\x01 \x03(\x0b\x32\x0c.milo.Oncall\x12\x1e\n\x05links\x18\x02 \x03(\x0b\x32\x0f.milo.LinkGroup\x12\x31\n\x0e\x63onsole_groups\x18\x03 \x03(\x0b\x32\x19.milo.ConsoleSummaryGroup\x12\x18\n\x10tree_status_host\x18\x04 \x01(\t\x12\n\n\x02id\x18\x05 \x01(\t\"\xa7\x02\n\x07\x43onsole\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x10\n\x08repo_url\x18\x03 \x01(\t\x12\x0c\n\x04refs\x18\x0e \x03(\t\x12\x13\n\x0b\x65xclude_ref\x18\r \x01(\t\x12\x15\n\rmanifest_name\x18\x05 \x01(\t\x12\x1f\n\x08\x62uilders\x18\x06 \x03(\x0b\x32\r.milo.Builder\x12\x13\n\x0b\x66\x61vicon_url\x18\x07 \x01(\t\x12\x1c\n\x06header\x18\t \x01(\x0b\x32\x0c.milo.Header\x12\x11\n\theader_id\x18\n \x01(\t\x12#\n\x1binclude_experimental_builds\x18\x0b \x01(\x08\x12\x19\n\x11\x62uilder_view_only\x18\x0c \x01(\x08J\x04\x08\x08\x10\tJ\x04\x08\x04\x10\x05R\x03ref\"=\n\x07\x42uilder\x12\x0c\n\x04name\x18\x01 \x03(\t\x12\x10\n\x08\x63\x61tegory\x18\x02 \x01(\t\x12\x12\n\nshort_name\x18\x03 \x01(\tB\x08Z\x06\x63onfigb\x06proto3') -) - - - - -_PROJECT = _descriptor.Descriptor( - name='Project', - full_name='milo.Project', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='consoles', full_name='milo.Project.consoles', index=0, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='headers', full_name='milo.Project.headers', index=1, - number=3, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='logo_url', full_name='milo.Project.logo_url', index=2, - number=4, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=23, - serialized_end=120, -) - - -_LINK = _descriptor.Descriptor( - name='Link', - full_name='milo.Link', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='text', full_name='milo.Link.text', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='url', full_name='milo.Link.url', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='alt', full_name='milo.Link.alt', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=122, - serialized_end=168, -) - - -_ONCALL = _descriptor.Descriptor( - name='Oncall', - full_name='milo.Oncall', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='milo.Oncall.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='url', full_name='milo.Oncall.url', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=170, - serialized_end=205, -) - - -_LINKGROUP = _descriptor.Descriptor( - name='LinkGroup', - full_name='milo.LinkGroup', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='milo.LinkGroup.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='links', full_name='milo.LinkGroup.links', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=207, - serialized_end=259, -) - - -_CONSOLESUMMARYGROUP = _descriptor.Descriptor( - name='ConsoleSummaryGroup', - full_name='milo.ConsoleSummaryGroup', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='title', full_name='milo.ConsoleSummaryGroup.title', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='console_ids', full_name='milo.ConsoleSummaryGroup.console_ids', index=1, - number=2, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=261, - serialized_end=330, -) - - -_HEADER = _descriptor.Descriptor( - name='Header', - full_name='milo.Header', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='oncalls', full_name='milo.Header.oncalls', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='links', full_name='milo.Header.links', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='console_groups', full_name='milo.Header.console_groups', index=2, - number=3, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='tree_status_host', full_name='milo.Header.tree_status_host', index=3, - number=4, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='id', full_name='milo.Header.id', index=4, - number=5, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=333, - serialized_end=493, -) - - -_CONSOLE = _descriptor.Descriptor( - name='Console', - full_name='milo.Console', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='id', full_name='milo.Console.id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='name', full_name='milo.Console.name', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='repo_url', full_name='milo.Console.repo_url', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='refs', full_name='milo.Console.refs', index=3, - number=14, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='exclude_ref', full_name='milo.Console.exclude_ref', index=4, - number=13, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='manifest_name', full_name='milo.Console.manifest_name', index=5, - number=5, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='builders', full_name='milo.Console.builders', index=6, - number=6, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='favicon_url', full_name='milo.Console.favicon_url', index=7, - number=7, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='header', full_name='milo.Console.header', index=8, - number=9, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='header_id', full_name='milo.Console.header_id', index=9, - number=10, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='include_experimental_builds', full_name='milo.Console.include_experimental_builds', index=10, - number=11, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='builder_view_only', full_name='milo.Console.builder_view_only', index=11, - number=12, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=496, - serialized_end=791, -) - - -_BUILDER = _descriptor.Descriptor( - name='Builder', - full_name='milo.Builder', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='milo.Builder.name', index=0, - number=1, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='category', full_name='milo.Builder.category', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='short_name', full_name='milo.Builder.short_name', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=793, - serialized_end=854, -) - -_PROJECT.fields_by_name['consoles'].message_type = _CONSOLE -_PROJECT.fields_by_name['headers'].message_type = _HEADER -_LINKGROUP.fields_by_name['links'].message_type = _LINK -_CONSOLESUMMARYGROUP.fields_by_name['title'].message_type = _LINK -_HEADER.fields_by_name['oncalls'].message_type = _ONCALL -_HEADER.fields_by_name['links'].message_type = _LINKGROUP -_HEADER.fields_by_name['console_groups'].message_type = _CONSOLESUMMARYGROUP -_CONSOLE.fields_by_name['builders'].message_type = _BUILDER -_CONSOLE.fields_by_name['header'].message_type = _HEADER -DESCRIPTOR.message_types_by_name['Project'] = _PROJECT -DESCRIPTOR.message_types_by_name['Link'] = _LINK -DESCRIPTOR.message_types_by_name['Oncall'] = _ONCALL -DESCRIPTOR.message_types_by_name['LinkGroup'] = _LINKGROUP -DESCRIPTOR.message_types_by_name['ConsoleSummaryGroup'] = _CONSOLESUMMARYGROUP -DESCRIPTOR.message_types_by_name['Header'] = _HEADER -DESCRIPTOR.message_types_by_name['Console'] = _CONSOLE -DESCRIPTOR.message_types_by_name['Builder'] = _BUILDER -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Project = _reflection.GeneratedProtocolMessageType('Project', (_message.Message,), dict( - DESCRIPTOR = _PROJECT, - __module__ = 'project_pb2' - # @@protoc_insertion_point(class_scope:milo.Project) - )) -_sym_db.RegisterMessage(Project) - -Link = _reflection.GeneratedProtocolMessageType('Link', (_message.Message,), dict( - DESCRIPTOR = _LINK, - __module__ = 'project_pb2' - # @@protoc_insertion_point(class_scope:milo.Link) - )) -_sym_db.RegisterMessage(Link) - -Oncall = _reflection.GeneratedProtocolMessageType('Oncall', (_message.Message,), dict( - DESCRIPTOR = _ONCALL, - __module__ = 'project_pb2' - # @@protoc_insertion_point(class_scope:milo.Oncall) - )) -_sym_db.RegisterMessage(Oncall) - -LinkGroup = _reflection.GeneratedProtocolMessageType('LinkGroup', (_message.Message,), dict( - DESCRIPTOR = _LINKGROUP, - __module__ = 'project_pb2' - # @@protoc_insertion_point(class_scope:milo.LinkGroup) - )) -_sym_db.RegisterMessage(LinkGroup) - -ConsoleSummaryGroup = _reflection.GeneratedProtocolMessageType('ConsoleSummaryGroup', (_message.Message,), dict( - DESCRIPTOR = _CONSOLESUMMARYGROUP, - __module__ = 'project_pb2' - # @@protoc_insertion_point(class_scope:milo.ConsoleSummaryGroup) - )) -_sym_db.RegisterMessage(ConsoleSummaryGroup) - -Header = _reflection.GeneratedProtocolMessageType('Header', (_message.Message,), dict( - DESCRIPTOR = _HEADER, - __module__ = 'project_pb2' - # @@protoc_insertion_point(class_scope:milo.Header) - )) -_sym_db.RegisterMessage(Header) - -Console = _reflection.GeneratedProtocolMessageType('Console', (_message.Message,), dict( - DESCRIPTOR = _CONSOLE, - __module__ = 'project_pb2' - # @@protoc_insertion_point(class_scope:milo.Console) - )) -_sym_db.RegisterMessage(Console) - -Builder = _reflection.GeneratedProtocolMessageType('Builder', (_message.Message,), dict( - DESCRIPTOR = _BUILDER, - __module__ = 'project_pb2' - # @@protoc_insertion_point(class_scope:milo.Builder) - )) -_sym_db.RegisterMessage(Builder) - - -DESCRIPTOR._options = None -# @@protoc_insertion_point(module_scope)
diff --git a/infra/config/global/refs.cfg b/infra/config/global/refs.cfg deleted file mode 100644 index b287e22..0000000 --- a/infra/config/global/refs.cfg +++ /dev/null
@@ -1,6 +0,0 @@ -# Refs configuration file. The documentation of the format can be found -# at https://luci-config.appspot.com/schemas/projects:refs.cfg. -refs { - name: "refs/heads/master" - config_path: "infra/config/branch" -}
diff --git a/infra/config/global/tricium-prod.cfg b/infra/config/global/tricium-prod.cfg deleted file mode 100644 index 6d63366..0000000 --- a/infra/config/global/tricium-prod.cfg +++ /dev/null
@@ -1,55 +0,0 @@ -# Schema for this config file: ProjectConfig in -# luci-config.appspot.com/schemas/projects:tricium-prod.cfg - -acls { - role: REQUESTER - group: "tricium-chromium-requesters" -} - -selections { - function: "Cpplint" - platform: UBUNTU - configs { - name: "filter" - value: "-,+readability/todo,+readability/check,+readability/fn_size,+build/header_guard,+build/include_what_you_use,+build/include_order" - } - configs { - name: "verbose" - value: "4" - } -} - -selections { - function: "GitFileIsolator" - platform: UBUNTU -} - -selections { - function: "SpellChecker" - platform: UBUNTU -} - -selections { - function: "Pylint" - platform: UBUNTU - configs { - name: "disable" - value: "all" - } - configs { - name: "enable" - value: "syntax-error,unused-variable,undefined-variable,unused-import" - } -} - -repos { - gerrit_project { - host: "chromium-review.googlesource.com" - project: "chromium/src" - git_url: "https://chromium.googlesource.com/chromium/src" - } - whitelisted_group: "project-chromium-tryjob-access" -} - -service_account: "tricium-prod@appspot.gserviceaccount.com" -swarming_service_account: "swarming@tricium-prod.iam.gserviceaccount.com"
diff --git a/infra/config/luci-milo-dev.cfg b/infra/config/luci-milo-dev.cfg index 3e8c9f3d..a5b7407 100644 --- a/infra/config/luci-milo-dev.cfg +++ b/infra/config/luci-milo-dev.cfg
@@ -136,7 +136,7 @@ } links: { text: "customize" - url: "https://chromium.googlesource.com/chromium/src/+/master/infra/config/global/luci-milo-dev.cfg" + url: "https://chromium.googlesource.com/chromium/src/+/master/infra/config/luci-milo-dev.cfg" alt: "Customize this console" } }
diff --git a/infra/config/luci-milo.cfg b/infra/config/luci-milo.cfg index b71b4683..abf8c008 100644 --- a/infra/config/luci-milo.cfg +++ b/infra/config/luci-milo.cfg
@@ -209,7 +209,7 @@ } links { text: "customize" - url: "https://chromium.googlesource.com/chromium/src/+/master/infra/config/global/luci-milo.cfg" + url: "https://chromium.googlesource.com/chromium/src/+/master/infra/config/luci-milo.cfg" alt: "Customize this console" } }
diff --git a/ios/chrome/browser/crash_report/crash_report_helper.mm b/ios/chrome/browser/crash_report/crash_report_helper.mm index 2bdafb39a..f28be28 100644 --- a/ios/chrome/browser/crash_report/crash_report_helper.mm +++ b/ios/chrome/browser/crash_report/crash_report_helper.mm
@@ -146,7 +146,9 @@ return; NSString* url = [notification.userInfo objectForKey:kTabUrlKey]; DCHECK(url); - [self recordURL:url forTabId:tab.tabId pending:NO]; + [self recordURL:url + forTabId:TabIdTabHelper::FromWebState(tab.webState)->tab_id() + pending:NO]; } - (void)urlChangeExpected:(NSNotification*)notification { @@ -156,7 +158,9 @@ return; NSString* url = [notification.userInfo objectForKey:kTabUrlKey]; DCHECK(url); - [self recordURL:url forTabId:tab.tabId pending:YES]; + [self recordURL:url + forTabId:TabIdTabHelper::FromWebState(tab.webState)->tab_id() + pending:YES]; } - (void)removeTabId:(NSString*)tabId { @@ -203,14 +207,14 @@ - (void)tabModel:(TabModel*)model didRemoveTab:(Tab*)tab atIndex:(NSUInteger)index { - [self removeTabId:tab.tabId]; + [self removeTabId:TabIdTabHelper::FromWebState(tab.webState)->tab_id()]; } - (void)tabModel:(TabModel*)model didReplaceTab:(Tab*)oldTab withTab:(Tab*)newTab atIndex:(NSUInteger)index { - [self removeTabId:oldTab.tabId]; + [self removeTabId:TabIdTabHelper::FromWebState(oldTab.webState)->tab_id()]; } - (void)tabModel:(TabModel*)model @@ -222,7 +226,7 @@ const GURL& URL = pendingItem ? pendingItem->GetURL() : newTab.webState->GetLastCommittedURL(); [self recordURL:base::SysUTF8ToNSString(URL.spec()) - forTabId:newTab.tabId + forTabId:TabIdTabHelper::FromWebState(newTab.webState)->tab_id() pending:pendingItem ? YES : NO]; } @@ -314,14 +318,14 @@ - (void)tabModel:(TabModel*)model didRemoveTab:(Tab*)tab atIndex:(NSUInteger)index { - [self removeTabId:tab.tabId]; + [self removeTabId:TabIdTabHelper::FromWebState(tab.webState)->tab_id()]; } - (void)tabModel:(TabModel*)model didReplaceTab:(Tab*)oldTab withTab:(Tab*)newTab atIndex:(NSUInteger)index { - [self removeTabId:oldTab.tabId]; + [self removeTabId:TabIdTabHelper::FromWebState(oldTab.webState)->tab_id()]; } @end
diff --git a/ios/chrome/browser/tabs/tab.mm b/ios/chrome/browser/tabs/tab.mm index aba4b5e..77645a8 100644 --- a/ios/chrome/browser/tabs/tab.mm +++ b/ios/chrome/browser/tabs/tab.mm
@@ -278,7 +278,8 @@ XCallbackFromRequestURL:requestURL originURL:originURL tabURL:self.webState->GetLastCommittedURL() - tabID:self.tabId]; + tabID:TabIdTabHelper::FromWebState(self.webState) + ->tab_id()]; } #pragma mark - CRWWebStateObserver protocol
diff --git a/ios/chrome/browser/tabs/tab_model.mm b/ios/chrome/browser/tabs/tab_model.mm index b4d40e92..cd30656e 100644 --- a/ios/chrome/browser/tabs/tab_model.mm +++ b/ios/chrome/browser/tabs/tab_model.mm
@@ -51,6 +51,7 @@ #import "ios/chrome/browser/tabs/tab_model_web_state_list_delegate.h" #import "ios/chrome/browser/tabs/tab_parenting_observer.h" #import "ios/chrome/browser/web/page_placeholder_tab_helper.h" +#import "ios/chrome/browser/web/tab_id_tab_helper.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" #import "ios/chrome/browser/web_state_list/web_state_list_metrics_observer.h" #import "ios/chrome/browser/web_state_list/web_state_list_observer.h" @@ -730,8 +731,10 @@ // Called when UIApplicationWillResignActiveNotification is received. - (void)willResignActive:(NSNotification*)notify { if (self.webUsageEnabled && self.currentTab) { + NSString* tabId = + TabIdTabHelper::FromWebState(self.currentTab.webState)->tab_id(); [SnapshotCacheFactory::GetForBrowserState(_browserState) - willBeSavedGreyWhenBackgrounding:self.currentTab.tabId]; + willBeSavedGreyWhenBackgrounding:tabId]; } } @@ -754,8 +757,11 @@ // Write out a grey version of the current website to disk. if (self.webUsageEnabled && self.currentTab) { + NSString* tabId = + TabIdTabHelper::FromWebState(self.currentTab.webState)->tab_id(); + [SnapshotCacheFactory::GetForBrowserState(_browserState) - saveGreyInBackgroundForSessionID:self.currentTab.tabId]; + saveGreyInBackgroundForSessionID:tabId]; } }
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm index 100fed2..4597fb83 100644 --- a/ios/chrome/browser/ui/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -104,7 +104,6 @@ #import "ios/chrome/browser/ui/fullscreen/fullscreen_ui_updater.h" #import "ios/chrome/browser/ui/image_util/image_copier.h" #import "ios/chrome/browser/ui/image_util/image_saver.h" -#import "ios/chrome/browser/ui/image_util/image_util.h" #import "ios/chrome/browser/ui/infobars/infobar_container_coordinator.h" #import "ios/chrome/browser/ui/infobars/infobar_positioner.h" #import "ios/chrome/browser/ui/key_commands_provider.h" @@ -169,6 +168,7 @@ #import "ios/chrome/browser/web/page_placeholder_tab_helper.h" #import "ios/chrome/browser/web/repost_form_tab_helper.h" #import "ios/chrome/browser/web/sad_tab_tab_helper.h" +#import "ios/chrome/browser/web/tab_id_tab_helper.h" #import "ios/chrome/browser/web/web_navigation_util.h" #include "ios/chrome/browser/web_state_list/all_web_state_observation_forwarder.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" @@ -206,6 +206,7 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util_mac.h" #include "ui/base/page_transition_types.h" +#import "ui/gfx/image/image_util.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -2982,7 +2983,9 @@ - (BOOL)displaySignInNotification:(UIViewController*)viewController fromTabId:(NSString*)tabId { // Check if the call comes from currently visible tab. - if ([tabId isEqual:self.tabModel.currentTab.tabId]) { + NSString* visibleTabId = + TabIdTabHelper::FromWebState(self.tabModel.currentTab.webState)->tab_id(); + if ([tabId isEqual:visibleTabId]) { [self addChildViewController:viewController]; [self.view addSubview:viewController.view]; [viewController didMoveToParentViewController:self]; @@ -3318,7 +3321,9 @@ - (void)searchByImageData:(NSData*)data atURL:(const GURL&)imageURL { NSData* imageData = data; UIImage* image = [UIImage imageWithData:data]; - UIImage* resizedImage = ResizeImageForSearchByImage(image); + gfx::Image gfxImage(image); + UIImage* resizedImage = + gfx::ResizedImageForSearchByImage(gfxImage).ToUIImage(); if (![image isEqual:resizedImage]) { imageData = UIImageJPEGRepresentation(resizedImage, 1.0); } @@ -3326,7 +3331,7 @@ } // Performs a search with the given image data. The data should alread have -// been scaled down in |ResizeImageForSearchByImage|. +// been scaled down in |ResizedImageForSearchByImage|. - (void)searchByResizedImageData:(NSData*)data atURL:(const GURL*)imageURL inNewTab:(BOOL)inNewTab { @@ -4375,7 +4380,9 @@ } - (void)searchByImage:(UIImage*)image { - UIImage* resizedImage = ResizeImageForSearchByImage(image); + gfx::Image gfxImage(image); + UIImage* resizedImage = + gfx::ResizedImageForSearchByImage(gfxImage).ToUIImage(); NSData* data = UIImageJPEGRepresentation(resizedImage, 1.0); [self searchByResizedImageData:data atURL:nil inNewTab:NO]; } @@ -4527,7 +4534,8 @@ [_paymentRequestManager stopTrackingWebState:tab.webState]; - [[UpgradeCenter sharedInstance] tabWillClose:tab.tabId]; + [[UpgradeCenter sharedInstance] + tabWillClose:TabIdTabHelper::FromWebState(tab.webState)->tab_id()]; if ([model count] == 1) { // About to remove the last tab. [_paymentRequestManager setActiveWebState:nullptr]; }
diff --git a/ios/chrome/browser/ui/image_util/image_util.h b/ios/chrome/browser/ui/image_util/image_util.h index f4a579e..974d1de 100644 --- a/ios/chrome/browser/ui/image_util/image_util.h +++ b/ios/chrome/browser/ui/image_util/image_util.h
@@ -39,9 +39,4 @@ // is nil, empty, or cannot be recognized, nil will be returned. NSString* GetImageUTIFromData(NSData* data); -// Downsizes the image if its area exceeds kSearchByImageMaxImageArea AND -// (either its width exceeds kSearchByImageMaxImageWidth OR its height exceeds -// kSearchByImageMaxImageHeight) in preparation for searching. -UIImage* ResizeImageForSearchByImage(UIImage* image); - #endif // IOS_CHROME_BROWSER_UI_IMAGE_UTIL_IMAGE_UTIL_H_
diff --git a/ios/chrome/browser/ui/image_util/image_util.mm b/ios/chrome/browser/ui/image_util/image_util.mm index 05a7102..cf00c3f 100644 --- a/ios/chrome/browser/ui/image_util/image_util.mm +++ b/ios/chrome/browser/ui/image_util/image_util.mm
@@ -24,10 +24,6 @@ NSString* kImageExtensionICO = @"ico"; NSString* kImageExtensionWebP = @"webp"; -// Dimensions to use when downsizing an image for search-by-image. -const CGFloat kSearchByImageMaxImageArea = 90000.0; -const CGFloat kSearchByImageMaxImageWidth = 600.0; -const CGFloat kSearchByImageMaxImageHeight = 400.0; } UIColor* DominantColorForImage(const gfx::Image& image, CGFloat opacity) { @@ -113,17 +109,3 @@ }; return dict[GetImageExtensionFromData(data)]; } - -UIImage* ResizeImageForSearchByImage(UIImage* image) { - if (image && - image.size.height * image.size.width > kSearchByImageMaxImageArea && - (image.size.width > kSearchByImageMaxImageWidth || - image.size.height > kSearchByImageMaxImageHeight)) { - CGSize newImageSize = - CGSizeMake(kSearchByImageMaxImageWidth, kSearchByImageMaxImageHeight); - image = [image gtm_imageByResizingToSize:newImageSize - preserveAspectRatio:YES - trimToFit:NO]; - } - return image; -}
diff --git a/ios/chrome/browser/ui/location_bar/BUILD.gn b/ios/chrome/browser/ui/location_bar/BUILD.gn index eb17e1e2..0e96a03a 100644 --- a/ios/chrome/browser/ui/location_bar/BUILD.gn +++ b/ios/chrome/browser/ui/location_bar/BUILD.gn
@@ -60,6 +60,7 @@ "//ios/chrome/browser/ui/util", "//ios/chrome/browser/ui/voice", "//ios/chrome/browser/url_loading", + "//ios/chrome/browser/web", "//ios/chrome/browser/web_state_list", "//ios/chrome/common:timing", "//ios/public/provider/chrome/browser:browser",
diff --git a/ios/chrome/browser/ui/location_bar/location_bar_coordinator.mm b/ios/chrome/browser/ui/location_bar/location_bar_coordinator.mm index 960e915..0c317c1 100644 --- a/ios/chrome/browser/ui/location_bar/location_bar_coordinator.mm +++ b/ios/chrome/browser/ui/location_bar/location_bar_coordinator.mm
@@ -39,6 +39,7 @@ #import "ios/chrome/browser/ui/url_loader.h" #import "ios/chrome/browser/ui/util/pasteboard_util.h" #import "ios/chrome/browser/url_loading/url_loading_util.h" +#import "ios/chrome/browser/web/web_navigation_util.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" #include "ios/public/provider/chrome/browser/voice/voice_search_provider.h" @@ -226,6 +227,7 @@ #pragma mark - LocationBarURLLoader - (void)loadGURLFromLocationBar:(const GURL&)url + postContent:(TemplateURLRef::PostContent*)postContent transition:(ui::PageTransition)transition disposition:(WindowOpenDisposition)disposition { if (url.SchemeIs(url::kJavaScriptScheme)) { @@ -240,9 +242,12 @@ // |loadURL|? It doesn't seem to be causing major problems. If we call // cancel before load, then any prerendered pages get destroyed before the // call to load. - web::NavigationManager::WebLoadParams params(url); - params.transition_type = transition; - params.extra_headers = [self variationHeadersForURL:url]; + web::NavigationManager::WebLoadParams params = + web_navigation_util::CreateWebLoadParams(url, transition, postContent); + NSMutableDictionary* combinedExtraHeaders = + [[self variationHeadersForURL:url] mutableCopy]; + [combinedExtraHeaders addEntriesFromDictionary:params.extra_headers]; + params.extra_headers = [combinedExtraHeaders copy]; ChromeLoadParams chromeParams(params); chromeParams.disposition = disposition; [self.URLLoader loadURLWithParams:chromeParams];
diff --git a/ios/chrome/browser/ui/location_bar/location_bar_coordinator_unittest.mm b/ios/chrome/browser/ui/location_bar/location_bar_coordinator_unittest.mm index 429040e..22f5fc6 100644 --- a/ios/chrome/browser/ui/location_bar/location_bar_coordinator_unittest.mm +++ b/ios/chrome/browser/ui/location_bar/location_bar_coordinator_unittest.mm
@@ -129,6 +129,7 @@ WindowOpenDisposition disposition = WindowOpenDisposition::SWITCH_TO_TAB; [coordinator_ start]; [coordinator_ loadGURLFromLocationBar:url + postContent:nil transition:transition disposition:disposition]; @@ -155,6 +156,7 @@ WindowOpenDisposition disposition = WindowOpenDisposition::CURRENT_TAB; [coordinator_ start]; [coordinator_ loadGURLFromLocationBar:url + postContent:nil transition:transition disposition:disposition];
diff --git a/ios/chrome/browser/ui/location_bar/location_bar_url_loader.h b/ios/chrome/browser/ui/location_bar/location_bar_url_loader.h index a76069b3d..c7cbeea 100644 --- a/ios/chrome/browser/ui/location_bar/location_bar_url_loader.h +++ b/ios/chrome/browser/ui/location_bar/location_bar_url_loader.h
@@ -7,6 +7,7 @@ #import <Foundation/Foundation.h> +#include "components/search_engines/template_url.h" #include "ui/base/page_transition_types.h" #include "ui/base/window_open_disposition.h" @@ -15,6 +16,7 @@ // A means of loading URLs for the location bar. @protocol LocationBarURLLoader - (void)loadGURLFromLocationBar:(const GURL&)url + postContent:(TemplateURLRef::PostContent*)postContent transition:(ui::PageTransition)transition disposition:(WindowOpenDisposition)disposition; @end
diff --git a/ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller_impl.h b/ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller_impl.h index 10f6859..0f91a87 100644 --- a/ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller_impl.h +++ b/ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller_impl.h
@@ -31,6 +31,7 @@ // OmniboxEditController methods. void OnAutocompleteAccept(const GURL& destination_url, + TemplateURLRef::PostContent* post_content, WindowOpenDisposition disposition, ui::PageTransition transition, AutocompleteMatchType::Type match_type,
diff --git a/ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller_impl.mm b/ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller_impl.mm index ba45a28..d804a3a 100644 --- a/ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller_impl.mm +++ b/ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller_impl.mm
@@ -37,6 +37,7 @@ void WebOmniboxEditControllerImpl::OnAutocompleteAccept( const GURL& destination_url, + TemplateURLRef::PostContent* post_content, WindowOpenDisposition disposition, ui::PageTransition transition, AutocompleteMatchType::Type match_type, @@ -45,6 +46,7 @@ transition = ui::PageTransitionFromInt( transition | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); [URLLoader_ loadGURLFromLocationBar:destination_url + postContent:post_content transition:transition disposition:disposition]; }
diff --git a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm index bec2aa7..53b4ef8b 100644 --- a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm +++ b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm
@@ -413,20 +413,22 @@ (const GURL&)replacementURL { // The specific class to swizzle depends on whether the UIRefresh experiment // is enabled. - void (^loadGURLFromLocationBarBlock)(LocationBarCoordinator*, const GURL&, - ui::PageTransition) = - ^void(LocationBarCoordinator* self, const GURL& url, - ui::PageTransition transition) { - web::NavigationManager::WebLoadParams params(replacementURL); - params.transition_type = transition; - ChromeLoadParams chromeParams(params); - [self.URLLoader loadURLWithParams:chromeParams]; - [self cancelOmniboxEdit]; - }; - load_GURL_from_location_bar_swizzler_.reset(new ScopedBlockSwizzler( - [LocationBarCoordinator class], - @selector(loadGURLFromLocationBar:transition:disposition:), - loadGURLFromLocationBarBlock)); + void (^loadGURLFromLocationBarBlock)(LocationBarCoordinator*, + TemplateURLRef::PostContent*, + const GURL&, ui::PageTransition) = + ^void(LocationBarCoordinator* self, + TemplateURLRef::PostContent* postContent, const GURL& url, + ui::PageTransition transition) { + web::NavigationManager::WebLoadParams params(replacementURL); + params.transition_type = transition; + ChromeLoadParams chromeParams(params); + [self.URLLoader loadURLWithParams:chromeParams]; + [self cancelOmniboxEdit]; + }; + load_GURL_from_location_bar_swizzler_.reset(new ScopedBlockSwizzler( + [LocationBarCoordinator class], + @selector(loadGURLFromLocationBar:postContent:transition:disposition:), + loadGURLFromLocationBarBlock)); } // Creates a new CameraController mock with camera permission granted if
diff --git a/ios/chrome/browser/ui/side_swipe/side_swipe_controller.mm b/ios/chrome/browser/ui/side_swipe/side_swipe_controller.mm index 208b6278..61cf4bb 100644 --- a/ios/chrome/browser/ui/side_swipe/side_swipe_controller.mm +++ b/ios/chrome/browser/ui/side_swipe/side_swipe_controller.mm
@@ -27,6 +27,7 @@ #import "ios/chrome/browser/ui/toolbar/public/side_swipe_toolbar_interacting.h" #include "ios/chrome/browser/ui/util/ui_util.h" #import "ios/chrome/browser/web/page_placeholder_tab_helper.h" +#import "ios/chrome/browser/web/tab_id_tab_helper.h" #import "ios/chrome/browser/web/web_navigation_util.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" #import "ios/web/public/navigation_item.h" @@ -289,7 +290,8 @@ Tab* tab = [model_ tabAtIndex:index]; if (tab && PagePlaceholderTabHelper::FromWebState(tab.webState) ->will_add_placeholder_for_next_navigation()) { - [sessionIDs addObject:tab.tabId]; + [sessionIDs + addObject:TabIdTabHelper::FromWebState(tab.webState)->tab_id()]; } index = index + dx; }
diff --git a/ios/web/BUILD.gn b/ios/web/BUILD.gn index f07d144..4b8d812f 100644 --- a/ios/web/BUILD.gn +++ b/ios/web/BUILD.gn
@@ -71,7 +71,6 @@ "web_browser_manifest.h", "web_browser_manifest.mm", "web_client.mm", - "web_kit_constants.cc", "web_packaged_services_manifest.h", "web_packaged_services_manifest.mm", "web_sub_thread.cc",
diff --git a/ios/web/public/BUILD.gn b/ios/web/public/BUILD.gn index 68e6e3e..2a108d86 100644 --- a/ios/web/public/BUILD.gn +++ b/ios/web/public/BUILD.gn
@@ -60,7 +60,6 @@ "url_schemes.mm", "url_util.h", "web_client.h", - "web_kit_constants.h", "web_state/context_menu_params.h", "web_state/global_web_state_observer.h", "web_state/js/crw_js_injection_evaluator.h",
diff --git a/ios/web/web_state/ui/BUILD.gn b/ios/web/web_state/ui/BUILD.gn index 4113d6f..09eb58c 100644 --- a/ios/web/web_state/ui/BUILD.gn +++ b/ios/web/web_state/ui/BUILD.gn
@@ -53,6 +53,8 @@ "crw_web_view_scroll_view_proxy.mm", "crw_wk_navigation_states.h", "crw_wk_navigation_states.mm", + "web_kit_constants.cc", + "web_kit_constants.h", "wk_back_forward_list_item_holder.h", "wk_back_forward_list_item_holder.mm", "wk_navigation_action_util.h",
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm index 222e9752..0af920f 100644 --- a/ios/web/web_state/ui/crw_web_controller.mm +++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -67,7 +67,6 @@ #import "ios/web/public/url_scheme_util.h" #include "ios/web/public/url_util.h" #import "ios/web/public/web_client.h" -#include "ios/web/public/web_kit_constants.h" #import "ios/web/public/web_state/context_menu_params.h" #import "ios/web/public/web_state/js/crw_js_injection_manager.h" #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" @@ -100,6 +99,7 @@ #import "ios/web/web_state/ui/crw_wk_navigation_states.h" #import "ios/web/web_state/ui/crw_wk_script_message_router.h" #import "ios/web/web_state/ui/favicon_util.h" +#include "ios/web/web_state/ui/web_kit_constants.h" #import "ios/web/web_state/ui/wk_back_forward_list_item_holder.h" #import "ios/web/web_state/ui/wk_navigation_action_util.h" #import "ios/web/web_state/ui/wk_web_view_configuration_provider.h"
diff --git a/ios/web/web_kit_constants.cc b/ios/web/web_state/ui/web_kit_constants.cc similarity index 83% rename from ios/web/web_kit_constants.cc rename to ios/web/web_state/ui/web_kit_constants.cc index 0bcfb28..0c45ab3 100644 --- a/ios/web/web_kit_constants.cc +++ b/ios/web/web_state/ui/web_kit_constants.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 "ios/web/public/web_kit_constants.h" +#include "ios/web/web_state/ui/web_kit_constants.h" namespace web {
diff --git a/ios/web/public/web_kit_constants.h b/ios/web/web_state/ui/web_kit_constants.h similarity index 82% rename from ios/web/public/web_kit_constants.h rename to ios/web/web_state/ui/web_kit_constants.h index 72ab31b8..5fed599 100644 --- a/ios/web/public/web_kit_constants.h +++ b/ios/web/web_state/ui/web_kit_constants.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 IOS_WEB_PUBLIC_WEB_KIT_CONSTANTS_H_ -#define IOS_WEB_PUBLIC_WEB_KIT_CONSTANTS_H_ +#ifndef IOS_WEB_WEB_STATE_UI_WEB_KIT_CONSTANTS_H_ +#define IOS_WEB_WEB_STATE_UI_WEB_KIT_CONSTANTS_H_ // This header defines missing symbols from WebKit. // See WebKitErrors.h on Mac SDK. @@ -22,10 +22,9 @@ const long kWebKitErrorFrameLoadInterruptedByPolicyChange = 102; // Undocumented iOS-specific WebKit error. -const long kWebKitErrorUnsafePort = 103; const long kWebKitErrorUrlBlockedByContentFilter = 105; const long kWebKitErrorPlugInLoadFailed = 204; } // namespace web -#endif // IOS_WEB_PUBLIC_WEB_KIT_CONSTANTS_H_ +#endif // IOS_WEB_WEB_STATE_UI_WEB_KIT_CONSTANTS_H_
diff --git a/media/audio/sounds/test_data.h b/media/audio/sounds/test_data.h index b7b2966..147e160 100644 --- a/media/audio/sounds/test_data.h +++ b/media/audio/sounds/test_data.h
@@ -24,6 +24,16 @@ "data\x04\x00\x00\x00\x01\x00\x01\x00"; const size_t kTestAudioDataSize = base::size(kTestAudioData) - 1; +// Extensible format with 48kHz rate stereo 32 bit PCM samples +const char kTestExtensibleAudioData[] = + "RIFF\x44\x00\x00\x00WAVEfmt \x28\x00\x00\x00" + "\xfe\xff\x02\x00\x80\xbb\x00\x00\x00\x77\x01\x00\x02\x00\x20\x00" + "\x16\x00\x20\x00\x00\x00\x00\x00" + "\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "data\x08\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00"; +const size_t kTestExtensibleAudioDataSize = + base::size(kTestExtensibleAudioData) - 1; + class TestObserver : public AudioStreamHandler::TestObserver { public: TestObserver(const base::Closure& quit);
diff --git a/media/audio/sounds/wav_audio_handler.cc b/media/audio/sounds/wav_audio_handler.cc index df3674b..915b48b 100644 --- a/media/audio/sounds/wav_audio_handler.cc +++ b/media/audio/sounds/wav_audio_handler.cc
@@ -31,15 +31,19 @@ // The minimum size of 'fmt' chunk. const size_t kFmtChunkMinimumSize = 16; +const size_t kFmtChunkExtensibleMinimumSize = 40; // The offsets of 'fmt' fields. const size_t kAudioFormatOffset = 0; const size_t kChannelOffset = 2; const size_t kSampleRateOffset = 4; const size_t kBitsPerSampleOffset = 14; +const size_t kValidBitsPerSampleOffset = 18; +const size_t kSubFormatOffset = 24; // Some constants for audio format. const int kAudioFormatPCM = 1; +const int kAudioFormatExtensible = 0xfffe; // A convenience struct for passing WAV parameters around. AudioParameters is // too heavyweight for this. Keep this class internal to this implementation. @@ -48,11 +52,15 @@ uint16_t num_channels; uint32_t sample_rate; uint16_t bits_per_sample; + uint16_t valid_bits_per_sample; + bool is_extensible; }; bool ParamsAreValid(const WavAudioParameters& params) { return (params.audio_format == kAudioFormatPCM && params.num_channels != 0u && - params.sample_rate != 0u && params.bits_per_sample != 0u); + params.sample_rate != 0u && params.bits_per_sample != 0u && + (!params.is_extensible || + params.valid_bits_per_sample == params.bits_per_sample)); } // Reads an integer from |data| with |offset|. @@ -82,6 +90,20 @@ params->num_channels = ReadInt<uint16_t>(data, kChannelOffset); params->sample_rate = ReadInt<uint32_t>(data, kSampleRateOffset); params->bits_per_sample = ReadInt<uint16_t>(data, kBitsPerSampleOffset); + + if (params->audio_format == kAudioFormatExtensible) { + if (data.size() < kFmtChunkExtensibleMinimumSize) { + LOG(ERROR) << "Data size " << data.size() << " is too short."; + return false; + } + + params->is_extensible = true; + params->audio_format = ReadInt<uint16_t>(data, kSubFormatOffset); + params->valid_bits_per_sample = + ReadInt<uint16_t>(data, kValidBitsPerSampleOffset); + } else { + params->is_extensible = false; + } return true; } @@ -150,7 +172,10 @@ LOG(ERROR) << "Format is invalid. " << "num_channels: " << params_out->num_channels << " " << "sample_rate: " << params_out->sample_rate << " " - << "bits_per_sample: " << params_out->bits_per_sample; + << "bits_per_sample: " << params_out->bits_per_sample << " " + << "valid_bits_per_sample: " << params_out->valid_bits_per_sample + << " " + << "is_extensible: " << params_out->is_extensible; return false; } return true;
diff --git a/media/audio/sounds/wav_audio_handler_unittest.cc b/media/audio/sounds/wav_audio_handler_unittest.cc index 21691cc..87d9fd67 100644 --- a/media/audio/sounds/wav_audio_handler_unittest.cc +++ b/media/audio/sounds/wav_audio_handler_unittest.cc
@@ -58,6 +58,29 @@ ASSERT_EQ(static_cast<size_t>(handler->data().size()), bytes_written); } +TEST(WavAudioHandlerTest, SampleExtensibleDataTest) { + std::string data(kTestExtensibleAudioData, kTestExtensibleAudioDataSize); + auto handler = WavAudioHandler::Create(data); + ASSERT_TRUE(handler); + ASSERT_EQ(2u, handler->num_channels()); + ASSERT_EQ(32u, handler->bits_per_sample()); + ASSERT_EQ(48000u, handler->sample_rate()); + ASSERT_EQ(1u, handler->total_frames()); + ASSERT_EQ(20u, handler->GetDuration().InMicroseconds()); + + ASSERT_EQ(8U, handler->data().size()); + const char kData[] = "\x01\x00\x00\x00\x01\x00\x00\x00"; + ASSERT_EQ(base::StringPiece(kData, base::size(kData) - 1), handler->data()); + + std::unique_ptr<AudioBus> bus = + AudioBus::Create(handler->num_channels(), + handler->data().size() / handler->num_channels()); + + size_t bytes_written = 0u; + ASSERT_TRUE(handler->CopyTo(bus.get(), 0, &bytes_written)); + ASSERT_EQ(static_cast<size_t>(handler->data().size()), bytes_written); +} + TEST(WavAudioHandlerTest, TestZeroChannelsIsNotValid) { // Read in the sample data and modify the channel field to hold |00|00|. std::string data(kTestAudioData, kTestAudioDataSize);
diff --git a/media/base/audio_renderer_mixer_input.cc b/media/base/audio_renderer_mixer_input.cc index f8444b49..ee04a46 100644 --- a/media/base/audio_renderer_mixer_input.cc +++ b/media/base/audio_renderer_mixer_input.cc
@@ -16,6 +16,12 @@ namespace media { +// TODO(dalecurtis): Merge with AudioDeviceDescription::IsDefaultDevice() once +// that file has been moved to media/base. +bool IsDefaultDevice(const std::string& device_id) { + return device_id.empty() || device_id == "default"; +} + AudioRendererMixerInput::AudioRendererMixerInput( AudioRendererMixerPool* mixer_pool, int owner_id, @@ -37,6 +43,11 @@ DCHECK(!mixer_); if (sink_) sink_->Stop(); + + // Because GetOutputDeviceInfoAsync() and SwitchOutputDevice() both use + // base::RetainedRef, it should be impossible to get here with these set. + DCHECK(!pending_device_info_cb_); + DCHECK(!pending_switch_cb_); } void AudioRendererMixerInput::Initialize( @@ -124,6 +135,14 @@ return; } + if (switch_output_device_in_progress_) { + DCHECK(!godia_in_progress_); + pending_device_info_cb_ = std::move(info_cb); + return; + } + + godia_in_progress_ = true; + // We may have |device_info_|, but a Stop() has been called since if we don't // have a |sink_| or a |mixer_|, so request the information again in case it // has changed (which may occur due to browser side device changes). @@ -151,11 +170,29 @@ void AudioRendererMixerInput::SwitchOutputDevice( const std::string& device_id, OutputDeviceStatusCB callback) { - if (device_id == device_id_) { + // If a GODIA() call is in progress, defer until it's complete. + if (godia_in_progress_) { + DCHECK(!switch_output_device_in_progress_); + + // Abort any previous device switch which may be pending. + if (pending_switch_cb_) + std::move(pending_switch_cb_).Run(OUTPUT_DEVICE_STATUS_ERROR_INTERNAL); + + pending_device_id_ = device_id; + pending_switch_cb_ = std::move(callback); + return; + } + + // Some pages send "default" instead of the spec compliant empty string for + // the default device. Short circuit these here to avoid busy work. + if (device_id == device_id_ || + (IsDefaultDevice(device_id_) && IsDefaultDevice(device_id))) { std::move(callback).Run(OUTPUT_DEVICE_STATUS_OK); return; } + switch_output_device_in_progress_ = true; + // Request a new sink using the new device id. This process may fail, so to // avoid interrupting working audio, don't set any class variables until we // know it's a success. @@ -200,17 +237,36 @@ void AudioRendererMixerInput::OnDeviceInfoReceived( OutputDeviceInfoCB info_cb, OutputDeviceInfo device_info) { + DCHECK(godia_in_progress_); + godia_in_progress_ = false; + device_info_ = device_info; std::move(info_cb).Run(*device_info_); + + // Complete any pending SwitchOutputDevice() if needed. We don't post this to + // ensure we don't reorder calls relative to what the page is expecting. I.e., + // if we post we could end up with Switch(1) -> Switch(2) ending on Switch(1). + if (!pending_switch_cb_) + return; + SwitchOutputDevice(std::move(pending_device_id_), + std::move(pending_switch_cb_)); } void AudioRendererMixerInput::OnDeviceSwitchReady( OutputDeviceStatusCB switch_cb, scoped_refptr<AudioRendererSink> sink, OutputDeviceInfo device_info) { + DCHECK(switch_output_device_in_progress_); + switch_output_device_in_progress_ = false; + if (device_info.device_status() != OUTPUT_DEVICE_STATUS_OK) { sink->Stop(); std::move(switch_cb).Run(device_info.device_status()); + + // Start any pending device info request. + if (pending_device_info_cb_) + GetOutputDeviceInfoAsync(std::move(pending_device_info_cb_)); + return; } @@ -233,6 +289,10 @@ } std::move(switch_cb).Run(device_info.device_status()); + + // Start any pending device info request. + if (pending_device_info_cb_) + GetOutputDeviceInfoAsync(std::move(pending_device_info_cb_)); } } // namespace media
diff --git a/media/base/audio_renderer_mixer_input.h b/media/base/audio_renderer_mixer_input.h index bfbaa16..0e47c24 100644 --- a/media/base/audio_renderer_mixer_input.h +++ b/media/base/audio_renderer_mixer_input.h
@@ -115,6 +115,23 @@ // Source of audio data which is provided to the mixer. AudioRendererSink::RenderCallback* callback_ = nullptr; + // SwitchOutputDevice() and GetOutputDeviceInfoAsync() must be mutually + // exclusive when executing; these flags indicate whether one or the other is + // in progress. Each method will use the other method's to defer its action. + bool godia_in_progress_ = false; + bool switch_output_device_in_progress_ = false; + + // Set by GetOutputDeviceInfoAsync() if a SwitchOutputDevice() call is in + // progress. GetOutputDeviceInfoAsync() will be invoked again with this value + // once OnDeviceSwitchReady() from the SwitchOutputDevice() call completes. + OutputDeviceInfoCB pending_device_info_cb_; + + // Set by SwitchOutputDevice() if a GetOutputDeviceInfoAsync() call is in + // progress. SwitchOutputDevice() will be invoked again with these values once + // the OnDeviceInfoReceived() from the GODIA() call completes. + std::string pending_device_id_; + OutputDeviceStatusCB pending_switch_cb_; + DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInput); };
diff --git a/media/base/audio_renderer_mixer_input_unittest.cc b/media/base/audio_renderer_mixer_input_unittest.cc index f42decf..e1606f9 100644 --- a/media/base/audio_renderer_mixer_input_unittest.cc +++ b/media/base/audio_renderer_mixer_input_unittest.cc
@@ -19,6 +19,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +using testing::_; + namespace { void LogUma(int value) {} } @@ -92,6 +94,7 @@ MOCK_METHOD1(ReturnMixer, void(AudioRendererMixer*)); MOCK_METHOD1(SwitchCallbackCalled, void(OutputDeviceStatus)); + MOCK_METHOD1(OnDeviceInfoReceived, void(OutputDeviceInfo)); void SwitchCallback(base::RunLoop* loop, OutputDeviceStatus result) { SwitchCallbackCalled(result); @@ -321,4 +324,129 @@ mixer_input_->Stop(); } +// Test that calling SwitchOutputDevice() before +// GetOutputDeviceInfoAsync() works correctly. +TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceBeforeGODIA) { + mixer_input_->Stop(); + mixer_input_ = new AudioRendererMixerInput( + this, kRenderFrameId, kDefaultDeviceId, AudioLatency::LATENCY_PLAYBACK); + + base::RunLoop run_loop; + EXPECT_CALL(*this, SwitchCallbackCalled(OUTPUT_DEVICE_STATUS_OK)); + mixer_input_->SwitchOutputDevice( + kAnotherDeviceId, + base::BindOnce(&AudioRendererMixerInputTest::SwitchCallback, + base::Unretained(this), &run_loop)); + run_loop.Run(); + mixer_input_->Stop(); +} + +// Test that calling SwitchOutputDevice() during an ongoing +// GetOutputDeviceInfoAsync() call works correctly. +TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceDuringGODIA) { + mixer_input_->Stop(); + mixer_input_ = new AudioRendererMixerInput( + this, kRenderFrameId, kDefaultDeviceId, AudioLatency::LATENCY_PLAYBACK); + + mixer_input_->GetOutputDeviceInfoAsync( + base::BindOnce(&AudioRendererMixerInputTest::OnDeviceInfoReceived, + base::Unretained(this))); + mixer_input_->SwitchOutputDevice( + kAnotherDeviceId, + base::BindOnce(&AudioRendererMixerInputTest::SwitchCallbackCalled, + base::Unretained(this))); + { + // Verify that first the GODIA call returns, then the SwitchOutputDevice(). + testing::InSequence sequence_required; + OutputDeviceInfo info; + constexpr auto kExpectedStatus = OUTPUT_DEVICE_STATUS_OK; + EXPECT_CALL(*this, OnDeviceInfoReceived(_)) + .WillOnce(testing::SaveArg<0>(&info)); + EXPECT_CALL(*this, SwitchCallbackCalled(OUTPUT_DEVICE_STATUS_OK)); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ(kExpectedStatus, info.device_status()); + EXPECT_EQ(kDefaultDeviceId, info.device_id()); + } + + mixer_input_->Stop(); +} + +// Test that calling GetOutputDeviceInfoAsync() during an ongoing +// SwitchOutputDevice() call works correctly. +TEST_F(AudioRendererMixerInputTest, GODIADuringSwitchOutputDevice) { + mixer_input_->Stop(); + mixer_input_ = new AudioRendererMixerInput( + this, kRenderFrameId, kDefaultDeviceId, AudioLatency::LATENCY_PLAYBACK); + + mixer_input_->SwitchOutputDevice( + kAnotherDeviceId, + base::BindOnce(&AudioRendererMixerInputTest::SwitchCallbackCalled, + base::Unretained(this))); + mixer_input_->GetOutputDeviceInfoAsync( + base::BindOnce(&AudioRendererMixerInputTest::OnDeviceInfoReceived, + base::Unretained(this))); + + { + // Verify that first the SwitchOutputDevice call returns, then the GODIA(). + testing::InSequence sequence_required; + EXPECT_CALL(*this, SwitchCallbackCalled(OUTPUT_DEVICE_STATUS_OK)); + OutputDeviceInfo info; + constexpr auto kExpectedStatus = OUTPUT_DEVICE_STATUS_OK; + EXPECT_CALL(*this, OnDeviceInfoReceived(_)) + .WillOnce(testing::SaveArg<0>(&info)); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ(kExpectedStatus, info.device_status()); + EXPECT_EQ(kAnotherDeviceId, info.device_id()); + } + + mixer_input_->Stop(); +} + +// Test that calling GetOutputDeviceInfoAsync() during an ongoing +// SwitchOutputDevice() call which eventually fails works correctly. +TEST_F(AudioRendererMixerInputTest, GODIADuringSwitchOutputDeviceWhichFails) { + mixer_input_->Stop(); + mixer_input_ = new AudioRendererMixerInput( + this, kRenderFrameId, kDefaultDeviceId, AudioLatency::LATENCY_PLAYBACK); + + mixer_input_->SwitchOutputDevice( + kNonexistentDeviceId, + base::BindOnce(&AudioRendererMixerInputTest::SwitchCallbackCalled, + base::Unretained(this))); + mixer_input_->GetOutputDeviceInfoAsync( + base::BindOnce(&AudioRendererMixerInputTest::OnDeviceInfoReceived, + base::Unretained(this))); + + { + // Verify that first the SwitchOutputDevice call returns, then the GODIA(). + testing::InSequence sequence_required; + EXPECT_CALL(*this, + SwitchCallbackCalled(OUTPUT_DEVICE_STATUS_ERROR_NOT_FOUND)); + OutputDeviceInfo info; + constexpr auto kExpectedStatus = OUTPUT_DEVICE_STATUS_OK; + EXPECT_CALL(*this, OnDeviceInfoReceived(_)) + .WillOnce(testing::SaveArg<0>(&info)); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ(kExpectedStatus, info.device_status()); + EXPECT_EQ(kDefaultDeviceId, info.device_id()); + } + + mixer_input_->Stop(); +} + +// Test that calling SwitchOutputDevice() with an empty device id does nothing +// when we're already on the default device. +TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceEmptyDeviceId) { + EXPECT_CALL(*this, SwitchCallbackCalled(OUTPUT_DEVICE_STATUS_OK)); + mixer_input_->SwitchOutputDevice( + std::string(), + base::BindOnce(&AudioRendererMixerInputTest::SwitchCallbackCalled, + base::Unretained(this))); + + // No RunUntilIdle() since switch should immediately return success. + testing::Mock::VerifyAndClear(this); + + mixer_input_->Stop(); +} + } // namespace media
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc index 7dcdd0b..d05c969 100644 --- a/media/blink/webmediaplayer_impl.cc +++ b/media/blink/webmediaplayer_impl.cc
@@ -902,7 +902,7 @@ UpdatePlayState(); } -void WebMediaPlayerImpl::EnterPictureInPicture() { +void WebMediaPlayerImpl::OnRequestPictureInPicture() { if (!surface_layer_for_video_enabled_) ActivateSurfaceLayerForVideo(); @@ -910,12 +910,6 @@ DCHECK(bridge_->GetSurfaceId().is_valid()); } -void WebMediaPlayerImpl::ExitPictureInPicture() { - // Internal cleanups. - // TODO(mlamouri): remove the need for this. - OnPictureInPictureModeEnded(); -} - void WebMediaPlayerImpl::SetPictureInPictureCustomControls( const std::vector<blink::PictureInPictureControlInfo>& controls) { delegate_->DidSetPictureInPictureCustomControls(delegate_id_, controls);
diff --git a/media/blink/webmediaplayer_impl.h b/media/blink/webmediaplayer_impl.h index 7183daa..06ede31 100644 --- a/media/blink/webmediaplayer_impl.h +++ b/media/blink/webmediaplayer_impl.h
@@ -120,8 +120,7 @@ void Seek(double seconds) override; void SetRate(double rate) override; void SetVolume(double volume) override; - void EnterPictureInPicture() override; - void ExitPictureInPicture() override; + void OnRequestPictureInPicture() override; void SetPictureInPictureCustomControls( const std::vector<blink::PictureInPictureControlInfo>&) override; void SetSinkId(
diff --git a/media/gpu/image_processor_test.cc b/media/gpu/image_processor_test.cc index e1c18d07..2d0561c 100644 --- a/media/gpu/image_processor_test.cc +++ b/media/gpu/image_processor_test.cc
@@ -93,7 +93,7 @@ std::string expected_md5 = output_image.Checksum(); std::string computed_md5 = MD5DigestToBase16(digest); EXPECT_EQ(expected_md5, computed_md5); -}; +} // I420->NV12 INSTANTIATE_TEST_SUITE_P(ConvertI420ToNV12,
diff --git a/media/gpu/v4l2/v4l2_image_processor.cc b/media/gpu/v4l2/v4l2_image_processor.cc index decc5c8b..93e656c 100644 --- a/media/gpu/v4l2/v4l2_image_processor.cc +++ b/media/gpu/v4l2/v4l2_image_processor.cc
@@ -379,17 +379,21 @@ FrameReadyCB cb) { DVLOGF(4) << "ts=" << frame->timestamp().InMilliseconds(); + auto job_record = std::make_unique<JobRecord>(); + job_record->input_frame = frame; + job_record->output_buffer_index = output_buffer_index; + job_record->ready_cb = std::move(cb); + switch (output_memory_type_) { case V4L2_MEMORY_MMAP: if (!output_dmabuf_fds.empty()) { VLOGF(1) << "output_dmabuf_fds must be empty for MMAP output mode"; return false; } - output_dmabuf_fds = - DuplicateFDs(output_buffer_map_[output_buffer_index].dmabuf_fds); break; case V4L2_MEMORY_DMABUF: + job_record->output_dmabuf_fds = std::move(output_dmabuf_fds); break; default: @@ -397,26 +401,6 @@ return false; } - if (output_dmabuf_fds.size() != output_layout_.num_buffers()) { - VLOGF(1) << "wrong number of output fds. Expected " - << output_layout_.num_buffers() << ", actual " - << output_dmabuf_fds.size(); - return false; - } - - std::unique_ptr<JobRecord> job_record(new JobRecord()); - job_record->input_frame = frame; - job_record->output_buffer_index = output_buffer_index; - job_record->ready_cb = std::move(cb); - - // Create the output frame - job_record->output_frame = VideoFrame::WrapExternalDmabufs( - output_layout_, gfx::Rect(output_visible_size_), output_visible_size_, - std::move(output_dmabuf_fds), job_record->input_frame->timestamp()); - - if (!job_record->output_frame) - return false; - // Since device_thread_ is owned by this class. base::Unretained(this) and the // raw pointer of that task runner are safe. process_task_tracker_.PostTask( @@ -773,9 +757,43 @@ std::unique_ptr<JobRecord> job_record = std::move(running_jobs_.front()); running_jobs_.pop(); + std::vector<base::ScopedFD> output_dmabuf_fds; + switch (output_memory_type_) { + case V4L2_MEMORY_MMAP: + output_dmabuf_fds = + DuplicateFDs(output_buffer_map_[dqbuf.index].dmabuf_fds); + break; + + case V4L2_MEMORY_DMABUF: + output_dmabuf_fds = std::move(job_record->output_dmabuf_fds); + break; + + default: + NOTREACHED(); + return; + } + + if (output_dmabuf_fds.size() != output_layout_.num_buffers()) { + VLOGF(1) << "wrong number of output fds. Expected " + << output_layout_.num_buffers() << ", actual " + << output_dmabuf_fds.size(); + return; + } + + // Create the output frame + auto output_frame = VideoFrame::WrapExternalDmabufs( + output_layout_, gfx::Rect(output_visible_size_), output_visible_size_, + std::move(output_dmabuf_fds), job_record->input_frame->timestamp()); + + if (!output_frame) { + DVLOGF(1) << "Error creating output frame!"; + NotifyError(); + return; + } + DVLOGF(4) << "Processing finished, returning frame, index=" << dqbuf.index; - std::move(job_record->ready_cb).Run(std::move(job_record->output_frame)); + std::move(job_record->ready_cb).Run(std::move(output_frame)); } } @@ -831,7 +849,7 @@ qbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; qbuf.memory = output_memory_type_; if (output_memory_type_ == V4L2_MEMORY_DMABUF) { - auto& fds = job_record->output_frame->DmabufFds(); + auto& fds = job_record->output_dmabuf_fds; if (fds.size() != output_layout_.num_buffers()) { VLOGF(1) << "Invalid number of FDs in output record"; return false;
diff --git a/media/gpu/v4l2/v4l2_image_processor.h b/media/gpu/v4l2/v4l2_image_processor.h index 7fd520e..953f3f46 100644 --- a/media/gpu/v4l2/v4l2_image_processor.h +++ b/media/gpu/v4l2/v4l2_image_processor.h
@@ -98,7 +98,6 @@ ~JobRecord(); scoped_refptr<VideoFrame> input_frame; int output_buffer_index; - scoped_refptr<VideoFrame> output_frame; std::vector<base::ScopedFD> output_dmabuf_fds; FrameReadyCB ready_cb; };
diff --git a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc index cfe2342e..69e250f3 100644 --- a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc +++ b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
@@ -37,7 +37,6 @@ #include "media/video/h264_parser.h" #include "ui/gfx/geometry/rect.h" #include "ui/gl/gl_context.h" -#include "ui/gl/gl_fence_egl.h" #include "ui/gl/scoped_binders.h" #define NOTIFY_ERROR(x) \ @@ -121,8 +120,7 @@ } V4L2VideoDecodeAccelerator::OutputRecord::OutputRecord() - : state(kFree), - egl_image(EGL_NO_IMAGE_KHR), + : egl_image(EGL_NO_IMAGE_KHR), picture_id(-1), texture_id(0), cleared(false) {} @@ -150,7 +148,6 @@ device_(device), decoder_delay_bitstream_buffer_id_(-1), decoder_decode_buffer_tasks_scheduled_(0), - decoder_frames_at_client_(0), decoder_flushing_(false), decoder_cmd_supported_(false), flush_awaiting_last_output_buffer_(false), @@ -406,6 +403,7 @@ DCHECK(buffer.IsValid()); int i = buffer.BufferId(); + DCHECK_EQ(output_wait_map_.count(buffers[i].id()), 0u); output_wait_map_.emplace(buffers[i].id(), std::move(buffer)); } @@ -413,9 +411,7 @@ DCHECK(buffers[i].size() == egl_image_size_); OutputRecord& output_record = output_buffer_map_[i]; - DCHECK_EQ(output_record.state, kFree); DCHECK_EQ(output_record.egl_image, EGL_NO_IMAGE_KHR); - DCHECK(!output_record.egl_fence); DCHECK_EQ(output_record.picture_id, -1); DCHECK(!output_record.cleared); DCHECK(output_record.processor_input_fds.empty()); @@ -425,10 +421,6 @@ ? 0 : buffers[i].service_texture_ids()[0]; - // This will remain kAtClient until ImportBufferForPicture is called, either - // by the client, or by ourselves, if we are allocating. - output_record.state = kAtClient; - if (image_processor_device_) { std::vector<base::ScopedFD> dmabuf_fds = device_->GetDmabufsForV4L2Buffer( i, output_planes_count_, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); @@ -535,13 +527,13 @@ OutputRecord& output_record = output_buffer_map_[buffer_index]; DCHECK_EQ(output_record.egl_image, EGL_NO_IMAGE_KHR); - DCHECK(!output_record.egl_fence); output_record.egl_image = egl_image; // Make ourselves available if CreateEGLImageFor has been called from // ImportBufferForPictureTask. if (!image_processor_) { + DCHECK_EQ(output_wait_map_.count(picture_buffer_id), 1u); output_wait_map_.erase(picture_buffer_id); if (decoder_state_ != kChangingResolution) { Enqueue(); @@ -644,12 +636,6 @@ return; } - if (iter->state != kAtClient) { - VLOGF(1) << "Cannot import buffer not owned by client"; - NOTIFY_ERROR(INVALID_ARGUMENT); - return; - } - int plane_horiz_bits_per_pixel = VideoFrame::PlaneHorizontalBitsPerPixel( V4L2Device::V4L2PixFmtToVideoPixelFormat(egl_image_format_fourcc_), 0); if (plane_horiz_bits_per_pixel == 0 || @@ -690,7 +676,6 @@ iter->output_fds = DuplicateFDs(dmabuf_fds); } - iter->state = kFree; if (iter->texture_id != 0) { if (iter->egl_image != EGL_NO_IMAGE_KHR) { child_task_runner_->PostTask( @@ -719,6 +704,7 @@ } // The buffer can now be used for decoding + DCHECK_EQ(output_wait_map_.count(picture_buffer_id), 1u); output_wait_map_.erase(picture_buffer_id); if (decoder_state_ != kChangingResolution) { Enqueue(); @@ -1304,14 +1290,42 @@ << output_queue_->FreeBuffersCount() << "+" << output_queue_->QueuedBuffersCount() << "/" << output_buffer_map_.size() << "] => PROCESSOR[" - << image_processor_bitstream_buffer_ids_.size() << "] => CLIENT[" - << decoder_frames_at_client_ << "]"; + << buffers_at_ip_.size() << "] => CLIENT[" + << buffers_at_client_.size() << "]"; ScheduleDecodeBufferTaskIfNeeded(); if (resolution_change_pending) StartResolutionChange(); } +void V4L2VideoDecodeAccelerator::CheckGLFences() { + DVLOGF(4); + DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); + + while (!buffers_awaiting_fence_.empty()) { + if (buffers_awaiting_fence_.front().first->HasCompleted()) { + // Buffer at the front of the queue goes back to V4L2Queue's free list + // and can be reused. + buffers_awaiting_fence_.pop(); + } else { + // If we have no free buffers available, then preemptively schedule a + // call to Enqueue() in a short time, otherwise we may starve out of + // buffers. The delay chosen roughly corresponds to the time a frame is + // displayed, which should be optimal in most cases. + if (output_queue_->FreeBuffersCount() == 0) { + constexpr int64_t resched_delay = 17; + + decoder_thread_.task_runner()->PostDelayedTask( + FROM_HERE, + base::Bind(&V4L2VideoDecodeAccelerator::Enqueue, + base::Unretained(this)), + base::TimeDelta::FromMilliseconds(resched_delay)); + } + break; + } + } +} + void V4L2VideoDecodeAccelerator::Enqueue() { DVLOGF(4); DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); @@ -1385,6 +1399,8 @@ // Enqueue all the outputs we can. const int old_outputs_queued = output_queue_->QueuedBuffersCount(); + // Release output buffers which GL fences have been signaled. + CheckGLFences(); while (output_queue_->FreeBuffersCount() > 0) { if (!EnqueueOutputRecord()) return; @@ -1485,24 +1501,21 @@ DCHECK_LT(buf->BufferId(), output_buffer_map_.size()); OutputRecord& output_record = output_buffer_map_[buf->BufferId()]; - DCHECK_EQ(output_record.state, kAtDevice); DCHECK_NE(output_record.picture_id, -1); - if (buf->GetPlaneBytesUsed(0) == 0) { - // This is an empty output buffer returned as part of a flush. - output_record.state = kFree; - } else { + // Zero-bytes buffers are returned as part of a flush and can be dismissed. + if (buf->GetPlaneBytesUsed(0) > 0) { int32_t bitstream_buffer_id = buf->GetTimeStamp().tv_sec; DCHECK_GE(bitstream_buffer_id, 0); DVLOGF(4) << "Dequeue output buffer: dqbuf index=" << buf->BufferId() << " bitstream input_id=" << bitstream_buffer_id; if (image_processor_device_) { - if (!ProcessFrame(bitstream_buffer_id, buf->BufferId())) { + if (!ProcessFrame(bitstream_buffer_id, buf)) { VLOGF(1) << "Processing frame failed"; NOTIFY_ERROR(PLATFORM_FAILURE); return false; } } else { - SendBufferToClient(buf->BufferId(), bitstream_buffer_id); + SendBufferToClient(buf->BufferId(), bitstream_buffer_id, buf); } } if (buf->IsLast()) { @@ -1517,12 +1530,6 @@ } } - if (buf->GetPlaneBytesUsed(0) > 0) { - // Keep a reference to this buffer until the client returns it - DCHECK_EQ(buffers_at_client_.count(output_record.picture_id), 0u); - buffers_at_client_.emplace(output_record.picture_id, std::move(buf)); - } - return true; } @@ -1549,36 +1556,7 @@ DCHECK(buffer.IsValid()); OutputRecord& output_record = output_buffer_map_[buffer.BufferId()]; - DCHECK_EQ(output_record.state, kFree); DCHECK_NE(output_record.picture_id, -1); - if (output_record.egl_fence) { - TRACE_EVENT0( - "media,gpu", - "V4L2VDA::EnqueueOutputRecord: GLFenceEGL::ClientWaitWithTimeoutNanos"); - // If we have to wait for completion, wait. Note that free_output_buffers_ - // is a FIFO queue, so we always wait on the buffer that has been in the - // queue the longest. Every 100ms we check whether the decoder is shutting - // down, or we might get stuck waiting on a fence that will never come. - while (!IsDestroyPending()) { - const EGLTimeKHR wait_ns = - base::TimeDelta::FromMilliseconds(100).InNanoseconds(); - EGLint result = - output_record.egl_fence->ClientWaitWithTimeoutNanos(wait_ns); - if (result == EGL_CONDITION_SATISFIED_KHR) { - break; - } else if (result == EGL_FALSE) { - // This will cause tearing, but is safe otherwise. - DVLOGF(1) << "GLFenceEGL::ClientWaitWithTimeoutNanos failed!"; - break; - } - DCHECK_EQ(result, EGL_TIMEOUT_EXPIRED_KHR); - } - - if (IsDestroyPending()) - return false; - - output_record.egl_fence.reset(); - } bool ret = false; switch (buffer.Memory()) { @@ -1598,7 +1576,6 @@ return false; } - output_record.state = kAtDevice; return true; } @@ -1634,32 +1611,25 @@ return; } V4L2ReadableBufferRef buffer = std::move(iter->second); + DCHECK_EQ(buffers_at_client_.count(picture_buffer_id), 1u); buffers_at_client_.erase(iter); - OutputRecord& output_record = output_buffer_map_[buffer->BufferId()]; - if (output_record.state != kAtClient) { - VLOGF(1) << "picture_buffer_id not reusable"; - NOTIFY_ERROR(INVALID_ARGUMENT); - return; - } - - DCHECK(!output_record.egl_fence); - output_record.state = kFree; - decoder_frames_at_client_--; // Take ownership of the EGL fence. - output_record.egl_fence = std::move(egl_fence); + if (egl_fence) + buffers_awaiting_fence_.emplace( + std::make_pair(std::move(egl_fence), std::move(buffer))); // We got a buffer back, so enqueue it back. Enqueue(); TRACE_COUNTER_ID2( "media,gpu", "V4L2 output buffers", this, "in client", - GetNumOfRecordsInState(kAtClient), "in vda", - output_buffer_map_.size() - GetNumOfRecordsInState(kAtClient)); + buffers_at_client_.size(), "in vda", + output_buffer_map_.size() - buffers_at_client_.size()); TRACE_COUNTER_ID2( "media,gpu", "V4L2 output buffers in vda", this, "free", - GetNumOfRecordsInState(kFree), "in device or IP", - GetNumOfRecordsInState(kAtDevice) + GetNumOfRecordsInState(kAtProcessor)); + output_queue_->FreeBuffersCount(), "in device or IP", + output_queue_->QueuedBuffersCount() + buffers_at_ip_.size()); } void V4L2VideoDecodeAccelerator::FlushTask() { @@ -1715,7 +1685,7 @@ DVLOGF(3) << "Some input buffers are not dequeued."; return; } - if (image_processor_bitstream_buffer_ids_.size() != 0) { + if (!buffers_at_ip_.empty()) { DVLOGF(3) << "Waiting for image processor to complete."; return; } @@ -1911,12 +1881,13 @@ decoder_current_bitstream_buffer_.reset(); current_input_buffer_ = V4L2WritableBufferRef(); decoder_decode_buffer_tasks_scheduled_ = 0; - decoder_frames_at_client_ = 0; while (!decoder_input_queue_.empty()) decoder_input_queue_.pop_front(); decoder_flushing_ = false; image_processor_ = nullptr; + while (!buffers_at_ip_.empty()) + buffers_at_ip_.pop(); DestroyInputBuffers(); DestroyOutputBuffers(); @@ -1987,16 +1958,6 @@ // Output stream is stopped. No need to wait for the buffer anymore. flush_awaiting_last_output_buffer_ = false; - for (size_t i = 0; i < output_buffer_map_.size(); ++i) { - // After streamoff, the device drops ownership of all buffers, even if we - // don't dequeue them explicitly. Some of them may still be owned by the - // client however. Reuse only those that aren't. - OutputRecord& output_record = output_buffer_map_[i]; - if (output_record.state == kAtDevice) { - output_record.state = kFree; - DCHECK(!output_record.egl_fence); - } - } return true; } @@ -2030,7 +1991,7 @@ decoder_state_ = kChangingResolution; SendPictureReady(); // Send all pending PictureReady. - if (!image_processor_bitstream_buffer_ids_.empty()) { + if (!buffers_at_ip_.empty()) { VLOGF(2) << "Wait image processor to finish before destroying buffers."; return; } @@ -2417,16 +2378,9 @@ if (!image_processor_->Reset()) return false; - for (size_t i = 0; i < output_buffer_map_.size(); ++i) { - OutputRecord& output_record = output_buffer_map_[i]; - if (output_record.state == kAtProcessor) { - DCHECK_EQ(buffers_at_client_.count(output_record.picture_id), 1u); - buffers_at_client_.erase(output_record.picture_id); - output_record.state = kFree; - } - } - while (!image_processor_bitstream_buffer_ids_.empty()) - image_processor_bitstream_buffer_ids_.pop(); + + while (!buffers_at_ip_.empty()) + buffers_at_ip_.pop(); return true; } @@ -2497,21 +2451,17 @@ } bool V4L2VideoDecodeAccelerator::ProcessFrame(int32_t bitstream_buffer_id, - int output_buffer_index) { + V4L2ReadableBufferRef buf) { DVLOGF(4); DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); - OutputRecord& output_record = output_buffer_map_[output_buffer_index]; - DCHECK_EQ(output_record.state, kAtDevice); - output_record.state = kAtProcessor; - image_processor_bitstream_buffer_ids_.push(bitstream_buffer_id); - auto layout = VideoFrameLayout::Create( V4L2Device::V4L2PixFmtToVideoPixelFormat(output_format_fourcc_), coded_size_); if (!layout) { return false; } + OutputRecord& output_record = output_buffer_map_[buf->BufferId()]; scoped_refptr<VideoFrame> input_frame = VideoFrame::WrapExternalDmabufs( *layout, gfx::Rect(visible_size_), visible_size_, DuplicateFDs(output_record.processor_input_fds), base::TimeDelta()); @@ -2527,14 +2477,18 @@ if (output_fds.empty()) return false; } + + // Keep reference to the IP input until the frame is processed + buffers_at_ip_.push(std::make_pair(bitstream_buffer_id, buf)); + // Unretained(this) is safe for FrameReadyCB because |decoder_thread_| is // owned by this V4L2VideoDecodeAccelerator and |this| must be valid when // FrameReadyCB is executed. image_processor_->Process( - input_frame, output_buffer_index, std::move(output_fds), + input_frame, buf->BufferId(), std::move(output_fds), base::BindOnce(&V4L2VideoDecodeAccelerator::FrameProcessed, base::Unretained(this), bitstream_buffer_id, - output_buffer_index)); + buf->BufferId())); return true; } @@ -2621,14 +2575,15 @@ egl_display_, output_record.egl_image)); } - output_record.egl_fence.reset(); - DVLOGF(3) << "dismissing PictureBuffer id=" << output_record.picture_id; child_task_runner_->PostTask( FROM_HERE, base::BindOnce(&Client::DismissPictureBuffer, client_, output_record.picture_id)); } + while (!buffers_awaiting_fence_.empty()) + buffers_awaiting_fence_.pop(); + // TODO(acourbot@) the client should properly drop all references to the // frames it holds instead! buffers_at_client_.clear(); @@ -2639,22 +2594,20 @@ } output_buffer_map_.clear(); - // The client may still hold some buffers. The texture holds a reference to - // the buffer. It is OK to free the buffer and destroy EGLImage here. - decoder_frames_at_client_ = 0; return success; } void V4L2VideoDecodeAccelerator::SendBufferToClient( size_t buffer_index, - int32_t bitstream_buffer_id) { + int32_t bitstream_buffer_id, + V4L2ReadableBufferRef vda_buffer) { DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); DCHECK_GE(bitstream_buffer_id, 0); OutputRecord& output_record = output_buffer_map_[buffer_index]; - output_record.state = kAtClient; - decoder_frames_at_client_++; + DCHECK_EQ(buffers_at_client_.count(output_record.picture_id), 0u); + buffers_at_client_.emplace(output_record.picture_id, std::move(vda_buffer)); // TODO(hubbe): Insert correct color space. http://crbug.com/647725 const Picture picture(output_record.picture_id, bitstream_buffer_id, gfx::Rect(visible_size_), gfx::ColorSpace(), false); @@ -2724,15 +2677,15 @@ DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); // TODO(crbug.com/921825): Remove this workaround once reset callback is // implemented. - if (image_processor_bitstream_buffer_ids_.empty() || - image_processor_bitstream_buffer_ids_.front() != bitstream_buffer_id || + if (buffers_at_ip_.empty() || + buffers_at_ip_.front().first != bitstream_buffer_id || output_buffer_map_.empty()) { // This can happen if image processor is reset. // V4L2VideoDecodeAccelerator::Reset() makes - // |image_processor_bitstream_buffer_ids| empty. + // |buffers_at_ip_| empty. // During ImageProcessor::Reset(), some FrameProcessed() can have been // posted to |decoder_thread|. |bitsream_buffer_id| is pushed to - // |image_processor_bitstream_buffer_ids_| in ProcessFrame(). Although we + // |buffers_at_ip_| in ProcessFrame(). Although we // are not sure a new bitstream buffer id is pushed after Reset() and before // FrameProcessed(), We should skip the case of mismatch of bitstream buffer // id for safety. @@ -2748,7 +2701,6 @@ OutputRecord& output_record = output_buffer_map_[output_buffer_index]; DVLOGF(4) << "picture_id=" << output_record.picture_id; - DCHECK_EQ(output_record.state, kAtProcessor); DCHECK_NE(output_record.picture_id, -1); // If the picture has not been cleared yet, this means it is the first time @@ -2768,10 +2720,14 @@ egl_image_size_, egl_image_format_fourcc_)); } - SendBufferToClient(output_buffer_index, bitstream_buffer_id); + // Remove our job from the IP jobs queue + DCHECK_GT(buffers_at_ip_.size(), 0u); + DCHECK(buffers_at_ip_.front().first == bitstream_buffer_id); + SendBufferToClient(output_buffer_index, bitstream_buffer_id, + std::move(buffers_at_ip_.front().second)); + buffers_at_ip_.pop(); // Flush or resolution change may be waiting image processor to finish. - image_processor_bitstream_buffer_ids_.pop(); - if (image_processor_bitstream_buffer_ids_.empty()) { + if (buffers_at_ip_.empty()) { NotifyFlushDoneIfNeeded(); if (decoder_state_ == kChangingResolution) StartResolutionChange(); @@ -2784,14 +2740,6 @@ NOTIFY_ERROR(PLATFORM_FAILURE); } -size_t V4L2VideoDecodeAccelerator::GetNumOfRecordsInState( - OutputRecordState state) const { - DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); - return std::count_if( - output_buffer_map_.begin(), output_buffer_map_.end(), - [state = state](const auto& r) { return r.state == state; }); -} - bool V4L2VideoDecodeAccelerator::OnMemoryDump( const base::trace_event::MemoryDumpArgs& args, base::trace_event::ProcessMemoryDump* pmd) {
diff --git a/media/gpu/v4l2/v4l2_video_decode_accelerator.h b/media/gpu/v4l2/v4l2_video_decode_accelerator.h index 0e2fe2d..ab740e5 100644 --- a/media/gpu/v4l2/v4l2_video_decode_accelerator.h +++ b/media/gpu/v4l2/v4l2_video_decode_accelerator.h
@@ -14,6 +14,8 @@ #include <list> #include <memory> +#include <queue> +#include <utility> #include <vector> #include "base/callback_forward.h" @@ -33,6 +35,7 @@ #include "media/video/video_decode_accelerator.h" #include "ui/gfx/geometry/size.h" #include "ui/gl/gl_bindings.h" +#include "ui/gl/gl_fence_egl.h" namespace gl { @@ -163,13 +166,6 @@ kDestroying, // Destroying state, when shutting down the decoder. }; - enum OutputRecordState { - kFree, // Ready to be queued to the device. - kAtDevice, // Held by device. - kAtProcessor, // Held by image processor. - kAtClient, // Held by client of V4L2VideoDecodeAccelerator. - }; - enum BufferId { kFlushBufferId = -2 // Buffer id for flush buffer, queued by FlushTask(). }; @@ -191,10 +187,7 @@ OutputRecord(); OutputRecord(OutputRecord&&); ~OutputRecord(); - OutputRecordState state; EGLImageKHR egl_image; // EGLImageKHR for the output buffer. - std::unique_ptr<gl::GLFenceEGL> egl_fence; // sync the compositor's use of - // the EGLImage. int32_t picture_id; // picture buffer id as returned to PictureReady(). GLuint texture_id; bool cleared; // Whether the texture is cleared and safe to render @@ -271,6 +264,9 @@ // DevicePollTask(). If |event_pending| is true, one or more events // on file descriptor are pending. void ServiceDeviceTask(bool event_pending); + + // Release buffers awaiting for their fence to be signaled. + void CheckGLFences(); // Handle the various device queues. void Enqueue(); void Dequeue(); @@ -396,13 +392,11 @@ bool CreateImageProcessor(); // Send a frame to the image processor to process. The index of decoder // output buffer is |output_buffer_index| and its id is |bitstream_buffer_id|. - bool ProcessFrame(int32_t bitstream_buffer_id, int output_buffer_index); + bool ProcessFrame(int32_t bitstream_buffer_id, V4L2ReadableBufferRef buf); - void SendBufferToClient(size_t buffer_index, int32_t bitstream_buffer_id); - - // Returns the number of OutputRecords whose state is |state|. This is used to - // compute values reported for chrome://tracing. - size_t GetNumOfRecordsInState(OutputRecordState state) const; + void SendBufferToClient(size_t buffer_index, + int32_t bitstream_buffer_id, + V4L2ReadableBufferRef vda_buffer); // // Methods run on child thread. @@ -476,8 +470,6 @@ // task execution should complete one buffer. If we fall behind (due to // resource backpressure, etc.), we'll have to schedule more to catch up. int decoder_decode_buffer_tasks_scheduled_; - // Picture buffers held by the client. - int decoder_frames_at_client_; // Are we flushing? bool decoder_flushing_; @@ -523,8 +515,14 @@ // Buffers that have been allocated but are awaiting an ImportBuffer // or AssignEGLImage event. std::map<int32_t, V4L2WritableBufferRef> output_wait_map_; + // Bitstream IDs and VDA buffers currently being processed by the IP. + std::queue<std::pair<int32_t, V4L2ReadableBufferRef>> buffers_at_ip_; // Keeps decoded buffers out of the free list until the client returns them. std::map<int32_t, V4L2ReadableBufferRef> buffers_at_client_; + // Queue of buffers that have been returned by the client, but which fence + // hasn't been signaled yet. + std::queue<std::pair<std::unique_ptr<gl::GLFenceEGL>, V4L2ReadableBufferRef>> + buffers_awaiting_fence_; // Mapping of int index to output buffer record. std::vector<OutputRecord> output_buffer_map_; @@ -586,11 +584,6 @@ // Number of planes for EGLImage. size_t egl_image_planes_count_; - // IDs of bitstream buffers sent to image processor to process. After a - // buffer is processed, it will sent to render if the id is in this - // queue. If the id is not in this queue, the buffer will be dropped. - base::queue<int> image_processor_bitstream_buffer_ids_; - // Input format V4L2 fourccs this class supports. static const uint32_t supported_input_fourccs_[];
diff --git a/media/gpu/windows/d3d11_h264_accelerator.cc b/media/gpu/windows/d3d11_h264_accelerator.cc index edbfb90..d189d22 100644 --- a/media/gpu/windows/d3d11_h264_accelerator.cc +++ b/media/gpu/windows/d3d11_h264_accelerator.cc
@@ -197,6 +197,134 @@ return true; } +void D3D11H264Accelerator::FillPicParamsWithConstants( + DXVA_PicParams_H264* pic) { + // From "DirectX Video Acceleration Specification for H.264/AVC Decoding": + // "The value shall be 1 unless the restricted-mode profile in use + // explicitly supports the value 0." + pic->MbsConsecutiveFlag = 1; + + // The latest DXVA decoding guide says to set this to 3 if the software + // decoder (this class) is following the guide. + pic->Reserved16Bits = 3; + + // |ContinuationFlag| indicates that we've filled in the remaining fields. + pic->ContinuationFlag = 1; + + // Must be zero unless bit 13 of ConfigDecoderSpecific is set. + pic->Reserved8BitsA = 0; + + // Unused, should always be zero. + pic->Reserved8BitsB = 0; + + // Should always be 1. + pic->StatusReportFeedbackNumber = 1; + + // UNUSED: slice_group_map_type (undocumented) + // UNUSED: slice_group_change_rate (undocumented) +} + +#define ARG_SEL(_1, _2, NAME, ...) NAME + +#define SPS_TO_PP1(a) pic_param->a = sps->a; +#define SPS_TO_PP2(a, b) pic_param->a = sps->b; +#define SPS_TO_PP(...) ARG_SEL(__VA_ARGS__, SPS_TO_PP2, SPS_TO_PP1)(__VA_ARGS__) +void D3D11H264Accelerator::PicParamsFromSPS(DXVA_PicParams_H264* pic_param, + const H264SPS* sps, + bool field_pic) { + // The H.264 specification now calls this |max_num_ref_frames|, while + // DXVA_PicParams_H264 continues to use the old name, |num_ref_frames|. + // See DirectX Video Acceleration for H.264/MPEG-4 AVC Decoding (4.2). + SPS_TO_PP(num_ref_frames, max_num_ref_frames); + SPS_TO_PP(wFrameWidthInMbsMinus1, pic_width_in_mbs_minus1); + SPS_TO_PP(wFrameHeightInMbsMinus1, pic_height_in_map_units_minus1); + SPS_TO_PP(residual_colour_transform_flag, separate_colour_plane_flag); + SPS_TO_PP(chroma_format_idc); + SPS_TO_PP(frame_mbs_only_flag); + SPS_TO_PP(bit_depth_luma_minus8); + SPS_TO_PP(bit_depth_chroma_minus8); + SPS_TO_PP(log2_max_frame_num_minus4); + SPS_TO_PP(pic_order_cnt_type); + SPS_TO_PP(log2_max_pic_order_cnt_lsb_minus4); + SPS_TO_PP(delta_pic_order_always_zero_flag); + SPS_TO_PP(direct_8x8_inference_flag); + + pic_param->MbaffFrameFlag = sps->mb_adaptive_frame_field_flag && field_pic; + pic_param->field_pic_flag = field_pic; + + pic_param->MinLumaBipredSize8x8Flag = sps->level_idc >= 31; +} +#undef SPS_TO_PP +#undef SPS_TO_PP2 +#undef SPS_TO_PP1 + +#define PPS_TO_PP1(a) pic_param->a = pps->a; +#define PPS_TO_PP2(a, b) pic_param->a = pps->b; +#define PPS_TO_PP(...) ARG_SEL(__VA_ARGS__, PPS_TO_PP2, PPS_TO_PP1)(__VA_ARGS__) +bool D3D11H264Accelerator::PicParamsFromPPS(DXVA_PicParams_H264* pic_param, + const H264PPS* pps) { + PPS_TO_PP(constrained_intra_pred_flag); + PPS_TO_PP(weighted_pred_flag); + PPS_TO_PP(weighted_bipred_idc); + + PPS_TO_PP(transform_8x8_mode_flag); + PPS_TO_PP(pic_init_qs_minus26); + PPS_TO_PP(chroma_qp_index_offset); + PPS_TO_PP(second_chroma_qp_index_offset); + PPS_TO_PP(pic_init_qp_minus26); + PPS_TO_PP(num_ref_idx_l0_active_minus1, num_ref_idx_l0_default_active_minus1); + PPS_TO_PP(num_ref_idx_l1_active_minus1, num_ref_idx_l1_default_active_minus1); + PPS_TO_PP(entropy_coding_mode_flag); + PPS_TO_PP(pic_order_present_flag, + bottom_field_pic_order_in_frame_present_flag); + PPS_TO_PP(deblocking_filter_control_present_flag); + PPS_TO_PP(redundant_pic_cnt_present_flag); + + PPS_TO_PP(num_slice_groups_minus1); + if (pic_param->num_slice_groups_minus1) { + // TODO(liberato): UMA? + // TODO(liberato): media log? + LOG(ERROR) << "num_slice_groups_minus1 == " + << pic_param->num_slice_groups_minus1; + return false; + } + return true; +} +#undef PPS_TO_PP +#undef PPS_TO_PP2 +#undef PPS_TO_PP1 + +#undef ARG_SEL + +void D3D11H264Accelerator::PicParamsFromSliceHeader( + DXVA_PicParams_H264* pic_param, + const H264SliceHeader* slice_hdr) { + pic_param->sp_for_switch_flag = slice_hdr->sp_for_switch_flag; + pic_param->field_pic_flag = slice_hdr->field_pic_flag; + pic_param->CurrPic.AssociatedFlag = slice_hdr->bottom_field_flag; + pic_param->IntraPicFlag = slice_hdr->IsISlice(); +} + +void D3D11H264Accelerator::PicParamsFromPic( + DXVA_PicParams_H264* pic_param, + const scoped_refptr<H264Picture>& pic) { + pic_param->CurrPic.Index7Bits = + static_cast<D3D11H264Picture*>(pic.get())->level_; + pic_param->RefPicFlag = pic->ref; + pic_param->frame_num = pic->frame_num; + + if (pic_param->field_pic_flag && pic_param->CurrPic.AssociatedFlag) { + pic_param->CurrFieldOrderCnt[1] = pic->bottom_field_order_cnt; + pic_param->CurrFieldOrderCnt[0] = 0; + } else if (pic_param->field_pic_flag && !pic_param->CurrPic.AssociatedFlag) { + pic_param->CurrFieldOrderCnt[0] = pic->top_field_order_cnt; + pic_param->CurrFieldOrderCnt[1] = 0; + } else { + pic_param->CurrFieldOrderCnt[0] = pic->top_field_order_cnt; + pic_param->CurrFieldOrderCnt[1] = pic->bottom_field_order_cnt; + } +} + Status D3D11H264Accelerator::SubmitSlice( const H264PPS* pps, const H264SliceHeader* slice_hdr, @@ -209,98 +337,24 @@ scoped_refptr<D3D11H264Picture> our_pic( static_cast<D3D11H264Picture*>(pic.get())); DXVA_PicParams_H264 pic_param = {}; -#define FROM_SPS_TO_PP(a) pic_param.a = sps_.a -#define FROM_SPS_TO_PP2(a, b) pic_param.a = sps_.b -#define FROM_PPS_TO_PP(a) pic_param.a = pps->a -#define FROM_PPS_TO_PP2(a, b) pic_param.a = pps->b -#define FROM_SLICE_TO_PP(a) pic_param.a = slice_hdr->a -#define FROM_SLICE_TO_PP2(a, b) pic_param.a = slice_hdr->b - FROM_SPS_TO_PP2(wFrameWidthInMbsMinus1, pic_width_in_mbs_minus1); - FROM_SPS_TO_PP2(wFrameHeightInMbsMinus1, pic_height_in_map_units_minus1); - pic_param.CurrPic.Index7Bits = our_pic->level_; - pic_param.CurrPic.AssociatedFlag = slice_hdr->bottom_field_flag; - // The H.264 specification now calls this |max_num_ref_frames|, while - // DXVA_PicParams_H264 continues to use the old name, |num_ref_frames|. - // See DirectX Video Acceleration for H.264/MPEG-4 AVC Decoding (4.2). - FROM_SPS_TO_PP2(num_ref_frames, max_num_ref_frames); + FillPicParamsWithConstants(&pic_param); - FROM_SLICE_TO_PP(field_pic_flag); - pic_param.MbaffFrameFlag = - sps_.mb_adaptive_frame_field_flag && pic_param.field_pic_flag; - FROM_SPS_TO_PP2(residual_colour_transform_flag, separate_colour_plane_flag); - FROM_SLICE_TO_PP(sp_for_switch_flag); - FROM_SPS_TO_PP(chroma_format_idc); - pic_param.RefPicFlag = pic->ref; - FROM_PPS_TO_PP(constrained_intra_pred_flag); - FROM_PPS_TO_PP(weighted_pred_flag); - FROM_PPS_TO_PP(weighted_bipred_idc); - // From "DirectX Video Acceleration Specification for H.264/AVC Decoding": - // "The value shall be 1 unless the restricted-mode profile in use explicitly - // supports the value 0." - pic_param.MbsConsecutiveFlag = 1; - FROM_SPS_TO_PP(frame_mbs_only_flag); - FROM_PPS_TO_PP(transform_8x8_mode_flag); - pic_param.MinLumaBipredSize8x8Flag = sps_.level_idc >= 31; - pic_param.IntraPicFlag = slice_hdr->IsISlice(); - FROM_SPS_TO_PP(bit_depth_luma_minus8); - FROM_SPS_TO_PP(bit_depth_chroma_minus8); - // The latest DXVA decoding guide says to set this to 3 if the software - // decoder (this class) is following the guide. - pic_param.Reserved16Bits = 3; + PicParamsFromSPS(&pic_param, &sps_, slice_hdr->field_pic_flag); + if (!PicParamsFromPPS(&pic_param, pps)) + return Status::kFail; + PicParamsFromSliceHeader(&pic_param, slice_hdr); + PicParamsFromPic(&pic_param, pic); + memcpy(pic_param.RefFrameList, ref_frame_list_, sizeof pic_param.RefFrameList); - if (pic_param.field_pic_flag && pic_param.CurrPic.AssociatedFlag) { - pic_param.CurrFieldOrderCnt[1] = pic->bottom_field_order_cnt; - pic_param.CurrFieldOrderCnt[0] = 0; - } else if (pic_param.field_pic_flag && !pic_param.CurrPic.AssociatedFlag) { - pic_param.CurrFieldOrderCnt[0] = pic->top_field_order_cnt; - pic_param.CurrFieldOrderCnt[1] = 0; - } else { - pic_param.CurrFieldOrderCnt[0] = pic->top_field_order_cnt; - pic_param.CurrFieldOrderCnt[1] = pic->bottom_field_order_cnt; - } + memcpy(pic_param.FieldOrderCntList, field_order_cnt_list_, sizeof pic_param.FieldOrderCntList); - FROM_PPS_TO_PP(pic_init_qs_minus26); - FROM_PPS_TO_PP(chroma_qp_index_offset); - FROM_PPS_TO_PP(second_chroma_qp_index_offset); - // |ContinuationFlag| indicates that we've filled in the remaining fields. - pic_param.ContinuationFlag = 1; - FROM_PPS_TO_PP(pic_init_qp_minus26); - FROM_PPS_TO_PP2(num_ref_idx_l0_active_minus1, - num_ref_idx_l0_default_active_minus1); - FROM_PPS_TO_PP2(num_ref_idx_l1_active_minus1, - num_ref_idx_l1_default_active_minus1); - // UNUSED: Reserved8BitsA. Must be zero unless bit 13 of - // ConfigDecoderSpecific is set. + memcpy(pic_param.FrameNumList, frame_num_list_, sizeof pic_param.FrameNumList); pic_param.UsedForReferenceFlags = used_for_reference_flags_; pic_param.NonExistingFrameFlags = non_existing_frame_flags_; - pic_param.frame_num = pic->frame_num; - FROM_SPS_TO_PP(log2_max_frame_num_minus4); - FROM_SPS_TO_PP(pic_order_cnt_type); - FROM_SPS_TO_PP(log2_max_pic_order_cnt_lsb_minus4); - FROM_SPS_TO_PP(delta_pic_order_always_zero_flag); - FROM_SPS_TO_PP(direct_8x8_inference_flag); - FROM_PPS_TO_PP(entropy_coding_mode_flag); - FROM_PPS_TO_PP2(pic_order_present_flag, - bottom_field_pic_order_in_frame_present_flag); - FROM_PPS_TO_PP(num_slice_groups_minus1); - if (pic_param.num_slice_groups_minus1) { - // TODO(liberato): UMA? - // TODO(liberato): media log? - LOG(ERROR) << "num_slice_groups_minus1 == " - << pic_param.num_slice_groups_minus1; - return Status::kFail; - } - // UNUSED: slice_group_map_type (undocumented) - FROM_PPS_TO_PP(deblocking_filter_control_present_flag); - FROM_PPS_TO_PP(redundant_pic_cnt_present_flag); - // UNUSED: Reserved8BitsB (unused, should always be zero). - // UNUSED: slice_group_change_rate (undocumented) - - pic_param.StatusReportFeedbackNumber = 1; UINT buffer_size; void* buffer;
diff --git a/media/gpu/windows/d3d11_h264_accelerator.h b/media/gpu/windows/d3d11_h264_accelerator.h index ec9d9ffa..653b2bb 100644 --- a/media/gpu/windows/d3d11_h264_accelerator.h +++ b/media/gpu/windows/d3d11_h264_accelerator.h
@@ -62,6 +62,24 @@ void Reset() override; bool OutputPicture(const scoped_refptr<H264Picture>& pic) override; + // Gets a pic params struct with the constant fields set. + void FillPicParamsWithConstants(DXVA_PicParams_H264* pic_param); + + // Populate the pic params with fields from the SPS structure. + void PicParamsFromSPS(DXVA_PicParams_H264* pic_param, + const H264SPS* sps, + bool field_pic); + + // Populate the pic params with fields from the PPS structure. + bool PicParamsFromPPS(DXVA_PicParams_H264* pic_param, const H264PPS* pps); + + // Populate the pic params with fields from the slice header structure. + void PicParamsFromSliceHeader(DXVA_PicParams_H264* pic_param, + const H264SliceHeader* pps); + + void PicParamsFromPic(DXVA_PicParams_H264* pic_param, + const scoped_refptr<H264Picture>& pic); + private: bool SubmitSliceData(); bool RetrieveBitstreamBuffer();
diff --git a/media/renderers/paint_canvas_video_renderer.cc b/media/renderers/paint_canvas_video_renderer.cc index a38177c..83049132 100644 --- a/media/renderers/paint_canvas_video_renderer.cc +++ b/media/renderers/paint_canvas_video_renderer.cc
@@ -218,7 +218,7 @@ gl->BindTexture(GL_TEXTURE_2D, source_texture); PaintCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( gl, video_frame, GL_TEXTURE_2D, source_texture, GL_RGBA, GL_RGBA, - GL_UNSIGNED_BYTE, 0, true, false); + GL_UNSIGNED_BYTE, 0, false, false); } else { gl->WaitSyncTokenCHROMIUM(mailbox_holder.sync_token.GetConstData()); source_texture =
diff --git a/media/renderers/video_resource_updater.cc b/media/renderers/video_resource_updater.cc index 7057554..563a35c 100644 --- a/media/renderers/video_resource_updater.cc +++ b/media/renderers/video_resource_updater.cc
@@ -73,11 +73,10 @@ return VideoFrameResourceType::STREAM_TEXTURE; FALLTHROUGH; case GL_TEXTURE_2D: + case GL_TEXTURE_RECTANGLE_ARB: return (format == PIXEL_FORMAT_XRGB) ? VideoFrameResourceType::RGB : VideoFrameResourceType::RGBA_PREMULTIPLIED; - case GL_TEXTURE_RECTANGLE_ARB: - return VideoFrameResourceType::RGB; default: NOTREACHED(); break;
diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc index a8e58c7..985c6fc 100644 --- a/media/test/pipeline_integration_test.cc +++ b/media/test/pipeline_integration_test.cc
@@ -2178,7 +2178,7 @@ Play(); ASSERT_TRUE(WaitUntilOnEnded()); -}; +} TEST_P(MSEPipelineIntegrationTest, ConfigChange_MP4) { TestMediaSource source("bear-640x360-av_frag.mp4", kAppendWholeFile);
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc index a71c6cb..1215589 100644 --- a/net/http/http_network_session.cc +++ b/net/http/http_network_session.cc
@@ -138,7 +138,6 @@ quic_race_stale_dns_on_connection(false), quic_go_away_on_path_degrading(false), quic_disable_bidirectional_streams(false), - quic_force_hol_blocking(false), quic_race_cert_verification(false), quic_estimate_initial_rtt(false), quic_headers_include_h2_stream_dependency(false), @@ -402,7 +401,6 @@ dict->SetBoolean("go_away_on_path_degrading", params_.quic_go_away_on_path_degrading); dict->SetBoolean("estimate_initial_rtt", params_.quic_estimate_initial_rtt); - dict->SetBoolean("force_hol_blocking", params_.quic_force_hol_blocking); dict->SetBoolean("server_push_cancellation", params_.enable_server_push_cancellation);
diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h index 5ba0df179..6345b86 100644 --- a/net/http/http_network_session.h +++ b/net/http/http_network_session.h
@@ -215,8 +215,6 @@ bool quic_go_away_on_path_degrading; // If true, bidirectional streams over QUIC will be disabled. bool quic_disable_bidirectional_streams; - // If true, enable force HOL blocking. For measurement purposes. - bool quic_force_hol_blocking; // If true, race cert verification with host resolution. bool quic_race_cert_verification; // If true, estimate the initial RTT for QUIC connections based on network.
diff --git a/net/proxy_resolution/pac_file_decider.cc b/net/proxy_resolution/pac_file_decider.cc index 15ef2c8..88fd027 100644 --- a/net/proxy_resolution/pac_file_decider.cc +++ b/net/proxy_resolution/pac_file_decider.cc
@@ -266,7 +266,6 @@ return OK; } - quick_check_start_time_ = base::Time::Now(); std::string host = current_pac_source().url.host(); HostResolver::ResolveHostParameters parameters; @@ -295,11 +294,6 @@ int PacFileDecider::DoQuickCheckComplete(int result) { DCHECK(quick_check_enabled_); - base::TimeDelta delta = base::Time::Now() - quick_check_start_time_; - if (result == OK) - UMA_HISTOGRAM_TIMES("Net.WpadQuickCheckSuccess", delta); - else - UMA_HISTOGRAM_TIMES("Net.WpadQuickCheckFailure", delta); resolve_request_.reset(); quick_check_timer_.Stop(); if (result != OK)
diff --git a/net/proxy_resolution/pac_file_decider.h b/net/proxy_resolution/pac_file_decider.h index e1f038d..fe4fbe1b 100644 --- a/net/proxy_resolution/pac_file_decider.h +++ b/net/proxy_resolution/pac_file_decider.h
@@ -202,7 +202,6 @@ std::unique_ptr<HostResolver::ResolveHostRequest> resolve_request_; base::OneShotTimer quick_check_timer_; - base::Time quick_check_start_time_; DISALLOW_COPY_AND_ASSIGN(PacFileDecider); };
diff --git a/printing/BUILD.gn b/printing/BUILD.gn index 119a5539..60fdbaf 100644 --- a/printing/BUILD.gn +++ b/printing/BUILD.gn
@@ -134,6 +134,10 @@ ] } + if (is_android) { + deps += [ "//ui/android" ] + } + if (use_cups) { configs += [ ":cups" ] @@ -345,6 +349,7 @@ android_library("printing_java") { deps = [ "//base:base_java", + "//ui/android:ui_java", ] java_files = [ "android/java/src/org/chromium/printing/PrintDocumentAdapterWrapper.java",
diff --git a/printing/DEPS b/printing/DEPS index 8cfa7a2..fb7ac6ec 100644 --- a/printing/DEPS +++ b/printing/DEPS
@@ -5,6 +5,7 @@ "+third_party/icu/source/common/unicode", "+third_party/icu/source/i18n/unicode", "+third_party/skia", + "+ui/android", "+ui/aura", "+ui/base/resource", "+ui/base/text",
diff --git a/printing/android/java/src/org/chromium/printing/PrintingContext.java b/printing/android/java/src/org/chromium/printing/PrintingContext.java index 2cd855c..6924e36b 100644 --- a/printing/android/java/src/org/chromium/printing/PrintingContext.java +++ b/printing/android/java/src/org/chromium/printing/PrintingContext.java
@@ -4,10 +4,13 @@ package org.chromium.printing; +import android.app.Activity; + import org.chromium.base.Log; import org.chromium.base.ThreadUtils; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; +import org.chromium.ui.base.WindowAndroid; /** * This class is responsible for communicating with its native counterpart through JNI to handle @@ -82,6 +85,17 @@ } @CalledByNative + private static void setPendingPrint( + WindowAndroid window, Printable printable, int renderProcessId, int renderFrameId) { + PrintingController printingController = PrintingControllerImpl.getInstance(); + Activity activity = window.getActivity().get(); + if (printingController == null || activity == null) return; + + printingController.setPendingPrint( + printable, new PrintManagerDelegateImpl(activity), renderProcessId, renderFrameId); + } + + @CalledByNative public int[] getPages() { ThreadUtils.assertOnUiThread(); return mController.getPageNumbers();
diff --git a/printing/printing_context_android.cc b/printing/printing_context_android.cc index 33d760d..a381582 100644 --- a/printing/printing_context_android.cc +++ b/printing/printing_context_android.cc
@@ -21,6 +21,7 @@ #include "printing/print_job_constants.h" #include "printing/units.h" #include "third_party/icu/source/i18n/unicode/ulocdata.h" +#include "ui/android/window_android.h" using base::android::JavaParamRef; using base::android::JavaRef; @@ -69,6 +70,17 @@ Java_PrintingContext_pdfWritingDone(env, page_count); } +// static +void PrintingContextAndroid::SetPendingPrint( + ui::WindowAndroid* window, + const ScopedJavaLocalRef<jobject>& printable, + int render_process_id, + int render_frame_id) { + JNIEnv* env = base::android::AttachCurrentThread(); + Java_PrintingContext_setPendingPrint(env, window->GetJavaObject(), printable, + render_process_id, render_frame_id); +} + PrintingContextAndroid::PrintingContextAndroid(Delegate* delegate) : PrintingContext(delegate) { // The constructor is run in the IO thread.
diff --git a/printing/printing_context_android.h b/printing/printing_context_android.h index 3471e45..46f9926 100644 --- a/printing/printing_context_android.h +++ b/printing/printing_context_android.h
@@ -12,6 +12,10 @@ #include "base/macros.h" #include "printing/printing_context.h" +namespace ui { +class WindowAndroid; +} + namespace printing { class MetafilePlayer; @@ -29,6 +33,12 @@ // failure. static void PdfWritingDone(int page_count); + static void SetPendingPrint( + ui::WindowAndroid* window, + const base::android::ScopedJavaLocalRef<jobject>& printable, + int render_process_id, + int render_frame_id); + // Called from Java, when printing settings from the user are ready or the // printing operation is canceled. void AskUserForSettingsReply(JNIEnv* env,
diff --git a/services/identity/public/cpp/identity_manager.cc b/services/identity/public/cpp/identity_manager.cc index 5a630ee..14090bb 100644 --- a/services/identity/public/cpp/identity_manager.cc +++ b/services/identity/public/cpp/identity_manager.cc
@@ -287,6 +287,13 @@ } #endif +#if defined(OS_ANDROID) || defined(OS_IOS) +void IdentityManager::LegacyReloadAccountsFromSystem() { + token_service_->GetDelegate()->ReloadAccountsFromSystem( + GetPrimaryAccountId()); +} +#endif + void IdentityManager::AddObserver(Observer* observer) { observer_list_.AddObserver(observer); }
diff --git a/services/identity/public/cpp/identity_manager.h b/services/identity/public/cpp/identity_manager.h index 1a6eecd..50b2434 100644 --- a/services/identity/public/cpp/identity_manager.h +++ b/services/identity/public/cpp/identity_manager.h
@@ -394,6 +394,15 @@ void ForceTriggerOnCookieChange(); #endif +#if defined(OS_ANDROID) || defined(OS_IOS) + // Reloads the accounts in the token service from the system accounts. This + // API calls OAuth2TokenServiceDelegate::ReloadAccountsFromSystem and it + // triggers platform specific implementation for Android and IOS. + // NOTE: In normal usage, this method SHOULD NOT be called. + // TODO(https://crbug.com/930094): Eliminate the need to expose this. + void LegacyReloadAccountsFromSystem(); +#endif + // Methods to register or remove observers. void AddObserver(Observer* observer); void RemoveObserver(Observer* observer);
diff --git a/services/media_session/media_controller.cc b/services/media_session/media_controller.cc index 19afe2c..01989a88 100644 --- a/services/media_session/media_controller.cc +++ b/services/media_session/media_controller.cc
@@ -92,6 +92,12 @@ session_actions_ = actions; } +void MediaController::MediaSessionImagesChanged( + const base::flat_map<mojom::MediaSessionImageType, std::vector<MediaImage>>& + images) { + // TODO(beccahughes): Implement this +} + void MediaController::PreviousTrack() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/services/media_session/media_controller.h b/services/media_session/media_controller.h index 7cb0b0e..f25a35f 100644 --- a/services/media_session/media_controller.h +++ b/services/media_session/media_controller.h
@@ -45,6 +45,9 @@ const base::Optional<MediaMetadata>&) override; void MediaSessionActionsChanged( const std::vector<mojom::MediaSessionAction>& action) override; + void MediaSessionImagesChanged( + const base::flat_map<mojom::MediaSessionImageType, + std::vector<MediaImage>>& images) override; // Sets the media session that the controller should be bound to. If the // session is already bound to the same session then we will return false.
diff --git a/services/media_session/public/cpp/test/mock_media_session.cc b/services/media_session/public/cpp/test/mock_media_session.cc index 2e19ae44..0af84d05 100644 --- a/services/media_session/public/cpp/test/mock_media_session.cc +++ b/services/media_session/public/cpp/test/mock_media_session.cc
@@ -61,6 +61,23 @@ } } +void MockMediaSessionMojoObserver::MediaSessionImagesChanged( + const base::flat_map<mojom::MediaSessionImageType, std::vector<MediaImage>>& + images) { + session_images_ = images; + + if (expected_images_of_type_.has_value()) { + auto type = expected_images_of_type_->first; + auto images = expected_images_of_type_->second; + auto it = session_images_->find(type); + + if (it != session_images_->end() && it->second == images) { + run_loop_->Quit(); + expected_images_of_type_.reset(); + } + } +} + void MockMediaSessionMojoObserver::WaitForState( mojom::MediaSessionInfo::SessionState wanted_state) { if (session_info_ && session_info_->state == wanted_state) @@ -117,6 +134,19 @@ StartWaiting(); } +void MockMediaSessionMojoObserver::WaitForExpectedImagesOfType( + mojom::MediaSessionImageType type, + const std::vector<MediaImage>& images) { + if (session_images_.has_value()) { + auto it = session_images_->find(type); + if (it != session_images_->end() && it->second == images) + return; + } + + expected_images_of_type_ = std::make_pair(type, images); + StartWaiting(); +} + void MockMediaSessionMojoObserver::StartWaiting() { DCHECK(!run_loop_);
diff --git a/services/media_session/public/cpp/test/mock_media_session.h b/services/media_session/public/cpp/test/mock_media_session.h index dfbac53..99d46e74 100644 --- a/services/media_session/public/cpp/test/mock_media_session.h +++ b/services/media_session/public/cpp/test/mock_media_session.h
@@ -5,7 +5,11 @@ #ifndef SERVICES_MEDIA_SESSION_PUBLIC_CPP_TEST_MOCK_MEDIA_SESSION_H_ #define SERVICES_MEDIA_SESSION_PUBLIC_CPP_TEST_MOCK_MEDIA_SESSION_H_ +#include <utility> +#include <vector> + #include "base/component_export.h" +#include "base/containers/flat_map.h" #include "base/optional.h" #include "base/run_loop.h" #include "mojo/public/cpp/bindings/binding.h" @@ -37,6 +41,9 @@ const base::Optional<MediaMetadata>& metadata) override; void MediaSessionActionsChanged( const std::vector<mojom::MediaSessionAction>& actions) override; + void MediaSessionImagesChanged( + const base::flat_map<mojom::MediaSessionImageType, + std::vector<MediaImage>>& images) override; void WaitForState(mojom::MediaSessionInfo::SessionState wanted_state); void WaitForPlaybackState(mojom::MediaPlaybackState wanted_state); @@ -49,6 +56,9 @@ void WaitForExpectedActions( const std::set<mojom::MediaSessionAction>& actions); + void WaitForExpectedImagesOfType(mojom::MediaSessionImageType type, + const std::vector<MediaImage>& images); + const mojom::MediaSessionInfoPtr& session_info() const { return session_info_; } @@ -68,10 +78,16 @@ mojom::MediaSessionInfoPtr session_info_; base::Optional<base::Optional<MediaMetadata>> session_metadata_; base::Optional<std::set<mojom::MediaSessionAction>> session_actions_; + base::Optional< + base::flat_map<mojom::MediaSessionImageType, std::vector<MediaImage>>> + session_images_; base::Optional<MediaMetadata> expected_metadata_; base::Optional<std::set<mojom::MediaSessionAction>> expected_actions_; base::Optional<bool> expected_controllable_; + base::Optional< + std::pair<mojom::MediaSessionImageType, std::vector<MediaImage>>> + expected_images_of_type_; bool waiting_for_empty_metadata_ = false; base::Optional<mojom::MediaSessionInfo::SessionState> wanted_state_;
diff --git a/services/media_session/public/mojom/media_session.mojom b/services/media_session/public/mojom/media_session.mojom index 148bcfa..f854209 100644 --- a/services/media_session/public/mojom/media_session.mojom +++ b/services/media_session/public/mojom/media_session.mojom
@@ -29,6 +29,12 @@ kStop, }; +[Extensible] +enum MediaSessionImageType { + // The artwork associated with the media session (e.g album art) + kArtwork, +}; + // Album art in MediaMetadata // Spec: https://wicg.github.io/mediasession/ struct MediaImage { @@ -43,6 +49,8 @@ mojo_base.mojom.String16 title; mojo_base.mojom.String16 artist; mojo_base.mojom.String16 album; + + // TODO(beccahughes): Remove this array<MediaImage> artwork; // The |source_title| is a human readable title for the source of the media @@ -101,7 +109,7 @@ }; // The observer for observing media session events. -// Next Method ID: 1 +// Next Method ID: 4 interface MediaSessionObserver { // Call when the info associated with the session changed. MediaSessionInfoChanged@0(MediaSessionInfo info); @@ -114,6 +122,10 @@ // Called when the media session action list has changed. This tells the // observer which actions can be used to control the session. MediaSessionActionsChanged@2(array<MediaSessionAction> action); + + // Called when the images associated with a media session change. + MediaSessionImagesChanged@3( + map<MediaSessionImageType, array<MediaImage>> images); }; // A MediaSession manages the media session and audio focus for a given
diff --git a/services/video_capture/device_media_to_mojo_adapter.cc b/services/video_capture/device_media_to_mojo_adapter.cc index c0beb8aa..e4069c8 100644 --- a/services/video_capture/device_media_to_mojo_adapter.cc +++ b/services/video_capture/device_media_to_mojo_adapter.cc
@@ -103,19 +103,6 @@ device_started_ = true; } -void DeviceMediaToMojoAdapter::OnReceiverReportingUtilization( - int32_t frame_feedback_id, - double utilization) { - DCHECK(thread_checker_.CalledOnValidThread()); - device_->OnUtilizationReport(frame_feedback_id, utilization); -} - -void DeviceMediaToMojoAdapter::RequestRefreshFrame() { - if (!device_started_) - return; - device_->RequestRefreshFrame(); -} - void DeviceMediaToMojoAdapter::MaybeSuspend() { if (!device_started_) return;
diff --git a/services/video_capture/device_media_to_mojo_adapter.h b/services/video_capture/device_media_to_mojo_adapter.h index 595de58..09a69def 100644 --- a/services/video_capture/device_media_to_mojo_adapter.h +++ b/services/video_capture/device_media_to_mojo_adapter.h
@@ -32,9 +32,6 @@ // mojom::Device implementation. void Start(const media::VideoCaptureParams& requested_settings, mojom::ReceiverPtr receiver) override; - void OnReceiverReportingUtilization(int32_t frame_feedback_id, - double utilization) override; - void RequestRefreshFrame() override; void MaybeSuspend() override; void Resume() override; void GetPhotoState(GetPhotoStateCallback callback) override;
diff --git a/services/video_capture/public/cpp/BUILD.gn b/services/video_capture/public/cpp/BUILD.gn index 68f40ca..5388362 100644 --- a/services/video_capture/public/cpp/BUILD.gn +++ b/services/video_capture/public/cpp/BUILD.gn
@@ -4,8 +4,6 @@ source_set("cpp") { sources = [ - "device_to_feedback_observer_adapter.cc", - "device_to_feedback_observer_adapter.h", "receiver_media_to_mojo_adapter.cc", "receiver_media_to_mojo_adapter.h", ]
diff --git a/services/video_capture/public/cpp/device_to_feedback_observer_adapter.cc b/services/video_capture/public/cpp/device_to_feedback_observer_adapter.cc deleted file mode 100644 index ad842a7..0000000 --- a/services/video_capture/public/cpp/device_to_feedback_observer_adapter.cc +++ /dev/null
@@ -1,20 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "services/video_capture/public/cpp/device_to_feedback_observer_adapter.h" - -namespace video_capture { - -DeviceToFeedbackObserverAdapter::DeviceToFeedbackObserverAdapter( - mojom::DevicePtr device) - : device_(std::move(device)) {} - -DeviceToFeedbackObserverAdapter::~DeviceToFeedbackObserverAdapter() = default; - -void DeviceToFeedbackObserverAdapter::OnUtilizationReport(int frame_feedback_id, - double utilization) { - device_->OnReceiverReportingUtilization(frame_feedback_id, utilization); -} - -} // namespace video_capture
diff --git a/services/video_capture/public/cpp/device_to_feedback_observer_adapter.h b/services/video_capture/public/cpp/device_to_feedback_observer_adapter.h deleted file mode 100644 index 88793a8..0000000 --- a/services/video_capture/public/cpp/device_to_feedback_observer_adapter.h +++ /dev/null
@@ -1,30 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SERVICES_VIDEO_CAPTURE_PUBLIC_CPP_DEVICE_TO_FEEDBACK_OBSERVER_ADAPTER_H_ -#define SERVICES_VIDEO_CAPTURE_PUBLIC_CPP_DEVICE_TO_FEEDBACK_OBSERVER_ADAPTER_H_ - -#include "media/capture/video/video_capture_device.h" -#include "services/video_capture/public/mojom/device.mojom.h" - -namespace video_capture { - -// Adapter that allows a video_capture::mojom::Device to be used in place of -// a media::VideoFrameConsumerFeedbackObserver -class DeviceToFeedbackObserverAdapter - : public media::VideoFrameConsumerFeedbackObserver { - public: - DeviceToFeedbackObserverAdapter(mojom::DevicePtr device); - ~DeviceToFeedbackObserverAdapter() override; - - // media::VideoFrameConsumerFeedbackObserver: - void OnUtilizationReport(int frame_feedback_id, double utilization) override; - - private: - mojom::DevicePtr device_; -}; - -} // namespace video_capture - -#endif // SERVICES_VIDEO_CAPTURE_PUBLIC_CPP_DEVICE_TO_FEEDBACK_OBSERVER_ADAPTER_H_
diff --git a/services/video_capture/public/mojom/device.mojom b/services/video_capture/public/mojom/device.mojom index 564e1f5..82f3d7c 100644 --- a/services/video_capture/public/mojom/device.mojom +++ b/services/video_capture/public/mojom/device.mojom
@@ -17,9 +17,6 @@ // that all events related to stopping device have been sent out. interface Device { Start(media.mojom.VideoCaptureParams requested_settings, Receiver receiver); - OnReceiverReportingUtilization(int32 frame_feedback_id, - double utilization); - RequestRefreshFrame(); MaybeSuspend(); Resume(); GetPhotoState()
diff --git a/services/video_capture/shared_memory_virtual_device_mojo_adapter.cc b/services/video_capture/shared_memory_virtual_device_mojo_adapter.cc index 3aa3b04..91d5e2a 100644 --- a/services/video_capture/shared_memory_virtual_device_mojo_adapter.cc +++ b/services/video_capture/shared_memory_virtual_device_mojo_adapter.cc
@@ -169,16 +169,6 @@ } } -void SharedMemoryVirtualDeviceMojoAdapter::OnReceiverReportingUtilization( - int32_t frame_feedback_id, - double utilization) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); -} - -void SharedMemoryVirtualDeviceMojoAdapter::RequestRefreshFrame() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); -} - void SharedMemoryVirtualDeviceMojoAdapter::MaybeSuspend() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); }
diff --git a/services/video_capture/shared_memory_virtual_device_mojo_adapter.h b/services/video_capture/shared_memory_virtual_device_mojo_adapter.h index 208179d..b1a2483 100644 --- a/services/video_capture/shared_memory_virtual_device_mojo_adapter.h +++ b/services/video_capture/shared_memory_virtual_device_mojo_adapter.h
@@ -38,9 +38,6 @@ // mojom::Device implementation. void Start(const media::VideoCaptureParams& requested_settings, mojom::ReceiverPtr receiver) override; - void OnReceiverReportingUtilization(int32_t frame_feedback_id, - double utilization) override; - void RequestRefreshFrame() override; void MaybeSuspend() override; void Resume() override; void GetPhotoState(GetPhotoStateCallback callback) override;
diff --git a/services/video_capture/test/mock_device_unittest.cc b/services/video_capture/test/mock_device_unittest.cc index d59a4e6..ba32804d 100644 --- a/services/video_capture/test/mock_device_unittest.cc +++ b/services/video_capture/test/mock_device_unittest.cc
@@ -59,43 +59,4 @@ } } -// Tests that a utilization reported to a video_capture.mojom.Device via -// OnReceiverReportingUtilization() arrives at the corresponding -// media::VideoCaptureDevice. -TEST_F(MockVideoCaptureDeviceTest, ReceiverUtilizationIsForwardedToDevice) { - base::RunLoop run_loop; - const media::VideoCaptureFormat stub_frame_format(gfx::Size(320, 200), 25.0f, - media::PIXEL_FORMAT_I420); - const int arbitrary_rotation = 0; - const int arbitrary_frame_feedback_id = 654; - const double arbitrary_utilization = 0.12345; - - EXPECT_CALL(*mock_receiver_, DoOnFrameReadyInBuffer(_, _, _, _)) - .WillOnce(Invoke([this, &arbitrary_utilization]( - int32_t buffer_id, int32_t frame_feedback_id, - mojom::ScopedAccessPermissionPtr*, - media::mojom::VideoFrameInfoPtr*) { - device_proxy_->OnReceiverReportingUtilization(frame_feedback_id, - arbitrary_utilization); - })); - - EXPECT_CALL(mock_device_, OnUtilizationReport(arbitrary_frame_feedback_id, - arbitrary_utilization)) - .Times(1); - - device_proxy_->Start(requested_settings_, std::move(mock_receiver_proxy_)); - run_loop.RunUntilIdle(); - - // Simulate device sending a frame, which should trigger |mock_receiver| - // DoOnFrameReadyInBuffer() getting called. - base::RunLoop run_loop_2; - mock_device_.SendStubFrame(stub_frame_format, arbitrary_rotation, - arbitrary_frame_feedback_id); - run_loop_2.RunUntilIdle(); - - base::RunLoop run_loop_3; - mock_receiver_.reset(); - run_loop_3.RunUntilIdle(); -} - } // namespace video_capture
diff --git a/services/video_capture/texture_virtual_device_mojo_adapter.cc b/services/video_capture/texture_virtual_device_mojo_adapter.cc index dcbb225..8bfdb327 100644 --- a/services/video_capture/texture_virtual_device_mojo_adapter.cc +++ b/services/video_capture/texture_virtual_device_mojo_adapter.cc
@@ -85,16 +85,6 @@ } } -void TextureVirtualDeviceMojoAdapter::OnReceiverReportingUtilization( - int32_t frame_feedback_id, - double utilization) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); -} - -void TextureVirtualDeviceMojoAdapter::RequestRefreshFrame() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); -} - void TextureVirtualDeviceMojoAdapter::MaybeSuspend() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); }
diff --git a/services/video_capture/texture_virtual_device_mojo_adapter.h b/services/video_capture/texture_virtual_device_mojo_adapter.h index 2c41dcc..6d7488a 100644 --- a/services/video_capture/texture_virtual_device_mojo_adapter.h +++ b/services/video_capture/texture_virtual_device_mojo_adapter.h
@@ -38,9 +38,6 @@ // mojom::Device implementation. void Start(const media::VideoCaptureParams& requested_settings, mojom::ReceiverPtr receiver) override; - void OnReceiverReportingUtilization(int32_t frame_feedback_id, - double utilization) override; - void RequestRefreshFrame() override; void MaybeSuspend() override; void Resume() override; void GetPhotoState(GetPhotoStateCallback callback) override;
diff --git a/skia/ext/fontmgr_fuchsia_unittest.cc b/skia/ext/fontmgr_fuchsia_unittest.cc index 0f90c956..d3fc113e 100644 --- a/skia/ext/fontmgr_fuchsia_unittest.cc +++ b/skia/ext/fontmgr_fuchsia_unittest.cc
@@ -31,7 +31,7 @@ // TODO(https://crbug.com/931333): Currently font provider returns the same // font for sans and serif when used with the default font config. Update this // test to use the fonts //third_party/test_fonts. -TEST_F(FuchsiaFontManagerTest, Caching) { +TEST_F(FuchsiaFontManagerTest, DISABLED_Caching) { sk_sp<SkTypeface> sans( font_manager_->matchFamilyStyle("sans", SkFontStyle())); EXPECT_TRUE(sans);
diff --git a/testing/buildbot/chromium.gpu.fyi.json b/testing/buildbot/chromium.gpu.fyi.json index 233858f..f75012b 100644 --- a/testing/buildbot/chromium.gpu.fyi.json +++ b/testing/buildbot/chromium.gpu.fyi.json
@@ -16704,6 +16704,30 @@ }, { "args": [ + "power", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "power_measurement_test", + "should_retry_with_patch": false, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6286", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ], + "idempotent": false + } + }, + { + "args": [ "trace_test", "--show-stdout", "--browser=release", @@ -18834,6 +18858,31 @@ }, { "args": [ + "power", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "power_measurement_test", + "should_retry_with_patch": false, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6286", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ], + "expiration": 21600, + "idempotent": false + } + }, + { + "args": [ "screenshot_sync", "--show-stdout", "--browser=release", @@ -19669,6 +19718,30 @@ }, { "args": [ + "power", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "power_measurement_test", + "should_retry_with_patch": false, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6286", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ], + "idempotent": false + } + }, + { + "args": [ "screenshot_sync", "--show-stdout", "--browser=release",
diff --git a/testing/buildbot/generate_buildbot_json.py b/testing/buildbot/generate_buildbot_json.py index 739ca42..a2ec27ac 100755 --- a/testing/buildbot/generate_buildbot_json.py +++ b/testing/buildbot/generate_buildbot_json.py
@@ -866,7 +866,7 @@ self.generate_waterfall_json(waterfall)) def get_valid_bot_names(self): - # Extract bot names from infra/config/global/luci-milo.cfg. + # Extract bot names from infra/config/luci-milo.cfg. # NOTE: This reference can cause issues; if a file changes there, the # presubmit here won't be run by default. A manually maintained list there # tries to run presubmit here when luci-milo.cfg is changed. If any other @@ -876,7 +876,7 @@ bot_names = set() infra_config_dir = os.path.abspath( os.path.join(os.path.dirname(__file__), - '..', '..', 'infra', 'config', 'global')) + '..', '..', 'infra', 'config')) milo_configs = [ os.path.join(infra_config_dir, 'luci-milo.cfg'), os.path.join(infra_config_dir, 'luci-milo-dev.cfg'), @@ -1232,11 +1232,43 @@ self.check_output_file_consistency(verbose) # pragma: no cover def parse_args(self, argv): # pragma: no cover - parser = argparse.ArgumentParser() - parser.add_argument( + + # RawTextHelpFormatter allows for styling of help statement + parser = argparse.ArgumentParser(formatter_class= + argparse.RawTextHelpFormatter) + + group = parser.add_mutually_exclusive_group() + group.add_argument( '-c', '--check', action='store_true', help= 'Do consistency checks of configuration and generated files and then ' 'exit. Used during presubmit. Causes the tool to not generate any files.') + group.add_argument( + '--query', type=str, help= + ("Returns raw JSON information of buildbots and tests.\n" + + "Examples:\n" + + " List all bots (all info):\n" + + " --query bots\n\n" + + " List all bots and only their associated tests:\n" + + " --query bots/tests\n\n" + + " List all information about 'bot1' " + + "(make sure you have quotes):\n" + + " --query bot/'bot1'\n\n" + + " List tests running for 'bot1' (make sure you have quotes):\n" + + " --query bot/'bot1'/tests\n\n" + + " List all tests:\n" + + " --query tests\n\n" + + " List all tests and the bots running them:\n" + + " --query tests/bots\n\n"+ + " List all tests that satisfy multiple parameters\n" + + " (separation of parameters by '&' symbol):\n" + + " --query tests/'device_os:Android&device_type:hammerhead'\n\n" + + " List all tests that run with a specific flag:\n" + + " --query bots/'--test-launcher-print-test-studio=always'\n\n" + + " List specific test (make sure you have quotes):\n" + " --query test/'test1'\n\n" + " List all bots running 'test1' " + + "(make sure you have quotes):\n" + + " --query test/'test1'/bots" )) parser.add_argument( '-n', '--new-files', action='store_true', help= 'Write output files as .new.json. Useful during development so old and ' @@ -1250,12 +1282,296 @@ parser.add_argument( '--pyl-files-dir', type=os.path.realpath, help='Path to the directory containing the input .pyl files.') + parser.add_argument( + '--json', help= + ("Outputs results into a json file. Only works with query function.\n" + + "Examples:\n" + + " Outputs file into specified json file: \n" + + " --json <file-name-here.json>")) self.args = parser.parse_args(argv) + if self.args.json and not self.args.query: + parser.error("The --json flag can only be used with --query.") + + def does_test_match(self, test_info, params_dict): + """Checks to see if the test matches the parameters given. + + Compares the provided test_info with the params_dict to see + if the bot matches the parameters given. If so, returns True. + Else, returns false. + + Args: + test_info (dict): Information about a specific bot provided + in the format shown in waterfalls.pyl + params_dict (dict): Dictionary of parameters and their values + to look for in the bot + Ex: { + 'device_os':'android', + '--flag':True, + 'mixins': ['mixin1', 'mixin2'], + 'ex_key':'ex_value' + } + + """ + DIMENSION_PARAMS = ['device_os', 'device_type', 'os', + 'kvm', 'pool', 'integrity'] # dimension parameters + SWARMING_PARAMS = ['shards', 'hard_timeout', 'idempotent', + 'can_use_on_swarming_builders'] + for param in params_dict: + # if dimension parameter + if param in DIMENSION_PARAMS or param in SWARMING_PARAMS: + if not 'swarming' in test_info: + return False + swarming = test_info['swarming'] + if param in SWARMING_PARAMS: + if not param in swarming: + return False + if not str(swarming[param]) == params_dict[param]: + return False + else: + if not 'dimension_sets' in swarming: + return False + d_set = swarming['dimension_sets'] + # only looking at the first dimension set + if not param in d_set[0]: + return False + if not d_set[0][param] == params_dict[param]: + return False + + # if flag + elif param.startswith('--'): + if not 'args' in test_info: + return False + if not param in test_info['args']: + return False + + # not dimension parameter/flag/mixin + else: + if not param in test_info: + return False + if not test_info[param] == params_dict[param]: + return False + return True + def error_msg(self, msg): + """Prints an error message. + + In addition to a catered error message, also prints + out where the user can find more help. Then, program exits. + """ + self.print_line(msg + (' If you need more information, ' + + 'please run with -h or --help to see valid commands.')) + sys.exit(1) + + def find_bots_that_run_test(self, test, bots): + matching_bots = [] + for bot in bots: + bot_info = bots[bot] + tests = self.flatten_tests_for_bot(bot_info) + for test_info in tests: + test_name = "" + if 'name' in test_info: + test_name = test_info['name'] + elif 'test' in test_info: + test_name = test_info['test'] + if not test_name == test: + continue + matching_bots.append(bot) + return matching_bots + + def find_tests_with_params(self, tests, params_dict): + matching_tests = [] + for test_name in tests: + test_info = tests[test_name] + if not self.does_test_match(test_info, params_dict): + continue + if not test_name in matching_tests: + matching_tests.append(test_name) + return matching_tests + + def flatten_waterfalls_for_query(self, waterfalls): + bots = {} + for waterfall in waterfalls: + waterfall_json = json.loads(self.generate_waterfall_json(waterfall)) + for bot in waterfall_json: + bot_info = waterfall_json[bot] + if 'AAAAA' not in bot: + bots[bot] = bot_info + return bots + + def flatten_tests_for_bot(self, bot_info): + """Returns a list of flattened tests. + + Returns a list of tests not grouped by test category + for a specific bot. + """ + TEST_CATS = self.get_test_generator_map().keys() + tests = [] + for test_cat in TEST_CATS: + if not test_cat in bot_info: + continue + test_cat_tests = bot_info[test_cat] + tests = tests + test_cat_tests + return tests + + def flatten_tests_for_query(self, test_suites): + """Returns a flattened dictionary of tests. + + Returns a dictionary of tests associate with their + configuration, not grouped by their test suite. + """ + tests = {} + for test_suite in test_suites.itervalues(): + for test in test_suite: + test_info = test_suite[test] + test_name = test + if 'name' in test_info: + test_name = test_info['name'] + tests[test_name] = test_info + return tests + + def parse_query_filter_params(self, params): + """Parses the filter parameters. + + Creates a dictionary from the parameters provided + to filter the bot array. + """ + params_dict = {} + for p in params: + # flag + if p.startswith("--"): + params_dict[p] = True + else: + pair = p.split(":") + if len(pair) != 2: + self.error_msg('Invalid command.') + # regular parameters + if pair[1].lower() == "true": + params_dict[pair[0]] = True + elif pair[1].lower() == "false": + params_dict[pair[0]] = False + else: + params_dict[pair[0]] = pair[1] + return params_dict + + def get_test_suites_dict(self, bots): + """Returns a dictionary of bots and their tests. + + Returns a dictionary of bots and a list of their associated tests. + """ + test_suite_dict = dict() + for bot in bots: + bot_info = bots[bot] + tests = self.flatten_tests_for_bot(bot_info) + test_suite_dict[bot] = tests + return test_suite_dict + + def output_query_result(self, result, json_file=None): + """Outputs the result of the query. + + If a json file parameter name is provided, then + the result is output into the json file. If not, + then the result is printed to the console. + """ + output = json.dumps(result, indent=2) + if json_file: + self.write_file(json_file, output) + else: + self.print_line(output) + return + + def query(self, args): + """Queries tests or bots. + + Depending on the arguments provided, outputs a json of + tests or bots matching the appropriate optional parameters provided. + """ + # split up query statement + query = args.query.split('/') + self.load_configuration_files() + self.resolve_configuration_files() + + # flatten bots json + tests = self.test_suites + bots = self.flatten_waterfalls_for_query(self.waterfalls) + + cmd_class = query[0] + + # For queries starting with 'bots' + if cmd_class == "bots": + if len(query) == 1: + return self.output_query_result(bots, args.json) + # query with specific parameters + elif len(query) == 2: + if query[1] == 'tests': + test_suites_dict = self.get_test_suites_dict(bots) + return self.output_query_result(test_suites_dict, args.json) + else: + self.error_msg("This query should be in the format: bots/tests.") + + else: + self.error_msg("This query should have 0 or 1 '/', found %s instead." + % str(len(query)-1)) + + # For queries starting with 'bot' + elif cmd_class == "bot": + if not len(query) == 2 and not len(query) == 3: + self.error_msg("Command should have 1 or 2 '/', found %s instead." + % str(len(query)-1)) + bot_id = query[1] + if not bot_id in bots: + self.error_msg("No bot named '" + bot_id + "' found.") + bot_info = bots[bot_id] + if len(query) == 2: + return self.output_query_result(bot_info, args.json) + if not query[2] == 'tests': + self.error_msg("The query should be in the format:" + + "bot/<bot-name>/tests.") + + bot_tests = self.flatten_tests_for_bot(bot_info) + return self.output_query_result(bot_tests, args.json) + + # For queries starting with 'tests' + elif cmd_class == "tests": + if not len(query) == 1 and not len(query) == 2: + self.error_msg("The query should have 0 or 1 '/', found %s instead." + % str(len(query)-1)) + flattened_tests = self.flatten_tests_for_query(tests) + if len(query) == 1: + return self.output_query_result(flattened_tests, args.json) + + # create params dict + params = query[1].split('&') + params_dict = self.parse_query_filter_params(params) + matching_bots = self.find_tests_with_params(flattened_tests, params_dict) + return self.output_query_result(matching_bots) + + # For queries starting with 'test' + elif cmd_class == "test": + if not len(query) == 2 and not len(query) == 3: + self.error_msg("The query should have 1 or 2 '/', found %s instead." + % str(len(query)-1)) + test_id = query[1] + if len(query) == 2: + flattened_tests = self.flatten_tests_for_query(tests) + for test in flattened_tests: + if test == test_id: + return self.output_query_result(flattened_tests[test], args.json) + self.error_msg("There is no test named %s." % test_id) + if not query[2] == 'bots': + self.error_msg("The query should be in the format: " + + "test/<test-name>/bots") + bots_for_test = self.find_bots_that_run_test(test_id, bots) + return self.output_query_result(bots_for_test) + + else: + self.error_msg("Your command did not match any valid commands." + + "Try starting with 'bots', 'bot', 'tests', or 'test'.") def main(self, argv): # pragma: no cover self.parse_args(argv) if self.args.check: self.check_consistency(verbose=self.args.verbose) + elif self.args.query: + self.query(self.args) else: self.generate_waterfalls() return 0
diff --git a/testing/buildbot/generate_buildbot_json_unittest.py b/testing/buildbot/generate_buildbot_json_unittest.py index 7c12563..942cacbe 100755 --- a/testing/buildbot/generate_buildbot_json_unittest.py +++ b/testing/buildbot/generate_buildbot_json_unittest.py
@@ -8,7 +8,7 @@ import argparse import os import unittest - +import json import generate_buildbot_json @@ -18,7 +18,7 @@ super(FakeBBGen, self).__init__() infra_config_dir = os.path.abspath( os.path.join(os.path.dirname(__file__), '..', '..', - 'infra', 'config', 'global')) + 'infra', 'config')) luci_milo_cfg_path = os.path.join(infra_config_dir, 'luci-milo.cfg') luci_milo_dev_cfg_path = os.path.join(infra_config_dir, 'luci-milo-dev.cfg') self.files = { @@ -2761,5 +2761,654 @@ fbb.check_output_file_consistency(verbose=True) self.assertFalse(fbb.printed_lines) +TEST_SUITE_WITH_PARAMS = """\ +{ + 'basic_suites': { + 'bar_tests': { + 'bar_test': { + 'args': ['--no-xvfb'], + 'swarming': { + 'dimension_sets': [ + { + 'device_os': 'NMF26U' + } + ], + }, + 'should_retry_with_patch': False, + 'name': 'bar_test' + }, + 'bar_test_test': { + 'swarming': { + 'dimension_sets': [ + { + 'kvm': '1' + } + ], + 'hard_timeout': 1000 + }, + 'should_retry_with_patch': True + } + }, + 'foo_tests': { + 'foo_test_empty': {}, + 'foo_test': { + 'args': [ + '--jobs=1', + '--verbose' + ], + 'swarming': { + 'dimension_sets': [ + { + 'device_os': 'MMB29Q' + } + ], + 'hard_timeout': 1800 + } + }, + 'foo_test_test': { + 'swarming': { + }, + 'name': 'pls' + }, + }, + }, + 'compound_suites': { + 'composition_tests': [ + 'foo_tests', + 'bar_tests', + ], + }, +} +""" +TEST_QUERY_BOTS_OUTPUT = { + "Fake Android M Tester": { + "gtest_tests": [ + { + "test": "foo_test", + "swarming": { + "can_use_on_swarming_builders": False + } + } + ] + }, + "Fake Android L Tester": { + "gtest_tests": [ + { + "test": "foo_test", + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "swarming": { + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": + "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets":[ + { + "device_os": "KTU84P", + "device_type": "hammerhead" + } + ], + "can_use_on_swarming_builders": True + } + } + ] + }, + "Fake Android K Tester": { + "additional_compile_targets": ["bar_test"], + "gtest_tests": [ + { + "test": "foo_test", + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "swarming": { + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": + "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "KTU84P", + "device_type": "hammerhead" + } + ], + "can_use_on_swarming_builders": True, + "output_links": [ + { + "link": ["https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats"], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + } + } + ] + }, + "Android Builder": { + "additional_compile_targets": ["bar_test"] + } +} +TEST_QUERY_BOTS_TESTS_OUTPUT = { + "Fake Android M Tester": [ + { + "test": "foo_test", + "swarming": { + "can_use_on_swarming_builders": False + } + } + ], + "Fake Android L Tester": [ + { + "test": "foo_test", + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "swarming": { + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "KTU84P", + "device_type": "hammerhead" + } + ], + "can_use_on_swarming_builders": True + } + } + ], + "Android Builder": [], + "Fake Android K Tester": [ + { + "test": "foo_test", + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "swarming": { + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "KTU84P", + "device_type": "hammerhead" + } + ], + "can_use_on_swarming_builders": True, + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + } + } + ] +} + +TEST_QUERY_BOT_OUTPUT = { + "additional_compile_targets": ["bar_test"], + "gtest_tests": [ + { + "test": "foo_test", "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], "swarming": { + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "KTU84P", + "device_type": "hammerhead" + } + ], + "can_use_on_swarming_builders": True, + "output_links": [ + { + "link": ["https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + } + } + ] +} +TEST_QUERY_BOT_TESTS_OUTPUT = [ + { + "test": "foo_test", + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "swarming": { + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "KTU84P", + "device_type": "hammerhead" + } + ], + "can_use_on_swarming_builders": True + } + } +] + +TEST_QUERY_TESTS_OUTPUT = { + "bar_test": {}, + "foo_test": {} +} + +TEST_QUERY_TESTS_MULTIPLE_PARAMS_OUTPUT = ["foo_test"] + +TEST_QUERY_TESTS_DIMENSION_PARAMS_OUTPUT = ["bar_test"] + +TEST_QUERY_TESTS_SWARMING_PARAMS_OUTPUT = ["bar_test_test"] + +TEST_QUERY_TESTS_PARAMS_OUTPUT = ['bar_test_test'] + +TEST_QUERY_TESTS_PARAMS_FALSE_OUTPUT = ['bar_test'] + +TEST_QUERY_TEST_OUTPUT = {} + +TEST_QUERY_TEST_BOTS_OUTPUT = [ + "Fake Android M Tester", + "Fake Android L Tester", + "Fake Android K Tester" +] + +TEST_QUERY_TEST_BOTS_ISOLATED_SCRIPTS_OUTPUT = ['Fake Tester'] + +TEST_QUERY_TEST_BOTS_NO_BOTS_OUTPUT = [] + +class QueryTests(unittest.TestCase): + """Tests for the query feature.""" + def test_query_bots(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='bots', check=False, + pyl_files_dir=None, json=None, + waterfall_filters = []) + fbb.query(fbb.args) + query_json = json.loads("".join(fbb.printed_lines)) + self.assertEqual(query_json, TEST_QUERY_BOTS_OUTPUT) + + def test_query_bots_invalid(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='bots/blah/blah', check=False, + pyl_files_dir=None, json=None, + waterfall_filters = []) + with self.assertRaises(SystemExit) as cm: + fbb.query(fbb.args) + self.assertEqual(cm.exception.code, 1) + self.assertTrue(fbb.printed_lines) + + def test_query_bots_json(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='bots', check=False, + pyl_files_dir=None, json='result.json', + waterfall_filters = []) + fbb.query(fbb.args) + self.assertFalse(fbb.printed_lines) + + def test_query_bots_tests(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='bots/tests', check=False, + pyl_files_dir=None, json=None, + waterfall_filters = []) + fbb.query(fbb.args) + query_json = json.loads("".join(fbb.printed_lines)) + self.assertEqual(query_json, TEST_QUERY_BOTS_TESTS_OUTPUT) + + def test_query_invalid_bots_tests(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='bots/tdfjdk', check=False, + pyl_files_dir=None, json=None, + waterfall_filters = []) + with self.assertRaises(SystemExit) as cm: + fbb.query(fbb.args) + self.assertEqual(cm.exception.code, 1) + self.assertTrue(fbb.printed_lines) + + def test_query_bot(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='bot/Fake Android K Tester', + check=False, pyl_files_dir=None, json=None, + waterfall_filters = []) + fbb.query(fbb.args) + query_json = json.loads("".join(fbb.printed_lines)) + self.assertEqual(query_json, TEST_QUERY_BOT_OUTPUT) + + def test_query_bot_invalid_id(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='bot/bot1', check=False, + pyl_files_dir=None, json=None, + waterfall_filters = []) + with self.assertRaises(SystemExit) as cm: + fbb.query(fbb.args) + self.assertEqual(cm.exception.code, 1) + self.assertTrue(fbb.printed_lines) + + def test_query_bot_invalid_query_too_many(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='bot/Fake Android K Tester/blah/blah', + check=False, pyl_files_dir=None, json=None, + waterfall_filters = []) + with self.assertRaises(SystemExit) as cm: + fbb.query(fbb.args) + self.assertEqual(cm.exception.code, 1) + self.assertTrue(fbb.printed_lines) + + def test_query_bot_invalid_query_no_tests(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='bot/Fake Android K Tester/blahs', + check=False, pyl_files_dir=None, json=None, + waterfall_filters = []) + with self.assertRaises(SystemExit) as cm: + fbb.query(fbb.args) + self.assertEqual(cm.exception.code, 1) + self.assertTrue(fbb.printed_lines) + + def test_query_bot_tests(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='bot/Fake Android L Tester/tests', + check=False, pyl_files_dir=None, json=None, + waterfall_filters = []) + fbb.query(fbb.args) + query_json = json.loads("".join(fbb.printed_lines)) + self.assertEqual(query_json, TEST_QUERY_BOT_TESTS_OUTPUT) + + def test_query_tests(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='tests', check=False, + pyl_files_dir=None, json=None, + waterfall_filters = []) + fbb.query(fbb.args) + query_json = json.loads("".join(fbb.printed_lines)) + self.assertEqual(query_json, TEST_QUERY_TESTS_OUTPUT) + + def test_query_tests_invalid(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='tests/blah/blah', check=False, + pyl_files_dir=None, json=None, + waterfall_filters = []) + with self.assertRaises(SystemExit) as cm: + fbb.query(fbb.args) + self.assertEqual(cm.exception.code, 1) + self.assertTrue(fbb.printed_lines) + + def test_query_tests_multiple_params(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + TEST_SUITE_WITH_PARAMS, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='tests/--jobs=1&--verbose', check=False, + pyl_files_dir=None, json=None, + waterfall_filters = []) + fbb.query(fbb.args) + query_json = json.loads("".join(fbb.printed_lines)) + self.assertEqual(query_json, TEST_QUERY_TESTS_MULTIPLE_PARAMS_OUTPUT) + + def test_query_tests_invalid_params(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + TEST_SUITE_WITH_PARAMS, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='tests/device_os?', check=False, + pyl_files_dir=None, json=None, + waterfall_filters = []) + with self.assertRaises(SystemExit) as cm: + fbb.query(fbb.args) + self.assertEqual(cm.exception.code, 1) + self.assertTrue(fbb.printed_lines) + + def test_query_tests_dimension_params(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + TEST_SUITE_WITH_PARAMS, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='tests/device_os:NMF26U', + check=False, pyl_files_dir=None, + json=None, waterfall_filters = []) + fbb.query(fbb.args) + query_json = json.loads("".join(fbb.printed_lines)) + self.assertEqual(query_json, TEST_QUERY_TESTS_DIMENSION_PARAMS_OUTPUT) + + def test_query_tests_swarming_params(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + TEST_SUITE_WITH_PARAMS, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='tests/hard_timeout:1000', + check=False, pyl_files_dir=None, + json=None, waterfall_filters = []) + fbb.query(fbb.args) + query_json = json.loads("".join(fbb.printed_lines)) + self.assertEqual(query_json, TEST_QUERY_TESTS_SWARMING_PARAMS_OUTPUT) + + def test_query_tests_params(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + TEST_SUITE_WITH_PARAMS, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='tests/should_retry_with_patch:true', + check=False, pyl_files_dir=None, + json=None, waterfall_filters = []) + fbb.query(fbb.args) + query_json = json.loads("".join(fbb.printed_lines)) + self.assertEqual(query_json, TEST_QUERY_TESTS_PARAMS_OUTPUT) + + def test_query_tests_params_false(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + TEST_SUITE_WITH_PARAMS, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='tests/should_retry_with_patch:false', + check=False, pyl_files_dir=None, + json=None, waterfall_filters = []) + fbb.query(fbb.args) + query_json = json.loads("".join(fbb.printed_lines)) + self.assertEqual(query_json, TEST_QUERY_TESTS_PARAMS_FALSE_OUTPUT) + + def test_query_test(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='test/foo_test', check=False, + pyl_files_dir=None, json=None, + waterfall_filters = []) + fbb.query(fbb.args) + query_json = json.loads("".join(fbb.printed_lines)) + self.assertEqual(query_json, TEST_QUERY_TEST_OUTPUT) + + def test_query_test_invalid_id(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='test/foo_foo', check=False, + pyl_files_dir=None, json=None, + waterfall_filters = []) + with self.assertRaises(SystemExit) as cm: + fbb.query(fbb.args) + self.assertEqual(cm.exception.code, 1) + self.assertTrue(fbb.printed_lines) + + def test_query_test_invalid_length(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='test/foo_tests/foo/foo', check=False, + pyl_files_dir=None, json=None, + waterfall_filters = []) + with self.assertRaises(SystemExit) as cm: + fbb.query(fbb.args) + self.assertEqual(cm.exception.code, 1) + self.assertTrue(fbb.printed_lines) + + def test_query_test_bots(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='test/foo_test/bots', check=False, + pyl_files_dir=None, json=None, + waterfall_filters = []) + fbb.query(fbb.args) + query_json = json.loads("".join(fbb.printed_lines)) + self.assertEqual(query_json, TEST_QUERY_TEST_BOTS_OUTPUT) + + def test_query_test_bots_isolated_scripts(self): + fbb = FakeBBGen(FOO_ISOLATED_SCRIPTS_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='test/foo_test/bots', check=False, + pyl_files_dir=None, json=None, + waterfall_filters = []) + fbb.query(fbb.args) + query_json = json.loads("".join(fbb.printed_lines)) + self.assertEqual(query_json, TEST_QUERY_TEST_BOTS_ISOLATED_SCRIPTS_OUTPUT) + + def test_query_test_bots_invalid(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='test/foo_tests/foo', check=False, + pyl_files_dir=None, json=None, + waterfall_filters = []) + with self.assertRaises(SystemExit) as cm: + fbb.query(fbb.args) + self.assertEqual(cm.exception.code, 1) + self.assertTrue(fbb.printed_lines) + + def test_query_test_bots_no_bots(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='test/bar_tests/bots', check=False, + pyl_files_dir=None, json=None, + waterfall_filters = []) + fbb.query(fbb.args) + query_json = json.loads("".join(fbb.printed_lines)) + self.assertEqual(query_json, TEST_QUERY_TEST_BOTS_NO_BOTS_OUTPUT) + + def test_query_invalid(self): + fbb = FakeBBGen(ANDROID_WATERFALL, + GOOD_COMPOSITION_TEST_SUITES, + EMPTY_PYL_FILE, + SWARMING_MIXINS_SORTED, + LUCI_MILO_CFG) + fbb.args = argparse.Namespace(query='foo', check=False, + pyl_files_dir=None, json=None, + waterfall_filters = []) + with self.assertRaises(SystemExit) as cm: + fbb.query(fbb.args) + self.assertEqual(cm.exception.code, 1) + self.assertTrue(fbb.printed_lines) + if __name__ == '__main__': unittest.main()
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index df1f30e8..037ee32 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -3493,6 +3493,12 @@ }, }, + 'gpu_win_intel_specific_telemetry_tests': { + 'power_measurement_test': { + 'telemetry_test_name': 'power', + }, + }, + 'gpu_win_specific_gtests': { 'gl_tests_passthrough': { 'test': 'gl_tests', @@ -4814,6 +4820,18 @@ 'gpu_win_specific_gtests', ], + 'gpu_fyi_win_intel_release_telemetry_tests': [ + 'gpu_common_and_optional_telemetry_tests', + 'gpu_fyi_and_optional_and_win_angle_amd_win_specific_gpu_telemetry_tests', + 'gpu_fyi_and_optional_win_and_linux_specific_telemetry_tests', + 'gpu_fyi_only_win_intel_and_nvidia_release_specific_telemetry_tests', + 'gpu_fyi_only_win_linux_intel_nvidia_specific_telemetry_tests', + 'gpu_fyi_optional_and_v8_desktop_release_specific_telemetry_tests', + 'gpu_telemetry_tests', + 'gpu_webgl_conformance_d3d9_validating_tests', + 'gpu_win_intel_specific_telemetry_tests', + ], + 'gpu_fyi_win_optional_gtests': [ 'gpu_angle_end2end_tests', 'gpu_angle_white_box_tests', @@ -4841,6 +4859,15 @@ 'gpu_telemetry_tests', ], + 'gpu_optional_win_intel_telemetry_tests': [ + 'gpu_common_and_optional_telemetry_tests', + 'gpu_fyi_and_optional_and_win_angle_amd_win_specific_gpu_telemetry_tests', + 'gpu_fyi_and_optional_win_and_linux_specific_telemetry_tests', + 'gpu_fyi_optional_and_v8_desktop_release_specific_telemetry_tests', + 'gpu_webgl_conformance_d3d9_validating_tests', + 'gpu_win_intel_specific_telemetry_tests', + ], + 'gpu_optional_win_telemetry_tests': [ 'gpu_common_and_optional_telemetry_tests', 'gpu_fyi_and_optional_and_win_angle_amd_win_specific_gpu_telemetry_tests',
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index 0c0539f..74a4bfdb 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -2661,7 +2661,7 @@ 'test_suites': { 'gtest_tests': 'gpu_fyi_win_optional_gtests', 'isolated_scripts': 'gpu_angle_perftests', - 'gpu_telemetry_tests': 'gpu_optional_win_telemetry_tests', + 'gpu_telemetry_tests': 'gpu_optional_win_intel_telemetry_tests', }, }, 'Optional Win10 Release (NVIDIA)': { @@ -2700,7 +2700,7 @@ 'test_suites': { 'gtest_tests': 'gpu_fyi_win_gtests', 'isolated_scripts': 'gpu_angle_perftests', - 'gpu_telemetry_tests': 'gpu_fyi_win_release_telemetry_tests', + 'gpu_telemetry_tests': 'gpu_fyi_win_intel_release_telemetry_tests', }, }, # TODO(kbr): "Experimental" caused too-long path names pre-LUCI. @@ -2728,7 +2728,7 @@ 'test_suites': { 'gtest_tests': 'gpu_fyi_win_gtests', 'isolated_scripts': 'gpu_angle_perftests', - 'gpu_telemetry_tests': 'gpu_fyi_win_release_telemetry_tests', + 'gpu_telemetry_tests': 'gpu_fyi_win_intel_release_telemetry_tests', }, }, 'Win10 FYI Release (NVIDIA)': {
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 4bca2fe2..85916e7b 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -4356,6 +4356,26 @@ ] } ], + "ServiceWorkerAggressiveCodeCache": [ + { + "platforms": [ + "android", + "android_webview", + "chromeos", + "linux", + "mac", + "windows" + ], + "experiments": [ + { + "name": "Enabled_20190212", + "enable_features": [ + "ServiceWorkerAggressiveCodeCache" + ] + } + ] + } + ], "ServiceWorkerForegroundPriority": [ { "platforms": [ @@ -4480,7 +4500,7 @@ ] } ], - "SimpleCachePrefetchExperiment2": [ + "SimpleCachePrefetchExperiment": [ { "platforms": [ "android", @@ -4489,11 +4509,11 @@ ], "experiments": [ { - "name": "PrefetchFull32KTrailer4k", + "name": "PrefetchTrailerHint2", "params": { - "FullPrefetchBytes": "32768", + "FullPrefetchBytes": "0", "TrailerPrefetchHint": "true", - "TrailerPrefetchSpeculativeBytes": "4096" + "TrailerPrefetchSpeculativeBytes": "0" }, "enable_features": [ "SimpleCachePrefetchExperiment2" @@ -4505,13 +4525,20 @@ "SimpleCacheTrial": [ { "platforms": [ - "chromeos", - "linux", - "mac" + "mac", + "windows" ], "experiments": [ { - "name": "ExperimentYes" + "name": "ExperimentNoTrailerPrefetchHint4", + "params": { + "FullPrefetchBytes": "0", + "TrailerPrefetchInt": "true", + "TrailerPrefetchSpeculativeBytes": "0" + }, + "enable_features": [ + "SimpleCachePrefetchExperiment2" + ] } ] }
diff --git a/third_party/blink/common/origin_trials/trial_token_unittest.cc b/third_party/blink/common/origin_trials/trial_token_unittest.cc index a3d7fd24..c8f4a85 100644 --- a/third_party/blink/common/origin_trials/trial_token_unittest.cc +++ b/third_party/blink/common/origin_trials/trial_token_unittest.cc
@@ -734,7 +734,7 @@ EXPECT_FALSE(empty_token) << "Invalid trial token should not parse."; } -INSTANTIATE_TEST_CASE_P(, TrialTokenTest, testing::ValuesIn(kInvalidTokens)); +INSTANTIATE_TEST_SUITE_P(, TrialTokenTest, testing::ValuesIn(kInvalidTokens)); TEST_F(TrialTokenTest, ParseValidToken) { std::unique_ptr<TrialToken> token = Parse(kSampleTokenJSON);
diff --git a/third_party/blink/public/mojom/worker/shared_worker_factory.mojom b/third_party/blink/public/mojom/worker/shared_worker_factory.mojom index e5de25e..ce14a565 100644 --- a/third_party/blink/public/mojom/worker/shared_worker_factory.mojom +++ b/third_party/blink/public/mojom/worker/shared_worker_factory.mojom
@@ -61,7 +61,7 @@ // // TODO(leonhsl): It doesn't really need to be associated. Make it // non-associated and update - // WebServiceWorkerNetworkProviderImplForWorker::script_loader_factory_ + // ServiceWorkerNetworkProviderForWorker::script_loader_factory_ // as well. associated network.mojom.URLLoaderFactory? main_script_loader_factory,
diff --git a/third_party/blink/public/platform/modules/service_worker/web_service_worker_network_provider.h b/third_party/blink/public/platform/modules/service_worker/web_service_worker_network_provider.h index ba68f8e..80303ed 100644 --- a/third_party/blink/public/platform/modules/service_worker/web_service_worker_network_provider.h +++ b/third_party/blink/public/platform/modules/service_worker/web_service_worker_network_provider.h
@@ -42,12 +42,17 @@ class WebURLRequest; -// This interface is implemented by the embedder and is only called on the main -// thread. Currently the embedder has implementations for service worker clients -// (frames and shared workers), and service workers themselves. +// This interface allows the Blink embedder to implement loading functionality +// related to service workers. It is consulted whenever a DocumentLoader makes a +// request. // -// Instances of this class are owned by the associated loading context, e.g. -// DocumentLoader. +// It is owned by DocumentLoader and only used on the main thread. +// +// Currently the Blink embedder has implementations for service worker clients +// (frames and shared workers), and service workers themselves. Note that for +// workers, the interface is only used for requests from the shadow page +// (WorkerShadowPage). For hooking into off-the-main-thread loading from +// workers, the embedder can implement WebWorkerFetchContext. class WebServiceWorkerNetworkProvider { public: virtual ~WebServiceWorkerNetworkProvider() = default; @@ -55,30 +60,26 @@ // A request is about to be sent out, and the embedder may modify it. The // request is writable, and changes to the URL, for example, will change the // request made. - virtual void WillSendRequest(WebURLRequest&) {} + virtual void WillSendRequest(WebURLRequest&) = 0; + + // S13nServiceWorker: + // Returns a URLLoader for loading |request|. May return nullptr to fall back + // to the default loading behavior. + virtual std::unique_ptr<WebURLLoader> CreateURLLoader( + const WebURLRequest& request, + std::unique_ptr<scheduler::WebResourceLoadingTaskRunnerHandle>) = 0; // For service worker clients. virtual blink::mojom::ControllerServiceWorkerMode - IsControlledByServiceWorker() { - return blink::mojom::ControllerServiceWorkerMode::kNoController; - } + IsControlledByServiceWorker() = 0; // For service worker clients. Returns an identifier of the controller service // worker associated with the loading context. - virtual int64_t ControllerServiceWorkerID() { return -1; } - - // S13nServiceWorker: - // Returns a URLLoader for the associated context. May return nullptr - // if this doesn't provide a ServiceWorker specific URLLoader. - virtual std::unique_ptr<WebURLLoader> CreateURLLoader( - const WebURLRequest& request, - std::unique_ptr<scheduler::WebResourceLoadingTaskRunnerHandle>) { - return nullptr; - } + virtual int64_t ControllerServiceWorkerID() = 0; // For service worker clients. Called when IdlenessDetector emits its network // idle signal. - virtual void DispatchNetworkQuiet() {} + virtual void DispatchNetworkQuiet() = 0; }; } // namespace blink
diff --git a/third_party/blink/public/platform/web_media_player.h b/third_party/blink/public/platform/web_media_player.h index 55115e8..820549f 100644 --- a/third_party/blink/public/platform/web_media_player.h +++ b/third_party/blink/public/platform/web_media_player.h
@@ -150,12 +150,10 @@ virtual void SetRate(double) = 0; virtual void SetVolume(double) = 0; - // Enter Picture-in-Picture and notifies Blink with window size - // when video successfully enters Picture-in-Picture. - // TODO(mlamouri): rename to "OnRequestPictureInPicture". - virtual void EnterPictureInPicture() = 0; - // Exit Picture-in-Picture and notifies Blink when it's done. - virtual void ExitPictureInPicture() = 0; + // The associated media element is going to enter Picture-in-Picture. This + // method should make sure the player is set up for this and has a SurfaceId + // as it will be needed. + virtual void OnRequestPictureInPicture() = 0; // Assign custom controls to the Picture-in-Picture window. virtual void SetPictureInPictureCustomControls( const std::vector<PictureInPictureControlInfo>&) = 0; @@ -406,7 +404,7 @@ // Returns the id given by the WebMediaPlayerDelegate. This is used by the // Blink code to pass a player id to mojo services. // TODO(mlamouri): remove this and move the id handling to Blink. - virtual int GetDelegateId() { return -1; }; + virtual int GetDelegateId() { return -1; } // Returns the SurfaceId the video element is currently using. // Returns base::nullopt if the element isn't a video or doesn't have a
diff --git a/third_party/blink/renderer/SpecMapping.md b/third_party/blink/renderer/SpecMapping.md index 8abae0f..8fa06e5 100644 --- a/third_party/blink/renderer/SpecMapping.md +++ b/third_party/blink/renderer/SpecMapping.md
@@ -10,7 +10,7 @@ Concepts found in the [HTML spec](https://html.spec.whatwg.org/). -### [browsing context](https://html.spec.whatwg.org/#browsing-context) +### [browsing context](https://html.spec.whatwg.org/C/#browsing-context) A browsing context corresponds to the [Frame] interface where the main implementation is [LocalFrame]. @@ -29,7 +29,7 @@ [same-origin domain]: https://html.spec.whatwg.org/multipage/browsers.html#same-origin-domain -### [Window object](https://html.spec.whatwg.org/#window) +### [Window object](https://html.spec.whatwg.org/C/#window) A Window object corresponds to the [DOMWindow] interface where the main implementation is [LocalDOMWindow]. @@ -37,7 +37,7 @@ [DOMWindow]: https://cs.chromium.org/src/third_party/blink/renderer/core/frame/dom_window.h [LocalDOMWindow]: https://cs.chromium.org/src/third_party/blink/renderer/core/frame/local_dom_window.h -### [WindowProxy](https://html.spec.whatwg.org/#windowproxy) +### [WindowProxy](https://html.spec.whatwg.org/C/#windowproxy) The WindowProxy is part of the bindings implemented by the [WindowProxy class](https://cs.chromium.org/Source/bindings/core/v8/WindowProxy.h).
diff --git a/third_party/blink/renderer/bindings/core/v8/binding_security_test.cc b/third_party/blink/renderer/bindings/core/v8/binding_security_test.cc index fdab789..baa9f58 100644 --- a/third_party/blink/renderer/bindings/core/v8/binding_security_test.cc +++ b/third_party/blink/renderer/bindings/core/v8/binding_security_test.cc
@@ -128,21 +128,21 @@ } }; -INSTANTIATE_TEST_CASE_P(WindowProperties, - BindingSecurityCounterTest, - testing::Values("window", - "self", - "location", - "close", - "closed", - "focus", - "blur", - "frames", - "length", - "top", - "opener", - "parent", - "postMessage")); +INSTANTIATE_TEST_SUITE_P(WindowProperties, + BindingSecurityCounterTest, + testing::Values("window", + "self", + "location", + "close", + "closed", + "focus", + "blur", + "frames", + "length", + "top", + "opener", + "parent", + "postMessage")); TEST_P(BindingSecurityCounterTest, CrossOriginWindow) { LoadWindowAndAccessProperty(OriginDisposition::CrossOrigin, GetParam());
diff --git a/third_party/blink/renderer/bindings/core/v8/custom/v8_html_all_collection_custom.cc b/third_party/blink/renderer/bindings/core/v8/custom/v8_html_all_collection_custom.cc index c3c3d59..13d8a63 100644 --- a/third_party/blink/renderer/bindings/core/v8/custom/v8_html_all_collection_custom.cc +++ b/third_party/blink/renderer/bindings/core/v8/custom/v8_html_all_collection_custom.cc
@@ -34,7 +34,7 @@ namespace blink { -// https://html.spec.whatwg.org/#the-htmlallcollection-interface +// https://html.spec.whatwg.org/C/#the-htmlallcollection-interface // // The only part of the spec expressed in terms of ECMAScript values instead of // IDL values is the [[Call]] internal method. However, the way the
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc index bec05f5..c345ace 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
@@ -584,7 +584,7 @@ return v8::Local<v8::Promise>::Cast(promise.V8Value()); } -// https://html.spec.whatwg.org/#hostgetimportmetaproperties +// https://html.spec.whatwg.org/C/#hostgetimportmetaproperties static void HostGetImportMetaProperties(v8::Local<v8::Context> context, v8::Local<v8::Module> module, v8::Local<v8::Object> meta) {
diff --git a/third_party/blink/renderer/core/clipboard/data_transfer.idl b/third_party/blink/renderer/core/clipboard/data_transfer.idl index e31df69..ef5113e 100644 --- a/third_party/blink/renderer/core/clipboard/data_transfer.idl +++ b/third_party/blink/renderer/core/clipboard/data_transfer.idl
@@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-datatransfer-interface +// https://html.spec.whatwg.org/C/#the-datatransfer-interface [ Constructor
diff --git a/third_party/blink/renderer/core/clipboard/data_transfer_item.idl b/third_party/blink/renderer/core/clipboard/data_transfer_item.idl index d7f3665..5d9d4ba 100644 --- a/third_party/blink/renderer/core/clipboard/data_transfer_item.idl +++ b/third_party/blink/renderer/core/clipboard/data_transfer_item.idl
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-datatransferitem-interface +// https://html.spec.whatwg.org/C/#the-datatransferitem-interface interface DataTransferItem { readonly attribute DOMString kind;
diff --git a/third_party/blink/renderer/core/clipboard/data_transfer_item_list.idl b/third_party/blink/renderer/core/clipboard/data_transfer_item_list.idl index a38c057..1b31f75 100644 --- a/third_party/blink/renderer/core/clipboard/data_transfer_item_list.idl +++ b/third_party/blink/renderer/core/clipboard/data_transfer_item_list.idl
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-datatransferitemlist-interface +// https://html.spec.whatwg.org/C/#the-datatransferitemlist-interface interface DataTransferItemList { readonly attribute unsigned long length;
diff --git a/third_party/blink/renderer/core/css/css_property_source_data.h b/third_party/blink/renderer/core/css/css_property_source_data.h index f74ec56..fb283eb8 100644 --- a/third_party/blink/renderer/core/css/css_property_source_data.h +++ b/third_party/blink/renderer/core/css/css_property_source_data.h
@@ -86,7 +86,7 @@ class CSSRuleSourceData : public GarbageCollectedFinalized<CSSRuleSourceData> { public: explicit CSSRuleSourceData(StyleRule::RuleType type) : type(type) {} - void Trace(blink::Visitor* visitor) { visitor->Trace(child_rules); }; + void Trace(blink::Visitor* visitor) { visitor->Trace(child_rules); } bool HasProperties() const { return type == StyleRule::kStyle || type == StyleRule::kFontFace ||
diff --git a/third_party/blink/renderer/core/css/css_test_helpers.h b/third_party/blink/renderer/core/css/css_test_helpers.h index 8d4e5b9..3cf1af00 100644 --- a/third_party/blink/renderer/core/css/css_test_helpers.h +++ b/third_party/blink/renderer/core/css/css_test_helpers.h
@@ -29,7 +29,7 @@ TestStyleSheet(); ~TestStyleSheet(); - const Document& GetDocument() { return *document_; }; + const Document& GetDocument() { return *document_; } void AddCSSRules(const char* rule_text, bool is_empty_sheet = false); RuleSet& GetRuleSet();
diff --git a/third_party/blink/renderer/core/css/parser/css_proto_converter.cc b/third_party/blink/renderer/core/css/parser/css_proto_converter.cc index c194fbf7..5c8a506 100644 --- a/third_party/blink/renderer/core/css/parser/css_proto_converter.cc +++ b/third_party/blink/renderer/core/css/parser/css_proto_converter.cc
@@ -2147,4 +2147,4 @@ if (append_semicolon) string_ += "; "; } -}; // namespace css_proto_converter +} // namespace css_proto_converter
diff --git a/third_party/blink/renderer/core/css/parser/css_proto_converter.h b/third_party/blink/renderer/core/css/parser/css_proto_converter.h index f21ab40..c369955 100644 --- a/third_party/blink/renderer/core/css/parser/css_proto_converter.h +++ b/third_party/blink/renderer/core/css/parser/css_proto_converter.h
@@ -109,6 +109,6 @@ template <size_t TableSize> void AppendTableValue(int id, const std::string (&lookup_table)[TableSize]); }; -}; // namespace css_proto_converter +} // namespace css_proto_converter #endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PARSER_CSS_PROTO_CONVERTER_H_
diff --git a/third_party/blink/renderer/core/css/parser/css_tokenizer_test.cc b/third_party/blink/renderer/core/css/parser/css_tokenizer_test.cc index 01e31733..c70effc 100644 --- a/third_party/blink/renderer/core/css/parser/css_tokenizer_test.cc +++ b/third_party/blink/renderer/core/css/parser/css_tokenizer_test.cc
@@ -139,25 +139,27 @@ } DEFINE_TOKEN(Whitespace, (kWhitespaceToken)) -DEFINE_TOKEN(Colon, (kColonToken)); -DEFINE_TOKEN(Semicolon, (kSemicolonToken)); -DEFINE_TOKEN(Comma, (kCommaToken)); -DEFINE_TOKEN(IncludeMatch, (kIncludeMatchToken)); -DEFINE_TOKEN(DashMatch, (kDashMatchToken)); -DEFINE_TOKEN(PrefixMatch, (kPrefixMatchToken)); -DEFINE_TOKEN(SuffixMatch, (kSuffixMatchToken)); -DEFINE_TOKEN(SubstringMatch, (kSubstringMatchToken)); -DEFINE_TOKEN(Column, (kColumnToken)); -DEFINE_TOKEN(Cdo, (kCDOToken)); -DEFINE_TOKEN(Cdc, (kCDCToken)); -DEFINE_TOKEN(LeftParenthesis, (kLeftParenthesisToken)); -DEFINE_TOKEN(RightParenthesis, (kRightParenthesisToken)); -DEFINE_TOKEN(LeftBracket, (kLeftBracketToken)); -DEFINE_TOKEN(RightBracket, (kRightBracketToken)); -DEFINE_TOKEN(LeftBrace, (kLeftBraceToken)); -DEFINE_TOKEN(RightBrace, (kRightBraceToken)); -DEFINE_TOKEN(BadString, (kBadStringToken)); -DEFINE_TOKEN(BadUrl, (kBadUrlToken)); +DEFINE_TOKEN(Colon, (kColonToken)) +DEFINE_TOKEN(Semicolon, (kSemicolonToken)) +DEFINE_TOKEN(Comma, (kCommaToken)) +DEFINE_TOKEN(IncludeMatch, (kIncludeMatchToken)) +DEFINE_TOKEN(DashMatch, (kDashMatchToken)) +DEFINE_TOKEN(PrefixMatch, (kPrefixMatchToken)) +DEFINE_TOKEN(SuffixMatch, (kSuffixMatchToken)) +DEFINE_TOKEN(SubstringMatch, (kSubstringMatchToken)) +DEFINE_TOKEN(Column, (kColumnToken)) +DEFINE_TOKEN(Cdo, (kCDOToken)) +DEFINE_TOKEN(Cdc, (kCDCToken)) +DEFINE_TOKEN(LeftParenthesis, (kLeftParenthesisToken)) +DEFINE_TOKEN(RightParenthesis, (kRightParenthesisToken)) +DEFINE_TOKEN(LeftBracket, (kLeftBracketToken)) +DEFINE_TOKEN(RightBracket, (kRightBracketToken)) +DEFINE_TOKEN(LeftBrace, (kLeftBraceToken)) +DEFINE_TOKEN(RightBrace, (kRightBraceToken)) +DEFINE_TOKEN(BadString, (kBadStringToken)) +DEFINE_TOKEN(BadUrl, (kBadUrlToken)) + +#undef DEFINE_TOKEN String FromUChar32(UChar32 c) { StringBuilder input;
diff --git a/third_party/blink/renderer/core/css/selector_query_test.cc b/third_party/blink/renderer/core/css/selector_query_test.cc index b30d942..bd11f1cd 100644 --- a/third_party/blink/renderer/core/css/selector_query_test.cc +++ b/third_party/blink/renderer/core/css/selector_query_test.cc
@@ -58,7 +58,7 @@ #endif } } -}; // namespace +} // namespace TEST(SelectorQueryTest, NotMatchingPseudoElement) { Document* document = Document::CreateForTest();
diff --git a/third_party/blink/renderer/core/dom/container_node.cc b/third_party/blink/renderer/core/dom/container_node.cc index 724be268..73232d4 100644 --- a/third_party/blink/renderer/core/dom/container_node.cc +++ b/third_party/blink/renderer/core/dom/container_node.cc
@@ -688,6 +688,10 @@ WillRemoveChild(*child); + // TODO(crbug.com/927646): |WillRemoveChild()| may dispatch events that set + // focus to a node that will be detached, leaving behind a detached focused + // node. Fix it. + // Mutation events might have moved this child into a different parent. if (child->parentNode() != this) { exception_state.ThrowDOMException(
diff --git a/third_party/blink/renderer/core/dom/create_element_flags.h b/third_party/blink/renderer/core/dom/create_element_flags.h index 83b59b73..aea3a5c 100644 --- a/third_party/blink/renderer/core/dom/create_element_flags.h +++ b/third_party/blink/renderer/core/dom/create_element_flags.h
@@ -17,7 +17,7 @@ bool IsCustomElementsV0() const { return custom_elements_v0_; } bool WasAlreadyStarted() const { return already_started_; } - // https://html.spec.whatwg.org/#create-an-element-for-the-token + // https://html.spec.whatwg.org/C/#create-an-element-for-the-token static CreateElementFlags ByParser() { return CreateElementFlags().SetCreatedByParser(true); } @@ -36,7 +36,7 @@ return CreateElementFlags().SetCustomElementsV0Only(); } - // https://html.spec.whatwg.org/#create-an-element-for-the-token + // https://html.spec.whatwg.org/C/#create-an-element-for-the-token static CreateElementFlags ByFragmentParser() { return CreateElementFlags() .SetCreatedByParser(true)
diff --git a/third_party/blink/renderer/core/dom/document.h b/third_party/blink/renderer/core/dom/document.h index 8ade6a4f..8818bea 100644 --- a/third_party/blink/renderer/core/dom/document.h +++ b/third_party/blink/renderer/core/dom/document.h
@@ -610,7 +610,7 @@ void close(); // Corresponds to "9. Abort the active document of browsingContext." - // https://html.spec.whatwg.org/#navigate + // https://html.spec.whatwg.org/C/#navigate void Abort(); void CheckCompleted();
diff --git a/third_party/blink/renderer/core/dom/document.idl b/third_party/blink/renderer/core/dom/document.idl index df10119..c28eba7 100644 --- a/third_party/blink/renderer/core/dom/document.idl +++ b/third_party/blink/renderer/core/dom/document.idl
@@ -85,7 +85,7 @@ [RaisesException=Setter, MeasureAs=DocumentXMLStandalone] attribute boolean xmlStandalone; // HTML - // https://html.spec.whatwg.org/#the-document-object + // https://html.spec.whatwg.org/C/#the-document-object // resource metadata management @@ -141,7 +141,7 @@ [LenientThis] attribute EventHandler onreadystatechange; // HTML obsolete features - // https://html.spec.whatwg.org/#Document-partial + // https://html.spec.whatwg.org/C/#Document-partial [Measure] readonly attribute HTMLCollection anchors; [Measure] readonly attribute HTMLCollection applets;
diff --git a/third_party/blink/renderer/core/dom/dom_string_map.idl b/third_party/blink/renderer/core/dom/dom_string_map.idl index 3e1378d..4c3ef5c 100644 --- a/third_party/blink/renderer/core/dom/dom_string_map.idl +++ b/third_party/blink/renderer/core/dom/dom_string_map.idl
@@ -23,7 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-domstringmap-interface +// https://html.spec.whatwg.org/C/#the-domstringmap-interface [ OverrideBuiltins
diff --git a/third_party/blink/renderer/core/dom/element_definition_options.idl b/third_party/blink/renderer/core/dom/element_definition_options.idl index adaf88ca..939b4d6 100644 --- a/third_party/blink/renderer/core/dom/element_definition_options.idl +++ b/third_party/blink/renderer/core/dom/element_definition_options.idl
@@ -1,7 +1,7 @@ // 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. -// Spec: https://html.spec.whatwg.org/#elementdefinitionoptions +// Spec: https://html.spec.whatwg.org/C/#elementdefinitionoptions dictionary ElementDefinitionOptions { DOMString? extends = null; sequence<CSSStyleSheet> styles;
diff --git a/third_party/blink/renderer/core/dom/function_string_callback.idl b/third_party/blink/renderer/core/dom/function_string_callback.idl index 9df2be61..147bcec3 100644 --- a/third_party/blink/renderer/core/dom/function_string_callback.idl +++ b/third_party/blink/renderer/core/dom/function_string_callback.idl
@@ -28,6 +28,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-datatransferitem-interface +// https://html.spec.whatwg.org/C/#the-datatransferitem-interface callback FunctionStringCallback = void (DOMString data);
diff --git a/third_party/blink/renderer/core/dom/global_event_handlers.idl b/third_party/blink/renderer/core/dom/global_event_handlers.idl index a6da520..268cb69f 100644 --- a/third_party/blink/renderer/core/dom/global_event_handlers.idl +++ b/third_party/blink/renderer/core/dom/global_event_handlers.idl
@@ -27,7 +27,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#globaleventhandlers +// https://html.spec.whatwg.org/C/#globaleventhandlers [ LegacyTreatAsPartialInterface,
diff --git a/third_party/blink/renderer/core/editing/finder/find_buffer_test.cc b/third_party/blink/renderer/core/editing/finder/find_buffer_test.cc index eb237c4..59cdd434 100644 --- a/third_party/blink/renderer/core/editing/finder/find_buffer_test.cc +++ b/third_party/blink/renderer/core/editing/finder/find_buffer_test.cc
@@ -421,7 +421,7 @@ EXPECT_EQ( 1u, buffer.FindMatches("a b c d e ", kCaseInsensitive)->CountForTesting()); -}; +} TEST_F(FindBufferTest, WhiteSpaceCollapsingPre) { SetBodyContent("<div style='white-space: pre;'>a \n b</div>");
diff --git a/third_party/blink/renderer/core/editing/frame_caret.cc b/third_party/blink/renderer/core/editing/frame_caret.cc index 95cce00..55e590d 100644 --- a/third_party/blink/renderer/core/editing/frame_caret.cc +++ b/third_party/blink/renderer/core/editing/frame_caret.cc
@@ -74,6 +74,7 @@ selection_editor_->ComputeVisibleSelectionInDOMTree(); if (!selection.IsCaret()) return PositionWithAffinity(); + DCHECK(selection.Start().IsValidFor(*frame_->GetDocument())); return PositionWithAffinity(selection.Start(), selection.Affinity()); }
diff --git a/third_party/blink/renderer/core/editing/local_caret_rect_test.cc b/third_party/blink/renderer/core/editing/local_caret_rect_test.cc index 547e2e8..562f569 100644 --- a/third_party/blink/renderer/core/editing/local_caret_rect_test.cc +++ b/third_party/blink/renderer/core/editing/local_caret_rect_test.cc
@@ -852,7 +852,7 @@ std::tie(position_rect, visible_position_rect) = GetLayoutRects(caret); EXPECT_EQ(LayoutRect(0, 10, 1, 10), position_rect); EXPECT_EQ(LayoutRect(0, 10, 1, 10), visible_position_rect); -}; +} TEST_P(ParameterizedLocalCaretRectTest, AfterLineBreakInPreBlockLTRLineRTL) { LoadAhem(); @@ -863,7 +863,7 @@ std::tie(position_rect, visible_position_rect) = GetLayoutRects(caret); EXPECT_EQ(LayoutRect(0, 10, 1, 10), position_rect); EXPECT_EQ(LayoutRect(0, 10, 1, 10), visible_position_rect); -}; +} TEST_P(ParameterizedLocalCaretRectTest, AfterLineBreakInPreBlockRTLLineLTR) { LoadAhem(); @@ -874,7 +874,7 @@ std::tie(position_rect, visible_position_rect) = GetLayoutRects(caret); EXPECT_EQ(LayoutRect(299, 10, 1, 10), position_rect); EXPECT_EQ(LayoutRect(299, 10, 1, 10), visible_position_rect); -}; +} TEST_P(ParameterizedLocalCaretRectTest, AfterLineBreakInPreBlockRTLLineRTL) { LoadAhem(); @@ -885,7 +885,7 @@ std::tie(position_rect, visible_position_rect) = GetLayoutRects(caret); EXPECT_EQ(LayoutRect(299, 10, 1, 10), position_rect); EXPECT_EQ(LayoutRect(299, 10, 1, 10), visible_position_rect); -}; +} // crbug.com/834686 TEST_P(ParameterizedLocalCaretRectTest, AfterTrimedLineBreak) { @@ -896,7 +896,7 @@ std::tie(position_rect, visible_position_rect) = GetLayoutRects(caret); EXPECT_EQ(LayoutRect(30, 0, 1, 10), position_rect); EXPECT_EQ(LayoutRect(30, 0, 1, 10), visible_position_rect); -}; +} TEST_P(ParameterizedLocalCaretRectTest, UnicodeBidiPlaintextWithDifferentBlockDirection) {
diff --git a/third_party/blink/renderer/core/editing/serializers/markup_accumulator.cc b/third_party/blink/renderer/core/editing/serializers/markup_accumulator.cc index ce26438c..0ae4b8eb 100644 --- a/third_party/blink/renderer/core/editing/serializers/markup_accumulator.cc +++ b/third_party/blink/renderer/core/editing/serializers/markup_accumulator.cc
@@ -154,8 +154,8 @@ // 3.5.1. Let candidate prefix be the result of retrieving a preferred // prefix string from map given namespace attribute namespace with preferred // prefix being attr's prefix value. - // TODO(tkent): Implement it. crbug.com/906807 - candidate_prefix = attribute.Prefix(); + candidate_prefix = + RetrievePreferredPrefixString(attribute_namespace, attribute.Prefix()); // 3.5.2. If the value of attribute namespace is the XMLNS namespace, then // run these steps: @@ -243,13 +243,16 @@ // We can't do |namespace_stack_.emplace_back(namespace_stack_.back())| // because back() returns a reference in the vector backing, and // emplace_back() can reallocate it. - namespace_stack_.push_back(Namespaces(namespace_stack_.back())); + namespace_stack_.push_back(PrefixToNamespaceMap(namespace_stack_.back())); + ns_prefixes_map_stack_.push_back( + NamespaceToPrefixesMap(ns_prefixes_map_stack_.back())); } void MarkupAccumulator::PopNamespaces(const Element& element) { if (SerializeAsHTMLDocument(element)) return; namespace_stack_.pop_back(); + ns_prefixes_map_stack_.pop_back(); } // https://w3c.github.io/DOM-Parsing/#dfn-recording-the-namespace-information @@ -262,10 +265,60 @@ } } +// https://w3c.github.io/DOM-Parsing/#dfn-retrieving-a-preferred-prefix-string +AtomicString MarkupAccumulator::RetrievePreferredPrefixString( + const AtomicString& ns, + const AtomicString& preferred_prefix) { + // TODO(tkent): We'll apply this function to elements too. + const bool kForAttribute = true; + AtomicString ns_for_preferred = LookupNamespaceURI(preferred_prefix); + // Preserve the prefix if the prefix is used in the scope and the namespace + // for it is matches to the node's one. + // This is equivalent to the following step in the specification: + // 2.1. If prefix matches preferred prefix, then stop running these steps and + // return prefix. + if ((!kForAttribute || !preferred_prefix.IsEmpty()) && + !ns_for_preferred.IsNull() && EqualIgnoringNullity(ns_for_preferred, ns)) + return preferred_prefix; + + const Vector<AtomicString>& candidate_list = + ns_prefixes_map_stack_.back().at(ns ? ns : g_empty_atom); + // Get the last effective prefix. + // + // <el1 xmlns:p="U1" xmlns:q="U1"> + // <el2 xmlns:q="U2"> + // el2.setAttributeNS(U1, 'n', 'v'); + // We should get 'p'. + // + // <el1 xmlns="U1"> + // el1.setAttributeNS(U1, 'n', 'v'); + // We should not get '' for attributes. + for (auto it = candidate_list.rbegin(); it != candidate_list.rend(); ++it) { + AtomicString candidate_prefix = *it; + if (kForAttribute && candidate_prefix.IsEmpty()) + continue; + AtomicString ns_for_candaite = LookupNamespaceURI(candidate_prefix); + if (EqualIgnoringNullity(ns_for_candaite, ns)) + return candidate_prefix; + } + + // No prefixes for |ns|. + // Preserve the prefix if the prefix is not used in the current scope. + if (!preferred_prefix.IsEmpty() && ns_for_preferred.IsNull()) + return preferred_prefix; + // If a prefix is not specified, or the prefix is mapped to a + // different namespace, we should generate new prefix. + return g_null_atom; +} + // https://w3c.github.io/DOM-Parsing/#dfn-add void MarkupAccumulator::AddPrefix(const AtomicString& prefix, const AtomicString& namespace_uri) { - namespace_stack_.back().Set(prefix ? prefix : g_empty_atom, namespace_uri); + const AtomicString& non_null_prefix = prefix ? prefix : g_empty_atom; + namespace_stack_.back().Set(non_null_prefix, namespace_uri); + auto result = ns_prefixes_map_stack_.back().insert( + namespace_uri ? namespace_uri : g_empty_atom, Vector<AtomicString>()); + result.stored_value->value.push_back(non_null_prefix); } AtomicString MarkupAccumulator::LookupNamespaceURI(const AtomicString& prefix) { @@ -370,6 +423,7 @@ DCHECK_EQ(namespace_stack_.size(), 0u); // 2. Let prefix map be a new namespace prefix map. namespace_stack_.emplace_back(); + ns_prefixes_map_stack_.emplace_back(); // 3. Add the XML namespace with prefix value "xml" to prefix map. AddPrefix(g_xml_atom, xml_names::kNamespaceURI); // 4. Let prefix index be a generated namespace prefix index with value 1.
diff --git a/third_party/blink/renderer/core/editing/serializers/markup_accumulator.h b/third_party/blink/renderer/core/editing/serializers/markup_accumulator.h index 2e1f2c3..ae4c8163 100644 --- a/third_party/blink/renderer/core/editing/serializers/markup_accumulator.h +++ b/third_party/blink/renderer/core/editing/serializers/markup_accumulator.h
@@ -42,8 +42,6 @@ class Element; class Node; -using Namespaces = HashMap<AtomicString, AtomicString>; - class MarkupAccumulator { STACK_ALLOCATED(); @@ -87,6 +85,8 @@ void PushNamespaces(const Element& element); void PopNamespaces(const Element& element); void RecordNamespaceInformation(const Element& element); + AtomicString RetrievePreferredPrefixString(const AtomicString& ns, + const AtomicString& prefix); void AddPrefix(const AtomicString& prefix, const AtomicString& namespace_uri); AtomicString LookupNamespaceURI(const AtomicString& prefix); AtomicString GeneratePrefix(const AtomicString& new_namespace); @@ -107,8 +107,13 @@ template <typename Strategy> void SerializeNodesWithNamespaces(const Node& target_node, EChildrenOnly children_only); - - Vector<Namespaces> namespace_stack_; + using PrefixToNamespaceMap = HashMap<AtomicString, AtomicString>; + using NamespaceToPrefixesMap = HashMap<AtomicString, Vector<AtomicString>>; + // TODO(tkent): Make a class consists of these two maps. + Vector<PrefixToNamespaceMap> namespace_stack_; + // Map a namespace URI to a list of prefixes. + // https://w3c.github.io/DOM-Parsing/#the-namespace-prefix-map + Vector<NamespaceToPrefixesMap> ns_prefixes_map_stack_; // https://w3c.github.io/DOM-Parsing/#dfn-generated-namespace-prefix-index uint32_t prefix_index_;
diff --git a/third_party/blink/renderer/core/events/before_unload_event.idl b/third_party/blink/renderer/core/events/before_unload_event.idl index 0495a685..fe704d27 100644 --- a/third_party/blink/renderer/core/events/before_unload_event.idl +++ b/third_party/blink/renderer/core/events/before_unload_event.idl
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-beforeunloadevent-interface +// https://html.spec.whatwg.org/C/#the-beforeunloadevent-interface [Exposed=Window] interface BeforeUnloadEvent : Event {
diff --git a/third_party/blink/renderer/core/exported/web_view_test.cc b/third_party/blink/renderer/core/exported/web_view_test.cc index 2c2b5e7..d9747bcdf 100644 --- a/third_party/blink/renderer/core/exported/web_view_test.cc +++ b/third_party/blink/renderer/core/exported/web_view_test.cc
@@ -4115,7 +4115,7 @@ // This EXPECT is merely a dummy. The real test is that we don't trigger // asserts in debug builds. EXPECT_FALSE(frame_view->NeedsLayout()); -}; +} TEST_F(WebViewTest, PreferredSize) { std::string url = base_url_ + "specify_size.html?100px:100px";
diff --git a/third_party/blink/renderer/core/frame/bar_prop.idl b/third_party/blink/renderer/core/frame/bar_prop.idl index 433d23a9..6bd3b1c 100644 --- a/third_party/blink/renderer/core/frame/bar_prop.idl +++ b/third_party/blink/renderer/core/frame/bar_prop.idl
@@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#barprop +// https://html.spec.whatwg.org/C/#barprop interface BarProp { readonly attribute boolean visible;
diff --git a/third_party/blink/renderer/core/frame/csp/csp_directive_list.cc b/third_party/blink/renderer/core/frame/csp/csp_directive_list.cc index 0e3acb4..544877f8 100644 --- a/third_party/blink/renderer/core/frame/csp/csp_directive_list.cc +++ b/third_party/blink/renderer/core/frame/csp/csp_directive_list.cc
@@ -1249,7 +1249,7 @@ } // Remove report-uri in meta policies, per - // https://html.spec.whatwg.org/#attr-meta-http-equiv-content-security-policy. + // https://html.spec.whatwg.org/C/#attr-meta-http-equiv-content-security-policy. if (header_source_ == kContentSecurityPolicyHeaderSourceMeta) { policy_->ReportInvalidDirectiveInMeta(name); return;
diff --git a/third_party/blink/renderer/core/frame/dom_timer_coordinator.h b/third_party/blink/renderer/core/frame/dom_timer_coordinator.h index e15c6c5..645fee38 100644 --- a/third_party/blink/renderer/core/frame/dom_timer_coordinator.h +++ b/third_party/blink/renderer/core/frame/dom_timer_coordinator.h
@@ -43,7 +43,7 @@ // Timers created during the execution of other timers, and // repeating timers, are throttled. Timer nesting level tracks the // number of linked timers or repetitions of a timer. See - // https://html.spec.whatwg.org/#timers + // https://html.spec.whatwg.org/C/#timers int TimerNestingLevel() { return timer_nesting_level_; } // Sets the timer nesting level. Set when a timer executes so that
diff --git a/third_party/blink/renderer/core/frame/history.idl b/third_party/blink/renderer/core/frame/history.idl index 1d3633d..182cfa0 100644 --- a/third_party/blink/renderer/core/frame/history.idl +++ b/third_party/blink/renderer/core/frame/history.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-history-interface +// https://html.spec.whatwg.org/C/#the-history-interface enum ScrollRestoration {"auto", "manual"};
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 ea408742..33268ed 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
@@ -327,7 +327,7 @@ void LocalDOMWindow::EnqueueHashchangeEvent(const String& old_url, const String& new_url) { - // https://html.spec.whatwg.org/#history-traversal + // https://html.spec.whatwg.org/C/#history-traversal EnqueueWindowEvent(*HashChangeEvent::Create(old_url, new_url), TaskType::kDOMManipulation); }
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.h b/third_party/blink/renderer/core/frame/local_dom_window.h index 21ab263..9ba2007 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.h +++ b/third_party/blink/renderer/core/frame/local_dom_window.h
@@ -228,7 +228,7 @@ int webkitRequestAnimationFrame(V8FrameRequestCallback*); void cancelAnimationFrame(int id); - // https://html.spec.whatwg.org/#windoworworkerglobalscope-mixin + // https://html.spec.whatwg.org/C/#windoworworkerglobalscope-mixin void queueMicrotask(V8VoidFunction*); // Idle callback extensions
diff --git a/third_party/blink/renderer/core/frame/location.cc b/third_party/blink/renderer/core/frame/location.cc index 24cb53f..10200bd 100644 --- a/third_party/blink/renderer/core/frame/location.cc +++ b/third_party/blink/renderer/core/frame/location.cc
@@ -291,9 +291,9 @@ return; // Check the source browsing context's CSP to fulfill the CSP check - // requirement of https://html.spec.whatwg.org/#navigate for javascript URLs. - // Although the spec states we should perform this check on task execution, - // we do this prior to dispatch since the parent frame's CSP may be + // requirement of https://html.spec.whatwg.org/C/#navigate for javascript + // URLs. Although the spec states we should perform this check on task + // execution, we do this prior to dispatch since the parent frame's CSP may be // inaccessible if the target frame is out of process. Document* current_document = current_window->document(); if (current_document && completed_url.ProtocolIsJavaScript() &&
diff --git a/third_party/blink/renderer/core/frame/navigator.idl b/third_party/blink/renderer/core/frame/navigator.idl index 4738819..abb8330 100644 --- a/third_party/blink/renderer/core/frame/navigator.idl +++ b/third_party/blink/renderer/core/frame/navigator.idl
@@ -17,7 +17,7 @@ Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-navigator-object +// https://html.spec.whatwg.org/C/#the-navigator-object interface Navigator { // objects implementing this interface also implement the interfaces given below
diff --git a/third_party/blink/renderer/core/frame/navigator_id.idl b/third_party/blink/renderer/core/frame/navigator_id.idl index 9e60756..a402a6968 100644 --- a/third_party/blink/renderer/core/frame/navigator_id.idl +++ b/third_party/blink/renderer/core/frame/navigator_id.idl
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#client-identification +// https://html.spec.whatwg.org/C/#client-identification [ NoInterfaceObject, // Always used on target of 'implements'
diff --git a/third_party/blink/renderer/core/frame/navigator_language.idl b/third_party/blink/renderer/core/frame/navigator_language.idl index f587304..7a72f53 100644 --- a/third_party/blink/renderer/core/frame/navigator_language.idl +++ b/third_party/blink/renderer/core/frame/navigator_language.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/#language-preferences +// https://html.spec.whatwg.org/C/#language-preferences [ NoInterfaceObject,
diff --git a/third_party/blink/renderer/core/frame/navigator_on_line.idl b/third_party/blink/renderer/core/frame/navigator_on_line.idl index d9f71c1..16dda054 100644 --- a/third_party/blink/renderer/core/frame/navigator_on_line.idl +++ b/third_party/blink/renderer/core/frame/navigator_on_line.idl
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#navigator.online +// https://html.spec.whatwg.org/C/#navigator.online [ NoInterfaceObject, // Always used on target of 'implements'
diff --git a/third_party/blink/renderer/core/frame/window.idl b/third_party/blink/renderer/core/frame/window.idl index a0396aac..51138a27 100644 --- a/third_party/blink/renderer/core/frame/window.idl +++ b/third_party/blink/renderer/core/frame/window.idl
@@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-window-object +// https://html.spec.whatwg.org/C/#the-window-object // FIXME: explain all uses of [CrossOrigin] [ @@ -88,7 +88,7 @@ [CrossOrigin, CallWith=Isolate, RaisesException] void postMessage(any message, optional WindowPostMessageOptions options); // WindowOrWorkerGlobalScope mixin - // https://html.spec.whatwg.org/#windoworworkerglobalscope-mixin + // https://html.spec.whatwg.org/C/#windoworworkerglobalscope-mixin [Replaceable] readonly attribute DOMString origin; void queueMicrotask(VoidFunction callback); @@ -98,7 +98,7 @@ void cancelAnimationFrame(long handle); // HTML obsolete features - // https://html.spec.whatwg.org/#Window-partial + // https://html.spec.whatwg.org/C/#Window-partial [MeasureAs=WindowCaptureEvents] void captureEvents(); [MeasureAs=WindowReleaseEvents] void releaseEvents();
diff --git a/third_party/blink/renderer/core/frame/window_or_worker_global_scope.idl b/third_party/blink/renderer/core/frame/window_or_worker_global_scope.idl index e19ec9076..219aab54 100644 --- a/third_party/blink/renderer/core/frame/window_or_worker_global_scope.idl +++ b/third_party/blink/renderer/core/frame/window_or_worker_global_scope.idl
@@ -28,7 +28,7 @@ // https://html.spec.whatwg.org/C/webappapis.html#windoworworkerglobalscope-mixin // https://html.spec.whatwg.org/C/timers-and-user-prompts.html#timers -// https://html.spec.whatwg.org/#imagebitmapsource +// https://html.spec.whatwg.org/C/#imagebitmapsource typedef (HTMLImageElement or SVGImageElement or HTMLVideoElement or
diff --git a/third_party/blink/renderer/core/html/canvas/image_data.idl b/third_party/blink/renderer/core/html/canvas/image_data.idl index 03bf6e3..45eace16 100644 --- a/third_party/blink/renderer/core/html/canvas/image_data.idl +++ b/third_party/blink/renderer/core/html/canvas/image_data.idl
@@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#dom-imagedata +// https://html.spec.whatwg.org/C/#dom-imagedata // https://github.com/WICG/canvas-color-space/blob/master/CanvasColorSpaceProposal.md#imagedata typedef (Uint8ClampedArray or Uint16Array or Float32Array) ImageDataArray;
diff --git a/third_party/blink/renderer/core/html/canvas/text_metrics.idl b/third_party/blink/renderer/core/html/canvas/text_metrics.idl index 79446ef..b837104 100644 --- a/third_party/blink/renderer/core/html/canvas/text_metrics.idl +++ b/third_party/blink/renderer/core/html/canvas/text_metrics.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#textmetrics +// https://html.spec.whatwg.org/C/#textmetrics // TODO(foolip): Exposed=(Window,Worker) interface TextMetrics {
diff --git a/third_party/blink/renderer/core/html/custom/custom_element.h b/third_party/blink/renderer/core/html/custom/custom_element.h index 05334196..e5bfe62 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element.h +++ b/third_party/blink/renderer/core/html/custom/custom_element.h
@@ -123,7 +123,7 @@ // Some existing specs have element names with hyphens in them, // like font-face in SVG. The custom elements spec explicitly // disallows these as custom element names. - // https://html.spec.whatwg.org/#valid-custom-element-name + // https://html.spec.whatwg.org/C/#valid-custom-element-name static bool IsHyphenatedSpecElementName(const AtomicString&); static Vector<AtomicString>& EmbedderCustomElementNames();
diff --git a/third_party/blink/renderer/core/html/forms/html_button_element.idl b/third_party/blink/renderer/core/html/forms/html_button_element.idl index 4b9d00ea..e872816f7 100644 --- a/third_party/blink/renderer/core/html/forms/html_button_element.idl +++ b/third_party/blink/renderer/core/html/forms/html_button_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-button-element +// https://html.spec.whatwg.org/C/#the-button-element [HTMLConstructor] interface HTMLButtonElement : HTMLElement { [CEReactions, Reflect] attribute boolean autofocus;
diff --git a/third_party/blink/renderer/core/html/forms/html_data_list_element.idl b/third_party/blink/renderer/core/html/forms/html_data_list_element.idl index 46de4a0a..84358a8a 100644 --- a/third_party/blink/renderer/core/html/forms/html_data_list_element.idl +++ b/third_party/blink/renderer/core/html/forms/html_data_list_element.idl
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-datalist-element +// https://html.spec.whatwg.org/C/#the-datalist-element [HTMLConstructor] interface HTMLDataListElement : HTMLElement { readonly attribute HTMLCollection options;
diff --git a/third_party/blink/renderer/core/html/forms/html_field_set_element.idl b/third_party/blink/renderer/core/html/forms/html_field_set_element.idl index 69b3aff..66adce58 100644 --- a/third_party/blink/renderer/core/html/forms/html_field_set_element.idl +++ b/third_party/blink/renderer/core/html/forms/html_field_set_element.idl
@@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-fieldset-element +// https://html.spec.whatwg.org/C/#the-fieldset-element [HTMLConstructor] interface HTMLFieldSetElement : HTMLElement { [CEReactions, Reflect] attribute boolean disabled;
diff --git a/third_party/blink/renderer/core/html/forms/html_form_controls_collection.idl b/third_party/blink/renderer/core/html/forms/html_form_controls_collection.idl index 674ee55..8a084be 100644 --- a/third_party/blink/renderer/core/html/forms/html_form_controls_collection.idl +++ b/third_party/blink/renderer/core/html/forms/html_form_controls_collection.idl
@@ -19,7 +19,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-htmlformcontrolscollection-interface +// https://html.spec.whatwg.org/C/#the-htmlformcontrolscollection-interface interface HTMLFormControlsCollection : HTMLCollection { // inherits length and item()
diff --git a/third_party/blink/renderer/core/html/forms/html_form_element.idl b/third_party/blink/renderer/core/html/forms/html_form_element.idl index 0571723..e91fbd5 100644 --- a/third_party/blink/renderer/core/html/forms/html_form_element.idl +++ b/third_party/blink/renderer/core/html/forms/html_form_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-form-element +// https://html.spec.whatwg.org/C/#the-form-element [ HTMLConstructor,
diff --git a/third_party/blink/renderer/core/html/forms/html_input_element.idl b/third_party/blink/renderer/core/html/forms/html_input_element.idl index 340d2afb..0d9b7a2 100644 --- a/third_party/blink/renderer/core/html/forms/html_input_element.idl +++ b/third_party/blink/renderer/core/html/forms/html_input_element.idl
@@ -19,7 +19,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-input-element +// https://html.spec.whatwg.org/C/#the-input-element enum SelectionMode { "select", "start", "end", "preserve" }; @@ -96,7 +96,7 @@ optional DOMString direction); // obsolete members - // https://html.spec.whatwg.org/#HTMLInputElement-partial + // https://html.spec.whatwg.org/C/#HTMLInputElement-partial [CEReactions, Reflect] attribute DOMString align; [CEReactions, Reflect] attribute DOMString useMap;
diff --git a/third_party/blink/renderer/core/html/forms/html_label_element.idl b/third_party/blink/renderer/core/html/forms/html_label_element.idl index 254cbd9..39f1eba 100644 --- a/third_party/blink/renderer/core/html/forms/html_label_element.idl +++ b/third_party/blink/renderer/core/html/forms/html_label_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-label-element +// https://html.spec.whatwg.org/C/#the-label-element [HTMLConstructor] interface HTMLLabelElement : HTMLElement { readonly attribute HTMLFormElement? form;
diff --git a/third_party/blink/renderer/core/html/forms/html_legend_element.idl b/third_party/blink/renderer/core/html/forms/html_legend_element.idl index 909b3ab1..b20b50e 100644 --- a/third_party/blink/renderer/core/html/forms/html_legend_element.idl +++ b/third_party/blink/renderer/core/html/forms/html_legend_element.idl
@@ -18,12 +18,12 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-legend-element +// https://html.spec.whatwg.org/C/#the-legend-element [HTMLConstructor] interface HTMLLegendElement : HTMLElement { readonly attribute HTMLFormElement? form; // obsolete members - // https://html.spec.whatwg.org/#HTMLLegendElement-partial + // https://html.spec.whatwg.org/C/#HTMLLegendElement-partial [CEReactions, Reflect] attribute DOMString align; };
diff --git a/third_party/blink/renderer/core/html/forms/html_opt_group_element.idl b/third_party/blink/renderer/core/html/forms/html_opt_group_element.idl index 91f7a64..60ede69 100644 --- a/third_party/blink/renderer/core/html/forms/html_opt_group_element.idl +++ b/third_party/blink/renderer/core/html/forms/html_opt_group_element.idl
@@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-optgroup-element +// https://html.spec.whatwg.org/C/#the-optgroup-element [HTMLConstructor] interface HTMLOptGroupElement : HTMLElement { [CEReactions, Reflect] attribute boolean disabled;
diff --git a/third_party/blink/renderer/core/html/forms/html_option_element.idl b/third_party/blink/renderer/core/html/forms/html_option_element.idl index 39c2fe2..638e3af 100644 --- a/third_party/blink/renderer/core/html/forms/html_option_element.idl +++ b/third_party/blink/renderer/core/html/forms/html_option_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-option-element +// https://html.spec.whatwg.org/C/#the-option-element [ HTMLConstructor,
diff --git a/third_party/blink/renderer/core/html/forms/html_options_collection.idl b/third_party/blink/renderer/core/html/forms/html_options_collection.idl index 2d02067..a78ff41 100644 --- a/third_party/blink/renderer/core/html/forms/html_options_collection.idl +++ b/third_party/blink/renderer/core/html/forms/html_options_collection.idl
@@ -19,7 +19,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-htmloptionscollection-interface +// https://html.spec.whatwg.org/C/#the-htmloptionscollection-interface interface HTMLOptionsCollection : HTMLCollection { // Inherits item() and namedItem()
diff --git a/third_party/blink/renderer/core/html/forms/html_output_element.idl b/third_party/blink/renderer/core/html/forms/html_output_element.idl index e647169..50a38fb 100644 --- a/third_party/blink/renderer/core/html/forms/html_output_element.idl +++ b/third_party/blink/renderer/core/html/forms/html_output_element.idl
@@ -23,7 +23,7 @@ * DAMAGE. */ -// https://html.spec.whatwg.org/#the-output-element +// https://html.spec.whatwg.org/C/#the-output-element [HTMLConstructor] interface HTMLOutputElement : HTMLElement { [PutForwards=value] readonly attribute DOMTokenList htmlFor;
diff --git a/third_party/blink/renderer/core/html/forms/html_select_element.idl b/third_party/blink/renderer/core/html/forms/html_select_element.idl index 3f0616e..4e43cd41 100644 --- a/third_party/blink/renderer/core/html/forms/html_select_element.idl +++ b/third_party/blink/renderer/core/html/forms/html_select_element.idl
@@ -19,7 +19,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-select-element +// https://html.spec.whatwg.org/C/#the-select-element [HTMLConstructor] interface HTMLSelectElement : HTMLElement { [CEReactions, ImplementedAs=IDLExposedAutofillValue] attribute DOMString autocomplete;
diff --git a/third_party/blink/renderer/core/html/forms/html_text_area_element.idl b/third_party/blink/renderer/core/html/forms/html_text_area_element.idl index 781b614..c06bd0d9 100644 --- a/third_party/blink/renderer/core/html/forms/html_text_area_element.idl +++ b/third_party/blink/renderer/core/html/forms/html_text_area_element.idl
@@ -19,7 +19,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-textarea-element +// https://html.spec.whatwg.org/C/#the-textarea-element [HTMLConstructor] interface HTMLTextAreaElement : HTMLElement { [CEReactions, ImplementedAs=IDLExposedAutofillValue] attribute DOMString autocomplete;
diff --git a/third_party/blink/renderer/core/html/forms/radio_node_list.idl b/third_party/blink/renderer/core/html/forms/radio_node_list.idl index 3f7fde9..ab299bf18 100644 --- a/third_party/blink/renderer/core/html/forms/radio_node_list.idl +++ b/third_party/blink/renderer/core/html/forms/radio_node_list.idl
@@ -23,7 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#radionodelist +// https://html.spec.whatwg.org/C/#radionodelist [ Exposed=Window
diff --git a/third_party/blink/renderer/core/html/forms/text_control_element.cc b/third_party/blink/renderer/core/html/forms/text_control_element.cc index add2d09..3eec0b9 100644 --- a/third_party/blink/renderer/core/html/forms/text_control_element.cc +++ b/third_party/blink/renderer/core/html/forms/text_control_element.cc
@@ -429,7 +429,9 @@ direction = kSelectionHasForwardDirection; bool did_change = CacheSelection(start, end, direction); - if (GetDocument().FocusedElement() != this) + // TODO(crbug.com/927646): The focused element should always be connected, but + // we fail to ensure so in some cases. Fix it. + if (GetDocument().FocusedElement() != this || !isConnected()) return did_change; HTMLElement* inner_editor = InnerEditorElement();
diff --git a/third_party/blink/renderer/core/html/forms/validity_state.idl b/third_party/blink/renderer/core/html/forms/validity_state.idl index 117bb925..5c5d868 100644 --- a/third_party/blink/renderer/core/html/forms/validity_state.idl +++ b/third_party/blink/renderer/core/html/forms/validity_state.idl
@@ -20,7 +20,7 @@ * */ -// https://html.spec.whatwg.org/#validitystate +// https://html.spec.whatwg.org/C/#validitystate interface ValidityState { readonly attribute boolean valueMissing;
diff --git a/third_party/blink/renderer/core/html/html_all_collection.idl b/third_party/blink/renderer/core/html/html_all_collection.idl index 7fc8fb9d..76d3170 100644 --- a/third_party/blink/renderer/core/html/html_all_collection.idl +++ b/third_party/blink/renderer/core/html/html_all_collection.idl
@@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-htmlallcollection-interface +// https://html.spec.whatwg.org/C/#the-htmlallcollection-interface [ Custom=LegacyCallAsFunction,
diff --git a/third_party/blink/renderer/core/html/html_anchor_element.idl b/third_party/blink/renderer/core/html/html_anchor_element.idl index 9d3bf75..2cd0d37 100644 --- a/third_party/blink/renderer/core/html/html_anchor_element.idl +++ b/third_party/blink/renderer/core/html/html_anchor_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-a-element +// https://html.spec.whatwg.org/C/#the-a-element [HTMLConstructor] interface HTMLAnchorElement : HTMLElement { [CEReactions, Reflect] attribute DOMString target; @@ -34,7 +34,7 @@ [CEReactions, ImplementedAs=textContent] attribute DOMString text; // obsolete members - // https://html.spec.whatwg.org/#HTMLAnchorElement-partial + // https://html.spec.whatwg.org/C/#HTMLAnchorElement-partial [CEReactions, Reflect] attribute DOMString coords; [CEReactions, Reflect] attribute DOMString charset; [CEReactions, Reflect] attribute DOMString name;
diff --git a/third_party/blink/renderer/core/html/html_area_element.idl b/third_party/blink/renderer/core/html/html_area_element.idl index 301cca50..468cda2 100644 --- a/third_party/blink/renderer/core/html/html_area_element.idl +++ b/third_party/blink/renderer/core/html/html_area_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-area-element +// https://html.spec.whatwg.org/C/#the-area-element [HTMLConstructor] interface HTMLAreaElement : HTMLElement { [CEReactions, Reflect] attribute DOMString alt; @@ -32,7 +32,7 @@ [CEReactions, Reflect, ReflectOnly=("","no-referrer","origin","no-referrer-when-downgrade","origin-when-cross-origin","unsafe-url"), ReflectMissing="", ReflectInvalid=""] attribute DOMString referrerPolicy; // obsolete members - // https://html.spec.whatwg.org/#HTMLAreaElement-partial + // https://html.spec.whatwg.org/C/#HTMLAreaElement-partial [CEReactions, Reflect] attribute boolean noHref; };
diff --git a/third_party/blink/renderer/core/html/html_base_element.idl b/third_party/blink/renderer/core/html/html_base_element.idl index d615212..5d6fec7 100644 --- a/third_party/blink/renderer/core/html/html_base_element.idl +++ b/third_party/blink/renderer/core/html/html_base_element.idl
@@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-base-element +// https://html.spec.whatwg.org/C/#the-base-element [HTMLConstructor] interface HTMLBaseElement : HTMLElement { [CEReactions, RaisesException=Setter] attribute URLString href;
diff --git a/third_party/blink/renderer/core/html/html_body_element.idl b/third_party/blink/renderer/core/html/html_body_element.idl index e886a376..da075c8 100644 --- a/third_party/blink/renderer/core/html/html_body_element.idl +++ b/third_party/blink/renderer/core/html/html_body_element.idl
@@ -18,11 +18,11 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-body-element +// https://html.spec.whatwg.org/C/#the-body-element [HTMLConstructor] interface HTMLBodyElement : HTMLElement { // obsolete members - // https://html.spec.whatwg.org/#HTMLBodyElement-partial + // https://html.spec.whatwg.org/C/#HTMLBodyElement-partial [CEReactions, Reflect] attribute [TreatNullAs=EmptyString] DOMString text; [CEReactions, Reflect] attribute [TreatNullAs=EmptyString] DOMString link; [CEReactions, Reflect] attribute [TreatNullAs=EmptyString] DOMString vLink;
diff --git a/third_party/blink/renderer/core/html/html_br_element.idl b/third_party/blink/renderer/core/html/html_br_element.idl index c1072e9..22ebfae 100644 --- a/third_party/blink/renderer/core/html/html_br_element.idl +++ b/third_party/blink/renderer/core/html/html_br_element.idl
@@ -17,10 +17,10 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-br-element +// https://html.spec.whatwg.org/C/#the-br-element [HTMLConstructor] interface HTMLBRElement : HTMLElement { // obsolete members - // https://html.spec.whatwg.org/#HTMLBRElement-partial + // https://html.spec.whatwg.org/C/#HTMLBRElement-partial [CEReactions, Reflect] attribute DOMString clear; };
diff --git a/third_party/blink/renderer/core/html/html_details_element.idl b/third_party/blink/renderer/core/html/html_details_element.idl index e7e6ea0..70eb7308 100644 --- a/third_party/blink/renderer/core/html/html_details_element.idl +++ b/third_party/blink/renderer/core/html/html_details_element.idl
@@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-details-element +// https://html.spec.whatwg.org/C/#the-details-element [HTMLConstructor] interface HTMLDetailsElement : HTMLElement { [CEReactions, Reflect] attribute boolean open;
diff --git a/third_party/blink/renderer/core/html/html_dialog_element.cc b/third_party/blink/renderer/core/html/html_dialog_element.cc index 7b1edb6..4a604879 100644 --- a/third_party/blink/renderer/core/html/html_dialog_element.cc +++ b/third_party/blink/renderer/core/html/html_dialog_element.cc
@@ -106,7 +106,7 @@ DEFINE_NODE_FACTORY(HTMLDialogElement) void HTMLDialogElement::close(const String& return_value) { - // https://html.spec.whatwg.org/#close-the-dialog + // https://html.spec.whatwg.org/C/#close-the-dialog if (!FastHasAttribute(kOpenAttr)) return;
diff --git a/third_party/blink/renderer/core/html/html_dialog_element.idl b/third_party/blink/renderer/core/html/html_dialog_element.idl index 44db2a57..2a69508 100644 --- a/third_party/blink/renderer/core/html/html_dialog_element.idl +++ b/third_party/blink/renderer/core/html/html_dialog_element.idl
@@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-dialog-element +// https://html.spec.whatwg.org/C/#the-dialog-element [HTMLConstructor] interface HTMLDialogElement : HTMLElement { [CEReactions, Reflect] attribute boolean open;
diff --git a/third_party/blink/renderer/core/html/html_directory_element.idl b/third_party/blink/renderer/core/html/html_directory_element.idl index 4dcd8a0..58b0922 100644 --- a/third_party/blink/renderer/core/html/html_directory_element.idl +++ b/third_party/blink/renderer/core/html/html_directory_element.idl
@@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#htmldirectoryelement +// https://html.spec.whatwg.org/C/#htmldirectoryelement [HTMLConstructor] interface HTMLDirectoryElement : HTMLElement { [CEReactions, Reflect] attribute boolean compact;
diff --git a/third_party/blink/renderer/core/html/html_div_element.idl b/third_party/blink/renderer/core/html/html_div_element.idl index 2eb1215..04a0751 100644 --- a/third_party/blink/renderer/core/html/html_div_element.idl +++ b/third_party/blink/renderer/core/html/html_div_element.idl
@@ -17,10 +17,10 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-div-element +// https://html.spec.whatwg.org/C/#the-div-element [HTMLConstructor] interface HTMLDivElement : HTMLElement { // obsolete members - // https://html.spec.whatwg.org/#HTMLDivElement-partial + // https://html.spec.whatwg.org/C/#HTMLDivElement-partial [CEReactions, Reflect] attribute DOMString align; };
diff --git a/third_party/blink/renderer/core/html/html_dlist_element.idl b/third_party/blink/renderer/core/html/html_dlist_element.idl index c798d04a..ef594e14 100644 --- a/third_party/blink/renderer/core/html/html_dlist_element.idl +++ b/third_party/blink/renderer/core/html/html_dlist_element.idl
@@ -17,10 +17,10 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-dl-element +// https://html.spec.whatwg.org/C/#the-dl-element [HTMLConstructor] interface HTMLDListElement : HTMLElement { // obsolete members - // https://html.spec.whatwg.org/#HTMLDListElement-partial + // https://html.spec.whatwg.org/C/#HTMLDListElement-partial [CEReactions, Reflect] attribute boolean compact; };
diff --git a/third_party/blink/renderer/core/html/html_document.idl b/third_party/blink/renderer/core/html/html_document.idl index a98017a..938136e 100644 --- a/third_party/blink/renderer/core/html/html_document.idl +++ b/third_party/blink/renderer/core/html/html_document.idl
@@ -21,7 +21,7 @@ // FIXME: "For historical reasons, Window objects must also have a // writable, configurable, non-enumerable property named HTMLDocument // whose value is the Document interface object." -// https://html.spec.whatwg.org/#the-window-object +// https://html.spec.whatwg.org/C/#the-window-object interface HTMLDocument : Document { };
diff --git a/third_party/blink/renderer/core/html/html_element.idl b/third_party/blink/renderer/core/html/html_element.idl index d148491..cb792372 100644 --- a/third_party/blink/renderer/core/html/html_element.idl +++ b/third_party/blink/renderer/core/html/html_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#htmlelement +// https://html.spec.whatwg.org/C/#htmlelement [HTMLConstructor] interface HTMLElement : Element { // metadata attributes @@ -41,7 +41,7 @@ [Measure] attribute DOMString autocapitalize; // HTMLElement implements ElementContentEditable - // https://html.spec.whatwg.org/#contenteditable + // https://html.spec.whatwg.org/C/#contenteditable [CEReactions, CustomElementCallbacks, RaisesException=Setter] attribute DOMString contentEditable; [ImplementedAs=isContentEditableForBinding] readonly attribute boolean isContentEditable; [CEReactions, Reflect, ReflectOnly=("none","text","tel","url","email","numeric","decimal","search")] attribute DOMString inputMode;
diff --git a/third_party/blink/renderer/core/html/html_embed_element.idl b/third_party/blink/renderer/core/html/html_embed_element.idl index 73cd221..1e698b5 100644 --- a/third_party/blink/renderer/core/html/html_embed_element.idl +++ b/third_party/blink/renderer/core/html/html_embed_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-embed-element +// https://html.spec.whatwg.org/C/#the-embed-element // TODO(yukishiino): HTMLEmbedElement should not have [OverrideBuiltins]. [ @@ -33,7 +33,7 @@ [CheckSecurity=ReturnValue, RaisesException] Document? getSVGDocument(); // obsolete members - // https://html.spec.whatwg.org/#HTMLEmbedElement-partial + // https://html.spec.whatwg.org/C/#HTMLEmbedElement-partial [CEReactions, Reflect] attribute DOMString align; [CEReactions, Reflect] attribute DOMString name;
diff --git a/third_party/blink/renderer/core/html/html_font_element.idl b/third_party/blink/renderer/core/html/html_font_element.idl index 9e4283d..8ff4ec16 100644 --- a/third_party/blink/renderer/core/html/html_font_element.idl +++ b/third_party/blink/renderer/core/html/html_font_element.idl
@@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#htmlfontelement +// https://html.spec.whatwg.org/C/#htmlfontelement [HTMLConstructor] interface HTMLFontElement : HTMLElement { [CEReactions, Reflect] attribute [TreatNullAs=EmptyString] DOMString color;
diff --git a/third_party/blink/renderer/core/html/html_frame_element.idl b/third_party/blink/renderer/core/html/html_frame_element.idl index ede4af7..0248a35 100644 --- a/third_party/blink/renderer/core/html/html_frame_element.idl +++ b/third_party/blink/renderer/core/html/html_frame_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#htmlframeelement +// https://html.spec.whatwg.org/C/#htmlframeelement [HTMLConstructor] interface HTMLFrameElement : HTMLElement {
diff --git a/third_party/blink/renderer/core/html/html_frame_set_element.idl b/third_party/blink/renderer/core/html/html_frame_set_element.idl index c341896..54a4bcb0 100644 --- a/third_party/blink/renderer/core/html/html_frame_set_element.idl +++ b/third_party/blink/renderer/core/html/html_frame_set_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#htmlframesetelement +// https://html.spec.whatwg.org/C/#htmlframesetelement // FIXME: HTMLFrameSetElement should not have [OverrideBuiltins]. [
diff --git a/third_party/blink/renderer/core/html/html_head_element.idl b/third_party/blink/renderer/core/html/html_head_element.idl index a603011e..34b7b3c 100644 --- a/third_party/blink/renderer/core/html/html_head_element.idl +++ b/third_party/blink/renderer/core/html/html_head_element.idl
@@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-head-element +// https://html.spec.whatwg.org/C/#the-head-element [HTMLConstructor] interface HTMLHeadElement : HTMLElement { };
diff --git a/third_party/blink/renderer/core/html/html_heading_element.idl b/third_party/blink/renderer/core/html/html_heading_element.idl index b2dfaf10..8b7fe5d 100644 --- a/third_party/blink/renderer/core/html/html_heading_element.idl +++ b/third_party/blink/renderer/core/html/html_heading_element.idl
@@ -17,10 +17,10 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements +// https://html.spec.whatwg.org/C/#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements [HTMLConstructor] interface HTMLHeadingElement : HTMLElement { // obsolete members - // https://html.spec.whatwg.org/#HTMLHeadingElement-partial + // https://html.spec.whatwg.org/C/#HTMLHeadingElement-partial [CEReactions, Reflect] attribute DOMString align; };
diff --git a/third_party/blink/renderer/core/html/html_hr_element.idl b/third_party/blink/renderer/core/html/html_hr_element.idl index db7b8dc..dda79b1 100644 --- a/third_party/blink/renderer/core/html/html_hr_element.idl +++ b/third_party/blink/renderer/core/html/html_hr_element.idl
@@ -17,11 +17,11 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-hr-element +// https://html.spec.whatwg.org/C/#the-hr-element [HTMLConstructor] interface HTMLHRElement : HTMLElement { // obsolete members - // https://html.spec.whatwg.org/#HTMLHRElement-partial + // https://html.spec.whatwg.org/C/#HTMLHRElement-partial [CEReactions, Reflect] attribute DOMString align; [CEReactions, Reflect] attribute DOMString color; [CEReactions, Reflect] attribute boolean noShade;
diff --git a/third_party/blink/renderer/core/html/html_html_element.idl b/third_party/blink/renderer/core/html/html_html_element.idl index 4a30205..5683c27 100644 --- a/third_party/blink/renderer/core/html/html_html_element.idl +++ b/third_party/blink/renderer/core/html/html_html_element.idl
@@ -17,10 +17,10 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-html-element +// https://html.spec.whatwg.org/C/#the-html-element [HTMLConstructor] interface HTMLHtmlElement : HTMLElement { // obsolete members - // https://html.spec.whatwg.org/#HTMLHtmlElement-partial + // https://html.spec.whatwg.org/C/#HTMLHtmlElement-partial [CEReactions, Reflect] attribute DOMString version; };
diff --git a/third_party/blink/renderer/core/html/html_hyperlink_element_utils.idl b/third_party/blink/renderer/core/html/html_hyperlink_element_utils.idl index bf2021fb..ff9057d 100644 --- a/third_party/blink/renderer/core/html/html_hyperlink_element_utils.idl +++ b/third_party/blink/renderer/core/html/html_hyperlink_element_utils.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/#htmlhyperlinkelementutils +// https://html.spec.whatwg.org/C/#htmlhyperlinkelementutils [ NoInterfaceObject // Always used on target of 'implements'
diff --git a/third_party/blink/renderer/core/html/html_iframe_element.idl b/third_party/blink/renderer/core/html/html_iframe_element.idl index 9bea0c3..b77c8d1 100644 --- a/third_party/blink/renderer/core/html/html_iframe_element.idl +++ b/third_party/blink/renderer/core/html/html_iframe_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-iframe-element +// https://html.spec.whatwg.org/C/#the-iframe-element // The `HTMLString` and `URLString` references below are from Trusted Types: // https://github.com/WICG/trusted-types/, which is still WIP. @@ -49,7 +49,7 @@ [RuntimeEnabled=LazyFrameLoading, CEReactions, Reflect, ReflectOnly=("on", "off", "auto"), ReflectMissing="auto", ReflectInvalid="auto"] attribute DOMString lazyLoad; // obsolete members - // https://html.spec.whatwg.org/#HTMLIFrameElement-partial + // https://html.spec.whatwg.org/C/#HTMLIFrameElement-partial [CEReactions, Reflect] attribute DOMString align; [CEReactions, Reflect] attribute DOMString scrolling; [CEReactions, Reflect] attribute DOMString frameBorder;
diff --git a/third_party/blink/renderer/core/html/html_image_element.idl b/third_party/blink/renderer/core/html/html_image_element.idl index 03d39e9..4fcec98 100644 --- a/third_party/blink/renderer/core/html/html_image_element.idl +++ b/third_party/blink/renderer/core/html/html_image_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-img-element +// https://html.spec.whatwg.org/C/#the-img-element [ ActiveScriptWrappable, @@ -47,7 +47,7 @@ [RuntimeEnabled=LazyImageLoading, CEReactions, Reflect, ReflectOnly=("on", "off", "auto"), ReflectMissing="auto", ReflectInvalid="auto"] attribute DOMString lazyLoad; // obsolete members - // https://html.spec.whatwg.org/#HTMLImageElement-partial + // https://html.spec.whatwg.org/C/#HTMLImageElement-partial [CEReactions, Reflect] attribute DOMString name; [CEReactions, Reflect, URL] attribute DOMString lowsrc; [CEReactions, Reflect] attribute DOMString align;
diff --git a/third_party/blink/renderer/core/html/html_li_element.idl b/third_party/blink/renderer/core/html/html_li_element.idl index 2b14720..134b750b 100644 --- a/third_party/blink/renderer/core/html/html_li_element.idl +++ b/third_party/blink/renderer/core/html/html_li_element.idl
@@ -17,12 +17,12 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-li-element +// https://html.spec.whatwg.org/C/#the-li-element [HTMLConstructor] interface HTMLLIElement : HTMLElement { [CEReactions, Reflect] attribute long value; // obsolete members - // https://html.spec.whatwg.org/#HTMLLIElement-partial + // https://html.spec.whatwg.org/C/#HTMLLIElement-partial [CEReactions, Reflect] attribute DOMString type; };
diff --git a/third_party/blink/renderer/core/html/html_link_element.idl b/third_party/blink/renderer/core/html/html_link_element.idl index da2890a9..027577f 100644 --- a/third_party/blink/renderer/core/html/html_link_element.idl +++ b/third_party/blink/renderer/core/html/html_link_element.idl
@@ -19,7 +19,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-link-element +// https://html.spec.whatwg.org/C/#the-link-element [HTMLConstructor] interface HTMLLinkElement : HTMLElement { // FIXME: The disabled attribute has been removed from the spec: @@ -40,7 +40,7 @@ [RuntimeEnabled=PreloadImageSrcSet, CEReactions, Reflect] attribute DOMString imageSizes; // obsolete members - // https://html.spec.whatwg.org/#HTMLLinkElement-partial + // https://html.spec.whatwg.org/C/#HTMLLinkElement-partial [CEReactions, Reflect] attribute DOMString charset; [CEReactions, Reflect] attribute DOMString rev; [CEReactions, Reflect] attribute DOMString target;
diff --git a/third_party/blink/renderer/core/html/html_map_element.idl b/third_party/blink/renderer/core/html/html_map_element.idl index 5abd3048..847c2e3 100644 --- a/third_party/blink/renderer/core/html/html_map_element.idl +++ b/third_party/blink/renderer/core/html/html_map_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-map-element +// https://html.spec.whatwg.org/C/#the-map-element [HTMLConstructor] interface HTMLMapElement : HTMLElement { [CEReactions, Reflect] attribute DOMString name;
diff --git a/third_party/blink/renderer/core/html/html_marquee_element.idl b/third_party/blink/renderer/core/html/html_marquee_element.idl index e3dd19d..d880323 100644 --- a/third_party/blink/renderer/core/html/html_marquee_element.idl +++ b/third_party/blink/renderer/core/html/html_marquee_element.idl
@@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#htmlmarqueeelement +// https://html.spec.whatwg.org/C/#htmlmarqueeelement [HTMLConstructor] interface HTMLMarqueeElement : HTMLElement { [Reflect] attribute DOMString behavior;
diff --git a/third_party/blink/renderer/core/html/html_menu_element.idl b/third_party/blink/renderer/core/html/html_menu_element.idl index fbbc79a5..74c8a60 100644 --- a/third_party/blink/renderer/core/html/html_menu_element.idl +++ b/third_party/blink/renderer/core/html/html_menu_element.idl
@@ -17,10 +17,10 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-menu-element +// https://html.spec.whatwg.org/C/#the-menu-element [HTMLConstructor] interface HTMLMenuElement : HTMLElement { // obsolete members - // https://html.spec.whatwg.org/#HTMLMenuElement-partial + // https://html.spec.whatwg.org/C/#HTMLMenuElement-partial [CEReactions, Reflect] attribute boolean compact; };
diff --git a/third_party/blink/renderer/core/html/html_meta_element.idl b/third_party/blink/renderer/core/html/html_meta_element.idl index d0714b4..437193f 100644 --- a/third_party/blink/renderer/core/html/html_meta_element.idl +++ b/third_party/blink/renderer/core/html/html_meta_element.idl
@@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-meta-element +// https://html.spec.whatwg.org/C/#the-meta-element [HTMLConstructor] interface HTMLMetaElement : HTMLElement { [CEReactions, Reflect] attribute DOMString name; @@ -25,6 +25,6 @@ [CEReactions, Reflect] attribute DOMString content; // obsolete members - // https://html.spec.whatwg.org/#HTMLMetaElement-partial + // https://html.spec.whatwg.org/C/#HTMLMetaElement-partial [CEReactions, Reflect] attribute DOMString scheme; };
diff --git a/third_party/blink/renderer/core/html/html_meter_element.idl b/third_party/blink/renderer/core/html/html_meter_element.idl index 94c6080..ad4c7d1 100644 --- a/third_party/blink/renderer/core/html/html_meter_element.idl +++ b/third_party/blink/renderer/core/html/html_meter_element.idl
@@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-meter-element +// https://html.spec.whatwg.org/C/#the-meter-element [HTMLConstructor] interface HTMLMeterElement : HTMLElement { [CEReactions] attribute double value;
diff --git a/third_party/blink/renderer/core/html/html_mod_element.idl b/third_party/blink/renderer/core/html/html_mod_element.idl index 65ad1b6..0ed79d98 100644 --- a/third_party/blink/renderer/core/html/html_mod_element.idl +++ b/third_party/blink/renderer/core/html/html_mod_element.idl
@@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-ins-element -// https://html.spec.whatwg.org/#the-del-element +// https://html.spec.whatwg.org/C/#the-ins-element +// https://html.spec.whatwg.org/C/#the-del-element [HTMLConstructor] interface HTMLModElement : HTMLElement { [CEReactions, Reflect, URL] attribute DOMString cite;
diff --git a/third_party/blink/renderer/core/html/html_object_element.idl b/third_party/blink/renderer/core/html/html_object_element.idl index 305df10f..bca66e9 100644 --- a/third_party/blink/renderer/core/html/html_object_element.idl +++ b/third_party/blink/renderer/core/html/html_object_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-object-element +// https://html.spec.whatwg.org/C/#the-object-element // TODO(yukishiino): HTMLObjectElement should not have [OverrideBuiltins]. [ @@ -47,7 +47,7 @@ void setCustomValidity(DOMString error); // obsolete members - // https://html.spec.whatwg.org/#HTMLObjectElement-partial + // https://html.spec.whatwg.org/C/#HTMLObjectElement-partial [CEReactions, Reflect] attribute DOMString align; [CEReactions, Reflect] attribute DOMString archive; [CEReactions, Reflect] attribute DOMString code;
diff --git a/third_party/blink/renderer/core/html/html_olist_element.idl b/third_party/blink/renderer/core/html/html_olist_element.idl index a73f9299..b47d8670 100644 --- a/third_party/blink/renderer/core/html/html_olist_element.idl +++ b/third_party/blink/renderer/core/html/html_olist_element.idl
@@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-ol-element +// https://html.spec.whatwg.org/C/#the-ol-element [HTMLConstructor] interface HTMLOListElement : HTMLElement { [CEReactions, Reflect] attribute boolean reversed; @@ -25,6 +25,6 @@ [CEReactions, Reflect] attribute DOMString type; // obsolete members - // https://html.spec.whatwg.org/#HTMLOListElement-partial + // https://html.spec.whatwg.org/C/#HTMLOListElement-partial [CEReactions, Reflect] attribute boolean compact; };
diff --git a/third_party/blink/renderer/core/html/html_paragraph_element.idl b/third_party/blink/renderer/core/html/html_paragraph_element.idl index 48ca805f..773d976 100644 --- a/third_party/blink/renderer/core/html/html_paragraph_element.idl +++ b/third_party/blink/renderer/core/html/html_paragraph_element.idl
@@ -17,10 +17,10 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-p-element +// https://html.spec.whatwg.org/C/#the-p-element [HTMLConstructor] interface HTMLParagraphElement : HTMLElement { // obsolete members - // https://html.spec.whatwg.org/#HTMLParagraphElement-partial + // https://html.spec.whatwg.org/C/#HTMLParagraphElement-partial [CEReactions, Reflect] attribute DOMString align; };
diff --git a/third_party/blink/renderer/core/html/html_param_element.idl b/third_party/blink/renderer/core/html/html_param_element.idl index bb31060..1359fe70 100644 --- a/third_party/blink/renderer/core/html/html_param_element.idl +++ b/third_party/blink/renderer/core/html/html_param_element.idl
@@ -17,14 +17,14 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-param-element +// https://html.spec.whatwg.org/C/#the-param-element [HTMLConstructor] interface HTMLParamElement : HTMLElement { [CEReactions, Reflect] attribute DOMString name; [CEReactions, Reflect] attribute DOMString value; // obsolete members - // https://html.spec.whatwg.org/#HTMLParamElement-partial + // https://html.spec.whatwg.org/C/#HTMLParamElement-partial [CEReactions, Reflect] attribute DOMString type; [CEReactions, Reflect] attribute DOMString valueType; };
diff --git a/third_party/blink/renderer/core/html/html_picture_element.idl b/third_party/blink/renderer/core/html/html_picture_element.idl index 3b61940..4dced65 100644 --- a/third_party/blink/renderer/core/html/html_picture_element.idl +++ b/third_party/blink/renderer/core/html/html_picture_element.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/#the-picture-element +// https://html.spec.whatwg.org/C/#the-picture-element [HTMLConstructor] interface HTMLPictureElement : HTMLElement { };
diff --git a/third_party/blink/renderer/core/html/html_pre_element.idl b/third_party/blink/renderer/core/html/html_pre_element.idl index d642a81..3d527ff 100644 --- a/third_party/blink/renderer/core/html/html_pre_element.idl +++ b/third_party/blink/renderer/core/html/html_pre_element.idl
@@ -18,10 +18,10 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-pre-element +// https://html.spec.whatwg.org/C/#the-pre-element [HTMLConstructor] interface HTMLPreElement : HTMLElement { // obsolete members - // https://html.spec.whatwg.org/#HTMLPreElement-partial + // https://html.spec.whatwg.org/C/#HTMLPreElement-partial [CEReactions, Reflect] attribute long width; };
diff --git a/third_party/blink/renderer/core/html/html_progress_element.idl b/third_party/blink/renderer/core/html/html_progress_element.idl index 54e26148..6cb8ed6a 100644 --- a/third_party/blink/renderer/core/html/html_progress_element.idl +++ b/third_party/blink/renderer/core/html/html_progress_element.idl
@@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-progress-element +// https://html.spec.whatwg.org/C/#the-progress-element [HTMLConstructor] interface HTMLProgressElement : HTMLElement { [CEReactions] attribute double value;
diff --git a/third_party/blink/renderer/core/html/html_quote_element.idl b/third_party/blink/renderer/core/html/html_quote_element.idl index 705411f8..26ebbc8 100644 --- a/third_party/blink/renderer/core/html/html_quote_element.idl +++ b/third_party/blink/renderer/core/html/html_quote_element.idl
@@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-blockquote-element -// https://html.spec.whatwg.org/#the-q-element +// https://html.spec.whatwg.org/C/#the-blockquote-element +// https://html.spec.whatwg.org/C/#the-q-element [HTMLConstructor] interface HTMLQuoteElement : HTMLElement { [CEReactions, Reflect, URL] attribute DOMString cite;
diff --git a/third_party/blink/renderer/core/html/html_script_element.idl b/third_party/blink/renderer/core/html/html_script_element.idl index c1bace7b..49bceea 100644 --- a/third_party/blink/renderer/core/html/html_script_element.idl +++ b/third_party/blink/renderer/core/html/html_script_element.idl
@@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-script-element +// https://html.spec.whatwg.org/C/#the-script-element [HTMLConstructor] interface HTMLScriptElement : HTMLElement { [CEReactions, Reflect, URL, RaisesException=Setter] attribute ScriptURLString src; @@ -32,7 +32,7 @@ [CEReactions, MeasureAs=PriorityHints, OriginTrialEnabled=PriorityHints, Reflect, ReflectOnly=("low", "auto", "high"), ReflectMissing="auto", ReflectInvalid="auto"] attribute DOMString importance; // obsolete members - // https://html.spec.whatwg.org/#HTMLScriptElement-partial + // https://html.spec.whatwg.org/C/#HTMLScriptElement-partial // TODO(foolip): The event and htmlFor attributes should return the empty // string on getting, and do nothing on setting. [CEReactions, Reflect] attribute DOMString event;
diff --git a/third_party/blink/renderer/core/html/html_source_element.idl b/third_party/blink/renderer/core/html/html_source_element.idl index 1c51502..acf73961 100644 --- a/third_party/blink/renderer/core/html/html_source_element.idl +++ b/third_party/blink/renderer/core/html/html_source_element.idl
@@ -23,13 +23,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-source-element +// https://html.spec.whatwg.org/C/#the-source-element [HTMLConstructor] interface HTMLSourceElement : HTMLElement { [CEReactions, Reflect, URL, RaisesException=Setter] attribute URLString src; [CEReactions] attribute DOMString type; - // https://html.spec.whatwg.org/#the-source-element-when-used-with-the-picture-element + // https://html.spec.whatwg.org/C/#the-source-element-when-used-with-the-picture-element [CEReactions, Reflect] attribute USVString srcset; [CEReactions, Reflect] attribute DOMString sizes; [CEReactions, Reflect] attribute DOMString media;
diff --git a/third_party/blink/renderer/core/html/html_span_element.idl b/third_party/blink/renderer/core/html/html_span_element.idl index 627de83d..6fcc37d 100644 --- a/third_party/blink/renderer/core/html/html_span_element.idl +++ b/third_party/blink/renderer/core/html/html_span_element.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-span-element +// https://html.spec.whatwg.org/C/#the-span-element [HTMLConstructor] interface HTMLSpanElement : HTMLElement { };
diff --git a/third_party/blink/renderer/core/html/html_style_element.idl b/third_party/blink/renderer/core/html/html_style_element.idl index 9c30bb9..143638e 100644 --- a/third_party/blink/renderer/core/html/html_style_element.idl +++ b/third_party/blink/renderer/core/html/html_style_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-style-element +// https://html.spec.whatwg.org/C/#the-style-element [HTMLConstructor] interface HTMLStyleElement : HTMLElement { // TODO(foolip): The disabled attribute has been removed from the spec:
diff --git a/third_party/blink/renderer/core/html/html_table_caption_element.idl b/third_party/blink/renderer/core/html/html_table_caption_element.idl index 7c1f3c6..030d384 100644 --- a/third_party/blink/renderer/core/html/html_table_caption_element.idl +++ b/third_party/blink/renderer/core/html/html_table_caption_element.idl
@@ -18,10 +18,10 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-caption-element +// https://html.spec.whatwg.org/C/#the-caption-element [HTMLConstructor] interface HTMLTableCaptionElement : HTMLElement { // obsolete members - // https://html.spec.whatwg.org/#HTMLTableCaptionElement-partial + // https://html.spec.whatwg.org/C/#HTMLTableCaptionElement-partial [CEReactions, Reflect] attribute DOMString align; };
diff --git a/third_party/blink/renderer/core/html/html_table_cell_element.idl b/third_party/blink/renderer/core/html/html_table_cell_element.idl index 91ed54b..29d6d5a 100644 --- a/third_party/blink/renderer/core/html/html_table_cell_element.idl +++ b/third_party/blink/renderer/core/html/html_table_cell_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#attributes-common-to-td-and-th-elements +// https://html.spec.whatwg.org/C/#attributes-common-to-td-and-th-elements [HTMLConstructor] interface HTMLTableCellElement : HTMLElement { [CEReactions] attribute unsigned long colSpan; @@ -29,7 +29,7 @@ readonly attribute long cellIndex; // obsolete members - // https://html.spec.whatwg.org/#HTMLTableCellElement-partial + // https://html.spec.whatwg.org/C/#HTMLTableCellElement-partial [CEReactions, Reflect] attribute DOMString align; [CEReactions, Reflect] attribute DOMString axis; [CEReactions, Reflect] attribute DOMString height;
diff --git a/third_party/blink/renderer/core/html/html_table_col_element.idl b/third_party/blink/renderer/core/html/html_table_col_element.idl index fd63330..42afbc1 100644 --- a/third_party/blink/renderer/core/html/html_table_col_element.idl +++ b/third_party/blink/renderer/core/html/html_table_col_element.idl
@@ -18,14 +18,14 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-colgroup-element -// https://html.spec.whatwg.org/#the-col-element +// https://html.spec.whatwg.org/C/#the-colgroup-element +// https://html.spec.whatwg.org/C/#the-col-element [HTMLConstructor] interface HTMLTableColElement : HTMLElement { [CEReactions] attribute unsigned long span; // obsolete attributes - // https://html.spec.whatwg.org/#HTMLTableColElement-partial + // https://html.spec.whatwg.org/C/#HTMLTableColElement-partial [CEReactions, Reflect] attribute DOMString align; [CEReactions, Reflect=char] attribute DOMString ch; [CEReactions, Reflect=charoff] attribute DOMString chOff;
diff --git a/third_party/blink/renderer/core/html/html_table_element.idl b/third_party/blink/renderer/core/html/html_table_element.idl index 70512e0a..a057d4d 100644 --- a/third_party/blink/renderer/core/html/html_table_element.idl +++ b/third_party/blink/renderer/core/html/html_table_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-table-element +// https://html.spec.whatwg.org/C/#the-table-element [HTMLConstructor] interface HTMLTableElement : HTMLElement { [CEReactions, RaisesException=Setter] attribute HTMLTableCaptionElement? caption; @@ -39,7 +39,7 @@ // void stopSorting(); // obsolete members - // https://html.spec.whatwg.org/#HTMLTableElement-partial + // https://html.spec.whatwg.org/C/#HTMLTableElement-partial [CEReactions, Reflect] attribute DOMString align; [CEReactions, Reflect] attribute DOMString border; [CEReactions, Reflect] attribute DOMString frame;
diff --git a/third_party/blink/renderer/core/html/html_table_row_element.idl b/third_party/blink/renderer/core/html/html_table_row_element.idl index 3ff3fad6..9965d481 100644 --- a/third_party/blink/renderer/core/html/html_table_row_element.idl +++ b/third_party/blink/renderer/core/html/html_table_row_element.idl
@@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-tr-element +// https://html.spec.whatwg.org/C/#the-tr-element [HTMLConstructor] interface HTMLTableRowElement : HTMLElement { readonly attribute long rowIndex; @@ -28,7 +28,7 @@ [CEReactions, RaisesException] void deleteCell(long index); // obsolete members - // https://html.spec.whatwg.org/#HTMLTableRowElement-partial + // https://html.spec.whatwg.org/C/#HTMLTableRowElement-partial [CEReactions, Reflect] attribute DOMString align; [CEReactions, Reflect=char] attribute DOMString ch; [CEReactions, Reflect=charoff] attribute DOMString chOff;
diff --git a/third_party/blink/renderer/core/html/html_table_section_element.idl b/third_party/blink/renderer/core/html/html_table_section_element.idl index 77767344..b95a4946 100644 --- a/third_party/blink/renderer/core/html/html_table_section_element.idl +++ b/third_party/blink/renderer/core/html/html_table_section_element.idl
@@ -18,9 +18,9 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-tbody-element -// https://html.spec.whatwg.org/#the-thead-element -// https://html.spec.whatwg.org/#the-tfoot-element +// https://html.spec.whatwg.org/C/#the-tbody-element +// https://html.spec.whatwg.org/C/#the-thead-element +// https://html.spec.whatwg.org/C/#the-tfoot-element [HTMLConstructor] interface HTMLTableSectionElement : HTMLElement { readonly attribute HTMLCollection rows; @@ -28,7 +28,7 @@ [CEReactions, RaisesException] void deleteRow(long index); // obsolete members - // https://html.spec.whatwg.org/#HTMLTableSectionElement-partial + // https://html.spec.whatwg.org/C/#HTMLTableSectionElement-partial [CEReactions, Reflect] attribute DOMString align; [CEReactions, Reflect=char] attribute DOMString ch; [CEReactions, Reflect=charoff] attribute DOMString chOff;
diff --git a/third_party/blink/renderer/core/html/html_template_element.idl b/third_party/blink/renderer/core/html/html_template_element.idl index ee856a65..2d8fdfb 100644 --- a/third_party/blink/renderer/core/html/html_template_element.idl +++ b/third_party/blink/renderer/core/html/html_template_element.idl
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-template-element +// https://html.spec.whatwg.org/C/#the-template-element [HTMLConstructor] interface HTMLTemplateElement : HTMLElement { readonly attribute DocumentFragment content;
diff --git a/third_party/blink/renderer/core/html/html_title_element.idl b/third_party/blink/renderer/core/html/html_title_element.idl index 9fb0769e..c28e9c0 100644 --- a/third_party/blink/renderer/core/html/html_title_element.idl +++ b/third_party/blink/renderer/core/html/html_title_element.idl
@@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-title-element +// https://html.spec.whatwg.org/C/#the-title-element [HTMLConstructor] interface HTMLTitleElement : HTMLElement { [CEReactions] attribute DOMString text;
diff --git a/third_party/blink/renderer/core/html/html_ulist_element.idl b/third_party/blink/renderer/core/html/html_ulist_element.idl index 961a6e22..7a0f2cd 100644 --- a/third_party/blink/renderer/core/html/html_ulist_element.idl +++ b/third_party/blink/renderer/core/html/html_ulist_element.idl
@@ -17,11 +17,11 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/#the-ul-element +// https://html.spec.whatwg.org/C/#the-ul-element [HTMLConstructor] interface HTMLUListElement : HTMLElement { // obsolete members - // https://html.spec.whatwg.org/#HTMLUListElement-partial + // https://html.spec.whatwg.org/C/#HTMLUListElement-partial [CEReactions, Reflect] attribute boolean compact; [CEReactions, Reflect] attribute DOMString type; };
diff --git a/third_party/blink/renderer/core/html/html_unknown_element.idl b/third_party/blink/renderer/core/html/html_unknown_element.idl index 3845598..30ab884c 100644 --- a/third_party/blink/renderer/core/html/html_unknown_element.idl +++ b/third_party/blink/renderer/core/html/html_unknown_element.idl
@@ -27,7 +27,7 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#elements-in-the-dom +// https://html.spec.whatwg.org/C/#elements-in-the-dom [ Exposed=Window
diff --git a/third_party/blink/renderer/core/html/media/html_audio_element.idl b/third_party/blink/renderer/core/html/media/html_audio_element.idl index 3335aa4f..f2eb3fa 100644 --- a/third_party/blink/renderer/core/html/media/html_audio_element.idl +++ b/third_party/blink/renderer/core/html/media/html_audio_element.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-audio-element +// https://html.spec.whatwg.org/C/#the-audio-element [ HTMLConstructor,
diff --git a/third_party/blink/renderer/core/html/media/html_media_element.cc b/third_party/blink/renderer/core/html/media/html_media_element.cc index 942f087..8f3f91e 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.cc +++ b/third_party/blink/renderer/core/html/media/html_media_element.cc
@@ -85,7 +85,6 @@ #include "third_party/blink/renderer/core/html/track/video_track_list.h" #include "third_party/blink/renderer/core/html_names.h" #include "third_party/blink/renderer/core/inspector/console_message.h" -#include "third_party/blink/renderer/core/layout/intersection_geometry.h" #include "third_party/blink/renderer/core/layout/layout_media.h" #include "third_party/blink/renderer/core/layout/layout_view.h" #include "third_party/blink/renderer/core/page/chrome_client.h" @@ -2355,7 +2354,7 @@ } // Per HTML spec, "The empty string ... maps to the Automatic state." - // https://html.spec.whatwg.org/#attr-media-preload + // https://html.spec.whatwg.org/C/#attr-media-preload if (DeprecatedEqualIgnoringCase(preload, "auto") || DeprecatedEqualIgnoringCase(preload, "")) { UseCounter::Count(GetDocument(), WebFeature::kHTMLMediaElementPreloadAuto);
diff --git a/third_party/blink/renderer/core/html/media/html_media_element.h b/third_party/blink/renderer/core/html/media/html_media_element.h index 0d0e45c..75753e3 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.h +++ b/third_party/blink/renderer/core/html/media/html_media_element.h
@@ -371,6 +371,7 @@ friend class ContextMenuControllerTest; friend class MediaElementFillingViewportTest; friend class VideoWakeLockTest; + friend class PictureInPictureControllerTest; void ResetMediaPlayerAndMediaSource();
diff --git a/third_party/blink/renderer/core/html/media/html_media_element.idl b/third_party/blink/renderer/core/html/media/html_media_element.idl index ecba454..f0e6166 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.idl +++ b/third_party/blink/renderer/core/html/media/html_media_element.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#media-elements +// https://html.spec.whatwg.org/C/#media-elements enum CanPlayTypeResult { "" /* empty string */, "maybe", "probably" }; [
diff --git a/third_party/blink/renderer/core/html/media/html_video_element.cc b/third_party/blink/renderer/core/html/media/html_video_element.cc index 43565f1..6b58137 100644 --- a/third_party/blink/renderer/core/html/media/html_video_element.cc +++ b/third_party/blink/renderer/core/html/media/html_video_element.cc
@@ -663,14 +663,6 @@ PictureInPictureController::Status::kEnabled; } -void HTMLVideoElement::enterPictureInPicture() { - if (DisplayType() == WebMediaPlayer::DisplayType::kFullscreen) - Fullscreen::ExitFullscreen(GetDocument()); - - if (GetWebMediaPlayer()) - GetWebMediaPlayer()->EnterPictureInPicture(); -} - void HTMLVideoElement::SendCustomControlsToPipWindow() { // TODO(sawtelle): Allow setting controls multiple times for a video, even // when not active, https://crbug.com/869133
diff --git a/third_party/blink/renderer/core/html/media/html_video_element.h b/third_party/blink/renderer/core/html/media/html_video_element.h index b8313c26..9db2894 100644 --- a/third_party/blink/renderer/core/html/media/html_video_element.h +++ b/third_party/blink/renderer/core/html/media/html_video_element.h
@@ -175,7 +175,6 @@ void MediaRemotingStarted(const WebString& remote_device_friendly_name) final; bool SupportsPictureInPicture() const final; - void enterPictureInPicture(); void SendCustomControlsToPipWindow(); void PictureInPictureStopped() final; void PictureInPictureControlClicked(const WebString& control_id) final;
diff --git a/third_party/blink/renderer/core/html/media/html_video_element.idl b/third_party/blink/renderer/core/html/media/html_video_element.idl index 1dc6183..25d7fdbb 100644 --- a/third_party/blink/renderer/core/html/media/html_video_element.idl +++ b/third_party/blink/renderer/core/html/media/html_video_element.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-video-element +// https://html.spec.whatwg.org/C/#the-video-element [ HTMLConstructor,
diff --git a/third_party/blink/renderer/core/html/media/media_custom_controls_fullscreen_detector.cc b/third_party/blink/renderer/core/html/media/media_custom_controls_fullscreen_detector.cc index 03efdfa..401fa08 100644 --- a/third_party/blink/renderer/core/html/media/media_custom_controls_fullscreen_detector.cc +++ b/third_party/blink/renderer/core/html/media/media_custom_controls_fullscreen_detector.cc
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/core/dom/events/event.h" #include "third_party/blink/renderer/core/fullscreen/fullscreen.h" #include "third_party/blink/renderer/core/html/media/html_video_element.h" -#include "third_party/blink/renderer/core/layout/intersection_geometry.h" #include "third_party/blink/renderer/core/layout/layout_object.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/wtf/functional.h"
diff --git a/third_party/blink/renderer/core/html/media/media_error.idl b/third_party/blink/renderer/core/html/media/media_error.idl index cd551b6..fbf1a23 100644 --- a/third_party/blink/renderer/core/html/media/media_error.idl +++ b/third_party/blink/renderer/core/html/media/media_error.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#error-codes +// https://html.spec.whatwg.org/C/#error-codes interface MediaError { const unsigned short MEDIA_ERR_ABORTED = 1;
diff --git a/third_party/blink/renderer/core/html/media/video_wake_lock_test.cc b/third_party/blink/renderer/core/html/media/video_wake_lock_test.cc index bc01a5ee..785b17a 100644 --- a/third_party/blink/renderer/core/html/media/video_wake_lock_test.cc +++ b/third_party/blink/renderer/core/html/media/video_wake_lock_test.cc
@@ -53,6 +53,12 @@ mojo::Binding<mojom::blink::PictureInPictureService> binding_; }; +class VideoWakeLockMediaPlayer final : public EmptyWebMediaPlayer { + public: + ReadyState GetReadyState() const final { return kReadyStateHaveMetadata; } + bool HasVideo() const final { return true; } +}; + class VideoWakeLockFrameClient : public test::MediaStubLocalFrameClient { public: static VideoWakeLockFrameClient* Create( @@ -109,7 +115,7 @@ void SetUp() override { PageTestBase::SetupPageWithClients( nullptr, VideoWakeLockFrameClient::Create( - std::make_unique<EmptyWebMediaPlayer>())); + std::make_unique<VideoWakeLockMediaPlayer>())); service_manager::InterfaceProvider::TestApi test_api( GetFrame().Client()->GetInterfaceProvider()); @@ -119,6 +125,7 @@ WTF::Unretained(&pip_service_))); video_ = HTMLVideoElement::Create(GetDocument()); + video_->SetReadyState(HTMLMediaElement::ReadyState::kHaveMetadata); video_wake_lock_ = MakeGarbageCollected<VideoWakeLock>(*video_.Get()); GetPage().SetIsHidden(false, true);
diff --git a/third_party/blink/renderer/core/html/parser/html_construction_site.cc b/third_party/blink/renderer/core/html/parser/html_construction_site.cc index d7f729c7..469e175 100644 --- a/third_party/blink/renderer/core/html/parser/html_construction_site.cc +++ b/third_party/blink/renderer/core/html/parser/html_construction_site.cc
@@ -110,7 +110,7 @@ if (auto* template_element = ToHTMLTemplateElementOrNull(*task.parent)) task.parent = template_element->content(); - // https://html.spec.whatwg.org/#insert-a-foreign-element + // https://html.spec.whatwg.org/C/#insert-a-foreign-element // 3.1, (3) Push (pop) an element queue CEReactionsScope reactions; if (task.next_child) @@ -842,7 +842,7 @@ } // "look up a custom element definition" for a token -// https://html.spec.whatwg.org/#look-up-a-custom-element-definition +// https://html.spec.whatwg.org/C/#look-up-a-custom-element-definition CustomElementDefinition* HTMLConstructionSite::LookUpCustomElementDefinition( Document& document, const QualifiedName& tag_name, @@ -1058,7 +1058,7 @@ // Adjusts |task| to match the "adjusted insertion location" determined by the // foster parenting algorithm, laid out as the substeps of step 2 of -// https://html.spec.whatwg.org/#appropriate-place-for-inserting-a-node +// https://html.spec.whatwg.org/C/#appropriate-place-for-inserting-a-node void HTMLConstructionSite::FindFosterSite(HTMLConstructionSiteTask& task) { // 2.1 HTMLElementStack::ElementRecord* last_template =
diff --git a/third_party/blink/renderer/core/html/parser/html_parser_reentry_permit.h b/third_party/blink/renderer/core/html/parser/html_parser_reentry_permit.h index 99beaf5..60d6a66 100644 --- a/third_party/blink/renderer/core/html/parser/html_parser_reentry_permit.h +++ b/third_party/blink/renderer/core/html/parser/html_parser_reentry_permit.h
@@ -78,10 +78,10 @@ private: HTMLParserReentryPermit(); - // https://html.spec.whatwg.org/#script-nesting-level + // https://html.spec.whatwg.org/C/#script-nesting-level unsigned script_nesting_level_; - // https://html.spec.whatwg.org/#parser-pause-flag + // https://html.spec.whatwg.org/C/#parser-pause-flag bool parser_pause_flag_; DISALLOW_COPY_AND_ASSIGN(HTMLParserReentryPermit);
diff --git a/third_party/blink/renderer/core/html/parser/html_tree_builder.cc b/third_party/blink/renderer/core/html/parser/html_tree_builder.cc index 7075f10..2938897d 100644 --- a/third_party/blink/renderer/core/html/parser/html_tree_builder.cc +++ b/third_party/blink/renderer/core/html/parser/html_tree_builder.cc
@@ -727,7 +727,7 @@ return; } if (token->GetName() == kInputTag) { - // Per spec https://html.spec.whatwg.org/#parsing-main-inbody, + // Per spec https://html.spec.whatwg.org/C/#parsing-main-inbody, // section "A start tag whose tag name is "input"" Attribute* type_attribute = token->GetAttributeItem(kTypeAttr);
diff --git a/third_party/blink/renderer/core/html/parser/html_tree_builder.h b/third_party/blink/renderer/core/html/parser/html_tree_builder.h index 20a49fc..cc8f5145 100644 --- a/third_party/blink/renderer/core/html/parser/html_tree_builder.h +++ b/third_party/blink/renderer/core/html/parser/html_tree_builder.h
@@ -242,7 +242,7 @@ DISALLOW_COPY_AND_ASSIGN(FragmentParsingContext); }; - // https://html.spec.whatwg.org/#frameset-ok-flag + // https://html.spec.whatwg.org/C/#frameset-ok-flag bool frameset_ok_; #if DCHECK_IS_ON() bool is_attached_ = true;
diff --git a/third_party/blink/renderer/core/html/parser/html_tree_builder_simulator.cc b/third_party/blink/renderer/core/html/parser/html_tree_builder_simulator.cc index 2bfaf2b..24ff8c3ae 100644 --- a/third_party/blink/renderer/core/html/parser/html_tree_builder_simulator.cc +++ b/third_party/blink/renderer/core/html/parser/html_tree_builder_simulator.cc
@@ -104,7 +104,7 @@ } static bool TokenExitsInSelect(const CompactHTMLToken& token) { - // https://html.spec.whatwg.org/#parsing-main-inselect + // https://html.spec.whatwg.org/C/#parsing-main-inselect const String& tag_name = token.Data(); return ThreadSafeMatch(tag_name, kInputTag) || ThreadSafeMatch(tag_name, kKeygenTag) || @@ -184,7 +184,7 @@ } else if (!in_select_insertion_mode_) { // If we're in the "in select" insertion mode, all of these tags are // ignored, so we shouldn't change the tokenizer state: - // https://html.spec.whatwg.org/#parsing-main-inselect + // https://html.spec.whatwg.org/C/#parsing-main-inselect if (ThreadSafeMatch(tag_name, kPlaintextTag) && !in_select_insertion_mode_) { tokenizer->SetState(HTMLTokenizer::kPLAINTEXTState); @@ -205,7 +205,7 @@ // into PLAINTEXTState, and whether '<xmp>' and others will consume // textual content. // - // https://html.spec.whatwg.org/#parsing-main-inselect + // https://html.spec.whatwg.org/C/#parsing-main-inselect if (ThreadSafeMatch(tag_name, kSelectTag)) { in_select_insertion_mode_ = true; } else if (in_select_insertion_mode_ && TokenExitsInSelect(token)) {
diff --git a/third_party/blink/renderer/core/html/time_ranges.idl b/third_party/blink/renderer/core/html/time_ranges.idl index a7387ff..f153bee 100644 --- a/third_party/blink/renderer/core/html/time_ranges.idl +++ b/third_party/blink/renderer/core/html/time_ranges.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#time-ranges +// https://html.spec.whatwg.org/C/#time-ranges interface TimeRanges { readonly attribute unsigned long length;
diff --git a/third_party/blink/renderer/core/html/track/audio_track.idl b/third_party/blink/renderer/core/html/track/audio_track.idl index a948469..b9caec0 100644 --- a/third_party/blink/renderer/core/html/track/audio_track.idl +++ b/third_party/blink/renderer/core/html/track/audio_track.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/#audiotrack +// https://html.spec.whatwg.org/C/#audiotrack [ RuntimeEnabled=AudioVideoTracks,
diff --git a/third_party/blink/renderer/core/html/track/audio_track_list.idl b/third_party/blink/renderer/core/html/track/audio_track_list.idl index 0c898d2..acd08f5 100644 --- a/third_party/blink/renderer/core/html/track/audio_track_list.idl +++ b/third_party/blink/renderer/core/html/track/audio_track_list.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/#audiotracklist +// https://html.spec.whatwg.org/C/#audiotracklist [ RuntimeEnabled=AudioVideoTracks,
diff --git a/third_party/blink/renderer/core/html/track/cue_timeline.cc b/third_party/blink/renderer/core/html/track/cue_timeline.cc index 0060487..effc386 100644 --- a/third_party/blink/renderer/core/html/track/cue_timeline.cc +++ b/third_party/blink/renderer/core/html/track/cue_timeline.cc
@@ -129,7 +129,7 @@ if (media_element.GetDocument().IsDetached()) return; - // https://html.spec.whatwg.org/#time-marches-on + // https://html.spec.whatwg.org/C/#time-marches-on // 1 - Let current cues be a list of cues, initialized to contain all the // cues of all the hidden, showing, or showing by default text tracks of the
diff --git a/third_party/blink/renderer/core/html/track/html_track_element.idl b/third_party/blink/renderer/core/html/track/html_track_element.idl index 001cabc9..79bd122 100644 --- a/third_party/blink/renderer/core/html/track/html_track_element.idl +++ b/third_party/blink/renderer/core/html/track/html_track_element.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-track-element +// https://html.spec.whatwg.org/C/#the-track-element [HTMLConstructor] interface HTMLTrackElement : HTMLElement {
diff --git a/third_party/blink/renderer/core/html/track/text_track.idl b/third_party/blink/renderer/core/html/track/text_track.idl index 670e98c..1c4156b 100644 --- a/third_party/blink/renderer/core/html/track/text_track.idl +++ b/third_party/blink/renderer/core/html/track/text_track.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#texttrack +// https://html.spec.whatwg.org/C/#texttrack enum TextTrackMode { "disabled", "hidden", "showing" }; enum TextTrackKind { "subtitles", "captions", "descriptions", "chapters", "metadata" };
diff --git a/third_party/blink/renderer/core/html/track/text_track_cue.idl b/third_party/blink/renderer/core/html/track/text_track_cue.idl index a5f4522..6cdef69 100644 --- a/third_party/blink/renderer/core/html/track/text_track_cue.idl +++ b/third_party/blink/renderer/core/html/track/text_track_cue.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#texttrackcue +// https://html.spec.whatwg.org/C/#texttrackcue interface TextTrackCue : EventTarget { readonly attribute TextTrack? track;
diff --git a/third_party/blink/renderer/core/html/track/text_track_cue_list.cc b/third_party/blink/renderer/core/html/track/text_track_cue_list.cc index b7b18a9..44bd640b 100644 --- a/third_party/blink/renderer/core/html/track/text_track_cue_list.cc +++ b/third_party/blink/renderer/core/html/track/text_track_cue_list.cc
@@ -60,7 +60,7 @@ bool TextTrackCueList::Add(TextTrackCue* cue) { // Maintain text track cue order: - // https://html.spec.whatwg.org/#text-track-cue-order + // https://html.spec.whatwg.org/C/#text-track-cue-order wtf_size_t index = FindInsertionIndex(cue); // FIXME: The cue should not exist in the list in the first place.
diff --git a/third_party/blink/renderer/core/html/track/text_track_cue_list.idl b/third_party/blink/renderer/core/html/track/text_track_cue_list.idl index b6e90f2..af3abb9 100644 --- a/third_party/blink/renderer/core/html/track/text_track_cue_list.idl +++ b/third_party/blink/renderer/core/html/track/text_track_cue_list.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#texttrackcuelist +// https://html.spec.whatwg.org/C/#texttrackcuelist interface TextTrackCueList { readonly attribute unsigned long length;
diff --git a/third_party/blink/renderer/core/html/track/text_track_list.idl b/third_party/blink/renderer/core/html/track/text_track_list.idl index 044b423..d781e2a6 100644 --- a/third_party/blink/renderer/core/html/track/text_track_list.idl +++ b/third_party/blink/renderer/core/html/track/text_track_list.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#texttracklist +// https://html.spec.whatwg.org/C/#texttracklist interface TextTrackList : EventTarget { readonly attribute unsigned long length;
diff --git a/third_party/blink/renderer/core/html/track/video_track.idl b/third_party/blink/renderer/core/html/track/video_track.idl index 52965bdc..4d3fc37 100644 --- a/third_party/blink/renderer/core/html/track/video_track.idl +++ b/third_party/blink/renderer/core/html/track/video_track.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/#videotrack +// https://html.spec.whatwg.org/C/#videotrack [ RuntimeEnabled=AudioVideoTracks,
diff --git a/third_party/blink/renderer/core/html/track/video_track_list.idl b/third_party/blink/renderer/core/html/track/video_track_list.idl index b1a914f..6136a38 100644 --- a/third_party/blink/renderer/core/html/track/video_track_list.idl +++ b/third_party/blink/renderer/core/html/track/video_track_list.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/#videotracklist +// https://html.spec.whatwg.org/C/#videotracklist [ RuntimeEnabled=AudioVideoTracks,
diff --git a/third_party/blink/renderer/core/imagebitmap/image_bitmap_options.idl b/third_party/blink/renderer/core/imagebitmap/image_bitmap_options.idl index 0026c35..f15b66ff 100644 --- a/third_party/blink/renderer/core/imagebitmap/image_bitmap_options.idl +++ b/third_party/blink/renderer/core/imagebitmap/image_bitmap_options.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/#imagebitmapoptions +// https://html.spec.whatwg.org/C/#imagebitmapoptions enum ImageOrientation { "none", "flipY" }; enum ImageBitmapPixelFormat { "default", "uint8" };
diff --git a/third_party/blink/renderer/core/inspector/inspector_log_agent.cc b/third_party/blink/renderer/core/inspector/inspector_log_agent.cc index c362c841..bec90bb 100644 --- a/third_party/blink/renderer/core/inspector/inspector_log_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_log_agent.cc
@@ -267,6 +267,6 @@ ConsoleMessage* message = ConsoleMessage::Create( kViolationMessageSource, kVerboseMessageLevel, text, location->Clone()); ConsoleMessageAdded(message); -}; +} } // namespace blink
diff --git a/third_party/blink/renderer/core/intersection_observer/BUILD.gn b/third_party/blink/renderer/core/intersection_observer/BUILD.gn index 3237355..01949c2 100644 --- a/third_party/blink/renderer/core/intersection_observer/BUILD.gn +++ b/third_party/blink/renderer/core/intersection_observer/BUILD.gn
@@ -8,6 +8,8 @@ sources = [ "element_intersection_observer_data.cc", "element_intersection_observer_data.h", + "intersection_geometry.cc", + "intersection_geometry.h", "intersection_observation.cc", "intersection_observation.h", "intersection_observer.cc",
diff --git a/third_party/blink/renderer/core/layout/intersection_geometry.cc b/third_party/blink/renderer/core/intersection_observer/intersection_geometry.cc similarity index 61% rename from third_party/blink/renderer/core/layout/intersection_geometry.cc rename to third_party/blink/renderer/core/intersection_observer/intersection_geometry.cc index 7704bf79..bdb377a 100644 --- a/third_party/blink/renderer/core/layout/intersection_geometry.cc +++ b/third_party/blink/renderer/core/intersection_observer/intersection_geometry.cc
@@ -2,12 +2,13 @@ // 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/core/layout/intersection_geometry.h" +#include "third_party/blink/renderer/core/intersection_observer/intersection_geometry.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame_view.h" #include "third_party/blink/renderer/core/frame/settings.h" #include "third_party/blink/renderer/core/html/html_frame_owner_element.h" +#include "third_party/blink/renderer/core/intersection_observer/intersection_observer_entry.h" #include "third_party/blink/renderer/core/layout/adjust_for_absolute_zoom.h" #include "third_party/blink/renderer/core/layout/layout_box.h" #include "third_party/blink/renderer/core/layout/layout_inline.h" @@ -66,26 +67,33 @@ } // namespace -IntersectionGeometry::IntersectionGeometry(Element* root, - Element& target, +IntersectionGeometry::IntersectionGeometry(Element* root_element, + Element& target_element, const Vector<Length>& root_margin, - bool should_report_root_bounds) - : root_(root ? root->GetLayoutObject() : LocalRootView(target)), - target_(target.GetLayoutObject()), + const Vector<float>& thresholds, + unsigned flags) + : root_(root_element ? root_element->GetLayoutObject() + : LocalRootView(target_element)), + target_(target_element.GetLayoutObject()), root_margin_(root_margin), - does_intersect_(0), - should_report_root_bounds_(should_report_root_bounds), - root_is_implicit_(!root), - can_compute_geometry_(InitializeCanComputeGeometry(root, target)) { - if (can_compute_geometry_) - InitializeGeometry(); + thresholds_(thresholds), + flags_(flags), + intersection_ratio_(0), + threshold_index_(0) { + DCHECK(root_margin.IsEmpty() || root_margin.size() == 4); + if (root_element) + flags_ &= ~kRootIsImplicit; + else + flags_ |= kRootIsImplicit; + flags_ &= ~kIsVisible; + if (CanComputeGeometry(root_element, target_element)) + ComputeGeometry(); } IntersectionGeometry::~IntersectionGeometry() = default; -bool IntersectionGeometry::InitializeCanComputeGeometry(Element* root, - Element& target) const { - DCHECK(root_margin_.IsEmpty() || root_margin_.size() == 4); +bool IntersectionGeometry::CanComputeGeometry(Element* root, + Element& target) const { if (root && !root->isConnected()) return false; if (!root_ || !root_->IsBox()) @@ -99,12 +107,6 @@ return true; } -void IntersectionGeometry::InitializeGeometry() { - InitializeTargetRect(); - intersection_rect_ = target_rect_; - InitializeRootRect(); -} - void IntersectionGeometry::InitializeTargetRect() { if (target_->IsBox()) { target_rect_ = @@ -153,41 +155,36 @@ root_rect_.SetHeight(root_rect_.Height() + top_margin + bottom_margin); } -void IntersectionGeometry::ClipToRoot() { +unsigned IntersectionGeometry::FirstThresholdGreaterThan(float ratio) const { + unsigned result = 0; + while (result < thresholds_.size() && thresholds_[result] <= ratio) + ++result; + return result; +} + +bool IntersectionGeometry::ClipToRoot() { // Map and clip rect into root element coordinates. // TODO(szager): the writing mode flipping needs a test. LayoutBox* local_ancestor = nullptr; if (!RootIsImplicit() || root_->GetDocument().IsInMainFrame()) local_ancestor = ToLayoutBox(root_); - // If we're throttled, then we can't guarantee that geometry mapper is up to - // date, so we fall back to the slow path. If we're unthrottled, then ensure - // that prepaint has run and the frame view doesn't need a paint property - // update. -#if DCHECK_IS_ON() - { - auto* frame_view = target_->GetFrameView(); - auto* layout_view = frame_view->GetLayoutView(); - DCHECK(frame_view->ShouldThrottleRendering() || !layout_view || - !(layout_view->NeedsPaintPropertyUpdate() || - layout_view->DescendantNeedsPaintPropertyUpdate())); - } -#endif - VisualRectFlags use_geometry_mapper = - target_->GetFrameView()->ShouldThrottleRendering() - ? kDefaultVisualRectFlags - : kUseGeometryMapper; - VisualRectFlags flags = - static_cast<VisualRectFlags>(use_geometry_mapper | kEdgeInclusive); - does_intersect_ = target_->MapToVisualRectInAncestorSpace( - local_ancestor, intersection_rect_, flags); - if (!does_intersect_ || !local_ancestor) - return; + LayoutView* layout_view = target_->GetDocument().GetLayoutView(); + + unsigned flags = kDefaultVisualRectFlags | kEdgeInclusive; + if (!layout_view->NeedsPaintPropertyUpdate() && + !layout_view->DescendantNeedsPaintPropertyUpdate()) { + flags |= kUseGeometryMapper; + } + bool does_intersect = target_->MapToVisualRectInAncestorSpace( + local_ancestor, intersection_rect_, static_cast<VisualRectFlags>(flags)); + if (!does_intersect || !local_ancestor) + return does_intersect; if (local_ancestor->HasOverflowClip()) intersection_rect_.Move(-local_ancestor->ScrolledContentOffset()); LayoutRect root_clip_rect(root_rect_); local_ancestor->FlipForWritingMode(root_clip_rect); - does_intersect_ &= intersection_rect_.InclusiveIntersect(root_clip_rect); + return does_intersect & intersection_rect_.InclusiveIntersect(root_clip_rect); } void IntersectionGeometry::MapTargetRectToTargetFrameCoordinates() { @@ -218,13 +215,15 @@ } void IntersectionGeometry::ComputeGeometry() { - if (!CanComputeGeometry()) - return; + InitializeTargetRect(); + intersection_rect_ = target_rect_; + InitializeRootRect(); DCHECK(root_); DCHECK(target_); - ClipToRoot(); + DCHECK(!target_->GetDocument().View()->NeedsLayout()); + bool does_intersect = ClipToRoot(); MapTargetRectToTargetFrameCoordinates(); - if (does_intersect_) + if (does_intersect) MapIntersectionRectToTargetFrameCoordinates(); else intersection_rect_ = LayoutRect(); @@ -232,6 +231,63 @@ // transforming them to the frame. if (ShouldReportRootBounds()) MapRootRectToRootFrameCoordinates(); + + // Some corner cases for threshold index: + // - If target rect is zero area, because it has zero width and/or zero + // height, + // only two states are recognized: + // - 0 means not intersecting. + // - 1 means intersecting. + // No other threshold crossings are possible. + // - Otherwise: + // - If root and target do not intersect, the threshold index is 0. + + // - If root and target intersect but the intersection has zero-area + // (i.e., they have a coincident edge or corner), we consider the + // intersection to have "crossed" a zero threshold, but not crossed + // any non-zero threshold. + + if (does_intersect) { + const LayoutRect comparison_rect = + ShouldTrackFractionOfRoot() ? RootRect() : TargetRect(); + if (comparison_rect.IsEmpty()) { + intersection_ratio_ = 1; + } else { + const LayoutSize& intersection_size = IntersectionRect().Size(); + const float intersection_area = intersection_size.Width().ToFloat() * + intersection_size.Height().ToFloat(); + const LayoutSize& comparison_size = comparison_rect.Size(); + const float area_of_interest = comparison_size.Width().ToFloat() * + comparison_size.Height().ToFloat(); + intersection_ratio_ = intersection_area / area_of_interest; + } + threshold_index_ = FirstThresholdGreaterThan(intersection_ratio_); + } else { + intersection_ratio_ = 0; + threshold_index_ = 0; + } + ComputeVisibility(); +} + +void IntersectionGeometry::ComputeVisibility() { + if (!IsIntersecting() || !ShouldComputeVisibility()) + return; + DCHECK(RuntimeEnabledFeatures::IntersectionObserverV2Enabled()); + if (target_->GetDocument() + .GetFrame() + ->LocalFrameRoot() + .MayBeOccludedOrObscuredByRemoteAncestor()) { + return; + } + if (target_->HasDistortingVisualEffects()) + return; + // TODO(layout-dev): This should hit-test the intersection rect, not the + // target rect; it's not helpful to know that the portion of the target that + // is clipped is also occluded. To do that, the intersection rect must be + // mapped down to the local space of the target element. + HitTestResult result(target_->HitTestForOcclusion(TargetRect())); + if (!result.InnerNode() || result.InnerNode() == target_->GetNode()) + flags_ |= kIsVisible; } LayoutRect IntersectionGeometry::UnZoomedTargetRect() const { @@ -258,4 +314,18 @@ return LayoutRect(rect); } +IntersectionObserverEntry* IntersectionGeometry::CreateEntry( + Element* target, + DOMHighResTimeStamp timestamp) { + FloatRect root_bounds(UnZoomedRootRect()); + FloatRect* root_bounds_pointer = + ShouldReportRootBounds() ? &root_bounds : nullptr; + IntersectionObserverEntry* entry = + MakeGarbageCollected<IntersectionObserverEntry>( + timestamp, IntersectionRatio(), FloatRect(UnZoomedTargetRect()), + root_bounds_pointer, FloatRect(UnZoomedIntersectionRect()), + IsIntersecting(), IsVisible(), target); + return entry; +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/intersection_observer/intersection_geometry.h b/third_party/blink/renderer/core/intersection_observer/intersection_geometry.h new file mode 100644 index 0000000..6714cbb --- /dev/null +++ b/third_party/blink/renderer/core/intersection_observer/intersection_geometry.h
@@ -0,0 +1,120 @@ +// 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_CORE_INTERSECTION_OBSERVER_INTERSECTION_GEOMETRY_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_INTERSECTION_OBSERVER_INTERSECTION_GEOMETRY_H_ + +#include "third_party/blink/renderer/core/dom/dom_high_res_time_stamp.h" +#include "third_party/blink/renderer/platform/geometry/layout_rect.h" +#include "third_party/blink/renderer/platform/geometry/length.h" +#include "third_party/blink/renderer/platform/heap/handle.h" +#include "third_party/blink/renderer/platform/wtf/vector.h" + +namespace blink { + +class Element; +class IntersectionObserverEntry; +class LayoutObject; + +// Computes the intersection between an ancestor (root) element and a +// descendant (target) element, with overflow and CSS clipping applied. +// Optionally also checks whether the target is occluded or has visual +// effects applied. +// +// If the root argument to the constructor is null, computes the intersection +// of the target with the top-level frame viewport (AKA the "implicit root"). +class IntersectionGeometry { + STACK_ALLOCATED(); + + public: + enum Flags { + // These flags should passed to the constructor + kShouldReportRootBounds = 1 << 0, + kShouldComputeVisibility = 1 << 1, + kShouldTrackFractionOfRoot = 1 << 2, + + // These flags will be computed + kRootIsImplicit = 1 << 3, + kIsVisible = 1 << 4 + }; + + IntersectionGeometry(Element* root, + Element& target, + const Vector<Length>& root_margin, + const Vector<float>& thresholds, + unsigned flags); + ~IntersectionGeometry(); + + bool ShouldReportRootBounds() const { + return flags_ & kShouldReportRootBounds; + } + bool ShouldComputeVisibility() const { + return flags_ & kShouldComputeVisibility; + } + bool ShouldTrackFractionOfRoot() const { + return flags_ & kShouldTrackFractionOfRoot; + } + + LayoutObject* Root() const { return root_; } + LayoutObject* Target() const { return target_; } + + // Client rect in the coordinate system of the frame containing target. + LayoutRect TargetRect() const { return target_rect_; } + // Target rect in CSS pixels + LayoutRect UnZoomedTargetRect() const; + + // Client rect in the coordinate system of the frame containing target. + LayoutRect IntersectionRect() const { return intersection_rect_; } + // Intersection rect in CSS pixels + LayoutRect UnZoomedIntersectionRect() const; + + // Client rect in the coordinate system of the frame containing root. + LayoutRect RootRect() const { return root_rect_; } + // Root rect in CSS pixels + LayoutRect UnZoomedRootRect() const; + + IntRect IntersectionIntRect() const { + return PixelSnappedIntRect(intersection_rect_); + } + IntRect TargetIntRect() const { return PixelSnappedIntRect(target_rect_); } + IntRect RootIntRect() const { return PixelSnappedIntRect(root_rect_); } + + double IntersectionRatio() const { return intersection_ratio_; } + unsigned ThresholdIndex() const { return threshold_index_; } + + bool RootIsImplicit() const { return flags_ & kRootIsImplicit; } + bool IsIntersecting() const { return threshold_index_ > 0; } + bool IsVisible() const { return flags_ & kIsVisible; } + + IntersectionObserverEntry* CreateEntry(Element* target, + DOMHighResTimeStamp timestamp); + + private: + void ComputeGeometry(); + bool CanComputeGeometry(Element* root, Element& target) const; + void InitializeTargetRect(); + void InitializeRootRect(); + bool ClipToRoot(); + void MapTargetRectToTargetFrameCoordinates(); + void MapRootRectToRootFrameCoordinates(); + void MapIntersectionRectToTargetFrameCoordinates(); + void ApplyRootMargin(); + unsigned FirstThresholdGreaterThan(float ratio) const; + void ComputeVisibility(); + + LayoutObject* root_; + LayoutObject* target_; + const Vector<Length>& root_margin_; + const Vector<float>& thresholds_; + LayoutRect target_rect_; + LayoutRect intersection_rect_; + LayoutRect root_rect_; + unsigned flags_; + double intersection_ratio_; + unsigned threshold_index_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_INTERSECTION_OBSERVER_INTERSECTION_GEOMETRY_H_
diff --git a/third_party/blink/renderer/core/intersection_observer/intersection_observation.cc b/third_party/blink/renderer/core/intersection_observer/intersection_observation.cc index b1cebee..39eecb4 100644 --- a/third_party/blink/renderer/core/intersection_observer/intersection_observation.cc +++ b/third_party/blink/renderer/core/intersection_observer/intersection_observation.cc
@@ -6,32 +6,16 @@ #include "third_party/blink/renderer/core/dom/element_rare_data.h" #include "third_party/blink/renderer/core/frame/local_frame.h" +#include "third_party/blink/renderer/core/intersection_observer/intersection_geometry.h" #include "third_party/blink/renderer/core/intersection_observer/intersection_observer.h" #include "third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.h" #include "third_party/blink/renderer/core/layout/hit_test_result.h" -#include "third_party/blink/renderer/core/layout/intersection_geometry.h" #include "third_party/blink/renderer/core/layout/layout_object.h" namespace blink { namespace { -bool IsOccluded(const Element& element, const IntersectionGeometry& geometry) { - DCHECK(RuntimeEnabledFeatures::IntersectionObserverV2Enabled()); - if (element.GetDocument() - .GetFrame() - ->LocalFrameRoot() - .MayBeOccludedOrObscuredByRemoteAncestor()) { - return true; - } - // TODO(layout-dev): This should hit-test the intersection rect, not the - // target rect; it's not helpful to know that the portion of the target that - // is clipped is also occluded. To do that, the intersection rect must be - // mapped down to the local space of the target element. - HitTestResult result( - element.GetLayoutObject()->HitTestForOcclusion(geometry.TargetRect())); - return result.InnerNode() && result.InnerNode() != &element; -} } // namespace @@ -76,74 +60,28 @@ bool report_root_bounds = observer_->AlwaysReportRootBounds() || (flags & kReportImplicitRootBounds) || !observer_->RootIsImplicit(); - IntersectionGeometry geometry(observer_->root(), *Target(), root_margin, - report_root_bounds); - geometry.ComputeGeometry(); + unsigned geometry_flags = 0; + if (report_root_bounds) + geometry_flags |= IntersectionGeometry::kShouldReportRootBounds; + if (Observer()->trackVisibility()) + geometry_flags |= IntersectionGeometry::kShouldComputeVisibility; + if (Observer()->trackFractionOfRoot()) + geometry_flags |= IntersectionGeometry::kShouldTrackFractionOfRoot; - // Some corner cases for threshold index: - // - If target rect is zero area, because it has zero width and/or zero - // height, - // only two states are recognized: - // - 0 means not intersecting. - // - 1 means intersecting. - // No other threshold crossings are possible. - // - Otherwise: - // - If root and target do not intersect, the threshold index is 0. - // - If root and target intersect but the intersection has zero-area - // (i.e., they have a coincident edge or corner), we consider the - // intersection to have "crossed" a zero threshold, but not crossed - // any non-zero threshold. - unsigned new_threshold_index; - float new_visible_ratio; - bool is_visible = false; - if (geometry.DoesIntersect()) { - const LayoutRect comparison_rect = observer_->trackFractionOfRoot() - ? geometry.RootRect() - : geometry.TargetRect(); - if (comparison_rect.IsEmpty()) { - new_visible_ratio = 1; - } else { - const LayoutSize& intersection_size = geometry.IntersectionRect().Size(); - const float intersection_area = intersection_size.Width().ToFloat() * - intersection_size.Height().ToFloat(); - const LayoutSize& comparison_size = comparison_rect.Size(); - const float area_of_interest = comparison_size.Width().ToFloat() * - comparison_size.Height().ToFloat(); - new_visible_ratio = intersection_area / area_of_interest; - } - new_threshold_index = - Observer()->FirstThresholdGreaterThan(new_visible_ratio); - if (RuntimeEnabledFeatures::IntersectionObserverV2Enabled() && - Observer()->trackVisibility()) { - is_visible = new_threshold_index > 0 && - !Target()->GetLayoutObject()->HasDistortingVisualEffects() && - !IsOccluded(*Target(), geometry); - } - } else { - new_visible_ratio = 0; - new_threshold_index = 0; - } + IntersectionGeometry geometry(observer_->root(), *Target(), root_margin, + observer_->thresholds(), geometry_flags); // TODO(tkent): We can't use CHECK_LT due to a compile error. - CHECK(new_threshold_index < kMaxThresholdIndex - 1); + CHECK(geometry.ThresholdIndex() < kMaxThresholdIndex - 1); - if (last_threshold_index_ != new_threshold_index || - last_is_visible_ != is_visible) { - FloatRect root_bounds(geometry.UnZoomedRootRect()); - FloatRect* root_bounds_pointer = - report_root_bounds ? &root_bounds : nullptr; - IntersectionObserverEntry* new_entry = - MakeGarbageCollected<IntersectionObserverEntry>( - timestamp, new_visible_ratio, - FloatRect(geometry.UnZoomedTargetRect()), root_bounds_pointer, - FloatRect(geometry.UnZoomedIntersectionRect()), - new_threshold_index > 0, is_visible, Target()); - entries_.push_back(new_entry); + if (last_threshold_index_ != geometry.ThresholdIndex() || + last_is_visible_ != geometry.IsVisible()) { + entries_.push_back(geometry.CreateEntry(Target(), timestamp)); To<Document>(Observer()->GetExecutionContext()) ->EnsureIntersectionObserverController() .ScheduleIntersectionObserverForDelivery(*Observer()); - SetLastThresholdIndex(new_threshold_index); - SetWasVisible(is_visible); + SetLastThresholdIndex(geometry.ThresholdIndex()); + SetWasVisible(geometry.IsVisible()); } }
diff --git a/third_party/blink/renderer/core/layout/BUILD.gn b/third_party/blink/renderer/core/layout/BUILD.gn index b150a53..1d09ecb 100644 --- a/third_party/blink/renderer/core/layout/BUILD.gn +++ b/third_party/blink/renderer/core/layout/BUILD.gn
@@ -91,8 +91,6 @@ "hit_test_result.h", "hit_testing_transform_state.cc", "hit_testing_transform_state.h", - "intersection_geometry.cc", - "intersection_geometry.h", "intrinsic_sizing_info.h", "jank_region.cc", "jank_region.h",
diff --git a/third_party/blink/renderer/core/layout/api/line_layout_block_flow.h b/third_party/blink/renderer/core/layout/api/line_layout_block_flow.h index 95a06d1..1b3ac4f 100644 --- a/third_party/blink/renderer/core/layout/api/line_layout_block_flow.h +++ b/third_party/blink/renderer/core/layout/api/line_layout_block_flow.h
@@ -205,10 +205,10 @@ private: LayoutBlockFlow* ToBlockFlow() { return ToLayoutBlockFlow(GetLayoutObject()); - }; + } const LayoutBlockFlow* ToBlockFlow() const { return ToLayoutBlockFlow(GetLayoutObject()); - }; + } }; } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/grid.cc b/third_party/blink/renderer/core/layout/grid.cc index 90aad1c7..f13eca09 100644 --- a/third_party/blink/renderer/core/layout/grid.cc +++ b/third_party/blink/renderer/core/layout/grid.cc
@@ -17,7 +17,7 @@ static inline GridTrackSizingDirection OrthogonalDirection( GridTrackSizingDirection direction) { return direction == kForRows ? kForColumns : kForRows; -}; +} } // namespace
diff --git a/third_party/blink/renderer/core/layout/grid.h b/third_party/blink/renderer/core/layout/grid.h index 4b5d90c..0304dd7 100644 --- a/third_party/blink/renderer/core/layout/grid.h +++ b/third_party/blink/renderer/core/layout/grid.h
@@ -41,7 +41,7 @@ virtual const GridItemList& Cell(size_t row, size_t column) const = 0; - virtual ~Grid(){}; + virtual ~Grid() {} // Note that out of flow children are not grid items. bool HasGridItems() const { return !grid_item_area_.IsEmpty(); } @@ -72,7 +72,7 @@ OrderIterator& GetOrderIterator() { return order_iterator_; } void SetNeedsItemsPlacement(bool); - bool NeedsItemsPlacement() const { return needs_items_placement_; }; + bool NeedsItemsPlacement() const { return needs_items_placement_; } #if DCHECK_IS_ON() bool HasAnyGridItemPaintOrder() const;
diff --git a/third_party/blink/renderer/core/layout/grid_baseline_alignment.h b/third_party/blink/renderer/core/layout/grid_baseline_alignment.h index 43c017b..54989cf 100644 --- a/third_party/blink/renderer/core/layout/grid_baseline_alignment.h +++ b/third_party/blink/renderer/core/layout/grid_baseline_alignment.h
@@ -155,7 +155,7 @@ // Sets the Grid Container's writing-mode so that we can avoid the // dependecy of the LayoutGrid class for determining whether a grid // item is orthogonal or not. - void SetBlockFlow(WritingMode block_flow) { block_flow_ = block_flow; }; + void SetBlockFlow(WritingMode block_flow) { block_flow_ = block_flow; } // Clearing the Baseline Alignment context and their internal // classes and data structures.
diff --git a/third_party/blink/renderer/core/layout/grid_track_sizing_algorithm.h b/third_party/blink/renderer/core/layout/grid_track_sizing_algorithm.h index 9542ea5..0b5b4578 100644 --- a/third_party/blink/renderer/core/layout/grid_track_sizing_algorithm.h +++ b/third_party/blink/renderer/core/layout/grid_track_sizing_algorithm.h
@@ -97,8 +97,8 @@ // TODO (jfernandez): We should remove any public getter for this attribute // and encapsulate any access in the algorithm class. Grid& GetMutableGrid() const { return grid_; } - LayoutUnit MinContentSize() const { return min_content_size_; }; - LayoutUnit MaxContentSize() const { return max_content_size_; }; + LayoutUnit MinContentSize() const { return min_content_size_; } + LayoutUnit MaxContentSize() const { return max_content_size_; } LayoutUnit BaselineOffsetForChild(const LayoutBox&, GridAxis) const;
diff --git a/third_party/blink/renderer/core/layout/hit_test_canvas_result.cc b/third_party/blink/renderer/core/layout/hit_test_canvas_result.cc index 2dc74ae..8c1f87c 100644 --- a/third_party/blink/renderer/core/layout/hit_test_canvas_result.cc +++ b/third_party/blink/renderer/core/layout/hit_test_canvas_result.cc
@@ -15,7 +15,7 @@ Element* HitTestCanvasResult::GetControl() const { return control_.Get(); -}; +} void HitTestCanvasResult::Trace(blink::Visitor* visitor) { visitor->Trace(control_);
diff --git a/third_party/blink/renderer/core/layout/intersection_geometry.h b/third_party/blink/renderer/core/layout/intersection_geometry.h deleted file mode 100644 index 3a625f9..0000000 --- a/third_party/blink/renderer/core/layout/intersection_geometry.h +++ /dev/null
@@ -1,95 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_INTERSECTION_GEOMETRY_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_INTERSECTION_GEOMETRY_H_ - -#include "third_party/blink/renderer/platform/geometry/layout_rect.h" -#include "third_party/blink/renderer/platform/geometry/length.h" -#include "third_party/blink/renderer/platform/heap/handle.h" -#include "third_party/blink/renderer/platform/wtf/vector.h" - -namespace blink { - -class Element; -class LayoutObject; - -// Computes the intersection between an ancestor (root) element and a -// descendant (target) element, with overflow and CSS clipping applied, but not -// paint occlusion. -// -// If the root argument to the constructor is null, computes the intersection -// of the target with the top-level frame viewport (AKA the "implicit root"). -class IntersectionGeometry { - STACK_ALLOCATED(); - - public: - IntersectionGeometry(Element* root, - Element& target, - const Vector<Length>& root_margin, - bool should_report_root_bounds); - ~IntersectionGeometry(); - - void ComputeGeometry(); - - LayoutObject* Root() const { return root_; } - LayoutObject* Target() const { return target_; } - - // Client rect in the coordinate system of the frame containing target. - LayoutRect TargetRect() const { return target_rect_; } - // Target rect in CSS pixels - LayoutRect UnZoomedTargetRect() const; - - // Client rect in the coordinate system of the frame containing target. - LayoutRect IntersectionRect() const { return intersection_rect_; } - // Intersection rect in CSS pixels - LayoutRect UnZoomedIntersectionRect() const; - - // Client rect in the coordinate system of the frame containing root. - LayoutRect RootRect() const { return root_rect_; } - // Root rect in CSS pixels - LayoutRect UnZoomedRootRect() const; - - bool DoesIntersect() const { return does_intersect_; } - - IntRect IntersectionIntRect() const { - return PixelSnappedIntRect(intersection_rect_); - } - - IntRect TargetIntRect() const { return PixelSnappedIntRect(target_rect_); } - - IntRect RootIntRect() const { return PixelSnappedIntRect(root_rect_); } - - private: - bool InitializeCanComputeGeometry(Element* root, Element& target) const; - void InitializeGeometry(); - void InitializeTargetRect(); - void InitializeRootRect(); - void ClipToRoot(); - void MapTargetRectToTargetFrameCoordinates(); - void MapRootRectToRootFrameCoordinates(); - void MapIntersectionRectToTargetFrameCoordinates(); - void ApplyRootMargin(); - - // Returns true iff it's possible to compute an intersection between root - // and target. - bool CanComputeGeometry() const { return can_compute_geometry_; } - bool RootIsImplicit() const { return root_is_implicit_; } - bool ShouldReportRootBounds() const { return should_report_root_bounds_; } - - LayoutObject* root_; - LayoutObject* target_; - const Vector<Length> root_margin_; - LayoutRect target_rect_; - LayoutRect intersection_rect_; - LayoutRect root_rect_; - unsigned does_intersect_ : 1; - const unsigned should_report_root_bounds_ : 1; - const unsigned root_is_implicit_ : 1; - const unsigned can_compute_geometry_ : 1; -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_INTERSECTION_GEOMETRY_H_
diff --git a/third_party/blink/renderer/core/layout/layout_table_section.h b/third_party/blink/renderer/core/layout/layout_table_section.h index 0f4b2719..d69ecbf 100644 --- a/third_party/blink/renderer/core/layout/layout_table_section.h +++ b/third_party/blink/renderer/core/layout/layout_table_section.h
@@ -265,8 +265,8 @@ TransformState&, VisualRectFlags = kDefaultVisualRectFlags) const override; - bool IsRepeatingHeaderGroup() const { return is_repeating_header_group_; }; - bool IsRepeatingFooterGroup() const { return is_repeating_footer_group_; }; + bool IsRepeatingHeaderGroup() const { return is_repeating_header_group_; } + bool IsRepeatingFooterGroup() const { return is_repeating_footer_group_; } void UpdateLayout() override;
diff --git a/third_party/blink/renderer/core/layout/line/line_box_list.h b/third_party/blink/renderer/core/layout/line/line_box_list.h index 969f137b..749752d 100644 --- a/third_party/blink/renderer/core/layout/line/line_box_list.h +++ b/third_party/blink/renderer/core/layout/line/line_box_list.h
@@ -120,7 +120,7 @@ STACK_ALLOCATED(); public: - explicit ReverseRange(InlineBoxType* last) : last_(last){}; + explicit ReverseRange(InlineBoxType* last) : last_(last) {} ReverseIterator begin() const { return ReverseIterator(last_); } ReverseIterator end() const { return ReverseIterator(nullptr); }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder_test.cc b/third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder_test.cc index 21e6911f..eb59619 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder_test.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder_test.cc
@@ -38,7 +38,7 @@ EXPECT_EQ(space.AvailableSize().inline_size, icb_size.height); EXPECT_EQ(space.PercentageResolutionInlineSize(), icb_size.height); -}; +} // Asserts that indefinite inline length becomes initial containing // block height for vertical-lr inside horizontal document. @@ -67,7 +67,7 @@ EXPECT_EQ(space.AvailableSize().inline_size, icb_size.width); EXPECT_EQ(space.PercentageResolutionInlineSize(), icb_size.width); -}; +} } // namespace
diff --git a/third_party/blink/renderer/core/layout/ng/ng_layout_input_node.h b/third_party/blink/renderer/core/layout/ng/ng_layout_input_node.h index 863c1c4..a5f4d950 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_layout_input_node.h +++ b/third_party/blink/renderer/core/layout/ng/ng_layout_input_node.h
@@ -124,7 +124,7 @@ bool IsAnonymousBlock() const { return box_->IsAnonymousBlock(); } // If the node is a quirky container for margin collapsing, see: - // https://html.spec.whatwg.org/#margin-collapsing-quirks + // https://html.spec.whatwg.org/C/#margin-collapsing-quirks // NOTE: The spec appears to only somewhat match reality. bool IsQuirkyContainer() const { return box_->GetDocument().InQuirksMode() && @@ -171,7 +171,7 @@ NGPhysicalSize InitialContainingBlockSize() const; // Returns the LayoutObject which is associated with this node. - LayoutBox* GetLayoutBox() const { return box_; }; + LayoutBox* GetLayoutBox() const { return box_; } const ComputedStyle& Style() const { return box_->StyleRef(); }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part_test.cc b/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part_test.cc index f923cdc..ee842b08 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part_test.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part_test.cc
@@ -70,8 +70,7 @@ EXPECT_EQ(fixed_1->OffsetTop(), LayoutUnit(99)); // fixed2 top is positioned: #fixed2.top EXPECT_EQ(fixed_2->OffsetTop(), LayoutUnit(9)); -}; - +} } // namespace } // namespace blink
diff --git a/third_party/blink/renderer/core/loader/appcache/application_cache.idl b/third_party/blink/renderer/core/loader/appcache/application_cache.idl index f173d23..e5826d20 100644 --- a/third_party/blink/renderer/core/loader/appcache/application_cache.idl +++ b/third_party/blink/renderer/core/loader/appcache/application_cache.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#application-cache-api +// https://html.spec.whatwg.org/C/#application-cache-api [ DoNotCheckConstants,
diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h index 9336f893..663268b 100644 --- a/third_party/blink/renderer/core/loader/empty_clients.h +++ b/third_party/blink/renderer/core/loader/empty_clients.h
@@ -395,7 +395,7 @@ void AnnotatedRegionsChanged() override {} base::UnguessableToken GetDevToolsFrameToken() const override { return base::UnguessableToken::Create(); - }; + } String evaluateInInspectorOverlayForTesting(const String& script) override { return g_empty_string; } @@ -467,7 +467,7 @@ void FrameFocused() const override {} base::UnguessableToken GetDevToolsFrameToken() const override { return base::UnguessableToken::Create(); - }; + } DISALLOW_COPY_AND_ASSIGN(EmptyRemoteFrameClient); };
diff --git a/third_party/blink/renderer/core/loader/frame_loader.cc b/third_party/blink/renderer/core/loader/frame_loader.cc index fdb10ea9..19cdced 100644 --- a/third_party/blink/renderer/core/loader/frame_loader.cc +++ b/third_party/blink/renderer/core/loader/frame_loader.cc
@@ -692,7 +692,7 @@ if (url.ProtocolIsJavaScript()) { Document* origin_document = request.OriginDocument(); // Check the CSP of the caller (the "source browsing context") if required, - // as per https://html.spec.whatwg.org/#javascript-protocol. + // as per https://html.spec.whatwg.org/C/#javascript-protocol. bool javascript_url_is_allowed = request.ShouldCheckMainWorldContentSecurityPolicy() == kDoNotCheckContentSecurityPolicy || @@ -1538,7 +1538,7 @@ // This seems to correspond to step 9 of the specification: // "9. Abort the active document of browsingContext." - // https://html.spec.whatwg.org/#navigate + // https://html.spec.whatwg.org/C/#navigate frame_->GetDocument()->Abort(); // document.onreadystatechange can fire in Abort(), which can: // 1) Detach this frame.
diff --git a/third_party/blink/renderer/core/loader/interactive_detector_test.cc b/third_party/blink/renderer/core/loader/interactive_detector_test.cc index 9e5a3f4..93f775274 100644 --- a/third_party/blink/renderer/core/loader/interactive_detector_test.cc +++ b/third_party/blink/renderer/core/loader/interactive_detector_test.cc
@@ -24,7 +24,7 @@ virtual void SetActiveConnections(int active_connections) { active_connections_ = active_connections; - }; + } int GetActiveConnections() override; private:
diff --git a/third_party/blink/renderer/core/loader/link_loader.cc b/third_party/blink/renderer/core/loader/link_loader.cc index 99f5ce3..786e2b91 100644 --- a/third_party/blink/renderer/core/loader/link_loader.cc +++ b/third_party/blink/renderer/core/loader/link_loader.cc
@@ -138,7 +138,7 @@ client_->LinkLoaded(); } -// https://html.spec.whatwg.org/#link-type-modulepreload +// https://html.spec.whatwg.org/C/#link-type-modulepreload void LinkLoader::NotifyModuleLoadFinished(ModuleScript* module) { // Step 11. "If result is null, fire an event named error at the link element, // and return." [spec text]
diff --git a/third_party/blink/renderer/core/loader/modulescript/module_script_fetcher.cc b/third_party/blink/renderer/core/loader/modulescript/module_script_fetcher.cc index 1af6cfc2..da86ef0 100644 --- a/third_party/blink/renderer/core/loader/modulescript/module_script_fetcher.cc +++ b/third_party/blink/renderer/core/loader/modulescript/module_script_fetcher.cc
@@ -25,7 +25,7 @@ Resource* resource, HeapVector<Member<ConsoleMessage>>* error_messages) { // Implements conditions in Step 7 of - // https://html.spec.whatwg.org/#fetch-a-single-module-script + // https://html.spec.whatwg.org/C/#fetch-a-single-module-script DCHECK(error_messages);
diff --git a/third_party/blink/renderer/core/loader/modulescript/module_script_loader_client.h b/third_party/blink/renderer/core/loader/modulescript/module_script_loader_client.h index e8f1b95..783e2d34 100644 --- a/third_party/blink/renderer/core/loader/modulescript/module_script_loader_client.h +++ b/third_party/blink/renderer/core/loader/modulescript/module_script_loader_client.h
@@ -18,7 +18,6 @@ class ModuleScriptLoaderClient : public GarbageCollectedMixin { public: virtual ~ModuleScriptLoaderClient() = default; - ; private: friend class ModuleScriptLoader;
diff --git a/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.cc b/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.cc index f7c9e19..4a164a3 100644 --- a/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.cc +++ b/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.cc
@@ -470,7 +470,7 @@ AdvanceState(State::kFinished); } -// [FFPE] https://html.spec.whatwg.org/#finding-the-first-parse-error +// [FFPE] https://html.spec.whatwg.org/C/#finding-the-first-parse-error // // This returns non-empty ScriptValue iff a parse error is found. ScriptValue ModuleTreeLinker::FindFirstParseError(
diff --git a/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.h b/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.h index b7da4df..c739ec7f 100644 --- a/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.h +++ b/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.h
@@ -31,16 +31,16 @@ // // Spec links: // [IMSGF] -// https://html.spec.whatwg.org/#internal-module-script-graph-fetching-procedure +// https://html.spec.whatwg.org/C/#internal-module-script-graph-fetching-procedure // [FD] -// https://html.spec.whatwg.org/#fetch-the-descendants-of-a-module-script +// https://html.spec.whatwg.org/C/#fetch-the-descendants-of-a-module-script // [FDaI] -// https://html.spec.whatwg.org/#fetch-the-descendants-of-and-instantiate-a-module-script +// https://html.spec.whatwg.org/C/#fetch-the-descendants-of-and-instantiate-a-module-script // [FFPE] -// https://html.spec.whatwg.org/#finding-the-first-parse-error +// https://html.spec.whatwg.org/C/#finding-the-first-parse-error class CORE_EXPORT ModuleTreeLinker final : public SingleModuleClient { public: - // https://html.spec.whatwg.org/#fetch-a-module-script-tree + // https://html.spec.whatwg.org/C/#fetch-a-module-script-tree static void Fetch(const KURL&, ResourceFetcher* fetch_client_settings_object_fetcher, mojom::RequestContextType destination,
diff --git a/third_party/blink/renderer/core/loader/preload_helper.cc b/third_party/blink/renderer/core/loader/preload_helper.cc index 2cbfd913..3514b12 100644 --- a/third_party/blink/renderer/core/loader/preload_helper.cc +++ b/third_party/blink/renderer/core/loader/preload_helper.cc
@@ -350,7 +350,7 @@ } // Preload only if media matches. - // https://html.spec.whatwg.org/#processing-the-media-attribute + // https://html.spec.whatwg.org/C/#processing-the-media-attribute if (!params.media.IsEmpty()) { MediaValues* media_values = CreateMediaValues(document, viewport_description);
diff --git a/third_party/blink/renderer/core/messaging/message_channel.idl b/third_party/blink/renderer/core/messaging/message_channel.idl index 8462ff0..7377c57 100644 --- a/third_party/blink/renderer/core/messaging/message_channel.idl +++ b/third_party/blink/renderer/core/messaging/message_channel.idl
@@ -24,7 +24,7 @@ * */ -// https://html.spec.whatwg.org/#message-channels +// https://html.spec.whatwg.org/C/#message-channels [ CustomConstructor,
diff --git a/third_party/blink/renderer/core/page/chrome_client.h b/third_party/blink/renderer/core/page/chrome_client.h index 4b21628..b7f82bd 100644 --- a/third_party/blink/renderer/core/page/chrome_client.h +++ b/third_party/blink/renderer/core/page/chrome_client.h
@@ -310,8 +310,8 @@ virtual void SetBrowserControlsState(float top_height, float bottom_height, - bool shrinks_layout){}; - virtual void SetBrowserControlsShownRatio(float){}; + bool shrinks_layout) {} + virtual void SetBrowserControlsShownRatio(float) {} virtual String AcceptLanguages() = 0;
diff --git a/third_party/blink/renderer/core/page/create_window.cc b/third_party/blink/renderer/core/page/create_window.cc index bb5f28c..1765b65 100644 --- a/third_party/blink/renderer/core/page/create_window.cc +++ b/third_party/blink/renderer/core/page/create_window.cc
@@ -71,7 +71,7 @@ WebWindowFeatures window_features; // This code follows the HTML spec, specifically - // https://html.spec.whatwg.org/#concept-window-open-features-tokenize + // https://html.spec.whatwg.org/C/#concept-window-open-features-tokenize if (feature_string.IsEmpty()) return window_features;
diff --git a/third_party/blink/renderer/core/page/scrolling/scroll_customization_callbacks.h b/third_party/blink/renderer/core/page/scrolling/scroll_customization_callbacks.h index f5ce11a..ad7ee18 100644 --- a/third_party/blink/renderer/core/page/scrolling/scroll_customization_callbacks.h +++ b/third_party/blink/renderer/core/page/scrolling/scroll_customization_callbacks.h
@@ -31,7 +31,7 @@ visitor->Trace(apply_scroll_callbacks_); visitor->Trace(distribute_scroll_callbacks_); visitor->Trace(in_scrolling_phase_); - }; + } private: using ScrollStateCallbackList =
diff --git a/third_party/blink/renderer/core/paint/ellipsis_box_painter.cc b/third_party/blink/renderer/core/paint/ellipsis_box_painter.cc index d483f87..c1f28b7 100644 --- a/third_party/blink/renderer/core/paint/ellipsis_box_painter.cc +++ b/third_party/blink/renderer/core/paint/ellipsis_box_painter.cc
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/core/layout/line/root_inline_box.h" #include "third_party/blink/renderer/core/layout/text_run_constructor.h" #include "third_party/blink/renderer/core/paint/paint_info.h" -#include "third_party/blink/renderer/core/paint/paint_timing_detector.h" #include "third_party/blink/renderer/core/paint/text_painter.h" #include "third_party/blink/renderer/platform/graphics/graphics_context_state_saver.h" #include "third_party/blink/renderer/platform/graphics/paint/drawing_recorder.h" @@ -70,11 +69,6 @@ // TODO(npm): Check that there are non-whitespace characters. See // crbug.com/788444. context.GetPaintController().SetTextPainted(); - if (RuntimeEnabledFeatures::FirstContentfulPaintPlusPlusEnabled()) { - PaintTimingDetector::NotifyTextPaint( - ellipsis_box_.GetLineLayoutItem().GetNode(), - paint_info.context.GetPaintController().CurrentPaintChunkProperties()); - } } } // namespace blink
diff --git a/third_party/blink/renderer/core/paint/file_upload_control_painter.cc b/third_party/blink/renderer/core/paint/file_upload_control_painter.cc index 91f25ce..5dfade7 100644 --- a/third_party/blink/renderer/core/paint/file_upload_control_painter.cc +++ b/third_party/blink/renderer/core/paint/file_upload_control_painter.cc
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/core/layout/layout_file_upload_control.h" #include "third_party/blink/renderer/core/layout/text_run_constructor.h" #include "third_party/blink/renderer/core/paint/paint_info.h" -#include "third_party/blink/renderer/core/paint/paint_timing_detector.h" #include "third_party/blink/renderer/platform/fonts/text_run_paint_info.h" #include "third_party/blink/renderer/platform/graphics/paint/drawing_recorder.h" @@ -78,11 +77,6 @@ paint_info.context.DrawBidiText( font, text_run_paint_info, FloatPoint(RoundToInt(text_x), RoundToInt(text_y))); - if (RuntimeEnabledFeatures::FirstContentfulPaintPlusPlusEnabled()) { - PaintTimingDetector::NotifyTextPaint( - layout_file_upload_control_, paint_info.context.GetPaintController() - .CurrentPaintChunkProperties()); - } } // Paint the children.
diff --git a/third_party/blink/renderer/core/paint/inline_text_box_painter.cc b/third_party/blink/renderer/core/paint/inline_text_box_painter.cc index 9d7f30c96..f948711 100644 --- a/third_party/blink/renderer/core/paint/inline_text_box_painter.cc +++ b/third_party/blink/renderer/core/paint/inline_text_box_painter.cc
@@ -20,7 +20,6 @@ #include "third_party/blink/renderer/core/paint/decoration_info.h" #include "third_party/blink/renderer/core/paint/document_marker_painter.h" #include "third_party/blink/renderer/core/paint/paint_info.h" -#include "third_party/blink/renderer/core/paint/paint_timing_detector.h" #include "third_party/blink/renderer/core/paint/selection_painting_utils.h" #include "third_party/blink/renderer/core/paint/text_painter.h" #include "third_party/blink/renderer/platform/graphics/graphics_context_state_saver.h" @@ -414,11 +413,6 @@ context.ConcatCTM(TextPainterBase::Rotation( box_rect, TextPainterBase::kCounterclockwise)); } - if (RuntimeEnabledFeatures::FirstContentfulPaintPlusPlusEnabled()) { - PaintTimingDetector::NotifyTextPaint( - InlineLayoutObject(), - paint_info.context.GetPaintController().CurrentPaintChunkProperties()); - } } bool InlineTextBoxPainter::ShouldPaintTextBox(const PaintInfo& paint_info) {
diff --git a/third_party/blink/renderer/core/paint/list_marker_painter.cc b/third_party/blink/renderer/core/paint/list_marker_painter.cc index a41b7a0..859bbcbb 100644 --- a/third_party/blink/renderer/core/paint/list_marker_painter.cc +++ b/third_party/blink/renderer/core/paint/list_marker_painter.cc
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/core/layout/list_marker_text.h" #include "third_party/blink/renderer/core/paint/box_model_object_painter.h" #include "third_party/blink/renderer/core/paint/paint_info.h" -#include "third_party/blink/renderer/core/paint/paint_timing_detector.h" #include "third_party/blink/renderer/core/paint/scoped_paint_state.h" #include "third_party/blink/renderer/core/paint/selection_painting_utils.h" #include "third_party/blink/renderer/core/paint/text_painter.h" @@ -179,11 +178,6 @@ // TODO(npm): Check that there are non-whitespace characters. See // crbug.com/788444. context.GetPaintController().SetTextPainted(); - if (RuntimeEnabledFeatures::FirstContentfulPaintPlusPlusEnabled()) { - PaintTimingDetector::NotifyTextPaint( - layout_list_marker_, - paint_info.context.GetPaintController().CurrentPaintChunkProperties()); - } } } // namespace blink
diff --git a/third_party/blink/renderer/core/paint/ng/ng_text_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_text_painter.cc index 67c36b1..d0588ee7 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_text_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_text_painter.cc
@@ -10,7 +10,6 @@ #include "third_party/blink/renderer/core/layout/ng/ng_unpositioned_float.h" #include "third_party/blink/renderer/core/paint/box_painter.h" #include "third_party/blink/renderer/core/paint/paint_info.h" -#include "third_party/blink/renderer/core/paint/paint_timing_detector.h" #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/core/style/shadow_list.h" #include "third_party/blink/renderer/platform/fonts/font.h" @@ -61,11 +60,6 @@ // TODO(npm): Check that there are non-whitespace characters. See // crbug.com/788444. graphics_context_.GetPaintController().SetTextPainted(); - if (RuntimeEnabledFeatures::FirstContentfulPaintPlusPlusEnabled()) { - PaintTimingDetector::NotifyTextPaint( - *fragment_.GetLayoutObject(), - graphics_context_.GetPaintController().CurrentPaintChunkProperties()); - } } }
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 c1a1f74..2a18451f 100644 --- a/third_party/blink/renderer/core/paint/object_paint_properties.h +++ b/third_party/blink/renderer/core/paint/object_paint_properties.h
@@ -68,6 +68,7 @@ // class-level comment ("update & clear implementation note") for details // about why this is needed for efficient updates. #define ADD_NODE(type, function, variable) \ + public: \ const type##PaintPropertyNode* function() const { return variable.get(); } \ UpdateResult Update##function(const type##PaintPropertyNode& parent, \ type##PaintPropertyNode::State&& state, \ @@ -88,10 +89,8 @@ } \ \ private: \ - scoped_refptr<type##PaintPropertyNode> variable; \ - \ - public: -// (End of ADD_NODE definition) + scoped_refptr<type##PaintPropertyNode> variable; + // (End of ADD_NODE definition) #define ADD_TRANSFORM(function, variable) \ ADD_NODE(Transform, function, variable) @@ -208,7 +207,7 @@ // containment. It is the deepest child of any clip tree on the contain: // paint element. ADD_CLIP(FragmentClip, fragment_clip_); - ADD_CLIP(ClipPathClip, clip_path_clip_); + ADD_CLIP(ClipPathClip, clip_path_clip_) ADD_CLIP(MaskClip, mask_clip_); ADD_CLIP(CssClip, css_clip_); ADD_CLIP(CssClipFixedPosition, css_clip_fixed_position_); @@ -217,6 +216,12 @@ ADD_CLIP(OverflowClip, overflow_clip_); ADD_CLIP(ClipIsolationNode, clip_isolation_node_); +#undef ADD_CLIP +#undef ADD_EFFECT +#undef ADD_TRANSFORM +#undef ADD_NODE + + public: #if DCHECK_IS_ON() // Used by FindPropertiesNeedingUpdate.h for verifying state doesn't change. void SetImmutable() const { is_immutable_ = true; }
diff --git a/third_party/blink/renderer/core/paint/paint_timing_detector.cc b/third_party/blink/renderer/core/paint/paint_timing_detector.cc index 596ec2c38..6c168a6 100644 --- a/third_party/blink/renderer/core/paint/paint_timing_detector.cc +++ b/third_party/blink/renderer/core/paint/paint_timing_detector.cc
@@ -13,10 +13,6 @@ #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/text_paint_timing_detector.h" #include "third_party/blink/renderer/platform/geometry/int_rect.h" -#include "third_party/blink/renderer/platform/graphics/paint/float_clip_rect.h" -#include "third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h" -#include "third_party/blink/renderer/platform/graphics/paint/property_tree_state.h" -#include "third_party/blink/renderer/platform/graphics/paint/scoped_paint_chunk_properties.h" namespace blink { @@ -39,6 +35,9 @@ if (!frame_view_->GetFrame().IsMainFrame()) return; + if (object.IsText()) { + text_paint_timing_detector_->RecordText(object, painting_layer); + } if (object.IsImage() || object.IsVideo() || object.IsSVGImage() || ImagePaintTimingDetector::HasContentfulBackgroundImage(object)) { image_paint_timing_detector_->RecordImage(object, painting_layer); @@ -46,28 +45,6 @@ // Todo(maxlg): add other detectors here. } -void PaintTimingDetector::NotifyTextPaint( - const Node* node, - const PropertyTreeState& current_paint_chunk_properties) { - if (!node) - return; - LayoutObject* object = node->GetLayoutObject(); - if (!object) - return; - NotifyTextPaint(*object, current_paint_chunk_properties); -} - -void PaintTimingDetector::NotifyTextPaint( - const LayoutObject& object, - const PropertyTreeState& current_paint_chunk_properties) { - LocalFrameView* frame_view = object.GetFrameView(); - if (!frame_view || !frame_view->GetFrame().IsMainFrame()) - return; - PaintTimingDetector& detector = frame_view->GetPaintTimingDetector(); - detector.GetTextPaintTimingDetector().RecordText( - object, current_paint_chunk_properties); -} - void PaintTimingDetector::NotifyNodeRemoved(const LayoutObject& object) { if (!object.GetNode()) return; @@ -112,23 +89,14 @@ uint64_t PaintTimingDetector::CalculateVisualSize( const LayoutRect& invalidated_rect, const PaintLayer& painting_layer) const { - return CalculateVisualSize(invalidated_rect, painting_layer.GetLayoutObject() - .FirstFragment() - .LocalBorderBoxProperties()); -} - -uint64_t PaintTimingDetector::CalculateVisualSize( - const LayoutRect& invalidated_rect, - const PropertyTreeState& current_paint_chunk_properties) const { // This case should be dealt with outside the function. DCHECK(!invalidated_rect.IsEmpty()); // As Layout objects live in different transform spaces, the object's rect // should be projected to the viewport's transform space. - FloatClipRect visual_rect = FloatClipRect(FloatRect(invalidated_rect)); - GeometryMapper::LocalToAncestorVisualRect( - current_paint_chunk_properties, PropertyTreeState::Root(), visual_rect); - FloatRect& visual_rect_float = visual_rect.Rect(); + IntRect visual_rect = SaturatedRect(EnclosedIntRect(invalidated_rect)); + painting_layer.GetLayoutObject().FirstFragment().MapRectToFragment( + painting_layer.GetLayoutObject().View()->FirstFragment(), visual_rect); // A visual rect means the part of the rect that's visible within // the viewport. We define the size of it as visual size. @@ -136,9 +104,8 @@ DCHECK(scrollable_area); IntRect viewport = scrollable_area->VisibleContentRect(); // Use saturated rect to avoid integer-overflow. - - visual_rect_float.Intersect(SaturatedRect(viewport)); - return visual_rect_float.Size().Area(); + visual_rect.Intersect(SaturatedRect(viewport)); + return visual_rect.Size().Area(); } void PaintTimingDetector::Dispose() {
diff --git a/third_party/blink/renderer/core/paint/paint_timing_detector.h b/third_party/blink/renderer/core/paint/paint_timing_detector.h index c8b0c0e..78e24f28 100644 --- a/third_party/blink/renderer/core/paint/paint_timing_detector.h +++ b/third_party/blink/renderer/core/paint/paint_timing_detector.h
@@ -18,7 +18,6 @@ class LayoutRect; class TextPaintTimingDetector; class ImagePaintTimingDetector; -class PropertyTreeState; // PaintTimingDetector contains some of paint metric detectors, // providing common infrastructure for these detectors. @@ -33,9 +32,6 @@ PaintTimingDetector(LocalFrameView*); void NotifyObjectPrePaint(const LayoutObject& object, const PaintLayer& painting_layer); - static void NotifyTextPaint(const Node* node, const PropertyTreeState&); - static void NotifyTextPaint(const LayoutObject& object, - const PropertyTreeState&); void NotifyNodeRemoved(const LayoutObject& object); void NotifyPrePaintFinished(); void NotifyInputEvent(WebInputEvent::Type); @@ -44,8 +40,6 @@ void DidChangePerformanceTiming(); uint64_t CalculateVisualSize(const LayoutRect& invalidated_rect, const PaintLayer& painting_layer) const; - uint64_t CalculateVisualSize(const LayoutRect& invalidated_rect, - const PropertyTreeState&) const; void Dispose(); TextPaintTimingDetector& GetTextPaintTimingDetector() {
diff --git a/third_party/blink/renderer/core/paint/svg_inline_text_box_painter.cc b/third_party/blink/renderer/core/paint/svg_inline_text_box_painter.cc index 67ac3293..d8ae713eb 100644 --- a/third_party/blink/renderer/core/paint/svg_inline_text_box_painter.cc +++ b/third_party/blink/renderer/core/paint/svg_inline_text_box_painter.cc
@@ -19,7 +19,6 @@ #include "third_party/blink/renderer/core/layout/svg/svg_resources_cache.h" #include "third_party/blink/renderer/core/paint/inline_text_box_painter.h" #include "third_party/blink/renderer/core/paint/paint_info.h" -#include "third_party/blink/renderer/core/paint/paint_timing_detector.h" #include "third_party/blink/renderer/core/paint/selection_painting_utils.h" #include "third_party/blink/renderer/core/paint/svg_object_painter.h" #include "third_party/blink/renderer/core/style/applied_text_decoration.h" @@ -469,11 +468,6 @@ // TODO(npm): Check that there are non-whitespace characters. See // crbug.com/788444. context.GetPaintController().SetTextPainted(); - if (RuntimeEnabledFeatures::FirstContentfulPaintPlusPlusEnabled()) { - PaintTimingDetector::NotifyTextPaint( - InlineLayoutObject(), - paint_info.context.GetPaintController().CurrentPaintChunkProperties()); - } } void SVGInlineTextBoxPainter::PaintText(
diff --git a/third_party/blink/renderer/core/paint/text_paint_timing_detector.cc b/third_party/blink/renderer/core/paint/text_paint_timing_detector.cc index eb6a61f..c5baafdb 100644 --- a/third_party/blink/renderer/core/paint/text_paint_timing_detector.cc +++ b/third_party/blink/renderer/core/paint/text_paint_timing_detector.cc
@@ -185,9 +185,8 @@ awaiting_swap_promise_ = false; } -void TextPaintTimingDetector::RecordText( - const LayoutObject& object, - const PropertyTreeState& current_paint_chunk_properties) { +void TextPaintTimingDetector::RecordText(const LayoutObject& object, + const PaintLayer& painting_layer) { if (!is_recording_) return; Node* node = object.GetNode(); @@ -205,12 +204,10 @@ // the text's first invalidation. uint64_t rect_size = 0; - // Compared to object.FirstFragment().VisualRect(), this will include other - // fragments of the object. - LayoutRect visual_rect = object.FragmentsVisualRectBoundingBox(); - if (!visual_rect.IsEmpty()) { + LayoutRect invalidated_rect = object.FirstFragment().VisualRect(); + if (!invalidated_rect.IsEmpty()) { rect_size = frame_view_->GetPaintTimingDetector().CalculateVisualSize( - visual_rect, current_paint_chunk_properties); + invalidated_rect, painting_layer); } // When rect_size == 0, it either means the text size is 0 or the text is out
diff --git a/third_party/blink/renderer/core/paint/text_paint_timing_detector.h b/third_party/blink/renderer/core/paint/text_paint_timing_detector.h index 835e608..8403420 100644 --- a/third_party/blink/renderer/core/paint/text_paint_timing_detector.h +++ b/third_party/blink/renderer/core/paint/text_paint_timing_detector.h
@@ -13,10 +13,10 @@ #include "third_party/blink/renderer/platform/wtf/time.h" namespace blink { +class PaintLayer; class LayoutObject; class TracedValue; class LocalFrameView; -class PropertyTreeState; struct TextRecord { DOMNodeId node_id = kInvalidDOMNodeId; @@ -57,7 +57,7 @@ public: TextPaintTimingDetector(LocalFrameView* frame_view); - void RecordText(const LayoutObject& object, const PropertyTreeState&); + void RecordText(const LayoutObject& object, const PaintLayer& painting_layer); TextRecord* FindLargestPaintCandidate(); TextRecord* FindLastPaintCandidate(); void OnPrePaintFinished();
diff --git a/third_party/blink/renderer/core/paint/text_paint_timing_detector_test.cc b/third_party/blink/renderer/core/paint/text_paint_timing_detector_test.cc index 0f15418a..496c9a7 100644 --- a/third_party/blink/renderer/core/paint/text_paint_timing_detector_test.cc +++ b/third_party/blink/renderer/core/paint/text_paint_timing_detector_test.cc
@@ -16,10 +16,7 @@ public: TextPaintTimingDetectorTest() : ScopedFirstContentfulPaintPlusPlusForTest(true) {} - void SetUp() override { - RenderingTest::SetUp(); - RenderingTest::EnableCompositing(); - } + void SetUp() override { RenderingTest::SetUp(); } protected: LocalFrameView& GetFrameView() { return *GetFrame().View(); }
diff --git a/third_party/blink/renderer/core/script/classic_pending_script.cc b/third_party/blink/renderer/core/script/classic_pending_script.cc index 4ead543f..c373f6d 100644 --- a/third_party/blink/renderer/core/script/classic_pending_script.cc +++ b/third_party/blink/renderer/core/script/classic_pending_script.cc
@@ -32,7 +32,7 @@ namespace blink { -// <specdef href="https://html.spec.whatwg.org/#fetch-a-classic-script"> +// <specdef href="https://html.spec.whatwg.org/C/#fetch-a-classic-script"> ClassicPendingScript* ClassicPendingScript::Fetch( const KURL& url, Document& element_document, @@ -378,7 +378,7 @@ not_streamed_reason); // The base URL for external classic script is // - // <spec href="https://html.spec.whatwg.org/#concept-script-base-url"> + // <spec href="https://html.spec.whatwg.org/C/#concept-script-base-url"> // ... the URL from which the script was obtained, ...</spec> const KURL& base_url = source_code.Url(); return ClassicScript::Create(source_code, base_url, options_,
diff --git a/third_party/blink/renderer/core/script/dynamic_module_resolver.cc b/third_party/blink/renderer/core/script/dynamic_module_resolver.cc index 4dab9c8f..383c721 100644 --- a/third_party/blink/renderer/core/script/dynamic_module_resolver.cc +++ b/third_party/blink/renderer/core/script/dynamic_module_resolver.cc
@@ -48,7 +48,7 @@ // Implements steps 2.[5-8] of // <specdef -// href="https://html.spec.whatwg.org/#hostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability)"> +// href="https://html.spec.whatwg.org/C/#hostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability)"> void DynamicImportTreeClient::NotifyModuleTreeLoadFinished( ModuleScript* module_script) { // [nospec] Abort the steps if the browsing context is discarded. @@ -163,7 +163,7 @@ } // <specdef -// href="https://html.spec.whatwg.org/#hostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability)"> +// href="https://html.spec.whatwg.org/C/#hostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability)"> void DynamicModuleResolver::ResolveDynamically( const String& specifier, const KURL& referrer_resource_url, @@ -222,11 +222,11 @@ // <spec step="2.3">Let options be the descendant script fetch options for // referencing script's fetch options.</spec> // - // <spec href="https://html.spec.whatwg.org/#descendant-script-fetch-options"> - // For any given script fetch options options, the descendant script fetch - // options are a new script fetch options whose items all have the same - // values, except for the integrity metadata, which is instead the empty - // string.</spec> + // <spec + // href="https://html.spec.whatwg.org/C/#descendant-script-fetch-options"> For + // any given script fetch options options, the descendant script fetch options + // are a new script fetch options whose items all have the same values, except + // for the integrity metadata, which is instead the empty string.</spec> // TODO(domfarolino): It has not yet been decided how a script's "importance" // should affect its dynamic imports. There is discussion at // https://github.com/whatwg/html/issues/3670, but for now there is no effect,
diff --git a/third_party/blink/renderer/core/script/html_parser_script_runner.cc b/third_party/blink/renderer/core/script/html_parser_script_runner.cc index ca737a21b..b95c3fb8 100644 --- a/third_party/blink/renderer/core/script/html_parser_script_runner.cc +++ b/third_party/blink/renderer/core/script/html_parser_script_runner.cc
@@ -180,7 +180,7 @@ // Corresponds to some steps of the "Otherwise" Clause of 'An end tag whose // tag name is "script"' -// <specdef href="https://html.spec.whatwg.org/#scriptEndTag"> +// <specdef href="https://html.spec.whatwg.org/C/#scriptEndTag"> void HTMLParserScriptRunner:: ExecutePendingParserBlockingScriptAndDispatchEvent() { // Stop watching loads before executeScript to prevent recursion if the script @@ -258,7 +258,7 @@ { // The following code corresponds to: // - // <spec href="https://html.spec.whatwg.org/#scriptEndTag" + // <spec href="https://html.spec.whatwg.org/C/#scriptEndTag" // step="B.7">Increment the parser's script nesting level by one (it should // be zero before this step, so this sets it to one).</spec> // @@ -302,7 +302,7 @@ host_->NotifyScriptLoaded(pending_script); } -// <specdef href="https://html.spec.whatwg.org/#scriptEndTag"> +// <specdef href="https://html.spec.whatwg.org/C/#scriptEndTag"> // // Script handling lives outside the tree builder to keep each class simple. void HTMLParserScriptRunner::ProcessScriptElement( @@ -357,7 +357,7 @@ return ParserBlockingScript(); } -// <specdef href="https://html.spec.whatwg.org/#scriptEndTag"> +// <specdef href="https://html.spec.whatwg.org/C/#scriptEndTag"> // // <spec>An end tag whose tag name is "script" ...</spec> void HTMLParserScriptRunner::ExecuteParsingBlockingScripts() { @@ -412,7 +412,7 @@ ExecuteParsingBlockingScripts(); } -// <specdef href="https://html.spec.whatwg.org/#stop-parsing"> +// <specdef href="https://html.spec.whatwg.org/C/#stop-parsing"> // // <spec step="3">If the list of scripts that will execute when the document has // finished parsing is not empty, run these substeps:</spec> @@ -462,10 +462,10 @@ void HTMLParserScriptRunner::RequestParsingBlockingScript( ScriptLoader* script_loader) { - // <spec href="https://html.spec.whatwg.org/#prepare-a-script" step="26.B">... - // The element is the pending parsing-blocking script of the Document of the - // parser that created the element. (There can only be one such script per - // Document at a time.) ...</spec> + // <spec href="https://html.spec.whatwg.org/C/#prepare-a-script" + // step="26.B">... The element is the pending parsing-blocking script of the + // Document of the parser that created the element. (There can only be one + // such script per Document at a time.) ...</spec> CHECK(!ParserBlockingScript()); parser_blocking_script_ = script_loader->TakePendingScript(ScriptSchedulingType::kParserBlocking); @@ -496,15 +496,15 @@ DCHECK(pending_script->IsExternalOrModule()); - // <spec href="https://html.spec.whatwg.org/#prepare-a-script" step="26.A">... - // Add the element to the end of the list of scripts that will execute when - // the document has finished parsing associated with the Document of the - // parser that created the element. ...</spec> + // <spec href="https://html.spec.whatwg.org/C/#prepare-a-script" + // step="26.A">... Add the element to the end of the list of scripts that will + // execute when the document has finished parsing associated with the Document + // of the parser that created the element. ...</spec> scripts_to_execute_after_parsing_.push_back(pending_script); } // The initial steps for 'An end tag whose tag name is "script"' -// <specdef href="https://html.spec.whatwg.org/#scriptEndTag"> +// <specdef href="https://html.spec.whatwg.org/C/#scriptEndTag"> // <specdef label="prepare-a-script" // href="https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script"> void HTMLParserScriptRunner::ProcessScriptElementInternal(
diff --git a/third_party/blink/renderer/core/script/modulator_impl_base.cc b/third_party/blink/renderer/core/script/modulator_impl_base.cc index c30ee5d..3dc6225 100644 --- a/third_party/blink/renderer/core/script/modulator_impl_base.cc +++ b/third_party/blink/renderer/core/script/modulator_impl_base.cc
@@ -107,7 +107,7 @@ return map_->GetFetchedModuleScript(url); } -// <specdef href="https://html.spec.whatwg.org/#resolve-a-module-specifier"> +// <specdef href="https://html.spec.whatwg.org/C/#resolve-a-module-specifier"> KURL ModulatorImplBase::ResolveModuleSpecifier(const String& module_request, const KURL& base_url, String* failure_reason) { @@ -174,7 +174,7 @@ referrer_info, resolver); } -// <specdef href="https://html.spec.whatwg.org/#hostgetimportmetaproperties"> +// <specdef href="https://html.spec.whatwg.org/C/#hostgetimportmetaproperties"> ModuleImportMeta ModulatorImplBase::HostGetImportMetaProperties( ScriptModule record) const { // <spec step="1">Let module script be moduleRecord.[[HostDefined]].</spec> @@ -213,7 +213,7 @@ return requests; } -// <specdef href="https://html.spec.whatwg.org/#run-a-module-script"> +// <specdef href="https://html.spec.whatwg.org/C/#run-a-module-script"> ScriptValue ModulatorImplBase::ExecuteModule( const ModuleScript* module_script, CaptureEvalErrorFlag capture_error) {
diff --git a/third_party/blink/renderer/core/script/module_map.cc b/third_party/blink/renderer/core/script/module_map.cc index e8ba2e8dd..a48f1f2 100644 --- a/third_party/blink/renderer/core/script/module_map.cc +++ b/third_party/blink/renderer/core/script/module_map.cc
@@ -110,7 +110,7 @@ visitor->Trace(loader_registry_); } -// <specdef href="https://html.spec.whatwg.org/#fetch-a-single-module-script"> +// <specdef href="https://html.spec.whatwg.org/C/#fetch-a-single-module-script"> void ModuleMap::FetchSingleModuleScript( const ModuleScriptFetchRequest& request, ResourceFetcher* fetch_client_settings_object_fetcher,
diff --git a/third_party/blink/renderer/core/script/module_script.cc b/third_party/blink/renderer/core/script/module_script.cc index 9cd7bdd7..0c2d2fd9 100644 --- a/third_party/blink/renderer/core/script/module_script.cc +++ b/third_party/blink/renderer/core/script/module_script.cc
@@ -11,7 +11,7 @@ namespace blink { -// <specdef href="https://html.spec.whatwg.org/#creating-a-module-script"> +// <specdef href="https://html.spec.whatwg.org/C/#creating-a-module-script"> ModuleScript* ModuleScript::Create(const ParkableString& original_source_text, Modulator* modulator, const KURL& source_url, @@ -106,7 +106,7 @@ base_url, options, TextPosition::MinimumPosition()); } -// <specdef href="https://html.spec.whatwg.org/#creating-a-module-script"> +// <specdef href="https://html.spec.whatwg.org/C/#creating-a-module-script"> ModuleScript* ModuleScript::CreateInternal(const ParkableString& source_text, Modulator* modulator, ScriptModule result,
diff --git a/third_party/blink/renderer/core/script/pending_script.cc b/third_party/blink/renderer/core/script/pending_script.cc index 9f23c80d..a3fd7b5 100644 --- a/third_party/blink/renderer/core/script/pending_script.cc +++ b/third_party/blink/renderer/core/script/pending_script.cc
@@ -124,7 +124,7 @@ parser_blocking_load_start_time_ = CurrentTimeTicks(); } -// <specdef href="https://html.spec.whatwg.org/#execute-the-script-block"> +// <specdef href="https://html.spec.whatwg.org/C/#execute-the-script-block"> void PendingScript::ExecuteScriptBlock(const KURL& document_url) { TRACE_EVENT0("blink", "PendingScript::ExecuteScriptBlock"); Document* context_document = element_->GetDocument().ContextDocument(); @@ -188,7 +188,7 @@ parser_blocking_load_start_time, is_controlled_by_script_runner); } -// <specdef href="https://html.spec.whatwg.org/#execute-the-script-block"> +// <specdef href="https://html.spec.whatwg.org/C/#execute-the-script-block"> void PendingScript::ExecuteScriptBlockInternal( Script* script, ScriptElementBase* element,
diff --git a/third_party/blink/renderer/core/script/script_loader.cc b/third_party/blink/renderer/core/script/script_loader.cc index c58812ff..77c49c8 100644 --- a/third_party/blink/renderer/core/script/script_loader.cc +++ b/third_party/blink/renderer/core/script/script_loader.cc
@@ -70,9 +70,9 @@ : element_(element), will_be_parser_executed_(false), will_execute_when_document_finished_parsing_(false) { - // <spec href="https://html.spec.whatwg.org/#already-started">... The cloning - // steps for script elements must set the "already started" flag on the copy - // if it is set on the element being cloned.</spec> + // <spec href="https://html.spec.whatwg.org/C/#already-started">... The + // cloning steps for script elements must set the "already started" flag on + // the copy if it is set on the element being cloned.</spec> // // TODO(hiroshige): Cloning is implemented together with // {HTML,SVG}ScriptElement::cloneElementWithoutAttributesAndChildren(). @@ -81,12 +81,12 @@ already_started_ = true; if (parser_inserted) { - // <spec href="https://html.spec.whatwg.org/#parser-inserted">... It is set - // by the HTML parser and the XML parser on script elements they insert + // <spec href="https://html.spec.whatwg.org/C/#parser-inserted">... It is + // set by the HTML parser and the XML parser on script elements they insert // ...</spec> parser_inserted_ = true; - // <spec href="https://html.spec.whatwg.org/#non-blocking">... It is unset + // <spec href="https://html.spec.whatwg.org/C/#non-blocking">... It is unset // by the HTML parser and the XML parser on script elements they insert. // ...</spec> non_blocking_ = false; @@ -120,7 +120,7 @@ PrepareScript(); // FIXME: Provide a real starting line number here. } -// <specdef href="https://html.spec.whatwg.org/#non-blocking"> +// <specdef href="https://html.spec.whatwg.org/C/#non-blocking"> void ScriptLoader::HandleAsyncAttribute() { // <spec>... In addition, whenever a script element whose "non-blocking" flag // is set has an async content attribute added, the element's "non-blocking" @@ -166,7 +166,7 @@ } // namespace -// <specdef href="https://html.spec.whatwg.org/#prepare-a-script"> +// <specdef href="https://html.spec.whatwg.org/C/#prepare-a-script"> bool ScriptLoader::IsValidScriptTypeAndLanguage( const String& type, const String& language, @@ -239,7 +239,7 @@ return !element->DeferAttributeValue() && !element->AsyncAttributeValue(); } -// <specdef href="https://html.spec.whatwg.org/#prepare-a-script"> +// <specdef href="https://html.spec.whatwg.org/C/#prepare-a-script"> bool ScriptLoader::PrepareScript(const TextPosition& script_start_position, LegacyTypeSupport support_legacy_types) { // <spec step="1">If the script element is marked as having "already started", @@ -308,9 +308,9 @@ // <spec step="11">If scripting is disabled for the script element, then // return. The script is not executed.</spec> // - // <spec href="https://html.spec.whatwg.org/#concept-n-noscript">Scripting is - // disabled for a node if there is no such browsing context, or if scripting - // is disabled in that browsing context.</spec> + // <spec href="https://html.spec.whatwg.org/C/#concept-n-noscript">Scripting + // is disabled for a node if there is no such browsing context, or if + // scripting is disabled in that browsing context.</spec> Document& element_document = element_->GetDocument(); // TODO(timothygu): Investigate if we could switch from ExecutingFrame() to // ExecutingWindow(). @@ -766,7 +766,7 @@ resource_keep_alive_ = pending_script->GetResource(); } -// <specdef href="https://html.spec.whatwg.org/#prepare-a-script"> +// <specdef href="https://html.spec.whatwg.org/C/#prepare-a-script"> void ScriptLoader::FetchModuleScriptTree( const KURL& url, ResourceFetcher* fetch_client_settings_object_fetcher, @@ -837,7 +837,7 @@ !element_->IsConnected(); } -// <specdef href="https://html.spec.whatwg.org/#prepare-a-script"> +// <specdef href="https://html.spec.whatwg.org/C/#prepare-a-script"> bool ScriptLoader::IsScriptForEventSupported() const { // <spec step="14.1">Let for be the value of the for attribute.</spec> String event_attribute = element_->EventAttributeValue();
diff --git a/third_party/blink/renderer/core/script/script_module_resolver_impl.cc b/third_party/blink/renderer/core/script/script_module_resolver_impl.cc index 9032ada8..3a94588 100644 --- a/third_party/blink/renderer/core/script/script_module_resolver_impl.cc +++ b/third_party/blink/renderer/core/script/script_module_resolver_impl.cc
@@ -51,7 +51,7 @@ } // <specdef -// href="https://html.spec.whatwg.org/#hostresolveimportedmodule(referencingscriptormodule,-specifier)"> +// href="https://html.spec.whatwg.org/C/#hostresolveimportedmodule(referencingscriptormodule,-specifier)"> ScriptModule ScriptModuleResolverImpl::Resolve( const String& specifier, const ScriptModule& referrer,
diff --git a/third_party/blink/renderer/core/svg/svg_matrix_tear_off.cc b/third_party/blink/renderer/core/svg/svg_matrix_tear_off.cc index b56fee0..adfe38ea 100644 --- a/third_party/blink/renderer/core/svg/svg_matrix_tear_off.cc +++ b/third_party/blink/renderer/core/svg/svg_matrix_tear_off.cc
@@ -77,12 +77,12 @@ CommitChange(); \ } -DEFINE_SETTER(A); -DEFINE_SETTER(B); -DEFINE_SETTER(C); -DEFINE_SETTER(D); -DEFINE_SETTER(E); -DEFINE_SETTER(F); +DEFINE_SETTER(A) +DEFINE_SETTER(B) +DEFINE_SETTER(C) +DEFINE_SETTER(D) +DEFINE_SETTER(E) +DEFINE_SETTER(F) #undef DEFINE_SETTER
diff --git a/third_party/blink/renderer/core/testing/dummy_modulator.cc b/third_party/blink/renderer/core/testing/dummy_modulator.cc index 74459e3..53b6ce3 100644 --- a/third_party/blink/renderer/core/testing/dummy_modulator.cc +++ b/third_party/blink/renderer/core/testing/dummy_modulator.cc
@@ -61,7 +61,7 @@ base::SingleThreadTaskRunner* DummyModulator::TaskRunner() { NOTREACHED(); return nullptr; -}; +} void DummyModulator::FetchTree(const KURL&, ResourceFetcher*,
diff --git a/third_party/blink/renderer/core/testing/internals.cc b/third_party/blink/renderer/core/testing/internals.cc index a4b7c35..b38b302 100644 --- a/third_party/blink/renderer/core/testing/internals.cc +++ b/third_party/blink/renderer/core/testing/internals.cc
@@ -40,6 +40,7 @@ #include "third_party/blink/renderer/bindings/core/v8/script_function.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_iterator_result_value.h" #include "third_party/blink/renderer/core/animation/document_timeline.h" #include "third_party/blink/renderer/core/css/css_property_names.h" @@ -127,6 +128,7 @@ #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" #include "third_party/blink/renderer/core/probe/core_probes.h" +#include "third_party/blink/renderer/core/script/modulator.h" #include "third_party/blink/renderer/core/scroll/programmatic_scroll_animator.h" #include "third_party/blink/renderer/core/scroll/scroll_animator_base.h" #include "third_party/blink/renderer/core/scroll/scrollbar_theme.h" @@ -3486,4 +3488,33 @@ CustomElement::AddEmbedderCustomElementNameForTesting(name, exception_state); } +String Internals::resolveModuleSpecifier(const String& specifier, + const String& base_url_string, + Document* document, + ExceptionState& exception_state) { + Modulator* modulator = + Modulator::From(ToScriptStateForMainWorld(document->GetFrame())); + + if (!modulator) { + V8ThrowException::ThrowTypeError( + v8::Isolate::GetCurrent(), + "Failed to resolve module specifier " + specifier + ": No modulator"); + return NullURL(); + } + + const KURL base_url = document->CompleteURL(base_url_string); + String failure_reason = "Failed"; + const KURL result = + modulator->ResolveModuleSpecifier(specifier, base_url, &failure_reason); + + if (!result.IsValid()) { + V8ThrowException::ThrowTypeError(v8::Isolate::GetCurrent(), + "Failed to resolve module specifier " + + specifier + ": " + failure_reason); + return NullURL(); + } + + return result.GetString(); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/testing/internals.h b/third_party/blink/renderer/core/testing/internals.h index 4c10f910..5d291c9e 100644 --- a/third_party/blink/renderer/core/testing/internals.h +++ b/third_party/blink/renderer/core/testing/internals.h
@@ -329,6 +329,11 @@ InternalRuntimeFlags* runtimeFlags() const; unsigned workerThreadCount() const; + String resolveModuleSpecifier(const String& specifier, + const String& base_url_string, + Document*, + ExceptionState&); + void SetDeviceProximity(Document*, const String& event_type, double value,
diff --git a/third_party/blink/renderer/core/testing/internals.idl b/third_party/blink/renderer/core/testing/internals.idl index 87f51ee9..c84d70c1 100644 --- a/third_party/blink/renderer/core/testing/internals.idl +++ b/third_party/blink/renderer/core/testing/internals.idl
@@ -415,4 +415,9 @@ // Declare that the given |name| is in use by the embedder via the custom // element mechanism. [RaisesException] void addEmbedderCustomElementName(DOMString name); + + // https://html.spec.whatwg.org/multipage/webappapis.html#resolve-a-module-specifier + // Throws TypeError on error. + // Used for testing Import Maps https://github.com/domenic/import-maps + [RaisesException] DOMString resolveModuleSpecifier(DOMString specifier, DOMString base_url, Document document); };
diff --git a/third_party/blink/renderer/core/testing/record_test.h b/third_party/blink/renderer/core/testing/record_test.h index cda756d8..9d73783 100644 --- a/third_party/blink/renderer/core/testing/record_test.h +++ b/third_party/blink/renderer/core/testing/record_test.h
@@ -52,7 +52,7 @@ bool unionReceivedARecord(const BooleanOrByteStringByteStringRecord& arg); - void setFloatOrStringElementRecord(const FloatOrStringElementRecord&){}; + void setFloatOrStringElementRecord(const FloatOrStringElementRecord&) {} void Trace(blink::Visitor*) override;
diff --git a/third_party/blink/renderer/core/workers/abstract_worker.idl b/third_party/blink/renderer/core/workers/abstract_worker.idl index 0b9f596..99091a7 100644 --- a/third_party/blink/renderer/core/workers/abstract_worker.idl +++ b/third_party/blink/renderer/core/workers/abstract_worker.idl
@@ -29,7 +29,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-abstractworker-abstract-interface +// https://html.spec.whatwg.org/C/#the-abstractworker-abstract-interface [ LegacyTreatAsPartialInterface,
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.idl b/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.idl index f6ce783..4adb13fb 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.idl +++ b/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.idl
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#dedicated-workers-and-the-dedicatedworkerglobalscope-interface +// https://html.spec.whatwg.org/C/#dedicated-workers-and-the-dedicatedworkerglobalscope-interface [ Global=(Worker,DedicatedWorker),
diff --git a/third_party/blink/renderer/core/workers/shared_worker.idl b/third_party/blink/renderer/core/workers/shared_worker.idl index c5b5399..3f54076 100644 --- a/third_party/blink/renderer/core/workers/shared_worker.idl +++ b/third_party/blink/renderer/core/workers/shared_worker.idl
@@ -29,7 +29,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#shared-workers-and-the-sharedworker-interface +// https://html.spec.whatwg.org/C/#shared-workers-and-the-sharedworker-interface [ ActiveScriptWrappable,
diff --git a/third_party/blink/renderer/core/workers/shared_worker_global_scope.idl b/third_party/blink/renderer/core/workers/shared_worker_global_scope.idl index c26b4c4..da18c5c2 100644 --- a/third_party/blink/renderer/core/workers/shared_worker_global_scope.idl +++ b/third_party/blink/renderer/core/workers/shared_worker_global_scope.idl
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#shared-workers-and-the-sharedworkerglobalscope-interface +// https://html.spec.whatwg.org/C/#shared-workers-and-the-sharedworkerglobalscope-interface [ Global=(Worker,SharedWorker),
diff --git a/third_party/blink/renderer/core/workers/worker.idl b/third_party/blink/renderer/core/workers/worker.idl index 3830550e..e66dd1cd 100644 --- a/third_party/blink/renderer/core/workers/worker.idl +++ b/third_party/blink/renderer/core/workers/worker.idl
@@ -25,7 +25,7 @@ * */ -// https://html.spec.whatwg.org/#dedicated-workers-and-the-worker-interface +// https://html.spec.whatwg.org/C/#dedicated-workers-and-the-worker-interface [ ActiveScriptWrappable,
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 441af372..a9ba45b 100644 --- a/third_party/blink/renderer/core/workers/worker_global_scope.cc +++ b/third_party/blink/renderer/core/workers/worker_global_scope.cc
@@ -524,7 +524,7 @@ } SetSecurityOrigin(std::move(security_origin)); - // https://html.spec.whatwg.org/#run-a-worker + // https://html.spec.whatwg.org/C/#run-a-worker // 4. Set worker global scope's HTTPS state to response's HTTPS state. [spec // text] https_state_ = CalculateHttpsState(GetSecurityOrigin(),
diff --git a/third_party/blink/renderer/core/workers/worker_global_scope.h b/third_party/blink/renderer/core/workers/worker_global_scope.h index 910ff018..d6deb4ae 100644 --- a/third_party/blink/renderer/core/workers/worker_global_scope.h +++ b/third_party/blink/renderer/core/workers/worker_global_scope.h
@@ -168,7 +168,7 @@ // FontFaceSource on the IDL. FontFaceSet* fonts(); - // https://html.spec.whatwg.org/#windoworworkerglobalscope-mixin + // https://html.spec.whatwg.org/C/#windoworworkerglobalscope-mixin void queueMicrotask(V8VoidFunction*); int requestAnimationFrame(V8FrameRequestCallback* callback, ExceptionState&);
diff --git a/third_party/blink/renderer/core/workers/worker_global_scope.idl b/third_party/blink/renderer/core/workers/worker_global_scope.idl index 23c7f0cb..38cfe8c 100644 --- a/third_party/blink/renderer/core/workers/worker_global_scope.idl +++ b/third_party/blink/renderer/core/workers/worker_global_scope.idl
@@ -24,7 +24,7 @@ * */ -// https://html.spec.whatwg.org/#the-workerglobalscope-common-interface +// https://html.spec.whatwg.org/C/#the-workerglobalscope-common-interface [ ActiveScriptWrappable, @@ -40,7 +40,7 @@ // attribute EventHandler onoffline; // attribute EventHandler ononline; - // https://html.spec.whatwg.org/#apis-available-to-workers + // https://html.spec.whatwg.org/C/#apis-available-to-workers [RaisesException] void importScripts(ScriptURLString... urls); readonly attribute WorkerNavigator navigator; @@ -64,7 +64,7 @@ [ImplementedAs=isSecureContextForBindings] readonly attribute boolean isSecureContext; // WindowOrWorkerGlobalScope mixin - // https://html.spec.whatwg.org/#windoworworkerglobalscope-mixin + // https://html.spec.whatwg.org/C/#windoworworkerglobalscope-mixin [Replaceable] readonly attribute DOMString origin; void queueMicrotask(VoidFunction callback);
diff --git a/third_party/blink/renderer/core/workers/worker_location.idl b/third_party/blink/renderer/core/workers/worker_location.idl index ffdf2ec..d8b934a 100644 --- a/third_party/blink/renderer/core/workers/worker_location.idl +++ b/third_party/blink/renderer/core/workers/worker_location.idl
@@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#worker-locations +// https://html.spec.whatwg.org/C/#worker-locations [ Exposed=Worker
diff --git a/third_party/blink/renderer/core/workers/worker_navigator.idl b/third_party/blink/renderer/core/workers/worker_navigator.idl index db30f30c..1fa072d4 100644 --- a/third_party/blink/renderer/core/workers/worker_navigator.idl +++ b/third_party/blink/renderer/core/workers/worker_navigator.idl
@@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/#the-workernavigator-object +// https://html.spec.whatwg.org/C/#the-workernavigator-object [ Exposed=Worker
diff --git a/third_party/blink/renderer/core/workers/worklet_module_tree_client.cc b/third_party/blink/renderer/core/workers/worklet_module_tree_client.cc index e96aa9f7..4f5cd5f 100644 --- a/third_party/blink/renderer/core/workers/worklet_module_tree_client.cc +++ b/third_party/blink/renderer/core/workers/worklet_module_tree_client.cc
@@ -74,7 +74,7 @@ *outside_settings_task_runner_, FROM_HERE, CrossThreadBind(&WorkletPendingTasks::DecrementCounter, WrapCrossThreadPersistent(pending_tasks_.Get()))); -}; +} void WorkletModuleTreeClient::Trace(blink::Visitor* visitor) { visitor->Trace(modulator_);
diff --git a/third_party/blink/renderer/modules/background_fetch/background_fetch_registration.cc b/third_party/blink/renderer/modules/background_fetch/background_fetch_registration.cc index 05106c7..4c7732e 100644 --- a/third_party/blink/renderer/modules/background_fetch/background_fetch_registration.cc +++ b/third_party/blink/renderer/modules/background_fetch/background_fetch_registration.cc
@@ -29,10 +29,10 @@ BackgroundFetchRegistration::BackgroundFetchRegistration( const String& developer_id, const String& unique_id, - unsigned long long upload_total, - unsigned long long uploaded, - unsigned long long download_total, - unsigned long long downloaded, + uint64_t upload_total, + uint64_t uploaded, + uint64_t download_total, + uint64_t downloaded, mojom::BackgroundFetchResult result, mojom::BackgroundFetchFailureReason failure_reason) : developer_id_(developer_id), @@ -124,19 +124,19 @@ return developer_id_; } -unsigned long long BackgroundFetchRegistration::uploadTotal() const { +uint64_t BackgroundFetchRegistration::uploadTotal() const { return upload_total_; } -unsigned long long BackgroundFetchRegistration::uploaded() const { +uint64_t BackgroundFetchRegistration::uploaded() const { return uploaded_; } -unsigned long long BackgroundFetchRegistration::downloadTotal() const { +uint64_t BackgroundFetchRegistration::downloadTotal() const { return download_total_; } -unsigned long long BackgroundFetchRegistration::downloaded() const { +uint64_t BackgroundFetchRegistration::downloaded() const { return downloaded_; }
diff --git a/third_party/blink/renderer/modules/background_fetch/background_fetch_registration.h b/third_party/blink/renderer/modules/background_fetch/background_fetch_registration.h index 4bf4c9e..9ec869df 100644 --- a/third_party/blink/renderer/modules/background_fetch/background_fetch_registration.h +++ b/third_party/blink/renderer/modules/background_fetch/background_fetch_registration.h
@@ -39,10 +39,10 @@ BackgroundFetchRegistration( const String& developer_id, const String& unique_id, - unsigned long long upload_total, - unsigned long long uploaded, - unsigned long long download_total, - unsigned long long downloaded, + uint64_t upload_total, + uint64_t uploaded, + uint64_t download_total, + uint64_t downloaded, mojom::BackgroundFetchResult result, mojom::BackgroundFetchFailureReason failure_reason); @@ -85,10 +85,10 @@ const CacheQueryOptions* options, ExceptionState& exception_state); - unsigned long long uploadTotal() const; - unsigned long long uploaded() const; - unsigned long long downloadTotal() const; - unsigned long long downloaded() const; + uint64_t uploadTotal() const; + uint64_t uploaded() const; + uint64_t downloadTotal() const; + uint64_t downloaded() const; bool recordsAvailable() const; const String result() const; const String failureReason() const; @@ -142,10 +142,10 @@ // exposed to JavaScript. String unique_id_; - unsigned long long upload_total_; - unsigned long long uploaded_; - unsigned long long download_total_; - unsigned long long downloaded_; + uint64_t upload_total_; + uint64_t uploaded_; + uint64_t download_total_; + uint64_t downloaded_; bool records_available_ = true; mojom::BackgroundFetchResult result_; mojom::BackgroundFetchFailureReason failure_reason_;
diff --git a/third_party/blink/renderer/modules/bluetooth/bluetooth_advertising_event.cc b/third_party/blink/renderer/modules/bluetooth/bluetooth_advertising_event.cc index e9c75dc..1388eb2 100644 --- a/third_party/blink/renderer/modules/bluetooth/bluetooth_advertising_event.cc +++ b/third_party/blink/renderer/modules/bluetooth/bluetooth_advertising_event.cc
@@ -62,7 +62,7 @@ BluetoothDevice* BluetoothAdvertisingEvent::device() const { return device_; -}; +} const String& BluetoothAdvertisingEvent::name() const { return name_;
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc index d9fa696..34a8a20 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc
@@ -1769,12 +1769,12 @@ CanvasColorParams(ColorParams().ColorSpace(), PixelFormat(), kNonOpaque); if (data_color_params.NeedsColorConversion(context_color_params) || PixelFormat() == kF16CanvasPixelFormat) { - base::CheckedNumeric<size_t> data_length = data->Size().Area(); - data_length *= context_color_params.BytesPerPixel(); - if (!data_length.IsValid()) + size_t data_length; + if (!base::CheckMul(data->Size().Area(), + context_color_params.BytesPerPixel()) + .AssignIfValid(&data_length)) return; - std::unique_ptr<uint8_t[]> converted_pixels( - new uint8_t[data_length.ValueOrDie()]); + std::unique_ptr<uint8_t[]> converted_pixels(new uint8_t[data_length]); if (data->ImageDataInCanvasColorSettings( ColorParams().ColorSpace(), PixelFormat(), converted_pixels.get(), kRGBAColorType)) {
diff --git a/third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module.idl b/third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module.idl index e205fc7c..8aa25fcb 100644 --- a/third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module.idl +++ b/third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/#the-canvas-element +// https://html.spec.whatwg.org/C/#the-canvas-element typedef (CanvasRenderingContext2D or WebGLRenderingContext or
diff --git a/third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module_support_webgl2_compute.idl b/third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module_support_webgl2_compute.idl index 2fb9d4ff..aee0f57f 100644 --- a/third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module_support_webgl2_compute.idl +++ b/third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module_support_webgl2_compute.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/#the-canvas-element +// https://html.spec.whatwg.org/C/#the-canvas-element typedef (CanvasRenderingContext2D or WebGLRenderingContext or
diff --git a/third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module_test.cc b/third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module_test.cc index bff719a..80ab33fa 100644 --- a/third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module_test.cc +++ b/third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module_test.cc
@@ -137,5 +137,5 @@ platform->RunUntilIdle(); } -INSTANTIATE_TEST_CASE_P(, HTMLCanvasElementModuleTest, Values(true, false)); +INSTANTIATE_TEST_SUITE_P(, HTMLCanvasElementModuleTest, Values(true, false)); } // namespace blink
diff --git a/third_party/blink/renderer/modules/canvas/offscreencanvas/offscreen_canvas_test.cc b/third_party/blink/renderer/modules/canvas/offscreencanvas/offscreen_canvas_test.cc index 21c5f15..066d509 100644 --- a/third_party/blink/renderer/modules/canvas/offscreencanvas/offscreen_canvas_test.cc +++ b/third_party/blink/renderer/modules/canvas/offscreencanvas/offscreen_canvas_test.cc
@@ -178,5 +178,5 @@ {true, false}, {true, true}}; -INSTANTIATE_TEST_CASE_P(, OffscreenCanvasTest, ValuesIn(kTestCases)); +INSTANTIATE_TEST_SUITE_P(, OffscreenCanvasTest, ValuesIn(kTestCases)); } // namespace blink
diff --git a/third_party/blink/renderer/modules/payments/payment_request_details_test.cc b/third_party/blink/renderer/modules/payments/payment_request_details_test.cc index 91e84a9..3c0f3245 100644 --- a/third_party/blink/renderer/modules/payments/payment_request_details_test.cc +++ b/third_party/blink/renderer/modules/payments/payment_request_details_test.cc
@@ -143,7 +143,7 @@ } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( EmptyData, PaymentRequestDetailsTest, testing::Values(DetailsTestCase(kPaymentTestDetailTotal, @@ -207,7 +207,7 @@ "", false))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidCurrencyCodeFormat, PaymentRequestDetailsTest, testing::Values(DetailsTestCase(kPaymentTestDetailTotal, @@ -231,7 +231,7 @@ kPaymentTestOverwriteValue, "USD"))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidValueFormat, PaymentRequestDetailsTest, testing::Values(DetailsTestCase(kPaymentTestDetailTotal, @@ -367,7 +367,7 @@ kPaymentTestOverwriteValue, "-012345678901234567890123456789"))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidValueFormatForModifier, PaymentRequestDetailsTest, testing::Values(DetailsTestCase(kPaymentTestDetailModifierTotal, @@ -451,7 +451,7 @@ kPaymentTestOverwriteValue, "-012345678901234567890123456789"))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( InvalidValueFormat, PaymentRequestDetailsTest, testing::Values(DetailsTestCase(kPaymentTestDetailTotal, @@ -689,7 +689,7 @@ true, ESErrorType::kTypeError))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( InvalidValueFormatForModifier, PaymentRequestDetailsTest, testing::Values(DetailsTestCase(kPaymentTestDetailModifierTotal,
diff --git a/third_party/blink/renderer/modules/payments/payments_validators_test.cc b/third_party/blink/renderer/modules/payments/payments_validators_test.cc index b86bd21..9440130 100644 --- a/third_party/blink/renderer/modules/payments/payments_validators_test.cc +++ b/third_party/blink/renderer/modules/payments/payments_validators_test.cc
@@ -46,7 +46,7 @@ PaymentsValidators::IsValidCurrencyCodeFormat(GetParam().code, nullptr)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( CurrencyCodes, PaymentsCurrencyValidatorTest, testing::Values( @@ -98,7 +98,7 @@ "test value", nullptr)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Amounts, PaymentsAmountValidatorTest, testing::Values(TestCase("0", true), @@ -144,15 +144,15 @@ PaymentsValidators::IsValidCountryCodeFormat(GetParam().input, nullptr)); } -INSTANTIATE_TEST_CASE_P(CountryCodes, - PaymentsRegionValidatorTest, - testing::Values(TestCase("US", true), - // Invalid country code formats - TestCase("U1", false), - TestCase("U", false), - TestCase("us", false), - TestCase("USA", false), - TestCase("", false))); +INSTANTIATE_TEST_SUITE_P(CountryCodes, + PaymentsRegionValidatorTest, + testing::Values(TestCase("US", true), + // Invalid country code formats + TestCase("U1", false), + TestCase("U", false), + TestCase("us", false), + TestCase("USA", false), + TestCase("", false))); class PaymentsLanguageValidatorTest : public testing::TestWithParam<TestCase> { }; @@ -171,17 +171,17 @@ PaymentsValidators::IsValidLanguageCodeFormat(GetParam().input, nullptr)); } -INSTANTIATE_TEST_CASE_P(LanguageCodes, - PaymentsLanguageValidatorTest, - testing::Values(TestCase("", true), - TestCase("en", true), - TestCase("eng", true), - // Invalid language code formats - TestCase("e1", false), - TestCase("en1", false), - TestCase("e", false), - TestCase("engl", false), - TestCase("EN", false))); +INSTANTIATE_TEST_SUITE_P(LanguageCodes, + PaymentsLanguageValidatorTest, + testing::Values(TestCase("", true), + TestCase("en", true), + TestCase("eng", true), + // Invalid language code formats + TestCase("e1", false), + TestCase("en1", false), + TestCase("e", false), + TestCase("engl", false), + TestCase("EN", false))); class PaymentsScriptValidatorTest : public testing::TestWithParam<TestCase> {}; @@ -199,17 +199,17 @@ PaymentsValidators::IsValidScriptCodeFormat(GetParam().input, nullptr)); } -INSTANTIATE_TEST_CASE_P(ScriptCodes, - PaymentsScriptValidatorTest, - testing::Values(TestCase("", true), - TestCase("Latn", true), - // Invalid script code formats - TestCase("Lat1", false), - TestCase("1lat", false), - TestCase("Latin", false), - TestCase("Lat", false), - TestCase("latn", false), - TestCase("LATN", false))); +INSTANTIATE_TEST_SUITE_P(ScriptCodes, + PaymentsScriptValidatorTest, + testing::Values(TestCase("", true), + TestCase("Latn", true), + // Invalid script code formats + TestCase("Lat1", false), + TestCase("1lat", false), + TestCase("Latin", false), + TestCase("Lat", false), + TestCase("latn", false), + TestCase("LATN", false))); struct ShippingAddressTestCase { ShippingAddressTestCase(const char* country_code, @@ -249,7 +249,7 @@ PaymentsValidators::IsValidShippingAddress(address, nullptr)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ShippingAddresses, PaymentsShippingAddressValidatorTest, testing::Values( @@ -334,7 +334,7 @@ << error_message; } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PaymentValidationErrorss, PaymentsErrorMessageValidatorTest, testing::Values(
diff --git a/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_crypto_config_factory_impl.h b/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_crypto_config_factory_impl.h index 780d914..a3420ec9 100644 --- a/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_crypto_config_factory_impl.h +++ b/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_crypto_config_factory_impl.h
@@ -21,7 +21,7 @@ P2PQuicCryptoConfigFactoryImpl( quic::QuicRandom* const random_generator); - ~P2PQuicCryptoConfigFactoryImpl() override{}; + ~P2PQuicCryptoConfigFactoryImpl() override {} // P2PQuicCryptoConfigFactory overrides. //
diff --git a/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_transport_impl.h b/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_transport_impl.h index 7b20ed0..b50f2b3 100644 --- a/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_transport_impl.h +++ b/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_transport_impl.h
@@ -92,11 +92,11 @@ // Called when the proof verification completes. This information is used // for 0 RTT handshakes, which isn't relevant for our P2P handshake. void OnProofValid( - const quic::QuicCryptoClientConfig::CachedState& cached) override{}; + const quic::QuicCryptoClientConfig::CachedState& cached) override {} // Called when proof verification become available. void OnProofVerifyDetailsAvailable( - const quic::ProofVerifyDetails& verify_details) override{}; + const quic::ProofVerifyDetails& verify_details) override {} // quic::QuicConnectionVisitorInterface override. void OnConnectionClosed(quic::QuicErrorCode error,
diff --git a/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_transport_test.cc b/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_transport_test.cc index c4d1bebf7..eaca9e1 100644 --- a/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_transport_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_transport_test.cc
@@ -119,7 +119,7 @@ ~FakePacketTransport() override { // The write observer should be unset when it is destroyed. DCHECK(!write_observer_); - }; + } // Called by QUIC for writing data to the other side. The flow for writing a // packet is P2PQuicTransportImpl --> quic::QuicConnection -->
diff --git a/third_party/blink/renderer/modules/picture_in_picture/document_picture_in_picture.cc b/third_party/blink/renderer/modules/picture_in_picture/document_picture_in_picture.cc index cfd09a8..0cb6b586 100644 --- a/third_party/blink/renderer/modules/picture_in_picture/document_picture_in_picture.cc +++ b/third_party/blink/renderer/modules/picture_in_picture/document_picture_in_picture.cc
@@ -45,14 +45,8 @@ ScriptPromise promise = resolver->Promise(); DCHECK(IsHTMLVideoElement(picture_in_picture_element)); - document.GetTaskRunner(TaskType::kMediaElementEvent) - ->PostTask( - FROM_HERE, - WTF::Bind( - &PictureInPictureControllerImpl::ExitPictureInPicture, - WrapPersistent(&controller), - WrapPersistent(ToHTMLVideoElement(picture_in_picture_element)), - WrapPersistent(resolver))); + controller.ExitPictureInPicture( + ToHTMLVideoElement(picture_in_picture_element), resolver); return promise; }
diff --git a/third_party/blink/renderer/modules/picture_in_picture/html_video_element_picture_in_picture.cc b/third_party/blink/renderer/modules/picture_in_picture/html_video_element_picture_in_picture.cc index 486889e..cac49b52 100644 --- a/third_party/blink/renderer/modules/picture_in_picture/html_video_element_picture_in_picture.cc +++ b/third_party/blink/renderer/modules/picture_in_picture/html_video_element_picture_in_picture.cc
@@ -95,13 +95,7 @@ ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); ScriptPromise promise = resolver->Promise(); - document.GetTaskRunner(TaskType::kMediaElementEvent) - ->PostTask( - FROM_HERE, - WTF::Bind(&PictureInPictureControllerImpl::EnterPictureInPicture, - WrapPersistent(&controller), WrapPersistent(&element), - WrapPersistent(resolver))); - + controller.EnterPictureInPicture(&element, resolver); return promise; }
diff --git a/third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_controller_impl.cc b/third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_controller_impl.cc index 3b96446..4da05d4 100644 --- a/third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_controller_impl.cc +++ b/third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_controller_impl.cc
@@ -16,6 +16,7 @@ #include "third_party/blink/renderer/core/dom/events/event.h" #include "third_party/blink/renderer/core/events/picture_in_picture_control_event.h" #include "third_party/blink/renderer/core/frame/settings.h" +#include "third_party/blink/renderer/core/fullscreen/fullscreen.h" #include "third_party/blink/renderer/core/html/media/html_video_element.h" #include "third_party/blink/renderer/modules/picture_in_picture/enter_picture_in_picture_event.h" #include "third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_window.h" @@ -99,6 +100,8 @@ void PictureInPictureControllerImpl::EnterPictureInPicture( HTMLVideoElement* element, ScriptPromiseResolver* resolver) { + DCHECK(element->GetWebMediaPlayer()); + if (picture_in_picture_element_ == element) { if (resolver) resolver->Resolve(picture_in_picture_window_); @@ -106,13 +109,14 @@ return; } - element->enterPictureInPicture(); - - DCHECK(element->GetWebMediaPlayer()); - if (!EnsureService()) return; + if (element->DisplayType() == WebMediaPlayer::DisplayType::kFullscreen) + Fullscreen::ExitFullscreen(*GetSupplementable()); + + element->GetWebMediaPlayer()->OnRequestPictureInPicture(); + picture_in_picture_service_->StartSession( element->GetWebMediaPlayer()->GetDelegateId(), element->GetWebMediaPlayer()->GetSurfaceId(), @@ -131,7 +135,7 @@ HTMLVideoElement* element, ScriptPromiseResolver* resolver, const WebSize& picture_in_picture_window_size) { - if (IsElementAllowed(*element) == Status::kDisabledByAttribute) { + if (IsElementAllowed(*element) != Status::kEnabled) { if (resolver) { resolver->Reject( DOMException::Create(DOMExceptionCode::kInvalidStateError, "")); @@ -173,9 +177,6 @@ void PictureInPictureControllerImpl::ExitPictureInPicture( HTMLVideoElement* element, ScriptPromiseResolver* resolver) { - if (element->GetWebMediaPlayer()) - element->GetWebMediaPlayer()->ExitPictureInPicture(); - if (!EnsureService()) return;
diff --git a/third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_controller_test.cc b/third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_controller_test.cc index 05239c5..10b7da8 100644 --- a/third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_controller_test.cc +++ b/third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_controller_test.cc
@@ -120,7 +120,6 @@ DISALLOW_COPY_AND_ASSIGN(PictureInPictureControllerFrameClient); }; -// TODO: can probably be removed. class PictureInPictureControllerPlayer : public EmptyWebMediaPlayer { public: PictureInPictureControllerPlayer() = default; @@ -132,6 +131,9 @@ return EmptyWebMediaPlayer::Duration(); } + ReadyState GetReadyState() const final { return kReadyStateHaveMetadata; } + bool HasVideo() const final { return true; } + void set_infinity_duration(bool value) { infinity_duration_ = value; } private: @@ -155,6 +157,7 @@ WTF::Unretained(&mock_service_))); video_ = HTMLVideoElement::Create(GetDocument()); + video_->SetReadyState(HTMLMediaElement::ReadyState::kHaveMetadata); layer_ = cc::Layer::Create(); video_->SetCcLayerForTesting(layer_.get());
diff --git a/third_party/blink/renderer/modules/service_worker/web_embedded_worker_impl_test.cc b/third_party/blink/renderer/modules/service_worker/web_embedded_worker_impl_test.cc index d61d425..2e162d4 100644 --- a/third_party/blink/renderer/modules/service_worker/web_embedded_worker_impl_test.cc +++ b/third_party/blink/renderer/modules/service_worker/web_embedded_worker_impl_test.cc
@@ -10,6 +10,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/messaging/message_port_channel.h" #include "third_party/blink/public/mojom/service_worker/service_worker_installed_scripts_manager.mojom-blink.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom-blink.h" #include "third_party/blink/public/platform/modules/service_worker/web_service_worker_network_provider.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_content_settings_client.h" @@ -37,7 +38,9 @@ FakeServiceWorkerNetworkProvider() = default; ~FakeServiceWorkerNetworkProvider() override = default; - // Return a loader from the mock factory. In production code, this uses the + void WillSendRequest(blink::WebURLRequest& request) override {} + + // Returns a loader from the mock factory. In production code, this uses the // factory provided at worker startup to load non-installed scripts via // ServiceWorkerScriptLoaderFactory. std::unique_ptr<WebURLLoader> CreateURLLoader( @@ -46,6 +49,17 @@ return Platform::Current()->GetURLLoaderMockFactory()->CreateURLLoader( nullptr); } + + blink::mojom::ControllerServiceWorkerMode IsControlledByServiceWorker() + override { + return blink::mojom::ControllerServiceWorkerMode::kNoController; + } + + int64_t ControllerServiceWorkerID() override { + return mojom::blink::kInvalidServiceWorkerVersionId; + } + + void DispatchNetworkQuiet() override {} }; class MockServiceWorkerContextClient : public WebServiceWorkerContextClient { @@ -98,7 +112,7 @@ Platform::Current() ->CreateThread(ThreadCreationParams(WebThreadType::kTestThread) .SetThreadNameForTest("io thread")) - ->GetTaskRunner()){}; + ->GetTaskRunner()) {} MOCK_CONST_METHOD1(IsScriptInstalled, bool(const KURL& script_url)); MOCK_METHOD1(GetRawScriptData, std::unique_ptr<ThreadSafeScriptContainer::RawScriptData>(
diff --git a/third_party/blink/renderer/modules/storage/cached_storage_area_test.cc b/third_party/blink/renderer/modules/storage/cached_storage_area_test.cc index eab9d83..6235942 100644 --- a/third_party/blink/renderer/modules/storage/cached_storage_area_test.cc +++ b/third_party/blink/renderer/modules/storage/cached_storage_area_test.cc
@@ -113,9 +113,9 @@ bool IsSessionStorage() override { return GetParam(); } }; -INSTANTIATE_TEST_CASE_P(CachedStorageAreaTest, - CachedStorageAreaTestWithParam, - ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(CachedStorageAreaTest, + CachedStorageAreaTestWithParam, + ::testing::Bool()); TEST_P(CachedStorageAreaTestWithParam, Basics) { EXPECT_FALSE(IsCacheLoaded()); @@ -475,7 +475,7 @@ class StringEncoding : public CachedStorageAreaTest, public testing::WithParamInterface<FormatOption> {}; -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( CachedStorageAreaTest, StringEncoding, ::testing::Values(FormatOption::kLocalStorageDetectFormat,
diff --git a/third_party/blink/renderer/modules/storage/window_storage.idl b/third_party/blink/renderer/modules/storage/window_storage.idl index 91790a6..48e77ff 100644 --- a/third_party/blink/renderer/modules/storage/window_storage.idl +++ b/third_party/blink/renderer/modules/storage/window_storage.idl
@@ -5,8 +5,8 @@ [ ImplementedAs=DOMWindowStorage ] partial interface Window { - // https://html.spec.whatwg.org/#the-sessionstorage-attribute + // https://html.spec.whatwg.org/C/#the-sessionstorage-attribute [LogActivity=GetterOnly, RaisesException=Getter] readonly attribute Storage sessionStorage; - // https://html.spec.whatwg.org/#the-localstorage-attribute + // https://html.spec.whatwg.org/C/#the-localstorage-attribute [LogActivity=GetterOnly, RaisesException=Getter] readonly attribute Storage localStorage; };
diff --git a/third_party/blink/renderer/modules/vr/vr_display.cc b/third_party/blink/renderer/modules/vr/vr_display.cc index 06ff7ad..94e7e987 100644 --- a/third_party/blink/renderer/modules/vr/vr_display.cc +++ b/third_party/blink/renderer/modules/vr/vr_display.cc
@@ -111,16 +111,16 @@ void SessionClientBinding::OnChanged( device::mojom::blink::VRDisplayInfoPtr ptr) { display_->OnChanged(std::move(ptr), is_immersive_); -}; +} void SessionClientBinding::OnExitPresent() { display_->OnExitPresent(is_immersive_); -}; +} void SessionClientBinding::OnBlur() { display_->OnBlur(is_immersive_); -}; +} void SessionClientBinding::OnFocus() { display_->OnFocus(is_immersive_); -}; +} void SessionClientBinding::Trace(blink::Visitor* visitor) { visitor->Trace(display_); }
diff --git a/third_party/blink/renderer/modules/vr/vr_frame_data.cc b/third_party/blink/renderer/modules/vr/vr_frame_data.cc index dd1af5b1..4ded226 100644 --- a/third_party/blink/renderer/modules/vr/vr_frame_data.cc +++ b/third_party/blink/renderer/modules/vr/vr_frame_data.cc
@@ -165,7 +165,7 @@ out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; return true; -}; +} VRFrameData::VRFrameData() { left_projection_matrix_ = DOMFloat32Array::Create(16);
diff --git a/third_party/blink/renderer/modules/webaudio/analyser_node.cc b/third_party/blink/renderer/modules/webaudio/analyser_node.cc index 489fd34..01583d25 100644 --- a/third_party/blink/renderer/modules/webaudio/analyser_node.cc +++ b/third_party/blink/renderer/modules/webaudio/analyser_node.cc
@@ -184,7 +184,7 @@ double AnalyserHandler::TailTime() const { return RealtimeAnalyser::kMaxFFTSize / static_cast<double>(Context()->sampleRate()); -}; +} // ---------------------------------------------------------------- AnalyserNode::AnalyserNode(BaseAudioContext& context)
diff --git a/third_party/blink/renderer/modules/webaudio/audio_context_autoplay_test.cc b/third_party/blink/renderer/modules/webaudio/audio_context_autoplay_test.cc index d7d4fb5..80467663 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_context_autoplay_test.cc +++ b/third_party/blink/renderer/modules/webaudio/audio_context_autoplay_test.cc
@@ -687,7 +687,7 @@ } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( AudioContextAutoplayTest, AudioContextAutoplayTest, testing::Values(AutoplayPolicy::Type::kNoUserGestureRequired,
diff --git a/third_party/blink/renderer/modules/webdatabase/database.cc b/third_party/blink/renderer/modules/webdatabase/database.cc index 999d4bc..3dd797a 100644 --- a/third_party/blink/renderer/modules/webdatabase/database.cc +++ b/third_party/blink/renderer/modules/webdatabase/database.cc
@@ -734,7 +734,7 @@ database_authorizer_->Reset(); } -unsigned long long Database::MaximumSize() const { +uint64_t Database::MaximumSize() const { return DatabaseTracker::Tracker().GetMaxSizeForDatabase(this); }
diff --git a/third_party/blink/renderer/modules/webdatabase/database.h b/third_party/blink/renderer/modules/webdatabase/database.h index 48841e0..567dbf1 100644 --- a/third_party/blink/renderer/modules/webdatabase/database.h +++ b/third_party/blink/renderer/modules/webdatabase/database.h
@@ -105,7 +105,7 @@ String FileName() const; SQLiteDatabase& SqliteDatabase() { return sqlite_database_; } - unsigned long long MaximumSize() const; + uint64_t MaximumSize() const; void IncrementalVacuumIfNeeded(); void DisableAuthorizer();
diff --git a/third_party/blink/renderer/modules/webdatabase/database_tracker.cc b/third_party/blink/renderer/modules/webdatabase/database_tracker.cc index d66f60a0..bf6764f 100644 --- a/third_party/blink/renderer/modules/webdatabase/database_tracker.cc +++ b/third_party/blink/renderer/modules/webdatabase/database_tracker.cc
@@ -167,10 +167,9 @@ DatabaseClosed(database); } -unsigned long long DatabaseTracker::GetMaxSizeForDatabase( - const Database* database) { - unsigned long long space_available = 0; - unsigned long long database_size = 0; +uint64_t DatabaseTracker::GetMaxSizeForDatabase(const Database* database) { + uint64_t space_available = 0; + uint64_t database_size = 0; QuotaTracker::Instance().GetDatabaseSizeAndSpaceAvailableToOrigin( database->GetSecurityOrigin(), database->StringIdentifier(), &database_size, &space_available);
diff --git a/third_party/blink/renderer/modules/webdatabase/database_tracker.h b/third_party/blink/renderer/modules/webdatabase/database_tracker.h index 7a1ee75..5ef2472 100644 --- a/third_party/blink/renderer/modules/webdatabase/database_tracker.h +++ b/third_party/blink/renderer/modules/webdatabase/database_tracker.h
@@ -72,7 +72,7 @@ void AddOpenDatabase(Database*); void RemoveOpenDatabase(Database*); - unsigned long long GetMaxSizeForDatabase(const Database*); + uint64_t GetMaxSizeForDatabase(const Database*); void CloseDatabasesImmediately(const SecurityOrigin*, const String& name);
diff --git a/third_party/blink/renderer/modules/webdatabase/quota_tracker.cc b/third_party/blink/renderer/modules/webdatabase/quota_tracker.cc index 3e9a066..1b6b484 100644 --- a/third_party/blink/renderer/modules/webdatabase/quota_tracker.cc +++ b/third_party/blink/renderer/modules/webdatabase/quota_tracker.cc
@@ -46,8 +46,8 @@ void QuotaTracker::GetDatabaseSizeAndSpaceAvailableToOrigin( const SecurityOrigin* origin, const String& database_name, - unsigned long long* database_size, - unsigned long long* space_available) { + uint64_t* database_size, + uint64_t* space_available) { // Extra scope to unlock prior to potentially calling Platform. { MutexLocker lock_data(data_guard_); @@ -65,7 +65,7 @@ void QuotaTracker::UpdateDatabaseSize(const SecurityOrigin* origin, const String& database_name, - unsigned long long database_size) { + uint64_t database_size) { MutexLocker lock_data(data_guard_); HashMap<String, SizeMap>::ValueType* it = database_sizes_.insert(origin->ToRawString(), SizeMap()).stored_value;
diff --git a/third_party/blink/renderer/modules/webdatabase/quota_tracker.h b/third_party/blink/renderer/modules/webdatabase/quota_tracker.h index dba6efb..12d72185 100644 --- a/third_party/blink/renderer/modules/webdatabase/quota_tracker.h +++ b/third_party/blink/renderer/modules/webdatabase/quota_tracker.h
@@ -48,19 +48,18 @@ public: static QuotaTracker& Instance(); - void GetDatabaseSizeAndSpaceAvailableToOrigin( - const SecurityOrigin*, - const String& database_name, - unsigned long long* database_size, - unsigned long long* space_available); + void GetDatabaseSizeAndSpaceAvailableToOrigin(const SecurityOrigin*, + const String& database_name, + uint64_t* database_size, + uint64_t* space_available); void UpdateDatabaseSize(const SecurityOrigin*, const String& database_name, - unsigned long long database_size); + uint64_t database_size); private: QuotaTracker() = default; - typedef HashMap<String, unsigned long long> SizeMap; + typedef HashMap<String, uint64_t> SizeMap; HashMap<String, SizeMap> database_sizes_; Mutex data_guard_;
diff --git a/third_party/blink/renderer/modules/webdatabase/quota_tracker_test.cc b/third_party/blink/renderer/modules/webdatabase/quota_tracker_test.cc index eeccb552..f4cbe7a 100644 --- a/third_party/blink/renderer/modules/webdatabase/quota_tracker_test.cc +++ b/third_party/blink/renderer/modules/webdatabase/quota_tracker_test.cc
@@ -17,11 +17,11 @@ SecurityOrigin::CreateFromString("file:///a/b/c"); const String database_name = "db"; - const unsigned long long kDatabaseSize = 1234ULL; + const uint64_t kDatabaseSize = 1234ULL; tracker.UpdateDatabaseSize(origin.get(), database_name, kDatabaseSize); - unsigned long long used = 0; - unsigned long long available = 0; + uint64_t used = 0; + uint64_t available = 0; tracker.GetDatabaseSizeAndSpaceAvailableToOrigin(origin.get(), database_name, &used, &available); @@ -35,14 +35,14 @@ SecurityOrigin::CreateFromString("file:///a/b/c"); const String database_name = "db"; - const unsigned long long kDatabaseSize = 1234ULL; + const uint64_t kDatabaseSize = 1234ULL; tracker.UpdateDatabaseSize(origin.get(), database_name, kDatabaseSize); // QuotaTracker should not care about policy, just identity. origin->BlockLocalAccessFromLocalOrigin(); - unsigned long long used = 0; - unsigned long long available = 0; + uint64_t used = 0; + uint64_t available = 0; tracker.GetDatabaseSizeAndSpaceAvailableToOrigin(origin.get(), database_name, &used, &available);
diff --git a/third_party/blink/renderer/platform/audio/audio_dsp_kernel.h b/third_party/blink/renderer/platform/audio/audio_dsp_kernel.h index cee1521..35f9190b 100644 --- a/third_party/blink/renderer/platform/audio/audio_dsp_kernel.h +++ b/third_party/blink/renderer/platform/audio/audio_dsp_kernel.h
@@ -59,7 +59,7 @@ uint32_t frames_to_process) = 0; // Subclasses that have AudioParams must override this to process the // AudioParams. - virtual void ProcessOnlyAudioParams(uint32_t frames_to_process){}; + virtual void ProcessOnlyAudioParams(uint32_t frames_to_process) {} virtual void Reset() = 0; float SampleRate() const { return sample_rate_; }
diff --git a/third_party/blink/renderer/platform/bindings/active_script_wrappable_base.cc b/third_party/blink/renderer/platform/bindings/active_script_wrappable_base.cc index 77350a1..b34636ac 100644 --- a/third_party/blink/renderer/platform/bindings/active_script_wrappable_base.cc +++ b/third_party/blink/renderer/platform/bindings/active_script_wrappable_base.cc
@@ -28,7 +28,7 @@ // detached, even if hasPendingActivity() returns |true|. This measure // avoids memory leaks and has proven not to be too eager wrt // garbage collection of objects belonging to discarded browser contexts - // ( https://html.spec.whatwg.org/#a-browsing-context-is-discarded ) + // ( https://html.spec.whatwg.org/C/#a-browsing-context-is-discarded ) // // Consequently, an implementation of hasPendingActivity() is // not required to take the detached state of the associated
diff --git a/third_party/blink/renderer/platform/graphics/compositing/property_tree_manager.cc b/third_party/blink/renderer/platform/graphics/compositing/property_tree_manager.cc index b3e4b42..d2b161c7 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/property_tree_manager.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/property_tree_manager.cc
@@ -429,7 +429,6 @@ GetEffectTree().Insert(cc::EffectNode(), current_.effect_id)); mask_effect.stable_id = mask_effect_id.GetInternalValue(); mask_effect.clip_id = clip_id; - mask_effect.has_render_surface = true; mask_effect.blend_mode = SkBlendMode::kDstIn; const auto& clip_space = current_.clip->LocalTransformSpace();
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_response.h b/third_party/blink/renderer/platform/loader/fetch/resource_response.h index d553472..ff4880d 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_response.h +++ b/third_party/blink/renderer/platform/loader/fetch/resource_response.h
@@ -312,11 +312,11 @@ void SetType(network::mojom::FetchResponseType value) { response_type_ = value; } - // https://html.spec.whatwg.org/#cors-same-origin + // https://html.spec.whatwg.org/C/#cors-same-origin bool IsCorsSameOrigin() const { return network::cors::IsCorsSameOriginResponseType(response_type_); } - // https://html.spec.whatwg.org/#cors-cross-origin + // https://html.spec.whatwg.org/C/#cors-cross-origin bool IsCorsCrossOrigin() const { return network::cors::IsCorsCrossOriginResponseType(response_type_); }
diff --git a/third_party/blink/renderer/platform/testing/empty_web_media_player.h b/third_party/blink/renderer/platform/testing/empty_web_media_player.h index fea2a40..8e268e9 100644 --- a/third_party/blink/renderer/platform/testing/empty_web_media_player.h +++ b/third_party/blink/renderer/platform/testing/empty_web_media_player.h
@@ -28,8 +28,7 @@ void Seek(double seconds) override {} void SetRate(double) override {} void SetVolume(double) override {} - void EnterPictureInPicture() override {} - void ExitPictureInPicture() override {} + void OnRequestPictureInPicture() override {} void SetPictureInPictureCustomControls( const std::vector<PictureInPictureControlInfo>&) override {} SurfaceLayerMode GetVideoSurfaceLayerMode() const override {
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index e0126ed..1e11a5f3 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -4329,6 +4329,18 @@ crbug.com/825798 external/wpt/html/semantics/embedded-content/media-elements/track/track-element/track-webvtt-non-snap-to-lines.html [ Failure ] +crbug.com/848607 external/wpt/import-maps/module-map-key.tentative.html [ Failure ] +crbug.com/848607 external/wpt/import-maps/http.sub.tentative.html [ Failure ] +crbug.com/848607 external/wpt/import-maps/bare.sub.tentative.html [ Failure ] +crbug.com/848607 external/wpt/import-maps/data.sub.tentative.html [ Failure ] +crbug.com/848607 external/wpt/import-maps/fallback-disallowed.sub.tentative.html [ Failure ] +crbug.com/848607 external/wpt/import-maps/fallback.sub.tentative.html [ Failure ] +crbug.com/848607 external/wpt/import-maps/resolving.tentative.html [ Failure ] +crbug.com/848607 external/wpt/import-maps/acquire-import-maps-flag/dynamic-import/ [ Skip ] +crbug.com/848607 external/wpt/import-maps/acquire-import-maps-flag/script-tag/ [ Skip ] + +crbug.com/927477 external/wpt/import-maps/acquire-import-maps-flag/worker-request/ [ Skip ] + # This test requires a special browser flag and seems not suitable for a wpt test, see bug. crbug.com/691944 external/wpt/service-workers/service-worker/update-after-oneday.https.html [ Skip ] crbug.com/691944 virtual/disabled-service-worker-servicification/external/wpt/service-workers/service-worker/update-after-oneday.https.html [ Skip ] @@ -6087,3 +6099,10 @@ # Sheriff 2019-02-12 crbug.com/931349 [ Mac ] fast/events/popup-blocking-timers5.html [ Failure Timeout Pass ] crbug.com/931349 [ Mac ] media/video-played-ranges-1.html [ Failure Timeout Pass ] + +# Viz on Android causes issues due to synchronization of view / renderer sizes. +crbug.com/930934 [ Android ] compositing/rendering-contexts.html [ Failure ] +crbug.com/930934 [ Android ] paint/invalidation/compositing/should-not-repaint-composited-opacity.html [ Failure ] +crbug.com/930934 [ Android ] paint/invalidation/svg/animated-svg-as-image-transformed-offscreen.html [ Failure ] +crbug.com/930934 [ Android ] paint/selection/selection-drag-image-in-iframe.html [ Failure ] +crbug.com/930934 [ Android ] virtual/gpu-rasterization/images/drag-image-descendant-painting-sibling.html [ Failure ]
diff --git a/third_party/blink/web_tests/animations/animationworklet/animator-animate-expected.txt b/third_party/blink/web_tests/animations/animationworklet/animator-animate-expected.txt deleted file mode 100644 index f456956..0000000 --- a/third_party/blink/web_tests/animations/animationworklet/animator-animate-expected.txt +++ /dev/null
@@ -1,2 +0,0 @@ -CONSOLE MESSAGE: line 36: opacity of target is 0.5 -
diff --git a/third_party/blink/web_tests/animations/animationworklet/animator-animate.html b/third_party/blink/web_tests/animations/animationworklet/animator-animate.html deleted file mode 100644 index a20dd7ec..0000000 --- a/third_party/blink/web_tests/animations/animationworklet/animator-animate.html +++ /dev/null
@@ -1,41 +0,0 @@ -<!DOCTYPE html> -<style> -#target { - width: 100px; - height: 100px; - background-color: green; -} -</style> -<script id="simple_animate" type="text/worklet"> -registerAnimator("test_animator", class { - animate(currentTime, effect) { - effect.localTime = 500; - } -}); -</script> - -<div id="target"></div> - -<script src="resources/animation-worklet-tests.js"></script> -<script> -if (window.testRunner) { - testRunner.waitUntilDone(); - testRunner.dumpAsText(); -} - -runInAnimationWorklet( - document.getElementById('simple_animate').textContent -).then(_ => { - const target = document.getElementById('target'); - const effect = new KeyframeEffect(target, [{ opacity: 0 }], { duration: 1000 }); - const animation = new WorkletAnimation('test_animator', [effect], document.timeline, {}); - animation.play(); - - if (window.testRunner) { - waitTwoAnimationFrames( _ => { - console.log(`opacity of target is ${getComputedStyle(target).opacity}`); - testRunner.notifyDone(); - }); - } -}); -</script>
diff --git a/third_party/blink/web_tests/animations/animationworklet/animator-with-options-expected.txt b/third_party/blink/web_tests/animations/animationworklet/animator-with-options-expected.txt deleted file mode 100644 index c6bdec3..0000000 --- a/third_party/blink/web_tests/animations/animationworklet/animator-with-options-expected.txt +++ /dev/null
@@ -1,2 +0,0 @@ -CONSOLE MESSAGE: line 44: opacity of target is 0.5 -
diff --git a/third_party/blink/web_tests/animations/animationworklet/animator-with-options.html b/third_party/blink/web_tests/animations/animationworklet/animator-with-options.html deleted file mode 100644 index 91f6116..0000000 --- a/third_party/blink/web_tests/animations/animationworklet/animator-with-options.html +++ /dev/null
@@ -1,49 +0,0 @@ -<!DOCTYPE html> -<style> -#target { - width: 100px; - height: 100px; - background-color: green; -} -</style> - -<script id="animate_with_options" type="text/worklet"> -registerAnimator("test_animator", class { - constructor(options) { - this.time_ = options.time; - } - animate(currentTime, effect) { - effect.localTime = this.time_; - } -}); -</script> - -<div id="target"></div> - -<script src="resources/animation-worklet-tests.js"></script> -<script> -if (window.testRunner) { - testRunner.waitUntilDone(); - testRunner.dumpAsText(); -} - -runInAnimationWorklet( - document.getElementById('animate_with_options').textContent -).then(_ => { - const target = document.getElementById('target'); - const effect = new KeyframeEffect(target, [{ opacity: 0 }], { duration: 1000 }); - const options = { - 'time': 500 - }; - const animation = new WorkletAnimation('test_animator', [effect], - document.timeline, options); - animation.play(); - - if (window.testRunner) { - waitTwoAnimationFrames( _ => { - console.log(`opacity of target is ${getComputedStyle(target).opacity}`); - testRunner.notifyDone(); - }); - } -}); -</script>
diff --git a/third_party/blink/web_tests/compositing/overflow/tiled-mask-expected.png b/third_party/blink/web_tests/compositing/overflow/tiled-mask-expected.png index 0eac266..2fb86778 100644 --- a/third_party/blink/web_tests/compositing/overflow/tiled-mask-expected.png +++ b/third_party/blink/web_tests/compositing/overflow/tiled-mask-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_5.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_5.json index 0a00b25f..93e23fa8 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_5.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_5.json
@@ -174348,6 +174348,106 @@ {} ] ], + "import-maps/@std/__dir__.headers": [ + [ + {} + ] + ], + "import-maps/@std/blank": [ + [ + {} + ] + ], + "import-maps/@std/none": [ + [ + {} + ] + ], + "import-maps/README.md": [ + [ + {} + ] + ], + "import-maps/bare/__dir__.headers": [ + [ + {} + ] + ], + "import-maps/bare/bare": [ + [ + {} + ] + ], + "import-maps/bare/blank": [ + [ + {} + ] + ], + "import-maps/bare/cross-origin-bare": [ + [ + {} + ] + ], + "import-maps/bare/none": [ + [ + {} + ] + ], + "import-maps/bare/std-blank": [ + [ + {} + ] + ], + "import-maps/bare/std-none": [ + [ + {} + ] + ], + "import-maps/bare/to-bare": [ + [ + {} + ] + ], + "import-maps/bare/to-data": [ + [ + {} + ] + ], + "import-maps/builtin.tentative-expected.txt": [ + [ + {} + ] + ], + "import-maps/resources/empty.js": [ + [ + {} + ] + ], + "import-maps/resources/log.js": [ + [ + {} + ] + ], + "import-maps/resources/log.js.headers": [ + [ + {} + ] + ], + "import-maps/resources/resolving.js": [ + [ + {} + ] + ], + "import-maps/resources/test-helper.js": [ + [ + {} + ] + ], + "import-maps/static-import.js": [ + [ + {} + ] + ], "infrastructure/META.yml": [ [ {} @@ -202995,12 +203095,30 @@ {} ] ], + "animation-worklet/animate-multiple-effects-on-different-targets-via-main-thread.https.html": [ + [ + "/animation-worklet/animate-multiple-effects-on-different-targets-via-main-thread.https.html", + {} + ] + ], "animation-worklet/animation-worklet-inside-iframe.https.html": [ [ "/animation-worklet/animation-worklet-inside-iframe.https.html", {} ] ], + "animation-worklet/animator-animate.https.html": [ + [ + "/animation-worklet/animator-animate.https.html", + {} + ] + ], + "animation-worklet/animator-with-options.https.html": [ + [ + "/animation-worklet/animator-with-options.https.html", + {} + ] + ], "animation-worklet/current-time.https.html": [ [ "/animation-worklet/current-time.https.html", @@ -203017,6 +203135,12 @@ {} ] ], + "animation-worklet/multiple-effects-on-same-target-driven-by-individual-local-time.https.html": [ + [ + "/animation-worklet/multiple-effects-on-same-target-driven-by-individual-local-time.https.html", + {} + ] + ], "animation-worklet/playback-rate.https.html": [ [ "/animation-worklet/playback-rate.https.html", @@ -215177,6 +215301,12 @@ {} ] ], + "css/css-syntax/unclosed-url-at-eof.html": [ + [ + "/css/css-syntax/unclosed-url-at-eof.html", + {} + ] + ], "css/css-syntax/unicode-range-selector.html": [ [ "/css/css-syntax/unicode-range-selector.html", @@ -219793,6 +219923,12 @@ {} ] ], + "css/css-values/calc-angle-values.html": [ + [ + "/css/css-values/calc-angle-values.html", + {} + ] + ], "css/css-values/calc-in-color-001.html": [ [ "/css/css-values/calc-in-color-001.html", @@ -219835,6 +219971,12 @@ {} ] ], + "css/css-values/calc-time-values.html": [ + [ + "/css/css-values/calc-time-values.html", + {} + ] + ], "css/css-values/calc-unit-analysis.html": [ [ "/css/css-values/calc-unit-analysis.html", @@ -250557,6 +250699,78 @@ {} ] ], + "import-maps/acquire-import-maps-flag/dynamic-import/success.tentative.html": [ + [ + "/import-maps/acquire-import-maps-flag/dynamic-import/success.tentative.html", + {} + ] + ], + "import-maps/acquire-import-maps-flag/script-tag/success.tentative.html": [ + [ + "/import-maps/acquire-import-maps-flag/script-tag/success.tentative.html", + {} + ] + ], + "import-maps/acquire-import-maps-flag/worker-request/success.tentative.html": [ + [ + "/import-maps/acquire-import-maps-flag/worker-request/success.tentative.html", + {} + ] + ], + "import-maps/bare.sub.tentative.html": [ + [ + "/import-maps/bare.sub.tentative.html", + {} + ] + ], + "import-maps/builtin-import-scheme.tentative.html": [ + [ + "/import-maps/builtin-import-scheme.tentative.html", + {} + ] + ], + "import-maps/builtin.tentative.html": [ + [ + "/import-maps/builtin.tentative.html", + {} + ] + ], + "import-maps/data.sub.tentative.html": [ + [ + "/import-maps/data.sub.tentative.html", + {} + ] + ], + "import-maps/fallback-disallowed.sub.tentative.html": [ + [ + "/import-maps/fallback-disallowed.sub.tentative.html", + {} + ] + ], + "import-maps/fallback.sub.tentative.html": [ + [ + "/import-maps/fallback.sub.tentative.html", + {} + ] + ], + "import-maps/http.sub.tentative.html": [ + [ + "/import-maps/http.sub.tentative.html", + {} + ] + ], + "import-maps/module-map-key.tentative.html": [ + [ + "/import-maps/module-map-key.tentative.html", + {} + ] + ], + "import-maps/resolving.tentative.html": [ + [ + "/import-maps/resolving.tentative.html", + {} + ] + ], "inert/inert-does-not-match-disabled-selector.tentative.html": [ [ "/inert/inert-does-not-match-disabled-selector.tentative.html", @@ -308064,10 +308278,22 @@ "c6918965843779e02522af1abf48acda8d0a128b", "support" ], + "animation-worklet/animate-multiple-effects-on-different-targets-via-main-thread.https.html": [ + "d22ed4cd251a20de43c4425e54abdc984b41976a", + "testharness" + ], "animation-worklet/animation-worklet-inside-iframe.https.html": [ "b02186309dc2cf8df05559ef9fb9bcacdf535112", "testharness" ], + "animation-worklet/animator-animate.https.html": [ + "6efc3caf89d7fc0a933ed3366bedcaa41f19b5c9", + "testharness" + ], + "animation-worklet/animator-with-options.https.html": [ + "1ff2544d6a9a4ee2cb251ef1d27b2278d979344f", + "testharness" + ], "animation-worklet/common.js": [ "983c22403c44256f11ca470f2f74410ac3b84e08", "support" @@ -308088,6 +308314,10 @@ "f73208c2a3c700d03ea1d39322a3e061b5caa5f7", "support" ], + "animation-worklet/multiple-effects-on-same-target-driven-by-individual-local-time.https.html": [ + "edf8488deda79eeb8eec071bf24305543d2f6627", + "testharness" + ], "animation-worklet/playback-rate.https.html": [ "9c975814f1ed09b3e78493df177c3c0eddf74cdd", "testharness" @@ -312165,7 +312395,7 @@ "support" ], "content-security-policy/securitypolicyviolation/targeting.html": [ - "28ca32e3dcc345fff5e187eee24e124cdbb250d4", + "b21273ca555cb24aab369a752192ab87355339d2", "testharness" ], "content-security-policy/securitypolicyviolation/upgrade-insecure-requests-reporting.https.html": [ @@ -358696,6 +358926,10 @@ "3d7940387c810572159bd55fcc79fc10626221dc", "testharness" ], + "css/css-syntax/unclosed-url-at-eof.html": [ + "7157896d97857f6aad35114f29323b2b6bdd9318", + "testharness" + ], "css/css-syntax/unicode-range-selector-expected.txt": [ "36bb5fa54626d9af05892bb7874ab513bb13147e", "support" @@ -375392,6 +375626,10 @@ "ec96924a6805bc6157a3845c12b630aed9e52fa8", "reftest" ], + "css/css-values/calc-angle-values.html": [ + "e41beaff211b87dd74dd6fee6f05d894ba03988d", + "testharness" + ], "css/css-values/calc-ch-ex-lang-ref.html": [ "e0ac1ead1e5247c7c1d5fb2dffdf9ee0b08dd497", "support" @@ -375480,6 +375718,10 @@ "f92de7338d3f05a6623f3aa882e21a724f1344e5", "testharness" ], + "css/css-values/calc-time-values.html": [ + "60bcdcba594d8300091120100dfe8d878f8ff708", + "testharness" + ], "css/css-values/calc-unit-analysis.html": [ "7508a3924162b87454a180f75f17c572192c3776", "testharness" @@ -420672,6 +420914,134 @@ "2bb82c9834790bfeb1a65cf2ef202dc63d2ebac4", "support" ], + "import-maps/@std/__dir__.headers": [ + "e7ec0d6699d07e5b13d0cb6f24c3639258fccdaa", + "support" + ], + "import-maps/@std/blank": [ + "38e1891bf7d5db9ad7063dc1f22bb17f8b1d4446", + "support" + ], + "import-maps/@std/none": [ + "69e165cce5e223684c9d0f0f7848bc6fc02b14cd", + "support" + ], + "import-maps/README.md": [ + "3803e350c844b4af77b871831817ac0d90aca97f", + "support" + ], + "import-maps/acquire-import-maps-flag/dynamic-import/success.tentative.html": [ + "512cd7fa6974e802dab6bff4c190774a76d7cbf1", + "testharness" + ], + "import-maps/acquire-import-maps-flag/script-tag/success.tentative.html": [ + "7f319b04758f8dbfd688f10b6a86be16d6bb720f", + "testharness" + ], + "import-maps/acquire-import-maps-flag/worker-request/success.tentative.html": [ + "ceef4100aad01f5cd5959086aacf83665f60c805", + "testharness" + ], + "import-maps/bare.sub.tentative.html": [ + "5bfb6b52072338568397a8dfac3a98a90c70b34b", + "testharness" + ], + "import-maps/bare/__dir__.headers": [ + "e7ec0d6699d07e5b13d0cb6f24c3639258fccdaa", + "support" + ], + "import-maps/bare/bare": [ + "1011e866b81dca7bf423fcb48266463c77591465", + "support" + ], + "import-maps/bare/blank": [ + "841d433acf72f828c34faca23f26e9afd10fbab7", + "support" + ], + "import-maps/bare/cross-origin-bare": [ + "64851cc8e2455a4cd150b10edf051425bb6dc5bf", + "support" + ], + "import-maps/bare/none": [ + "2aec0d72826f203074dea5a5268b9f937bdb7183", + "support" + ], + "import-maps/bare/std-blank": [ + "5ded98fd382a52a11d52af57cc7e79f56b083843", + "support" + ], + "import-maps/bare/std-none": [ + "1437d9ff1e0c0c60672a1f656a2ab91aa01601db", + "support" + ], + "import-maps/bare/to-bare": [ + "bdb3791bc9471533434067b826dc59fef07e1c0c", + "support" + ], + "import-maps/bare/to-data": [ + "6f25c5af12412dc6dbb374d4bee0fdd1472f475e", + "support" + ], + "import-maps/builtin-import-scheme.tentative.html": [ + "6a27ef5aee2371b2114bc75b2b194c22a5fa85c2", + "testharness" + ], + "import-maps/builtin.tentative-expected.txt": [ + "76932ca432f2ce3f814186598c6942c73bd9805c", + "support" + ], + "import-maps/builtin.tentative.html": [ + "e85289e4d884d49bb4520154cecdd2826a07b333", + "testharness" + ], + "import-maps/data.sub.tentative.html": [ + "1c7172bf7c6f21aeb22948f9d3eb05d9b3c11b86", + "testharness" + ], + "import-maps/fallback-disallowed.sub.tentative.html": [ + "3f89e8f12dfe04b214b36ef89a89eeccdbea935b", + "testharness" + ], + "import-maps/fallback.sub.tentative.html": [ + "4cf3e18182a11a75d682106d88c532d069b6e77d", + "testharness" + ], + "import-maps/http.sub.tentative.html": [ + "bd24f3535507334a69bb98b711106466c8a340a3", + "testharness" + ], + "import-maps/module-map-key.tentative.html": [ + "13bd122c673144f001048eacbaf4fc7bb78c9b58", + "testharness" + ], + "import-maps/resolving.tentative.html": [ + "f2b09a7ae02422c8f6fd3f8dad1f9b8d52a43831", + "testharness" + ], + "import-maps/resources/empty.js": [ + "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "support" + ], + "import-maps/resources/log.js": [ + "a024a29bf2482c78cf7eb96544d38217f1d81f81", + "support" + ], + "import-maps/resources/log.js.headers": [ + "cb762eff806849df46dc758ef7b98b63f27f54c9", + "support" + ], + "import-maps/resources/resolving.js": [ + "ec2645e599119ab64949c016076164b40277006c", + "support" + ], + "import-maps/resources/test-helper.js": [ + "2447bfb94353e1ec193857cbcda79f46556216a1", + "support" + ], + "import-maps/static-import.js": [ + "1686fc123a798bddbf626f4d112516317739da8f", + "support" + ], "inert/inert-does-not-match-disabled-selector.tentative.html": [ "74b8ac3f7dd5c3447bf47fd732fade9220497c93", "testharness" @@ -434601,7 +434971,7 @@ "support" ], "picture-in-picture/disable-picture-in-picture.html": [ - "31e0d12ad770fb9bcc8bbc2f7f86d690efe3c06d", + "5075c011632e549848dfbd3420d733d60e84dc8a", "testharness" ], "picture-in-picture/enter-picture-in-picture.html": [ @@ -451373,15 +451743,15 @@ "testharness" ], "svg/geometry/parsing/ry-invalid-expected.txt": [ - "f8f69653524e1686c070ba0584a2c7fc6925064a", + "4a845ad2a10e1fe7a6fd8de81bf20488672000b1", "support" ], "svg/geometry/parsing/ry-invalid.svg": [ - "7a25a1ec0e61e4a36e65b7884d9667bb1614adfa", + "5938ae830d52ad752a3f502a2308e9efae57dcdb", "testharness" ], "svg/geometry/parsing/ry-valid.svg": [ - "e92e2cf6410ba4071baa81c18ec4462ba60b42dd", + "178c0c007d649d75bd51a52a31f5c046eba9fd28", "testharness" ], "svg/geometry/parsing/sizing-properties-computed.svg": [
diff --git a/third_party/blink/web_tests/external/wpt/animation-worklet/animator-animate.https.html b/third_party/blink/web_tests/external/wpt/animation-worklet/animator-animate.https.html new file mode 100644 index 0000000..6efc3caf --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/animation-worklet/animator-animate.https.html
@@ -0,0 +1,22 @@ +<!DOCTYPE html> +<title>Basic use of Worklet Animation</title> +<link rel="help" href="https://drafts.css-houdini.org/css-animationworklet/"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/web-animations/testcommon.js"></script> +<script src="common.js"></script> + +<div id="target"></div> + +<script> + promise_test(async t => { + await registerConstantLocalTimeAnimator(500); + const effect = new KeyframeEffect(target, [{ opacity: 0 }], { duration: 1000 }); + const animation = new WorkletAnimation('constant_time', effect); + animation.play(); + + await waitForAsyncAnimationFrames(1); + assert_equals(getComputedStyle(target).opacity, "0.5"); + }, "Simple worklet animation should output values at specified local time"); +</script> \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/animation-worklet/animator-with-options.https.html b/third_party/blink/web_tests/external/wpt/animation-worklet/animator-with-options.https.html new file mode 100644 index 0000000..1ff2544 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/animation-worklet/animator-with-options.https.html
@@ -0,0 +1,35 @@ +<!DOCTYPE html> +<title>Worklet Animation with options</title> +<link rel="help" href="https://drafts.css-houdini.org/css-animationworklet/"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/web-animations/testcommon.js"></script> +<script src="common.js"></script> + +<div id="target"></div> + +<script id="animate_with_options" type="text/worklet"> + registerAnimator("test_animator", class { + constructor(options) { + this.time_ = options.time; + } + animate(currentTime, effect) { + effect.localTime = this.time_; + } + }); +</script> + +<script> + promise_test(async t => { + await runInAnimationWorklet(document.getElementById('animate_with_options').textContent); + const target = document.getElementById('target'); + const effect = new KeyframeEffect(target, [{ opacity: 0 }], { duration: 1000 }); + const options = {'time': 500}; + const animation = new WorkletAnimation('test_animator', effect, document.timeline, options); + animation.play(); + + await waitForAsyncAnimationFrames(1); + assert_equals(getComputedStyle(target).opacity, "0.5"); + }, "Animator should be able to use options to update the animation"); +</script> \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/content-security-policy/securitypolicyviolation/targeting.html b/third_party/blink/web_tests/external/wpt/content-security-policy/securitypolicyviolation/targeting.html index 28ca32e..b21273ca 100644 --- a/third_party/blink/web_tests/external/wpt/content-security-policy/securitypolicyviolation/targeting.html +++ b/third_party/blink/web_tests/external/wpt/content-security-policy/securitypolicyviolation/targeting.html
@@ -36,7 +36,7 @@ .then(t.step_func(e => { assert_equals(e.blockedURI, "inline"); assert_equals(e.lineNumber, 118); - assert_equals(e.columnNumber, 4); + assert_in_array(e.columnNumber, [4, 6]); assert_equals(e.target, document, "Elements created in this document, but pushed into a same-origin frame trigger on that frame's document, not on this frame's document."); return watcher.wait_for('securitypolicyviolation'); })) @@ -50,7 +50,7 @@ .then(t.step_func(e => { assert_equals(e.blockedURI, "inline"); assert_equals(e.lineNumber, 139); - assert_equals(e.columnNumber, 4); + assert_in_array(e.columnNumber, [4, 6]); assert_equals(e.target, document, "Inline event handlers for disconnected elements target the document."); return watcher.wait_for('securitypolicyviolation'); }))
diff --git a/third_party/blink/web_tests/external/wpt/css/css-syntax/unclosed-url-at-eof.html b/third_party/blink/web_tests/external/wpt/css/css-syntax/unclosed-url-at-eof.html new file mode 100644 index 0000000..7157896 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-syntax/unclosed-url-at-eof.html
@@ -0,0 +1,29 @@ +<!doctype html> +<title>Unclosed URL At EOF</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<meta name=author title="Tab Atkins-Bittner"> +<link rel=help href="https://drafts.csswg.org/css-syntax/#consume-url-token"> + +<div id=test1-control style="background-image:url(foo)"></div> +<div id=test1-experiment style="background-image:url(foo"></div> + +<div id=test2-control style="background-image:url()"></div> +<div id=test2-experiment style="background-image:url("></div> + +<script> + +test(()=>{ + const control = document.querySelector("#test1-control"); + const experiment = document.querySelector("#test1-experiment"); + assert_equals(control.style.backgroundImage, experiment.style.backgroundImage); +}, "Unclosed url token at EOF is valid."); + +test(()=>{ + const control = document.querySelector("#test2-control"); + const experiment = document.querySelector("#test2-experiment"); + assert_equals(control.style.backgroundImage, experiment.style.backgroundImage); +}, "Unclosed empty url token at EOF is valid."); + +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-values/calc-angle-values.html b/third_party/blink/web_tests/external/wpt/css/css-values/calc-angle-values.html new file mode 100644 index 0000000..e41beaff --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-values/calc-angle-values.html
@@ -0,0 +1,295 @@ +<!DOCTYPE html> + + <meta charset="UTF-8"> + + <title>CSS Values and Units Test: calc() function with angle values</title> + + <!-- + + Original test is: + + https://chromium.googlesource.com/chromium/src/+/c825d655f6aaf73484f9d56e9012793f5b9668cc/third_party/WebKit/LayoutTests/css3/calc/calc-with-time-angle-and-frequency-values.html + + Issue 917718: [css-values] calc-with-time-angle-and-frequency-values + test is highly unreliable, transition-delay testing causes side effects + https://bugs.chromium.org/p/chromium/issues/detail?id=917718 + + --> + + <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> + <link rel="help" href="https://www.w3.org/TR/css-values-3/#calc-computed-value"> + <link rel="help" href="https://www.w3.org/TR/css-values-3/#angles"> + + <meta content="This test checks that additions, substractions, multiplications and divisions in calc() function when applied to angle units." name="assert"> + + <script src="/resources/testharness.js"></script> + + <script src="/resources/testharnessreport.js"></script> + + <div id="log"></div> + + <div id="target"></div> + + <script> + function startTesting() + { + + var targetElement = document.getElementById("target"); + + function compareValueCloseTo(property_name, calcValue, epsilon, expectedValue, description) + { + + test(function() + { + + targetElement.style.setProperty(property_name, "initial"); + + /* + Since we are running many consecutive tests on the same + element, then it is necessary to reset its property + to an initial value before actually re-testing it. + */ + + targetElement.style.setProperty(property_name, calcValue); + + var computedCalcValue = getComputedStyle(targetElement)[property_name]; + + /* + We first strip out the word "matrix" with the + opening parenthesis "(" and the closing + parenthesis ")" + */ + + computedCalcValue = computedCalcValue.replace("matrix(", "").replace(")", ""); + + /* + Then, we split the string at each comma "," + and store the resulting 6 sub-strings into + tableSplitComputedCalcValue + */ + + var tableSplitCalcValue = computedCalcValue.split(","); + + /* + We convert the 6 sub-strings into numerical floating values + so that mathematical operations (substraction, absolute value, + comparison) can be performed. + */ + + tableSplitCalcValue[0] = parseFloat(tableSplitCalcValue[0]); + tableSplitCalcValue[1] = parseFloat(tableSplitCalcValue[1]); + tableSplitCalcValue[2] = parseFloat(tableSplitCalcValue[2]); + tableSplitCalcValue[3] = parseFloat(tableSplitCalcValue[3]); + tableSplitCalcValue[4] = parseFloat(tableSplitCalcValue[4]); + tableSplitCalcValue[5] = parseFloat(tableSplitCalcValue[5]); + + /* + Now, we execute the same steps with the expectedValue + */ + + targetElement.style.setProperty(property_name, expectedValue); + + var computedExpectedValue = getComputedStyle(targetElement)[property_name]; + + /* + We first strip out the word "matrix" with the + opening parenthesis "(" and the closing + parenthesis ")" + */ + + computedExpectedValue = computedExpectedValue.replace("matrix(", "").replace(")", ""); + + /* + Then, we split the string at each comma "," + and store the resulting 6 sub-strings into + tableSplitComputedCalcValue + */ + + var tableSplitExpectedValue = computedExpectedValue.split(","); + + /* + We convert the 6 sub-strings into numerical floating values + so that mathematical operations (substraction, absolute value, + comparison) can be performed. + */ + + tableSplitExpectedValue[0] = parseFloat(tableSplitExpectedValue[0]); + tableSplitExpectedValue[1] = parseFloat(tableSplitExpectedValue[1]); + tableSplitExpectedValue[2] = parseFloat(tableSplitExpectedValue[2]); + tableSplitExpectedValue[3] = parseFloat(tableSplitExpectedValue[3]); + tableSplitExpectedValue[4] = parseFloat(tableSplitExpectedValue[4]); + tableSplitExpectedValue[5] = parseFloat(tableSplitExpectedValue[5]); + + assert_array_approx_equals(tableSplitCalcValue, tableSplitExpectedValue, epsilon); + + /* + In this mega-test of 27 sub-tests, we intentionally + set the tolerance precision (epsilon) to a rather big + value (0.0001 === 100 millionths). The reason for this + is we want to verify if browsers and CSS-capable + applications do the right calculations. We do not want + to penalize browsers and CSS-capable applications that + have modest precision (not capable of a 1 millionth + level precision). + */ + + } , description); + + } + + /* + + deg + Degrees. There are 360 degrees in a full circle. + + grad + Gradians, also known as "gons" or "grades". There are 400 gradians in a full circle. + + rad + Radians. There are 2π radians in a full circle. + + 1rad == 57.295779513° + https://www.rapidtables.com/convert/number/radians-to-degrees.html + + π == Math.PI == 3.141592653589793 + + turn + Turns. There is 1 turn in a full circle. + + */ + + + /* Addition of angle units */ + + + /* compareValueCloseTo(property_name, calcValue, epsilon, expectedValue, description) */ + + compareValueCloseTo("transform", "rotate(calc(45deg + 45deg))", 0.0001, "rotate(90deg)", "addition of 2 angle units: deg plus deg"); + + compareValueCloseTo("transform", "rotate(calc(45deg + 1rad))", 0.0001, "rotate(102.29578deg)", "addition of 2 angle units: deg plus rad"); + /* + 1 radian == 57.295779513 degrees + The original test was using the slightly imprecise rotate(102.3deg) + */ + + compareValueCloseTo("transform", "rotate(calc(20deg + 200grad))", 0.0001, "rotate(200deg)", "addition of 2 angle units: deg plus grad"); + + compareValueCloseTo("transform", "rotate(calc(200deg + 0.5turn))", 0.0001, "rotate(380deg)", "addition of 2 angle units: deg plus turn"); + + compareValueCloseTo("transform", "rotate(calc(45rad + 45rad))", 0.0001, "rotate(90rad)", "addition of 2 angle units: rad plus rad"); + + compareValueCloseTo("transform", "rotate(calc(1rad + 40grad))", 0.0001, "rotate(93.29578deg)", "addition of 2 angle units: rad plus grad"); + + /* + 1 radian == 57.295779513 degrees; 40 gradians is 36 degrees. + */ + + compareValueCloseTo("transform", "rotate(calc(1rad + 0.5turn))", 0.0001, "rotate(237.29578deg)", "addition of 2 angle units: rad plus turn"); + + compareValueCloseTo("transform", "rotate(calc(45grad + 45grad))", 0.0001, "rotate(90grad)", "addition of 2 angle units: grad plus grad"); + + compareValueCloseTo("transform", "rotate(calc(10grad + 0.5turn))", 0.0001, "rotate(189deg)", "addition of 2 angle units: grad plus turn"); + + /* + 10 gradians is 9 degrees. + */ + + /* compareValueCloseTo(property_name, calcValue, epsilon, expectedValue, description) */ + + + /* Substraction of angle unit */ + + /* compareValueCloseTo(property_name, calcValue, epsilon, expectedValue, description) */ + + compareValueCloseTo("transform", "rotate(calc(45deg - 15deg))", 0.0001, "rotate(30deg)", "substraction of angle unit: deg minus deg"); + + compareValueCloseTo("transform", "rotate(calc(90deg - 1rad))", 0.0001, "rotate(32.70422deg)", "substraction of angle unit: deg minus rad"); + + /* + 1 radian == 57.295779513 degrees + */ + + compareValueCloseTo("transform", "rotate(calc(38deg - 20grad))", 0.0001, "rotate(20deg)", "substraction of angle unit: deg minus grad"); + + compareValueCloseTo("transform", "rotate(calc(360deg - 0.5turn))", 0.0001, "rotate(180deg)", "substraction of angle unit: deg minus turn"); + + compareValueCloseTo("transform", "rotate(calc(45rad - 15rad))", 0.0001, "rotate(30rad)", "substraction of angle unit: rad minus rad"); + + compareValueCloseTo("transform", "rotate(calc(30rad - 10grad))", 0.0001, "rotate(1709.87339deg)", "substraction of angle unit: rad minus grad"); + + /* + 30 radians is 1718.8733854 degrees ; 10 gradians is 9 degrees. + */ + + compareValueCloseTo("transform", "rotate(calc(4rad - 0.1turn))", 0.0001, "rotate(193.18312deg)", "substraction of angle unit: rad minus turn"); + + /* + 4 radians is 229.183118052 degrees ; 0.1 turn is 36 degrees. + */ + + compareValueCloseTo("transform", "rotate(calc(45grad - 15grad))", 0.0001, "rotate(30grad)", "substraction of angle unit: grad minus grad"); + + compareValueCloseTo("transform", "rotate(calc(100grad - 0.25turn))", 0.0001, "rotate(0deg)", "substraction of angle unit: grad minus turn"); + + + /* Multiplication of angle unit */ + + /* compareValueCloseTo(property_name, calcValue, epsilon, expectedValue, description) */ + + compareValueCloseTo("transform", "rotate(calc(45deg * 2))", 0.0001, "rotate(90deg)", "multiplication of angle unit: deg multiplied by int"); + + compareValueCloseTo("transform", "rotate(calc(2 * 45rad))", 0.0001, "rotate(90rad)", "multiplication of angle unit: int multiplied by rad"); + + compareValueCloseTo("transform", "rotate(calc(45grad * 2))", 0.0001, "rotate(90grad)", "multiplication of angle unit: grad multiplied by int"); + + compareValueCloseTo("transform", "rotate(calc(2 * 45turn))", 0.0001, "rotate(90turn)", "multiplication of angle unit: int multiplied by turn"); + + + /* Division of angle unit */ + + /* compareValueCloseTo(property_name, calcValue, epsilon, expectedValue, description) */ + + compareValueCloseTo("transform", "rotate(calc(90deg / 2))", 0.0001, "rotate(45deg)", "division of angle unit: deg divided by int"); + + compareValueCloseTo("transform", "rotate(calc(90rad / 2))", 0.0001, "rotate(45rad)", "division of angle unit: rad divided by int"); + + compareValueCloseTo("transform", "rotate(calc(90grad / 2))", 0.0001, "rotate(45grad)", "division of angle unit: grad divided by int"); + + compareValueCloseTo("transform", "rotate(calc(90turn / 2))", 0.0001, "rotate(45turn)", "division of angle unit: turn divided by int"); + + /* compareValueCloseTo(property_name, calcValue, epsilon, expectedValue, description) */ + + /* + + deg + Degrees. There are 360 degrees in a full circle. + + grad + Gradians, also known as "gons" or "grades". There are 400 gradians in a full circle. + + rad + Radians. There are 2π radians in a full circle. + + 1rad == 57.295779513° + https://www.rapidtables.com/convert/number/radians-to-degrees.html + + π == Math.PI == 3.141592653589793 + + turn + Turns. There is 1 turn in a full circle. + + */ + + + + /* Testing conversion of angle unit */ + + /* compareValueCloseTo(property_name, calcValue, epsilon, expectedValue, description) */ + + compareValueCloseTo("transform", "rotate(calc(50grad)", 0.0001, "rotate(45deg)", "conversion of angle unit: grad into deg"); + + } + + startTesting(); + + </script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-values/calc-time-values.html b/third_party/blink/web_tests/external/wpt/css/css-values/calc-time-values.html new file mode 100644 index 0000000..60bcdcb --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-values/calc-time-values.html
@@ -0,0 +1,104 @@ +<!DOCTYPE html> + + <meta charset="UTF-8"> + + <title>CSS Values and Units Test: calc() function with time values</title> + + <!-- + + Original test is: + + https://chromium.googlesource.com/chromium/src/+/c825d655f6aaf73484f9d56e9012793f5b9668cc/third_party/WebKit/LayoutTests/css3/calc/calc-with-time-angle-and-frequency-values.html + + Issue 917718: [css-values] calc-with-time-angle-and-frequency-values + test is highly unreliable, transition-delay testing causes side effects + https://bugs.chromium.org/p/chromium/issues/detail?id=917718 + + --> + + <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> + <link rel="help" href="https://www.w3.org/TR/css-values-3/#calc-computed-value"> + <link rel="help" href="https://www.w3.org/TR/css-values-3/#time"> + + <meta content="This test checks that additions, substractions, multiplications and divisions in calc() function when applied to time units." name="assert"> + + <script src="/resources/testharness.js"></script> + + <script src="/resources/testharnessreport.js"></script> + + <div id="log"></div> + + <div id="target"></div> + + <script> + function startTesting() + { + + var targetElement = document.getElementById("target"); + + function compareValue(property_name, calcValue, expectedValue, description) + { + + test(function() + { + + targetElement.style.setProperty(property_name, "inherit"); + + /* + Since we are running many consecutive tests on the same + element, then it is necessary to 'reset' its property + to an initial value before actually re-testing it. + */ + + targetElement.style.setProperty(property_name, calcValue); + + var computedCalcValue = getComputedStyle(targetElement)[property_name]; + + targetElement.style.setProperty(property_name, expectedValue); + + var computedExpectedValue = getComputedStyle(targetElement)[property_name]; + + assert_equals(computedCalcValue, computedExpectedValue); + + }, description); + + } + + + /* Testing time units */ + + /* compareValue(property_name, calcValue, expectedValue, description) */ + + compareValue("transition-delay", "calc(4s + 1s)", "5s", "addition of 2 time units: s plus s"); + + compareValue("transition-delay", "calc(4s + 1ms)", "4.001s", "addition of 2 time units: s plus ms"); + + compareValue("transition-delay", "calc(4ms + 1ms)", "0.005s", "addition of 2 time units: ms plus ms"); + + compareValue("transition-delay", "calc(4s - 1s)", "3s", "substraction of time unit: s minus s"); + + compareValue("transition-delay", "calc(4s - 1ms)", "3.999s", "substraction of time unit: s minus ms"); + + compareValue("transition-delay", "calc(4 * 1s)", "4s", "multiplication of integer with a time unit: int multiplied by s"); + + compareValue("transition-delay", "calc(4 * 1ms)", "0.004s", "multiplication of integer with a time unit: int multiplied by ms"); + + compareValue("transition-delay", "calc(4s / 2)", "2s", "division of time unit with integer: s divided by int"); + + compareValue("transition-delay", "calc(4ms / 2)", "0.002s", "division of time unit with integer: ms divided by int"); + + /* compareValue(property_name, calcValue, expectedValue, description) */ + + + + /* Testing conversion of time unit */ + + /* compareValue(property_name, calcValue, expectedValue, description) */ + + compareValue("transition-delay", "calc(4000ms)", "4s", "conversion of time unit: ms into s"); + + } + + startTesting(); + + </script>
diff --git a/third_party/blink/web_tests/external/wpt/domparsing/XMLSerializer-serializeToString-expected.txt b/third_party/blink/web_tests/external/wpt/domparsing/XMLSerializer-serializeToString-expected.txt index 965e6c1..e727b94 100644 --- a/third_party/blink/web_tests/external/wpt/domparsing/XMLSerializer-serializeToString-expected.txt +++ b/third_party/blink/web_tests/external/wpt/domparsing/XMLSerializer-serializeToString-expected.txt
@@ -2,6 +2,11 @@ PASS check XMLSerializer.serializeToString method could parsing xmldoc to string PASS Check if the default namespace is correctly reset. PASS Check if there is no redundant empty namespace declaration. +PASS Check if an attribute with namespace and no prefix is serialized with the nearest-declared prefix +FAIL Check if an attribute with namespace and no prefix is serialized with the nearest-declared prefix even if the prefix is assigned to another namespace. assert_equals: expected "<el1 xmlns:p=\"u1\" xmlns:q=\"u1\"><el2 xmlns:q=\"u2\" q:name=\"v\"/></el1>" but got "<el1 xmlns:p=\"u1\" xmlns:q=\"u1\"><el2 xmlns:q=\"u2\" p:name=\"v\"/></el1>" +PASS Check if the prefix of an attribute is replaced with another existing prefix mapped to the same namespace URI. +FAIL Check if the prefix of an attribute is NOT preserved in a case where neither its prefix nor its namespace URI is not already used. assert_equals: expected "<r xmlns:xx=\"uri\" xmlns:ns1=\"uri2\" ns1:name=\"value\"/>" but got "<r xmlns:xx=\"uri\" xmlns:p=\"uri2\" p:name=\"value\"/>" +PASS Check if the prefix of an attribute is replaced with a generated one in a case where the prefix is already mapped to a different namespace URI. PASS check XMLSerializer.serializeToString escapes attribute values for roundtripping PASS Check if attribute serialization takes into account of following xmlns:* attributes PASS Check if attribute serialization takes into account of the same prefix declared in an ancestor element
diff --git a/third_party/blink/web_tests/external/wpt/domparsing/XMLSerializer-serializeToString.html b/third_party/blink/web_tests/external/wpt/domparsing/XMLSerializer-serializeToString.html index ab37348..e2e72e39 100644 --- a/third_party/blink/web_tests/external/wpt/domparsing/XMLSerializer-serializeToString.html +++ b/third_party/blink/web_tests/external/wpt/domparsing/XMLSerializer-serializeToString.html
@@ -15,6 +15,15 @@ return parser.parseFromString(input, 'text/xml'); } +// Returns the root element. +function parse(xmlString) { + return (new DOMParser()).parseFromString(xmlString, 'text/xml').documentElement; +} + +function serialize(node) { + return (new XMLSerializer()).serializeToString(node); +} + test(function() { var serializer = new XMLSerializer(); var root = createXmlDoc().documentElement; @@ -41,6 +50,58 @@ }, 'Check if there is no redundant empty namespace declaration.'); test(function() { + let root = parse('<r xmlns:xx="uri"></r>'); + root.setAttributeNS('uri', 'name', 'v'); + assert_equals(serialize(root), '<r xmlns:xx="uri" xx:name="v"/>'); + + let root2 = parse('<r xmlns:xx="uri"><b/></r>'); + let child = root2.firstChild; + child.setAttributeNS('uri', 'name', 'v'); + assert_equals(serialize(root2), '<r xmlns:xx="uri"><b xx:name="v"/></r>'); + + let root3 = parse('<r xmlns:x0="uri" xmlns:x2="uri"><b xmlns:x1="uri"/></r>'); + let child3 = root3.firstChild; + child3.setAttributeNS('uri', 'name', 'v'); + assert_equals(serialize(root3), + '<r xmlns:x0="uri" xmlns:x2="uri"><b xmlns:x1="uri" x1:name="v"/></r>', + 'Should choose the nearest prefix'); +}, 'Check if an attribute with namespace and no prefix is serialized with the nearest-declared prefix'); + +test(function() { + let root = parse('<el1 xmlns:p="u1" xmlns:q="u1"><el2 xmlns:q="u2"/></el1>'); + root.firstChild.setAttributeNS('u1', 'name', 'v'); + assert_equals(serialize(root), + '<el1 xmlns:p="u1" xmlns:q="u1"><el2 xmlns:q="u2" q:name="v"/></el1>'); + // Maybe this is a specification error. +}, 'Check if an attribute with namespace and no prefix is serialized with the nearest-declared prefix even if the prefix is assigned to another namespace.'); + +test(function() { + let root = parse('<r xmlns:xx="uri"></r>'); + root.setAttributeNS('uri', 'p:name', 'v'); + assert_equals(serialize(root), '<r xmlns:xx="uri" xx:name="v"/>'); + + let root2 = parse('<r xmlns:xx="uri"><b/></r>'); + let child = root2.firstChild; + child.setAttributeNS('uri', 'p:name', 'value'); + assert_equals(serialize(root2), + '<r xmlns:xx="uri"><b xx:name="value"/></r>'); +}, 'Check if the prefix of an attribute is replaced with another existing prefix mapped to the same namespace URI.'); + +test(function() { + let root = parse('<r xmlns:xx="uri"></r>'); + root.setAttributeNS('uri2', 'p:name', 'value'); + assert_equals(serialize(root), + '<r xmlns:xx="uri" xmlns:ns1="uri2" ns1:name="value"/>'); +}, 'Check if the prefix of an attribute is NOT preserved in a case where neither its prefix nor its namespace URI is not already used.'); + +test(function() { + let root = parse('<r xmlns:xx="uri"></r>'); + root.setAttributeNS('uri2', 'xx:name', 'value'); + assert_equals(serialize(root), + '<r xmlns:xx="uri" xmlns:ns1="uri2" ns1:name="value"/>'); +}, 'Check if the prefix of an attribute is replaced with a generated one in a case where the prefix is already mapped to a different namespace URI.'); + +test(function() { var serializer = new XMLSerializer(); var parser = new DOMParser(); var root = parser.parseFromString('<root />', 'text/xml').documentElement;
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/@std/__dir__.headers b/third_party/blink/web_tests/external/wpt/import-maps/@std/__dir__.headers new file mode 100644 index 0000000..e7ec0d6 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/@std/__dir__.headers
@@ -0,0 +1 @@ +Content-Type: text/javascript
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/@std/blank b/third_party/blink/web_tests/external/wpt/import-maps/@std/blank new file mode 100644 index 0000000..38e1891 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/@std/blank
@@ -0,0 +1 @@ +log.push("relative:@std/blank");
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/@std/none b/third_party/blink/web_tests/external/wpt/import-maps/@std/none new file mode 100644 index 0000000..69e165c --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/@std/none
@@ -0,0 +1 @@ +log.push("relative:@std/none");
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/README.md b/third_party/blink/web_tests/external/wpt/import-maps/README.md new file mode 100644 index 0000000..3803e35 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/README.md
@@ -0,0 +1,9 @@ +Tests for [Import Maps](https://github.com/WICG/import-maps). + +Because the spec itself is still under development and there are ongoing spec +discussions, the tests are all tentative. + +Also, some tests are based on Chromium's behavior which reflects an older +version of import maps spec ("package name maps" around May 2018), and have +dependency to Chromium's implementation (internals.resolveModuleSpecifier). +These dependencies should be removed, once the spec matures.
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/acquire-import-maps-flag/dynamic-import/success.tentative.html b/third_party/blink/web_tests/external/wpt/import-maps/acquire-import-maps-flag/dynamic-import/success.tentative.html new file mode 100644 index 0000000..512cd7f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/acquire-import-maps-flag/dynamic-import/success.tentative.html
@@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +// https://github.com/WICG/import-maps/blob/master/spec.md#when-import-maps-can-be-encountered +const t = async_test( + 'After dynamic imports, import maps should fire error events'); +const log = []; +// To ensure we are testing that the flag is cleared at the beginning of module +// script loading unconditionally, not at the end of loading or not at the +// first attempt to resolve a module specifier, trickle(d1) is used to ensure +// the following import map is added after module loading is triggered but +// before the first module script is parsed. +promise_test(() => import('../../resources/empty.js?pipe=trickle(d1)'), + "A dynamic import succeeds"); +</script> +<script type="importmap" onload="t.assert_unreached('onload')" onerror="t.done()"> +{ + "imports": { + "../../resources/log.js?pipe=sub&name=A": "../../resources/log.js?pipe=sub&name=B" + } +} +</script> +<script> +promise_test(() => { + return import("../../resources/log.js?pipe=sub&name=A") + .then(() => assert_array_equals(log, ["log:A"])) + }, + 'After a dynamic import(), import maps are not effective'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/acquire-import-maps-flag/script-tag/success.tentative.html b/third_party/blink/web_tests/external/wpt/import-maps/acquire-import-maps-flag/script-tag/success.tentative.html new file mode 100644 index 0000000..7f319b04 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/acquire-import-maps-flag/script-tag/success.tentative.html
@@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +// https://github.com/WICG/import-maps/blob/master/spec.md#when-import-maps-can-be-encountered +const t = async_test( + 'After <script type="module"> import maps should fire error events'); +const log = []; +</script> +<script type="module" src="../../resources/empty.js?pipe=trickle(d1)"></script> +<script type="importmap" onerror="t.done()"> +{ + "imports": { + "../../resources/log.js?pipe=sub&name=A": "../../resources/log.js?pipe=sub&name=B" + } +} +</script> +<script> +promise_test(() => { + return import("../../resources/log.js?pipe=sub&name=A") + .then(() => assert_array_equals(log, ["log:A"])) + }, + 'After <script type="module"> import maps are not effective'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/acquire-import-maps-flag/worker-request/success.tentative.html b/third_party/blink/web_tests/external/wpt/import-maps/acquire-import-maps-flag/worker-request/success.tentative.html new file mode 100644 index 0000000..ceef410 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/acquire-import-maps-flag/worker-request/success.tentative.html
@@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +// https://github.com/WICG/import-maps/blob/master/spec.md#when-import-maps-can-be-encountered +const t = async_test( + 'After module worker creation, import maps should fire error events'); +const log = []; +new Worker('../../resources/empty.js?pipe=trickle(d1)', {type: "module"}); +</script> +<script type="importmap" onerror="t.done()"> +{ + "imports": { + "../../resources/log.js?pipe=sub&name=A": "../../resources/log.js?pipe=sub&name=B" + } +} +</script> +<script> +promise_test(() => { + return import("../../resources/log.js?pipe=sub&name=A") + .then(() => assert_array_equals(log, ["A"])) + }, + 'After module worker creation import maps are not effective'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/bare.sub.tentative.html b/third_party/blink/web_tests/external/wpt/import-maps/bare.sub.tentative.html new file mode 100644 index 0000000..5bfb6b52 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/bare.sub.tentative.html
@@ -0,0 +1,70 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/test-helper.js"></script> + +<script> +// "bare/..." (i.e. without leading "./") are bare specifiers +// (not relative paths). +// +// Discussions about notations for builtin modules are ongoing, e.g. +// https://github.com/tc39/proposal-javascript-standard-library/issues/12 +// Currently the tests expects two notations are accepted. +// TODO: Once the discussions converge, update the tests. +const importMap = ` +{ + "imports": { + "bare/bare": "./resources/log.js?pipe=sub&name=bare", + "bare/cross-origin-bare": "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-bare", + "bare/to-data": "data:text/javascript,log.push('dataURL')", + + "bare/std-blank": "std:blank", + "bare/blank": "@std/blank", + "bare/std-none": "std:none", + "bare/none": "@std/none", + + "bare/to-bare": "bare/bare" + } +} +`; + +const tests = { + // Arrays of expected results for: + // - <script src type="module">, + // - <script src> (classic script), + // - static import, and + // - dynamic import. + + // Currently, Chromium's implementation resolves import maps as a part of + // specifier resolution, and thus failure in import map resolution causes + // a parse error, not fetch error. Therefore, we use Result.PARSE_ERROR + // below. https://crbug.com/928435 + + // Bare to HTTP(S). + "bare/bare": + [Result.URL, Result.URL, "log:bare", "log:bare"], + "bare/cross-origin-bare": + [Result.URL, Result.URL, "log:cross-origin-bare", "log:cross-origin-bare"], + + // Bare to data: + "bare/to-data": + [Result.URL, Result.URL, "dataURL", "dataURL"], + + // Bare to built-in. + "bare/std-blank": + [Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN], + "bare/blank": + [Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN], + "bare/std-none": + [Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR], + "bare/none": + [Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR], + + // Bare to bare mapping is disabled. + "bare/to-bare": + [Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR], +}; + +doTests(importMap, null, tests); +</script> +<body>
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/bare/__dir__.headers b/third_party/blink/web_tests/external/wpt/import-maps/bare/__dir__.headers new file mode 100644 index 0000000..e7ec0d6 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/bare/__dir__.headers
@@ -0,0 +1 @@ +Content-Type: text/javascript
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/bare/bare b/third_party/blink/web_tests/external/wpt/import-maps/bare/bare new file mode 100644 index 0000000..1011e866 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/bare/bare
@@ -0,0 +1 @@ +log.push("relative:bare/bare");
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/bare/blank b/third_party/blink/web_tests/external/wpt/import-maps/bare/blank new file mode 100644 index 0000000..841d433a --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/bare/blank
@@ -0,0 +1 @@ +log.push("relative:bare/blank");
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/bare/cross-origin-bare b/third_party/blink/web_tests/external/wpt/import-maps/bare/cross-origin-bare new file mode 100644 index 0000000..64851cc --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/bare/cross-origin-bare
@@ -0,0 +1 @@ +log.push("relative:bare/cross-origin-bare");
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/bare/none b/third_party/blink/web_tests/external/wpt/import-maps/bare/none new file mode 100644 index 0000000..2aec0d7 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/bare/none
@@ -0,0 +1 @@ +log.push("relative:bare/none");
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/bare/std-blank b/third_party/blink/web_tests/external/wpt/import-maps/bare/std-blank new file mode 100644 index 0000000..5ded98f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/bare/std-blank
@@ -0,0 +1 @@ +log.push("relative:bare/std-blank");
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/bare/std-none b/third_party/blink/web_tests/external/wpt/import-maps/bare/std-none new file mode 100644 index 0000000..1437d9f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/bare/std-none
@@ -0,0 +1 @@ +log.push("relative:bare/std-none");
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/bare/to-bare b/third_party/blink/web_tests/external/wpt/import-maps/bare/to-bare new file mode 100644 index 0000000..bdb3791b --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/bare/to-bare
@@ -0,0 +1 @@ +log.push("relative:bare/to-bare");
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/bare/to-data b/third_party/blink/web_tests/external/wpt/import-maps/bare/to-data new file mode 100644 index 0000000..6f25c5af --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/bare/to-data
@@ -0,0 +1 @@ +log.push("relative:bare/to-data");
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/builtin-import-scheme.tentative.html b/third_party/blink/web_tests/external/wpt/import-maps/builtin-import-scheme.tentative.html new file mode 100644 index 0000000..6a27ef5 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/builtin-import-scheme.tentative.html
@@ -0,0 +1,27 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/test-helper.js"></script> + +<script> +const tests = { + // Arrays of expected results for: + // - <script src type="module">, + // - <script src> (classic script), + // - static import, and + // - dynamic import. + + // Currently direct use of import: URLs are disabled. + "import:std:blank": + [Result.FETCH_ERROR, Result.FETCH_ERROR, Result.FETCH_ERROR, Result.FETCH_ERROR], + "import:@std/blank": + [Result.FETCH_ERROR, Result.FETCH_ERROR, Result.FETCH_ERROR, Result.FETCH_ERROR], + "import:std:none": + [Result.FETCH_ERROR, Result.FETCH_ERROR, Result.FETCH_ERROR, Result.FETCH_ERROR], + "import:@std/none": + [Result.FETCH_ERROR, Result.FETCH_ERROR, Result.FETCH_ERROR, Result.FETCH_ERROR], +}; + +doTests(null, null, tests); +</script> +<body>
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/builtin.tentative-expected.txt b/third_party/blink/web_tests/external/wpt/import-maps/builtin.tentative-expected.txt new file mode 100644 index 0000000..76932ca --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/builtin.tentative-expected.txt
@@ -0,0 +1,23 @@ +This is a testharness.js-based test. +PASS std:blank: <script src type=module> +PASS std:blank: <script src type=text/javascript> +PASS std:blank: static import +PASS std:blank: dynamic import (from module) +PASS std:blank: dynamic import (from text/javascript) +PASS @std/blank: <script src type=module> +PASS @std/blank: <script src type=text/javascript> +FAIL @std/blank: static import assert_unreached: window's error event shouldn't be fired Reached unreachable code +FAIL @std/blank: dynamic import (from module) assert_unreached: dynamic import promise shouldn't be rejected Reached unreachable code +FAIL @std/blank: dynamic import (from text/javascript) assert_unreached: dynamic import promise shouldn't be rejected Reached unreachable code +PASS std:none: <script src type=module> +PASS std:none: <script src type=text/javascript> +FAIL std:none: static import assert_unreached: window's error event shouldn't be fired Reached unreachable code +PASS std:none: dynamic import (from module) +PASS std:none: dynamic import (from text/javascript) +PASS @std/none: <script src type=module> +PASS @std/none: <script src type=text/javascript> +FAIL @std/none: static import assert_unreached: window's error event shouldn't be fired Reached unreachable code +PASS @std/none: dynamic import (from module) +PASS @std/none: dynamic import (from text/javascript) +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/builtin.tentative.html b/third_party/blink/web_tests/external/wpt/import-maps/builtin.tentative.html new file mode 100644 index 0000000..e85289e --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/builtin.tentative.html
@@ -0,0 +1,30 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/test-helper.js"></script> + +<script> +const tests = { + // Arrays of expected results for: + // - <script src type="module">, + // - <script src> (classic script), + // - static import, and + // - dynamic import. + + // Discussions about notations are ongoing, e.g. + // https://github.com/tc39/proposal-javascript-standard-library/issues/12 + // Currently the tests expects two notations are accepted. + // TODO: Once the discussions converge, update this and related tests. + "std:blank": + [Result.BUILTIN, Result.FETCH_ERROR, Result.BUILTIN, Result.BUILTIN], + "@std/blank": + [Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN], + "std:none": + [Result.FETCH_ERROR, Result.FETCH_ERROR, Result.FETCH_ERROR, Result.FETCH_ERROR], + "@std/none": + [Result.URL, Result.URL, Result.FETCH_ERROR, Result.FETCH_ERROR], +}; + +doTests(null, null, tests); +</script> +<body>
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/data.sub.tentative.html b/third_party/blink/web_tests/external/wpt/import-maps/data.sub.tentative.html new file mode 100644 index 0000000..1c7172bf --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/data.sub.tentative.html
@@ -0,0 +1,72 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/test-helper.js"></script> + +<script> +// "bare/..." (i.e. without leading "./") are bare specifiers +// (not relative paths). +// +// Discussions about notations for builtin modules are ongoing, e.g. +// https://github.com/tc39/proposal-javascript-standard-library/issues/12 +// Currently the tests expects two notations are accepted. +// TODO: Once the discussions converge, update the tests. +const importMap = ` +{ + "imports": { + "bare": "./resources/log.js?pipe=sub&name=bare", + + "data:text/javascript,log.push('data:foo')": "./resources/log.js?pipe=sub&name=foo", + "data:text/javascript,log.push('data:cross-origin-foo')": "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-foo", + "data:text/javascript,log.push('data:to-data')": "data:text/javascript,log.push('dataURL')", + + "data:text/javascript,log.push('data:std-blank')": "std:blank", + "data:text/javascript,log.push('data:blank')": "@std/blank", + "data:text/javascript,log.push('data:std-none')": "std:none", + "data:text/javascript,log.push('data:none')": "@std/none", + + "data:text/javascript,log.push('data:to-bare')": "bare" + } +} +`; + +const tests = { + // Arrays of expected results for: + // - <script src type="module">, + // - <script src> (classic script), + // - static import, and + // - dynamic import. + + // Currently, Chromium's implementation resolves import maps as a part of + // specifier resolution, and thus failure in import map resolution causes + // a parse error, not fetch error. Therefore, we use Result.PARSE_ERROR + // below. https://crbug.com/928435 + + // data: to HTTP(S). + "data:text/javascript,log.push('data:foo')": + [Result.URL, Result.URL, "log:foo", "log:foo"], + "data:text/javascript,log.push('data:cross-origin-foo')": + [Result.URL, Result.URL, "log:cross-origin-foo", "log:cross-origin-foo"], + + // data: to data: + "data:text/javascript,log.push('data:to-data')": + [Result.URL, Result.URL, "dataURL", "dataURL"], + + // data: to built-in. + "data:text/javascript,log.push('data:std-blank')": + [Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN], + "data:text/javascript,log.push('data:blank')": + [Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN], + "data:text/javascript,log.push('data:std-none')": + [Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR], + "data:text/javascript,log.push('data:none')": + [Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR], + + // data: to bare mapping is disabled. + "data:text/javascript,log.push('data:to-bare')": + [Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR], +}; + +doTests(importMap, null, tests); +</script> +<body>
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/fallback-disallowed.sub.tentative.html b/third_party/blink/web_tests/external/wpt/import-maps/fallback-disallowed.sub.tentative.html new file mode 100644 index 0000000..3f89e8f1 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/fallback-disallowed.sub.tentative.html
@@ -0,0 +1,79 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/test-helper.js"></script> + +<script> +// Fallbacks from external URLs (such as HTTPS URLs) are +// blocked by ongoing spec discussions, for example +// https://github.com/WICG/import-maps/issues/76. +// https://crbug.com/928435 +// +// This test, as well as Chromium's implementation, rejects broader range of +// fallbacks (not only those from HTTPS), to avoid potential spec and +// interoperability issues. +// The only allowed fallback pattern is fallbacks from bare specifiers with +// two elements, which are listed in fallback.sub.tentative.html. +const importMap = ` +{ + "imports": { + "bare": "./resources/log.js?pipe=sub&name=bare", + + "./resources/log.js?pipe=sub&name=http-to-builtin": [ + "./resources/log.js?pipe=sub&name=http-to-builtin", + "@std/blank" + ], + + "./resources/log.js?pipe=sub&name=fallback-to-different-url-1": [ + "@std/blank", + "./resources/log.js?pipe=sub&name=something-different" + ], + "./resources/log.js?pipe=sub&name=fallback-to-different-url-2": [ + "@std/none", + "./resources/log.js?pipe=sub&name=something-different2" + ], + "./resources/log.js?pipe=sub&name=fallback-to-different-origin-1": [ + "@std/blank", + "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=fallback-to-different-origin-1" + ], + "./resources/log.js?pipe=sub&name=fallback-to-different-origin-2": [ + "@std/none", + "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=fallback-to-different-origin-2" + ], + + "./resources/log.js?pipe=sub&name=more-than-two-values-1": [ + "@std/none", + "@std/blank", + "./resources/log.js?pipe=sub&name=more-than-two-values-1" + ], + "./resources/log.js?pipe=sub&name=more-than-two-values-2": [ + "@std/none", + "./resources/log.js?pipe=sub&name=more-than-two-values-2", + "@std/blank" + ], + "./resources/log.js?pipe=sub&name=fallback-from-http": [ + "./resources/log.js?pipe=sub&name=non-built-in", + "./resources/log.js?pipe=sub&name=fallback-from-http" + ], + "./resources/log.js?pipe=sub&name=fallback-from-data-1": [ + "data:text/plain,", + "./resources/log.js?pipe=sub&name=fallback-from-http" + ], + "./resources/log.js?pipe=sub&name=fallback-from-data-2": [ + "data:text/javascript,log.push('dataURL')", + "./resources/log.js?pipe=sub&name=fallback-from-http" + ] + } +} +`; +const tests = {}; +for (const key in JSON.parse(importMap).imports) { + if (key === "bare") { + continue; + } + tests[key] = + [Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR]; +} +doTests(importMap, null, tests); +</script> +<body>
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/fallback.sub.tentative.html b/third_party/blink/web_tests/external/wpt/import-maps/fallback.sub.tentative.html new file mode 100644 index 0000000..4cf3e181 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/fallback.sub.tentative.html
@@ -0,0 +1,84 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/test-helper.js"></script> + +<script> +// This tests is for fallbacks with the pattern of +// `"https://some.external/url": ["@std/x", "https://some.external/url"]` +// which maps "https://some.external/url" to "@std/x" if "@std/x" is +// implemented, or leaves it unmodified otherwise. +// +// This is the primary use case where fallback should work. +// Some other patterns of fallbacks are intentionally blocked due to ongoing +// spec issues. See fallback-disallowed.sub.tentative.html. +const importMap = ` +{ + "imports": { + "./resources/log.js?pipe=sub&name=blank": [ + "@std/blank", + "./resources/log.js?pipe=sub&name=blank" + ], + "./resources/log.js?pipe=sub&name=none": [ + "@std/none", + "./resources/log.js?pipe=sub&name=none" + ], + "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-blank": [ + "@std/blank", + "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-blank" + ], + "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-none": [ + "@std/none", + "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-none" + ], + + "./resources/log.js?pipe=sub&name=std-blank": [ + "std:blank", + "./resources/log.js?pipe=sub&name=std-blank" + ], + "./resources/log.js?pipe=sub&name=std-none": [ + "std:none", + "./resources/log.js?pipe=sub&name=std-none" + ], + "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=std-cross-origin-blank": [ + "std:blank", + "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=std-cross-origin-blank" + ], + "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=std-cross-origin-none": [ + "std:none", + "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=std-cross-origin-none" + ] + + } +} +`; +const tests = { + // Arrays of expected results for: + // - <script src type="module">, + // - <script src> (classic script), + // - static import, and + // - dynamic import. + // Result.URL indicates that the specifier was not re-mapped by import maps, + // i.e. either considered as a relative path, or fallback occured. + "./resources/log.js?pipe=sub&name=blank": + [Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN], + "./resources/log.js?pipe=sub&name=none": + [Result.URL, Result.URL, Result.URL, Result.URL], + "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-blank": + [Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN], + "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-none": + [Result.URL, Result.URL, Result.URL, Result.URL], + + "./resources/log.js?pipe=sub&name=std-blank": + [Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN], + "./resources/log.js?pipe=sub&name=std-none": + [Result.URL, Result.URL, Result.URL, Result.URL], + "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=std-cross-origin-blank": + [Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN], + "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=std-cross-origin-none": + [Result.URL, Result.URL, Result.URL, Result.URL], +}; + +doTests(importMap, null, tests); +</script> +<body>
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/http.sub.tentative.html b/third_party/blink/web_tests/external/wpt/import-maps/http.sub.tentative.html new file mode 100644 index 0000000..bd24f353 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/http.sub.tentative.html
@@ -0,0 +1,72 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/test-helper.js"></script> + +<script> +// "bare/..." (i.e. without leading "./") are bare specifiers +// (not relative paths). +// +// Discussions about notations for builtin modules are ongoing, e.g. +// https://github.com/tc39/proposal-javascript-standard-library/issues/12 +// Currently the tests expects two notations are accepted. +// TODO: Once the discussions converge, update the tests. +const importMap = ` +{ + "imports": { + "bare": "./resources/log.js?pipe=sub&name=bare", + + "./resources/log.js?pipe=sub&name=foo": "./resources/log.js?pipe=sub&name=bar", + "./resources/log.js?pipe=sub&name=cross-origin-foo": "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-bar", + "./resources/log.js?pipe=sub&name=to-data": "data:text/javascript,log.push('dataURL')", + + "./resources/log.js?pipe=sub&name=std-blank": "std:blank", + "./resources/log.js?pipe=sub&name=blank": "@std/blank", + "./resources/log.js?pipe=sub&name=std-none": "std:none", + "./resources/log.js?pipe=sub&name=none": "@std/none", + + "./resources/log.js?pipe=sub&name=to-bare": "bare" + } +} +`; + +const tests = { + // Arrays of expected results for: + // - <script src type="module">, + // - <script src> (classic script), + // - static import, and + // - dynamic import. + + // Currently, Chromium's implementation resolves import maps as a part of + // specifier resolution, and thus failure in import map resolution causes + // a parse error, not fetch error. Therefore, we use Result.PARSE_ERROR + // below. https://crbug.com/928435 + + // HTTP(S) to HTTP(S). + "{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=foo": + [Result.URL, Result.URL, "log:bar", "log:bar"], + "{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-foo": + [Result.URL, Result.URL, "log:cross-origin-bar", "log:cross-origin-bar"], + + // HTTP(S) to data: + "{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=to-data": + [Result.URL, Result.URL, "dataURL", "dataURL"], + + // HTTP(S) to built-in. + "{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=std-blank": + [Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN], + "{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=blank": + [Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN], + "{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=std-none": + [Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR], + "{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=none": + [Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR], + + // HTTP(S) to bare mapping is disabled. + "{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=to-bare": + [Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR], +}; + +doTests(importMap, null, tests); +</script> +<body>
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/module-map-key.tentative.html b/third_party/blink/web_tests/external/wpt/import-maps/module-map-key.tentative.html new file mode 100644 index 0000000..13bd122 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/module-map-key.tentative.html
@@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script type="importmap"> +{ + "imports": { + "./resources/log.js?pipe=sub&name=A": "./resources/log.js?pipe=sub&name=B" + } +} +</script> +<script> +const log = []; + +// This test reflects the Chromium's current implementation. +// If the import map resolution is moved into the fetch spec, the module map's +// key will become the URL/specifier BEFORE import map resolution. +// https://crbug.com/928435 +promise_test(() => { + return import("./resources/log.js?pipe=sub&name=A") + .then(() => import("./resources/log.js?pipe=sub&name=B")) + .then(() => assert_array_equals(log, ["log:B"])) + }, + "Module map's key is the URL after import map resolution"); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/resolving.tentative.html b/third_party/blink/web_tests/external/wpt/import-maps/resolving.tentative.html new file mode 100644 index 0000000..f2b09a7a --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/resolving.tentative.html
@@ -0,0 +1,81 @@ +<!DOCTYPE html> +<html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +setup({allow_uncaught_exception : true}); + +// Hacky glue code to run Jest-based tests as WPT tests. +// Only supports resolving.js. +function require(name) { + return { + 'URL': URL, + 'parseFromString': parseFromString, + 'resolve': resolve + }; +} + +function expect(v) { + return { + toMatchURL: expected => assert_equals(v, expected), + toThrow: expected => assert_throws(expected(), v) + }; +} + +let current_message = ''; +function describe(message, f) { + const old = current_message; + if (current_message !== '') { + current_message += ' / '; + } + current_message += message; + f(); + current_message = old; +} +function it(message, f) { + const old = current_message; + if (current_message !== '') { + current_message += ' / '; + } + current_message += message; + test(t => t.step_func(f)(), current_message); + current_message = old; +} + +// Creates a new Document (via <iframe>) and add an inline import map. +// Currently document.write() is used to make everything synchronous, which +// is just needed for running the existing Jest-based tests easily. +function parseFromString(mapString, mapBaseURL) { + const iframe = document.createElement('iframe'); + document.body.appendChild(iframe); + iframe.contentDocument.write(` + <base href="${mapBaseURL}"> + <script> + let isError = false; + function onError() { + isError = true; + } + </sc` + `ript> + <script type="importmap" onerror="onError()"> + ${mapString} + </sc` + `ript> + `); + iframe.contentDocument.close(); + return iframe; +} + +// URL resolution is tested using Chromium's `internals`. +// TODO(hiroshige): Remove the Chromium-specific dependency. +function resolve(specifier, map, baseURL) { + return internals.resolveModuleSpecifier(specifier, + baseURL, + map.contentDocument); +} + +</script> + +<!-- +resolving.js is +https://github.com/WICG/import-maps/blob/master/reference-implementation/__tests__/resolving.js +--> +<script type="module" src="resources/resolving.js"></script>
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/resources/empty.js b/third_party/blink/web_tests/external/wpt/import-maps/resources/empty.js new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/resources/empty.js
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/resources/log.js b/third_party/blink/web_tests/external/wpt/import-maps/resources/log.js new file mode 100644 index 0000000..a024a29bf --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/resources/log.js
@@ -0,0 +1 @@ +log.push("log:{{GET[name]}}");
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/resources/log.js.headers b/third_party/blink/web_tests/external/wpt/import-maps/resources/log.js.headers new file mode 100644 index 0000000..cb762eff --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/resources/log.js.headers
@@ -0,0 +1 @@ +Access-Control-Allow-Origin: *
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/resources/resolving.js b/third_party/blink/web_tests/external/wpt/import-maps/resources/resolving.js new file mode 100644 index 0000000..ec2645e --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/resources/resolving.js
@@ -0,0 +1,206 @@ +'use strict'; +const { URL } = require('url'); +const { parseFromString } = require('../lib/parser.js'); +const { resolve } = require('../lib/resolver.js'); + +const mapBaseURL = new URL('https://example.com/app/index.html'); +const scriptURL = new URL('https://example.com/js/app.mjs'); + +function makeResolveUnderTest(mapString) { + const map = parseFromString(mapString, mapBaseURL); + return specifier => resolve(specifier, map, scriptURL); +} + +describe('Unmapped', () => { + const resolveUnderTest = makeResolveUnderTest(`{}`); + + it('should resolve ./ specifiers as URLs', () => { + expect(resolveUnderTest('./foo')).toMatchURL('https://example.com/js/foo'); + expect(resolveUnderTest('./foo/bar')).toMatchURL('https://example.com/js/foo/bar'); + expect(resolveUnderTest('./foo/../bar')).toMatchURL('https://example.com/js/bar'); + expect(resolveUnderTest('./foo/../../bar')).toMatchURL('https://example.com/bar'); + }); + + it('should resolve ../ specifiers as URLs', () => { + expect(resolveUnderTest('../foo')).toMatchURL('https://example.com/foo'); + expect(resolveUnderTest('../foo/bar')).toMatchURL('https://example.com/foo/bar'); + expect(resolveUnderTest('../../../foo/bar')).toMatchURL('https://example.com/foo/bar'); + }); + + it('should resolve / specifiers as URLs', () => { + expect(resolveUnderTest('/foo')).toMatchURL('https://example.com/foo'); + expect(resolveUnderTest('/foo/bar')).toMatchURL('https://example.com/foo/bar'); + expect(resolveUnderTest('/../../foo/bar')).toMatchURL('https://example.com/foo/bar'); + expect(resolveUnderTest('/../foo/../bar')).toMatchURL('https://example.com/bar'); + }); + + it('should parse absolute fetch-scheme URLs', () => { + expect(resolveUnderTest('about:good')).toMatchURL('about:good'); + expect(resolveUnderTest('https://example.net')).toMatchURL('https://example.net/'); + expect(resolveUnderTest('https://ex%41mple.com/')).toMatchURL('https://example.com/'); + expect(resolveUnderTest('https:example.org')).toMatchURL('https://example.org/'); + expect(resolveUnderTest('https://///example.com///')).toMatchURL('https://example.com///'); + }); + + it('should fail for absolute non-fetch-scheme URLs', () => { + expect(() => resolveUnderTest('mailto:bad')).toThrow(TypeError); + expect(() => resolveUnderTest('import:bad')).toThrow(TypeError); + expect(() => resolveUnderTest('javascript:bad')).toThrow(TypeError); + expect(() => resolveUnderTest('wss:bad')).toThrow(TypeError); + }); + + it('should fail for strings not parseable as absolute URLs and not starting with ./ ../ or /', () => { + expect(() => resolveUnderTest('foo')).toThrow(TypeError); + expect(() => resolveUnderTest('\\foo')).toThrow(TypeError); + expect(() => resolveUnderTest(':foo')).toThrow(TypeError); + expect(() => resolveUnderTest('@foo')).toThrow(TypeError); + expect(() => resolveUnderTest('%2E/foo')).toThrow(TypeError); + expect(() => resolveUnderTest('%2E%2E/foo')).toThrow(TypeError); + expect(() => resolveUnderTest('.%2Ffoo')).toThrow(TypeError); + expect(() => resolveUnderTest('https://ex ample.org/')).toThrow(TypeError); + expect(() => resolveUnderTest('https://example.com:demo')).toThrow(TypeError); + expect(() => resolveUnderTest('http://[www.example.com]/')).toThrow(TypeError); + }); +}); + +describe('Mapped using the "imports" key only (no scopes)', () => { + it('should fail when the mapping is to an empty array', () => { + const resolveUnderTest = makeResolveUnderTest(`{ + "imports": { + "moment": null, + "lodash": [] + } + }`); + + expect(() => resolveUnderTest('moment')).toThrow(TypeError); + expect(() => resolveUnderTest('lodash')).toThrow(TypeError); + }); + + describe('Package-like scenarios', () => { + const resolveUnderTest = makeResolveUnderTest(`{ + "imports": { + "moment": "/node_modules/moment/src/moment.js", + "moment/": "/node_modules/moment/src/", + "lodash-dot": "./node_modules/lodash-es/lodash.js", + "lodash-dot/": "./node_modules/lodash-es/", + "lodash-dotdot": "../node_modules/lodash-es/lodash.js", + "lodash-dotdot/": "../node_modules/lodash-es/" + } + }`); + + it('should work for package main modules', () => { + expect(resolveUnderTest('moment')).toMatchURL('https://example.com/node_modules/moment/src/moment.js'); + expect(resolveUnderTest('lodash-dot')).toMatchURL('https://example.com/app/node_modules/lodash-es/lodash.js'); + expect(resolveUnderTest('lodash-dotdot')).toMatchURL('https://example.com/node_modules/lodash-es/lodash.js'); + }); + + it('should work for package submodules', () => { + expect(resolveUnderTest('moment/foo')).toMatchURL('https://example.com/node_modules/moment/src/foo'); + expect(resolveUnderTest('lodash-dot/foo')).toMatchURL('https://example.com/app/node_modules/lodash-es/foo'); + expect(resolveUnderTest('lodash-dotdot/foo')).toMatchURL('https://example.com/node_modules/lodash-es/foo'); + }); + + it('should work for package names that end in a slash by just passing through', () => { + // TODO: is this the right behavior, or should we throw? + expect(resolveUnderTest('moment/')).toMatchURL('https://example.com/node_modules/moment/src/'); + }); + + it('should still fail for package modules that are not declared', () => { + expect(() => resolveUnderTest('underscore/')).toThrow(TypeError); + expect(() => resolveUnderTest('underscore/foo')).toThrow(TypeError); + }); + }); + + describe('Tricky specifiers', () => { + const resolveUnderTest = makeResolveUnderTest(`{ + "imports": { + "package/withslash": "/node_modules/package-with-slash/index.mjs", + "not-a-package": "/lib/not-a-package.mjs", + ".": "/lib/dot.mjs", + "..": "/lib/dotdot.mjs", + "..\\\\": "/lib/dotdotbackslash.mjs", + "%2E": "/lib/percent2e.mjs", + "%2F": "/lib/percent2f.mjs" + } + }`); + + it('should work for explicitly-mapped specifiers that happen to have a slash', () => { + expect(resolveUnderTest('package/withslash')).toMatchURL('https://example.com/node_modules/package-with-slash/index.mjs'); + }); + + it('should work when the specifier has punctuation', () => { + expect(resolveUnderTest('.')).toMatchURL('https://example.com/lib/dot.mjs'); + expect(resolveUnderTest('..')).toMatchURL('https://example.com/lib/dotdot.mjs'); + expect(resolveUnderTest('..\\')).toMatchURL('https://example.com/lib/dotdotbackslash.mjs'); + expect(resolveUnderTest('%2E')).toMatchURL('https://example.com/lib/percent2e.mjs'); + expect(resolveUnderTest('%2F')).toMatchURL('https://example.com/lib/percent2f.mjs'); + }); + + it('should fail for attempting to get a submodule of something not declared with a trailing slash', () => { + expect(() => resolveUnderTest('not-a-package/foo')).toThrow(TypeError); + }); + }); + + describe('URL-like specifiers', () => { + const resolveUnderTest = makeResolveUnderTest(`{ + "imports": { + "/node_modules/als-polyfill/index.mjs": "@std/kv-storage", + + "/lib/foo.mjs": "./more/bar.mjs", + "./dotrelative/foo.mjs": "/lib/dot.mjs", + "../dotdotrelative/foo.mjs": "/lib/dotdot.mjs", + + "/lib/no.mjs": null, + "./dotrelative/no.mjs": [], + + "/": "/lib/slash-only.mjs", + "./": "/lib/dotslash-only.mjs", + + "/test": "/lib/test1.mjs", + "../test": "/lib/test2.mjs" + } + }`); + + it('should remap to built-in modules', () => { + expect(resolveUnderTest('/node_modules/als-polyfill/index.mjs')).toMatchURL('import:@std/kv-storage'); + expect(resolveUnderTest('https://example.com/node_modules/als-polyfill/index.mjs')).toMatchURL('import:@std/kv-storage'); + expect(resolveUnderTest('https://///example.com/node_modules/als-polyfill/index.mjs')).toMatchURL('import:@std/kv-storage'); + }); + + it('should remap to other URLs', () => { + expect(resolveUnderTest('https://example.com/lib/foo.mjs')).toMatchURL('https://example.com/app/more/bar.mjs'); + expect(resolveUnderTest('https://///example.com/lib/foo.mjs')).toMatchURL('https://example.com/app/more/bar.mjs'); + expect(resolveUnderTest('/lib/foo.mjs')).toMatchURL('https://example.com/app/more/bar.mjs'); + + expect(resolveUnderTest('https://example.com/app/dotrelative/foo.mjs')).toMatchURL('https://example.com/lib/dot.mjs'); + expect(resolveUnderTest('../app/dotrelative/foo.mjs')).toMatchURL('https://example.com/lib/dot.mjs'); + + expect(resolveUnderTest('https://example.com/dotdotrelative/foo.mjs')).toMatchURL('https://example.com/lib/dotdot.mjs'); + expect(resolveUnderTest('../dotdotrelative/foo.mjs')).toMatchURL('https://example.com/lib/dotdot.mjs'); + }); + + it('should fail for URLs that remap to empty arrays', () => { + expect(() => resolveUnderTest('https://example.com/lib/no.mjs')).toThrow(TypeError); + expect(() => resolveUnderTest('/lib/no.mjs')).toThrow(TypeError); + expect(() => resolveUnderTest('../lib/no.mjs')).toThrow(TypeError); + + expect(() => resolveUnderTest('https://example.com/app/dotrelative/no.mjs')).toThrow(TypeError); + expect(() => resolveUnderTest('/app/dotrelative/no.mjs')).toThrow(TypeError); + expect(() => resolveUnderTest('../app/dotrelative/no.mjs')).toThrow(TypeError); + }); + + it('should remap URLs that are just composed from / and .', () => { + expect(resolveUnderTest('https://example.com/')).toMatchURL('https://example.com/lib/slash-only.mjs'); + expect(resolveUnderTest('/')).toMatchURL('https://example.com/lib/slash-only.mjs'); + expect(resolveUnderTest('../')).toMatchURL('https://example.com/lib/slash-only.mjs'); + + expect(resolveUnderTest('https://example.com/app/')).toMatchURL('https://example.com/lib/dotslash-only.mjs'); + expect(resolveUnderTest('/app/')).toMatchURL('https://example.com/lib/dotslash-only.mjs'); + expect(resolveUnderTest('../app/')).toMatchURL('https://example.com/lib/dotslash-only.mjs'); + }); + + it('should use the last entry\'s address when URL-like specifiers parse to the same absolute URL', () => { + expect(resolveUnderTest('/test')).toMatchURL('https://example.com/lib/test2.mjs'); + }); + }); +});
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/resources/test-helper.js b/third_party/blink/web_tests/external/wpt/import-maps/resources/test-helper.js new file mode 100644 index 0000000..2447bfb --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/resources/test-helper.js
@@ -0,0 +1,205 @@ +let log = []; + +function expect_log(test, expected_log) { + test.step_func_done(() => { + const actual_log = log; + log = []; + assert_array_equals(actual_log, expected_log, 'fallback log'); + })(); +} + +// Results of resolving a specifier using import maps. +const Result = { + // A built-in module (std:blank) is loaded. + BUILTIN: "builtin", + + // A failure considered as a fetch error in a module script tree. + // <script>'s error event is fired. + FETCH_ERROR: "fetch_error", + + // A failure considered as a parse error in a module script tree. + // Window's error event is fired. + PARSE_ERROR: "parse_error", + + // The specifier is considered as a relative or absolute URL. + // Specifier Expected log + // ------------------------- ---------------------- + // ...?name=foo log:foo + // data:...log('foo') foo + // Others, e.g. @std/blank relative:@std/blank + // ------------------------- ---------------------- + // (The last case assumes a file `@std/blank` that logs `relative:@std/blank` + // exists) + URL: "URL", +}; + +const Handler = { + // Handlers for <script> element cases. + // Note that on a parse error both WindowErrorEvent and ScriptLoadEvent are + // called. + ScriptLoadEvent: "<script> element's load event handler", + ScriptErrorEvent: "<script> element's error event handler", + WindowErrorEvent: "window's error event handler", + + // Handlers for dynamic imports. + DynamicImportResolve: "dynamic import resolve", + DynamicImportReject: "dynamic import reject", +}; + +// Returns a map with Handler.* as the keys. +function getHandlers(t, specifier, expected) { + let handlers = {}; + handlers[Handler.ScriptLoadEvent] = t.unreached_func("Shouldn't load"); + handlers[Handler.ScriptErrorEvent] = + t.unreached_func("script's error event shouldn't be fired"); + handlers[Handler.WindowErrorEvent] = + t.unreached_func("window's error event shouldn't be fired"); + handlers[Handler.DynamicImportResolve] = + t.unreached_func("dynamic import promise shouldn't be resolved"); + handlers[Handler.DynamicImportReject] = + t.unreached_func("dynamic import promise shouldn't be rejected"); + + if (expected === Result.FETCH_ERROR) { + handlers[Handler.ScriptErrorEvent] = () => expect_log(t, []); + handlers[Handler.DynamicImportReject] = () => expect_log(t, []); + } else if (expected === Result.PARSE_ERROR) { + let error_occurred = false; + handlers[Handler.WindowErrorEvent] = () => { error_occurred = true; }; + handlers[Handler.ScriptLoadEvent] = t.step_func(() => { + // Even if a parse error occurs, load event is fired (after + // window.onerror is called), so trigger the load handler only if + // there was no previous window.onerror call. + assert_true(error_occurred, "window.onerror should be fired"); + expect_log(t, []); + }); + handlers[Handler.DynamicImportReject] = t.step_func(() => { + assert_false(error_occurred, + "window.onerror shouldn't be fired for dynamic imports"); + expect_log(t, []); + }); + } else { + let expected_log; + if (expected === Result.BUILTIN) { + expected_log = []; + } else if (expected === Result.URL) { + const match_data_url = specifier.match(/data:.*log\.push\('(.*)'\)/); + const match_log_js = specifier.match(/name=(.*)/); + if (match_data_url) { + expected_log = [match_data_url[1]]; + } else if (match_log_js) { + expected_log = ["log:" + match_log_js[1]]; + } else { + expected_log = ["relative:" + specifier]; + } + } else { + expected_log = [expected]; + } + handlers[Handler.ScriptLoadEvent] = () => expect_log(t, expected_log); + handlers[Handler.DynamicImportResolve] = () => expect_log(t, expected_log); + } + return handlers; +} + +// Creates an <iframe> and run a test inside the <iframe> +// to separate the module maps and import maps in each test. +function testInIframe(importMapString, importMapBaseURL, testScript) { + const iframe = document.createElement('iframe'); + document.body.appendChild(iframe); + if (!importMapBaseURL) { + importMapBaseURL = document.baseURI; + } + let content = ` + <script src="/resources/testharness.js"></script> + <script src="/import-maps/resources/test-helper.js"></script> + <base href="${importMapBaseURL}"> + `; + if (importMapString) { + content += ` + <script type="importmap"> + ${importMapString} + </sc` + `ript> + `; + } + content += ` + <body> + <script> + setup({ allow_uncaught_exception: true }); + ${testScript} + </sc` + `ript> + `; + iframe.contentDocument.write(content); + iframe.contentDocument.close(); + fetch_tests_from_window(iframe.contentWindow); +} + +function testScriptElement(importMapString, importMapBaseURL, specifier, expected, type) { + testInIframe(importMapString, importMapBaseURL, ` + const t = async_test("${specifier}: <script src type=${type}>"); + const handlers = getHandlers(t, "${specifier}", "${expected}"); + const script = document.createElement("script"); + script.setAttribute("type", "${type}"); + script.setAttribute("src", "${specifier}"); + script.addEventListener("load", handlers[Handler.ScriptLoadEvent]); + script.addEventListener("error", handlers[Handler.ScriptErrorEvent]); + window.addEventListener("error", handlers[Handler.WindowErrorEvent]); + document.body.appendChild(script); + `); +} + +function testStaticImport(importMapString, importMapBaseURL, specifier, expected) { + testInIframe(importMapString, importMapBaseURL, ` + const t = async_test("${specifier}: static import"); + const handlers = getHandlers(t, "${specifier}", "${expected}"); + const script = document.createElement("script"); + script.setAttribute("type", "module"); + script.setAttribute("src", + "/import-maps/static-import.js?pipe=sub(none)&url=" + + encodeURIComponent("${specifier}")); + script.addEventListener("load", handlers[Handler.ScriptLoadEvent]); + script.addEventListener("error", handlers[Handler.ScriptErrorEvent]); + window.addEventListener("error", handlers[Handler.WindowErrorEvent]); + document.body.appendChild(script); + `); +} + +function testDynamicImport(importMapString, importMapBaseURL, specifier, expected, type) { + testInIframe(importMapString, importMapBaseURL, ` + const t = async_test("${specifier}: dynamic import (from ${type})"); + const handlers = getHandlers(t, "${specifier}", "${expected}"); + const script = document.createElement("script"); + script.setAttribute("type", "${type}"); + script.innerText = + "import(\\"${specifier}\\")" + + ".then(handlers[Handler.DynamicImportResolve], " + + "handlers[Handler.DynamicImportReject]);"; + script.addEventListener("error", + t.unreached_func("top-level inline script shouldn't error")); + document.body.appendChild(script); + `); +} + +function doTests(importMapString, importMapBaseURL, tests) { + window.addEventListener("load", () => { + for (const specifier in tests) { + // <script src> (module scripts) + testScriptElement(importMapString, importMapBaseURL, specifier, + tests[specifier][0], "module"); + + // <script src> (classic scripts) + testScriptElement(importMapString, importMapBaseURL, specifier, + tests[specifier][1], "text/javascript"); + + // static imports. + testStaticImport(importMapString, importMapBaseURL, specifier, + tests[specifier][2]); + + // dynamic imports from a module script. + testDynamicImport(importMapString, importMapBaseURL, specifier, + tests[specifier][3], "module"); + + // dynamic imports from a classic script. + testDynamicImport(importMapString, importMapBaseURL, specifier, + tests[specifier][3], "text/javascript"); + } + }); +}
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/static-import.js b/third_party/blink/web_tests/external/wpt/import-maps/static-import.js new file mode 100644 index 0000000..1686fc1 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/static-import.js
@@ -0,0 +1 @@ +import "{{GET[url]}}";
diff --git a/third_party/blink/web_tests/external/wpt/picture-in-picture/disable-picture-in-picture.html b/third_party/blink/web_tests/external/wpt/picture-in-picture/disable-picture-in-picture.html index 31e0d12..5075c01 100644 --- a/third_party/blink/web_tests/external/wpt/picture-in-picture/disable-picture-in-picture.html +++ b/third_party/blink/web_tests/external/wpt/picture-in-picture/disable-picture-in-picture.html
@@ -47,7 +47,9 @@ return requestPictureInPictureWithTrustedClick(video) .then(() => { video.disablePictureInPicture = true; - assert_equals(document.pictureInPictureElement, null); + video.addEventListener('leavepictureinpicture', t.step_func(() => { + assert_equals(document.pictureInPictureElement, null); + })); }); }, 'pictureInPictureElement is unset if disablePictureInPicture becomes true');
diff --git a/third_party/blink/web_tests/external/wpt/svg/geometry/parsing/ry-invalid-expected.txt b/third_party/blink/web_tests/external/wpt/svg/geometry/parsing/ry-invalid-expected.txt index f8f6965..4a845ad2 100644 --- a/third_party/blink/web_tests/external/wpt/svg/geometry/parsing/ry-invalid-expected.txt +++ b/third_party/blink/web_tests/external/wpt/svg/geometry/parsing/ry-invalid-expected.txt
@@ -1,7 +1,7 @@ This is a testharness.js-based test. -FAIL e.style['rx'] = "10" should not set the property value assert_equals: expected "" but got "10" -PASS e.style['rx'] = "none" should not set the property value -PASS e.style['rx'] = "10px 20px" should not set the property value -PASS e.style['rx'] = "-1px" should not set the property value +FAIL e.style['ry'] = "10" should not set the property value assert_equals: expected "" but got "10" +PASS e.style['ry'] = "none" should not set the property value +PASS e.style['ry'] = "10px 20px" should not set the property value +PASS e.style['ry'] = "-1px" should not set the property value Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/svg/geometry/parsing/ry-invalid.svg b/third_party/blink/web_tests/external/wpt/svg/geometry/parsing/ry-invalid.svg index 7a25a1e..5938ae8 100644 --- a/third_party/blink/web_tests/external/wpt/svg/geometry/parsing/ry-invalid.svg +++ b/third_party/blink/web_tests/external/wpt/svg/geometry/parsing/ry-invalid.svg
@@ -2,10 +2,10 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml" width="800px" height="8000px"> - <title>SVG Geometry Properties: parsing rx with invalid values</title> + <title>SVG Geometry Properties: parsing ry with invalid values</title> <metadata> <h:link rel="help" href="https://svgwg.org/svg2-draft/geometry.html#RY"/> - <h:meta name="assert" content="rx supports only the grammar '<length-percentage> | auto'."/> + <h:meta name="assert" content="ry supports only the grammar '<length-percentage> | auto'."/> </metadata> <g id="target"></g> <h:script src="/resources/testharness.js"/> @@ -13,10 +13,10 @@ <h:script src="/css/support/parsing-testcommon.js"/> <script><![CDATA[ -test_invalid_value("rx", "10"); -test_invalid_value("rx", "none"); -test_invalid_value("rx", "10px 20px"); -test_invalid_value("rx", "-1px"); +test_invalid_value("ry", "10"); +test_invalid_value("ry", "none"); +test_invalid_value("ry", "10px 20px"); +test_invalid_value("ry", "-1px"); ]]></script> </svg>
diff --git a/third_party/blink/web_tests/external/wpt/svg/geometry/parsing/ry-valid.svg b/third_party/blink/web_tests/external/wpt/svg/geometry/parsing/ry-valid.svg index e92e2cf6..178c0c0 100644 --- a/third_party/blink/web_tests/external/wpt/svg/geometry/parsing/ry-valid.svg +++ b/third_party/blink/web_tests/external/wpt/svg/geometry/parsing/ry-valid.svg
@@ -2,10 +2,10 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml" width="800px" height="8000px"> - <title>SVG Geometry Properties: parsing rx with valid values</title> + <title>SVG Geometry Properties: parsing ry with valid values</title> <metadata> <h:link rel="help" href="https://svgwg.org/svg2-draft/geometry.html#RY"/> - <h:meta name="assert" content="rx supports the full grammar '<length-percentage> | auto'."/> + <h:meta name="assert" content="ry supports the full grammar '<length-percentage> | auto'."/> </metadata> <g id="target"></g> <h:script src="/resources/testharness.js"/> @@ -13,13 +13,13 @@ <h:script src="/css/support/parsing-testcommon.js"/> <script><![CDATA[ -test_valid_value("rx", "auto"); +test_valid_value("ry", "auto"); -test_valid_value("rx", "0", "0px"); -test_valid_value("rx", "1px"); -test_valid_value("rx", "calc(2em + 3ex)"); -test_valid_value("rx", "4%"); -test_valid_value("rx", "5vh"); +test_valid_value("ry", "0", "0px"); +test_valid_value("ry", "1px"); +test_valid_value("ry", "calc(2em + 3ex)"); +test_valid_value("ry", "4%"); +test_valid_value("ry", "5vh"); ]]></script> </svg>
diff --git a/third_party/blink/web_tests/fast/forms/select_detached_textarea_crash.html b/third_party/blink/web_tests/fast/forms/select_detached_textarea_crash.html new file mode 100644 index 0000000..1075f33 --- /dev/null +++ b/third_party/blink/web_tests/fast/forms/select_detached_textarea_crash.html
@@ -0,0 +1,21 @@ +<!doctype html> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<div id=container> +<textarea id=textarea></textarea> +<iframe id=iframe></iframe> +</div> +<script> +// Regression test for https://crbug.com/927646 +const textarea = document.getElementById('textarea'); +const iframe = document.getElementById('iframe'); +iframe.contentDocument.body.onpagehide = () => textarea.select(); + +test(() => { + // Triggers onpagehide + container.remove(); + + // Shouldn't crash + textarea.select(); +}); +</script>
diff --git a/third_party/blink/web_tests/media/picture-in-picture/clear-after-request.html b/third_party/blink/web_tests/media/picture-in-picture/clear-after-request.html new file mode 100644 index 0000000..8b0b86d8 --- /dev/null +++ b/third_party/blink/web_tests/media/picture-in-picture/clear-after-request.html
@@ -0,0 +1,35 @@ +<!DOCTYPE html> +<title>No crash when resetting player just after requesting PIP</title> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<video></video> +<script> +async_test(t => { + if (!document.pictureInPictureEnabled) + t.done(); + + const video = document.querySelector('video'); + video.src = '../content/test.ogv'; + + video.addEventListener('click', t.step_func_done(() => { + video.requestPictureInPicture(); + video.src = ''; + // Do not crash. + }), { once: true }); + + video.play().then(t.step_func(() => { + const bounds = video.getBoundingClientRect(); + + chrome.gpuBenchmarking.pointerActionSequence([{ + source: 'mouse', + actions: [ + { name: 'pointerDown', + x: bounds.left + bounds.width / 2, + y: bounds.top + bounds.height / 2 + }, + { name: 'pointerUp' } + ] + }]); + })); +}); +</script>
diff --git a/third_party/closure_compiler/externs/safe_browsing_private.js b/third_party/closure_compiler/externs/safe_browsing_private.js index d11808b9..f7ae7fd 100644 --- a/third_party/closure_compiler/externs/safe_browsing_private.js +++ b/third_party/closure_compiler/externs/safe_browsing_private.js
@@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,10 +17,31 @@ chrome.safeBrowsingPrivate = {}; /** + * @enum {string} + */ +chrome.safeBrowsingPrivate.URLType = { + EVENT_URL: 'EVENT_URL', + LANDING_PAGE: 'LANDING_PAGE', + LANDING_REFERRER: 'LANDING_REFERRER', + CLIENT_REDIRECT: 'CLIENT_REDIRECT', + RECENT_NAVIGATION: 'RECENT_NAVIGATION', + REFERRER: 'REFERRER', +}; + +/** + * @enum {string} + */ +chrome.safeBrowsingPrivate.NavigationInitiation = { + BROWSER_INITIATED: 'BROWSER_INITIATED', + RENDERER_INITIATED_WITHOUT_USER_GESTURE: 'RENDERER_INITIATED_WITHOUT_USER_GESTURE', + RENDERER_INITIATED_WITH_USER_GESTURE: 'RENDERER_INITIATED_WITH_USER_GESTURE', +}; + +/** * @typedef {{ * url: string, * userName: string, - * isPhishing: boolean + * isPhishingUrl: boolean * }} */ chrome.safeBrowsingPrivate.PolicySpecifiedPasswordReuse; @@ -29,8 +50,8 @@ * @typedef {{ * url: string, * fileName: string, - * sha256: string, - * userName: (string|undefined) + * downloadDigestSha256: string, + * userName: string * }} */ chrome.safeBrowsingPrivate.DangerousDownloadInfo; @@ -39,12 +60,45 @@ * @typedef {{ * url: string, * reason: string, - * netErrorCode: (number|undefined) + * netErrorCode: (string|undefined), + * userName: string * }} */ chrome.safeBrowsingPrivate.InterstitialInfo; /** + * @typedef {{ + * url: (string|undefined) + * }} + */ +chrome.safeBrowsingPrivate.ServerRedirect; + +/** + * @typedef {{ + * url: string, + * mainFrameUrl: (string|undefined), + * urlType: !chrome.safeBrowsingPrivate.URLType, + * ipAddresses: (!Array<string>|undefined), + * referrerUrl: (string|undefined), + * referrerMainFrameUrl: (string|undefined), + * isRetargeting: (boolean|undefined), + * navigationTimeMs: (number|undefined), + * serverRedirectChain: (!Array<!chrome.safeBrowsingPrivate.ServerRedirect>|undefined), + * navigationInitiation: (!chrome.safeBrowsingPrivate.NavigationInitiation|undefined), + * maybeLaunchedByExternalApp: (boolean|undefined) + * }} + */ +chrome.safeBrowsingPrivate.ReferrerChainEntry; + +/** + * Gets referrer chain for the specified tab. + * @param {number} tabId Id of the tab from which to retrieve the referrer. + * @param {function(!Array<!chrome.safeBrowsingPrivate.ReferrerChainEntry>):void} callbac + * k Called with the list of referrer chain entries. + */ +chrome.safeBrowsingPrivate.getReferrerChain = function(tabId, callback) {}; + +/** * Fired when Chrome detects a reuse of a policy specified password. * @type {!ChromeEvent} */ @@ -66,10 +120,10 @@ * Fired when a security interstitial is shown to the user. * @type {!ChromeEvent} */ -chrome.safeBrowsingPrivate.onInterstitialShown; +chrome.safeBrowsingPrivate.onSecurityInterstitialShown; /** * Fired when the user clicked-through a security interstitial. * @type {!ChromeEvent} */ -chrome.safeBrowsingPrivate.onInterstitialProceeded; +chrome.safeBrowsingPrivate.onSecurityInterstitialProceeded;
diff --git a/third_party/inspector_protocol/roll.py b/third_party/inspector_protocol/roll.py new file mode 100755 index 0000000..7ab04bb --- /dev/null +++ b/third_party/inspector_protocol/roll.py
@@ -0,0 +1,164 @@ +#!/usr/bin/env python +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import argparse +import sys +import os +import subprocess +import glob +import shutil + + +FILES_TO_SYNC = [ + 'BUILD.gn', + 'README.md', + 'check_protocol_compatibility.py', + 'code_generator.py', + 'concatenate_protocols.py', + 'convert_protocol_to_json.py', + 'encoding/*', + 'inspector_protocol.gni', + 'inspector_protocol.gypi', + 'lib/*', + 'pdl.py', + 'templates/*', +] + + +def RunCmd(cmd): + p = subprocess.Popen(cmd, stdout=subprocess.PIPE) + (stdoutdata, stderrdata) = p.communicate() + if p.returncode != 0: + raise Exception('%s: exit status %d', str(cmd), p.returncode) + return stdoutdata + + +def CheckRepoIsClean(path): + os.chdir(path) # As a side effect this also checks for existence of the dir. + # If path isn't a git repo, this will throw and exception. + # And if it is a git repo and 'git status' has anything interesting to say, + # then it's not clean (uncommitted files etc.) + if len(RunCmd(['git', 'status', '--porcelain'])) != 0: + raise Exception('%s is not a clean git repo (run git status)' % path) + if not path.endswith('/src'): + raise Exception('%s does not end with /src' % path) + + +def CheckRepoIsNotAtMasterBranch(path): + os.chdir(path) + stdout = RunCmd(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip() + if stdout == 'master': + raise Exception('%s is at master branch - refusing to copy there.' % path) + + +def CheckRepoIsChromiumCheckout(path): + os.chdir(path) + if (RunCmd(['git', 'config', '--get', 'remote.origin.url']).strip() != + 'https://chromium.googlesource.com/chromium/src.git'): + raise Exception('%s is not a proper Chromium checkout.' % path) + + +def CheckRepoIsInspectorProtocolCheckout(path): + os.chdir(path) + if (RunCmd(['git', 'config', '--get', 'remote.origin.url']).strip() != + 'https://chromium.googlesource.com/deps/inspector_protocol.git'): + raise Exception('%s is not a proper inspector_protocol checkout.' % path) + + +def FindFilesToSyncIn(path): + files = [] + for f in FILES_TO_SYNC: + files += glob.glob(os.path.join(path, f)) + files = [os.path.relpath(f, path) for f in files] + return files + + +def FilesAreEqual(path1, path2): + # We check for permissions (useful for executable scripts) and contents. + return (os.stat(path1).st_mode == os.stat(path2).st_mode and + open(path1).read() == open(path2).read()) + + +def GetHeadRevision(path): + os.chdir(path) + return RunCmd(['git', 'rev-parse', 'HEAD']) + + +def main(argv): + parser = argparse.ArgumentParser(description=( + "Rolls the inspector_protocol project (upstream) into Chromium's " + "third_party (downstream).")) + parser.add_argument("--ip_src_upstream", + help="The inspector_protocol (upstream) tree.", + default="~/ip/src") + parser.add_argument("--chromium_src_downstream", + help="The Chromium src tree.", + default="~/chromium/src") + parser.add_argument('--reverse', dest='reverse', action='store_true', + help=("Whether to roll the opposite direction, from " + "Chromium (downstream) to inspector_protocol " + "(upstream).")) + parser.set_defaults(reverse=False) + parser.add_argument('--force', dest='force', action='store_true', + help=("Whether to carry out the modifications " + "in the destination tree.")) + parser.set_defaults(force=False) + + args = parser.parse_args(argv) + upstream = os.path.normpath(os.path.expanduser(args.ip_src_upstream)) + downstream = os.path.normpath(os.path.expanduser( + args.chromium_src_downstream)) + CheckRepoIsClean(upstream) + CheckRepoIsClean(downstream) + CheckRepoIsInspectorProtocolCheckout(upstream) + CheckRepoIsChromiumCheckout(downstream) + # Check that the destination Git repo isn't at the master branch - it's + # generally a bad idea to check into the master branch, so we catch this + # common pilot error here early. + if args.reverse: + CheckRepoIsNotAtMasterBranch(upstream) + src_dir = os.path.join(downstream, 'third_party/inspector_protocol') + dest_dir = upstream + else: + CheckRepoIsNotAtMasterBranch(downstream) + src_dir = upstream + dest_dir = os.path.join(downstream, 'third_party/inspector_protocol') + print 'Rolling %s into %s ...' % (src_dir, dest_dir) + src_files = set(FindFilesToSyncIn(src_dir)) + dest_files = set(FindFilesToSyncIn(dest_dir)) + to_add = [f for f in src_files if f not in dest_files] + to_delete = [f for f in dest_files if f not in src_files] + to_copy = [f for f in src_files + if (f in dest_files and not FilesAreEqual( + os.path.join(src_dir, f), os.path.join(dest_dir, f)))] + print 'To add: %s' % to_add + print 'To delete: %s' % to_delete + print 'To copy: %s' % to_copy + if not to_add and not to_delete and not to_copy: + print 'Nothing to do. You\'re good.' + sys.exit(0) + if not args.force: + print 'Rerun with --force if you wish the modifications to be done.' + sys.exit(1) + print 'You said --force ... as you wish, modifying the destination.' + for f in to_add + to_copy: + shutil.copyfile(os.path.join(src_dir, f), os.path.join(dest_dir, f)) + shutil.copymode(os.path.join(src_dir, f), os.path.join(dest_dir, f)) + for f in to_delete: + os.unlink(os.path.join(dest_dir, f)) + if not args.reverse: + head_revision = GetHeadRevision(upstream) + lines = open(os.path.join(dest_dir, 'README.chromium')).readlines() + f = open(os.path.join(dest_dir, 'README.chromium'), 'w') + for line in lines: + if line.startswith('Revision: '): + f.write('Revision: %s' % head_revision) + else: + f.write(line) + f.close() + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:]))
diff --git a/tools/accessibility/inspect/ax_tree_server.cc b/tools/accessibility/inspect/ax_tree_server.cc index 062b5ab..58b30d1 100644 --- a/tools/accessibility/inspect/ax_tree_server.cc +++ b/tools/accessibility/inspect/ax_tree_server.cc
@@ -79,9 +79,9 @@ Format(*formatter, *dict, filters_path, use_json); } -std::vector<AccessibilityTreeFormatter::Filter> GetFilters( +std::vector<AccessibilityTreeFormatter::PropertyFilter> GetPropertyFilters( const base::FilePath& filters_path) { - std::vector<AccessibilityTreeFormatter::Filter> filters; + std::vector<AccessibilityTreeFormatter::PropertyFilter> filters; if (!filters_path.empty()) { std::string raw_filters_text; base::ScopedAllowBlockingForTesting allow_io_for_test_setup; @@ -91,26 +91,27 @@ base::SPLIT_WANT_ALL)) { if (base::StartsWith(line, kAllowOptEmptyStr, base::CompareCase::SENSITIVE)) { - filters.push_back(AccessibilityTreeFormatter::Filter( + filters.push_back(AccessibilityTreeFormatter::PropertyFilter( base::UTF8ToUTF16(line.substr(strlen(kAllowOptEmptyStr))), - AccessibilityTreeFormatter::Filter::ALLOW_EMPTY)); + AccessibilityTreeFormatter::PropertyFilter::ALLOW_EMPTY)); } else if (base::StartsWith(line, kAllowOptStr, base::CompareCase::SENSITIVE)) { - filters.push_back(AccessibilityTreeFormatter::Filter( + filters.push_back(AccessibilityTreeFormatter::PropertyFilter( base::UTF8ToUTF16(line.substr(strlen(kAllowOptStr))), - AccessibilityTreeFormatter::Filter::ALLOW)); + AccessibilityTreeFormatter::PropertyFilter::ALLOW)); } else if (base::StartsWith(line, kDenyOptStr, base::CompareCase::SENSITIVE)) { - filters.push_back(AccessibilityTreeFormatter::Filter( + filters.push_back(AccessibilityTreeFormatter::PropertyFilter( base::UTF8ToUTF16(line.substr(strlen(kDenyOptStr))), - AccessibilityTreeFormatter::Filter::DENY)); + AccessibilityTreeFormatter::PropertyFilter::DENY)); } } } } if (filters.empty()) { - filters = {AccessibilityTreeFormatter::Filter( - base::ASCIIToUTF16("*"), AccessibilityTreeFormatter::Filter::ALLOW)}; + filters = {AccessibilityTreeFormatter::PropertyFilter( + base::ASCIIToUTF16("*"), + AccessibilityTreeFormatter::PropertyFilter::ALLOW)}; } return filters; @@ -120,11 +121,11 @@ const base::DictionaryValue& dict, const base::FilePath& filters_path, bool use_json) { - std::vector<AccessibilityTreeFormatter::Filter> filters = - GetFilters(filters_path); + std::vector<AccessibilityTreeFormatter::PropertyFilter> filters = + GetPropertyFilters(filters_path); // Set filters. - formatter.SetFilters(filters); + formatter.SetPropertyFilters(filters); std::string accessibility_contents_utf8;
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 6a5a4f43..7df526a 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -11050,6 +11050,13 @@ <int value="19" label="Screensaver"/> </enum> +<enum name="DemoModeAppLaunchSource"> + <summary>Source of App Launches in Demo Mode.</summary> + <int value="0" label="Shelf"/> + <int value="1" label="App List"/> + <int value="2" label="Highlights App"/> +</enum> + <enum name="DemoModeIdleLogoutWarningEvent"> <int value="0" label="Shown"/> <int value="1" label="Canceled"/> @@ -17877,6 +17884,7 @@ <int value="1314" label="AUTOFILLPRIVATE_GETSERVERCREDITCARDLIST"/> <int value="1315" label="PASSWORDSPRIVATE_CHANGESAVEDPASSWORD"/> <int value="1316" label="AUTOTESTPRIVATE_SETWHITELISTEDPREF"/> + <int value="1317" label="SAFEBROWSINGPRIVATE_GETREFERRERCHAIN"/> </enum> <enum name="ExtensionIconState"> @@ -31532,6 +31540,7 @@ <int value="-624221121" label="CommandLineOnNonRooted:enabled"/> <int value="-622685174" label="enable-pdf-material-ui"/> <int value="-621382525" label="VizDisplayCompositor:enabled"/> + <int value="-621044227" label="OmniboxReverseTabSwitchLogic:enabled"/> <int value="-620030047" label="CrosCompUpdates:disabled"/> <int value="-617452890" label="media-router"/> <int value="-612633819" label="NotificationScrollBar:disabled"/> @@ -32529,6 +32538,7 @@ <int value="1153454438" label="AutofillCreditCardLastUsedDateDisplay:disabled"/> <int value="1155923106" label="NTPOfflinePages:enabled"/> + <int value="1161075291" label="OmniboxReverseTabSwitchLogic:disabled"/> <int value="1163255347" label="ash-enable-touch-view-touch-feedback"/> <int value="1166169237" label="disable-delay-agnostic-aec"/> <int value="1166789664" label="SyncPseudoUSSAppList:disabled"/> @@ -51682,6 +51692,9 @@ <int value="0" label="Download paused"/> <int value="1" label="Download resumed"/> <int value="2" label="Download canceled"/> + <int value="3" label="Download page paused"/> + <int value="4" label="Download page resumed"/> + <int value="5" label="Download page canceled"/> </enum> <enum name="SystemNotificationType">
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index c7cc0cd..bf4d988 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -17240,7 +17240,10 @@ </histogram> <histogram name="ContentSuggestions.Feed.Image.FetchResult" - enum="FeedImageFetchResult" expires_after="2019-10-01"> + enum="FeedImageFetchResult"> + <obsolete> + Deprecated in favor of CachedImageFetcher.Events. + </obsolete> <owner>wylieb@chromium.org</owner> <summary> Android: Represents success/failure of Feed image loading. Recorded upon @@ -17248,16 +17251,20 @@ </summary> </histogram> -<histogram name="ContentSuggestions.Feed.Image.LoadFromCacheTime" units="ms" - expires_after="2019-10-01"> +<histogram name="ContentSuggestions.Feed.Image.LoadFromCacheTime" units="ms"> + <obsolete> + Deprecated in favor of CachedImageFetcher.Events. + </obsolete> <owner>wylieb@chromium.org</owner> <summary> Android: The time it takes for Feed to load an image from the cache. </summary> </histogram> -<histogram name="ContentSuggestions.Feed.Image.LoadFromNetworkTime" units="ms" - expires_after="2019-10-01"> +<histogram name="ContentSuggestions.Feed.Image.LoadFromNetworkTime" units="ms"> + <obsolete> + Deprecated in favor of CachedImageFetcher.Events. + </obsolete> <owner>wylieb@chromium.org</owner> <summary> Android: The time it takes for Feed to load an image from the network. @@ -21538,6 +21545,16 @@ </summary> </histogram> +<histogram name="DemoMode.AppLaunchSource" enum="DemoModeAppLaunchSource" + expires_after="M76"> + <owner>danan@chromium.org</owner> + <owner>michaelpg@chromium.org</owner> + <summary> + The source of app launches in demo mode, either the shelf, the app list, or + the highlights app. + </summary> +</histogram> + <histogram name="DemoMode.IdleLogoutWarningEvent" enum="DemoModeIdleLogoutWarningEvent" expires_after="M76"> <owner>michaelpg@chromium.org</owner> @@ -25065,6 +25082,16 @@ </summary> </histogram> +<histogram name="Download.DuplicateInProgressDownloadIdCount" + units="duplicates" expires_after="2019-07-30"> + <owner>qinmin@chromium.org</owner> + <owner>dtrainor@chromium.org</owner> + <summary> + The total number of download IDs that are duplicate in the in-progress + downloads DB, capped at 10. + </summary> +</histogram> + <histogram name="Download.EstimatedTimeSavedWithParallelDownload" units="ms"> <owner>qinmin@chromium.org</owner> <summary> @@ -66282,7 +66309,10 @@ <histogram name="Net.WpadQuickCheckFailure" units="ms" expires_after="2018-08-30"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> + <obsolete> + Deprecated 02/2019. + </obsolete> + <owner>eroman@chromium.org</owner> <summary> Duration of time that a failing WPAD QuickCheck takes. WPAD QuickCheck does a name lookup for "wpad" and times out quickly to fail fast when @@ -66292,7 +66322,10 @@ <histogram name="Net.WpadQuickCheckSuccess" units="ms" expires_after="2018-08-30"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> + <obsolete> + Deprecated 02/2019. + </obsolete> + <owner>eroman@chromium.org</owner> <summary> Duration of time that a successful WPAD QuickCheck takes. WPAD QuickCheck does a name lookup for "wpad" and times out quickly to fail fast @@ -71734,7 +71767,7 @@ <histogram name="Notifications.LoadFailTime" units="ms"> <!-- Name completed by histogram_suffixes name="NotificationImageTypes" --> - <owner>johnme@chromium.org</owner> + <owner>peter@chromium.org</owner> <summary> The number of milliseconds it took to fail loading an icon/image for a Web Notification. @@ -71744,7 +71777,7 @@ <histogram name="Notifications.LoadFileSize" units="bytes"> <!-- Name completed by histogram_suffixes name="NotificationImageTypes" --> - <owner>johnme@chromium.org</owner> + <owner>peter@chromium.org</owner> <summary> The number of bytes loaded for a Web Notification icon/image. </summary> @@ -71753,7 +71786,7 @@ <histogram name="Notifications.LoadFinishTime" units="ms"> <!-- Name completed by histogram_suffixes name="NotificationImageTypes" --> - <owner>johnme@chromium.org</owner> + <owner>peter@chromium.org</owner> <summary> The number of milliseconds it took to finish successfully loading an icon/image for a Web Notification. @@ -71763,7 +71796,7 @@ <histogram name="Notifications.LoadScaleDownTime" units="ms"> <!-- Name completed by histogram_suffixes name="NotificationImageTypes" --> - <owner>johnme@chromium.org</owner> + <owner>peter@chromium.org</owner> <summary> The number of milliseconds it took to scale down an icon/image for a Web Notification. @@ -71846,7 +71879,7 @@ <histogram name="Notifications.PersistentNotificationActionCount" units="buttons"> - <owner>johnme@chromium.org</owner> + <owner>peter@chromium.org</owner> <summary> The number of action buttons the developer provided for a persistent Web Notification. Logged whenever showNotification is called. @@ -89415,6 +89448,22 @@ <summary>User interactions with the Previews Android Omnibox UI.</summary> </histogram> +<histogram name="Previews.OmniboxLiteStringShown" enum="BooleanShown" + expires_after="2019-08-30"> + <owner>robertogden@chromium.org</owner> + <summary> + Whether the verbose status string was shown on a Preview page. This is + recorded on every transition from a non-preview page to a preview page. An + entry of false means that the Previews Icon appeared without the + "Lite" string only because there was not enough room to show the + string. + + Note that it is possible for the Lite string to not be shown on the page + after true is recorded if the user rotates their device or enters + multi-window mode while viewing the page, or the converse. + </summary> +</histogram> + <histogram base="true" name="Previews.OptimizationFilterStatus" enum="PreviewsOptimizationFilterStatus"> <owner>dougarnett@chromium.org</owner> @@ -91197,7 +91246,7 @@ </histogram> <histogram name="PushMessaging.DeliveryStatus" enum="PushDeliveryStatus"> - <owner>johnme@google.com</owner> + <owner>peter@google.com</owner> <summary> When a Service Worker receives a push message, this records whether the overall operation was successful, or otherwise the type of error @@ -91207,7 +91256,7 @@ <histogram name="PushMessaging.DeliveryStatus.FindServiceWorker" enum="ServiceWorkerStatusCode"> - <owner>johnme@google.com</owner> + <owner>peter@google.com</owner> <summary> When attempting to deliver a push message to a Service Worker, this records the result of finding the Service Worker registration given its ID and @@ -91217,7 +91266,7 @@ <histogram name="PushMessaging.DeliveryStatus.ServiceWorkerEvent" enum="ServiceWorkerStatusCode"> - <owner>johnme@google.com</owner> + <owner>peter@google.com</owner> <summary> When a Service Worker receives a push message, this records the precise result received from the Service Worker code. @@ -91226,7 +91275,7 @@ <histogram name="PushMessaging.GetRegistrationStatus" enum="PushGetRegistrationStatus"> - <owner>johnme@google.com</owner> + <owner>peter@google.com</owner> <summary> When a webpage asks for details about its current push messaging registration, this records whether the request is successful, or otherwise @@ -91257,7 +91306,7 @@ <histogram name="PushMessaging.RegistrationStatus" enum="PushRegistrationStatus"> - <owner>johnme@google.com</owner> + <owner>peter@google.com</owner> <summary> When a webpage registers for push messaging, this records whether the request is successful, or otherwise the type of error encountered. @@ -91305,7 +91354,7 @@ </histogram> <histogram name="PushMessaging.UnregistrationGCMResult" enum="GCMClientResult"> - <owner>johnme@google.com</owner> + <owner>peter@google.com</owner> <summary> When unregistering a legacy non-InstanceID push messaging subscription, this records the result returned by the GCMDriver (note that exceeding the @@ -91314,7 +91363,7 @@ </histogram> <histogram name="PushMessaging.UnregistrationIIDResult" enum="InstanceIDResult"> - <owner>johnme@google.com</owner> + <owner>peter@google.com</owner> <summary> When unregistering an InstanceID push messaging subscription, this records the result returned from deleting the InstanceID (note that exceeding the @@ -91324,7 +91373,7 @@ <histogram name="PushMessaging.UnregistrationReason" enum="PushUnregistrationReason"> - <owner>johnme@google.com</owner> + <owner>peter@google.com</owner> <summary> When unregistering a website from push messaging, this records the reason why it is being unregistered. @@ -91333,7 +91382,7 @@ <histogram name="PushMessaging.UnregistrationStatus" enum="PushUnregistrationStatus"> - <owner>johnme@google.com</owner> + <owner>peter@google.com</owner> <summary> When unregistering a website from push messaging, this records whether the request is successful, or otherwise the type of error encountered. @@ -91341,7 +91390,7 @@ </histogram> <histogram name="PushMessaging.UserVisibleStatus" enum="PushUserVisibleStatus"> - <owner>johnme@google.com</owner> + <owner>peter@google.com</owner> <summary> When a Service Worker receives a push message, this records whether it showed user-visible UX (like a notification), or whether we showed a forced @@ -92565,7 +92614,8 @@ </histogram> <histogram name="Renderer4.GpuRasterizationEnabled" enum="BooleanEnabled"> - <owner>alokp@chromium.org</owner> + <owner>ericrk@chromium.org</owner> + <owner>enne@chromium.org</owner> <summary> Whether gpu rasterization is enabled (checked once after the page is painted for the first time). @@ -92575,6 +92625,7 @@ <histogram name="Renderer4.GpuRasterizationSlowPathsWithNonAAPaint" enum="BooleanHasSlowPathsWithNonAAPaint"> <owner>ericrk@chromium.org</owner> + <owner>enne@chromium.org</owner> <summary> If gpu rasterization is enabled, whether this page contains both slow-paths (making it suitable for MSAA) and non-AA paints (making it not-suitable for @@ -92585,7 +92636,8 @@ <histogram name="Renderer4.GpuRasterizationSuitableContent" enum="BooleanEnabled"> - <owner>alokp@chromium.org</owner> + <owner>ericrk@chromium.org</owner> + <owner>enne@chromium.org</owner> <summary> If gpu rasterization is enabled, whether the page contents contain no more than 5 slow paths, and is suitable for non-MSAA gpu rasterization (checked @@ -92594,7 +92646,8 @@ </histogram> <histogram name="Renderer4.GpuRasterizationTriggered" enum="BooleanEnabled"> - <owner>alokp@chromium.org</owner> + <owner>ericrk@chromium.org</owner> + <owner>enne@chromium.org</owner> <summary> If gpu rasterization is enabled, whether it was triggered (checked once after the page is painted for the first time). @@ -92602,6 +92655,10 @@ </histogram> <histogram name="Renderer4.GpuRasterizationUsed" enum="BooleanEnabled"> + <obsolete> + Deprecated 02/2019. Due to changes in the code, this is synonymous with + Renderer4.GpuRasterizationEnabled. + </obsolete> <owner>alokp@chromium.org</owner> <summary> If gpu rasterization is enabled, whether it was actually used for the page @@ -104294,7 +104351,7 @@ </histogram> <histogram name="ServiceWorker.PushEvent.Time" units="ms"> - <owner>johnme@chromium.org</owner> + <owner>peter@chromium.org</owner> <summary> The time taken between dispatching a PushEvent to a Service Worker and receiving a message that it finished handling the event. Includes the time @@ -104306,7 +104363,7 @@ <obsolete> Deprecated 2015-05 in favor of ServiceWorker.PushEvent.Time. </obsolete> - <owner>johnme@chromium.org</owner> + <owner>peter@chromium.org</owner> <summary>Execution time of ServiceWorkerGlobalScope.onpush.</summary> </histogram> @@ -111711,7 +111768,7 @@ <histogram name="Startup.BringToForegroundReason" enum="BooleanBringToForegroundReason"> - <owner>johnme@chromium.org</owner> + <owner>peter@chromium.org</owner> <summary> Records the cause, each time Chrome is brought to the foreground. Currently only checks if a NotificationUIManager notification was shown in the last 5
diff --git a/tools/traffic_annotation/summary/annotations.xml b/tools/traffic_annotation/summary/annotations.xml index 8498ce96..6e87dcb 100644 --- a/tools/traffic_annotation/summary/annotations.xml +++ b/tools/traffic_annotation/summary/annotations.xml
@@ -104,7 +104,7 @@ <item id="external_policy_fetcher" hash_code="9459438" type="0" content_hash_code="64260484" os_list="linux,windows" file_path="components/policy/core/common/cloud/external_policy_data_fetcher.cc"/> <item id="family_info" hash_code="30913825" type="0" content_hash_code="25369370" os_list="linux,windows" file_path="chrome/browser/supervised_user/child_accounts/family_info_fetcher.cc"/> <item id="favicon_loader" hash_code="112189210" type="0" content_hash_code="70773116" os_list="linux,windows" file_path="content/renderer/loader/web_url_loader_impl.cc"/> - <item id="feed_image_fetcher" hash_code="87439531" type="0" content_hash_code="26756208" os_list="linux,windows" file_path="components/feed/core/feed_image_manager.cc"/> + <item id="feed_image_fetcher" hash_code="87439531" type="0" deprecated="2019-01-04" content_hash_code="26756208" file_path=""/> <item id="gaia_auth_check_connection_info" hash_code="4598626" type="0" content_hash_code="57347000" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> <item id="gaia_auth_exchange_cookies" hash_code="134289752" type="0" deprecated="2018-09-11" content_hash_code="66433230" file_path=""/> <item id="gaia_auth_exchange_device_id" hash_code="39877119" type="0" content_hash_code="61857947" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/>
diff --git a/ui/accessibility/BUILD.gn b/ui/accessibility/BUILD.gn index f09dce57..42d30b49 100644 --- a/ui/accessibility/BUILD.gn +++ b/ui/accessibility/BUILD.gn
@@ -204,6 +204,7 @@ test("accessibility_unittests") { testonly = true sources = [ + "ax_enum_util_unittest.cc", "ax_event_generator_unittest.cc", "ax_generated_tree_unittest.cc", "ax_language_info_unittest.cc",
diff --git a/ui/accessibility/ax_enum_util.cc b/ui/accessibility/ax_enum_util.cc index 8852fe1..c9f6a89 100644 --- a/ui/accessibility/ax_enum_util.cc +++ b/ui/accessibility/ax_enum_util.cc
@@ -152,6 +152,8 @@ return ax::mojom::Event::kExpandedChanged; if (0 == strcmp(event, "focus")) return ax::mojom::Event::kFocus; + if (0 == strcmp(event, "focusContext")) + return ax::mojom::Event::kFocusContext; if (0 == strcmp(event, "hide")) return ax::mojom::Event::kHide; if (0 == strcmp(event, "hitTestResult")) @@ -222,6 +224,8 @@ return ax::mojom::Event::kSelectionRemove; if (0 == strcmp(event, "show")) return ax::mojom::Event::kShow; + if (0 == strcmp(event, "stateChanged")) + return ax::mojom::Event::kStateChanged; if (0 == strcmp(event, "textChanged")) return ax::mojom::Event::kTextChanged; if (0 == strcmp(event, "textSelectionChanged")) @@ -316,83 +320,83 @@ case ax::mojom::Role::kDisclosureTriangle: return "disclosureTriangle"; case ax::mojom::Role::kDocAbstract: - return "docAbstractRole"; + return "docAbstract"; case ax::mojom::Role::kDocAcknowledgments: - return "docAcknowledgmentsRole"; + return "docAcknowledgments"; case ax::mojom::Role::kDocAfterword: - return "docAfterwordRole"; + return "docAfterword"; case ax::mojom::Role::kDocAppendix: - return "docAppendixRole"; + return "docAppendix"; case ax::mojom::Role::kDocBackLink: - return "docBackLinkRole"; + return "docBackLink"; case ax::mojom::Role::kDocBiblioEntry: - return "docBiblioEntryRole"; + return "docBiblioEntry"; case ax::mojom::Role::kDocBibliography: - return "docBibliographyRole"; + return "docBibliography"; case ax::mojom::Role::kDocBiblioRef: - return "docBiblioRefRole"; + return "docBiblioRef"; case ax::mojom::Role::kDocChapter: - return "docChapterRole"; + return "docChapter"; case ax::mojom::Role::kDocColophon: - return "docColophonRole"; + return "docColophon"; case ax::mojom::Role::kDocConclusion: - return "docConclusionRole"; + return "docConclusion"; case ax::mojom::Role::kDocCover: - return "docCoverRole"; + return "docCover"; case ax::mojom::Role::kDocCredit: - return "docCreditRole"; + return "docCredit"; case ax::mojom::Role::kDocCredits: - return "docCreditsRole"; + return "docCredits"; case ax::mojom::Role::kDocDedication: - return "docDedicationRole"; + return "docDedication"; case ax::mojom::Role::kDocEndnote: - return "docEndnoteRole"; + return "docEndnote"; case ax::mojom::Role::kDocEndnotes: - return "docEndnotesRole"; + return "docEndnotes"; case ax::mojom::Role::kDocEpigraph: - return "docEpigraphRole"; + return "docEpigraph"; case ax::mojom::Role::kDocEpilogue: - return "docEpilogueRole"; + return "docEpilogue"; case ax::mojom::Role::kDocErrata: - return "docErrataRole"; + return "docErrata"; case ax::mojom::Role::kDocExample: - return "docExampleRole"; + return "docExample"; case ax::mojom::Role::kDocFootnote: - return "docFootnoteRole"; + return "docFootnote"; case ax::mojom::Role::kDocForeword: - return "docForewordRole"; + return "docForeword"; case ax::mojom::Role::kDocGlossary: - return "docGlossaryRole"; + return "docGlossary"; case ax::mojom::Role::kDocGlossRef: - return "docGlossrefRole"; + return "docGlossref"; case ax::mojom::Role::kDocIndex: - return "docIndexRole"; + return "docIndex"; case ax::mojom::Role::kDocIntroduction: - return "docIntroductionRole"; + return "docIntroduction"; case ax::mojom::Role::kDocNoteRef: - return "docNoteRefRole"; + return "docNoteRef"; case ax::mojom::Role::kDocNotice: - return "docNoticeRole"; + return "docNotice"; case ax::mojom::Role::kDocPageBreak: - return "docPageBreakRole"; + return "docPageBreak"; case ax::mojom::Role::kDocPageList: - return "docPageListRole"; + return "docPageList"; case ax::mojom::Role::kDocPart: - return "docPartRole"; + return "docPart"; case ax::mojom::Role::kDocPreface: - return "docPrefaceRole"; + return "docPreface"; case ax::mojom::Role::kDocPrologue: - return "docPrologueRole"; + return "docPrologue"; case ax::mojom::Role::kDocPullquote: - return "docPullquoteRole"; + return "docPullquote"; case ax::mojom::Role::kDocQna: - return "docQnaRole"; + return "docQna"; case ax::mojom::Role::kDocSubtitle: - return "docSubtitleRole"; + return "docSubtitle"; case ax::mojom::Role::kDocTip: - return "docTipRole"; + return "docTip"; case ax::mojom::Role::kDocToc: - return "docTocRole"; + return "docToc"; case ax::mojom::Role::kDocument: return "document"; case ax::mojom::Role::kEmbeddedObject: @@ -673,6 +677,84 @@ return ax::mojom::Role::kDirectory; if (0 == strcmp(role, "disclosureTriangle")) return ax::mojom::Role::kDisclosureTriangle; + if (0 == strcmp(role, "docAbstract")) + return ax::mojom::Role::kDocAbstract; + if (0 == strcmp(role, "docAcknowledgments")) + return ax::mojom::Role::kDocAcknowledgments; + if (0 == strcmp(role, "docAfterword")) + return ax::mojom::Role::kDocAfterword; + if (0 == strcmp(role, "docAppendix")) + return ax::mojom::Role::kDocAppendix; + if (0 == strcmp(role, "docBackLink")) + return ax::mojom::Role::kDocBackLink; + if (0 == strcmp(role, "docBiblioEntry")) + return ax::mojom::Role::kDocBiblioEntry; + if (0 == strcmp(role, "docBibliography")) + return ax::mojom::Role::kDocBibliography; + if (0 == strcmp(role, "docBiblioRef")) + return ax::mojom::Role::kDocBiblioRef; + if (0 == strcmp(role, "docChapter")) + return ax::mojom::Role::kDocChapter; + if (0 == strcmp(role, "docColophon")) + return ax::mojom::Role::kDocColophon; + if (0 == strcmp(role, "docConclusion")) + return ax::mojom::Role::kDocConclusion; + if (0 == strcmp(role, "docCover")) + return ax::mojom::Role::kDocCover; + if (0 == strcmp(role, "docCredit")) + return ax::mojom::Role::kDocCredit; + if (0 == strcmp(role, "docCredits")) + return ax::mojom::Role::kDocCredits; + if (0 == strcmp(role, "docDedication")) + return ax::mojom::Role::kDocDedication; + if (0 == strcmp(role, "docEndnote")) + return ax::mojom::Role::kDocEndnote; + if (0 == strcmp(role, "docEndnotes")) + return ax::mojom::Role::kDocEndnotes; + if (0 == strcmp(role, "docEpigraph")) + return ax::mojom::Role::kDocEpigraph; + if (0 == strcmp(role, "docEpilogue")) + return ax::mojom::Role::kDocEpilogue; + if (0 == strcmp(role, "docErrata")) + return ax::mojom::Role::kDocErrata; + if (0 == strcmp(role, "docExample")) + return ax::mojom::Role::kDocExample; + if (0 == strcmp(role, "docFootnote")) + return ax::mojom::Role::kDocFootnote; + if (0 == strcmp(role, "docForeword")) + return ax::mojom::Role::kDocForeword; + if (0 == strcmp(role, "docGlossary")) + return ax::mojom::Role::kDocGlossary; + if (0 == strcmp(role, "docGlossref")) + return ax::mojom::Role::kDocGlossRef; + if (0 == strcmp(role, "docIndex")) + return ax::mojom::Role::kDocIndex; + if (0 == strcmp(role, "docIntroduction")) + return ax::mojom::Role::kDocIntroduction; + if (0 == strcmp(role, "docNoteRef")) + return ax::mojom::Role::kDocNoteRef; + if (0 == strcmp(role, "docNotice")) + return ax::mojom::Role::kDocNotice; + if (0 == strcmp(role, "docPageBreak")) + return ax::mojom::Role::kDocPageBreak; + if (0 == strcmp(role, "docPageList")) + return ax::mojom::Role::kDocPageList; + if (0 == strcmp(role, "docPart")) + return ax::mojom::Role::kDocPart; + if (0 == strcmp(role, "docPreface")) + return ax::mojom::Role::kDocPreface; + if (0 == strcmp(role, "docPrologue")) + return ax::mojom::Role::kDocPrologue; + if (0 == strcmp(role, "docPullquote")) + return ax::mojom::Role::kDocPullquote; + if (0 == strcmp(role, "docQna")) + return ax::mojom::Role::kDocQna; + if (0 == strcmp(role, "docSubtitle")) + return ax::mojom::Role::kDocSubtitle; + if (0 == strcmp(role, "docTip")) + return ax::mojom::Role::kDocTip; + if (0 == strcmp(role, "docToc")) + return ax::mojom::Role::kDocToc; if (0 == strcmp(role, "document")) return ax::mojom::Role::kDocument; if (0 == strcmp(role, "embeddedObject")) @@ -689,6 +771,12 @@ return ax::mojom::Role::kForm; if (0 == strcmp(role, "genericContainer")) return ax::mojom::Role::kGenericContainer; + if (0 == strcmp(role, "graphicsDocument")) + return ax::mojom::Role::kGraphicsDocument; + if (0 == strcmp(role, "graphicsObject")) + return ax::mojom::Role::kGraphicsObject; + if (0 == strcmp(role, "graphicsSymbol")) + return ax::mojom::Role::kGraphicsSymbol; if (0 == strcmp(role, "grid")) return ax::mojom::Role::kGrid; if (0 == strcmp(role, "group")) @@ -709,6 +797,8 @@ return ax::mojom::Role::kInlineTextBox; if (0 == strcmp(role, "inputTime")) return ax::mojom::Role::kInputTime; + if (0 == strcmp(role, "keyboard")) + return ax::mojom::Role::kKeyboard; if (0 == strcmp(role, "labelText")) return ax::mojom::Role::kLabelText; if (0 == strcmp(role, "layoutTable")) @@ -729,6 +819,8 @@ return ax::mojom::Role::kListBoxOption; if (0 == strcmp(role, "listBox")) return ax::mojom::Role::kListBox; + if (0 == strcmp(role, "listGrid")) + return ax::mojom::Role::kListGrid; if (0 == strcmp(role, "listItem")) return ax::mojom::Role::kListItem; if (0 == strcmp(role, "listMarker")) @@ -797,6 +889,8 @@ return ax::mojom::Role::kSvgRoot; if (0 == strcmp(role, "scrollBar")) return ax::mojom::Role::kScrollBar; + if (0 == strcmp(role, "scrollView")) + return ax::mojom::Role::kScrollView; if (0 == strcmp(role, "search")) return ax::mojom::Role::kSearch; if (0 == strcmp(role, "searchBox")) @@ -1027,6 +1121,8 @@ return ax::mojom::Action::kFocus; if (0 == strcmp(action, "getImageData")) return ax::mojom::Action::kGetImageData; + if (0 == strcmp(action, "getTextLocation")) + return ax::mojom::Action::kGetTextLocation; if (0 == strcmp(action, "hitTest")) return ax::mojom::Action::kHitTest; if (0 == strcmp(action, "increment")) @@ -1898,11 +1994,25 @@ return "underline"; case ax::mojom::TextStyle::kLineThrough: return "lineThrough"; + case ax::mojom::TextStyle::kNone: + return "none"; } return ""; } +ax::mojom::TextStyle ParseTextStyle(const char* text_style) { + if (0 == strcmp(text_style, "bold")) + return ax::mojom::TextStyle::kBold; + if (0 == strcmp(text_style, "italic")) + return ax::mojom::TextStyle::kItalic; + if (0 == strcmp(text_style, "underline")) + return ax::mojom::TextStyle::kUnderline; + if (0 == strcmp(text_style, "lineThrough")) + return ax::mojom::TextStyle::kLineThrough; + return ax::mojom::TextStyle::kNone; +} + const char* ToString(ax::mojom::AriaCurrentState aria_current_state) { switch (aria_current_state) { case ax::mojom::AriaCurrentState::kNone:
diff --git a/ui/accessibility/ax_enum_util_unittest.cc b/ui/accessibility/ax_enum_util_unittest.cc new file mode 100644 index 0000000..754886e --- /dev/null +++ b/ui/accessibility/ax_enum_util_unittest.cc
@@ -0,0 +1,198 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/accessibility/ax_enum_util.h" + +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/accessibility/ax_node_data.h" + +namespace ui { + +// Templatized function that tests that for a mojom enum +// such as ax::mojom::Role, ax::mojom::Event, etc. we can +// call ToString() on the enum to get a string, and then +// ParseEnumName() on the string to get back the original +// value. Also tests what happens when we call ToString +// or ParseEnumName on a bogus value. +template <typename T> +void TestEnumStringConversion(T(ParseFunction)(const char*)) { + // Check every valid enum value. + for (int i = static_cast<int>(T::kMinValue); + i <= static_cast<int>(T::kMaxValue); ++i) { + T src = static_cast<T>(i); + std::string str = ToString(src); + auto dst = ParseFunction(str.c_str()); + EXPECT_EQ(src, dst); + } + + // Parse a bogus string. + EXPECT_EQ(T::kNone, ParseFunction("bogus")); + + // Convert a bogus value to a string. + EXPECT_STREQ("", ToString(static_cast<T>(999999))); +} + +// Templatized function that tries calling a setter on AXNodeData +// such as AddIntAttribute, AddFloatAttribute - with each possible +// enum value. +// +// This variant is for cases where the value type is an object. +template <typename T, typename U> +void TestAXNodeDataSetter(void (AXNodeData::*Setter)(T, const U&), + const U& value) { + AXNodeData node_data; + for (int i = static_cast<int>(T::kMinValue) + 1; + i <= static_cast<int>(T::kMaxValue); ++i) { + T attr = static_cast<T>(i); + ((node_data).*(Setter))(attr, value); + } + EXPECT_TRUE(!node_data.ToString().empty()); +} + +// Same as TextAXNodeData, above, but This variant is for +// cases where the value type is POD. +template <typename T, typename U> +void TestAXNodeDataSetter(void (AXNodeData::*Setter)(T, U), U value) { + AXNodeData node_data; + for (int i = static_cast<int>(T::kMinValue) + 1; + i <= static_cast<int>(T::kMaxValue); ++i) { + T attr = static_cast<T>(i); + ((node_data).*(Setter))(attr, value); + } + EXPECT_TRUE(!node_data.ToString().empty()); +} + +TEST(AXEnumUtilTest, Event) { + TestEnumStringConversion<ax::mojom::Event>(ParseEvent); +} + +TEST(AXEnumUtilTest, Role) { + TestEnumStringConversion<ax::mojom::Role>(ParseRole); +} + +TEST(AXEnumUtilTest, State) { + TestEnumStringConversion<ax::mojom::State>(ParseState); +} + +TEST(AXEnumUtilTest, Action) { + TestEnumStringConversion<ax::mojom::Action>(ParseAction); +} + +TEST(AXEnumUtilTest, ActionFlags) { + TestEnumStringConversion<ax::mojom::ActionFlags>(ParseActionFlags); +} + +TEST(AXEnumUtilTest, DefaultActionVerb) { + TestEnumStringConversion<ax::mojom::DefaultActionVerb>( + ParseDefaultActionVerb); +} + +TEST(AXEnumUtilTest, Mutation) { + TestEnumStringConversion<ax::mojom::Mutation>(ParseMutation); +} + +TEST(AXEnumUtilTest, StringAttribute) { + TestEnumStringConversion<ax::mojom::StringAttribute>(ParseStringAttribute); + TestAXNodeDataSetter<ax::mojom::StringAttribute>( + &AXNodeData::AddStringAttribute, std::string()); +} + +TEST(AXEnumUtilTest, IntAttribute) { + TestEnumStringConversion<ax::mojom::IntAttribute>(ParseIntAttribute); + TestAXNodeDataSetter<ax::mojom::IntAttribute>(&AXNodeData::AddIntAttribute, + 0); +} + +TEST(AXEnumUtilTest, FloatAttribute) { + TestEnumStringConversion<ax::mojom::FloatAttribute>(ParseFloatAttribute); + TestAXNodeDataSetter<ax::mojom::FloatAttribute>( + &AXNodeData::AddFloatAttribute, 0.0f); +} + +TEST(AXEnumUtilTest, BoolAttribute) { + TestEnumStringConversion<ax::mojom::BoolAttribute>(ParseBoolAttribute); + TestAXNodeDataSetter<ax::mojom::BoolAttribute>(&AXNodeData::AddBoolAttribute, + false); +} + +TEST(AXEnumUtilTest, IntListAttribute) { + TestEnumStringConversion<ax::mojom::IntListAttribute>(ParseIntListAttribute); + TestAXNodeDataSetter<ax::mojom::IntListAttribute>( + &AXNodeData::AddIntListAttribute, std::vector<int32_t>()); +} + +TEST(AXEnumUtilTest, StringListAttribute) { + TestEnumStringConversion<ax::mojom::StringListAttribute>( + ParseStringListAttribute); + TestAXNodeDataSetter<ax::mojom::StringListAttribute>( + &AXNodeData::AddStringListAttribute, std::vector<std::string>()); +} + +// TODO(dmazzoni) this should be an enum of flags, not an +// enum of every possible bitfield value. +TEST(AXEnumUtilTest, DISABLED_MarkerType) { + TestEnumStringConversion<ax::mojom::MarkerType>(ParseMarkerType); +} + +TEST(AXEnumUtilTest, TextDirection) { + TestEnumStringConversion<ax::mojom::TextDirection>(ParseTextDirection); +} + +TEST(AXEnumUtilTest, TextPosition) { + TestEnumStringConversion<ax::mojom::TextPosition>(ParseTextPosition); +} + +TEST(AXEnumUtilTest, TextStyle) { + TestEnumStringConversion<ax::mojom::TextStyle>(ParseTextStyle); +} + +TEST(AXEnumUtilTest, AriaCurrentState) { + TestEnumStringConversion<ax::mojom::AriaCurrentState>(ParseAriaCurrentState); +} + +TEST(AXEnumUtilTest, HasPopup) { + TestEnumStringConversion<ax::mojom::HasPopup>(ParseHasPopup); +} + +TEST(AXEnumUtilTest, InvalidState) { + TestEnumStringConversion<ax::mojom::InvalidState>(ParseInvalidState); +} + +TEST(AXEnumUtilTest, Restriction) { + TestEnumStringConversion<ax::mojom::Restriction>(ParseRestriction); +} + +TEST(AXEnumUtilTest, CheckedState) { + TestEnumStringConversion<ax::mojom::CheckedState>(ParseCheckedState); +} + +TEST(AXEnumUtilTest, SortDirection) { + TestEnumStringConversion<ax::mojom::SortDirection>(ParseSortDirection); +} + +TEST(AXEnumUtilTest, NameFrom) { + TestEnumStringConversion<ax::mojom::NameFrom>(ParseNameFrom); +} + +TEST(AXEnumUtilTest, DescriptionFrom) { + TestEnumStringConversion<ax::mojom::DescriptionFrom>(ParseDescriptionFrom); +} + +TEST(AXEnumUtilTest, EventFrom) { + TestEnumStringConversion<ax::mojom::EventFrom>(ParseEventFrom); +} + +TEST(AXEnumUtilTest, Gesture) { + TestEnumStringConversion<ax::mojom::Gesture>(ParseGesture); +} + +TEST(AXEnumUtilTest, TextAffinity) { + TestEnumStringConversion<ax::mojom::TextAffinity>(ParseTextAffinity); +} + +TEST(AXEnumUtilTest, TreeOrder) { + TestEnumStringConversion<ax::mojom::TreeOrder>(ParseTreeOrder); +} + +} // namespace ui
diff --git a/ui/accessibility/ax_enums.mojom b/ui/accessibility/ax_enums.mojom index 8f492b15..f8515bb 100644 --- a/ui/accessibility/ax_enums.mojom +++ b/ui/accessibility/ax_enums.mojom
@@ -752,6 +752,7 @@ kItalic, kUnderline, kLineThrough, + kNone, }; enum AriaCurrentState { @@ -774,7 +775,7 @@ kTree, kGrid, kDialog, - kLast = kDialog, + kNone = kFalse }; enum InvalidState { @@ -892,4 +893,3 @@ kUnknown, // The Tree ID is unknown. kToken, // Every other tree ID must have a valid unguessable token. }; -
diff --git a/ui/file_manager/audio_player/elements/audio_player.js b/ui/file_manager/audio_player/elements/audio_player.js index ae96d3e..bbb307a 100644 --- a/ui/file_manager/audio_player/elements/audio_player.js +++ b/ui/file_manager/audio_player/elements/audio_player.js
@@ -422,7 +422,7 @@ /** * Invoked when dragging state of seek bar on control panel is changed. * During the user is dragging it, audio playback is paused temporalily. - * @param {!{detail: {value: boolean}}} e + * @param {!CustomEvent<{value: boolean}>} e */ onSeekingChanged_: function(e) { if (e.detail.value && this.playing) { @@ -438,7 +438,7 @@ }, /** - * @param {!{detail: number}} e + * @param {!CustomEvent<number>} e * @private */ onUpdateTime_: function(e) {
diff --git a/ui/file_manager/audio_player/js/BUILD.gn b/ui/file_manager/audio_player/js/BUILD.gn index 5d9d85a..38aed4c 100644 --- a/ui/file_manager/audio_player/js/BUILD.gn +++ b/ui/file_manager/audio_player/js/BUILD.gn
@@ -28,6 +28,7 @@ deps = [ "../elements:audio_player", "../elements:track_list", + "//ui/file_manager/base/js:app_util", "//ui/file_manager/base/js:filtered_volume_manager", "//ui/file_manager/base/js:mediasession_types", "//ui/file_manager/file_manager/common/js:util",
diff --git a/ui/file_manager/audio_player/js/audio_player.js b/ui/file_manager/audio_player/js/audio_player.js index 8cd3601b..ef7b2fa 100644 --- a/ui/file_manager/audio_player/js/audio_player.js +++ b/ui/file_manager/audio_player/js/audio_player.js
@@ -181,7 +181,7 @@ // playlist member is not changed after entries are resolved. window.appState = /** @type {Playlist} */ ( JSON.parse(JSON.stringify(playlist))); // cloning - util.saveAppState(); + appUtil.saveAppState(); this.isPlaylistExpanded_ = this.player_.playlistExpanded; this.isTrackInfoExpanded_ = this.player_.trackInfoExpanded; @@ -307,7 +307,7 @@ window.appState.position = this.currentTrackIndex_; window.appState.time = 0; - util.saveAppState(); + appUtil.saveAppState(); var entry = this.entries_[this.currentTrackIndex_]; @@ -550,7 +550,7 @@ // Saves new state. window.appState.playlistExpanded = newValue; - util.saveAppState(); + appUtil.saveAppState(); } }; @@ -584,7 +584,7 @@ // Saves new state. window.appState.isTrackInfoExpanded_ = newValue; - util.saveAppState(); + appUtil.saveAppState(); } };
diff --git a/ui/file_manager/audio_player/js/audio_player_scripts.js b/ui/file_manager/audio_player/js/audio_player_scripts.js index 5cdbdf64..df79601 100644 --- a/ui/file_manager/audio_player/js/audio_player_scripts.js +++ b/ui/file_manager/audio_player/js/audio_player_scripts.js
@@ -28,6 +28,7 @@ // <include src="../../file_manager/common/js/file_type.js"> // <include src="../../file_manager/common/js/util.js"> // <include src="../../base/js/mediasession_types.js"> +// <include src="../../base/js/app_util.js"> // <include src="../../base/js/volume_manager_types.js"> // <include src="../../base/js/filtered_volume_manager.js">
diff --git a/ui/file_manager/base/js/BUILD.gn b/ui/file_manager/base/js/BUILD.gn index 607ba92..5d852f1 100644 --- a/ui/file_manager/base/js/BUILD.gn +++ b/ui/file_manager/base/js/BUILD.gn
@@ -17,6 +17,7 @@ js_type_check("closure_compile_module") { deps = [ + ":app_util", ":error_counter", ":filtered_volume_manager", ] @@ -30,6 +31,10 @@ ] } +js_library("app_util") { + externs_list = [ "//ui/file_manager/externs/app_window_common.js" ] +} + js_library("error_counter") { }
diff --git a/ui/file_manager/base/js/app_util.js b/ui/file_manager/base/js/app_util.js new file mode 100644 index 0000000..792dc063 --- /dev/null +++ b/ui/file_manager/base/js/app_util.js
@@ -0,0 +1,177 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** + * @fileoverview Utility functions for creating and operating on the packaged + * AppWindow API. + */ + +const appUtil = {}; + +/** + * Save app launch data to the local storage. + */ +appUtil.saveAppState = () => { + if (!window.appState) { + return; + } + const items = {}; + + items[window.appID] = JSON.stringify(window.appState); + chrome.storage.local.set(items, () => { + if (chrome.runtime.lastError) { + console.error( + 'Failed to save app state: ' + chrome.runtime.lastError.message); + } + }); +}; + +/** + * Updates the app state. + * + * @param {?string} currentDirectoryURL Currently opened directory as an URL.qq + * If null the value is left unchanged. + * @param {?string} selectionURL Currently selected entry as an URL. If null the + * value is left unchanged. + * @param {string|Object=} opt_param Additional parameters, to be stored. If + * null, then left unchanged. + */ +appUtil.updateAppState = (currentDirectoryURL, selectionURL, opt_param) => { + window.appState = window.appState || {}; + if (opt_param !== undefined && opt_param !== null) { + window.appState.params = opt_param; + } + if (currentDirectoryURL !== null) { + window.appState.currentDirectoryURL = currentDirectoryURL; + } + if (selectionURL !== null) { + window.appState.selectionURL = selectionURL; + } + appUtil.saveAppState(); +}; + + +/** + * AppCache is a persistent timestamped key-value storage backed by + * HTML5 local storage. + * + * It is not designed for frequent access. In order to avoid costly + * localStorage iteration all data is kept in a single localStorage item. + * There is no in-memory caching, so concurrent access is _almost_ safe. + * + * TODO(kaznacheev) Reimplement this based on Indexed DB. + */ +appUtil.AppCache = () => {}; + +/** + * Local storage key. + */ +appUtil.AppCache.KEY = 'AppCache'; + +/** + * Max number of items. + */ +appUtil.AppCache.CAPACITY = 100; + +/** + * Default lifetime. + */ +appUtil.AppCache.LIFETIME = 30 * 24 * 60 * 60 * 1000; // 30 days. + +/** + * @param {string} key Key. + * @param {function(number)} callback Callback accepting a value. + */ +appUtil.AppCache.getValue = (key, callback) => { + appUtil.AppCache.read_(map => { + const entry = map[key]; + callback(entry && entry.value); + }); +}; + +/** + * Updates the cache. + * + * @param {string} key Key. + * @param {?(string|number)} value Value. Remove the key if value is null. + * @param {number=} opt_lifetime Maximum time to keep an item (in milliseconds). + */ +appUtil.AppCache.update = (key, value, opt_lifetime) => { + appUtil.AppCache.read_(map => { + if (value != null) { + map[key] = { + value: value, + expire: Date.now() + (opt_lifetime || appUtil.AppCache.LIFETIME) + }; + } else if (key in map) { + delete map[key]; + } else { + return; // Nothing to do. + } + appUtil.AppCache.cleanup_(map); + appUtil.AppCache.write_(map); + }); +}; + +/** + * @param {function(Object)} callback Callback accepting a map of timestamped + * key-value pairs. + * @private + */ +appUtil.AppCache.read_ = callback => { + chrome.storage.local.get(appUtil.AppCache.KEY, values => { + const json = values[appUtil.AppCache.KEY]; + if (json) { + try { + callback(/** @type {Object} */ (JSON.parse(json))); + } catch (e) { + // The local storage item somehow got messed up, start fresh. + } + } + callback({}); + }); +}; + +/** + * @param {Object} map A map of timestamped key-value pairs. + * @private + */ +appUtil.AppCache.write_ = map => { + const items = {}; + items[appUtil.AppCache.KEY] = JSON.stringify(map); + chrome.storage.local.set(items); +}; + +/** + * Remove over-capacity and obsolete items. + * + * @param {Object} map A map of timestamped key-value pairs. + * @private + */ +appUtil.AppCache.cleanup_ = map => { + // Sort keys by ascending timestamps. + const keys = []; + for (const key in map) { + if (map.hasOwnProperty(key)) { + keys.push(key); + } + } + keys.sort((a, b) => { + return map[a].expire - map[b].expire; + }); + + const cutoff = Date.now(); + + let obsolete = 0; + while (obsolete < keys.length && map[keys[obsolete]].expire < cutoff) { + obsolete++; + } + + const overCapacity = Math.max(0, keys.length - appUtil.AppCache.CAPACITY); + + const itemsToDelete = Math.max(obsolete, overCapacity); + for (let i = 0; i != itemsToDelete; i++) { + delete map[keys[i]]; + } +};
diff --git a/ui/file_manager/base/js/error_counter.js b/ui/file_manager/base/js/error_counter.js index 4176fd1f..e779e4a 100644 --- a/ui/file_manager/base/js/error_counter.js +++ b/ui/file_manager/base/js/error_counter.js
@@ -17,7 +17,7 @@ /** * Count uncaught exceptions. */ -window.onerror = function(message, url) { +window.onerror = (message, url) => { window.JSErrorCount++; };
diff --git a/ui/file_manager/base/js/filtered_volume_manager.js b/ui/file_manager/base/js/filtered_volume_manager.js index 8abbad4..7a8ae97 100644 --- a/ui/file_manager/base/js/filtered_volume_manager.js +++ b/ui/file_manager/base/js/filtered_volume_manager.js
@@ -83,27 +83,27 @@ this.disposed_ = false; // Start initialize the VolumeManager. - var queue = new AsyncUtil.Queue(); + const queue = new AsyncUtil.Queue(); if (opt_backgroundPage) { this.backgroundPage_ = opt_backgroundPage; } else { - queue.run(function(callNextStep) { + queue.run(callNextStep => { chrome.runtime.getBackgroundPage(/** @type {function(Window=)} */( - function(opt_backgroundPage) { + opt_backgroundPage => { this.backgroundPage_ = opt_backgroundPage; callNextStep(); - }.bind(this))); - }.bind(this)); + })); + }); } - queue.run(function(callNextStep) { + queue.run(callNextStep => { this.backgroundPage_.volumeManagerFactory.getInstance( - function(volumeManager) { + volumeManager => { this.onReady_(volumeManager); callNextStep(); - }.bind(this)); - }.bind(this)); + }); + }); } /** @@ -177,9 +177,9 @@ cr.dispatchSimpleEvent(this, 'drive-connection-changed'); // Cache volumeInfoList. - var volumeInfoList = []; + const volumeInfoList = []; for (var i = 0; i < this.volumeManager_.volumeInfoList.length; i++) { - var volumeInfo = this.volumeManager_.volumeInfoList.item(i); + const volumeInfo = this.volumeManager_.volumeInfoList.item(i); // TODO(hidehiko): Filter mounted volumes located on Drive File System. if (!this.isAllowedVolume_(volumeInfo)) { continue; @@ -195,7 +195,7 @@ 'splice', this.onVolumeInfoListUpdatedBound_); // Run pending tasks. - var pendingTasks = this.pendingTasks_; + const pendingTasks = this.pendingTasks_; this.pendingTasks_ = null; for (var i = 0; i < pendingTasks.length; i++) { pendingTasks[i](); @@ -252,7 +252,7 @@ */ FilteredVolumeManager.prototype.onVolumeInfoListUpdated_ = function(event) { // Filters some volumes. - var index = event.index; + let index = event.index; for (var i = 0; i < event.index; i++) { var volumeInfo = this.volumeManager_.volumeInfoList.item(i); if (!this.isAllowedVolume_(volumeInfo)) { @@ -260,7 +260,7 @@ } } - var numRemovedVolumes = 0; + let numRemovedVolumes = 0; for (var i = 0; i < event.removed.length; i++) { var volumeInfo = event.removed[i]; if (this.isAllowedVolume_(volumeInfo)) { @@ -268,7 +268,7 @@ } } - var addedVolumes = []; + const addedVolumes = []; for (var i = 0; i < event.added.length; i++) { var volumeInfo = event.added[i]; if (this.isAllowedVolume_(volumeInfo)) { @@ -340,11 +340,11 @@ /** @override */ FilteredVolumeManager.prototype.getDefaultDisplayRoot = function(callback) { - this.ensureInitialized(function() { - var defaultVolume = this.getCurrentProfileVolumeInfo( + this.ensureInitialized(() => { + const defaultVolume = this.getCurrentProfileVolumeInfo( VolumeManagerCommon.VolumeType.DOWNLOADS); if (defaultVolume) { - defaultVolume.resolveDisplayRoot(callback, function() { + defaultVolume.resolveDisplayRoot(callback, () => { // defaultVolume is DOWNLOADS and resolveDisplayRoot should succeed. throw new Error( 'Unexpectedly failed to obtain the default display root.'); @@ -353,7 +353,7 @@ console.warn('Unexpectedly failed to obtain the default display root.'); callback(null); } - }.bind(this)); + }); }; /** @@ -363,7 +363,7 @@ * @return {EntryLocation} Location information. */ FilteredVolumeManager.prototype.getLocationInfo = function(entry) { - var locationInfo = + const locationInfo = this.volumeManager_ && this.volumeManager_.getLocationInfo(entry); if (!locationInfo) { return null; @@ -377,7 +377,7 @@ /** @override */ FilteredVolumeManager.prototype.findByDevicePath = function(devicePath) { - for (var i = 0; i < this.volumeInfoList.length; i++) { + for (let i = 0; i < this.volumeInfoList.length; i++) { const volumeInfo = this.volumeInfoList.item(i); if (volumeInfo.devicePath && volumeInfo.devicePath === devicePath) { return this.filterDisallowedVolume_(volumeInfo); @@ -450,11 +450,11 @@ */ FilteredVolumeManager.prototype.configure = function(volumeInfo) { if (this.pendingTasks_) { - return new Promise(function(fulfill, reject) { - this.pendingTasks_.push(function() { + return new Promise((fulfill, reject) => { + this.pendingTasks_.push(() => { return this.volumeManager_.configure(volumeInfo).then(fulfill, reject); - }.bind(this)); - }.bind(this)); + }); + }); } return this.volumeManager_.configure(volumeInfo);
diff --git a/ui/file_manager/base/js/volume_manager_types.js b/ui/file_manager/base/js/volume_manager_types.js index bbe0da5d5..b20383a0 100644 --- a/ui/file_manager/base/js/volume_manager_types.js +++ b/ui/file_manager/base/js/volume_manager_types.js
@@ -5,14 +5,14 @@ /** * Namespace for common types. */ -var VolumeManagerCommon = {}; +const VolumeManagerCommon = {}; /** * Paths that can be handled by the dialog opener in native code. * @enum {string} * @const */ -var AllowedPaths = { +const AllowedPaths = { NATIVE_PATH: 'nativePath', NATIVE_OR_DRIVE_PATH: 'nativeOrDrivePath', ANY_PATH: 'anyPath', @@ -263,7 +263,7 @@ * @param {VolumeManagerCommon.VolumeType} type * @return {boolean} */ -VolumeManagerCommon.VolumeType.isNative = function(type) { +VolumeManagerCommon.VolumeType.isNative = type => { return type === VolumeManagerCommon.VolumeType.DOWNLOADS || type === VolumeManagerCommon.VolumeType.ANDROID_FILES || type === VolumeManagerCommon.VolumeType.CROSTINI || @@ -278,7 +278,7 @@ * @param {VolumeManagerCommon.RootType} rootType RootType * @return {VolumeManagerCommon.VolumeType} */ -VolumeManagerCommon.getVolumeTypeFromRootType = function(rootType) { +VolumeManagerCommon.getVolumeTypeFromRootType = rootType => { switch (rootType) { case VolumeManagerCommon.RootType.DOWNLOADS: return VolumeManagerCommon.VolumeType.DOWNLOADS; @@ -320,7 +320,7 @@ * @param {VolumeManagerCommon.VolumeType} volumeType . * @return {VolumeManagerCommon.RootType} */ -VolumeManagerCommon.getRootTypeFromVolumeType = function(volumeType) { +VolumeManagerCommon.getRootTypeFromVolumeType = volumeType => { switch (volumeType) { case VolumeManagerCommon.VolumeType.ANDROID_FILES: return VolumeManagerCommon.RootType.ANDROID_FILES; @@ -376,7 +376,7 @@ * @param {string} volumeId Volume ID. * @return {VolumeManagerCommon.MediaViewRootType} */ -VolumeManagerCommon.getMediaViewRootTypeFromVolumeId = function(volumeId) { +VolumeManagerCommon.getMediaViewRootTypeFromVolumeId = volumeId => { return /** @type {VolumeManagerCommon.MediaViewRootType} */ ( volumeId.split(':', 2)[1]); }; @@ -411,9 +411,9 @@ * file is newly mounted, or when opened a one already mounted. * @param {!DirectoryEntry} mountPoint The root directory of the mounted * volume. - * @return {!CustomEvent} + * @return {!CustomEvent<!DirectoryEntry>} */ -VolumeManagerCommon.createArchiveOpenedEvent = function(mountPoint) { +VolumeManagerCommon.createArchiveOpenedEvent = mountPoint => { return new CustomEvent( VolumeManagerCommon.ARCHIVE_OPENED_EVENT_TYPE, {detail: {mountPoint: mountPoint}});
diff --git a/ui/file_manager/externs/app_window_common.js b/ui/file_manager/externs/app_window_common.js index a5117172..bfb0db2 100644 --- a/ui/file_manager/externs/app_window_common.js +++ b/ui/file_manager/externs/app_window_common.js
@@ -4,7 +4,7 @@ /** * This definition is required by - * ui/file_manager/file_manager/common/js/util.js. + * ui/file_manager/base/js/app_util.js. * @type {string} */ Window.prototype.appID;
diff --git a/ui/file_manager/file_manager/background/js/BUILD.gn b/ui/file_manager/file_manager/background/js/BUILD.gn index 189b3b21..703de75 100644 --- a/ui/file_manager/file_manager/background/js/BUILD.gn +++ b/ui/file_manager/file_manager/background/js/BUILD.gn
@@ -103,7 +103,7 @@ deps = [ ":app_windows", "../../common/js:async_util", - "../../common/js:util", + "//ui/file_manager/base/js:app_util", ] }
diff --git a/ui/file_manager/file_manager/background/js/app_window_wrapper.js b/ui/file_manager/file_manager/background/js/app_window_wrapper.js index 59a9537a..2570b54 100644 --- a/ui/file_manager/file_manager/background/js/app_window_wrapper.js +++ b/ui/file_manager/file_manager/background/js/app_window_wrapper.js
@@ -7,9 +7,9 @@ * * Expects the following from the app scripts: * 1. The page load handler should initialize the app using |window.appState| - * and call |util.saveAppState|. + * and call |appUtil.saveAppState|. * 2. Every time the app state changes the app should update |window.appState| - * and call |util.saveAppState| . + * and call |appUtil.saveAppState| . * 3. The app may have |unload| function to persist the app state that does not * fit into |window.appState|. * @@ -95,14 +95,14 @@ // Get similar windows, it means with the same initial url, eg. different // main windows of the Files app. - var similarWindows = window.getSimilarWindows(this.url_); + const similarWindows = window.getSimilarWindows(this.url_); // Restore maximized windows, to avoid hiding them to tray, which can be // confusing for users. this.queue.run(function(callback) { - for (var index = 0; index < similarWindows.length; index++) { + for (let index = 0; index < similarWindows.length; index++) { if (similarWindows[index].isMaximized()) { - var createWindowAndRemoveListener = function() { + const createWindowAndRemoveListener = function() { similarWindows[index].onRestored.removeListener( createWindowAndRemoveListener); callback(); @@ -118,11 +118,11 @@ }); // Obtains the last geometry and window state (maximized or not). - var lastBounds; - var isMaximized = false; + let lastBounds; + let isMaximized = false; this.queue.run(function(callback) { - var boundsKey = AppWindowWrapper.makeGeometryKey(this.url_); - var maximizedKey = AppWindowWrapper.MAXIMIZED_KEY_; + const boundsKey = AppWindowWrapper.makeGeometryKey(this.url_); + const maximizedKey = AppWindowWrapper.MAXIMIZED_KEY_; chrome.storage.local.get([boundsKey, maximizedKey], function(preferences) { if (!chrome.runtime.lastError) { lastBounds = preferences[boundsKey]; @@ -165,37 +165,37 @@ // After creating. this.queue.run(function(callback) { // If there is another window in the same position, shift the window. - var makeBoundsKey = function(bounds) { + const makeBoundsKey = function(bounds) { return bounds.left + '/' + bounds.top; }; - var notAvailablePositions = {}; - for (var i = 0; i < similarWindows.length; i++) { - var key = makeBoundsKey(similarWindows[i].getBounds()); + const notAvailablePositions = {}; + for (let i = 0; i < similarWindows.length; i++) { + let key = makeBoundsKey(similarWindows[i].getBounds()); notAvailablePositions[key] = true; } - var candidateBounds = this.window_.getBounds(); + const candidateBounds = this.window_.getBounds(); while (true) { - var key = makeBoundsKey(candidateBounds); + let key = makeBoundsKey(candidateBounds); if (!notAvailablePositions[key]) { break; } // Make the position available to avoid an infinite loop. notAvailablePositions[key] = false; - var nextLeft = candidateBounds.left + AppWindowWrapper.SHIFT_DISTANCE; - var nextRight = nextLeft + candidateBounds.width; + const nextLeft = candidateBounds.left + AppWindowWrapper.SHIFT_DISTANCE; + const nextRight = nextLeft + candidateBounds.width; candidateBounds.left = nextRight >= screen.availWidth ? nextRight % screen.availWidth : nextLeft; - var nextTop = candidateBounds.top + AppWindowWrapper.SHIFT_DISTANCE; - var nextBottom = nextTop + candidateBounds.height; + const nextTop = candidateBounds.top + AppWindowWrapper.SHIFT_DISTANCE; + const nextBottom = nextTop + candidateBounds.height; candidateBounds.top = nextBottom >= screen.availHeight ? nextBottom % screen.availHeight : nextTop; } this.window_.moveTo(candidateBounds.left, candidateBounds.top); // Save the properties. - var appWindow = this.window_; + const appWindow = this.window_; window.appWindows[this.id_] = appWindow; - var contentWindow = appWindow.contentWindow; + const contentWindow = appWindow.contentWindow; contentWindow.appID = this.id_; contentWindow.appState = this.appState_; contentWindow.appReopen = reopen; @@ -222,13 +222,13 @@ */ AppWindowWrapper.prototype.onClosed_ = function() { // Remember the last window state (maximized or normal). - var preferences = {}; + const preferences = {}; preferences[AppWindowWrapper.MAXIMIZED_KEY_] = this.window_.isMaximized(); chrome.storage.local.set(preferences); // Unload the window. - var appWindow = this.window_; - var contentWindow = this.window_.contentWindow; + const appWindow = this.window_; + const contentWindow = this.window_.contentWindow; if (contentWindow.unload) { contentWindow.unload(); } @@ -238,7 +238,7 @@ // Updates preferences. if (contentWindow.saveOnExit) { contentWindow.saveOnExit.forEach(function(entry) { - util.AppCache.update(entry.key, entry.value); + appUtil.AppCache.update(entry.key, entry.value); }); } chrome.storage.local.remove(this.id_); // Forget the persisted state. @@ -253,7 +253,7 @@ */ AppWindowWrapper.prototype.onBoundsChanged_ = function() { if (!this.window_.isMaximized()) { - var preferences = {}; + const preferences = {}; preferences[AppWindowWrapper.makeGeometryKey(this.url_)] = this.window_.getBounds(); chrome.storage.local.set(preferences); @@ -327,7 +327,7 @@ */ SingletonAppWindowWrapper.prototype.reopen = function(opt_callback) { chrome.storage.local.get(this.id_, function(items) { - var value = items[this.id_]; + const value = items[this.id_]; if (!value) { opt_callback && opt_callback(); return; // No app state persisted.
diff --git a/ui/file_manager/file_manager/background/js/app_windows.js b/ui/file_manager/file_manager/background/js/app_windows.js index f964f2d..c75f62a 100644 --- a/ui/file_manager/file_manager/background/js/app_windows.js +++ b/ui/file_manager/file_manager/background/js/app_windows.js
@@ -14,8 +14,8 @@ * @return {Array<chrome.app.window.AppWindow>} List of similar windows. */ window.getSimilarWindows = function(url) { - var result = []; - for (var appID in window.appWindows) { + const result = []; + for (const appID in window.appWindows) { if (window.appWindows[appID].contentWindow.appInitialURL === url) { result.push(window.appWindows[appID]); }
diff --git a/ui/file_manager/file_manager/background/js/background.js b/ui/file_manager/file_manager/background/js/background.js index 6698d447..9bfaf42 100644 --- a/ui/file_manager/file_manager/background/js/background.js +++ b/ui/file_manager/file_manager/background/js/background.js
@@ -308,13 +308,13 @@ * @type {!string} * @const */ -var DIALOG_ID_PREFIX = 'dialog#'; +const DIALOG_ID_PREFIX = 'dialog#'; /** * Value of the next file manager dialog ID. * @type {number} */ -var nextFileManagerDialogID = 0; +let nextFileManagerDialogID = 0; /** * Registers dialog window to the background page. @@ -322,7 +322,7 @@ * @param {!Window} dialogWindow Window of the dialog. */ function registerDialog(dialogWindow) { - var id = DIALOG_ID_PREFIX + (nextFileManagerDialogID++); + const id = DIALOG_ID_PREFIX + (nextFileManagerDialogID++); window.background.dialogs[id] = dialogWindow; if (window.IN_TEST) { dialogWindow.IN_TEST = true; @@ -340,7 +340,7 @@ * @private */ FileBrowserBackgroundImpl.prototype.onExecute_ = function(action, details) { - var appState = { + const appState = { params: {action: action}, // It is not allowed to call getParent() here, since there may be // no permissions to access it at this stage. Therefore we are passing @@ -370,7 +370,7 @@ // The app just launched. Remove window state records that are not needed // any more. chrome.storage.local.get(function(items) { - for (var key in items) { + for (const key in items) { if (items.hasOwnProperty(key)) { if (key.match(FILES_ID_PATTERN)) { chrome.storage.local.remove(key); @@ -387,7 +387,7 @@ }; /** @const {!string} */ -var GPLUS_PHOTOS_APP_ID = 'efjnaogkjbogokcnohkmnjdojkikgobo'; +const GPLUS_PHOTOS_APP_ID = 'efjnaogkjbogokcnohkmnjdojkikgobo'; /** * Handles a message received via chrome.runtime.sendMessageExternal. @@ -410,14 +410,14 @@ FileBrowserBackgroundImpl.prototype.onRestarted_ = function() { // Reopen file manager windows. chrome.storage.local.get(function(items) { - for (var key in items) { + for (const key in items) { if (items.hasOwnProperty(key)) { - var match = key.match(FILES_ID_PATTERN); + const match = key.match(FILES_ID_PATTERN); if (match) { metrics.startInterval('Load.BackgroundRestart'); - var id = Number(match[1]); + const id = Number(match[1]); try { - var appState = /** @type {Object} */ (JSON.parse(items[key])); + const appState = /** @type {Object} */ (JSON.parse(items[key])); launcher.launchFileManager(appState, id, undefined, function() { metrics.recordInterval('Load.BackgroundRestart'); }); @@ -444,7 +444,7 @@ launcher.launchFileManager(); return; } - var appState = { + const appState = { // Do not clone the selection url, only the current directory. currentDirectoryURL: window.appWindows[key]. contentWindow.appState.currentDirectoryURL @@ -465,7 +465,7 @@ */ FileBrowserBackgroundImpl.prototype.findFocusedWindow_ = function() { return new Promise(function(fulfill, reject) { - for (var key in window.appWindows) { + for (const key in window.appWindows) { try { if (window.appWindows[key].contentWindow.isFocused()) { fulfill(key); @@ -530,7 +530,7 @@ // console as an unchecked error. // - [1] https://developer.chrome.com/extensions/contextMenus#method-remove chrome.contextMenus.remove('new-window', function() { - var ignore = chrome.runtime.lastError; + const ignore = chrome.runtime.lastError; }); } catch (ignore) { // There is no way to detect if the context menu is already added, therefore
diff --git a/ui/file_manager/file_manager/background/js/background_base.js b/ui/file_manager/file_manager/background/js/background_base.js index f4cefd1..58b012d 100644 --- a/ui/file_manager/file_manager/background/js/background_base.js +++ b/ui/file_manager/file_manager/background/js/background_base.js
@@ -3,7 +3,7 @@ // found in the LICENSE file. /** @typedef {function(!Array<string>):!Promise} */ -var LaunchHandler; +let LaunchHandler; /** * Root class of the background page. @@ -55,7 +55,7 @@ // before resolveIsolatedEntries(). return volumeManagerFactory.getInstance(); }).then(function() { - var isolatedEntries = launchData.items.map(function(item) { + const isolatedEntries = launchData.items.map(function(item) { return item.entry; }); @@ -66,7 +66,7 @@ chrome.fileManagerPrivate.resolveIsolatedEntries( isolatedEntries, function(externalEntries) { - var urls = util.entriesToURLs(externalEntries); + const urls = util.entriesToURLs(externalEntries); if (this.launchHandler_) { this.launchHandler_(urls); }
diff --git a/ui/file_manager/file_manager/background/js/background_common_scripts.js b/ui/file_manager/file_manager/background/js/background_common_scripts.js index 593ad4d6..02e6e1d2 100644 --- a/ui/file_manager/file_manager/background/js/background_common_scripts.js +++ b/ui/file_manager/file_manager/background/js/background_common_scripts.js
@@ -14,7 +14,11 @@ // <include src="../../common/js/file_type.js"> // <include src="../../common/js/metrics_base.js"> // <include src="../../common/js/files_app_entry_types.js"> +// <include src="../../../base/js/app_util.js"> + +/* TODO(tapted): Remove this when it is specific to the files app */ // <include src="../../common/js/util.js"> + // <include src="../../../base/js/volume_manager_types.js"> // <include src="app_window_wrapper.js"> // <include src="app_windows.js">
diff --git a/ui/file_manager/file_manager/background/js/device_handler.js b/ui/file_manager/file_manager/background/js/device_handler.js index 6426378..956128e 100644 --- a/ui/file_manager/file_manager/background/js/device_handler.js +++ b/ui/file_manager/file_manager/background/js/device_handler.js
@@ -213,7 +213,7 @@ * @return {string} Notification ID. */ DeviceHandler.Notification.prototype.show = function(devicePath, opt_message) { - var notificationId = this.makeId_(devicePath); + const notificationId = this.makeId_(devicePath); this.queue_.run(function(callback) { this.showInternal_(notificationId, opt_message || null, callback); }.bind(this)); @@ -226,7 +226,7 @@ * @param {string} devicePath Device path. */ DeviceHandler.Notification.prototype.showOnce = function(devicePath) { - var notificationId = this.makeId_(devicePath); + const notificationId = this.makeId_(devicePath); this.queue_.run(function(callback) { chrome.notifications.getAll(function(idList) { if (idList.indexOf(notificationId) !== -1) { @@ -248,7 +248,7 @@ */ DeviceHandler.Notification.prototype.showInternal_ = function( notificationId, message, callback) { - var buttons = + const buttons = this.buttonLabel ? [{title: str(this.buttonLabel)}] : undefined; chrome.notifications.create( notificationId, @@ -368,7 +368,7 @@ }; DeviceHandler.prototype.onMountCompletedInternal_ = function(event) { - var volume = event.volumeMetadata; + const volume = event.volumeMetadata; if (event.status === 'success' && event.shouldNotify) { if (event.eventType === 'mount') { @@ -382,7 +382,7 @@ return; } - var getFirstStatus = function(event) { + const getFirstStatus = function(event) { if (event.status === 'success') { return DeviceHandler.MountStatus.SUCCESS; } else if (event.volumeMetadata.isParentDevice) { @@ -437,7 +437,7 @@ // Show the notification for the current errors. // If there is no error, do not show/update the notification. - var message; + let message; switch (this.mountStatus_[volume.devicePath]) { case DeviceHandler.MountStatus.MULTIPART_ERROR: message = volume.deviceLabel ? @@ -481,7 +481,7 @@ DeviceHandler.prototype.onMount_ = function(event) { // If this is remounting, which happens when resuming Chrome OS, the device // has already inserted to the computer. So we suppress the notification. - var metadata = event.volumeMetadata; + const metadata = event.volumeMetadata; volumeManagerFactory.getInstance() .then( /** @@ -573,9 +573,9 @@ * @private */ DeviceHandler.prototype.onNotificationClickedInternal_ = function(id) { - var pos = id.indexOf(':'); - var type = id.substr(0, pos); - var devicePath = id.substr(pos + 1); + const pos = id.indexOf(':'); + const type = id.substr(0, pos); + const devicePath = id.substr(pos + 1); if (type === 'deviceNavigation' || type === 'deviceFail') { chrome.notifications.clear(id, function() {}); this.openMediaDirectory_(null, devicePath, null); @@ -594,7 +594,7 @@ */ DeviceHandler.prototype.openMediaDirectory_ = function(volumeId, devicePath, filePath) { - var event = new Event(DeviceHandler.VOLUME_NAVIGATION_REQUESTED); + const event = new Event(DeviceHandler.VOLUME_NAVIGATION_REQUESTED); event.volumeId = volumeId; event.devicePath = devicePath; event.filePath = filePath;
diff --git a/ui/file_manager/file_manager/background/js/device_handler_unittest.js b/ui/file_manager/file_manager/background/js/device_handler_unittest.js index d282fa7c..d887442 100644 --- a/ui/file_manager/file_manager/background/js/device_handler_unittest.js +++ b/ui/file_manager/file_manager/background/js/device_handler_unittest.js
@@ -4,13 +4,13 @@ 'use strict'; /** @type {!MockVolumeManager} */ -var volumeManager; +let volumeManager; /** @type {!DeviceHandler} */ -var deviceHandler; +let deviceHandler; /** Mock chrome APIs. */ -var mockChrome; +let mockChrome; // Set up the test components. function setUp() { @@ -51,7 +51,7 @@ reportPromise( mockChrome.notifications.resolver.promise.then(function(notifications) { assertEquals(1, Object.keys(notifications).length); - var options = notifications['deviceNavigation:/device/path']; + const options = notifications['deviceNavigation:/device/path']; assertEquals('REMOVABLE_DEVICE_NAVIGATION_MESSAGE', options.message); assertTrue(options.isClickable); }), @@ -59,7 +59,7 @@ } function testRemovableMediaDeviceWithImportEnabled(callback) { - var storage = new MockChromeStorageAPI(); + const storage = new MockChromeStorageAPI(); setupFileSystem( VolumeManagerCommon.VolumeType.REMOVABLE, @@ -69,7 +69,7 @@ '/DCIM/grandma.jpg' ]); - var resolver = new importer.Resolver(); + const resolver = new importer.Resolver(); // Handle media device navigation requests. deviceHandler.addEventListener( @@ -93,7 +93,7 @@ } function testMtpMediaDeviceWithImportEnabled(callback) { - var storage = new MockChromeStorageAPI(); + const storage = new MockChromeStorageAPI(); setupFileSystem( VolumeManagerCommon.VolumeType.MTP, @@ -103,7 +103,7 @@ '/dcim/grandpa.jpg' ]); - var resolver = new importer.Resolver(); + const resolver = new importer.Resolver(); // Handle media device navigation requests. deviceHandler.addEventListener( @@ -270,7 +270,7 @@ reportPromise( mockChrome.notifications.resolver.promise.then(function(notifications) { assertFalse(!!mockChrome.notifications.items['device:/device/path']); - var item = mockChrome.notifications.items['deviceFail:/device/path']; + const item = mockChrome.notifications.items['deviceFail:/device/path']; assertEquals('DEVICE_UNKNOWN_DEFAULT_MESSAGE', item.message); // "Format device" button should appear. assertEquals('DEVICE_UNKNOWN_BUTTON_LABEL', item.buttons[0].title); @@ -295,7 +295,7 @@ reportPromise( mockChrome.notifications.resolver.promise.then(function(notifications) { assertFalse(!!mockChrome.notifications.items['device:/device/path']); - var item = mockChrome.notifications.items['deviceFail:/device/path']; + const item = mockChrome.notifications.items['deviceFail:/device/path']; assertEquals('DEVICE_UNKNOWN_DEFAULT_MESSAGE', item.message); // "Format device" button should not appear. assertFalse(!!item.buttons); @@ -373,7 +373,7 @@ }); }) .then(function() { - var notifications = mockChrome.notifications.items; + const notifications = mockChrome.notifications.items; assertEquals( 2, Object.keys(notifications).length); assertEquals( @@ -579,11 +579,11 @@ } function testNotificationClicked(callback) { - var devicePath = '/device/path'; - var notificationId = 'deviceNavigation:' + devicePath; + const devicePath = '/device/path'; + const notificationId = 'deviceNavigation:' + devicePath; // Add a listener for navigation-requested events. - var resolver = new importer.Resolver(); + const resolver = new importer.Resolver(); deviceHandler.addEventListener( DeviceHandler.VOLUME_NAVIGATION_REQUESTED, function(event) { resolver.resolve(event); @@ -640,11 +640,11 @@ */ function setupFileSystem(volumeType, volumeId, fileNames) { /** @type {!MockVolumeManager}*/ - var mockVolumeManager = volumeManager; - var volumeInfo = mockVolumeManager.createVolumeInfo( + const mockVolumeManager = volumeManager; + const volumeInfo = mockVolumeManager.createVolumeInfo( volumeType, volumeId, 'A volume known as ' + volumeId); assertTrue(!!volumeInfo); - var mockFileSystem = /** @type {!MockFileSystem} */ + const mockFileSystem = /** @type {!MockFileSystem} */ (volumeInfo.fileSystem); mockFileSystem.populate(fileNames); return volumeInfo;
diff --git a/ui/file_manager/file_manager/background/js/drive_sync_handler.js b/ui/file_manager/file_manager/background/js/drive_sync_handler.js index 59e97759..84ab097 100644 --- a/ui/file_manager/file_manager/background/js/drive_sync_handler.js +++ b/ui/file_manager/file_manager/background/js/drive_sync_handler.js
@@ -238,7 +238,7 @@ */ DriveSyncHandlerImpl.prototype.onDriveSyncError_ = function(event) { window.webkitResolveLocalFileSystemURL(event.fileUrl, function(entry) { - var item = new ProgressCenterItem(); + const item = new ProgressCenterItem(); item.type = ProgressItemType.SYNC; item.quiet = true; item.state = ProgressItemState.ERROR; @@ -277,7 +277,7 @@ */ DriveSyncHandlerImpl.prototype.onNotificationButtonClicked_ = function( notificationId, buttonIndex) { - var expectedId = DriveSyncHandlerImpl.DISABLED_MOBILE_SYNC_NOTIFICATION_ID_; + const expectedId = DriveSyncHandlerImpl.DISABLED_MOBILE_SYNC_NOTIFICATION_ID_; if (notificationId !== expectedId) { return; }
diff --git a/ui/file_manager/file_manager/background/js/drive_sync_handler_unittest.js b/ui/file_manager/file_manager/background/js/drive_sync_handler_unittest.js index 8da5c913a..3256216 100644 --- a/ui/file_manager/file_manager/background/js/drive_sync_handler_unittest.js +++ b/ui/file_manager/file_manager/background/js/drive_sync_handler_unittest.js
@@ -6,18 +6,18 @@ /** * @type {!MockProgressCenter} */ -var progressCenter; +let progressCenter; /** * @type {!DriveSyncHandlerImpl} */ -var driveSyncHandler; +let driveSyncHandler; /** * Mock chrome APIs. * @type {Object} */ -var mockChrome = {}; +const mockChrome = {}; mockChrome.fileManagerPrivate = { onFileTransfersUpdated: { @@ -167,7 +167,7 @@ // Check that this created one item. assertEquals(1, progressCenter.getItemCount()); - var item = progressCenter.items['drive-sync']; + let item = progressCenter.items['drive-sync']; assertEquals(ProgressItemState.PROGRESSING, item.state); assertTrue(driveSyncHandler.syncing);
diff --git a/ui/file_manager/file_manager/background/js/duplicate_finder.js b/ui/file_manager/file_manager/background/js/duplicate_finder.js index 368b0b7..d79ea56 100644 --- a/ui/file_manager/file_manager/background/js/duplicate_finder.js +++ b/ui/file_manager/file_manager/background/js/duplicate_finder.js
@@ -58,15 +58,15 @@ importer.DriveDuplicateFinder.prototype.computeHash_ = function(entry) { return importer.createMetadataHashcode(entry).then(function(hashcode) { // Cache key is the concatination of metadata hashcode and URL. - var cacheKey = hashcode + '|' + entry.toURL(); + const cacheKey = hashcode + '|' + entry.toURL(); if (this.hashCache_.hasKey(cacheKey)) { return this.hashCache_.get(cacheKey); } - var hashPromise = new Promise( + const hashPromise = new Promise( (/** @this {importer.DriveDuplicateFinder} */ function(resolve, reject) { - var startTime = new Date().getTime(); + const startTime = new Date().getTime(); chrome.fileManagerPrivate.computeChecksum( entry, (/** @@ -74,7 +74,7 @@ * @this {importer.DriveDuplicateFinder} */ function(result) { - var elapsedTime = new Date().getTime() - startTime; + const elapsedTime = new Date().getTime() - startTime; // Send the timing to GA only if it is sorta exceptionally long. // A one second, CPU intensive operation, is pretty long. if (elapsedTime >= @@ -142,7 +142,7 @@ return new Promise( (/** @this {importer.DriveDuplicateFinder} */ function(resolve, reject) { - var startTime = new Date().getTime(); + const startTime = new Date().getTime(); chrome.fileManagerPrivate.searchFilesByHashes( volumeId, [hash], @@ -151,7 +151,7 @@ * @this {importer.DriveDuplicateFinder} */ function(urls) { - var elapsedTime = new Date().getTime() - startTime; + const elapsedTime = new Date().getTime() - startTime; // Send the timing to GA only if it is sorta exceptionally long. if (elapsedTime >= importer.DriveDuplicateFinder.SEARCH_EVENT_THRESHOLD_) { @@ -277,7 +277,7 @@ * @return {!importer.DispositionChecker.CheckerFunction} */ importer.DispositionChecker.createChecker = function(historyLoader) { - var checker = new importer.DispositionChecker( + const checker = new importer.DispositionChecker( historyLoader, new importer.DriveDuplicateFinder()); return checker.getDisposition.bind(checker); };
diff --git a/ui/file_manager/file_manager/background/js/duplicate_finder_unittest.js b/ui/file_manager/file_manager/background/js/duplicate_finder_unittest.js index b3b9967..ec0bb83 100644 --- a/ui/file_manager/file_manager/background/js/duplicate_finder_unittest.js +++ b/ui/file_manager/file_manager/background/js/duplicate_finder_unittest.js
@@ -3,31 +3,31 @@ // found in the LICENSE file. /** @type {!importer.DriveDuplicateFinder} */ -var duplicateFinder; +let duplicateFinder; /** @type {VolumeInfo} */ -var drive; +let drive; /** * Map of file URL to hash code. * @type {!Object<string>} */ -var hashes = {}; +const hashes = {}; /** * Map of hash code to file URL. * @type {!Object<string>} */ -var fileUrls = {}; +const fileUrls = {}; /** @type {!MockFileSystem} */ -var fileSystem; +let fileSystem; /** @type {!importer.TestImportHistory} */ -var testHistory; +let testHistory; /** @type {importer.DispositionChecker.CheckerFunction} */ -var getDisposition; +let getDisposition; window.metrics = { recordTime: function() {}, @@ -50,7 +50,7 @@ * @param {function(!Object<Array<string>>)} callback */ searchFilesByHashes: function(volumeId, hashes, callback) { - var result = {}; + const result = {}; hashes.forEach( /** @param {string} hash */ function(hash) { @@ -67,7 +67,7 @@ // importer.setupTestLogger(); fileSystem = new MockFileSystem('fake-filesystem'); - var volumeManager = new MockVolumeManager(); + const volumeManager = new MockVolumeManager(); drive = volumeManager.getCurrentProfileVolumeInfo( VolumeManagerCommon.VolumeType.DRIVE); assertTrue(drive != null); @@ -81,9 +81,9 @@ // Verifies the correct result when a duplicate exists. function testCheckDuplicateTrue(callback) { - var filePaths = ['/foo.txt']; - var fileHashes = ['abc123']; - var files = setupHashes(filePaths, fileHashes); + const filePaths = ['/foo.txt']; + const fileHashes = ['abc123']; + const files = setupHashes(filePaths, fileHashes); reportPromise( duplicateFinder.isDuplicate(files[0]) @@ -96,14 +96,14 @@ // Verifies the correct result when a duplicate doesn't exist. function testCheckDuplicateFalse(callback) { - var filePaths = ['/foo.txt']; - var fileHashes = ['abc123']; - var files = setupHashes(filePaths, fileHashes); + const filePaths = ['/foo.txt']; + const fileHashes = ['abc123']; + const files = setupHashes(filePaths, fileHashes); // Make another file. - var newFilePath = '/bar.txt'; + const newFilePath = '/bar.txt'; fileSystem.populate([newFilePath]); - var newFile = /** @type {!FileEntry} */ (fileSystem.entries[newFilePath]); + const newFile = /** @type {!FileEntry} */ (fileSystem.entries[newFilePath]); reportPromise( duplicateFinder.isDuplicate(newFile) @@ -115,9 +115,9 @@ } function testDispositionChecker_ContentDupe(callback) { - var filePaths = ['/foo.txt']; - var fileHashes = ['abc123']; - var files = setupHashes(filePaths, fileHashes); + const filePaths = ['/foo.txt']; + const fileHashes = ['abc123']; + const files = setupHashes(filePaths, fileHashes); reportPromise( getDisposition( @@ -130,9 +130,9 @@ } function testDispositionChecker_HistoryDupe(callback) { - var filePaths = ['/foo.txt']; - var fileHashes = ['abc123']; - var files = setupHashes(filePaths, fileHashes); + const filePaths = ['/foo.txt']; + const fileHashes = ['abc123']; + const files = setupHashes(filePaths, fileHashes); testHistory.importedPaths['/foo.txt'] = [importer.Destination.GOOGLE_DRIVE]; @@ -148,13 +148,13 @@ } function testDispositionChecker_Original(callback) { - var filePaths = ['/foo.txt']; - var fileHashes = ['abc123']; - var files = setupHashes(filePaths, fileHashes); + const filePaths = ['/foo.txt']; + const fileHashes = ['abc123']; + const files = setupHashes(filePaths, fileHashes); - var newFilePath = '/bar.txt'; + const newFilePath = '/bar.txt'; fileSystem.populate([newFilePath]); - var newFile = /** @type {!FileEntry} */ (fileSystem.entries[newFilePath]); + const newFile = /** @type {!FileEntry} */ (fileSystem.entries[newFilePath]); reportPromise( getDisposition( @@ -174,7 +174,7 @@ // Set up a filesystem with some files. fileSystem.populate(filePaths); - var files = filePaths.map( + const files = filePaths.map( function(filename) { return fileSystem.entries[filename]; });
diff --git a/ui/file_manager/file_manager/background/js/file_operation_handler.js b/ui/file_manager/file_manager/background/js/file_operation_handler.js index 081e23a..af73ba6 100644 --- a/ui/file_manager/file_manager/background/js/file_operation_handler.js +++ b/ui/file_manager/file_manager/background/js/file_operation_handler.js
@@ -9,7 +9,7 @@ * @constructor * @struct */ -var FileOperationHandler = function(fileOperationManager, progressCenter) { +const FileOperationHandler = function(fileOperationManager, progressCenter) { /** * File operation manager. * @type {!FileOperationManager} @@ -77,7 +77,7 @@ } case util.FileOperationErrorType.FILESYSTEM_ERROR: - var detail = util.getFileErrorString(event.error.data.name); + const detail = util.getFileErrorString(event.error.data.name); switch (event.status.operationType) { case 'COPY': return strf('COPY_FILESYSTEM_ERROR', detail); case 'MOVE': return strf('MOVE_FILESYSTEM_ERROR', detail); @@ -102,7 +102,7 @@ default: return strf('TRANSFER_FILE_NAME', name); } } else { - var remainNumber = event.status.numRemainingItems; + const remainNumber = event.status.numRemainingItems; switch (event.status.operationType) { case 'COPY': return strf('COPY_ITEMS_REMAINING', remainNumber); case 'MOVE': return strf('MOVE_ITEMS_REMAINING', remainNumber); @@ -123,7 +123,7 @@ if (event.reason === fileOperationUtil.EventRouter.EventType.ERROR) { return str('DELETE_ERROR'); } else if (event.entries.length == 1) { - var fileName = event.entries[0].name; + const fileName = event.entries[0].name; return strf('DELETE_FILE_NAME', fileName); } else if (event.entries.length > 1) { return strf('DELETE_ITEMS_REMAINING', event.entries.length); @@ -156,12 +156,12 @@ * @private */ FileOperationHandler.prototype.onCopyProgress_ = function(event) { - var EventType = fileOperationUtil.EventRouter.EventType; + const EventType = fileOperationUtil.EventRouter.EventType; event = /** @type {FileOperationProgressEvent} */ (event); // Update progress center. - var progressCenter = this.progressCenter_; - var item; + const progressCenter = this.progressCenter_; + let item; switch (event.reason) { case EventType.BEGIN: item = new ProgressCenterItem(); @@ -221,13 +221,13 @@ * @private */ FileOperationHandler.prototype.onDeleteProgress_ = function(event) { - var EventType = fileOperationUtil.EventRouter.EventType; + const EventType = fileOperationUtil.EventRouter.EventType; event = /** @type {FileOperationProgressEvent} */ (event); // Update progress center. - var progressCenter = this.progressCenter_; - var item; - var pending; + const progressCenter = this.progressCenter_; + let item; + let pending; switch (event.reason) { case EventType.BEGIN: item = new ProgressCenterItem();
diff --git a/ui/file_manager/file_manager/background/js/file_operation_handler_unittest.js b/ui/file_manager/file_manager/background/js/file_operation_handler_unittest.js index f2ccaa3..ce4f8a0 100644 --- a/ui/file_manager/file_manager/background/js/file_operation_handler_unittest.js +++ b/ui/file_manager/file_manager/background/js/file_operation_handler_unittest.js
@@ -5,13 +5,13 @@ 'use strict'; /** @type {!MockFileOperationManager} */ -var fileOperationManager; +let fileOperationManager; /** @type {!MockProgressCenter} */ -var progressCenter; +let progressCenter; /** @type {!FileOperationHandler} */ -var fileOperationHandler; +let fileOperationHandler; // Set up the test components. function setUp() { @@ -54,7 +54,7 @@ })); // Check the updated item. - var item = progressCenter.items['TASK_ID']; + let item = progressCenter.items['TASK_ID']; assertEquals(ProgressItemState.PROGRESSING, item.state); assertEquals('TASK_ID', item.id); assertEquals('Copying sample.txt...', item.message); @@ -103,7 +103,7 @@ })); // Check the updated item. - var item = progressCenter.items['TASK_ID']; + let item = progressCenter.items['TASK_ID']; assertEquals(ProgressItemState.PROGRESSING, item.state); assertEquals('Copying sample.txt...', item.message); assertEquals('copy', item.type); @@ -156,7 +156,7 @@ })); // Check the item errored. - var item = progressCenter.items['TASK_ID']; + const item = progressCenter.items['TASK_ID']; assertEquals(ProgressItemState.ERROR, item.state); assertEquals('sample.txt is already exists.', item.message); assertEquals('copy', item.type); @@ -186,7 +186,7 @@ })); // Check the item errored. - var item = progressCenter.items['TASK_ID']; + const item = progressCenter.items['TASK_ID']; assertEquals(ProgressItemState.ERROR, item.state); assertEquals('Copy filesystem error: File error generic.', item.message); assertEquals('copy', item.type); @@ -216,7 +216,7 @@ })); // Check the item errored. - var item = progressCenter.items['TASK_ID']; + const item = progressCenter.items['TASK_ID']; assertEquals(ProgressItemState.ERROR, item.state); assertEquals('Copy unexpected error: Unexpected', item.message); assertEquals('copy', item.type);
diff --git a/ui/file_manager/file_manager/background/js/file_operation_manager.js b/ui/file_manager/file_manager/background/js/file_operation_manager.js index 313cdbe..dad64ca 100644 --- a/ui/file_manager/file_manager/background/js/file_operation_manager.js +++ b/ui/file_manager/file_manager/background/js/file_operation_manager.js
@@ -92,7 +92,7 @@ * @param {string} taskId ID of task to be canceled. */ FileOperationManagerImpl.prototype.requestTaskCancel = function(taskId) { - var task = null; + let task = null; // If the task is not on progress, remove it immediately. for (var i = 0; i < this.pendingCopyTasks_.length; i++) { @@ -108,7 +108,7 @@ this.pendingCopyTasks_.splice(i, 1); } - for (var volumeId in this.runningCopyTasks_) { + for (const volumeId in this.runningCopyTasks_) { task = this.runningCopyTasks_[volumeId]; if (task.taskId === taskId) { task.requestCancel(); @@ -147,14 +147,14 @@ return Promise.resolve(sourceEntries); } // Utility function to concat arrays. - var compactArrays = function(arrays) { + const compactArrays = function(arrays) { return arrays.filter(function(element) { return !!element; }); }; // Call processEntry for each item of entries. - var processEntries = function(entries) { - var promises = entries.map(processFileOrDirectoryEntries); + const processEntries = function(entries) { + const promises = entries.map(processFileOrDirectoryEntries); return Promise.all(promises).then(compactArrays); }; // Check all file entries and keeps only those need sharing operation. @@ -222,8 +222,8 @@ */ FileOperationManagerImpl.prototype.queueCopy_ = function( targetDirEntry, entries, isMove, opt_taskId) { - var task; - var taskId = opt_taskId || this.generateTaskId(); + let task; + const taskId = opt_taskId || this.generateTaskId(); if (isMove) { // When moving between different volumes, moving is implemented as a copy // and delete. This is because moving between volumes is slow, and moveTo() @@ -278,14 +278,14 @@ chrome.power.requestKeepAwake('system'); // Find next task which can run at now. - var nextTask = null; - var nextTaskVolumeId = null; - for (var i = 0; i < this.pendingCopyTasks_.length; i++) { - var task = this.pendingCopyTasks_[i]; + let nextTask = null; + let nextTaskVolumeId = null; + for (let i = 0; i < this.pendingCopyTasks_.length; i++) { + const task = this.pendingCopyTasks_[i]; // Fails a copy task of which it fails to get volume info. The destination // volume might be already unmounted. - var volumeInfo = this.volumeManager_.getVolumeInfo( + const volumeInfo = this.volumeManager_.getVolumeInfo( /** @type {!DirectoryEntry} */ (task.targetDirEntry)); if (volumeInfo === null) { this.eventRouter_.sendProgressEvent( @@ -315,24 +315,24 @@ return; } - var onTaskProgress = function(task) { + const onTaskProgress = function(task) { this.eventRouter_.sendProgressEvent( fileOperationUtil.EventRouter.EventType.PROGRESS, task.getStatus(), task.taskId); }.bind(this, nextTask); - var onEntryChanged = function(kind, entry) { + const onEntryChanged = function(kind, entry) { this.eventRouter_.sendEntryChangedEvent(kind, entry); }.bind(this); // Since getVolumeInfo of targetDirEntry might not be available when this // callback is called, bind volume id here. - var onTaskError = function(volumeId, err) { - var task = this.runningCopyTasks_[volumeId]; + const onTaskError = function(volumeId, err) { + const task = this.runningCopyTasks_[volumeId]; delete this.runningCopyTasks_[volumeId]; - var reason = err.data.name === util.FileError.ABORT_ERR ? + const reason = err.data.name === util.FileError.ABORT_ERR ? fileOperationUtil.EventRouter.EventType.CANCELED : fileOperationUtil.EventRouter.EventType.ERROR; this.eventRouter_.sendProgressEvent(reason, @@ -342,8 +342,8 @@ this.serviceAllTasks_(); }.bind(this, nextTaskVolumeId); - var onTaskSuccess = function(volumeId) { - var task = this.runningCopyTasks_[volumeId]; + const onTaskSuccess = function(volumeId) { + const task = this.runningCopyTasks_[volumeId]; delete this.runningCopyTasks_[volumeId]; this.eventRouter_.sendProgressEvent( @@ -369,7 +369,7 @@ * @param {Array<Entry>} entries The entries. */ FileOperationManagerImpl.prototype.deleteEntries = function(entries) { - var task = + const task = /** @type {!fileOperationUtil.DeleteTask} */ (Object.preventExtensions({ entries: entries, taskId: this.generateTaskId(), @@ -380,8 +380,8 @@ })); // Obtains entry size and sum them up. - var group = new AsyncUtil.Group(); - for (var i = 0; i < task.entries.length; i++) { + const group = new AsyncUtil.Group(); + for (let i = 0; i < task.entries.length; i++) { group.add(function(entry, callback) { metadataProxy.getEntryMetadata(entry).then( function(metadata) { @@ -437,11 +437,11 @@ */ FileOperationManagerImpl.prototype.serviceDeleteTask_ = function( task, callback) { - var queue = new AsyncUtil.Queue(); + const queue = new AsyncUtil.Queue(); // Delete each entry. - var error = null; - var deleteOneEntry = function(inCallback) { + let error = null; + const deleteOneEntry = function(inCallback) { if (!task.entries.length || task.cancelRequested || error) { inCallback(); return; @@ -466,8 +466,8 @@ // Send an event and finish the async steps. queue.run(function(inCallback) { - var EventType = fileOperationUtil.EventRouter.EventType; - var reason; + const EventType = fileOperationUtil.EventRouter.EventType; + let reason; if (error) { reason = EventType.ERROR; } else if (task.cancelRequested) { @@ -489,7 +489,7 @@ */ FileOperationManagerImpl.prototype.zipSelection = function( selectionEntries, dirEntry) { - var zipTask = new fileOperationUtil.ZipTask( + const zipTask = new fileOperationUtil.ZipTask( this.generateTaskId(), selectionEntries, dirEntry, dirEntry); this.eventRouter_.sendProgressEvent( fileOperationUtil.EventRouter.EventType.BEGIN,
diff --git a/ui/file_manager/file_manager/background/js/file_operation_manager_unittest.js b/ui/file_manager/file_manager/background/js/file_operation_manager_unittest.js index d026861a..33e15e5 100644 --- a/ui/file_manager/file_manager/background/js/file_operation_manager_unittest.js +++ b/ui/file_manager/file_manager/background/js/file_operation_manager_unittest.js
@@ -7,7 +7,7 @@ * Mock chrome APIs. * @type {Object} */ -var mockChrome = {}; +const mockChrome = {}; mockChrome.runtime = { lastError: null @@ -98,7 +98,7 @@ */ BlockableFakeStartCopy.prototype.startCopyFunc = function( source, destination, newName, callback) { - var makeStatus = function(type) { + const makeStatus = function(type) { return { type: type, sourceUrl: source.toURL(), @@ -106,11 +106,11 @@ }; }; - var completeCopyOperation = function(copyId) { - var newPath = joinPath('/', newName); - var fileSystem = getFileSystemForURL( + const completeCopyOperation = function(copyId) { + const newPath = joinPath('/', newName); + const fileSystem = getFileSystemForURL( this.fileSystems_, destination.toURL()); - var mockEntry = /** @type {!MockEntry} */ (this.sourceEntry_); + const mockEntry = /** @type {!MockEntry} */ (this.sourceEntry_); fileSystem.entries[newPath] = /** @type {!MockEntry} */ (mockEntry.clone(newPath)); listener(copyId, makeStatus('end_copy_entry')); @@ -155,7 +155,7 @@ * @return {!MockFileSystem} */ function getFileSystemForURL(fileSystems, url) { - for (var i = 0; i < fileSystems.length; i++) { + for (let i = 0; i < fileSystems.length; i++) { if (new RegExp('^filesystem:' + fileSystems[i].name + '/').test(url)) { return fileSystems[i]; } @@ -169,7 +169,7 @@ * @type {number} * @const */ -var DIRECTORY_SIZE = -1; +const DIRECTORY_SIZE = -1; /** * Creates test file system. @@ -179,12 +179,12 @@ * @return {!MockFileSystem} */ function createTestFileSystem(id, entries) { - var fileSystem = new MockFileSystem(id, 'filesystem:' + id); - for (var path in entries) { + const fileSystem = new MockFileSystem(id, 'filesystem:' + id); + for (const path in entries) { if (entries[path] === DIRECTORY_SIZE) { fileSystem.entries[path] = new MockDirectoryEntry(fileSystem, path); } else { - var metadata = /** @type {!Metadata} */ ({size: entries[path]}); + const metadata = /** @type {!Metadata} */ ({size: entries[path]}); fileSystem.entries[path] = new MockFileEntry(fileSystem, path, metadata); } } @@ -199,8 +199,8 @@ * @param {function(!FileError)=} opt_failure Failure callback. */ function resolveTestFileSystemURL(fileSystem, url, success, opt_failure) { - for (var name in fileSystem.entries) { - var entry = fileSystem.entries[name]; + for (const name in fileSystem.entries) { + const entry = fileSystem.entries[name]; if (entry.toURL() == url) { success(entry); return; @@ -219,7 +219,7 @@ */ function waitForEvents(fileOperationManager) { return new Promise(function(fulfill) { - var events = []; + const events = []; fileOperationManager.addEventListener('copy-progress', function(event) { event = /** @type {FileOperationProgressEvent} */ (event); events.push(event); @@ -245,9 +245,9 @@ * Placeholder for mocked volume manager. * @type {(FakeVolumeManager|{getVolumeInfo: function()}?)} */ -var volumeManager; +let volumeManager; -var volumeManagerFactory = {}; +var volumeManagerFactory = volumeManagerFactory || {}; /** * Provide VolumeManager.getInstance() for FileOperationManager using mocked @@ -262,7 +262,7 @@ * Test target. * @type {FileOperationManagerImpl} */ -var fileOperationManager; +let fileOperationManager; /** * Initializes the test environment. @@ -277,16 +277,16 @@ * @param {function(boolean)} callback Callback to be passed true on error. */ function testResolvePath(callback) { - var fileSystem = createTestFileSystem('testVolume', { + const fileSystem = createTestFileSystem('testVolume', { '/': DIRECTORY_SIZE, '/file': 10, '/directory': DIRECTORY_SIZE }); - var root = fileSystem.root; - var rootPromise = fileOperationUtil.resolvePath(root, '/'); - var filePromise = fileOperationUtil.resolvePath(root, '/file'); - var directoryPromise = fileOperationUtil.resolvePath(root, '/directory'); - var errorPromise = + const root = fileSystem.root; + const rootPromise = fileOperationUtil.resolvePath(root, '/'); + const filePromise = fileOperationUtil.resolvePath(root, '/file'); + const directoryPromise = fileOperationUtil.resolvePath(root, '/directory'); + const errorPromise = fileOperationUtil.resolvePath(root, '/not_found') .then( function() { @@ -314,7 +314,7 @@ * @param {function(boolean)} callback Callback to be passed true on error. */ function testFindEntriesRecursively(callback) { - var fileSystem = createTestFileSystem('testVolume', { + const fileSystem = createTestFileSystem('testVolume', { '/': DIRECTORY_SIZE, '/file.txt': 10, '/file (1).txt': 10, @@ -329,7 +329,7 @@ '/DCIM/IMG_1235 (9).txt': 10, }); - var foundFiles = []; + const foundFiles = []; fileOperationUtil .findEntriesRecursively( fileSystem.root, @@ -341,7 +341,7 @@ callback(false); }) .catch(function() { - var error = true; + const error = true; callback(error); }); } @@ -350,7 +350,7 @@ * @param {function(boolean)} callback Callback to be passed true on error. */ function testFindFilesRecursively(callback) { - var fileSystem = createTestFileSystem('testVolume', { + const fileSystem = createTestFileSystem('testVolume', { '/': DIRECTORY_SIZE, '/file.txt': 10, '/file (1).txt': 10, @@ -365,7 +365,7 @@ '/DCIM/IMG_1235 (9).txt': 10, }); - var foundFiles = []; + const foundFiles = []; fileOperationUtil .findFilesRecursively( fileSystem.root, @@ -382,7 +382,7 @@ callback(false); }) .catch(function() { - var error = true; + const error = true; callback(error); }); } @@ -391,7 +391,7 @@ * @param {function(boolean)} callback Callback to be passed true on error. */ function testGatherEntriesRecursively(callback) { - var fileSystem = createTestFileSystem('testVolume', { + const fileSystem = createTestFileSystem('testVolume', { '/': DIRECTORY_SIZE, '/file.txt': 10, '/file (1).txt': 10, @@ -412,7 +412,7 @@ callback(false); }) .catch(function() { - var error = true; + const error = true; callback(error); }); } @@ -422,12 +422,12 @@ * @param {function(boolean)} callback Callback to be passed true on error. */ function testDeduplicatePath(callback) { - var fileSystem1 = createTestFileSystem('testVolume', {'/': DIRECTORY_SIZE}); - var fileSystem2 = createTestFileSystem('testVolume', { + const fileSystem1 = createTestFileSystem('testVolume', {'/': DIRECTORY_SIZE}); + const fileSystem2 = createTestFileSystem('testVolume', { '/': DIRECTORY_SIZE, '/file.txt': 10 }); - var fileSystem3 = createTestFileSystem('testVolume', { + const fileSystem3 = createTestFileSystem('testVolume', { '/': DIRECTORY_SIZE, '/file.txt': 10, '/file (1).txt': 10, @@ -441,23 +441,23 @@ '/file (9).txt': 10, }); - var nonExistingPromise = + const nonExistingPromise = fileOperationUtil.deduplicatePath(fileSystem1.root, 'file.txt'). then(function(path) { assertEquals('file.txt', path); }); - var existingPathPromise = + const existingPathPromise = fileOperationUtil.deduplicatePath(fileSystem2.root, 'file.txt'). then(function(path) { assertEquals('file (1).txt', path); }); - var moreExistingPathPromise = + const moreExistingPathPromise = fileOperationUtil.deduplicatePath(fileSystem3.root, 'file.txt'). then(function(path) { assertEquals('file (10).txt', path); }); - var testPromise = Promise.all([ + const testPromise = Promise.all([ nonExistingPromise, existingPathPromise, moreExistingPathPromise, @@ -471,7 +471,7 @@ */ function testCopy(callback) { // Prepare entries and their resolver. - var fileSystem = createTestFileSystem('testVolume', { + const fileSystem = createTestFileSystem('testVolume', { '/': DIRECTORY_SIZE, '/test.txt': 10, }); @@ -481,7 +481,7 @@ mockChrome.fileManagerPrivate.startCopy = function( source, destination, newName, callback) { - var makeStatus = function(type) { + const makeStatus = function(type) { return { type: type, sourceUrl: source.toURL(), @@ -489,11 +489,11 @@ }; }; callback(1); - var listener = mockChrome.fileManagerPrivate.onCopyProgress.listener_; + const listener = mockChrome.fileManagerPrivate.onCopyProgress.listener_; listener(1, makeStatus('begin_copy_entry')); listener(1, makeStatus('progress')); - var newPath = joinPath('/', newName); - var entry = /** @type {!MockEntry} */ + const newPath = joinPath('/', newName); + const entry = /** @type {!MockEntry} */ (fileSystem.entries['/test.txt']); fileSystem.entries[newPath] = /** @type {!MockEntry} */ (entry.clone(newPath)); @@ -505,17 +505,17 @@ fileOperationManager = new FileOperationManagerImpl(); // Observe the file operation manager's events. - var eventsPromise = waitForEvents(fileOperationManager); + const eventsPromise = waitForEvents(fileOperationManager); // Verify the events. reportPromise(eventsPromise.then(function(events) { - var firstEvent = events[0]; + const firstEvent = events[0]; assertEquals('BEGIN', firstEvent.reason); assertEquals(1, firstEvent.status.numRemainingItems); assertEquals(0, firstEvent.status.processedBytes); assertEquals(1, firstEvent.status.totalBytes); - var lastEvent = events[events.length - 1]; + const lastEvent = events[events.length - 1]; assertEquals('SUCCESS', lastEvent.reason); assertEquals(0, lastEvent.status.numRemainingItems); assertEquals(10, lastEvent.status.processedBytes); @@ -543,7 +543,7 @@ */ function testCopyInSequential(callback) { // Prepare entries and their resolver. - var fileSystem = createTestFileSystem('testVolume', { + const fileSystem = createTestFileSystem('testVolume', { '/': DIRECTORY_SIZE, '/dest': DIRECTORY_SIZE, '/test.txt': 10 @@ -552,7 +552,7 @@ resolveTestFileSystemURL(fileSystem, url, success, failure); }; - var blockableFakeStartCopy = new BlockableFakeStartCopy( + const blockableFakeStartCopy = new BlockableFakeStartCopy( 'filesystem:testVolume/dest', fileSystem.entries['/test.txt'], [fileSystem]); mockChrome.fileManagerPrivate.startCopy = @@ -562,14 +562,14 @@ fileOperationManager = new FileOperationManagerImpl(); // Observe the file operation manager's events. - var eventLogger = new EventLogger(fileOperationManager); + const eventLogger = new EventLogger(fileOperationManager); // Copy test.txt to /dest. This operation should be blocked. fileOperationManager.paste( [fileSystem.entries['/test.txt']], /** @type {!DirectoryEntry} */ (fileSystem.entries['/dest']), false); - var firstOperationTaskId; + let firstOperationTaskId; reportPromise(waitUntil(function() { // Wait until the first operation is blocked. return blockableFakeStartCopy.resolveBlockedOperationCallback !== null; @@ -591,7 +591,7 @@ // implementation run tasks synchronusly after adding it to pending tasks. // TODO(yawano) This check deeply depends on the implementation. Find a // better way to test this. - var pendingTask = fileOperationManager.getPendingCopyTasksForTesting()[0]; + const pendingTask = fileOperationManager.getPendingCopyTasksForTesting()[0]; assertEquals(fileSystem.entries['/'], pendingTask.targetDirEntry); blockableFakeStartCopy.resolveBlockedOperationCallback(); @@ -605,7 +605,7 @@ // BEGIN: second operation // SUCCESS: first operation // SUCCESS: second operation - var events = eventLogger.events; + const events = eventLogger.events; assertEquals(4, events.length); assertEquals('BEGIN', events[0].reason); assertEquals(firstOperationTaskId, events[0].taskId); @@ -624,21 +624,21 @@ */ function testCopyInParallel(callback) { // Prepare entries and their resolver. - var fileSystemA = createTestFileSystem('volumeA', { + const fileSystemA = createTestFileSystem('volumeA', { '/': DIRECTORY_SIZE, '/test.txt': 10 }); - var fileSystemB = createTestFileSystem('volumeB', { + const fileSystemB = createTestFileSystem('volumeB', { '/': DIRECTORY_SIZE, }); - var fileSystems = [fileSystemA, fileSystemB]; + const fileSystems = [fileSystemA, fileSystemB]; window.webkitResolveLocalFileSystemURL = function(url, success, failure) { - var system = getFileSystemForURL(fileSystems, url); + const system = getFileSystemForURL(fileSystems, url); resolveTestFileSystemURL(system, url, success, failure); }; - var blockableFakeStartCopy = new BlockableFakeStartCopy( + const blockableFakeStartCopy = new BlockableFakeStartCopy( 'filesystem:volumeB/', fileSystemA.entries['/test.txt'], fileSystems); @@ -649,14 +649,14 @@ fileOperationManager = new FileOperationManagerImpl(); // Observe the file operation manager's events. - var eventLogger = new EventLogger(fileOperationManager); + const eventLogger = new EventLogger(fileOperationManager); // Copy test.txt from volume A to volume B. fileOperationManager.paste( [fileSystemA.entries['/test.txt']], /** @type {!DirectoryEntry} */ (fileSystemB.entries['/']), false); - var firstOperationTaskId; + let firstOperationTaskId; reportPromise(waitUntil(function() { return blockableFakeStartCopy.resolveBlockedOperationCallback !== null; }).then(function() { @@ -688,7 +688,7 @@ // BEGIN: second operation // SUCCESS: second operation // SUCCESS: first operation - var events = eventLogger.events; + const events = eventLogger.events; assertEquals(4, events.length); assertEquals('BEGIN', events[0].reason); assertEquals(firstOperationTaskId, events[0].taskId); @@ -707,7 +707,7 @@ */ function testCopyFails(callback) { // Prepare entries. - var fileSystem = createTestFileSystem('testVolume', { + const fileSystem = createTestFileSystem('testVolume', { '/': DIRECTORY_SIZE, '/test.txt': 10 }); @@ -722,7 +722,7 @@ fileOperationManager = new FileOperationManagerImpl(); // Observe the file operation manager's events. - var eventLogger = new EventLogger(fileOperationManager); + const eventLogger = new EventLogger(fileOperationManager); // Copy test.txt to /, which should fail. fileOperationManager.paste( @@ -737,7 +737,7 @@ fileOperationManager.getPendingCopyTasksForTesting().length); // Check events. - var events = eventLogger.events; + const events = eventLogger.events; assertEquals(2, events.length); assertEquals('BEGIN', events[0].reason); assertEquals('ERROR', events[1].reason); @@ -751,7 +751,7 @@ */ function testMove(callback) { // Prepare entries and their resolver. - var fileSystem = createTestFileSystem('testVolume', { + const fileSystem = createTestFileSystem('testVolume', { '/': DIRECTORY_SIZE, '/directory': DIRECTORY_SIZE, '/test.txt': 10, @@ -764,17 +764,17 @@ fileOperationManager = new FileOperationManagerImpl(); // Observe the file operation manager's events. - var eventsPromise = waitForEvents(fileOperationManager); + const eventsPromise = waitForEvents(fileOperationManager); // Verify the events. reportPromise(eventsPromise.then(function(events) { - var firstEvent = events[0]; + const firstEvent = events[0]; assertEquals('BEGIN', firstEvent.reason); assertEquals(1, firstEvent.status.numRemainingItems); assertEquals(0, firstEvent.status.processedBytes); assertEquals(1, firstEvent.status.totalBytes); - var lastEvent = events[events.length - 1]; + const lastEvent = events[events.length - 1]; assertEquals('SUCCESS', lastEvent.reason); assertEquals(0, lastEvent.status.numRemainingItems); assertEquals(1, lastEvent.status.processedBytes); @@ -808,7 +808,7 @@ */ function testDelete(callback) { // Prepare entries and their resolver. - var fileSystem = createTestFileSystem('testVolume', { + const fileSystem = createTestFileSystem('testVolume', { '/': DIRECTORY_SIZE, '/test.txt': 10, }); @@ -824,7 +824,7 @@ assertEquals(10, events[0].totalBytes); assertEquals(0, events[0].processedBytes); - var lastEvent = events[events.length - 1]; + const lastEvent = events[events.length - 1]; assertEquals('delete', lastEvent.type); assertEquals('SUCCESS', lastEvent.reason); assertEquals(10, lastEvent.totalBytes); @@ -845,7 +845,7 @@ */ function testZip(callback) { // Prepare entries and their resolver. - var fileSystem = createTestFileSystem('testVolume', { + const fileSystem = createTestFileSystem('testVolume', { '/': DIRECTORY_SIZE, '/test.txt': 10, }); @@ -855,8 +855,8 @@ mockChrome.fileManagerPrivate.zipSelection = function( sources, parent, newName, success, error) { - var newPath = joinPath('/', newName); - var newEntry = new MockFileEntry( + const newPath = joinPath('/', newName); + const newEntry = new MockFileEntry( fileSystem, newPath, /** @type {!Metadata} */ ({size: 10})); fileSystem.entries[newPath] = newEntry; success(newEntry); @@ -872,7 +872,7 @@ assertEquals(1, events[0].status.totalBytes); assertEquals(0, events[0].status.processedBytes); - var lastEvent = events[events.length - 1]; + const lastEvent = events[events.length - 1]; assertEquals('copy-progress', lastEvent.type); assertEquals('SUCCESS', lastEvent.reason); assertEquals(10, lastEvent.status.totalBytes);
diff --git a/ui/file_manager/file_manager/background/js/file_operation_util.js b/ui/file_manager/file_manager/background/js/file_operation_util.js index d548e99..6726b66a 100644 --- a/ui/file_manager/file_manager/background/js/file_operation_util.js +++ b/ui/file_manager/file_manager/background/js/file_operation_util.js
@@ -5,7 +5,7 @@ /** * Utilities for file operations. */ -var fileOperationUtil = {}; +const fileOperationUtil = {}; /** * Resolves a path to either a DirectoryEntry or a FileEntry, regardless of @@ -54,14 +54,14 @@ // be replaced by incremented number for retry. For example, suppose // |relativePath| is "file (10).txt", the second check path will be // "file (11).txt". - var match = /^(.*?)(?: \((\d+)\))?(\.[^.]*?)?$/.exec(relativePath); - var prefix = match[1]; - var ext = match[3] || ''; + const match = /^(.*?)(?: \((\d+)\))?(\.[^.]*?)?$/.exec(relativePath); + const prefix = match[1]; + const ext = match[3] || ''; // Check to see if the target exists. - var resolvePath = function(trialPath, copyNumber) { + const resolvePath = function(trialPath, copyNumber) { return fileOperationUtil.resolvePath(dirEntry, trialPath).then(function() { - var newTrialPath = prefix + ' (' + copyNumber + ')' + ext; + const newTrialPath = prefix + ' (' + copyNumber + ')' + ext; return resolvePath(newTrialPath, copyNumber + 1); }, function(error) { // We expect to be unable to resolve the target file, since we're @@ -75,7 +75,7 @@ }); }; - var promise = resolvePath(relativePath, 1).catch(function(error) { + const promise = resolvePath(relativePath, 1).catch(function(error) { if (error instanceof Error) { return Promise.reject(error); } @@ -102,11 +102,11 @@ */ fileOperationUtil.resolveRecursively_ = function( entry, successCallback, errorCallback) { - var result = []; - var error = null; - var numRunningTasks = 0; + const result = []; + let error = null; + let numRunningTasks = 0; - var maybeInvokeCallback = function() { + const maybeInvokeCallback = function() { // If there still remain some running tasks, wait their finishing. if (numRunningTasks > 0) { return; @@ -120,7 +120,7 @@ }; // The error handling can be shared. - var onError = function(fileError) { + const onError = function(fileError) { // If this is the first error, remember it. if (!error) { error = fileError; @@ -129,7 +129,7 @@ maybeInvokeCallback(); }; - var process = function(entry) { + const process = function(entry) { numRunningTasks++; result.push(entry); if (entry.isDirectory) { @@ -139,7 +139,7 @@ entry.size = 1; // Recursively traverse children. - var reader = entry.createReader(); + const reader = entry.createReader(); reader.readEntries( function processSubEntries(subEntries) { if (error || subEntries.length == 0) { @@ -150,7 +150,7 @@ return; } - for (var i = 0; i < subEntries.length; i++) { + for (let i = 0; i < subEntries.length; i++) { process(subEntries[i]); } @@ -182,7 +182,7 @@ */ fileOperationUtil.gatherEntriesRecursively = function(entry) { /** @type {!Array<!Entry>} */ - var gatheredFiles = []; + const gatheredFiles = []; return fileOperationUtil.findEntriesRecursively( entry, @@ -234,14 +234,14 @@ fileOperationUtil.findEntriesRecursively = function(entry, onResultCallback) { return new Promise( function(resolve, reject) { - var numRunningTasks = 0; - var scanError = null; + let numRunningTasks = 0; + let scanError = null; /** * @param {*=} opt_error If defined immediately * terminates scanning. */ - var maybeSettlePromise = function(opt_error) { + const maybeSettlePromise = function(opt_error) { scanError = opt_error; if (scanError) { @@ -258,7 +258,7 @@ }; /** @param {!Entry} entry */ - var processEntry = function(entry) { + const processEntry = function(entry) { // All scanning stops when an error is encountered. if (scanError) { return; @@ -282,7 +282,7 @@ // Recursively traverse children. // reader.readEntries chunksResults resulting in the need // for us to call it multiple times. - var reader = directory.createReader(); + const reader = directory.createReader(); reader.readEntries( function processSubEntries(subEntries) { if (subEntries.length === 0) { @@ -315,9 +315,9 @@ fileOperationUtil.listEntries = function(directory, callback) { return new Promise( function(resolve, reject) { - var reader = directory.createReader(); + const reader = directory.createReader(); - var readEntries = function() { + const readEntries = function() { reader.readEntries ( /** @param {!Array<!Entry>} entries */ function(entries) { @@ -363,13 +363,13 @@ successCallback, errorCallback) { /** @type {number|undefined} */ - var copyId; - var pendingCallbacks = []; + let copyId; + const pendingCallbacks = []; // Makes the callback called in order they were invoked. - var callbackQueue = new AsyncUtil.Queue(); + const callbackQueue = new AsyncUtil.Queue(); - var onCopyProgress = function(progressCopyId, status) { + const onCopyProgress = function(progressCopyId, status) { callbackQueue.run(function(callback) { if (copyId === null) { // If the copyId is not yet available, wait for it. @@ -464,7 +464,7 @@ } copyId = startCopyId; - for (var i = 0; i < pendingCallbacks.length; i++) { + for (let i = 0; i < pendingCallbacks.length; i++) { pendingCallbacks[i](); } }); @@ -605,7 +605,7 @@ fileOperationUtil.Task.prototype.requestCancel = function() { this.cancelRequested_ = true; if (this.cancelCallback_) { - var callback = this.cancelCallback_; + const callback = this.cancelCallback_; this.cancelCallback_ = null; callback(); } @@ -632,7 +632,7 @@ * @return {Object} Status object. */ fileOperationUtil.Task.prototype.getStatus = function() { - var processingEntry = this.sourceEntries[this.processingSourceIndex_]; + const processingEntry = this.sourceEntries[this.processingSourceIndex_]; return { operationType: this.operationType, numRemainingItems: this.numRemainingItems, @@ -648,13 +648,13 @@ * @private */ fileOperationUtil.Task.prototype.calcProcessedBytes_ = function() { - var bytes = 0; - for (var i = 0; i < this.processingSourceIndex_ + 1; i++) { - var entryMap = this.processingEntries[i]; + let bytes = 0; + for (let i = 0; i < this.processingSourceIndex_ + 1; i++) { + const entryMap = this.processingEntries[i]; if (!entryMap) { break; } - for (var name in entryMap) { + for (const name in entryMap) { bytes += i < this.processingSourceIndex_ ? entryMap[name].size : entryMap[name].processedBytes; } @@ -668,21 +668,21 @@ * @private */ fileOperationUtil.Task.prototype.calcNumRemainingItems_ = function() { - var numRemainingItems = 0; + let numRemainingItems = 0; - var resolvedEntryMap; + let resolvedEntryMap; if (this.processingEntries && this.processingEntries.length > 0) { resolvedEntryMap = this.processingEntries[this.processingSourceIndex_]; } if (resolvedEntryMap) { - for (var key in resolvedEntryMap) { + for (const key in resolvedEntryMap) { if (resolvedEntryMap.hasOwnProperty(key) && resolvedEntryMap[key].processedBytes === 0) { numRemainingItems++; } } - for (var i = this.processingSourceIndex_ + 1; + for (let i = this.processingSourceIndex_ + 1; i < this.processingEntries.length; i++) { numRemainingItems += Object.keys(this.processingEntries[i] || {}).length; } @@ -743,17 +743,17 @@ * @param {function()} callback Called when the initialize is completed. */ fileOperationUtil.CopyTask.prototype.initialize = function(callback) { - var group = new AsyncUtil.Group(); + const group = new AsyncUtil.Group(); // Correct all entries to be copied for status update. this.processingEntries = []; - for (var i = 0; i < this.sourceEntries.length; i++) { + for (let i = 0; i < this.sourceEntries.length; i++) { group.add(function(index, callback) { fileOperationUtil.resolveRecursively_( this.sourceEntries[index], function(resolvedEntries) { - var resolvedEntryMap = {}; - for (var j = 0; j < resolvedEntries.length; ++j) { - var entry = resolvedEntries[j]; + const resolvedEntryMap = {}; + for (let j = 0; j < resolvedEntries.length; ++j) { + const entry = resolvedEntries[j]; entry.processedBytes = 0; resolvedEntryMap[entry.toURL()] = entry; } @@ -771,8 +771,8 @@ group.run(function() { // Fill totalBytes. this.totalBytes = 0; - for (var i = 0; i < this.processingEntries.length; i++) { - for (var entryURL in this.processingEntries[i]) { + for (let i = 0; i < this.processingEntries.length; i++) { + for (const entryURL in this.processingEntries[i]) { this.totalBytes += this.processingEntries[i][entryURL].size; } } @@ -805,10 +805,10 @@ // TODO(hidehiko): Delete after copy is the implementation of Move. // Migrate the part into MoveTask.run(). - var deleteOriginals = function() { - var count = this.sourceEntries.length; + const deleteOriginals = function() { + let count = this.sourceEntries.length; - var onEntryDeleted = function(entry) { + const onEntryDeleted = function(entry) { entryChangedCallback(util.EntryChangedKind.DELETED, entry); count--; if (!count) { @@ -816,13 +816,13 @@ } }; - var onFilesystemError = function(err) { + const onFilesystemError = function(err) { errorCallback(new fileOperationUtil.Error( util.FileOperationErrorType.FILESYSTEM_ERROR, err)); }; - for (var i = 0; i < this.sourceEntries.length; i++) { - var entry = this.sourceEntries[i]; + for (let i = 0; i < this.sourceEntries.length; i++) { + const entry = this.sourceEntries[i]; util.removeFileOrDirectory( entry, onEntryDeleted.bind(null, entry), onFilesystemError); } @@ -836,21 +836,21 @@ * @param {number=} opt_size Processed bytes of the |sourceEntry|. If it is * dropped, all bytes of the entry are considered to be processed. */ - var updateProgress = function(index, sourceEntryUrl, opt_size) { + let updateProgress = function(index, sourceEntryUrl, opt_size) { if (!sourceEntryUrl) { return; } - var processedEntry = this.processingEntries[index][sourceEntryUrl]; + const processedEntry = this.processingEntries[index][sourceEntryUrl]; if (!processedEntry) { return; } - var alreadyCompleted = + const alreadyCompleted = processedEntry.processedBytes === processedEntry.size; // Accumulates newly processed bytes. - var size = opt_size !== undefined ? opt_size : processedEntry.size; + const size = opt_size !== undefined ? opt_size : processedEntry.size; this.processedBytes += size - processedEntry.processedBytes; processedEntry.processedBytes = size; @@ -876,8 +876,8 @@ // Number of consecutive errors. Increases while failing and resets to zero // when one of them succeeds. - var errorCount = 0; - var lastError; + let errorCount = 0; + let lastError; AsyncUtil.forEach( this.sourceEntries, @@ -1021,9 +1021,9 @@ }); this.processingEntries = []; - for (var i = 0; i < this.sourceEntries.length; i++) { - var processingEntryMap = {}; - var entry = this.sourceEntries[i]; + for (let i = 0; i < this.sourceEntries.length; i++) { + const processingEntryMap = {}; + const entry = this.sourceEntries[i]; // The move should be done with updating the metadata. So here we assume // all the file size is 1 byte. (Avoiding 0, so that progress bar can @@ -1150,13 +1150,13 @@ * @param {function()} callback Called when the initialize is completed. */ fileOperationUtil.ZipTask.prototype.initialize = function(callback) { - var resolvedEntryMap = {}; - var group = new AsyncUtil.Group(); - for (var i = 0; i < this.sourceEntries.length; i++) { + const resolvedEntryMap = {}; + const group = new AsyncUtil.Group(); + for (let i = 0; i < this.sourceEntries.length; i++) { group.add(function(index, callback) { fileOperationUtil.resolveRecursively_( this.sourceEntries[index], function(entries) { - for (var j = 0; j < entries.length; j++) { + for (let j = 0; j < entries.length; j++) { resolvedEntryMap[entries[j].toURL()] = entries[j]; } callback(); @@ -1169,7 +1169,7 @@ this.processingEntries = [resolvedEntryMap]; this.totalBytes = 0; - for (var url in resolvedEntryMap) { + for (const url in resolvedEntryMap) { this.totalBytes += resolvedEntryMap[url].size; } @@ -1191,10 +1191,10 @@ fileOperationUtil.ZipTask.prototype.run = function( entryChangedCallback, progressCallback, successCallback, errorCallback) { // TODO(hidehiko): we should localize the name. - var destName = 'Archive'; + let destName = 'Archive'; if (this.sourceEntries.length == 1) { - var entryName = this.sourceEntries[0].name; - var i = entryName.lastIndexOf('.'); + const entryName = this.sourceEntries[0].name; + const i = entryName.lastIndexOf('.'); destName = ((i < 0) ? entryName : entryName.substr(0, i)); } @@ -1209,8 +1209,8 @@ // The number of elements in processingEntries is 1. See also // initialize(). - var entries = []; - for (var url in this.processingEntries[0]) { + const entries = []; + for (const url in this.processingEntries[0]) { entries.push(this.processingEntries[0][url]); } @@ -1286,13 +1286,13 @@ * should be set iff the reason is "ERROR". */ sendProgressEvent(type, status, taskId, opt_error) { - var EventType = fileOperationUtil.EventRouter.EventType; + const EventType = fileOperationUtil.EventRouter.EventType; // Before finishing operation, dispatch pending entries-changed events. if (type === EventType.SUCCESS || type === EventType.CANCELED) { this.entryChangedEventRateLimiter_.runImmediately(); } - var event = /** @type {FileOperationProgressEvent} */ + const event = /** @type {FileOperationProgressEvent} */ (new Event('copy-progress')); event.reason = type; event.status = status; @@ -1327,8 +1327,8 @@ * @private */ dispatchEntryChangedEvent_() { - var deletedEntries = []; - var createdEntries = []; + const deletedEntries = []; + const createdEntries = []; for (var url in this.pendingDeletedEntries_) { deletedEntries.push(this.pendingDeletedEntries_[url]); } @@ -1358,7 +1358,7 @@ * @param {!Object} task Delete task related with the event. */ sendDeleteEvent(reason, task) { - var event = /** @type {FileOperationProgressEvent} */ (new Event('delete')); + const event = /** @type {FileOperationProgressEvent} */ (new Event('delete')); event.reason = reason; event.taskId = task.taskId; event.entries = task.entries;
diff --git a/ui/file_manager/file_manager/background/js/import_history.js b/ui/file_manager/file_manager/background/js/import_history.js index 7f3938e..b5f2f8a 100644 --- a/ui/file_manager/file_manager/background/js/import_history.js +++ b/ui/file_manager/file_manager/background/js/import_history.js
@@ -335,12 +335,12 @@ function() { // TODO(smckay): Merge copy and sync records for simpler // unimported file discovery. - var unimported = []; - for (var key in this.copiedEntries_) { - var imported = this.importedEntries_[key]; - for (var destination in this.copiedEntries_[key]) { + const unimported = []; + for (const key in this.copiedEntries_) { + const imported = this.importedEntries_[key]; + for (const destination in this.copiedEntries_[key]) { if (!imported || imported.indexOf(destination) === -1) { - var url = importer.inflateAppUrl( + const url = importer.inflateAppUrl( this.copiedEntries_[key][destination].destinationUrl); unimported.push(url); } @@ -376,15 +376,15 @@ /** @override */ importer.PersistentImportHistory.prototype.markImportedByUrl = function(destinationUrl) { - var deflatedUrl = importer.deflateAppUrl(destinationUrl); - var key = this.copyKeyIndex_[deflatedUrl]; + const deflatedUrl = importer.deflateAppUrl(destinationUrl); + const key = this.copyKeyIndex_[deflatedUrl]; if (!!key) { - var copyData = this.copiedEntries_[key]; + const copyData = this.copiedEntries_[key]; // We could build an index of this as well, but it seems // unnecessary given the fact that there will almost always // be just one destination for a file (assumption). - for (var destination in copyData) { + for (const destination in copyData) { if (copyData[destination].destinationUrl === deflatedUrl) { return this.storeRecord_([ importer.RecordType_.IMPORT, @@ -393,7 +393,7 @@ .then( (/** @this {importer.PersistentImportHistory} */ function() { - var sourceUrl = importer.inflateAppUrl( + const sourceUrl = importer.inflateAppUrl( copyData[destination].sourceUrl); // Here we try to create an Entry for the source URL. // This will allow observers to update the UI if the @@ -436,7 +436,7 @@ /** @override */ importer.PersistentImportHistory.prototype.removeObserver = function(observer) { - var index = this.observers_.indexOf(observer); + const index = this.observers_.indexOf(observer); if (index > -1) { this.observers_.splice(index, 1); } else { @@ -527,8 +527,8 @@ * @this {importer.SynchronizedHistoryLoader} */ function(fileEntries) { - var storage = new importer.FileBasedRecordStorage(fileEntries); - var history = new importer.PersistentImportHistory( + const storage = new importer.FileBasedRecordStorage(fileEntries); + const history = new importer.PersistentImportHistory( importer.createMetadataHashcode, storage); new importer.DriveSyncWatcher(history); history.whenReady().then( @@ -623,7 +623,7 @@ */ importer.FileBasedRecordStorage.prototype.writeRecord_ = function(record, writer) { - var blob = new Blob( + const blob = new Blob( [JSON.stringify(record) + ',\n'], {type: 'text/plain; charset=UTF-8'}); @@ -651,7 +651,7 @@ * @this {importer.FileBasedRecordStorage} */ function(ignored) { - var filePromises = this.inputFiles_.map( + const filePromises = this.inputFiles_.map( /** * @param {!importer.PromisingFileEntry} entry * @this {importer.FileBasedRecordStorage} @@ -667,7 +667,7 @@ * @this {importer.FileBasedRecordStorage} */ function(files) { - var contentPromises = files.map( + const contentPromises = files.map( this.readFileAsText_.bind(this)); return Promise.all(contentPromises); }).bind(this), @@ -685,7 +685,7 @@ * @this {importer.FileBasedRecordStorage} */ function(fileContents) { - var parsePromises = fileContents.map( + const parsePromises = fileContents.map( this.parse_.bind(this)); return Promise.all(parsePromises); }).bind(this)) @@ -711,7 +711,7 @@ importer.FileBasedRecordStorage.prototype.readFileAsText_ = function(file) { return new Promise( function(resolve, reject) { - var reader = new FileReader(); + const reader = new FileReader(); reader.onloadend = function() { if (reader.error) { @@ -751,7 +751,7 @@ // 2) Surround the whole string in brackets. // NOTE: JSON.parse is WAY faster than parsing this // ourselves in javascript. - var json = '[' + text.substring(0, text.length - 2) + ']'; + const json = '[' + text.substring(0, text.length - 2) + ']'; return /** @type {!Array<!Array<*>>} */ (JSON.parse(json)); } }; @@ -906,7 +906,7 @@ if (chrome.runtime.lastError) { reject(chrome.runtime.lastError); } else { - var data = propertiesList[0]; + const data = propertiesList[0]; resolve(!data['dirty']); } }).bind(this)); @@ -993,7 +993,7 @@ } else if (!('size' in metadata)) { reject('File entry missing "size" field.'); } else { - var secondsSinceEpoch = importer.toSecondsFromEpoch( + const secondsSinceEpoch = importer.toSecondsFromEpoch( metadata.modificationTime); resolve(secondsSinceEpoch + '_' + metadata.size); }
diff --git a/ui/file_manager/file_manager/background/js/import_history_unittest.js b/ui/file_manager/file_manager/background/js/import_history_unittest.js index d545e96a..b9bc68fe 100644 --- a/ui/file_manager/file_manager/background/js/import_history_unittest.js +++ b/ui/file_manager/file_manager/background/js/import_history_unittest.js
@@ -3,43 +3,43 @@ // found in the LICENSE file. /** @const {string} */ -var FILE_LAST_MODIFIED = new Date("Dec 4 1968").toString(); +const FILE_LAST_MODIFIED = new Date("Dec 4 1968").toString(); /** @const {number} */ -var FILE_SIZE = 1234; +const FILE_SIZE = 1234; /** @const {string} */ -var FILE_PATH = 'test/data'; +const FILE_PATH = 'test/data'; /** @const {number} */ -var TEMPORARY = window.TEMPORARY || 0; +const TEMPORARY = window.TEMPORARY || 0; /** @const {!importer.Destination<string>} */ -var GOOGLE_DRIVE = importer.Destination.GOOGLE_DRIVE; +const GOOGLE_DRIVE = importer.Destination.GOOGLE_DRIVE; /** * Space Cloud: Your source for interstellar cloud storage. * @const {!importer.Destination<string>} */ -var SPACE_CAMP = /** @type !importer.Destination<string> */ ('Space Camp'); +const SPACE_CAMP = /** @type !importer.Destination<string> */ ('Space Camp'); /** @type {!MockFileSystem} */ -var testFileSystem; +let testFileSystem; /** @type {!MockFileEntry} */ -var testFileEntry; +let testFileEntry; /** @type {!importer.TestLogger} */ -var testLogger; +let testLogger; /** @type {!importer.RecordStorage} */ -var storage; +let storage; /** @type {!Promise<!importer.ImportHistory>} */ -var historyProvider; +let historyProvider; /** @type {Promise} */ -var testPromise; +let testPromise; // Set up the test components. function setUp() { @@ -59,7 +59,7 @@ storage = new TestRecordStorage(); - var history = new importer.PersistentImportHistory( + const history = new importer.PersistentImportHistory( importer.createMetadataHashcode, storage); @@ -92,33 +92,11 @@ reportPromise(testPromise, callback); } -function testWasImported_TrueForKnownEntrySetAtRuntime(callback) { - testPromise = historyProvider.then( - function(history) { - return history.markImported(testFileEntry, SPACE_CAMP).then( - function() { - return history.wasImported(testFileEntry, SPACE_CAMP) - .then(assertTrue); - }); - }); - - reportPromise(testPromise, callback); -} - -function testWasCopied_TrueForKnownEntryLoadedFromStorage(callback) { - // TestRecordWriter is pre-configured with this entry. - testPromise = historyProvider.then( - function(history) { - return history.wasCopied(testFileEntry, GOOGLE_DRIVE).then(assertTrue); - }); - - reportPromise(testPromise, callback); -} function testMarkCopied_FiresChangedEvent(callback) { testPromise = historyProvider.then( function(history) { - var recorder = new TestCallRecorder(); + const recorder = new TestCallRecorder(); history.addObserver(recorder.callback); return history.markCopied(testFileEntry, SPACE_CAMP, 'url1').then( function() { @@ -137,7 +115,7 @@ } function testMarkImported_ByUrl(callback) { - var destinationUrl = 'filesystem:chrome-extension://abc/photos/splosion.jpg'; + const destinationUrl = 'filesystem:chrome-extension://abc/photos/splosion.jpg'; testPromise = historyProvider.then( function(history) { return history.markCopied(testFileEntry, SPACE_CAMP, destinationUrl) @@ -195,7 +173,7 @@ function testMarkImport_FiresChangedEvent(callback) { testPromise = historyProvider.then( function(history) { - var recorder = new TestCallRecorder(); + const recorder = new TestCallRecorder(); history.addObserver(recorder.callback); return history.markImported(testFileEntry, SPACE_CAMP).then( function() { @@ -216,11 +194,11 @@ function testHistoryObserver_Unsubscribe(callback) { testPromise = historyProvider.then( function(history) { - var recorder = new TestCallRecorder(); + const recorder = new TestCallRecorder(); history.addObserver(recorder.callback); history.removeObserver(recorder.callback); - var promises = []; + const promises = []; promises.push(history.markCopied(testFileEntry, SPACE_CAMP, 'url2')); promises.push(history.markImported(testFileEntry, SPACE_CAMP)); return Promise.all(promises).then( @@ -237,7 +215,7 @@ } function testRecordStorage_RemembersPreviouslyWrittenRecords(callback) { - var recorder = new TestCallRecorder(); + const recorder = new TestCallRecorder(); testPromise = createRealStorage(['recordStorageTest.data']) .then( function(storage) { @@ -254,14 +232,14 @@ } function testRecordStorage_LoadsRecordsFromMultipleHistoryFiles(callback) { - var recorder = new TestCallRecorder(); + const recorder = new TestCallRecorder(); - var remoteData = createRealStorage(['multiStorage-1.data']) + const remoteData = createRealStorage(['multiStorage-1.data']) .then( function(storage) { return storage.write(['remote-data', '98765432']); }); - var moreRemoteData = createRealStorage(['multiStorage-2.data']) + const moreRemoteData = createRealStorage(['multiStorage-2.data']) .then( function(storage) { return storage.write(['antarctica-data', '777777777777']); @@ -275,7 +253,7 @@ 'multiStorage-2.data']) .then( function(storage) { - var writePromises = [ + const writePromises = [ storage.write(['local-data', '111']) ]; return Promise.all(writePromises) @@ -302,16 +280,16 @@ } function testRecordStorage_SerializingOperations(callback) { - var recorder = new TestCallRecorder(); + const recorder = new TestCallRecorder(); testPromise = createRealStorage(['recordStorageTestForSerializing.data']) .then( function(storage) { - var writePromises = []; - var WRITES_COUNT = 20; - for (var i = 0; i < WRITES_COUNT; i++) { + const writePromises = []; + const WRITES_COUNT = 20; + for (let i = 0; i < WRITES_COUNT; i++) { writePromises.push(storage.write(['abc', '123'])); } - var readAllPromise = storage.readAll(recorder.callback).then( + const readAllPromise = storage.readAll(recorder.callback).then( function() { recorder.assertCallCount(WRITES_COUNT); }); @@ -325,7 +303,7 @@ } function testCreateMetadataHashcode(callback) { - var promise = + const promise = importer.createMetadataHashcode(testFileEntry).then(function(hashcode) { // Note that the expression matches at least 4 numbers // in the last segment, since we hard code the byte @@ -361,7 +339,7 @@ * @return {!Promise<!importer.RecordStorage>} */ function createRealStorage(fileNames) { - var filePromises = fileNames.map(createFileEntry); + const filePromises = fileNames.map(createFileEntry); return Promise.all(filePromises).then(function(fileEntries) { return new importer.FileBasedRecordStorage(fileEntries); }); @@ -376,7 +354,7 @@ function createFileEntry(fileName) { return new Promise( function(resolve, reject) { - var onFileSystemReady = function(fileSystem) { + const onFileSystemReady = function(fileSystem) { fileSystem.root.getFile( fileName, { @@ -403,7 +381,7 @@ * @struct */ var TestRecordStorage = function() { - var timeStamp = importer.toSecondsFromEpoch(FILE_LAST_MODIFIED); + const timeStamp = importer.toSecondsFromEpoch(FILE_LAST_MODIFIED); // Pre-populate the store with some "previously written" data <wink>. /** @private {!Array<!Array<string>>} */
diff --git a/ui/file_manager/file_manager/background/js/launcher.js b/ui/file_manager/file_manager/background/js/launcher.js index fb73785..ed90d714 100644 --- a/ui/file_manager/file_manager/background/js/launcher.js +++ b/ui/file_manager/file_manager/background/js/launcher.js
@@ -5,13 +5,13 @@ /** * @type {!Object} */ -var launcher = {}; +const launcher = {}; /** * Type of a Files app's instance launch. * @enum {number} */ -var LaunchType = { +const LaunchType = { ALWAYS_CREATE: 0, FOCUS_ANY_OR_CREATE: 1, FOCUS_SAME_OR_CREATE: 2 @@ -21,19 +21,19 @@ * Prefix for the file manager window ID. * @const {string} */ -var FILES_ID_PREFIX = 'files#'; +const FILES_ID_PREFIX = 'files#'; /** * Value of the next file manager window ID. * @type {number} */ -var nextFileManagerWindowID = 0; +let nextFileManagerWindowID = 0; /** * File manager window create options. * @const {!Object} */ -var FILE_MANAGER_WINDOW_CREATE_OPTIONS = { +const FILE_MANAGER_WINDOW_CREATE_OPTIONS = { bounds: { left: Math.round(window.screen.availWidth * 0.1), top: Math.round(window.screen.availHeight * 0.1), @@ -53,7 +53,7 @@ * Regexp matching a file manager window ID. * @const {!RegExp} */ -var FILES_ID_PATTERN = new RegExp('^' + FILES_ID_PREFIX + '(\\d*)$'); +const FILES_ID_PATTERN = new RegExp('^' + FILES_ID_PREFIX + '(\\d*)$'); /** * Synchronous queue for asynchronous calls. @@ -69,7 +69,7 @@ */ launcher.launchFileManager = function( opt_appState, opt_id, opt_type, opt_callback) { - var type = opt_type || LaunchType.ALWAYS_CREATE; + const type = opt_type || LaunchType.ALWAYS_CREATE; opt_appState = /** * @type {(undefined| @@ -89,7 +89,7 @@ if (!key.match(FILES_ID_PATTERN)) { continue; } - var contentWindow = window.appWindows[key].contentWindow; + const contentWindow = window.appWindows[key].contentWindow; if (!contentWindow.appState) { continue; } @@ -169,11 +169,11 @@ // Create a new instance in case of ALWAYS_CREATE type, or as a fallback // for other types. - var id = opt_id || nextFileManagerWindowID; + const id = opt_id || nextFileManagerWindowID; nextFileManagerWindowID = Math.max(nextFileManagerWindowID, id + 1); - var appId = FILES_ID_PREFIX + id; + const appId = FILES_ID_PREFIX + id; - var appWindow = new AppWindowWrapper( + const appWindow = new AppWindowWrapper( 'main.html', appId, FILE_MANAGER_WINDOW_CREATE_OPTIONS);
diff --git a/ui/file_manager/file_manager/background/js/launcher_search.js b/ui/file_manager/file_manager/background/js/launcher_search.js index 25fc90e..6eebcf8 100644 --- a/ui/file_manager/file_manager/background/js/launcher_search.js +++ b/ui/file_manager/file_manager/background/js/launcher_search.js
@@ -68,7 +68,7 @@ */ LauncherSearch.prototype.initializeEventListeners_ = function( isDriveEnabled, isSearchSuggestEnabled) { - var launcherSearchEnabled = isDriveEnabled && isSearchSuggestEnabled; + const launcherSearchEnabled = isDriveEnabled && isSearchSuggestEnabled; // If this.enabled_ === launcherSearchEnabled, we don't need to change // anything here. @@ -170,7 +170,7 @@ // If the file is not directory, try to execute default task. chrome.fileManagerPrivate.getFileTasks([entry], function(tasks) { // Select default task. - var defaultTask = null; + let defaultTask = null; for (var i = 0; i < tasks.length; i++) { var task = tasks[i]; if (task.isDefault) { @@ -235,7 +235,7 @@ * @private */ LauncherSearch.prototype.queryDriveEntries_ = function(queryId, query, limit) { - var param = {query: query, types: 'ALL', maxResults: limit}; + const param = {query: query, types: 'ALL', maxResults: limit}; return new Promise((resolve, reject) => { chrome.fileManagerPrivate.searchDriveMetadata(param, function(results) { resolve(results.map(result => result.entry)); @@ -275,7 +275,7 @@ */ LauncherSearch.prototype.getDownloadsEntry_ = function() { return volumeManagerFactory.getInstance().then((volumeManager) => { - var downloadsVolumeInfo = volumeManager.getCurrentProfileVolumeInfo( + const downloadsVolumeInfo = volumeManager.getCurrentProfileVolumeInfo( VolumeManagerCommon.VolumeType.DOWNLOADS); return downloadsVolumeInfo.resolveDisplayRoot(); }); @@ -345,18 +345,18 @@ // TODO(yawano): Use filetype_folder_shared.png for a shared // folder. // TODO(yawano): Add archive launcher filetype icon. - var icon = FileType.getIcon(entry); + let icon = FileType.getIcon(entry); if (icon === 'UNKNOWN' || icon === 'archive') { icon = 'generic'; } - var useHighDpiIcon = window.devicePixelRatio > 1.0; - var iconUrl = chrome.runtime.getURL( + const useHighDpiIcon = window.devicePixelRatio > 1.0; + const iconUrl = chrome.runtime.getURL( 'foreground/images/launcher_filetypes/' + (useHighDpiIcon ? '2x/' : '') + 'launcher_filetype_' + icon + '.png'); // Hide extensions for hosted files. - var title = FileType.isHosted(entry) ? + const title = FileType.isHosted(entry) ? entry.name.substr( 0, entry.name.length - FileType.getExtension(entry).length) : entry.name;
diff --git a/ui/file_manager/file_manager/background/js/media_import_handler.js b/ui/file_manager/file_manager/background/js/media_import_handler.js index 9897c76ba..c4352f95 100644 --- a/ui/file_manager/file_manager/background/js/media_import_handler.js +++ b/ui/file_manager/file_manager/background/js/media_import_handler.js
@@ -63,7 +63,7 @@ importer.MediaImportHandler.prototype.importFromScanResult = function( scanResult, destination, directoryPromise) { - var task = new importer.MediaImportHandler.ImportTask( + const task = new importer.MediaImportHandler.ImportTask( this.generateTaskId_(), this.historyLoader_, scanResult, directoryPromise, destination, this.getDisposition_); @@ -98,9 +98,9 @@ */ importer.MediaImportHandler.prototype.onTaskProgress_ = function(task, updateType) { - var UpdateType = importer.TaskQueue.UpdateType; + const UpdateType = importer.TaskQueue.UpdateType; - var item = this.progressCenter_.getItemById(task.taskId); + let item = this.progressCenter_.getItemById(task.taskId); if (!item) { item = new ProgressCenterItem(); item.id = task.taskId; @@ -133,9 +133,9 @@ } else { // Otherwise, finish progress bar. // Display all errors. - var errorIdCounter = 0; + let errorIdCounter = 0; task.failedEntries.forEach(function(entry) { - var errorItem = new ProgressCenterItem(); + const errorItem = new ProgressCenterItem(); errorItem.id = task.taskId_ + '-' + (errorIdCounter++); errorItem.type = ProgressItemType.COPY; errorItem.quiet = true; @@ -196,7 +196,7 @@ } // Update info must exist for ENTRY_CHANGED notifications. console.assert(updateInfo && updateInfo.destination); - var info = + const info = /** @type {!importer.MediaImportHandler.ImportTask.EntryChangedInfo} */ ( updateInfo); @@ -383,7 +383,7 @@ if (this.cancelCallback_) { // Reset the callback before calling it, as the callback might do anything // (including calling #requestCancel again). - var cancelCallback = this.cancelCallback_; + const cancelCallback = this.cancelCallback_; this.cancelCallback_ = null; cancelCallback(); } @@ -391,7 +391,7 @@ /** @private */ importer.MediaImportHandler.ImportTask.prototype.initialize_ = function() { - var stats = this.scanResult_.getStatistics(); + const stats = this.scanResult_.getStatistics(); this.remainingFilesCount_ = stats.newFileCount; this.totalBytes_ = stats.sizeBytes; @@ -406,7 +406,7 @@ */ importer.MediaImportHandler.ImportTask.prototype.importScanEntries_ = function() { - var resolver = new importer.Resolver(); + const resolver = new importer.Resolver(); this.directoryPromise_.then(function(destinationDirectory) { AsyncUtil.forEach( this.importEntries_, this.importOne_.bind(this, destinationDirectory), @@ -498,9 +498,9 @@ importer.MediaImportHandler.ImportTask.prototype.copy_ = function(entry, destinationDirectory) { // A count of the current number of processed bytes for this entry. - var currentBytes = 0; + let currentBytes = 0; - var resolver = new importer.Resolver(); + const resolver = new importer.Resolver(); /** * Updates the task when the copy code reports progress. @@ -508,7 +508,7 @@ * @param {number} processedBytes * @this {importer.MediaImportHandler.ImportTask} */ - var onProgress = function(sourceUrl, processedBytes) { + const onProgress = function(sourceUrl, processedBytes) { // Update the running total, then send a progress update. this.processedBytes_ -= currentBytes; this.processedBytes_ += processedBytes; @@ -522,7 +522,7 @@ * @param {Entry} destinationEntry * @this {importer.MediaImportHandler.ImportTask} */ - var onEntryChanged = function(sourceUrl, destinationEntry) { + const onEntryChanged = function(sourceUrl, destinationEntry) { this.processedBytes_ -= currentBytes; this.processedBytes_ += entry.size; destinationEntry.size = entry.size; @@ -539,7 +539,7 @@ * @param {Entry} destinationEntry The new destination entry. * @this {importer.MediaImportHandler.ImportTask} */ - var onComplete = function(destinationEntry) { + const onComplete = function(destinationEntry) { this.cancelCallback_ = null; this.markAsCopied_(entry, /** @type {!FileEntry} */ (destinationEntry)); this.notify(importer.TaskQueue.UpdateType.PROGRESS); @@ -547,7 +547,7 @@ }; /** @this {importer.MediaImportHandler.ImportTask} */ - var onError = function(error) { + const onError = function(error) { this.cancelCallback_ = null; if (error.name === util.FileError.ABORT_ERR) { // Task cancellations result in the error callback being triggered with an @@ -631,7 +631,7 @@ importer.MediaImportHandler.ImportTask.prototype.sendImportStats_ = function() { - var scanStats = this.scanResult_.getStatistics(); + const scanStats = this.scanResult_.getStatistics(); metrics.recordMediumCount( 'MediaImport.ImportMB', Math.floor(this.processedBytes_ / (1024 * 1024))); @@ -647,7 +647,7 @@ // Finally we want to report on the number of duplicates // that were identified during scanning. - var totalDeduped = 0; + let totalDeduped = 0; // The scan is run without content duplicate check. // Instead, report the number of duplicated files found at import. assert(scanStats.duplicates[importer.Disposition.CONTENT_DUPLICATE] === 0); @@ -656,7 +656,7 @@ Object.keys(scanStats.duplicates).forEach( function(disposition) { - var count = scanStats.duplicates[ + const count = scanStats.duplicates[ /** @type {!importer.Disposition} */ (disposition)]; totalDeduped += count; }, this);
diff --git a/ui/file_manager/file_manager/background/js/media_import_handler_unittest.js b/ui/file_manager/file_manager/background/js/media_import_handler_unittest.js index 44a8531d..3f692a23 100644 --- a/ui/file_manager/file_manager/background/js/media_import_handler_unittest.js +++ b/ui/file_manager/file_manager/background/js/media_import_handler_unittest.js
@@ -5,28 +5,28 @@ 'use strict'; /** @type {!MockProgressCenter} */ -var progressCenter; +let progressCenter; /** @type {!importer.MediaImportHandler} */ -var mediaImporter; +let mediaImporter; /** @type {!importer.TestImportHistory} */ -var importHistory; +let importHistory; /** @type {!importer.DispositionChecker.CheckerFunction} */ -var dispositionChecker; +let dispositionChecker; /** @type {!MockCopyTo} */ -var mockCopier; +let mockCopier; /** @type {!MockFileSystem} */ -var destinationFileSystem; +let destinationFileSystem; /** @type {!Promise<!DirectoryEntry>} */ -var destinationFactory; +let destinationFactory; /** @type {!MockDriveSyncHandler} */ -var driveSyncHandler; +let driveSyncHandler; /** * Mock metrics. @@ -43,7 +43,7 @@ * Mock Chrome APIs * @type {!Object} */ -var mockChrome; +let mockChrome; // Set up the test components. function setUp() { @@ -75,14 +75,14 @@ mockCopier = new MockCopyTo(); // Create and install MockVolumeManager. - var volumeManager = new MockVolumeManager(); + const volumeManager = new MockVolumeManager(); MockVolumeManager.installMockSingleton(volumeManager); // Add fake parented and non-parented roots: /root/ and /other/. - var driveVolumeType = VolumeManagerCommon.VolumeType.DRIVE; - var driveVolumeInfo = /** @type {!VolumeInfo} */ + const driveVolumeType = VolumeManagerCommon.VolumeType.DRIVE; + const driveVolumeInfo = /** @type {!VolumeInfo} */ (volumeManager.getCurrentProfileVolumeInfo(driveVolumeType)); - var driveFileSystem = + const driveFileSystem = /** @type {!MockFileSystem} */ (driveVolumeInfo.fileSystem); driveFileSystem.populate(['/root/', '/other/']); @@ -109,7 +109,7 @@ * Tests media imports. */ function testImportMedia(callback) { - var media = setupFileSystem([ + const media = setupFileSystem([ '/DCIM/photos0/IMG00001.jpg', '/DCIM/photos0/IMG00002.jpg', '/DCIM/photos0/IMG00003.jpg', @@ -118,13 +118,13 @@ '/DCIM/photos1/IMG00006.jpg' ]); - var scanResult = new TestScanResult(media); - var importTask = mediaImporter.importFromScanResult( + const scanResult = new TestScanResult(media); + const importTask = mediaImporter.importFromScanResult( scanResult, importer.Destination.GOOGLE_DRIVE, destinationFactory); - var whenImportDone = new Promise(function(resolve, reject) { + const whenImportDone = new Promise(function(resolve, reject) { importTask.addObserver( /** * @param {!importer.TaskQueue.UpdateType} updateType @@ -144,9 +144,9 @@ reportPromise( whenImportDone.then(function() { - var mockDirectoryEntry = + const mockDirectoryEntry = /** @type {!MockDirectoryEntry} */ (destinationFileSystem.root); - var copiedEntries = mockDirectoryEntry.getAllChildren(); + const copiedEntries = mockDirectoryEntry.getAllChildren(); assertEquals(media.length, copiedEntries.length); }), callback); @@ -158,12 +158,12 @@ * Tests media import duplicate detection. */ function testImportMedia_skipAndMarkDuplicatedFiles(callback) { - var DUPLICATED_FILE_PATH_1 = '/DCIM/photos0/duplicated_1.jpg'; - var DUPLICATED_FILE_PATH_2 = '/DCIM/photos0/duplicated_2.jpg'; - var ORIGINAL_FILE_NAME = 'new_image.jpg'; - var ORIGINAL_FILE_SRC_PATH = '/DCIM/photos0/' + ORIGINAL_FILE_NAME; - var ORIGINAL_FILE_DEST_PATH = '/' + ORIGINAL_FILE_NAME; - var media = setupFileSystem([ + const DUPLICATED_FILE_PATH_1 = '/DCIM/photos0/duplicated_1.jpg'; + const DUPLICATED_FILE_PATH_2 = '/DCIM/photos0/duplicated_2.jpg'; + const ORIGINAL_FILE_NAME = 'new_image.jpg'; + const ORIGINAL_FILE_SRC_PATH = '/DCIM/photos0/' + ORIGINAL_FILE_NAME; + const ORIGINAL_FILE_DEST_PATH = '/' + ORIGINAL_FILE_NAME; + const media = setupFileSystem([ DUPLICATED_FILE_PATH_1, ORIGINAL_FILE_NAME, DUPLICATED_FILE_PATH_2, @@ -180,13 +180,13 @@ }; mediaImporter = new importer.MediaImportHandler( progressCenter, importHistory, dispositionChecker, driveSyncHandler); - var scanResult = new TestScanResult(media); - var importTask = mediaImporter.importFromScanResult( + const scanResult = new TestScanResult(media); + const importTask = mediaImporter.importFromScanResult( scanResult, importer.Destination.GOOGLE_DRIVE, destinationFactory); - var whenImportDone = new Promise(function(resolve, reject) { + const whenImportDone = new Promise(function(resolve, reject) { importTask.addObserver( /** * @param {!importer.TaskQueue.UpdateType} updateType @@ -208,12 +208,12 @@ whenImportDone.then( function() { // Only the new file should be copied. - var mockDirectoryEntry = + const mockDirectoryEntry = /** @type {!MockDirectoryEntry} */ (destinationFileSystem.root); - var copiedEntries = mockDirectoryEntry.getAllChildren(); + const copiedEntries = mockDirectoryEntry.getAllChildren(); assertEquals(1, copiedEntries.length); assertEquals(ORIGINAL_FILE_DEST_PATH, copiedEntries[0].fullPath); - var mockFileEntry = /** @type {!MockFileEntry} */ (media[1]); + const mockFileEntry = /** @type {!MockFileEntry} */ (media[1]); importHistory.assertCopied( mockFileEntry, importer.Destination.GOOGLE_DRIVE); // The 2 duplicated files should be marked as imported. @@ -231,17 +231,17 @@ * Tests media import uses encoded URLs. */ function testImportMedia_EmploysEncodedUrls(callback) { - var media = setupFileSystem([ + const media = setupFileSystem([ '/DCIM/photos0/Mom and Dad.jpg', ]); - var scanResult = new TestScanResult(media); - var importTask = mediaImporter.importFromScanResult( + const scanResult = new TestScanResult(media); + const importTask = mediaImporter.importFromScanResult( scanResult, importer.Destination.GOOGLE_DRIVE, destinationFactory); - var promise = + const promise = new Promise(function(resolve, reject) { importTask.addObserver( /** @@ -260,10 +260,10 @@ } }); }).then(function(copiedEntries) { - var expected = 'Mom%20and%20Dad.jpg'; - var url = copiedEntries[0].toURL(); + const expected = 'Mom%20and%20Dad.jpg'; + const url = copiedEntries[0].toURL(); assertTrue(url.length > expected.length); - var actual = url.substring(url.length - expected.length); + const actual = url.substring(url.length - expected.length); assertEquals(expected, actual); }); @@ -277,7 +277,7 @@ * overwrite one another. */ function testImportMediaWithDuplicateFilenames(callback) { - var media = setupFileSystem([ + const media = setupFileSystem([ '/DCIM/photos0/IMG00001.jpg', '/DCIM/photos0/IMG00002.jpg', '/DCIM/photos0/IMG00003.jpg', @@ -286,13 +286,13 @@ '/DCIM/photos1/IMG00003.jpg' ]); - var scanResult = new TestScanResult(media); - var importTask = mediaImporter.importFromScanResult( + const scanResult = new TestScanResult(media); + const importTask = mediaImporter.importFromScanResult( scanResult, importer.Destination.GOOGLE_DRIVE, destinationFactory); - var whenImportDone = new Promise(function(resolve, reject) { + const whenImportDone = new Promise(function(resolve, reject) { importTask.addObserver( /** * @param {!importer.TaskQueue.UpdateType} updateType @@ -313,9 +313,9 @@ // Verify that we end up with 6, and not 3, destination entries. reportPromise( whenImportDone.then(function() { - var mockDirectoryEntry = + const mockDirectoryEntry = /** @type {!MockDirectoryEntry} */ (destinationFileSystem.root); - var copiedEntries = mockDirectoryEntry.getAllChildren(); + const copiedEntries = mockDirectoryEntry.getAllChildren(); assertEquals(media.length, copiedEntries.length); }), callback); @@ -327,7 +327,7 @@ * Tests that active media imports keep chrome.power awake. */ function testKeepAwakeDuringImport(callback) { - var media = setupFileSystem([ + const media = setupFileSystem([ '/DCIM/photos0/IMG00001.jpg', '/DCIM/photos0/IMG00002.jpg', '/DCIM/photos0/IMG00003.jpg', @@ -336,13 +336,13 @@ '/DCIM/photos1/IMG00006.jpg' ]); - var scanResult = new TestScanResult(media); - var importTask = mediaImporter.importFromScanResult( + const scanResult = new TestScanResult(media); + const importTask = mediaImporter.importFromScanResult( scanResult, importer.Destination.GOOGLE_DRIVE, destinationFactory); - var whenImportDone = new Promise(function(resolve, reject) { + const whenImportDone = new Promise(function(resolve, reject) { importTask.addObserver( /** * @param {!importer.TaskQueue.UpdateType} updateType @@ -366,9 +366,9 @@ whenImportDone.then(function() { assertTrue(mockChrome.power.requestKeepAwakeWasCalled); assertFalse(mockChrome.power.requestKeepAwakeStatus); - var mockDirectoryEntry = + const mockDirectoryEntry = /** @type {!MockDirectoryEntry} */ (destinationFileSystem.root); - var copiedEntries = mockDirectoryEntry.getAllChildren(); + const copiedEntries = mockDirectoryEntry.getAllChildren(); assertEquals(media.length, copiedEntries.length); }), callback); @@ -380,24 +380,24 @@ * Tests that media imports update import history. */ function testUpdatesHistoryAfterImport(callback) { - var entries = setupFileSystem([ + const entries = setupFileSystem([ '/DCIM/photos0/IMG00001.jpg', '/DCIM/photos1/IMG00003.jpg', '/DCIM/photos0/DRIVEDUPE00001.jpg', '/DCIM/photos1/DRIVEDUPE99999.jpg' ]); - var newFiles = entries.slice(0, 2); - var dupeFiles = entries.slice(2); + const newFiles = entries.slice(0, 2); + const dupeFiles = entries.slice(2); - var scanResult = new TestScanResult(entries.slice(0, 2)); + const scanResult = new TestScanResult(entries.slice(0, 2)); scanResult.duplicateFileEntries = dupeFiles; - var importTask = mediaImporter.importFromScanResult( + const importTask = mediaImporter.importFromScanResult( scanResult, importer.Destination.GOOGLE_DRIVE, destinationFactory); - var whenImportDone = new Promise(function(resolve, reject) { + const whenImportDone = new Promise(function(resolve, reject) { importTask.addObserver( /** * @param {!importer.TaskQueue.UpdateType} updateType @@ -415,16 +415,16 @@ }); }); - var promise = whenImportDone.then(function() { + const promise = whenImportDone.then(function() { mockCopier.copiedFiles.forEach( /** @param {!MockCopyTo.CopyInfo} copy */ function(copy) { - var mockFileEntry = /** @type {!MockFileEntry} */ (copy.source); + const mockFileEntry = /** @type {!MockFileEntry} */ (copy.source); importHistory.assertCopied( mockFileEntry, importer.Destination.GOOGLE_DRIVE); }); dupeFiles.forEach(function(entry) { - var mockFileEntry = /** @type {!MockFileEntry} */ (entry); + const mockFileEntry = /** @type {!MockFileEntry} */ (entry); importHistory.assertImported( mockFileEntry, importer.Destination.GOOGLE_DRIVE); }); @@ -438,18 +438,18 @@ * Tests that media imports tag entries after import. */ function testTagsEntriesAfterImport(callback) { - var entries = setupFileSystem([ + const entries = setupFileSystem([ '/DCIM/photos0/IMG00001.jpg', '/DCIM/photos1/IMG00003.jpg' ]); - var scanResult = new TestScanResult(entries); - var importTask = mediaImporter.importFromScanResult( + const scanResult = new TestScanResult(entries); + const importTask = mediaImporter.importFromScanResult( scanResult, importer.Destination.GOOGLE_DRIVE, destinationFactory); - var whenImportDone = new Promise(function(resolve, reject) { + const whenImportDone = new Promise(function(resolve, reject) { importTask.addObserver( /** * @param {!importer.TaskQueue.UpdateType} updateType @@ -467,7 +467,7 @@ }); }); - var taggedEntries = []; + const taggedEntries = []; // Replace chrome.fileManagerPrivate.setEntryTag with a listener. mockChrome.fileManagerPrivate.setEntryTag = function(entry) { taggedEntries.push(entry); @@ -487,7 +487,7 @@ * Tests cancelling a media import. */ function testImportCancellation(callback) { - var media = setupFileSystem([ + const media = setupFileSystem([ '/DCIM/photos0/IMG00001.jpg', '/DCIM/photos0/IMG00002.jpg', '/DCIM/photos0/IMG00003.jpg', @@ -497,15 +497,15 @@ ]); /** @const {number} */ - var EXPECTED_COPY_COUNT = 3; + const EXPECTED_COPY_COUNT = 3; - var scanResult = new TestScanResult(media); - var importTask = mediaImporter.importFromScanResult( + const scanResult = new TestScanResult(media); + const importTask = mediaImporter.importFromScanResult( scanResult, importer.Destination.GOOGLE_DRIVE, destinationFactory); - var whenImportCancelled = new Promise(function(resolve, reject) { + const whenImportCancelled = new Promise(function(resolve, reject) { importTask.addObserver( /** * @param {!importer.TaskQueue.UpdateType} updateType @@ -519,7 +519,7 @@ }); // Simulate cancellation after the expected number of copies is done. - var copyCount = 0; + let copyCount = 0; importTask.addObserver(function(updateType) { if (updateType === importer.MediaImportHandler.ImportTask.UpdateType.ENTRY_CHANGED) { @@ -532,9 +532,9 @@ reportPromise( whenImportCancelled.then(function() { - var mockDirectoryEntry = + const mockDirectoryEntry = /** @type {!MockDirectoryEntry} */ (destinationFileSystem.root); - var copiedEntries = mockDirectoryEntry.getAllChildren(); + const copiedEntries = mockDirectoryEntry.getAllChildren(); assertEquals(EXPECTED_COPY_COUNT, copiedEntries.length); }), callback); @@ -550,7 +550,7 @@ // Elsewhere, it's better for errors to be seen by test authors. importer.setupTestLogger().quiet(); - var media = setupFileSystem([ + const media = setupFileSystem([ '/DCIM/photos0/IMG00001.jpg', '/DCIM/photos0/IMG00002.jpg', '/DCIM/photos0/IMG00003.jpg', @@ -560,15 +560,15 @@ ]); /** @const {number} */ - var EXPECTED_COPY_COUNT = 5; + const EXPECTED_COPY_COUNT = 5; - var scanResult = new TestScanResult(media); - var importTask = mediaImporter.importFromScanResult( + const scanResult = new TestScanResult(media); + const importTask = mediaImporter.importFromScanResult( scanResult, importer.Destination.GOOGLE_DRIVE, destinationFactory); - var whenImportDone = new Promise(function(resolve, reject) { + const whenImportDone = new Promise(function(resolve, reject) { importTask.addObserver( /** * @param {!importer.TaskQueue.UpdateType} updateType @@ -582,7 +582,7 @@ }); // Simulate an error after 3 imports. - var copyCount = 0; + let copyCount = 0; importTask.addObserver(function(updateType) { if (updateType === importer.MediaImportHandler.ImportTask.UpdateType.ENTRY_CHANGED) { @@ -596,9 +596,9 @@ // Verify that the error didn't result in some files not being copied. reportPromise( whenImportDone.then(function() { - var mockDirectoryEntry = + const mockDirectoryEntry = /** @type {!MockDirectoryEntry} */ (destinationFileSystem.root); - var copiedEntries = mockDirectoryEntry.getAllChildren(); + const copiedEntries = mockDirectoryEntry.getAllChildren(); assertEquals(EXPECTED_COPY_COUNT, copiedEntries.length); }), callback); @@ -675,7 +675,7 @@ if (this.simulateError_) { this.simulateError_ = false; - var error = new Error('test error'); + const error = new Error('test error'); this.errorCallback_(error); return; } @@ -688,7 +688,7 @@ })); // Copy the file. - var copyErrorCallback = /** @type {!function(FileError):*} */ + const copyErrorCallback = /** @type {!function(FileError):*} */ (this.errorCallback_.bind(this)); source.copyTo(parent, newName, function(newEntry) { this.entryChangedCallback_(source.toURL(), parent);
diff --git a/ui/file_manager/file_manager/background/js/media_scanner.js b/ui/file_manager/file_manager/background/js/media_scanner.js index eba7f1c..d529de4 100644 --- a/ui/file_manager/file_manager/background/js/media_scanner.js +++ b/ui/file_manager/file_manager/background/js/media_scanner.js
@@ -54,7 +54,7 @@ /** @override */ importer.DefaultMediaScanner.prototype.removeObserver = function(observer) { - var index = this.observers_.indexOf(observer); + const index = this.observers_.indexOf(observer); if (index > -1) { this.observers_.splice(index, 1); } else { @@ -65,10 +65,10 @@ /** @override */ importer.DefaultMediaScanner.prototype.scanDirectory = function(directory, mode) { - var scan = this.createScanResult_(mode); + const scan = this.createScanResult_(mode); console.info(scan.name + ': Scanning directory ' + directory.fullPath); - var watcher = this.watcherFactory_( + const watcher = this.watcherFactory_( (/** @this {importer.DefaultMediaScanner} */ function() { scan.cancel(); @@ -98,12 +98,12 @@ if (entries.length === 0) { throw new Error('Cannot scan empty list.'); } - var scan = this.createScanResult_(mode); + const scan = this.createScanResult_(mode); console.info( scan.name + ': Scanning fixed set of ' + entries.length + ' entries.'); - var watcher = this.watcherFactory_( + const watcher = this.watcherFactory_( /** @this {importer.DefaultMediaScanner} */ (function() { scan.cancel(); @@ -111,7 +111,7 @@ }).bind(this)); scan.setCandidateCount(entries.length); - var scanPromises = entries.map(this.onFileEntryFound_.bind(this, scan)); + const scanPromises = entries.map(this.onFileEntryFound_.bind(this, scan)); Promise.all(scanPromises) .then(scan.resolve) @@ -143,14 +143,14 @@ importer.DefaultMediaScanner.prototype.scanMediaFiles_ = function(scan, entries) { scan.setCandidateCount(entries.length); - var handleFileEntry = this.onFileEntryFound_.bind(this, scan); + const handleFileEntry = this.onFileEntryFound_.bind(this, scan); /** * @param {number} begin The beginning offset in the list of entries * to process. * @return {!Promise} */ - var scanBatch = function(begin) { + const scanBatch = function(begin) { if (scan.canceled()) { console.debug( scan.name + ': Skipping remaining ' + @@ -160,9 +160,9 @@ } // the second arg to slice is an exclusive end index, so we +1 batch size. - var end = begin + importer.DefaultMediaScanner.SCAN_BATCH_SIZE; + const end = begin + importer.DefaultMediaScanner.SCAN_BATCH_SIZE; console.log(scan.name + ': Processing batch ' + begin + '-' + (end - 1)); - var batch = entries.slice(begin, end); + const batch = entries.slice(begin, end); return Promise.all( batch.map(handleFileEntry)) @@ -203,7 +203,7 @@ */ importer.DefaultMediaScanner.prototype.crawlDirectory_ = function(directory, watcher) { - var mediaFiles = []; + const mediaFiles = []; return fileOperationUtil.findEntriesRecursively( directory, @@ -537,7 +537,7 @@ * @private */ importer.DefaultScanResult.prototype.calculateProgress_ = function() { - var progress = (this.candidateCount_ > 0) ? + let progress = (this.candidateCount_ > 0) ? Math.floor(this.candidatesProcessed_ / this.candidateCount_ * 100) : 0; @@ -622,7 +622,7 @@ return; } this.triggered = true; - for (var url in this.watchedDirectories_) { + for (const url in this.watchedDirectories_) { window.webkitResolveLocalFileSystemURL(url, function(entry) { if (chrome.runtime.lastError) { console.error(chrome.runtime.lastError.name);
diff --git a/ui/file_manager/file_manager/background/js/media_scanner_unittest.js b/ui/file_manager/file_manager/background/js/media_scanner_unittest.js index 063957d1..644874b 100644 --- a/ui/file_manager/file_manager/background/js/media_scanner_unittest.js +++ b/ui/file_manager/file_manager/background/js/media_scanner_unittest.js
@@ -6,30 +6,30 @@ * Stub out the metrics package. * @type {!Object<!string, !Function>} */ -var metrics = { +const metrics = { recordTime: function() {}, recordValue: function() {} }; /** @type {!importer.DefaultMediaScanner} */ -var scanner; +let scanner; /** * @const {importer.ScanMode} */ -var scanMode = importer.ScanMode.HISTORY; +const scanMode = importer.ScanMode.HISTORY; /** @type {!importer.TestImportHistory} */ -var importHistory; +let importHistory; /** @type {!TestDirectoryWatcher} */ -var watcher; +let watcher; /** * @type {function(!FileEntry, !importer.Destination): * !Promise<!importer.Disposition>} */ -var dispositionChecker; +let dispositionChecker; // Set up the test components. function setUp() { @@ -65,7 +65,7 @@ } function testIsScanning(callback) { - var filenames = [ + const filenames = [ 'happy', 'thoughts' ]; @@ -78,14 +78,14 @@ * @param {!DirectoryEntry} root */ function(root) { - var results = scanner.scanDirectory(root, scanMode); + const results = scanner.scanDirectory(root, scanMode); assertFalse(results.isFinal()); }), callback); } function testObserverNotifiedOnScanFinish(callback) { - var filenames = [ + const filenames = [ 'happy', 'thoughts' ]; @@ -101,7 +101,7 @@ // We kick this off first so we can capture the result for // use in an assert. Promises ensure the scan won't finish // until after our function is fully processed. - var result = scanner.scanDirectory(root, scanMode); + const result = scanner.scanDirectory(root, scanMode); scanner.addObserver( function(eventType, scanResult) { assertEquals(importer.ScanEvent.FINALIZED, eventType); @@ -118,13 +118,13 @@ * Verifies that scanFiles slurps up all specified files. */ function testScanFiles(callback) { - var filenames = [ + const filenames = [ 'foo', 'foo.jpg', 'bar.gif', 'baz.avi' ]; - var expectedFiles = [ + const expectedFiles = [ '/testScanFiles/foo.jpg', '/testScanFiles/bar.gif', '/testScanFiles/baz.avi' @@ -146,7 +146,7 @@ * Verifies that scanFiles skips duplicated files. */ function testScanFilesIgnoresPreviousImports(callback) { - var filenames = [ + const filenames = [ 'oldimage1234.jpg', // a history duplicate 'driveimage1234.jpg', // a content duplicate 'foo.jpg', @@ -166,7 +166,7 @@ return Promise.resolve(importer.Disposition.ORIGINAL); }; - var expectedFiles = [ + const expectedFiles = [ '/testScanFilesIgnoresPreviousImports/foo.jpg', '/testScanFilesIgnoresPreviousImports/bar.gif', '/testScanFilesIgnoresPreviousImports/baz.avi' @@ -188,7 +188,7 @@ * Verifies that scanning a simple single-level directory structure works. */ function testEmptyScanResults(callback) { - var filenames = [ + const filenames = [ 'happy', 'thoughts' ]; @@ -211,7 +211,7 @@ * Verifies that scanning a simple single-level directory structure works. */ function testSingleLevel(callback) { - var filenames = [ + const filenames = [ 'foo', 'foo.jpg', 'bar.gif', @@ -219,7 +219,7 @@ 'foo.mp3', 'bar.txt' ]; - var expectedFiles = [ + const expectedFiles = [ '/testSingleLevel/foo.jpg', '/testSingleLevel/bar.gif', '/testSingleLevel/baz.avi' @@ -244,7 +244,7 @@ * progress at completion. */ function testProgress(callback) { - var filenames = [ + const filenames = [ 'foo', 'foo.jpg', 'bar.gif', @@ -252,7 +252,7 @@ 'foo.mp3', 'bar.txt' ]; - var expectedFiles = [ + const expectedFiles = [ '/testProgress/foo.jpg', '/testProgress/bar.gif', '/testProgress/baz.avi' @@ -279,7 +279,7 @@ importHistory.importedPaths[ '/testIgnoresPreviousImports/oldimage1234.jpg'] = [importer.Destination.GOOGLE_DRIVE]; - var filenames = [ + const filenames = [ 'oldimage1234.jpg', // a history duplicate 'driveimage1234.jpg', // a content duplicate 'foo.jpg', @@ -299,13 +299,13 @@ return Promise.resolve(importer.Disposition.ORIGINAL); }; - var expectedFiles = [ + const expectedFiles = [ '/testIgnoresPreviousImports/foo.jpg', '/testIgnoresPreviousImports/bar.gif', '/testIgnoresPreviousImports/baz.avi' ]; - var promise = + const promise = makeTestFileSystemRoot('testIgnoresPreviousImports') .then(populateDir.bind(null, filenames)) .then( @@ -325,7 +325,7 @@ importHistory.importedPaths[ '/testTracksDuplicates/oldimage1234.jpg'] = [importer.Destination.GOOGLE_DRIVE]; - var filenames = [ + const filenames = [ 'oldimage1234.jpg', // a history duplicate 'driveimage1234.jpg', // a content duplicate 'driveimage9999.jpg', // a content duplicate @@ -348,12 +348,12 @@ return Promise.resolve(importer.Disposition.ORIGINAL); }; - var expectedDuplicates = [ + const expectedDuplicates = [ '/testTracksDuplicates/driveimage1234.jpg', '/testTracksDuplicates/driveimage9999.jpg' ]; - var promise = + const promise = makeTestFileSystemRoot('testTracksDuplicates') .then(populateDir.bind(null, filenames)) .then( @@ -370,7 +370,7 @@ } function testMultiLevel(callback) { - var filenames = [ + const filenames = [ 'foo.jpg', 'bar', [ @@ -386,7 +386,7 @@ ] ] ]; - var expectedFiles = [ + const expectedFiles = [ '/testMultiLevel/foo.jpg', '/testMultiLevel/dir1/bar.0.jpg', '/testMultiLevel/dir2/bar.1.gif', @@ -409,7 +409,7 @@ } function testDedupesFilesInScanResult(callback) { - var filenames = [ + const filenames = [ 'foo.jpg', 'bar.jpg', [ @@ -428,7 +428,7 @@ ] ] ]; - var expectedFiles = [ + const expectedFiles = [ '/testDedupesFilesInScanResult/foo.jpg', '/testDedupesFilesInScanResult/bar.jpg' ]; @@ -452,10 +452,10 @@ * Verifies that scanning a simple single-level directory structure works. */ function testDefaultScanResult() { - var hashGenerator = function(file) { + const hashGenerator = function(file) { return file.toURL(); }; - var scan = new importer.DefaultScanResult(scanMode, hashGenerator); + const scan = new importer.DefaultScanResult(scanMode, hashGenerator); // 0 before we set candidate count assertProgress(0, scan); @@ -472,7 +472,7 @@ } function testInvalidation(callback) { - var invalidatePromise = new Promise(function(fulfill) { + const invalidatePromise = new Promise(function(fulfill) { scanner.addObserver(fulfill); }); reportPromise( @@ -582,7 +582,7 @@ }) .then(populateDir.bind(null, filename)); } else { - var name = /** @type {string} */ (filename); + const name = /** @type {string} */ (filename); return new Promise(function(resolve, reject) { dir.getFile(name, {create: true}, resolve, reject); });
diff --git a/ui/file_manager/file_manager/background/js/metadata_proxy.js b/ui/file_manager/file_manager/background/js/metadata_proxy.js index 70858a19..71bb86e 100644 --- a/ui/file_manager/file_manager/background/js/metadata_proxy.js +++ b/ui/file_manager/file_manager/background/js/metadata_proxy.js
@@ -3,7 +3,7 @@ // found in the LICENSE file. // Namespace -var metadataProxy = {}; +const metadataProxy = {}; /** * Maximum number of entries whose metadata can be cached. @@ -24,7 +24,7 @@ * @return {!Promise<!Metadata>} */ metadataProxy.getEntryMetadata = function(entry) { - var entryURL = entry.toURL(); + const entryURL = entry.toURL(); if (metadataProxy.cache_.hasKey(entryURL)) { return Promise.resolve(metadataProxy.cache_.get(entryURL)); } else {
diff --git a/ui/file_manager/file_manager/background/js/mock_file_operation_manager.js b/ui/file_manager/file_manager/background/js/mock_file_operation_manager.js index 8a76fbe..014b3de 100644 --- a/ui/file_manager/file_manager/background/js/mock_file_operation_manager.js +++ b/ui/file_manager/file_manager/background/js/mock_file_operation_manager.js
@@ -83,7 +83,7 @@ * @return {string} */ MockFileOperationManager.prototype.generateTaskId = function() { - var newTaskId = 'task' + this.generatedTaskIds.length; + const newTaskId = 'task' + this.generatedTaskIds.length; this.generatedTaskIds.push(newTaskId); return newTaskId; };
diff --git a/ui/file_manager/file_manager/background/js/mock_media_scanner.js b/ui/file_manager/file_manager/background/js/mock_media_scanner.js index aa198d3..54f9c00 100644 --- a/ui/file_manager/file_manager/background/js/mock_media_scanner.js +++ b/ui/file_manager/file_manager/background/js/mock_media_scanner.js
@@ -40,7 +40,7 @@ /** @override */ TestMediaScanner.prototype.scanDirectory = function(directory, mode) { - var scan = new TestScanResult(this.fileEntries); + const scan = new TestScanResult(this.fileEntries); scan.totalBytes = this.totalBytes; scan.scanDuration = this.scanDuration; this.scans_.push(scan); @@ -49,7 +49,7 @@ /** @override */ TestMediaScanner.prototype.scanFiles = function(entries, mode) { - var scan = new TestScanResult(this.fileEntries); + const scan = new TestScanResult(this.fileEntries); scan.totalBytes = this.totalBytes; scan.scanDuration = this.scanDuration; this.scans_.push(scan); @@ -63,7 +63,7 @@ /** @override */ TestMediaScanner.prototype.removeObserver = function(observer) { - var index = this.observers.indexOf(observer); + const index = this.observers.indexOf(observer); if (index !== -1) { this.observers.splice(index, 1); } else { @@ -83,7 +83,7 @@ */ TestMediaScanner.prototype.update = function() { assertTrue(this.scans_.length > 0); - var scan = this.scans_[this.scans_.length - 1]; + const scan = this.scans_[this.scans_.length - 1]; this.observers.forEach( function(observer) { observer(importer.ScanEvent.UPDATED, scan); @@ -230,7 +230,7 @@ /** @override */ TestScanResult.prototype.getStatistics = function() { - var duplicates = {}; + const duplicates = {}; duplicates[importer.Disposition.CONTENT_DUPLICATE] = 0; duplicates[importer.Disposition.HISTORY_DUPLICATE] = 0; duplicates[importer.Disposition.SCAN_DUPLICATE] = 0;
diff --git a/ui/file_manager/file_manager/background/js/mock_volume_manager.js b/ui/file_manager/file_manager/background/js/mock_volume_manager.js index f01b6de..063d536 100644 --- a/ui/file_manager/file_manager/background/js/mock_volume_manager.js +++ b/ui/file_manager/file_manager/background/js/mock_volume_manager.js
@@ -45,13 +45,14 @@ * @param {!VolumeManagerCommon.VolumeType} type * @param {string} volumeId * @param {string} label + * @param {string=} providerId * * @return {!VolumeInfo} */ -MockVolumeManager.prototype.createVolumeInfo = - function(type, volumeId, label) { - var volumeInfo = - MockVolumeManager.createMockVolumeInfo(type, volumeId, label); +MockVolumeManager.prototype.createVolumeInfo = function( + type, volumeId, label, providerId) { + const volumeInfo = MockVolumeManager.createMockVolumeInfo( + type, volumeId, label, undefined, providerId); this.volumeInfoList.add(volumeInfo); return volumeInfo; }; @@ -123,8 +124,8 @@ * @return {VolumeInfo} Volume info. */ MockVolumeManager.prototype.getCurrentProfileVolumeInfo = function(volumeType) { - for (var i = 0; i < this.volumeInfoList.length; i++) { - var volumeInfo = this.volumeInfoList.item(i); + for (let i = 0; i < this.volumeInfoList.length; i++) { + const volumeInfo = this.volumeInfoList.item(i); if (volumeInfo.profile.isCurrentProfile && volumeInfo.volumeType === volumeType) { return volumeInfo; @@ -147,14 +148,15 @@ * @param {string} volumeId Volume id. * @param {string=} label Label. * @param {string=} devicePath Device path. + * @param {string=} providerId Provider id. * @return {!VolumeInfo} Created mock VolumeInfo. */ MockVolumeManager.createMockVolumeInfo = function( - type, volumeId, label, devicePath) { - var fileSystem = new MockFileSystem(volumeId, 'filesystem:' + volumeId); + type, volumeId, label, devicePath, providerId) { + const fileSystem = new MockFileSystem(volumeId, 'filesystem:' + volumeId); // If there's no label set it to volumeId to make it shorter to write tests. - var volumeInfo = new VolumeInfoImpl( + const volumeInfo = new VolumeInfoImpl( type, volumeId, fileSystem, '', // error '', // deviceType @@ -163,7 +165,7 @@ false, // isReadOnlyRemovableDevice {isCurrentProfile: true, displayName: ''}, // profile label || volumeId, // label - undefined, // providerId + providerId, // providerId false, // hasMedia false, // configurable false, // watchable
diff --git a/ui/file_manager/file_manager/background/js/progress_center.js b/ui/file_manager/file_manager/background/js/progress_center.js index 0d7f44f6..54da380 100644 --- a/ui/file_manager/file_manager/background/js/progress_center.js +++ b/ui/file_manager/file_manager/background/js/progress_center.js
@@ -9,7 +9,7 @@ * @struct * @implements {ProgressCenter} */ -var ProgressCenterImpl = function() { +const ProgressCenterImpl = function() { /** * Current items managed by the progress center. * @type {Array<!ProgressCenterItem>} @@ -94,8 +94,8 @@ */ ProgressCenterImpl.Notifications_.prototype.updateItem = function( item, newItemAcceptable) { - var NotificationState = ProgressCenterImpl.Notifications_.NotificationState_; - var newlyAdded = !(item.id in this.ids_); + const NotificationState = ProgressCenterImpl.Notifications_.NotificationState_; + const newlyAdded = !(item.id in this.ids_); // If new item is not acceptable, just return. if (newlyAdded && !newItemAcceptable) { @@ -113,7 +113,7 @@ } } else { // This notification is no longer tracked. - var previousState = this.ids_[item.id]; + const previousState = this.ids_[item.id]; delete this.ids_[item.id]; // Clear notifications for complete or canceled items. if (item.state === ProgressItemState.CANCELED || @@ -129,7 +129,7 @@ // Create/update the notification with the item. this.queue_.run(function(proceed) { - var params = { + const params = { title: chrome.runtime.getManifest().name, iconUrl: chrome.runtime.getURL('/common/images/icon96.png'), type: item.state === ProgressItemState.PROGRESSING ? 'progress' : 'basic', @@ -195,7 +195,7 @@ */ ProgressCenterImpl.prototype.updateItem = function(item) { // Update item. - var index = this.getItemIndex_(item.id); + const index = this.getItemIndex_(item.id); if (item.state === ProgressItemState.PROGRESSING) { if (index === -1) { this.items_.push(item); @@ -210,7 +210,7 @@ } // Update panels. - for (var i = 0; i < this.panels_.length; i++) { + for (let i = 0; i < this.panels_.length; i++) { this.panels_[i].updateItem(item); } @@ -223,7 +223,7 @@ * @param {string} id Progress ID to be requested to cancel. */ ProgressCenterImpl.prototype.requestCancel = function(id) { - var item = this.getItemById(id); + const item = this.getItemById(id); if (item && item.cancelCallback) { item.cancelCallback(); } @@ -235,7 +235,7 @@ * @private */ ProgressCenterImpl.prototype.onNotificationDismissed_ = function(id) { - var item = this.getItemById(id); + const item = this.getItemById(id); if (item && item.state === ProgressItemState.ERROR) { this.dismissErrorItem_(id); } @@ -254,7 +254,7 @@ this.panels_.push(panel); // Set the current items. - for (var i = 0; i < this.items_.length; i++) { + for (let i = 0; i < this.items_.length; i++) { panel.updateItem(this.items_[i]); } @@ -270,7 +270,7 @@ * @param {ProgressCenterPanel} panel Panel UI. */ ProgressCenterImpl.prototype.removePanel = function(panel) { - var index = this.panels_.indexOf(panel); + const index = this.panels_.indexOf(panel); if (index === -1) { return; } @@ -282,7 +282,7 @@ if (this.panels_.length) { return; } - for (var i = 0; i < this.items_.length; i++) { + for (let i = 0; i < this.items_.length; i++) { this.notifications_.updateItem(this.items_[i], true); } }; @@ -304,7 +304,7 @@ * @private */ ProgressCenterImpl.prototype.getItemIndex_ = function(id) { - for (var i = 0; i < this.items_.length; i++) { + for (let i = 0; i < this.items_.length; i++) { if (this.items_[i].id === id) { return i; } @@ -318,14 +318,14 @@ * @private */ ProgressCenterImpl.prototype.dismissErrorItem_ = function(id) { - var index = this.getItemIndex_(id); + const index = this.getItemIndex_(id); if (index > -1) { this.items_.splice(index, 1); } this.notifications_.dismissErrorItem(id); - for (var i = 0; i < this.panels_.length; i++) { + for (let i = 0; i < this.panels_.length; i++) { this.panels_[i].dismissErrorItem(id); } };
diff --git a/ui/file_manager/file_manager/background/js/runtime_loaded_test_util.js b/ui/file_manager/file_manager/background/js/runtime_loaded_test_util.js index 7c95b17..d6917ab 100644 --- a/ui/file_manager/file_manager/background/js/runtime_loaded_test_util.js +++ b/ui/file_manager/file_manager/background/js/runtime_loaded_test_util.js
@@ -70,9 +70,9 @@ * ID and window information. */ test.util.sync.getWindows = function() { - var windows = {}; + const windows = {}; for (var id in window.appWindows) { - var windowWrapper = window.appWindows[id]; + const windowWrapper = window.appWindows[id]; windows[id] = { outerWidth: windowWrapper.contentWindow.outerWidth, outerHeight: windowWrapper.contentWindow.outerHeight @@ -106,9 +106,9 @@ * @return {number} Error count. */ test.util.sync.getErrorCount = function() { - var totalCount = window.JSErrorCount; - for (var appId in window.appWindows) { - var contentWindow = window.appWindows[appId].contentWindow; + let totalCount = window.JSErrorCount; + for (const appId in window.appWindows) { + const contentWindow = window.appWindows[appId].contentWindow; if (contentWindow.JSErrorCount) { totalCount += contentWindow.JSErrorCount; } @@ -199,7 +199,7 @@ targetQuery = [targetQuery]; } - var elems = + const elems = test.util.sync.deepQuerySelectorAll_(contentWindow.document, targetQuery); return elems.map(function(element) { return extractElementInfo(element, contentWindow, opt_styleNames); @@ -218,14 +218,14 @@ * @private */ test.util.sync.deepQuerySelectorAll_ = function(root, targetQuery) { - var elems = Array.prototype.slice.call(root.querySelectorAll(targetQuery[0])); - var remaining = targetQuery.slice(1); + const elems = Array.prototype.slice.call(root.querySelectorAll(targetQuery[0])); + const remaining = targetQuery.slice(1); if (remaining.length === 0) { return elems; } - var res = []; - for (var i = 0; i < elems.length; i++) { + let res = []; + for (let i = 0; i < elems.length; i++) { if (elems[i].shadowRoot) { res = res.concat( test.util.sync.deepQuerySelectorAll_(elems[i].shadowRoot, remaining)); @@ -287,7 +287,7 @@ * @param {string} text Text to be assigned. */ test.util.sync.inputText = function(contentWindow, query, text) { - var input = contentWindow.document.querySelector(query); + const input = contentWindow.document.querySelector(query); input.value = text; }; @@ -342,11 +342,11 @@ */ test.util.sync.fakeEvent = function( contentWindow, targetQuery, eventType, opt_additionalProperties) { - var event = new Event( + const event = new Event( eventType, /** @type {!EventInit} */ (opt_additionalProperties || {})); if (opt_additionalProperties) { - for (var name in opt_additionalProperties) { + for (const name in opt_additionalProperties) { event[name] = opt_additionalProperties[name]; } } @@ -538,7 +538,7 @@ * otherwise. */ test.util.sync.focus = function(contentWindow, targetQuery) { - var target = contentWindow.document && + const target = contentWindow.document && contentWindow.document.querySelector(targetQuery); if (!target) { @@ -583,14 +583,14 @@ * script. */ test.util.async.getFilesUnderVolume = function(volumeType, names, callback) { - var displayRootPromise = + const displayRootPromise = volumeManagerFactory.getInstance().then(function(volumeManager) { - var volumeInfo = volumeManager.getCurrentProfileVolumeInfo(volumeType); + const volumeInfo = volumeManager.getCurrentProfileVolumeInfo(volumeType); return volumeInfo.resolveDisplayRoot(); }); - var retrievePromise = displayRootPromise.then(function(displayRoot) { - var filesPromise = names.map(function(name) { + const retrievePromise = displayRootPromise.then(function(displayRoot) { + const filesPromise = names.map(function(name) { // TODO(crbug.com/880130): Remove this conditional. if (volumeType === VolumeManagerCommon.VolumeType.DOWNLOADS && util.isMyFilesVolumeEnabled()) { @@ -643,7 +643,7 @@ throw new Error('Invalid request.'); } - var args = request.args.slice(); // shallow copy + const args = request.args.slice(); // shallow copy if (request.appId) { if (window.appWindows[request.appId]) { args.unshift(window.appWindows[request.appId].contentWindow);
diff --git a/ui/file_manager/file_manager/background/js/task_queue.js b/ui/file_manager/file_manager/background/js/task_queue.js index b59776ec..7c52c00 100644 --- a/ui/file_manager/file_manager/background/js/task_queue.js +++ b/ui/file_manager/file_manager/background/js/task_queue.js
@@ -103,7 +103,7 @@ }); // If the task update is a terminal one, move on to the next task. - var UpdateType = importer.TaskQueue.UpdateType; + const UpdateType = importer.TaskQueue.UpdateType; if (updateType === UpdateType.COMPLETE || updateType === UpdateType.CANCELED) { // Assumption: the currently running task is at the head of the queue. @@ -139,7 +139,7 @@ } } - var nextTask = this.tasks_[0]; + const nextTask = this.tasks_[0]; nextTask.run(); };
diff --git a/ui/file_manager/file_manager/background/js/task_queue_unittest.js b/ui/file_manager/file_manager/background/js/task_queue_unittest.js index dfb5144f..c118d05a 100644 --- a/ui/file_manager/file_manager/background/js/task_queue_unittest.js +++ b/ui/file_manager/file_manager/background/js/task_queue_unittest.js
@@ -3,22 +3,22 @@ // found in the LICENSE file. /** @type {!importer.TaskQueue} */ -var queue; +let queue; /** @type {!Object<importer.TaskQueue.UpdateType, number>} */ -var updates = {}; +const updates = {}; function setUp() { queue = new importer.TaskQueue(); // Set up a callback to log updates from running tasks. - for (var updateType in importer.TaskQueue.UpdateType) { + for (const updateType in importer.TaskQueue.UpdateType) { // Reset counts for all update types. updates[importer.TaskQueue.UpdateType[updateType]] = 0; } // Counts the number of updates of each type that have been received. - var updateCallback = function(type, updatedTask) { + const updateCallback = function(type, updatedTask) { updates[type]++; }; queue.addUpdateCallback(updateCallback); @@ -31,7 +31,7 @@ * * @param {string} taskId */ -var TestTask = function(taskId) { +const TestTask = function(taskId) { importer.TaskQueue.BaseTask.call(this, taskId); /** @type {boolean} */ @@ -81,15 +81,15 @@ // Verifies that a queued task gets run. function testRunsTask(callback) { - var task = new TestTask('task0'); + const task = new TestTask('task0'); queue.queueTask(task); reportPromise(task.whenRun(), callback); } // Verifies that multiple queued tasks get run. function testRunsTasks(callback) { - var task0 = new TestTask('task0'); - var task1 = new TestTask('task1'); + const task0 = new TestTask('task0'); + const task1 = new TestTask('task1'); // Make the tasks call Task#notifyComplete when they are run. task0.whenRun().then(function(task) { @@ -109,10 +109,10 @@ // Verifies that the active callback triggers when the queue starts doing work function testOnActiveCalled(callback) { - var task = new TestTask('task0'); + const task = new TestTask('task0'); // Make a promise that resolves when the active callback is triggered. - var whenActive = new Promise(function(resolve) { + const whenActive = new Promise(function(resolve) { queue.setActiveCallback( function() { // Verify that the active callback is called before the task runs. @@ -128,7 +128,7 @@ // Verifies that the idle callback triggers when the queue is empty. function testOnIdleCalled(callback) { - var task = new TestTask('task0'); + const task = new TestTask('task0'); task.whenRun().then(function(task) { task.notifyComplete(); @@ -136,7 +136,7 @@ // Make a promise that resolves when the idle callback is triggered // (i.e. after all queued tasks have finished running). - var whenDone = new Promise(function(resolve) { + const whenDone = new Promise(function(resolve) { queue.setIdleCallback( function() { // Verify that the idle callback is called after the task runs. @@ -152,7 +152,7 @@ // Verifies that the update callback is called when a task reports progress. function testProgressUpdate(callback) { - var task = new TestTask('task0'); + const task = new TestTask('task0'); // Get the task to report some progress, then success, when it's run. task.whenRun() @@ -168,7 +168,7 @@ }); // Make a promise that resolves after the task runs. - var whenDone = new Promise(function(resolve) { + const whenDone = new Promise(function(resolve) { queue.setIdleCallback( function() { // Verify that progress was recorded. @@ -184,7 +184,7 @@ // Verifies that the update callback is called to report successful task // completion. function testSuccessUpdate(callback) { - var task = new TestTask('task0'); + const task = new TestTask('task0'); // Get the task to report success when it's run. task.whenRun().then(function(task) { @@ -193,7 +193,7 @@ queue.queueTask(task); - var whenDone = new Promise(function(resolve) { + const whenDone = new Promise(function(resolve) { queue.setIdleCallback( function() { // Verify that the done callback was called. @@ -207,7 +207,7 @@ // Verifies that the update callback is called to report task errors. function testErrorUpdate(callback) { - var task = new TestTask('task0'); + const task = new TestTask('task0'); // Get the task to report an error when it's run. task.whenRun().then( @@ -220,7 +220,7 @@ queue.queueTask(task); - var whenDone = new Promise(function(resolve) { + const whenDone = new Promise(function(resolve) { queue.setIdleCallback( function() { // Verify that the done callback was called. @@ -233,8 +233,8 @@ } function testOnTaskCancelled(callback) { - var task0 = new TestTask('task0'); - var task1 = new TestTask('task1'); + const task0 = new TestTask('task0'); + const task1 = new TestTask('task1'); // Make the tasks call Task#notifyComplete when they are run. task0.whenRun().then(function(task) {
diff --git a/ui/file_manager/file_manager/background/js/test_import_history.js b/ui/file_manager/file_manager/background/js/test_import_history.js index 2029ca49..4184cb2 100644 --- a/ui/file_manager/file_manager/background/js/test_import_history.js +++ b/ui/file_manager/file_manager/background/js/test_import_history.js
@@ -73,7 +73,7 @@ */ importer.TestImportHistory.prototype.wasCopied_ = function(entry, destination) { - var path = entry.fullPath; + const path = entry.fullPath; return path in this.copiedPaths && this.copiedPaths[path].indexOf(destination) > -1; }; @@ -81,14 +81,14 @@ /** @override */ importer.TestImportHistory.prototype.wasCopied = function(entry, destination) { - var path = entry.fullPath; + const path = entry.fullPath; return Promise.resolve(this.wasCopied_(entry, destination)); }; /** @override */ importer.TestImportHistory.prototype.markCopied = function(entry, destination, destinationUrl) { - var path = entry.fullPath; + const path = entry.fullPath; if (path in this.copiedPaths) { this.copiedPaths[path].push(destination); } else { @@ -120,7 +120,7 @@ */ importer.TestImportHistory.prototype.wasImported_ = function(entry, destination) { - var path = entry.fullPath; + const path = entry.fullPath; return path in this.importedPaths && this.importedPaths[path].indexOf(destination) > -1; }; @@ -128,14 +128,14 @@ /** @override */ importer.TestImportHistory.prototype.wasImported = function(entry, destination) { - var path = entry.fullPath; + const path = entry.fullPath; return Promise.resolve(this.wasImported_(entry, destination)); }; /** @override */ importer.TestImportHistory.prototype.markImported = function(entry, destination) { - var path = entry.fullPath; + const path = entry.fullPath; if (path in this.importedPaths) { this.importedPaths[path].push(destination); } else {
diff --git a/ui/file_manager/file_manager/background/js/test_util.js b/ui/file_manager/file_manager/background/js/test_util.js index 92ba7d1..0c148b1 100644 --- a/ui/file_manager/file_manager/background/js/test_util.js +++ b/ui/file_manager/file_manager/background/js/test_util.js
@@ -24,10 +24,10 @@ * @return {string} Name of selected tree item. */ test.util.sync.getSelectedTreeItem = function(contentWindow) { - var tree = contentWindow.document.querySelector('#directory-tree'); - var items = tree.querySelectorAll('.tree-item'); - var selected = []; - for (var i = 0; i < items.length; ++i) { + const tree = contentWindow.document.querySelector('#directory-tree'); + const items = tree.querySelectorAll('.tree-item'); + const selected = []; + for (let i = 0; i < items.length; ++i) { if (items[i].hasAttribute('selected')) { return items[i].querySelector('.label').textContent; } @@ -48,11 +48,11 @@ * @return {Array<Array<string>>} Details for each visible file row. */ test.util.sync.getFileList = function(contentWindow) { - var table = contentWindow.document.querySelector('#detail-table'); - var rows = table.querySelectorAll('li'); - var fileList = []; - for (var j = 0; j < rows.length; ++j) { - var row = rows[j]; + const table = contentWindow.document.querySelector('#detail-table'); + const rows = table.querySelectorAll('li'); + const fileList = []; + for (let j = 0; j < rows.length; ++j) { + const row = rows[j]; fileList.push([ row.querySelector('.filename-label').textContent, row.querySelector('.size').textContent, @@ -71,10 +71,10 @@ * @return {Array<string>} Selected file names. */ test.util.sync.getSelectedFiles = function(contentWindow) { - var table = contentWindow.document.querySelector('#detail-table'); - var rows = table.querySelectorAll('li'); - var selected = []; - for (var i = 0; i < rows.length; ++i) { + const table = contentWindow.document.querySelector('#detail-table'); + const rows = table.querySelectorAll('li'); + const selected = []; + for (let i = 0; i < rows.length; ++i) { if (rows[i].hasAttribute('selected')) { selected.push(rows[i].querySelector('.filename-label').textContent); } @@ -90,12 +90,12 @@ * @return {boolean} True if file got selected, false otherwise. */ test.util.sync.selectFile = function(contentWindow, filename) { - var rows = contentWindow.document.querySelectorAll('#detail-table li'); + const rows = contentWindow.document.querySelectorAll('#detail-table li'); test.util.sync.focus(contentWindow, '#file-list'); test.util.sync.fakeKeyDown( contentWindow, '#file-list', 'Home', false, false, false); - for (var index = 0; index < rows.length; ++index) { - var selection = test.util.sync.getSelectedFiles(contentWindow); + for (let index = 0; index < rows.length; ++index) { + const selection = test.util.sync.getSelectedFiles(contentWindow); if (selection.length === 1 && selection[0] === filename) { return true; } @@ -115,7 +115,7 @@ * sent, false otherwise. */ test.util.sync.openFile = function(contentWindow, filename) { - var query = '#file-list li.table-row[selected] .filename-label span'; + const query = '#file-list li.table-row[selected] .filename-label span'; return test.util.sync.selectFile(contentWindow, filename) && test.util.sync.fakeMouseDoubleClick(contentWindow, query); }; @@ -192,12 +192,12 @@ * @return {boolean} True if file got selected, false otherwise. */ test.util.sync.selectFolderInTree = function(contentWindow, folderName) { - var items = + const items = contentWindow.document.querySelectorAll('#directory-tree .tree-item'); test.util.sync.fakeKeyDown( contentWindow, '#directory-tree', 'Home', false, false, false); - for (var index = 0; index < items.length; ++index) { - var selectedTreeItemName = + for (let index = 0; index < items.length; ++index) { + const selectedTreeItemName = test.util.sync.getSelectedTreeItem(contentWindow); if (selectedTreeItemName === folderName) { test.util.sync.fakeKeyDown( @@ -220,7 +220,7 @@ * @return {boolean} True if folder got expanded, false otherwise. */ test.util.sync.expandSelectedFolderInTree = function(contentWindow) { - var selectedItem = contentWindow.document.querySelector( + const selectedItem = contentWindow.document.querySelector( '#directory-tree .tree-item[selected]'); if (!selectedItem) { console.error('Unexpected; no tree item currently selected.'); @@ -240,7 +240,7 @@ * @return {boolean} True if folder got expanded, false otherwise. */ test.util.sync.collapseSelectedFolderInTree = function(contentWindow) { - var selectedItem = contentWindow.document.querySelector( + const selectedItem = contentWindow.document.querySelector( '#directory-tree .tree-item[selected]'); if (!selectedItem) { console.error('Unexpected; no tree item currently selected.'); @@ -293,10 +293,10 @@ * @return {!Array<string>} List of visible item names. */ test.util.sync.getTreeItems = function(contentWindow) { - var items = contentWindow.document.querySelectorAll( + const items = contentWindow.document.querySelectorAll( '#directory-tree .tree-item'); - var result = []; - for (var i = 0; i < items.length; i++) { + const result = []; + for (let i = 0; i < items.length; i++) { if (items[i].matches('.tree-children:not([expanded]) *')) { continue; } @@ -326,7 +326,7 @@ */ test.util.async.executeScriptInWebView = function( contentWindow, webViewQuery, code, callback) { - var webView = contentWindow.document.querySelector(webViewQuery); + const webView = contentWindow.document.querySelector(webViewQuery); webView.executeScript({code: code}, callback); }; @@ -390,12 +390,12 @@ */ test.util.sync.overrideInstallWebstoreItemApi = function(contentWindow, expectedItemId, intendedError) { - var setLastError = function(message) { + const setLastError = function(message) { contentWindow.chrome.runtime.lastError = message ? {message: message} : undefined; }; - var installWebstoreItem = function(itemId, silentInstallation, callback) { + const installWebstoreItem = function(itemId, silentInstallation, callback) { setTimeout(function() { if (itemId !== expectedItemId) { setLastError('Invalid Chrome Web Store item ID'); @@ -423,19 +423,19 @@ * @return {boolean} Always return true. */ test.util.sync.overrideTasks = function(contentWindow, taskList) { - var getFileTasks = function(entries, onTasks) { + const getFileTasks = function(entries, onTasks) { // Call onTask asynchronously (same with original getFileTasks). setTimeout(function() { onTasks(taskList); }, 0); }; - var executeTask = function(taskId, entry) { + const executeTask = function(taskId, entry) { test.util.executedTasks_.push(taskId); }; - var setDefaultTask = function(taskId) { - for (var i = 0; i < taskList.length; i++) { + const setDefaultTask = function(taskId) { + for (let i = 0; i < taskList.length; i++) { taskList[i].isDefault = taskList[i].taskId === taskId; } }; @@ -468,10 +468,10 @@ * @return {boolean} True if the menu is found and run. */ test.util.sync.runVisitDesktopMenu = function(contentWindow, profileId) { - var list = contentWindow.document.querySelectorAll('.visit-desktop'); - for (var i = 0; i < list.length; ++i) { + const list = contentWindow.document.querySelectorAll('.visit-desktop'); + for (let i = 0; i < list.length; ++i) { if (list[i].label.indexOf(profileId) != -1) { - var activateEvent = contentWindow.document.createEvent('Event'); + const activateEvent = contentWindow.document.createEvent('Event'); activateEvent.initEvent('activate', false, false); list[i].dispatchEvent(activateEvent); return true; @@ -495,12 +495,12 @@ * @return {string} Path which is shown in the breadcrumb. */ test.util.sync.getBreadcrumbPath = function(contentWindow) { - var breadcrumb = contentWindow.document.querySelector( + const breadcrumb = contentWindow.document.querySelector( '#location-breadcrumbs'); - var paths = breadcrumb.querySelectorAll('.breadcrumb-path'); + const paths = breadcrumb.querySelectorAll('.breadcrumb-path'); - var path = ''; - for(var i = 0; i < paths.length; i++) { + let path = ''; + for(let i = 0; i < paths.length; i++) { path += '/' + paths[i].textContent; } return path;
diff --git a/ui/file_manager/file_manager/background/js/volume_info_impl.js b/ui/file_manager/file_manager/background/js/volume_info_impl.js index 157307d5..dd40150e5 100644 --- a/ui/file_manager/file_manager/background/js/volume_info_impl.js +++ b/ui/file_manager/file_manager/background/js/volume_info_impl.js
@@ -320,7 +320,7 @@ } } // For Drive, we need to resolve. - var displayRootURL = this.fileSystem_.root.toURL() + 'root'; + const displayRootURL = this.fileSystem_.root.toURL() + 'root'; return Promise .all([ VolumeInfoImpl.resolveFileSystemUrl_(displayRootURL),
diff --git a/ui/file_manager/file_manager/background/js/volume_info_list_impl.js b/ui/file_manager/file_manager/background/js/volume_info_list_impl.js index b6ae060..1795976 100644 --- a/ui/file_manager/file_manager/background/js/volume_info_list_impl.js +++ b/ui/file_manager/file_manager/background/js/volume_info_list_impl.js
@@ -35,7 +35,7 @@ /** @override */ VolumeInfoListImpl.prototype.add = function(volumeInfo) { - var index = this.findIndex(volumeInfo.volumeId); + const index = this.findIndex(volumeInfo.volumeId); if (index !== -1) { this.model_.splice(index, 1, volumeInfo); } else { @@ -45,7 +45,7 @@ /** @override */ VolumeInfoListImpl.prototype.remove = function(volumeId) { - var index = this.findIndex(volumeId); + const index = this.findIndex(volumeId); if (index !== -1) { this.model_.splice(index, 1); } @@ -62,7 +62,7 @@ * @return {number} Index of the volume. */ VolumeInfoListImpl.prototype.findIndex = function(volumeId) { - for (var i = 0; i < this.model_.length; i++) { + for (let i = 0; i < this.model_.length; i++) { if (this.model_.item(i).volumeId === volumeId) { return i; }
diff --git a/ui/file_manager/file_manager/background/js/volume_manager_factory.js b/ui/file_manager/file_manager/background/js/volume_manager_factory.js index c56e4a5..c63994e 100644 --- a/ui/file_manager/file_manager/background/js/volume_manager_factory.js +++ b/ui/file_manager/file_manager/background/js/volume_manager_factory.js
@@ -8,12 +8,12 @@ * invocation of getInstance(). * @type {VolumeManager} */ - var instance = null; + let instance = null; /** * @type {Promise} */ - var instancePromise = null; + let instancePromise = null; /** * Returns the VolumeManager instance asynchronously. If it has not been
diff --git a/ui/file_manager/file_manager/background/js/volume_manager_impl.js b/ui/file_manager/file_manager/background/js/volume_manager_impl.js index 98356115..5fa1c18 100644 --- a/ui/file_manager/file_manager/background/js/volume_manager_impl.js +++ b/ui/file_manager/file_manager/background/js/volume_manager_impl.js
@@ -88,7 +88,7 @@ // TODO(fukino): Once the Files app gets ready, show erroneous Drive // volume so that users can see auth warning banner on the volume. // crbug.com/517772. - var shouldShow = true; + let shouldShow = true; switch (volumeInfo.volumeType) { case VolumeManagerCommon.VolumeType.DOWNLOADS: case VolumeManagerCommon.VolumeType.DRIVE: @@ -184,7 +184,7 @@ }.bind(this)); } else if (event.status === VolumeManagerCommon.VolumeError.ALREADY_MOUNTED) { - var navigationEvent = + const navigationEvent = new Event(VolumeManagerCommon.VOLUME_ALREADY_MOUNTED); navigationEvent.volumeId = event.volumeMetadata.volumeId; this.dispatchEvent(navigationEvent); @@ -198,17 +198,17 @@ break; case 'unmount': - var volumeId = event.volumeMetadata.volumeId; - var status = event.status; + const volumeId = event.volumeMetadata.volumeId; + const status = event.status; var requestKey = this.makeRequestKey_('unmount', volumeId); - var requested = requestKey in this.requests_; - var volumeInfoIndex = + const requested = requestKey in this.requests_; + const volumeInfoIndex = this.volumeInfoList.findIndex(volumeId); - var volumeInfo = volumeInfoIndex !== -1 ? + const volumeInfo = volumeInfoIndex !== -1 ? this.volumeInfoList.item(volumeInfoIndex) : null; if (event.status === 'success' && !requested && volumeInfo) { console.warn('Unmounted volume without a request: ' + volumeId); - var e = new Event('externally-unmounted'); + const e = new Event('externally-unmounted'); e.volumeInfo = volumeInfo; this.dispatchEvent(e); } @@ -243,7 +243,7 @@ chrome.fileManagerPrivate.addMount(fileUrl, function(sourcePath) { console.info( 'Mount request: url=' + fileUrl + '; sourcePath=' + sourcePath); - var requestKey = this.makeRequestKey_('mount', sourcePath); + const requestKey = this.makeRequestKey_('mount', sourcePath); this.startRequest_(requestKey, successCallback, errorCallback); }.bind(this)); }; @@ -253,7 +253,7 @@ successCallback, errorCallback) { chrome.fileManagerPrivate.removeMount(volumeInfo.volumeId); - var requestKey = this.makeRequestKey_('unmount', volumeInfo.volumeId); + const requestKey = this.makeRequestKey_('unmount', volumeInfo.volumeId); this.startRequest_(requestKey, successCallback, errorCallback); }; @@ -295,8 +295,8 @@ /** @override */ VolumeManagerImpl.prototype.getCurrentProfileVolumeInfo = function(volumeType) { - for (var i = 0; i < this.volumeInfoList.length; i++) { - var volumeInfo = this.volumeInfoList.item(i); + for (let i = 0; i < this.volumeInfoList.length; i++) { + const volumeInfo = this.volumeInfoList.item(i); if (volumeInfo.profile.isCurrentProfile && volumeInfo.volumeType === volumeType) { return volumeInfo; @@ -311,7 +311,7 @@ console.error('Invalid entry passed to getLocationInfo: ' + entry); return null; } - var volumeInfo = this.getVolumeInfo(entry); + const volumeInfo = this.getVolumeInfo(entry); if (util.isFakeEntry(entry)) { return new EntryLocationImpl( @@ -324,9 +324,9 @@ return null; } - var rootType; - var isReadOnly; - var isRootEntry; + let rootType; + let isReadOnly; + let isRootEntry; if (volumeInfo.volumeType === VolumeManagerCommon.VolumeType.DRIVE) { // For Drive, the roots are /root, /team_drives, /Computers and /other, // instead of /. Root URLs contain trailing slashes. @@ -453,7 +453,7 @@ VolumeManagerImpl.prototype.startRequest_ = function(key, successCallback, errorCallback) { if (key in this.requests_) { - var request = this.requests_[key]; + const request = this.requests_[key]; request.successCallbacks.push(successCallback); request.errorCallbacks.push(errorCallback); } else { @@ -487,7 +487,7 @@ */ VolumeManagerImpl.prototype.finishRequest_ = function(key, status, opt_volumeInfo) { - var request = this.requests_[key]; + const request = this.requests_[key]; if (!request) { return; } @@ -506,8 +506,8 @@ */ VolumeManagerImpl.prototype.invokeRequestCallbacks_ = function( request, status, opt_volumeInfo) { - var callEach = function(callbacks, self, args) { - for (var i = 0; i < callbacks.length; i++) { + const callEach = function(callbacks, self, args) { + for (let i = 0; i < callbacks.length; i++) { callbacks[i].apply(self, args); } };
diff --git a/ui/file_manager/file_manager/background/js/volume_manager_unittest.js b/ui/file_manager/file_manager/background/js/volume_manager_unittest.js index 8f79539..ed68f5c2 100644 --- a/ui/file_manager/file_manager/background/js/volume_manager_unittest.js +++ b/ui/file_manager/file_manager/background/js/volume_manager_unittest.js
@@ -29,7 +29,7 @@ callback(mockChrome.fileManagerPrivate.mountSourcePath_); }, removeMount: function(volumeId) { - var event = { + const event = { eventType: 'unmount', status: 'success', volumeMetadata: { @@ -144,10 +144,10 @@ function testGetVolumeInfo(callback) { reportPromise( volumeManagerFactory.getInstance().then(function(volumeManager) { - var entry = new MockFileEntry(new MockFileSystem('download:Downloads'), + const entry = new MockFileEntry(new MockFileSystem('download:Downloads'), '/foo/bar/bla.zip'); - var volumeInfo = volumeManager.getVolumeInfo(entry); + const volumeInfo = volumeManager.getVolumeInfo(entry); assertEquals('download:Downloads', volumeInfo.volumeId); assertEquals(VolumeManagerCommon.VolumeType.DOWNLOADS, volumeInfo.volumeType); @@ -186,7 +186,7 @@ reportPromise( volumeManagerFactory.getInstance().then(function(volumeManager) { - var numberOfVolumes = volumeManager.volumeInfoList.length; + const numberOfVolumes = volumeManager.volumeInfoList.length; return new Promise(function(resolve, reject) { // Mount an archieve @@ -221,10 +221,10 @@ volumeManager.volumeInfoList.length); resolve(true); }); - var entry = new MockFileEntry( + const entry = new MockFileEntry( new MockFileSystem('archive:foobar.zip'), '/foo.txt'); - var volumeInfo = volumeManager.getVolumeInfo(entry); + const volumeInfo = volumeManager.getVolumeInfo(entry); volumeManager.unmount(volumeInfo); }); }); @@ -235,7 +235,7 @@ function testGetCurrentProfileVolumeInfo(callback) { reportPromise( volumeManagerFactory.getInstance().then(function(volumeManager) { - var volumeInfo = volumeManager.getCurrentProfileVolumeInfo( + const volumeInfo = volumeManager.getCurrentProfileVolumeInfo( VolumeManagerCommon.VolumeType.DRIVE); assertEquals('drive:drive-foobar%40chromium.org-hash', @@ -249,30 +249,30 @@ function testGetLocationInfo(callback) { reportPromise( volumeManagerFactory.getInstance().then(function(volumeManager) { - var downloadEntry = new MockFileEntry( + const downloadEntry = new MockFileEntry( new MockFileSystem('download:Downloads'), '/foo/bar/bla.zip'); - var downloadLocationInfo = volumeManager.getLocationInfo(downloadEntry); + const downloadLocationInfo = volumeManager.getLocationInfo(downloadEntry); assertEquals(VolumeManagerCommon.RootType.DOWNLOADS, downloadLocationInfo.rootType); assertFalse(downloadLocationInfo.hasFixedLabel); assertFalse(downloadLocationInfo.isReadOnly); assertFalse(downloadLocationInfo.isRootEntry); - var driveEntry = new MockFileEntry( + const driveEntry = new MockFileEntry( new MockFileSystem('drive:drive-foobar%40chromium.org-hash'), '/root'); - var driveLocationInfo = volumeManager.getLocationInfo(driveEntry); + const driveLocationInfo = volumeManager.getLocationInfo(driveEntry); assertEquals(VolumeManagerCommon.RootType.DRIVE, driveLocationInfo.rootType); assertTrue(driveLocationInfo.hasFixedLabel); assertFalse(driveLocationInfo.isReadOnly); assertTrue(driveLocationInfo.isRootEntry); - var teamDrivesGrandRoot = new MockFileEntry( + const teamDrivesGrandRoot = new MockFileEntry( new MockFileSystem('drive:drive-foobar%40chromium.org-hash'), '/team_drives'); - var teamDrivesGrandRootLocationInfo = + const teamDrivesGrandRootLocationInfo = volumeManager.getLocationInfo(teamDrivesGrandRoot); assertEquals( VolumeManagerCommon.RootType.TEAM_DRIVES_GRAND_ROOT, @@ -281,10 +281,10 @@ assertTrue(teamDrivesGrandRootLocationInfo.isReadOnly); assertTrue(teamDrivesGrandRootLocationInfo.isRootEntry); - var teamDrive = new MockFileEntry( + const teamDrive = new MockFileEntry( new MockFileSystem('drive:drive-foobar%40chromium.org-hash'), '/team_drives/MyTeamDrive'); - var teamDriveLocationInfo = volumeManager.getLocationInfo(teamDrive); + const teamDriveLocationInfo = volumeManager.getLocationInfo(teamDrive); assertEquals( VolumeManagerCommon.RootType.TEAM_DRIVE, teamDriveLocationInfo.rootType); @@ -292,10 +292,10 @@ assertFalse(teamDriveLocationInfo.isReadOnly); assertTrue(teamDriveLocationInfo.isRootEntry); - var driveFilesByIdDirectoryEntry = new MockDirectoryEntry( + const driveFilesByIdDirectoryEntry = new MockDirectoryEntry( new MockFileSystem('drive:drive-foobar%40chromium.org-hash'), '/.files-by-id/123'); - var driveFilesByIdDirectoryLocationInfo = + const driveFilesByIdDirectoryLocationInfo = volumeManager.getLocationInfo(driveFilesByIdDirectoryEntry); assertEquals( VolumeManagerCommon.RootType.DRIVE_OTHER, @@ -304,10 +304,10 @@ assertTrue(driveFilesByIdDirectoryLocationInfo.isReadOnly); assertFalse(driveFilesByIdDirectoryLocationInfo.isRootEntry); - var driveFilesByIdEntry = new MockFileEntry( + const driveFilesByIdEntry = new MockFileEntry( new MockFileSystem('drive:drive-foobar%40chromium.org-hash'), '/.files-by-id/123/foo.txt'); - var driveFilesByIdLocationInfo = + const driveFilesByIdLocationInfo = volumeManager.getLocationInfo(driveFilesByIdEntry); assertEquals( VolumeManagerCommon.RootType.DRIVE_OTHER, @@ -316,16 +316,16 @@ assertFalse(driveFilesByIdLocationInfo.isReadOnly); assertFalse(driveFilesByIdLocationInfo.isRootEntry); - var androidRoot = + const androidRoot = new MockFileEntry(new MockFileSystem('android_files:0'), '/'); - var androidRootLocationInfo = + const androidRootLocationInfo = volumeManager.getLocationInfo(androidRoot); assertTrue(androidRootLocationInfo.isReadOnly); assertTrue(androidRootLocationInfo.isRootEntry); - var androidSubFolder = new MockFileEntry( + const androidSubFolder = new MockFileEntry( new MockFileSystem('android_files:0'), '/Pictures'); - var androidSubFolderLocationInfo = + const androidSubFolderLocationInfo = volumeManager.getLocationInfo(androidSubFolder); assertFalse(androidSubFolderLocationInfo.isReadOnly); assertFalse(androidSubFolderLocationInfo.isRootEntry); @@ -390,13 +390,13 @@ } function testDriveMountedDuringInitialization(callback) { - var sendMetadataListCallback; + let sendMetadataListCallback; chrome.fileManagerPrivate.getVolumeMetadataList = function(callback) { sendMetadataListCallback = callback; }; // Start initialization. - var instancePromise = volumeManagerFactory.getInstance(); + const instancePromise = volumeManagerFactory.getInstance(); // Drive is mounted during initialization. mockChrome.fileManagerPrivate.onMountCompleted.dispatchEvent({
diff --git a/ui/file_manager/file_manager/background/js/volume_manager_util.js b/ui/file_manager/file_manager/background/js/volume_manager_util.js index d654b6ae..1fcd6bf 100644 --- a/ui/file_manager/file_manager/background/js/volume_manager_util.js +++ b/ui/file_manager/file_manager/background/js/volume_manager_util.js
@@ -5,7 +5,7 @@ /** * Utilities for volume manager implementation. */ -var volumeManagerUtil = {}; +const volumeManagerUtil = {}; /** * Time in milliseconds that we wait a response for general volume operations @@ -41,7 +41,7 @@ * @param {string} error Status string usually received from APIs. */ volumeManagerUtil.validateError = function(error) { - for (var key in VolumeManagerCommon.VolumeError) { + for (const key in VolumeManagerCommon.VolumeError) { if (error === VolumeManagerCommon.VolumeError[key]) { return; } @@ -57,7 +57,7 @@ * @return {!Promise<!VolumeInfo>} Promise settled with the VolumeInfo instance. */ volumeManagerUtil.createVolumeInfo = function(volumeMetadata) { - var localizedLabel; + let localizedLabel; switch (volumeMetadata.volumeType) { case VolumeManagerCommon.VolumeType.DOWNLOADS: if (util.isMyFilesVolumeEnabled()) {
diff --git a/ui/file_manager/file_manager/common/js/BUILD.gn b/ui/file_manager/file_manager/common/js/BUILD.gn index 31581662e..2e324bb5e 100644 --- a/ui/file_manager/file_manager/common/js/BUILD.gn +++ b/ui/file_manager/file_manager/common/js/BUILD.gn
@@ -62,7 +62,6 @@ deps = [ ":files_app_entry_types", ":mock_entry", - ":util", "//ui/file_manager/base/js:test_error_reporting", "//ui/file_manager/base/js:volume_manager_types", ] @@ -171,6 +170,10 @@ deps = [ ":files_app_entry_types", "../../../externs:file_manager_private", + + # TODO(tapted): Remove these base util dependencies, which exist temporarily + # to allow targets to depend only on util, if they depend on one of these. + "//ui/file_manager/base/js:app_util", "//ui/file_manager/base/js:volume_manager_types", "//ui/webui/resources/js:load_time_data", "//ui/webui/resources/js:util", @@ -179,7 +182,6 @@ ] externs_list = [ "$externs_path/command_line_private.js", - "../../../externs/app_window_common.js", "../../../externs/entry_location.js", "../../../externs/platform.js", "../../../externs/volume_info.js",
diff --git a/ui/file_manager/file_manager/common/js/util.js b/ui/file_manager/file_manager/common/js/util.js index ae68407..0a9c148 100644 --- a/ui/file_manager/file_manager/common/js/util.js +++ b/ui/file_manager/file_manager/common/js/util.js
@@ -3,6 +3,12 @@ // found in the LICENSE file. /** + * @fileoverview This file should contain utility functions used only by the + * files app. Other shared utility functions can be found in base/*_util.js, + * which allows finer-grained control over introducing dependencies. + */ + +/** * Namespace for utility functions. */ var util = {}; @@ -340,30 +346,6 @@ }; /** - * Updates the app state. - * - * @param {?string} currentDirectoryURL Currently opened directory as an URL. - * If null the value is left unchanged. - * @param {?string} selectionURL Currently selected entry as an URL. If null the - * value is left unchanged. - * @param {string|Object=} opt_param Additional parameters, to be stored. If - * null, then left unchanged. - */ -util.updateAppState = function(currentDirectoryURL, selectionURL, opt_param) { - window.appState = window.appState || {}; - if (opt_param !== undefined && opt_param !== null) { - window.appState.params = opt_param; - } - if (currentDirectoryURL !== null) { - window.appState.currentDirectoryURL = currentDirectoryURL; - } - if (selectionURL !== null) { - window.appState.selectionURL = selectionURL; - } - util.saveAppState(); -}; - -/** * Returns a translated string. * * Wrapper function to make dealing with translated strings more concise. @@ -399,149 +381,6 @@ }; /** - * Save app launch data to the local storage. - */ -util.saveAppState = function() { - if (!window.appState) { - return; - } - var items = {}; - - items[window.appID] = JSON.stringify(window.appState); - chrome.storage.local.set(items, function() { - if (chrome.runtime.lastError) { - console.error( - 'Failed to save app state: ' + chrome.runtime.lastError.message); - } - }); -}; - -/** - * AppCache is a persistent timestamped key-value storage backed by - * HTML5 local storage. - * - * It is not designed for frequent access. In order to avoid costly - * localStorage iteration all data is kept in a single localStorage item. - * There is no in-memory caching, so concurrent access is _almost_ safe. - * - * TODO(kaznacheev) Reimplement this based on Indexed DB. - */ -util.AppCache = function() {}; - -/** - * Local storage key. - */ -util.AppCache.KEY = 'AppCache'; - -/** - * Max number of items. - */ -util.AppCache.CAPACITY = 100; - -/** - * Default lifetime. - */ -util.AppCache.LIFETIME = 30 * 24 * 60 * 60 * 1000; // 30 days. - -/** - * @param {string} key Key. - * @param {function(number)} callback Callback accepting a value. - */ -util.AppCache.getValue = function(key, callback) { - util.AppCache.read_(function(map) { - var entry = map[key]; - callback(entry && entry.value); - }); -}; - -/** - * Updates the cache. - * - * @param {string} key Key. - * @param {?(string|number)} value Value. Remove the key if value is null. - * @param {number=} opt_lifetime Maximum time to keep an item (in milliseconds). - */ -util.AppCache.update = function(key, value, opt_lifetime) { - util.AppCache.read_(function(map) { - if (value != null) { - map[key] = { - value: value, - expire: Date.now() + (opt_lifetime || util.AppCache.LIFETIME) - }; - } else if (key in map) { - delete map[key]; - } else { - return; // Nothing to do. - } - util.AppCache.cleanup_(map); - util.AppCache.write_(map); - }); -}; - -/** - * @param {function(Object)} callback Callback accepting a map of timestamped - * key-value pairs. - * @private - */ -util.AppCache.read_ = function(callback) { - chrome.storage.local.get(util.AppCache.KEY, function(values) { - var json = values[util.AppCache.KEY]; - if (json) { - try { - callback(/** @type {Object} */ (JSON.parse(json))); - } catch (e) { - // The local storage item somehow got messed up, start fresh. - } - } - callback({}); - }); -}; - -/** - * @param {Object} map A map of timestamped key-value pairs. - * @private - */ -util.AppCache.write_ = function(map) { - var items = {}; - items[util.AppCache.KEY] = JSON.stringify(map); - chrome.storage.local.set(items); -}; - -/** - * Remove over-capacity and obsolete items. - * - * @param {Object} map A map of timestamped key-value pairs. - * @private - */ -util.AppCache.cleanup_ = function(map) { - // Sort keys by ascending timestamps. - var keys = []; - for (var key in map) { - if (map.hasOwnProperty(key)) { - keys.push(key); - } - } - keys.sort(function(a, b) { - return map[a].expire - map[b].expire; - }); - - var cutoff = Date.now(); - - var obsolete = 0; - while (obsolete < keys.length && - map[keys[obsolete]].expire < cutoff) { - obsolete++; - } - - var overCapacity = Math.max(0, keys.length - util.AppCache.CAPACITY); - - var itemsToDelete = Math.max(obsolete, overCapacity); - for (var i = 0; i != itemsToDelete; i++) { - delete map[keys[i]]; - } -}; - -/** * Adds an isFocused method to the current window object. */ util.addIsFocusedMethod = function() {
diff --git a/ui/file_manager/file_manager/foreground/js/BUILD.gn b/ui/file_manager/file_manager/foreground/js/BUILD.gn index d55d0cf..cabae49 100644 --- a/ui/file_manager/file_manager/foreground/js/BUILD.gn +++ b/ui/file_manager/file_manager/foreground/js/BUILD.gn
@@ -82,7 +82,6 @@ "$externs_path/command_line_private.js", "$externs_path/metrics_private.js", "$externs_path/web_animations.js", - "../../../externs/app_window_common.js", "../../../externs/background/crostini.js", "../../../externs/background/drive_sync_handler.js", "../../../externs/background/file_browser_background.js",
diff --git a/ui/file_manager/file_manager/foreground/js/app_state_controller.js b/ui/file_manager/file_manager/foreground/js/app_state_controller.js index 8d9e0724..1b505522 100644 --- a/ui/file_manager/file_manager/foreground/js/app_state_controller.js +++ b/ui/file_manager/file_manager/foreground/js/app_state_controller.js
@@ -163,7 +163,7 @@ // Save the window-specific preference. if (window.appState) { window.appState.viewOptions = prefs; - util.saveAppState(); + appUtil.saveAppState(); } }; @@ -226,9 +226,9 @@ } // TODO(mtomasz): Consider remembering the selection. - util.updateAppState( + appUtil.updateAppState( this.directoryModel_.getCurrentDirEntry() ? - this.directoryModel_.getCurrentDirEntry().toURL() : '', - '' /* selectionURL */, - '' /* opt_param */); + this.directoryModel_.getCurrentDirEntry().toURL() : + '', + '' /* selectionURL */, '' /* opt_param */); };
diff --git a/ui/file_manager/file_manager/foreground/js/main_scripts.js b/ui/file_manager/file_manager/foreground/js/main_scripts.js index b61f869b..dee6f11 100644 --- a/ui/file_manager/file_manager/foreground/js/main_scripts.js +++ b/ui/file_manager/file_manager/foreground/js/main_scripts.js
@@ -81,6 +81,7 @@ // <include src="../../common/js/file_type.js"> // <include src="../../common/js/files_app_entry_types.js"> // <include src="../../../base/js/volume_manager_types.js"> +// <include src="../../../base/js/app_util.js"> // <include src="../../common/js/util.js"> // <include src="../../common/js/progress_center_common.js"> // <include src="../../common/js/importer_common.js">
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/BUILD.gn b/ui/file_manager/file_manager/foreground/js/metadata/BUILD.gn index 6f95c18..e5c43cb 100644 --- a/ui/file_manager/file_manager/foreground/js/metadata/BUILD.gn +++ b/ui/file_manager/file_manager/foreground/js/metadata/BUILD.gn
@@ -19,7 +19,6 @@ js_type_check("closure_compile_module") { deps = [ ":byte_reader", - ":closure_compile_externs", ":content_metadata_provider", ":exif_constants", ":exif_parser", @@ -44,14 +43,6 @@ ] } -js_library("closure_compile_externs") { - sources = [] - externs_list = [ - "../../../../externs/app_window_common.js", - "../../../../externs/platform.js", - ] -} - js_library("byte_reader") { } @@ -191,6 +182,7 @@ deps = [ ":metadata_parser", ] + externs_list = [ "../../../../externs/platform.js" ] } js_library("metadata_item") {
diff --git a/ui/file_manager/file_manager/foreground/js/navigation_list_model.js b/ui/file_manager/file_manager/foreground/js/navigation_list_model.js index ef36a99..bca62dfb 100644 --- a/ui/file_manager/file_manager/foreground/js/navigation_list_model.js +++ b/ui/file_manager/file_manager/foreground/js/navigation_list_model.js
@@ -106,6 +106,7 @@ * @param {!VolumeInfo} volumeInfo Volume info for the volume. Cannot be null. * @constructor * @extends {NavigationModelItem} + * @struct */ function NavigationModelVolumeItem(label, volumeInfo) { NavigationModelItem.call(this, label, NavigationModelItemType.VOLUME); @@ -725,10 +726,6 @@ this.navigationItems_.push(volume); volume.section = NavigationSection.REMOVABLE; } - - if (this.addNewServicesItem_) { - this.navigationItems_.push(this.addNewServicesItem_); - } }; /**
diff --git a/ui/file_manager/file_manager/foreground/js/ui/BUILD.gn b/ui/file_manager/file_manager/foreground/js/ui/BUILD.gn index a943c32..e0c18d6 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/BUILD.gn +++ b/ui/file_manager/file_manager/foreground/js/ui/BUILD.gn
@@ -58,7 +58,6 @@ externs_list = [ "$externs_path/metrics_private.js", "$externs_path/web_animations.js", - "../../../../externs/app_window_common.js", "../../../../externs/background/drive_sync_handler.js", "../../../../externs/background/file_browser_background.js", "../../../../externs/background/file_operation_manager.js",
diff --git a/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js b/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js index 4066b88..87728e1d 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js +++ b/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js
@@ -971,10 +971,13 @@ item.setContextMenu_(tree.contextMenuForRootItems); } - // Populate children of this volume using resolved display root. - item.volumeInfo_.resolveDisplayRoot((displayRoot) => { - item.updateSubDirectories(false /* recursive */); - }); + // Populate children of this volume using resolved display root. For SMB + // shares, avoid prefetching sub directories to delay authentication. + if (modelItem.volumeInfo_.providerId !== '@smb') { + item.volumeInfo_.resolveDisplayRoot((displayRoot) => { + item.updateSubDirectories(false /* recursive */); + }); + } return item; }
diff --git a/ui/file_manager/file_manager/foreground/js/ui/directory_tree_unittest.js b/ui/file_manager/file_manager/foreground/js/ui/directory_tree_unittest.js index f8bd92c..44ed3be 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/directory_tree_unittest.js +++ b/ui/file_manager/file_manager/foreground/js/ui/directory_tree_unittest.js
@@ -864,3 +864,63 @@ }), callback); } + +/** + * Test adding FSPs. + * Sub directories should be fetched for FSPs, but not for the Smb FSP. + * + * @param {!function(boolean)} callback A callback function which is called with + * test result. + */ +function testAddProviders(callback) { + // Add a volume representing a non-Smb provider to the mock filesystem. + volumeManager.createVolumeInfo( + VolumeManagerCommon.VolumeType.PROVIDED, 'not_smb', 'NOT_SMB_LABEL'); + + // Add a sub directory to the non-Smb provider. + const provider = assert(volumeManager.volumeInfoList.item(2).fileSystem); + fakeFileSystemURLEntries['filesystem:not_smb/child'] = + new MockDirectoryEntry(provider, '/child'); + + // Add a volume representing an Smb provider to the mock filesystem. + volumeManager.createVolumeInfo( + VolumeManagerCommon.VolumeType.PROVIDED, 'smb', 'SMB_LABEL', '@smb'); + + // Add a sub directory to the Smb provider. + const smbProvider = assert(volumeManager.volumeInfoList.item(3).fileSystem); + fakeFileSystemURLEntries['filesystem:smb/child'] = + new MockDirectoryEntry(smbProvider, '/smb_child'); + + // Populate the directory tree with the mock filesystem. + var directoryTree = createElements(); + const metadataModel = createMockMetadataModel(); + directoryTree.metadataModel = metadataModel; + DirectoryTree.decorate( + directoryTree, directoryModel, volumeManager, metadataModel, + fileOperationManager, true); + directoryTree.dataModel = new MockNavigationListModel(volumeManager); + + // Coerce to DirectoryTree type and draw the tree. + directoryTree = /** @type {!DirectoryTree} */ (directoryTree); + directoryTree.redraw(true); + + // At top level, Drive and downloads should be listed. + assertEquals(4, directoryTree.items.length); + assertEquals(str('DRIVE_DIRECTORY_LABEL'), directoryTree.items[0].label); + assertEquals(str('DOWNLOADS_DIRECTORY_LABEL'), directoryTree.items[1].label); + assertEquals('NOT_SMB_LABEL', directoryTree.items[2].label); + assertEquals('SMB_LABEL', directoryTree.items[3].label); + + const providerItem = directoryTree.items[2]; + const smbItem = directoryTree.items[3]; + reportPromise( + waitUntil(() => { + // Under providerItem there should be 1 entry, 'child'. Ensure there are + // no entries under smbItem. + return providerItem.items.length === 1; + }).then(() => { + assertEquals('child', providerItem.items[0].label); + assertEquals(0, smbItem.items.length); + }), + callback); +} \ No newline at end of file
diff --git a/ui/file_manager/file_manager/test/BUILD.gn b/ui/file_manager/file_manager/test/BUILD.gn index 965a684..682ecb3c 100644 --- a/ui/file_manager/file_manager/test/BUILD.gn +++ b/ui/file_manager/file_manager/test/BUILD.gn
@@ -57,7 +57,6 @@ "js/externs.js", "$externs_path/command_line_private.js", "$externs_path/metrics_private.js", - "//ui/file_manager/externs/app_window_common.js", "//ui/file_manager/externs/background/file_browser_background.js", "//ui/file_manager/externs/background/progress_center.js", "//ui/file_manager/externs/background/crostini.js",
diff --git a/ui/file_manager/gallery/js/gallery.js b/ui/file_manager/gallery/js/gallery.js index 464f9e2..4e3cfb7 100644 --- a/ui/file_manager/gallery/js/gallery.js +++ b/ui/file_manager/gallery/js/gallery.js
@@ -873,12 +873,12 @@ this.shareButton_.disabled = true; } - util.updateAppState( - null, // Keep the current directory. + appUtil.updateAppState( + null, // Keep the current directory. selectedEntryURL, // Update the selection. { - gallery: (this.currentMode_ === this.thumbnailMode_ ? - 'thumbnail' : 'slide') + gallery: + (this.currentMode_ === this.thumbnailMode_ ? 'thumbnail' : 'slide') }); };
diff --git a/ui/file_manager/gallery/js/gallery_scripts.js b/ui/file_manager/gallery/js/gallery_scripts.js index c6b0b9c..074aac15 100644 --- a/ui/file_manager/gallery/js/gallery_scripts.js +++ b/ui/file_manager/gallery/js/gallery_scripts.js
@@ -44,7 +44,11 @@ // <include src="../../file_manager/common/js/async_util.js"> // <include src="../../file_manager/common/js/file_type.js"> +// <include src="../../base/js/app_util.js"> + +/* TODO(tapted): Remove the util.js dependency */ // <include src="../../file_manager/common/js/util.js"> + // <include src="../../base/js/volume_manager_types.js"> // <include // src="../../file_manager/foreground/js/metadata/content_metadata_provider.js">
diff --git a/ui/file_manager/integration_tests/file_manager/quick_view.js b/ui/file_manager/integration_tests/file_manager/quick_view.js index e7c503cd..d1135981 100644 --- a/ui/file_manager/integration_tests/file_manager/quick_view.js +++ b/ui/file_manager/integration_tests/file_manager/quick_view.js
@@ -155,6 +155,47 @@ }; /** + * Tests opening Quick View on a removable partition. + */ +testcase.openQuickViewRemovablePartitions = async function() { + const PARTITION_QUERY = + '#directory-tree .tree-children [volume-type-icon="removable"]'; + const caller = getCaller(); + + // Open Files app on Downloads containing ENTRIES.photos. + const appId = + await setupAndWaitUntilReady(RootPath.DOWNLOADS, [ENTRIES.photos], []); + + // Mount USB volume. + await sendTestMessage({name: 'mountFakePartitions'}); + + // Wait for 2 removable partitions to appear in the directory tree. + await repeatUntil(async () => { + const partitions = await remoteCall.callRemoteTestUtil( + 'queryAllElements', appId, [PARTITION_QUERY]); + + if (partitions.length == 2) { + return true; + } + return pending( + caller, 'Found %d partitions, waiting for 2.', partitions.length); + }); + + // Click to open the first partition. + chrome.test.assertTrue( + !!await remoteCall.callRemoteTestUtil( + 'fakeMouseClick', appId, [PARTITION_QUERY]), + 'fakeMouseClick failed'); + + // Check: the 'hello.txt' file should appear in the file list. + const files = [ENTRIES.hello.getExpectedRow()]; + await remoteCall.waitForFiles(appId, files, {ignoreLastModifiedTime: true}); + + // Open the file in Quick View. + await openQuickView(appId, ENTRIES.hello.nameText); +}; + +/** * Tests opening Quick View on an MTP file. */ testcase.openQuickViewMtp = async function() {
diff --git a/ui/file_manager/video_player/js/cast/BUILD.gn b/ui/file_manager/video_player/js/cast/BUILD.gn index 7305df1..11b8e38 100644 --- a/ui/file_manager/video_player/js/cast/BUILD.gn +++ b/ui/file_manager/video_player/js/cast/BUILD.gn
@@ -20,7 +20,6 @@ "$externs_path/chrome_extensions.js", "$externs_path/media_player_private.js", "$externs_path/mediasession.js", - "../../../externs/app_window_common.js", "../../../externs/background/volume_manager_factory.js", "../../../externs/chrome_cast.js", "../../../externs/platform.js",
diff --git a/ui/file_manager/video_player/js/media_controls.js b/ui/file_manager/video_player/js/media_controls.js index 4b240b9..9735cb3ce 100644 --- a/ui/file_manager/video_player/js/media_controls.js +++ b/ui/file_manager/video_player/js/media_controls.js
@@ -915,7 +915,7 @@ if (window.appState) { window.appState.time = this.media_.currentTime; - util.saveAppState(); + appUtil.saveAppState(); } return; }; @@ -946,7 +946,7 @@ if ('time' in window.appState) { delete window.appState.time; } - util.saveAppState(); + appUtil.saveAppState(); return; }; @@ -1176,7 +1176,7 @@ } window.saveOnExit.push({ key: this.media_.src, value: position }); } else { - util.AppCache.update(this.media_.src, position); + appUtil.AppCache.update(this.media_.src, position); } }; @@ -1185,7 +1185,7 @@ */ VideoControls.prototype.restorePlayState = function() { if (this.media_ && this.media_.duration >= VideoControls.RESUME_THRESHOLD) { - util.AppCache.getValue(this.media_.src, function(position) { + appUtil.AppCache.getValue(this.media_.src, function(position) { if (position) { this.media_.currentTime = position; }
diff --git a/ui/file_manager/video_player/js/video_player_scripts.js b/ui/file_manager/video_player/js/video_player_scripts.js index 425dbd6..98a11d1 100644 --- a/ui/file_manager/video_player/js/video_player_scripts.js +++ b/ui/file_manager/video_player/js/video_player_scripts.js
@@ -41,7 +41,11 @@ // <include src="../../file_manager/common/js/async_util.js"> // <include src="../../file_manager/common/js/file_type.js"> +// <include src="../../base/js/app_util.js"> + +/* TODO(tapted): Remove the util.js dependency */ // <include src="../../file_manager/common/js/util.js"> + // <include src="../../base/js/mediasession_types.js"> // <include src="../../base/js/volume_manager_types.js"> // <include src="../../base/js/filtered_volume_manager.js">
diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn index c5ff6eea..6f9b0c3f 100644 --- a/ui/gfx/BUILD.gn +++ b/ui/gfx/BUILD.gn
@@ -276,6 +276,7 @@ set_sources_assignment_filter([]) sources += [ "scoped_cg_context_save_gstate_mac.h" ] set_sources_assignment_filter(sources_assignment_filter) + deps += [ "//third_party/google_toolbox_for_mac" ] } else { public_deps += [ "//cc/paint" ] deps += [ "//third_party:freetype_harfbuzz" ]
diff --git a/ui/gfx/DEPS b/ui/gfx/DEPS index 1fa6347..16c421d 100644 --- a/ui/gfx/DEPS +++ b/ui/gfx/DEPS
@@ -4,6 +4,7 @@ "+cc/paint", "+device/vr/buildflags/buildflags.h", "+skia/ext", + "+third_party/google_toolbox_for_mac", "+third_party/harfbuzz-ng", "+third_party/skia", "+ui/ios",
diff --git a/ui/gfx/image/image_util.cc b/ui/gfx/image/image_util.cc index dc0061d..b856788 100644 --- a/ui/gfx/image/image_util.cc +++ b/ui/gfx/image/image_util.cc
@@ -10,6 +10,7 @@ #include <memory> #include "build/build_config.h" +#include "skia/ext/image_operations.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/codec/jpeg_codec.h" #include "ui/gfx/image/image.h" @@ -35,6 +36,7 @@ // The iOS implementations of the JPEG functions are in image_util_ios.mm. #if !defined(OS_IOS) + Image ImageFrom1xJPEGEncodedData(const unsigned char* input, size_t input_size) { std::unique_ptr<SkBitmap> bitmap(gfx::JPEGCodec::Decode(input, input_size)); @@ -44,6 +46,10 @@ return Image(); } +Image ResizedImageForSearchByImage(const Image& image) { + return ResizedImageForSearchByImageSkiaRepresentation(image); +} + // The MacOS implementation of this function is in image_utils_mac.mm. #if !defined(OS_MACOSX) bool JPEG1xEncodedDataFromImage(const Image& image, @@ -67,6 +73,26 @@ return gfx::JPEGCodec::Encode(bitmap, quality, dst); } + +Image ResizedImageForSearchByImageSkiaRepresentation(const Image& image) { + const gfx::ImageSkiaRep& image_skia_rep = + image.AsImageSkia().GetRepresentation(1.0f); + if (image_skia_rep.scale() != 1.0f) + return image; + + const SkBitmap& bitmap = image_skia_rep.GetBitmap(); + if (bitmap.height() * bitmap.width() > kSearchByImageMaxImageArea && + (bitmap.width() > kSearchByImageMaxImageWidth || + bitmap.height() > kSearchByImageMaxImageHeight)) { + SkBitmap new_bitmap; + new_bitmap = skia::ImageOperations::Resize( + new_bitmap, skia::ImageOperations::RESIZE_GOOD, + kSearchByImageMaxImageWidth, kSearchByImageMaxImageHeight); + return Image(ImageSkia(ImageSkiaRep(new_bitmap, 0.0f))); + } + + return image; +} #endif // !defined(OS_IOS) void GetVisibleMargins(const ImageSkia& image, int* left, int* right) {
diff --git a/ui/gfx/image/image_util.h b/ui/gfx/image/image_util.h index cee54a3..5b48487b 100644 --- a/ui/gfx/image/image_util.h +++ b/ui/gfx/image/image_util.h
@@ -18,6 +18,11 @@ namespace gfx { +// Dimensions to use when downsizing an image for search-by-image. +const int kSearchByImageMaxImageArea = 90000; +const int kSearchByImageMaxImageWidth = 600; +const int kSearchByImageMaxImageHeight = 400; + // Creates an image from the given JPEG-encoded input. If there was an error // creating the image, returns an IsEmpty() Image. GFX_EXPORT Image ImageFrom1xJPEGEncodedData(const unsigned char* input, @@ -47,6 +52,13 @@ int* left, int* right); +// Downsizes the image if its area exceeds kSearchByImageMaxImageArea AND +// (either its width exceeds kSearchByImageMaxImageWidth OR its height exceeds +// kSearchByImageMaxImageHeight) in preparation for searching. +GFX_EXPORT Image ResizedImageForSearchByImage(const Image& image); + +Image ResizedImageForSearchByImageSkiaRepresentation(const Image& image); + } // namespace gfx #endif // UI_GFX_IMAGE_IMAGE_UTIL_H_
diff --git a/ui/gfx/image/image_util_ios.mm b/ui/gfx/image/image_util_ios.mm index 92b88ac..adac57a 100644 --- a/ui/gfx/image/image_util_ios.mm +++ b/ui/gfx/image/image_util_ios.mm
@@ -4,6 +4,7 @@ #import <UIKit/UIKit.h> +#include "third_party/google_toolbox_for_mac/src/iPhone/GTMUIImage+Resize.h" #include "ui/gfx/image/image.h" #include "ui/gfx/image/image_util.h" @@ -24,4 +25,20 @@ return true; } +Image ResizedImageForSearchByImage(const Image& image) { + UIImage* ui_image = image.ToUIImage(); + + if (ui_image && + ui_image.size.height * ui_image.size.width > kSearchByImageMaxImageArea && + (ui_image.size.width > kSearchByImageMaxImageWidth || + ui_image.size.height > kSearchByImageMaxImageHeight)) { + CGSize new_image_size = + CGSizeMake(kSearchByImageMaxImageWidth, kSearchByImageMaxImageHeight); + ui_image = [ui_image gtm_imageByResizingToSize:new_image_size + preserveAspectRatio:YES + trimToFit:NO]; + } + return Image(ui_image); +} + } // end namespace gfx
diff --git a/ui/ozone/platform/scenic/scenic_window.cc b/ui/ozone/platform/scenic/scenic_window.cc index 60537dc..9f7c1aa 100644 --- a/ui/ozone/platform/scenic/scenic_window.cc +++ b/ui/ozone/platform/scenic/scenic_window.cc
@@ -29,9 +29,8 @@ delegate_(delegate), window_id_(manager_->AddWindow(this)), event_dispatcher_(this), - view_listener_binding_(this), scenic_session_(manager_->GetScenic()), - parent_node_(&scenic_session_), + view_(&scenic_session_, std::move(view_token), "chromium window"), node_(&scenic_session_), input_node_(&scenic_session_), render_node_(&scenic_session_) { @@ -40,14 +39,9 @@ scenic_session_.set_event_handler( fit::bind_member(this, &ScenicWindow::OnScenicEvents)); - // Import parent node and create event pair to pass to the ViewManager. - zx::eventpair parent_export_token; - parent_node_.BindAsRequest(&parent_export_token); - // Subscribe to metrics events from the parent node. These events are used to // get the device pixel ratio for the screen. - parent_node_.SetEventMask(fuchsia::ui::gfx::kMetricsEventMask); - parent_node_.AddChild(node_); + view_.SetEventMask(fuchsia::ui::gfx::kMetricsEventMask); // Add input shape. input_node_.SetShape(scenic::Rectangle(&scenic_session_, 1.f, 1.f)); @@ -58,15 +52,6 @@ render_node_.SetHitTestBehavior(fuchsia::ui::gfx::HitTestBehavior::kSuppress); node_.AddChild(render_node_); - // Create the view. - manager_->GetViewManager()->CreateView2( - view_.NewRequest(), std::move(view_token), - view_listener_binding_.NewBinding(), std::move(parent_export_token), - "Chromium"); - view_.set_error_handler(fit::bind_member(this, &ScenicWindow::OnViewError)); - view_listener_binding_.set_error_handler( - fit::bind_member(this, &ScenicWindow::OnViewError)); - // Call Present() to ensure that the scenic session commands are processed, // which is necessary to receive metrics event from Scenic. scenic_session_.Present( @@ -104,7 +89,7 @@ } void ScenicWindow::Show() { - parent_node_.AddChild(node_); + view_.AddChild(node_); } void ScenicWindow::Hide() { @@ -205,18 +190,6 @@ delegate_->OnBoundsChanged(size_rect); } -void ScenicWindow::OnPropertiesChanged( - fuchsia::ui::viewsv1::ViewProperties properties, - OnPropertiesChangedCallback callback) { - if (properties.view_layout) { - size_dips_.SetSize(properties.view_layout->size.width, - properties.view_layout->size.height); - if (device_pixel_ratio_ > 0.0) - UpdateSize(); - } - - callback(); -} void ScenicWindow::OnScenicError(zx_status_t status) { LOG(ERROR) << "scenic::Session failed with code " << status << "."; @@ -227,38 +200,52 @@ std::vector<fuchsia::ui::scenic::Event> events) { for (const auto& event : events) { if (event.is_gfx()) { - if (!event.gfx().is_metrics()) - continue; - - auto& metrics = event.gfx().metrics(); - if (metrics.node_id != parent_node_.id()) - continue; - - device_pixel_ratio_ = - std::max(metrics.metrics.scale_x, metrics.metrics.scale_y); - - ScenicScreen* screen = manager_->screen(); - if (screen) - screen->OnWindowMetrics(window_id_, device_pixel_ratio_); - - if (!size_dips_.IsEmpty()) - UpdateSize(); - } else if (event.is_input()) { - auto& input_event = event.input(); - if (input_event.is_focus()) { - delegate_->OnActivationChanged(input_event.focus().focused); - } else { - // Scenic doesn't care if the input event was handled, so ignore the - // "handled" status. - ignore_result(event_dispatcher_.ProcessEvent(input_event)); + if (event.gfx().is_metrics()) { + if (event.gfx().metrics().node_id != node_.id()) + continue; + OnViewMetrics(event.gfx().metrics().metrics); + } else if (event.gfx().is_view_properties_changed()) { + if (event.gfx().view_properties_changed().view_id != view_.id()) + continue; + OnViewProperties(event.gfx().view_properties_changed().properties); } + } else if (event.is_input()) { + OnInputEvent(event.input()); } } } -void ScenicWindow::OnViewError(zx_status_t status) { - VLOG(1) << "viewsv1::View connection was closed with code " << status << "."; - delegate_->OnClosed(); +void ScenicWindow::OnViewMetrics(const fuchsia::ui::gfx::Metrics& metrics) { + device_pixel_ratio_ = std::max(metrics.scale_x, metrics.scale_y); + + ScenicScreen* screen = manager_->screen(); + if (screen) + screen->OnWindowMetrics(window_id_, device_pixel_ratio_); + + if (!size_dips_.IsEmpty()) + UpdateSize(); +} + +void ScenicWindow::OnViewProperties( + const fuchsia::ui::gfx::ViewProperties& properties) { + float width = properties.bounding_box.max.x - properties.bounding_box.min.x - + properties.inset_from_min.x - properties.inset_from_max.x; + float height = properties.bounding_box.max.y - properties.bounding_box.min.y - + properties.inset_from_min.y - properties.inset_from_max.y; + + size_dips_.SetSize(width, height); + if (device_pixel_ratio_ > 0.0) + UpdateSize(); +} + +void ScenicWindow::OnInputEvent(const fuchsia::ui::input::InputEvent& event) { + if (event.is_focus()) { + delegate_->OnActivationChanged(event.focus().focused); + } else { + // Scenic doesn't care if the input event was handled, so ignore the + // "handled" status. + ignore_result(event_dispatcher_.ProcessEvent(event)); + } } void ScenicWindow::DispatchEvent(ui::Event* event) {
diff --git a/ui/ozone/platform/scenic/scenic_window.h b/ui/ozone/platform/scenic/scenic_window.h index 3ea813f..ad02cbf1 100644 --- a/ui/ozone/platform/scenic/scenic_window.h +++ b/ui/ozone/platform/scenic/scenic_window.h
@@ -5,9 +5,10 @@ #ifndef UI_OZONE_PLATFORM_SCENIC_SCENIC_WINDOW_H_ #define UI_OZONE_PLATFORM_SCENIC_SCENIC_WINDOW_H_ -#include <fuchsia/ui/viewsv1/cpp/fidl.h> +#include <fuchsia/ui/input/cpp/fidl.h> #include <lib/ui/scenic/cpp/resources.h> #include <lib/ui/scenic/cpp/session.h> +#include <lib/zx/eventpair.h> #include <string> #include <vector> @@ -27,7 +28,6 @@ class PlatformWindowDelegate; class OZONE_EXPORT ScenicWindow : public PlatformWindow, - public fuchsia::ui::viewsv1::ViewListener, public InputEventDispatcherDelegate { public: // Both |window_manager| and |delegate| must outlive the ScenicWindow. @@ -65,21 +65,20 @@ gfx::Rect GetRestoredBoundsInPixels() const override; private: - // views::ViewListener interface. - void OnPropertiesChanged(fuchsia::ui::viewsv1::ViewProperties properties, - OnPropertiesChangedCallback callback) override; - // Callbacks for |scenic_session_|. void OnScenicError(zx_status_t status); void OnScenicEvents(std::vector<fuchsia::ui::scenic::Event> events); + // Called from OnScenicEvents() to handle view properties and metrics changes. + void OnViewProperties(const fuchsia::ui::gfx::ViewProperties& properties); + void OnViewMetrics(const fuchsia::ui::gfx::Metrics& metrics); + + // Called from OnScenicEvents() to handle input events. + void OnInputEvent(const fuchsia::ui::input::InputEvent& event); + // InputEventDispatcher::Delegate interface. void DispatchEvent(ui::Event* event) override; - // Error handler for |view_|. This error normally indicates the View was - // destroyed (e.g. dropping ViewOwner). - void OnViewError(zx_status_t status); - void UpdateSize(); ScenicWindowManager* const manager_; @@ -89,17 +88,13 @@ // Dispatches Scenic input events as Chrome ui::Events. InputEventDispatcher event_dispatcher_; - // Underlying View in the view_manager. - fuchsia::ui::viewsv1::ViewPtr view_; - fidl::Binding<fuchsia::ui::viewsv1::ViewListener> view_listener_binding_; - // Scenic session used for all drawing operations in this View. scenic::Session scenic_session_; - // Node in |scenic_session_| for the parent view. - scenic::ImportNode parent_node_; + // The view resource in |scenic_session_|. + scenic::View view_; - // Node in |scenic_session_| for the parent view. + // Entity node for the |view_|. scenic::EntityNode node_; // Node in |scenic_session_| for receiving input that hits within our View.
diff --git a/ui/ozone/platform/scenic/scenic_window_manager.cc b/ui/ozone/platform/scenic/scenic_window_manager.cc index c19d20d..aeabc0ee 100644 --- a/ui/ozone/platform/scenic/scenic_window_manager.cc +++ b/ui/ozone/platform/scenic/scenic_window_manager.cc
@@ -20,18 +20,6 @@ return screen; } -fuchsia::ui::viewsv1::ViewManager* ScenicWindowManager::GetViewManager() { - if (!view_manager_) { - view_manager_ = base::fuchsia::ServiceDirectoryClient::ForCurrentProcess() - ->ConnectToService<fuchsia::ui::viewsv1::ViewManager>(); - view_manager_.set_error_handler([](zx_status_t status) { - ZX_LOG(FATAL, status) << " ViewManager lost."; - }); - } - - return view_manager_.get(); -} - fuchsia::ui::scenic::Scenic* ScenicWindowManager::GetScenic() { if (!scenic_) { scenic_ = base::fuchsia::ServiceDirectoryClient::ForCurrentProcess()
diff --git a/ui/ozone/platform/scenic/scenic_window_manager.h b/ui/ozone/platform/scenic/scenic_window_manager.h index e219ace..d7ee9a7e 100644 --- a/ui/ozone/platform/scenic/scenic_window_manager.h +++ b/ui/ozone/platform/scenic/scenic_window_manager.h
@@ -5,11 +5,10 @@ #ifndef UI_OZONE_PLATFORM_SCENIC_SCENIC_WINDOW_MANAGER_H_ #define UI_OZONE_PLATFORM_SCENIC_SCENIC_WINDOW_MANAGER_H_ +#include <fuchsia/ui/scenic/cpp/fidl.h> #include <stdint.h> #include <memory> -#include <fuchsia/ui/viewsv1/cpp/fidl.h> - #include "base/containers/id_map.h" #include "base/macros.h" #include "base/threading/thread_checker.h" @@ -36,10 +35,9 @@ std::unique_ptr<PlatformScreen> CreateScreen(); - // ViewManager and Scenic services that are used by ScenicWindow. Both - // interfaces are initialized lazily on the first call and they don't change - // afterwards. ScenicWindowManager keeps the ownership. - fuchsia::ui::viewsv1::ViewManager* GetViewManager(); + // Scenic interface that is used by ScenicWindow instances. The interface + // is initialized lazily on the first call and it don't change afterwards. + // ScenicWindowManager keeps the ownership. fuchsia::ui::scenic::Scenic* GetScenic(); // Called by ScenicWindow when a new window instance is created. Returns @@ -58,7 +56,6 @@ base::WeakPtr<ScenicScreen> screen_; - fuchsia::ui::viewsv1::ViewManagerPtr view_manager_; fuchsia::ui::scenic::ScenicPtr scenic_; DISALLOW_COPY_AND_ASSIGN(ScenicWindowManager);
diff --git a/ui/views/layout/flex_layout.cc b/ui/views/layout/flex_layout.cc index ca5e664..b8c7edb 100644 --- a/ui/views/layout/flex_layout.cc +++ b/ui/views/layout/flex_layout.cc
@@ -354,6 +354,13 @@ ChildViewSpacing* child_spacing, const NormalizedSizeBounds& bounds) const; + // Calculates the cross-layout space available to a view based on the + // available space and margins. + base::Optional<int> GetAvailableCrossAxisSize( + const Layout& layout, + int child_index, + const NormalizedSizeBounds& bounds) const; + // Calculates a margin between two child views based on each's margin and any // internal padding present in one or both elements. Uses properties of the // layout, like whether adjacent margins should be collapsed. @@ -390,8 +397,8 @@ const Layout& FlexLayoutInternal::CalculateLayout(const SizeBounds& bounds) { // If bounds are smaller than the minimum cross axis size, expand them. NormalizedSizeBounds normalized_bounds = Normalize(orientation(), bounds); - if (normalized_bounds.cross().has_value() && - normalized_bounds.cross().value() < layout_.minimum_cross_axis_size()) { + if (normalized_bounds.cross() && + *normalized_bounds.cross() < layout_.minimum_cross_axis_size()) { normalized_bounds = NormalizedSizeBounds{normalized_bounds.main(), layout_.minimum_cross_axis_size()}; } @@ -441,6 +448,25 @@ } } +base::Optional<int> FlexLayoutInternal::GetAvailableCrossAxisSize( + const Layout& layout, + int child_index, + const NormalizedSizeBounds& bounds) const { + if (!bounds.cross()) + return base::Optional<int>(); + + const ChildLayout& child_layout = layout.child_layouts[child_index]; + const int leading_margin = + CalculateMargin(layout.interior_margin.cross_leading(), + child_layout.margins.cross_leading(), + child_layout.internal_padding.cross_leading()); + const int trailing_margin = + CalculateMargin(layout.interior_margin.cross_trailing(), + child_layout.margins.cross_trailing(), + child_layout.internal_padding.cross_trailing()); + return std::max(0, *bounds.cross() - (leading_margin + trailing_margin)); +} + int FlexLayoutInternal::CalculateMargin(int margin1, int margin2, int internal_padding) const { @@ -482,13 +508,19 @@ ChildViewSpacing* child_spacing, const NormalizedSizeBounds& bounds) const { // Calculate starting minimum for cross-axis size. - const int min_cross_size = + int min_cross_size = std::max(layout_.minimum_cross_axis_size(), CalculateMargin(layout->interior_margin.cross_leading(), layout->interior_margin.cross_trailing(), 0)); layout->total_size = NormalizedSize(0, min_cross_size); - if (bounds.cross().has_value()) - layout->total_size.SetToMax(0, bounds.cross().value()); + + // For cases with a non-zero cross-axis bound, the objective is to fit the + // layout into that precise size, not to determine what size we need. + bool force_cross_size = false; + if (bounds.cross() && *bounds.cross() > 0) { + layout->total_size.SetToMax(0, *bounds.cross()); + force_cross_size = true; + } std::vector<Inset1D> cross_spacings(layout->child_layouts.size()); for (size_t i = 0; i < layout->child_layouts.size(); ++i) { @@ -498,7 +530,7 @@ if (child_layout.excluded || !child_layout.visible) continue; - // Update the cross-axis size. + // Update the cross-axis margins and if necessary, the size. Inset1D& cross_spacing = cross_spacings[i]; cross_spacing.set_leading( CalculateMargin(layout->interior_margin.cross_leading(), @@ -509,9 +541,11 @@ child_layout.margins.cross_trailing(), child_layout.internal_padding.cross_trailing())); - const int cross_size = std::min(child_layout.current_size.cross(), - child_layout.preferred_size.cross()); - layout->total_size.SetToMax(0, cross_spacing.size() + cross_size); + if (!force_cross_size) { + const int cross_size = std::min(child_layout.current_size.cross(), + child_layout.preferred_size.cross()); + layout->total_size.SetToMax(0, cross_spacing.size() + cross_size); + } // Calculate main-axis size and upper-left main axis coordinate. int leading_space; @@ -530,8 +564,8 @@ // Add the end margin. layout->total_size.Enlarge(child_spacing->GetTrailingInset(), 0); - // Calculate vertical positioning given the cross-axis size we've already - // calculated above. + // Calculate cross-axis positioning based on the cross margins and size that + // were calculated above. const Span cross_span(0, layout->total_size.cross()); for (size_t i = 0; i < layout->child_layouts.size(); ++i) { ChildLayout& child_layout = layout->child_layouts[i]; @@ -540,12 +574,13 @@ if (child_layout.excluded || !child_layout.visible) continue; - // Because we have an explicit kStretch option, regardless of what the - // control *says* we won't allow the cross-axis size to exceed the preferred - // size. kStretch may cause it to become larger. - const int cross_size = std::min(child_layout.current_size.cross(), - child_layout.preferred_size.cross()); - child_layout.actual_bounds.set_size_cross(cross_size); + // Start with a size appropriate for the child view. For child views which + // can become larger than the preferred size, start with the preferred size + // and let the alignment operation (specifically, if the alignment is set to + // kStretch) grow the child view. + const int starting_cross_size = std::min( + child_layout.current_size.cross(), child_layout.preferred_size.cross()); + child_layout.actual_bounds.set_size_cross(starting_cross_size); child_layout.actual_bounds.AlignCross( cross_span, layout_.cross_axis_alignment(), cross_spacings[i]); } @@ -553,20 +588,13 @@ const Layout& FlexLayoutInternal::CalculateNewLayout( const NormalizedSizeBounds& bounds) { - DCHECK(!bounds.cross().has_value() || - bounds.cross().value() >= layout_.minimum_cross_axis_size()); + DCHECK(!bounds.cross() || + *bounds.cross() >= layout_.minimum_cross_axis_size()); std::unique_ptr<Layout> layout = std::make_unique<Layout>(layout_counter_); layout->interior_margin = Normalize(orientation(), layout_.interior_margin()); std::map<int, std::vector<int>> order_to_view_index; const bool main_axis_bounded = bounds.main().has_value(); - // Start with the smallest size the child view can occupy. - NormalizedSizeBounds effective_bounds{0, bounds.cross()}; - if (effective_bounds.cross()) { - effective_bounds.set_cross(std::max( - 0, *effective_bounds.cross() - layout->interior_margin.cross_size())); - } - // Step through the children, creating placeholder layout view elements // and setting up initial minimal visibility. View* const view = layout_.host(); @@ -592,10 +620,12 @@ // gfx::Size calculation depends on whether flex is allowed. if (main_axis_bounded) { - child_layout.current_size = - Normalize(orientation(), - child_layout.flex.rule().Run( - child, Denormalize(orientation(), effective_bounds))); + child_layout.available_size = { + 0, GetAvailableCrossAxisSize(*layout, i, bounds)}; + child_layout.current_size = Normalize( + orientation(), + child_layout.flex.rule().Run( + child, Denormalize(orientation(), child_layout.available_size))); // We should revisit whether this is a valid assumption for text views // in vertical layouts. @@ -605,7 +635,7 @@ // Keep track of non-hidden flex controls. const bool can_flex = (child_layout.flex.weight() > 0 && - !child_layout.preferred_size.is_empty()) || + child_layout.preferred_size.main() > 0) || child_layout.current_size.main() < child_layout.preferred_size.main(); if (can_flex) order_to_view_index[child_layout.flex.order()].push_back(i); @@ -615,7 +645,7 @@ child_layout.current_size = child_layout.preferred_size; } - child_layout.visible = !child_layout.current_size.is_empty(); + child_layout.visible = child_layout.current_size.main() > 0; // Actual size and positioning will be set during the final layout // calculation. @@ -720,12 +750,13 @@ // Offer the modified flex space to the child view and see how large it // wants to be (or if it wants to be visible at that size at all). const NormalizedSizeBounds available( - flex_amount + old_size - margin_delta, effective_bounds.cross()); + flex_amount + old_size - margin_delta, + child_layout.available_size.cross()); const NormalizedSize new_size = Normalize( orientation(), child_layout.flex.rule().Run( child_layout.view, Denormalize(orientation(), available))); - if (new_size.is_empty()) + if (new_size.main() <= 0) continue; // If the amount of space claimed increases (but is still within
diff --git a/ui/views/layout/flex_layout_types_internal.cc b/ui/views/layout/flex_layout_types_internal.cc index 83e255e..c1707f33 100644 --- a/ui/views/layout/flex_layout_types_internal.cc +++ b/ui/views/layout/flex_layout_types_internal.cc
@@ -49,13 +49,25 @@ } void Span::Center(const Span& container, const Inset1D& margins) { - const int margin_total = margins.size(); - const int remaining = container.length() - (length() + margin_total); - if (remaining >= 0 || margin_total <= 0) - set_start(container.start() + margins.leading() + remaining / 2); - else - set_start(((container.length() - length()) * margins.leading()) / - margin_total); + int remaining = container.length() - length(); + + // Case 1: no room for any margins. Just center the span in the container, + // with equal overflow on each side. + if (remaining <= 0) { + set_start(std::ceilf(remaining * 0.5f)); + return; + } + + // Case 2: room for only part of the margins. + if (margins.size() > remaining) { + float scale = float{remaining} / float{margins.size()}; + set_start(std::roundf(scale * margins.leading())); + return; + } + + // Case 3: room for both span and margins. Center the whole unit. + remaining -= margins.size(); + set_start(remaining / 2 + margins.leading()); } void Span::Align(const Span& container,
diff --git a/ui/views/layout/flex_layout_unittest.cc b/ui/views/layout/flex_layout_unittest.cc index 18cb42e..50ffda4 100644 --- a/ui/views/layout/flex_layout_unittest.cc +++ b/ui/views/layout/flex_layout_unittest.cc
@@ -5,6 +5,8 @@ #include "ui/views/layout/flex_layout.h" #include <stddef.h> + +#include <algorithm> #include <vector> #include "base/bind.h" @@ -114,6 +116,13 @@ } protected: + // Constants re-used in many tests. + static const Insets kLayoutInsets; + static const Insets kLargeInsets; + static const Size kChild1Size; + static const Size kChild2Size; + static const Size kChild3Size; + // Preferred size or drop out. static const FlexSpecification kDropOut; static const FlexSpecification kDropOutHighPriority; @@ -137,6 +146,12 @@ FlexLayout* layout_; }; +const Insets FlexLayoutTest::kLayoutInsets{5, 6, 7, 9}; +const Insets FlexLayoutTest::kLargeInsets{10, 11, 12, 13}; +const Size FlexLayoutTest::kChild1Size{12, 10}; +const Size FlexLayoutTest::kChild2Size{13, 11}; +const Size FlexLayoutTest::kChild3Size{17, 13}; + const FlexSpecification FlexLayoutTest::kDropOut = FlexSpecification::ForSizeRule(MinimumFlexSizeRule::kPreferredSnapToZero, MaximumFlexSizeRule::kPreferred) @@ -191,21 +206,21 @@ TEST_F(FlexLayoutTest, GetMinimumSize_Empty_ViewInsets) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(false); - host_->SetBorder(CreateEmptyBorder(5, 6, 7, 9)); + host_->SetBorder(CreateEmptyBorder(kLayoutInsets)); EXPECT_EQ(Size(15, 12), host_->GetMinimumSize()); } TEST_F(FlexLayoutTest, GetMinimumSize_Empty_InternalMargin_Collapsed) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); EXPECT_EQ(Size(9, 7), host_->GetMinimumSize()); } TEST_F(FlexLayoutTest, GetMinimumSize_Empty_InternalMargin_NotCollapsed) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(false); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); EXPECT_EQ(Size(15, 12), host_->GetMinimumSize()); } @@ -213,7 +228,7 @@ GetMinimumSize_Empty_InternalMargin_DefaultMarginHasNoEffect) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(false); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetDefaultChildMargins(gfx::Insets(11, 11)); EXPECT_EQ(Size(15, 12), host_->GetMinimumSize()); } @@ -221,7 +236,7 @@ TEST_F(FlexLayoutTest, GetMinimumSize_MinimumCross_Horizontal) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetMinimumCrossAxisSize(5); EXPECT_EQ(Size(9, 7), host_->GetMinimumSize()); layout_->SetMinimumCrossAxisSize(10); @@ -233,7 +248,7 @@ TEST_F(FlexLayoutTest, GetMinimumSize_MinimumCross_Vertical) { layout_->SetOrientation(LayoutOrientation::kVertical); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetMinimumCrossAxisSize(5); EXPECT_EQ(Size(9, 7), host_->GetMinimumSize()); layout_->SetMinimumCrossAxisSize(10); @@ -287,11 +302,11 @@ TEST_F(FlexLayoutTest, Layout_VisibilitySetBeforeAdd) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11), Optional<Size>(), false); - View* child3 = AddChild(Size(17, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size, Optional<Size>(), false); + View* child3 = AddChild(kChild3Size); host_->Layout(); EXPECT_EQ(true, layout_->IsHiddenByOwner(child2)); @@ -322,11 +337,11 @@ TEST_F(FlexLayoutTest, Layout_VisibilitySetAfterAdd) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - View* child3 = AddChild(Size(17, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + View* child3 = AddChild(kChild3Size); child2->SetVisible(false); host_->Layout(); @@ -350,11 +365,11 @@ Layout_ViewVisibilitySetNotContingentOnActualVisibility) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - View* child3 = AddChild(Size(17, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + View* child3 = AddChild(kChild3Size); layout_->SetFlexForView(child2, kDropOut); // Layout makes child view invisible due to flex rule. @@ -383,11 +398,11 @@ TEST_F(FlexLayoutTest, Layout_Exlcude) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); - const View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - const View* child3 = AddChild(Size(17, 13)); + const View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + const View* child3 = AddChild(kChild3Size); layout_->SetViewExcluded(child2, true); child2->SetBounds(3, 3, 3, 3); @@ -412,8 +427,8 @@ TEST_F(FlexLayoutTest, LayoutSingleView_Horizontal) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); - View* child = AddChild(Size(12, 10)); + layout_->SetInteriorMargin(kLayoutInsets); + View* child = AddChild(kChild1Size); host_->Layout(); EXPECT_EQ(Rect(6, 5, 12, 10), child->bounds()); } @@ -421,8 +436,8 @@ TEST_F(FlexLayoutTest, LayoutSingleView_Vertical) { layout_->SetOrientation(LayoutOrientation::kVertical); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); - View* child = AddChild(Size(12, 10)); + layout_->SetInteriorMargin(kLayoutInsets); + View* child = AddChild(kChild1Size); host_->Layout(); EXPECT_EQ(Rect(6, 5, 12, 10), child->bounds()); } @@ -430,11 +445,11 @@ TEST_F(FlexLayoutTest, LayoutMultipleViews_Horizontal_CrossStart) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); - AddChild(Size(12, 10)); - AddChild(Size(13, 11)); - AddChild(Size(17, 13)); + AddChild(kChild1Size); + AddChild(kChild2Size); + AddChild(kChild3Size); host_->Layout(); std::vector<Rect> expected{Rect(6, 5, 12, 10), Rect(18, 5, 13, 11), Rect(31, 5, 17, 13)}; @@ -445,11 +460,11 @@ TEST_F(FlexLayoutTest, LayoutMultipleViews_Horizontal_CrossCenter) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kCenter); - AddChild(Size(12, 10)); - AddChild(Size(13, 11)); - AddChild(Size(17, 13)); + AddChild(kChild1Size); + AddChild(kChild2Size); + AddChild(kChild3Size); host_->Layout(); std::vector<Rect> expected{Rect(6, 6, 12, 10), Rect(18, 6, 13, 11), Rect(31, 5, 17, 13)}; @@ -460,11 +475,11 @@ TEST_F(FlexLayoutTest, LayoutMultipleViews_Horizontal_CrossEnd) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kEnd); - AddChild(Size(12, 10)); - AddChild(Size(13, 11)); - AddChild(Size(17, 13)); + AddChild(kChild1Size); + AddChild(kChild2Size); + AddChild(kChild3Size); host_->Layout(); std::vector<Rect> expected{Rect(6, 8, 12, 10), Rect(18, 7, 13, 11), Rect(31, 5, 17, 13)}; @@ -475,12 +490,12 @@ TEST_F(FlexLayoutTest, LayoutMultipleViews_Horizontal_CrossStretch) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kStretch); host_->SetSize(Size(100, 25)); - AddChild(Size(12, 10)); - AddChild(Size(13, 11)); - AddChild(Size(17, 13)); + AddChild(kChild1Size); + AddChild(kChild2Size); + AddChild(kChild3Size); host_->Layout(); std::vector<Rect> expected{Rect(6, 5, 12, 13), Rect(18, 5, 13, 13), Rect(31, 5, 17, 13)}; @@ -491,11 +506,11 @@ TEST_F(FlexLayoutTest, LayoutMultipleViews_Vertical_CrossStart) { layout_->SetOrientation(LayoutOrientation::kVertical); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); - AddChild(Size(12, 10)); - AddChild(Size(13, 11)); - AddChild(Size(17, 13)); + AddChild(kChild1Size); + AddChild(kChild2Size); + AddChild(kChild3Size); host_->Layout(); std::vector<Rect> expected{Rect(6, 5, 12, 10), Rect(6, 15, 13, 11), Rect(6, 26, 17, 13)}; @@ -506,11 +521,11 @@ TEST_F(FlexLayoutTest, LayoutMultipleViews_Vertical_CrossCenter) { layout_->SetOrientation(LayoutOrientation::kVertical); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kCenter); - AddChild(Size(12, 10)); - AddChild(Size(13, 11)); - AddChild(Size(17, 13)); + AddChild(kChild1Size); + AddChild(kChild2Size); + AddChild(kChild3Size); host_->Layout(); std::vector<Rect> expected{Rect(8, 5, 12, 10), Rect(8, 15, 13, 11), Rect(6, 26, 17, 13)}; @@ -521,11 +536,11 @@ TEST_F(FlexLayoutTest, LayoutMultipleViews_Vertical_CrossEnd) { layout_->SetOrientation(LayoutOrientation::kVertical); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kEnd); - AddChild(Size(12, 10)); - AddChild(Size(13, 11)); - AddChild(Size(17, 13)); + AddChild(kChild1Size); + AddChild(kChild2Size); + AddChild(kChild3Size); host_->Layout(); std::vector<Rect> expected{Rect(11, 5, 12, 10), Rect(10, 15, 13, 11), Rect(6, 26, 17, 13)}; @@ -536,11 +551,11 @@ TEST_F(FlexLayoutTest, LayoutMultipleViews_Vertical_CrossStretch) { layout_->SetOrientation(LayoutOrientation::kVertical); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kStretch); - AddChild(Size(12, 10)); - AddChild(Size(13, 11)); - AddChild(Size(17, 13)); + AddChild(kChild1Size); + AddChild(kChild2Size); + AddChild(kChild3Size); host_->SetSize(Size(32, 50)); host_->Layout(); std::vector<Rect> expected{Rect(6, 5, 17, 10), Rect(6, 15, 17, 11), @@ -553,11 +568,11 @@ LayoutMultipleViews_MarginAndSpacing_NoCollapse_Horizontal) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(false); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - View* child3 = AddChild(Size(17, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + View* child3 = AddChild(kChild3Size); host_->Layout(); std::vector<Rect> expected{Rect(6, 5, 12, 10), Rect(18, 5, 13, 11), Rect(31, 5, 17, 13)}; @@ -594,12 +609,12 @@ LayoutMultipleViews_MarginAndSpacing_NoCollapse_Vertical) { layout_->SetOrientation(LayoutOrientation::kVertical); layout_->SetCollapseMargins(false); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); layout_->SetDefaultChildMargins(gfx::Insets(3)); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - View* child3 = AddChild(Size(17, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + View* child3 = AddChild(kChild3Size); child1->SetProperty(views::kMarginsKey, new Insets(20, 21, 22, 23)); child2->SetProperty(views::kMarginsKey, new Insets(1, 1, 1, 1)); child3->SetProperty(views::kMarginsKey, new Insets(2, 2, 2, 2)); @@ -615,12 +630,12 @@ LayoutMultipleViews_MarginAndSpacing_Collapse_Horizontal) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); layout_->SetDefaultChildMargins(gfx::Insets(3)); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - View* child3 = AddChild(Size(17, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + View* child3 = AddChild(kChild3Size); child1->SetProperty(views::kMarginsKey, new Insets(20, 21, 22, 23)); child2->SetProperty(views::kMarginsKey, new Insets(1, 1, 1, 1)); child3->SetProperty(views::kMarginsKey, new Insets(2, 2, 2, 2)); @@ -635,12 +650,12 @@ TEST_F(FlexLayoutTest, LayoutMultipleViews_MarginAndSpacing_Collapse_Vertical) { layout_->SetOrientation(LayoutOrientation::kVertical); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); layout_->SetDefaultChildMargins(gfx::Insets(3)); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - View* child3 = AddChild(Size(17, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + View* child3 = AddChild(kChild3Size); child1->SetProperty(views::kMarginsKey, new Insets(20, 21, 22, 23)); child2->SetProperty(views::kMarginsKey, new Insets(1, 1, 1, 1)); child3->SetProperty(views::kMarginsKey, new Insets(2, 2, 2, 2)); @@ -655,11 +670,11 @@ TEST_F(FlexLayoutTest, LayoutMultipleViews_InteriorPadding) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); layout_->SetDefaultChildMargins(gfx::Insets(10)); View* child = AddChild(Size(13, 15)); - AddChild(Size(17, 13)); + AddChild(kChild3Size); child->SetProperty(views::kInternalPaddingKey, new Insets(1, 2, 4, 8)); host_->InvalidateLayout(); host_->Layout(); @@ -674,11 +689,11 @@ TEST_F(FlexLayoutTest, LayoutMultipleViews_InteriorPadding_Margins) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); layout_->SetDefaultChildMargins(gfx::Insets(2)); View* child = AddChild(Size(13, 15)); - View* child2 = AddChild(Size(17, 13)); + View* child2 = AddChild(kChild3Size); child->SetProperty(views::kInternalPaddingKey, new Insets(1, 2, 4, 8)); child2->SetProperty(views::kMarginsKey, new Insets(5, 5, 5, 5)); host_->InvalidateLayout(); @@ -694,11 +709,11 @@ TEST_F(FlexLayoutTest, LayoutMultipleViews_InteriorPadding_Additive) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); layout_->SetDefaultChildMargins(gfx::Insets(20)); View* child = AddChild(Size(13, 15)); - View* child2 = AddChild(Size(17, 13)); + View* child2 = AddChild(kChild3Size); child->SetProperty(views::kInternalPaddingKey, new Insets(1, 2, 4, 8)); child2->SetProperty(views::kInternalPaddingKey, new Insets(5, 5, 5, 5)); host_->InvalidateLayout(); @@ -716,13 +731,13 @@ TEST_F(FlexLayoutTest, Layout_CrossStart) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetMainAxisAlignment(LayoutAlignment::kStart); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - View* child3 = AddChild(Size(17, 13)); - child1->SetProperty(views::kMarginsKey, new Insets(10, 11, 12, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + View* child3 = AddChild(kChild3Size); + child1->SetProperty(views::kMarginsKey, new Insets(kLargeInsets)); child2->SetProperty(views::kMarginsKey, new Insets(1, 1, 1, 1)); child3->SetProperty(views::kMarginsKey, new Insets(2, 2, 2, 2)); host_->SetSize(Size(200, 200)); @@ -735,13 +750,13 @@ TEST_F(FlexLayoutTest, Layout_CrossCenter) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetMainAxisAlignment(LayoutAlignment::kStart); layout_->SetCrossAxisAlignment(LayoutAlignment::kCenter); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - View* child3 = AddChild(Size(17, 13)); - child1->SetProperty(views::kMarginsKey, new Insets(10, 11, 12, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + View* child3 = AddChild(kChild3Size); + child1->SetProperty(views::kMarginsKey, new Insets(kLargeInsets)); child2->SetProperty(views::kMarginsKey, new Insets(1, 1, 1, 1)); child3->SetProperty(views::kMarginsKey, new Insets(2, 2, 2, 2)); host_->SetSize(Size(200, 200)); @@ -754,13 +769,13 @@ TEST_F(FlexLayoutTest, Layout_CrossEnd) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetMainAxisAlignment(LayoutAlignment::kStart); layout_->SetCrossAxisAlignment(LayoutAlignment::kEnd); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - View* child3 = AddChild(Size(17, 13)); - child1->SetProperty(views::kMarginsKey, new Insets(10, 11, 12, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + View* child3 = AddChild(kChild3Size); + child1->SetProperty(views::kMarginsKey, new Insets(kLargeInsets)); child2->SetProperty(views::kMarginsKey, new Insets(1, 1, 1, 1)); child3->SetProperty(views::kMarginsKey, new Insets(2, 2, 2, 2)); host_->SetSize(Size(200, 200)); @@ -773,13 +788,13 @@ TEST_F(FlexLayoutTest, Layout_CrossStretch) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetMainAxisAlignment(LayoutAlignment::kStart); layout_->SetCrossAxisAlignment(LayoutAlignment::kStretch); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - View* child3 = AddChild(Size(17, 13)); - child1->SetProperty(views::kMarginsKey, new Insets(10, 11, 12, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + View* child3 = AddChild(kChild3Size); + child1->SetProperty(views::kMarginsKey, new Insets(kLargeInsets)); child2->SetProperty(views::kMarginsKey, new Insets(1, 1, 1, 1)); child3->SetProperty(views::kMarginsKey, new Insets(2, 2, 2, 2)); host_->SetSize(Size(200, 200)); @@ -795,13 +810,13 @@ TEST_F(FlexLayoutTest, Layout_AlignStart) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetMainAxisAlignment(LayoutAlignment::kStart); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); layout_->SetDefaultChildMargins(gfx::Insets(3)); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - View* child3 = AddChild(Size(17, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + View* child3 = AddChild(kChild3Size); child1->SetProperty(views::kMarginsKey, new Insets(20, 21, 22, 23)); child2->SetProperty(views::kMarginsKey, new Insets(1, 1, 1, 1)); child3->SetProperty(views::kMarginsKey, new Insets(2, 2, 2, 2)); @@ -815,13 +830,13 @@ TEST_F(FlexLayoutTest, Layout_AlignCenter) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetMainAxisAlignment(LayoutAlignment::kCenter); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); layout_->SetDefaultChildMargins(gfx::Insets(3)); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - View* child3 = AddChild(Size(17, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + View* child3 = AddChild(kChild3Size); child1->SetProperty(views::kMarginsKey, new Insets(20, 21, 22, 23)); child2->SetProperty(views::kMarginsKey, new Insets(1, 1, 1, 1)); child3->SetProperty(views::kMarginsKey, new Insets(2, 2, 2, 2)); @@ -835,13 +850,13 @@ TEST_F(FlexLayoutTest, Layout_AlignEnd) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetMainAxisAlignment(LayoutAlignment::kEnd); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); layout_->SetDefaultChildMargins(gfx::Insets(3)); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - View* child3 = AddChild(Size(17, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + View* child3 = AddChild(kChild3Size); child1->SetProperty(views::kMarginsKey, new Insets(20, 21, 22, 23)); child2->SetProperty(views::kMarginsKey, new Insets(1, 1, 1, 1)); child3->SetProperty(views::kMarginsKey, new Insets(2, 2, 2, 2)); @@ -883,14 +898,14 @@ TEST_F(FlexLayoutTest, Layout_IgnoreMinimumSize_DropViews) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetMainAxisAlignment(LayoutAlignment::kStart); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); layout_->SetDefaultChildMargins(gfx::Insets(3)); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - View* child3 = AddChild(Size(17, 13)); - child1->SetProperty(views::kMarginsKey, new Insets(10, 11, 12, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + View* child3 = AddChild(kChild3Size); + child1->SetProperty(views::kMarginsKey, new Insets(kLargeInsets)); child2->SetProperty(views::kMarginsKey, new Insets(1, 1, 1, 1)); child3->SetProperty(views::kMarginsKey, new Insets(2, 2, 2, 2)); host_->SetSize(Size(55, 50)); @@ -935,14 +950,14 @@ TEST_F(FlexLayoutTest, Layout_IgnoreMinimumSize_DropInOrder) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetMainAxisAlignment(LayoutAlignment::kStart); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); layout_->SetDefaultChildMargins(gfx::Insets(3)); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - View* child3 = AddChild(Size(17, 13)); - child1->SetProperty(views::kMarginsKey, new Insets(10, 11, 12, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + View* child3 = AddChild(kChild3Size); + child1->SetProperty(views::kMarginsKey, new Insets(kLargeInsets)); child2->SetProperty(views::kMarginsKey, new Insets(1, 1, 1, 1)); child3->SetProperty(views::kMarginsKey, new Insets(2, 2, 2, 2)); // Set flex separately; we'll test default flex later. @@ -987,14 +1002,14 @@ // Perform the same test as above but with default flex set instead. layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetMainAxisAlignment(LayoutAlignment::kStart); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); layout_->SetDefaultChildMargins(gfx::Insets(3)); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - View* child3 = AddChild(Size(17, 13)); - child1->SetProperty(views::kMarginsKey, new Insets(10, 11, 12, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + View* child3 = AddChild(kChild3Size); + child1->SetProperty(views::kMarginsKey, new Insets(kLargeInsets)); child2->SetProperty(views::kMarginsKey, new Insets(1, 1, 1, 1)); child3->SetProperty(views::kMarginsKey, new Insets(2, 2, 2, 2)); layout_->SetDefaultFlex(kDropOut); @@ -1035,14 +1050,14 @@ TEST_F(FlexLayoutTest, Layout_IgnoreMinimumSize_DropByPriority) { layout_->SetOrientation(LayoutOrientation::kHorizontal); layout_->SetCollapseMargins(true); - layout_->SetInteriorMargin(Insets(5, 6, 7, 9)); + layout_->SetInteriorMargin(kLayoutInsets); layout_->SetMainAxisAlignment(LayoutAlignment::kStart); layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); layout_->SetDefaultChildMargins(gfx::Insets(3)); - View* child1 = AddChild(Size(12, 10)); - View* child2 = AddChild(Size(13, 11)); - View* child3 = AddChild(Size(17, 13)); - child1->SetProperty(views::kMarginsKey, new Insets(10, 11, 12, 13)); + View* child1 = AddChild(kChild1Size); + View* child2 = AddChild(kChild2Size); + View* child3 = AddChild(kChild3Size); + child1->SetProperty(views::kMarginsKey, new Insets(kLargeInsets)); child2->SetProperty(views::kMarginsKey, new Insets(1, 1, 1, 1)); child3->SetProperty(views::kMarginsKey, new Insets(2, 2, 2, 2)); layout_->SetDefaultFlex(kDropOut); @@ -1216,7 +1231,7 @@ host_->SetSize(Size(45, 20)); host_->Layout(); - EXPECT_EQ(Size(12, 10), child1->size()); + EXPECT_EQ(kChild1Size, child1->size()); EXPECT_EQ(Size(18, 10), child2->size()); } @@ -1360,9 +1375,12 @@ host_->Layout(); EXPECT_EQ(Size(15, 6), child->size()); + // This is too short to display the view, however it has horizontal size, so + // the view does not drop out. host_->SetSize(Size(25, 10)); host_->Layout(); - EXPECT_FALSE(child->visible()); + EXPECT_TRUE(child->visible()); + EXPECT_EQ(Size(15, 0), child->size()); host_->SetSize(Size(15, 15)); host_->Layout(); @@ -1401,9 +1419,12 @@ host_->Layout(); EXPECT_EQ(Size(15, 6), child->size()); + // This is too short to display the view, however it has horizontal size, so + // the view does not drop out. host_->SetSize(Size(25, 10)); host_->Layout(); - EXPECT_FALSE(child->visible()); + EXPECT_TRUE(child->visible()); + EXPECT_EQ(Size(15, 0), child->size()); host_->SetSize(Size(15, 15)); host_->Layout(); @@ -1566,6 +1587,117 @@ EXPECT_EQ(0, child2->GetSetVisibleCount()); } +// Cross-axis Fit Tests -------------------------------------------------------- + +// Tests for cross-axis alignment that checks three different conditions: +// - child1 fits entirely in the space provided, with margins +// - child2 fits in the space, but its margins don't +// - child3 does not fit in the space provided +class FlexLayoutCrossAxisFitTest : public FlexLayoutTest { + public: + void SetUp() override { + FlexLayoutTest::SetUp(); + DCHECK(child_views_.empty()); + + for (int i = 0; i < kNumChildren; ++i) { + View* const child = AddChild(kChildSizes[i]); + child->SetProperty(kMarginsKey, new gfx::Insets(kChildMargins[i])); + child_views_.push_back(child); + } + + layout_->SetOrientation(LayoutOrientation::kHorizontal); + layout_->SetCollapseMargins(true); + layout_->SetMainAxisAlignment(LayoutAlignment::kStart); + host_->SetSize(kHostSize); + } + + void TearDown() override { child_views_.clear(); } + + protected: + static constexpr int kNumChildren = 3; + static const gfx::Size kHostSize; + static const gfx::Size kChildSizes[kNumChildren]; + static const gfx::Insets kChildMargins[kNumChildren]; + + std::vector<View*> child_views_; +}; + +const gfx::Size FlexLayoutCrossAxisFitTest::kHostSize{200, 20}; + +const gfx::Size FlexLayoutCrossAxisFitTest::kChildSizes[]{{10, 10}, + {10, 10}, + {10, 30}}; + +const gfx::Insets FlexLayoutCrossAxisFitTest::kChildMargins[]{{6, 0, 2, 0}, + {10, 0, 5, 0}, + {6, 0, 2, 0}}; + +TEST_F(FlexLayoutCrossAxisFitTest, Layout_CrossStretch) { + layout_->SetCrossAxisAlignment(LayoutAlignment::kStretch); + host_->Layout(); + + // Expect child views to respect their leading margin and to occupy all + // available space (other than margins), with a minimum size of zero. + for (int i = 0; i < kNumChildren; ++i) { + EXPECT_EQ(kChildMargins[i].top(), child_views_[i]->origin().y()); + const int expected_height = + std::max(0, kHostSize.height() - kChildMargins[i].height()); + EXPECT_EQ(expected_height, child_views_[i]->size().height()); + } +} + +TEST_F(FlexLayoutCrossAxisFitTest, Layout_CrossStart) { + layout_->SetCrossAxisAlignment(LayoutAlignment::kStart); + host_->Layout(); + + // These should all justify to the leading edge and keep their original size. + for (int i = 0; i < kNumChildren; ++i) { + EXPECT_EQ(kChildMargins[i].top(), child_views_[i]->origin().y()); + EXPECT_EQ(kChildSizes[i].height(), child_views_[i]->size().height()); + } +} + +TEST_F(FlexLayoutCrossAxisFitTest, Layout_CrossCenter) { + layout_->SetCrossAxisAlignment(LayoutAlignment::kCenter); + host_->Layout(); + + // First child view fits entirely in the host view with margins (18 DIPs). + // The entire height (including margins) will be centered vertically. + int remain = kHostSize.height() - + (kChildSizes[0].height() + kChildMargins[0].height()); + int expected = remain / 2 + kChildMargins[0].top(); + EXPECT_EQ(expected, child_views_[0]->origin().y()); + + // Second child view is smaller than the host view, but margins don't fit. + // The margins will be scaled down. + remain = kHostSize.height() - kChildSizes[0].height(); + expected = std::roundf(kChildMargins[1].top() * float{remain} / + float{kChildMargins[1].height()}); + EXPECT_EQ(expected, child_views_[1]->origin().y()); + + // Third child view does not fit, so is centered. + remain = kHostSize.height() - kChildSizes[2].height(); + expected = std::ceilf(remain * 0.5f); + EXPECT_EQ(expected, child_views_[2]->origin().y()); + + // Expect child views to retain their preferred sizes. + for (int i = 0; i < kNumChildren; ++i) { + EXPECT_EQ(kChildSizes[i].height(), child_views_[i]->size().height()); + } +} + +TEST_F(FlexLayoutCrossAxisFitTest, Layout_CrossEnd) { + layout_->SetCrossAxisAlignment(LayoutAlignment::kEnd); + host_->Layout(); + + // These should all justify to the trailing edge and keep their original size. + for (int i = 0; i < kNumChildren; ++i) { + EXPECT_EQ(kHostSize.height() - kChildMargins[i].bottom(), + child_views_[i]->bounds().bottom()); + EXPECT_EQ(kChildSizes[i].height(), child_views_[i]->size().height()); + } +} + // Nested Layout Tests --------------------------------------------------------- class NestedFlexLayoutTest : public FlexLayoutTest {
diff --git a/url/BUILD.gn b/url/BUILD.gn index e7a43342..b52a2286 100644 --- a/url/BUILD.gn +++ b/url/BUILD.gn
@@ -129,6 +129,7 @@ ":url", "//base", "//base/test:test_support", + "//testing/gmock", "//testing/gtest", ]
diff --git a/url/origin.cc b/url/origin.cc index 916ad36..c2dee88 100644 --- a/url/origin.cc +++ b/url/origin.cc
@@ -10,6 +10,7 @@ #include "base/logging.h" #include "base/stl_util.h" +#include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "url/gurl.h" @@ -239,6 +240,30 @@ return Origin(Nonce(), tuple_); } +std::string Origin::GetDebugString() const { + // Handle non-opaque origins first, as they are simpler. + if (!opaque()) { + std::string out = Serialize(); + if (scheme() == kFileScheme) + base::StrAppend(&out, {" [internally: ", tuple_.Serialize(), "]"}); + return out; + } + + // For opaque origins, log the nonce and precursor as well. Without this, + // EXPECT_EQ failures between opaque origins are nearly impossible to + // understand. + std::string nonce = nonce_->raw_token().is_empty() + ? std::string("nonce TBD") + : nonce_->raw_token().ToString(); + + std::string out = base::StrCat({Serialize(), " [internally: (", nonce, ")"}); + if (tuple_.IsInvalid()) + base::StrAppend(&out, {" anonymous]"}); + else + base::StrAppend(&out, {" derived from ", tuple_.Serialize(), "]"}); + return out; +} + Origin::Origin(SchemeHostPort tuple) : tuple_(std::move(tuple)) { DCHECK(!opaque()); DCHECK(!tuple_.IsInvalid()); @@ -255,21 +280,7 @@ } std::ostream& operator<<(std::ostream& out, const url::Origin& origin) { - out << origin.Serialize(); - - if (origin.opaque()) { - // For opaque origins, log the nonce and precursor as well. Without this, - // EXPECT_EQ failures between opaque origins are nearly impossible to - // understand. - out << " [internally: " << *origin.nonce_; - if (origin.tuple_.IsInvalid()) - out << " anonymous"; - else - out << " derived from " << origin.tuple_; - out << "]"; - } else if (origin.scheme() == kFileScheme) { - out << " [internally: " << origin.tuple_ << "]"; - } + out << origin.GetDebugString(); return out; }
diff --git a/url/origin.h b/url/origin.h index 0833254..cfcba14 100644 --- a/url/origin.h +++ b/url/origin.h
@@ -261,6 +261,11 @@ // |d|, and |d| is cross-origin to |a| and |c|. Origin DeriveNewOpaqueOrigin() const; + // Creates a string representation of the object that can be used for logging + // and debugging. It serializes the internal state, such as the nonce value + // and precursor information. + std::string GetDebugString() const; + private: friend class blink::SecurityOrigin; friend class OriginTest;
diff --git a/url/origin_unittest.cc b/url/origin_unittest.cc index 36f2f51..2f65757 100644 --- a/url/origin_unittest.cc +++ b/url/origin_unittest.cc
@@ -7,6 +7,7 @@ #include "base/logging.h" #include "base/macros.h" +#include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" #include "url/origin.h" @@ -831,4 +832,35 @@ } } +TEST_F(OriginTest, GetDebugString) { + Origin http_origin = Origin::Create(GURL("http://192.168.9.1")); + EXPECT_STREQ(http_origin.GetDebugString().c_str(), "http://192.168.9.1"); + + Origin http_opaque_origin = http_origin.DeriveNewOpaqueOrigin(); + EXPECT_THAT( + http_opaque_origin.GetDebugString().c_str(), + ::testing::MatchesRegex( + "null \\[internally: \\(\\w*\\) derived from http://192.168.9.1\\]")); + + Origin data_origin = Origin::Create(GURL("data:")); + EXPECT_STREQ(data_origin.GetDebugString().c_str(), + "null [internally: (nonce TBD) anonymous]"); + + // The nonce of the origin will be initialized if a new opaque origin is + // derived. + Origin data_derived_origin = data_origin.DeriveNewOpaqueOrigin(); + EXPECT_THAT( + data_derived_origin.GetDebugString().c_str(), + ::testing::MatchesRegex("null \\[internally: \\(\\w*\\) anonymous\\]")); + + Origin file_origin = Origin::Create(GURL("file:///etc/passwd")); + EXPECT_STREQ(file_origin.GetDebugString().c_str(), + "file:// [internally: file://]"); + + Origin file_server_origin = + Origin::Create(GURL("file://example.com/etc/passwd")); + EXPECT_STREQ(file_server_origin.GetDebugString().c_str(), + "file:// [internally: file://example.com]"); +} + } // namespace url