diff --git a/DEPS b/DEPS index f053a4bc..5138d53 100644 --- a/DEPS +++ b/DEPS
@@ -209,11 +209,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '827dab407ec0d265d3bf10270795e2b0f7309577', + 'skia_revision': '11a737fa4b8be45d9942345a717f058695b51f20', # 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': '014482f5ec58fec384a2f920266b921fd46e72f6', + 'v8_revision': '9d64f51f8b298b2158ecd7965c20d4cf9178a385', # 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. @@ -221,7 +221,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': '904ac34039cf1e5f8cb1f340ad41a2ee0015f634', + 'angle_revision': '16a919b174b122d8463345262eade7795fb97aa8', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -288,7 +288,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': '417940939a7a17e0c2a6f879cae426e06bd20cc1', + 'devtools_frontend_revision': '3b10a97f910e240f1012cc838fb4560c00a12494', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libprotobuf-mutator # and whatever else without interference from each other. @@ -332,7 +332,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'quiche_revision': '59de4b0760cce3b052924470c4da2ee784555483', + 'quiche_revision': '0142a09c2f0c8bb48f2aa13ec375f5e3287ad2e6', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ios_webkit # and whatever else without interference from each other. @@ -548,7 +548,7 @@ Var('chromium_git') + '/external/github.com/toji/webvr.info.git' + '@' + 'c58ae99b9ff9e2aa4c524633519570bf33536248', 'src/ios/third_party/earl_grey2/src': { - 'url': Var('chromium_git') + '/external/github.com/google/EarlGrey.git' + '@' + 'ae7523b3d3fe493c4bebd7a31486119119563266', + 'url': Var('chromium_git') + '/external/github.com/google/EarlGrey.git' + '@' + 'f4395d996a10f7c8a065f4c8435497d419698f0b', 'condition': 'checkout_ios', }, @@ -573,7 +573,7 @@ }, 'src/ios/third_party/material_components_ios/src': { - 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + 'ee79f1c2b1ded032bf91dfcf01d82eb20c73fa31', + 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '5874e43f476f4463d92f768a7adc2bb29f92cc24', 'condition': 'checkout_ios', }, @@ -966,7 +966,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '0e6b37448ddf1eaaf93db1d2cb2b0198d7b79188', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'ae1b2b19ef3118866b3237ef9f0c85fba855118c', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), @@ -1338,7 +1338,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '36d5d47a5168725d3a4fbef751f44212f6f4cb5f', + Var('android_git') + '/platform/external/perfetto.git' + '@' + 'e01ad9a6a83bd8df88dc01bc86fd0ec9080296c7', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1525,7 +1525,7 @@ 'src/third_party/usrsctp/usrsctplib': Var('chromium_git') + '/external/github.com/sctplab/usrsctp' + '@' + '70d42ae95a1de83bd317c8cc9503f894671d1392', - 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@4d5ff9313ec422141bcd58e8986dad1beaa67588', + 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@42d8716d02941f47870776a9c273de1effc51b1a', 'src/third_party/vulkan_memory_allocator': Var('chromium_git') + '/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git' + '@' + '732a76d9d3c70d6aa487216495eeb28518349c3a', @@ -1549,7 +1549,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + 'a0b8774ce8cec1dc8f4308810bf05eb8867c62de', 'src/third_party/webgpu-cts/src': - Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '9dd7f1e157c609c8056f7f8b9c04e627611ef937', + Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '267e0b71649664a27d79f23773f0bde9e0e1164f', 'src/third_party/webrtc': Var('webrtc_git') + '/src.git' + '@' + 'f8187e0a82130f93cf01953deafd63ea427af022', @@ -1613,7 +1613,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@93ae6ed257ec929ba5ed7f3014099c58244a16ce', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@b8d239568fb2af12d03d4ca9cf2fcb3a45a5f58a', 'condition': 'checkout_src_internal', },
diff --git a/android_webview/browser/BUILD.gn b/android_webview/browser/BUILD.gn index 4c4b0ca..d31554f 100644 --- a/android_webview/browser/BUILD.gn +++ b/android_webview/browser/BUILD.gn
@@ -4,6 +4,7 @@ import("//build/config/android/rules.gni") import("//components/spellcheck/spellcheck_build_features.gni") +import("//printing/buildflags/buildflags.gni") java_cpp_enum("browser_enums") { sources = [ @@ -233,9 +234,6 @@ "//components/policy/core/browser", "//components/pref_registry", "//components/prefs", - "//components/printing/browser", - "//components/printing/common", - "//components/printing/common:mojo_interfaces", "//components/safe_browsing/android:remote_database_manager", "//components/safe_browsing/content", "//components/safe_browsing/content/browser", @@ -264,7 +262,6 @@ "//components/webdata/common", "//content/public/browser", "//media/mojo:buildflags", - "//printing", "//services/cert_verifier/public/mojom", "//services/network/public/mojom", "//services/proxy_resolver:lib", @@ -278,6 +275,15 @@ "//url:gurl_android", ] + if (enable_basic_printing) { + deps += [ + "//components/printing/browser", + "//components/printing/common", + "//components/printing/common:mojo_interfaces", + "//printing", + ] + } + if (enable_spellcheck) { deps += [ "//components/spellcheck/browser" ] }
diff --git a/android_webview/lib/aw_main_delegate.cc b/android_webview/lib/aw_main_delegate.cc index 2b81b342..2dab07b 100644 --- a/android_webview/lib/aw_main_delegate.cc +++ b/android_webview/lib/aw_main_delegate.cc
@@ -217,8 +217,8 @@ // WebView does not and should not support WebAuthN. features.DisableIfNotSet(::features::kWebAuth); - // Enable VizForWebView by default. - features.EnableIfNotSet(::features::kVizForWebViewDefault); + // WebView requires SkiaRenderer. + features.EnableIfNotSet(::features::kUseSkiaRenderer); // WebView does not support overlay fullscreen yet for video overlays. features.DisableIfNotSet(media::kOverlayFullscreenVideo);
diff --git a/android_webview/lib/webview_tests.cc b/android_webview/lib/webview_tests.cc index 5c3b7a9a..a2cdd39 100644 --- a/android_webview/lib/webview_tests.cc +++ b/android_webview/lib/webview_tests.cc
@@ -13,10 +13,9 @@ int main(int argc, char** argv) { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); command_line->AppendSwitch(switches::kSingleProcess); - command_line->AppendSwitchASCII(switches::kDisableFeatures, - ",Vulkan,UseSkiaRenderer"); + command_line->AppendSwitchASCII(switches::kDisableFeatures, ",Vulkan"); command_line->AppendSwitchASCII(switches::kEnableFeatures, - ",VizForWebViewDefault"); + ",UseSkiaRenderer"); gl::GLSurfaceTestSupport::InitializeNoExtensionsOneOff(); base::TestSuite test_suite(argc, argv);
diff --git a/android_webview/renderer/BUILD.gn b/android_webview/renderer/BUILD.gn index 29955af1..3a46f68 100644 --- a/android_webview/renderer/BUILD.gn +++ b/android_webview/renderer/BUILD.gn
@@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//printing/buildflags/buildflags.gni") + source_set("renderer") { sources = [ "aw_content_renderer_client.cc", @@ -43,8 +45,6 @@ "//components/js_injection/renderer", "//components/page_load_metrics/renderer", "//components/power_scheduler", - "//components/printing/common", - "//components/printing/renderer", "//components/resources", "//components/safe_browsing/content/common:interfaces", "//components/safe_browsing/content/renderer:throttles", @@ -64,4 +64,11 @@ "//ui/base", "//url", ] + + if (enable_basic_printing) { + deps += [ + "//components/printing/common", + "//components/printing/renderer", + ] + } }
diff --git a/ash/accelerators/accelerator_controller_impl.cc b/ash/accelerators/accelerator_controller_impl.cc index 42b168b1..273f42a 100644 --- a/ash/accelerators/accelerator_controller_impl.cc +++ b/ash/accelerators/accelerator_controller_impl.cc
@@ -147,6 +147,7 @@ namespace { using base::UserMetricsAction; +using chromeos::input_method::InputMethodManager; using message_center::Notification; using message_center::SystemNotificationWarningLevel; @@ -1687,6 +1688,13 @@ accelerator_history_(std::make_unique<AcceleratorHistoryImpl>()), side_volume_button_location_file_path_( base::FilePath(kSideVolumeButtonLocationFilePath)) { + if (::features::IsImprovedKeyboardShortcutsEnabled()) { + // Observe input method changes to determine when to use positional + // shortcuts. Calling AddObserver will cause InputMethodChanged to be + // called once even when the method does not change. + InputMethodManager::Get()->AddObserver(this); + } + Init(); ParseSideVolumeButtonLocationInfo(); @@ -1701,6 +1709,25 @@ AcceleratorControllerImpl::~AcceleratorControllerImpl() { aura::Env::GetInstance()->RemovePreTargetHandler(accelerator_history_.get()); + + if (::features::IsImprovedKeyboardShortcutsEnabled()) { + InputMethodManager::Get()->RemoveObserver(this); + } +} + +void AcceleratorControllerImpl::InputMethodChanged(InputMethodManager* manager, + Profile* profile, + bool show_message) { + DCHECK(::features::IsImprovedKeyboardShortcutsEnabled()); + DCHECK(manager); + + // InputMethodChanged will be called as soon as the observer is registered + // from Init(), so these settings get propagated before any keys are + // seen. + const bool use_positional_lookup = + manager->ArePositionalShortcutsUsedByCurrentInputMethod(); + accelerators_.set_use_positional_lookup(use_positional_lookup); + accelerator_manager_->SetUsePositionalLookup(use_positional_lookup); } void AcceleratorControllerImpl::Register( @@ -1807,10 +1834,6 @@ // AcceleratorControllerImpl, private: void AcceleratorControllerImpl::Init() { - // Use positional lookup by default if the feature is enabled. - accelerators_.set_use_positional_lookup( - ::features::IsImprovedKeyboardShortcutsEnabled()); - for (size_t i = 0; i < kActionsAllowedAtLoginOrLockScreenLength; ++i) { actions_allowed_at_login_screen_.insert( kActionsAllowedAtLoginOrLockScreen[i]);
diff --git a/ash/accelerators/accelerator_controller_impl.h b/ash/accelerators/accelerator_controller_impl.h index 0c28e9cc..57d2a88 100644 --- a/ash/accelerators/accelerator_controller_impl.h +++ b/ash/accelerators/accelerator_controller_impl.h
@@ -23,6 +23,7 @@ #include "base/macros.h" #include "ui/base/accelerators/accelerator.h" #include "ui/base/accelerators/accelerator_map.h" +#include "ui/base/ime/chromeos/input_method_manager.h" namespace ui { class AcceleratorManager; @@ -75,8 +76,10 @@ // AcceleratorControllerImpl provides functions for registering or unregistering // global keyboard accelerators, which are handled earlier than any windows. It // also implements several handlers as an accelerator target. -class ASH_EXPORT AcceleratorControllerImpl : public ui::AcceleratorTarget, - public AcceleratorController { +class ASH_EXPORT AcceleratorControllerImpl + : public ui::AcceleratorTarget, + public AcceleratorController, + public chromeos::input_method::InputMethodManager::Observer { public: // Some Chrome OS devices have volume up and volume down buttons on their // side. We want the button that's closer to the top/right to increase the @@ -160,6 +163,11 @@ RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION }; + // chromeos::input_method::InputMethodManager::Observer overrides: + void InputMethodChanged(chromeos::input_method::InputMethodManager* manager, + Profile* profile, + bool show_message) override; + // Registers global keyboard accelerators for the specified target. If // multiple targets are registered for any given accelerator, a target // registered later has higher priority.
diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc index 6477ea0..7bb82f1 100644 --- a/ash/accelerators/accelerator_controller_unittest.cc +++ b/ash/accelerators/accelerator_controller_unittest.cc
@@ -76,6 +76,7 @@ #include "ui/base/accelerators/test_accelerator_target.h" #include "ui/base/ime/chromeos/fake_ime_keyboard.h" #include "ui/base/ime/chromeos/ime_keyboard.h" +#include "ui/base/ime/chromeos/mock_input_method_manager.h" #include "ui/base/ui_base_features.h" #include "ui/display/manager/display_manager.h" #include "ui/display/screen.h" @@ -92,6 +93,8 @@ namespace ash { using ::chromeos::WindowStateType; +using ::chromeos::input_method::InputMethodManager; +using ::chromeos::input_method::MockInputMethodManager; using media_session::mojom::MediaSessionAction; namespace { @@ -2136,9 +2139,28 @@ void SetUp() override { scoped_feature_list_.InitAndEnableFeature( ::features::kImprovedKeyboardShortcuts); + + // Pass ownership of InputMethodManager to Initialize where it is stored + // in a global. During TearDown() it needs to be cleaned up by calling + // InputMethodManager::Shutdown(). + input_method_manager_ = new MockInputMethodManager(); + InputMethodManager::Initialize(input_method_manager_); AcceleratorControllerTest::SetUp(); } + void TearDown() override { + // The base TearDown() has to run before calling + // InputMethodManager::Shutdown() + AcceleratorControllerTest::TearDown(); + + // Shutdown deletes the global pointer to InputMethodManager. + InputMethodManager::Shutdown(); + input_method_manager_ = nullptr; + } + + protected: + MockInputMethodManager* input_method_manager_ = nullptr; + private: base::test::ScopedFeatureList scoped_feature_list_; };
diff --git a/ash/content/common/OWNERS b/ash/content/common/OWNERS new file mode 100644 index 0000000..411167b --- /dev/null +++ b/ash/content/common/OWNERS
@@ -0,0 +1,5 @@ +# Primary OWNERS +jimmyxgong@chromium.org +zentaro@chromium.org +gavinwill@chromium.org +joonbug@chromium.org \ No newline at end of file
diff --git a/ash/public/cpp/cast_config_controller.h b/ash/public/cpp/cast_config_controller.h index 102fa22..1993b33c 100644 --- a/ash/public/cpp/cast_config_controller.h +++ b/ash/public/cpp/cast_config_controller.h
@@ -14,14 +14,11 @@ namespace ash { // The type of icon the sink is associated with. These values match -// media_router::SinkIconType. +// media_router::SinkIconType and media_router::mojom::SinkIconType. enum class SinkIconType { kCast = 0, kCastAudioGroup = 1, kCastAudio = 2, - kMeeting = 3, - kHangout = 4, - kEducation = 5, kWiredDisplay = 6, kGeneric = 7, };
diff --git a/ash/system/cast/tray_cast.cc b/ash/system/cast/tray_cast.cc index b35ebba..d18f1b08 100644 --- a/ash/system/cast/tray_cast.cc +++ b/ash/system/cast/tray_cast.cc
@@ -38,19 +38,9 @@ #if BUILDFLAG(GOOGLE_CHROME_BRANDING) case SinkIconType::kCast: return kSystemMenuCastDeviceIcon; - case SinkIconType::kEducation: - return kSystemMenuCastEducationIcon; - case SinkIconType::kHangout: - return kSystemMenuCastHangoutIcon; - case SinkIconType::kMeeting: - return kSystemMenuCastMeetingIcon; #else case SinkIconType::kCast: - case SinkIconType::kEducation: return kSystemMenuCastGenericIcon; - case SinkIconType::kHangout: - case SinkIconType::kMeeting: - return kSystemMenuCastMessageIcon; #endif case SinkIconType::kGeneric: return kSystemMenuCastGenericIcon;
diff --git a/ash/system/dark_mode/dark_mode_feature_pod_controller.cc b/ash/system/dark_mode/dark_mode_feature_pod_controller.cc index becf602..1561de3 100644 --- a/ash/system/dark_mode/dark_mode_feature_pod_controller.cc +++ b/ash/system/dark_mode/dark_mode_feature_pod_controller.cc
@@ -35,8 +35,12 @@ IDS_ASH_STATUS_TRAY_DARK_THEME_SETTINGS_TOOLTIP)); button_->ShowDetailedViewArrow(); // TODO(minch): Add the logic for login screen. + // Disable dark mode feature pod in OOBE since only light mode should be + // allowed there. button_->SetVisible( - Shell::Get()->session_controller()->IsActiveUserSessionStarted()); + Shell::Get()->session_controller()->IsActiveUserSessionStarted() && + Shell::Get()->session_controller()->GetSessionState() != + session_manager::SessionState::OOBE); UpdateButton(AshColorProvider::Get()->IsDarkModeEnabled()); return button_;
diff --git a/ash/wm/full_restore/full_restore_controller.cc b/ash/wm/full_restore/full_restore_controller.cc index 1e704b4..8eb8717 100644 --- a/ash/wm/full_restore/full_restore_controller.cc +++ b/ash/wm/full_restore/full_restore_controller.cc
@@ -8,6 +8,7 @@ #include "ash/public/cpp/app_types.h" #include "ash/public/cpp/shell_window_ids.h" +#include "ash/public/cpp/window_properties.h" #include "ash/shell.h" #include "ash/wm/mru_window_tracker.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" @@ -297,20 +298,30 @@ // storage size. window_info.visible_on_all_workspaces = true; } - // If there are restore bounds, use those as current bounds. On restore, for - // states with restore bounds (maximized, minimized, snapped, etc), they will - // take the current bounds as their restore bounds and have the current bounds - // determined by the system. - window_info.current_bounds = window_state->HasRestoreBounds() - ? window_state->GetRestoreBoundsInScreen() - : window->GetBoundsInScreen(); - // Full restore does not support restoring fullscreen windows. If a window is - // fullscreen save the pre-fullscreen window state instead. - window_info.window_state_type = - window_state->IsInImmersiveFullscreen() - ? chromeos::ToWindowStateType( - window->GetProperty(aura::client::kPreFullscreenShowStateKey)) - : window_state->GetStateType(); + + // If override bounds and window state are available (in tablet mode), save + // those bounds. + gfx::Rect* override_bounds = window->GetProperty(kRestoreBoundsOverrideKey); + if (override_bounds) { + window_info.current_bounds = *override_bounds; + window_info.window_state_type = + window->GetProperty(kRestoreWindowStateTypeOverrideKey); + } else { + // If there are restore bounds, use those as current bounds. On restore, for + // states with restore bounds (maximized, minimized, snapped, etc), they + // will take the current bounds as their restore bounds and have the current + // bounds determined by the system. + window_info.current_bounds = window_state->HasRestoreBounds() + ? window_state->GetRestoreBoundsInScreen() + : window->GetBoundsInScreen(); + // Full restore does not support restoring fullscreen windows. If a window + // is fullscreen save the pre-fullscreen window state instead. + window_info.window_state_type = + window_state->IsInImmersiveFullscreen() + ? chromeos::ToWindowStateType( + window->GetProperty(aura::client::kPreFullscreenShowStateKey)) + : window_state->GetStateType(); + } window_info.display_id = display::Screen::GetScreen()->GetDisplayNearestWindow(window).id();
diff --git a/ash/wm/full_restore/full_restore_controller_unittest.cc b/ash/wm/full_restore/full_restore_controller_unittest.cc index 06d40781..ba25e4a 100644 --- a/ash/wm/full_restore/full_restore_controller_unittest.cc +++ b/ash/wm/full_restore/full_restore_controller_unittest.cc
@@ -6,6 +6,7 @@ #include "ash/accelerators/accelerator_controller_impl.h" #include "ash/public/cpp/ash_features.h" +#include "ash/screen_util.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" #include "ash/test/test_widget_builder.h" @@ -33,6 +34,13 @@ accelerator); } +void SetResizable(views::Widget* widget) { + widget->GetNativeWindow()->SetProperty( + aura::client::kResizeBehaviorKey, + aura::client::kResizeBehaviorCanResize | + aura::client::kResizeBehaviorCanMaximize); +} + } // namespace class FullRestoreControllerTest : public AshTestBase, public aura::EnvObserver { @@ -75,14 +83,21 @@ member.second.call_count = 0; } - // Returns the stored activation index for |window|. - int GetActivationIndex(aura::Window* window) const { + // Returns window info for `window`. + full_restore::WindowInfo* GetWindowInfo(aura::Window* window) const { const int32_t restore_window_id = window->GetProperty(full_restore::kRestoreWindowIdKey); if (!base::Contains(fake_full_restore_file_, restore_window_id)) + return nullptr; + return fake_full_restore_file_.at(restore_window_id).info.get(); + } + + // Returns the stored activation index for |window|. + int GetActivationIndex(aura::Window* window) const { + full_restore::WindowInfo* window_info = GetWindowInfo(window); + if (!window_info) return -1; - base::Optional<int32_t> activation_index = - fake_full_restore_file_.at(restore_window_id).info->activation_index; + base::Optional<int32_t> activation_index = window_info->activation_index; return activation_index.value_or(-1); } @@ -99,23 +114,22 @@ TestWidgetBuilder widget_builder; widget_builder.SetWidgetType(views::Widget::InitParams::TYPE_WINDOW) .SetBounds(bounds) - .SetContext(root_window); - widget_builder.SetWindowProperty(full_restore::kActivationIndexKey, - new int32_t(activation_index)); - widget_builder.SetWindowProperty(full_restore::kLaunchedFromFullRestoreKey, - true); + .SetShow(false) + .SetContext(root_window) + .SetWindowProperty(full_restore::kActivationIndexKey, + new int32_t(activation_index)) + .SetWindowProperty(full_restore::kLaunchedFromFullRestoreKey, true); // If this is not given, the window will get assigned an id in // `OnWindowInitialized()`. if (restore_window_id) { widget_builder.SetWindowProperty(full_restore::kRestoreWindowIdKey, *restore_window_id); } + views::Widget* widget = widget_builder.BuildOwnedByNativeWidget(); - widget->GetNativeWindow()->SetProperty( - aura::client::kResizeBehaviorKey, - aura::client::kResizeBehaviorCanResize | - aura::client::kResizeBehaviorCanMaximize); + SetResizable(widget); FullRestoreController::Get()->OnWidgetInitialized(widget); + widget->Show(); return widget; } @@ -747,4 +761,76 @@ EXPECT_TRUE(WindowState::Get(restored_window)->IsNormalStateType()); } +// Tests full restore behavior for when a window saved in clamshell mode is +// restored as expected in tablet mode. +TEST_F(FullRestoreControllerTest, ClamshellToTablet) { + constexpr int kRestoreId = 1; + + // Add a normal window to the fake file. + const gfx::Rect clamshell_bounds(400, 400); + AddEntryToFakeFile(kRestoreId, clamshell_bounds, + chromeos::WindowStateType::kNormal); + + // Restore the window after entering tablet mode, it should be maximized. + TabletModeControllerTestApi().EnterTabletMode(); + auto* restored_window = + CreateTestFullRestoredWidgetFromRestoreId(kRestoreId)->GetNativeWindow(); + EXPECT_TRUE(WindowState::Get(restored_window)->IsMaximized()); + EXPECT_EQ(screen_util::GetMaximizedWindowBoundsInParent(restored_window), + restored_window->GetBoundsInScreen()); + + // Leave tablet mode. The window should have the saved bounds. + TabletModeControllerTestApi().LeaveTabletMode(); + EXPECT_FALSE(WindowState::Get(restored_window)->IsMaximized()); + EXPECT_EQ(clamshell_bounds, restored_window->GetBoundsInScreen()); +} + +// Tests full restore behavior for when a window saved in tablet mode is +// restored as expected in clamshell mode. +TEST_F(FullRestoreControllerTest, TabletToClamshell) { + TabletModeControllerTestApi().EnterTabletMode(); + + // The tablet mode window manager watches windows when they are added, then + // tracks them when the window is shown. They must be resizable when tracked, + // so we use a TestWidgetBuilder instead of `CreateTestWindow()`, which would + // show the window before we can make it resizable. + const gfx::Rect expected_bounds(300, 300); + TestWidgetBuilder builder; + views::Widget* widget = + builder.SetTestWidgetDelegate() + .SetBounds(expected_bounds) + .SetContext(Shell::GetPrimaryRootWindow()) + .SetShow(false) + .SetWindowProperty(aura::client::kAppType, + static_cast<int>(AppType::CHROME_APP)) + .BuildOwnedByNativeWidget(); + SetResizable(widget); + widget->Show(); + + aura::Window* window = widget->GetNativeWindow(); + ASSERT_TRUE(WindowState::Get(window)->IsMaximized()); + ASSERT_EQ(screen_util::GetMaximizedWindowBoundsInParent(window), + window->GetBoundsInScreen()); + + // Check that the values in the fake file can be restored in clamshell mode. + full_restore::WindowInfo* window_info = GetWindowInfo(window); + ASSERT_TRUE(window_info); + ASSERT_TRUE(window_info->current_bounds); + ASSERT_TRUE(window_info->window_state_type); + EXPECT_EQ(expected_bounds, *window_info->current_bounds); + EXPECT_EQ(chromeos::WindowStateType::kDefault, + *window_info->window_state_type); + + const int restore_id = window->GetProperty(full_restore::kRestoreWindowIdKey); + + // Leave tablet mode, and then mock creating the window from full restore + // file. Test that the state and bounds are as expected in clamshell mode. + widget->CloseWithReason(views::Widget::ClosedReason::kUnspecified); + TabletModeControllerTestApi().LeaveTabletMode(); + auto* restored_window = + CreateTestFullRestoredWidgetFromRestoreId(restore_id)->GetNativeWindow(); + EXPECT_TRUE(WindowState::Get(restored_window)->IsNormalStateType()); + EXPECT_EQ(expected_bounds, window->GetBoundsInScreen()); +} + } // namespace ash
diff --git a/base/observer_list_threadsafe.h b/base/observer_list_threadsafe.h index b079691a..c750bbb0 100644 --- a/base/observer_list_threadsafe.h +++ b/base/observer_list_threadsafe.h
@@ -16,7 +16,6 @@ #include "base/memory/ref_counted.h" #include "base/observer_list.h" #include "base/sequenced_task_runner.h" -#include "base/stl_util.h" #include "base/synchronization/lock.h" #include "base/threading/sequenced_task_runner_handle.h" #include "base/threading/thread_local.h"
diff --git a/base/pending_task.cc b/base/pending_task.cc index 82ac835..f7eeb7c 100644 --- a/base/pending_task.cc +++ b/base/pending_task.cc
@@ -9,12 +9,17 @@ PendingTask::PendingTask() = default; +PendingTask::PendingTask(const Location& posted_from, OnceClosure task) + : PendingTask(posted_from, std::move(task), TimeTicks(), TimeTicks()) {} + PendingTask::PendingTask(const Location& posted_from, OnceClosure task, + TimeTicks queue_time, TimeTicks delayed_run_time, Nestable nestable) : task(std::move(task)), posted_from(posted_from), + queue_time(queue_time), delayed_run_time(delayed_run_time), nestable(nestable) {} @@ -40,4 +45,10 @@ return (sequence_num - other.sequence_num) > 0; } +TimeTicks PendingTask::GetDesiredExecutionTime() const { + if (!delayed_run_time.is_null()) + return delayed_run_time; + return queue_time; +} + } // namespace base
diff --git a/base/pending_task.h b/base/pending_task.h index dc68e26..b40c334 100644 --- a/base/pending_task.h +++ b/base/pending_task.h
@@ -24,9 +24,11 @@ // for use by classes that queue and execute tasks. struct BASE_EXPORT PendingTask { PendingTask(); + PendingTask(const Location& posted_from, OnceClosure task); PendingTask(const Location& posted_from, OnceClosure task, - TimeTicks delayed_run_time = TimeTicks(), + TimeTicks queue_time, + TimeTicks delayed_run_time, Nestable nestable = Nestable::kNestable); PendingTask(PendingTask&& other); ~PendingTask(); @@ -36,25 +38,27 @@ // Used to support sorting. bool operator<(const PendingTask& other) const; + // Returns the time at which this task should run. This is |delayed_run_time| + // for a delayed task, |queue_time| otherwise. + base::TimeTicks GetDesiredExecutionTime() const; + // The task to run. OnceClosure task; // The site this PendingTask was posted from. Location posted_from; + // The time at which the task was queued, which happens at post time. For + // deferred non-nestable tasks, this is reset when the nested loop exits and + // the deferred tasks are pushed back at the front of the queue. This is not + // set for immediate SequenceManager tasks unless SetAddQueueTimeToTasks(true) + // was called. This defaults to a null TimeTicks if the task hasn't been + // inserted in a sequence yet. + TimeTicks queue_time; + // The time when the task should be run. This is null for an immediate task. base::TimeTicks delayed_run_time; - // The time at which the task was queued. For SequenceManager tasks and - // ThreadPool non-delayed tasks, this happens at post time. For ThreadPool - // delayed tasks, this happens some time after the task's delay has expired. - // For deferred non-nestable tasks, this is reset when the nested loop exits - // and the deferred tasks are pushed back at the front of the queue. This is - // not set for SequenceManager tasks if SetAddQueueTimeToTasks(true) wasn't - // called. This defaults to a null TimeTicks if the task hasn't been inserted - // in a sequence yet. - TimeTicks queue_time; - // Chain of symbols of the parent tasks which led to this one being posted. static constexpr size_t kTaskBacktraceLength = 4; std::array<const void*, kTaskBacktraceLength> task_backtrace = {};
diff --git a/base/strings/string_util.h b/base/strings/string_util.h index ab8d4fd..8392c57 100644 --- a/base/strings/string_util.h +++ b/base/strings/string_util.h
@@ -20,7 +20,6 @@ #include "base/base_export.h" #include "base/compiler_specific.h" #include "base/containers/span.h" -#include "base/stl_util.h" #include "base/strings/string_piece.h" // For implicit conversions. #include "build/build_config.h"
diff --git a/base/task/sequence_manager/task_queue_impl.cc b/base/task/sequence_manager/task_queue_impl.cc index 017400b..b6d85d7 100644 --- a/base/task/sequence_manager/task_queue_impl.cc +++ b/base/task/sequence_manager/task_queue_impl.cc
@@ -25,18 +25,6 @@ namespace base { namespace sequence_manager { -namespace { - -base::TimeTicks GetTaskDesiredExecutionTime(const Task& task) { - if (!task.delayed_run_time.is_null()) - return task.delayed_run_time; - // The desired run time for a non-delayed task is the queue time. - DCHECK(!task.queue_time.is_null()); - return task.queue_time; -} - -} // namespace - // static const char* TaskQueue::PriorityToString(TaskQueue::QueuePriority priority) { switch (priority) { @@ -440,7 +428,6 @@ // If |delayed_run_time| is in the past then push it onto the work queue // immediately. To ensure the right task ordering we need to temporarily // push it onto the |delayed_incoming_queue|. - delayed_run_time = time_domain_now; pending_task.delayed_run_time = time_domain_now; main_thread_only().delayed_incoming_queue.push(std::move(pending_task)); LazyNow lazy_now(time_domain_now); @@ -588,8 +575,8 @@ if (sequence_manager_->settings().log_task_delay_expiry) VLOG(0) << name_ << " Delay expired for " << task->posted_from.ToString(); #endif // DCHECK_IS_ON() - - ActivateDelayedFenceIfNeeded(GetTaskDesiredExecutionTime(*task)); + DCHECK(!task->delayed_run_time.is_null()); + ActivateDelayedFenceIfNeeded(task->delayed_run_time); DCHECK(!task->enqueue_order_set()); task->set_enqueue_order(sequence_manager_->GetNextSequenceNumber());
diff --git a/base/task/sequence_manager/tasks.cc b/base/task/sequence_manager/tasks.cc index 5c724474..43c9a02 100644 --- a/base/task/sequence_manager/tasks.cc +++ b/base/task/sequence_manager/tasks.cc
@@ -14,6 +14,7 @@ internal::WakeUpResolution resolution) : PendingTask(posted_task.location, std::move(posted_task.callback), + posted_task.queue_time, delayed_run_time, posted_task.nestable), task_type(posted_task.task_type), @@ -26,7 +27,6 @@ static_assert(std::is_same<decltype(sequence_num), int>::value, ""); sequence_num = static_cast<int>(sequence_order); this->is_high_res = resolution == internal::WakeUpResolution::kHigh; - queue_time = posted_task.queue_time; } Task::Task(Task&& move_from) = default;
diff --git a/base/task/thread_pool/delayed_task_manager_unittest.cc b/base/task/thread_pool/delayed_task_manager_unittest.cc index dd931e6..4745928 100644 --- a/base/task/thread_pool/delayed_task_manager_unittest.cc +++ b/base/task/thread_pool/delayed_task_manager_unittest.cc
@@ -41,11 +41,7 @@ TimeTicks now, TimeDelta delay) { Task task(FROM_HERE, BindOnce(&MockCallback::Run, Unretained(&mock_task)), - delay); - // The constructor of Task computes |delayed_run_time| by adding |delay| to - // the real time. Recompute it by adding |delay| to the given |now| (usually - // mock time). - task.delayed_run_time = now + delay; + now, delay); return task; } @@ -166,7 +162,8 @@ // Add a cancelable task to the DelayedTaskManager with a longer delay. CancelableOnceClosure cancelable_closure(DoNothing::Once()); bool post_cancelable_task_now_invoked = false; - Task cancelable_task(FROM_HERE, cancelable_closure.callback(), kLongerDelay); + Task cancelable_task(FROM_HERE, cancelable_closure.callback(), + TimeTicks::Now(), kLongerDelay); auto post_cancelable_task_now = BindLambdaForTesting( [&](Task task) { post_cancelable_task_now_invoked = true; }); delayed_task_manager_.AddDelayedTask(std::move(cancelable_task),
diff --git a/base/task/thread_pool/job_task_source.cc b/base/task/thread_pool/job_task_source.cc index 67b8a21..d44e3bc 100644 --- a/base/task/thread_pool/job_task_source.cc +++ b/base/task/thread_pool/job_task_source.cc
@@ -329,7 +329,7 @@ // if |transaction| is nullptr. DCHECK_GT(TS_UNCHECKED_READ(state_).Load().worker_count(), 0U); DCHECK(primary_task_); - return Task(from_here_, primary_task_, TimeDelta()); + return Task(from_here_, primary_task_, TimeTicks(), TimeDelta()); } bool JobTaskSource::DidProcessTask(TaskSource::Transaction* /*transaction*/) { @@ -368,7 +368,7 @@ // Nothing is cleared since other workers might still racily run tasks. For // simplicity, the destructor will take care of it once all references are // released. - return Task(from_here_, DoNothing(), TimeDelta()); + return Task(from_here_, DoNothing(), TimeTicks(), TimeDelta()); } } // namespace internal
diff --git a/base/task/thread_pool/pooled_parallel_task_runner.cc b/base/task/thread_pool/pooled_parallel_task_runner.cc index 327f736..00f84bb 100644 --- a/base/task/thread_pool/pooled_parallel_task_runner.cc +++ b/base/task/thread_pool/pooled_parallel_task_runner.cc
@@ -36,7 +36,8 @@ } return pooled_task_runner_delegate_->PostTaskWithSequence( - Task(from_here, std::move(closure), delay), std::move(sequence)); + Task(from_here, std::move(closure), TimeTicks::Now(), delay), + std::move(sequence)); } void PooledParallelTaskRunner::UnregisterSequence(Sequence* sequence) {
diff --git a/base/task/thread_pool/pooled_sequenced_task_runner.cc b/base/task/thread_pool/pooled_sequenced_task_runner.cc index b07008e0..7a5b5cf8 100644 --- a/base/task/thread_pool/pooled_sequenced_task_runner.cc +++ b/base/task/thread_pool/pooled_sequenced_task_runner.cc
@@ -28,7 +28,7 @@ return false; } - Task task(from_here, std::move(closure), delay); + Task task(from_here, std::move(closure), TimeTicks::Now(), delay); // Post the task as part of |sequence_|. return pooled_task_runner_delegate_->PostTaskWithSequence(std::move(task),
diff --git a/base/task/thread_pool/pooled_single_thread_task_runner_manager.cc b/base/task/thread_pool/pooled_single_thread_task_runner_manager.cc index dd636a98..67538da 100644 --- a/base/task/thread_pool/pooled_single_thread_task_runner_manager.cc +++ b/base/task/thread_pool/pooled_single_thread_task_runner_manager.cc
@@ -349,7 +349,7 @@ DispatchMessage(&msg); }, std::move(msg)), - TimeDelta()); + TimeTicks::Now(), TimeDelta()); if (task_tracker()->WillPostTask( &pump_message_task, TaskShutdownBehavior::SKIP_ON_SHUTDOWN)) { auto transaction = message_pump_sequence_->BeginTransaction(); @@ -410,7 +410,7 @@ if (!g_manager_is_alive) return false; - Task task(from_here, std::move(closure), delay); + Task task(from_here, std::move(closure), TimeTicks::Now(), delay); if (!outer_->task_tracker_->WillPostTask(&task, sequence_->shutdown_behavior())) {
diff --git a/base/task/thread_pool/priority_queue_unittest.cc b/base/task/thread_pool/priority_queue_unittest.cc index 135a77c..1a270618 100644 --- a/base/task/thread_pool/priority_queue_unittest.cc +++ b/base/task/thread_pool/priority_queue_unittest.cc
@@ -44,7 +44,7 @@ scoped_refptr<Sequence> sequence = MakeRefCounted<Sequence>( traits, nullptr, TaskSourceExecutionMode::kParallel); sequence->BeginTransaction().PushTask( - Task(FROM_HERE, DoNothing(), TimeDelta())); + Task(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta())); return sequence; }
diff --git a/base/task/thread_pool/sequence.cc b/base/task/thread_pool/sequence.cc index b37b5796..8687f27 100644 --- a/base/task/thread_pool/sequence.cc +++ b/base/task/thread_pool/sequence.cc
@@ -38,18 +38,18 @@ // Use CHECK instead of DCHECK to crash earlier. See http://crbug.com/711167 // for details. CHECK(task.task); - DCHECK(task.queue_time.is_null()); + DCHECK(!task.queue_time.is_null()); bool should_be_queued = WillPushTask(); - task.queue_time = TimeTicks::Now(); - task.task = sequence()->traits_.shutdown_behavior() == TaskShutdownBehavior::BLOCK_SHUTDOWN ? MakeCriticalClosure(task.posted_from, std::move(task.task)) : std::move(task.task); - if (sequence()->queue_.empty()) - sequence()->ready_time_.store(task.queue_time, std::memory_order_relaxed); + if (sequence()->queue_.empty()) { + sequence()->ready_time_.store(task.GetDesiredExecutionTime(), + std::memory_order_relaxed); + } sequence()->queue_.push(std::move(task)); // AddRef() matched by manual Release() when the sequence has no more tasks @@ -125,7 +125,7 @@ queue.pop(); }, std::move(queue_)), - TimeDelta()); + TimeTicks(), TimeDelta()); } void Sequence::ReleaseTaskRunner() {
diff --git a/base/task/thread_pool/sequence_unittest.cc b/base/task/thread_pool/sequence_unittest.cc index 8959329..6af99f5 100644 --- a/base/task/thread_pool/sequence_unittest.cc +++ b/base/task/thread_pool/sequence_unittest.cc
@@ -26,7 +26,7 @@ Task CreateTask(MockTask* mock_task) { return Task(FROM_HERE, BindOnce(&MockTask::Run, Unretained(mock_task)), - TimeDelta()); + TimeTicks::Now(), TimeDelta()); } void ExpectMockTask(MockTask* mock_task, Task* task) { @@ -118,7 +118,7 @@ // Verifies the sort key of a BEST_EFFORT sequence that contains one task. TEST(ThreadPoolSequenceTest, GetSortKeyBestEffort) { // Create a BEST_EFFORT sequence with a task. - Task best_effort_task(FROM_HERE, DoNothing(), TimeDelta()); + Task best_effort_task(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta()); scoped_refptr<Sequence> best_effort_sequence = MakeRefCounted<Sequence>(TaskTraits(TaskPriority::BEST_EFFORT), nullptr, TaskSourceExecutionMode::kParallel); @@ -152,7 +152,7 @@ // USER_VISIBLE sequence. TEST(ThreadPoolSequenceTest, GetSortKeyForeground) { // Create a USER_VISIBLE sequence with a task. - Task foreground_task(FROM_HERE, DoNothing(), TimeDelta()); + Task foreground_task(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta()); scoped_refptr<Sequence> foreground_sequence = MakeRefCounted<Sequence>(TaskTraits(TaskPriority::USER_VISIBLE), nullptr, TaskSourceExecutionMode::kParallel); @@ -187,7 +187,8 @@ scoped_refptr<Sequence> sequence = MakeRefCounted<Sequence>( TaskTraits(), nullptr, TaskSourceExecutionMode::kParallel); Sequence::Transaction sequence_transaction(sequence->BeginTransaction()); - sequence_transaction.PushTask(Task(FROM_HERE, DoNothing(), TimeDelta())); + sequence_transaction.PushTask( + Task(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta())); auto registered_task_source = RegisteredTaskSource::CreateForTesting(sequence); @@ -202,7 +203,8 @@ scoped_refptr<Sequence> sequence = MakeRefCounted<Sequence>( TaskTraits(), nullptr, TaskSourceExecutionMode::kParallel); Sequence::Transaction sequence_transaction(sequence->BeginTransaction()); - sequence_transaction.PushTask(Task(FROM_HERE, DoNothing(), TimeDelta())); + sequence_transaction.PushTask( + Task(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta())); auto registered_task_source = RegisteredTaskSource::CreateForTesting(sequence);
diff --git a/base/task/thread_pool/task.cc b/base/task/thread_pool/task.cc index 68cfd09..2ba82d22 100644 --- a/base/task/thread_pool/task.cc +++ b/base/task/thread_pool/task.cc
@@ -17,10 +17,14 @@ } // namespace -Task::Task(const Location& posted_from, OnceClosure task, TimeDelta delay) +Task::Task(const Location& posted_from, + OnceClosure task, + TimeTicks queue_time, + TimeDelta delay) : PendingTask(posted_from, std::move(task), - delay.is_zero() ? TimeTicks() : TimeTicks::Now() + delay, + queue_time, + delay.is_zero() ? TimeTicks() : queue_time + delay, Nestable::kNonNestable) { // ThreadPoolImpl doesn't use |sequence_num| but tracing (toplevel.flow) // relies on it being unique. While this subtle dependency is a bit
diff --git a/base/task/thread_pool/task.h b/base/task/thread_pool/task.h index 0ec5d0b..8f70bf4 100644 --- a/base/task/thread_pool/task.h +++ b/base/task/thread_pool/task.h
@@ -25,7 +25,10 @@ // |posted_from| is the site the task was posted from. |task| is the closure // to run. |delay| is a delay that must expire before the Task runs. - Task(const Location& posted_from, OnceClosure task, TimeDelta delay); + Task(const Location& posted_from, + OnceClosure task, + TimeTicks queue_time, + TimeDelta delay); // Task is move-only to avoid mistakes that cause reference counts to be // accidentally bumped.
diff --git a/base/task/thread_pool/task_tracker_posix_unittest.cc b/base/task/thread_pool/task_tracker_posix_unittest.cc index c6f8c19..811880f4 100644 --- a/base/task/thread_pool/task_tracker_posix_unittest.cc +++ b/base/task/thread_pool/task_tracker_posix_unittest.cc
@@ -56,7 +56,7 @@ Task task( FROM_HERE, BindOnce([](bool* did_run) { *did_run = true; }, Unretained(&did_run)), - TimeDelta()); + TimeTicks::Now(), TimeDelta()); constexpr TaskTraits default_traits; EXPECT_TRUE(tracker_.WillPostTask(&task, default_traits.shutdown_behavior())); @@ -77,7 +77,7 @@ Task task(FROM_HERE, BindOnce(IgnoreResult(&FileDescriptorWatcher::WatchReadable), fds[0], DoNothing()), - TimeDelta()); + TimeTicks::Now(), TimeDelta()); constexpr TaskTraits default_traits; EXPECT_TRUE(tracker_.WillPostTask(&task, default_traits.shutdown_behavior()));
diff --git a/base/task/thread_pool/task_tracker_unittest.cc b/base/task/thread_pool/task_tracker_unittest.cc index 9794e3f..978870e 100644 --- a/base/task/thread_pool/task_tracker_unittest.cc +++ b/base/task/thread_pool/task_tracker_unittest.cc
@@ -174,7 +174,7 @@ return Task( FROM_HERE, BindOnce(&ThreadPoolTaskTrackerTest::RunTaskCallback, Unretained(this)), - TimeDelta()); + TimeTicks::Now(), TimeDelta()); } RegisteredTaskSource WillPostTaskAndQueueTaskSource( @@ -308,7 +308,7 @@ task_running.Signal(); task_barrier.Wait(); }), - TimeDelta()); + TimeTicks::Now(), TimeDelta()); // Inform |task_tracker_| that |blocked_task| will be posted. auto sequence = @@ -491,7 +491,7 @@ (GetParam() != TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN); Task task(FROM_HERE, BindOnce(&ThreadRestrictions::AssertSingletonAllowed), - TimeDelta()); + TimeTicks::Now(), TimeDelta()); auto sequence = WillPostTaskAndQueueTaskSource(std::move(task), {GetParam()}); EXPECT_TRUE(sequence); @@ -518,7 +518,7 @@ ScopedBlockingCall scope_blocking_call( FROM_HERE, BlockingType::WILL_BLOCK); }), - TimeDelta()); + TimeTicks::Now(), TimeDelta()); TaskTraits traits_with_may_block{MayBlock(), GetParam()}; auto sequence_with_may_block = WillPostTaskAndQueueTaskSource( std::move(task_with_may_block), traits_with_may_block); @@ -534,7 +534,7 @@ FROM_HERE, BlockingType::WILL_BLOCK); }); }), - TimeDelta()); + TimeTicks::Now(), TimeDelta()); TaskTraits traits_without_may_block = TaskTraits(GetParam()); auto sequence_without_may_block = WillPostTaskAndQueueTaskSource( std::move(task_without_may_block), traits_without_may_block); @@ -574,7 +574,8 @@ TEST_P(ThreadPoolTaskTrackerTest, TaskRunnerHandleIsNotSetOnParallel) { // Create a task that will verify that TaskRunnerHandles are not set in its // scope per no TaskRunner ref being set to it. - Task verify_task(FROM_HERE, BindOnce(&VerifyNoTaskRunnerHandle), TimeDelta()); + Task verify_task(FROM_HERE, BindOnce(&VerifyNoTaskRunnerHandle), + TimeTicks::Now(), TimeDelta()); RunTaskRunnerHandleVerificationTask(&tracker_, std::move(verify_task), TaskTraits(GetParam()), nullptr, @@ -597,7 +598,7 @@ Task verify_task(FROM_HERE, BindOnce(&VerifySequencedTaskRunnerHandle, Unretained(test_task_runner.get())), - TimeDelta()); + TimeTicks::Now(), TimeDelta()); RunTaskRunnerHandleVerificationTask( &tracker_, std::move(verify_task), TaskTraits(GetParam()), @@ -622,7 +623,7 @@ Task verify_task(FROM_HERE, BindOnce(&VerifyThreadTaskRunnerHandle, Unretained(test_task_runner.get())), - TimeDelta()); + TimeTicks::Now(), TimeDelta()); RunTaskRunnerHandleVerificationTask( &tracker_, std::move(verify_task), TaskTraits(GetParam()), @@ -630,14 +631,16 @@ } TEST_P(ThreadPoolTaskTrackerTest, FlushPendingDelayedTask) { - Task delayed_task(FROM_HERE, DoNothing(), TimeDelta::FromDays(1)); + Task delayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), + TimeDelta::FromDays(1)); tracker_.WillPostTask(&delayed_task, GetParam()); // FlushForTesting() should return even if the delayed task didn't run. tracker_.FlushForTesting(); } TEST_P(ThreadPoolTaskTrackerTest, FlushAsyncForTestingPendingDelayedTask) { - Task delayed_task(FROM_HERE, DoNothing(), TimeDelta::FromDays(1)); + Task delayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), + TimeDelta::FromDays(1)); tracker_.WillPostTask(&delayed_task, GetParam()); // FlushAsyncForTesting() should callback even if the delayed task didn't run. bool called_back = false; @@ -648,7 +651,7 @@ } TEST_P(ThreadPoolTaskTrackerTest, FlushPendingUndelayedTask) { - Task undelayed_task(FROM_HERE, DoNothing(), TimeDelta()); + Task undelayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta()); auto undelayed_sequence = WillPostTaskAndQueueTaskSource(std::move(undelayed_task), {GetParam()}); @@ -663,7 +666,7 @@ } TEST_P(ThreadPoolTaskTrackerTest, FlushAsyncForTestingPendingUndelayedTask) { - Task undelayed_task(FROM_HERE, DoNothing(), TimeDelta()); + Task undelayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta()); auto undelayed_sequence = WillPostTaskAndQueueTaskSource(std::move(undelayed_task), {GetParam()}); @@ -680,7 +683,7 @@ } TEST_P(ThreadPoolTaskTrackerTest, PostTaskDuringFlush) { - Task undelayed_task(FROM_HERE, DoNothing(), TimeDelta()); + Task undelayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta()); auto undelayed_sequence = WillPostTaskAndQueueTaskSource(std::move(undelayed_task), {GetParam()}); @@ -690,7 +693,8 @@ VERIFY_ASYNC_FLUSH_IN_PROGRESS(); // Simulate posting another undelayed task. - Task other_undelayed_task(FROM_HERE, DoNothing(), TimeDelta()); + Task other_undelayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), + TimeDelta()); auto other_undelayed_sequence = WillPostTaskAndQueueTaskSource( std::move(other_undelayed_task), {GetParam()}); @@ -707,7 +711,7 @@ } TEST_P(ThreadPoolTaskTrackerTest, PostTaskDuringFlushAsyncForTesting) { - Task undelayed_task(FROM_HERE, DoNothing(), TimeDelta()); + Task undelayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta()); auto undelayed_sequence = WillPostTaskAndQueueTaskSource(std::move(undelayed_task), {GetParam()}); @@ -719,7 +723,8 @@ EXPECT_FALSE(event.IsSignaled()); // Simulate posting another undelayed task. - Task other_undelayed_task(FROM_HERE, DoNothing(), TimeDelta()); + Task other_undelayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), + TimeDelta()); auto other_undelayed_sequence = WillPostTaskAndQueueTaskSource( std::move(other_undelayed_task), {GetParam()}); @@ -739,10 +744,11 @@ TEST_P(ThreadPoolTaskTrackerTest, RunDelayedTaskDuringFlush) { // Simulate posting a delayed and an undelayed task. - Task delayed_task(FROM_HERE, DoNothing(), TimeDelta::FromDays(1)); + Task delayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), + TimeDelta::FromDays(1)); auto delayed_sequence = WillPostTaskAndQueueTaskSource(std::move(delayed_task), {GetParam()}); - Task undelayed_task(FROM_HERE, DoNothing(), TimeDelta()); + Task undelayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta()); auto undelayed_sequence = WillPostTaskAndQueueTaskSource(std::move(undelayed_task), {GetParam()}); @@ -768,10 +774,11 @@ TEST_P(ThreadPoolTaskTrackerTest, RunDelayedTaskDuringFlushAsyncForTesting) { // Simulate posting a delayed and an undelayed task. - Task delayed_task(FROM_HERE, DoNothing(), TimeDelta::FromDays(1)); + Task delayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), + TimeDelta::FromDays(1)); auto delayed_sequence = WillPostTaskAndQueueTaskSource(std::move(delayed_task), {GetParam()}); - Task undelayed_task(FROM_HERE, DoNothing(), TimeDelta()); + Task undelayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta()); auto undelayed_sequence = WillPostTaskAndQueueTaskSource(std::move(undelayed_task), {GetParam()}); @@ -802,7 +809,7 @@ return; // Simulate posting a task. - Task undelayed_task(FROM_HERE, DoNothing(), TimeDelta()); + Task undelayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta()); tracker_.WillPostTask(&undelayed_task, GetParam()); // Shutdown() should return immediately since there are no pending @@ -819,7 +826,7 @@ return; // Simulate posting a task. - Task undelayed_task(FROM_HERE, DoNothing(), TimeDelta()); + Task undelayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta()); tracker_.WillPostTask(&undelayed_task, GetParam()); // Shutdown() should return immediately since there are no pending @@ -840,7 +847,7 @@ return; // Simulate posting a task. - Task undelayed_task(FROM_HERE, DoNothing(), TimeDelta()); + Task undelayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta()); auto undelayed_sequence = WillPostTaskAndQueueTaskSource(std::move(undelayed_task), {GetParam()}); @@ -863,7 +870,7 @@ return; // Simulate posting a task. - Task undelayed_task(FROM_HERE, DoNothing(), TimeDelta()); + Task undelayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta()); auto undelayed_sequence = WillPostTaskAndQueueTaskSource(std::move(undelayed_task), {GetParam()}); @@ -885,7 +892,7 @@ } TEST_P(ThreadPoolTaskTrackerTest, DoublePendingFlushAsyncForTestingFails) { - Task undelayed_task(FROM_HERE, DoNothing(), TimeDelta()); + Task undelayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta()); auto undelayed_sequence = WillPostTaskAndQueueTaskSource(std::move(undelayed_task), {GetParam()}); @@ -901,7 +908,7 @@ TEST_P(ThreadPoolTaskTrackerTest, PostTasksDoNotBlockShutdown) { // Simulate posting an undelayed task. - Task undelayed_task(FROM_HERE, DoNothing(), TimeDelta()); + Task undelayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta()); EXPECT_TRUE(tracker_.WillPostTask(&undelayed_task, GetParam())); // Since no sequence was queued, a call to Shutdown() should not hang. @@ -912,7 +919,8 @@ // of its shutdown behavior. TEST_P(ThreadPoolTaskTrackerTest, DelayedRunTasks) { // Simulate posting a delayed task. - Task delayed_task(FROM_HERE, DoNothing(), TimeDelta::FromDays(1)); + Task delayed_task(FROM_HERE, DoNothing(), TimeTicks::Now(), + TimeDelta::FromDays(1)); auto sequence = WillPostTaskAndQueueTaskSource(std::move(delayed_task), {GetParam()}); EXPECT_TRUE(sequence); @@ -953,7 +961,7 @@ const SequenceToken sequence_token = sequence->token(); Task task(FROM_HERE, BindOnce(&ExpectSequenceToken, sequence_token), - TimeDelta()); + TimeTicks::Now(), TimeDelta()); tracker_.WillPostTask(&task, sequence->shutdown_behavior()); { @@ -1149,10 +1157,10 @@ TEST_F(ThreadPoolTaskTrackerTest, RunAndPopNextTaskReturnsSequenceToReschedule) { TaskTraits default_traits; - Task task_1(FROM_HERE, DoNothing(), TimeDelta()); + Task task_1(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta()); EXPECT_TRUE( tracker_.WillPostTask(&task_1, default_traits.shutdown_behavior())); - Task task_2(FROM_HERE, DoNothing(), TimeDelta()); + Task task_2(FROM_HERE, DoNothing(), TimeTicks::Now(), TimeDelta()); EXPECT_TRUE( tracker_.WillPostTask(&task_2, default_traits.shutdown_behavior())); @@ -1182,7 +1190,7 @@ FROM_HERE, BindOnce([]() { EXPECT_DCHECK_DEATH({ internal::AssertBaseSyncPrimitivesAllowed(); }); }), - TimeDelta()); + TimeTicks::Now(), TimeDelta()); TaskTraits default_traits; EXPECT_TRUE(task_tracker->WillPostTask(&task_without_sync_primitives, default_traits.shutdown_behavior())); @@ -1199,7 +1207,7 @@ // Shouldn't fail. internal::AssertBaseSyncPrimitivesAllowed(); }), - TimeDelta()); + TimeTicks::Now(), TimeDelta()); TaskTraits traits_with_sync_primitives = TaskTraits(WithBaseSyncPrimitives()); EXPECT_TRUE(task_tracker->WillPostTask(
diff --git a/base/task/thread_pool/thread_pool_impl.cc b/base/task/thread_pool/thread_pool_impl.cc index 375dea9..ee5a089 100644 --- a/base/task/thread_pool/thread_pool_impl.cc +++ b/base/task/thread_pool/thread_pool_impl.cc
@@ -267,7 +267,7 @@ AssertNoExtensionInTraits(traits); // Post |task| as part of a one-off single-task Sequence. return PostTaskWithSequence( - Task(from_here, std::move(task), delay), + Task(from_here, std::move(task), TimeTicks::Now(), delay), MakeRefCounted<Sequence>(traits, nullptr, TaskSourceExecutionMode::kParallel)); }
diff --git a/base/task/thread_pool/worker_thread_unittest.cc b/base/task/thread_pool/worker_thread_unittest.cc index fa6c964..bfae6ed 100644 --- a/base/task/thread_pool/worker_thread_unittest.cc +++ b/base/task/thread_pool/worker_thread_unittest.cc
@@ -191,7 +191,7 @@ Task task(FROM_HERE, BindOnce(&ThreadPoolWorkerTest::RunTaskCallback, Unretained(outer_)), - TimeDelta()); + TimeTicks::Now(), TimeDelta()); EXPECT_TRUE(outer_->task_tracker_.WillPostTask( &task, sequence->shutdown_behavior())); sequence_transaction.PushTask(std::move(task)); @@ -473,7 +473,7 @@ }, Unretained(&controls_->work_processed_), Unretained(&controls_->work_running_)), - TimeDelta()); + TimeTicks::Now(), TimeDelta()); EXPECT_TRUE( task_tracker_->WillPostTask(&task, sequence->shutdown_behavior())); sequence->BeginTransaction().PushTask(std::move(task));
diff --git a/base/threading/platform_thread_linux.cc b/base/threading/platform_thread_linux.cc index de2e0c16..bf645d2 100644 --- a/base/threading/platform_thread_linux.cc +++ b/base/threading/platform_thread_linux.cc
@@ -17,6 +17,7 @@ #include "base/files/file_util.h" #include "base/lazy_instance.h" #include "base/logging.h" +#include "base/metrics/field_trial_params.h" #include "base/process/internal_linux.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h"
diff --git a/base/threading/threading_features.h b/base/threading/threading_features.h index 5c9a08ac..c8f6f0d 100644 --- a/base/threading/threading_features.h +++ b/base/threading/threading_features.h
@@ -8,6 +8,10 @@ #include "base/base_export.h" #include "build/build_config.h" +#if defined(OS_APPLE) +#include "base/metrics/field_trial_params.h" +#endif + namespace base { struct Feature;
diff --git a/base/trace_event/category_registry.h b/base/trace_event/category_registry.h index a41dd94..a2358b0 100644 --- a/base/trace_event/category_registry.h +++ b/base/trace_event/category_registry.h
@@ -12,7 +12,6 @@ #include "base/base_export.h" #include "base/check_op.h" -#include "base/stl_util.h" #include "base/trace_event/builtin_categories.h" #include "base/trace_event/common/trace_event_common.h" #include "base/trace_event/trace_category.h"
diff --git a/build/android/gyp/aar.py b/build/android/gyp/aar.py index 1a1e910..b157cd8 100755 --- a/build/android/gyp/aar.py +++ b/build/android/gyp/aar.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/aidl.py b/build/android/gyp/aidl.py index 7edce172..b8099aa 100755 --- a/build/android/gyp/aidl.py +++ b/build/android/gyp/aidl.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/allot_native_libraries.py b/build/android/gyp/allot_native_libraries.py index 585f19d..978b1734 100755 --- a/build/android/gyp/allot_native_libraries.py +++ b/build/android/gyp/allot_native_libraries.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/apkbuilder.py b/build/android/gyp/apkbuilder.py index 15251da..f1e6563 100755 --- a/build/android/gyp/apkbuilder.py +++ b/build/android/gyp/apkbuilder.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/assert_static_initializers.py b/build/android/gyp/assert_static_initializers.py index 856784d..31f2a77 100755 --- a/build/android/gyp/assert_static_initializers.py +++ b/build/android/gyp/assert_static_initializers.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file.
diff --git a/build/android/gyp/bundletool.py b/build/android/gyp/bundletool.py index e161c66..dc9b86a 100755 --- a/build/android/gyp/bundletool.py +++ b/build/android/gyp/bundletool.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # 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.
diff --git a/build/android/gyp/bytecode_processor.py b/build/android/gyp/bytecode_processor.py index 02465e08..d77f159 100755 --- a/build/android/gyp/bytecode_processor.py +++ b/build/android/gyp/bytecode_processor.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file.
diff --git a/build/android/gyp/bytecode_rewriter.py b/build/android/gyp/bytecode_rewriter.py index b37ef6f..ad232df 100755 --- a/build/android/gyp/bytecode_rewriter.py +++ b/build/android/gyp/bytecode_rewriter.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file.
diff --git a/build/android/gyp/check_flag_expectations.py b/build/android/gyp/check_flag_expectations.py old mode 100644 new mode 100755 index a6e47db..22da211 --- a/build/android/gyp/check_flag_expectations.py +++ b/build/android/gyp/check_flag_expectations.py
@@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # Copyright 2021 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file.
diff --git a/build/android/gyp/compile_java.py b/build/android/gyp/compile_java.py index ea564c8..2a92842 100755 --- a/build/android/gyp/compile_java.py +++ b/build/android/gyp/compile_java.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/copy_ex.py b/build/android/gyp/copy_ex.py index 3fb1a36..41604c4 100755 --- a/build/android/gyp/copy_ex.py +++ b/build/android/gyp/copy_ex.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/create_apk_operations_script.py b/build/android/gyp/create_apk_operations_script.py index c5306dc5..660567f0 100755 --- a/build/android/gyp/create_apk_operations_script.py +++ b/build/android/gyp/create_apk_operations_script.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file.
diff --git a/build/android/gyp/create_app_bundle_apks.py b/build/android/gyp/create_app_bundle_apks.py index d261996d..5950696b 100755 --- a/build/android/gyp/create_app_bundle_apks.py +++ b/build/android/gyp/create_app_bundle_apks.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/create_app_bundle_apks.pydeps b/build/android/gyp/create_app_bundle_apks.pydeps index 064ab48..20d8ffe8 100644 --- a/build/android/gyp/create_app_bundle_apks.pydeps +++ b/build/android/gyp/create_app_bundle_apks.pydeps
@@ -2,6 +2,8 @@ # build/print_python_deps.py --root build/android/gyp --output build/android/gyp/create_app_bundle_apks.pydeps build/android/gyp/create_app_bundle_apks.py ../../../third_party/jinja2/__init__.py ../../../third_party/jinja2/_compat.py +../../../third_party/jinja2/asyncfilters.py +../../../third_party/jinja2/asyncsupport.py ../../../third_party/jinja2/bccache.py ../../../third_party/jinja2/compiler.py ../../../third_party/jinja2/defaults.py
diff --git a/build/android/gyp/create_bundle_wrapper_script.py b/build/android/gyp/create_bundle_wrapper_script.py index f4f4cc68..282e206 100755 --- a/build/android/gyp/create_bundle_wrapper_script.py +++ b/build/android/gyp/create_bundle_wrapper_script.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # 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.
diff --git a/build/android/gyp/create_java_binary_script.py b/build/android/gyp/create_java_binary_script.py index e21db79..5bc9d08 100755 --- a/build/android/gyp/create_java_binary_script.py +++ b/build/android/gyp/create_java_binary_script.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/create_r_java.py b/build/android/gyp/create_r_java.py index e50ec81..97e512d 100755 --- a/build/android/gyp/create_r_java.py +++ b/build/android/gyp/create_r_java.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file.
diff --git a/build/android/gyp/create_r_java.pydeps b/build/android/gyp/create_r_java.pydeps index 2976746..45121e3 100644 --- a/build/android/gyp/create_r_java.pydeps +++ b/build/android/gyp/create_r_java.pydeps
@@ -2,6 +2,8 @@ # build/print_python_deps.py --root build/android/gyp --output build/android/gyp/create_r_java.pydeps build/android/gyp/create_r_java.py ../../../third_party/jinja2/__init__.py ../../../third_party/jinja2/_compat.py +../../../third_party/jinja2/asyncfilters.py +../../../third_party/jinja2/asyncsupport.py ../../../third_party/jinja2/bccache.py ../../../third_party/jinja2/compiler.py ../../../third_party/jinja2/defaults.py
diff --git a/build/android/gyp/create_r_txt.py b/build/android/gyp/create_r_txt.py index 64d0bb9..2adde5d 100755 --- a/build/android/gyp/create_r_txt.py +++ b/build/android/gyp/create_r_txt.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file.
diff --git a/build/android/gyp/create_r_txt.pydeps b/build/android/gyp/create_r_txt.pydeps index 5fcd079..c7698eef 100644 --- a/build/android/gyp/create_r_txt.pydeps +++ b/build/android/gyp/create_r_txt.pydeps
@@ -2,6 +2,8 @@ # build/print_python_deps.py --root build/android/gyp --output build/android/gyp/create_r_txt.pydeps build/android/gyp/create_r_txt.py ../../../third_party/jinja2/__init__.py ../../../third_party/jinja2/_compat.py +../../../third_party/jinja2/asyncfilters.py +../../../third_party/jinja2/asyncsupport.py ../../../third_party/jinja2/bccache.py ../../../third_party/jinja2/compiler.py ../../../third_party/jinja2/defaults.py
diff --git a/build/android/gyp/create_size_info_files.py b/build/android/gyp/create_size_info_files.py index 0677699..c60b02d 100755 --- a/build/android/gyp/create_size_info_files.py +++ b/build/android/gyp/create_size_info_files.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/create_ui_locale_resources.py b/build/android/gyp/create_ui_locale_resources.py index 007afb37..772dab7 100755 --- a/build/android/gyp/create_ui_locale_resources.py +++ b/build/android/gyp/create_ui_locale_resources.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/create_ui_locale_resources.pydeps b/build/android/gyp/create_ui_locale_resources.pydeps index 663ed03..6bb98dd2 100644 --- a/build/android/gyp/create_ui_locale_resources.pydeps +++ b/build/android/gyp/create_ui_locale_resources.pydeps
@@ -2,6 +2,8 @@ # build/print_python_deps.py --root build/android/gyp --output build/android/gyp/create_ui_locale_resources.pydeps build/android/gyp/create_ui_locale_resources.py ../../../third_party/jinja2/__init__.py ../../../third_party/jinja2/_compat.py +../../../third_party/jinja2/asyncfilters.py +../../../third_party/jinja2/asyncsupport.py ../../../third_party/jinja2/bccache.py ../../../third_party/jinja2/compiler.py ../../../third_party/jinja2/defaults.py
diff --git a/build/android/gyp/desugar.py b/build/android/gyp/desugar.py index 1df7bf7e..87eb159 100755 --- a/build/android/gyp/desugar.py +++ b/build/android/gyp/desugar.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/dex.py b/build/android/gyp/dex.py index 12d0c9f..381775a 100755 --- a/build/android/gyp/dex.py +++ b/build/android/gyp/dex.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/dex_jdk_libs.py b/build/android/gyp/dex_jdk_libs.py index d7a68df..6304779 100755 --- a/build/android/gyp/dex_jdk_libs.py +++ b/build/android/gyp/dex_jdk_libs.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/dexsplitter.py b/build/android/gyp/dexsplitter.py index 34aef03..149e994 100755 --- a/build/android/gyp/dexsplitter.py +++ b/build/android/gyp/dexsplitter.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/dist_aar.py b/build/android/gyp/dist_aar.py index fed1983..7f0de1d 100755 --- a/build/android/gyp/dist_aar.py +++ b/build/android/gyp/dist_aar.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/extract_unwind_tables.py b/build/android/gyp/extract_unwind_tables.py index edfd1ef..25c3130 100755 --- a/build/android/gyp/extract_unwind_tables.py +++ b/build/android/gyp/extract_unwind_tables.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # 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.
diff --git a/build/android/gyp/filter_zip.py b/build/android/gyp/filter_zip.py index 9b52288c..068ff03e 100755 --- a/build/android/gyp/filter_zip.py +++ b/build/android/gyp/filter_zip.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/find.py b/build/android/gyp/find.py index a78bc83..b05874b 100755 --- a/build/android/gyp/find.py +++ b/build/android/gyp/find.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/gcc_preprocess.py b/build/android/gyp/gcc_preprocess.py index 8f6ec8d..70ae10fc 100755 --- a/build/android/gyp/gcc_preprocess.py +++ b/build/android/gyp/gcc_preprocess.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/generate_android_wrapper.py b/build/android/gyp/generate_android_wrapper.py index f8e1815..c8b762c 100755 --- a/build/android/gyp/generate_android_wrapper.py +++ b/build/android/gyp/generate_android_wrapper.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # 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.
diff --git a/build/android/gyp/generate_linker_version_script.py b/build/android/gyp/generate_linker_version_script.py index 7575bfc..995fcd7 100755 --- a/build/android/gyp/generate_linker_version_script.py +++ b/build/android/gyp/generate_linker_version_script.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env vpython +#!/usr/bin/env python3 # 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.
diff --git a/build/android/gyp/ijar.py b/build/android/gyp/ijar.py index 10773342..45413f62 100755 --- a/build/android/gyp/ijar.py +++ b/build/android/gyp/ijar.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/jacoco_instr.py b/build/android/gyp/jacoco_instr.py index cb3880c..8e5f29c9 100755 --- a/build/android/gyp/jacoco_instr.py +++ b/build/android/gyp/jacoco_instr.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/java_cpp_enum.py b/build/android/gyp/java_cpp_enum.py index 21037d3..08a381a9 100755 --- a/build/android/gyp/java_cpp_enum.py +++ b/build/android/gyp/java_cpp_enum.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/java_cpp_enum_tests.py b/build/android/gyp/java_cpp_enum_tests.py index 1acb57f..6d5f150 100755 --- a/build/android/gyp/java_cpp_enum_tests.py +++ b/build/android/gyp/java_cpp_enum_tests.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file.
diff --git a/build/android/gyp/java_cpp_features.py b/build/android/gyp/java_cpp_features.py index 9fe7cb9..8e7c244 100755 --- a/build/android/gyp/java_cpp_features.py +++ b/build/android/gyp/java_cpp_features.py
@@ -1,4 +1,4 @@ -#!/user/bin/env python +#!/usr/bin/env python3 # # Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/java_cpp_features_tests.py b/build/android/gyp/java_cpp_features_tests.py index b50f59a..5dcdcd8b 100755 --- a/build/android/gyp/java_cpp_features_tests.py +++ b/build/android/gyp/java_cpp_features_tests.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/java_cpp_strings.py b/build/android/gyp/java_cpp_strings.py index d73e4ce..d713599 100755 --- a/build/android/gyp/java_cpp_strings.py +++ b/build/android/gyp/java_cpp_strings.py
@@ -1,4 +1,4 @@ -#!/user/bin/env python +#!/usr/bin/env python3 # # Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/java_cpp_strings_tests.py b/build/android/gyp/java_cpp_strings_tests.py index b2df08d..4cb1eee 100755 --- a/build/android/gyp/java_cpp_strings_tests.py +++ b/build/android/gyp/java_cpp_strings_tests.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/java_google_api_keys.py b/build/android/gyp/java_google_api_keys.py index 53b9d85..a58628a 100755 --- a/build/android/gyp/java_google_api_keys.py +++ b/build/android/gyp/java_google_api_keys.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/jetify_jar.py b/build/android/gyp/jetify_jar.py index 491efd4f..e97ad97 100755 --- a/build/android/gyp/jetify_jar.py +++ b/build/android/gyp/jetify_jar.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/jinja_template.py b/build/android/gyp/jinja_template.py index ba335a2..d42189ba 100755 --- a/build/android/gyp/jinja_template.py +++ b/build/android/gyp/jinja_template.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/jinja_template.pydeps b/build/android/gyp/jinja_template.pydeps index 31d109a..af22c40 100644 --- a/build/android/gyp/jinja_template.pydeps +++ b/build/android/gyp/jinja_template.pydeps
@@ -11,6 +11,8 @@ ../../../third_party/catapult/devil/devil/constants/exit_codes.py ../../../third_party/jinja2/__init__.py ../../../third_party/jinja2/_compat.py +../../../third_party/jinja2/asyncfilters.py +../../../third_party/jinja2/asyncsupport.py ../../../third_party/jinja2/bccache.py ../../../third_party/jinja2/compiler.py ../../../third_party/jinja2/defaults.py
diff --git a/build/android/gyp/lint.py b/build/android/gyp/lint.py index b30c672..faad21c 100755 --- a/build/android/gyp/lint.py +++ b/build/android/gyp/lint.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/merge_manifest.py b/build/android/gyp/merge_manifest.py index fdec8c3..53f1c11a 100755 --- a/build/android/gyp/merge_manifest.py +++ b/build/android/gyp/merge_manifest.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/nocompile_test.py b/build/android/gyp/nocompile_test.py old mode 100644 new mode 100755 index 57b84b7..a5739f1 --- a/build/android/gyp/nocompile_test.py +++ b/build/android/gyp/nocompile_test.py
@@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file.
diff --git a/build/android/gyp/prepare_resources.py b/build/android/gyp/prepare_resources.py index 4f627ff..93fe9f91 100755 --- a/build/android/gyp/prepare_resources.py +++ b/build/android/gyp/prepare_resources.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/prepare_resources.pydeps b/build/android/gyp/prepare_resources.pydeps index e07d9e3..b225918 100644 --- a/build/android/gyp/prepare_resources.pydeps +++ b/build/android/gyp/prepare_resources.pydeps
@@ -2,6 +2,8 @@ # build/print_python_deps.py --root build/android/gyp --output build/android/gyp/prepare_resources.pydeps build/android/gyp/prepare_resources.py ../../../third_party/jinja2/__init__.py ../../../third_party/jinja2/_compat.py +../../../third_party/jinja2/asyncfilters.py +../../../third_party/jinja2/asyncsupport.py ../../../third_party/jinja2/bccache.py ../../../third_party/jinja2/compiler.py ../../../third_party/jinja2/defaults.py
diff --git a/build/android/gyp/process_native_prebuilt.py b/build/android/gyp/process_native_prebuilt.py index f05bc8c4..52645d9 100755 --- a/build/android/gyp/process_native_prebuilt.py +++ b/build/android/gyp/process_native_prebuilt.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/proguard.py b/build/android/gyp/proguard.py index c42b16c..7f59769 100755 --- a/build/android/gyp/proguard.py +++ b/build/android/gyp/proguard.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/turbine.py b/build/android/gyp/turbine.py index 2983ac4..208cc76 100755 --- a/build/android/gyp/turbine.py +++ b/build/android/gyp/turbine.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file.
diff --git a/build/android/gyp/util/build_utils_test.py b/build/android/gyp/util/build_utils_test.py index 75a3ba3..008ea11 100755 --- a/build/android/gyp/util/build_utils_test.py +++ b/build/android/gyp/util/build_utils_test.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env vpython +#!/usr/bin/env python3 # 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.
diff --git a/build/android/gyp/util/java_cpp_utils.py b/build/android/gyp/util/java_cpp_utils.py old mode 100755 new mode 100644 index f556768..5180400 --- a/build/android/gyp/util/java_cpp_utils.py +++ b/build/android/gyp/util/java_cpp_utils.py
@@ -1,5 +1,3 @@ -#!/user/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.
diff --git a/build/android/gyp/util/md5_check_test.py b/build/android/gyp/util/md5_check_test.py index f77e971..e11bbd5 100755 --- a/build/android/gyp/util/md5_check_test.py +++ b/build/android/gyp/util/md5_check_test.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env vpython +#!/usr/bin/env python3 # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -116,7 +116,7 @@ expected_changes='force=True', added_or_modified_only=False) - input_file1.write('some more input') + input_file1.write(b'some more input') input_file1.flush() CheckCallAndRecord(True, 'changed input file should trigger call', expected_changes='*Modified: %s' % input_file1.name,
diff --git a/build/android/gyp/validate_static_library_dex_references.py b/build/android/gyp/validate_static_library_dex_references.py index 391c846..b14ca3c3 100755 --- a/build/android/gyp/validate_static_library_dex_references.py +++ b/build/android/gyp/validate_static_library_dex_references.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # 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.
diff --git a/build/android/gyp/write_build_config.py b/build/android/gyp/write_build_config.py index 5369a80..0600fdc 100755 --- a/build/android/gyp/write_build_config.py +++ b/build/android/gyp/write_build_config.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/write_build_config.pydeps b/build/android/gyp/write_build_config.pydeps index 6ccb736..b1276bc 100644 --- a/build/android/gyp/write_build_config.pydeps +++ b/build/android/gyp/write_build_config.pydeps
@@ -2,6 +2,8 @@ # build/print_python_deps.py --root build/android/gyp --output build/android/gyp/write_build_config.pydeps build/android/gyp/write_build_config.py ../../../third_party/jinja2/__init__.py ../../../third_party/jinja2/_compat.py +../../../third_party/jinja2/asyncfilters.py +../../../third_party/jinja2/asyncsupport.py ../../../third_party/jinja2/bccache.py ../../../third_party/jinja2/compiler.py ../../../third_party/jinja2/defaults.py
diff --git a/build/android/gyp/write_native_libraries_java.py b/build/android/gyp/write_native_libraries_java.py index 58754d4..322b8b2 100755 --- a/build/android/gyp/write_native_libraries_java.py +++ b/build/android/gyp/write_native_libraries_java.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/android/gyp/zip.py b/build/android/gyp/zip.py index ed8f61a..6b40540 100755 --- a/build/android/gyp/zip.py +++ b/build/android/gyp/zip.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/build/config/sanitizers/BUILD.gn b/build/config/sanitizers/BUILD.gn index bc2717c8..aaaad02 100644 --- a/build/config/sanitizers/BUILD.gn +++ b/build/config/sanitizers/BUILD.gn
@@ -440,7 +440,7 @@ if (is_ubsan) { if (!defined(ubsan_blacklist_path)) { ubsan_blacklist_path = - rebase_path("//tools/ubsan/blacklist.txt", root_build_dir) + rebase_path("//tools/ubsan/ignorelist.txt", root_build_dir) } cflags += [ "-fsanitize=bool", @@ -488,7 +488,7 @@ if (is_ubsan_security) { if (!defined(ubsan_security_blacklist_path)) { ubsan_security_blacklist_path = - rebase_path("//tools/ubsan/security_blacklist.txt", root_build_dir) + rebase_path("//tools/ubsan/security_ignorelist.txt", root_build_dir) } cflags = [ "-fsanitize=function", @@ -510,7 +510,7 @@ if (is_ubsan_vptr) { if (!defined(ubsan_vptr_blacklist_path)) { ubsan_vptr_blacklist_path = - rebase_path("//tools/ubsan/vptr_blacklist.txt", root_build_dir) + rebase_path("//tools/ubsan/vptr_ignorelist.txt", root_build_dir) } cflags = [ "-fsanitize=vptr",
diff --git a/cc/base/features.cc b/cc/base/features.cc index 9b1496f..dcdbf85 100644 --- a/cc/base/features.cc +++ b/cc/base/features.cc
@@ -21,6 +21,10 @@ base::FEATURE_DISABLED_BY_DEFAULT}; // Enables impulse-style scroll animations in place of the default ones. +// +// Note: Do not enable this on the Mac. The animation does not match the system +// scroll animation curve to such an extent that it makes Chromium stand out in +// a bad way. const base::Feature kImpulseScrollAnimations = { "ImpulseScrollAnimations", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/cc/metrics/jank_injector.cc b/cc/metrics/jank_injector.cc index 1ffcbfbe..01bf704b 100644 --- a/cc/metrics/jank_injector.cc +++ b/cc/metrics/jank_injector.cc
@@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/debug/alias.h" #include "base/feature_list.h" +#include "base/metrics/field_trial_params.h" #include "base/no_destructor.h" #include "base/strings/string_split.h" #include "base/trace_event/trace_event.h"
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index f9900810..7239c9e4 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -25,6 +25,7 @@ import("//chrome/chrome_paks.gni") import("//chrome/common/features.gni") import("//device/vr/buildflags/buildflags.gni") +import("//printing/buildflags/buildflags.gni") import("//testing/test.gni") import("//third_party/icu/config.gni") import("//third_party/protobuf/proto_library.gni") @@ -516,7 +517,6 @@ "//mojo/public/java/system:system_impl_java", "//mojo/public/mojom/base:base_java", "//net/android:net_java", - "//printing:printing_java", "//services/data_decoder/public/cpp/android:safe_json_java", "//services/device/public/java:device_feature_list_java", "//services/device/public/mojom:mojom_java", @@ -654,6 +654,10 @@ # TODO(crbug/1186003): Instead of adding source files, add it as a separate # dependency when circular deps is resolved. sources += price_tracking_java_sources + + if (enable_basic_printing) { + deps += [ "//printing:printing_java" ] + } } # Template for strict mode detection enabling/disabling so that proguard strips out @@ -1359,7 +1363,6 @@ "//mojo/public/mojom/base:base_java", "//net/android:net_java", "//net/android:net_java_test_support", - "//printing:printing_java", "//services:services_javatests", "//services/device/public/java:geolocation_java", "//services/device/public/java:geolocation_java_test_support", @@ -1412,6 +1415,10 @@ deps += feed_test_deps + if (enable_basic_printing) { + deps += [ "//printing:printing_java" ] + } + srcjar_deps = [ "//chrome/browser:tos_dialog_behavior_generated_enum" ] data = [
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/state/CriticalPersistedTabDataTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/state/CriticalPersistedTabDataTest.java index b47d9ec3..2f84255 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/state/CriticalPersistedTabDataTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/state/CriticalPersistedTabDataTest.java
@@ -152,7 +152,7 @@ Assert.assertEquals(mCriticalPersistedTabData.getThemeColor(), THEME_COLOR); Assert.assertEquals( mCriticalPersistedTabData.getTabLaunchTypeAtCreation(), LAUNCH_TYPE_AT_CREATION); - Assert.assertArrayEquals(getByteArrayFromByteBuffer( + Assert.assertArrayEquals(CriticalPersistedTabData.getContentStateByteArray( mCriticalPersistedTabData.getWebContentsState().buffer()), WEB_CONTENTS_STATE_BYTES); Semaphore deleteSemaphore = new Semaphore(0); @@ -271,7 +271,8 @@ Assert.assertEquals(THEME_COLOR, deserialized.getThemeColor()); Assert.assertEquals(LAUNCH_TYPE_AT_CREATION, deserialized.getTabLaunchTypeAtCreation()); Assert.assertArrayEquals(WEB_CONTENTS_STATE_BYTES, - getByteArrayFromByteBuffer(deserialized.getWebContentsState().buffer())); + CriticalPersistedTabData.getContentStateByteArray( + deserialized.getWebContentsState().buffer())); } @UiThreadTest @@ -493,11 +494,4 @@ CriticalPersistedTabData.getLaunchType(type); } } - - private static final byte[] getByteArrayFromByteBuffer(ByteBuffer buffer) { - byte[] contentsStateBytes = new byte[buffer.limit()]; - buffer.rewind(); - buffer.get(contentsStateBytes); - return contentsStateBytes; - } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArCameraAccessTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArCameraAccessTest.java index 11c3e509..e3349c1 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArCameraAccessTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArCameraAccessTest.java
@@ -22,7 +22,6 @@ import org.chromium.base.test.params.ParameterSet; import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.MinAndroidSdkLevel; import org.chromium.chrome.browser.flags.ChromeSwitches; @@ -42,7 +41,6 @@ @UseRunnerDelegate(ChromeJUnit4RunnerDelegate.class) // TODO(https://crbug.com/1112356) Change this to Build.VERSION_CODES.N once N support is added. @MinAndroidSdkLevel(Build.VERSION_CODES.O) -@DisableIf.Build(sdk_is_greater_than = 28) // https://crbug.com/1201342 public class WebXrArCameraAccessTest { @ClassParameter private static List<ParameterSet> sClassParams =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArDepthSensingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArDepthSensingTest.java index 604bcf9..3574a22 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArDepthSensingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArDepthSensingTest.java
@@ -21,7 +21,6 @@ import org.chromium.base.test.params.ParameterSet; import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.MinAndroidSdkLevel; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.vr.rules.ArPlaybackFile; @@ -41,7 +40,6 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, "enable-features=WebXR,WebXRARModule,WebXRIncubations,LogJsConsoleMessages"}) @MinAndroidSdkLevel(Build.VERSION_CODES.N) // WebXR for AR is only supported on N+ -@DisableIf.Build(sdk_is_greater_than = 28) // https://crbug.com/1201342 public class WebXrArDepthSensingTest { @ClassParameter private static List<ParameterSet> sClassParams =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArHitTestTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArHitTestTest.java index decf9d6..622f54a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArHitTestTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArHitTestTest.java
@@ -21,7 +21,6 @@ import org.chromium.base.test.params.ParameterSet; import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.MinAndroidSdkLevel; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.vr.rules.ArPlaybackFile; @@ -41,7 +40,6 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, "enable-features=WebXR,WebXRARModule,WebXRHitTest,LogJsConsoleMessages"}) @MinAndroidSdkLevel(Build.VERSION_CODES.N) // WebXR for AR is only supported on N+ -@DisableIf.Build(sdk_is_greater_than = 28) // https://crbug.com/1201342 public class WebXrArHitTestTest { @ClassParameter private static List<ParameterSet> sClassParams =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArLightEstimationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArLightEstimationTest.java index 0794b814..971a0e7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArLightEstimationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArLightEstimationTest.java
@@ -21,7 +21,6 @@ import org.chromium.base.test.params.ParameterSet; import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.MinAndroidSdkLevel; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.vr.rules.ArPlaybackFile; @@ -41,7 +40,6 @@ @CommandLineFlags. Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, "enable-features=LogJsConsoleMessages"}) @MinAndroidSdkLevel(Build.VERSION_CODES.N) // WebXR for AR is only supported on N+ -@DisableIf.Build(sdk_is_greater_than = 28) // https://crbug.com/1201342 public class WebXrArLightEstimationTest { @ClassParameter private static List<ParameterSet> sClassParams =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArViewportScaleTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArViewportScaleTest.java index 2ea071e..53e9981 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArViewportScaleTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArViewportScaleTest.java
@@ -21,7 +21,6 @@ import org.chromium.base.test.params.ParameterSet; import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.MinAndroidSdkLevel; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.vr.rules.XrActivityRestriction; @@ -40,7 +39,6 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, "enable-features=WebXR,WebXRARModule,WebXRHitTest,LogJsConsoleMessages"}) @MinAndroidSdkLevel(Build.VERSION_CODES.N) // WebXR for AR is only supported on N+ -@DisableIf.Build(sdk_is_greater_than = 28) // https://crbug.com/1201342 public class WebXrArViewportScaleTest { @ClassParameter private static List<ParameterSet> sClassParams =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkIntegrationTest.java index ebee8c1..e39234d9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkIntegrationTest.java
@@ -24,6 +24,7 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.Feature; +import org.chromium.base.test.util.FlakyTest; import org.chromium.chrome.browser.flags.ActivityType; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; @@ -89,6 +90,7 @@ @Test @LargeTest @Feature({"Webapps"}) + @FlakyTest(message = "https://crbug.com/1112352") public void testShare() throws TimeoutException { final String sharedSubject = "Fun tea parties"; final String sharedText = "Boston";
diff --git a/chrome/app/vector_icons/BUILD.gn b/chrome/app/vector_icons/BUILD.gn index 20b5cd05..b7f095a 100644 --- a/chrome/app/vector_icons/BUILD.gn +++ b/chrome/app/vector_icons/BUILD.gn
@@ -29,7 +29,6 @@ "browser_tools_error.icon", "browser_tools_touch.icon", "browser_tools_update.icon", - "cast_for_education.icon", "chevron_right.icon", "chrome_labs.icon", "chrome_labs_touch.icon",
diff --git a/chrome/app/vector_icons/cast_for_education.icon b/chrome/app/vector_icons/cast_for_education.icon deleted file mode 100644 index 7d07688c..0000000 --- a/chrome/app/vector_icons/cast_for_education.icon +++ /dev/null
@@ -1,50 +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. - -MOVE_TO, 42, 6, -H_LINE_TO, 6, -R_CUBIC_TO, -2.2f, 0, -4, 1.8f, -4, 4, -R_V_LINE_TO, 6, -R_H_LINE_TO, 4, -R_V_LINE_TO, -6, -R_H_LINE_TO, 36, -R_V_LINE_TO, 28, -H_LINE_TO, 28, -R_V_LINE_TO, 4, -R_H_LINE_TO, 14, -R_CUBIC_TO, 2.2f, 0, 4, -1.8f, 4, -4, -V_LINE_TO, 10, -R_CUBIC_TO, 0, -2.2f, -1.8f, -4, -4, -4, -CLOSE, -MOVE_TO, 2, 36, -R_V_LINE_TO, 6, -R_H_LINE_TO, 6, -R_CUBIC_TO, 0, -3.32f, -2.68f, -6, -6, -6, -CLOSE, -R_MOVE_TO, 0, -8, -R_V_LINE_TO, 4, -R_CUBIC_TO, 5.52f, 0, 10, 4.48f, 10, 10, -R_H_LINE_TO, 4, -R_CUBIC_TO, 0, -7.74f, -6.26f, -14, -14, -14, -CLOSE, -R_MOVE_TO, 0, -8, -R_V_LINE_TO, 4, -R_CUBIC_TO, 9.94f, 0, 18, 8.06f, 18, 18, -R_H_LINE_TO, 4, -R_CUBIC_TO, 0, -12.16f, -9.86f, -22, -22, -22, -CLOSE, -R_MOVE_TO, 20, 2.18f, -R_V_LINE_TO, 4, -LINE_TO, 29, 30, -R_LINE_TO, 7, -3.82f, -R_V_LINE_TO, -4, -LINE_TO, 29, 26, -R_LINE_TO, -7, -3.82f, -CLOSE, -MOVE_TO, 29, 12, -R_LINE_TO, -11, 6, -R_LINE_TO, 11, 6, -R_LINE_TO, 11, -6, -R_LINE_TO, -11, -6, -CLOSE \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 683dc731..c156512 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -1988,7 +1988,6 @@ "//chrome/common:version_header", "//chrome/common/net", "//chrome/common/performance_manager/mojom", - "//chrome/common/printing:printing", "//chrome/installer/util:with_no_strings", "//components/assist_ranker", "//components/autofill/content/browser", @@ -2133,7 +2132,6 @@ "//components/policy/core/browser", "//components/policy/proto", "//components/prefs", - "//components/printing/browser", "//components/privacy_sandbox:privacy_sandbox_prefs", "//components/profile_metrics", "//components/proxy_config", @@ -2294,7 +2292,6 @@ "//net", "//net:extras", "//ppapi/buildflags", - "//printing", "//printing/buildflags", "//rlz/buildflags", "//services/audio/public/cpp", @@ -4198,7 +4195,6 @@ "//components/keep_alive_registry", "//components/live_caption:constants", "//components/pref_registry", - "//components/printing/common:mojo_interfaces", "//components/services/app_service:lib", "//components/services/app_service/public/cpp:app_file_handling", "//components/services/app_service/public/cpp:app_share_target", @@ -5510,6 +5506,7 @@ "printing/printing_init.h", ] deps += [ + "//chrome/common/printing", "//components/printing/browser", "//components/printing/common:mojo_interfaces", "//components/services/print_compositor/public/cpp",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 2f5e022b..9b695ea 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -4616,6 +4616,11 @@ kTabScrollingVariations, "TabScrolling")}, + {"scrollable-tabstrip-buttons", + flag_descriptions::kScrollableTabStripButtonsName, + flag_descriptions::kScrollableTabStripButtonsDescription, kOsDesktop, + FEATURE_VALUE_TYPE(features::kScrollableTabStripButtons)}, + {"side-panel", flag_descriptions::kSidePanelName, flag_descriptions::kSidePanelDescription, kOsDesktop, FEATURE_VALUE_TYPE(features::kSidePanel)}, @@ -6521,6 +6526,11 @@ flag_descriptions::kEnableTranslateSubFramesDescription, kOsAll, FEATURE_VALUE_TYPE(translate::kTranslateSubFrames)}, + {"service-worker-subresource-filter", + flag_descriptions::kServiceWorkerSubresourceFilterName, + flag_descriptions::kServiceWorkerSubresourceFilterDescription, kOsAll, + FEATURE_VALUE_TYPE(features::kServiceWorkerSubresourceFilter)}, + {"conversion-measurement-api", flag_descriptions::kConversionMeasurementApiName, flag_descriptions::kConversionMeasurementApiDescription, kOsAll,
diff --git a/chrome/browser/android/vr/arcore_device/fake_arcore.h b/chrome/browser/android/vr/arcore_device/fake_arcore.h index e46b477..039289d 100644 --- a/chrome/browser/android/vr/arcore_device/fake_arcore.h +++ b/chrome/browser/android/vr/arcore_device/fake_arcore.h
@@ -6,6 +6,8 @@ #define CHROME_BROWSER_ANDROID_VR_ARCORE_DEVICE_FAKE_ARCORE_H_ #include <memory> +#include <unordered_map> + #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/time/time.h"
diff --git a/chrome/browser/ash/accessibility/spoken_feedback_app_list_browsertest.cc b/chrome/browser/ash/accessibility/spoken_feedback_app_list_browsertest.cc index 295eeba..05ae7dd 100644 --- a/chrome/browser/ash/accessibility/spoken_feedback_app_list_browsertest.cc +++ b/chrome/browser/ash/accessibility/spoken_feedback_app_list_browsertest.cc
@@ -537,7 +537,7 @@ sm_.Call([]() { SendKeyPressWithShiftAndControl(ui::VKEY_RIGHT); }); sm_.ExpectSpeech("Folder Unnamed"); sm_.ExpectSpeech("Button"); - sm_.ExpectSpeech("Alert"); + sm_.ExpectNextSpeechIsNot("Alert"); sm_.ExpectSpeech("Item 0 combined with Item 1 to create new folder."); // Open the folder and move focus to the first item of the folder. @@ -549,7 +549,7 @@ sm_.Call([]() { SendKeyPressWithShiftAndControl(ui::VKEY_LEFT); }); sm_.ExpectSpeech("Item 1"); sm_.ExpectSpeech("Button"); - sm_.ExpectSpeech("Alert"); + sm_.ExpectNextSpeechIsNot("Alert"); sm_.ExpectSpeech("Moved to Page 1, row 1, column 1."); sm_.Replay(); @@ -591,37 +591,37 @@ // Move the first item to the right. sm_.Call([this]() { SendKeyPressWithControl(ui::VKEY_RIGHT); }); - sm_.ExpectSpeech("Alert"); + sm_.ExpectNextSpeechIsNot("Alert"); sm_.ExpectSpeech("Moved to Page 1, row 1, column 2."); // Move the focused item down. sm_.Call([this]() { SendKeyPressWithControl(ui::VKEY_DOWN); }); - sm_.ExpectSpeech("Alert"); + sm_.ExpectNextSpeechIsNot("Alert"); sm_.ExpectSpeech("Moved to Page 1, row 2, column 2."); // Move the focused item down. sm_.Call([this]() { SendKeyPressWithControl(ui::VKEY_DOWN); }); - sm_.ExpectSpeech("Alert"); + sm_.ExpectNextSpeechIsNot("Alert"); sm_.ExpectSpeech("Moved to Page 1, row 3, column 2."); // Move the focused item down. sm_.Call([this]() { SendKeyPressWithControl(ui::VKEY_DOWN); }); - sm_.ExpectSpeech("Alert"); + sm_.ExpectNextSpeechIsNot("Alert"); sm_.ExpectSpeech("Moved to Page 1, row 4, column 2."); // Move the focused item down to page 2. sm_.Call([this]() { SendKeyPressWithControl(ui::VKEY_DOWN); }); - sm_.ExpectSpeech("Alert"); + sm_.ExpectNextSpeechIsNot("Alert"); sm_.ExpectSpeech("Moved to Page 2, row 1, column 2."); // Move the focused item to the left. sm_.Call([this]() { SendKeyPressWithControl(ui::VKEY_LEFT); }); - sm_.ExpectSpeech("Alert"); + sm_.ExpectNextSpeechIsNot("Alert"); sm_.ExpectSpeech("Moved to Page 2, row 1, column 1."); // Move the focused item back up to page 1.. sm_.Call([this]() { SendKeyPressWithControl(ui::VKEY_UP); }); - sm_.ExpectSpeech("Alert"); + sm_.ExpectNextSpeechIsNot("Alert"); sm_.ExpectSpeech("Moved to Page 1, row 4, column 1."); sm_.Replay();
diff --git a/chrome/browser/ash/arc/user_session/arc_user_session_service_browsertest.cc b/chrome/browser/ash/arc/user_session/arc_user_session_service_browsertest.cc index 41fd0ab8..7ed3888a 100644 --- a/chrome/browser/ash/arc/user_session/arc_user_session_service_browsertest.cc +++ b/chrome/browser/ash/arc/user_session/arc_user_session_service_browsertest.cc
@@ -8,7 +8,7 @@ #include "base/run_loop.h" #include "base/task/current_thread.h" -#include "chrome/browser/ui/ash/chrome_launcher_prefs.h" +#include "chrome/browser/ui/ash/chrome_shelf_prefs.h" #include "chrome/test/base/in_process_browser_test.h" #include "components/arc/arc_service_manager.h" #include "components/arc/arc_util.h"
diff --git a/chrome/browser/ash/borealis/borealis_task.cc b/chrome/browser/ash/borealis/borealis_task.cc index ce4e9454..c0cf561e 100644 --- a/chrome/browser/ash/borealis/borealis_task.cc +++ b/chrome/browser/ash/borealis/borealis_task.cc
@@ -114,6 +114,7 @@ request.set_enable_gpu(true); request.set_software_tpm(false); request.set_enable_audio_capture(false); + request.set_enable_vulkan(true); request.set_name(context->vm_name()); vm_tools::concierge::DiskImage* disk_image = request.add_disks();
diff --git a/chrome/browser/ash/login/saml/password_sync_token_checkers_collection.h b/chrome/browser/ash/login/saml/password_sync_token_checkers_collection.h index f228fe1..0905c01e 100644 --- a/chrome/browser/ash/login/saml/password_sync_token_checkers_collection.h +++ b/chrome/browser/ash/login/saml/password_sync_token_checkers_collection.h
@@ -8,6 +8,7 @@ #include <map> #include <memory> #include <string> +#include <unordered_map> #include "chrome/browser/ash/login/saml/password_sync_token_login_checker.h" #include "components/user_manager/user.h"
diff --git a/chrome/browser/autofill/autofill_interactive_uitest.cc b/chrome/browser/autofill/autofill_interactive_uitest.cc index 7d4cd378..540cbce 100644 --- a/chrome/browser/autofill/autofill_interactive_uitest.cc +++ b/chrome/browser/autofill/autofill_interactive_uitest.cc
@@ -533,6 +533,27 @@ void FillElementWithValue(const std::string& element_name, const std::string& value) { + // Sends "|element_name|:|value|" to |msg_queue| if the |element_name|'s + // value has changed to |value|. + std::string script = + base::StringPrintf(R"( + (function() { + const element_name = '%s'; + const value = '%s'; + const field = document.getElementById(element_name); + const listener = function() { + if (field.value === value) { + field.removeEventListener('input', listener); + domAutomationController.send(element_name +':'+ field.value); + } + } + field.addEventListener('input', listener, false); + return 'done'; + })();)", + element_name.c_str(), value.c_str()); + ASSERT_TRUE(ExecJs(GetWebContents(), script)); + + content::DOMMessageQueue msg_queue; for (char16_t character : value) { ui::DomKey dom_key = ui::DomKey::FromCharacter(character); const ui::PrintableCodeEntry* code_entry = std::find_if( @@ -548,7 +569,9 @@ ui::DomCodeToUsLayoutKeyboardCode(dom_code), false, shift, false, false); } - AssertFieldValue(element_name, value); + std::string reply; + ASSERT_TRUE(msg_queue.WaitForMessage(&reply)); + ASSERT_EQ("\"" + element_name + ":" + value + "\"", reply); } void DeleteElementValue(const std::string& element_name) { @@ -817,16 +840,7 @@ ExpectFilledTestForm(); } -// Test that autofill doesn't refill a text field initially modified by the -// user. -// TODO(https://crbug.com/1185439): This test is flaky on Mac, Linux, and -// ChromeOS. -#if defined(OS_MAC) || defined(OS_LINUX) || defined(OS_CHROMEOS) -#define MAYBE_ModifyTextFieldAndFill DISABLED_ModifyTextFieldAndFill -#else -#define MAYBE_ModifyTextFieldAndFill ModifyTextFieldAndFill -#endif -IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, MAYBE_ModifyTextFieldAndFill) { +IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, ModifyTextFieldAndFill) { CreateTestProfile(); // Load the test page. @@ -1910,12 +1924,13 @@ EXPECT_TRUE(select_blur_triggered); } -// Test fails on Linux ASAN, see http://crbug.com/532737 -#if defined(ADDRESS_SANITIZER) +// Test fails on Linux ASAN and flakes on Windows, see http://crbug.com/532737 +// and http://crbug.com/1203410. +#if defined(ADDRESS_SANITIZER) || defined(OS_WIN) #define MAYBE_AutofillAfterTranslate DISABLED_AutofillAfterTranslate #else #define MAYBE_AutofillAfterTranslate AutofillAfterTranslate -#endif // ADDRESS_SANITIZER +#endif // defined(ADDRESS_SANITIZER) || defined(OS_WIN) IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, MAYBE_AutofillAfterTranslate) { ASSERT_TRUE(TranslateService::IsTranslateBubbleEnabled());
diff --git a/chrome/browser/cart/cart_handler.cc b/chrome/browser/cart/cart_handler.cc index 1327cfc..5162448 100644 --- a/chrome/browser/cart/cart_handler.cc +++ b/chrome/browser/cart/cart_handler.cc
@@ -3,6 +3,8 @@ // found in the LICENSE file. #include "chrome/browser/cart/cart_handler.h" + +#include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_functions.h" #include "chrome/browser/cart/cart_db_content.pb.h" #include "chrome/browser/cart/cart_service.h"
diff --git a/chrome/browser/cart/cart_service.cc b/chrome/browser/cart/cart_service.cc index 0041460..37f48fa 100644 --- a/chrome/browser/cart/cart_service.cc +++ b/chrome/browser/cart/cart_service.cc
@@ -3,7 +3,9 @@ // found in the LICENSE file. #include "chrome/browser/cart/cart_service.h" + #include "base/json/json_reader.h" +#include "base/metrics/field_trial_params.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/cart/cart_db_content.pb.h" #include "chrome/browser/history/history_service_factory.h"
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index c6cd0c1..48e3492 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -3813,7 +3813,9 @@ case sandbox::policy::SandboxType::kXrCompositing: case sandbox::policy::SandboxType::kNetwork: case sandbox::policy::SandboxType::kCdm: +#if BUILDFLAG(ENABLE_PRINTING) case sandbox::policy::SandboxType::kPrintBackend: +#endif case sandbox::policy::SandboxType::kPrintCompositor: case sandbox::policy::SandboxType::kAudio: case sandbox::policy::SandboxType::kSpeechRecognition: @@ -3860,7 +3862,9 @@ case sandbox::policy::SandboxType::kNoSandboxAndElevatedPrivileges: case sandbox::policy::SandboxType::kXrCompositing: case sandbox::policy::SandboxType::kCdm: +#if BUILDFLAG(ENABLE_PRINTING) case sandbox::policy::SandboxType::kPrintBackend: +#endif case sandbox::policy::SandboxType::kPrintCompositor: case sandbox::policy::SandboxType::kAudio: case sandbox::policy::SandboxType::kSpeechRecognition:
diff --git a/chrome/browser/chromeos/crostini/crostini_export_import.h b/chrome/browser/chromeos/crostini/crostini_export_import.h index 193c266..a442663 100644 --- a/chrome/browser/chromeos/crostini/crostini_export_import.h +++ b/chrome/browser/chromeos/crostini/crostini_export_import.h
@@ -8,6 +8,7 @@ #include <map> #include <memory> #include <string> +#include <unordered_map> #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_port_forwarder.h b/chrome/browser/chromeos/crostini/crostini_port_forwarder.h index ca718ec..a074a493e 100644 --- a/chrome/browser/chromeos/crostini/crostini_port_forwarder.h +++ b/chrome/browser/chromeos/crostini/crostini_port_forwarder.h
@@ -6,6 +6,7 @@ #define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_PORT_FORWARDER_H_ #include <string> +#include <unordered_map> #include "base/files/scoped_file.h" #include "base/memory/weak_ptr.h"
diff --git a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_apitest.cc b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_apitest.cc index a62bcfa..f94f7c85 100644 --- a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_apitest.cc +++ b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_apitest.cc
@@ -19,7 +19,7 @@ #include "chrome/browser/ash/settings/scoped_testing_cros_settings.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" -#include "chrome/browser/ui/ash/chrome_launcher_prefs.h" +#include "chrome/browser/ui/ash/chrome_shelf_prefs.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/web_applications/system_web_apps/test/test_system_web_app_installation.h" #include "components/arc/arc_prefs.h"
diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc index 71d47c36..315d418 100644 --- a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc +++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
@@ -53,6 +53,7 @@ #include "ui/base/ime/chromeos/ime_keyboard.h" #include "ui/base/ime/chromeos/ime_keyboard_impl.h" #include "ui/base/ime/chromeos/input_method_delegate.h" +#include "ui/base/ui_base_features.h" #include "ui/ozone/public/ozone_platform.h" namespace chromeos { @@ -60,6 +61,13 @@ namespace { +const char* const kNonPositionalLayouts[] = { + "de(neo)", "gb(dvorak)", "tr(f)", "us(colemak)", + "us(dvorak)", "us(dvp)", "us(workman)", "us(workman-intl)", +}; + +const size_t kNonPositionalLayoutsLength = base::size(kNonPositionalLayouts); + enum InputMethodCategory { INPUT_METHOD_CATEGORY_UNKNOWN = 0, INPUT_METHOD_CATEGORY_XKB, // XKB input methods @@ -961,6 +969,14 @@ util_(delegate_.get()), enable_extension_loading_(enable_extension_loading), features_enabled_state_(InputMethodManager::FEATURE_ALL) { + if (::features::IsImprovedKeyboardShortcutsEnabled()) { + // Create a set of layouts that do not use positional shortcuts. + non_positional_layouts_.reserve(kNonPositionalLayoutsLength); + for (size_t i = 0; i < kNonPositionalLayoutsLength; i++) { + non_positional_layouts_.emplace(kNonPositionalLayouts[i]); + } + } + if (IsRunningAsSystemCompositor()) { keyboard_ = std::make_unique<ImeKeyboardImpl>( ui::OzonePlatform::GetInstance()->GetInputController()); @@ -1202,6 +1218,15 @@ return keyboard_->IsAltGrAvailable(); } +bool InputMethodManagerImpl::ArePositionalShortcutsUsedByCurrentInputMethod() + const { + if (!state_ || !::features::IsImprovedKeyboardShortcutsEnabled()) + return false; + + return !non_positional_layouts_.contains( + state_.get()->GetCurrentInputMethod().keyboard_layout()); +} + ImeKeyboard* InputMethodManagerImpl::GetImeKeyboard() { return keyboard_.get(); }
diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl.h b/chrome/browser/chromeos/input_method/input_method_manager_impl.h index 45be922..539e3552 100644 --- a/chrome/browser/chromeos/input_method/input_method_manager_impl.h +++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.h
@@ -12,6 +12,7 @@ #include <string> #include <vector> +#include "base/containers/flat_set.h" #include "base/macros.h" #include "base/observer_list.h" #include "base/threading/thread_checker.h" @@ -213,6 +214,7 @@ override; bool IsISOLevel5ShiftUsedByCurrentInputMethod() const override; bool IsAltGrUsedByCurrentInputMethod() const override; + bool ArePositionalShortcutsUsedByCurrentInputMethod() const override; void NotifyImeMenuItemsChanged( const std::string& engine_id, const std::vector<InputMethodManager::MenuItem>& items) override; @@ -328,6 +330,9 @@ // auto-repeat interval. std::unique_ptr<ImeKeyboard> keyboard_; + // The set of layouts that do not use positional shortcuts. + base::flat_set<std::string> non_positional_layouts_; + // Whether load IME extensions. bool enable_extension_loading_;
diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc b/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc index 6aa6fe6..02f0c96b 100644 --- a/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc +++ b/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc
@@ -16,6 +16,7 @@ #include "base/compiler_specific.h" #include "base/macros.h" #include "base/run_loop.h" +#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "chrome/browser/chromeos/input_method/mock_candidate_window_controller.h" #include "chrome/browser/chromeos/input_method/mock_input_method_engine.h" @@ -36,6 +37,7 @@ #include "ui/base/ime/chromeos/mock_component_extension_ime_manager_delegate.h" #include "ui/base/ime/chromeos/mock_ime_engine_handler.h" #include "ui/base/ime/init/input_method_initializer.h" +#include "ui/base/ui_base_features.h" namespace chromeos { @@ -160,9 +162,9 @@ mock_delegate->set_ime_list(ime_list); mock_delegate->set_login_layout_set(login_layout_set); - manager_ = std::make_unique<InputMethodManagerImpl>( - std::make_unique<FakeInputMethodDelegate>(), std::move(mock_delegate), - false); + manager_ = + new InputMethodManagerImpl(std::make_unique<FakeInputMethodDelegate>(), + std::move(mock_delegate), false); manager_->GetInputMethodUtil()->UpdateHardwareLayoutCache(); candidate_window_controller_ = new MockCandidateWindowController; manager_->SetCandidateWindowControllerForTesting( @@ -175,6 +177,10 @@ menu_manager_ = ui::ime::InputMethodMenuManager::GetInstance(); + // Let the global pointer own manager_. Components in ash need to be + // able to call InputMethodManager::Get() during initialization. Cleanup + // the pointer by calling ShutDown() in TearDown(). + InputMethodManager::Initialize(manager_); BrowserWithTestWindowTest::SetUp(); // Needs ash::Shell keyboard to be created first. @@ -204,7 +210,10 @@ candidate_window_controller_ = nullptr; keyboard_ = nullptr; - manager_.reset(); + + // Cleanup the global manager and clear the member pointer. + InputMethodManager::Shutdown(); + manager_ = nullptr; } private: @@ -362,7 +371,7 @@ protected: std::unique_ptr<ChromeKeyboardControllerClientTestHelper> chrome_keyboard_controller_client_test_helper_; - std::unique_ptr<InputMethodManagerImpl> manager_; + InputMethodManagerImpl* manager_ = nullptr; MockCandidateWindowController* candidate_window_controller_ = nullptr; std::unique_ptr<MockInputMethodEngine> mock_engine_handler_; FakeImeKeyboard* keyboard_ = nullptr; @@ -1454,7 +1463,7 @@ // ImeControllerClient sends the correct data to ash. TEST_F(InputMethodManagerImplTest, IntegrationWithAsh) { TestImeController ime_controller; - ImeControllerClient ime_controller_client(manager_.get()); + ImeControllerClient ime_controller_client(manager_); ime_controller_client.Init(); // Setup 3 IMEs. @@ -1582,5 +1591,52 @@ EXPECT_TRUE(result.empty()); } +// TODO(crbug.com/1179893): Remove once the feature is enabled permanently. +class InputMethodManagerImplPositionalTest : public InputMethodManagerImplTest { + public: + InputMethodManagerImplPositionalTest() = default; + ~InputMethodManagerImplPositionalTest() override = default; + + void SetUp() override { + scoped_feature_list_.InitAndEnableFeature( + ::features::kImprovedKeyboardShortcuts); + + InputMethodManagerImplTest::SetUp(); + } + + private: + base::test::ScopedFeatureList scoped_feature_list_; +}; + +TEST_F(InputMethodManagerImplPositionalTest, ValidatePositionalShortcutLayout) { + // Initialize with one positional (US) and one non-positional (US-dvorak) + // layout. + std::vector<std::string> ids; + ids.push_back(ImeIdFromEngineId("xkb:us::eng")); + ids.push_back(ImeIdFromEngineId("xkb:us:dvorak:eng")); + EXPECT_TRUE(manager_->GetActiveIMEState()->ReplaceEnabledInputMethods(ids)); + EXPECT_EQ(2U, manager_->GetActiveIMEState()->GetNumActiveInputMethods()); + + // Verify the US layout is positional. + EXPECT_EQ(ImeIdFromEngineId(ids[0]), + manager_->GetActiveIMEState()->GetCurrentInputMethod().id()); + EXPECT_EQ("us", keyboard_->last_layout_); + EXPECT_TRUE(manager_->ArePositionalShortcutsUsedByCurrentInputMethod()); + + // Switch to dvorak and verify it is non-positional. + manager_->GetActiveIMEState()->SwitchToNextInputMethod(); + EXPECT_EQ(ImeIdFromEngineId(ids[1]), + manager_->GetActiveIMEState()->GetCurrentInputMethod().id()); + EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); + EXPECT_FALSE(manager_->ArePositionalShortcutsUsedByCurrentInputMethod()); + + // Switch back to US and verify it is positional again. + manager_->GetActiveIMEState()->SwitchToNextInputMethod(); + EXPECT_EQ(ImeIdFromEngineId(ids[0]), + manager_->GetActiveIMEState()->GetCurrentInputMethod().id()); + EXPECT_EQ("us", keyboard_->last_layout_); + EXPECT_TRUE(manager_->ArePositionalShortcutsUsedByCurrentInputMethod()); +} + } // namespace input_method } // namespace chromeos
diff --git a/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.cc b/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.cc index eb76236..f4ffdda 100644 --- a/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.cc +++ b/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.cc
@@ -22,7 +22,7 @@ #include "base/strings/string_util.h" #include "base/values.h" #include "chrome/browser/ash/accessibility/magnifier_type.h" -#include "chrome/browser/ui/ash/chrome_launcher_prefs.h" +#include "chrome/browser/ui/ash/chrome_shelf_prefs.h" #include "chrome/common/pref_names.h" #include "chromeos/dbus/power/power_policy_controller.h" #include "chromeos/network/onc/onc_signature.h"
diff --git a/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos_unittest.cc b/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos_unittest.cc index bdbd953e..13d4b62 100644 --- a/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos_unittest.cc +++ b/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos_unittest.cc
@@ -12,7 +12,7 @@ #include "base/json/json_reader.h" #include "base/macros.h" #include "base/values.h" -#include "chrome/browser/ui/ash/chrome_launcher_prefs.h" +#include "chrome/browser/ui/ash/chrome_shelf_prefs.h" #include "chrome/common/pref_names.h" #include "components/arc/arc_prefs.h" #include "components/policy/core/browser/policy_error_map.h"
diff --git a/chrome/browser/complex_tasks/task_tab_helper.h b/chrome/browser/complex_tasks/task_tab_helper.h index 66eb33f..b0f4bf0 100644 --- a/chrome/browser/complex_tasks/task_tab_helper.h +++ b/chrome/browser/complex_tasks/task_tab_helper.h
@@ -6,6 +6,7 @@ #define CHROME_BROWSER_COMPLEX_TASKS_TASK_TAB_HELPER_H_ #include <map> +#include <unordered_map> #include "base/containers/contains.h" #include "base/macros.h"
diff --git a/chrome/browser/download/android/download_dialog_bridge.cc b/chrome/browser/download/android/download_dialog_bridge.cc index fe0a6600..952db84 100644 --- a/chrome/browser/download/android/download_dialog_bridge.cc +++ b/chrome/browser/download/android/download_dialog_bridge.cc
@@ -6,6 +6,7 @@ #include "base/android/jni_android.h" #include "base/android/jni_string.h" +#include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_macros.h" #include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.h" #include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings_factory.h"
diff --git a/chrome/browser/federated_learning/floc_eligibility_browsertest.cc b/chrome/browser/federated_learning/floc_eligibility_browsertest.cc index 5882f0e92..460037e 100644 --- a/chrome/browser/federated_learning/floc_eligibility_browsertest.cc +++ b/chrome/browser/federated_learning/floc_eligibility_browsertest.cc
@@ -12,6 +12,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "components/embedder_support/switches.h" +#include "components/federated_learning/features/features.h" #include "components/history/core/browser/history_service.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/page_load_metrics/browser/page_load_metrics_test_waiter.h" @@ -204,7 +205,7 @@ } IN_PROC_BROWSER_TEST_F(FlocEligibilityBrowserTest, - EligibleForHistoryAfterAdResource) { + NotEligibleForHistoryAfterAdResource) { net::IPAddress::ConsiderLoopbackIPToBePubliclyRoutableForTesting(); SetRulesetWithRules( @@ -216,12 +217,11 @@ // Three resources in the main frame and one favicon. NavigateAndWaitForResourcesCompeletion(main_page_url, 4); - // Expect that the navigation history is eligible for floc computation as the - // page contains an ad resource. + // Expect that the navigation history is not eligible for floc computation. base::Optional<bool> query_floc_eligible = QueryFlocEligibleForURL(main_page_url); EXPECT_TRUE(query_floc_eligible); - EXPECT_TRUE(query_floc_eligible.value()); + EXPECT_FALSE(query_floc_eligible.value()); } IN_PROC_BROWSER_TEST_F(FlocEligibilityBrowserTest, @@ -249,9 +249,6 @@ NotEligibleForHistoryDueToPermissionsPolicyLegacy) { net::IPAddress::ConsiderLoopbackIPToBePubliclyRoutableForTesting(); - SetRulesetWithRules( - {subresource_filter::testing::CreateSuffixRule("maybe_ad_script.js")}); - GURL main_page_url = https_server_.GetURL( "a.test", "/federated_learning/" @@ -260,6 +257,8 @@ // Three resources in the main frame and one favicon. NavigateAndWaitForResourcesCompeletion(main_page_url, 4); + InvokeInterestCohortJsApi(web_contents()); + // Expect that the navigation history is not eligible for floc computation as // the permissions policy disallows it. base::Optional<bool> query_floc_eligible = @@ -272,9 +271,6 @@ NotEligibleForHistoryDueToPermissionsPolicy) { net::IPAddress::ConsiderLoopbackIPToBePubliclyRoutableForTesting(); - SetRulesetWithRules( - {subresource_filter::testing::CreateSuffixRule("maybe_ad_script.js")}); - GURL main_page_url = https_server_.GetURL( "a.test", "/federated_learning/permissions_policy_interest_cohort_none.html"); @@ -282,6 +278,8 @@ // Three resources in the main frame and one favicon. NavigateAndWaitForResourcesCompeletion(main_page_url, 4); + InvokeInterestCohortJsApi(web_contents()); + // Expect that the navigation history is not eligible for floc computation as // the permissions policy disallows it. base::Optional<bool> query_floc_eligible = @@ -292,15 +290,14 @@ IN_PROC_BROWSER_TEST_F(FlocEligibilityBrowserTest, NotEligibleForHistoryDueToPrivateIP) { - SetRulesetWithRules( - {subresource_filter::testing::CreateSuffixRule("maybe_ad_script.js")}); - GURL main_page_url = https_server_.GetURL( "a.test", "/federated_learning/page_with_script_and_iframe.html"); // Three resources in the main frame and one favicon. NavigateAndWaitForResourcesCompeletion(main_page_url, 4); + InvokeInterestCohortJsApi(web_contents()); + // Expect that the navigation history is not eligible for floc computation as // the IP was not publicly routable. base::Optional<bool> query_floc_eligible = @@ -472,6 +469,59 @@ .ExtractString()); } +class FlocEligibilityBrowserTestPagesWithAdResourcesDefaultIncluded + : public FlocEligibilityBrowserTest { + public: + FlocEligibilityBrowserTestPagesWithAdResourcesDefaultIncluded() { + scoped_feature_list_.Reset(); + scoped_feature_list_.InitWithFeatures( + {blink::features::kInterestCohortFeaturePolicy, + federated_learning:: + kFlocPagesWithAdResourcesDefaultIncludedInFlocComputation}, + {}); + } +}; + +IN_PROC_BROWSER_TEST_F( + FlocEligibilityBrowserTestPagesWithAdResourcesDefaultIncluded, + EligibleForHistoryAfterAdResource) { + net::IPAddress::ConsiderLoopbackIPToBePubliclyRoutableForTesting(); + + SetRulesetWithRules( + {subresource_filter::testing::CreateSuffixRule("maybe_ad_script.js")}); + + GURL main_page_url = https_server_.GetURL( + "a.test", "/federated_learning/page_with_script_and_iframe.html"); + + // Three resources in the main frame and one favicon. + NavigateAndWaitForResourcesCompeletion(main_page_url, 4); + + // Expect that the navigation history is eligible for floc computation as the + // page contains an ad resource. + base::Optional<bool> query_floc_eligible = + QueryFlocEligibleForURL(main_page_url); + EXPECT_TRUE(query_floc_eligible); + EXPECT_TRUE(query_floc_eligible.value()); +} + +IN_PROC_BROWSER_TEST_F( + FlocEligibilityBrowserTestPagesWithAdResourcesDefaultIncluded, + NotEligibleForHistoryAfterNonAdResource) { + net::IPAddress::ConsiderLoopbackIPToBePubliclyRoutableForTesting(); + + GURL main_page_url = https_server_.GetURL( + "a.test", "/federated_learning/page_with_script_and_iframe.html"); + + // Three resources in the main frame and one favicon. + NavigateAndWaitForResourcesCompeletion(main_page_url, 4); + + // Expect that the navigation history is not eligible for floc computation. + base::Optional<bool> query_floc_eligible = + QueryFlocEligibleForURL(main_page_url); + EXPECT_TRUE(query_floc_eligible); + EXPECT_FALSE(query_floc_eligible.value()); +} + class FlocEligibilityBrowserTestChromePermissionsPolicyDisabled : public FlocEligibilityBrowserTest { public:
diff --git a/chrome/browser/federated_learning/floc_eligibility_observer.cc b/chrome/browser/federated_learning/floc_eligibility_observer.cc index 71e7544a..297f61d 100644 --- a/chrome/browser/federated_learning/floc_eligibility_observer.cc +++ b/chrome/browser/federated_learning/floc_eligibility_observer.cc
@@ -6,6 +6,7 @@ #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/profiles/profile.h" +#include "components/federated_learning/features/features.h" #include "components/history/content/browser/history_context_helper.h" #include "components/history/core/browser/history_service.h" #include "content/public/browser/browser_context.h" @@ -65,6 +66,11 @@ } void FlocEligibilityObserver::OnAdResource() { + if (!base::FeatureList::IsEnabled( + kFlocPagesWithAdResourcesDefaultIncludedInFlocComputation)) { + return; + } + OnOptInSignalObserved(); }
diff --git a/chrome/browser/federated_learning/floc_eligibility_unittest.cc b/chrome/browser/federated_learning/floc_eligibility_unittest.cc index 1b82e82..d49df8f 100644 --- a/chrome/browser/federated_learning/floc_eligibility_unittest.cc +++ b/chrome/browser/federated_learning/floc_eligibility_unittest.cc
@@ -8,6 +8,7 @@ #include "chrome/browser/page_load_metrics/observers/ad_metrics/floc_page_load_metrics_observer.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/testing_browser_process.h" +#include "components/federated_learning/features/features.h" #include "components/federated_learning/floc_sorting_lsh_clusters_service.h" #include "components/history/content/browser/history_context_helper.h" #include "components/history/core/browser/history_service.h" @@ -160,7 +161,7 @@ EXPECT_FALSE(IsUrlVisitEligibleToComputeFloc(url)); SimulateResourceDataUseUpdate(/*is_ad_resource=*/true); - EXPECT_TRUE(IsUrlVisitEligibleToComputeFloc(url)); + EXPECT_FALSE(IsUrlVisitEligibleToComputeFloc(url)); } TEST_F(FlocEligibilityUnitTest, OnNonAdResourceObserved) { @@ -202,6 +203,42 @@ EXPECT_FALSE(IsUrlVisitEligibleToComputeFloc(url)); } +class FlocEligibilityUnitTestPagesWithAdResourcesDefaultIncluded + : public FlocEligibilityUnitTest { + public: + FlocEligibilityUnitTestPagesWithAdResourcesDefaultIncluded() { + feature_list_.InitAndEnableFeature( + kFlocPagesWithAdResourcesDefaultIncludedInFlocComputation); + } + + protected: + base::test::ScopedFeatureList feature_list_; +}; + +TEST_F(FlocEligibilityUnitTestPagesWithAdResourcesDefaultIncluded, + OnAdResourceObserved) { + GURL url("https://foo.com"); + NavigateToPage(url, /*publicly_routable=*/true, + /*floc_permissions_policy_enabled=*/true); + + EXPECT_FALSE(IsUrlVisitEligibleToComputeFloc(url)); + + SimulateResourceDataUseUpdate(/*is_ad_resource=*/true); + EXPECT_TRUE(IsUrlVisitEligibleToComputeFloc(url)); +} + +TEST_F(FlocEligibilityUnitTestPagesWithAdResourcesDefaultIncluded, + OnNonAdResourceObserved) { + GURL url("https://foo.com"); + NavigateToPage(url, /*publicly_routable=*/true, + /*floc_permissions_policy_enabled=*/true); + + EXPECT_FALSE(IsUrlVisitEligibleToComputeFloc(url)); + + SimulateResourceDataUseUpdate(/*is_ad_resource=*/false); + EXPECT_FALSE(IsUrlVisitEligibleToComputeFloc(url)); +} + class FlocEligibilityIncognitoUnitTest : public FlocEligibilityUnitTest { public: FlocEligibilityIncognitoUnitTest() = default;
diff --git a/chrome/browser/file_system_access/chrome_file_system_access_permission_context_unittest.cc b/chrome/browser/file_system_access/chrome_file_system_access_permission_context_unittest.cc index 578b8a3c..e8f49e45 100644 --- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context_unittest.cc +++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context_unittest.cc
@@ -90,12 +90,11 @@ web_contents_ = content::WebContentsTester::CreateTestWebContents(&profile_, nullptr); FileSystemAccessPermissionRequestManager::CreateForWebContents( - web_contents_.get()); - content::WebContentsTester::For(web_contents_.get()) + web_contents()); + content::WebContentsTester::For(web_contents()) ->NavigateAndCommit(kTestOrigin.GetURL()); - FileSystemAccessPermissionRequestManager::FromWebContents( - web_contents_.get()) + FileSystemAccessPermissionRequestManager::FromWebContents(web_contents()) ->set_auto_response_for_test(PermissionAction::DISMISSED); permission_context_ = std::make_unique<TestFileSystemAccessPermissionContext>( @@ -680,7 +679,7 @@ GetWellKnownDirectoryPath_Base_OK) { base::ScopedPathOverride user_desktop_override( base::DIR_USER_DESKTOP, temp_dir_.GetPath(), true, true); - EXPECT_EQ(permission_context_->GetWellKnownDirectoryPath( + EXPECT_EQ(permission_context()->GetWellKnownDirectoryPath( blink::mojom::WellKnownDirectory::kDirDesktop), temp_dir_.GetPath()); } @@ -689,7 +688,7 @@ GetWellKnownDirectoryPath_Chrome_OK) { base::ScopedPathOverride user_documents_override( chrome::DIR_USER_DOCUMENTS, temp_dir_.GetPath(), true, true); - EXPECT_EQ(permission_context_->GetWellKnownDirectoryPath( + EXPECT_EQ(permission_context()->GetWellKnownDirectoryPath( blink::mojom::WellKnownDirectory::kDirDocuments), temp_dir_.GetPath()); } @@ -698,7 +697,7 @@ GetWellKnownDirectoryPath_Default) { base::ScopedPathOverride user_documents_override( chrome::DIR_USER_DOCUMENTS, temp_dir_.GetPath(), true, true); - EXPECT_EQ(permission_context_->GetWellKnownDirectoryPath( + EXPECT_EQ(permission_context()->GetWellKnownDirectoryPath( blink::mojom::WellKnownDirectory::kDefault), temp_dir_.GetPath()); } @@ -708,7 +707,7 @@ auto grant = permission_context()->GetReadPermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kLoadFromStorage); EXPECT_EQ(PermissionStatus::ASK, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kRead)); } @@ -717,7 +716,7 @@ auto grant = permission_context()->GetReadPermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kOpen); EXPECT_EQ(PermissionStatus::GRANTED, grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kRead)); } @@ -726,7 +725,7 @@ auto grant = permission_context()->GetReadPermissionGrant( kTestOrigin, kTestPath, HandleType::kDirectory, UserAction::kOpen); EXPECT_EQ(PermissionStatus::ASK, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kDirectory, GrantType::kRead)); } @@ -735,7 +734,7 @@ auto grant = permission_context()->GetWritePermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kLoadFromStorage); EXPECT_EQ(PermissionStatus::ASK, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } @@ -744,7 +743,7 @@ auto grant = permission_context()->GetWritePermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kOpen); EXPECT_EQ(PermissionStatus::ASK, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } @@ -753,7 +752,7 @@ auto grant = permission_context()->GetWritePermissionGrant( kTestOrigin, kTestPath, HandleType::kDirectory, UserAction::kOpen); EXPECT_EQ(PermissionStatus::ASK, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kDirectory, GrantType::kWrite)); } @@ -762,7 +761,7 @@ auto grant = permission_context()->GetWritePermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kSave); EXPECT_EQ(PermissionStatus::GRANTED, grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); // The existing grant should not change if the permission is blocked globally, @@ -772,7 +771,7 @@ EXPECT_EQ(PermissionStatus::GRANTED, grant->GetStatus()); // The persistent permission is inaccessible because of the BLOCK, but will // still exist until it expires. - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); // Getting a grant for the same file again should also not change the grant, @@ -780,7 +779,7 @@ grant = permission_context()->GetWritePermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kSave); EXPECT_EQ(PermissionStatus::GRANTED, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } @@ -796,7 +795,7 @@ EXPECT_EQ(grant1, grant2); EXPECT_EQ(grant1, grant3); EXPECT_EQ(PermissionStatus::GRANTED, grant1->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } @@ -821,7 +820,7 @@ kTestOrigin, kTestPath, HandleType::kFile, UserAction::kSave); EXPECT_EQ(PermissionStatus::GRANTED, grant->GetStatus()); // A valid persisted permission should be created. - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); grant.reset(); @@ -861,7 +860,7 @@ grant = permission_context()->GetWritePermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kOpen); EXPECT_EQ(PermissionStatus::ASK, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } @@ -876,7 +875,7 @@ EXPECT_EQ(PermissionStatus::DENIED, grant->GetStatus()); grant.reset(); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); SetContentSettingValueForOrigin(kTestOrigin, @@ -886,7 +885,7 @@ grant = permission_context()->GetWritePermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kSave); EXPECT_EQ(PermissionStatus::GRANTED, grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } @@ -907,7 +906,7 @@ EXPECT_EQ(grant1, grant2); EXPECT_EQ(grant1, grant3); EXPECT_EQ(PermissionStatus::DENIED, grant1->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } @@ -926,7 +925,7 @@ grant = permission_context()->GetWritePermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kOpen); EXPECT_EQ(PermissionStatus::DENIED, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } @@ -937,10 +936,10 @@ kTestOrigin, kTestPath, HandleType::kFile, UserAction::kSave); EXPECT_EQ(PermissionStatus::GRANTED, grant->GetStatus()); // Revoke active and persisted permissions. - permission_context_->RevokeGrants( + permission_context()->RevokeGrants( kTestOrigin, PersistedPermissionOptions::kUpdatePersistedPermission); grant.reset(); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); // After reset grant should go away, but the new grant request should be in @@ -955,7 +954,7 @@ // After the guard is blocked, the permission status for |grant| should remain // unchanged. EXPECT_EQ(PermissionStatus::ASK, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } @@ -966,10 +965,10 @@ kTestOrigin, kTestPath, HandleType::kFile, UserAction::kSave); EXPECT_EQ(PermissionStatus::GRANTED, grant->GetStatus()); // Revoke active and persisted permissions. - permission_context_->RevokeGrants( + permission_context()->RevokeGrants( kTestOrigin, PersistedPermissionOptions::kUpdatePersistedPermission); grant.reset(); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); // After reset grant should go away, but the new grant request should be in @@ -984,13 +983,13 @@ // After the guard is blocked, the permission status for |grant| should remain // unchanged. EXPECT_EQ(PermissionStatus::ASK, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } TEST_F(ChromeFileSystemAccessPermissionContextTest, GetReadPermissionGrant_InheritFromAncestor) { - FileSystemAccessPermissionRequestManager::FromWebContents(web_contents_.get()) + FileSystemAccessPermissionRequestManager::FromWebContents(web_contents()) ->set_auto_response_for_test(PermissionAction::GRANTED); auto dir_grant = permission_context()->GetReadPermissionGrant( @@ -1005,7 +1004,7 @@ })); loop.Run(); EXPECT_EQ(PermissionStatus::GRANTED, dir_grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kDirectory, GrantType::kRead)); // A file in |dir_path|'s directory should be auto-granted permissions. @@ -1013,13 +1012,13 @@ auto file_grant = permission_context()->GetReadPermissionGrant( kTestOrigin, file_path, HandleType::kFile, UserAction::kLoadFromStorage); EXPECT_EQ(PermissionStatus::GRANTED, file_grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, file_path, HandleType::kFile, GrantType::kRead)); } TEST_F(ChromeFileSystemAccessPermissionContextTest, GetWritePermissionGrant_InheritFromAncestor) { - FileSystemAccessPermissionRequestManager::FromWebContents(web_contents_.get()) + FileSystemAccessPermissionRequestManager::FromWebContents(web_contents()) ->set_auto_response_for_test(PermissionAction::GRANTED); auto dir_grant = permission_context()->GetWritePermissionGrant( @@ -1034,7 +1033,7 @@ })); loop.Run(); EXPECT_EQ(PermissionStatus::GRANTED, dir_grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kDirectory, GrantType::kWrite)); // A file in |dir_path|'s directory should be auto-granted permissions. @@ -1042,13 +1041,13 @@ auto file_grant = permission_context()->GetWritePermissionGrant( kTestOrigin, file_path, HandleType::kFile, UserAction::kLoadFromStorage); EXPECT_EQ(PermissionStatus::GRANTED, file_grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, file_path, HandleType::kFile, GrantType::kWrite)); } TEST_F(ChromeFileSystemAccessPermissionContextTest, DoNotInheritFromAncestorOfOppositeType) { - FileSystemAccessPermissionRequestManager::FromWebContents(web_contents_.get()) + FileSystemAccessPermissionRequestManager::FromWebContents(web_contents()) ->set_auto_response_for_test(PermissionAction::GRANTED); auto dir_grant = permission_context()->GetReadPermissionGrant( @@ -1063,7 +1062,7 @@ })); loop.Run(); EXPECT_EQ(PermissionStatus::GRANTED, dir_grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kDirectory, GrantType::kRead)); // |dir_path| has read permission while we're asking for write permission, so @@ -1072,13 +1071,13 @@ auto file_grant = permission_context()->GetWritePermissionGrant( kTestOrigin, file_path, HandleType::kFile, UserAction::kLoadFromStorage); EXPECT_EQ(PermissionStatus::ASK, file_grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, file_path, HandleType::kFile, GrantType::kWrite)); } TEST_F(ChromeFileSystemAccessPermissionContextTest, GetReadPermissionGrant_InheritFromPersistedAncestor) { - FileSystemAccessPermissionRequestManager::FromWebContents(web_contents_.get()) + FileSystemAccessPermissionRequestManager::FromWebContents(web_contents()) ->set_auto_response_for_test(PermissionAction::GRANTED); auto dir_grant = permission_context()->GetReadPermissionGrant( @@ -1093,7 +1092,7 @@ })); loop.Run(); EXPECT_EQ(PermissionStatus::GRANTED, dir_grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kDirectory, GrantType::kRead)); // Remove the active grant, but not the persisted permission. @@ -1115,13 +1114,13 @@ })); loop2.Run(); EXPECT_EQ(PermissionStatus::GRANTED, file_grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, file_path, HandleType::kFile, GrantType::kRead)); } TEST_F(ChromeFileSystemAccessPermissionContextTest, GetWritePermissionGrant_InheritFromPersistedAncestor) { - FileSystemAccessPermissionRequestManager::FromWebContents(web_contents_.get()) + FileSystemAccessPermissionRequestManager::FromWebContents(web_contents()) ->set_auto_response_for_test(PermissionAction::GRANTED); auto dir_grant = permission_context()->GetWritePermissionGrant( @@ -1136,7 +1135,7 @@ })); loop.Run(); EXPECT_EQ(PermissionStatus::GRANTED, dir_grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kDirectory, GrantType::kWrite)); // Remove the active grant, but not the persisted permission. @@ -1158,13 +1157,13 @@ })); loop2.Run(); EXPECT_EQ(PermissionStatus::GRANTED, file_grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, file_path, HandleType::kFile, GrantType::kWrite)); } TEST_F(ChromeFileSystemAccessPermissionContextTest, DoNotInheritFromPersistedAncestorOfOppositeType) { - FileSystemAccessPermissionRequestManager::FromWebContents(web_contents_.get()) + FileSystemAccessPermissionRequestManager::FromWebContents(web_contents()) ->set_auto_response_for_test(PermissionAction::GRANTED); auto dir_grant = permission_context()->GetReadPermissionGrant( @@ -1179,7 +1178,7 @@ })); loop.Run(); EXPECT_EQ(PermissionStatus::GRANTED, dir_grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kDirectory, GrantType::kRead)); // Remove the active grant, but not the persisted permission. @@ -1200,7 +1199,7 @@ })); loop2.Run(); EXPECT_EQ(PermissionStatus::GRANTED, file_grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, file_path, HandleType::kFile, GrantType::kWrite)); } @@ -1209,7 +1208,7 @@ auto grant = permission_context()->GetWritePermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kSave); EXPECT_EQ(PermissionStatus::GRANTED, grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); grant.reset(); @@ -1234,7 +1233,7 @@ })); loop.Run(); EXPECT_EQ(PermissionStatus::ASK, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } @@ -1244,10 +1243,10 @@ kTestOrigin, kTestPath, HandleType::kFile, UserAction::kSave); EXPECT_EQ(PermissionStatus::GRANTED, grant->GetStatus()); // Revoke active grant, but not persisted permission. - permission_context_->RevokeGrants( + permission_context()->RevokeGrants( kTestOrigin, PersistedPermissionOptions::kDoNotUpdatePersistedPermission); EXPECT_EQ(PermissionStatus::ASK, grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } @@ -1257,7 +1256,7 @@ kTestOrigin, kTestPath, HandleType::kFile, UserAction::kSave); EXPECT_EQ(PermissionStatus::GRANTED, grant->GetStatus()); grant.reset(); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); // After reset grant should go away, but the new grant request should be in @@ -1272,7 +1271,7 @@ // After the guard is blocked, the permission status for |grant| should remain // unchanged, but the persisted permission should not be accessible. EXPECT_EQ(PermissionStatus::ASK, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } @@ -1281,7 +1280,7 @@ auto grant = permission_context()->GetWritePermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kSave); EXPECT_EQ(PermissionStatus::GRANTED, grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); Advance(ChromeFileSystemAccessPermissionContext:: @@ -1289,8 +1288,8 @@ base::TimeDelta::FromSeconds(1)); auto advance_once = Now(); // The active grant exists, so its timestamp should have been updated. - permission_context_->UpdatePersistedPermissionsForTesting(); - auto objects = permission_context_->GetAllGrantedObjects(); + permission_context()->UpdatePersistedPermissionsForTesting(); + auto objects = permission_context()->GetAllGrantedObjects(); ASSERT_EQ(objects.size(), 1u); EXPECT_EQ(objects[0]->origin, kTestOrigin.GetURL()); EXPECT_EQ(util::ValueToTime(objects[0]->value.FindKey("time")), advance_once); @@ -1302,8 +1301,8 @@ Advance(ChromeFileSystemAccessPermissionContext:: kPersistentPermissionExpirationTimeoutNonPWA - base::TimeDelta::FromSeconds(1)); - permission_context_->UpdatePersistedPermissionsForTesting(); - objects = permission_context_->GetAllGrantedObjects(); + permission_context()->UpdatePersistedPermissionsForTesting(); + objects = permission_context()->GetAllGrantedObjects(); ASSERT_EQ(objects.size(), 1u); EXPECT_EQ(objects[0]->origin, kTestOrigin.GetURL()); EXPECT_EQ(util::ValueToTime(objects[0]->value.FindKey("time")), advance_once); @@ -1312,8 +1311,8 @@ Advance(ChromeFileSystemAccessPermissionContext:: kPersistentPermissionExpirationTimeoutNonPWA + base::TimeDelta::FromSeconds(1)); - permission_context_->UpdatePersistedPermissionsForTesting(); - objects = permission_context_->GetAllGrantedObjects(); + permission_context()->UpdatePersistedPermissionsForTesting(); + objects = permission_context()->GetAllGrantedObjects(); EXPECT_EQ(objects.size(), 0u); } @@ -1322,7 +1321,7 @@ auto grant = permission_context()->GetReadPermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kSave); EXPECT_EQ(PermissionStatus::GRANTED, grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kRead)); Advance(ChromeFileSystemAccessPermissionContext:: @@ -1330,8 +1329,8 @@ base::TimeDelta::FromSeconds(1)); auto advance_once = Now(); // The active grant exists, so its timestamp should have been updated. - permission_context_->UpdatePersistedPermissionsForTesting(); - auto objects = permission_context_->GetAllGrantedObjects(); + permission_context()->UpdatePersistedPermissionsForTesting(); + auto objects = permission_context()->GetAllGrantedObjects(); ASSERT_EQ(objects.size(), 1u); EXPECT_EQ(objects[0]->origin, kTestOrigin.GetURL()); EXPECT_EQ(util::ValueToTime(objects[0]->value.FindKey("time")), advance_once); @@ -1343,8 +1342,8 @@ Advance(ChromeFileSystemAccessPermissionContext:: kPersistentPermissionExpirationTimeoutNonPWA - base::TimeDelta::FromSeconds(1)); - permission_context_->UpdatePersistedPermissionsForTesting(); - objects = permission_context_->GetAllGrantedObjects(); + permission_context()->UpdatePersistedPermissionsForTesting(); + objects = permission_context()->GetAllGrantedObjects(); ASSERT_EQ(objects.size(), 1u); EXPECT_EQ(objects[0]->origin, kTestOrigin.GetURL()); EXPECT_EQ(util::ValueToTime(objects[0]->value.FindKey("time")), advance_once); @@ -1353,8 +1352,8 @@ Advance(ChromeFileSystemAccessPermissionContext:: kPersistentPermissionExpirationTimeoutNonPWA + base::TimeDelta::FromSeconds(1)); - permission_context_->UpdatePersistedPermissionsForTesting(); - objects = permission_context_->GetAllGrantedObjects(); + permission_context()->UpdatePersistedPermissionsForTesting(); + objects = permission_context()->GetAllGrantedObjects(); EXPECT_EQ(objects.size(), 0u); } @@ -1363,13 +1362,13 @@ auto grant1 = permission_context()->GetWritePermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kSave); EXPECT_EQ(PermissionStatus::GRANTED, grant1->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); auto grant2 = permission_context()->GetWritePermissionGrant( kTestOrigin2, kTestPath, HandleType::kFile, UserAction::kSave); EXPECT_EQ(PermissionStatus::GRANTED, grant2->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin2, kTestPath, HandleType::kFile, GrantType::kWrite)); grant1.reset(); @@ -1380,8 +1379,8 @@ base::TimeDelta::FromSeconds(1)); // Both grants are still valid. - permission_context_->UpdatePersistedPermissionsForTesting(); - auto objects = permission_context_->GetAllGrantedObjects(); + permission_context()->UpdatePersistedPermissionsForTesting(); + auto objects = permission_context()->GetAllGrantedObjects(); ASSERT_EQ(objects.size(), 2u); // Requesting permission for |grant2| should update its timestamp. @@ -1402,15 +1401,15 @@ Advance(base::TimeDelta::FromSeconds(2)); // Clean up |grant1|'s expired entry from HostContentSettingsMap. - permission_context_->UpdatePersistedPermissionsForTesting(); + permission_context()->UpdatePersistedPermissionsForTesting(); // Only |grant2| should be persisted. - objects = permission_context_->GetAllGrantedObjects(); + objects = permission_context()->GetAllGrantedObjects(); ASSERT_EQ(objects.size(), 1u); EXPECT_EQ(objects[0]->origin, kTestOrigin2.GetURL()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin2, kTestPath, HandleType::kFile, GrantType::kWrite)); } @@ -1421,13 +1420,13 @@ auto grant1 = permission_context()->GetWritePermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kSave); EXPECT_EQ(PermissionStatus::GRANTED, grant1->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); auto grant2 = permission_context()->GetWritePermissionGrant( kTestOrigin2, kTestPath, HandleType::kFile, UserAction::kSave); EXPECT_EQ(PermissionStatus::GRANTED, grant2->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin2, kTestPath, HandleType::kFile, GrantType::kWrite)); Advance(ChromeFileSystemAccessPermissionContext:: @@ -1446,7 +1445,7 @@ loop.Run(); // Only |grant2|'s timestamp should have been updated. - auto objects = permission_context_->GetAllGrantedObjects(); + auto objects = permission_context()->GetAllGrantedObjects(); ASSERT_EQ(objects.size(), 2u); EXPECT_EQ(objects[0]->origin, kTestOrigin.GetURL()); EXPECT_EQ(objects[1]->origin, kTestOrigin2.GetURL()); @@ -1461,7 +1460,7 @@ auto grant = permission_context()->GetWritePermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kSave); EXPECT_EQ(PermissionStatus::GRANTED, grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); grant.reset(); @@ -1477,7 +1476,7 @@ task_environment_.RunUntilIdle(); // The timestamp should not have been updated. - auto objects = permission_context_->GetAllGrantedObjects(); + auto objects = permission_context()->GetAllGrantedObjects(); ASSERT_EQ(objects.size(), 1u); EXPECT_EQ(objects[0]->origin, kTestOrigin.GetURL()); EXPECT_EQ(util::ValueToTime(objects[0]->value.FindKey("time")), initial_time); @@ -1493,7 +1492,7 @@ task_environment_.RunUntilIdle(); // The timestamp should not have been updated. - objects = permission_context_->GetAllGrantedObjects(); + objects = permission_context()->GetAllGrantedObjects(); ASSERT_EQ(objects.size(), 0u); } @@ -1540,7 +1539,7 @@ TEST_F(ChromeFileSystemAccessPermissionContextTest, RequestPermission_Dismissed) { - FileSystemAccessPermissionRequestManager::FromWebContents(web_contents_.get()) + FileSystemAccessPermissionRequestManager::FromWebContents(web_contents()) ->set_auto_response_for_test(PermissionAction::DISMISSED); content::RenderFrameHostTester::For(web_contents_->GetMainFrame()) ->SimulateUserActivation(); @@ -1558,12 +1557,12 @@ loop.Run(); // Dismissed, so status should not change. EXPECT_EQ(PermissionStatus::ASK, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } TEST_F(ChromeFileSystemAccessPermissionContextTest, RequestPermission_Granted) { - FileSystemAccessPermissionRequestManager::FromWebContents(web_contents_.get()) + FileSystemAccessPermissionRequestManager::FromWebContents(web_contents()) ->set_auto_response_for_test(PermissionAction::GRANTED); content::RenderFrameHostTester::For(web_contents_->GetMainFrame()) ->SimulateUserActivation(); @@ -1580,12 +1579,12 @@ })); loop.Run(); EXPECT_EQ(PermissionStatus::GRANTED, grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } TEST_F(ChromeFileSystemAccessPermissionContextTest, RequestPermission_Denied) { - FileSystemAccessPermissionRequestManager::FromWebContents(web_contents_.get()) + FileSystemAccessPermissionRequestManager::FromWebContents(web_contents()) ->set_auto_response_for_test(PermissionAction::DENIED); content::RenderFrameHostTester::For(web_contents_->GetMainFrame()) ->SimulateUserActivation(); @@ -1602,13 +1601,13 @@ })); loop.Run(); EXPECT_EQ(PermissionStatus::DENIED, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } TEST_F(ChromeFileSystemAccessPermissionContextTest, RequestPermission_NoUserActivation) { - FileSystemAccessPermissionRequestManager::FromWebContents(web_contents_.get()) + FileSystemAccessPermissionRequestManager::FromWebContents(web_contents()) ->set_auto_response_for_test(PermissionAction::GRANTED); auto grant = permission_context()->GetWritePermissionGrant( @@ -1624,13 +1623,13 @@ loop.Run(); // No user activation, so status should not change. EXPECT_EQ(PermissionStatus::ASK, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } TEST_F(ChromeFileSystemAccessPermissionContextTest, RequestPermission_NoUserActivation_UserActivationNotRequired) { - FileSystemAccessPermissionRequestManager::FromWebContents(web_contents_.get()) + FileSystemAccessPermissionRequestManager::FromWebContents(web_contents()) ->set_auto_response_for_test(PermissionAction::GRANTED); auto grant = permission_context()->GetWritePermissionGrant( @@ -1646,7 +1645,7 @@ loop.Run(); // No user activation, so status should not change. EXPECT_EQ(PermissionStatus::GRANTED, grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } @@ -1667,7 +1666,7 @@ })); loop.Run(); EXPECT_EQ(PermissionStatus::GRANTED, grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); } @@ -1691,7 +1690,7 @@ })); loop.Run(); EXPECT_EQ(PermissionStatus::DENIED, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); auto grant2 = permission_context()->GetWritePermissionGrant( @@ -1706,7 +1705,7 @@ })); loop2.Run(); EXPECT_EQ(PermissionStatus::DENIED, grant2->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin2, kTestPath, HandleType::kFile, GrantType::kWrite)); grant2.reset(); @@ -1726,7 +1725,7 @@ })); loop3.Run(); EXPECT_EQ(PermissionStatus::ASK, grant2->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin2, kTestPath, HandleType::kFile, GrantType::kWrite)); } @@ -1752,7 +1751,7 @@ })); loop.Run(); EXPECT_EQ(PermissionStatus::DENIED, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); base::RunLoop loop2; @@ -1764,7 +1763,7 @@ })); loop2.Run(); EXPECT_EQ(PermissionStatus::DENIED, grant2->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin2, kTestPath, HandleType::kFile, GrantType::kWrite)); grant.reset(); @@ -1787,7 +1786,7 @@ })); loop3.Run(); EXPECT_EQ(PermissionStatus::ASK, grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); base::RunLoop loop4; @@ -1799,7 +1798,7 @@ })); loop4.Run(); EXPECT_EQ(PermissionStatus::DENIED, grant2->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin2, kTestPath, HandleType::kFile, GrantType::kWrite)); } @@ -1819,27 +1818,27 @@ kChromeOrigin, kTestPath, HandleType::kFile, UserAction::kOpen); EXPECT_EQ(PermissionStatus::GRANTED, grant1->GetStatus()); // Permissions are not persisted for allowlisted origins. - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kChromeOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); auto grant2 = permission_context()->GetWritePermissionGrant( kChromeOrigin, kTestPath, HandleType::kDirectory, UserAction::kOpen); EXPECT_EQ(PermissionStatus::GRANTED, grant2->GetStatus()); // Permissions are not persisted for allowlisted origins. - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kChromeOrigin, kTestPath, HandleType::kDirectory, GrantType::kWrite)); // Other origin should gets blocked. auto grant3 = permission_context()->GetWritePermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kOpen); EXPECT_EQ(PermissionStatus::DENIED, grant3->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); auto grant4 = permission_context()->GetWritePermissionGrant( kTestOrigin, kTestPath, HandleType::kDirectory, UserAction::kOpen); EXPECT_EQ(PermissionStatus::DENIED, grant4->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kDirectory, GrantType::kWrite)); } @@ -1859,7 +1858,7 @@ kChromeOrigin, kTestPath, HandleType::kFile, UserAction::kOpen); EXPECT_EQ(PermissionStatus::GRANTED, grant1->GetStatus()); // Permissions are not persisted for allowlisted origins. - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kChromeOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); // Existing grant (file). @@ -1872,7 +1871,7 @@ kChromeOrigin, kTestPath, HandleType::kDirectory, UserAction::kOpen); EXPECT_EQ(PermissionStatus::GRANTED, grant3->GetStatus()); // Permissions are not persisted for allowlisted origins. - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kChromeOrigin, kTestPath, HandleType::kDirectory, GrantType::kWrite)); // Existing grant (directory). @@ -1886,19 +1885,19 @@ auto file_grant = permission_context()->GetReadPermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kOpen); EXPECT_EQ(PermissionStatus::GRANTED, file_grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kRead)); auto directory_grant = permission_context()->GetReadPermissionGrant( kTestOrigin, kTestPath, HandleType::kDirectory, UserAction::kOpen); EXPECT_EQ(PermissionStatus::ASK, directory_grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kDirectory, GrantType::kRead)); // Requesting a permission grant for a directory which was previously a file // should have revoked the original file permission. EXPECT_EQ(PermissionStatus::DENIED, file_grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kRead)); } @@ -1907,19 +1906,19 @@ auto file_grant = permission_context()->GetWritePermissionGrant( kTestOrigin, kTestPath, HandleType::kFile, UserAction::kSave); EXPECT_EQ(PermissionStatus::GRANTED, file_grant->GetStatus()); - EXPECT_TRUE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); auto directory_grant = permission_context()->GetWritePermissionGrant( kTestOrigin, kTestPath, HandleType::kDirectory, UserAction::kOpen); EXPECT_EQ(PermissionStatus::ASK, directory_grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kDirectory, GrantType::kWrite)); // Requesting a permission grant for a directory which was previously a file // should have revoked the original file permission. EXPECT_EQ(PermissionStatus::DENIED, file_grant->GetStatus()); - EXPECT_FALSE(permission_context_->HasPersistedPermissionForTesting( + EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); }
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index dbbee88..88366d3 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -4631,6 +4631,11 @@ "expiry_milestone": 93 }, { + "name": "scrollable-tabstrip-buttons", + "owners": [ "chrome-desktop-ui-sea@google.com", "tbergquist" ], + "expiry_milestone": 93 + }, + { "name": "sct-auditing", "owners": [ "cthomp", "estark", "jdeblasio" ], "expiry_milestone": 92 @@ -4681,6 +4686,11 @@ "expiry_milestone": 93 }, { + "name": "service-worker-subresource-filter", + "owners": [ "noahlemen@fb.com", "browsers@fb.com" ], + "expiry_milestone": 95 + }, + { "name": "set-market-url-for-testing", "owners": [ "//chrome/android/java/src/org/chromium/chrome/browser/omaha/OWNERS" ], // This is required by test teams to verify functionality on devices which
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index eeb02a758..643091d4 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -2166,6 +2166,11 @@ const char kScrollableTabStripDescription[] = "Enables tab strip to scroll left and right when full."; +const char kScrollableTabStripButtonsName[] = "Tab Scrolling Buttons"; +const char kScrollableTabStripButtonsDescription[] = + "When the scrollable-tabstrip flag is enabled, this enables buttons to " + "permanently appear on the tabstrip."; + const char kScrollUnificationName[] = "Scroll Unification"; const char kScrollUnificationDescription[] = "Refactoring project that eliminates scroll handling code from Blink. " @@ -2195,6 +2200,12 @@ const char kSidePanelPrototypeDescription[] = "Display a prototype of the side panel."; +const char kServiceWorkerSubresourceFilterName[] = + "ServiceWorker subresource filter"; +const char kServiceWorkerSubresourceFilterDescription[] = + "Enables an experimental API to specify subresource URLs that bypass " + "service workers"; + const char kSharedClipboardUIName[] = "Enable shared clipboard feature signals to be handled"; const char kSharedClipboardUIDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index e760073..08dca52f 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -1252,6 +1252,9 @@ extern const char kScrollableTabStripName[]; extern const char kScrollableTabStripDescription[]; +extern const char kScrollableTabStripButtonsName[]; +extern const char kScrollableTabStripButtonsDescription[]; + extern const char kScrollUnificationName[]; extern const char kScrollUnificationDescription[]; @@ -1270,6 +1273,9 @@ extern const char kSidePanelPrototypeName[]; extern const char kSidePanelPrototypeDescription[]; +extern const char kServiceWorkerSubresourceFilterName[]; +extern const char kServiceWorkerSubresourceFilterDescription[]; + extern const char kSharedClipboardUIName[]; extern const char kSharedClipboardUIDescription[];
diff --git a/chrome/browser/nearby_sharing/instantmessaging/receive_messages_express.cc b/chrome/browser/nearby_sharing/instantmessaging/receive_messages_express.cc index c9f4074..56d0498 100644 --- a/chrome/browser/nearby_sharing/instantmessaging/receive_messages_express.cc +++ b/chrome/browser/nearby_sharing/instantmessaging/receive_messages_express.cc
@@ -75,12 +75,12 @@ return NearbyShareHttpStatus(loader->NetError(), loader->ResponseInfo()); } -void LogReceiveResult( - bool success, - const base::Optional<NearbyShareHttpStatus>& http_status) { +void LogReceiveResult(bool success, + const base::Optional<NearbyShareHttpStatus>& http_status, + const std::string& request_id) { std::stringstream ss; ss << "Instant messaging receive express " - << (success ? "succeeded." : "failed."); + << (success ? "succeeded" : "failed") << " for request " << request_id; base::UmaHistogramBoolean( "Nearby.Connections.InstantMessaging.ReceiveExpress.Result", success); if (http_status) { @@ -111,13 +111,12 @@ StartReceivingMessagesCallback callback, signin::IdentityManager* identity_manager, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) { - NS_LOG(INFO) << __func__ << ": self_id=" << self_id - << ", location hint=" << location_hint->location - << ", location format=" << location_hint->format; - chrome_browser_nearby_sharing_instantmessaging::ReceiveMessagesExpressRequest request = BuildReceiveRequest(self_id, std::move(location_hint)); + NS_LOG(INFO) << __func__ << ": self_id=" << self_id + << ", request id=" << request.header().request_id(); + auto receive_messages_express = base::WrapUnique( new ReceiveMessagesExpress(std::move(incoming_messages_listener), identity_manager, url_loader_factory)); @@ -150,7 +149,9 @@ ReceiveMessagesExpress::~ReceiveMessagesExpress() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - NS_LOG(VERBOSE) << __func__ << ": Receive messages session going down"; + NS_LOG(VERBOSE) << __func__ + << ": Receive messages session going down, request id=" + << request_id_; fast_path_ready_timeout_timer_.Stop(); @@ -170,6 +171,8 @@ DCHECK(!url_loader_); NS_LOG(VERBOSE) << "ReceiveMessagesExpress::StartReceivingMessages() called."; + request_id_ = request.header().request_id(); + // Used to complete the initial mojo call once fast path is received. start_receiving_messages_callback_ = std::move(start_receiving_messages_callback); @@ -276,7 +279,7 @@ << ", net::Error " << url_loader_->NetError(); if (start_receiving_messages_callback_) { - LogReceiveResult(success, http_status); + LogReceiveResult(success, http_status, request_id_); // If we have not called start_receiving_messages_callback_ yet, we // consider that a failure and need to complete the mojo call with a // failure. @@ -299,7 +302,8 @@ NS_LOG(VERBOSE) << __func__; fast_path_ready_timeout_timer_.Stop(); if (start_receiving_messages_callback_) { - LogReceiveResult(/*success=*/true, /*http_status=*/base::nullopt); + LogReceiveResult(/*success=*/true, /*http_status=*/base::nullopt, + request_id_); std::move(start_receiving_messages_callback_) .Run(true, std::move(self_pending_remote_)); }
diff --git a/chrome/browser/nearby_sharing/instantmessaging/receive_messages_express.h b/chrome/browser/nearby_sharing/instantmessaging/receive_messages_express.h index a2cdf09..dab5ed1 100644 --- a/chrome/browser/nearby_sharing/instantmessaging/receive_messages_express.h +++ b/chrome/browser/nearby_sharing/instantmessaging/receive_messages_express.h
@@ -102,6 +102,7 @@ std::unique_ptr<network::SimpleURLLoader> url_loader_; StreamParser stream_parser_; base::OneShotTimer fast_path_ready_timeout_timer_; + std::string request_id_; SEQUENCE_CHECKER(sequence_checker_);
diff --git a/chrome/browser/nearby_sharing/instantmessaging/send_message_express.cc b/chrome/browser/nearby_sharing/instantmessaging/send_message_express.cc index b0c2c66f..6befb43 100644 --- a/chrome/browser/nearby_sharing/instantmessaging/send_message_express.cc +++ b/chrome/browser/nearby_sharing/instantmessaging/send_message_express.cc
@@ -59,10 +59,12 @@ } })"); -void LogSendResult(bool success, const NearbyShareHttpStatus& http_status) { +void LogSendResult(bool success, + const NearbyShareHttpStatus& http_status, + const std::string& request_id) { std::stringstream ss; ss << "Instant messaging send express " << (success ? "succeeded" : "failed") - << ". HTTP status: " << http_status; + << " for request " << request_id << ". HTTP status: " << http_status; if (success) { NS_LOG(VERBOSE) << ss.str(); } else { @@ -111,7 +113,7 @@ return; } - std::string message_id = request.header().requester_id().id(); + std::string request_id = request.header().request_id(); auto resource_request = std::make_unique<network::ResourceRequest>(); resource_request->url = GURL(kInstantMessagingSendMessageAPI); @@ -132,13 +134,13 @@ send_url_loader_ptr->DownloadToString( url_loader_factory_.get(), base::BindOnce(&SendMessageExpress::OnSendMessageResponse, - weak_ptr_factory_.GetWeakPtr(), message_id, + weak_ptr_factory_.GetWeakPtr(), request_id, std::move(send_url_loader), std::move(callback)), kMaxSendResponseSize); } void SendMessageExpress::OnSendMessageResponse( - const std::string& message_id, + const std::string& request_id, std::unique_ptr<network::SimpleURLLoader> url_loader, SuccessCallback callback, std::unique_ptr<std::string> response_body) { @@ -146,7 +148,7 @@ url_loader->ResponseInfo()); bool success = http_status.IsSuccess() && response_body && !response_body->empty(); - LogSendResult(success, http_status); + LogSendResult(success, http_status, request_id); std::move(callback).Run(success); // NOTE: |this| might be destroyed here after running the callback }
diff --git a/chrome/browser/nearby_sharing/instantmessaging/stream_parser.cc b/chrome/browser/nearby_sharing/instantmessaging/stream_parser.cc index fe26f13..9bed517 100644 --- a/chrome/browser/nearby_sharing/instantmessaging/stream_parser.cc +++ b/chrome/browser/nearby_sharing/instantmessaging/stream_parser.cc
@@ -4,9 +4,20 @@ #include "chrome/browser/nearby_sharing/instantmessaging/stream_parser.h" +#include "base/metrics/histogram_functions.h" #include "chrome/browser/nearby_sharing/instantmessaging/proto/instantmessaging.pb.h" #include "chrome/browser/nearby_sharing/logging/logging.h" +namespace { + +void RecordNumParsingAttemptsMetrics(int num_attempts) { + base::UmaHistogramCounts1000( + "Nearby.Connections.InstantMessaging.ReceiveExpress.NumParsingAttempts", + num_attempts); +} + +} // namespace + StreamParser::StreamParser( base::RepeatingCallback<void(const std::string& message)> listener, base::OnceClosure fastpath_ready_callback) @@ -43,19 +54,25 @@ // individual messages sent by WebRTC are small, so check that first to // speed up parsing. chrome_browser_nearby_sharing_instantmessaging::StreamBody stream_body; + ++parsing_counter_for_metrics_; if (stream_body.ParseFromString(data_)) { data_.clear(); + RecordNumParsingAttemptsMetrics(parsing_counter_for_metrics_); + parsing_counter_for_metrics_ = 0; return stream_body; } int end_pos = 1; int size = data_.size(); while (end_pos < size) { + ++parsing_counter_for_metrics_; // TODO(crbug.com/1123169) - Optimize this function to use header // information to figure out the start and end of proto instead of checking // for every length. if (stream_body.ParseFromArray(data_.data(), end_pos)) { data_.erase(data_.begin(), data_.begin() + end_pos); + RecordNumParsingAttemptsMetrics(parsing_counter_for_metrics_); + parsing_counter_for_metrics_ = 0; return stream_body; } end_pos++;
diff --git a/chrome/browser/nearby_sharing/instantmessaging/stream_parser.h b/chrome/browser/nearby_sharing/instantmessaging/stream_parser.h index 4402ea4..fca03ca 100644 --- a/chrome/browser/nearby_sharing/instantmessaging/stream_parser.h +++ b/chrome/browser/nearby_sharing/instantmessaging/stream_parser.h
@@ -36,6 +36,7 @@ base::RepeatingCallback<void(const std::string& message)> listener_; base::OnceClosure fastpath_ready_callback_; std::string data_; + int parsing_counter_for_metrics_ = 0; }; #endif // CHROME_BROWSER_NEARBY_SHARING_INSTANTMESSAGING_STREAM_PARSER_H_
diff --git a/chrome/browser/nearby_sharing/webrtc_request_builder.cc b/chrome/browser/nearby_sharing/webrtc_request_builder.cc index 9fb26e0..5fc2bc0 100644 --- a/chrome/browser/nearby_sharing/webrtc_request_builder.cc +++ b/chrome/browser/nearby_sharing/webrtc_request_builder.cc
@@ -6,6 +6,7 @@ #include "base/check.h" #include "base/i18n/timezone.h" +#include "base/unguessable_token.h" #include "chrome/browser/nearby_sharing/instantmessaging/proto/instantmessaging.pb.h" namespace { @@ -51,6 +52,7 @@ const std::string& requester_id, sharing::mojom::LocationHintPtr location_hint) { DCHECK(header); + header->set_request_id(base::UnguessableToken::Create().ToString()); header->set_app(kAppName); BuildId(header->mutable_requester_id(), requester_id, std::move(location_hint));
diff --git a/chrome/browser/nearby_sharing/webrtc_request_builder_unittest.cc b/chrome/browser/nearby_sharing/webrtc_request_builder_unittest.cc index 7dc561c9..2742050 100644 --- a/chrome/browser/nearby_sharing/webrtc_request_builder_unittest.cc +++ b/chrome/browser/nearby_sharing/webrtc_request_builder_unittest.cc
@@ -58,6 +58,7 @@ sharing::mojom::LocationHintPtr location_hint = CountryCodeLocationHint("ZZ"); chrome_browser_nearby_sharing_instantmessaging::SendMessageExpressRequest request = BuildSendRequest(kSelfId, kPeerId, location_hint.Clone()); + EXPECT_NE("", request.header().request_id()); EXPECT_EQ(kSelfId, request.header().requester_id().id()); EXPECT_EQ(kPeerId, request.dest_id().id()); VerifyLocationHint(location_hint.Clone(), request.dest_id()); @@ -68,6 +69,16 @@ sharing::mojom::LocationHintPtr location_hint = CallingCodeLocationHint("+1"); chrome_browser_nearby_sharing_instantmessaging::ReceiveMessagesExpressRequest request = BuildReceiveRequest(kSelfId, location_hint.Clone()); + EXPECT_NE("", request.header().request_id()); EXPECT_EQ(kSelfId, request.header().requester_id().id()); VerifyLocationHint(location_hint.Clone(), request.header().requester_id()); } + +TEST_F(WebRtcRequestBuilderTest, RequestIdsAreUnique) { + sharing::mojom::LocationHintPtr location_hint = CountryCodeLocationHint("ZZ"); + chrome_browser_nearby_sharing_instantmessaging::SendMessageExpressRequest + request_a = BuildSendRequest(kSelfId, kPeerId, location_hint.Clone()); + chrome_browser_nearby_sharing_instantmessaging::SendMessageExpressRequest + request_b = BuildSendRequest(kSelfId, kPeerId, location_hint.Clone()); + EXPECT_NE(request_a.header().request_id(), request_b.header().request_id()); +}
diff --git a/chrome/browser/nearby_sharing/webrtc_signaling_messenger.cc b/chrome/browser/nearby_sharing/webrtc_signaling_messenger.cc index 1204c44..1b06ad4 100644 --- a/chrome/browser/nearby_sharing/webrtc_signaling_messenger.cc +++ b/chrome/browser/nearby_sharing/webrtc_signaling_messenger.cc
@@ -24,15 +24,14 @@ sharing::mojom::LocationHintPtr location_hint, const std::string& message, SendMessageCallback callback) { - NS_LOG(VERBOSE) << __func__ << ": self_id=" << self_id - << ", peer_id=" << peer_id - << ", location hint=" << location_hint->location - << ", location format=" << location_hint->format - << ", message size=" << message.size(); - chrome_browser_nearby_sharing_instantmessaging::SendMessageExpressRequest request = BuildSendRequest(self_id, peer_id, std::move(location_hint)); + NS_LOG(VERBOSE) << __func__ << ": self_id=" << self_id + << ", peer_id=" << peer_id + << ", request_id=" << request.header().request_id() + << ", message size=" << message.size(); + chrome_browser_nearby_sharing_instantmessaging::InboxMessage* inbox_message = request.mutable_message(); inbox_message->set_message_id(base::Token::CreateRandom().ToString());
diff --git a/chrome/browser/permissions/permission_request_manager_browsertest.cc b/chrome/browser/permissions/permission_request_manager_browsertest.cc index bca52cf..f9b319cb 100644 --- a/chrome/browser/permissions/permission_request_manager_browsertest.cc +++ b/chrome/browser/permissions/permission_request_manager_browsertest.cc
@@ -350,8 +350,8 @@ // Prompts are only shown for active tabs and (on Desktop) hidden on tab // switching -// Flaky on Win bots crbug.com/1003747. -#if defined(OS_WIN) +// Flaky on Win and Linux bots crbug.com/1003747. +#if defined(OS_WIN) || defined(OS_LINUX) #define MAYBE_MultipleTabs DISABLED_MultipleTabs #else #define MAYBE_MultipleTabs MultipleTabs
diff --git a/chrome/browser/prefetch/search_prefetch/field_trial_settings.cc b/chrome/browser/prefetch/search_prefetch/field_trial_settings.cc index 0608f31..2566a1b 100644 --- a/chrome/browser/prefetch/search_prefetch/field_trial_settings.cc +++ b/chrome/browser/prefetch/search_prefetch/field_trial_settings.cc
@@ -7,6 +7,7 @@ #include <string> #include "base/command_line.h" +#include "base/metrics/field_trial_params.h" #include "base/system/sys_info.h" // Enables the feature completely with a few skipped checks to make local
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 4213b8c..592f49a 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc
@@ -341,7 +341,7 @@ #include "chrome/browser/ui/app_list/app_list_syncable_service.h" #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" #include "chrome/browser/ui/app_list/search/arc/arc_app_reinstall_search_provider.h" -#include "chrome/browser/ui/ash/chrome_launcher_prefs.h" +#include "chrome/browser/ui/ash/chrome_shelf_prefs.h" #include "chrome/browser/ui/webui/certificates_handler.h" #include "chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h" @@ -1144,7 +1144,7 @@ registry); policy::StatusCollector::RegisterProfilePrefs(registry); chromeos::SystemProxyManager::RegisterProfilePrefs(registry); - RegisterChromeLauncherUserPrefs(registry); + RegisterChromeShelfProfilePrefs(registry); ::onc::RegisterProfilePrefs(registry); ash::cert_provisioning::RegisterProfilePrefs(registry); borealis::prefs::RegisterProfilePrefs(registry);
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js index a342051..5bb64259 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js
@@ -2046,7 +2046,7 @@ .expectSpeech('Name:') .expectSpeech('Edit text') .expectSpeech('Required') - .expectSpeech('Alert') + .expectNextSpeechUtteranceIsNot('Alert') .expectSpeech('Please enter name') .replay(); }); @@ -2934,7 +2934,7 @@ mockFeedback .call(DesktopAutomationHandler.instance.onAlert.bind( DesktopAutomationHandler.instance, alertEvt)) - .expectSpeech('Alert') + .expectNextSpeechUtteranceIsNot('Alert') .expectSpeech('hello world') .replay(); });
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/desktop_automation_handler.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/desktop_automation_handler.js index b52ca1a..9f77af65 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/desktop_automation_handler.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/desktop_automation_handler.js
@@ -183,7 +183,7 @@ .withSpeechAndBraille(range, null, evt.type); // A workaround for alert nodes that contain no actual content. - if (output.toString() !== (Msgs.getMsg('role_alert'))) { + if (output.toString()) { output.go(); } }
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output.js index 393058d..c50b917 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output.js
@@ -2919,10 +2919,7 @@ } }, alert: { - default: { - speak: `$earcon(ALERT_NONMODAL) @role_alert - $nameOrTextContent $description` - } + default: {speak: `$earcon(ALERT_NONMODAL) $nameOrTextContent $description`} } };
diff --git a/chrome/browser/resources/new_tab_page/modules/drive/module.html b/chrome/browser/resources/new_tab_page/modules/drive/module.html index 337efb1..cc2797ea 100644 --- a/chrome/browser/resources/new_tab_page/modules/drive/module.html +++ b/chrome/browser/resources/new_tab_page/modules/drive/module.html
@@ -1,79 +1,69 @@ <style> :host { - --ntp-modules-drive-row-margin: 15px; display: block; height: 100%; width: 100%; } + ntp-module-header { + margin-bottom: 8px; + } + #files { display: flex; flex-direction: column; + margin-bottom: 7px; } .file { - align-items: center; - border-top: 0.5px solid var(--ntp-border-color); + box-sizing: border-box; color: var(--cr-primary-text-color); display: flex; flex-shrink: 0; - height: 55px; - margin-inline-end: var(--ntp-modules-drive-row-margin); - margin-inline-start: var(--ntp-modules-drive-row-margin); + height: 56px; + outline: none; + padding: 8px 18px; text-decoration: none; } .file:hover { background-color: var(--ntp-hover-background-color); - margin-inline-end: 0; - margin-inline-start: 0; - padding-inline-end: var(--ntp-modules-drive-row-margin); - padding-inline-start: var(--ntp-modules-drive-row-margin); } - .file:hover + .file { - margin-inline-end: 0; - margin-inline-start: 0; - padding-inline-end: var(--ntp-modules-drive-row-margin); - padding-inline-start: var(--ntp-modules-drive-row-margin); + .file:active, + :host-context(.focus-outline-visible) .file:focus { + background-color: var(--ntp-active-background-color); } .file-icon { - margin-inline-end: 8px; - } - - .file-title { - flex-basis: 0; - flex-grow: 260; - margin-inline-end: 34px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - - .file-description { - color: var(--cr-secondary-text-color); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; + height: 19px; + margin-inline-end: 19px; + margin-top: 3px; + object-fit: contain; + width: 19px; } .file-info { display: flex; + flex-direction: column; + width: 100%; } - .justification-container { - align-items: center; - display: flex; - flex-basis: 0; - flex-grow: 210; + .file-title, + .file-description { + line-height: 20px; overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } - .user-image { - border-radius: 50%; - margin-inline-end: 8px; - max-height: 16px; + .file-title { + font-size: 13px; + } + + .file-description { + color: var(--cr-secondary-text-color); + font-size: 12px; } </style> <ntp-module-header @@ -93,16 +83,8 @@ draggable="false" auto-src="[[getImageSrc_(item)]]"> </img> - <div class="file-title" title="[[item.title]]">[[item.title]]</div> - <div class="justification-container"> - <template is="dom-if" if="[[item.untrustedPhotoUrl]]"> - <img - is="ntp-img" - class="user-image" - draggable="false" - auto-src="[[item.untrustedPhotoUrl.url]]"> - </img> - </template> + <div class="file-info"> + <div class="file-title">[[item.title]]</div> <div class="file-description">[[item.justificationText]]</div> </div> </a>
diff --git a/chrome/browser/resources/new_tab_page/modules/drive/module.js b/chrome/browser/resources/new_tab_page/modules/drive/module.js index ad114a0a..c87bd614 100644 --- a/chrome/browser/resources/new_tab_page/modules/drive/module.js +++ b/chrome/browser/resources/new_tab_page/modules/drive/module.js
@@ -35,12 +35,6 @@ }; } - constructor() { - super(); - /** @private {IntersectionObserver} */ - this.intersectionObserver_ = null; - } - /** @private */ onDisableButtonClick_() { this.dispatchEvent(new CustomEvent('disable-module', { @@ -60,7 +54,7 @@ * @private */ getImageSrc_(file) { - return 'https://drive-thirdparty.googleusercontent.com/16/type/' + + return 'https://drive-thirdparty.googleusercontent.com/32/type/' + file.mimeType; }
diff --git a/chrome/browser/resources/welcome/BUILD.gn b/chrome/browser/resources/welcome/BUILD.gn index 6bd3856..81d73b0 100644 --- a/chrome/browser/resources/welcome/BUILD.gn +++ b/chrome/browser/resources/welcome/BUILD.gn
@@ -165,7 +165,6 @@ } js_library("landing_view_proxy") { - deps = [ "//ui/webui/resources/js:cr.m" ] externs_list = [ "$externs_path/metrics_private.js" ] } @@ -180,7 +179,6 @@ } js_library("signin_view_proxy") { - deps = [ "//ui/webui/resources/js:cr.m" ] externs_list = [ "$externs_path/metrics_private.js" ] } @@ -205,7 +203,6 @@ } js_library("welcome_browser_proxy") { - deps = [ "//ui/webui/resources/js:cr.m" ] externs_list = [ "$externs_path/chrome_send.js" ] }
diff --git a/chrome/browser/resources/welcome/google_apps/google_app_proxy.js b/chrome/browser/resources/welcome/google_apps/google_app_proxy.js index 63d890d8..f5a3a1d 100644 --- a/chrome/browser/resources/welcome/google_apps/google_app_proxy.js +++ b/chrome/browser/resources/welcome/google_apps/google_app_proxy.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js'; +import {sendWithPromise} from 'chrome://resources/js/cr.m.js'; import {BookmarkListItem} from '../shared/nux_types.js'; /** @@ -61,6 +61,17 @@ 'FirstRun.NewUserExperience.GoogleAppsSelection', providerId, Object.keys(NuxGoogleAppsSelections).length); } + + /** @return {!GoogleAppProxy} */ + static getInstance() { + return instance || (instance = new GoogleAppProxyImpl()); + } + + /** @param {!GoogleAppProxy} obj */ + static setInstance(obj) { + instance = obj; + } } -addSingletonGetter(GoogleAppProxyImpl); +/** @type {?GoogleAppProxy} */ +let instance = null;
diff --git a/chrome/browser/resources/welcome/google_apps/google_apps_metrics_proxy.js b/chrome/browser/resources/welcome/google_apps/google_apps_metrics_proxy.js index 529d4d63..18ba9bb 100644 --- a/chrome/browser/resources/welcome/google_apps/google_apps_metrics_proxy.js +++ b/chrome/browser/resources/welcome/google_apps/google_apps_metrics_proxy.js
@@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {addSingletonGetter} from 'chrome://resources/js/cr.m.js'; import {ModuleMetricsProxyImpl, NuxGoogleAppsInteractions} from '../shared/module_metrics_proxy.js'; export class GoogleAppsMetricsProxyImpl extends ModuleMetricsProxyImpl { @@ -11,6 +10,17 @@ 'FirstRun.NewUserExperience.GoogleAppsInteraction', NuxGoogleAppsInteractions); } + + /** @return {!GoogleAppsMetricsProxyImpl} */ + static getInstance() { + return instance || (instance = new GoogleAppsMetricsProxyImpl()); + } + + /** @param {!GoogleAppsMetricsProxyImpl} obj */ + static setInstance(obj) { + instance = obj; + } } -addSingletonGetter(GoogleAppsMetricsProxyImpl); +/** @type {?GoogleAppsMetricsProxyImpl} */ +let instance = null;
diff --git a/chrome/browser/resources/welcome/landing_view_proxy.js b/chrome/browser/resources/welcome/landing_view_proxy.js index 99e9819..993e2a12 100644 --- a/chrome/browser/resources/welcome/landing_view_proxy.js +++ b/chrome/browser/resources/welcome/landing_view_proxy.js
@@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {addSingletonGetter} from 'chrome://resources/js/cr.m.js'; - const NUX_LANDING_PAGE_INTERACTION_METRIC_NAME = 'FirstRun.NewUserExperience.LandingPageInteraction'; @@ -65,6 +63,17 @@ NUX_LANDING_PAGE_INTERACTION_METRIC_NAME, interaction, NUX_LANDING_PAGE_INTERACTIONS_COUNT); } + + /** @return {!LandingViewProxy} */ + static getInstance() { + return instance || (instance = new LandingViewProxyImpl()); + } + + /** @param {!LandingViewProxy} obj */ + static setInstance(obj) { + instance = obj; + } } -addSingletonGetter(LandingViewProxyImpl); +/** @type {?LandingViewProxy} */ +let instance = null;
diff --git a/chrome/browser/resources/welcome/ntp_background/BUILD.gn b/chrome/browser/resources/welcome/ntp_background/BUILD.gn index ca4e0c5..d820305 100644 --- a/chrome/browser/resources/welcome/ntp_background/BUILD.gn +++ b/chrome/browser/resources/welcome/ntp_background/BUILD.gn
@@ -22,10 +22,7 @@ } js_library("ntp_background_metrics_proxy") { - deps = [ - "../shared:module_metrics_proxy", - "//ui/webui/resources/js:cr.m", - ] + deps = [ "../shared:module_metrics_proxy" ] } html_to_js("web_components") {
diff --git a/chrome/browser/resources/welcome/ntp_background/ntp_background_metrics_proxy.js b/chrome/browser/resources/welcome/ntp_background/ntp_background_metrics_proxy.js index 114e561..531d7f3c 100644 --- a/chrome/browser/resources/welcome/ntp_background/ntp_background_metrics_proxy.js +++ b/chrome/browser/resources/welcome/ntp_background/ntp_background_metrics_proxy.js
@@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {addSingletonGetter} from 'chrome://resources/js/cr.m.js'; import {ModuleMetricsProxyImpl, NuxNtpBackgroundInteractions} from '../shared/module_metrics_proxy.js'; export class NtpBackgroundMetricsProxyImpl extends ModuleMetricsProxyImpl { @@ -15,6 +14,17 @@ getInteractions() { return this.interactions_; } + + /** @return {!NtpBackgroundMetricsProxyImpl} */ + static getInstance() { + return instance || (instance = new NtpBackgroundMetricsProxyImpl()); + } + + /** @param {!NtpBackgroundMetricsProxyImpl} obj */ + static setInstance(obj) { + instance = obj; + } } -addSingletonGetter(NtpBackgroundMetricsProxyImpl); +/** @type {?NtpBackgroundMetricsProxyImpl} */ +let instance = null;
diff --git a/chrome/browser/resources/welcome/ntp_background/ntp_background_proxy.js b/chrome/browser/resources/welcome/ntp_background/ntp_background_proxy.js index 6f86f16..d376ed8 100644 --- a/chrome/browser/resources/welcome/ntp_background/ntp_background_proxy.js +++ b/chrome/browser/resources/welcome/ntp_background/ntp_background_proxy.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js'; +import {sendWithPromise} from 'chrome://resources/js/cr.m.js'; import {NtpBackgroundMetricsProxyImpl} from './ntp_background_metrics_proxy.js'; /** @@ -92,6 +92,17 @@ setBackground(id) { chrome.send('setBackground', [id]); } + + /** @return {!NtpBackgroundProxy} */ + static getInstance() { + return instance || (instance = new NtpBackgroundProxyImpl()); + } + + /** @param {!NtpBackgroundProxy} obj */ + static setInstance(obj) { + instance = obj; + } } -addSingletonGetter(NtpBackgroundProxyImpl); +/** @type {?NtpBackgroundProxy} */ +let instance = null;
diff --git a/chrome/browser/resources/welcome/set_as_default/nux_set_as_default_proxy.js b/chrome/browser/resources/welcome/set_as_default/nux_set_as_default_proxy.js index 33266da..1cc30d3 100644 --- a/chrome/browser/resources/welcome/set_as_default/nux_set_as_default_proxy.js +++ b/chrome/browser/resources/welcome/set_as_default/nux_set_as_default_proxy.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js'; +import {sendWithPromise} from 'chrome://resources/js/cr.m.js'; import {DefaultBrowserInfo} from '../shared/nux_types.js'; const NUX_SET_AS_DEFAULT_INTERACTION_METRIC_NAME = @@ -91,6 +91,17 @@ NUX_SET_AS_DEFAULT_INTERACTION_METRIC_NAME, interaction, NUX_SET_AS_DEFAULT_INTERACTIONS_COUNT); } + + /** @return {!NuxSetAsDefaultProxy} */ + static getInstance() { + return instance || (instance = new NuxSetAsDefaultProxyImpl()); + } + + /** @param {!NuxSetAsDefaultProxy} obj */ + static setInstance(obj) { + instance = obj; + } } -addSingletonGetter(NuxSetAsDefaultProxyImpl); +/** @type {?NuxSetAsDefaultProxy} */ +let instance = null;
diff --git a/chrome/browser/resources/welcome/shared/bookmark_proxy.js b/chrome/browser/resources/welcome/shared/bookmark_proxy.js index c905084..6bf0f3d 100644 --- a/chrome/browser/resources/welcome/shared/bookmark_proxy.js +++ b/chrome/browser/resources/welcome/shared/bookmark_proxy.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js'; +import {sendWithPromise} from 'chrome://resources/js/cr.m.js'; /** * @typedef {{ @@ -52,9 +52,21 @@ isBookmarkBarShown() { return sendWithPromise('isBookmarkBarShown'); } + + /** @return {!BookmarkProxy} */ + static getInstance() { + return bookmarkProxyInstance || + (bookmarkProxyInstance = new BookmarkProxyImpl()); + } + + /** @param {!BookmarkProxy} obj */ + static setInstance(obj) { + bookmarkProxyInstance = obj; + } } -addSingletonGetter(BookmarkProxyImpl); +/** @type {?BookmarkProxy} */ +let bookmarkProxyInstance = null; // Wrapper for bookmark proxy to keep some additional states. export class BookmarkBarManager { @@ -81,6 +93,17 @@ this.isBarShown_ = show; this.proxy_.toggleBookmarkBar(show); } + + /** @return {!BookmarkBarManager} */ + static getInstance() { + return managerInstance || (managerInstance = new BookmarkBarManager()); + } + + /** @param {!BookmarkBarManager} obj */ + static setInstance(obj) { + managerInstance = obj; + } } -addSingletonGetter(BookmarkBarManager); +/** @type {?BookmarkBarManager} */ +let managerInstance = null;
diff --git a/chrome/browser/resources/welcome/signin_view_proxy.js b/chrome/browser/resources/welcome/signin_view_proxy.js index 43266ea4..978ffdc 100644 --- a/chrome/browser/resources/welcome/signin_view_proxy.js +++ b/chrome/browser/resources/welcome/signin_view_proxy.js
@@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {addSingletonGetter} from 'chrome://resources/js/cr.m.js'; - const NUX_SIGNIN_VIEW_INTERACTION_METRIC_NAME = 'FirstRun.NewUserExperience.SignInInterstitialInteraction'; @@ -70,6 +68,17 @@ NUX_SIGNIN_VIEW_INTERACTION_METRIC_NAME, interaction, NUX_SIGNIN_VIEW_INTERACTIONS_COUNT); } + + /** @return {!SigninViewProxy} */ + static getInstance() { + return instance || (instance = new SigninViewProxyImpl()); + } + + /** @param {!SigninViewProxy} obj */ + static setInstance(obj) { + instance = obj; + } } -addSingletonGetter(SigninViewProxyImpl); +/** @type {?SigninViewProxy} */ +let instance = null;
diff --git a/chrome/browser/resources/welcome/welcome_browser_proxy.js b/chrome/browser/resources/welcome/welcome_browser_proxy.js index bf8146f..74cae0a7 100644 --- a/chrome/browser/resources/welcome/welcome_browser_proxy.js +++ b/chrome/browser/resources/welcome/welcome_browser_proxy.js
@@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {addSingletonGetter} from 'chrome://resources/js/cr.m.js'; - /** * @fileoverview A helper object used by the welcome page to interact with * the browser. @@ -48,6 +46,17 @@ goToURL(url) { window.location.assign(url); } + + /** @return {!WelcomeBrowserProxy} */ + static getInstance() { + return instance || (instance = new WelcomeBrowserProxyImpl()); + } + + /** @param {!WelcomeBrowserProxy} obj */ + static setInstance(obj) { + instance = obj; + } } -addSingletonGetter(WelcomeBrowserProxyImpl); +/** @type {?WelcomeBrowserProxy} */ +let instance = null;
diff --git a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc index 7f87c6c3..4c9f262 100644 --- a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc +++ b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc
@@ -25,6 +25,7 @@ #include "components/safe_browsing/content/browser/client_side_detection_service.h" #include "components/safe_browsing/content/browser/client_side_model_loader.h" #include "components/safe_browsing/core/common/safe_browsing_prefs.h" +#include "components/safe_browsing/core/common/safebrowsing_constants.h" #include "components/safe_browsing/core/proto/client_model.pb.h" #include "components/safe_browsing/core/proto/csd.pb.h" #include "components/variations/variations_associated_data.h" @@ -297,7 +298,7 @@ std::string out; EXPECT_TRUE(request.headers.GetHeader( net::HttpRequestHeaders::kAuthorization, &out)); - EXPECT_EQ(out, "Bearer " + access_token); + EXPECT_EQ(out, kAuthHeaderBearer + access_token); })); SetClientReportPhishingResponse(response.SerializeAsString(), net::OK); EXPECT_TRUE(SendClientReportPhishingRequest(url, score, access_token));
diff --git a/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc b/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc index a9faab69..a9069959 100644 --- a/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc +++ b/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc
@@ -41,8 +41,6 @@ const char kDownloadExtensionUmaName[] = "SBClientDownload.DownloadExtensions"; -constexpr char kAuthHeaderBearer[] = "Bearer "; - void RecordFileExtensionType(const std::string& metric_name, const base::FilePath& file) { base::UmaHistogramSparse(
diff --git a/chrome/browser/safe_browsing/safe_browsing_navigation_observer.h b/chrome/browser/safe_browsing/safe_browsing_navigation_observer.h index f85f83e..d205bf0 100644 --- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer.h +++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer.h
@@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_H_ #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_H_ +#include <unordered_map> + #include "base/scoped_observer.h" #include "base/supports_user_data.h" #include "components/content_settings/core/browser/content_settings_observer.h"
diff --git a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h index c27141db..b1905a8 100644 --- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h +++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h
@@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_MANAGER_H_ #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_MANAGER_H_ +#include <unordered_map> + #include "base/containers/circular_deque.h" #include "base/feature_list.h" #include "base/supports_user_data.h"
diff --git a/chrome/browser/search/drive/drive.mojom b/chrome/browser/search/drive/drive.mojom index e85adf5..0fe6af88 100644 --- a/chrome/browser/search/drive/drive.mojom +++ b/chrome/browser/search/drive/drive.mojom
@@ -16,9 +16,6 @@ string mime_type; // The name of the Drive Item. string title; - // The URL of the active person's photo that - // must be served through SanitizedImageSource. - url.mojom.Url? untrusted_photo_url; // The URL to navigate to the Drive Item. url.mojom.Url item_url; };
diff --git a/chrome/browser/search/drive/drive_service.cc b/chrome/browser/search/drive/drive_service.cc index 873c37b..d2ba01ef 100644 --- a/chrome/browser/search/drive/drive_service.cc +++ b/chrome/browser/search/drive/drive_service.cc
@@ -207,17 +207,12 @@ !item_url || !GURL(*item_url).is_valid()) { continue; } - auto* photo_url = - item.FindStringPath("justification.primaryPerson.photoUrl"); auto mojo_drive_doc = drive::mojom::File::New(); mojo_drive_doc->title = *title; mojo_drive_doc->mime_type = *mime_type; mojo_drive_doc->justification_text = justification_text; mojo_drive_doc->id = *id; mojo_drive_doc->item_url = GURL(*item_url); - if (photo_url && GURL(*photo_url).is_valid()) { - mojo_drive_doc->untrusted_photo_url = GURL(*photo_url); - } document_list.push_back(std::move(mojo_drive_doc)); } std::move(callback).Run(std::move(document_list));
diff --git a/chrome/browser/search/drive/drive_service_unittest.cc b/chrome/browser/search/drive/drive_service_unittest.cc index 67d62ed..23b07c4 100644 --- a/chrome/browser/search/drive/drive_service_unittest.cc +++ b/chrome/browser/search/drive/drive_service_unittest.cc
@@ -105,9 +105,6 @@ "text": "bar foo bar" } ] - }, - "primaryPerson": { - "photoUrl": "https://google.com/userphoto" } } }, @@ -133,8 +130,6 @@ actual_documents.at(1)->mime_type); EXPECT_EQ("Foo bar foo bar", actual_documents.at(1)->justification_text); EXPECT_EQ("https://google.com/bar", actual_documents.at(1)->item_url.spec()); - EXPECT_EQ("https://google.com/userphoto", - actual_documents.at(1)->untrusted_photo_url.value()); } TEST_F(DriveServiceTest, PassesDataToMultipleRequestsToDriveService) {
diff --git a/chrome/browser/search/task_module/task_module_service.cc b/chrome/browser/search/task_module/task_module_service.cc index 42657a6f..c087193c 100644 --- a/chrome/browser/search/task_module/task_module_service.cc +++ b/chrome/browser/search/task_module/task_module_service.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/search/task_module/task_module_service.h" +#include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_functions.h" #include "base/stl_util.h" #include "base/strings/stringprintf.h"
diff --git a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/CriticalPersistedTabData.java b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/CriticalPersistedTabData.java index e57cc9a..02aa889 100644 --- a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/CriticalPersistedTabData.java +++ b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/CriticalPersistedTabData.java
@@ -387,17 +387,26 @@ } return () -> { try (TraceEvent e = TraceEvent.scoped("CriticalPersistedTabData.Serialize")) { - if (byteBuffer == null) { - builder.setWebContentsStateBytes(ByteString.EMPTY); - } else { - byteBuffer.rewind(); - builder.setWebContentsStateBytes(ByteString.copyFrom(byteBuffer)); - } - return builder.build().toByteArray(); + // TODO(crbug.com/1203298) migrate to ByteString.copyFrom(ByteBuffer ...) + // in a thread safe way to avoid intermediate ByteBuffer -> byte[]. Be careful as + // this has caused crashes in the past crbug.com/1195550. + return builder + .setWebContentsStateBytes(byteBuffer == null + ? ByteString.EMPTY + : ByteString.copyFrom(getContentStateByteArray(byteBuffer))) + .build() + .toByteArray(); } }; } + protected static byte[] getContentStateByteArray(ByteBuffer buffer) { + byte[] contentsStateBytes = new byte[buffer.limit()]; + buffer.rewind(); + buffer.get(contentsStateBytes); + return contentsStateBytes; + } + @Override public void save() { if (shouldSave()) {
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 4433cc6..5f98aabe 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -1576,7 +1576,6 @@ "//components/network_session_configurator/common", "//components/page_load_metrics/browser", "//components/performance_manager:site_data_proto", - "//components/printing/browser", "//components/reading_list/features:flags", "//components/safe_browsing/core/common:safe_browsing_policy_handler", "//components/safety_check", @@ -1907,8 +1906,6 @@ "ash/chrome_browser_main_extra_parts_ash.h", "ash/chrome_capture_mode_delegate.cc", "ash/chrome_capture_mode_delegate.h", - "ash/chrome_launcher_prefs.cc", - "ash/chrome_launcher_prefs.h", "ash/chrome_new_window_client.cc", "ash/chrome_new_window_client.h", "ash/chrome_new_window_delegate_provider.cc", @@ -1916,6 +1913,8 @@ "ash/chrome_screenshot_grabber.cc", "ash/chrome_screenshot_grabber.h", "ash/chrome_screenshot_grabber_test_observer.h", + "ash/chrome_shelf_prefs.cc", + "ash/chrome_shelf_prefs.h", "ash/chrome_shell_delegate.cc", "ash/chrome_shell_delegate.h", "ash/clipboard_image_model_factory_impl.cc", @@ -4719,7 +4718,7 @@ "webui/print_preview/printer_handler.h", ] deps += [ - "//chrome/common/printing:printing", + "//chrome/common/printing", "//chrome/services/printing/public/mojom", "//components/printing/common:mojo_interfaces", "//components/services/print_compositor/public/mojom",
diff --git a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h index 9f02e23..43b7f95 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h +++ b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h
@@ -410,8 +410,7 @@ bool IsDefaultPackage(const std::string& package_name) const; private: - // TODO(https://crbug.com/1201256): Rename to ChromeShelfControllerTest. - friend class ChromeLauncherControllerTest; + friend class ChromeShelfControllerTest; friend class ArcAppModelBuilderTest; friend class app_list::ArcAppShortcutsSearchProviderTest;
diff --git a/chrome/browser/ui/ash/cast_config_controller_media_router.cc b/chrome/browser/ui/ash/cast_config_controller_media_router.cc index 226f80d..28fc54a1 100644 --- a/chrome/browser/ui/ash/cast_config_controller_media_router.cc +++ b/chrome/browser/ui/ash/cast_config_controller_media_router.cc
@@ -204,13 +204,6 @@ devices_.clear(); for (const media_router::MediaSink& sink : device_cache()->sinks()) { - // TODO(crbug.com/1154342): Remove this if-statement once the toolbar's Cast - // dialog no longer needs Meet sinks and they are disabled in the backend. - if (sink.IsMaybeCloudSink() && - !base::FeatureList::IsEnabled( - media_router::kCastToMeetingFromCastDialog)) { - continue; - } ash::SinkAndRoute device; device.sink.id = sink.id(); device.sink.name = sink.name();
diff --git a/chrome/browser/ui/ash/chrome_launcher_prefs.cc b/chrome/browser/ui/ash/chrome_shelf_prefs.cc similarity index 99% rename from chrome/browser/ui/ash/chrome_launcher_prefs.cc rename to chrome/browser/ui/ash/chrome_shelf_prefs.cc index 83a84a3..54438b18 100644 --- a/chrome/browser/ui/ash/chrome_launcher_prefs.cc +++ b/chrome/browser/ui/ash/chrome_shelf_prefs.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/ash/chrome_launcher_prefs.h" +#include "chrome/browser/ui/ash/chrome_shelf_prefs.h" #include <stddef.h> @@ -203,7 +203,7 @@ const char kPinnedAppsPrefAppIDKey[] = "id"; -void RegisterChromeLauncherUserPrefs( +void RegisterChromeShelfProfilePrefs( user_prefs::PrefRegistrySyncable* registry) { registry->RegisterListPref(prefs::kPolicyPinnedLauncherApps); registry->RegisterListPref(
diff --git a/chrome/browser/ui/ash/chrome_launcher_prefs.h b/chrome/browser/ui/ash/chrome_shelf_prefs.h similarity index 93% rename from chrome/browser/ui/ash/chrome_launcher_prefs.h rename to chrome/browser/ui/ash/chrome_shelf_prefs.h index 01b93ac..b196028 100644 --- a/chrome/browser/ui/ash/chrome_launcher_prefs.h +++ b/chrome/browser/ui/ash/chrome_shelf_prefs.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_ASH_CHROME_LAUNCHER_PREFS_H_ -#define CHROME_BROWSER_UI_ASH_CHROME_LAUNCHER_PREFS_H_ +#ifndef CHROME_BROWSER_UI_ASH_CHROME_SHELF_PREFS_H_ +#define CHROME_BROWSER_UI_ASH_CHROME_SHELF_PREFS_H_ #include <vector> @@ -29,7 +29,7 @@ // This is NOT a valid extension identifier so pre-M31 versions ignore it. extern const char kPinnedAppsPlaceholder[]; -void RegisterChromeLauncherUserPrefs( +void RegisterChromeShelfProfilePrefs( user_prefs::PrefRegistrySyncable* registry); // Init a local pref from a synced pref, if the local pref has no user setting. @@ -67,4 +67,4 @@ // https://crbug.com/1085597 void SkipPinnedAppsFromSyncForTest(); -#endif // CHROME_BROWSER_UI_ASH_CHROME_LAUNCHER_PREFS_H_ +#endif // CHROME_BROWSER_UI_ASH_CHROME_SHELF_PREFS_H_
diff --git a/chrome/browser/ui/ash/launcher/app_window_shelf_item_controller.h b/chrome/browser/ui/ash/launcher/app_window_shelf_item_controller.h index 91a6444..ab3c5f7 100644 --- a/chrome/browser/ui/ash/launcher/app_window_shelf_item_controller.h +++ b/chrome/browser/ui/ash/launcher/app_window_shelf_item_controller.h
@@ -74,8 +74,7 @@ AppWindowBase* GetLastActiveWindow(); private: - // TODO(https://crbug.com/1201256): Rename to ChromeShelfControllerTest. - friend class ChromeLauncherControllerTest; + friend class ChromeShelfControllerTest; WindowList::iterator GetFromNativeWindow(aura::Window* window, WindowList& list);
diff --git a/chrome/browser/ui/ash/launcher/chrome_shelf_controller.cc b/chrome/browser/ui/ash/launcher/chrome_shelf_controller.cc index acad41b..3499744 100644 --- a/chrome/browser/ui/ash/launcher/chrome_shelf_controller.cc +++ b/chrome/browser/ui/ash/launcher/chrome_shelf_controller.cc
@@ -46,7 +46,7 @@ #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" #include "chrome/browser/ui/app_list/md_icon_normalizer.h" #include "chrome/browser/ui/apps/app_info_dialog.h" -#include "chrome/browser/ui/ash/chrome_launcher_prefs.h" +#include "chrome/browser/ui/ash/chrome_shelf_prefs.h" #include "chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.h" #include "chrome/browser/ui/ash/launcher/app_service/app_service_app_window_arc_tracker.h" #include "chrome/browser/ui/ash/launcher/app_service/app_service_app_window_shelf_controller.h"
diff --git a/chrome/browser/ui/ash/launcher/chrome_shelf_controller.h b/chrome/browser/ui/ash/launcher/chrome_shelf_controller.h index fd22304..fae459c3 100644 --- a/chrome/browser/ui/ash/launcher/chrome_shelf_controller.h +++ b/chrome/browser/ui/ash/launcher/chrome_shelf_controller.h
@@ -282,10 +282,9 @@ const gfx::ImageSkia& image) override; private: - // TODO(https://crbug.com/1201256): Rename to ChromeShelfControllerTest. - friend class ChromeLauncherControllerTest; - friend class LauncherPlatformAppBrowserTest; + friend class ChromeShelfControllerTest; friend class ShelfAppBrowserTest; + friend class ShelfPlatformAppBrowserTest; friend class TestChromeShelfController; FRIEND_TEST_ALL_PREFIXES(ash::SpokenFeedbackTest, ShelfIconFocusForward);
diff --git a/chrome/browser/ui/ash/launcher/chrome_shelf_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_shelf_controller_browsertest.cc index 5e33a2bc..cfe5031 100644 --- a/chrome/browser/ui/ash/launcher/chrome_shelf_controller_browsertest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_shelf_controller_browsertest.cc
@@ -58,7 +58,7 @@ #include "chrome/browser/extensions/menu_manager.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" -#include "chrome/browser/ui/ash/chrome_launcher_prefs.h" +#include "chrome/browser/ui/ash/chrome_shelf_prefs.h" #include "chrome/browser/ui/ash/launcher/browser_shortcut_shelf_item_controller.h" #include "chrome/browser/ui/ash/launcher/chrome_shelf_controller_test_util.h" #include "chrome/browser/ui/ash/launcher/chrome_shelf_controller_util.h" @@ -217,15 +217,13 @@ } // namespace -class LauncherPlatformAppBrowserTest - : public extensions::PlatformAppBrowserTest { +class ShelfPlatformAppBrowserTest : public extensions::PlatformAppBrowserTest { protected: - LauncherPlatformAppBrowserTest() = default; - LauncherPlatformAppBrowserTest(const LauncherPlatformAppBrowserTest&) = + ShelfPlatformAppBrowserTest() = default; + ShelfPlatformAppBrowserTest(const ShelfPlatformAppBrowserTest&) = delete; + ShelfPlatformAppBrowserTest& operator=(const ShelfPlatformAppBrowserTest&) = delete; - LauncherPlatformAppBrowserTest& operator=( - const LauncherPlatformAppBrowserTest&) = delete; - ~LauncherPlatformAppBrowserTest() override = default; + ~ShelfPlatformAppBrowserTest() override = default; void SetUpOnMainThread() override { controller_ = ChromeShelfController::instance(); @@ -464,7 +462,7 @@ }; // Test that we can launch a platform app and get a running item. -IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchUnpinned) { +IN_PROC_BROWSER_TEST_F(ShelfPlatformAppBrowserTest, LaunchUnpinned) { int item_count = shelf_model()->item_count(); const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched"); AppWindow* window = CreateAppWindow(browser()->profile(), extension); @@ -479,7 +477,7 @@ } // Test that we can launch a platform app that already has a shortcut. -IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPinned) { +IN_PROC_BROWSER_TEST_F(ShelfPlatformAppBrowserTest, LaunchPinned) { int item_count = shelf_model()->item_count(); // First get app_id. @@ -511,7 +509,7 @@ EXPECT_EQ(ash::STATUS_CLOSED, item.status); } -IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, PinRunning) { +IN_PROC_BROWSER_TEST_F(ShelfPlatformAppBrowserTest, PinRunning) { // Run. int item_count = shelf_model()->item_count(); const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched"); @@ -551,7 +549,7 @@ ASSERT_EQ(item_count, shelf_model()->item_count()); } -IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, UnpinRunning) { +IN_PROC_BROWSER_TEST_F(ShelfPlatformAppBrowserTest, UnpinRunning) { int item_count = shelf_model()->item_count(); // First get app_id. @@ -641,7 +639,7 @@ } // Test that we can launch a platform app with more than one window. -IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleWindows) { +IN_PROC_BROWSER_TEST_F(ShelfPlatformAppBrowserTest, MultipleWindows) { int item_count = shelf_model()->item_count(); // Run the application; a shelf item should be added with one app menu item. @@ -673,7 +671,7 @@ ASSERT_EQ(item_count, shelf_model()->item_count()); } -IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleApps) { +IN_PROC_BROWSER_TEST_F(ShelfPlatformAppBrowserTest, MultipleApps) { int item_count = shelf_model()->item_count(); // First run app. @@ -715,7 +713,7 @@ // Confirm that app windows can be reactivated by clicking their icons and that // the correct activation order is maintained. -IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowActivation) { +IN_PROC_BROWSER_TEST_F(ShelfPlatformAppBrowserTest, WindowActivation) { int item_count = shelf_model()->item_count(); // First run app. @@ -793,7 +791,7 @@ EXPECT_EQ(item_count, shelf_model()->item_count()); } -IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleBrowsers) { +IN_PROC_BROWSER_TEST_F(ShelfPlatformAppBrowserTest, MultipleBrowsers) { EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); Browser* const browser1 = chrome::FindLastActive(); ASSERT_TRUE(browser1); @@ -825,7 +823,7 @@ } // Confirm the minimizing click behavior for apps. -IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, +IN_PROC_BROWSER_TEST_F(ShelfPlatformAppBrowserTest, PackagedAppClickBehaviorInMinimizeMode) { // Launch one platform app and create a window for it. const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); @@ -885,7 +883,7 @@ EXPECT_TRUE(window1a->GetBaseWindow()->IsActive()); } -IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, BrowserActivation) { +IN_PROC_BROWSER_TEST_F(ShelfPlatformAppBrowserTest, BrowserActivation) { int item_count = shelf_model()->item_count(); // First run app. @@ -903,7 +901,7 @@ } // Test that opening an app sets the correct icon -IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, SetIcon) { +IN_PROC_BROWSER_TEST_F(ShelfPlatformAppBrowserTest, SetIcon) { TestAppWindowIconObserver test_observer(browser()->profile()); int base_shelf_item_count = shelf_model()->item_count(); @@ -1022,7 +1020,7 @@ } // Test that app window has shelf ID and app ID properties set. -IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppIDWindowProperties) { +IN_PROC_BROWSER_TEST_F(ShelfPlatformAppBrowserTest, AppIDWindowProperties) { const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched"); AppWindow* window = CreateAppWindow(browser()->profile(), extension); ASSERT_TRUE(window); @@ -1369,10 +1367,10 @@ } // The Browsertest verifying FilesManager's features. -class FilesManagerExtensionTest : public LauncherPlatformAppBrowserTest { +class FilesManagerExtensionTest : public ShelfPlatformAppBrowserTest { public: void SetUpOnMainThread() override { - LauncherPlatformAppBrowserTest::SetUpOnMainThread(); + ShelfPlatformAppBrowserTest::SetUpOnMainThread(); CHECK(profile()); file_manager::test::AddDefaultComponentExtensionsOnMainThread(profile()); @@ -1760,7 +1758,7 @@ // Check that the keyboard activation of a launcher item tabs properly through // the items at hand. -IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AltNumberAppsTabbing) { +IN_PROC_BROWSER_TEST_F(ShelfPlatformAppBrowserTest, AltNumberAppsTabbing) { // First run app. const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); ui::BaseWindow* window1 = @@ -1796,7 +1794,7 @@ // Check that the keyboard activation of a launcher item tabs even if the app is // not currently activated. -IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, +IN_PROC_BROWSER_TEST_F(ShelfPlatformAppBrowserTest, AltNumberAppsTabbingFromOtherApp) { // Create one app with two windows. const Extension* app1_extension1 = @@ -1835,7 +1833,7 @@ } // Test that we get correct shelf presence with hidden app windows. -IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, HiddenAppWindows) { +IN_PROC_BROWSER_TEST_F(ShelfPlatformAppBrowserTest, HiddenAppWindows) { int item_count = shelf_model()->item_count(); const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched"); AppWindow::CreateParams params; @@ -1874,7 +1872,7 @@ } // Test attention states of windows. -IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowAttentionStatus) { +IN_PROC_BROWSER_TEST_F(ShelfPlatformAppBrowserTest, WindowAttentionStatus) { const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched"); AppWindow::CreateParams params; params.focused = false; @@ -1902,7 +1900,7 @@ EXPECT_EQ(ash::STATUS_RUNNING, item.status); } -IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, +IN_PROC_BROWSER_TEST_F(ShelfPlatformAppBrowserTest, ShowInShelfWindowsWithWindowKeySet) { // Add a window with shelf True, close it int item_count = shelf_model()->item_count();
diff --git a/chrome/browser/ui/ash/launcher/chrome_shelf_controller_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_shelf_controller_unittest.cc index 25309d6..84a828a 100644 --- a/chrome/browser/ui/ash/launcher/chrome_shelf_controller_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_shelf_controller_unittest.cc
@@ -66,7 +66,7 @@ #include "chrome/browser/ui/app_list/arc/arc_default_app_list.h" #include "chrome/browser/ui/app_list/internal_app/internal_app_metadata.h" #include "chrome/browser/ui/apps/chrome_app_delegate.h" -#include "chrome/browser/ui/ash/chrome_launcher_prefs.h" +#include "chrome/browser/ui/ash/chrome_shelf_prefs.h" #include "chrome/browser/ui/ash/launcher/app_service/app_service_app_window_shelf_item_controller.h" #include "chrome/browser/ui/ash/launcher/app_window_shelf_controller.h" #include "chrome/browser/ui/ash/launcher/app_window_shelf_item_controller.h" @@ -263,16 +263,15 @@ }; // Test implementation of a V2 app launcher item controller. -class TestV2AppLauncherItemController : public ash::ShelfItemDelegate { +class TestV2AppShelfItemController : public ash::ShelfItemDelegate { public: - explicit TestV2AppLauncherItemController(const std::string& app_id) + explicit TestV2AppShelfItemController(const std::string& app_id) : ash::ShelfItemDelegate(ash::ShelfID(app_id)) {} - TestV2AppLauncherItemController(const TestV2AppLauncherItemController&) = + TestV2AppShelfItemController(const TestV2AppShelfItemController&) = delete; + TestV2AppShelfItemController& operator=(const TestV2AppShelfItemController&) = delete; - TestV2AppLauncherItemController& operator=( - const TestV2AppLauncherItemController&) = delete; - ~TestV2AppLauncherItemController() override = default; + ~TestV2AppShelfItemController() override = default; // Override for ash::ShelfItemDelegate: void ItemSelected(std::unique_ptr<ui::Event> event, @@ -335,17 +334,15 @@ } // namespace -// TODO(https://crbug.com/1201256): Rename to ChromeShelfControllerTest. -class ChromeLauncherControllerTest : public BrowserWithTestWindowTest { +class ChromeShelfControllerTest : public BrowserWithTestWindowTest { protected: - ChromeLauncherControllerTest() - : BrowserWithTestWindowTest(Browser::TYPE_NORMAL) { - } + ChromeShelfControllerTest() + : BrowserWithTestWindowTest(Browser::TYPE_NORMAL) {} - ChromeLauncherControllerTest(const ChromeLauncherControllerTest&) = delete; - ChromeLauncherControllerTest& operator=(const ChromeLauncherControllerTest&) = + ChromeShelfControllerTest(const ChromeShelfControllerTest&) = delete; + ChromeShelfControllerTest& operator=(const ChromeShelfControllerTest&) = delete; - ~ChromeLauncherControllerTest() override = default; + ~ChromeShelfControllerTest() override = default; void SetUp() override { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); @@ -482,19 +479,19 @@ virtual void CreateRunningV2App(const std::string& app_id) { DCHECK(!test_controller_); // Change the created launcher controller into a V2 app controller. - std::unique_ptr<TestV2AppLauncherItemController> controller = - std::make_unique<TestV2AppLauncherItemController>(app_id); + std::unique_ptr<TestV2AppShelfItemController> controller = + std::make_unique<TestV2AppShelfItemController>(app_id); test_controller_ = controller.get(); - ash::ShelfID id = launcher_controller_->InsertAppLauncherItem( + ash::ShelfID id = shelf_controller_->InsertAppLauncherItem( std::move(controller), ash::STATUS_RUNNING, model_->item_count(), ash::TYPE_APP); - DCHECK(launcher_controller_->IsPlatformApp(id)); + DCHECK(shelf_controller_->IsPlatformApp(id)); } // Sets the stage for a multi user test. virtual void SetUpMultiUserScenario(syncer::SyncChangeList* user_a, syncer::SyncChangeList* user_b) { - InitLauncherController(); + InitShelfController(); EXPECT_EQ("Chrome", GetPinnedAppStatus()); // Set an empty pinned pref to begin with. @@ -534,7 +531,7 @@ void TearDown() override { arc_test_.TearDown(); - launcher_controller_ = nullptr; + shelf_controller_ = nullptr; BrowserWithTestWindowTest::TearDown(); chromeos::DBusThreadManager::Shutdown(); app_list::AppListSyncableServiceFactory::SetUseInTesting(false); @@ -553,32 +550,29 @@ // Create an uninitialized chrome launcher controller instance. ChromeShelfController* CreateShelfController() { - launcher_controller_ = + shelf_controller_ = std::make_unique<ChromeShelfController>(profile(), model_.get()); - launcher_controller_->SetProfileForTest(profile()); - launcher_controller_->SetShelfControllerHelperForTest( + shelf_controller_->SetProfileForTest(profile()); + shelf_controller_->SetShelfControllerHelperForTest( std::make_unique<ShelfControllerHelper>(profile())); - return launcher_controller_.get(); + return shelf_controller_.get(); } // Create and initialize the controller, owned by the test shell delegate. - // TODO(https://crbug.com/1201256): Rename to InitShelfController(). - void InitLauncherController() { + void InitShelfController() { CreateShelfController()->Init(); app_service_test_.FlushMojoCalls(); } // Create and initialize the controller; create a tab and show the browser. - // TODO(https://crbug.com/1201256): Rename to InitShelfControllerWithBrowser. - void InitLauncherControllerWithBrowser() { - InitLauncherController(); + void InitShelfControllerWithBrowser() { + InitShelfController(); chrome::NewTab(browser()); browser()->window()->Show(); } - // Destroy the launcher controller instance and clear the local pointer. - // TODO(https://crbug.com/1201256): Rename to ResetShelfController. - void ResetLauncherController() { launcher_controller_.reset(); } + // Destroy the controller instance and clear the local pointer. + void ResetShelfController() { shelf_controller_.reset(); } // Destroy and recreate the controller; clear and reinitialize the ShelfModel. // Returns a pointer to the uninitialized controller, owned by shell delegate. @@ -586,7 +580,7 @@ // lifetime or usage in production, and does not accurately simulate restarts. ChromeShelfController* RecreateShelfController() { // Destroy any existing controller first; only one may exist at a time. - ResetLauncherController(); + ResetShelfController(); model_ = std::make_unique<ash::ShelfModel>(); return CreateShelfController(); } @@ -633,7 +627,7 @@ void SetAppIconLoader(std::unique_ptr<AppIconLoader> loader) { std::vector<std::unique_ptr<AppIconLoader>> loaders; loaders.push_back(std::move(loader)); - launcher_controller_->SetAppIconLoadersForTest(loaders); + shelf_controller_->SetAppIconLoadersForTest(loaders); } void SetAppIconLoaders(std::unique_ptr<AppIconLoader> loader1, @@ -641,11 +635,11 @@ std::vector<std::unique_ptr<AppIconLoader>> loaders; loaders.push_back(std::move(loader1)); loaders.push_back(std::move(loader2)); - launcher_controller_->SetAppIconLoadersForTest(loaders); + shelf_controller_->SetAppIconLoadersForTest(loaders); } void SetShelfControllerHelper(ShelfControllerHelper* helper) { - launcher_controller_->SetShelfControllerHelperForTest( + shelf_controller_->SetShelfControllerHelperForTest( base::WrapUnique<ShelfControllerHelper>(helper)); } @@ -781,7 +775,7 @@ } } - // Get the setup of the currently shown launcher items in one string. + // Get the setup of the currently shown shelf items in one string. // Each pinned element will start with a big letter, each running but not // pinned V1 app will start with a small letter and each running but not // pinned V2 app will start with a '*' + small letter. @@ -792,10 +786,10 @@ result.append(", "); switch (model_->items()[i].type) { case ash::TYPE_APP: { - if (launcher_controller_->IsPlatformApp(model_->items()[i].id)) + if (shelf_controller_->IsPlatformApp(model_->items()[i].id)) result += "*"; const std::string& app = model_->items()[i].id.app_id; - EXPECT_FALSE(launcher_controller_->IsAppPinned(app)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(app)); if (app == extension1_->id()) { result += "app1"; } else if (app == extension2_->id()) { @@ -822,10 +816,10 @@ break; } case ash::TYPE_PINNED_APP: { - if (launcher_controller_->IsPlatformApp(model_->items()[i].id)) + if (shelf_controller_->IsPlatformApp(model_->items()[i].id)) result += "*"; const std::string& app = model_->items()[i].id.app_id; - EXPECT_TRUE(launcher_controller_->IsAppPinned(app)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(app)); if (app == extension1_->id()) { result += "App1"; } else if (app == extension2_->id()) { @@ -896,12 +890,12 @@ // Remember the order of unpinned but running applications for the current // user. void RememberUnpinnedRunningApplicationOrder() { - launcher_controller_->RememberUnpinnedRunningApplicationOrder(); + shelf_controller_->RememberUnpinnedRunningApplicationOrder(); } // Restore the order of running but unpinned applications for a given user. void RestoreUnpinnedRunningApplicationOrder(const AccountId& account_id) { - launcher_controller_->RestoreUnpinnedRunningApplicationOrder( + shelf_controller_->RestoreUnpinnedRunningApplicationOrder( account_id.GetUserEmail()); } @@ -944,7 +938,7 @@ views::Widget* widget = new views::Widget(); widget->Init(std::move(params)); // Set ARC id before showing the window to be recognized in - // ArcAppWindowLauncherController. + // AppServiceAppWindowArcTracker. exo::SetShellApplicationId(widget->GetNativeWindow(), window_app_id); widget->Show(); widget->Activate(); @@ -1068,8 +1062,7 @@ ArcAppTest arc_test_; bool auto_start_arc_test_ = false; - // TODO(https://crbug.com/1201256): Rename to shelf_controller_. - std::unique_ptr<ChromeShelfController> launcher_controller_; + std::unique_ptr<ChromeShelfController> shelf_controller_; std::unique_ptr<ash::ShelfModel> model_; // |item_delegate_manager_| owns |test_controller_|. @@ -1096,53 +1089,50 @@ apps::AppServiceTest app_service_test_; }; -class ChromeLauncherControllerWithArcTest - : public ChromeLauncherControllerTest { +class ChromeShelfControllerWithArcTest : public ChromeShelfControllerTest { protected: - ChromeLauncherControllerWithArcTest() { - auto_start_arc_test_ = true; - } + ChromeShelfControllerWithArcTest() { auto_start_arc_test_ = true; } - ChromeLauncherControllerWithArcTest( - const ChromeLauncherControllerWithArcTest&) = delete; - ChromeLauncherControllerWithArcTest& operator=( - const ChromeLauncherControllerWithArcTest&) = delete; - ~ChromeLauncherControllerWithArcTest() override = default; + ChromeShelfControllerWithArcTest(const ChromeShelfControllerWithArcTest&) = + delete; + ChromeShelfControllerWithArcTest& operator=( + const ChromeShelfControllerWithArcTest&) = delete; + ~ChromeShelfControllerWithArcTest() override = default; void SetUp() override { // To prevent crash on test exit and pending decode request. ArcAppIcon::DisableSafeDecodingForTesting(); - ChromeLauncherControllerTest::SetUp(); + ChromeShelfControllerTest::SetUp(); } }; // Tests for feature SplitSettingsSync. Exists as a separate class because the -// feature must be initialized before ChromeLauncherControllerTest::SetUp(). -class ChromeLauncherControllerSplitSettingsSyncTest - : public ChromeLauncherControllerTest { +// feature must be initialized before ChromeShelfControllerTest::SetUp(). +class ChromeShelfControllerSplitSettingsSyncTest + : public ChromeShelfControllerTest { public: - ChromeLauncherControllerSplitSettingsSyncTest() { + ChromeShelfControllerSplitSettingsSyncTest() { feature_list_.InitAndEnableFeature(chromeos::features::kSplitSettingsSync); } - ~ChromeLauncherControllerSplitSettingsSyncTest() override = default; + ~ChromeShelfControllerSplitSettingsSyncTest() override = default; private: base::test::ScopedFeatureList feature_list_; }; // Tests for Lacros integration. Exists as a separate class because the feature -// must be initialized before ChromeLauncherControllerTest::SetUp(). -class ChromeLauncherControllerLacrosTest : public ChromeLauncherControllerTest { +// must be initialized before ChromeShelfControllerTest::SetUp(). +class ChromeShelfControllerLacrosTest : public ChromeShelfControllerTest { public: - ChromeLauncherControllerLacrosTest() { + ChromeShelfControllerLacrosTest() { feature_list_.InitAndEnableFeature(chromeos::features::kLacrosSupport); } - ChromeLauncherControllerLacrosTest( - const ChromeLauncherControllerLacrosTest&) = delete; - ChromeLauncherControllerLacrosTest& operator=( - const ChromeLauncherControllerLacrosTest&) = delete; - ~ChromeLauncherControllerLacrosTest() override = default; + ChromeShelfControllerLacrosTest(const ChromeShelfControllerLacrosTest&) = + delete; + ChromeShelfControllerLacrosTest& operator=( + const ChromeShelfControllerLacrosTest&) = delete; + ~ChromeShelfControllerLacrosTest() override = default; // testing::Test: void SetUp() override { @@ -1159,7 +1149,7 @@ fake_user_manager->LoginUser(account_id); // Creates profile(). - ChromeLauncherControllerTest::SetUp(); + ChromeShelfControllerTest::SetUp(); ASSERT_TRUE(chromeos::ProfileHelper::Get()->IsPrimaryProfile(profile())); } @@ -1239,17 +1229,17 @@ }; // The testing framework to test multi profile scenarios. -class MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest - : public ChromeLauncherControllerTest { +class MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest + : public ChromeShelfControllerTest { protected: - MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest() = default; - MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest( - const MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest&) = + MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest() = default; + MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest( + const MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest&) = delete; - MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest& operator=( - const MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest&) = + MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest& operator=( + const MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest&) = delete; - ~MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest() override = + ~MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest() override = default; // Overwrite the Setup function to enable multi profile and needed objects. @@ -1259,7 +1249,7 @@ std::make_unique<ash::FakeChromeUserManager>()); // Initialize the rest. - ChromeLauncherControllerTest::SetUp(); + ChromeShelfControllerTest::SetUp(); // Initialize WallpaperControllerClientImpl. wallpaper_controller_client_ = @@ -1272,7 +1262,7 @@ } void TearDown() override { - ChromeLauncherControllerTest::TearDown(); + ChromeShelfControllerTest::TearDown(); user_manager_enabler_.reset(); wallpaper_controller_client_.reset(); @@ -1311,8 +1301,8 @@ created_profiles_[profile] = account_id.GetUserEmail(); if (MultiUserWindowManagerHelper::GetInstance()) MultiUserWindowManagerHelper::GetInstance()->AddUser(profile); - if (launcher_controller_) - launcher_controller_->AdditionalUserAddedToSession(profile); + if (shelf_controller_) + shelf_controller_->AdditionalUserAddedToSession(profile); return profile; } @@ -1341,7 +1331,7 @@ } // Creates a running V1 application. - // Note that with the use of the launcher_controller_helper as done below, + // Note that with the use of the shelf_controller_helper as done below, // this is only usable with a single v1 application. V1App* CreateRunningV1App(Profile* profile, const std::string& app_name, @@ -1374,21 +1364,21 @@ ProfileToNameMap created_profiles_; }; -class ChromeLauncherControllerMultiProfileWithArcTest - : public MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest { +class ChromeShelfControllerMultiProfileWithArcTest + : public MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest { protected: - ChromeLauncherControllerMultiProfileWithArcTest() { + ChromeShelfControllerMultiProfileWithArcTest() { auto_start_arc_test_ = true; } - ChromeLauncherControllerMultiProfileWithArcTest( - const ChromeLauncherControllerMultiProfileWithArcTest&) = delete; - ChromeLauncherControllerMultiProfileWithArcTest& operator=( - const ChromeLauncherControllerMultiProfileWithArcTest&) = delete; - ~ChromeLauncherControllerMultiProfileWithArcTest() override = default; + ChromeShelfControllerMultiProfileWithArcTest( + const ChromeShelfControllerMultiProfileWithArcTest&) = delete; + ChromeShelfControllerMultiProfileWithArcTest& operator=( + const ChromeShelfControllerMultiProfileWithArcTest&) = delete; + ~ChromeShelfControllerMultiProfileWithArcTest() override = default; }; -TEST_F(ChromeLauncherControllerTest, PreinstalledApps) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, PreinstalledApps) { + InitShelfController(); // The model should only contain the browser shortcut item. EXPECT_EQ("Chrome", GetPinnedAppStatus()); @@ -1396,7 +1386,7 @@ // Pinning the non-preinstalled app. It should appear at the end. No // preinstalled app is currently installed. extension_service_->AddExtension(extension1_.get()); - launcher_controller_->PinAppWithID(extension1_->id()); + shelf_controller_->PinAppWithID(extension1_->id()); EXPECT_EQ("Chrome, App1", GetPinnedAppStatus()); // Install preinstalled apps in reverse order, compared how they are declared. @@ -1425,13 +1415,13 @@ GetPinnedAppStatus()); } -TEST_F(ChromeLauncherControllerSplitSettingsSyncTest, PreinstalledApps) { +TEST_F(ChromeShelfControllerSplitSettingsSyncTest, PreinstalledApps) { // Simulate a user who opted out of sync. syncer::SyncService* sync_service = ProfileSyncServiceFactory::GetForProfile(profile()); sync_service->GetUserSettings()->SetOsSyncFeatureEnabled(false); - InitLauncherController(); + InitShelfController(); EXPECT_EQ("Chrome", GetPinnedAppStatus()); // Simulate the preinstalled app loader installing some apps. Don't start the @@ -1444,14 +1434,13 @@ EXPECT_EQ("Chrome, Gmail, Messages, Youtube", GetPinnedAppStatus()); } -TEST_F(ChromeLauncherControllerLacrosTest, LacrosPinnedByDefault) { - InitLauncherController(); +TEST_F(ChromeShelfControllerLacrosTest, LacrosPinnedByDefault) { + InitShelfController(); EXPECT_EQ("Chrome, Lacros", GetPinnedAppStatus()); } -TEST_F(ChromeLauncherControllerWithArcTest, - ArcAppsHiddenFromLaunchCanBePinned) { - InitLauncherController(); +TEST_F(ChromeShelfControllerWithArcTest, ArcAppsHiddenFromLaunchCanBePinned) { + InitShelfController(); // Register Android Settings. arc::mojom::AppHost* app_host = arc_test_.arc_app_list_prefs(); @@ -1459,7 +1448,7 @@ app_service_test().WaitForAppService(); // Pin Android settings. - launcher_controller_->PinAppWithID(arc::kSettingsAppId); + shelf_controller_->PinAppWithID(arc::kSettingsAppId); EXPECT_EQ("Chrome, Android Settings", GetPinnedAppStatus()); // The pin should remain after syncing prefs. Play Store should now appear. @@ -1467,7 +1456,7 @@ EXPECT_EQ("Chrome, Play Store, Android Settings", GetPinnedAppStatus()); } -TEST_F(ChromeLauncherControllerWithArcTest, ArcAppPinCrossPlatformWorkflow) { +TEST_F(ChromeShelfControllerWithArcTest, ArcAppPinCrossPlatformWorkflow) { // Work on ARC disabled platform first. const std::string arc_app_id1 = ArcAppTest::GetAppId(arc_test_.fake_apps()[0]); @@ -1476,7 +1465,7 @@ const std::string arc_app_id3 = ArcAppTest::GetAppId(arc_test_.fake_apps()[2]); - InitLauncherController(); + InitShelfController(); extension_service_->AddExtension(extension1_.get()); extension_service_->AddExtension(extension2_.get()); @@ -1493,12 +1482,12 @@ SendPinChanges(sync_list, true); SetShelfChromeIconIndex(1); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id1)); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id2)); - EXPECT_TRUE(launcher_controller_->IsAppPinned(web_app::kGmailAppId)); - EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id3)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(arc_app_id1)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension2_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(arc_app_id2)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(web_app::kGmailAppId)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(arc_app_id3)); EXPECT_EQ("App1, Chrome, App2, Gmail", GetPinnedAppStatus()); // Persist pin state, we don't have active pin for ARC apps yet, but pin @@ -1506,7 +1495,7 @@ syncer::SyncDataList copy_sync_list = app_list_syncable_service_->GetAllSyncDataForTesting(); - ResetLauncherController(); + ResetShelfController(); SendPinChanges(syncer::SyncChangeList(), true); StopAppSyncService(); EXPECT_EQ(0U, app_list_syncable_service_->sync_items().size()); @@ -1518,12 +1507,12 @@ // Pins must be automatically updated. SendListOfArcApps(); app_service_test().WaitForAppService(); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id1)); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); - EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id2)); - EXPECT_TRUE(launcher_controller_->IsAppPinned(web_app::kGmailAppId)); - EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id3)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(arc_app_id1)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension2_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(arc_app_id2)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(web_app::kGmailAppId)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(arc_app_id3)); EXPECT_EQ("App1, Chrome, Fake App 0, App2, Fake App 1, Gmail", GetPinnedAppStatus()); @@ -1539,7 +1528,7 @@ app_service_test().WaitForAppService(); copy_sync_list = app_list_syncable_service_->GetAllSyncDataForTesting(); - ResetLauncherController(); + ResetShelfController(); ResetPinModel(); SendPinChanges(syncer::SyncChangeList(), true); @@ -1551,36 +1540,36 @@ StartAppSyncService(copy_sync_list); RecreateShelfController()->Init(); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id1)); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id2)); - EXPECT_TRUE(launcher_controller_->IsAppPinned(web_app::kGmailAppId)); - EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id3)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(arc_app_id1)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension2_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(arc_app_id2)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(web_app::kGmailAppId)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(arc_app_id3)); EXPECT_EQ("App2, Chrome, App1, Gmail", GetPinnedAppStatus()); // Now move/remove pins on ARC disabled platform. model_->Move(3, 1); - launcher_controller_->UnpinAppWithID(extension2_->id()); + shelf_controller_->UnpinAppWithID(extension2_->id()); EXPECT_EQ("Gmail, Chrome, App1", GetPinnedAppStatus()); EnablePlayStore(true); SendListOfArcApps(); app_service_test().WaitForAppService(); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id1)); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); - EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id2)); - EXPECT_TRUE(launcher_controller_->IsAppPinned(web_app::kGmailAppId)); - EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id3)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(arc_app_id1)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension2_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(arc_app_id2)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(web_app::kGmailAppId)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(arc_app_id3)); EXPECT_EQ("Gmail, Fake App 1, Chrome, App1, Fake App 0", GetPinnedAppStatus()); } // Ensure correct merging of policy pinned apps and user pinned apps. -TEST_F(ChromeLauncherControllerTest, MergePolicyAndUserPrefPinnedApps) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, MergePolicyAndUserPrefPinnedApps) { + InitShelfController(); AddWebApp(web_app::kGoogleDocsAppId); AddWebApp(web_app::kGmailAppId); @@ -1600,14 +1589,14 @@ profile()->GetTestingPrefService()->SetManagedPref( prefs::kPolicyPinnedLauncherApps, policy_value.CreateDeepCopy()); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); // 2 is not pinned as it's not installed - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); - EXPECT_TRUE(launcher_controller_->IsAppPinned(web_app::kGmailAppId)); - EXPECT_TRUE(launcher_controller_->IsAppPinned(web_app::kGoogleDocsAppId)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension2_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(web_app::kGmailAppId)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(web_app::kGoogleDocsAppId)); // install extension 2 and check AddExtension(extension2_.get()); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension2_->id())); // Check user can manually pin or unpin these apps EXPECT_EQ(AppListControllerDelegate::PIN_EDITABLE, @@ -1623,11 +1612,11 @@ EXPECT_EQ("App2, Doc, App1, Chrome, Gmail", GetPinnedAppStatus()); } -// Check that the restauration of launcher items is happening in the same order +// Check that the restoration of shelf items is happening in the same order // as the user has pinned them (on another system) when they are synced reverse // order. -TEST_F(ChromeLauncherControllerTest, RestorePreinstalledAppsReverseOrder) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, RestorePreinstalledAppsReverseOrder) { + InitShelfController(); syncer::SyncChangeList sync_list; InsertAddPinChange(&sync_list, 0, extension1_->id()); @@ -1636,36 +1625,36 @@ SendPinChanges(sync_list, true); // The model should only contain the browser shortcut and app list items. - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(web_app::kGmailAppId)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension2_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(web_app::kGmailAppId)); EXPECT_EQ("Chrome", GetPinnedAppStatus()); // Installing Gmail should add it to the shelf - behind the // chrome icon. ash::ShelfItem item; AddWebApp(web_app::kGmailAppId); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension2_->id())); EXPECT_EQ("Chrome, Gmail", GetPinnedAppStatus()); - // Installing |extension2_| should add it to the launcher - behind the + // Installing |extension2_| should add it to the shelf - behind the // chrome icon, but in first location. AddExtension(extension2_.get()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ("Chrome, App2, Gmail", GetPinnedAppStatus()); - // Installing |extension1_| should add it to the launcher - behind the + // Installing |extension1_| should add it to the shelf - behind the // chrome icon, but in first location. AddExtension(extension1_.get()); EXPECT_EQ("Chrome, App1, App2, Gmail", GetPinnedAppStatus()); } -// Check that the restauration of launcher items is happening in the same order +// Check that the restoration of shelf items is happening in the same order // as the user has pinned them (on another system) when they are synced random // order. -TEST_F(ChromeLauncherControllerTest, RestorePreinstalledAppsRandomOrder) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, RestorePreinstalledAppsRandomOrder) { + InitShelfController(); syncer::SyncChangeList sync_list; InsertAddPinChange(&sync_list, 0, extension1_->id()); @@ -1674,36 +1663,36 @@ SendPinChanges(sync_list, true); // The model should only contain the browser shortcut and app list items. - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(web_app::kGmailAppId)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension2_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(web_app::kGmailAppId)); EXPECT_EQ("Chrome", GetPinnedAppStatus()); - // Installing |extension2_| should add it to the launcher - behind the + // Installing |extension2_| should add it to the shelf - behind the // chrome icon. AddExtension(extension2_.get()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(web_app::kGmailAppId)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(web_app::kGmailAppId)); EXPECT_EQ("Chrome, App2", GetPinnedAppStatus()); - // Installing |extension1_| should add it to the launcher - behind the + // Installing |extension1_| should add it to the shelf - behind the // chrome icon, but in first location. AddExtension(extension1_.get()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(web_app::kGmailAppId)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(web_app::kGmailAppId)); EXPECT_EQ("Chrome, App1, App2", GetPinnedAppStatus()); - // Installing Gmail should add it to the launcher - behind the chrome icon, + // Installing Gmail should add it to the shelf - behind the chrome icon, // but in first location. AddWebApp(web_app::kGmailAppId); EXPECT_EQ("Chrome, App1, App2, Gmail", GetPinnedAppStatus()); } -// Check that the restauration of launcher items is happening in the same order +// Check that the restoration of shelf items is happening in the same order // as the user has pinned / moved them (on another system) when they are synced // random order - including the chrome icon. -TEST_F(ChromeLauncherControllerTest, +TEST_F(ChromeShelfControllerTest, RestorePreinstalledAppsRandomOrderChromeMoved) { - InitLauncherController(); + InitShelfController(); syncer::SyncChangeList sync_list; InsertAddPinChange(&sync_list, 0, extension1_->id()); @@ -1713,34 +1702,34 @@ SendPinChanges(sync_list, true); // The model should only contain the browser shortcut and app list items. - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(web_app::kGmailAppId)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension2_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(web_app::kGmailAppId)); EXPECT_EQ("Chrome", GetPinnedAppStatus()); // Installing |extension2_| should add it to the shelf - behind the // chrome icon. ash::ShelfItem item; AddExtension(extension2_.get()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(web_app::kGmailAppId)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(web_app::kGmailAppId)); EXPECT_EQ("Chrome, App2", GetPinnedAppStatus()); - // Installing |extension1_| should add it to the launcher - behind the + // Installing |extension1_| should add it to the shelf - behind the // chrome icon, but in first location. AddExtension(extension1_.get()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(web_app::kGmailAppId)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(web_app::kGmailAppId)); EXPECT_EQ("App1, Chrome, App2", GetPinnedAppStatus()); - // Installing Gmail should add it to the launcher - behind the chrome icon, + // Installing Gmail should add it to the shelf - behind the chrome icon, // but in first location. AddWebApp(web_app::kGmailAppId); EXPECT_EQ("App1, Chrome, App2, Gmail", GetPinnedAppStatus()); } // Check that syncing to a different state does the correct thing. -TEST_F(ChromeLauncherControllerTest, RestorePreinstalledAppsResyncOrder) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, RestorePreinstalledAppsResyncOrder) { + InitShelfController(); syncer::SyncChangeList sync_list0; InsertAddPinChange(&sync_list0, 0, extension1_->id()); @@ -1791,186 +1780,185 @@ } // Test the V1 app interaction flow: run it, activate it, close it. -TEST_F(ChromeLauncherControllerTest, V1AppRunActivateClose) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, V1AppRunActivateClose) { + InitShelfController(); // The model should only contain the browser shortcut item. EXPECT_EQ(1, model_->item_count()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is running should create a new shelf item. - launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); + shelf_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(ash::TYPE_APP, model_->items()[1].type); EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[1].status); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is running again should have no effect. - launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); + shelf_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[1].status); // Reporting that the app is closed should remove its shelf item. - launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); + shelf_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); EXPECT_EQ(1, model_->item_count()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is closed again should have no effect. - launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); + shelf_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); EXPECT_EQ(1, model_->item_count()); } // Test the V1 app interaction flow: pin it, run it, close it, unpin it. -TEST_F(ChromeLauncherControllerTest, V1AppPinRunCloseUnpin) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, V1AppPinRunCloseUnpin) { + InitShelfController(); // The model should only contain the browser shortcut. EXPECT_EQ(1, model_->item_count()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Pinning the app should create a new shelf item. - launcher_controller_->PinAppWithID(extension1_->id()); + shelf_controller_->PinAppWithID(extension1_->id()); EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[1].type); EXPECT_EQ(ash::STATUS_CLOSED, model_->items()[1].status); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is running should just update the existing item. - launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); + shelf_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[1].type); EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[1].status); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is closed should just update the existing item. - launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); + shelf_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[1].type); EXPECT_EQ(ash::STATUS_CLOSED, model_->items()[1].status); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Unpinning the app should remove its shelf item. - launcher_controller_->UnpinAppWithID(extension1_->id()); + shelf_controller_->UnpinAppWithID(extension1_->id()); EXPECT_EQ(1, model_->item_count()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); } // Test the V1 app interaction flow: run it, pin it, close it, unpin it. -TEST_F(ChromeLauncherControllerTest, V1AppRunPinCloseUnpin) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, V1AppRunPinCloseUnpin) { + InitShelfController(); // The model should only contain the browser shortcut. EXPECT_EQ(1, model_->item_count()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is running should create a new shelf item. - launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); + shelf_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(ash::TYPE_APP, model_->items()[1].type); EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[1].status); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Pinning the app should just update the existing item. - launcher_controller_->PinAppWithID(extension1_->id()); + shelf_controller_->PinAppWithID(extension1_->id()); EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[1].type); EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[1].status); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is closed should just update the existing item. - launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); + shelf_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[1].type); EXPECT_EQ(ash::STATUS_CLOSED, model_->items()[1].status); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Unpinning the app should remove its shelf item. - launcher_controller_->UnpinAppWithID(extension1_->id()); + shelf_controller_->UnpinAppWithID(extension1_->id()); EXPECT_EQ(1, model_->item_count()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); } // Test the V1 app interaction flow: pin it, run it, unpin it, close it. -TEST_F(ChromeLauncherControllerTest, V1AppPinRunUnpinClose) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, V1AppPinRunUnpinClose) { + InitShelfController(); // The model should only contain the browser shortcut item. EXPECT_EQ(1, model_->item_count()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Pinning the app should create a new shelf item. - launcher_controller_->PinAppWithID(extension1_->id()); + shelf_controller_->PinAppWithID(extension1_->id()); EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[1].type); EXPECT_EQ(ash::STATUS_CLOSED, model_->items()[1].status); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is running should just update the existing item. - launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); + shelf_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[1].type); EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[1].status); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Unpinning the app should just update the existing item. - launcher_controller_->UnpinAppWithID(extension1_->id()); + shelf_controller_->UnpinAppWithID(extension1_->id()); EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(ash::TYPE_APP, model_->items()[1].type); EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[1].status); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is closed should remove its shelf item. - launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); + shelf_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); EXPECT_EQ(1, model_->item_count()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(nullptr, - launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); + shelf_controller_->GetItem(ash::ShelfID(extension1_->id()))); } // Ensure unpinned V1 app ordering is properly restored after user changes. -TEST_F(ChromeLauncherControllerTest, CheckRunningV1AppOrder) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, CheckRunningV1AppOrder) { + InitShelfController(); // The model should only contain the browser shortcut item. EXPECT_EQ(1, model_->item_count()); // Add a few running applications. - launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); - launcher_controller_->SetV1AppStatus(extension2_->id(), ash::STATUS_RUNNING); - launcher_controller_->SetV1AppStatus(web_app::kGmailAppId, - ash::STATUS_RUNNING); + shelf_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); + shelf_controller_->SetV1AppStatus(extension2_->id(), ash::STATUS_RUNNING); + shelf_controller_->SetV1AppStatus(web_app::kGmailAppId, ash::STATUS_RUNNING); EXPECT_EQ(4, model_->item_count()); // Note that this not only checks the order of applications but also the // running type. @@ -1997,23 +1985,22 @@ // Switch again some items and even delete one - making sure that the missing // item gets properly handled. model_->Move(2, 3); - launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); + shelf_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); EXPECT_EQ("Chrome, gmail, app2", GetPinnedAppStatus()); RestoreUnpinnedRunningApplicationOrder(current_account_id); EXPECT_EQ("Chrome, app2, gmail", GetPinnedAppStatus()); // Check that removing more items does not crash and changes nothing. - launcher_controller_->SetV1AppStatus(extension2_->id(), ash::STATUS_CLOSED); + shelf_controller_->SetV1AppStatus(extension2_->id(), ash::STATUS_CLOSED); RestoreUnpinnedRunningApplicationOrder(current_account_id); EXPECT_EQ("Chrome, gmail", GetPinnedAppStatus()); - launcher_controller_->SetV1AppStatus(web_app::kGmailAppId, - ash::STATUS_CLOSED); + shelf_controller_->SetV1AppStatus(web_app::kGmailAppId, ash::STATUS_CLOSED); RestoreUnpinnedRunningApplicationOrder(current_account_id); EXPECT_EQ("Chrome", GetPinnedAppStatus()); } -TEST_F(ChromeLauncherControllerWithArcTest, ArcDeferredLaunch) { - InitLauncherController(); +TEST_F(ChromeShelfControllerWithArcTest, ArcDeferredLaunch) { + InitShelfController(); const arc::mojom::AppInfo& app1 = arc_test_.fake_apps()[0]; const arc::mojom::AppInfo& app2 = arc_test_.fake_apps()[1]; @@ -2033,10 +2020,10 @@ const ash::ShelfID shelf_id_app_2(arc_app_id2); const ash::ShelfID shelf_id_app_3(arc_app_id3); const ash::ShelfID shelf_id_shortcut(arc_shortcut_id); - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id_app_1)); - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id_app_2)); - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id_app_3)); - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id_shortcut)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id_app_1)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id_app_2)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id_app_3)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id_shortcut)); arc::LaunchApp(profile(), arc_app_id1, ui::EF_LEFT_MOUSE_BUTTON, arc::UserInteractionType::NOT_USER_INITIATED); @@ -2049,10 +2036,10 @@ arc::LaunchApp(profile(), arc_shortcut_id, ui::EF_LEFT_MOUSE_BUTTON, arc::UserInteractionType::NOT_USER_INITIATED); - EXPECT_TRUE(launcher_controller_->GetItem(shelf_id_app_1)); - EXPECT_TRUE(launcher_controller_->GetItem(shelf_id_app_2)); - EXPECT_TRUE(launcher_controller_->GetItem(shelf_id_app_3)); - EXPECT_TRUE(launcher_controller_->GetItem(shelf_id_shortcut)); + EXPECT_TRUE(shelf_controller_->GetItem(shelf_id_app_1)); + EXPECT_TRUE(shelf_controller_->GetItem(shelf_id_app_2)); + EXPECT_TRUE(shelf_controller_->GetItem(shelf_id_app_3)); + EXPECT_TRUE(shelf_controller_->GetItem(shelf_id_shortcut)); // We activated arc_app_id1 twice but expect one close for item controller // stops launching request. @@ -2062,10 +2049,10 @@ item_delegate->Close(); base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id_app_1)); - EXPECT_TRUE(launcher_controller_->GetItem(shelf_id_app_2)); - EXPECT_TRUE(launcher_controller_->GetItem(shelf_id_app_3)); - EXPECT_TRUE(launcher_controller_->GetItem(shelf_id_shortcut)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id_app_1)); + EXPECT_TRUE(shelf_controller_->GetItem(shelf_id_app_2)); + EXPECT_TRUE(shelf_controller_->GetItem(shelf_id_app_3)); + EXPECT_TRUE(shelf_controller_->GetItem(shelf_id_shortcut)); arc_test_.RestartArcInstance(); SendListOfArcApps(); @@ -2074,10 +2061,10 @@ // Now spinner controllers should go away together with shelf items and ARC // app instance should receive request for launching apps and shortcuts. - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id_app_1)); - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id_app_2)); - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id_app_3)); - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id_shortcut)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id_app_1)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id_app_2)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id_app_3)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id_shortcut)); ASSERT_EQ(2U, arc_test_.app_instance()->launch_requests().size()); ASSERT_EQ(1U, arc_test_.app_instance()->launch_intents().size()); @@ -2094,8 +2081,8 @@ } // Launch is canceled in case app becomes suspended. -TEST_F(ChromeLauncherControllerWithArcTest, ArcDeferredLaunchForSuspendedApp) { - InitLauncherController(); +TEST_F(ChromeShelfControllerWithArcTest, ArcDeferredLaunchForSuspendedApp) { + InitShelfController(); arc::mojom::AppInfo app = arc_test_.fake_apps()[0]; const std::string app_id = ArcAppTest::GetAppId(app); @@ -2111,14 +2098,14 @@ const ash::ShelfID shelf_id(app_id); arc::LaunchApp(profile(), app_id, ui::EF_LEFT_MOUSE_BUTTON, arc::UserInteractionType::NOT_USER_INITIATED); - EXPECT_TRUE(launcher_controller_->GetItem(shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(shelf_id)); // Send app with suspended state. app.suspended = true; arc_test_.app_instance()->SendRefreshAppList({app}); - // Controler automatically closed. - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id)); + // Controller automatically closed. + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id)); // And no launch request issued. EXPECT_TRUE(arc_test_.app_instance()->launch_requests().empty()); @@ -2126,18 +2113,18 @@ // Ensure the spinner controller does not override the active app controller // (crbug.com/701152). -TEST_F(ChromeLauncherControllerWithArcTest, ArcDeferredLaunchForActiveApp) { - InitLauncherController(); +TEST_F(ChromeShelfControllerWithArcTest, ArcDeferredLaunchForActiveApp) { + InitShelfController(); SendListOfArcApps(); arc_test_.StopArcInstance(); const arc::mojom::AppInfo& app = arc_test_.fake_apps()[0]; const std::string app_id = ArcAppTest::GetAppId(app); - launcher_controller_->PinAppWithID(app_id); - EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); + shelf_controller_->PinAppWithID(app_id); + EXPECT_TRUE(shelf_controller_->IsAppPinned(app_id)); const ash::ShelfID shelf_id(app_id); - const ash::ShelfItem* item = launcher_controller_->GetItem(shelf_id); + const ash::ShelfItem* item = shelf_controller_->GetItem(shelf_id); ASSERT_NE(nullptr, item); EXPECT_EQ(ash::STATUS_CLOSED, item->status); EXPECT_EQ(ash::TYPE_PINNED_APP, item->type); @@ -2147,18 +2134,17 @@ model_->SetShelfItemDelegate( shelf_id, std::make_unique<AppServiceAppWindowShelfItemController>( - shelf_id, launcher_controller_->app_service_app_window_controller())); - launcher_controller_->SetItemStatus(shelf_id, ash::STATUS_RUNNING); + shelf_id, shelf_controller_->app_service_app_window_controller())); + shelf_controller_->SetItemStatus(shelf_id, ash::STATUS_RUNNING); // This launch request should be ignored in case of active app. arc::LaunchApp(profile(), app_id, ui::EF_LEFT_MOUSE_BUTTON, arc::UserInteractionType::NOT_USER_INITIATED); - EXPECT_FALSE( - launcher_controller_->GetShelfSpinnerController()->HasApp(app_id)); + EXPECT_FALSE(shelf_controller_->GetShelfSpinnerController()->HasApp(app_id)); // Closing the app should leave a pinned but closed shelf item shortcut. - launcher_controller_->CloseLauncherItem(shelf_id); - item = launcher_controller_->GetItem(shelf_id); + shelf_controller_->CloseLauncherItem(shelf_id); + item = shelf_controller_->GetItem(shelf_id); ASSERT_NE(nullptr, item); EXPECT_EQ(ash::STATUS_CLOSED, item->status); EXPECT_EQ(ash::TYPE_PINNED_APP, item->type); @@ -2166,15 +2152,14 @@ // Now launch request should not be ignored. arc::LaunchApp(profile(), app_id, ui::EF_LEFT_MOUSE_BUTTON, arc::UserInteractionType::NOT_USER_INITIATED); - EXPECT_TRUE( - launcher_controller_->GetShelfSpinnerController()->HasApp(app_id)); + EXPECT_TRUE(shelf_controller_->GetShelfSpinnerController()->HasApp(app_id)); } // TODO(crbug.com/915840): this test is flakey and/or often crashes. -TEST_F(ChromeLauncherControllerMultiProfileWithArcTest, DISABLED_ArcMultiUser) { +TEST_F(ChromeShelfControllerMultiProfileWithArcTest, DISABLED_ArcMultiUser) { SendListOfArcApps(); - InitLauncherController(); + InitShelfController(); SetShelfControllerHelper(new TestShelfControllerHelper); @@ -2201,47 +2186,47 @@ views::Widget* arc_window1 = CreateArcWindow(window_app_id1); arc_test_.app_instance()->SendTaskCreated(1, arc_test_.fake_apps()[0], std::string()); - EXPECT_TRUE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id1))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id1))); std::string window_app_id2("org.chromium.arc.2"); views::Widget* arc_window2 = CreateArcWindow(window_app_id2); arc_test_.app_instance()->SendTaskCreated(2, arc_test_.fake_apps()[1], std::string()); - EXPECT_TRUE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id2))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id2))); - launcher_controller_->SetProfileForTest(profile2); + shelf_controller_->SetProfileForTest(profile2); SwitchActiveUser(account_id2); - EXPECT_FALSE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id1))); - EXPECT_FALSE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id2))); + EXPECT_FALSE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id1))); + EXPECT_FALSE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id2))); std::string window_app_id3("org.chromium.arc.3"); views::Widget* arc_window3 = CreateArcWindow(window_app_id3); arc_test_.app_instance()->SendTaskCreated(3, arc_test_.fake_apps()[2], std::string()); - EXPECT_FALSE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id3))); + EXPECT_FALSE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id3))); arc_window2->CloseNow(); arc_test_.app_instance()->SendTaskDestroyed(2); - launcher_controller_->SetProfileForTest(profile()); + shelf_controller_->SetProfileForTest(profile()); SwitchActiveUser(account_id); - EXPECT_TRUE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id1))); - EXPECT_FALSE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id2))); - EXPECT_TRUE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id3))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id1))); + EXPECT_FALSE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id2))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id3))); // Close active window to let test passes. arc_window1->CloseNow(); arc_window3->CloseNow(); } -TEST_F(ChromeLauncherControllerWithArcTest, ArcRunningApp) { - InitLauncherController(); +TEST_F(ChromeShelfControllerWithArcTest, ArcRunningApp) { + InitShelfController(); const std::string arc_app_id = ArcAppTest::GetAppId(arc_test_.fake_apps()[0]); SendListOfArcApps(); - EXPECT_FALSE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id))); + EXPECT_FALSE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id))); // Normal flow, create/destroy tasks. std::string window_app_id1("org.chromium.arc.1"); @@ -2250,30 +2235,30 @@ CreateArcWindow(window_app_id1); arc_test_.app_instance()->SendTaskCreated(1, arc_test_.fake_apps()[0], std::string()); - EXPECT_TRUE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id))); CreateArcWindow(window_app_id2); arc_test_.app_instance()->SendTaskCreated(2, arc_test_.fake_apps()[0], std::string()); - EXPECT_TRUE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id))); arc_test_.app_instance()->SendTaskDestroyed(1); - EXPECT_TRUE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id))); arc_test_.app_instance()->SendTaskDestroyed(2); - EXPECT_FALSE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id))); + EXPECT_FALSE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id))); // Stopping bridge removes apps. CreateArcWindow(window_app_id3); arc_test_.app_instance()->SendTaskCreated(3, arc_test_.fake_apps()[0], std::string()); - EXPECT_TRUE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id))); arc_test_.StopArcInstance(); base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id))); + EXPECT_FALSE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id))); } // Test race creation/deletion of ARC app. // TODO(khmel): Remove after moving everything to wayland protocol. -TEST_F(ChromeLauncherControllerWithArcTest, ArcRaceCreateClose) { - InitLauncherController(); +TEST_F(ChromeShelfControllerWithArcTest, ArcRaceCreateClose) { + InitShelfController(); const std::string arc_app_id1 = ArcAppTest::GetAppId(arc_test_.fake_apps()[0]); @@ -2284,35 +2269,35 @@ // ARC window created before and closed after mojom notification. std::string window_app_id1("org.chromium.arc.1"); views::Widget* arc_window = CreateArcWindow(window_app_id1); - EXPECT_FALSE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id1))); + EXPECT_FALSE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id1))); ASSERT_TRUE(arc_window); arc_test_.app_instance()->SendTaskCreated(1, arc_test_.fake_apps()[0], std::string()); - EXPECT_TRUE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id1))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id1))); arc_test_.app_instance()->SendTaskDestroyed(1); - EXPECT_FALSE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id1))); + EXPECT_FALSE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id1))); arc_window->Close(); base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id1))); + EXPECT_FALSE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id1))); // ARC window created after and closed before mojom notification. std::string window_app_id2("org.chromium.arc.2"); arc_test_.app_instance()->SendTaskCreated(2, arc_test_.fake_apps()[1], std::string()); - EXPECT_TRUE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id2))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id2))); arc_window = CreateArcWindow(window_app_id2); ASSERT_TRUE(arc_window); - EXPECT_TRUE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id2))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id2))); arc_window->Close(); base::RunLoop().RunUntilIdle(); // Closing window does not close shelf item. It is closed on task destroy. - EXPECT_TRUE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id2))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id2))); arc_test_.app_instance()->SendTaskDestroyed(2); - EXPECT_FALSE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id2))); + EXPECT_FALSE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id2))); } -TEST_F(ChromeLauncherControllerWithArcTest, ArcWindowRecreation) { - InitLauncherController(); +TEST_F(ChromeShelfControllerWithArcTest, ArcWindowRecreation) { + InitShelfController(); const std::string arc_app_id = ArcAppTest::GetAppId(arc_test_.fake_apps()[0]); SendListOfArcApps(); @@ -2322,29 +2307,29 @@ ASSERT_TRUE(arc_window); arc_test_.app_instance()->SendTaskCreated(1, arc_test_.fake_apps()[0], std::string()); - EXPECT_TRUE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id))); for (int i = 0; i < 3; ++i) { arc_window->Close(); base::RunLoop().RunUntilIdle(); - EXPECT_TRUE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id))); arc_window = CreateArcWindow(window_app_id); ASSERT_TRUE(arc_window); base::RunLoop().RunUntilIdle(); - EXPECT_TRUE(launcher_controller_->GetItem(ash::ShelfID(arc_app_id))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID(arc_app_id))); } } -// Verifies edge cases when Extension app launcher may be overwritten by ARC app -// launcher controller and vice versa. This should not happen in normal cases -// but in case of ARC boot failure this may lead to such situation. This test -// verifies that dynamic change of app launcher controllers is safe. -// See more crbug.com/770005. -TEST_F(ChromeLauncherControllerWithArcTest, OverrideAppItemController) { +// Verifies edge cases when Extension app item controller may be overwritten by +// ARC app item controller and vice versa. This should not happen in normal +// cases but in case of ARC boot failure this may lead to such situation. This +// test verifies that dynamic change of app item controllers is safe. See more +// crbug.com/770005. +TEST_F(ChromeShelfControllerWithArcTest, OverrideAppItemController) { extension_service_->AddExtension(arc_support_host_.get()); - InitLauncherController(); + InitShelfController(); SendListOfArcApps(); arc::mojom::AppInfo app_info = CreateAppInfo( @@ -2355,8 +2340,8 @@ std::string window_app_id("org.chromium.arc.1"); const ash::ShelfID play_store_shelf_id(arc::kPlayStoreAppId); - launcher_controller_->UnpinAppWithID(arc::kPlayStoreAppId); - EXPECT_FALSE(launcher_controller_->GetItem(play_store_shelf_id)); + shelf_controller_->UnpinAppWithID(arc::kPlayStoreAppId); + EXPECT_FALSE(shelf_controller_->GetItem(play_store_shelf_id)); // Try 4 different scenarios with different creation and destroying orders. @@ -2365,19 +2350,19 @@ std::unique_ptr<V2App> play_store_optin = std::make_unique<V2App>(profile(), arc_support_host_.get(), extensions::AppWindow::WINDOW_TYPE_DEFAULT); - EXPECT_TRUE(launcher_controller_->GetItem(play_store_shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(play_store_shelf_id)); views::Widget* arc_window = CreateArcWindow(window_app_id); ASSERT_TRUE(arc_window); arc_test_.app_instance()->SendTaskCreated(1, app_info, std::string()); - EXPECT_TRUE(launcher_controller_->GetItem(play_store_shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(play_store_shelf_id)); play_store_optin.reset(); - EXPECT_TRUE(launcher_controller_->GetItem(play_store_shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(play_store_shelf_id)); arc_window->CloseNow(); arc_test_.app_instance()->SendTaskDestroyed(1); - EXPECT_FALSE(launcher_controller_->GetItem(play_store_shelf_id)); + EXPECT_FALSE(shelf_controller_->GetItem(play_store_shelf_id)); } // Scenario 2: Create OptIn, Play Store. Destroy Play Store, OptIn. @@ -2385,19 +2370,19 @@ std::unique_ptr<V2App> play_store_optin = std::make_unique<V2App>(profile(), arc_support_host_.get(), extensions::AppWindow::WINDOW_TYPE_DEFAULT); - EXPECT_TRUE(launcher_controller_->GetItem(play_store_shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(play_store_shelf_id)); views::Widget* arc_window = CreateArcWindow(window_app_id); ASSERT_TRUE(arc_window); arc_test_.app_instance()->SendTaskCreated(1, app_info, std::string()); - EXPECT_TRUE(launcher_controller_->GetItem(play_store_shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(play_store_shelf_id)); arc_window->CloseNow(); arc_test_.app_instance()->SendTaskDestroyed(1); - EXPECT_FALSE(launcher_controller_->GetItem(play_store_shelf_id)); + EXPECT_FALSE(shelf_controller_->GetItem(play_store_shelf_id)); play_store_optin.reset(); - EXPECT_FALSE(launcher_controller_->GetItem(play_store_shelf_id)); + EXPECT_FALSE(shelf_controller_->GetItem(play_store_shelf_id)); } // Scenario 3: Create Play Store, OptIn. Destroy OptIn, Play Store. @@ -2405,19 +2390,19 @@ views::Widget* arc_window = CreateArcWindow(window_app_id); ASSERT_TRUE(arc_window); arc_test_.app_instance()->SendTaskCreated(1, app_info, std::string()); - EXPECT_TRUE(launcher_controller_->GetItem(play_store_shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(play_store_shelf_id)); std::unique_ptr<V2App> play_store_optin = std::make_unique<V2App>(profile(), arc_support_host_.get(), extensions::AppWindow::WINDOW_TYPE_DEFAULT); - EXPECT_TRUE(launcher_controller_->GetItem(play_store_shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(play_store_shelf_id)); play_store_optin.reset(); - EXPECT_FALSE(launcher_controller_->GetItem(play_store_shelf_id)); + EXPECT_FALSE(shelf_controller_->GetItem(play_store_shelf_id)); arc_window->CloseNow(); arc_test_.app_instance()->SendTaskDestroyed(1); - EXPECT_FALSE(launcher_controller_->GetItem(play_store_shelf_id)); + EXPECT_FALSE(shelf_controller_->GetItem(play_store_shelf_id)); } // Scenario 4: Create Play Store, OptIn. Destroy Play Store, OptIn. @@ -2425,26 +2410,26 @@ views::Widget* arc_window = CreateArcWindow(window_app_id); ASSERT_TRUE(arc_window); arc_test_.app_instance()->SendTaskCreated(1, app_info, std::string()); - EXPECT_TRUE(launcher_controller_->GetItem(play_store_shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(play_store_shelf_id)); std::unique_ptr<V2App> play_store_optin = std::make_unique<V2App>(profile(), arc_support_host_.get(), extensions::AppWindow::WINDOW_TYPE_DEFAULT); - EXPECT_TRUE(launcher_controller_->GetItem(play_store_shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(play_store_shelf_id)); arc_window->CloseNow(); arc_test_.app_instance()->SendTaskDestroyed(1); - EXPECT_TRUE(launcher_controller_->GetItem(play_store_shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(play_store_shelf_id)); play_store_optin.reset(); - EXPECT_FALSE(launcher_controller_->GetItem(play_store_shelf_id)); + EXPECT_FALSE(shelf_controller_->GetItem(play_store_shelf_id)); } } // Validate that ARC app is pinned correctly and pin is removed automatically // once app is uninstalled. -TEST_F(ChromeLauncherControllerWithArcTest, ArcAppPin) { - InitLauncherController(); +TEST_F(ChromeShelfControllerWithArcTest, ArcAppPin) { + InitShelfController(); const std::string arc_app_id = ArcAppTest::GetAppId(arc_test_.fake_apps()[0]); @@ -2454,17 +2439,17 @@ // Allow async callbacks to run. base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id)); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(arc_app_id)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension2_->id())); - launcher_controller_->PinAppWithID(extension1_->id()); - launcher_controller_->PinAppWithID(arc_app_id); - launcher_controller_->PinAppWithID(extension2_->id()); + shelf_controller_->PinAppWithID(extension1_->id()); + shelf_controller_->PinAppWithID(arc_app_id); + shelf_controller_->PinAppWithID(extension2_->id()); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id)); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(arc_app_id)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension2_->id())); EXPECT_EQ("Chrome, App1, Fake App 0, App2", GetPinnedAppStatus()); @@ -2472,18 +2457,18 @@ // Allow async callbacks to run. base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(arc_app_id)); EXPECT_EQ("Chrome, App1, App2", GetPinnedAppStatus()); SendListOfArcApps(); // Allow async callbacks to run. base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(arc_app_id)); EXPECT_EQ("Chrome, App1, App2", GetPinnedAppStatus()); // Opt-Out/Opt-In remove item from the shelf. - launcher_controller_->PinAppWithID(arc_app_id); + shelf_controller_->PinAppWithID(arc_app_id); EXPECT_EQ("Chrome, App1, App2, Fake App 0", GetPinnedAppStatus()); EnablePlayStore(false); EXPECT_EQ("Chrome, App1, App2", GetPinnedAppStatus()); @@ -2498,8 +2483,8 @@ } // Validates that ARC app pins persist across OptOut/OptIn. -TEST_F(ChromeLauncherControllerWithArcTest, ArcAppPinOptOutOptIn) { - InitLauncherController(); +TEST_F(ChromeShelfControllerWithArcTest, ArcAppPinOptOutOptIn) { + InitShelfController(); const std::string arc_app_id1 = ArcAppTest::GetAppId(arc_test_.fake_apps()[0]); @@ -2510,39 +2495,39 @@ extension_service_->AddExtension(extension1_.get()); extension_service_->AddExtension(extension2_.get()); - launcher_controller_->PinAppWithID(extension1_->id()); - launcher_controller_->PinAppWithID(arc_app_id2); - launcher_controller_->PinAppWithID(extension2_->id()); - launcher_controller_->PinAppWithID(arc_app_id1); + shelf_controller_->PinAppWithID(extension1_->id()); + shelf_controller_->PinAppWithID(arc_app_id2); + shelf_controller_->PinAppWithID(extension2_->id()); + shelf_controller_->PinAppWithID(arc_app_id1); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id1)); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); - EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id2)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(arc_app_id1)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension2_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(arc_app_id2)); EXPECT_EQ("Chrome, App1, Fake App 1, App2, Fake App 0", GetPinnedAppStatus()); EnablePlayStore(false); EXPECT_EQ("Chrome, App1, App2", GetPinnedAppStatus()); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id1)); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id2)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(arc_app_id1)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension2_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(arc_app_id2)); EnablePlayStore(true); SendListOfArcApps(); base::RunLoop().RunUntilIdle(); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id1)); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); - EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id2)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(arc_app_id1)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension2_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(arc_app_id2)); EXPECT_EQ("Chrome, App1, Fake App 1, App2, Fake App 0", GetPinnedAppStatus()); } -TEST_F(ChromeLauncherControllerWithArcTest, DISABLED_ArcCustomAppIcon) { - InitLauncherController(); +TEST_F(ChromeShelfControllerWithArcTest, DISABLED_ArcCustomAppIcon) { + InitShelfController(); // Wait until other apps are updated to avoid race condition while accessing // last updated item. @@ -2567,7 +2552,7 @@ // Some input that represents invalid png content. std::string invalid_png_data("aaaaaa"); - EXPECT_FALSE(launcher_controller_->GetItem(arc_shelf_id)); + EXPECT_FALSE(shelf_controller_->GetItem(arc_shelf_id)); std::string window_app_id1("org.chromium.arc.1"); std::string window_app_id2("org.chromium.arc.2"); views::Widget* window1 = CreateArcWindow(window_app_id1); @@ -2577,14 +2562,14 @@ views::Widget* window2 = CreateArcWindow(window_app_id2); ASSERT_TRUE(window2 && window2->GetNativeWindow()); arc_test_.app_instance()->SendTaskCreated(2, app, std::string()); - EXPECT_TRUE(launcher_controller_->GetItem(arc_shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(arc_shelf_id)); ash::ShelfItemDelegate* item_delegate = model_->GetShelfItemDelegate(arc_shelf_id); ASSERT_TRUE(item_delegate); base::RunLoop().RunUntilIdle(); auto get_icon = [=]() { - return *launcher_controller_->GetItem(arc_shelf_id)->image.bitmap(); + return *shelf_controller_->GetItem(arc_shelf_id)->image.bitmap(); }; const SkBitmap default_icon = get_icon(); @@ -2630,8 +2615,8 @@ EXPECT_TRUE(gfx::test::AreBitmapsEqual(custom_icon, get_icon())); } -TEST_F(ChromeLauncherControllerWithArcTest, ArcWindowPackageName) { - InitLauncherController(); +TEST_F(ChromeShelfControllerWithArcTest, ArcWindowPackageName) { + InitShelfController(); SendListOfArcApps(); app_service_test().WaitForAppService(); @@ -2670,10 +2655,10 @@ // Check that with multi profile V1 apps are properly added / removed from the // shelf. -TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest, +TEST_F(MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest, V1AppUpdateOnUserSwitch) { - // Create a browser item in the LauncherController. - InitLauncherController(); + // Create a browser item in the controller. + InitShelfController(); EXPECT_EQ(1, model_->item_count()); { @@ -2701,10 +2686,10 @@ } // Check edge cases with multi profile V1 apps in the shelf. -TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest, +TEST_F(MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest, V1AppUpdateOnUserSwitchEdgecases) { - // Create a browser item in the LauncherController. - InitLauncherController(); + // Create a browser item in the controller. + InitShelfController(); // First test: Create an app when the user is not active. std::string user2 = "user2"; @@ -2737,10 +2722,10 @@ } // Check edge case where a visiting V1 app gets closed (crbug.com/321374). -TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest, +TEST_F(MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest, V1CloseOnVisitingDesktop) { - // Create a browser item in the LauncherController. - InitLauncherController(); + // Create a browser item in the controller. + InitShelfController(); // First create an app when the user is active. std::string user2 = "user2"; @@ -2773,10 +2758,10 @@ } // Check edge cases with multi profile V1 apps in the shelf. -TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest, +TEST_F(MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest, V1AppUpdateOnUserSwitchEdgecases2) { - // Create a browser item in the LauncherController. - InitLauncherController(); + // Create a browser item in the controller. + InitShelfController(); // First test: Create an app when the user is not active. std::string user2 = "user2"; @@ -2811,10 +2796,10 @@ // Check that activating an item which is on another user's desktop, will bring // it back. -TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest, - TestLauncherActivationPullsBackWindow) { - // Create a browser item in the LauncherController. - InitLauncherController(); +TEST_F(MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest, + TestShelfActivationPullsBackWindow) { + // Create a browser item in the controller. + InitShelfController(); ash::MultiUserWindowManager* window_manager = MultiUserWindowManagerHelper::GetWindowManager(); @@ -2835,7 +2820,7 @@ // Check that an activation of the window on its owner's desktop does not // change the visibility to another user. - launcher_controller_->ActivateWindowOrMinimizeIfActive(browser_window, false); + shelf_controller_->ActivateWindowOrMinimizeIfActive(browser_window, false); EXPECT_TRUE(IsWindowOnDesktopOfUser(window, current_user)); // Transfer the window to another user's desktop and check that activating it @@ -2843,17 +2828,17 @@ window_manager->ShowWindowForUser( window, multi_user_util::GetAccountIdFromProfile(profile2)); EXPECT_FALSE(IsWindowOnDesktopOfUser(window, current_user)); - launcher_controller_->ActivateWindowOrMinimizeIfActive(browser_window, false); + shelf_controller_->ActivateWindowOrMinimizeIfActive(browser_window, false); EXPECT_TRUE(IsWindowOnDesktopOfUser(window, current_user)); } // Tests that web app icon is removed from shelf after user switch if the app is // not installed by the new active user, even if the user has the URL associated // with the app open in a tab. -TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest, +TEST_F(MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest, WebAppNotShownIfNotInstalledAfterUserSwitch) { - // Create a browser item in the LauncherController. - InitLauncherController(); + // Create a browser item in the controller. + InitShelfController(); std::string user2 = "user2"; TestingProfile* profile2 = CreateMultiUserProfile(user2); @@ -2873,7 +2858,7 @@ web_app_info->start_url = GURL(kWebAppUrl); web_app::AppId installed_app_id = web_app::test::InstallWebApp(profile(), std::move(web_app_info)); - launcher_controller_->PinAppWithID(installed_app_id); + shelf_controller_->PinAppWithID(installed_app_id); std::unique_ptr<Browser> profile2_browser = CreateBrowserAndTabWithProfile(profile2, kWebAppName, kWebAppUrl); @@ -2894,9 +2879,8 @@ // Check that a running windowed V1 application will be properly pinned and // unpinned when the order gets changed through a profile / policy change. -TEST_F(ChromeLauncherControllerTest, - RestoreDefaultAndRunningV1AppsResyncOrder) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, RestoreDefaultAndRunningV1AppsResyncOrder) { + InitShelfController(); StartPrefSyncService(syncer::SyncDataList()); @@ -2913,7 +2897,7 @@ EXPECT_EQ("Chrome, App1", GetPinnedAppStatus()); // Set the app status as running, which will add an unpinned item. - launcher_controller_->SetV1AppStatus(extension2_->id(), ash::STATUS_RUNNING); + shelf_controller_->SetV1AppStatus(extension2_->id(), ash::STATUS_RUNNING); EXPECT_EQ("Chrome, App1, app2", GetPinnedAppStatus()); AddWebApp(web_app::kGmailAppId); EXPECT_EQ("Chrome, App1, Gmail, app2", GetPinnedAppStatus()); @@ -2944,9 +2928,8 @@ // Check that a running unpinned V2 application will be properly pinned and // unpinned when the order gets changed through a profile / policy change. -TEST_F(ChromeLauncherControllerTest, - RestoreDefaultAndRunningV2AppsResyncOrder) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, RestoreDefaultAndRunningV2AppsResyncOrder) { + InitShelfController(); syncer::SyncChangeList sync_list0; InsertAddPinChange(&sync_list0, 0, extension1_->id()); InsertAddPinChange(&sync_list0, 1, web_app::kGmailAppId); @@ -2989,7 +2972,7 @@ // Each user has a different set of applications pinned. Check that when // switching between the two users, the state gets properly set. -TEST_F(ChromeLauncherControllerTest, UserSwitchIconRestore) { +TEST_F(ChromeShelfControllerTest, UserSwitchIconRestore) { syncer::SyncChangeList user_a; syncer::SyncChangeList user_b; @@ -3017,7 +3000,7 @@ // Each user has a different set of applications pinned, and one user has an // application running. Check that when switching between the two users, the // state gets properly set. -TEST_F(ChromeLauncherControllerTest, UserSwitchIconRestoreWithRunningV2App) { +TEST_F(ChromeShelfControllerTest, UserSwitchIconRestoreWithRunningV2App) { syncer::SyncChangeList user_a; syncer::SyncChangeList user_b; @@ -3049,7 +3032,7 @@ // application running. The chrome icon is not the last item in the list. // Check that when switching between the two users, the state gets properly set. // There was once a bug associated with this. -TEST_F(ChromeLauncherControllerTest, +TEST_F(ChromeShelfControllerTest, UserSwitchIconRestoreWithRunningV2AppChromeInMiddle) { syncer::SyncChangeList user_a; syncer::SyncChangeList user_b; @@ -3076,7 +3059,7 @@ GetPinnedAppStatus()); } -TEST_F(ChromeLauncherControllerTest, Policy) { +TEST_F(ChromeShelfControllerTest, Policy) { extension_service_->AddExtension(extension2_.get()); AddWebApp(web_app::kGmailAppId); @@ -3087,48 +3070,48 @@ profile()->GetTestingPrefService()->SetManagedPref( prefs::kPolicyPinnedLauncherApps, policy_value.CreateDeepCopy()); - InitLauncherController(); + InitShelfController(); // Only |extension2_| should get pinned. |extension1_| is specified but not // installed, and Gmail is part of the default set, but that // shouldn't take effect when the policy override is in place. EXPECT_EQ("Chrome, App2", GetPinnedAppStatus()); - // Installing |extension1_| should add it to the launcher. Note, App1 goes + // Installing |extension1_| should add it to the shelf. Note, App1 goes // before App2 that is aligned with the pin order in policy. AddExtension(extension1_.get()); EXPECT_EQ("Chrome, App1, App2", GetPinnedAppStatus()); // Removing |extension1_| from the policy should not be reflected in the - // launcher and pin will exist. + // shelf and pin will exist. policy_value.Remove(0, nullptr); profile()->GetTestingPrefService()->SetManagedPref( prefs::kPolicyPinnedLauncherApps, policy_value.CreateDeepCopy()); EXPECT_EQ("Chrome, App1, App2", GetPinnedAppStatus()); } -TEST_F(ChromeLauncherControllerTest, UnpinWithUninstall) { +TEST_F(ChromeShelfControllerTest, UnpinWithUninstall) { AddWebApp(web_app::kGmailAppId); AddWebApp(web_app::kYoutubeAppId); - InitLauncherController(); + InitShelfController(); StartPrefSyncService(syncer::SyncDataList()); - EXPECT_TRUE(launcher_controller_->IsAppPinned(web_app::kGmailAppId)); - EXPECT_TRUE(launcher_controller_->IsAppPinned(web_app::kYoutubeAppId)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(web_app::kGmailAppId)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(web_app::kYoutubeAppId)); RemoveWebApp(web_app::kGmailAppId); - EXPECT_FALSE(launcher_controller_->IsAppPinned(web_app::kGmailAppId)); - EXPECT_TRUE(launcher_controller_->IsAppPinned(web_app::kYoutubeAppId)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(web_app::kGmailAppId)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(web_app::kYoutubeAppId)); } -TEST_F(ChromeLauncherControllerTest, SyncUpdates) { +TEST_F(ChromeShelfControllerTest, SyncUpdates) { extension_service_->AddExtension(extension2_.get()); AddWebApp(web_app::kGmailAppId); AddWebApp(web_app::kGoogleDocsAppId); - InitLauncherController(); + InitShelfController(); syncer::SyncChangeList sync_list; InsertAddPinChange(&sync_list, 10, extension_misc::kChromeAppId); @@ -3136,10 +3119,10 @@ std::vector<std::string> expected_pinned_apps; std::vector<std::string> actual_pinned_apps; - GetPinnedAppIds(launcher_controller_.get(), &actual_pinned_apps); + GetPinnedAppIds(shelf_controller_.get(), &actual_pinned_apps); EXPECT_EQ(expected_pinned_apps, actual_pinned_apps); - // Unavailable extensions don't create launcher items. + // Unavailable extensions don't create shelf items. sync_list.clear(); InsertAddPinChange(&sync_list, 0, extension1_->id()); InsertAddPinChange(&sync_list, 1, extension2_->id()); @@ -3148,7 +3131,7 @@ expected_pinned_apps.push_back(extension2_->id()); expected_pinned_apps.push_back(web_app::kGoogleDocsAppId); - GetPinnedAppIds(launcher_controller_.get(), &actual_pinned_apps); + GetPinnedAppIds(shelf_controller_.get(), &actual_pinned_apps); EXPECT_EQ(expected_pinned_apps, actual_pinned_apps); sync_list.clear(); @@ -3156,7 +3139,7 @@ SendPinChanges(sync_list, false); expected_pinned_apps.insert(expected_pinned_apps.begin() + 1, web_app::kGmailAppId); - GetPinnedAppIds(launcher_controller_.get(), &actual_pinned_apps); + GetPinnedAppIds(shelf_controller_.get(), &actual_pinned_apps); EXPECT_EQ(expected_pinned_apps, actual_pinned_apps); sync_list.clear(); @@ -3165,21 +3148,21 @@ InsertUpdatePinChange(&sync_list, 2, extension2_->id()); SendPinChanges(sync_list, false); std::reverse(expected_pinned_apps.begin(), expected_pinned_apps.end()); - GetPinnedAppIds(launcher_controller_.get(), &actual_pinned_apps); + GetPinnedAppIds(shelf_controller_.get(), &actual_pinned_apps); EXPECT_EQ(expected_pinned_apps, actual_pinned_apps); // Sending legacy sync change without pin info should not affect pin model. sync_list.clear(); InsertLegacyPinChange(&sync_list, web_app::kGoogleDocsAppId); SendPinChanges(sync_list, false); - GetPinnedAppIds(launcher_controller_.get(), &actual_pinned_apps); + GetPinnedAppIds(shelf_controller_.get(), &actual_pinned_apps); EXPECT_EQ(expected_pinned_apps, actual_pinned_apps); sync_list.clear(); InsertRemovePinChange(&sync_list, web_app::kGoogleDocsAppId); SendPinChanges(sync_list, false); expected_pinned_apps.erase(expected_pinned_apps.begin()); - GetPinnedAppIds(launcher_controller_.get(), &actual_pinned_apps); + GetPinnedAppIds(shelf_controller_.get(), &actual_pinned_apps); EXPECT_EQ(expected_pinned_apps, actual_pinned_apps); sync_list.clear(); @@ -3187,15 +3170,15 @@ InsertRemovePinChange(&sync_list, extension2_->id()); SendPinChanges(sync_list, false); expected_pinned_apps.clear(); - GetPinnedAppIds(launcher_controller_.get(), &actual_pinned_apps); + GetPinnedAppIds(shelf_controller_.get(), &actual_pinned_apps); EXPECT_EQ(expected_pinned_apps, actual_pinned_apps); } -TEST_F(ChromeLauncherControllerTest, PendingInsertionOrder) { +TEST_F(ChromeShelfControllerTest, PendingInsertionOrder) { extension_service_->AddExtension(extension1_.get()); AddWebApp(web_app::kGmailAppId); - InitLauncherController(); + InitShelfController(); syncer::SyncChangeList sync_list; InsertAddPinChange(&sync_list, 0, extension1_->id()); @@ -3208,14 +3191,14 @@ expected_pinned_apps.push_back(web_app::kGmailAppId); std::vector<std::string> actual_pinned_apps; - GetPinnedAppIds(launcher_controller_.get(), &actual_pinned_apps); + GetPinnedAppIds(shelf_controller_.get(), &actual_pinned_apps); EXPECT_EQ(expected_pinned_apps, actual_pinned_apps); // Install |extension2| and verify it shows up between the other two. AddExtension(extension2_.get()); expected_pinned_apps.insert(expected_pinned_apps.begin() + 1, extension2_->id()); - GetPinnedAppIds(launcher_controller_.get(), &actual_pinned_apps); + GetPinnedAppIds(shelf_controller_.get(), &actual_pinned_apps); EXPECT_EQ(expected_pinned_apps, actual_pinned_apps); } @@ -3230,18 +3213,18 @@ EXPECT_EQ(expected_item_titles[i], items[i].title); } -// Check that browsers get reflected correctly in the launcher menu. -TEST_F(ChromeLauncherControllerTest, BrowserMenuGeneration) { +// Check that browsers get reflected correctly in the shelf menu. +TEST_F(ChromeShelfControllerTest, BrowserMenuGeneration) { EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); chrome::NewTab(browser()); - InitLauncherController(); + InitShelfController(); // Check that the browser list is empty at this time. ash::ShelfItem item_browser; item_browser.type = ash::TYPE_BROWSER_SHORTCUT; item_browser.id = ash::ShelfID(extension_misc::kChromeAppId); - CheckAppMenu(launcher_controller_.get(), item_browser, 0, nullptr); + CheckAppMenu(shelf_controller_.get(), item_browser, 0, nullptr); // Now make the created browser() visible by showing its browser window. browser()->window()->Show(); @@ -3249,7 +3232,7 @@ NavigateAndCommitActiveTabWithTitle(browser(), GURL("http://test1"), title1); std::u16string one_menu_item[] = {title1}; - CheckAppMenu(launcher_controller_.get(), item_browser, 1, one_menu_item); + CheckAppMenu(shelf_controller_.get(), item_browser, 1, one_menu_item); // Create one more browser/window and check that one more was added. std::unique_ptr<Browser> browser2( @@ -3263,17 +3246,17 @@ // Check that the list contains now two entries - make furthermore sure that // the active item is the first entry. std::u16string two_menu_items[] = {title1, title2}; - CheckAppMenu(launcher_controller_.get(), item_browser, 2, two_menu_items); + CheckAppMenu(shelf_controller_.get(), item_browser, 2, two_menu_items); // Apparently we have to close all tabs we have. chrome::CloseTab(browser2.get()); } // Check the multi profile case where only user related browsers should show up. -TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest, +TEST_F(MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest, BrowserMenuGenerationTwoUsers) { - // Create a browser item in the LauncherController. - InitLauncherController(); + // Create a browser item in the controller. + InitShelfController(); ash::ShelfItem item_browser; item_browser.type = ash::TYPE_BROWSER_SHORTCUT; @@ -3281,14 +3264,14 @@ // Check that the menu is empty. chrome::NewTab(browser()); - CheckAppMenu(launcher_controller_.get(), item_browser, 0, nullptr); + CheckAppMenu(shelf_controller_.get(), item_browser, 0, nullptr); // Show the created |browser()| by showing its window. browser()->window()->Show(); std::u16string title1 = u"Test1"; NavigateAndCommitActiveTabWithTitle(browser(), GURL("http://test1"), title1); std::u16string one_menu_item1[] = {title1}; - CheckAppMenu(launcher_controller_.get(), item_browser, 1, one_menu_item1); + CheckAppMenu(shelf_controller_.get(), item_browser, 1, one_menu_item1); // Create a browser for another user and check that it is not included in the // users running browser list. @@ -3299,41 +3282,41 @@ std::unique_ptr<Browser> browser2( CreateBrowserAndTabWithProfile(profile2, user2, "http://test2")); std::u16string one_menu_item2[] = {ASCIIToUTF16(user2)}; - CheckAppMenu(launcher_controller_.get(), item_browser, 1, one_menu_item1); + CheckAppMenu(shelf_controller_.get(), item_browser, 1, one_menu_item1); // Switch to the other user and make sure that only that browser window gets // shown. SwitchActiveUser(account_id2); - CheckAppMenu(launcher_controller_.get(), item_browser, 1, one_menu_item2); + CheckAppMenu(shelf_controller_.get(), item_browser, 1, one_menu_item2); // Transferred browsers of other users should not show up in the list. MultiUserWindowManagerHelper::GetWindowManager()->ShowWindowForUser( browser()->window()->GetNativeWindow(), account_id2); - CheckAppMenu(launcher_controller_.get(), item_browser, 1, one_menu_item2); + CheckAppMenu(shelf_controller_.get(), item_browser, 1, one_menu_item2); chrome::CloseTab(browser2.get()); } -// Check that V1 apps are correctly reflected in the launcher menu using the +// Check that V1 apps are correctly reflected in the shelf menu using the // refocus logic. // Note that the extension matching logic is tested by the extension system // and does not need a separate test here. -TEST_F(ChromeLauncherControllerTest, V1AppMenuGeneration) { +TEST_F(ChromeShelfControllerTest, V1AppMenuGeneration) { EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); EXPECT_EQ(0, browser()->tab_strip_model()->count()); - InitLauncherControllerWithBrowser(); + InitShelfControllerWithBrowser(); StartPrefSyncService(syncer::SyncDataList()); // The model should only contain the browser shortcut item. EXPECT_EQ(1, model_->item_count()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(web_app::kGmailAppId)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(web_app::kGmailAppId)); - // Installing Gmail pins it to the launcher. + // Installing Gmail pins it to the shelf. const ash::ShelfID gmail_id(web_app::kGmailAppId); AddWebApp(web_app::kGmailAppId); - EXPECT_TRUE(launcher_controller_->IsAppPinned(web_app::kGmailAppId)); - launcher_controller_->SetRefocusURLPatternForTest(gmail_id, GURL(kGmailUrl)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(web_app::kGmailAppId)); + shelf_controller_->SetRefocusURLPatternForTest(gmail_id, GURL(kGmailUrl)); // Check the menu content. ash::ShelfItem item_browser; @@ -3343,14 +3326,14 @@ ash::ShelfItem item_gmail; item_gmail.type = ash::TYPE_PINNED_APP; item_gmail.id = gmail_id; - CheckAppMenu(launcher_controller_.get(), item_gmail, 0, nullptr); + CheckAppMenu(shelf_controller_.get(), item_gmail, 0, nullptr); // Set the gmail URL to a new tab. std::u16string title1 = u"Test1"; NavigateAndCommitActiveTabWithTitle(browser(), GURL(kGmailUrl), title1); std::u16string one_menu_item[] = {title1}; - CheckAppMenu(launcher_controller_.get(), item_gmail, 1, one_menu_item); + CheckAppMenu(shelf_controller_.get(), item_gmail, 1, one_menu_item); // Create one empty tab. chrome::NewTab(browser()); @@ -3362,35 +3345,35 @@ std::u16string title3 = u"Test3"; NavigateAndCommitActiveTabWithTitle(browser(), GURL(kGmailUrl), title3); std::u16string two_menu_items[] = {title1, title3}; - CheckAppMenu(launcher_controller_.get(), item_gmail, 2, two_menu_items); + CheckAppMenu(shelf_controller_.get(), item_gmail, 2, two_menu_items); // Even though the item is in the V1 app list, it should also be in the // browser list. std::u16string browser_menu_item[] = {title3}; - CheckAppMenu(launcher_controller_.get(), item_browser, 1, browser_menu_item); + CheckAppMenu(shelf_controller_.get(), item_browser, 1, browser_menu_item); // Test that closing of (all) the item(s) does work (and all menus get // updated properly). - launcher_controller_->Close(item_gmail.id); + shelf_controller_->Close(item_gmail.id); - CheckAppMenu(launcher_controller_.get(), item_gmail, 0, nullptr); + CheckAppMenu(shelf_controller_.get(), item_gmail, 0, nullptr); std::u16string browser_menu_item2[] = {title2}; - CheckAppMenu(launcher_controller_.get(), item_browser, 1, browser_menu_item2); + CheckAppMenu(shelf_controller_.get(), item_browser, 1, browser_menu_item2); } // Check the multi profile case where only user related apps should show up. -TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest, +TEST_F(MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest, V1AppMenuGenerationTwoUsers) { - // Create a browser item in the LauncherController. - InitLauncherController(); + // Create a browser item in the controller. + InitShelfController(); StartPrefSyncService(syncer::SyncDataList()); chrome::NewTab(browser()); - // Installing Gmail pins it to the launcher. + // Installing Gmail pins it to the shelf. const ash::ShelfID gmail_id(web_app::kGmailAppId); AddWebApp(web_app::kGmailAppId); - EXPECT_TRUE(launcher_controller_->IsAppPinned(web_app::kGmailAppId)); - launcher_controller_->SetRefocusURLPatternForTest(gmail_id, GURL(kGmailUrl)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(web_app::kGmailAppId)); + shelf_controller_->SetRefocusURLPatternForTest(gmail_id, GURL(kGmailUrl)); // Check the menu content. ash::ShelfItem item_browser; @@ -3400,14 +3383,14 @@ ash::ShelfItem item_gmail; item_gmail.type = ash::TYPE_PINNED_APP; item_gmail.id = gmail_id; - CheckAppMenu(launcher_controller_.get(), item_gmail, 0, nullptr); + CheckAppMenu(shelf_controller_.get(), item_gmail, 0, nullptr); // Set the gmail URL to a new tab. std::u16string title1 = u"Test1"; NavigateAndCommitActiveTabWithTitle(browser(), GURL(kGmailUrl), title1); std::u16string one_menu_item[] = {title1}; - CheckAppMenu(launcher_controller_.get(), item_gmail, 1, one_menu_item); + CheckAppMenu(shelf_controller_.get(), item_gmail, 1, one_menu_item); // Create a second profile and switch to that user. std::string user2 = "user2"; @@ -3417,22 +3400,22 @@ SwitchActiveUser(account_id2); // No item should have content yet. - CheckAppMenu(launcher_controller_.get(), item_browser, 0, nullptr); - CheckAppMenu(launcher_controller_.get(), item_gmail, 0, nullptr); + CheckAppMenu(shelf_controller_.get(), item_browser, 0, nullptr); + CheckAppMenu(shelf_controller_.get(), item_gmail, 0, nullptr); // Transfer the browser of the first user - it should still not show up. MultiUserWindowManagerHelper::GetWindowManager()->ShowWindowForUser( browser()->window()->GetNativeWindow(), account_id2); - CheckAppMenu(launcher_controller_.get(), item_browser, 0, nullptr); - CheckAppMenu(launcher_controller_.get(), item_gmail, 0, nullptr); + CheckAppMenu(shelf_controller_.get(), item_browser, 0, nullptr); + CheckAppMenu(shelf_controller_.get(), item_gmail, 0, nullptr); } -// Check that V2 applications are creating items properly in the launcher when +// Check that V2 applications are creating items properly in the shelf when // instantiated by the current user. -TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest, +TEST_F(MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest, V2AppHandlingTwoUsers) { - InitLauncherController(); + InitShelfController(); const AccountId account_id( multi_user_util::GetAccountIdFromProfile(profile())); // Check that there is a browser. @@ -3460,16 +3443,16 @@ // Check that V2 applications are creating items properly in edge cases: // a background user creates a V2 app, gets active and inactive again and then // deletes the app. -TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest, +TEST_F(MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest, V2AppHandlingTwoUsersEdgeCases) { - InitLauncherController(); + InitShelfController(); // Create a profile for our second user (will be destroyed by the framework). TestingProfile* profile2 = CreateMultiUserProfile("user2"); const AccountId account_id( multi_user_util::GetAccountIdFromProfile(profile())); const AccountId account_id2( multi_user_util::GetAccountIdFromProfile(profile2)); - // Check that there is a browser, back button and a app launcher. + // Check that there is a browser, back button and an app. EXPECT_EQ(1, model_->item_count()); // Switch to an inactive user. @@ -3477,7 +3460,7 @@ EXPECT_EQ(1, model_->item_count()); // Add the v2 app to the inactive user and check that no item was added to - // the launcher. + // the shelf. { AddExtension(extension1_.get()); V2App v2_app(profile(), extension1_.get()); @@ -3503,8 +3486,8 @@ EXPECT_EQ(1, model_->item_count()); } -TEST_F(ChromeLauncherControllerTest, Active) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, Active) { + InitShelfController(); // Creates a new app window. int initial_item_count = model_->item_count(); @@ -3523,8 +3506,8 @@ EXPECT_EQ(app_1.window()->GetNativeWindow(), last_active->GetNativeWindow()); // Change the status so that we can verify it gets reset when the active // window changes. - launcher_controller_->SetItemStatus(app_item_delegate_1->shelf_id(), - ash::STATUS_ATTENTION); + shelf_controller_->SetItemStatus(app_item_delegate_1->shelf_id(), + ash::STATUS_ATTENTION); // Creates another app window, which should become active and reset |app_1|'s // status (to running). @@ -3541,27 +3524,27 @@ last_active = GetLastActiveWindowForItemController(app_item_controller_2); EXPECT_EQ(app_2.window()->GetNativeWindow(), last_active->GetNativeWindow()); const ash::ShelfItem* shelf_item_1 = - launcher_controller_->GetItem(app_item_delegate_1->shelf_id()); + shelf_controller_->GetItem(app_item_delegate_1->shelf_id()); ASSERT_TRUE(shelf_item_1); EXPECT_EQ(ash::STATUS_RUNNING, shelf_item_1->status); - launcher_controller_->SetItemStatus(app_item_delegate_2->shelf_id(), - ash::STATUS_ATTENTION); + shelf_controller_->SetItemStatus(app_item_delegate_2->shelf_id(), + ash::STATUS_ATTENTION); // Activate the first window, which should reset the status of the // second apps window. app_1.window()->GetBaseWindow()->Activate(); const ash::ShelfItem* shelf_item_2 = - launcher_controller_->GetItem(app_item_delegate_2->shelf_id()); + shelf_controller_->GetItem(app_item_delegate_2->shelf_id()); ASSERT_TRUE(shelf_item_2); EXPECT_EQ(ash::STATUS_RUNNING, shelf_item_2->status); } // Check that V2 applications will be made visible on the target desktop if // another window of the same type got previously teleported there. -TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest, +TEST_F(MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest, V2AppFollowsTeleportedWindow) { - InitLauncherController(); + InitShelfController(); ash::MultiUserWindowManager* window_manager = MultiUserWindowManagerHelper::GetWindowManager(); @@ -3647,9 +3630,9 @@ // Check that V2 applications hide correctly on the shelf when the app window // is hidden. -TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest, +TEST_F(MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest, V2AppHiddenWindows) { - InitLauncherController(); + InitShelfController(); TestingProfile* profile2 = CreateMultiUserProfile("user-2"); const AccountId account_id2( @@ -3725,9 +3708,9 @@ } // Checks that spinners are hidden and restored on profile switching -TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest, +TEST_F(MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest, SpinnersUpdateOnUserSwitch) { - InitLauncherController(); + InitShelfController(); const AccountId account_id( multi_user_util::GetAccountIdFromProfile(profile())); @@ -3740,40 +3723,35 @@ extension_service_->AddExtension(extension1_.get()); EXPECT_EQ(1, model_->item_count()); - EXPECT_FALSE( - launcher_controller_->GetShelfSpinnerController()->HasApp(app_id)); + EXPECT_FALSE(shelf_controller_->GetShelfSpinnerController()->HasApp(app_id)); // Add a spinner to the shelf - launcher_controller_->GetShelfSpinnerController()->AddSpinnerToShelf( + shelf_controller_->GetShelfSpinnerController()->AddSpinnerToShelf( app_id, std::make_unique<ShelfSpinnerItemController>(app_id)); EXPECT_EQ(2, model_->item_count()); - EXPECT_TRUE( - launcher_controller_->GetShelfSpinnerController()->HasApp(app_id)); + EXPECT_TRUE(shelf_controller_->GetShelfSpinnerController()->HasApp(app_id)); // Switch to a new profile SwitchActiveUser(account_id2); EXPECT_EQ(1, model_->item_count()); - EXPECT_FALSE( - launcher_controller_->GetShelfSpinnerController()->HasApp(app_id)); + EXPECT_FALSE(shelf_controller_->GetShelfSpinnerController()->HasApp(app_id)); // Switch back SwitchActiveUser(account_id); EXPECT_EQ(2, model_->item_count()); - EXPECT_TRUE( - launcher_controller_->GetShelfSpinnerController()->HasApp(app_id)); + EXPECT_TRUE(shelf_controller_->GetShelfSpinnerController()->HasApp(app_id)); // Close the spinner - launcher_controller_->GetShelfSpinnerController()->CloseSpinner(app_id); + shelf_controller_->GetShelfSpinnerController()->CloseSpinner(app_id); EXPECT_EQ(1, model_->item_count()); - EXPECT_FALSE( - launcher_controller_->GetShelfSpinnerController()->HasApp(app_id)); + EXPECT_FALSE(shelf_controller_->GetShelfSpinnerController()->HasApp(app_id)); } // Checks that pinned spinners are hidden and restored on profile switching // but are not removed when the spinner closes. -TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest, +TEST_F(MultiProfileMultiBrowserShelfLayoutChromeShelfControllerTest, PinnedSpinnersUpdateOnUserSwitch) { - InitLauncherController(); + InitShelfController(); const AccountId account_id( multi_user_util::GetAccountIdFromProfile(profile())); @@ -3786,58 +3764,52 @@ AddExtension(extension1_.get()); EXPECT_EQ(1, model_->item_count()); - EXPECT_FALSE( - launcher_controller_->GetShelfSpinnerController()->HasApp(app_id)); + EXPECT_FALSE(shelf_controller_->GetShelfSpinnerController()->HasApp(app_id)); // Pin an app to the shelf - launcher_controller_->PinAppWithID(app_id); - EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); + shelf_controller_->PinAppWithID(app_id); + EXPECT_TRUE(shelf_controller_->IsAppPinned(app_id)); EXPECT_EQ(2, model_->item_count()); - EXPECT_FALSE( - launcher_controller_->GetShelfSpinnerController()->HasApp(app_id)); + EXPECT_FALSE(shelf_controller_->GetShelfSpinnerController()->HasApp(app_id)); // Activate the spinner - launcher_controller_->GetShelfSpinnerController()->AddSpinnerToShelf( + shelf_controller_->GetShelfSpinnerController()->AddSpinnerToShelf( app_id, std::make_unique<ShelfSpinnerItemController>(app_id)); - EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(app_id)); EXPECT_EQ(2, model_->item_count()); - EXPECT_TRUE( - launcher_controller_->GetShelfSpinnerController()->HasApp(app_id)); + EXPECT_TRUE(shelf_controller_->GetShelfSpinnerController()->HasApp(app_id)); // Switch to a new profile SwitchActiveUser(account_id2); app_service_test().FlushMojoCalls(); - EXPECT_FALSE(launcher_controller_->IsAppPinned(app_id)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(app_id)); EXPECT_EQ(1, model_->item_count()); - EXPECT_FALSE( - launcher_controller_->GetShelfSpinnerController()->HasApp(app_id)); + EXPECT_FALSE(shelf_controller_->GetShelfSpinnerController()->HasApp(app_id)); // Switch back SwitchActiveUser(account_id); app_service_test().FlushMojoCalls(); - EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(app_id)); EXPECT_EQ(2, model_->item_count()); - EXPECT_TRUE( - launcher_controller_->GetShelfSpinnerController()->HasApp(app_id)); + EXPECT_TRUE(shelf_controller_->GetShelfSpinnerController()->HasApp(app_id)); // Close the spinner - launcher_controller_->GetShelfSpinnerController()->CloseSpinner(app_id); - EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); + shelf_controller_->GetShelfSpinnerController()->CloseSpinner(app_id); + EXPECT_TRUE(shelf_controller_->IsAppPinned(app_id)); EXPECT_EQ(2, model_->item_count()); - EXPECT_FALSE( - launcher_controller_->GetShelfSpinnerController()->HasApp(app_id)); + EXPECT_FALSE(shelf_controller_->GetShelfSpinnerController()->HasApp(app_id)); } // Checks that the generated menu list properly activates items. -TEST_F(ChromeLauncherControllerTest, V1AppMenuExecution) { - InitLauncherControllerWithBrowser(); +TEST_F(ChromeShelfControllerTest, V1AppMenuExecution) { + InitShelfControllerWithBrowser(); StartPrefSyncService(syncer::SyncDataList()); - // Add Gmail to the launcher and add two items. + // Add Gmail to the shelf and add two items. GURL gmail = GURL("https://mail.google.com/mail/u"); const ash::ShelfID gmail_id(web_app::kGmailAppId); AddWebApp(web_app::kGmailAppId); - launcher_controller_->SetRefocusURLPatternForTest(gmail_id, GURL(kGmailUrl)); + shelf_controller_->SetRefocusURLPatternForTest(gmail_id, GURL(kGmailUrl)); std::u16string title1 = u"Test1"; NavigateAndCommitActiveTabWithTitle(browser(), GURL(kGmailUrl), title1); chrome::NewTab(browser()); @@ -3850,7 +3822,7 @@ item_gmail.type = ash::TYPE_PINNED_APP; item_gmail.id = gmail_id; std::u16string two_menu_items[] = {title1, title2}; - CheckAppMenu(launcher_controller_.get(), item_gmail, 2, two_menu_items); + CheckAppMenu(shelf_controller_.get(), item_gmail, 2, two_menu_items); ash::ShelfItemDelegate* item_delegate = model_->GetShelfItemDelegate(gmail_id); ASSERT_TRUE(item_delegate); @@ -3860,7 +3832,7 @@ { ash::ShelfApplicationMenuModel menu( std::u16string(), - launcher_controller_->GetAppMenuItemsForTesting(item_gmail), + shelf_controller_->GetAppMenuItemsForTesting(item_gmail), item_delegate); menu.ActivatedAt(2); } @@ -3871,7 +3843,7 @@ { ash::ShelfApplicationMenuModel menu( std::u16string(), - launcher_controller_->GetAppMenuItemsForTesting(item_gmail), + shelf_controller_->GetAppMenuItemsForTesting(item_gmail), item_delegate); menu.ActivatedAt(1); } @@ -3879,14 +3851,14 @@ } // Checks that the generated menu list properly deletes items. -TEST_F(ChromeLauncherControllerTest, V1AppMenuDeletionExecution) { - InitLauncherControllerWithBrowser(); +TEST_F(ChromeShelfControllerTest, V1AppMenuDeletionExecution) { + InitShelfControllerWithBrowser(); StartPrefSyncService(syncer::SyncDataList()); - // Add Gmail to the launcher and add two items. + // Add Gmail to the shelf and add two items. const ash::ShelfID gmail_id(web_app::kGmailAppId); AddWebApp(web_app::kGmailAppId); - launcher_controller_->SetRefocusURLPatternForTest(gmail_id, GURL(kGmailUrl)); + shelf_controller_->SetRefocusURLPatternForTest(gmail_id, GURL(kGmailUrl)); std::u16string title1 = u"Test1"; NavigateAndCommitActiveTabWithTitle(browser(), GURL(kGmailUrl), title1); chrome::NewTab(browser()); @@ -3899,7 +3871,7 @@ item_gmail.type = ash::TYPE_PINNED_APP; item_gmail.id = gmail_id; std::u16string two_menu_items[] = {title1, title2}; - CheckAppMenu(launcher_controller_.get(), item_gmail, 2, two_menu_items); + CheckAppMenu(shelf_controller_.get(), item_gmail, 2, two_menu_items); ash::ShelfItemDelegate* item_delegate = model_->GetShelfItemDelegate(gmail_id); @@ -3907,7 +3879,7 @@ int tabs = browser()->tab_strip_model()->count(); // Activate the proper tab through the menu item. { - auto items = launcher_controller_->GetAppMenuItemsForTesting(item_gmail); + auto items = shelf_controller_->GetAppMenuItemsForTesting(item_gmail); item_delegate->ExecuteCommand(false, 1, ui::EF_NONE, display::kInvalidDisplayId); EXPECT_EQ(tabs, browser()->tab_strip_model()->count()); @@ -3915,16 +3887,16 @@ // Delete one tab through the menu item. { - auto items = launcher_controller_->GetAppMenuItemsForTesting(item_gmail); + auto items = shelf_controller_->GetAppMenuItemsForTesting(item_gmail); item_delegate->ExecuteCommand(false, 1, ui::EF_SHIFT_DOWN, display::kInvalidDisplayId); EXPECT_EQ(--tabs, browser()->tab_strip_model()->count()); } } -// Verify that the launcher item positions are persisted and restored. -TEST_F(ChromeLauncherControllerTest, PersistLauncherItemPositions) { - InitLauncherController(); +// Verify that the shelf item positions are persisted and restored. +TEST_F(ChromeShelfControllerTest, PersistShelfItemPositions) { + InitShelfController(); TestShelfControllerHelper* helper = new TestShelfControllerHelper; SetShelfControllerHelper(helper); @@ -3939,10 +3911,10 @@ helper->SetAppID(tab_strip_model->GetWebContentsAt(0), "1"); helper->SetAppID(tab_strip_model->GetWebContentsAt(1), "2"); - EXPECT_FALSE(launcher_controller_->IsAppPinned("1")); - launcher_controller_->PinAppWithID("1"); - EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); - launcher_controller_->PinAppWithID("2"); + EXPECT_FALSE(shelf_controller_->IsAppPinned("1")); + shelf_controller_->PinAppWithID("1"); + EXPECT_TRUE(shelf_controller_->IsAppPinned("1")); + shelf_controller_->PinAppWithID("2"); EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[0].type); EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[1].type); @@ -3959,7 +3931,7 @@ helper->SetAppID(tab_strip_model->GetWebContentsAt(0), "1"); helper->SetAppID(tab_strip_model->GetWebContentsAt(1), "2"); SetShelfControllerHelper(helper); - launcher_controller_->Init(); + shelf_controller_->Init(); // Check ShelfItems are restored after resetting ChromeShelfController. EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[0].type); @@ -3968,8 +3940,8 @@ } // Verifies pinned apps are persisted and restored. -TEST_F(ChromeLauncherControllerTest, PersistPinned) { - InitLauncherControllerWithBrowser(); +TEST_F(ChromeShelfControllerTest, PersistPinned) { + InitShelfControllerWithBrowser(); size_t initial_size = model_->items().size(); TabStripModel* tab_strip_model = browser()->tab_strip_model(); @@ -3985,12 +3957,12 @@ SetAppIconLoader(std::unique_ptr<AppIconLoader>(app_icon_loader)); EXPECT_EQ(0, app_icon_loader->fetch_count()); - launcher_controller_->PinAppWithID("1"); + shelf_controller_->PinAppWithID("1"); const int app_index = model_->ItemIndexByID(ash::ShelfID("1")); EXPECT_EQ(1, app_icon_loader->fetch_count()); EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[app_index].type); - EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); - EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); + EXPECT_TRUE(shelf_controller_->IsAppPinned("1")); + EXPECT_FALSE(shelf_controller_->IsAppPinned("0")); EXPECT_EQ(initial_size + 1, model_->items().size()); RecreateShelfController(); @@ -4001,15 +3973,15 @@ app_icon_loader = new TestAppIconLoaderImpl; app_icon_loader->AddSupportedApp("1"); SetAppIconLoader(std::unique_ptr<AppIconLoader>(app_icon_loader)); - launcher_controller_->Init(); + shelf_controller_->Init(); EXPECT_EQ(1, app_icon_loader->fetch_count()); ASSERT_EQ(initial_size + 1, model_->items().size()); - EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); - EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); + EXPECT_TRUE(shelf_controller_->IsAppPinned("1")); + EXPECT_FALSE(shelf_controller_->IsAppPinned("0")); EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[app_index].type); - launcher_controller_->UnpinAppWithID("1"); + shelf_controller_->UnpinAppWithID("1"); EXPECT_EQ(initial_size + 1, model_->items().size()); tab_strip_model->CloseWebContentsAt(0, 0); @@ -4018,9 +3990,9 @@ // Verifies that ShelfID property is updated for browsers that are present when // ChromeShelfController is created. -TEST_F(ChromeLauncherControllerTest, ExistingBrowserWindowShelfIDSet) { - InitLauncherControllerWithBrowser(); - launcher_controller_->PinAppWithID("1"); +TEST_F(ChromeShelfControllerTest, ExistingBrowserWindowShelfIDSet) { + InitShelfControllerWithBrowser(); + shelf_controller_->PinAppWithID("1"); TabStripModel* tab_strip_model = browser()->tab_strip_model(); ASSERT_EQ(1, tab_strip_model->count()); @@ -4033,17 +4005,17 @@ helper = new TestShelfControllerHelper(profile()); helper->SetAppID(tab_strip_model->GetWebContentsAt(0), "1"); SetShelfControllerHelper(helper); - launcher_controller_->Init(); + shelf_controller_->Init(); - EXPECT_TRUE(launcher_controller_->GetItem(ash::ShelfID("1"))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID("1"))); EXPECT_EQ(ash::ShelfID("1"), ash::ShelfID::Deserialize( browser()->window()->GetNativeWindow()->GetProperty( ash::kShelfIDKey))); } -TEST_F(ChromeLauncherControllerTest, MultipleAppIconLoaders) { - InitLauncherControllerWithBrowser(); +TEST_F(ChromeShelfControllerTest, MultipleAppIconLoaders) { + InitShelfControllerWithBrowser(); const ash::ShelfID shelf_id1(extension1_->id()); const ash::ShelfID shelf_id2(extension2_->id()); @@ -4057,54 +4029,54 @@ SetAppIconLoaders(std::unique_ptr<AppIconLoader>(app_icon_loader1), std::unique_ptr<AppIconLoader>(app_icon_loader2)); - launcher_controller_->CreateAppLauncherItem( + shelf_controller_->CreateAppLauncherItem( std::make_unique<AppServiceAppWindowShelfItemController>( - shelf_id3, launcher_controller_->app_service_app_window_controller()), + shelf_id3, shelf_controller_->app_service_app_window_controller()), ash::STATUS_RUNNING); EXPECT_EQ(0, app_icon_loader1->fetch_count()); EXPECT_EQ(0, app_icon_loader1->clear_count()); EXPECT_EQ(0, app_icon_loader2->fetch_count()); EXPECT_EQ(0, app_icon_loader2->clear_count()); - launcher_controller_->CreateAppLauncherItem( + shelf_controller_->CreateAppLauncherItem( std::make_unique<AppServiceAppWindowShelfItemController>( - shelf_id2, launcher_controller_->app_service_app_window_controller()), + shelf_id2, shelf_controller_->app_service_app_window_controller()), ash::STATUS_RUNNING); EXPECT_EQ(0, app_icon_loader1->fetch_count()); EXPECT_EQ(0, app_icon_loader1->clear_count()); EXPECT_EQ(1, app_icon_loader2->fetch_count()); EXPECT_EQ(0, app_icon_loader2->clear_count()); - launcher_controller_->CreateAppLauncherItem( + shelf_controller_->CreateAppLauncherItem( std::make_unique<AppServiceAppWindowShelfItemController>( - shelf_id1, launcher_controller_->app_service_app_window_controller()), + shelf_id1, shelf_controller_->app_service_app_window_controller()), ash::STATUS_RUNNING); EXPECT_EQ(1, app_icon_loader1->fetch_count()); EXPECT_EQ(0, app_icon_loader1->clear_count()); EXPECT_EQ(1, app_icon_loader2->fetch_count()); EXPECT_EQ(0, app_icon_loader2->clear_count()); - launcher_controller_->CloseLauncherItem(shelf_id1); + shelf_controller_->CloseLauncherItem(shelf_id1); EXPECT_EQ(1, app_icon_loader1->fetch_count()); EXPECT_EQ(1, app_icon_loader1->clear_count()); EXPECT_EQ(1, app_icon_loader2->fetch_count()); EXPECT_EQ(0, app_icon_loader2->clear_count()); - launcher_controller_->CloseLauncherItem(shelf_id2); + shelf_controller_->CloseLauncherItem(shelf_id2); EXPECT_EQ(1, app_icon_loader1->fetch_count()); EXPECT_EQ(1, app_icon_loader1->clear_count()); EXPECT_EQ(1, app_icon_loader2->fetch_count()); EXPECT_EQ(1, app_icon_loader2->clear_count()); - launcher_controller_->CloseLauncherItem(shelf_id3); + shelf_controller_->CloseLauncherItem(shelf_id3); EXPECT_EQ(1, app_icon_loader1->fetch_count()); EXPECT_EQ(1, app_icon_loader1->clear_count()); EXPECT_EQ(1, app_icon_loader2->fetch_count()); EXPECT_EQ(1, app_icon_loader2->clear_count()); } -TEST_F(ChromeLauncherControllerWithArcTest, ArcAppPinPolicy) { - InitLauncherControllerWithBrowser(); +TEST_F(ChromeShelfControllerWithArcTest, ArcAppPinPolicy) { + InitShelfControllerWithBrowser(); arc::mojom::AppInfo appinfo = CreateAppInfo("Some App", "SomeActivity", "com.example.app"); const std::string app_id = AddArcAppAndShortcut(appinfo); @@ -4117,17 +4089,17 @@ profile()->GetTestingPrefService()->SetManagedPref( prefs::kPolicyPinnedLauncherApps, policy_value.CreateDeepCopy()); - EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(app_id)); EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, GetPinnableForAppID(app_id, profile())); } -TEST_F(ChromeLauncherControllerWithArcTest, ArcManaged) { +TEST_F(ChromeShelfControllerWithArcTest, ArcManaged) { extension_service_->AddExtension(arc_support_host_.get()); // Test enables ARC, so turn it off for initial values. EnablePlayStore(false); - InitLauncherController(); + InitShelfController(); // To prevent import legacy pins each time. // Initially pins are imported from legacy pref based model. @@ -4182,8 +4154,8 @@ } // Test the application menu of a shelf item with multiple ARC windows. -TEST_F(ChromeLauncherControllerWithArcTest, ShelfItemWithMultipleWindows) { - InitLauncherControllerWithBrowser(); +TEST_F(ChromeShelfControllerWithArcTest, ShelfItemWithMultipleWindows) { + InitShelfControllerWithBrowser(); arc::mojom::AppInfo appinfo = CreateAppInfo("Test1", "test", "com.example.app"); @@ -4239,34 +4211,34 @@ namespace { -class ChromeLauncherControllerArcDefaultAppsTest - : public ChromeLauncherControllerTest { +class ChromeShelfControllerArcDefaultAppsTest + : public ChromeShelfControllerTest { public: - ChromeLauncherControllerArcDefaultAppsTest() = default; - ChromeLauncherControllerArcDefaultAppsTest( - const ChromeLauncherControllerArcDefaultAppsTest&) = delete; - ChromeLauncherControllerArcDefaultAppsTest& operator=( - const ChromeLauncherControllerArcDefaultAppsTest&) = delete; - ~ChromeLauncherControllerArcDefaultAppsTest() override = default; + ChromeShelfControllerArcDefaultAppsTest() = default; + ChromeShelfControllerArcDefaultAppsTest( + const ChromeShelfControllerArcDefaultAppsTest&) = delete; + ChromeShelfControllerArcDefaultAppsTest& operator=( + const ChromeShelfControllerArcDefaultAppsTest&) = delete; + ~ChromeShelfControllerArcDefaultAppsTest() override = default; protected: void SetUp() override { ArcAppIcon::DisableSafeDecodingForTesting(); ArcDefaultAppList::UseTestAppsDirectory(); - ChromeLauncherControllerTest::SetUp(); + ChromeShelfControllerTest::SetUp(); } }; -class ChromeLauncherControllerPlayStoreAvailabilityTest - : public ChromeLauncherControllerTest, +class ChromeShelfControllerPlayStoreAvailabilityTest + : public ChromeShelfControllerTest, public ::testing::WithParamInterface<bool> { public: - ChromeLauncherControllerPlayStoreAvailabilityTest() = default; - ChromeLauncherControllerPlayStoreAvailabilityTest( - const ChromeLauncherControllerPlayStoreAvailabilityTest&) = delete; - ChromeLauncherControllerPlayStoreAvailabilityTest& operator=( - const ChromeLauncherControllerPlayStoreAvailabilityTest&) = delete; - ~ChromeLauncherControllerPlayStoreAvailabilityTest() override = default; + ChromeShelfControllerPlayStoreAvailabilityTest() = default; + ChromeShelfControllerPlayStoreAvailabilityTest( + const ChromeShelfControllerPlayStoreAvailabilityTest&) = delete; + ChromeShelfControllerPlayStoreAvailabilityTest& operator=( + const ChromeShelfControllerPlayStoreAvailabilityTest&) = delete; + ~ChromeShelfControllerPlayStoreAvailabilityTest() override = default; protected: void SetUp() override { @@ -4275,15 +4247,15 @@ // To prevent crash on test exit and pending decode request. ArcAppIcon::DisableSafeDecodingForTesting(); ArcDefaultAppList::UseTestAppsDirectory(); - ChromeLauncherControllerTest::SetUp(); + ChromeShelfControllerTest::SetUp(); } }; } // namespace -TEST_F(ChromeLauncherControllerArcDefaultAppsTest, DefaultApps) { +TEST_F(ChromeShelfControllerArcDefaultAppsTest, DefaultApps) { arc_test_.SetUp(profile()); - InitLauncherController(); + InitShelfController(); ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs(); EnablePlayStore(false); @@ -4293,30 +4265,29 @@ const std::string app_id = ArcAppTest::GetAppId(arc_test_.fake_default_apps()[0]); const ash::ShelfID shelf_id(app_id); - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id)); EXPECT_TRUE(arc::LaunchApp(profile(), app_id, ui::EF_LEFT_MOUSE_BUTTON, arc::UserInteractionType::NOT_USER_INITIATED)); EXPECT_TRUE(arc::IsArcPlayStoreEnabledForProfile(profile())); - EXPECT_TRUE(launcher_controller_->GetItem(shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(shelf_id)); // Stop ARC again. Shelf item should go away. EnablePlayStore(false); - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id)); EXPECT_TRUE(arc::LaunchApp(profile(), app_id, ui::EF_LEFT_MOUSE_BUTTON, arc::UserInteractionType::NOT_USER_INITIATED)); EXPECT_TRUE(arc::IsArcPlayStoreEnabledForProfile(profile())); - EXPECT_TRUE(launcher_controller_->GetItem(shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(shelf_id)); auto* item_delegate = model_->GetShelfItemDelegate(shelf_id); ASSERT_TRUE(item_delegate); - EXPECT_TRUE( - launcher_controller_->GetShelfSpinnerController()->HasApp(app_id)); + EXPECT_TRUE(shelf_controller_->GetShelfSpinnerController()->HasApp(app_id)); // Initially, a default icon is set for the shelf item. EXPECT_FALSE(item_delegate->image_set_by_controller()); auto get_icon = [=]() { - return *launcher_controller_->GetItem(shelf_id)->image.bitmap(); + return *shelf_controller_->GetItem(shelf_id)->image.bitmap(); }; const SkBitmap default_icon = get_icon(); @@ -4324,12 +4295,11 @@ CreateArcWindow(window_app_id); arc_test_.app_instance()->SendTaskCreated(1, arc_test_.fake_default_apps()[0], std::string()); - EXPECT_TRUE(launcher_controller_->GetItem(shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(shelf_id)); // Refresh delegate, it was changed. item_delegate = model_->GetShelfItemDelegate(shelf_id); ASSERT_TRUE(item_delegate); - EXPECT_FALSE( - launcher_controller_->GetShelfSpinnerController()->HasApp(app_id)); + EXPECT_FALSE(shelf_controller_->GetShelfSpinnerController()->HasApp(app_id)); EXPECT_FALSE(item_delegate->image_set_by_controller()); EXPECT_TRUE(gfx::test::AreBitmapsEqual(default_icon, get_icon())); @@ -4338,21 +4308,21 @@ EXPECT_FALSE(gfx::test::AreBitmapsEqual(default_icon, get_icon())); } -TEST_F(ChromeLauncherControllerArcDefaultAppsTest, PlayStoreDeferredLaunch) { +TEST_F(ChromeShelfControllerArcDefaultAppsTest, PlayStoreDeferredLaunch) { // Add ARC host app to enable Play Store default app. extension_service_->AddExtension(arc_support_host_.get()); arc_test_.SetUp(profile()); ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs(); EXPECT_TRUE(prefs->IsRegistered(arc::kPlayStoreAppId)); - InitLauncherController(); + InitShelfController(); EnablePlayStore(true); // Pin Play Store. It should be pinned but not scheduled for deferred launch. - launcher_controller_->PinAppWithID(arc::kPlayStoreAppId); - EXPECT_TRUE(launcher_controller_->IsAppPinned(arc::kPlayStoreAppId)); - EXPECT_FALSE(launcher_controller_->GetShelfSpinnerController()->HasApp( + shelf_controller_->PinAppWithID(arc::kPlayStoreAppId); + EXPECT_TRUE(shelf_controller_->IsAppPinned(arc::kPlayStoreAppId)); + EXPECT_FALSE(shelf_controller_->GetShelfSpinnerController()->HasApp( arc::kPlayStoreAppId)); // Simulate click. This should schedule Play Store for deferred launch. @@ -4361,17 +4331,17 @@ EXPECT_TRUE(item_delegate); SelectItem(item_delegate); app_service_test().FlushMojoCalls(); - EXPECT_TRUE(launcher_controller_->IsAppPinned(arc::kPlayStoreAppId)); - EXPECT_TRUE(launcher_controller_->GetShelfSpinnerController()->HasApp( + EXPECT_TRUE(shelf_controller_->IsAppPinned(arc::kPlayStoreAppId)); + EXPECT_TRUE(shelf_controller_->GetShelfSpinnerController()->HasApp( arc::kPlayStoreAppId)); } -TEST_F(ChromeLauncherControllerArcDefaultAppsTest, PlayStoreLaunchMetric) { +TEST_F(ChromeShelfControllerArcDefaultAppsTest, PlayStoreLaunchMetric) { extension_service_->AddExtension(arc_support_host_.get()); arc_test_.SetUp(profile()); ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs(); - InitLauncherController(); + InitShelfController(); EnablePlayStore(true); // Play Store available now as a default app but is not ready yet. @@ -4396,8 +4366,7 @@ views::Widget* play_store_window = CreateArcWindow(play_store_window_id); arc_test_.app_instance()->SendTaskCreated( 1, app, arc_test_.app_instance()->launch_intents()[0]); - EXPECT_TRUE( - launcher_controller_->GetItem(ash::ShelfID(arc::kPlayStoreAppId))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID(arc::kPlayStoreAppId))); // UMA is reported since app becomes ready. base::HistogramBase* const histogram = base::StatisticsRecorder::FindHistogram(kHistogramName); @@ -4414,8 +4383,7 @@ play_store_window = CreateArcWindow(play_store_window_id); arc_test_.app_instance()->SendTaskCreated( 2, app, arc_test_.app_instance()->launch_intents()[1]); - EXPECT_TRUE( - launcher_controller_->GetItem(ash::ShelfID(arc::kPlayStoreAppId))); + EXPECT_TRUE(shelf_controller_->GetItem(ash::ShelfID(arc::kPlayStoreAppId))); // UMA is reported for app-ready launch. Note, previous call of SnapshotDelta // resets samples, so we expect here only one recorded. EXPECT_EQ(1, histogram->SnapshotDelta()->TotalCount()); @@ -4424,11 +4392,11 @@ // Tests that the Play Store is not visible in AOSP image and visible in default // images. -TEST_P(ChromeLauncherControllerPlayStoreAvailabilityTest, Visible) { +TEST_P(ChromeShelfControllerPlayStoreAvailabilityTest, Visible) { extension_service_->AddExtension(arc_support_host_.get()); arc_test_.SetUp(profile()); - InitLauncherController(); + InitShelfController(); StartPrefSyncService(syncer::SyncDataList()); ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs(); @@ -4436,14 +4404,14 @@ prefs->IsRegistered(arc::kPlayStoreAppId)); // If the Play Store available, it is pinned by default. EXPECT_EQ(arc::IsPlayStoreAvailable(), - launcher_controller_->IsAppPinned(arc::kPlayStoreAppId)); + shelf_controller_->IsAppPinned(arc::kPlayStoreAppId)); arc_test_.TearDown(); } // Checks the case when several app items have the same ordinal position (which // is valid case). -TEST_F(ChromeLauncherControllerTest, CheckPositionConflict) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, CheckPositionConflict) { + InitShelfController(); extension_service_->AddExtension(extension1_.get()); extension_service_->AddExtension(extension2_.get()); @@ -4492,8 +4460,8 @@ // Test the case when sync app is turned off and we need to use local copy to // support user's pins. -TEST_F(ChromeLauncherControllerTest, SyncOffLocalUpdate) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, SyncOffLocalUpdate) { + InitShelfController(); extension_service_->AddExtension(extension1_.get()); extension_service_->AddExtension(extension2_.get()); @@ -4514,7 +4482,7 @@ // Pinned state should not change. EXPECT_EQ("Chrome, App1, App2", GetPinnedAppStatus()); - launcher_controller_->UnpinAppWithID(extension2_->id()); + shelf_controller_->UnpinAppWithID(extension2_->id()); EXPECT_EQ("Chrome, App1", GetPinnedAppStatus()); // Resume syncing and sync information overrides local copy. @@ -4523,73 +4491,73 @@ } // Test the Settings can be pinned and unpinned. -TEST_F(ChromeLauncherControllerTest, InternalAppPinUnpin) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, InternalAppPinUnpin) { + InitShelfController(); // The model should only contain the browser shortcut item. EXPECT_EQ(1, model_->item_count()); const std::string app_id = ash::kInternalAppIdSettings; - EXPECT_FALSE(launcher_controller_->IsAppPinned(app_id)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(app_id)); // Pin Settings. - launcher_controller_->PinAppWithID(app_id); + shelf_controller_->PinAppWithID(app_id); EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[1].type); EXPECT_EQ(ash::STATUS_CLOSED, model_->items()[1].status); - EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(app_id)); // Unpin Settings. - launcher_controller_->UnpinAppWithID(app_id); + shelf_controller_->UnpinAppWithID(app_id); EXPECT_EQ(1, model_->item_count()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(app_id)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(app_id)); } // Test that internal app can be added and removed on shelf. -TEST_F(ChromeLauncherControllerTest, InternalAppWindowRecreation) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, InternalAppWindowRecreation) { + InitShelfController(); // Only test the first internal app. The others should be the same. const auto& internal_app = app_list::GetInternalAppList(profile()).front(); const std::string app_id = internal_app.app_id; const ash::ShelfID shelf_id(app_id); - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id)); views::Widget* internal_app_window = CreateShelfAppWindow(app_id); ASSERT_TRUE(internal_app_window); base::RunLoop().RunUntilIdle(); - EXPECT_TRUE(launcher_controller_->GetItem(shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(shelf_id)); internal_app_window->Close(); base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id)); // Create and close again. internal_app_window = CreateShelfAppWindow(app_id); ASSERT_TRUE(internal_app_window); base::RunLoop().RunUntilIdle(); - EXPECT_TRUE(launcher_controller_->GetItem(shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(shelf_id)); internal_app_window->Close(); base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id)); } // Test that internal app can be added and removed by SetProperty of // ash::kShelfIDKey. -TEST_F(ChromeLauncherControllerTest, InternalAppWindowPropertyChanged) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, InternalAppWindowPropertyChanged) { + InitShelfController(); // Only test the first internal app. The others should be the same. const auto internal_app = app_list::GetInternalAppList(profile()).front(); std::string app_id; ash::ShelfID shelf_id; - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id)); // Set an empty ash::kShelfIDKey. views::Widget* internal_app_window = CreateShelfAppWindow(app_id); ASSERT_TRUE(internal_app_window); base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id)); // Set an invalid ash::kShelfIDKey. app_id = "An invalid internal app id"; @@ -4597,7 +4565,7 @@ internal_app_window->GetNativeWindow()->SetProperty( ash::kShelfIDKey, new std::string(shelf_id.Serialize())); base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id)); // Set a valid ash::kShelfIDKey. app_id = internal_app.app_id; @@ -4605,28 +4573,27 @@ internal_app_window->GetNativeWindow()->SetProperty( ash::kShelfIDKey, new std::string(shelf_id.Serialize())); base::RunLoop().RunUntilIdle(); - EXPECT_TRUE(launcher_controller_->GetItem(shelf_id)); + EXPECT_TRUE(shelf_controller_->GetItem(shelf_id)); internal_app_window->Close(); base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(launcher_controller_->GetItem(shelf_id)); + EXPECT_FALSE(shelf_controller_->GetItem(shelf_id)); } -class ChromeLauncherControllerDemoModeTest - : public ChromeLauncherControllerTest { +class ChromeShelfControllerDemoModeTest : public ChromeShelfControllerTest { protected: - ChromeLauncherControllerDemoModeTest() { auto_start_arc_test_ = true; } - ChromeLauncherControllerDemoModeTest( - const ChromeLauncherControllerDemoModeTest&) = delete; - ChromeLauncherControllerDemoModeTest& operator=( - const ChromeLauncherControllerDemoModeTest&) = delete; - ~ChromeLauncherControllerDemoModeTest() override = default; + ChromeShelfControllerDemoModeTest() { auto_start_arc_test_ = true; } + ChromeShelfControllerDemoModeTest(const ChromeShelfControllerDemoModeTest&) = + delete; + ChromeShelfControllerDemoModeTest& operator=( + const ChromeShelfControllerDemoModeTest&) = delete; + ~ChromeShelfControllerDemoModeTest() override = default; void SetUp() override { // To prevent crash on test exit and pending decode request. ArcAppIcon::DisableSafeDecodingForTesting(); - ChromeLauncherControllerTest::SetUp(); + ChromeShelfControllerTest::SetUp(); // Fake Demo Mode. demo_mode_test_helper_ = std::make_unique<chromeos::DemoModeTestHelper>(); @@ -4636,18 +4603,18 @@ void TearDown() override { demo_mode_test_helper_.reset(); - ChromeLauncherControllerTest::TearDown(); + ChromeShelfControllerTest::TearDown(); } private: std::unique_ptr<chromeos::DemoModeTestHelper> demo_mode_test_helper_; }; -TEST_F(ChromeLauncherControllerDemoModeTest, PinnedAppsOnline) { +TEST_F(ChromeShelfControllerDemoModeTest, PinnedAppsOnline) { network::TestNetworkConnectionTracker::GetInstance()->SetConnectionType( network::mojom::ConnectionType::CONNECTION_ETHERNET); - InitLauncherControllerWithBrowser(); + InitShelfControllerWithBrowser(); base::ListValue policy_value; @@ -4678,28 +4645,28 @@ app_service_test().FlushMojoCalls(); // Since the device is online, all policy pinned apps are pinned. - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, GetPinnableForAppID(extension1_->id(), profile())); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension2_->id())); EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, GetPinnableForAppID(extension2_->id(), profile())); - EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(app_id)); EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, GetPinnableForAppID(app_id, profile())); - EXPECT_TRUE(launcher_controller_->IsAppPinned(online_only_app_id)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(online_only_app_id)); EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, GetPinnableForAppID(online_only_app_id, profile())); } -TEST_F(ChromeLauncherControllerDemoModeTest, PinnedAppsOffline) { +TEST_F(ChromeShelfControllerDemoModeTest, PinnedAppsOffline) { network::TestNetworkConnectionTracker::GetInstance()->SetConnectionType( network::mojom::ConnectionType::CONNECTION_NONE); - InitLauncherControllerWithBrowser(); + InitShelfControllerWithBrowser(); base::ListValue policy_value; @@ -4730,39 +4697,39 @@ // Since the device is online, the policy pinned apps that shouldn't be pinned // in Demo Mode are unpinned. - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, GetPinnableForAppID(extension1_->id(), profile())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension2_->id())); EXPECT_EQ(AppListControllerDelegate::PIN_EDITABLE, GetPinnableForAppID(extension2_->id(), profile())); - EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); + EXPECT_TRUE(shelf_controller_->IsAppPinned(app_id)); EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, GetPinnableForAppID(app_id, profile())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(online_only_app_id)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(online_only_app_id)); EXPECT_EQ(AppListControllerDelegate::PIN_EDITABLE, GetPinnableForAppID(online_only_app_id, profile())); // Pin a Chrome app that would have been pinned by policy but was suppressed // for Demo Mode. - launcher_controller_->PinAppWithID(extension2_->id()); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); + shelf_controller_->PinAppWithID(extension2_->id()); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension2_->id())); EXPECT_EQ(AppListControllerDelegate::PIN_EDITABLE, GetPinnableForAppID(extension2_->id(), profile())); // Pin an ARC app that would have been pinned by policy but was suppressed // for Demo Mode. - launcher_controller_->PinAppWithID(online_only_app_id); - EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); + shelf_controller_->PinAppWithID(online_only_app_id); + EXPECT_TRUE(shelf_controller_->IsAppPinned(app_id)); EXPECT_EQ(AppListControllerDelegate::PIN_EDITABLE, GetPinnableForAppID(online_only_app_id, profile())); } -TEST_F(ChromeLauncherControllerTest, CrostiniTerminalPinUnpin) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, CrostiniTerminalPinUnpin) { + InitShelfController(); // Load pinned Terminal from prefs without Crostini UI being allowed syncer::SyncChangeList sync_list; @@ -4779,19 +4746,19 @@ EXPECT_EQ("Chrome, Terminal", GetPinnedAppStatus()); // Unpin the Terminal - launcher_controller_->UnpinAppWithID(crostini::kCrostiniTerminalSystemAppId); + shelf_controller_->UnpinAppWithID(crostini::kCrostiniTerminalSystemAppId); EXPECT_EQ("Chrome", GetPinnedAppStatus()); // Pin Terminal again. - launcher_controller_->PinAppWithID(crostini::kCrostiniTerminalSystemAppId); + shelf_controller_->PinAppWithID(crostini::kCrostiniTerminalSystemAppId); EXPECT_EQ("Chrome, Terminal", GetPinnedAppStatus()); } // TODO(crbug.com/846546) Recognising app id from the browser app_name is only // necessary because the crostini terminal is a little hacky. Pending a better // terminal implementation we should remove this test. -TEST_F(ChromeLauncherControllerTest, CrostiniBrowserWindowsRecogniseShelfItem) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, CrostiniBrowserWindowsRecogniseShelfItem) { + InitShelfController(); crostini::CrostiniTestHelper helper(profile()); // We want to match this shelf item. @@ -4813,14 +4780,14 @@ chrome::NewTab(browser()); browser()->window()->Show(); - EXPECT_EQ(launcher_controller_->GetAppIDForWebContents( + EXPECT_EQ(shelf_controller_->GetAppIDForWebContents( browser()->tab_strip_model()->GetActiveWebContents()), item.id.app_id); } // Tests behavior for ensuring some component apps can be marked unpinnable. -TEST_F(ChromeLauncherControllerTest, UnpinnableComponentApps) { - InitLauncherController(); +TEST_F(ChromeShelfControllerTest, UnpinnableComponentApps) { + InitShelfController(); const char* kPinnableApp = file_manager::kFileManagerAppId; const char* kNoPinApps[] = {file_manager::kGalleryAppId, @@ -4834,7 +4801,7 @@ } } -TEST_F(ChromeLauncherControllerTest, DoNotShowInShelf) { +TEST_F(ChromeShelfControllerTest, DoNotShowInShelf) { syncer::SyncChangeList sync_list; InsertAddPinChange(&sync_list, 0, extension1_->id()); InsertAddPinChange(&sync_list, 0, extension2_->id()); @@ -4855,12 +4822,12 @@ .OnApps(std::move(apps), apps::mojom::AppType::kExtension, false /* should_notify_initialized */); - InitLauncherController(); + InitShelfController(); EXPECT_EQ("Chrome, App2", GetPinnedAppStatus()); } -TEST_F(ChromeLauncherControllerWithArcTest, ReplacePinnedItem) { - InitLauncherController(); +TEST_F(ChromeShelfControllerWithArcTest, ReplacePinnedItem) { + InitShelfController(); SendListOfArcApps(); const std::string arc_app_id1 = @@ -4871,45 +4838,45 @@ extension_service_->AddExtension(extension1_.get()); extension_service_->AddExtension(extension2_.get()); - launcher_controller_->PinAppWithID(extension1_->id()); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id1)); + shelf_controller_->PinAppWithID(extension1_->id()); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(arc_app_id1)); // Replace pin extension to ARC app - launcher_controller_->ReplacePinnedItem(extension1_->id(), arc_app_id1); - EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id1)); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); + shelf_controller_->ReplacePinnedItem(extension1_->id(), arc_app_id1); + EXPECT_TRUE(shelf_controller_->IsAppPinned(arc_app_id1)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); // Replace pin ARC app to ARC app - launcher_controller_->ReplacePinnedItem(arc_app_id1, arc_app_id2); - EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id2)); - EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id1)); + shelf_controller_->ReplacePinnedItem(arc_app_id1, arc_app_id2); + EXPECT_TRUE(shelf_controller_->IsAppPinned(arc_app_id2)); + EXPECT_FALSE(shelf_controller_->IsAppPinned(arc_app_id1)); // Replace pin ARC app to extension app - launcher_controller_->ReplacePinnedItem(arc_app_id2, extension1_->id()); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id2)); + shelf_controller_->ReplacePinnedItem(arc_app_id2, extension1_->id()); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(arc_app_id2)); // Replace pin extension app to extension app - launcher_controller_->ReplacePinnedItem(extension1_->id(), extension2_->id()); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); + shelf_controller_->ReplacePinnedItem(extension1_->id(), extension2_->id()); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension2_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); // Try to replace item that is not pinned. - launcher_controller_->ReplacePinnedItem(arc_app_id2, extension1_->id()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id2)); + shelf_controller_->ReplacePinnedItem(arc_app_id2, extension1_->id()); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(arc_app_id2)); // Try to replace item with item that is already pinned. - launcher_controller_->PinAppWithID(extension1_->id()); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); - launcher_controller_->ReplacePinnedItem(extension2_->id(), extension1_->id()); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); + shelf_controller_->PinAppWithID(extension1_->id()); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); + shelf_controller_->ReplacePinnedItem(extension2_->id(), extension1_->id()); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension2_->id())); } -TEST_F(ChromeLauncherControllerWithArcTest, PinAtIndex) { - InitLauncherController(); +TEST_F(ChromeShelfControllerWithArcTest, PinAtIndex) { + InitShelfController(); SendListOfArcApps(); const std::string arc_app_id1 = @@ -4921,46 +4888,46 @@ extension_service_->AddExtension(extension2_.get()); int index = 0; - launcher_controller_->PinAppAtIndex(extension1_->id(), index); + shelf_controller_->PinAppAtIndex(extension1_->id(), index); EXPECT_EQ(index, - launcher_controller_->PinnedItemIndexByAppID(extension1_->id())); + shelf_controller_->PinnedItemIndexByAppID(extension1_->id())); - launcher_controller_->PinAppAtIndex(extension2_->id(), index); + shelf_controller_->PinAppAtIndex(extension2_->id(), index); EXPECT_EQ(index, - launcher_controller_->PinnedItemIndexByAppID(extension2_->id())); + shelf_controller_->PinnedItemIndexByAppID(extension2_->id())); EXPECT_NE(index, - launcher_controller_->PinnedItemIndexByAppID(extension1_->id())); + shelf_controller_->PinnedItemIndexByAppID(extension1_->id())); index = 3; - launcher_controller_->PinAppAtIndex(arc_app_id1, index); - EXPECT_EQ(index, launcher_controller_->PinnedItemIndexByAppID(arc_app_id1)); + shelf_controller_->PinAppAtIndex(arc_app_id1, index); + EXPECT_EQ(index, shelf_controller_->PinnedItemIndexByAppID(arc_app_id1)); // Test pinning at invalid index. index = -100; - launcher_controller_->PinAppAtIndex(arc_app_id2, index); - EXPECT_NE(index, launcher_controller_->PinnedItemIndexByAppID(arc_app_id2)); - EXPECT_EQ(-1, launcher_controller_->PinnedItemIndexByAppID(arc_app_id2)); + shelf_controller_->PinAppAtIndex(arc_app_id2, index); + EXPECT_NE(index, shelf_controller_->PinnedItemIndexByAppID(arc_app_id2)); + EXPECT_EQ(-1, shelf_controller_->PinnedItemIndexByAppID(arc_app_id2)); // Test pinning already pinned app. index = 0; - launcher_controller_->PinAppAtIndex(arc_app_id1, index); - EXPECT_NE(index, launcher_controller_->PinnedItemIndexByAppID(arc_app_id1)); - EXPECT_EQ(3, launcher_controller_->PinnedItemIndexByAppID(arc_app_id1)); + shelf_controller_->PinAppAtIndex(arc_app_id1, index); + EXPECT_NE(index, shelf_controller_->PinnedItemIndexByAppID(arc_app_id1)); + EXPECT_EQ(3, shelf_controller_->PinnedItemIndexByAppID(arc_app_id1)); } -class ChromeLauncherControllerWebAppTest : public ChromeLauncherControllerTest { +class ChromeShelfControllerWebAppTest : public ChromeShelfControllerTest { protected: - ChromeLauncherControllerWebAppTest() {} + ChromeShelfControllerWebAppTest() {} - ~ChromeLauncherControllerWebAppTest() override = default; + ~ChromeShelfControllerWebAppTest() override = default; }; // Test the web app interaction flow: pin it, run it, unpin it, close it. -TEST_F(ChromeLauncherControllerWebAppTest, WebAppPinRunUnpinClose) { +TEST_F(ChromeShelfControllerWebAppTest, WebAppPinRunUnpinClose) { constexpr char kWebAppUrl[] = "https://webappone.com/"; constexpr char kWebAppName[] = "WebApp1"; - InitLauncherController(); + InitShelfController(); const web_app::AppId app_id = web_app::test::InstallDummyWebApp( profile(), kWebAppName, GURL(kWebAppUrl)); @@ -4968,42 +4935,42 @@ // The model should only contain the browser shortcut item. EXPECT_EQ(1, model_->item_count()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(app_id)); - EXPECT_EQ(nullptr, launcher_controller_->GetItem(ash::ShelfID(app_id))); + EXPECT_FALSE(shelf_controller_->IsAppPinned(app_id)); + EXPECT_EQ(nullptr, shelf_controller_->GetItem(ash::ShelfID(app_id))); // Pinning the app should create a new shelf item. - launcher_controller_->PinAppWithID(app_id); + shelf_controller_->PinAppWithID(app_id); EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[1].type); EXPECT_EQ(ash::STATUS_CLOSED, model_->items()[1].status); - EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); - EXPECT_NE(nullptr, launcher_controller_->GetItem(ash::ShelfID(app_id))); + EXPECT_TRUE(shelf_controller_->IsAppPinned(app_id)); + EXPECT_NE(nullptr, shelf_controller_->GetItem(ash::ShelfID(app_id))); // Reporting that the app is running should just update the existing item. - launcher_controller_->SetV1AppStatus(app_id, ash::STATUS_RUNNING); + shelf_controller_->SetV1AppStatus(app_id, ash::STATUS_RUNNING); EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[1].type); EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[1].status); - EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); - EXPECT_NE(nullptr, launcher_controller_->GetItem(ash::ShelfID(app_id))); + EXPECT_TRUE(shelf_controller_->IsAppPinned(app_id)); + EXPECT_NE(nullptr, shelf_controller_->GetItem(ash::ShelfID(app_id))); // Unpinning the app should just update the existing item. - launcher_controller_->UnpinAppWithID(app_id); + shelf_controller_->UnpinAppWithID(app_id); EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(ash::TYPE_APP, model_->items()[1].type); EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[1].status); - EXPECT_FALSE(launcher_controller_->IsAppPinned(app_id)); - EXPECT_NE(nullptr, launcher_controller_->GetItem(ash::ShelfID(app_id))); + EXPECT_FALSE(shelf_controller_->IsAppPinned(app_id)); + EXPECT_NE(nullptr, shelf_controller_->GetItem(ash::ShelfID(app_id))); // Reporting that the app is closed should remove its shelf item. - launcher_controller_->SetV1AppStatus(app_id, ash::STATUS_CLOSED); + shelf_controller_->SetV1AppStatus(app_id, ash::STATUS_CLOSED); EXPECT_EQ(1, model_->item_count()); - EXPECT_FALSE(launcher_controller_->IsAppPinned(app_id)); - EXPECT_EQ(nullptr, launcher_controller_->GetItem(ash::ShelfID(app_id))); + EXPECT_FALSE(shelf_controller_->IsAppPinned(app_id)); + EXPECT_EQ(nullptr, shelf_controller_->GetItem(ash::ShelfID(app_id))); } // Test the app status when the paused app is blocked, un-blocked, and un-paused -TEST_F(ChromeLauncherControllerTest, VerifyAppStatusForPausedApp) { +TEST_F(ChromeShelfControllerTest, VerifyAppStatusForPausedApp) { AddExtension(extension1_.get()); // Set the app as paused @@ -5011,9 +4978,9 @@ profile(), extension1_->id(), false /* block */, true /* pause */, apps::mojom::OptionalBool::kUnknown /* show_in_shelf */); - InitLauncherController(); + InitShelfController(); - launcher_controller_->PinAppWithID(extension1_->id()); + shelf_controller_->PinAppWithID(extension1_->id()); EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(ash::AppStatus::kPaused, model_->items()[1].app_status); @@ -5038,7 +5005,7 @@ // Test the app status when the blocked app is paused, un-paused, hidden, // visible and un-blocked -TEST_F(ChromeLauncherControllerTest, VerifyAppStatusForBlockedApp) { +TEST_F(ChromeShelfControllerTest, VerifyAppStatusForBlockedApp) { AddExtension(extension1_.get()); // Set the app as blocked @@ -5046,9 +5013,9 @@ profile(), extension1_->id(), true /* block */, false /* pause */, apps::mojom::OptionalBool::kUnknown /* show_in_shelf */); - InitLauncherController(); + InitShelfController(); - launcher_controller_->PinAppWithID(extension1_->id()); + shelf_controller_->PinAppWithID(extension1_->id()); EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(ash::AppStatus::kBlocked, model_->items()[1].app_status); @@ -5074,14 +5041,14 @@ UpdateAppRegistryCache(profile(), extension1_->id(), true /* block */, false /* pause */, apps::mojom::OptionalBool::kFalse /* show_in_shelf */); - EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_FALSE(shelf_controller_->IsAppPinned(extension1_->id())); // Set the app as blocked and visible UpdateAppRegistryCache(profile(), extension1_->id(), true /* block */, false /* pause */, apps::mojom::OptionalBool::kTrue /* show_in_shelf */); EXPECT_EQ(ash::AppStatus::kBlocked, model_->items()[1].app_status); - EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); + EXPECT_TRUE(shelf_controller_->IsAppPinned(extension1_->id())); // Set the app as ready UpdateAppRegistryCache( @@ -5091,5 +5058,5 @@ } INSTANTIATE_TEST_SUITE_P(All, - ChromeLauncherControllerPlayStoreAvailabilityTest, + ChromeShelfControllerPlayStoreAvailabilityTest, ::testing::Values(false, true));
diff --git a/chrome/browser/ui/ash/launcher/chrome_shelf_controller_util.cc b/chrome/browser/ui/ash/launcher/chrome_shelf_controller_util.cc index 20d3b6b..1a4346c5 100644 --- a/chrome/browser/ui/ash/launcher/chrome_shelf_controller_util.cc +++ b/chrome/browser/ui/ash/launcher/chrome_shelf_controller_util.cc
@@ -13,7 +13,7 @@ #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" #include "chrome/browser/ui/app_list/extension_app_utils.h" -#include "chrome/browser/ui/ash/chrome_launcher_prefs.h" +#include "chrome/browser/ui/ash/chrome_shelf_prefs.h" #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_helper.h" #include "chrome/browser/ui/browser.h"
diff --git a/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.h b/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.h index 460386d2..205e9d00 100644 --- a/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.h +++ b/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.h
@@ -53,7 +53,7 @@ : NSObject <FullscreenToolbarContextDelegate> // Designated initializer. -- (id)initWithBrowserView:(BrowserView*)browserView; +- (instancetype)initWithBrowserView:(BrowserView*)browserView; // Informs the controller that the browser has entered or exited fullscreen // mode. |-enterFullscreenMode| should be called when the window is about to
diff --git a/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.mm b/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.mm index cc5e101c..63f2de56 100644 --- a/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.mm +++ b/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.mm
@@ -39,7 +39,7 @@ BrowserView* _browserView; // weak } -- (id)initWithBrowserView:(BrowserView*)browserView { +- (instancetype)initWithBrowserView:(BrowserView*)browserView { if ((self = [super init])) { _browserView = browserView; _animationController =
diff --git a/chrome/browser/ui/media_router/media_router_ui.cc b/chrome/browser/ui/media_router/media_router_ui.cc index a50af7f9..4305c7a8 100644 --- a/chrome/browser/ui/media_router/media_router_ui.cc +++ b/chrome/browser/ui/media_router/media_router_ui.cc
@@ -469,25 +469,6 @@ return sink.sink.id() == display_sink_id; }); - // Remove the pseudo-sink, since it's only used in the WebUI dialog. - // TODO(takumif): Remove this once we've removed pseudo-sink from Cloud MRP. - base::EraseIf(enabled_sinks, [](const MediaSinkWithCastModes& sink) { - return base::StartsWith(sink.sink.id(), - "pseudo:", base::CompareCase::SENSITIVE); - }); - - // Filter out cloud sinks if the window is off-the-record. Casting to cloud - // sinks from off-the-record is not currently supported by the Cloud MRP. This - // is not the best place to do this, but the Media Router browser service and - // extension process are shared between normal and off-the-record, so - // off-the-record behaviors around sink availability have to be handled at the - // UI layer. - if (initiator_->GetBrowserContext()->IsOffTheRecord()) { - base::EraseIf(enabled_sinks, [](const MediaSinkWithCastModes& sink) { - return sink.sink.IsMaybeCloudSink(); - }); - } - return enabled_sinks; } @@ -1003,10 +984,6 @@ ? UIMediaSinkState::CONNECTING : UIMediaSinkState::AVAILABLE; } - if (ui_sink.icon_type == SinkIconType::HANGOUT && - ui_sink.state == UIMediaSinkState::AVAILABLE && sink.sink.domain()) { - ui_sink.status_text = base::UTF8ToUTF16(*sink.sink.domain()); - } if (issue && IssueMatches(*issue, ui_sink)) ui_sink.issue = issue; return ui_sink;
diff --git a/chrome/browser/ui/media_router/media_router_ui.h b/chrome/browser/ui/media_router/media_router_ui.h index 75142f1..8b45270 100644 --- a/chrome/browser/ui/media_router/media_router_ui.h +++ b/chrome/browser/ui/media_router/media_router_ui.h
@@ -142,7 +142,6 @@ UpdateSinksWhenDialogMovesToAnotherDisplay); FRIEND_TEST_ALL_PREFIXES(MediaRouterViewsUITest, NotifyObserver); FRIEND_TEST_ALL_PREFIXES(MediaRouterViewsUITest, SinkFriendlyName); - FRIEND_TEST_ALL_PREFIXES(MediaRouterViewsUITest, RemovePseudoSink); FRIEND_TEST_ALL_PREFIXES(MediaRouterViewsUITest, ConnectingState); FRIEND_TEST_ALL_PREFIXES(MediaRouterViewsUITest, DisconnectingState); FRIEND_TEST_ALL_PREFIXES(MediaRouterViewsUITest, AddAndRemoveIssue);
diff --git a/chrome/browser/ui/media_router/media_router_ui_unittest.cc b/chrome/browser/ui/media_router/media_router_ui_unittest.cc index b68e879..9d91b854 100644 --- a/chrome/browser/ui/media_router/media_router_ui_unittest.cc +++ b/chrome/browser/ui/media_router/media_router_ui_unittest.cc
@@ -49,7 +49,6 @@ namespace { -constexpr char kPseudoSinkId[] = "pseudo:sink"; constexpr char kRouteId[] = "route1"; constexpr char kSinkDescription[] = "description"; constexpr char kSinkId[] = "sink1"; @@ -362,24 +361,6 @@ ui_->StopCasting(kRouteId); } -TEST_F(MediaRouterViewsUITest, RemovePseudoSink) { - MockControllerObserver observer(ui_.get()); - - MediaSink sink(kSinkId, kSinkName, SinkIconType::CAST_AUDIO); - MediaSinkWithCastModes sink_with_cast_modes(sink); - sink_with_cast_modes.cast_modes = {MediaCastMode::TAB_MIRROR}; - MediaSink pseudo_sink(kPseudoSinkId, kSinkName, SinkIconType::MEETING); - MediaSinkWithCastModes pseudo_sink_with_cast_modes(pseudo_sink); - pseudo_sink_with_cast_modes.cast_modes = {MediaCastMode::TAB_MIRROR}; - - EXPECT_CALL(observer, OnModelUpdated(_)) - .WillOnce(WithArg<0>(Invoke([&sink](const CastDialogModel& model) { - EXPECT_EQ(1u, model.media_sinks().size()); - EXPECT_EQ(sink.id(), model.media_sinks()[0].id); - }))); - NotifyUiOnResultsUpdated({sink_with_cast_modes, pseudo_sink_with_cast_modes}); -} - TEST_F(MediaRouterViewsUITest, ConnectingState) { MockControllerObserver observer(ui_.get()); @@ -472,39 +453,6 @@ mock_router_->GetIssueManager()->ClearIssue(issue_id); } -TEST_F(MediaRouterViewsUITest, ShowDomainForHangouts) { - const std::string domain1 = "domain1.com"; - const std::string domain2 = "domain2.com"; - MediaSinkWithCastModes available_hangout( - MediaSink("sink1", "Hangout 1", SinkIconType::HANGOUT)); - MediaSinkWithCastModes connected_hangout( - MediaSink("sink2", "Hangout 2", SinkIconType::HANGOUT)); - available_hangout.sink.set_domain(domain1); - connected_hangout.sink.set_domain(domain2); - available_hangout.cast_modes = {MediaCastMode::TAB_MIRROR}; - connected_hangout.cast_modes = {MediaCastMode::TAB_MIRROR}; - - MockControllerObserver observer(ui_.get()); - const std::string route_description = "route 1"; - MediaRoute route(kRouteId, MediaSource(kSourceId), "sink2", route_description, - true, true); - NotifyUiOnRoutesUpdated({route}, {}); - - // The domain should be used as the status text only if the sink is available. - // If the sink has a route, the route description is used. - EXPECT_CALL(observer, OnModelUpdated(_)) - .WillOnce(WithArg<0>([&](const CastDialogModel& model) { - EXPECT_EQ(2u, model.media_sinks().size()); - EXPECT_EQ(model.media_sinks()[0].id, available_hangout.sink.id()); - EXPECT_EQ(base::UTF8ToUTF16(domain1), - model.media_sinks()[0].status_text); - EXPECT_EQ(model.media_sinks()[1].id, connected_hangout.sink.id()); - EXPECT_EQ(base::UTF8ToUTF16(route_description), - model.media_sinks()[1].status_text); - })); - NotifyUiOnResultsUpdated({available_hangout, connected_hangout}); -} - TEST_F(MediaRouterViewsUITest, RouteCreationTimeoutForTab) { StartCastingAndExpectTimeout( MediaCastMode::TAB_MIRROR, @@ -600,22 +548,20 @@ TEST_F(MediaRouterViewsUITest, SortSinksByIconType) { NotifyUiOnResultsUpdated( - {{MediaSink("id1", "sink", SinkIconType::HANGOUT), {}}, - {MediaSink("id2", "B sink", SinkIconType::CAST_AUDIO_GROUP), {}}, - {MediaSink("id3", "sink", SinkIconType::GENERIC), {}}, - {MediaSink("id4", "A sink", SinkIconType::CAST_AUDIO_GROUP), {}}, - {MediaSink("id5", "sink", SinkIconType::CAST_AUDIO), {}}, - {MediaSink("id6", "sink", SinkIconType::CAST), {}}}); + {{MediaSink("id1", "B sink", SinkIconType::CAST_AUDIO_GROUP), {}}, + {MediaSink("id2", "sink", SinkIconType::GENERIC), {}}, + {MediaSink("id3", "A sink", SinkIconType::CAST_AUDIO_GROUP), {}}, + {MediaSink("id4", "sink", SinkIconType::CAST_AUDIO), {}}, + {MediaSink("id5", "sink", SinkIconType::CAST), {}}}); // The sorted order is CAST, CAST_AUDIO_GROUP "A", CAST_AUDIO_GROUP "B", // CAST_AUDIO, HANGOUT, GENERIC. const auto& sorted_sinks = ui_->GetEnabledSinks(); - EXPECT_EQ("id6", sorted_sinks[0].sink.id()); - EXPECT_EQ("id4", sorted_sinks[1].sink.id()); - EXPECT_EQ("id2", sorted_sinks[2].sink.id()); - EXPECT_EQ("id5", sorted_sinks[3].sink.id()); - EXPECT_EQ("id1", sorted_sinks[4].sink.id()); - EXPECT_EQ("id3", sorted_sinks[5].sink.id()); + EXPECT_EQ("id5", sorted_sinks[0].sink.id()); + EXPECT_EQ("id3", sorted_sinks[1].sink.id()); + EXPECT_EQ("id1", sorted_sinks[2].sink.id()); + EXPECT_EQ("id4", sorted_sinks[3].sink.id()); + EXPECT_EQ("id2", sorted_sinks[4].sink.id()); } TEST_F(MediaRouterViewsUITest, FilterNonDisplayRoutes) { @@ -750,30 +696,6 @@ } }; -TEST_F(MediaRouterViewsUIIncognitoTest, HidesCloudSinksForIncognito) { - const std::string domain1 = "domain1.com"; - MediaSinkWithCastModes hangout( - MediaSink("sink1", "Hangout", SinkIconType::HANGOUT)); - MediaSinkWithCastModes meeting( - MediaSink("sink2", "Meeting", SinkIconType::MEETING)); - MediaSinkWithCastModes eduReceiver( - MediaSink("sink3", "Cast for EDU", SinkIconType::EDUCATION)); - MediaSinkWithCastModes chromeCast( - MediaSink("sink4", "Living Room TV", SinkIconType::CAST)); - chromeCast.cast_modes = {MediaCastMode::TAB_MIRROR}; - for (MediaSinkWithCastModes* sink : - std::initializer_list<MediaSinkWithCastModes*>{&hangout, &meeting, - &eduReceiver}) { - sink->sink.set_domain(domain1); - sink->cast_modes = {MediaCastMode::TAB_MIRROR}; - } - - NotifyUiOnResultsUpdated({hangout, meeting, eduReceiver, chromeCast}); - - EXPECT_EQ(std::vector<MediaSinkWithCastModes>{chromeCast}, - ui_->GetEnabledSinks()); -} - TEST_F(MediaRouterViewsUIIncognitoTest, RouteRequestFromIncognito) { StartTabCasting(true); }
diff --git a/chrome/browser/ui/media_router/query_result_manager.h b/chrome/browser/ui/media_router/query_result_manager.h index 2f7eaeb..efd38d3 100644 --- a/chrome/browser/ui/media_router/query_result_manager.h +++ b/chrome/browser/ui/media_router/query_result_manager.h
@@ -8,7 +8,7 @@ #include <map> #include <memory> #include <set> -#include <unordered_set> +#include <unordered_map> #include <vector> #include "base/gtest_prod_util.h"
diff --git a/chrome/browser/ui/tabs/existing_tab_group_sub_menu_model.cc b/chrome/browser/ui/tabs/existing_tab_group_sub_menu_model.cc index d87378e4..c06e31a 100644 --- a/chrome/browser/ui/tabs/existing_tab_group_sub_menu_model.cc +++ b/chrome/browser/ui/tabs/existing_tab_group_sub_menu_model.cc
@@ -86,10 +86,10 @@ } void ExistingTabGroupSubMenuModel::ExecuteExistingCommand(int command_index) { - DCHECK_LT(size_t{command_index}, - model()->group_model()->ListTabGroups().size()); base::RecordAction(base::UserMetricsAction("TabContextMenu_NewTabInGroup")); + if (size_t{command_index} >= model()->group_model()->ListTabGroups().size()) + return; if (!model()->ContainsIndex(GetContextIndex())) return; model()->ExecuteAddToExistingGroupCommand(
diff --git a/chrome/browser/ui/tabs/tab_menu_model_unittest.cc b/chrome/browser/ui/tabs/tab_menu_model_unittest.cc index e3727c9..ae47184 100644 --- a/chrome/browser/ui/tabs/tab_menu_model_unittest.cc +++ b/chrome/browser/ui/tabs/tab_menu_model_unittest.cc
@@ -100,3 +100,33 @@ EXPECT_EQ(submenu->GetCommandIdAt(3), ExistingBaseSubMenuModel::kMinExistingTabGroupCommandId + 2); } + +// In some cases, groups may change after the menu is created. For example an +// extension may modify groups while the menu is open. If a group referenced in +// the menu goes away, ensure we handle this gracefully. +// +// Regression test for crbug.com/1197875 +TEST_F(TabMenuModelTest, AddToExistingGroupAfterGroupDestroyed) { + chrome::NewTab(browser()); + chrome::NewTab(browser()); + + TabStripModel* tab_strip_model = browser()->tab_strip_model(); + tab_strip_model->AddToNewGroup({0}); + + TabMenuModel menu(&delegate_, tab_strip_model, 1); + + int submenu_index = + menu.GetIndexOfCommandId(TabStripModel::CommandAddToExistingGroup); + ui::MenuModel* submenu = menu.GetSubmenuModelAt(submenu_index); + + EXPECT_EQ(submenu->GetItemCount(), 3); + + // Ungroup the tab at 0 to make the group in the menu dangle. + tab_strip_model->RemoveFromGroup({0}); + + // Try adding to the group from the menu. + submenu->ActivatedAt(2); + + EXPECT_FALSE(tab_strip_model->GetTabGroupForTab(0).has_value()); + EXPECT_FALSE(tab_strip_model->GetTabGroupForTab(1).has_value()); +}
diff --git a/chrome/browser/ui/ui_features.cc b/chrome/browser/ui/ui_features.cc index fef1541e..7205ec2c 100644 --- a/chrome/browser/ui/ui_features.cc +++ b/chrome/browser/ui/ui_features.cc
@@ -59,6 +59,11 @@ base::FEATURE_DISABLED_BY_DEFAULT}; const char kMinimumTabWidthFeatureParameterName[] = "minTabWidth"; +// Enables buttons to permanently appear on the tabstrip when +// scrollable-tabstrip is enabled. https://crbug.com/1116118 +const base::Feature kScrollableTabStripButtons{ + "ScrollableTabStripButtons", base::FEATURE_DISABLED_BY_DEFAULT}; + // Hosts some content in a side panel. https://crbug.com/1149995 const base::Feature kSidePanel{"SidePanel", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chrome/browser/ui/ui_features.h b/chrome/browser/ui/ui_features.h index 09882bc..a71c77f 100644 --- a/chrome/browser/ui/ui_features.h +++ b/chrome/browser/ui/ui_features.h
@@ -46,6 +46,8 @@ extern const base::Feature kScrollableTabStrip; extern const char kMinimumTabWidthFeatureParameterName[]; +extern const base::Feature kScrollableTabStripButtons; + extern const base::Feature kSidePanel; extern const base::Feature kSidePanelPrototype;
diff --git a/chrome/browser/ui/views/frame/tab_strip_region_view.cc b/chrome/browser/ui/views/frame/tab_strip_region_view.cc index e3732df7..e7a82d9 100644 --- a/chrome/browser/ui/views/frame/tab_strip_region_view.cc +++ b/chrome/browser/ui/views/frame/tab_strip_region_view.cc
@@ -194,18 +194,6 @@ views::kFlexBehaviorKey, views::FlexSpecification(base::BindRepeating( &TabScrollContainerFlexRule, base::Unretained(tab_strip_)))); - - leading_scroll_button_ = AddChildView(CreateScrollButton( - base::BindRepeating(&TabStripRegionView::ScrollTowardsLeadingTab, - base::Unretained(this)))); - trailing_scroll_button_ = AddChildView(CreateScrollButton( - base::BindRepeating(&TabStripRegionView::ScrollTowardsTrailingTab, - base::Unretained(this)))); - - // The space in dips between the scroll buttons and the NTB. - constexpr int kScrollButtonsTrailingMargin = 8; - trailing_scroll_button_->SetProperty( - views::kMarginsKey, gfx::Insets(0, 0, 0, kScrollButtonsTrailingMargin)); } else { tab_strip_container_ = AddChildView(std::move(tab_strip)); @@ -219,6 +207,20 @@ tab_strip_container_flex_spec); } + if (base::FeatureList::IsEnabled(features::kScrollableTabStripButtons)) { + leading_scroll_button_ = AddChildView(CreateScrollButton( + base::BindRepeating(&TabStripRegionView::ScrollTowardsLeadingTab, + base::Unretained(this)))); + trailing_scroll_button_ = AddChildView(CreateScrollButton( + base::BindRepeating(&TabStripRegionView::ScrollTowardsTrailingTab, + base::Unretained(this)))); + + // The space in dips between the scroll buttons and the NTB. + constexpr int kScrollButtonsTrailingMargin = 8; + trailing_scroll_button_->SetProperty( + views::kMarginsKey, gfx::Insets(0, 0, 0, kScrollButtonsTrailingMargin)); + } + new_tab_button_ = AddChildView(std::make_unique<NewTabButton>( tab_strip_, base::BindRepeating(&TabStrip::NewTabButtonPressed, base::Unretained(tab_strip_)))); @@ -310,7 +312,7 @@ new_tab_button_->FrameColorsChanged(); if (tab_search_button_) tab_search_button_->FrameColorsChanged(); - if (base::FeatureList::IsEnabled(features::kScrollableTabStrip)) { + if (base::FeatureList::IsEnabled(features::kScrollableTabStripButtons)) { const SkColor background_color = tab_strip_->GetTabBackgroundColor( TabActive::kInactive, BrowserFrameActiveState::kUseCurrent); SkColor foreground_color = tab_strip_->GetTabForegroundColor( @@ -362,7 +364,7 @@ void TabStripRegionView::OnViewPreferredSizeChanged(View* view) { DCHECK_EQ(view, tab_strip_); - if (base::FeatureList::IsEnabled(features::kScrollableTabStrip)) + if (base::FeatureList::IsEnabled(features::kScrollableTabStripButtons)) UpdateScrollButtonVisibility(); // The |tab_strip_|'s preferred size changing can change our own preferred @@ -378,24 +380,28 @@ // sibling views. First ask for the available size of the container. views::SizeBound width_bound = GetAvailableSize(tab_strip_container_).width(); - int tabstrip_available_width = width_bound.min_of(width()); - // The scroll buttons should never prevent the tabstrip from being entirely - // visible (i.e. non-scrollable). In that sense, their layout space is always - // available for the tabstrip's use. - if (base::FeatureList::IsEnabled(features::kScrollableTabStrip) && - leading_scroll_button_->GetVisible()) { - // The scroll button span has to be manually calculated since this occurs - // during layout and we cannot use the layout positions. - const int scroll_buttons_span = - leading_scroll_button_->width() + trailing_scroll_button_->width() + - trailing_scroll_button_->GetProperty(views::kMarginsKey)->right(); - tabstrip_available_width += scroll_buttons_span; - } - // Because we can't return a null value, and we can't return zero, for cases // where we have never been laid out we will return something arbitrary (the // width of the region view is as good a choice as any, as it's strictly // larger than the tabstrip should be able to display). + int tabstrip_available_width = width_bound.min_of(width()); + + // The scroll buttons should never prevent the tabstrip from being entirely + // visible (i.e. non-scrollable). In that sense, their layout space is always + // available for the tabstrip's use. + if (base::FeatureList::IsEnabled(features::kScrollableTabStripButtons) && + leading_scroll_button_->GetVisible()) { + const int scroll_buttons_span = + new_tab_button_->x() - leading_scroll_button_->x(); + // The NTB must immediately follow the scroll buttons for this approach + // to make sense. If these DCHECKS fail, we will need to revisit this + // assumption. + DCHECK_GT(scroll_buttons_span, 0); + DCHECK_EQ(GetIndexOf(trailing_scroll_button_) + 1, + GetIndexOf(new_tab_button_)); + tabstrip_available_width += scroll_buttons_span; + } + return tabstrip_available_width; } @@ -442,10 +448,11 @@ } void TabStripRegionView::UpdateScrollButtonVisibility() { - DCHECK(base::FeatureList::IsEnabled(features::kScrollableTabStrip)); + DCHECK(base::FeatureList::IsEnabled(features::kScrollableTabStripButtons)); // Make the scroll buttons visible only if the tabstrip can be scrolled. bool is_scrollable = tab_strip_->GetMinimumSize().width() > GetTabStripAvailableWidth(); + leading_scroll_button_->SetVisible(is_scrollable); trailing_scroll_button_->SetVisible(is_scrollable); }
diff --git a/chrome/browser/ui/views/frame/tab_strip_region_view.h b/chrome/browser/ui/views/frame/tab_strip_region_view.h index 96e5858..db193f1 100644 --- a/chrome/browser/ui/views/frame/tab_strip_region_view.h +++ b/chrome/browser/ui/views/frame/tab_strip_region_view.h
@@ -44,8 +44,6 @@ NewTabButton* new_tab_button() { return new_tab_button_; } - views::View* leading_scroll_button() { return leading_scroll_button_; } - TabSearchButton* tab_search_button() { return tab_search_button_; } TipMarqueeView* tip_marquee_view() { return tip_marquee_view_; }
diff --git a/chrome/browser/ui/views/frame/tab_strip_region_view_unittest.cc b/chrome/browser/ui/views/frame/tab_strip_region_view_unittest.cc index 9f5b34a0..10468a2 100644 --- a/chrome/browser/ui/views/frame/tab_strip_region_view_unittest.cc +++ b/chrome/browser/ui/views/frame/tab_strip_region_view_unittest.cc
@@ -62,9 +62,6 @@ } void TearDown() override { - // TODO(crbug.com/1202946): Ensure the tabstrip is not animating during tear - // down which causes undefined behavior. - tab_strip_->StopAnimating(true); widget_.reset(); ChromeViewsTestBase::TearDown(); } @@ -267,27 +264,6 @@ tab_strip_->tab_at(tab_strip_->GetModelCount() - 1)->GetVisible()); } -// When scrolling is enabled, adding enough tabs will cause the tabstrip to -// enter a scroll state with visible scroll controls. When the last tab that -// caused the tabstrip to enter the scroll state is removed, the tabstrip should -// return to a non-scrolling state. -TEST_F(TabStripRegionViewTestWithScrollingEnabled, - TabStripEntersAndExitsScrolling) { - // const int minimum_active_width = TabStyleViews::GetMinimumInactiveWidth(); - controller_->AddTab(0, true); - CompleteAnimationAndLayout(); - - // Add tabs to the tabstrip until it is full and should start overflowing. - while (!tab_strip_region_view_->leading_scroll_button()->GetVisible()) { - controller_->AddTab(0, false); - CompleteAnimationAndLayout(); - } - EXPECT_TRUE(tab_strip_region_view_->leading_scroll_button()->GetVisible()); - controller_->CloseTab(0); - CompleteAnimationAndLayout(); - EXPECT_FALSE(tab_strip_region_view_->leading_scroll_button()->GetVisible()); -} - INSTANTIATE_TEST_SUITE_P(All, TabStripRegionViewTest, ::testing::Values(true, false));
diff --git a/chrome/browser/ui/views/media_router/cast_dialog_sink_button.cc b/chrome/browser/ui/views/media_router/cast_dialog_sink_button.cc index d26f611..a1348ebc 100644 --- a/chrome/browser/ui/views/media_router/cast_dialog_sink_button.cc +++ b/chrome/browser/ui/views/media_router/cast_dialog_sink_button.cc
@@ -49,24 +49,6 @@ namespace { -bool CastToMeetingEnabled() { - return base::FeatureList::IsEnabled(kCastToMeetingFromCastDialog); -} - -bool IsMeetingIconType(SinkIconType icon_type) { - switch (icon_type) { - case SinkIconType::MEETING: - case SinkIconType::HANGOUT: - return true; - default: - return false; - } -} - -bool IsEnabledIconType(SinkIconType icon_type) { - return CastToMeetingEnabled() || !IsMeetingIconType(icon_type); -} - gfx::ImageSkia CreateSinkIcon(SinkIconType icon_type, bool enabled = true) { SkColor icon_color = enabled ? gfx::kChromeIconGrey : gfx::kGoogleGrey500; return gfx::CreateVectorIcon(*CastDialogSinkButton::GetVectorIcon(icon_type), @@ -107,9 +89,6 @@ } std::u16string GetStatusTextForSink(const UIMediaSink& sink) { - if (!IsEnabledIconType(sink.icon_type)) - return std::u16string(); - if (sink.issue) return base::UTF8ToUTF16(sink.issue->info().title); // If the sink is disconnecting, say so instead of using the source info @@ -128,119 +107,15 @@ } } -// Find the index of a tab whose URL matches the given origin and path. In the -// case of multiple matches, the active tab is given priority, otherwise returns -// the index of an arbitrary tab. -base::Optional<int> FindTabWithUrlPrefix(TabStripModel* tabs, - const GURL& origin, - base::StringPiece path) { - base::Optional<int> to_activate; - for (int i = 0; i < tabs->count(); i++) { - auto* content = tabs->GetWebContentsAt(i); - const GURL& url = content->GetVisibleURL(); - if (url.GetOrigin() == origin && url.path() == path) { - to_activate = i; - if (tabs->active_index() <= i) - break; - } - } - return to_activate; -} - -// Selects or creates a tab for a meeting ID. Tries to select an existing tab -// in the current window or some other window, and if no tab is found, opens a -// new tab for the meeting. -// -// If there is no meeting ID, this function just selects or creates a tab -// showing the start page of Google Meet. -void ShowMeetTab(Profile* profile, - const base::Optional<std::string>& meeting_id) { - const GURL origin("https://meet.google.com"); - const std::string path = meeting_id ? "/" + *meeting_id : std::string(); - - const auto& browsers = *BrowserList::GetInstance(); - for (auto iter = browsers.begin_last_active(); - iter != browsers.end_last_active(); ++iter) { - Browser* browser = *iter; - if (browser->profile() == profile && browser->window() && - browser->is_type_normal()) { - auto* tabs = browser->tab_strip_model(); - auto tab_index = FindTabWithUrlPrefix(tabs, origin, path); - if (tab_index.has_value()) { - browser->window()->Show(); - tabs->ActivateTabAt(tab_index.value()); - return; - } - } - } - - NavigateParams params(profile, origin.Resolve(path), - ui::PAGE_TRANSITION_FIRST); - params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; - Navigate(¶ms); -} - -class CastToMeetingDeprecationWarningView : public views::View { - public: - METADATA_HEADER(CastToMeetingDeprecationWarningView); - CastToMeetingDeprecationWarningView(const std::string& sink_id, - Profile* profile) { - DCHECK(profile); - - auto* layout = SetLayoutManager(std::make_unique<views::BoxLayout>()); - layout->set_inside_border_insets(gfx::Insets(5)); - layout->set_cross_axis_alignment( - views::BoxLayout::CrossAxisAlignment::kStart); - - // Add space to line up with text in receiver list. - auto* spacer = AddChildView(std::make_unique<views::View>()); - spacer->SetPreferredSize(gfx::Size(55, 1)); - - std::u16string text = l10n_util::GetStringUTF16( - CastToMeetingEnabled() ? IDS_MEDIA_ROUTER_CAST_TO_MEETING_DEPRECATED - : IDS_MEDIA_ROUTER_CAST_TO_MEETING_REMOVED); - std::vector<std::u16string> substrings{u"Google Meet"}; - std::vector<size_t> offsets; - text = base::ReplaceStringPlaceholders(text, substrings, &offsets); - - auto* label = AddChildView(std::make_unique<views::StyledLabel>()); - label->SetText(text); - - // Try to extract a meeting ID from a sink ID. This should always succeed - // unless the "meeting" is actually a Hangout, or if the wrong version of - // the Cast extension is installed. - base::Optional<std::string> meeting_id; - if (sink_id.size() == 17 && base::StartsWith(sink_id, "meet:")) { - meeting_id = sink_id.substr(5); - } - - gfx::Range link_range(offsets[0], offsets[0] + substrings[0].length()); - auto link_style = - views::StyledLabel::RangeStyleInfo::CreateForLink(base::BindRepeating( - &ShowMeetTab, base::Unretained(profile), meeting_id)); - link_style.disable_line_wrapping = false; - label->AddStyleRange(link_range, link_style); - } -}; - -BEGIN_METADATA(CastToMeetingDeprecationWarningView, views::View) -END_METADATA - } // namespace CastDialogSinkButton::CastDialogSinkButton(PressedCallback callback, const UIMediaSink& sink) - : HoverButton( - IsEnabledIconType(sink.icon_type) - ? std::move(callback) - // Using the default constructor here causes the button to be - // disabled, including the visual "ink drop" effect. Calling - // SetEnabled() or SetState() does not have the same effect. - : PressedCallback(), - CreatePrimaryIconForSink(sink), - sink.friendly_name, - GetStatusTextForSink(sink), - /** secondary_icon_view */ nullptr), + : HoverButton(std::move(callback), + CreatePrimaryIconForSink(sink), + sink.friendly_name, + GetStatusTextForSink(sink), + /** secondary_icon_view */ nullptr), sink_(sink) { SetEnabled(sink.state == UIMediaSinkState::AVAILABLE || sink.state == UIMediaSinkState::CONNECTED); @@ -343,21 +218,9 @@ RestoreStatusText(); } -std::unique_ptr<views::View> -CastDialogSinkButton::MakeCastToMeetingDeprecationWarningView( - Profile* profile) { - return IsMeetingIconType(sink_.icon_type) - ? std::make_unique<CastToMeetingDeprecationWarningView>(sink_.id, - profile) - : nullptr; -} - // static const gfx::VectorIcon* CastDialogSinkButton::GetVectorIcon( SinkIconType icon_type) { - if (!IsEnabledIconType(icon_type)) - return &::vector_icons::kHelpOutlineIcon; - const gfx::VectorIcon* vector_icon; switch (icon_type) { case SinkIconType::CAST_AUDIO_GROUP: @@ -366,22 +229,9 @@ case SinkIconType::CAST_AUDIO: vector_icon = &kSpeakerIcon; break; - case SinkIconType::EDUCATION: - vector_icon = &kCastForEducationIcon; - break; case SinkIconType::WIRED_DISPLAY: vector_icon = &kInputIcon; break; -// Use proprietary icons only in Chrome builds. The default TV icon is used -// instead for these sink types in Chromium builds. -#if BUILDFLAG(GOOGLE_CHROME_BRANDING) - case SinkIconType::MEETING: - vector_icon = &vector_icons::kMeetIcon; - break; - case SinkIconType::HANGOUT: - vector_icon = &vector_icons::kHangoutIcon; - break; -#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) case SinkIconType::CAST: case SinkIconType::GENERIC: default:
diff --git a/chrome/browser/ui/views/media_router/cast_dialog_sink_button.h b/chrome/browser/ui/views/media_router/cast_dialog_sink_button.h index 77b3f73..5867e2a 100644 --- a/chrome/browser/ui/views/media_router/cast_dialog_sink_button.h +++ b/chrome/browser/ui/views/media_router/cast_dialog_sink_button.h
@@ -12,8 +12,6 @@ #include "chrome/browser/ui/views/hover_button.h" #include "ui/views/metadata/metadata_header_macros.h" -class Profile; - namespace ui { class MouseEvent; } @@ -42,13 +40,6 @@ const UIMediaSink& sink() const { return sink_; } - // If this button will cast to a meeting, creates a view showing a warning - // about the feature being deprecated. Otherwise returns nullptr. The - // |profile| parameter is used to open the meeting tab the the user clicks on - // the link in the warning. - std::unique_ptr<views::View> MakeCastToMeetingDeprecationWarningView( - Profile* profile); - static const gfx::VectorIcon* GetVectorIcon(SinkIconType icon_type); static const gfx::VectorIcon* GetVectorIcon(UIMediaSink sink);
diff --git a/chrome/browser/ui/views/media_router/cast_dialog_view.cc b/chrome/browser/ui/views/media_router/cast_dialog_view.cc index 1be9e5e..3ccf266d 100644 --- a/chrome/browser/ui/views/media_router/cast_dialog_view.cc +++ b/chrome/browser/ui/views/media_router/cast_dialog_view.cc
@@ -326,16 +326,6 @@ base::Unretained(this), i), sinks.at(i))); sink_buttons_.push_back(sink_button); - - // This could potentially add a lot of warnings to the receiver list, but in - // practice a user is unlikely to have more than one or two meetings in the - // list at any given time, and repeating the warning is probably better than - // having the user ignore possibly the warning if it's only shown for a - // meeting they're not trying to cast to. - auto warning_view = - sink_button->MakeCastToMeetingDeprecationWarningView(profile_); - if (warning_view) - sink_list_view->AddChildView(std::move(warning_view)); } scroll_view_->SetContents(std::move(sink_list_view));
diff --git a/chrome/browser/ui/views/passwords/password_save_update_with_account_store_view.cc b/chrome/browser/ui/views/passwords/password_save_update_with_account_store_view.cc index 637db9a..dad5fea 100644 --- a/chrome/browser/ui/views/passwords/password_save_update_with_account_store_view.cc +++ b/chrome/browser/ui/views/passwords/password_save_update_with_account_store_view.cc
@@ -10,6 +10,7 @@ #include <vector> #include "base/feature_list.h" +#include "base/metrics/field_trial_params.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "chrome/app/vector_icons/vector_icons.h"
diff --git a/chrome/browser/ui/webui/app_management/app_management_shelf_delegate_chromeos.cc b/chrome/browser/ui/webui/app_management/app_management_shelf_delegate_chromeos.cc index 128df97..cd04417 100644 --- a/chrome/browser/ui/webui/app_management/app_management_shelf_delegate_chromeos.cc +++ b/chrome/browser/ui/webui/app_management/app_management_shelf_delegate_chromeos.cc
@@ -10,7 +10,7 @@ #include "ash/public/cpp/shelf_model.h" #include "ash/public/cpp/shelf_types.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/ash/chrome_launcher_prefs.h" +#include "chrome/browser/ui/ash/chrome_shelf_prefs.h" #include "chrome/browser/ui/ash/launcher/chrome_shelf_controller.h" #include "chrome/browser/ui/ash/launcher/chrome_shelf_controller_util.h" #include "chrome/browser/ui/ash/launcher/shelf_controller_helper.h"
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 004edb94..008e66b 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-master-1619535568-f9f3d0e78e8e9d18be7f93808c31850e4c6dfdec.profdata +chrome-win32-master-1619546379-5a0dba72f543078b3748e5d96b95d110e07e66a3.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 1c6a7e2..698f1c1 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-master-1619535568-e1590f0dc714ab34c1f50650a262ae1f1fca57d5.profdata +chrome-win64-master-1619546379-2747bea154d1d236cc5533b03b96ae01e7fd1034.profdata
diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn index f9c66092..0e3009c3 100644 --- a/chrome/common/BUILD.gn +++ b/chrome/common/BUILD.gn
@@ -17,6 +17,7 @@ import("//mojo/public/tools/bindings/mojom.gni") import("//pdf/features.gni") import("//ppapi/buildflags/buildflags.gni") +import("//printing/buildflags/buildflags.gni") import("//third_party/widevine/cdm/widevine.gni") import("//tools/grit/grit_rule.gni")
diff --git a/chrome/credential_provider/test/com_fakes.h b/chrome/credential_provider/test/com_fakes.h index 5c7f594..67d0377 100644 --- a/chrome/credential_provider/test/com_fakes.h +++ b/chrome/credential_provider/test/com_fakes.h
@@ -10,6 +10,7 @@ #include <propkey.h> #include <string> +#include <unordered_map> #include <vector> #include "chrome/credential_provider/gaiacp/gaia_credential_provider.h"
diff --git a/chrome/credential_provider/test/gcp_fakes.h b/chrome/credential_provider/test/gcp_fakes.h index b4e7d12b..371c9ac 100644 --- a/chrome/credential_provider/test/gcp_fakes.h +++ b/chrome/credential_provider/test/gcp_fakes.h
@@ -11,6 +11,7 @@ #include <memory> #include <string> #include <thread> +#include <unordered_map> #include <vector> #include "base/synchronization/waitable_event.h"
diff --git a/chrome/renderer/resources/extensions/media_router_bindings.js b/chrome/renderer/resources/extensions/media_router_bindings.js index 9d7801ef..cb62dc4 100644 --- a/chrome/renderer/resources/extensions/media_router_bindings.js +++ b/chrome/renderer/resources/extensions/media_router_bindings.js
@@ -413,12 +413,6 @@ return mediaRouter.mojom.SinkIconType.CAST_AUDIO_GROUP; case 'cast_audio': return mediaRouter.mojom.SinkIconType.CAST_AUDIO; - case 'meeting': - return mediaRouter.mojom.SinkIconType.MEETING; - case 'hangout': - return mediaRouter.mojom.SinkIconType.HANGOUT; - case 'education': - return mediaRouter.mojom.SinkIconType.EDUCATION; case 'generic': return mediaRouter.mojom.SinkIconType.GENERIC; default:
diff --git a/chrome/service/BUILD.gn b/chrome/service/BUILD.gn index b39ef53..048d8d7 100644 --- a/chrome/service/BUILD.gn +++ b/chrome/service/BUILD.gn
@@ -6,7 +6,7 @@ import("//build/config/features.gni") import("//printing/buildflags/buildflags.gni") -assert(!is_chromeos_ash) +assert(enable_print_preview) static_library("service") { sources = [
diff --git a/chrome/test/chromedriver/support/release/release.sh b/chrome/test/chromedriver/support/release/release.sh index 3e1a28a..b2c44cd 100755 --- a/chrome/test/chromedriver/support/release/release.sh +++ b/chrome/test/chromedriver/support/release/release.sh
@@ -59,6 +59,7 @@ unzip $src/chromedriver_mac64_m1.zip -d chromedriver_mac64_m1/ unzip $src/chromedriver_win32.zip +# TODO: Remove this line after verifying strip has no effect strip -p chromedriver_linux64/chromedriver zip -j $tgt/chromedriver_linux64.zip chromedriver_linux64/chromedriver
diff --git a/chrome/test/data/webui/new_tab_page/modules/drive/module_test.js b/chrome/test/data/webui/new_tab_page/modules/drive/module_test.js index 31284d8..60296fb 100644 --- a/chrome/test/data/webui/new_tab_page/modules/drive/module_test.js +++ b/chrome/test/data/webui/new_tab_page/modules/drive/module_test.js
@@ -30,7 +30,6 @@ id: '123', mimeType: 'application/vnd.google-apps.spreadsheet', itemUrl: {url: 'https://foo.com'}, - untrustedPhotoUrl: {url: 'https://photo.com'}, }, { justificationText: 'Edited today', @@ -64,16 +63,14 @@ 'Edited today', items[1].querySelector('.file-description').textContent); assertEquals( - 'https://drive-thirdparty.googleusercontent.com/16/type/application/vnd.google-apps.spreadsheet', + 'https://drive-thirdparty.googleusercontent.com/32/type/application/vnd.google-apps.spreadsheet', items[0].querySelector('.file-icon').autoSrc); assertEquals( - 'https://drive-thirdparty.googleusercontent.com/16/type/application/vnd.google-apps.document', + 'https://drive-thirdparty.googleusercontent.com/32/type/application/vnd.google-apps.document', items[1].querySelector('.file-icon').autoSrc); assertEquals( - 'https://drive-thirdparty.googleusercontent.com/16/type/application/vnd.google-apps.presentation', + 'https://drive-thirdparty.googleusercontent.com/32/type/application/vnd.google-apps.presentation', items[2].querySelector('.file-icon').autoSrc); - assertEquals( - 'https://photo.com', items[0].querySelector('.user-image').autoSrc); const urls = module.shadowRoot.querySelectorAll('.file'); assertEquals('https://foo.com/', urls[0].href); assertEquals('https://bar.com/', urls[1].href);
diff --git a/chrome/test/data/webui/welcome/app_chooser_test.js b/chrome/test/data/webui/welcome/app_chooser_test.js index 3557944..e80bb6f 100644 --- a/chrome/test/data/webui/welcome/app_chooser_test.js +++ b/chrome/test/data/webui/welcome/app_chooser_test.js
@@ -63,10 +63,10 @@ testAppMetricsProxy = new TestMetricsProxy(); testBookmarkBrowserProxy = new TestBookmarkProxy(); - GoogleAppProxyImpl.instance_ = testAppBrowserProxy; - GoogleAppsMetricsProxyImpl.instance_ = testAppMetricsProxy; - BookmarkProxyImpl.instance_ = testBookmarkBrowserProxy; - BookmarkBarManager.instance_ = new BookmarkBarManager(); + GoogleAppProxyImpl.setInstance(testAppBrowserProxy); + GoogleAppsMetricsProxyImpl.setInstance(testAppMetricsProxy); + BookmarkProxyImpl.setInstance(testBookmarkBrowserProxy); + BookmarkBarManager.setInstance(new BookmarkBarManager()); testAppBrowserProxy.setAppList(apps);
diff --git a/chrome/test/data/webui/welcome/nux_ntp_background_test.js b/chrome/test/data/webui/welcome/nux_ntp_background_test.js index be80d35d..bbf2fad0 100644 --- a/chrome/test/data/webui/welcome/nux_ntp_background_test.js +++ b/chrome/test/data/webui/welcome/nux_ntp_background_test.js
@@ -44,9 +44,9 @@ }); testMetricsProxy = new TestMetricsProxy(); - NtpBackgroundMetricsProxyImpl.instance_ = testMetricsProxy; + NtpBackgroundMetricsProxyImpl.setInstance(testMetricsProxy); testNtpBackgroundProxy = new TestNtpBackgroundProxy(); - NtpBackgroundProxyImpl.instance_ = testNtpBackgroundProxy; + NtpBackgroundProxyImpl.setInstance(testNtpBackgroundProxy); testNtpBackgroundProxy.setBackgroundsList(backgrounds); document.body.innerHTML = '';
diff --git a/chrome/test/data/webui/welcome/nux_set_as_default_test.js b/chrome/test/data/webui/welcome/nux_set_as_default_test.js index e796f74bf..7e789642 100644 --- a/chrome/test/data/webui/welcome/nux_set_as_default_test.js +++ b/chrome/test/data/webui/welcome/nux_set_as_default_test.js
@@ -23,7 +23,7 @@ setup(function() { testSetAsDefaultProxy = new TestNuxSetAsDefaultProxy(); - NuxSetAsDefaultProxyImpl.instance_ = testSetAsDefaultProxy; + NuxSetAsDefaultProxyImpl.setInstance(testSetAsDefaultProxy); document.body.innerHTML = ''; testElement = document.createElement('nux-set-as-default');
diff --git a/chrome/test/data/webui/welcome/signin_view_test.js b/chrome/test/data/webui/welcome/signin_view_test.js index 6203dec..77e8a71 100644 --- a/chrome/test/data/webui/welcome/signin_view_test.js +++ b/chrome/test/data/webui/welcome/signin_view_test.js
@@ -19,11 +19,11 @@ setup(function() { testWelcomeBrowserProxy = new TestWelcomeBrowserProxy(); - WelcomeBrowserProxyImpl.instance_ = testWelcomeBrowserProxy; + WelcomeBrowserProxyImpl.setInstance(testWelcomeBrowserProxy); // Not used in test, but setting to test proxy anyway, in order to prevent // calls to backend. - SigninViewProxyImpl.instance_ = new TestSigninViewProxy(); + SigninViewProxyImpl.setInstance(new TestSigninViewProxy()); document.body.innerHTML = ''; testElement = document.createElement('signin-view');
diff --git a/chrome/test/data/webui/welcome/welcome_app_test.js b/chrome/test/data/webui/welcome/welcome_app_test.js index 5fea3f8..3d396ad 100644 --- a/chrome/test/data/webui/welcome/welcome_app_test.js +++ b/chrome/test/data/webui/welcome/welcome_app_test.js
@@ -8,7 +8,6 @@ import {navigateTo, Routes} from 'chrome://welcome/navigation_behavior.js'; import {NuxSetAsDefaultProxyImpl} from 'chrome://welcome/set_as_default/nux_set_as_default_proxy.js'; import {BookmarkProxyImpl} from 'chrome://welcome/shared/bookmark_proxy.js'; -import {ModuleMetricsProxyImpl} from 'chrome://welcome/shared/module_metrics_proxy.js'; import {WelcomeBrowserProxyImpl} from 'chrome://welcome/welcome_browser_proxy.js'; import {waitBeforeNextRender} from '../test_util.m.js'; @@ -60,16 +59,15 @@ setup(function() { testWelcomeBrowserProxy = new TestWelcomeBrowserProxy(); - WelcomeBrowserProxyImpl.instance_ = testWelcomeBrowserProxy; + WelcomeBrowserProxyImpl.setInstance(testWelcomeBrowserProxy); testSetAsDefaultProxy = new TestNuxSetAsDefaultProxy(); - NuxSetAsDefaultProxyImpl.instance_ = testSetAsDefaultProxy; + NuxSetAsDefaultProxyImpl.setInstance(testSetAsDefaultProxy); // Not used in test, but setting to test proxy anyway, in order to prevent // calls to backend. - BookmarkProxyImpl.instance_ = new TestBookmarkProxy(); - LandingViewProxyImpl.instance_ = new TestLandingViewProxy(); - ModuleMetricsProxyImpl.instance_ = new TestMetricsProxy(); + BookmarkProxyImpl.setInstance(new TestBookmarkProxy()); + LandingViewProxyImpl.setInstance(new TestLandingViewProxy()); return resetTestElement(); });
diff --git a/chromeos/dbus/dlcservice/fake_dlcservice_client.h b/chromeos/dbus/dlcservice/fake_dlcservice_client.h index dca9e18..92e138c8 100644 --- a/chromeos/dbus/dlcservice/fake_dlcservice_client.h +++ b/chromeos/dbus/dlcservice/fake_dlcservice_client.h
@@ -29,7 +29,7 @@ UninstallCallback callback) override; // Purging removes the DLC entirely from disk. void Purge(const std::string& dlc_id, PurgeCallback callback) override; - void GetDlcState(const std::string& dlc_if, + void GetDlcState(const std::string& dlc_id, GetDlcStateCallback callback) override; void GetExistingDlcs(GetExistingDlcsCallback callback) override; void DlcStateChangedForTest(dbus::Signal* signal) override;
diff --git a/chromeos/memory/memory_ablation_study.cc b/chromeos/memory/memory_ablation_study.cc index e81974e..ec4f74a 100644 --- a/chromeos/memory/memory_ablation_study.cc +++ b/chromeos/memory/memory_ablation_study.cc
@@ -9,6 +9,7 @@ #include "base/debug/alias.h" #include "base/feature_list.h" +#include "base/metrics/field_trial_params.h" #include "base/timer/timer.h" #include "crypto/random.h"
diff --git a/chromeos/network/BUILD.gn b/chromeos/network/BUILD.gn index 208ebc73..8212259 100644 --- a/chromeos/network/BUILD.gn +++ b/chromeos/network/BUILD.gn
@@ -113,6 +113,8 @@ "network_metadata_observer.h", "network_metadata_store.cc", "network_metadata_store.h", + "network_name_util.cc", + "network_name_util.h", "network_profile.cc", "network_profile.h", "network_profile_handler.cc", @@ -292,6 +294,7 @@ "network_device_handler_unittest.cc", "network_event_log_unittest.cc", "network_metadata_store_unittest.cc", + "network_name_util_unittest.cc", "network_sms_handler_unittest.cc", "network_state_handler_unittest.cc", "network_state_unittest.cc",
diff --git a/chromeos/network/network_name_util.cc b/chromeos/network/network_name_util.cc new file mode 100644 index 0000000..5730aa5 --- /dev/null +++ b/chromeos/network/network_name_util.cc
@@ -0,0 +1,79 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/network/network_name_util.h" + +#include <stddef.h> +#include <stdint.h> + +#include <utility> + +#include "base/strings/string_util.h" +#include "base/strings/utf_string_conversions.h" +#include "chromeos/network/cellular_esim_profile_handler.h" +#include "chromeos/network/network_state.h" +#include "third_party/cros_system_api/dbus/shill/dbus-constants.h" + +namespace chromeos { + +namespace network_name_util { + +base::Optional<std::string> GetESimProfileName( + CellularESimProfileHandler* cellular_esim_profile_handler, + const NetworkState* network_state) { + DCHECK(network_state); + + // CellularESimProfileHandler is not available if the relevant flag is + // disabled. + if (!cellular_esim_profile_handler) + return base::nullopt; + + // Only Cellular networks correspond to eSIM profiles. + if (network_state->type() != shill::kTypeCellular) + return base::nullopt; + + // eSIM profiles have an associated EID and ICCID. + if (network_state->eid().empty() || network_state->iccid().empty()) + return base::nullopt; + + std::vector<CellularESimProfile> profiles = + cellular_esim_profile_handler->GetESimProfiles(); + for (const auto& profile : profiles) { + if (profile.eid() != network_state->eid() || + profile.iccid() != network_state->iccid()) { + continue; + } + + // We've found a profile corresponding to the network. If possible, use the + // profile's nickname, falling back to the name or the service provider. + + if (!profile.nickname().empty()) + return base::UTF16ToUTF8(profile.nickname()); + + if (!profile.name().empty()) + return base::UTF16ToUTF8(profile.name()); + + if (!profile.service_provider().empty()) + return base::UTF16ToUTF8(profile.service_provider()); + } + + return base::nullopt; +} + +std::string GetNetworkName( + CellularESimProfileHandler* cellular_esim_profile_handler, + const NetworkState* network_state) { + DCHECK(network_state); + if (!network_state->eid().empty()) { + base::Optional<std::string> network_name; + network_name = + GetESimProfileName(cellular_esim_profile_handler, network_state); + if (network_name.has_value()) + return *network_name; + } + return network_state->name(); +} + +} // namespace network_name_util +} // namespace chromeos
diff --git a/chromeos/network/network_name_util.h b/chromeos/network/network_name_util.h new file mode 100644 index 0000000..7e5411a --- /dev/null +++ b/chromeos/network/network_name_util.h
@@ -0,0 +1,40 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_NETWORK_NETWORK_NAME_UTIL_H_ +#define CHROMEOS_NETWORK_NETWORK_NAME_UTIL_H_ + +#include <string> + +#include "base/component_export.h" +#include "base/optional.h" + +namespace chromeos { + +class NetworkState; +class CellularESimProfileHandler; + +namespace network_name_util { + +// Returns eSIM profile name for a given |network_state|. +// Returns null if |cellular_esim_profile_handler| is null, or network is not +// an eSIM network. +COMPONENT_EXPORT(CHROMEOS_NETWORK) +base::Optional<std::string> GetESimProfileName( + CellularESimProfileHandler* cellular_esim_profile_handler, + const NetworkState* network_state); + +// Returns network name for a given |network_state|. If network +// is eSIM it calls GetESimProfileName and uses |cellular_esim_profile_handler| +// to get the eSIM profile name. If |cellular_esim_profile_handler| is null, +// this function returns |network_state->name|. +COMPONENT_EXPORT(CHROMEOS_NETWORK) +std::string GetNetworkName( + CellularESimProfileHandler* cellular_esim_profile_handler, + const NetworkState* network_state); + +} // namespace network_name_util +} // namespace chromeos + +#endif // CHROMEOS_NETWORK_NETWORK_NAME_UTIL_H_
diff --git a/chromeos/network/network_name_util_unittest.cc b/chromeos/network/network_name_util_unittest.cc new file mode 100644 index 0000000..b85e8fb --- /dev/null +++ b/chromeos/network/network_name_util_unittest.cc
@@ -0,0 +1,132 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/network/network_name_util.h" + +#include <stddef.h> + +#include <memory> +#include <utility> + +#include "base/run_loop.h" +#include "base/test/task_environment.h" +#include "chromeos/network/network_handler.h" +#include "chromeos/network/network_state.h" +#include "chromeos/network/network_state_handler.h" +#include "chromeos/network/network_state_test_helper.h" +#include "chromeos/network/test_cellular_esim_profile_handler.h" +#include "net/base/net_errors.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/cros_system_api/dbus/service_constants.h" + +namespace chromeos { + +namespace { + +const char kTestEuiccPath[] = "euicc_path"; +const char kTestIccid[] = "iccid"; +const char kTestProfileName[] = "test_profile_name"; +const char kTestEidName[] = "eid"; +const char kTestEthName[] = "test_eth_name"; +const char kTestNameFromShill[] = "shill_network_name"; + +const char kTestESimCellularServicePath[] = "/service/cellular1"; +const char kTestEthServicePath[] = "/service/eth0"; + +} // namespace + +class NetworkNameUtilTest : public testing::Test { + public: + NetworkNameUtilTest() {} + ~NetworkNameUtilTest() override = default; + + // testing::Test: + void SetUp() override { + cellular_inhibitor_ = std::make_unique<CellularInhibitor>(); + cellular_esim_profile_handler_ = + std::make_unique<TestCellularESimProfileHandler>(); + + network_state_test_helper_.hermes_manager_test()->AddEuicc( + dbus::ObjectPath(kTestEuiccPath), kTestEidName, /*is_active=*/true, + /*physical_slot=*/0); + cellular_esim_profile_handler_->Init( + network_state_test_helper_.network_state_handler(), + cellular_inhibitor_.get()); + base::RunLoop().RunUntilIdle(); + } + + void AddESimProfile(hermes::profile::State state, + const std::string& service_path) { + network_state_test_helper_.hermes_euicc_test()->AddCarrierProfile( + dbus::ObjectPath(service_path), dbus::ObjectPath(kTestEuiccPath), + kTestIccid, kTestProfileName, "service_provider", "activation_code", + service_path, state, hermes::profile::ProfileClass::kOperational, + HermesEuiccClient::TestInterface::AddCarrierProfileBehavior:: + kAddProfileWithService); + base::RunLoop().RunUntilIdle(); + } + + void AddEthernet() { + ShillServiceClient::TestInterface* service_test = + network_state_test_helper_.service_test(); + service_test->AddService(kTestEthServicePath, "test_guid1", kTestEthName, + shill::kTypeEthernet, shill::kStateIdle, true); + base::RunLoop().RunUntilIdle(); + } + + protected: + base::test::SingleThreadTaskEnvironment task_environment_; + NetworkStateTestHelper network_state_test_helper_{ + false /* use_default_devices_and_services */}; + std::unique_ptr<CellularInhibitor> cellular_inhibitor_; + std::unique_ptr<TestCellularESimProfileHandler> + cellular_esim_profile_handler_; +}; + +TEST_F(NetworkNameUtilTest, EsimNetworkGetNetworkName) { + AddESimProfile(hermes::profile::State::kActive, kTestESimCellularServicePath); + + const chromeos::NetworkState* network = + network_state_test_helper_.network_state_handler()->GetNetworkState( + kTestESimCellularServicePath); + + std::string name = network_name_util::GetNetworkName( + cellular_esim_profile_handler_.get(), network); + + EXPECT_EQ(name, kTestProfileName); +} + +TEST_F(NetworkNameUtilTest, EthernetNetworkGetNetworkName) { + AddEthernet(); + const chromeos::NetworkState* network = + network_state_test_helper_.network_state_handler()->GetNetworkState( + kTestEthServicePath); + + std::string name = network_name_util::GetNetworkName( + cellular_esim_profile_handler_.get(), network); + + EXPECT_EQ(name, kTestEthName); +} + +TEST_F(NetworkNameUtilTest, NameComesFromHermes) { + AddESimProfile(hermes::profile::State::kActive, kTestESimCellularServicePath); + + // Change the network's name in Shill. Now, Hermes and Shill have different + // names associated with the profile. + network_state_test_helper_.SetServiceProperty( + kTestESimCellularServicePath, shill::kNameProperty, + base::Value(kTestNameFromShill)); + base::RunLoop().RunUntilIdle(); + + const chromeos::NetworkState* network = + network_state_test_helper_.network_state_handler()->GetNetworkState( + kTestESimCellularServicePath); + + std::string name = network_name_util::GetNetworkName( + cellular_esim_profile_handler_.get(), network); + + EXPECT_EQ(name, kTestProfileName); +} + +} // namespace chromeos
diff --git a/chromeos/network/stub_cellular_networks_provider.cc b/chromeos/network/stub_cellular_networks_provider.cc index f63a4b35..f4c611e 100644 --- a/chromeos/network/stub_cellular_networks_provider.cc +++ b/chromeos/network/stub_cellular_networks_provider.cc
@@ -20,14 +20,14 @@ for (const std::unique_ptr<ManagedState>& managed_state : network_list) { const NetworkState* network = managed_state->AsNetworkState(); - // Only cellular networks have ICCIDs. - if (!NetworkTypePattern::Cellular().MatchesType(network->type())) - continue; - // Skip networks that have not received any property updates yet. if (!network->update_received()) continue; + // Only cellular networks have ICCIDs. + if (!NetworkTypePattern::Cellular().MatchesType(network->type())) + continue; + std::string iccid = network->iccid(); if (iccid.empty()) { NET_LOG(ERROR) << "Cellular network missing ICCID";
diff --git a/chromeos/services/network_config/cros_network_config.cc b/chromeos/services/network_config/cros_network_config.cc index 0d975d2..7f847f3 100644 --- a/chromeos/services/network_config/cros_network_config.cc +++ b/chromeos/services/network_config/cros_network_config.cc
@@ -23,6 +23,7 @@ #include "chromeos/network/network_device_handler.h" #include "chromeos/network/network_handler.h" #include "chromeos/network/network_metadata_store.h" +#include "chromeos/network/network_name_util.h" #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h" #include "chromeos/network/network_type_pattern.h" @@ -303,48 +304,6 @@ return result; } -base::Optional<std::string> GetESimProfileName( - CellularESimProfileHandler* cellular_esim_profile_handler, - const NetworkState* network_state) { - DCHECK(network_state); - - // CellularESimProfileHandler is not available if the relevant flag is - // disabled. - if (!cellular_esim_profile_handler) - return base::nullopt; - - // Only Cellular networks correspond to eSIM profiles. - if (network_state->type() != shill::kTypeCellular) - return base::nullopt; - - // eSIM profiles have an associated EID and ICCID. - if (network_state->eid().empty() || network_state->iccid().empty()) - return base::nullopt; - - std::vector<CellularESimProfile> profiles = - cellular_esim_profile_handler->GetESimProfiles(); - for (const auto& profile : profiles) { - if (profile.eid() != network_state->eid() || - profile.iccid() != network_state->iccid()) { - continue; - } - - // We've found a profile corresponding to the network. If possible, use the - // profile's nickname, falling back to the name or the service provider. - - if (!profile.nickname().empty()) - return base::UTF16ToUTF8(profile.nickname()); - - if (!profile.name().empty()) - return base::UTF16ToUTF8(profile.name()); - - if (!profile.service_provider().empty()) - return base::UTF16ToUTF8(profile.service_provider()); - } - - return base::nullopt; -} - mojom::NetworkStatePropertiesPtr NetworkStateToMojo( NetworkStateHandler* network_state_handler, CellularESimProfileHandler* cellular_esim_profile_handler, @@ -368,7 +327,8 @@ if (!network->GetError().empty()) result->error_state = network->GetError(); result->guid = network->guid(); - result->name = network->name(); + result->name = + network_name_util::GetNetworkName(cellular_esim_profile_handler, network); result->portal_state = GetMojoPortalState(network->portal_state()); result->priority = network->priority(); result->prohibited_by_policy = network->blocked_by_policy(); @@ -382,11 +342,6 @@ switch (type) { case mojom::NetworkType::kCellular: { - base::Optional<std::string> profile_name = - GetESimProfileName(cellular_esim_profile_handler, network); - if (profile_name) - result->name = *profile_name; - auto cellular = mojom::CellularStateProperties::New(); cellular->iccid = network->iccid(); cellular->eid = network->eid(); @@ -1354,7 +1309,8 @@ result->name = GetManagedString(properties, ::onc::network_config::kName); if (result->name->policy_source == mojom::PolicySource::kNone) { base::Optional<std::string> profile_name = - GetESimProfileName(cellular_esim_profile_handler, network_state); + network_name_util::GetESimProfileName(cellular_esim_profile_handler, + network_state); if (profile_name) result->name->active_value = *profile_name; }
diff --git a/components/BUILD.gn b/components/BUILD.gn index 7785818..1b04c26 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn
@@ -226,6 +226,7 @@ deps += [ "//components/autofill/ios/browser:unit_tests", "//components/autofill/ios/form_util:unit_tests", + "//components/breadcrumbs/ios:unit_tests", "//components/feed/core/v2:feed_core_base_unit_tests", "//components/image_fetcher/ios:unit_tests", "//components/language/ios/browser:unit_tests",
diff --git a/components/autofill/core/browser/autofill_metrics_unittest.cc b/components/autofill/core/browser/autofill_metrics_unittest.cc index 30eb8d1..4d8060ae 100644 --- a/components/autofill/core/browser/autofill_metrics_unittest.cc +++ b/components/autofill/core/browser/autofill_metrics_unittest.cc
@@ -6724,6 +6724,206 @@ EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix( "Autofill.Offer")["Autofill.Offer.SubmittedCardHasOffer"]); } + + // Recreate cards and add card that is linked to an offer. + RecreateCreditCards(true /* include_local_credit_card */, + true /* include_masked_server_credit_card */, + true /* include_full_server_credit_card */); + guid = "12340000-0000-0000-0000-000000000003"; + AddMaskedServerCreditCardWithOffer(guid, "$5", autofill_client_.form_origin(), + /*id=*/0x5fff); + + // Reset the autofill manager state. + browser_autofill_manager_->Reset(); + browser_autofill_manager_->AddSeenForm(form, field_types, field_types); + + { + // A masked server card with linked offers. + // Simulating activating the autofill popup for the credit card field, new + // popup being shown, selecting a masked card server suggestion, showing the + // suggestions again, and then submitting the form with previously filled + // card. Verify that all related form events are correctly logged to offer + // sub-histogram. Making suggestions reappear tests confirmation of a fix + // for crbug/1198751. + base::HistogramTester histogram_tester; + browser_autofill_manager_->OnQueryFormFieldAutofill( + 0, form, field, gfx::RectF(), /*autoselect_first_suggestion=*/false); + browser_autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, + field); + // Select the masked server card with the linked offer. + browser_autofill_manager_->FillOrPreviewForm( + AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.back(), + browser_autofill_manager_->MakeFrontendIDForTest(guid, std::string())); + OnDidGetRealPan(AutofillClient::SUCCESS, "6011000990139424"); + + // Simulate user showing suggestions but then submitting form with + // previously filled card info. + browser_autofill_manager_->OnQueryFormFieldAutofill( + 0, form, field, gfx::RectF(), /*autoselect_first_suggestion=*/false); + browser_autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, + field); + browser_autofill_manager_->OnFormSubmitted( + form, false, SubmissionSource::FORM_SUBMISSION); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_SUGGESTIONS_SHOWN, 2); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SELECTED, 1); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SELECTED_ONCE, 1); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_FILLED, 1); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_FILLED_ONCE, 1); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE, 1); + + // Ensure we count the correct number of offers shown. + histogram_tester.ExpectUniqueSample( + "Autofill.Offer.SuggestedCardsHaveOffer", + /*suggestions with offers=*/1, 1); + + // Should track card was selected and form was submitted with that card. + histogram_tester.ExpectBucketCount("Autofill.Offer.SelectedCardHasOffer", + /*selected=*/true, 1); + histogram_tester.ExpectUniqueSample("Autofill.Offer.SubmittedCardHasOffer", + /*submitted=*/true, 1); + } + + // Reset the autofill manager state. + browser_autofill_manager_->Reset(); + browser_autofill_manager_->AddSeenForm(form, field_types, field_types); + + { + // A masked server card with linked offers. + // Simulating activating the autofill popup for the credit card field, new + // popup being shown, selecting a masked card server suggestion, but then + // failing the CVC check and submitting the form anyways. Verify that all + // related form events are correctly logged to offer sub-histogram. + base::HistogramTester histogram_tester; + browser_autofill_manager_->OnQueryFormFieldAutofill( + 0, form, field, gfx::RectF(), /*autoselect_first_suggestion=*/false); + browser_autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, + field); + // Select the masked server card with the linked offer, but fail the CVC + // check. + browser_autofill_manager_->FillOrPreviewForm( + AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.back(), + browser_autofill_manager_->MakeFrontendIDForTest(guid, std::string())); + OnDidGetRealPan(AutofillClient::PERMANENT_FAILURE, std::string()); + + // Submitting the form without the filled suggestion. + browser_autofill_manager_->OnFormSubmitted( + form, false, SubmissionSource::FORM_SUBMISSION); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_SUGGESTIONS_SHOWN, 1); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SELECTED, 1); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SELECTED_ONCE, 1); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_FILLED, 0); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_FILLED_ONCE, 0); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE, 0); + + // Ensure we count the correct number of offers shown. + histogram_tester.ExpectUniqueSample( + "Autofill.Offer.SuggestedCardsHaveOffer", + /*suggestions with offers=*/1, 1); + + // Should track card was selected once, but not submitted. + histogram_tester.ExpectUniqueSample("Autofill.Offer.SelectedCardHasOffer", + /*selected=*/true, 1); + histogram_tester.ExpectBucketCount("Autofill.Offer.SubmittedCardHasOffer", + /*submitted=*/true, 0); + } + + // Reset the autofill manager state. + browser_autofill_manager_->Reset(); + browser_autofill_manager_->AddSeenForm(form, field_types, field_types); + + { + // A masked server card with linked offers. + // Simulating activating the autofill popup for the credit card field, new + // popup being shown, selecting a masked card server suggestion, but then + // selecting a local card instead. Verify that all related form events are + // correctly logged to offer sub-histogram. + base::HistogramTester histogram_tester; + + // Show suggestions and select the card with offer. + browser_autofill_manager_->OnQueryFormFieldAutofill( + 0, form, field, gfx::RectF(), /*autoselect_first_suggestion=*/false); + browser_autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, + field); + browser_autofill_manager_->FillOrPreviewForm( + AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.back(), + browser_autofill_manager_->MakeFrontendIDForTest(guid, std::string())); + OnDidGetRealPan(AutofillClient::SUCCESS, "6011000990139424"); + + // Show suggestions again, and select a local card instead. + browser_autofill_manager_->OnQueryFormFieldAutofill( + 0, form, field, gfx::RectF(), /*autoselect_first_suggestion=*/false); + browser_autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, + field); + guid = "10000000-0000-0000-0000-000000000001"; + browser_autofill_manager_->FillOrPreviewForm( + AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, form.fields.back(), + browser_autofill_manager_->MakeFrontendIDForTest(guid, std::string())); + browser_autofill_manager_->OnFormSubmitted( + form, false, SubmissionSource::FORM_SUBMISSION); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_SUGGESTIONS_SHOWN, 2); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SELECTED, 1); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SELECTED_ONCE, 1); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_FILLED, 1); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_FILLED_ONCE, 1); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOffer", + FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE, 1); + + // Ensure we count the correct number of offers shown. + histogram_tester.ExpectBucketCount("Autofill.Offer.SuggestedCardsHaveOffer", + /*suggestions with offers=*/1, 1); + + // Should track card was only selected once. + histogram_tester.ExpectBucketCount("Autofill.Offer.SelectedCardHasOffer", + /*selected=*/true, 1); + histogram_tester.ExpectBucketCount("Autofill.Offer.SelectedCardHasOffer", + /*selected=*/false, 1); + histogram_tester.ExpectUniqueSample("Autofill.Offer.SubmittedCardHasOffer", + /*submitted=*/false, 1); + } } // Test that we log parsed form events for address and cards in the same form.
diff --git a/components/autofill/core/browser/metrics/credit_card_form_event_logger.cc b/components/autofill/core/browser/metrics/credit_card_form_event_logger.cc index 8783f97a..0209935b 100644 --- a/components/autofill/core/browser/metrics/credit_card_form_event_logger.cc +++ b/components/autofill/core/browser/metrics/credit_card_form_event_logger.cc
@@ -32,7 +32,6 @@ void CreditCardFormEventLogger::set_suggestions( std::vector<Suggestion> suggestions) { suggestions_.clear(); - card_selected_has_offer_ = false; for (auto suggestion : suggestions) { suggestions_.emplace_back(suggestion); @@ -48,6 +47,7 @@ AutofillSyncSigninState sync_state) { sync_state_ = sync_state; + card_selected_has_offer_ = false; if (has_eligible_offer_) { card_selected_has_offer_ = DoesCardHaveOffer(credit_card); base::UmaHistogramBoolean("Autofill.Offer.SelectedCardHasOffer", @@ -160,7 +160,7 @@ Log(FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE, form); } - if (has_eligible_offer_) { + if (has_logged_suggestion_filled_ && has_eligible_offer_) { base::UmaHistogramBoolean("Autofill.Offer.SubmittedCardHasOffer", card_selected_has_offer_); }
diff --git a/components/breadcrumbs/ios/BUILD.gn b/components/breadcrumbs/ios/BUILD.gn new file mode 100644 index 0000000..28455ad --- /dev/null +++ b/components/breadcrumbs/ios/BUILD.gn
@@ -0,0 +1,33 @@ +# Copyright 2021 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +source_set("ios") { + sources = [ + "breadcrumb_manager_observer_bridge.h", + "breadcrumb_manager_observer_bridge.mm", + ] + + deps = [ + "//base", + "//components/breadcrumbs/core", + ] + + configs += [ "//build/config/compiler:enable_arc" ] +} + +source_set("unit_tests") { + testonly = true + sources = [ "breadcrumb_manager_observer_bridge_unittest.mm" ] + + deps = [ + ":ios", + "//base/test:test_support", + "//components/breadcrumbs/core", + "//ios/web/public/test", + "//testing/gtest", + "//third_party/ocmock", + ] + + configs += [ "//build/config/compiler:enable_arc" ] +}
diff --git a/components/breadcrumbs/ios/DEPS b/components/breadcrumbs/ios/DEPS new file mode 100644 index 0000000..4dd6307 --- /dev/null +++ b/components/breadcrumbs/ios/DEPS
@@ -0,0 +1,4 @@ +include_rules = [ + "+ios/web/public", + "+third_party/ocmock", +]
diff --git a/ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_observer_bridge.h b/components/breadcrumbs/ios/breadcrumb_manager_observer_bridge.h similarity index 63% rename from ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_observer_bridge.h rename to components/breadcrumbs/ios/breadcrumb_manager_observer_bridge.h index 96441d9a..2cc36d9 100644 --- a/ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_observer_bridge.h +++ b/components/breadcrumbs/ios/breadcrumb_manager_observer_bridge.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_CHROME_BROWSER_CRASH_REPORT_BREADCRUMBS_BREADCRUMB_MANAGER_OBSERVER_BRIDGE_H_ -#define IOS_CHROME_BROWSER_CRASH_REPORT_BREADCRUMBS_BREADCRUMB_MANAGER_OBSERVER_BRIDGE_H_ +#ifndef COMPONENTS_BREADCRUMBS_IOS_BREADCRUMB_MANAGER_OBSERVER_BRIDGE_H_ +#define COMPONENTS_BREADCRUMBS_IOS_BREADCRUMB_MANAGER_OBSERVER_BRIDGE_H_ #import <Foundation/Foundation.h> @@ -26,21 +26,21 @@ (breadcrumbs::BreadcrumbManager*)manager; @end +namespace breadcrumbs { + // A C++ bridge class to handle receiving notifications from the C++ class // that observes the connection type. -class BreadcrumbManagerObserverBridge - : public breadcrumbs::BreadcrumbManagerObserver { +class BreadcrumbManagerObserverBridge : public BreadcrumbManagerObserver { public: // Constructs a new bridge instance adding |observer| as an observer of // |breadcrumb_manager|. - BreadcrumbManagerObserverBridge( - breadcrumbs::BreadcrumbManager* breadcrumb_manager, - id<BreadcrumbManagerObserving> observer); + BreadcrumbManagerObserverBridge(BreadcrumbManager* breadcrumb_manager, + id<BreadcrumbManagerObserving> observer); // Constructs a new bridge instance adding |observer| as an observer of // |breadcrumb_manager_service|. BreadcrumbManagerObserverBridge( - breadcrumbs::BreadcrumbManagerKeyedService* breadcrumb_manager_service, + BreadcrumbManagerKeyedService* breadcrumb_manager_service, id<BreadcrumbManagerObserving> observer); ~BreadcrumbManagerObserverBridge() override; @@ -52,14 +52,15 @@ const BreadcrumbManagerObserverBridge&) = delete; // BreadcrumbManagerObserver implementation: - void EventAdded(breadcrumbs::BreadcrumbManager* manager, + void EventAdded(BreadcrumbManager* manager, const std::string& event) override; - void OldEventsRemoved(breadcrumbs::BreadcrumbManager* manager) override; + void OldEventsRemoved(BreadcrumbManager* manager) override; - breadcrumbs::BreadcrumbManager* breadcrumb_manager_ = nullptr; - breadcrumbs::BreadcrumbManagerKeyedService* breadcrumb_manager_service_ = - nullptr; + BreadcrumbManager* breadcrumb_manager_ = nullptr; + BreadcrumbManagerKeyedService* breadcrumb_manager_service_ = nullptr; __weak id<BreadcrumbManagerObserving> observer_ = nil; }; -#endif // IOS_CHROME_BROWSER_CRASH_REPORT_BREADCRUMBS_BREADCRUMB_MANAGER_OBSERVER_BRIDGE_H_ +} // namespace breadcrumbs + +#endif // COMPONENTS_BREADCRUMBS_IOS_BREADCRUMB_MANAGER_OBSERVER_BRIDGE_H_
diff --git a/ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_observer_bridge.mm b/components/breadcrumbs/ios/breadcrumb_manager_observer_bridge.mm similarity index 80% rename from ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_observer_bridge.mm rename to components/breadcrumbs/ios/breadcrumb_manager_observer_bridge.mm index 0145989..4c2f658 100644 --- a/ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_observer_bridge.mm +++ b/components/breadcrumbs/ios/breadcrumb_manager_observer_bridge.mm
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_observer_bridge.h" +#import "components/breadcrumbs/ios/breadcrumb_manager_observer_bridge.h" #include "base/check.h" #include "base/strings/sys_string_conversions.h" @@ -13,8 +13,10 @@ #error "This file requires ARC support." #endif +namespace breadcrumbs { + BreadcrumbManagerObserverBridge::BreadcrumbManagerObserverBridge( - breadcrumbs::BreadcrumbManager* breadcrumb_manager, + BreadcrumbManager* breadcrumb_manager, id<BreadcrumbManagerObserving> observer) : breadcrumb_manager_(breadcrumb_manager), observer_(observer) { DCHECK(observer_); @@ -22,7 +24,7 @@ } BreadcrumbManagerObserverBridge::BreadcrumbManagerObserverBridge( - breadcrumbs::BreadcrumbManagerKeyedService* breadcrumb_manager_service, + BreadcrumbManagerKeyedService* breadcrumb_manager_service, id<BreadcrumbManagerObserving> observer) : breadcrumb_manager_service_(breadcrumb_manager_service), observer_(observer) { @@ -39,9 +41,8 @@ } } -void BreadcrumbManagerObserverBridge::EventAdded( - breadcrumbs::BreadcrumbManager* manager, - const std::string& event) { +void BreadcrumbManagerObserverBridge::EventAdded(BreadcrumbManager* manager, + const std::string& event) { if ([observer_ respondsToSelector:@selector(breadcrumbManager: didAddEvent:)]) { [observer_ breadcrumbManager:manager @@ -50,9 +51,11 @@ } void BreadcrumbManagerObserverBridge::OldEventsRemoved( - breadcrumbs::BreadcrumbManager* manager) { + BreadcrumbManager* manager) { if ([observer_ respondsToSelector:@selector(breadcrumbManagerDidRemoveOldEvents:)]) { [observer_ breadcrumbManagerDidRemoveOldEvents:manager]; } } + +} // namespace breadcrumbs
diff --git a/ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_observer_bridge_unittest.mm b/components/breadcrumbs/ios/breadcrumb_manager_observer_bridge_unittest.mm similarity index 91% rename from ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_observer_bridge_unittest.mm rename to components/breadcrumbs/ios/breadcrumb_manager_observer_bridge_unittest.mm index 410fa2a..74a419c 100644 --- a/ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_observer_bridge_unittest.mm +++ b/components/breadcrumbs/ios/breadcrumb_manager_observer_bridge_unittest.mm
@@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_observer_bridge.h" +#import "components/breadcrumbs/ios/breadcrumb_manager_observer_bridge.h" + +#include <memory> #import "base/strings/sys_string_conversions.h" #include "components/breadcrumbs/core/breadcrumb_manager.h" -#include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #import "ios/web/public/test/web_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" @@ -18,6 +19,8 @@ #error "This file requires ARC support." #endif +namespace breadcrumbs { + // Test fixture to test BreadcrumbManagerObserverBridge class. class BreadcrumbManagerObserverBridgeTest : public PlatformTest { protected: @@ -30,7 +33,7 @@ web::WebTaskEnvironment task_env_{ web::WebTaskEnvironment::Options::DEFAULT, base::test::TaskEnvironment::TimeSource::MOCK_TIME}; - breadcrumbs::BreadcrumbManager breadcrumb_manager_; + BreadcrumbManager breadcrumb_manager_; id mock_observer_; std::unique_ptr<BreadcrumbManagerObserverBridge> observer_bridge_; }; @@ -70,3 +73,5 @@ [mock_observer_ verify]; } + +} // namespace breadcrumbs
diff --git a/components/exo/client_controlled_shell_surface_unittest.cc b/components/exo/client_controlled_shell_surface_unittest.cc index 20d4d7cd..bb04755 100644 --- a/components/exo/client_controlled_shell_surface_unittest.cc +++ b/components/exo/client_controlled_shell_surface_unittest.cc
@@ -52,6 +52,7 @@ #include "ui/aura/window_event_dispatcher.h" #include "ui/aura/window_targeter.h" #include "ui/aura/window_tree_host.h" +#include "ui/compositor/layer.h" #include "ui/compositor/scoped_animation_duration_scale_mode.h" #include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/compositor_extra/shadow.h"
diff --git a/components/exo/drag_drop_operation.cc b/components/exo/drag_drop_operation.cc index c89c3aa..f2b830c5 100644 --- a/components/exo/drag_drop_operation.cc +++ b/components/exo/drag_drop_operation.cc
@@ -23,6 +23,7 @@ #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/dragdrop/mojom/drag_drop_types.mojom.h" #include "ui/base/dragdrop/os_exchange_data.h" +#include "ui/compositor/layer.h" #include "ui/display/display.h" #include "ui/display/screen.h" #include "ui/gfx/geometry/point.h"
diff --git a/components/exo/notification_surface.cc b/components/exo/notification_surface.cc index a6f496e..da83810 100644 --- a/components/exo/notification_surface.cc +++ b/components/exo/notification_surface.cc
@@ -10,6 +10,7 @@ #include "components/viz/host/host_frame_sink_manager.h" #include "ui/aura/env.h" #include "ui/aura/window.h" +#include "ui/compositor/layer.h" #include "ui/gfx/geometry/rect.h" namespace exo {
diff --git a/components/exo/pointer.cc b/components/exo/pointer.cc index 7c9b923..366b46c3 100644 --- a/components/exo/pointer.cc +++ b/components/exo/pointer.cc
@@ -33,6 +33,7 @@ #include "ui/base/cursor/mojom/cursor_type.mojom-shared.h" #include "ui/base/layout.h" #include "ui/base/resource/scale_factor.h" +#include "ui/compositor/layer.h" #include "ui/display/manager/display_manager.h" #include "ui/display/screen.h" #include "ui/events/event.h"
diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc index 5923cd6..d4c9cbb 100644 --- a/components/exo/shell_surface.cc +++ b/components/exo/shell_surface.cc
@@ -23,6 +23,7 @@ #include "ui/aura/window_event_dispatcher.h" #include "ui/aura/window_tree_host.h" #include "ui/base/ui_base_types.h" +#include "ui/compositor/layer.h" #include "ui/views/widget/widget.h" #include "ui/wm/core/coordinate_conversion.h" #include "ui/wm/core/transient_window_manager.h"
diff --git a/components/exo/shell_surface_base.cc b/components/exo/shell_surface_base.cc index 6c456ab2..880e81ea 100644 --- a/components/exo/shell_surface_base.cc +++ b/components/exo/shell_surface_base.cc
@@ -49,6 +49,7 @@ #include "ui/base/class_property.h" #include "ui/base/ui_base_features.h" #include "ui/compositor/compositor.h" +#include "ui/compositor/layer.h" #include "ui/compositor_extra/shadow.h" #include "ui/display/display.h" #include "ui/display/screen.h"
diff --git a/components/exo/surface.h b/components/exo/surface.h index c05a272..d64d33a 100644 --- a/components/exo/surface.h +++ b/components/exo/surface.h
@@ -41,6 +41,7 @@ namespace gfx { class ColorSpace; class GpuFence; +struct PresentationFeedback; } namespace viz {
diff --git a/components/exo/surface_tree_host.cc b/components/exo/surface_tree_host.cc index 7a79c9c..201b57c 100644 --- a/components/exo/surface_tree_host.cc +++ b/components/exo/surface_tree_host.cc
@@ -31,6 +31,7 @@ #include "ui/aura/window_targeter.h" #include "ui/aura/window_tree_host.h" #include "ui/base/cursor/cursor.h" +#include "ui/compositor/layer.h" #include "ui/display/display.h" #include "ui/display/screen.h" #include "ui/gfx/geometry/dip_util.h"
diff --git a/components/exo/surface_unittest.cc b/components/exo/surface_unittest.cc index 5d89e0cf..c6b7cde 100644 --- a/components/exo/surface_unittest.cc +++ b/components/exo/surface_unittest.cc
@@ -20,6 +20,7 @@ #include "components/viz/test/fake_external_begin_frame_source.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/khronos/GLES2/gl2.h" +#include "ui/compositor/layer.h" #include "ui/compositor/layer_tree_owner.h" #include "ui/display/display.h" #include "ui/display/display_switches.h"
diff --git a/components/exo/touch.cc b/components/exo/touch.cc index e5174f4..421ea4ca 100644 --- a/components/exo/touch.cc +++ b/components/exo/touch.cc
@@ -12,6 +12,7 @@ #include "components/exo/touch_stylus_delegate.h" #include "components/exo/wm_helper.h" #include "ui/aura/window.h" +#include "ui/compositor/layer.h" #include "ui/events/event.h" #include "ui/wm/core/capture_controller.h" #include "ui/wm/core/window_util.h"
diff --git a/components/exo/wayland/zaura_shell.cc b/components/exo/wayland/zaura_shell.cc index c344a2f..6311c51 100644 --- a/components/exo/wayland/zaura_shell.cc +++ b/components/exo/wayland/zaura_shell.cc
@@ -24,6 +24,7 @@ #include "components/exo/wm_helper.h" #include "ui/aura/env.h" #include "ui/aura/window_occlusion_tracker.h" +#include "ui/compositor/layer.h" #include "ui/display/display_observer.h" #include "ui/display/manager/display_manager.h" #include "ui/display/manager/display_util.h"
diff --git a/components/exo/wayland/zaura_shell_unittest.cc b/components/exo/wayland/zaura_shell_unittest.cc index 30330f26..c2df8ad 100644 --- a/components/exo/wayland/zaura_shell_unittest.cc +++ b/components/exo/wayland/zaura_shell_unittest.cc
@@ -18,6 +18,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/aura/window_occlusion_tracker.h" +#include "ui/compositor/layer.h" #include "ui/compositor/layer_animation_observer.h" #include "ui/compositor/layer_animation_sequence.h" #include "ui/compositor/layer_animator.h"
diff --git a/components/exo/wm_helper_chromeos.cc b/components/exo/wm_helper_chromeos.cc index 3405302..05db305 100644 --- a/components/exo/wm_helper_chromeos.cc +++ b/components/exo/wm_helper_chromeos.cc
@@ -3,7 +3,6 @@ // found in the LICENSE file. #include "components/exo/wm_helper_chromeos.h" -#include "components/exo/wm_helper.h" #include "ash/frame_throttler/frame_throttling_controller.h" #include "ash/public/cpp/shell_window_ids.h" @@ -11,11 +10,13 @@ #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/callback_helpers.h" #include "base/memory/singleton.h" +#include "components/exo/wm_helper.h" #include "ui/aura/client/drag_drop_delegate.h" #include "ui/aura/client/focus_client.h" #include "ui/base/data_transfer_policy/data_transfer_endpoint.h" #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/dragdrop/mojom/drag_drop_types.mojom.h" +#include "ui/compositor/layer.h" #include "ui/display/manager/display_configurator.h" #include "ui/display/manager/display_manager.h" #include "ui/display/types/display_snapshot.h"
diff --git a/components/federated_learning/features/features.cc b/components/federated_learning/features/features.cc index 4ad98f32..c618ad7 100644 --- a/components/federated_learning/features/features.cc +++ b/components/federated_learning/features/features.cc
@@ -14,6 +14,15 @@ const base::Feature kFlocIdComputedEventLogging{ "FlocIdComputedEventLogging", base::FEATURE_ENABLED_BY_DEFAULT}; +// If enabled, pages that had ad resources will be included in floc computation; +// otherwise, only pages that used the document.interestCohort API will be +// included. This flag affects a bit to be stored at page viewing time, so it +// may take a full computation cycle for the floc to meet the configured +// criteria. +const base::Feature kFlocPagesWithAdResourcesDefaultIncludedInFlocComputation{ + "kFlocPagesWithAdResourcesDefaultIncludedInFlocComputation", + base::FEATURE_DISABLED_BY_DEFAULT}; + // The main floc feature for all the subsidiary control and setting params. It's // controlling the floc update rate, and the minimum history domain size // required.
diff --git a/components/federated_learning/features/features.h b/components/federated_learning/features/features.h index b26477e2..39f0eb0 100644 --- a/components/federated_learning/features/features.h +++ b/components/federated_learning/features/features.h
@@ -11,6 +11,8 @@ namespace federated_learning { extern const base::Feature kFlocIdComputedEventLogging; +extern const base::Feature + kFlocPagesWithAdResourcesDefaultIncludedInFlocComputation; extern const base::Feature kFederatedLearningOfCohorts; extern const base::FeatureParam<base::TimeDelta> kFlocIdScheduledUpdateInterval;
diff --git a/components/history/core/browser/cluster_visit_database.cc b/components/history/core/browser/cluster_visit_database.cc index af7bbcc..cd1ae8a 100644 --- a/components/history/core/browser/cluster_visit_database.cc +++ b/components/history/core/browser/cluster_visit_database.cc
@@ -4,7 +4,7 @@ #include "components/history/core/browser/cluster_visit_database.h" -#include "sql/database.h" +#include "base/logging.h" #include "sql/statement.h" #include "sql/statement_id.h"
diff --git a/components/history/core/browser/history_backend.cc b/components/history/core/browser/history_backend.cc index 76529543..af64c7b9 100644 --- a/components/history/core/browser/history_backend.cc +++ b/components/history/core/browser/history_backend.cc
@@ -31,7 +31,6 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" -#include "base/timer/elapsed_timer.h" #include "base/trace_event/trace_event.h" #include "build/build_config.h" #include "components/favicon/core/favicon_backend.h" @@ -54,7 +53,6 @@ #include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "sql/error_delegate_util.h" #include "third_party/skia/include/core/SkBitmap.h" -#include "ui/gfx/codec/png_codec.h" #include "url/gurl.h" #include "url/url_constants.h" @@ -1103,9 +1101,9 @@ } URLRows changed_urls; - for (size_t i = 0; i < redirects->size(); i++) { + for (const auto& redirect : *redirects) { URLRow row; - URLID row_id = db_->GetRowForURL(redirects->at(i), &row); + URLID row_id = db_->GetRowForURL(redirect, &row); if (row_id && row.title() != title) { row.set_title(title); db_->UpdateURLRow(row_id, row); @@ -1205,10 +1203,10 @@ const std::vector<VisitInfo>& visits, VisitSource visit_source) { if (db_) { - for (auto visit = visits.begin(); visit != visits.end(); ++visit) { - if (!AddPageVisit(url, visit->first, 0, visit->second, - !ui::PageTransitionIsMainFrame(visit->second), - visit_source, IsTypedIncrement(visit->second), + for (const auto& visit : visits) { + if (!AddPageVisit(url, visit.first, 0, visit.second, + !ui::PageTransitionIsMainFrame(visit.second), + visit_source, IsTypedIncrement(visit.second), /*floc_allowed=*/false) .first) { return false; @@ -1517,9 +1515,8 @@ size_t downloads_count_before = db_->CountDownloads(); // HistoryBackend uses a long-running Transaction that is committed // periodically, so this loop doesn't actually hit the disk too hard. - for (auto it = ids.begin(); it != ids.end(); ++it) { - db_->RemoveDownload(*it); - } + for (uint32_t id : ids) + db_->RemoveDownload(id); ScheduleCommit(); size_t downloads_count_after = db_->CountDownloads(); @@ -1559,9 +1556,7 @@ // Now add them and the URL rows to the results. std::vector<URLResult> matching_results; URLResult url_result; - for (size_t i = 0; i < visits.size(); i++) { - const VisitRow visit = visits[i]; - + for (const auto& visit : visits) { // Add a result row for this visit, get the URL info from the DB. if (!db_->GetURLRow(visit.url_id, &url_result)) { DVLOG(0) << "Failed to get id " << visit.url_id << " from history.urls."; @@ -1605,17 +1600,15 @@ std::vector<URLResult> matching_visits; VisitVector visits; // Declare outside loop to prevent re-construction. - for (size_t i = 0; i < text_matches.size(); i++) { - const URLRow& text_match = text_matches[i]; + for (const auto& text_match : text_matches) { // Get all visits for given URL match. db_->GetVisibleVisitsForURL(text_match.id(), options, &visits); - for (size_t j = 0; j < visits.size(); j++) { + for (const auto& visit : visits) { URLResult url_result(text_match); - url_result.set_visit_time(visits[j].visit_time); + url_result.set_visit_time(visit.visit_time); VisitContentAnnotations content_annotations; - db_->GetContentAnnotationsForVisit(visits[j].visit_id, - &content_annotations); + db_->GetContentAnnotationsForVisit(visit.visit_id, &content_annotations); url_result.set_content_annotations(content_annotations); matching_visits.push_back(url_result); @@ -1934,47 +1927,46 @@ std::set<GURL> favicons_changed; favicon::FaviconDatabase* favicon_db = favicon_backend_->db(); - for (size_t i = 0; i < favicon_usage.size(); i++) { + for (const auto& favicon_usage_data : favicon_usage) { favicon_base::FaviconID favicon_id = favicon_db->GetFaviconIDForFaviconURL( - favicon_usage[i].favicon_url, favicon_base::IconType::kFavicon); + favicon_usage_data.favicon_url, favicon_base::IconType::kFavicon); if (!favicon_id) { // This favicon doesn't exist yet, so we create it using the given data. // TODO(pkotwicz): Pass in real pixel size. favicon_id = favicon_db->AddFavicon( - favicon_usage[i].favicon_url, favicon_base::IconType::kFavicon, - new base::RefCountedBytes(favicon_usage[i].png_data), + favicon_usage_data.favicon_url, favicon_base::IconType::kFavicon, + new base::RefCountedBytes(favicon_usage_data.png_data), FaviconBitmapType::ON_VISIT, now, gfx::Size()); } // Save the mapping from all the URLs to the favicon. - for (auto url = favicon_usage[i].urls.begin(); - url != favicon_usage[i].urls.end(); ++url) { + for (const auto& url : favicon_usage_data.urls) { URLRow url_row; - if (!db_->GetRowForURL(*url, &url_row)) { + if (!db_->GetRowForURL(url, &url_row)) { // If the URL is present as a bookmark, add the url in history to // save the favicon mapping. This will match with what history db does // for regular bookmarked URLs with favicons - when history db is // cleaned, we keep an entry in the db with 0 visits as long as that // url is bookmarked. The same is applicable to the saved credential's // URLs. - if (backend_client_ && backend_client_->IsPinnedURL(*url)) { - URLRow url_info(*url); + if (backend_client_ && backend_client_->IsPinnedURL(url)) { + URLRow url_info(url); url_info.set_visit_count(0); url_info.set_typed_count(0); url_info.set_last_visit(base::Time()); url_info.set_hidden(false); db_->AddURL(url_info); - favicon_db->AddIconMapping(*url, favicon_id); - favicons_changed.insert(*url); + favicon_db->AddIconMapping(url, favicon_id); + favicons_changed.insert(url); } } else { if (!favicon_db->GetIconMappingsForPageURL( - *url, {favicon_base::IconType::kFavicon}, + url, {favicon_base::IconType::kFavicon}, /*mapping_data=*/nullptr)) { // URL is present in history, update the favicon *only* if it is not // set already. - favicon_db->AddIconMapping(*url, favicon_id); - favicons_changed.insert(*url); + favicon_db->AddIconMapping(url, favicon_id); + favicons_changed.insert(url); } } } @@ -2174,18 +2166,18 @@ // 1st pass: find URLs that are visited at one of |times|. std::set<GURL> urls; - for (size_t i = 0; i < results.size(); ++i) { - if (times.count(results[i].visit_time()) > 0) - urls.insert(results[i].url()); + for (const auto& result : results) { + if (times.count(result.visit_time()) > 0) + urls.insert(result.url()); } if (urls.empty()) return; // 2nd pass: collect all visit times of those URLs. std::vector<base::Time> times_to_expire; - for (size_t i = 0; i < results.size(); ++i) { - if (urls.count(results[i].url())) - times_to_expire.push_back(results[i].visit_time()); + for (const auto& result : results) { + if (urls.count(result.url())) + times_to_expire.push_back(result.visit_time()); } // Put the times in reverse chronological order and remove @@ -2212,11 +2204,11 @@ if (db_) { bool update_first_recorded_time = false; - for (auto it = expire_list.begin(); it != expire_list.end(); ++it) { - expirer_.ExpireHistoryBetween(it->urls, it->begin_time, it->end_time, - true); + for (const auto& expire : expire_list) { + expirer_.ExpireHistoryBetween(expire.urls, expire.begin_time, + expire.end_time, true); - if (it->begin_time < first_recorded_time_) + if (expire.begin_time < first_recorded_time_) update_first_recorded_time = true; } Commit(); @@ -2240,16 +2232,16 @@ if (!db_) return; - for (auto i = urls.begin(); i != urls.end(); ++i) { + for (const auto& url : urls) { VisitVector visits; URLRow url_row; - if (db_->GetRowForURL(*i, &url_row)) + if (db_->GetRowForURL(url, &url_row)) db_->GetVisitsForURL(url_row.id(), &visits); // We need to call DeleteURL() even if the DB didn't contain this URL, so // that we can delete all associated icons in the case of deleting an // unvisited bookmarked URL. if (visits.empty()) - expirer_.DeleteURL(*i, base::Time::Max()); + expirer_.DeleteURL(url, base::Time::Max()); } } @@ -2452,9 +2444,8 @@ return false; // Insert the URLs into the temporary table. - for (auto i = kept_urls.begin(); i != kept_urls.end(); ++i) { - db_->AddTemporaryURL(*i); - } + for (const auto& url : kept_urls) + db_->AddTemporaryURL(url); // Replace the original URL table with the temporary one. if (!db_->CommitTemporaryURLTable())
diff --git a/components/history/core/browser/history_backend.h b/components/history/core/browser/history_backend.h index 71ed33a..61723a7 100644 --- a/components/history/core/browser/history_backend.h +++ b/components/history/core/browser/history_backend.h
@@ -120,7 +120,7 @@ // a history service object. class Delegate { public: - virtual ~Delegate() {} + virtual ~Delegate() = default; // Called when the database cannot be read correctly for some reason. // |diagnostics| contains information about the underlying database
diff --git a/components/history/core/browser/history_database.cc b/components/history/core/browser/history_database.cc index bad0dab..f45d66a 100644 --- a/components/history/core/browser/history_database.cc +++ b/components/history/core/browser/history_database.cc
@@ -12,7 +12,6 @@ #include <utility> #include <vector> -#include "base/command_line.h" #include "base/files/file_util.h" #include "base/logging.h" #include "base/metrics/histogram_functions.h" @@ -22,7 +21,6 @@ #include "base/strings/string_util.h" #include "base/time/time.h" #include "build/build_config.h" -#include "components/history/core/browser/url_utils.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "sql/meta_table.h" #include "sql/statement.h"
diff --git a/components/history/core/browser/history_database.h b/components/history/core/browser/history_database.h index 056bcb16..b83f8370 100644 --- a/components/history/core/browser/history_database.h +++ b/components/history/core/browser/history_database.h
@@ -5,8 +5,6 @@ #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_DATABASE_H_ #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_DATABASE_H_ -#include <stddef.h> - #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" #include "base/macros.h"
diff --git a/components/history/core/browser/history_service.cc b/components/history/core/browser/history_service.cc index ddc5728..bc8543b 100644 --- a/components/history/core/browser/history_service.cc +++ b/components/history/core/browser/history_service.cc
@@ -23,7 +23,6 @@ #include "base/callback_helpers.h" #include "base/command_line.h" #include "base/compiler_specific.h" -#include "base/feature_list.h" #include "base/location.h" #include "base/logging.h" #include "base/memory/ref_counted.h"
diff --git a/components/history/core/browser/history_service.h b/components/history/core/browser/history_service.h index 0093b0d..65ea15cc 100644 --- a/components/history/core/browser/history_service.h +++ b/components/history/core/browser/history_service.h
@@ -5,7 +5,6 @@ #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ -#include <stddef.h> #include <stdint.h> #include <memory>
diff --git a/components/history/core/browser/url_database.cc b/components/history/core/browser/url_database.cc index dbd924735..432d208 100644 --- a/components/history/core/browser/url_database.cc +++ b/components/history/core/browser/url_database.cc
@@ -9,8 +9,6 @@ #include <vector> #include "base/i18n/case_conversion.h" -#include "base/logging.h" -#include "base/stl_util.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" @@ -29,11 +27,9 @@ : initialized_(false) { } -URLDatabase::URLEnumeratorBase::~URLEnumeratorBase() { -} +URLDatabase::URLEnumeratorBase::~URLEnumeratorBase() = default; -URLDatabase::URLEnumerator::URLEnumerator() { -} +URLDatabase::URLEnumerator::URLEnumerator() = default; bool URLDatabase::URLEnumerator::GetNextURL(URLRow* r) { if (statement_.Step()) { @@ -47,8 +43,7 @@ : has_keyword_search_terms_(false) { } -URLDatabase::~URLDatabase() { -} +URLDatabase::~URLDatabase() = default; // Convenience to fill a URLRow. Must be in sync with the fields in // kURLRowFields. @@ -363,13 +358,13 @@ url::kFtpScheme }; URLRows dummy; - for (size_t i = 0; i < base::size(schemes); ++i) { - std::string scheme_and_host(schemes[i]); + for (const char* known_scheme : schemes) { + std::string scheme_and_host(known_scheme); scheme_and_host += url::kStandardSchemeSeparator + host; if (AutocompleteForPrefix(scheme_and_host + '/', 1, true, &dummy) || AutocompleteForPrefix(scheme_and_host + ':', 1, true, &dummy)) { if (scheme != nullptr) - *scheme = schemes[i]; + *scheme = known_scheme; return true; } }
diff --git a/components/history/core/browser/visit_database.cc b/components/history/core/browser/visit_database.cc index 1be502c..6cf62226 100644 --- a/components/history/core/browser/visit_database.cc +++ b/components/history/core/browser/visit_database.cc
@@ -73,9 +73,9 @@ } // namespace -VisitDatabase::VisitDatabase() {} +VisitDatabase::VisitDatabase() = default; -VisitDatabase::~VisitDatabase() {} +VisitDatabase::~VisitDatabase() = default; bool VisitDatabase::InitVisitTable() { if (!GetDB().DoesTableExist("visits")) { @@ -345,12 +345,12 @@ VisitVector* visits) { visits->clear(); - for (auto it = times.begin(); it != times.end(); ++it) { + for (const auto& time : times) { sql::Statement statement(GetDB().GetCachedStatement( SQL_FROM_HERE, "SELECT" HISTORY_VISIT_ROW_FIELDS "FROM visits " "WHERE visit_time == ?")); - statement.BindInt64(0, it->ToInternalValue()); + statement.BindInt64(0, time.ToInternalValue()); if (!FillVisitVector(statement, visits)) return false;
diff --git a/components/history_clusters/core/memories_features.cc b/components/history_clusters/core/memories_features.cc index 3f6fdb5..32b12a4 100644 --- a/components/history_clusters/core/memories_features.cc +++ b/components/history_clusters/core/memories_features.cc
@@ -13,6 +13,11 @@ kRemoteModelForDebugging, "MemoriesRemoteModelEndpoint")); } +std::string ExperimentNameForRemoteModelEndpoint() { + return base::GetFieldTrialParamValueByFeature( + kRemoteModelForDebugging, "MemoriesRemoteModelEndpointExperimentName"); +} + bool StoreVisitsInHistoryDb() { return base::GetFieldTrialParamByFeatureAsBool( kMemories, "MemoriesStoreVisitsInHistoryDb", false);
diff --git a/components/history_clusters/core/memories_features.h b/components/history_clusters/core/memories_features.h index 76c04031..b4ee73a 100644 --- a/components/history_clusters/core/memories_features.h +++ b/components/history_clusters/core/memories_features.h
@@ -14,6 +14,12 @@ // Returns an empty GURL() when the remote model debug endpoint is disabled. GURL RemoteModelEndpointForDebugging(); +// Returns the experiment name to pass through to the remote model debug +// endpoint to control how the visits get clustered. Returns an empty string if +// this client should just use be returned the default clustering or if the +// remote model debug endpoint is disabled. +std::string ExperimentNameForRemoteModelEndpoint(); + // If enabled, completed visits are persisted to the history DB and read back // when clustering. If disabled, completed visits are kept in-memory and used // these in-memory visits are used when clustering.
diff --git a/components/history_clusters/core/memories_remote_model_helper.cc b/components/history_clusters/core/memories_remote_model_helper.cc index cc72448a..2e4f206d41 100644 --- a/components/history_clusters/core/memories_remote_model_helper.cc +++ b/components/history_clusters/core/memories_remote_model_helper.cc
@@ -35,6 +35,7 @@ proto::GetClustersRequest CreateRequestProto( const std::vector<history::ClusterVisit>& visits) { proto::GetClustersRequest request; + request.set_experiment_name(ExperimentNameForRemoteModelEndpoint()); for (auto& visit : visits) { proto::Visit* request_visit = request.add_visits(); request_visit->set_visit_id(visit.visit_row.visit_id);
diff --git a/components/history_clusters/core/memories_service_unittest.cc b/components/history_clusters/core/memories_service_unittest.cc index 9be2612..807b003 100644 --- a/components/history_clusters/core/memories_service_unittest.cc +++ b/components/history_clusters/core/memories_service_unittest.cc
@@ -65,7 +65,8 @@ MemoriesServiceTest& operator=(const MemoriesServiceTest&) = delete; void EnableMemoriesWithEndpoint( - const std::string& endpoint_url = kFakeEndpoint) { + const std::string& endpoint_url = kFakeEndpoint, + const std::string& endpoint_experiment = "") { scoped_feature_list_ = std::make_unique<base::test::ScopedFeatureList>(); scoped_feature_list_->InitWithFeaturesAndParameters( { @@ -75,7 +76,11 @@ }, { kRemoteModelForDebugging, - {{"MemoriesRemoteModelEndpoint", endpoint_url}}, + { + {"MemoriesRemoteModelEndpoint", endpoint_url}, + {"MemoriesRemoteModelEndpointExperimentName", + endpoint_experiment}, + }, }, }, {}); @@ -132,9 +137,11 @@ // Verifies that that a particular hardcoded request is in a pending request // within the URL loader. - void VerifyHardcodedTestDataInUrlLoaderRequest() { + void VerifyHardcodedTestDataInUrlLoaderRequest( + const std::string& expected_experiment_name = "") { EXPECT_TRUE(test_url_loader_factory_.IsPending(kFakeEndpoint)); proto::GetClustersRequest request; + request.set_experiment_name(expected_experiment_name); auto* visit = request.add_visits(); visit->set_visit_id(2); visit->set_navigation_time_ms(2); @@ -200,7 +207,8 @@ constexpr char MemoriesServiceTest::kFakeEndpoint[]; TEST_F(MemoriesServiceTest, QueryMemoriesEmptyQuery) { - EnableMemoriesWithEndpoint(kFakeEndpoint); + std::string experiment_name = "someexperiment"; + EnableMemoriesWithEndpoint(kFakeEndpoint, experiment_name); AddVisit(0, GURL{"https://google.com"}, u"Google title", 2, IntToTime(2), 3); AddVisit(0, GURL{"https://github.com"}, u"Github title", 4, IntToTime(4), 5); @@ -240,7 +248,7 @@ run_loop_quit_.Run(); })); - VerifyHardcodedTestDataInUrlLoaderRequest(); + VerifyHardcodedTestDataInUrlLoaderRequest(experiment_name); InjectHardcodedTestDataToUrlLoaderResponse({{2, 4}, {4}}); // Verify the callback is invoked.
diff --git a/components/history_clusters/core/proto/clusters.proto b/components/history_clusters/core/proto/clusters.proto index 677315f..54e2093 100644 --- a/components/history_clusters/core/proto/clusters.proto +++ b/components/history_clusters/core/proto/clusters.proto
@@ -12,6 +12,9 @@ message GetClustersRequest { // Represents a set of visits. repeated Visit visits = 1; + // The experiment name that controls the clustering behavior served for + // this request. + string experiment_name = 2; } message GetClustersResponse {
diff --git a/components/media_router/browser/media_router_metrics_unittest.cc b/components/media_router/browser/media_router_metrics_unittest.cc index 91ad2b00..efd5459 100644 --- a/components/media_router/browser/media_router_metrics_unittest.cc +++ b/components/media_router/browser/media_router_metrics_unittest.cc
@@ -218,16 +218,14 @@ MediaRouterMetrics::RecordMediaSinkType(SinkIconType::WIRED_DISPLAY); MediaRouterMetrics::RecordMediaSinkType(SinkIconType::CAST); MediaRouterMetrics::RecordMediaSinkType(SinkIconType::CAST_AUDIO); - MediaRouterMetrics::RecordMediaSinkType(SinkIconType::HANGOUT); MediaRouterMetrics::RecordMediaSinkType(SinkIconType::CAST); MediaRouterMetrics::RecordMediaSinkType(SinkIconType::GENERIC); - tester.ExpectTotalCount(MediaRouterMetrics::kHistogramMediaSinkType, 6); + tester.ExpectTotalCount(MediaRouterMetrics::kHistogramMediaSinkType, 5); EXPECT_THAT( tester.GetAllSamples(MediaRouterMetrics::kHistogramMediaSinkType), ElementsAre(Bucket(static_cast<int>(SinkIconType::CAST), 2), Bucket(static_cast<int>(SinkIconType::CAST_AUDIO), 1), - Bucket(static_cast<int>(SinkIconType::HANGOUT), 1), Bucket(static_cast<int>(SinkIconType::WIRED_DISPLAY), 1), Bucket(static_cast<int>(SinkIconType::GENERIC), 1))); }
diff --git a/components/media_router/common/media_sink.cc b/components/media_router/common/media_sink.cc index ef5eb14..d0a5167 100644 --- a/components/media_router/common/media_sink.cc +++ b/components/media_router/common/media_sink.cc
@@ -26,17 +26,6 @@ MediaSink& MediaSink::operator=(const MediaSink& other) = default; MediaSink& MediaSink::operator=(MediaSink&& other) noexcept = default; -bool MediaSink::IsMaybeCloudSink() const { - switch (icon_type_) { - case SinkIconType::MEETING: - case SinkIconType::HANGOUT: - case SinkIconType::EDUCATION: - return true; - default: - return false; - } -} - bool MediaSink::operator==(const MediaSink& other) const { return sink_id_ == other.sink_id_ && name_ == other.name_ && description_ == other.description_ && domain_ == other.domain_ &&
diff --git a/components/media_router/common/media_sink.h b/components/media_router/common/media_sink.h index 24994a94..f9abed14 100644 --- a/components/media_router/common/media_sink.h +++ b/components/media_router/common/media_sink.h
@@ -18,8 +18,8 @@ namespace media_router { // IconTypes are listed in the order in which sinks should be sorted. -// The order must stay in sync with -// chrome/browser/resources/media_router/media_router_data.js. +// The values must match media_router::mojom::SinkIconType and +// ash::SinkIconType. // // NOTE: This enum is used for recording the MediaRouter.Sink.SelectedType // metrics, so if we want to reorder it, we must create a separate enum that @@ -29,9 +29,6 @@ CAST = 0, CAST_AUDIO_GROUP = 1, CAST_AUDIO = 2, - MEETING = 3, - HANGOUT = 4, - EDUCATION = 5, WIRED_DISPLAY = 6, GENERIC = 7, TOTAL_COUNT = 8 // Add new types above this line. @@ -80,10 +77,6 @@ } MediaRouteProviderId provider_id() const { return provider_id_; } - // Returns true if the sink is from the Cloud MRP; however, as this is based - // solely on the icon type, is not guaranteed to be correct 100% of the time. - bool IsMaybeCloudSink() const; - bool operator==(const MediaSink& other) const; bool operator!=(const MediaSink& other) const;
diff --git a/components/media_router/common/media_sink_unittest.cc b/components/media_router/common/media_sink_unittest.cc index b38557b..9fb9cb2 100644 --- a/components/media_router/common/media_sink_unittest.cc +++ b/components/media_router/common/media_sink_unittest.cc
@@ -8,19 +8,6 @@ namespace media_router { -TEST(MediaSinkTest, IsMaybeCloudSink) { - MediaSink meeting("sinkId", "Sink", SinkIconType::MEETING, - MediaRouteProviderId::EXTENSION); - MediaSink eduReceiver("sinkId2", "Sink", SinkIconType::EDUCATION, - MediaRouteProviderId::EXTENSION); - MediaSink chromeCast("sinkId3", "Sink", SinkIconType::CAST, - MediaRouteProviderId::EXTENSION); - - EXPECT_TRUE(meeting.IsMaybeCloudSink()); - EXPECT_TRUE(eduReceiver.IsMaybeCloudSink()); - EXPECT_FALSE(chromeCast.IsMaybeCloudSink()); -} - TEST(MediaSinkTest, TestEquals) { MediaSink sink1("sinkId", "Sink", SinkIconType::CAST, MediaRouteProviderId::EXTENSION);
diff --git a/components/media_router/common/mojom/media_router.mojom b/components/media_router/common/mojom/media_router.mojom index a423f79..e1b402b3 100644 --- a/components/media_router/common/mojom/media_router.mojom +++ b/components/media_router/common/mojom/media_router.mojom
@@ -15,16 +15,13 @@ import "url/mojom/origin.mojom"; import "url/mojom/url.mojom"; -// This must stay in sync with ash.mojom.SinkIconType. +// This must stay in sync with media_router::SinkIconType and ash::SinkIconType. enum SinkIconType { - CAST, - CAST_AUDIO_GROUP, - CAST_AUDIO, - MEETING, - HANGOUT, - EDUCATION, - WIRED_DISPLAY, - GENERIC + CAST = 0, + CAST_AUDIO_GROUP = 1, + CAST_AUDIO = 2, + WIRED_DISPLAY = 6, + GENERIC = 7 }; // Represents an output sink to which media can be routed.
diff --git a/components/media_router/common/mojom/media_router_mojom_traits.h b/components/media_router/common/mojom/media_router_mojom_traits.h index 80a77f4d..896349a5 100644 --- a/components/media_router/common/mojom/media_router_mojom_traits.h +++ b/components/media_router/common/mojom/media_router_mojom_traits.h
@@ -215,12 +215,6 @@ return media_router::mojom::SinkIconType::CAST_AUDIO_GROUP; case media_router::SinkIconType::CAST_AUDIO: return media_router::mojom::SinkIconType::CAST_AUDIO; - case media_router::SinkIconType::MEETING: - return media_router::mojom::SinkIconType::MEETING; - case media_router::SinkIconType::HANGOUT: - return media_router::mojom::SinkIconType::HANGOUT; - case media_router::SinkIconType::EDUCATION: - return media_router::mojom::SinkIconType::EDUCATION; case media_router::SinkIconType::WIRED_DISPLAY: return media_router::mojom::SinkIconType::WIRED_DISPLAY; case media_router::SinkIconType::GENERIC: @@ -244,15 +238,6 @@ case media_router::mojom::SinkIconType::CAST_AUDIO: *output = media_router::SinkIconType::CAST_AUDIO; return true; - case media_router::mojom::SinkIconType::MEETING: - *output = media_router::SinkIconType::MEETING; - return true; - case media_router::mojom::SinkIconType::HANGOUT: - *output = media_router::SinkIconType::HANGOUT; - return true; - case media_router::mojom::SinkIconType::EDUCATION: - *output = media_router::SinkIconType::EDUCATION; - return true; case media_router::mojom::SinkIconType::WIRED_DISPLAY: *output = media_router::SinkIconType::WIRED_DISPLAY; return true;
diff --git a/components/omnibox/browser/bookmark_provider.cc b/components/omnibox/browser/bookmark_provider.cc index 9413464..09abcf8 100644 --- a/components/omnibox/browser/bookmark_provider.cc +++ b/components/omnibox/browser/bookmark_provider.cc
@@ -10,6 +10,7 @@ #include "base/feature_list.h" #include "base/macros.h" +#include "base/metrics/field_trial_params.h" #include "base/stl_util.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h"
diff --git a/components/password_manager/core/browser/password_manager_features_util.cc b/components/password_manager/core/browser/password_manager_features_util.cc index 22b3d6f..2bd7a86 100644 --- a/components/password_manager/core/browser/password_manager_features_util.cc +++ b/components/password_manager/core/browser/password_manager_features_util.cc
@@ -7,6 +7,7 @@ #include <algorithm> #include "base/containers/flat_set.h" +#include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_functions.h" #include "base/ranges/algorithm.h" #include "base/values.h"
diff --git a/components/password_manager/core/browser/ui/insecure_credentials_manager.cc b/components/password_manager/core/browser/ui/insecure_credentials_manager.cc index 916d9b60..3e5c56e6 100644 --- a/components/password_manager/core/browser/ui/insecure_credentials_manager.cc +++ b/components/password_manager/core/browser/ui/insecure_credentials_manager.cc
@@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/callback.h" #include "base/containers/flat_set.h" +#include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_functions.h" #include "base/ranges/algorithm.h" #include "base/strings/utf_string_conversions.h"
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index 86f7409..953f00f 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -10902,7 +10902,7 @@ 'dynamic_refresh': True, 'per_profile': False, }, - 'example_value': '.*@example\.com', + 'example_value': '.*@example.com', 'id': 147, 'caption': '''Restrict which Google accounts are allowed to be set as browser primary accounts in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>''', 'tags': [],
diff --git a/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm b/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm index 6958088..cf88f696 100644 --- a/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm +++ b/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm
@@ -65,23 +65,6 @@ @implementation BrowserNativeWidgetWindow -// Prevent detached tabs from glitching when the window is partially offscreen. -// See https://crbug.com/1095717 for details. -// This is easy to get wrong so scope very tightly to only disallow large -// vertical jumps. -- (NSRect)constrainFrameRect:(NSRect)rect toScreen:(NSScreen*)screen { - NSRect proposed = [super constrainFrameRect:rect toScreen:screen]; - // This boils down to: use the small threshold when we're not avoiding a - // Dock on the bottom, and the big threshold otherwise. - static constexpr CGFloat kBigThreshold = 200; - static constexpr CGFloat kSmallThreshold = 50; - const CGFloat yDelta = NSMaxY(proposed) - NSMaxY(rect); - if (yDelta > kBigThreshold || - (yDelta > kSmallThreshold && NSMinY(proposed) == 0)) - return rect; - return proposed; -} - // NSWindow (PrivateAPI) overrides. + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
diff --git a/components/remote_cocoa/app_shim/window_move_loop.h b/components/remote_cocoa/app_shim/window_move_loop.h index 1a3f6c6..cb92808c 100644 --- a/components/remote_cocoa/app_shim/window_move_loop.h +++ b/components/remote_cocoa/app_shim/window_move_loop.h
@@ -9,6 +9,7 @@ #include "base/callback.h" #include "base/memory/weak_ptr.h" +#include "ui/gfx/mac/scoped_cocoa_disable_screen_updates.h" namespace remote_cocoa { class NativeWidgetNSWindowBridge; @@ -42,6 +43,8 @@ LoopExitReason* exit_reason_ref_ = nullptr; base::OnceClosure quit_closure_; + std::unique_ptr<gfx::ScopedCocoaDisableScreenUpdates> screen_disabler_; + // WeakPtrFactory for event monitor safety. base::WeakPtrFactory<CocoaWindowMoveLoop> weak_factory_;
diff --git a/components/remote_cocoa/app_shim/window_move_loop.mm b/components/remote_cocoa/app_shim/window_move_loop.mm index dea9ab6..ff510a4 100644 --- a/components/remote_cocoa/app_shim/window_move_loop.mm +++ b/components/remote_cocoa/app_shim/window_move_loop.mm
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "components/remote_cocoa/app_shim/window_move_loop.h" +#include <memory> #include "base/debug/stack_trace.h" #include "base/run_loop.h" @@ -80,6 +81,9 @@ [[[WeakCocoaWindowMoveLoop alloc] initWithWeakPtr:weak_factory_.GetWeakPtr()] autorelease]; + __block BOOL has_moved = NO; + screen_disabler_ = std::make_unique<gfx::ScopedCocoaDisableScreenUpdates>(); + // Esc keypress is handled by EscapeTracker, which is installed by // TabDragController. NSEventMask mask = @@ -104,8 +108,11 @@ NSRect ns_frame = NSOffsetRect( initial_frame, mouse_in_screen.x - initial_mouse_in_screen_.x, mouse_in_screen.y - initial_mouse_in_screen_.y); - ns_frame = [window constrainFrameRect:ns_frame toScreen:window.screen]; [window setFrame:ns_frame display:NO animate:NO]; + if (!has_moved) { + has_moved = YES; + strong->screen_disabler_.reset(); + } return event; } @@ -136,6 +143,7 @@ } void CocoaWindowMoveLoop::End() { + screen_disabler_.reset(); if (exit_reason_ref_) { DCHECK_EQ(*exit_reason_ref_, ENDED_EXTERNALLY); // Ensure the destructor doesn't replace the reason.
diff --git a/components/safe_browsing/content/browser/client_side_detection_service.cc b/components/safe_browsing/content/browser/client_side_detection_service.cc index b9e9a2ea..0e13fc1 100644 --- a/components/safe_browsing/content/browser/client_side_detection_service.cc +++ b/components/safe_browsing/content/browser/client_side_detection_service.cc
@@ -26,6 +26,7 @@ #include "components/safe_browsing/content/common/safe_browsing.mojom.h" #include "components/safe_browsing/content/web_ui/safe_browsing_ui.h" #include "components/safe_browsing/core/common/safe_browsing_prefs.h" +#include "components/safe_browsing/core/common/safebrowsing_constants.h" #include "components/safe_browsing/core/common/utils.h" #include "components/safe_browsing/core/features.h" #include "components/safe_browsing/core/proto/client_model.pb.h" @@ -61,8 +62,6 @@ const char ClientSideDetectionService::kClientReportPhishingUrl[] = "https://sb-ssl.google.com/safebrowsing/clientreport/phishing"; -constexpr char kAuthHeaderBearer[] = "Bearer "; - struct ClientSideDetectionService::ClientPhishingReportInfo { std::unique_ptr<network::SimpleURLLoader> loader; ClientReportPhishingRequestCallback callback;
diff --git a/components/safe_browsing/content/password_protection/BUILD.gn b/components/safe_browsing/content/password_protection/BUILD.gn index 01d6f8f..ea72d77d 100644 --- a/components/safe_browsing/content/password_protection/BUILD.gn +++ b/components/safe_browsing/content/password_protection/BUILD.gn
@@ -79,6 +79,7 @@ "//components/safe_browsing/core:csd_proto", "//components/safe_browsing/core:features", "//components/safe_browsing/core:verdict_cache_manager", + "//components/safe_browsing/core/common:common", "//components/safe_browsing/core/common:safe_browsing_prefs", "//components/safe_browsing/core/db:test_database_manager", "//components/safe_browsing/core/password_protection",
diff --git a/components/safe_browsing/content/password_protection/password_protection_service_unittest.cc b/components/safe_browsing/content/password_protection/password_protection_service_unittest.cc index 225b0363b..076137b8 100644 --- a/components/safe_browsing/content/password_protection/password_protection_service_unittest.cc +++ b/components/safe_browsing/content/password_protection/password_protection_service_unittest.cc
@@ -29,6 +29,7 @@ #include "components/safe_browsing/content/password_protection/password_protection_navigation_throttle.h" #include "components/safe_browsing/content/password_protection/password_protection_request_content.h" #include "components/safe_browsing/core/common/safe_browsing_prefs.h" +#include "components/safe_browsing/core/common/safebrowsing_constants.h" #include "components/safe_browsing/core/db/test_database_manager.h" #include "components/safe_browsing/core/features.h" #include "components/safe_browsing/core/password_protection/metrics_util.h" @@ -1035,7 +1036,7 @@ std::string out; EXPECT_TRUE(request.headers.GetHeader( net::HttpRequestHeaders::kAuthorization, &out)); - EXPECT_EQ(out, "Bearer " + access_token); + EXPECT_EQ(out, kAuthHeaderBearer + access_token); })); // Set up mock call to token fetcher. SafeBrowsingTokenFetcher::Callback cb;
diff --git a/components/safe_browsing/core/common/safebrowsing_constants.cc b/components/safe_browsing/core/common/safebrowsing_constants.cc index d4fea361..d35332a3 100644 --- a/components/safe_browsing/core/common/safebrowsing_constants.cc +++ b/components/safe_browsing/core/common/safebrowsing_constants.cc
@@ -23,6 +23,8 @@ const char kArtificialCachedPhishGuardVerdictFlag[] = "mark_as_phish_guard_phishing"; +const char kAuthHeaderBearer[] = "Bearer "; + const std::vector<std::string> GetExcludedCountries() { // Safe Browsing endpoint doesn't exist. return {"cn"};
diff --git a/components/safe_browsing/core/common/safebrowsing_constants.h b/components/safe_browsing/core/common/safebrowsing_constants.h index bd7a075..a0647922 100644 --- a/components/safe_browsing/core/common/safebrowsing_constants.h +++ b/components/safe_browsing/core/common/safebrowsing_constants.h
@@ -31,6 +31,10 @@ // Command-line flag for caching an artificial PhishGuard unsafe verdict. extern const char kArtificialCachedPhishGuardVerdictFlag[]; +// The bearer token prefix in authorization header. Used when various Safe +// Browsing requests are GAIA-keyed by attaching oauth2 tokens as bearer tokens. +extern const char kAuthHeaderBearer[]; + // Countries that has no endpoint for Safe Browsing. const std::vector<std::string> GetExcludedCountries();
diff --git a/components/safe_browsing/core/password_protection/password_protection_request.cc b/components/safe_browsing/core/password_protection/password_protection_request.cc index a930872..442fdfb 100644 --- a/components/safe_browsing/core/password_protection/password_protection_request.cc +++ b/components/safe_browsing/core/password_protection/password_protection_request.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/strings/strcat.h" #include "base/strings/utf_string_conversions.h" +#include "components/safe_browsing/core/common/safebrowsing_constants.h" #include "components/safe_browsing/core/common/thread_utils.h" #include "components/safe_browsing/core/db/allowlist_checker_client.h" #include "components/safe_browsing/core/db/database_manager.h" @@ -29,8 +30,6 @@ using ReusedPasswordAccountType = LoginReputationClientRequest::PasswordReuseEvent::ReusedPasswordAccountType; -constexpr char kAuthHeaderBearer[] = "Bearer "; - namespace { // Cap on how many reused domains can be included in a report, to limit
diff --git a/components/safe_browsing/core/realtime/url_lookup_service_base.cc b/components/safe_browsing/core/realtime/url_lookup_service_base.cc index 60020ea..9387c76d6 100644 --- a/components/safe_browsing/core/realtime/url_lookup_service_base.cc +++ b/components/safe_browsing/core/realtime/url_lookup_service_base.cc
@@ -15,6 +15,7 @@ #include "components/prefs/pref_service.h" #include "components/safe_browsing/core/browser/referrer_chain_provider.h" #include "components/safe_browsing/core/common/safe_browsing_prefs.h" +#include "components/safe_browsing/core/common/safebrowsing_constants.h" #include "components/safe_browsing/core/common/thread_utils.h" #include "components/safe_browsing/core/common/utils.h" #include "components/safe_browsing/core/verdict_cache_manager.h" @@ -38,8 +39,6 @@ const size_t kURLLookupTimeoutDurationInSeconds = 3; -constexpr char kAuthHeaderBearer[] = "Bearer "; - // Represents the value stored in the |version| field of |RTLookupRequest|. const int kRTLookupRequestVersion = 2;
diff --git a/components/search/ntp_features.cc b/components/search/ntp_features.cc index 5a8c989b..8657556d 100644 --- a/components/search/ntp_features.cc +++ b/components/search/ntp_features.cc
@@ -5,6 +5,7 @@ #include "components/search/ntp_features.h" #include "base/feature_list.h" +#include "base/metrics/field_trial_params.h" #include "base/strings/string_number_conversions.h" #include "base/time/time.h" #include "build/build_config.h"
diff --git a/components/variations/synthetic_trial_registry.h b/components/variations/synthetic_trial_registry.h index a549721..3cfe4de 100644 --- a/components/variations/synthetic_trial_registry.h +++ b/components/variations/synthetic_trial_registry.h
@@ -8,6 +8,7 @@ #include <vector> #include "base/feature_list.h" +#include "base/metrics/field_trial_params.h" #include "base/observer_list.h" #include "components/variations/synthetic_trials.h"
diff --git a/components/viz/common/features.cc b/components/viz/common/features.cc index 732f69b2..db4cfa3 100644 --- a/components/viz/common/features.cc +++ b/components/viz/common/features.cc
@@ -65,12 +65,6 @@ const base::Feature kFastSolidColorDraw{"FastSolidColorDraw", base::FEATURE_DISABLED_BY_DEFAULT}; -// We use this feature for default value, because enabled VizForWebView forces -// skia renderer on and we want to have different feature state between webview -// and chrome. This one is set by webview, while the above can be set via finch. -const base::Feature kVizForWebViewDefault{"VizForWebViewDefault", - base::FEATURE_DISABLED_BY_DEFAULT}; - // Submit CompositorFrame from SynchronousLayerTreeFrameSink directly to viz in // WebView. const base::Feature kVizFrameSubmissionForWebView{ @@ -160,10 +154,6 @@ return false; #endif - // Viz for webview requires SkiaRenderer. - if (IsUsingVizForWebView()) - return true; - #if BUILDFLAG(IS_CHROMEOS_ASH) // TODO(https://crbug.com/1145180): SkiaRenderer isn't supported on Chrome // OS boards that still use the legacy video decoder. @@ -192,21 +182,8 @@ return base::FeatureList::IsEnabled(kFastSolidColorDraw); } -bool IsUsingVizForWebView() { - // Vulkan on WebView requires viz. - if (features::IsUsingVulkan()) - return true; - - return base::FeatureList::IsEnabled(kVizForWebViewDefault); -} - bool IsUsingVizFrameSubmissionForWebView() { - if (base::FeatureList::IsEnabled(kVizFrameSubmissionForWebView)) { - DCHECK(IsUsingVizForWebView()) - << "kVizFrameSubmissionForWebView requires kVizForWebView"; - return true; - } - return false; + return base::FeatureList::IsEnabled(kVizFrameSubmissionForWebView); } bool IsUsingPreferredIntervalForVideo() {
diff --git a/components/viz/common/features.h b/components/viz/common/features.h index dab5555..6a1b684 100644 --- a/components/viz/common/features.h +++ b/components/viz/common/features.h
@@ -23,7 +23,6 @@ VIZ_COMMON_EXPORT extern const base::Feature kDynamicColorGamut; #endif VIZ_COMMON_EXPORT extern const base::Feature kFastSolidColorDraw; -VIZ_COMMON_EXPORT extern const base::Feature kVizForWebViewDefault; VIZ_COMMON_EXPORT extern const base::Feature kVizFrameSubmissionForWebView; VIZ_COMMON_EXPORT extern const base::Feature kUsePreferredIntervalForVideo; VIZ_COMMON_EXPORT extern const base::Feature kUseRealBuffersForPageFlipTest; @@ -49,7 +48,6 @@ VIZ_COMMON_EXPORT bool IsSyncWindowDestructionEnabled(); VIZ_COMMON_EXPORT bool IsUsingFastPathForSolidColorQuad(); VIZ_COMMON_EXPORT bool IsUsingSkiaRenderer(); -VIZ_COMMON_EXPORT bool IsUsingVizForWebView(); VIZ_COMMON_EXPORT bool IsUsingVizFrameSubmissionForWebView(); VIZ_COMMON_EXPORT bool IsUsingPreferredIntervalForVideo(); VIZ_COMMON_EXPORT bool IsVizHitTestingDebugEnabled();
diff --git a/components/viz/service/transitions/surface_animation_manager.cc b/components/viz/service/transitions/surface_animation_manager.cc index 1cda86e..882c207 100644 --- a/components/viz/service/transitions/surface_animation_manager.cc +++ b/components/viz/service/transitions/surface_animation_manager.cc
@@ -30,7 +30,13 @@ } constexpr base::TimeDelta kDefaultAnimationDuration = - base::TimeDelta::FromMilliseconds(300); + base::TimeDelta::FromMilliseconds(250); + +constexpr base::TimeDelta kSharedOpacityAnimationDuration = + base::TimeDelta::FromMilliseconds(60); + +constexpr base::TimeDelta kSharedOpacityAnimationDelay = + base::TimeDelta::FromMilliseconds(60); // Scale the overall duration to produce the opacity duration. Opacity // transitions which reveal an element (i.e., transition opacity from 0 -> 1) @@ -581,7 +587,7 @@ return; for (const auto& resource : resources) { if (resource.id >= kVizReservedRangeStartId) - transferable_resource_tracker_.UnrefResource(resource.id); + transferable_resource_tracker_.UnrefResource(resource.id, resource.count); } } @@ -781,10 +787,25 @@ auto float_curve = gfx::KeyframedFloatAnimationCurve::Create(); float_curve->set_target(&state); + + // The curve starts at opacity delay and runs for opacity animation, so it + // potentially has 4 points: + // time 0 == start opacity + // time 'delay' == start opacity + // time 'delay' + 'duration' == end opacity + // time end of animation == end opacity float_curve->AddKeyframe( gfx::FloatKeyframe::Create(base::TimeDelta(), start_opacity, nullptr)); + if (!kSharedOpacityAnimationDelay.is_zero()) { + float_curve->AddKeyframe(gfx::FloatKeyframe::Create( + kSharedOpacityAnimationDelay, start_opacity, nullptr)); + } + float_curve->AddKeyframe(gfx::FloatKeyframe::Create( + kSharedOpacityAnimationDuration + kSharedOpacityAnimationDelay, + end_opacity, nullptr)); float_curve->AddKeyframe(gfx::FloatKeyframe::Create( kDefaultAnimationDuration, end_opacity, nullptr)); + state.driver().AddKeyframeModel(gfx::KeyframeModel::Create( std::move(float_curve), gfx::KeyframeEffect::GetNextKeyframeModelId(), AnimationState::kSrcOpacity)); @@ -797,8 +818,9 @@ // Set transform value to be the same at the start and end; we will // re-target the end transform when we update the curves for a given // compositor frame if needed. - auto ease_timing = gfx::CubicBezierTimingFunction::CreatePreset( - gfx::CubicBezierTimingFunction::EaseType::EASE); + // The specific timing function is fine tuned for the effect. + auto ease_timing = + gfx::CubicBezierTimingFunction::Create(0.4, 0.0, 0.2, 1.0); gfx::TransformOperations transform_ops; transform_ops.AppendMatrix(shared->draw_data.target_transform);
diff --git a/components/viz/service/transitions/surface_animation_manager_unittest.cc b/components/viz/service/transitions/surface_animation_manager_unittest.cc index 7097eb4..4be80cf8 100644 --- a/components/viz/service/transitions/surface_animation_manager_unittest.cc +++ b/components/viz/service/transitions/surface_animation_manager_unittest.cc
@@ -349,12 +349,12 @@ EXPECT_TRUE(manager().NeedsBeginFrame()); manager().UpdateFrameTime( - AdvanceTime(base::TimeDelta::FromMilliseconds(250))); + AdvanceTime(base::TimeDelta::FromMilliseconds(200))); manager().NotifyFrameAdvanced(); EXPECT_TRUE(manager().NeedsBeginFrame()); manager().UpdateFrameTime( - AdvanceTime(base::TimeDelta::FromMilliseconds(250))); + AdvanceTime(base::TimeDelta::FromMilliseconds(200))); manager().NotifyFrameAdvanced(); // We should be at the done state, but still need a frame. EXPECT_TRUE(manager().NeedsBeginFrame());
diff --git a/components/viz/service/transitions/transferable_resource_tracker.cc b/components/viz/service/transitions/transferable_resource_tracker.cc index 39fc71cf..27153aa 100644 --- a/components/viz/service/transitions/transferable_resource_tracker.cc +++ b/components/viz/service/transitions/transferable_resource_tracker.cc
@@ -109,10 +109,10 @@ } void TransferableResourceTracker::ReturnFrame(const ResourceFrame& frame) { - UnrefResource(frame.root.resource.id); + UnrefResource(frame.root.resource.id, /*count=*/1); for (const auto& shared : frame.shared) { if (shared.has_value()) - UnrefResource(shared->resource.id); + UnrefResource(shared->resource.id, /*count=*/1); } } @@ -121,9 +121,11 @@ ++managed_resources_[id].ref_count; } -void TransferableResourceTracker::UnrefResource(ResourceId id) { +void TransferableResourceTracker::UnrefResource(ResourceId id, int count) { DCHECK(base::Contains(managed_resources_, id)); - if (--managed_resources_[id].ref_count == 0) + DCHECK_LE(count, managed_resources_[id].ref_count); + managed_resources_[id].ref_count -= count; + if (managed_resources_[id].ref_count == 0) managed_resources_.erase(id); }
diff --git a/components/viz/service/transitions/transferable_resource_tracker.h b/components/viz/service/transitions/transferable_resource_tracker.h index 58e817f..b8c1d01 100644 --- a/components/viz/service/transitions/transferable_resource_tracker.h +++ b/components/viz/service/transitions/transferable_resource_tracker.h
@@ -72,7 +72,7 @@ // Ref count management for the resources returned by `ImportResources`. void RefResource(ResourceId id); - void UnrefResource(ResourceId id); + void UnrefResource(ResourceId id, int count); bool is_empty() const { return managed_resources_.empty(); }
diff --git a/components/viz/service/transitions/transferable_resource_tracker_unittest.cc b/components/viz/service/transitions/transferable_resource_tracker_unittest.cc index 939b2ef9..30127ed0 100644 --- a/components/viz/service/transitions/transferable_resource_tracker_unittest.cc +++ b/components/viz/service/transitions/transferable_resource_tracker_unittest.cc
@@ -66,7 +66,7 @@ tracker.RefResource(frame2.root.resource.id); tracker.ReturnFrame(frame2); EXPECT_TRUE(HasBitmapResource(frame2.root.resource)); - tracker.UnrefResource(frame2.root.resource.id); + tracker.UnrefResource(frame2.root.resource.id, 1); EXPECT_FALSE(HasBitmapResource(frame2.root.resource)); } @@ -91,6 +91,20 @@ } } +TEST_F(TransferableResourceTrackerTest, UnrefWithCount) { + TransferableResourceTracker tracker(&shared_bitmap_manager_); + auto frame = tracker.ImportResources(CreateFrameWithResult()); + for (int i = 0; i < 100; ++i) + tracker.RefResource(frame.root.resource.id); + ASSERT_FALSE(tracker.is_empty()); + tracker.UnrefResource(frame.root.resource.id, 1); + EXPECT_FALSE(tracker.is_empty()); + tracker.UnrefResource(frame.root.resource.id, 1); + EXPECT_FALSE(tracker.is_empty()); + tracker.UnrefResource(frame.root.resource.id, 99); + EXPECT_TRUE(tracker.is_empty()); +} + TEST_F(TransferableResourceTrackerTest, ExhaustedIdLoopsButSkipsUnavailableIds) { static_assert(std::is_same<decltype(kInvalidResourceId.GetUnsafeValue()),
diff --git a/content/BUILD.gn b/content/BUILD.gn index 30537118..b8a3d36 100644 --- a/content/BUILD.gn +++ b/content/BUILD.gn
@@ -97,6 +97,7 @@ "//base", "//build:chromeos_buildflags", "//media:media_buildflags", + "//printing/buildflags", "//sandbox:sandbox_buildflags", "//sandbox/linux:sandbox", "//sandbox/policy",
diff --git a/content/browser/appcache/appcache_response_unittest.cc b/content/browser/appcache/appcache_response_unittest.cc index 744ee9c..7e28c7a9 100644 --- a/content/browser/appcache/appcache_response_unittest.cc +++ b/content/browser/appcache/appcache_response_unittest.cc
@@ -28,6 +28,7 @@ #include "base/timer/timer.h" #include "content/browser/appcache/appcache_response_info.h" #include "content/browser/appcache/mock_appcache_service.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/test/browser_task_environment.h" #include "net/base/io_buffer.h"
diff --git a/content/browser/back_forward_cache_browsertest.cc b/content/browser/back_forward_cache_browsertest.cc index e8c7f34c..eb90e3f 100644 --- a/content/browser/back_forward_cache_browsertest.cc +++ b/content/browser/back_forward_cache_browsertest.cc
@@ -1335,9 +1335,11 @@ // Test that a series of cross-site navigations (which use different processes) // use the background limit. +// +// TODO(crbug.com/1203418): This test is flaky. IN_PROC_BROWSER_TEST_F( BackgroundForegroundProcessLimitBackForwardCacheBrowserTest, - CacheEvictionCrossSite) { + DISABLED_CacheEvictionCrossSite) { ASSERT_TRUE(embedded_test_server()->Start()); std::vector<std::unique_ptr<RenderFrameDeletedObserver>> delete_observers;
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index 4ec13b0..e37b6aa 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -135,11 +135,6 @@ web_contents->SetBrowserPluginGuest(std::move(guest)); } -// static -bool BrowserPluginGuest::IsGuest(WebContentsImpl* web_contents) { - return web_contents && web_contents->GetBrowserPluginGuest(); -} - WebContentsImpl* BrowserPluginGuest::GetWebContents() const { return static_cast<WebContentsImpl*>(web_contents()); }
diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h index cb6a2dfb..bc13113 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.h +++ b/content/browser/browser_plugin/browser_plugin_guest.h
@@ -68,9 +68,6 @@ static void CreateInWebContents(WebContentsImpl* web_contents, BrowserPluginGuestDelegate* delegate); - // Returns whether the given WebContents is a BrowserPlugin guest. - static bool IsGuest(WebContentsImpl* web_contents); - // BrowserPluginGuest::Init is called after the associated guest WebContents // initializes. If this guest cannot navigate without being attached to a // container, then this call is a no-op. For guest types that can be
diff --git a/content/browser/child_process_security_policy_unittest.cc b/content/browser/child_process_security_policy_unittest.cc index d36d553..a949bdd 100644 --- a/content/browser/child_process_security_policy_unittest.cc +++ b/content/browser/child_process_security_policy_unittest.cc
@@ -17,6 +17,7 @@ #include "content/browser/child_process_security_policy_impl.h" #include "content/browser/isolated_origin_util.h" #include "content/browser/site_instance_impl.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/bindings_policy.h" #include "content/public/common/content_client.h"
diff --git a/content/browser/media/media_interface_proxy.cc b/content/browser/media/media_interface_proxy.cc index 6ec65b1d..a8e6d726 100644 --- a/content/browser/media/media_interface_proxy.cc +++ b/content/browser/media/media_interface_proxy.cc
@@ -360,6 +360,8 @@ DCHECK(thread_checker_.CalledOnValidThread()); DVLOG(1) << __func__ << ": this=" << this; + // For protected playback, the service should have already been initialized + // with a CDM path in CreateCdm(). auto* factory = GetMediaFoundationServiceInterfaceFactory(base::FilePath()); if (factory) { factory->CreateMediaFoundationRenderer( @@ -391,15 +393,30 @@ return; } } + // Fallback to use library CDM below. ReportCdmTypeUMA(CrosCdmType::kChromeCdm); #elif defined(OS_WIN) if (ShouldUseMediaFoundationServiceForCdm(key_system, cdm_config)) { - // TODO(xhwang): Refactor CdmInfo to provide the CDM path here. - auto* factory = GetMediaFoundationServiceInterfaceFactory(base::FilePath()); - if (factory) - factory->CreateCdm(key_system, cdm_config, std::move(callback)); - return; + if (!cdm_config.allow_distinctive_identifier || + !cdm_config.allow_persistent_state) { + DVLOG(2) << "MediaFoundationService requires both distinctive identifier " + "and persistent state"; + std::move(callback).Run(mojo::NullRemote(), nullptr, "Invalid CdmConfig"); + return; + } + + auto cdm_info = CdmRegistryImpl::GetInstance()->GetCdmInfo( + key_system, CdmInfo::Robustness::kHardwareSecure); + if (cdm_info) { + DVLOG(2) << "Get MediaFoundationService with CDM path " << cdm_info->path; + auto* factory = GetMediaFoundationServiceInterfaceFactory(cdm_info->path); + if (factory) { + factory->CreateCdm(key_system, cdm_config, std::move(callback)); + return; + } + } } + // Fallback to use library CDM below. #endif // BUILDFLAG(IS_CHROMEOS_ASH) && BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA) #if BUILDFLAG(ENABLE_LIBRARY_CDMS) @@ -493,9 +510,6 @@ // TODO(xhwang): Refine this after we populate support info during EME // requestMediaKeySystemAccess() query, e.g. to check both `key_system` and // `cdm_config`. - // TODO(xhwang): Determine whether we need to also check - // cdm_config.allow_distinctive_identifier here. - return cdm_config.use_hw_secure_codecs; } #endif // defined(OS_WIN)
diff --git a/content/browser/renderer_host/back_forward_cache_impl.h b/content/browser/renderer_host/back_forward_cache_impl.h index 484f6ad..b269b08 100644 --- a/content/browser/renderer_host/back_forward_cache_impl.h +++ b/content/browser/renderer_host/back_forward_cache_impl.h
@@ -18,7 +18,6 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "content/browser/renderer_host/back_forward_cache_can_store_document_result.h" -#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_process_host_internal_observer.h" #include "content/common/content_export.h" #include "content/public/browser/back_forward_cache.h" @@ -104,7 +103,7 @@ // BackForwardCache. static bool IsMediaSessionImplOnServiceCreatedAllowed(); - explicit BackForwardCacheImpl(); + BackForwardCacheImpl(); ~BackForwardCacheImpl() override; // Returns whether a RenderFrameHost can be stored into the BackForwardCache
diff --git a/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.cc b/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.cc index 3edeacfa..9982337 100644 --- a/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.cc +++ b/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.cc
@@ -16,6 +16,8 @@ #include "content/browser/file_system/browser_file_system_helper.h" #include "content/browser/renderer_host/pepper/pepper_file_system_browser_host.h" #include "content/public/browser/browser_context.h" +#include "content/public/browser/browser_task_traits.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/storage_partition.h" #include "content/public/common/content_features.h"
diff --git a/content/browser/renderer_host/render_frame_proxy_host.h b/content/browser/renderer_host/render_frame_proxy_host.h index 1c0f5ed8..f84ad83 100644 --- a/content/browser/renderer_host/render_frame_proxy_host.h +++ b/content/browser/renderer_host/render_frame_proxy_host.h
@@ -16,6 +16,7 @@ #include "ipc/ipc_listener.h" #include "ipc/ipc_sender.h" #include "mojo/public/cpp/bindings/associated_receiver.h" +#include "mojo/public/cpp/bindings/associated_remote.h" #include "third_party/blink/public/common/tokens/tokens.h" #include "third_party/blink/public/mojom/frame/frame.mojom.h" #include "third_party/blink/public/mojom/input/focus_type.mojom-forward.h"
diff --git a/content/browser/renderer_host/render_view_host_delegate.cc b/content/browser/renderer_host/render_view_host_delegate.cc index 4d17a642..42de6d8 100644 --- a/content/browser/renderer_host/render_view_host_delegate.cc +++ b/content/browser/renderer_host/render_view_host_delegate.cc
@@ -37,6 +37,10 @@ return false; } +bool RenderViewHostDelegate::IsGuest() { + return false; +} + bool RenderViewHostDelegate::IsPortal() { return false; }
diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h index 23762012..b877d0b7 100644 --- a/content/browser/renderer_host/render_view_host_delegate.h +++ b/content/browser/renderer_host/render_view_host_delegate.h
@@ -137,6 +137,9 @@ // The RenderView finished the first visually non-empty paint. virtual void DidFirstVisuallyNonEmptyPaint(RenderViewHostImpl* source) {} + // Returns true if the render view is rendering a guest. + virtual bool IsGuest(); + // Returns true if the render view is rendering a portal. virtual bool IsPortal();
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc index cf7e079..756ad32 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -476,11 +476,12 @@ params->hidden = frame_tree_->delegate()->IsHidden(); params->never_composited = delegate_->IsNeverComposited(); params->window_was_created_with_opener = window_was_created_with_opener; - // GuestViews in the same StoragePartition need to find each other's frames. - params->renderer_wide_named_frame_lookup = site_info_.is_guest(); bool is_portal = delegate_->IsPortal(); - bool is_guest_view = site_info_.is_guest(); + bool is_guest_view = delegate_->IsGuest(); + + // GuestViews in the same StoragePartition need to find each other's frames. + params->renderer_wide_named_frame_lookup = is_guest_view; // A view cannot be inside both a <portal> and inside a <webview>. DCHECK(!is_portal || !is_guest_view);
diff --git a/content/browser/scheduler/responsiveness/watcher_unittest.cc b/content/browser/scheduler/responsiveness/watcher_unittest.cc index c7195f11..5c36372 100644 --- a/content/browser/scheduler/responsiveness/watcher_unittest.cc +++ b/content/browser/scheduler/responsiveness/watcher_unittest.cc
@@ -156,8 +156,9 @@ // Test that tasks are forwarded to calculator. TEST_F(ResponsivenessWatcherTest, TaskForwarding) { for (int i = 0; i < 3; ++i) { - base::PendingTask task(FROM_HERE, base::OnceClosure()); - task.queue_time = base::TimeTicks::Now(); + base::PendingTask task(FROM_HERE, base::OnceClosure(), + /*queue_time=*/base::TimeTicks::Now(), + /*delayed_run_time=*/base::TimeTicks()); watcher_->WillRunTaskOnUIThread(&task, /* was_blocked_or_low_priority= */ false); watcher_->DidRunTaskOnUIThread(&task); @@ -166,8 +167,9 @@ EXPECT_EQ(0, watcher_->NumTasksOnIOThread()); for (int i = 0; i < 4; ++i) { - base::PendingTask task(FROM_HERE, base::OnceClosure()); - task.queue_time = base::TimeTicks::Now(); + base::PendingTask task(FROM_HERE, base::OnceClosure(), + /*queue_time=*/base::TimeTicks::Now(), + /*delayed_run_time=*/base::TimeTicks()); watcher_->WillRunTaskOnIOThread(&task, /* was_blocked_or_low_priority= */ false); watcher_->DidRunTaskOnIOThread(&task); @@ -178,13 +180,16 @@ // Test that nested tasks are not forwarded to the calculator. TEST_F(ResponsivenessWatcherTest, TaskNesting) { - base::PendingTask task1(FROM_HERE, base::OnceClosure()); - task1.queue_time = base::TimeTicks::Now(); - base::PendingTask task2(FROM_HERE, base::OnceClosure()); - task2.queue_time = base::TimeTicks::Now(); + base::PendingTask task1(FROM_HERE, base::OnceClosure(), + /*queue_time=*/base::TimeTicks::Now(), + /*delayed_run_time=*/base::TimeTicks()); + base::PendingTask task2(FROM_HERE, base::OnceClosure(), + /*queue_time=*/base::TimeTicks::Now(), + /*delayed_run_time=*/base::TimeTicks()); task_environment_.FastForwardBy(base::TimeDelta::FromMilliseconds(1)); - base::PendingTask task3(FROM_HERE, base::OnceClosure()); - task3.queue_time = base::TimeTicks::Now(); + base::PendingTask task3(FROM_HERE, base::OnceClosure(), + /*queue_time=*/base::TimeTicks::Now(), + /*delayed_run_time=*/base::TimeTicks()); const base::TimeTicks task_1_execution_start_time = base::TimeTicks::Now(); watcher_->WillRunTaskOnUIThread(&task1, @@ -240,8 +245,9 @@ // Test that the queue duration of a blocked or low priority task is zero. TEST_F(ResponsivenessWatcherTest, BlockedOrLowPriorityTask) { - base::PendingTask task(FROM_HERE, base::OnceClosure()); - task.queue_time = base::TimeTicks::Now(); + base::PendingTask task(FROM_HERE, base::OnceClosure(), + /*queue_time=*/base::TimeTicks::Now(), + /*delayed_run_time=*/base::TimeTicks()); task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); const base::TimeTicks execution_start_time = base::TimeTicks::Now(); @@ -265,8 +271,9 @@ // Test that the queue duration of a delayed task is zero. TEST_F(ResponsivenessWatcherTest, DelayedTask) { - base::PendingTask task(FROM_HERE, base::OnceClosure()); - task.delayed_run_time = base::TimeTicks::Now(); + base::PendingTask task(FROM_HERE, base::OnceClosure(), + /*queue_time=*/base::TimeTicks(), + /*delayed_run_time=*/base::TimeTicks::Now()); task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); const base::TimeTicks execution_start_time = base::TimeTicks::Now();
diff --git a/content/browser/service_worker/service_worker_subresource_filter_browsertest.cc b/content/browser/service_worker/service_worker_subresource_filter_browsertest.cc new file mode 100644 index 0000000..2b9438a1 --- /dev/null +++ b/content/browser/service_worker/service_worker_subresource_filter_browsertest.cc
@@ -0,0 +1,121 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/test/scoped_feature_list.h" +#include "content/public/common/content_features.h" +#include "content/public/test/browser_test.h" +#include "content/public/test/browser_test_utils.h" +#include "content/public/test/content_browser_test.h" +#include "content/public/test/content_browser_test_utils.h" +#include "content/shell/browser/shell.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace content { +namespace { + +// This script asks the fetch_event_pass_through service worker what fetch +// events it saw. +const std::string script = R"( + (async () => { + const saw_message = new Promise(resolve => { + navigator.serviceWorker.onmessage = event => { + resolve(event.data); + }; + }); + const registration = await navigator.serviceWorker.ready; + registration.active.postMessage(''); + return await saw_message; + })(); + )"; + +class ServiceWorkerSubresourceFilterBrowserTest + : public ContentBrowserTest, + public testing::WithParamInterface<bool> { + protected: + ServiceWorkerSubresourceFilterBrowserTest() { + feature_list_.InitWithFeatureState( + features::kServiceWorkerSubresourceFilter, FeatureIsEnabled()); + } + void SetUpOnMainThread() override { + ASSERT_TRUE(embedded_test_server()->InitializeAndListen()); + embedded_test_server()->StartAcceptingConnections(); + } + + void NavigateAndFetch(std::string url, bool expect_only_matching_filter) { + EXPECT_TRUE(NavigateToURL( + shell(), embedded_test_server()->GetURL( + "/service_worker/create_service_worker.html"))); + EXPECT_EQ("DONE", + EvalJs(shell(), "register('fetch_event_pass_through.js');")); + + GURL page_url = embedded_test_server()->GetURL(url); + GURL fetch_url = embedded_test_server()->GetURL("/echo"); + GURL fetch_url_with_fragment = embedded_test_server()->GetURL("/echo#foo"); + GURL fetch_url_with_fragment_substring = + embedded_test_server()->GetURL("/echo#afooz"); + GURL fetch_url_with_other_fragment = + embedded_test_server()->GetURL("/echo#bar"); + + EXPECT_TRUE(NavigateToURL(shell(), page_url)); + EXPECT_EQ("Echo", + EvalJs(shell(), JsReplace("fetch_from_page($1)", fetch_url))); + EXPECT_EQ("Echo", EvalJs(shell(), JsReplace("fetch_from_page($1)", + fetch_url_with_fragment))); + EXPECT_EQ("Echo", + EvalJs(shell(), JsReplace("fetch_from_page($1)", + fetch_url_with_fragment_substring))); + EXPECT_EQ("Echo", + EvalJs(shell(), JsReplace("fetch_from_page($1)", + fetch_url_with_other_fragment))); + + base::Value list(base::Value::Type::LIST); + if (expect_only_matching_filter) { + list.Append(page_url.spec()); + list.Append(fetch_url_with_fragment.spec()); + list.Append(fetch_url_with_fragment_substring.spec()); + } else { + list.Append(page_url.spec()); + list.Append(fetch_url.spec()); + list.Append(fetch_url_with_fragment.spec()); + list.Append(fetch_url_with_fragment_substring.spec()); + list.Append(fetch_url_with_other_fragment.spec()); + } + + EXPECT_EQ(list, EvalJs(shell(), script)); + } + + bool FeatureIsEnabled() { return GetParam(); } + + private: + base::test::ScopedFeatureList feature_list_; +}; + +INSTANTIATE_TEST_SUITE_P(EnabledDisabled, + ServiceWorkerSubresourceFilterBrowserTest, + testing::Bool()); + +IN_PROC_BROWSER_TEST_P(ServiceWorkerSubresourceFilterBrowserTest, WithFilter) { + // If the feature is disabled, all URLs should be seen by the Service Worker. + // If the feature is enabled, only the initial navigation URL and URLs + // matching the filter should be seen by the Service Worker. + NavigateAndFetch("/service_worker/subresource_filter.html", + FeatureIsEnabled()); +} + +IN_PROC_BROWSER_TEST_P(ServiceWorkerSubresourceFilterBrowserTest, + WithoutFilter) { + // All URLs should be seen by the Service Worker regardless of whether or not + // the feature is enabled. + NavigateAndFetch("/service_worker/fetch_from_page.html", false); +} + +IN_PROC_BROWSER_TEST_P(ServiceWorkerSubresourceFilterBrowserTest, + WithEmptyFilter) { + // All URLs should be seen by the Service Worker regardless of whether or not + // the feature is enabled. + NavigateAndFetch("/service_worker/subresource_filter_empty.html", false); +} + +} // namespace +} // namespace content \ No newline at end of file
diff --git a/content/browser/site_instance_group_manager.cc b/content/browser/site_instance_group_manager.cc index 4c97e1d7..3359840 100644 --- a/content/browser/site_instance_group_manager.cc +++ b/content/browser/site_instance_group_manager.cc
@@ -5,6 +5,7 @@ #include "content/browser/site_instance_group_manager.h" #include "base/feature_list.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/site_instance_impl.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/content_features.h"
diff --git a/content/browser/site_instance_impl.h b/content/browser/site_instance_impl.h index c3f5fb3..c439e14 100644 --- a/content/browser/site_instance_impl.h +++ b/content/browser/site_instance_impl.h
@@ -11,7 +11,6 @@ #include "base/observer_list.h" #include "content/browser/coop_coep_cross_origin_isolated_info.h" #include "content/browser/isolation_context.h" -#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/common/content_export.h" #include "content/public/browser/render_process_host_observer.h" #include "content/public/browser/site_instance.h"
diff --git a/content/browser/utility_process_sandbox_browsertest.cc b/content/browser/utility_process_sandbox_browsertest.cc index d92d008..0d1c1ca 100644 --- a/content/browser/utility_process_sandbox_browsertest.cc +++ b/content/browser/utility_process_sandbox_browsertest.cc
@@ -20,6 +20,7 @@ #include "content/public/test/test_service.mojom.h" #include "content/test/sandbox_status.test-mojom.h" #include "mojo/public/cpp/bindings/remote.h" +#include "printing/buildflags/buildflags.h" #include "sandbox/policy/linux/sandbox_linux.h" #include "sandbox/policy/switches.h" @@ -134,7 +135,9 @@ case SandboxType::kTts: #endif case SandboxType::kNetwork: +#if BUILDFLAG(ENABLE_PRINTING) case SandboxType::kPrintBackend: +#endif case SandboxType::kSpeechRecognition: { constexpr int kExpectedPartialSandboxFlags = SandboxLinux::kSeccompBPF | SandboxLinux::kYama |
diff --git a/content/browser/utility_sandbox_delegate.cc b/content/browser/utility_sandbox_delegate.cc index ea5d824..e6e51bb 100644 --- a/content/browser/utility_sandbox_delegate.cc +++ b/content/browser/utility_sandbox_delegate.cc
@@ -9,6 +9,7 @@ #include "build/chromeos_buildflags.h" #include "content/public/common/sandboxed_process_launcher_delegate.h" #include "content/public/common/zygote/zygote_buildflags.h" +#include "printing/buildflags/buildflags.h" #include "sandbox/policy/sandbox_type.h" #if BUILDFLAG(USE_ZYGOTE_HANDLE) @@ -47,7 +48,9 @@ sandbox_type_ == sandbox::policy::SandboxType::kUtility || sandbox_type_ == sandbox::policy::SandboxType::kNetwork || sandbox_type_ == sandbox::policy::SandboxType::kCdm || +#if BUILDFLAG(ENABLE_PRINTING) sandbox_type_ == sandbox::policy::SandboxType::kPrintBackend || +#endif sandbox_type_ == sandbox::policy::SandboxType::kPrintCompositor || sandbox_type_ == sandbox::policy::SandboxType::kPpapi || sandbox_type_ == sandbox::policy::SandboxType::kVideoCapture || @@ -99,7 +102,9 @@ #endif // BUILDFLAG(ENABLE_LIBASSISTANT_SANDBOX) #endif // BUILDFLAG(IS_CHROMEOS_ASH) sandbox_type_ == sandbox::policy::SandboxType::kAudio || +#if BUILDFLAG(ENABLE_PRINTING) sandbox_type_ == sandbox::policy::SandboxType::kPrintBackend || +#endif sandbox_type_ == sandbox::policy::SandboxType::kSpeechRecognition) { return GetUnsandboxedZygote(); }
diff --git a/content/browser/utility_sandbox_delegate_win.cc b/content/browser/utility_sandbox_delegate_win.cc index 42720f3..8683cd37 100644 --- a/content/browser/utility_sandbox_delegate_win.cc +++ b/content/browser/utility_sandbox_delegate_win.cc
@@ -12,6 +12,7 @@ #include "content/public/common/content_switches.h" #include "content/public/common/sandboxed_process_launcher_delegate.h" #include "media/mojo/mojom/cdm_service.mojom.h" +#include "printing/buildflags/buildflags.h" #include "sandbox/policy/features.h" #include "sandbox/policy/sandbox_type.h" #include "sandbox/policy/win/sandbox_win.h" @@ -263,10 +264,12 @@ return false; } +#if BUILDFLAG(ENABLE_PRINTING) if (sandbox_type_ == sandbox::policy::SandboxType::kPrintBackend) { if (!PrintBackendPreSpawnTarget(policy)) return false; } +#endif return GetContentClient()->browser()->PreSpawnChild( policy, sandbox_type_, ContentBrowserClient::ChildSpawnFlags::NONE);
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 7057c28..2cb5a233 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2160,7 +2160,7 @@ } bool WebContentsImpl::IsInnerWebContentsForGuest() { - return !!browser_plugin_guest_; + return IsGuest(); } void WebContentsImpl::AttachInnerWebContents( @@ -3594,7 +3594,7 @@ // if the opener is being suppressed (in a non-guest), we do not provide // a SiteInstance which causes a new one to get created in its own // BrowsingInstance. - bool is_guest = BrowserPluginGuest::IsGuest(this); + bool is_guest = IsGuest(); scoped_refptr<SiteInstance> site_instance = params.opener_suppressed && !is_guest ? nullptr : source_site_instance; @@ -3905,7 +3905,7 @@ RemoveWebContentsDestructionObserver(new_contents); // Don't initialize the guest WebContents immediately. - if (BrowserPluginGuest::IsGuest(new_contents)) + if (new_contents->IsGuest()) return result; if (!new_contents->GetMainFrame()->GetProcess()->IsInitializedAndNotDead() || @@ -6057,6 +6057,10 @@ } } +bool WebContentsImpl::IsGuest() { + return !!browser_plugin_guest_; +} + bool WebContentsImpl::IsPortal() { return portal(); }
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index f1fb20f8..95932d3 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h
@@ -844,6 +844,7 @@ bool IsJavaScriptDialogShowing() const override; bool ShouldIgnoreUnresponsiveRenderer() override; void DidFirstVisuallyNonEmptyPaint(RenderViewHostImpl* source) override; + bool IsGuest() override; void OnThemeColorChanged(RenderViewHostImpl* source) override; void OnBackgroundColorChanged(RenderViewHostImpl* source) override; void RecomputeWebPreferencesSlow() override;
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc index 6a91156..3ef2c45 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -892,7 +892,7 @@ // The use cases for WindowObserver do not apply to Browser Plugins: // 1) guests do not support NPAPI plugins. // 2) guests' window bounds are supposed to come from its embedder. - if (!BrowserPluginGuest::IsGuest(web_contents_)) + if (!web_contents_->IsGuest()) window_observer_ = std::make_unique<WindowObserver>(this); }
diff --git a/content/browser/worker_host/shared_worker_host_unittest.cc b/content/browser/worker_host/shared_worker_host_unittest.cc index 98cdec5..2f498936 100644 --- a/content/browser/worker_host/shared_worker_host_unittest.cc +++ b/content/browser/worker_host/shared_worker_host_unittest.cc
@@ -14,6 +14,7 @@ #include "base/run_loop.h" #include "content/browser/appcache/chrome_appcache_service.h" #include "content/browser/navigation_subresource_loader_params.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/service_worker/embedded_worker_test_helper.h" #include "content/browser/service_worker/service_worker_main_resource_handle.h" #include "content/browser/worker_host/mock_shared_worker.h"
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index 078fb3c..f6c94b5b 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -711,6 +711,14 @@ const base::Feature kWebOTPAssertionFeaturePolicy{ "WebOTPAssertionFeaturePolicy", base::FEATURE_DISABLED_BY_DEFAULT}; +// Experiment allowing control over what requests are intercepted by Service +// Worker fetch events. By setting a Service-Worker-Subresource-Filter HTTP +// header on the document to some string, only requests which contain a fragment +// matching the header string will be intercepted. When not set, Service Workers +// will intercept all requests, as normal. +const base::Feature kServiceWorkerSubresourceFilter{ + "ServiceWorkerSubresourceFilter", base::FEATURE_DISABLED_BY_DEFAULT}; + // Controls whether to isolate sites of documents that specify an eligible // Cross-Origin-Opener-Policy header. Note that this is only intended to be // used on Android, which does not use strict site isolation. See
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h index 9c8166d..9299582 100644 --- a/content/public/common/content_features.h +++ b/content/public/common/content_features.h
@@ -169,6 +169,7 @@ kSkipEarlyCommitPendingForCrashedFrame; CONTENT_EXPORT extern const base::Feature kWebOTP; CONTENT_EXPORT extern const base::Feature kWebOTPAssertionFeaturePolicy; +CONTENT_EXPORT extern const base::Feature kServiceWorkerSubresourceFilter; CONTENT_EXPORT extern const base::Feature kSpareRendererForSitePerProcess; CONTENT_EXPORT extern const base::Feature kStorageServiceOutOfProcess; CONTENT_EXPORT extern const base::Feature kStrictOriginIsolation;
diff --git a/content/renderer/accessibility/render_accessibility_impl.cc b/content/renderer/accessibility/render_accessibility_impl.cc index a48cb9c9..1a7b0e3ad 100644 --- a/content/renderer/accessibility/render_accessibility_impl.cc +++ b/content/renderer/accessibility/render_accessibility_impl.cc
@@ -476,9 +476,12 @@ return; #if defined(OS_ANDROID) - // Force the newly focused node to be re-serialized so we include its - // inline text boxes. - if (event.event_type == ax::mojom::Event::kFocus) + // Inline text boxes are needed to support moving by character/word/line. + // On Android, we don't load inline text boxes by default, only on-demand, or + // when part of the focused object. So, when focus moves to an editable text + // field, ensure we re-serialize the whole thing including its inline text + // boxes. + if (event.event_type == ax::mojom::Event::kFocus && obj.IsEditable()) serializer_->InvalidateSubtree(obj); #endif
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 5e1c8cf5..0621c1da 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -2870,6 +2870,19 @@ new_loader_factories->CloneWithoutAppCacheFactory())); } + if (base::FeatureList::IsEnabled(features::kServiceWorkerSubresourceFilter)) { + WebString subresource_filter = navigation_params->response.HttpHeaderField( + WebString::FromUTF8("Service-Worker-Subresource-Filter")); + if (!subresource_filter.IsEmpty()) { + ServiceWorkerNetworkProviderForFrame* provider = + static_cast<ServiceWorkerNetworkProviderForFrame*>( + navigation_params->service_worker_network_provider.get()); + DCHECK(provider); + + provider->context()->SetSubresourceFilter(subresource_filter.Utf8()); + } + } + DCHECK(!pending_loader_factories_); pending_loader_factories_ = std::move(new_loader_factories);
diff --git a/content/renderer/service_worker/service_worker_network_provider_for_frame.cc b/content/renderer/service_worker/service_worker_network_provider_for_frame.cc index a3ac1fcb..095684d0 100644 --- a/content/renderer/service_worker/service_worker_network_provider_for_frame.cc +++ b/content/renderer/service_worker/service_worker_network_provider_for_frame.cc
@@ -6,8 +6,10 @@ #include <utility> +#include "base/feature_list.h" #include "base/memory/ptr_util.h" #include "content/common/service_worker/service_worker_utils.h" +#include "content/public/common/content_features.h" #include "content/public/common/origin_util.h" #include "content/public/renderer/render_frame_observer.h" #include "content/renderer/render_frame_impl.h" @@ -86,7 +88,9 @@ } ServiceWorkerNetworkProviderForFrame::ServiceWorkerNetworkProviderForFrame( - RenderFrameImpl* frame) { + RenderFrameImpl* frame) + : service_worker_subresource_filter_enabled_(base::FeatureList::IsEnabled( + features::kServiceWorkerSubresourceFilter)) { if (frame) observer_ = std::make_unique<NewDocumentObserver>(this, frame); } @@ -136,6 +140,16 @@ if (request.GetSkipServiceWorker()) return nullptr; + if (service_worker_subresource_filter_enabled_) { + std::string subresource_filter = context()->subresource_filter(); + // If the document has a subresource filter set and the requested URL does + // not match it, do not intercept the request. + if (!subresource_filter.empty() && + gurl.ref().find(subresource_filter) == std::string::npos) { + return nullptr; + } + } + // Record use counter for intercepting requests from opaque stylesheets. // TODO(crbug.com/898497): Remove this feature usage once we have enough data. if (observer_ && request.IsFromOriginDirtyStyleSheet()) {
diff --git a/content/renderer/service_worker/service_worker_network_provider_for_frame.h b/content/renderer/service_worker/service_worker_network_provider_for_frame.h index d0dfc1c..3cb042a 100644 --- a/content/renderer/service_worker/service_worker_network_provider_for_frame.h +++ b/content/renderer/service_worker/service_worker_network_provider_for_frame.h
@@ -76,6 +76,8 @@ scoped_refptr<ServiceWorkerProviderContext> context_; std::unique_ptr<NewDocumentObserver> observer_; + + const bool service_worker_subresource_filter_enabled_ = false; }; } // namespace content
diff --git a/content/renderer/service_worker/service_worker_provider_context.h b/content/renderer/service_worker/service_worker_provider_context.h index 06f1c03..e300e330 100644 --- a/content/renderer/service_worker/service_worker_provider_context.h +++ b/content/renderer/service_worker/service_worker_provider_context.h
@@ -198,6 +198,12 @@ const override; const blink::WebString client_id() const override; + std::string subresource_filter() const { return subresource_filter_; } + void SetSubresourceFilter(const std::string& filter) { + CountFeature(blink::mojom::WebFeature::kServiceWorkerSubresourceFilter); + subresource_filter_ = filter; + } + private: friend class base::DeleteHelper<ServiceWorkerProviderContext>; friend class base::RefCountedThreadSafe<ServiceWorkerProviderContext, @@ -328,6 +334,8 @@ bool sent_execution_ready_ = false; + std::string subresource_filter_; + // Contains pending receivers whose corresponding requests are still // in-flight. The pending receivers are taken by // TakePendingWorkerTimingReceiver() when the request is completed.
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 320ce9b..2bff271 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -16,6 +16,7 @@ import("//mojo/public/tools/bindings/mojom.gni") import("//net/features.gni") import("//ppapi/buildflags/buildflags.gni") +import("//printing/buildflags/buildflags.gni") import("//testing/test.gni") import("//third_party/blink/public/public_features.gni") import("//third_party/closure_compiler/closure_args.gni") @@ -1201,6 +1202,7 @@ "../browser/service_worker/service_worker_no_best_effort_tasks_browsertest.cc", "../browser/service_worker/service_worker_offline_capability_check_browsertest.cc", "../browser/service_worker/service_worker_process_browsertest.cc", + "../browser/service_worker/service_worker_subresource_filter_browsertest.cc", "../browser/service_worker/service_worker_version_browsertest.cc", "../browser/session_history_browsertest.cc", "../browser/shape_detection/shape_detection_browsertest.cc", @@ -1518,7 +1520,10 @@ "../browser/utility_process_sandbox_browsertest.cc", "../browser/zygote_host/zygote_browsertest.cc", ] - deps += [ "//ui/gfx:test_support" ] + deps += [ + "//printing/buildflags", + "//ui/gfx:test_support", + ] if (use_atk) { sources += [ @@ -2336,7 +2341,6 @@ "//net:test_support", "//ppapi/buildflags", "//ppapi/c", - "//printing", "//services/audio/public/cpp:test_support", "//services/audio/public/mojom", "//services/data_decoder/public/cpp:test_support", @@ -2411,6 +2415,10 @@ deps += [ "//components/crash/content/browser/error_reporting" ] } + if (enable_basic_printing) { + deps += [ "//printing" ] + } + if (enable_plugins) { sources += [ "../browser/renderer_host/pepper/browser_ppapi_host_test.cc",
diff --git a/content/test/data/service_worker/subresource_filter.html b/content/test/data/service_worker/subresource_filter.html new file mode 100644 index 0000000..d83213b --- /dev/null +++ b/content/test/data/service_worker/subresource_filter.html
@@ -0,0 +1,16 @@ +<html> +<title>subresource filter</title> + +<body>this page is for registering a subresource filter via the corresponding mock http header file</body> +<script> + async function fetch_from_page(url) { + try { + const response = await fetch(url); + return await response.text(); + } catch (error) { + return `${error}`; + } + } +</script> + +</html> \ No newline at end of file
diff --git a/content/test/data/service_worker/subresource_filter.html.mock-http-headers b/content/test/data/service_worker/subresource_filter.html.mock-http-headers new file mode 100644 index 0000000..c163927 --- /dev/null +++ b/content/test/data/service_worker/subresource_filter.html.mock-http-headers
@@ -0,0 +1,2 @@ +HTTP/1.1 200 OK +Service-Worker-Subresource-Filter: foo
diff --git a/content/test/data/service_worker/subresource_filter_empty.html b/content/test/data/service_worker/subresource_filter_empty.html new file mode 100644 index 0000000..d83213b --- /dev/null +++ b/content/test/data/service_worker/subresource_filter_empty.html
@@ -0,0 +1,16 @@ +<html> +<title>subresource filter</title> + +<body>this page is for registering a subresource filter via the corresponding mock http header file</body> +<script> + async function fetch_from_page(url) { + try { + const response = await fetch(url); + return await response.text(); + } catch (error) { + return `${error}`; + } + } +</script> + +</html> \ No newline at end of file
diff --git a/content/test/data/service_worker/subresource_filter_empty.html.mock-http-headers b/content/test/data/service_worker/subresource_filter_empty.html.mock-http-headers new file mode 100644 index 0000000..9d4bba1 --- /dev/null +++ b/content/test/data/service_worker/subresource_filter_empty.html.mock-http-headers
@@ -0,0 +1,2 @@ +HTTP/1.1 200 OK +Service-Worker-Subresource-Filter:
diff --git a/content/test/gpu/gpu_tests/test_expectations/context_lost_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/context_lost_expectations.txt index 167e1f97..ff09da3 100644 --- a/content/test/gpu/gpu_tests/test_expectations/context_lost_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/context_lost_expectations.txt
@@ -22,7 +22,7 @@ # release release-x64 ] # GPU # tags: [ amd amd-0x6613 amd-0x679e amd-0x6821 amd-0x7340 -# apple apple-apple-m1 apple-metal-renderer:-apple-m1 +# apple apple-apple-m1 apple-angle-metal-renderer:-apple-m1 # arm # google google-0xffff # intel intel-0xa2e intel-0xd26 intel-0xa011 intel-0x3e92 intel-0x3e9b
diff --git a/content/test/gpu/gpu_tests/test_expectations/depth_capture_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/depth_capture_expectations.txt index f74ff2c..5af2f88 100644 --- a/content/test/gpu/gpu_tests/test_expectations/depth_capture_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/depth_capture_expectations.txt
@@ -22,7 +22,7 @@ # release release-x64 ] # GPU # tags: [ amd amd-0x6613 amd-0x679e amd-0x6821 amd-0x7340 -# apple apple-apple-m1 apple-metal-renderer:-apple-m1 +# apple apple-apple-m1 apple-angle-metal-renderer:-apple-m1 # arm # google google-0xffff # intel intel-0xa2e intel-0xd26 intel-0xa011 intel-0x3e92 intel-0x3e9b
diff --git a/content/test/gpu/gpu_tests/test_expectations/gpu_process_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/gpu_process_expectations.txt index 897a5f7..87168af 100644 --- a/content/test/gpu/gpu_tests/test_expectations/gpu_process_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/gpu_process_expectations.txt
@@ -22,7 +22,7 @@ # release release-x64 ] # GPU # tags: [ amd amd-0x6613 amd-0x679e amd-0x6821 amd-0x7340 -# apple apple-apple-m1 apple-metal-renderer:-apple-m1 +# apple apple-apple-m1 apple-angle-metal-renderer:-apple-m1 # arm # google google-0xffff # intel intel-0xa2e intel-0xd26 intel-0xa011 intel-0x3e92 intel-0x3e9b
diff --git a/content/test/gpu/gpu_tests/test_expectations/hardware_accelerated_feature_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/hardware_accelerated_feature_expectations.txt index 2f248cc..2dc6367 100644 --- a/content/test/gpu/gpu_tests/test_expectations/hardware_accelerated_feature_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/hardware_accelerated_feature_expectations.txt
@@ -22,7 +22,7 @@ # release release-x64 ] # GPU # tags: [ amd amd-0x6613 amd-0x679e amd-0x6821 amd-0x7340 -# apple apple-apple-m1 apple-metal-renderer:-apple-m1 +# apple apple-apple-m1 apple-angle-metal-renderer:-apple-m1 # arm # google google-0xffff # intel intel-0xa2e intel-0xd26 intel-0xa011 intel-0x3e92 intel-0x3e9b
diff --git a/content/test/gpu/gpu_tests/test_expectations/info_collection_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/info_collection_expectations.txt index d6d690f7..7f242c9 100644 --- a/content/test/gpu/gpu_tests/test_expectations/info_collection_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/info_collection_expectations.txt
@@ -22,7 +22,7 @@ # release release-x64 ] # GPU # tags: [ amd amd-0x6613 amd-0x679e amd-0x6821 amd-0x7340 -# apple apple-apple-m1 apple-metal-renderer:-apple-m1 +# apple apple-apple-m1 apple-angle-metal-renderer:-apple-m1 # arm # google google-0xffff # intel intel-0xa2e intel-0xd26 intel-0xa011 intel-0x3e92 intel-0x3e9b
diff --git a/content/test/gpu/gpu_tests/test_expectations/maps_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/maps_expectations.txt index b8221a20..568efb34 100644 --- a/content/test/gpu/gpu_tests/test_expectations/maps_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/maps_expectations.txt
@@ -22,7 +22,7 @@ # release release-x64 ] # GPU # tags: [ amd amd-0x6613 amd-0x679e amd-0x6821 amd-0x7340 -# apple apple-apple-m1 apple-metal-renderer:-apple-m1 +# apple apple-apple-m1 apple-angle-metal-renderer:-apple-m1 # arm # google google-0xffff # intel intel-0xa2e intel-0xd26 intel-0xa011 intel-0x3e92 intel-0x3e9b
diff --git a/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt index a8f46c78..dd31e7247 100644 --- a/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt
@@ -22,7 +22,7 @@ # release release-x64 ] # GPU # tags: [ amd amd-0x6613 amd-0x679e amd-0x6821 amd-0x7340 -# apple apple-apple-m1 apple-metal-renderer:-apple-m1 +# apple apple-apple-m1 apple-angle-metal-renderer:-apple-m1 # arm # google google-0xffff # intel intel-0xa2e intel-0xd26 intel-0xa011 intel-0x3e92 intel-0x3e9b
diff --git a/content/test/gpu/gpu_tests/test_expectations/power_measurement_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/power_measurement_expectations.txt index af0a2ca..738670f 100644 --- a/content/test/gpu/gpu_tests/test_expectations/power_measurement_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/power_measurement_expectations.txt
@@ -22,7 +22,7 @@ # release release-x64 ] # GPU # tags: [ amd amd-0x6613 amd-0x679e amd-0x6821 amd-0x7340 -# apple apple-apple-m1 apple-metal-renderer:-apple-m1 +# apple apple-apple-m1 apple-angle-metal-renderer:-apple-m1 # arm # google google-0xffff # intel intel-0xa2e intel-0xd26 intel-0xa011 intel-0x3e92 intel-0x3e9b
diff --git a/content/test/gpu/gpu_tests/test_expectations/screenshot_sync_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/screenshot_sync_expectations.txt index 48a2ff6e..bc1f07b6 100644 --- a/content/test/gpu/gpu_tests/test_expectations/screenshot_sync_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/screenshot_sync_expectations.txt
@@ -22,7 +22,7 @@ # release release-x64 ] # GPU # tags: [ amd amd-0x6613 amd-0x679e amd-0x6821 amd-0x7340 -# apple apple-apple-m1 apple-metal-renderer:-apple-m1 +# apple apple-apple-m1 apple-angle-metal-renderer:-apple-m1 # arm # google google-0xffff # intel intel-0xa2e intel-0xd26 intel-0xa011 intel-0x3e92 intel-0x3e9b
diff --git a/content/test/gpu/gpu_tests/test_expectations/trace_test_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/trace_test_expectations.txt index fdecb41..7485631 100644 --- a/content/test/gpu/gpu_tests/test_expectations/trace_test_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/trace_test_expectations.txt
@@ -22,7 +22,7 @@ # release release-x64 ] # GPU # tags: [ amd amd-0x6613 amd-0x679e amd-0x6821 amd-0x7340 -# apple apple-apple-m1 apple-metal-renderer:-apple-m1 +# apple apple-apple-m1 apple-angle-metal-renderer:-apple-m1 # arm # google google-0xffff # intel intel-0xa2e intel-0xd26 intel-0xa011 intel-0x3e92 intel-0x3e9b
diff --git a/content/test/gpu/gpu_tests/test_expectations/webcodecs_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/webcodecs_expectations.txt index 991da643..adf4dad 100644 --- a/content/test/gpu/gpu_tests/test_expectations/webcodecs_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/webcodecs_expectations.txt
@@ -22,7 +22,7 @@ # release release-x64 ] # GPU # tags: [ amd amd-0x6613 amd-0x679e amd-0x6821 amd-0x7340 -# apple apple-apple-m1 apple-metal-renderer:-apple-m1 +# apple apple-apple-m1 apple-angle-metal-renderer:-apple-m1 # arm # google google-0xffff # intel intel-0xa2e intel-0xd26 intel-0xa011 intel-0x3e92 intel-0x3e9b
diff --git a/content/test/gpu/gpu_tests/test_expectations/webgl2_conformance_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/webgl2_conformance_expectations.txt index 46ceea9..c1bf7397 100644 --- a/content/test/gpu/gpu_tests/test_expectations/webgl2_conformance_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/webgl2_conformance_expectations.txt
@@ -22,7 +22,7 @@ # release release-x64 ] # GPU # tags: [ amd amd-0x6613 amd-0x679e amd-0x6821 amd-0x7340 -# apple apple-apple-m1 apple-metal-renderer:-apple-m1 +# apple apple-apple-m1 apple-angle-metal-renderer:-apple-m1 # arm # google google-0xffff # intel intel-0xa2e intel-0xd26 intel-0xa011 intel-0x3e92 intel-0x3e9b
diff --git a/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt index 00da585..b86472d 100644 --- a/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt
@@ -22,7 +22,7 @@ # release release-x64 ] # GPU # tags: [ amd amd-0x6613 amd-0x679e amd-0x6821 amd-0x7340 -# apple apple-apple-m1 apple-metal-renderer:-apple-m1 +# apple apple-apple-m1 apple-angle-metal-renderer:-apple-m1 # arm # google google-0xffff # intel intel-0xa2e intel-0xd26 intel-0xa011 intel-0x3e92 intel-0x3e9b @@ -485,14 +485,14 @@ # TODO(crbug.com/1153984): remove the expectations with the incorrect GPU type for the Metal backend. # finder:disable Want to keep both sets of expectations around until the issue is fixed. crbug.com/1130758 [ mac apple-apple-m1 ] conformance/extensions/webgl-depth-texture.html [ Failure ] -crbug.com/1130758 [ mac apple-metal-renderer:-apple-m1 ] conformance/extensions/webgl-depth-texture.html [ Failure ] +crbug.com/1130758 [ mac apple-angle-metal-renderer:-apple-m1 ] conformance/extensions/webgl-depth-texture.html [ Failure ] crbug.com/1130759 [ mac apple-apple-m1 angle-metal ] conformance/rendering/rendering-stencil-large-viewport.html [ Failure ] -crbug.com/1130759 [ mac apple-metal-renderer:-apple-m1 angle-metal ] conformance/rendering/rendering-stencil-large-viewport.html [ Failure ] +crbug.com/1130759 [ mac apple-angle-metal-renderer:-apple-m1 angle-metal ] conformance/rendering/rendering-stencil-large-viewport.html [ Failure ] crbug.com/1130759 [ mac apple-apple-m1 angle-metal ] conformance/textures/misc/texture-mips.html [ Failure ] crbug.com/1130760 [ mac apple-apple-m1 angle-metal ] conformance/extensions/webgl-draw-buffers.html [ Failure ] -crbug.com/1130760 [ mac apple-metal-renderer:-apple-m1 angle-metal ] conformance/extensions/webgl-draw-buffers.html [ Failure ] +crbug.com/1130760 [ mac apple-angle-metal-renderer:-apple-m1 angle-metal ] conformance/extensions/webgl-draw-buffers.html [ Failure ] crbug.com/1130760 [ mac apple-apple-m1 angle-metal ] conformance/ogles/GL/discard/discard_001_to_002.html [ Failure ] -crbug.com/1130760 [ mac apple-metal-renderer:-apple-m1 angle-metal ] conformance/ogles/GL/discard/discard_001_to_002.html [ Failure ] +crbug.com/1130760 [ mac apple-angle-metal-renderer:-apple-m1 angle-metal ] conformance/ogles/GL/discard/discard_001_to_002.html [ Failure ] crbug.com/1141066 [ mac apple-apple-m1 angle-opengl passthrough ] conformance/textures/misc/texture-copying-and-deletion.html [ Failure ] crbug.com/1141066 [ mac apple-apple-m1 angle-opengl passthrough ] conformance/textures/misc/texture-copying-feedback-loops.html [ Failure ] # finder:enable @@ -682,6 +682,7 @@ crbug.com/1175226 [ android android-pixel-4 no-passthrough no-swiftshader-gl ] conformance/rendering/blending.html [ Failure ] crbug.com/1179432 [ android android-pixel-4 no-passthrough ] conformance/rendering/polygon-offset.html [ RetryOnFailure ] crbug.com/1191030 [ android android-pixel-4 ] conformance/textures/misc/video-rotation.html [ Failure ] +crbug.com/1187332 [ android android-pixel-4 ] conformance/textures/misc/texture-corner-case-videos.html [ RetryOnFailure ] # Misc failures crbug.com/angleproject/2988 [ android angle-opengles ] conformance/context/context-size-change.html [ Failure ]
diff --git a/content/test/gpu/validate_tag_consistency.py b/content/test/gpu/validate_tag_consistency.py index 02e31c5..5f04c9c 100755 --- a/content/test/gpu/validate_tag_consistency.py +++ b/content/test/gpu/validate_tag_consistency.py
@@ -33,7 +33,7 @@ # release release-x64 ] # GPU # tags: [ amd amd-0x6613 amd-0x679e amd-0x6821 amd-0x7340 -# apple apple-apple-m1 apple-metal-renderer:-apple-m1 +# apple apple-apple-m1 apple-angle-metal-renderer:-apple-m1 # arm # google google-0xffff # intel intel-0xa2e intel-0xd26 intel-0xa011 intel-0x3e92 intel-0x3e9b
diff --git a/content/utility/BUILD.gn b/content/utility/BUILD.gn index 62d4fdb..4b6a6cd4 100644 --- a/content/utility/BUILD.gn +++ b/content/utility/BUILD.gn
@@ -6,6 +6,7 @@ import("//chromeos/assistant/assistant.gni") import("//device/vr/buildflags/buildflags.gni") import("//media/media_options.gni") +import("//printing/buildflags/buildflags.gni") source_set("utility") { # Only the public target should depend on this. All other targets (even @@ -49,6 +50,7 @@ "//media:media_buildflags", "//mojo/public/cpp/bindings", "//net", + "//printing/buildflags", "//sandbox", "//services/audio", "//services/data_decoder:lib", @@ -103,9 +105,11 @@ if (is_linux || is_chromeos) { deps += [ "//content/utility/speech:speech_recognition_sandbox_hook", - "//printing:printing_sandbox_hook", "//services/network:network_sandbox_hook", ] + if (enable_basic_printing) { + deps += [ "//printing:printing_sandbox_hook" ] + } } if (enable_vr && !is_android) {
diff --git a/content/utility/utility_main.cc b/content/utility/utility_main.cc index ee7e1cde..30fd82d 100644 --- a/content/utility/utility_main.cc +++ b/content/utility/utility_main.cc
@@ -23,6 +23,7 @@ #include "content/public/common/sandbox_init.h" #include "content/public/utility/content_utility_client.h" #include "content/utility/utility_thread_impl.h" +#include "printing/buildflags/buildflags.h" #include "sandbox/policy/sandbox.h" #include "services/tracing/public/cpp/trace_startup.h" #include "third_party/icu/source/common/unicode/unistr.h" @@ -30,7 +31,9 @@ #if defined(OS_LINUX) || defined(OS_CHROMEOS) #include "content/utility/speech/speech_recognition_sandbox_hook_linux.h" +#if BUILDFLAG(ENABLE_PRINTING) #include "printing/sandbox/print_backend_sandbox_hook_linux.h" +#endif #include "sandbox/policy/linux/sandbox_linux.h" #include "services/audio/audio_sandbox_hook_linux.h" #include "services/network/network_sandbox_hook_linux.h" @@ -118,14 +121,18 @@ sandbox_type == sandbox::policy::SandboxType::kLibassistant || #endif // BUILDFLAG(ENABLE_LIBASSISTANT_SANDBOX) #endif // BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(ENABLE_PRINTING) sandbox_type == sandbox::policy::SandboxType::kPrintBackend || +#endif sandbox_type == sandbox::policy::SandboxType::kAudio || sandbox_type == sandbox::policy::SandboxType::kSpeechRecognition) { sandbox::policy::SandboxLinux::PreSandboxHook pre_sandbox_hook; if (sandbox_type == sandbox::policy::SandboxType::kNetwork) pre_sandbox_hook = base::BindOnce(&network::NetworkPreSandboxHook); +#if BUILDFLAG(ENABLE_PRINTING) else if (sandbox_type == sandbox::policy::SandboxType::kPrintBackend) pre_sandbox_hook = base::BindOnce(&printing::PrintBackendPreSandboxHook); +#endif // BUILDFLAG(ENABLE_PRINTING) else if (sandbox_type == sandbox::policy::SandboxType::kAudio) pre_sandbox_hook = base::BindOnce(&audio::AudioPreSandboxHook); else if (sandbox_type == sandbox::policy::SandboxType::kSpeechRecognition)
diff --git a/content/web_test/BUILD.gn b/content/web_test/BUILD.gn index a8140316..f42c2a9 100644 --- a/content/web_test/BUILD.gn +++ b/content/web_test/BUILD.gn
@@ -6,6 +6,7 @@ import("//build/config/ui.gni") # For the use_x11 and toolkit_views variables. import("//mojo/public/tools/bindings/mojom.gni") import("//ppapi/buildflags/buildflags.gni") # For the enable_plugins variable. +import("//printing/buildflags/buildflags.gni") if (is_android) { import("//build/config/android/config.gni") @@ -246,8 +247,6 @@ "renderer/gc_controller.h", "renderer/layout_dump.cc", "renderer/layout_dump.h", - "renderer/pixel_dump.cc", - "renderer/pixel_dump.h", "renderer/spell_check_client.cc", "renderer/spell_check_client.h", "renderer/test_plugin.cc", @@ -294,7 +293,10 @@ "//gpu", "//gpu/command_buffer/client:gles2_interface", "//media/capture", - "//printing", + "//printing/buildflags", + + # TODO(crbug.com/1200443) Remove //printing/mojom requirement coming from + # //third_party/blink/public:blink_headers. "//printing/mojom", "//services/device/public/mojom", "//services/service_manager/public/cpp", @@ -316,4 +318,12 @@ "//url", "//v8", ] + + if (enable_basic_printing) { + sources += [ + "renderer/pixel_dump.cc", + "renderer/pixel_dump.h", + ] + deps += [ "//printing" ] + } }
diff --git a/content/web_test/renderer/test_runner.cc b/content/web_test/renderer/test_runner.cc index a6ab270..6248697 100644 --- a/content/web_test/renderer/test_runner.cc +++ b/content/web_test/renderer/test_runner.cc
@@ -42,6 +42,7 @@ #include "gin/wrappable.h" #include "mojo/public/mojom/base/text_direction.mojom-forward.h" #include "net/base/filename_util.h" +#include "printing/buildflags/buildflags.h" #include "services/network/public/mojom/cors.mojom.h" #include "third_party/blink/public/common/page/page_zoom.h" #include "third_party/blink/public/common/permissions/permission_utils.h" @@ -242,7 +243,9 @@ void AddWebPageOverlay(); void AllowPointerLock(); void SetHighlightAds(); +#if BUILDFLAG(ENABLE_PRINTING) void CapturePrintingPixelsThen(v8::Local<v8::Function> callback); +#endif void CheckForLeakedWindows(); void ClearAllDatabases(); void ClearTrustTokenState(v8::Local<v8::Function> callback); @@ -511,8 +514,10 @@ // Permits the adding of only one opaque overlay. May only be called from // inside the main frame. .SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay) +#if BUILDFLAG(ENABLE_PRINTING) .SetMethod("capturePrintingPixelsThen", &TestRunnerBindings::CapturePrintingPixelsThen) +#endif // If the test will be closing its windows explicitly, and wants to look // for leaks due to those windows closing incorrectly, it can specify this // to avoid having them closed at the end of the test before the leak @@ -1883,6 +1888,7 @@ base::BindOnce(GetManifestReply, WrapV8Callback(std::move(v8_callback)))); } +#if BUILDFLAG(ENABLE_PRINTING) void TestRunnerBindings::CapturePrintingPixelsThen( v8::Local<v8::Function> v8_callback) { if (invalid_) @@ -1902,6 +1908,7 @@ ConvertBitmapToV8(context_scope, bitmap), }); } +#endif // BUILDFLAG(ENABLE_PRINTING) void TestRunnerBindings::CheckForLeakedWindows() { if (invalid_) @@ -2452,6 +2459,7 @@ return bitmap; } +#if BUILDFLAG(ENABLE_PRINTING) blink::WebLocalFrame* target_frame = main_frame; std::string frame_name = web_test_runtime_flags_.printing_frame(); if (!frame_name.empty()) { @@ -2461,6 +2469,10 @@ target_frame = frame_to_print->ToWebLocalFrame(); } return PrintFrameToBitmap(target_frame); +#else + NOTREACHED(); + return SkBitmap(); +#endif } void TestRunner::ReplicateWebTestRuntimeFlagsChanges(
diff --git a/device/bluetooth/adapter.cc b/device/bluetooth/adapter.cc index 7ec20cb..0bc0b424 100644 --- a/device/bluetooth/adapter.cc +++ b/device/bluetooth/adapter.cc
@@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/memory/ptr_util.h" +#include "base/metrics/histogram_functions.h" #include "build/build_config.h" #include "device/bluetooth/advertisement.h" #include "device/bluetooth/bluetooth_socket.h" @@ -39,12 +40,36 @@ } // namespace +Adapter::ConnectToServiceRequestDetails::ConnectToServiceRequestDetails( + const std::string& address, + const device::BluetoothUUID& service_uuid, + const base::Time& time_requested, + ConnectToServiceInsecurelyCallback callback) + : address(address), + service_uuid(service_uuid), + time_requested(time_requested), + callback(std::move(callback)) {} + +Adapter::ConnectToServiceRequestDetails::~ConnectToServiceRequestDetails() = + default; + Adapter::Adapter(scoped_refptr<device::BluetoothAdapter> adapter) : adapter_(std::move(adapter)) { adapter_->AddObserver(this); } Adapter::~Adapter() { + for (auto& entry : connect_to_service_request_map_) { + base::UmaHistogramMediumTimes( + "Bluetooth.Mojo.PendingConnectAtShutdown." + "DurationWaiting", + base::Time::Now() - entry.second->time_requested); + } + base::UmaHistogramCounts100( + "Bluetooth.Mojo.PendingConnectAtShutdown." + "NumberOfServiceDiscoveriesInProgress", + connect_to_service_requests_pending_discovery_.size()); + adapter_->RemoveObserver(this); adapter_ = nullptr; } @@ -199,26 +224,29 @@ } auto* device = adapter_->GetDevice(address); + int request_id = next_request_id_++; + connect_to_service_request_map_.emplace( + request_id, + std::make_unique<ConnectToServiceRequestDetails>( + address, service_uuid, base::Time::Now(), std::move(callback))); + if (device) { - OnDeviceFetchedForInsecureServiceConnection(service_uuid, - std::move(callback), device); + OnDeviceFetchedForInsecureServiceConnection(request_id, device); return; } // This device has neither been discovered, nor has it been paired/connected // to previously. Use the ConnectDevice() API, if available, to connect to it. #if defined(OS_CHROMEOS) || defined(OS_LINUX) - auto split_callback = base::SplitOnceCallback(std::move(callback)); adapter_->ConnectDevice( address, /*address_type=*/base::nullopt, base::BindOnce(&Adapter::OnDeviceFetchedForInsecureServiceConnection, - weak_ptr_factory_.GetWeakPtr(), service_uuid, - std::move(split_callback.first)), - base::BindOnce( - &Adapter::OnConnectToServiceError, weak_ptr_factory_.GetWeakPtr(), - std::move(split_callback.second), kCannotConnectToDeviceError)); + weak_ptr_factory_.GetWeakPtr(), request_id), + base::BindOnce(&Adapter::OnConnectToServiceError, + weak_ptr_factory_.GetWeakPtr(), request_id, + kCannotConnectToDeviceError)); #else - OnConnectToServiceError(std::move(callback), "Device does not exist."); + OnConnectToServiceError(request_id, "Device does not exist."); #endif } @@ -321,11 +349,12 @@ } void Adapter::OnDeviceFetchedForInsecureServiceConnection( - const device::BluetoothUUID& service_uuid, - ConnectToServiceInsecurelyCallback callback, + int request_id, device::BluetoothDevice* device) { + DCHECK(connect_to_service_request_map_.contains(request_id)); + if (!device) { - std::move(callback).Run(/*result=*/nullptr); + ExecuteConnectToServiceCallback(request_id, /*result=*/nullptr); return; } @@ -337,32 +366,28 @@ // services). That means attempting ConnectToServiceInsecurely() right now // would fail with an "InProgress" error. Wait for GattServicesDiscovered() // to be called to signal that ConnectToServiceInsecurely() can be called. - pending_connect_to_service_args_.emplace_back( - device->GetAddress(), service_uuid, std::move(callback)); + connect_to_service_requests_pending_discovery_.push_back(request_id); return; } - auto split_callback = base::SplitOnceCallback(std::move(callback)); device->ConnectToServiceInsecurely( - service_uuid, + connect_to_service_request_map_[request_id]->service_uuid, base::BindOnce(&Adapter::OnConnectToService, - weak_ptr_factory_.GetWeakPtr(), - std::move(split_callback.first)), + weak_ptr_factory_.GetWeakPtr(), request_id), base::BindOnce(&Adapter::OnConnectToServiceError, - weak_ptr_factory_.GetWeakPtr(), - std::move(split_callback.second))); + weak_ptr_factory_.GetWeakPtr(), request_id)); } void Adapter::ProcessPendingInsecureServiceConnectionRequest( const std::string& address, device::BluetoothDevice* device) { - auto it = pending_connect_to_service_args_.begin(); - while (it != pending_connect_to_service_args_.end()) { - if (address == std::get<0>(*it)) { - OnDeviceFetchedForInsecureServiceConnection( - /*service_uuid=*/std::get<1>(*it), - /*callback=*/std::move(std::get<2>(*it)), device); - it = pending_connect_to_service_args_.erase(it); + auto it = connect_to_service_requests_pending_discovery_.begin(); + while (it != connect_to_service_requests_pending_discovery_.end()) { + auto request_it = connect_to_service_request_map_.find(*it); + DCHECK(request_it != connect_to_service_request_map_.end()); + if (address == request_it->second->address) { + OnDeviceFetchedForInsecureServiceConnection(*it, device); + it = connect_to_service_requests_pending_discovery_.erase(it); } else { ++it; } @@ -433,7 +458,7 @@ } void Adapter::OnConnectToService( - ConnectToServiceInsecurelyCallback callback, + int request_id, scoped_refptr<device::BluetoothSocket> socket) { mojo::ScopedDataPipeProducerHandle receive_pipe_producer_handle; mojo::ScopedDataPipeConsumerHandle receive_pipe_consumer_handle; @@ -441,9 +466,9 @@ mojo::CreateDataPipe(/*options=*/nullptr, receive_pipe_producer_handle, receive_pipe_consumer_handle); if (result != MOJO_RESULT_OK) { - socket->Disconnect(base::BindOnce( - &Adapter::OnConnectToServiceError, weak_ptr_factory_.GetWeakPtr(), - std::move(callback), kMojoReceivingPipeError)); + socket->Disconnect(base::BindOnce(&Adapter::OnConnectToServiceError, + weak_ptr_factory_.GetWeakPtr(), + request_id, kMojoReceivingPipeError)); return; } @@ -452,9 +477,9 @@ result = mojo::CreateDataPipe(/*options=*/nullptr, send_pipe_producer_handle, send_pipe_consumer_handle); if (result != MOJO_RESULT_OK) { - socket->Disconnect(base::BindOnce( - &Adapter::OnConnectToServiceError, weak_ptr_factory_.GetWeakPtr(), - std::move(callback), kMojoSendingPipeError)); + socket->Disconnect(base::BindOnce(&Adapter::OnConnectToServiceError, + weak_ptr_factory_.GetWeakPtr(), + request_id, kMojoSendingPipeError)); return; } @@ -471,7 +496,8 @@ connect_to_service_result->receive_stream = std::move(receive_pipe_consumer_handle); connect_to_service_result->send_stream = std::move(send_pipe_producer_handle); - std::move(callback).Run(std::move(connect_to_service_result)); + ExecuteConnectToServiceCallback(request_id, + std::move(connect_to_service_result)); #if defined(OS_CHROMEOS) || defined(OS_LINUX) RecordConnectToServiceInsecurelyResult( @@ -479,11 +505,10 @@ #endif } -void Adapter::OnConnectToServiceError( - ConnectToServiceInsecurelyCallback callback, - const std::string& message) { +void Adapter::OnConnectToServiceError(int request_id, + const std::string& message) { DLOG(ERROR) << "Failed to connect to service: '" << message << "'"; - std::move(callback).Run(/*result=*/nullptr); + ExecuteConnectToServiceCallback(request_id, /*result=*/nullptr); #if defined(OS_CHROMEOS) || defined(OS_LINUX) base::Optional<ConnectToServiceInsecurelyResult> result = @@ -523,4 +548,14 @@ std::move(callback).Run(/*server_socket=*/mojo::NullRemote()); } +void Adapter::ExecuteConnectToServiceCallback( + int request_id, + mojom::ConnectToServiceResultPtr result) { + auto it = connect_to_service_request_map_.find(request_id); + DCHECK(it != connect_to_service_request_map_.end()); + + std::move(it->second->callback).Run(std::move(result)); + connect_to_service_request_map_.erase(it); +} + } // namespace bluetooth
diff --git a/device/bluetooth/adapter.h b/device/bluetooth/adapter.h index faf71c3..8fc3865 100644 --- a/device/bluetooth/adapter.h +++ b/device/bluetooth/adapter.h
@@ -80,9 +80,21 @@ void AllowConnectionsForUuid(const device::BluetoothUUID& service_uuid); private: + struct ConnectToServiceRequestDetails { + ConnectToServiceRequestDetails(const std::string& address, + const device::BluetoothUUID& service_uuid, + const base::Time& time_requested, + ConnectToServiceInsecurelyCallback callback); + ~ConnectToServiceRequestDetails(); + + std::string address; + device::BluetoothUUID service_uuid; + base::Time time_requested; + ConnectToServiceInsecurelyCallback callback; + }; + void OnDeviceFetchedForInsecureServiceConnection( - const device::BluetoothUUID& service_uuid, - ConnectToServiceInsecurelyCallback callback, + int request_id, device::BluetoothDevice* device); void ProcessPendingInsecureServiceConnectionRequest( const std::string& address, @@ -112,10 +124,9 @@ std::unique_ptr<device::BluetoothDiscoverySession> session); void OnDiscoverySessionError(StartDiscoverySessionCallback callback); - void OnConnectToService(ConnectToServiceInsecurelyCallback callback, + void OnConnectToService(int request_id, scoped_refptr<device::BluetoothSocket> socket); - void OnConnectToServiceError(ConnectToServiceInsecurelyCallback callback, - const std::string& message); + void OnConnectToServiceError(int request_id, const std::string& message); void OnCreateRfcommServiceInsecurely( CreateRfcommServiceInsecurelyCallback callback, @@ -124,23 +135,34 @@ CreateRfcommServiceInsecurelyCallback callback, const std::string& message); + void ExecuteConnectToServiceCallback(int request_id, + mojom::ConnectToServiceResultPtr result); + // The current Bluetooth adapter. scoped_refptr<device::BluetoothAdapter> adapter_; // The adapter observers that listen to this service. mojo::RemoteSet<mojom::AdapterObserver> observers_; - // Arguments provided to ConnectToServiceInsecurely(), cached until the - // device is ready to be connected to. - std::vector<std::tuple<std::string, - device::BluetoothUUID, - ConnectToServiceInsecurelyCallback>> - pending_connect_to_service_args_; + // Keeps track of details about pending ConnectToService requests while async + // operations are in progress. This includes details about the caller and + // service as well as the callback. Requests will wait here in three cases: + // * device::BluetoothAdapter::ConnectDevice() + // * device::BluetoothDevice::ConnectToServiceInsecurely() + // * device's services have not completed discovery + base::flat_map<int, std::unique_ptr<ConnectToServiceRequestDetails>> + connect_to_service_request_map_; + + // Ids of ConnectToServiceRequestDetails that are awaiting the completion of + // service discovery for the given device. + std::vector<int> connect_to_service_requests_pending_discovery_; // Allowed UUIDs for untrusted clients to initiate outgoing connections, or // listen on incoming connections. std::set<device::BluetoothUUID> allowed_uuids_; + int next_request_id_ = 0; + base::WeakPtrFactory<Adapter> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(Adapter);
diff --git a/device/bluetooth/adapter_unittest.cc b/device/bluetooth/adapter_unittest.cc index 3c699a6..9185bda8 100644 --- a/device/bluetooth/adapter_unittest.cc +++ b/device/bluetooth/adapter_unittest.cc
@@ -9,6 +9,7 @@ #include "base/task/thread_pool.h" #include "base/test/bind.h" #include "base/test/gmock_callback_support.h" +#include "base/test/metrics/histogram_tester.h" #include "base/test/task_environment.h" #include "build/build_config.h" #include "device/bluetooth/bluetooth_advertisement.h" @@ -457,4 +458,48 @@ run_loop.Run(); } +#if defined(OS_CHROMEOS) +TEST_F(AdapterTest, TestMetricsOnShutdown_NoPendingConnects) { + base::HistogramTester histogram_tester; + adapter_.reset(); + + EXPECT_EQ(0u, + histogram_tester + .GetAllSamples( + "Bluetooth.Mojo.PendingConnectAtShutdown.DurationWaiting") + .size()); + histogram_tester.ExpectUniqueSample( + "Bluetooth.Mojo.PendingConnectAtShutdown." + "NumberOfServiceDiscoveriesInProgress", + /*sample=*/0, /*expected_bucket_count=*/1); +} + +TEST_F(AdapterTest, TestMetricsOnShutdown_PendingConnects) { + base::HistogramTester histogram_tester; + EXPECT_CALL(*mock_bluetooth_adapter_, + ConnectDevice(kUnknownDeviceAddress, _, _, _)) + .WillOnce(RunOnceCallback<2>(mock_unknown_bluetooth_device_.get())); + + EXPECT_CALL(*mock_unknown_bluetooth_device_, + IsGattServicesDiscoveryComplete()) + .WillRepeatedly(Return(false)); + + adapter_->AllowConnectionsForUuid(device::BluetoothUUID(kServiceId)); + adapter_->ConnectToServiceInsecurely(kUnknownDeviceAddress, + device::BluetoothUUID(kServiceId), + base::DoNothing()); + base::RunLoop().RunUntilIdle(); + + adapter_.reset(); + + histogram_tester.ExpectUniqueSample( + "Bluetooth.Mojo.PendingConnectAtShutdown." + "NumberOfServiceDiscoveriesInProgress", + /*sample=*/1, /*expected_bucket_count=*/1); + EXPECT_EQ(1u, histogram_tester + .GetAllSamples("Bluetooth.Mojo.PendingConnectAtShutdown." + "NumberOfServiceDiscoveriesInProgress") + .size()); +} +#endif } // namespace bluetooth
diff --git a/docs/gpu/swiftshader.md b/docs/gpu/swiftshader.md new file mode 100644 index 0000000..746f8e6 --- /dev/null +++ b/docs/gpu/swiftshader.md
@@ -0,0 +1,39 @@ +# Using Chromium with SwiftShader + +SwiftShader is an open-source high-performance implementation of the Vulkan and OpenGL ES graphics APIs which runs purely on the CPU. Thus no graphics processor (GPU) is required for advanced (3D) graphics. + +Chromium uses SwiftShader in two different ways: + +1) **As the OpenGL ES driver** + +When Chromium uses SwiftShader as the OpenGL ES driver, Chromium behaves as if it was running a on regular GPU, while actually running on SwiftShader. This allows Chromium to exercise hardware only code paths on GPU-less bots. + +2) **As the WebGL fallback** + +When Chromium uses SwiftShader as the WebGL fallback, Chromium runs in all software mode and only uses SwiftShader to render WebGL content. + +SwiftShader also provides 2 different libraries: + +1) **The legacy SwiftShader Open GL ES libraries** + +Legacy SwiftShader includes a GLES library and an EGL library, in order to provide a complete solution to run OpenGL ES content. + +*Do not use these libraries if possible, they are being phased out in favor of SwANGLE (ANGLE + SwiftShader Vulkan).* + +2) **The SwiftShader Vulkan library** + +SwiftShader Vulkan can be used both to render Vulkan content directly, or OpenGL ES content when use in conjunction with the ANGLE library. + +## Relevant Chromium command line switches + +When running the **chrome** executable from the command line, SwiftShader can be enabled using the following Switches: +1) As the OpenGL ES driver, SwANGLE (ANGLE + SwiftShader Vulkan) +>**\-\-use-gl=angle \-\-use-angle=swiftshader** +2) As the WebGL fallback, SwANGLE (ANGLE + SwiftShader Vulkan) +>**\-\-use-gl=angle \-\-use-angle=swiftshader-webgl** +3) As the OpenGL ES driver, legacy SwiftShader Open GL ES libraries +> **\-\-use-gl=swiftshader** +4) As the WebGL fallback, legacy SwiftShader Open GL ES libraries +>**\-\-use-gl=swiftshader-webgl** +5) As the Vulkan driver (requires the [enable_swiftshader_vulkan](https://source.chromium.org/chromium/chromium/src/+/master:gpu/vulkan/features.gni;l=16) feature) +>**--use-vulkan=swiftshader**
diff --git a/docs/security/side-channel-threat-model.md b/docs/security/side-channel-threat-model.md index afe54be..71c692c 100644 --- a/docs/security/side-channel-threat-model.md +++ b/docs/security/side-channel-threat-model.md
@@ -3,7 +3,7 @@ Contributors: awhalley, creis, dcheng, jschuh, jyasskin, lukasza, mkwst, nasko, palmer, tsepez. Patches and corrections welcome! -Last Updated: 29 May 2018 +Last Updated: 27 April 2021 [TOC] @@ -323,7 +323,7 @@ for several reasons: * There are [many explicit and implicit clocks in the - platform](https://bugs.chromium.org/p/chromium/issues/detail?id=798795) + platform](https://gruss.cc/files/fantastictimers.pdf) * It is not always possible to coarsen or jitter them enough to slow or stop exploitation… * …while also maintaining web platform compatibility and utility
diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc index b5004ff..90235bed 100644 --- a/gpu/command_buffer/service/feature_info.cc +++ b/gpu/command_buffer/service/feature_info.cc
@@ -225,7 +225,9 @@ const auto useANGLE = command_line->GetSwitchValueASCII(switches::kUseANGLE); feature_flags_.is_swiftshader_for_webgl = - (useGL == gl::kGLImplementationSwiftShaderForWebGLName); + (useGL == gl::kGLImplementationSwiftShaderForWebGLName) || + ((useGL == gl::kGLImplementationANGLEName) && + (useANGLE == gl::kANGLEImplementationSwiftShaderForWebGLName)); // The shader translator is needed to translate from WebGL-conformant GLES SL // to normal GLES SL, enforce WebGL conformance, translate from GLES SL 1.0 to
diff --git a/gpu/config/gpu_util.cc b/gpu/config/gpu_util.cc index 3294164..7fb428fb 100644 --- a/gpu/config/gpu_util.cc +++ b/gpu/config/gpu_util.cc
@@ -498,6 +498,8 @@ command_line->GetSwitchValueASCII(switches::kUseANGLE); if (use_angle == gl::kANGLEImplementationSwiftShaderName) use_swift_shader = true; + else if (use_angle == gl::kANGLEImplementationSwiftShaderForWebGLName) + return ComputeGpuFeatureInfoForSwiftShader(); } } else if (use_gl == gl::kGLImplementationSwiftShaderForWebGLName) return ComputeGpuFeatureInfoForSwiftShader();
diff --git a/gpu/ipc/service/gpu_init.cc b/gpu/ipc/service/gpu_init.cc index d2197651..d2a3f62 100644 --- a/gpu/ipc/service/gpu_init.cc +++ b/gpu/ipc/service/gpu_init.cc
@@ -8,6 +8,7 @@ #include "base/command_line.h" #include "base/logging.h" +#include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_macros.h" #include "base/strings/pattern.h" #include "base/strings/string_number_conversions.h" @@ -590,8 +591,13 @@ // In SwiftShader case, the implementation is actually EGLGLES2. if (!gl_use_swiftshader_ && command_line->HasSwitch(switches::kUseGL)) { std::string use_gl = command_line->GetSwitchValueASCII(switches::kUseGL); + std::string use_angle = + command_line->GetSwitchValueASCII(switches::kUseANGLE); if (use_gl == gl::kGLImplementationSwiftShaderName || - use_gl == gl::kGLImplementationSwiftShaderForWebGLName) { + use_gl == gl::kGLImplementationSwiftShaderForWebGLName || + (use_gl == gl::kGLImplementationANGLEName && + (use_angle == gl::kANGLEImplementationSwiftShaderName || + use_angle == gl::kANGLEImplementationSwiftShaderForWebGLName))) { gl_use_swiftshader_ = true; } }
diff --git a/headless/lib/browser/headless_web_contents_impl.cc b/headless/lib/browser/headless_web_contents_impl.cc index 4fdbf1c..4e4b37c 100644 --- a/headless/lib/browser/headless_web_contents_impl.cc +++ b/headless/lib/browser/headless_web_contents_impl.cc
@@ -452,6 +452,7 @@ void HeadlessWebContentsImpl::RenderProcessHostDestroyed( content::RenderProcessHost* host) { DCHECK_EQ(render_process_host_, host); + render_process_host_->RemoveObserver(this); render_process_host_ = nullptr; }
diff --git a/infra/config/generated/cr-buildbucket.cfg b/infra/config/generated/cr-buildbucket.cfg index c224ca96..00ba0a4 100644 --- a/infra/config/generated/cr-buildbucket.cfg +++ b/infra/config/generated/cr-buildbucket.cfg
@@ -34566,7 +34566,7 @@ name: "android-marshmallow-arm64-rel-dual-coverage" swarming_host: "chromium-swarm.appspot.com" swarming_tags: "vpython:native-python-wrapper" - dimensions: "builder:android-marshmallow-arm64-rel-dual-coverage" + dimensions: "builderless:1" dimensions: "cores:32" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" @@ -46813,7 +46813,7 @@ dimensions: "builder:linux-rel" dimensions: "cores:8" dimensions: "cpu:x86-64" - dimensions: "os:Ubuntu-16.04" + dimensions: "os:Ubuntu-16.04|Ubuntu-18.04" dimensions: "pool:luci.chromium.try" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build"
diff --git a/infra/config/subprojects/chromium/try.star b/infra/config/subprojects/chromium/try.star index 801bb82..25f69a4b 100644 --- a/infra/config/subprojects/chromium/try.star +++ b/infra/config/subprojects/chromium/try.star
@@ -390,7 +390,7 @@ # Experimental builder to check dual coverage on android platform. try_.chromium_android_builder( name = "android-marshmallow-arm64-rel-dual-coverage", - builderless = not settings.is_main, + builderless = True, cores = branches.value(for_main = 32, for_branches = 16), goma_jobs = goma.jobs.J300, main_list_view = "try", @@ -1230,6 +1230,8 @@ main_list_view = "try", tryjob = try_.job(), use_clang_coverage = True, + # TODO(crbug/1199425): Remove this once bionic bot is the default option. + os = os.LINUX_XENIAL_OR_BIONIC, ) try_.chromium_linux_builder(
diff --git a/ios/chrome/browser/crash_report/BUILD.gn b/ios/chrome/browser/crash_report/BUILD.gn index bbfca9a..ac55a23a 100644 --- a/ios/chrome/browser/crash_report/BUILD.gn +++ b/ios/chrome/browser/crash_report/BUILD.gn
@@ -32,6 +32,7 @@ "//base", "//build:branding_buildflags", "//components/breadcrumbs/core", + "//components/breadcrumbs/ios", "//components/crash/core/app", "//components/crash/core/browser", "//components/crash/core/common", @@ -40,7 +41,6 @@ "//ios/chrome/app:tests_hook", "//ios/chrome/browser", "//ios/chrome/browser/browser_state", - "//ios/chrome/browser/crash_report/breadcrumbs", "//ios/chrome/browser/crash_report/breadcrumbs:feature_flags", "//ios/chrome/common", "//ios/chrome/common/app_group",
diff --git a/ios/chrome/browser/crash_report/DEPS b/ios/chrome/browser/crash_report/DEPS index 6f0081c..23061fc 100644 --- a/ios/chrome/browser/crash_report/DEPS +++ b/ios/chrome/browser/crash_report/DEPS
@@ -1,3 +1,4 @@ include_rules = [ "+components/breadcrumbs/core", + "+components/breadcrumbs/ios", ]
diff --git a/ios/chrome/browser/crash_report/breadcrumbs/BUILD.gn b/ios/chrome/browser/crash_report/breadcrumbs/BUILD.gn index 94f6f93f..016cb1e 100644 --- a/ios/chrome/browser/crash_report/breadcrumbs/BUILD.gn +++ b/ios/chrome/browser/crash_report/breadcrumbs/BUILD.gn
@@ -36,8 +36,6 @@ "breadcrumb_manager_browser_agent.mm", "breadcrumb_manager_keyed_service_factory.cc", "breadcrumb_manager_keyed_service_factory.h", - "breadcrumb_manager_observer_bridge.h", - "breadcrumb_manager_observer_bridge.mm", "breadcrumb_manager_tab_helper.h", "breadcrumb_manager_tab_helper.mm", "breadcrumb_persistent_storage_util.cc", @@ -100,7 +98,6 @@ "application_breadcrumbs_logger_unittest.mm", "application_breadcrumbs_not_user_action_unittest.mm", "breadcrumb_manager_browser_agent_unittest.mm", - "breadcrumb_manager_observer_bridge_unittest.mm", "breadcrumb_manager_tab_helper_unittest.mm", "breadcrumb_persistent_storage_manager_unittest.mm", ]
diff --git a/ios/chrome/browser/crash_report/crash_reporter_breadcrumb_observer.h b/ios/chrome/browser/crash_report/crash_reporter_breadcrumb_observer.h index d362979..6ef42d7 100644 --- a/ios/chrome/browser/crash_report/crash_reporter_breadcrumb_observer.h +++ b/ios/chrome/browser/crash_report/crash_reporter_breadcrumb_observer.h
@@ -5,13 +5,17 @@ #ifndef IOS_CHROME_BROWSER_CRASH_REPORT_CRASH_REPORTER_BREADCRUMB_OBSERVER_H_ #define IOS_CHROME_BROWSER_CRASH_REPORT_CRASH_REPORTER_BREADCRUMB_OBSERVER_H_ -#include <map> -#include <memory> #include <string> +#include <vector> #import <Foundation/Foundation.h> -#import "ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_observer_bridge.h" +#import "components/breadcrumbs/ios/breadcrumb_manager_observer_bridge.h" + +namespace breadcrumbs { +class BreadcrumbManager; +class BreadcrumbManagerKeyedService; +} // Combines breadcrumbs from multiple BreadcrumbManagers and sends the merged // breadcrumb events to breakpad for attachment to crash reports.
diff --git a/ios/chrome/browser/crash_report/crash_reporter_breadcrumb_observer.mm b/ios/chrome/browser/crash_report/crash_reporter_breadcrumb_observer.mm index ccc3aa06..01669ce 100644 --- a/ios/chrome/browser/crash_report/crash_reporter_breadcrumb_observer.mm +++ b/ios/chrome/browser/crash_report/crash_reporter_breadcrumb_observer.mm
@@ -4,11 +4,13 @@ #include "ios/chrome/browser/crash_report/crash_reporter_breadcrumb_observer.h" +#include <map> +#include <memory> + #include "base/strings/sys_string_conversions.h" #include "components/breadcrumbs/core/breadcrumb_manager.h" #include "components/breadcrumbs/core/breadcrumb_manager_keyed_service.h" #include "components/breadcrumbs/core/crash_reporter_breadcrumb_constants.h" -#import "ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_observer_bridge.h" #include "ios/chrome/browser/crash_report/crash_keys_helper.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -19,13 +21,13 @@ // Map associating the observed BreadcrumbManager with the corresponding // observer bridge instances. std::map<breadcrumbs::BreadcrumbManager*, - std::unique_ptr<BreadcrumbManagerObserverBridge>> + std::unique_ptr<breadcrumbs::BreadcrumbManagerObserverBridge>> _breadcrumbManagerObservers; // Map associating the observed BreadcrumbManagerKeyedServices with the // corresponding observer bridge instances. std::map<breadcrumbs::BreadcrumbManagerKeyedService*, - std::unique_ptr<BreadcrumbManagerObserverBridge>> + std::unique_ptr<breadcrumbs::BreadcrumbManagerObserverBridge>> _breadcrumbManagerServiceObservers; // A string which stores the received breadcrumbs. Since breakpad limits @@ -59,8 +61,8 @@ DCHECK(!_breadcrumbManagerObservers[breadcrumbManager]); _breadcrumbManagerObservers[breadcrumbManager] = - std::make_unique<BreadcrumbManagerObserverBridge>(breadcrumbManager, - self); + std::make_unique<breadcrumbs::BreadcrumbManagerObserverBridge>( + breadcrumbManager, self); } - (void)stopObservingBreadcrumbManager: @@ -73,7 +75,7 @@ DCHECK(!_breadcrumbManagerServiceObservers[breadcrumbManagerService]); _breadcrumbManagerServiceObservers[breadcrumbManagerService] = - std::make_unique<BreadcrumbManagerObserverBridge>( + std::make_unique<breadcrumbs::BreadcrumbManagerObserverBridge>( breadcrumbManagerService, self); }
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_return_to_recent_tab_item.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_return_to_recent_tab_item.mm index e1364dfc..b289552 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_return_to_recent_tab_item.mm +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_return_to_recent_tab_item.mm
@@ -43,29 +43,12 @@ if (self.icon) { [cell setIconImage:self.icon]; } - cell.accessibilityCustomActions = [self customActions]; } - (CGFloat)cellHeightForWidth:(CGFloat)width { return [ContentSuggestionsReturnToRecentTabCell defaultSize].height; } -// Custom action for a cell configured with this item. -- (NSArray<UIAccessibilityCustomAction*>*)customActions { - UIAccessibilityCustomAction* openMostRecentTab = - [[UIAccessibilityCustomAction alloc] - initWithName:@"Open Most Recent Tab" - target:self - selector:@selector(openMostRecentTab)]; - - return @[ openMostRecentTab ]; -} - -- (BOOL)openMostRecentTab { - // TODO:(crbug.com/1173160) implement. - return YES; -} - @end #pragma mark - ContentSuggestionsReturnToRecentTabCell
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm index 44692c7..1a8c00a 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm
@@ -750,10 +750,12 @@ - (void)configureStartSurfaceIfNeeded { SceneState* scene = SceneStateBrowserAgent::FromBrowser(self.browser)->GetSceneState(); - BOOL shouldShowReturnToRecentTabTile = - scene.modifytVisibleNTPForStartSurface && - ShouldShowReturnToMostRecentTabForStartSurface(); - if (shouldShowReturnToRecentTabTile) { + if (!scene.modifytVisibleNTPForStartSurface) + return; + + if (ShouldShowReturnToMostRecentTabForStartSurface()) { + base::RecordAction( + base::UserMetricsAction("IOS.StartSurface.ShowReturnToRecentTabTile")); web::WebState* most_recent_tab = StartSurfaceRecentTabBrowserAgent::FromBrowser(self.browser) ->most_recent_tab(); @@ -769,8 +771,15 @@ StartSurfaceRecentTabBrowserAgent::FromBrowser(self.browser) ->AddObserver(_startSurfaceObserver.get()); } - scene.modifytVisibleNTPForStartSurface = NO; } + if (ShouldShrinkLogoForStartSurface()) { + base::RecordAction(base::UserMetricsAction("IOS.StartSurface.ShrinkLogo")); + } + if (ShouldHideShortcutsForStartSurface()) { + base::RecordAction( + base::UserMetricsAction("IOS.StartSurface.HideShortcuts")); + } + scene.modifytVisibleNTPForStartSurface = NO; } // Creates, configures and returns a DiscoverFeed ViewController.
diff --git a/ios/chrome/browser/ui/content_suggestions/ntp_home_mediator.mm b/ios/chrome/browser/ui/content_suggestions/ntp_home_mediator.mm index 73de1a36..bd4ce056 100644 --- a/ios/chrome/browser/ui/content_suggestions/ntp_home_mediator.mm +++ b/ios/chrome/browser/ui/content_suggestions/ntp_home_mediator.mm
@@ -439,6 +439,8 @@ - (void)openMostRecentTab:(CollectionViewItem*)item { DCHECK([item isKindOfClass:[ContentSuggestionsReturnToRecentTabItem class]]); + base::RecordAction( + base::UserMetricsAction("IOS.StartSurface.OpenMostRecentTab")); [self.suggestionsMediator hideRecentTabTile]; WebStateList* web_state_list = self.browser->GetWebStateList(); web::WebState* web_state =
diff --git a/ios/chrome/browser/ui/default_promo/default_browser_utils.mm b/ios/chrome/browser/ui/default_promo/default_browser_utils.mm index effd993e..f8f6f68 100644 --- a/ios/chrome/browser/ui/default_promo/default_browser_utils.mm +++ b/ios/chrome/browser/ui/default_promo/default_browser_utils.mm
@@ -8,6 +8,7 @@ #include "base/ios/ios_util.h" #include "base/mac/foundation_util.h" #include "base/metrics/field_trial.h" +#include "base/metrics/field_trial_params.h" #include "ios/chrome/browser/ui/ui_feature_flags.h" #if !defined(__has_feature) || !__has_feature(objc_arc)
diff --git a/ios/chrome/browser/ui/main/scene_controller.mm b/ios/chrome/browser/ui/main/scene_controller.mm index 7b3be76..e917589 100644 --- a/ios/chrome/browser/ui/main/scene_controller.mm +++ b/ios/chrome/browser/ui/main/scene_controller.mm
@@ -12,6 +12,8 @@ #import "base/logging.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" +#include "base/metrics/user_metrics.h" +#include "base/metrics/user_metrics_action.h" #include "base/strings/sys_string_conversions.h" #include "base/task/post_task.h" #include "components/breadcrumbs/core/breadcrumb_manager_keyed_service.h" @@ -505,6 +507,7 @@ return; } + base::RecordAction(base::UserMetricsAction("IOS.StartSurface.Show")); self.sceneState.modifytVisibleNTPForStartSurface = YES; Browser* browser = self.currentInterface.browser; StartSurfaceRecentTabBrowserAgent::FromBrowser(browser)->SaveMostRecentTab();
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1 index 5b092a8..e7b8019 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -6695840dd7ed1b61999fce58e1d015f0ee3e5e8f \ No newline at end of file +3056951d04477c38eb3a5d62e80c97cb18c5a6fd \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1 index 32b05d1..dd1628d 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -3a315a798bc4d80baabf6362821fd99df33020f8 \ No newline at end of file +e0caf0b2d04f2d529cdedf3568e992e9bfee142e \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.arm64.zip.sha1 index 12511efa..7021a2f 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -b4506e2d5babef57f7f7afcdedd6a6f97e83aa18 \ No newline at end of file +f051a597a4313e06a380f691bb1fb739d2f0d727 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.x64.zip.sha1 index eef330d..af445ed 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -28b1458dee362ba0e97b0f1753c0d428982da3f4 \ No newline at end of file +79214851b0759eede744e88b3fec1cac587b3285 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1 index 0d429a0..04b005a 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -b87fdac7ed09f5edb34bbaa655d8502c9dc3336e \ No newline at end of file +5cef7e714f2e0ca6c57e463c87cc44bdc92ea6e6 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1 index 631a3e5..97e9222 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -df055c3140ef65cd73a71ddc0a456881630975f8 \ No newline at end of file +40c337e183663b2d339250be20f4fd1da0cbc62e \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1 index 2fc0431..34cc0a8 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -a7c6d5765a25998fca539f4828a98afcd632222c \ No newline at end of file +6e4b71c4aae0bf184d6037f1159b28f78ee1c993 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1 index b3c3c7b1..c5ce7a8a 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -f1357f3dfd66bce245b298a5bf1e3d103c757ad4 \ No newline at end of file +30c31bb0a486fde505619ddc01824ad1444f5456 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1 index bba9e5d..5d2d560 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -ae27365d7c8223d2e77262179db64e4e8d7f765e \ No newline at end of file +6a3f11191d5b064b6c2b8774263e670def4fb389 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1 index 574d466b..03da8fa 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -8eb9f13a2f57ae5b0e8d2f1357b1ff659a30762d \ No newline at end of file +d588fa403159ae7b127283d572ca700c65771e1a \ No newline at end of file
diff --git a/ios/third_party/material_components_ios/BUILD.gn b/ios/third_party/material_components_ios/BUILD.gn index 30179352..701ff13 100644 --- a/ios/third_party/material_components_ios/BUILD.gn +++ b/ios/third_party/material_components_ios/BUILD.gn
@@ -25,6 +25,7 @@ "src/components/ActionSheet/src/private/MDCActionSheetItemTableViewCell.h", "src/components/ActionSheet/src/private/MaterialActionSheetStrings.h", "src/components/ActionSheet/src/private/MaterialActionSheetStrings_table.h", + "src/components/ActivityIndicator/src/MDCActivityIndicator+Interface.h", "src/components/ActivityIndicator/src/MDCActivityIndicator.h", "src/components/ActivityIndicator/src/MDCActivityIndicatorDelegate.h", "src/components/ActivityIndicator/src/MaterialActivityIndicator.h", @@ -66,6 +67,7 @@ "src/components/BottomNavigation/src/MDCBottomNavigationBarDelegate.h", "src/components/BottomNavigation/src/MaterialBottomNavigation+BottomNavigationController.h", "src/components/BottomNavigation/src/MaterialBottomNavigation.h", + "src/components/BottomNavigation/src/PerformantShadowMigration/MDCBottomNavigationBar+ShadowsPrivate.h", "src/components/BottomNavigation/src/Theming/MDCBottomNavigationBar+MaterialTheming.h", "src/components/BottomNavigation/src/Theming/MaterialBottomNavigation+Theming.h", "src/components/BottomNavigation/src/private/MDCBottomNavigationBar+Private.h", @@ -110,6 +112,7 @@ "src/components/Buttons/src/MDCFloatingButton.h", "src/components/Buttons/src/MDCRaisedButton.h", "src/components/Buttons/src/MaterialButtons.h", + "src/components/Buttons/src/PerformantShadowMigration/MDCButton+ShadowsPrivate.h", "src/components/Buttons/src/ShapeThemer/MDCButtonShapeThemer.h", "src/components/Buttons/src/ShapeThemer/MaterialButtons+ShapeThemer.h", "src/components/Buttons/src/Theming/MDCButton+MaterialTheming.h", @@ -132,6 +135,7 @@ "src/components/Chips/src/MDCChipField.h", "src/components/Chips/src/MDCChipFieldDelegate.h", "src/components/Chips/src/MDCChipView.h", + "src/components/Chips/src/MDCChipViewDeleteButton.h", "src/components/Chips/src/MaterialChips.h", "src/components/Chips/src/Theming/MDCChipView+MaterialTheming.h", "src/components/Chips/src/Theming/MaterialChips+Theming.h", @@ -293,9 +297,8 @@ "src/components/ScalableFontDescriptor/src/MDCScalableFontDescriptor.h", "src/components/ScalableFontDescriptor/src/MaterialScalableFontDescriptor.h", "src/components/Shadow/src/MDCShadow.h", - "src/components/Shadow/src/MDCShadowConfiguring.h", + "src/components/Shadow/src/MDCShadowsCollection.h", "src/components/Shadow/src/MaterialShadow.h", - "src/components/Shadow/src/private/MDCShadow+Internal.h", "src/components/ShadowElevations/src/MDCShadowElevations.h", "src/components/ShadowElevations/src/MaterialShadowElevations.h", "src/components/ShadowLayer/src/MDCShadowLayer.h", @@ -314,6 +317,7 @@ "src/components/Shapes/src/MDCPathGenerator.h", "src/components/Shapes/src/MDCRectangleShapeGenerator.h", "src/components/Shapes/src/MDCShapeGenerating.h", + "src/components/Shapes/src/MDCShapeMediator.h", "src/components/Shapes/src/MDCShapedShadowLayer.h", "src/components/Shapes/src/MDCShapedView.h", "src/components/Shapes/src/MaterialShapes.h", @@ -512,7 +516,7 @@ "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlHorizontalPositioning.h", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlHorizontalPositioningReference.h", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelAnimation.h", - "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelPosition.h", + "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelSupport.h", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlPlaceholderSupport.h", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlSideViewSupport.h", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlVerticalPositioningReference.h", @@ -574,6 +578,7 @@ "src/components/BottomAppBar/src", "src/components/BottomAppBar/src/private", "src/components/BottomNavigation/src", + "src/components/BottomNavigation/src/PerformantShadowMigration", "src/components/BottomNavigation/src/Theming", "src/components/BottomNavigation/src/private", "src/components/BottomSheet/src", @@ -584,6 +589,7 @@ "src/components/Buttons/src", "src/components/Buttons/src/ButtonThemer", "src/components/Buttons/src/ColorThemer", + "src/components/Buttons/src/PerformantShadowMigration", "src/components/Buttons/src/ShapeThemer", "src/components/Buttons/src/Theming", "src/components/Buttons/src/TypographyThemer", @@ -637,7 +643,6 @@ "src/components/Ripple/src/private", "src/components/ScalableFontDescriptor/src", "src/components/Shadow/src", - "src/components/Shadow/src/private", "src/components/ShadowElevations/src", "src/components/ShadowLayer/src", "src/components/ShapeLibrary/src", @@ -735,6 +740,7 @@ "src/components/ActionSheet/src/private/MDCActionSheetItemTableViewCell.m", "src/components/ActionSheet/src/private/MaterialActionSheetStrings.h", "src/components/ActionSheet/src/private/MaterialActionSheetStrings_table.h", + "src/components/ActivityIndicator/src/MDCActivityIndicator+Interface.h", "src/components/ActivityIndicator/src/MDCActivityIndicator.h", "src/components/ActivityIndicator/src/MDCActivityIndicator.m", "src/components/ActivityIndicator/src/MDCActivityIndicatorDelegate.h", @@ -792,6 +798,7 @@ "src/components/BottomNavigation/src/MDCBottomNavigationBarDelegate.h", "src/components/BottomNavigation/src/MaterialBottomNavigation+BottomNavigationController.h", "src/components/BottomNavigation/src/MaterialBottomNavigation.h", + "src/components/BottomNavigation/src/PerformantShadowMigration/MDCBottomNavigationBar+ShadowsPrivate.h", "src/components/BottomNavigation/src/Theming/MDCBottomNavigationBar+MaterialTheming.h", "src/components/BottomNavigation/src/Theming/MDCBottomNavigationBar+MaterialTheming.m", "src/components/BottomNavigation/src/Theming/MaterialBottomNavigation+Theming.h", @@ -865,6 +872,7 @@ "src/components/Buttons/src/MDCRaisedButton.h", "src/components/Buttons/src/MDCRaisedButton.m", "src/components/Buttons/src/MaterialButtons.h", + "src/components/Buttons/src/PerformantShadowMigration/MDCButton+ShadowsPrivate.h", "src/components/Buttons/src/ShapeThemer/MDCButtonShapeThemer.h", "src/components/Buttons/src/ShapeThemer/MDCButtonShapeThemer.m", "src/components/Buttons/src/ShapeThemer/MaterialButtons+ShapeThemer.h", @@ -901,6 +909,8 @@ "src/components/Chips/src/MDCChipFieldDelegate.h", "src/components/Chips/src/MDCChipView.h", "src/components/Chips/src/MDCChipView.m", + "src/components/Chips/src/MDCChipViewDeleteButton.h", + "src/components/Chips/src/MDCChipViewDeleteButton.m", "src/components/Chips/src/MaterialChips.h", "src/components/Chips/src/Theming/MDCChipView+MaterialTheming.h", "src/components/Chips/src/Theming/MDCChipView+MaterialTheming.m", @@ -1139,10 +1149,9 @@ "src/components/ScalableFontDescriptor/src/MaterialScalableFontDescriptor.h", "src/components/Shadow/src/MDCShadow.h", "src/components/Shadow/src/MDCShadow.m", - "src/components/Shadow/src/MDCShadowConfiguring.h", - "src/components/Shadow/src/MDCShadowConfiguring.m", + "src/components/Shadow/src/MDCShadowsCollection.h", + "src/components/Shadow/src/MDCShadowsCollection.m", "src/components/Shadow/src/MaterialShadow.h", - "src/components/Shadow/src/private/MDCShadow+Internal.h", "src/components/ShadowElevations/src/MDCShadowElevations.h", "src/components/ShadowElevations/src/MaterialShadowElevations.h", "src/components/ShadowElevations/src/MaterialShadowElevationsDummy.m", @@ -1175,6 +1184,8 @@ "src/components/Shapes/src/MDCRectangleShapeGenerator.h", "src/components/Shapes/src/MDCRectangleShapeGenerator.m", "src/components/Shapes/src/MDCShapeGenerating.h", + "src/components/Shapes/src/MDCShapeMediator.h", + "src/components/Shapes/src/MDCShapeMediator.m", "src/components/Shapes/src/MDCShapedShadowLayer.h", "src/components/Shapes/src/MDCShapedShadowLayer.m", "src/components/Shapes/src/MDCShapedView.h", @@ -1484,8 +1495,8 @@ "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlHorizontalPositioningReference.m", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelAnimation.h", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelAnimation.m", - "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelPosition.h", - "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelPosition.m", + "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelSupport.h", + "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelSupport.m", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlPlaceholderSupport.h", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlPlaceholderSupport.m", "src/components/private/TextControlsPrivate/src/Shared/MDCTextControlSideViewSupport.h",
diff --git a/ios/web/common/features.mm b/ios/web/common/features.mm index 478d93b..1416b899 100644 --- a/ios/web/common/features.mm +++ b/ios/web/common/features.mm
@@ -4,6 +4,8 @@ #include "ios/web/common/features.h" +#include "base/metrics/field_trial_params.h" + #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif
diff --git a/ios/web/navigation/wk_navigation_util.mm b/ios/web/navigation/wk_navigation_util.mm index 31d7cf4..9181ff1 100644 --- a/ios/web/navigation/wk_navigation_util.mm +++ b/ios/web/navigation/wk_navigation_util.mm
@@ -8,6 +8,7 @@ #include "base/json/json_writer.h" #include "base/mac/bundle_locations.h" +#include "base/metrics/field_trial_params.h" #include "base/strings/string_util.h" #include "base/strings/sys_string_conversions.h" #include "base/values.h"
diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc index fb31baa9..5cdc7782 100644 --- a/media/base/media_switches.cc +++ b/media/base/media_switches.cc
@@ -873,8 +873,8 @@ if (base::FeatureList::IsEnabled(media::kUseSodaForLiveCaption)) { // Check if the CPU has the required instruction set to run the Speech // On-Device API (SODA) library. - static bool has_sse42 = base::CPU().has_sse42(); - if (!has_sse42) + static bool has_sse41 = base::CPU().has_sse41(); + if (!has_sse41) return false; } #endif
diff --git a/mojo/core/channel_linux.h b/mojo/core/channel_linux.h index 6b70f06..2901fe0c 100644 --- a/mojo/core/channel_linux.h +++ b/mojo/core/channel_linux.h
@@ -74,7 +74,7 @@ // This flag keeps track of whether or not we've established a shared memory // channel with the remote. If false we always fall back to the PosixChannel // (socket). - bool shared_mem_writer_ = false; + std::atomic_bool shared_mem_writer_{false}; std::unique_ptr<DataAvailableNotifier> write_notifier_; std::unique_ptr<SharedBuffer> write_buffer_; @@ -84,7 +84,7 @@ uint32_t num_pages_ = 0; - bool reject_writes_ = false; + std::atomic_bool reject_writes_{false}; // This is a temporary buffer we use to remove messages from the shared buffer // for validation and dispatching.
diff --git a/net/BUILD.gn b/net/BUILD.gn index dff1b35..d13af6a8 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn
@@ -757,10 +757,6 @@ "http/url_security_manager.h", "http/webfonts_histogram.cc", "http/webfonts_histogram.h", - "http2/platform/impl/http2_bug_tracker_impl.h", - "http2/platform/impl/http2_containers_impl.h", - "http2/platform/impl/http2_estimate_memory_usage_impl.h", - "http2/platform/impl/http2_logging_impl.h", "http2/platform/impl/http2_macros_impl.h", "http2/platform/impl/http2_string_utils_impl.h", "log/file_net_log_observer.cc", @@ -864,9 +860,7 @@ "quic/platform/impl/quic_client_stats_impl.h", "quic/platform/impl/quic_containers_impl.h", "quic/platform/impl/quic_error_code_wrappers_impl.h", - "quic/platform/impl/quic_estimate_memory_usage_impl.h", "quic/platform/impl/quic_file_utils_impl.h", - "quic/platform/impl/quic_flag_utils_impl.h", "quic/platform/impl/quic_flags_impl.cc", "quic/platform/impl/quic_flags_impl.h", "quic/platform/impl/quic_hostname_utils_impl.cc", @@ -883,10 +877,7 @@ "quic/platform/impl/quic_reference_counted_impl.h", "quic/platform/impl/quic_server_stats_impl.h", "quic/platform/impl/quic_sleep_impl.h", - "quic/platform/impl/quic_socket_address_impl.cc", - "quic/platform/impl/quic_socket_address_impl.h", "quic/platform/impl/quic_stack_trace_impl.h", - "quic/platform/impl/quic_testvalue_impl.h", "quic/properties_based_quic_server_info.cc", "quic/properties_based_quic_server_info.h", "quic/quic_address_mismatch.cc", @@ -945,10 +936,7 @@ "quiche/common/platform/impl/quiche_flag_utils_impl.h", "quiche/common/platform/impl/quiche_flags_impl.cc", "quiche/common/platform/impl/quiche_flags_impl.h", - "quiche/common/platform/impl/quiche_map_util_impl.h", - "quiche/common/platform/impl/quiche_string_piece_impl.h", "quiche/common/platform/impl/quiche_text_utils_impl.h", - "quiche/common/platform/impl/quiche_unordered_containers_impl.h", "socket/client_socket_factory.cc", "socket/client_socket_factory.h", "socket/client_socket_pool.cc", @@ -1027,8 +1015,6 @@ "spdy/multiplexed_session.cc", "spdy/multiplexed_session.h", "spdy/platform/impl/spdy_containers_impl.h", - "spdy/platform/impl/spdy_estimate_memory_usage_impl.h", - "spdy/platform/impl/spdy_macros_impl.h", "spdy/platform/impl/spdy_string_utils_impl.cc", "spdy/platform/impl/spdy_string_utils_impl.h", "spdy/server_push_delegate.h", @@ -2485,10 +2471,6 @@ sources = [ "quic/platform/impl/quic_epoll_clock.cc", "quic/platform/impl/quic_epoll_clock.h", - "quic/platform/impl/quic_linux_socket_utils.cc", - "quic/platform/impl/quic_linux_socket_utils.h", - "quic/platform/impl/quic_socket_utils.cc", - "quic/platform/impl/quic_socket_utils.h", "quic/platform/impl/quic_stream_buffer_allocator_impl.h", "quic/platform/impl/quic_udp_socket_platform_impl.h", ] @@ -2574,7 +2556,6 @@ sources = [ "spdy/fuzzing/hpack_fuzz_util.cc", "spdy/fuzzing/hpack_fuzz_util.h", - "spdy/platform/impl/spdy_test_impl.h", ] deps = [ ":net", @@ -2618,8 +2599,6 @@ "quic/platform/impl/quic_epoll_test_tools_impl.h", "quic/platform/impl/quic_expect_bug_impl.h", "quic/platform/impl/quic_mock_log_impl.h", - "quic/platform/impl/quic_port_utils_impl.cc", - "quic/platform/impl/quic_port_utils_impl.h", "quic/platform/impl/quic_test_impl.cc", "quic/platform/impl/quic_test_impl.h", "quic/platform/impl/quic_test_loopback_impl.cc", @@ -4591,8 +4570,6 @@ sources += [ "quic/platform/impl/quic_epoll_clock_test.cc", "quic/platform/impl/quic_flags_test.cc", - "quic/platform/impl/quic_linux_socket_utils_test.cc", - "quic/platform/impl/quic_socket_utils_test.cc", "tools/quic/quic_http_proxy_backend_stream_test.cc", "tools/quic/quic_http_proxy_backend_test.cc", "tools/quic/quic_simple_server_test.cc",
diff --git a/net/cert_net/cert_net_fetcher_url_request.cc b/net/cert_net/cert_net_fetcher_url_request.cc index 51248e1..8fcf2bb7 100644 --- a/net/cert_net/cert_net_fetcher_url_request.cc +++ b/net/cert_net/cert_net_fetcher_url_request.cc
@@ -76,6 +76,7 @@ #include "net/base/load_flags.h" #include "net/cert/cert_net_fetcher.h" #include "net/cookies/site_for_cookies.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "net/url_request/redirect_info.h" #include "net/url_request/url_request_context.h" @@ -513,7 +514,7 @@ // Disable secure DNS for hostname lookups triggered by certificate network // fetches to prevent deadlock. - url_request_->SetDisableSecureDns(true); + url_request_->SetSecureDnsPolicy(SecureDnsPolicy::kDisable); // Create IsolationInfo based on the origin of the requested URL. // TODO(https://crbug.com/1016890): Cert validation needs to either be
diff --git a/net/cert_net/cert_net_fetcher_url_request_unittest.cc b/net/cert_net/cert_net_fetcher_url_request_unittest.cc index 1bbc0e7..f5ce308f 100644 --- a/net/cert_net/cert_net_fetcher_url_request_unittest.cc +++ b/net/cert_net/cert_net_fetcher_url_request_unittest.cc
@@ -18,6 +18,7 @@ #include "net/cert/mock_cert_verifier.h" #include "net/cert/multi_log_ct_verifier.h" #include "net/dns/mock_host_resolver.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_server_properties.h" #include "net/proxy_resolution/configured_proxy_resolution_service.h" #include "net/quic/quic_context.h" @@ -259,7 +260,7 @@ // URLRequestInterceptor implementation: std::unique_ptr<net::URLRequestJob> MaybeInterceptRequest( net::URLRequest* request) const override { - EXPECT_TRUE(request->disable_secure_dns()); + EXPECT_EQ(SecureDnsPolicy::kDisable, request->secure_dns_policy()); *invoked_interceptor_ = true; return nullptr; }
diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc index e53e4e01..d44d5fa1 100644 --- a/net/dns/dns_transaction.cc +++ b/net/dns/dns_transaction.cc
@@ -39,13 +39,13 @@ #include "net/base/backoff_entry.h" #include "net/base/completion_once_callback.h" #include "net/base/elements_upload_data_stream.h" +#include "net/base/idempotency.h" #include "net/base/io_buffer.h" #include "net/base/ip_address.h" #include "net/base/ip_endpoint.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" #include "net/base/upload_bytes_element_reader.h" -#include "net/base/idempotency.h" #include "net/dns/dns_config.h" #include "net/dns/dns_query.h" #include "net/dns/dns_response.h" @@ -59,6 +59,7 @@ #include "net/dns/public/dns_over_https_server_config.h" #include "net/dns/public/dns_protocol.h" #include "net/dns/public/dns_query_type.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/dns/resolve_context.h" #include "net/http/http_request_headers.h" #include "net/log/net_log.h" @@ -411,7 +412,7 @@ request_->SetExtraRequestHeaders(extra_request_headers); // Disable secure DNS for any DoH server hostname lookups to avoid deadlock. - request_->SetDisableSecureDns(true); + request_->SetSecureDnsPolicy(SecureDnsPolicy::kDisable); request_->SetLoadFlags(request_->load_flags() | LOAD_DISABLE_CACHE | LOAD_BYPASS_PROXY); request_->set_allow_credentials(false);
diff --git a/net/dns/dns_transaction_unittest.cc b/net/dns/dns_transaction_unittest.cc index 016f79b9..887361d 100644 --- a/net/dns/dns_transaction_unittest.cc +++ b/net/dns/dns_transaction_unittest.cc
@@ -42,6 +42,7 @@ #include "net/dns/dns_util.h" #include "net/dns/public/dns_over_https_server_config.h" #include "net/dns/public/dns_protocol.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/dns/resolve_context.h" #include "net/log/net_log.h" #include "net/log/net_log_capture_mode.h" @@ -814,7 +815,7 @@ } EXPECT_FALSE(request->allow_credentials()); - EXPECT_TRUE(request->disable_secure_dns()); + EXPECT_EQ(SecureDnsPolicy::kDisable, request->secure_dns_policy()); std::string accept; EXPECT_TRUE(request->extra_request_headers().GetHeader("Accept", &accept));
diff --git a/net/dns/host_resolver.h b/net/dns/host_resolver.h index 221800da..4d7eab2 100644 --- a/net/dns/host_resolver.h +++ b/net/dns/host_resolver.h
@@ -263,6 +263,7 @@ bool avoid_multicast_resolution = false; // Set to override the resolver's default secure dns mode for this request. + // TODO(crbug.com/1200908): Replace with a SecureDnsPolicy. base::Optional<SecureDnsMode> secure_dns_mode_override = base::nullopt; };
diff --git a/net/dns/public/BUILD.gn b/net/dns/public/BUILD.gn index ec1c7a64..b436ce59 100644 --- a/net/dns/public/BUILD.gn +++ b/net/dns/public/BUILD.gn
@@ -30,6 +30,7 @@ "resolve_error_info.cc", "resolve_error_info.h", "secure_dns_mode.h", + "secure_dns_policy.h", "util.cc", "util.h", ]
diff --git a/net/dns/public/secure_dns_policy.h b/net/dns/public/secure_dns_policy.h new file mode 100644 index 0000000..12dc5be --- /dev/null +++ b/net/dns/public/secure_dns_policy.h
@@ -0,0 +1,21 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_DNS_PUBLIC_SECURE_DNS_POLICY_H_ +#define NET_DNS_PUBLIC_SECURE_DNS_POLICY_H_ + +namespace net { + +// The SecureDnsPolicy indicates whether and how a specific request or socket +// can use Secure DNS. +enum class SecureDnsPolicy { + // Secure DNS is allowed for this request, if it is generally enabled. + kAllow, + // This request must not use Secure DNS, even when it is otherwise enabled. + kDisable, +}; + +} // namespace net + +#endif // NET_DNS_PUBLIC_SECURE_DNS_POLICY_H_
diff --git a/net/http/bidirectional_stream_unittest.cc b/net/http/bidirectional_stream_unittest.cc index e189bd860..8196590 100644 --- a/net/http/bidirectional_stream_unittest.cc +++ b/net/http/bidirectional_stream_unittest.cc
@@ -23,6 +23,7 @@ #include "net/base/load_timing_info.h" #include "net/base/load_timing_info_test_util.h" #include "net/base/net_errors.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/bidirectional_stream_request_info.h" #include "net/http/http_network_session.h" #include "net/http/http_response_headers.h" @@ -434,7 +435,7 @@ SpdySessionKey key(host_port_pair_, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, socket_tag, - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); session_ = CreateSpdySession(http_session_.get(), key, net_log_.bound()); } @@ -629,7 +630,7 @@ SpdySessionKey key(host_port_pair_, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); std::unique_ptr<BidirectionalStreamRequestInfo> request_info( new BidirectionalStreamRequestInfo); request_info->method = "GET";
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index c808698..35f78a10 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc
@@ -61,6 +61,7 @@ #include "net/cert/cert_status_flags.h" #include "net/cert/mock_cert_verifier.h" #include "net/dns/mock_host_resolver.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_auth_challenge_tokenizer.h" #include "net/http/http_auth_handler_digest.h" #include "net/http/http_auth_handler_mock.h" @@ -6639,7 +6640,7 @@ SpdySessionKey key(HostPortPair("proxy", 70), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kTrue, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session = CreateSpdySession(session.get(), key, log.bound()); @@ -13001,7 +13002,7 @@ ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), false, }, { @@ -13011,7 +13012,7 @@ ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), false, }, @@ -13023,7 +13024,7 @@ ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), true, }, { @@ -13033,7 +13034,7 @@ ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), true, }, { @@ -13043,7 +13044,7 @@ ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), true, }, }; @@ -13080,7 +13081,7 @@ ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), false, }, @@ -13092,7 +13093,7 @@ ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), true, }, @@ -13103,7 +13104,7 @@ ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), true, }, }; @@ -13142,7 +13143,7 @@ ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), false, }, { @@ -13152,7 +13153,7 @@ ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), false, }, @@ -13164,7 +13165,7 @@ ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), true, }, { @@ -13174,7 +13175,7 @@ ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), true, }, @@ -13185,7 +13186,7 @@ ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), true, }, }; @@ -15306,7 +15307,7 @@ SpdySessionKey key(host_port_pair, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session = CreateSpdySession(session.get(), key, NetLogWithSource()); @@ -16369,7 +16370,7 @@ const ClientSocketPool::GroupId kSocketGroup( HostPortPair("www.example.com", 80), ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); // First round of authentication. auth_handler->SetGenerateExpectation(false, OK); @@ -16981,7 +16982,7 @@ SpdySessionKey key(host_port_pair, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session = CreateSpdySession(session.get(), key, NetLogWithSource()); @@ -18740,7 +18741,7 @@ SpdySessionKey spdy_session_key_a( host_port_pair_a, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); EXPECT_FALSE( HasSpdySession(session->spdy_session_pool(), spdy_session_key_a)); @@ -18776,7 +18777,7 @@ SpdySessionKey spdy_session_key_b( host_port_pair_b, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); EXPECT_FALSE( HasSpdySession(session->spdy_session_pool(), spdy_session_key_b)); HttpRequestInfo request2; @@ -18809,7 +18810,7 @@ SpdySessionKey spdy_session_key_a1( host_port_pair_a1, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); EXPECT_FALSE( HasSpdySession(session->spdy_session_pool(), spdy_session_key_a1)); HttpRequestInfo request3;
diff --git a/net/http/http_proxy_connect_job.cc b/net/http/http_proxy_connect_job.cc index 16917190..75b9f81 100644 --- a/net/http/http_proxy_connect_job.cc +++ b/net/http/http_proxy_connect_job.cc
@@ -671,7 +671,7 @@ return quic_stream_request_->Request( proxy_server, quic_version, ssl_params->privacy_mode(), kH2QuicTunnelPriority, socket_tag(), params_->network_isolation_key(), - ssl_params->GetDirectConnectionParams()->disable_secure_dns(), + ssl_params->GetDirectConnectionParams()->secure_dns_policy(), /*use_dns_aliases=*/false, ssl_params->ssl_config().GetCertVerifyFlags(), GURL("https://" + proxy_server.ToString()), net_log(), &quic_net_error_details_, @@ -832,7 +832,7 @@ ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kTrue, socket_tag(), params_->network_isolation_key(), - params_->ssl_params()->GetDirectConnectionParams()->disable_secure_dns()); + params_->ssl_params()->GetDirectConnectionParams()->secure_dns_policy()); } } // namespace net
diff --git a/net/http/http_proxy_connect_job_unittest.cc b/net/http/http_proxy_connect_job_unittest.cc index 1436cf5..35ddc18 100644 --- a/net/http/http_proxy_connect_job_unittest.cc +++ b/net/http/http_proxy_connect_job_unittest.cc
@@ -25,6 +25,7 @@ #include "net/base/test_proxy_delegate.h" #include "net/dns/mock_host_resolver.h" #include "net/dns/public/secure_dns_mode.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_network_session.h" #include "net/nqe/network_quality_estimator_test_util.h" #include "net/socket/client_socket_handle.h" @@ -106,33 +107,34 @@ } scoped_refptr<TransportSocketParams> CreateHttpProxyParams( - bool disable_secure_dns) const { + SecureDnsPolicy secure_dns_policy) const { if (GetParam() != HTTP) return nullptr; return base::MakeRefCounted<TransportSocketParams>( HostPortPair(kHttpProxyHost, 80), NetworkIsolationKey(), - disable_secure_dns, OnHostResolutionCallback()); + secure_dns_policy, OnHostResolutionCallback()); } scoped_refptr<SSLSocketParams> CreateHttpsProxyParams( - bool disable_secure_dns) const { + SecureDnsPolicy secure_dns_policy) const { if (GetParam() == HTTP) return nullptr; return base::MakeRefCounted<SSLSocketParams>( base::MakeRefCounted<TransportSocketParams>( HostPortPair(kHttpsProxyHost, 443), NetworkIsolationKey(), - disable_secure_dns, OnHostResolutionCallback()), + secure_dns_policy, OnHostResolutionCallback()), nullptr, nullptr, HostPortPair(kHttpsProxyHost, 443), SSLConfig(), PRIVACY_MODE_DISABLED, NetworkIsolationKey()); } // Returns a correctly constructed HttpProxyParams for the HTTP or HTTPS // proxy. - scoped_refptr<HttpProxySocketParams> CreateParams(bool tunnel, - bool disable_secure_dns) { + scoped_refptr<HttpProxySocketParams> CreateParams( + bool tunnel, + SecureDnsPolicy secure_dns_policy) { return base::MakeRefCounted<HttpProxySocketParams>( - CreateHttpProxyParams(disable_secure_dns), - CreateHttpsProxyParams(disable_secure_dns), false /* is_quic */, + CreateHttpProxyParams(secure_dns_policy), + CreateHttpsProxyParams(secure_dns_policy), false /* is_quic */, HostPortPair(kEndpointHost, tunnel ? 443 : 80), /*is_trusted_proxy=*/false, tunnel, TRAFFIC_ANNOTATION_FOR_TESTS, NetworkIsolationKey()); @@ -141,17 +143,16 @@ std::unique_ptr<HttpProxyConnectJob> CreateConnectJobForHttpRequest( ConnectJob::Delegate* delegate, RequestPriority priority = DEFAULT_PRIORITY, - bool disable_secure_dns = false) { - return CreateConnectJob( - CreateParams(false /* tunnel */, disable_secure_dns), delegate, - priority); + SecureDnsPolicy secure_dns_policy = SecureDnsPolicy::kAllow) { + return CreateConnectJob(CreateParams(false /* tunnel */, secure_dns_policy), + delegate, priority); } std::unique_ptr<HttpProxyConnectJob> CreateConnectJobForTunnel( ConnectJob::Delegate* delegate, RequestPriority priority = DEFAULT_PRIORITY, - bool disable_secure_dns = false) { - return CreateConnectJob(CreateParams(true /* tunnel */, disable_secure_dns), + SecureDnsPolicy secure_dns_policy = SecureDnsPolicy::kAllow) { + return CreateConnectJob(CreateParams(true /* tunnel */, secure_dns_policy), delegate, priority); } @@ -230,7 +231,7 @@ // since tunnels need an extra round trip. base::TimeDelta alternate_connection_timeout = HttpProxyConnectJob::AlternateNestedConnectionTimeout( - *CreateParams(true /* tunnel */, false /* disable_secure_dns */), + *CreateParams(true /* tunnel */, SecureDnsPolicy::kAllow), network_quality_estimator_.get()); // If there's an alternate connection timeout, and it's less than the @@ -878,17 +879,18 @@ } } -TEST_P(HttpProxyConnectJobTest, DisableSecureDns) { - for (bool disable_secure_dns : {false, true}) { +TEST_P(HttpProxyConnectJobTest, SecureDnsPolicy) { + for (auto secure_dns_policy : + {SecureDnsPolicy::kAllow, SecureDnsPolicy::kDisable}) { TestConnectJobDelegate test_delegate; std::unique_ptr<ConnectJob> connect_job = CreateConnectJobForHttpRequest( - &test_delegate, DEFAULT_PRIORITY, disable_secure_dns); + &test_delegate, DEFAULT_PRIORITY, secure_dns_policy); EXPECT_THAT(connect_job->Connect(), test::IsError(ERR_IO_PENDING)); - EXPECT_EQ(disable_secure_dns, + EXPECT_EQ(secure_dns_policy == SecureDnsPolicy::kDisable, session_deps_.host_resolver->last_secure_dns_mode_override() .has_value()); - if (disable_secure_dns) { + if (secure_dns_policy == SecureDnsPolicy::kDisable) { EXPECT_EQ( net::SecureDnsMode::kOff, session_deps_.host_resolver->last_secure_dns_mode_override().value()); @@ -921,7 +923,7 @@ auto ssl_params = base::MakeRefCounted<SSLSocketParams>( base::MakeRefCounted<TransportSocketParams>( HostPortPair(kHttpsProxyHost, 443), NetworkIsolationKey(), - true /* disable_secure_dns */, OnHostResolutionCallback()), + SecureDnsPolicy::kDisable, OnHostResolutionCallback()), nullptr, nullptr, HostPortPair(kHttpsProxyHost, 443), SSLConfig(), PRIVACY_MODE_DISABLED, NetworkIsolationKey()); auto http_proxy_params = base::MakeRefCounted<HttpProxySocketParams>( @@ -939,7 +941,7 @@ SpdySessionKey(HostPortPair(kHttpsProxyHost, 443), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kTrue, SocketTag(), - NetworkIsolationKey(), true /* disable_secure_dns */), + NetworkIsolationKey(), SecureDnsPolicy::kDisable), /* enable_ip_based_pooling = */ false, /* is_websocket = */ false, NetLogWithSource())); EXPECT_FALSE( @@ -947,7 +949,7 @@ SpdySessionKey(HostPortPair(kHttpsProxyHost, 443), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kTrue, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */), + NetworkIsolationKey(), SecureDnsPolicy::kAllow), /* enable_ip_based_pooling = */ false, /* is_websocket = */ false, NetLogWithSource())); } @@ -1633,7 +1635,7 @@ // since tunnels need an extra round trip. base::TimeDelta alternate_connection_timeout = HttpProxyConnectJob::AlternateNestedConnectionTimeout( - *CreateParams(true /* tunnel */, false /* disable_secure_dns */), + *CreateParams(true /* tunnel */, SecureDnsPolicy::kAllow), nullptr /* network_quality_estimator */); #if defined(OS_ANDROID) || defined(OS_IOS)
diff --git a/net/http/http_request_info.cc b/net/http/http_request_info.cc index 23445980..faf3191 100644 --- a/net/http/http_request_info.cc +++ b/net/http/http_request_info.cc
@@ -4,6 +4,8 @@ #include "net/http/http_request_info.h" +#include "net/dns/public/secure_dns_policy.h" + namespace net { HttpRequestInfo::HttpRequestInfo() @@ -11,7 +13,7 @@ upload_data_stream(nullptr), load_flags(0), privacy_mode(PRIVACY_MODE_DISABLED), - disable_secure_dns(false), + secure_dns_policy(SecureDnsPolicy::kAllow), reporting_upload_depth(0), idempotency(net::DEFAULT_IDEMPOTENCY) {}
diff --git a/net/http/http_request_info.h b/net/http/http_request_info.h index 3837cf4..5c5b841 100644 --- a/net/http/http_request_info.h +++ b/net/http/http_request_info.h
@@ -12,6 +12,7 @@ #include "net/base/net_export.h" #include "net/base/network_isolation_key.h" #include "net/base/privacy_mode.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_request_headers.h" #include "net/socket/socket_tag.h" #include "net/traffic_annotation/network_traffic_annotation.h" @@ -53,8 +54,8 @@ // tracked by the server (e.g. without channel id). PrivacyMode privacy_mode; - // Whether secure DNS should be disabled for the request. - bool disable_secure_dns; + // Secure DNS Tag for the request. + SecureDnsPolicy secure_dns_policy; // Tag applied to all sockets used to service request. SocketTag socket_tag;
diff --git a/net/http/http_stream_factory_job.cc b/net/http/http_stream_factory_job.cc index 395c793..652c9432 100644 --- a/net/http/http_stream_factory_job.cc +++ b/net/http/http_stream_factory_job.cc
@@ -28,6 +28,7 @@ #include "net/base/proxy_delegate.h" #include "net/base/trace_constants.h" #include "net/cert/cert_verifier.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/bidirectional_stream_impl.h" #include "net/http/http_basic_stream.h" #include "net/http/http_network_session.h" @@ -166,7 +167,7 @@ request_info_.privacy_mode, request_info_.socket_tag, request_info_.network_isolation_key, - request_info_.disable_secure_dns)), + request_info_.secure_dns_policy)), stream_type_(HttpStreamRequest::BIDIRECTIONAL_STREAM), init_connection_already_resumed_(false) { // QUIC can only be spoken to servers, never to proxies. @@ -371,18 +372,18 @@ PrivacyMode privacy_mode, const SocketTag& socket_tag, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns) { + SecureDnsPolicy secure_dns_policy) { // In the case that we're using an HTTPS proxy for an HTTP url, look for a // HTTP/2 proxy session *to* the proxy, instead of to the origin server. if (!spdy_session_direct) { return SpdySessionKey(proxy_server.host_port_pair(), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kTrue, socket_tag, - network_isolation_key, disable_secure_dns); + network_isolation_key, secure_dns_policy); } return SpdySessionKey(HostPortPair::FromURL(origin_url), proxy_server, privacy_mode, SpdySessionKey::IsProxySession::kFalse, - socket_tag, network_isolation_key, disable_secure_dns); + socket_tag, network_isolation_key, secure_dns_policy); } bool HttpStreamFactory::Job::CanUseExistingSpdySession() const { @@ -816,7 +817,7 @@ GetSocketGroup(), destination_, request_info_.load_flags, priority_, session_, proxy_info_, server_ssl_config_, proxy_ssl_config_, request_info_.privacy_mode, request_info_.network_isolation_key, - request_info_.disable_secure_dns, net_log_, num_streams_); + request_info_.secure_dns_policy, net_log_, num_streams_); } ClientSocketPool::ProxyAuthCallback proxy_auth_callback = @@ -824,7 +825,7 @@ base::Unretained(this)); if (is_websocket_) { DCHECK(request_info_.socket_tag == SocketTag()); - DCHECK(!request_info_.disable_secure_dns); + DCHECK_EQ(SecureDnsPolicy::kAllow, request_info_.secure_dns_policy); SSLConfig websocket_server_ssl_config = server_ssl_config_; websocket_server_ssl_config.alpn_protos.clear(); return InitSocketHandleForWebSocketRequest( @@ -838,7 +839,7 @@ GetSocketGroup(), destination_, request_info_.load_flags, priority_, session_, proxy_info_, server_ssl_config_, proxy_ssl_config_, request_info_.privacy_mode, request_info_.network_isolation_key, - request_info_.disable_secure_dns, request_info_.socket_tag, net_log_, + request_info_.secure_dns_policy, request_info_.socket_tag, net_log_, connection_.get(), io_callback_, proxy_auth_callback); } @@ -872,7 +873,7 @@ int rv = quic_request_.Request( destination, quic_version_, request_info_.privacy_mode, priority_, request_info_.socket_tag, request_info_.network_isolation_key, - request_info_.disable_secure_dns, proxy_info_.is_direct(), + request_info_.secure_dns_policy, proxy_info_.is_direct(), ssl_config->GetCertVerifyFlags(), url, net_log_, &net_error_details_, base::BindOnce(&Job::OnFailedOnDefaultNetwork, ptr_factory_.GetWeakPtr()), io_callback_);
diff --git a/net/http/http_stream_factory_job.h b/net/http/http_stream_factory_job.h index eef80fe..e75520d 100644 --- a/net/http/http_stream_factory_job.h +++ b/net/http/http_stream_factory_job.h
@@ -17,6 +17,7 @@ #include "net/base/proxy_server.h" #include "net/base/request_priority.h" #include "net/dns/public/resolve_error_info.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/bidirectional_stream_impl.h" #include "net/http/http_auth.h" #include "net/http/http_auth_controller.h" @@ -326,7 +327,7 @@ PrivacyMode privacy_mode, const SocketTag& socket_tag, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns); + SecureDnsPolicy secure_dns_policy); // Returns true if the current request can use an existing spdy session. bool CanUseExistingSpdySession() const;
diff --git a/net/http/http_stream_factory_job_controller.cc b/net/http/http_stream_factory_job_controller.cc index 878c6aea..19293fa 100644 --- a/net/http/http_stream_factory_job_controller.cc +++ b/net/http/http_stream_factory_job_controller.cc
@@ -1035,7 +1035,7 @@ ignore_result(ApplyHostMappingRules(original_url, &mapped_origin)); QuicSessionKey session_key( mapped_origin, request_info.privacy_mode, request_info.socket_tag, - request_info.network_isolation_key, request_info.disable_secure_dns); + request_info.network_isolation_key, request_info.secure_dns_policy); HostPortPair destination(alternative_service_info.host_port_pair()); if (session_key.host() != destination.host() &&
diff --git a/net/http/http_stream_factory_job_controller_unittest.cc b/net/http/http_stream_factory_job_controller_unittest.cc index c94dfef..de826bb 100644 --- a/net/http/http_stream_factory_job_controller_unittest.cc +++ b/net/http/http_stream_factory_job_controller_unittest.cc
@@ -28,6 +28,7 @@ #include "net/base/schemeful_site.h" #include "net/base/test_proxy_delegate.h" #include "net/dns/mock_host_resolver.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_basic_stream.h" #include "net/http/http_network_session_peer.h" #include "net/http/http_server_properties.h" @@ -2304,7 +2305,7 @@ HostPortPair::FromURL(request_info.url), ProxyServer::Direct(), request_info.privacy_mode, SpdySessionKey::IsProxySession::kFalse, request_info.socket_tag, request_info.network_isolation_key, - request_info.disable_secure_dns), + request_info.secure_dns_policy), false /* enable_ip_based_pooling */, false /* is_websocket */, NetLogWithSource()); EXPECT_TRUE(spdy_session); @@ -2450,15 +2451,15 @@ ClientSocketPool::GroupId group_id0( HostPortPair::FromURL(request_info.url), ClientSocketPool::SocketType::kSsl, request_info.privacy_mode, - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); ClientSocketPool::GroupId group_id1( HostPortPair::FromURL(request_info.url), ClientSocketPool::SocketType::kSsl, request_info.privacy_mode, - kNetworkIsolationKey1, false /* disable_secure_dns */); + kNetworkIsolationKey1, SecureDnsPolicy::kAllow); ClientSocketPool::GroupId group_id2( HostPortPair::FromURL(request_info.url), ClientSocketPool::SocketType::kSsl, request_info.privacy_mode, - kNetworkIsolationKey2, false /* disable_secure_dns */); + kNetworkIsolationKey2, SecureDnsPolicy::kAllow); EXPECT_EQ(static_cast<uint32_t>(kNumRequests), socket_pool->NumConnectJobsInGroupForTesting(group_id0)); EXPECT_EQ(1u, socket_pool->NumConnectJobsInGroupForTesting(group_id1));
diff --git a/net/http/http_stream_factory_unittest.cc b/net/http/http_stream_factory_unittest.cc index 32aebbb..4bcf449 100644 --- a/net/http/http_stream_factory_unittest.cc +++ b/net/http/http_stream_factory_unittest.cc
@@ -37,6 +37,7 @@ #include "net/cert/multi_log_ct_verifier.h" #include "net/dns/mock_host_resolver.h" #include "net/dns/public/secure_dns_mode.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/bidirectional_stream_impl.h" #include "net/http/bidirectional_stream_request_info.h" #include "net/http/http_auth_handler_factory.h" @@ -371,7 +372,7 @@ void PreconnectHelperForURL(int num_streams, const GURL& url, NetworkIsolationKey network_isolation_key, - bool disable_secure_dns, + SecureDnsPolicy secure_dns_policy, HttpNetworkSession* session) { HttpNetworkSessionPeer peer(session); MockHttpStreamFactoryForPreconnect* mock_factory = @@ -383,7 +384,7 @@ request.url = url; request.load_flags = 0; request.network_isolation_key = network_isolation_key; - request.disable_secure_dns = disable_secure_dns; + request.secure_dns_policy = secure_dns_policy; request.traffic_annotation = MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS); @@ -395,7 +396,7 @@ GURL url = test.ssl ? GURL("https://www.google.com") : GURL("http://www.google.com"); PreconnectHelperForURL(test.num_streams, url, NetworkIsolationKey(), - false /* disable_secure_dns */, session); + SecureDnsPolicy::kAllow, session); } ClientSocketPool::GroupId GetGroupId(const TestCase& test) { @@ -403,12 +404,12 @@ return ClientSocketPool::GroupId( HostPortPair("www.google.com", 443), ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); } return ClientSocketPool::GroupId( HostPortPair("www.google.com", 80), ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); } class CapturePreconnectsTransportSocketPool : public TransportClientSocketPool { @@ -435,7 +436,7 @@ last_group_id_ = ClientSocketPool::GroupId( HostPortPair(), ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_ENABLED, NetworkIsolationKey(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); } int RequestSocket( @@ -584,7 +585,7 @@ SpdySessionKey key(host_port_pair, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); ignore_result(CreateFakeSpdySession(session->spdy_session_pool(), key)); CommonConnectJobParams common_connect_job_params = @@ -633,7 +634,7 @@ peer.SetClientSocketPoolManager(std::move(mock_pool_manager)); PreconnectHelperForURL(1, GURL("http://www.google.com:7"), - NetworkIsolationKey(), false /* disable_secure_dns */, + NetworkIsolationKey(), SecureDnsPolicy::kAllow, session.get()); EXPECT_EQ(-1, transport_conn_pool->last_num_streams()); } @@ -667,20 +668,20 @@ SchemefulSite kSiteBar(GURL("http://bar.test")); const NetworkIsolationKey kKey1(kSiteFoo, kSiteFoo); const NetworkIsolationKey kKey2(kSiteBar, kSiteBar); - PreconnectHelperForURL(1, kURL, kKey1, false /* disable_secure_dns */, + PreconnectHelperForURL(1, kURL, kKey1, SecureDnsPolicy::kAllow, session.get()); EXPECT_EQ(1, transport_conn_pool->last_num_streams()); EXPECT_EQ(kKey1, transport_conn_pool->last_group_id().network_isolation_key()); - PreconnectHelperForURL(2, kURL, kKey2, false /* disable_secure_dns */, + PreconnectHelperForURL(2, kURL, kKey2, SecureDnsPolicy::kAllow, session.get()); EXPECT_EQ(2, transport_conn_pool->last_num_streams()); EXPECT_EQ(kKey2, transport_conn_pool->last_group_id().network_isolation_key()); } -// Verify that preconnects use the specified disable_secure_dns field. +// Verify that preconnects use the specified Secure DNS Tag. TEST_F(HttpStreamFactoryTest, PreconnectDisableSecureDns) { SpdySessionDependencies session_deps( ConfiguredProxyResolutionService::CreateDirect()); @@ -704,14 +705,16 @@ SchemefulSite kSiteFoo(GURL("http://foo.test")); SchemefulSite kSiteBar(GURL("http://bar.test")); PreconnectHelperForURL(1, kURL, NetworkIsolationKey(), - false /* disable_secure_dns */, session.get()); + SecureDnsPolicy::kAllow, session.get()); EXPECT_EQ(1, transport_conn_pool->last_num_streams()); - EXPECT_FALSE(transport_conn_pool->last_group_id().disable_secure_dns()); + EXPECT_EQ(SecureDnsPolicy::kAllow, + transport_conn_pool->last_group_id().secure_dns_policy()); PreconnectHelperForURL(2, kURL, NetworkIsolationKey(), - true /* disable_secure_dns */, session.get()); + SecureDnsPolicy::kDisable, session.get()); EXPECT_EQ(2, transport_conn_pool->last_num_streams()); - EXPECT_TRUE(transport_conn_pool->last_group_id().disable_secure_dns()); + EXPECT_EQ(SecureDnsPolicy::kDisable, + transport_conn_pool->last_group_id().secure_dns_policy()); } TEST_F(HttpStreamFactoryTest, JobNotifiesProxy) { @@ -1018,7 +1021,7 @@ base::WrapUnique(http_proxy_pool)); peer.SetClientSocketPoolManager(std::move(mock_pool_manager)); PreconnectHelperForURL(num_streams, url, NetworkIsolationKey(), - false /* disable_secure_dns */, session.get()); + SecureDnsPolicy::kAllow, session.get()); EXPECT_EQ(num_streams, http_proxy_pool->last_num_streams()); } } @@ -1165,7 +1168,7 @@ request_info.privacy_mode = PRIVACY_MODE_DISABLED; request_info.traffic_annotation = MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS); - request_info.disable_secure_dns = false; + request_info.secure_dns_policy = SecureDnsPolicy::kAllow; SSLConfig ssl_config; StreamRequestWaiter waiter; @@ -1192,7 +1195,7 @@ session_deps.host_resolver->last_secure_dns_mode_override().has_value()); EXPECT_EQ(GetSocketPoolGroupCount(ssl_pool), 1); - request_info.disable_secure_dns = true; + request_info.secure_dns_policy = SecureDnsPolicy::kDisable; std::unique_ptr<HttpStreamRequest> request3( session->http_stream_factory()->RequestStream( request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, @@ -1776,7 +1779,7 @@ ClientSocketPool::GroupId group_id( host_port_pair, ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); int rv = connection->Init( group_id, socket_params, base::nullopt /* proxy_annotation_tag */, MEDIUM, SocketTag(), ClientSocketPool::RespectLimits::ENABLED,
diff --git a/net/http2/platform/impl/http2_bug_tracker_impl.h b/net/http2/platform/impl/http2_bug_tracker_impl.h deleted file mode 100644 index 2d44e2ca..0000000 --- a/net/http2/platform/impl/http2_bug_tracker_impl.h +++ /dev/null
@@ -1,18 +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 NET_HTTP2_PLATFORM_IMPL_HTTP2_BUG_TRACKER_IMPL_H_ -#define NET_HTTP2_PLATFORM_IMPL_HTTP2_BUG_TRACKER_IMPL_H_ - -#include "base/logging.h" - -#define HTTP2_BUG_IMPL(bug_id) LOG(DFATAL) -#define HTTP2_BUG_IF_IMPL(bug_id) LOG_IF(DFATAL, (condition)) - -#define HTTP2_BUG_V2_IMPL(bug_id) LOG(DFATAL) -#define HTTP2_BUG_IF_V2_IMPL(bug_id, condition) LOG_IF(DFATAL, (condition)) - -#define FLAGS_http2_always_log_bugs_for_tests_IMPL (true) - -#endif // NET_HTTP2_PLATFORM_IMPL_HTTP2_BUG_TRACKER_IMPL_H_
diff --git a/net/http2/platform/impl/http2_containers_impl.h b/net/http2/platform/impl/http2_containers_impl.h deleted file mode 100644 index 4d895854..0000000 --- a/net/http2/platform/impl/http2_containers_impl.h +++ /dev/null
@@ -1,17 +0,0 @@ -// 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. - -#ifndef NET_HTTP2_PLATFORM_IMPL_HTTP2_CONTAINERS_IMPL_H_ -#define NET_HTTP2_PLATFORM_IMPL_HTTP2_CONTAINERS_IMPL_H_ - -#include "base/containers/circular_deque.h" - -namespace http2 { - -template <typename T> -using Http2DequeImpl = base::circular_deque<T>; - -} - -#endif // NET_HTTP2_PLATFORM_IMPL_HTTP2_CONTAINERS_IMPL_H_
diff --git a/net/http2/platform/impl/http2_estimate_memory_usage_impl.h b/net/http2/platform/impl/http2_estimate_memory_usage_impl.h deleted file mode 100644 index 4581adc..0000000 --- a/net/http2/platform/impl/http2_estimate_memory_usage_impl.h +++ /dev/null
@@ -1,21 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef NET_HTTP2_PLATFORM_IMPL_HTTP2_ESTIMATE_MEMORY_USAGE_IMPL_H_ -#define NET_HTTP2_PLATFORM_IMPL_HTTP2_ESTIMATE_MEMORY_USAGE_IMPL_H_ - -#include <cstddef> - -#include "base/trace_event/memory_usage_estimator.h" - -namespace http2 { - -template <class T> -size_t Http2EstimateMemoryUsageImpl(const T& object) { - return base::trace_event::EstimateMemoryUsage(object); -} - -} // namespace http2 - -#endif // NET_HTTP2_PLATFORM_IMPL_HTTP2_ESTIMATE_MEMORY_USAGE_IMPL_H_
diff --git a/net/http2/platform/impl/http2_logging_impl.h b/net/http2/platform/impl/http2_logging_impl.h deleted file mode 100644 index 804d6a7b3..0000000 --- a/net/http2/platform/impl/http2_logging_impl.h +++ /dev/null
@@ -1,75 +0,0 @@ -// Copyright (c) 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef NET_HTTP2_PLATFORM_IMPL_HTTP2_LOGGING_IMPL_H_ -#define NET_HTTP2_PLATFORM_IMPL_HTTP2_LOGGING_IMPL_H_ - -#include "base/check_op.h" -#include "base/logging.h" -#include "base/notreached.h" -#include "build/build_config.h" -#include "net/base/net_export.h" - -#define HTTP2_LOG_IMPL(severity) HTTP2_CHROMIUM_LOG_##severity -#define HTTP2_VLOG_IMPL(verbose_level) VLOG(verbose_level) -#define HTTP2_DLOG_IMPL(severity) HTTP2_CHROMIUM_DLOG_##severity -#define HTTP2_DLOG_IF_IMPL(severity, condition) \ - HTTP2_CHROMIUM_DLOG_IF_##severity(condition) -#define HTTP2_DVLOG_IMPL(verbose_level) DVLOG(verbose_level) -#define HTTP2_DVLOG_IF_IMPL(verbose_level, condition) \ - DVLOG_IF(verbose_level, condition) -#define HTTP2_LOG_FIRST_N_IMPL(severity, n) HTTP2_LOG_IMPL(severity) - -#define HTTP2_CHROMIUM_LOG_INFO VLOG(1) -#define HTTP2_CHROMIUM_LOG_WARNING DLOG(WARNING) -#define HTTP2_CHROMIUM_LOG_ERROR DLOG(ERROR) -#define HTTP2_CHROMIUM_LOG_FATAL LOG(FATAL) -#define HTTP2_CHROMIUM_LOG_DFATAL LOG(DFATAL) - -#define HTTP2_CHROMIUM_DLOG_INFO DVLOG(1) -#define HTTP2_CHROMIUM_DLOG_WARNING DLOG(WARNING) -#define HTTP2_CHROMIUM_DLOG_ERROR DLOG(ERROR) -#define HTTP2_CHROMIUM_DLOG_FATAL DLOG(FATAL) -#define HTTP2_CHROMIUM_DLOG_DFATAL DLOG(DFATAL) - -#define HTTP2_CHROMIUM_LOG_IF_INFO(condition) VLOG_IF(1, condition) -#define HTTP2_CHROMIUM_LOG_IF_WARNING(condition) DLOG_IF(WARNING, condition) -#define HTTP2_CHROMIUM_LOG_IF_ERROR(condition) DLOG_IF(ERROR, condition) -#define HTTP2_CHROMIUM_LOG_IF_FATAL(condition) LOG_IF(FATAL, condition) -#define HTTP2_CHROMIUM_LOG_IF_DFATAL(condition) LOG_IF(DFATAL, condition) - -#define HTTP2_CHROMIUM_DLOG_IF_INFO(condition) DVLOG_IF(1, condition) -#define HTTP2_CHROMIUM_DLOG_IF_WARNING(condition) DLOG_IF(WARNING, condition) -#define HTTP2_CHROMIUM_DLOG_IF_ERROR(condition) DLOG_IF(ERROR, condition) -#define HTTP2_CHROMIUM_DLOG_IF_FATAL(condition) DLOG_IF(FATAL, condition) -#define HTTP2_CHROMIUM_DLOG_IF_DFATAL(condition) DLOG_IF(DFATAL, condition) - -#define HTTP2_LOG_INFO_IS_ON_IMPL() 0 -#ifdef NDEBUG -#define HTTP2_LOG_WARNING_IS_ON_IMPL() 0 -#define HTTP2_LOG_ERROR_IS_ON_IMPL() 0 -#else -#define HTTP2_LOG_WARNING_IS_ON_IMPL() 1 -#define HTTP2_LOG_ERROR_IS_ON_IMPL() 1 -#endif -#define HTTP2_DLOG_INFO_IS_ON_IMPL() 0 - -#if defined(OS_WIN) -// wingdi.h defines ERROR to be 0. When we call HTTP2_DLOG(ERROR), it gets -// substituted with 0, and it expands to HTTP2_CHROMIUM_DLOG_0. To allow us to -// keep using this syntax, we define this macro to do the same thing as -// HTTP2_CHROMIUM_DLOG_ERROR. -#define HTTP2_CHROMIUM_LOG_0 HTTP2_CHROMIUM_LOG_ERROR -#define HTTP2_CHROMIUM_DLOG_0 HTTP2_CHROMIUM_DLOG_ERROR -#define HTTP2_CHROMIUM_LOG_IF_0 HTTP2_CHROMIUM_LOG_IF_ERROR -#define HTTP2_CHROMIUM_DLOG_IF_0 HTTP2_CHROMIUM_DLOG_IF_ERROR -#endif - -#define HTTP2_PREDICT_FALSE_IMPL(x) x - -#define HTTP2_NOTREACHED_IMPL() NOTREACHED() - -#define HTTP2_PLOG_IMPL(severity) DVLOG(1) - -#endif // NET_HTTP2_PLATFORM_IMPL_HTTP2_LOGGING_IMPL_H_
diff --git a/net/quic/bidirectional_stream_quic_impl_unittest.cc b/net/quic/bidirectional_stream_quic_impl_unittest.cc index dd9d9bfd..9d7a488 100644 --- a/net/quic/bidirectional_stream_quic_impl_unittest.cc +++ b/net/quic/bidirectional_stream_quic_impl_unittest.cc
@@ -20,6 +20,7 @@ #include "net/base/load_timing_info.h" #include "net/base/load_timing_info_test_util.h" #include "net/base/net_errors.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/bidirectional_stream_request_info.h" #include "net/http/transport_security_state.h" #include "net/log/net_log_event_type.h" @@ -552,7 +553,7 @@ base::WrapUnique(static_cast<QuicServerInfo*>(nullptr)), QuicSessionKey(kDefaultServerHostName, kDefaultServerPort, PRIVACY_MODE_DISABLED, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */), + NetworkIsolationKey(), SecureDnsPolicy::kAllow), /*require_confirmation=*/false, /*migrate_session_early_v2=*/false, /*migrate_session_on_network_change_v2=*/false,
diff --git a/net/quic/platform/impl/quic_estimate_memory_usage_impl.h b/net/quic/platform/impl/quic_estimate_memory_usage_impl.h deleted file mode 100644 index 8e3349e1..0000000 --- a/net/quic/platform/impl/quic_estimate_memory_usage_impl.h +++ /dev/null
@@ -1,21 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef NET_QUIC_PLATFORM_IMPL_QUIC_ESTIMATE_MEMORY_USAGE_IMPL_H_ -#define NET_QUIC_PLATFORM_IMPL_QUIC_ESTIMATE_MEMORY_USAGE_IMPL_H_ - -#include <cstddef> - -#include "base/trace_event/memory_usage_estimator.h" - -namespace quic { - -template <class T> -size_t QuicEstimateMemoryUsageImpl(const T& object) { - return base::trace_event::EstimateMemoryUsage(object); -} - -} // namespace quic - -#endif // NET_QUIC_PLATFORM_IMPL_QUIC_ESTIMATE_MEMORY_USAGE_IMPL_H_
diff --git a/net/quic/platform/impl/quic_export_impl.h b/net/quic/platform/impl/quic_export_impl.h deleted file mode 100644 index 3384974..0000000 --- a/net/quic/platform/impl/quic_export_impl.h +++ /dev/null
@@ -1,17 +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 NET_QUIC_PLATFORM_IMPL_QUIC_EXPORT_IMPL_H_ -#define NET_QUIC_PLATFORM_IMPL_QUIC_EXPORT_IMPL_H_ - -#include "net/base/net_export.h" - -// These macros are documented in: -// net/third_party/quiche/src/quic/platform/api/quic_export.h - -#define QUIC_EXPORT NET_EXPORT -#define QUIC_EXPORT_PRIVATE NET_EXPORT_PRIVATE -#define QUIC_NO_EXPORT - -#endif // NET_QUIC_PLATFORM_IMPL_QUIC_EXPORT_IMPL_H_
diff --git a/net/quic/platform/impl/quic_flag_utils_impl.h b/net/quic/platform/impl/quic_flag_utils_impl.h deleted file mode 100644 index 717cc0e..0000000 --- a/net/quic/platform/impl/quic_flag_utils_impl.h +++ /dev/null
@@ -1,8 +0,0 @@ -// Copyright (c) 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef NET_QUIC_PLATFORM_IMPL_QUIC_FLAG_UTILS_IMPL_H_ -#define NET_QUIC_PLATFORM_IMPL_QUIC_FLAG_UTILS_IMPL_H_ - -#endif // NET_QUIC_PLATFORM_IMPL_QUIC_FLAG_UTILS_IMPL_H_
diff --git a/net/quic/platform/impl/quic_linux_socket_utils.cc b/net/quic/platform/impl/quic_linux_socket_utils.cc deleted file mode 100644 index c326db5..0000000 --- a/net/quic/platform/impl/quic_linux_socket_utils.cc +++ /dev/null
@@ -1,139 +0,0 @@ -// Copyright (c) 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 "net/quic/platform/impl/quic_linux_socket_utils.h" - -#include <netinet/in.h> -#include <iostream> - -#include "net/third_party/quiche/src/quic/platform/api/quic_ip_address.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h" - -namespace quic { - -BufferedWrite::BufferedWrite(const char* buffer, - size_t buf_len, - const QuicIpAddress& self_address, - const QuicSocketAddress& peer_address) - : BufferedWrite(buffer, - buf_len, - self_address, - peer_address, - std::unique_ptr<PerPacketOptions>()) {} - -BufferedWrite::BufferedWrite(const char* buffer, - size_t buf_len, - const QuicIpAddress& self_address, - const QuicSocketAddress& peer_address, - std::unique_ptr<PerPacketOptions> options) - : buffer(buffer), - buf_len(buf_len), - self_address(self_address), - peer_address(peer_address), - options(std::move(options)) {} - -BufferedWrite::BufferedWrite(BufferedWrite&&) = default; - -BufferedWrite::~BufferedWrite() = default; - -QuicMMsgHdr::~QuicMMsgHdr() = default; - -void QuicMMsgHdr::InitOneHeader(int i, const BufferedWrite& buffered_write) { - mmsghdr* mhdr = GetMMsgHdr(i); - msghdr* hdr = &mhdr->msg_hdr; - iovec* iov = GetIov(i); - - iov->iov_base = const_cast<char*>(buffered_write.buffer); - iov->iov_len = buffered_write.buf_len; - hdr->msg_iov = iov; - hdr->msg_iovlen = 1; - hdr->msg_control = nullptr; - hdr->msg_controllen = 0; - - // Only support unconnected sockets. - DCHECK(buffered_write.peer_address.IsInitialized()); - - sockaddr_storage* peer_address_storage = GetPeerAddressStorage(i); - *peer_address_storage = buffered_write.peer_address.generic_address(); - hdr->msg_name = peer_address_storage; - hdr->msg_namelen = peer_address_storage->ss_family == AF_INET - ? sizeof(sockaddr_in) - : sizeof(sockaddr_in6); -} - -void QuicMMsgHdr::SetIpInNextCmsg(int i, const QuicIpAddress& self_address) { - if (!self_address.IsInitialized()) { - return; - } - - if (self_address.IsIPv4()) { - QuicSocketUtils::SetIpInfoInCmsgData( - self_address, GetNextCmsgData<in_pktinfo>(i, IPPROTO_IP, IP_PKTINFO)); - } else { - QuicSocketUtils::SetIpInfoInCmsgData( - self_address, - GetNextCmsgData<in6_pktinfo>(i, IPPROTO_IPV6, IPV6_PKTINFO)); - } -} - -void* QuicMMsgHdr::GetNextCmsgDataInternal(int i, - int cmsg_level, - int cmsg_type, - size_t data_size) { - mmsghdr* mhdr = GetMMsgHdr(i); - msghdr* hdr = &mhdr->msg_hdr; - cmsghdr*& cmsg = *GetCmsgHdr(i); - - // msg_controllen needs to be increased first, otherwise CMSG_NXTHDR will - // return nullptr. - hdr->msg_controllen += CMSG_SPACE(data_size); - DCHECK_LE(hdr->msg_controllen, cbuf_size_); - - if (cmsg == nullptr) { - DCHECK_EQ(nullptr, hdr->msg_control); - hdr->msg_control = GetCbuf(i); - cmsg = CMSG_FIRSTHDR(hdr); - } else { - DCHECK_NE(nullptr, hdr->msg_control); - cmsg = CMSG_NXTHDR(hdr, cmsg); - } - - DCHECK_NE(nullptr, cmsg) << "Insufficient control buffer space"; - - cmsg->cmsg_len = CMSG_LEN(data_size); - cmsg->cmsg_level = cmsg_level; - cmsg->cmsg_type = cmsg_type; - - return CMSG_DATA(cmsg); -} - -int QuicMMsgHdr::num_bytes_sent(int num_packets_sent) { - DCHECK_LE(0, num_packets_sent); - DCHECK_LE(num_packets_sent, num_msgs_); - - int bytes_sent = 0; - iovec* iov = GetIov(0); - for (int i = 0; i < num_packets_sent; ++i) { - bytes_sent += iov[i].iov_len; - } - return bytes_sent; -} - -// static -int QuicLinuxSocketUtils::GetUDPSegmentSize(int fd) { - int optval; - socklen_t optlen = sizeof(optval); - int rc = getsockopt(fd, SOL_UDP, UDP_SEGMENT, &optval, &optlen); - if (rc < 0) { - QUIC_LOG_EVERY_N_SEC(INFO, 10) - << "getsockopt(UDP_SEGMENT) failed: " << strerror(errno); - return -1; - } - QUIC_LOG_EVERY_N_SEC(INFO, 10) - << "getsockopt(UDP_SEGMENT) returned segment size: " << optval; - return optval; -} - -} // namespace quic
diff --git a/net/quic/platform/impl/quic_linux_socket_utils.h b/net/quic/platform/impl/quic_linux_socket_utils.h deleted file mode 100644 index a5ac07ff..0000000 --- a/net/quic/platform/impl/quic_linux_socket_utils.h +++ /dev/null
@@ -1,245 +0,0 @@ -// Copyright (c) 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 NET_QUIC_PLATFORM_IMPL_QUIC_LINUX_SOCKET_UTILS_H_ -#define NET_QUIC_PLATFORM_IMPL_QUIC_LINUX_SOCKET_UTILS_H_ - -#include <errno.h> -#include <stddef.h> -#include <string.h> -#include <sys/socket.h> -#include <sys/uio.h> -#include <deque> -#include <functional> -#include <iterator> -#include <memory> -#include <type_traits> -#include <utility> - -#include "net/quic/platform/impl/quic_socket_utils.h" -#include "net/third_party/quiche/src/quic/core/quic_packet_writer.h" -#include "net/third_party/quiche/src/quic/core/quic_types.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_ip_address.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h" - -#ifndef SOL_UDP -#define SOL_UDP 17 -#endif - -#ifndef UDP_SEGMENT -#define UDP_SEGMENT 103 -#endif - -#ifndef UDP_MAX_SEGMENTS -#define UDP_MAX_SEGMENTS (1 << 6UL) -#endif - -namespace quic { - -// BufferedWrite holds all information needed to send a packet. -struct BufferedWrite { - BufferedWrite(const char* buffer, - size_t buf_len, - const QuicIpAddress& self_address, - const QuicSocketAddress& peer_address); - - BufferedWrite(const char* buffer, - size_t buf_len, - const QuicIpAddress& self_address, - const QuicSocketAddress& peer_address, - std::unique_ptr<PerPacketOptions> options); - - BufferedWrite(BufferedWrite&&); - ~BufferedWrite(); - - const char* buffer; // Not owned. - size_t buf_len; - QuicIpAddress self_address; - QuicSocketAddress peer_address; - std::unique_ptr<PerPacketOptions> options; -}; - -// QuicMMsgHdr is used to build mmsghdr objects that can be used to send -// multiple packets at once via ::sendmmsg. -// -// Example: -// QuicDeque<BufferedWrite> buffered_writes; -// ... (Populate buffered_writes) ... -// -// QuicMMsgHdr mhdr( -// buffered_writes.begin(), buffered_writes.end(), kCmsgSpaceForIp, -// [](QuicMMsgHdr* mhdr, int i, const BufferedWrite& buffered_write) { -// mhdr->SetIpInNextCmsg(i, buffered_write.self_address); -// }); -// -// int num_packets_sent; -// QuicSocketUtils::WriteMultiplePackets(fd, &mhdr, &num_packets_sent); -class QuicMMsgHdr { - public: - typedef std::function< - void(QuicMMsgHdr* mhdr, int i, const BufferedWrite& buffered_write)> - ControlBufferInitializer; - template <typename IteratorT> - QuicMMsgHdr(const IteratorT& first, - const IteratorT& last, - size_t cbuf_size, - ControlBufferInitializer cbuf_initializer) - : num_msgs_(std::distance(first, last)), cbuf_size_(cbuf_size) { - static_assert( - std::is_same<typename std::iterator_traits<IteratorT>::value_type, - BufferedWrite>::value, - "Must iterate over a collection of BufferedWrite."); - - DCHECK_LE(0, num_msgs_); - if (num_msgs_ == 0) { - return; - } - - storage_ = std::make_unique<char[]>(StorageSize()); - memset(&storage_[0], 0, StorageSize()); - - int i = -1; - for (auto it = first; it != last; ++it) { - ++i; - - InitOneHeader(i, *it); - if (cbuf_initializer) { - cbuf_initializer(this, i, *it); - } - } - } - - ~QuicMMsgHdr(); - - void SetIpInNextCmsg(int i, const QuicIpAddress& self_address); - - template <typename DataType> - DataType* GetNextCmsgData(int i, int cmsg_level, int cmsg_type) { - return reinterpret_cast<DataType*>( - GetNextCmsgDataInternal(i, cmsg_level, cmsg_type, sizeof(DataType))); - } - - mmsghdr* mhdr() { return GetMMsgHdr(0); } - - int num_msgs() const { return num_msgs_; } - - // Get the total number of bytes in the first |num_packets_sent| packets. - int num_bytes_sent(int num_packets_sent); - - protected: - void InitOneHeader(int i, const BufferedWrite& buffered_write); - - void* GetNextCmsgDataInternal(int i, - int cmsg_level, - int cmsg_type, - size_t data_size); - - size_t StorageSize() const { - return num_msgs_ * - (sizeof(mmsghdr) + sizeof(iovec) + sizeof(sockaddr_storage) + - sizeof(cmsghdr*) + cbuf_size_); - } - - mmsghdr* GetMMsgHdr(int i) { - auto* first = reinterpret_cast<mmsghdr*>(&storage_[0]); - return &first[i]; - } - - iovec* GetIov(int i) { - auto* first = reinterpret_cast<iovec*>(GetMMsgHdr(num_msgs_)); - return &first[i]; - } - - sockaddr_storage* GetPeerAddressStorage(int i) { - auto* first = reinterpret_cast<sockaddr_storage*>(GetIov(num_msgs_)); - return &first[i]; - } - - cmsghdr** GetCmsgHdr(int i) { - auto** first = - reinterpret_cast<cmsghdr**>(GetPeerAddressStorage(num_msgs_)); - return &first[i]; - } - - char* GetCbuf(int i) { - auto* first = reinterpret_cast<char*>(GetCmsgHdr(num_msgs_)); - return &first[i * cbuf_size_]; - } - - const int num_msgs_; - // Size of cmsg buffer for each message. - const size_t cbuf_size_; - // storage_ holds the memory of - // |num_msgs_| mmsghdr - // |num_msgs_| iovec - // |num_msgs_| sockaddr_storage, for peer addresses - // |num_msgs_| cmsghdr* - // |num_msgs_| cbuf, each of size cbuf_size - std::unique_ptr<char[]> storage_; -}; - -// QuicSyscallWrapper wraps system calls for testing. -class QuicSyscallWrapper { - public: - int Sendmmsg(int sockfd, - mmsghdr* msgvec, - unsigned int vlen, - int flags) const { - return ::sendmmsg(sockfd, msgvec, vlen, flags); - } -}; - -class QuicLinuxSocketUtils : public QuicSocketUtils { - public: - // Return the UDP segment size of |fd|, 0 means segment size has not been set - // on this socket. If GSO is not supported, return -1. - static int GetUDPSegmentSize(int fd); - - // Writes the packets in |mhdr| to the socket, using ::sendmmsg. - static WriteResult WriteMultiplePackets(int fd, - QuicMMsgHdr* mhdr, - int* num_packets_sent) { - return WriteMultiplePackets(fd, mhdr, num_packets_sent, - QuicSyscallWrapper()); - } - - template <typename SyscallWrapper> - static WriteResult WriteMultiplePackets(int fd, - QuicMMsgHdr* mhdr, - int* num_packets_sent, - const SyscallWrapper& syscall) { - *num_packets_sent = 0; - - if (mhdr->num_msgs() <= 0) { - return WriteResult(WRITE_STATUS_ERROR, EINVAL); - } - - int rc; - do { - rc = syscall.Sendmmsg(fd, mhdr->mhdr(), mhdr->num_msgs(), 0); - } while (rc < 0 && errno == EINTR); - - if (rc > 0) { - *num_packets_sent = rc; - - return WriteResult(WRITE_STATUS_OK, mhdr->num_bytes_sent(rc)); - } else if (rc == 0) { - LOG(DFATAL) - << "sendmmsg returned 0, returning WRITE_STATUS_ERROR. errno: " - << errno; - errno = EIO; - } - - return WriteResult((errno == EAGAIN || errno == EWOULDBLOCK) - ? WRITE_STATUS_BLOCKED - : WRITE_STATUS_ERROR, - errno); - } -}; - -} // namespace quic - -#endif // NET_QUIC_PLATFORM_IMPL_QUIC_LINUX_SOCKET_UTILS_H_
diff --git a/net/quic/platform/impl/quic_linux_socket_utils_test.cc b/net/quic/platform/impl/quic_linux_socket_utils_test.cc deleted file mode 100644 index 06e9754..0000000 --- a/net/quic/platform/impl/quic_linux_socket_utils_test.cc +++ /dev/null
@@ -1,259 +0,0 @@ -// Copyright (c) 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 "net/quic/platform/impl/quic_linux_socket_utils.h" - -#include <netinet/in.h> -#include <stdint.h> -#include <sstream> -#include <vector> - -#include "net/third_party/quiche/src/quic/core/quic_circular_deque.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_test.h" - -using testing::_; -using testing::InSequence; -using testing::Invoke; - -namespace quic { -namespace test { -namespace { - -class MockQuicSyscallWrapper { - public: - MOCK_CONST_METHOD4( - Sendmmsg, - int(int sockfd, mmsghdr* msgvec, unsigned int vlen, int flags)); -}; - -class QuicLinuxSocketUtilsTest : public QuicTest { - protected: - WriteResult TestWriteMultiplePackets( - int fd, - const QuicCircularDeque<BufferedWrite>::const_iterator& first, - const QuicCircularDeque<BufferedWrite>::const_iterator& last, - int* num_packets_sent) { - QuicMMsgHdr mhdr( - first, last, kCmsgSpaceForIp, - [](QuicMMsgHdr* mhdr, int i, const BufferedWrite& buffered_write) { - mhdr->SetIpInNextCmsg(i, buffered_write.self_address); - }); - - WriteResult res = QuicLinuxSocketUtils::WriteMultiplePackets( - fd, &mhdr, num_packets_sent, mock_syscalls_); - return res; - } - - MockQuicSyscallWrapper mock_syscalls_; -}; - -void CheckMsghdrWithoutCbuf(const msghdr* hdr, - const void* buffer, - size_t buf_len, - const QuicSocketAddress& peer_addr) { - EXPECT_EQ( - peer_addr.host().IsIPv4() ? sizeof(sockaddr_in) : sizeof(sockaddr_in6), - hdr->msg_namelen); - sockaddr_storage peer_generic_addr = peer_addr.generic_address(); - EXPECT_EQ(0, memcmp(hdr->msg_name, &peer_generic_addr, hdr->msg_namelen)); - EXPECT_EQ(1u, hdr->msg_iovlen); - EXPECT_EQ(buffer, hdr->msg_iov->iov_base); - EXPECT_EQ(buf_len, hdr->msg_iov->iov_len); - EXPECT_EQ(0, hdr->msg_flags); - EXPECT_EQ(nullptr, hdr->msg_control); - EXPECT_EQ(0u, hdr->msg_controllen); -} - -void CheckIpAndGsoSizeInCbuf(msghdr* hdr, - const void* cbuf, - const QuicIpAddress& self_addr, - uint16_t gso_size) { - const bool is_ipv4 = self_addr.IsIPv4(); - const size_t ip_cmsg_space = is_ipv4 ? kCmsgSpaceForIpv4 : kCmsgSpaceForIpv6; - - EXPECT_EQ(cbuf, hdr->msg_control); - EXPECT_EQ(ip_cmsg_space + CMSG_SPACE(sizeof(uint16_t)), hdr->msg_controllen); - - cmsghdr* cmsg = CMSG_FIRSTHDR(hdr); - EXPECT_EQ(cmsg->cmsg_len, is_ipv4 ? CMSG_LEN(sizeof(in_pktinfo)) - : CMSG_LEN(sizeof(in6_pktinfo))); - EXPECT_EQ(cmsg->cmsg_level, is_ipv4 ? IPPROTO_IP : IPPROTO_IPV6); - EXPECT_EQ(cmsg->cmsg_type, is_ipv4 ? IP_PKTINFO : IPV6_PKTINFO); - - const std::string& self_addr_str = self_addr.ToPackedString(); - if (is_ipv4) { - in_pktinfo* pktinfo = reinterpret_cast<in_pktinfo*>(CMSG_DATA(cmsg)); - EXPECT_EQ(0, memcmp(&pktinfo->ipi_spec_dst, self_addr_str.c_str(), - self_addr_str.length())); - } else { - in6_pktinfo* pktinfo = reinterpret_cast<in6_pktinfo*>(CMSG_DATA(cmsg)); - EXPECT_EQ(0, memcmp(&pktinfo->ipi6_addr, self_addr_str.c_str(), - self_addr_str.length())); - } - - cmsg = CMSG_NXTHDR(hdr, cmsg); - EXPECT_EQ(cmsg->cmsg_len, CMSG_LEN(sizeof(uint16_t))); - EXPECT_EQ(cmsg->cmsg_level, SOL_UDP); - EXPECT_EQ(cmsg->cmsg_type, UDP_SEGMENT); - EXPECT_EQ(gso_size, *reinterpret_cast<uint16_t*>(CMSG_DATA(cmsg))); - - EXPECT_EQ(nullptr, CMSG_NXTHDR(hdr, cmsg)); -} - -TEST_F(QuicLinuxSocketUtilsTest, QuicMMsgHdr) { - QuicCircularDeque<BufferedWrite> buffered_writes; - char packet_buf1[1024]; - char packet_buf2[512]; - buffered_writes.emplace_back( - packet_buf1, sizeof(packet_buf1), QuicIpAddress::Loopback4(), - QuicSocketAddress(QuicIpAddress::Loopback4(), 4)); - buffered_writes.emplace_back( - packet_buf2, sizeof(packet_buf2), QuicIpAddress::Loopback6(), - QuicSocketAddress(QuicIpAddress::Loopback6(), 6)); - - QuicMMsgHdr quic_mhdr_without_cbuf(buffered_writes.begin(), - buffered_writes.end(), 0, nullptr); - for (size_t i = 0; i < buffered_writes.size(); ++i) { - const BufferedWrite& bw = buffered_writes[i]; - CheckMsghdrWithoutCbuf(&quic_mhdr_without_cbuf.mhdr()[i].msg_hdr, bw.buffer, - bw.buf_len, bw.peer_address); - } - - QuicMMsgHdr quic_mhdr_with_cbuf( - buffered_writes.begin(), buffered_writes.end(), - kCmsgSpaceForIp + kCmsgSpaceForSegmentSize, - [](QuicMMsgHdr* mhdr, int i, const BufferedWrite& buffered_write) { - mhdr->SetIpInNextCmsg(i, buffered_write.self_address); - *mhdr->GetNextCmsgData<uint16_t>(i, SOL_UDP, UDP_SEGMENT) = 1300; - }); - for (size_t i = 0; i < buffered_writes.size(); ++i) { - const BufferedWrite& bw = buffered_writes[i]; - msghdr* hdr = &quic_mhdr_with_cbuf.mhdr()[i].msg_hdr; - CheckIpAndGsoSizeInCbuf(hdr, hdr->msg_control, bw.self_address, 1300); - } -} - -TEST_F(QuicLinuxSocketUtilsTest, WriteMultiplePackets_NoPacketsToSend) { - int num_packets_sent; - QuicCircularDeque<BufferedWrite> buffered_writes; - - EXPECT_CALL(mock_syscalls_, Sendmmsg(_, _, _, _)).Times(0); - - EXPECT_EQ(WriteResult(WRITE_STATUS_ERROR, EINVAL), - TestWriteMultiplePackets(1, buffered_writes.begin(), - buffered_writes.end(), &num_packets_sent)); -} - -TEST_F(QuicLinuxSocketUtilsTest, WriteMultiplePackets_WriteBlocked) { - int num_packets_sent; - QuicCircularDeque<BufferedWrite> buffered_writes; - buffered_writes.emplace_back(nullptr, 0, QuicIpAddress(), - QuicSocketAddress(QuicIpAddress::Any4(), 0)); - - EXPECT_CALL(mock_syscalls_, Sendmmsg(_, _, _, _)) - .WillOnce( - Invoke([](int fd, mmsghdr* msgvec, unsigned int vlen, int flags) { - errno = EWOULDBLOCK; - return -1; - })); - - EXPECT_EQ(WriteResult(WRITE_STATUS_BLOCKED, EWOULDBLOCK), - TestWriteMultiplePackets(1, buffered_writes.begin(), - buffered_writes.end(), &num_packets_sent)); - EXPECT_EQ(0, num_packets_sent); -} - -TEST_F(QuicLinuxSocketUtilsTest, WriteMultiplePackets_WriteError) { - int num_packets_sent; - QuicCircularDeque<BufferedWrite> buffered_writes; - buffered_writes.emplace_back(nullptr, 0, QuicIpAddress(), - QuicSocketAddress(QuicIpAddress::Any4(), 0)); - - EXPECT_CALL(mock_syscalls_, Sendmmsg(_, _, _, _)) - .WillOnce( - Invoke([](int fd, mmsghdr* msgvec, unsigned int vlen, int flags) { - errno = EPERM; - return -1; - })); - - EXPECT_EQ(WriteResult(WRITE_STATUS_ERROR, EPERM), - TestWriteMultiplePackets(1, buffered_writes.begin(), - buffered_writes.end(), &num_packets_sent)); - EXPECT_EQ(0, num_packets_sent); -} - -TEST_F(QuicLinuxSocketUtilsTest, WriteMultiplePackets_WriteSuccess) { - int num_packets_sent; - QuicCircularDeque<BufferedWrite> buffered_writes; - const int kNumBufferedWrites = 10; - static_assert(kNumBufferedWrites < 256, "Must be less than 256"); - std::vector<std::string> buffer_holder; - for (int i = 0; i < kNumBufferedWrites; ++i) { - size_t buf_len = (i + 1) * 2; - std::ostringstream buffer_ostream; - while (buffer_ostream.str().length() < buf_len) { - buffer_ostream << i; - } - buffer_holder.push_back(buffer_ostream.str().substr(0, buf_len - 1) + '$'); - - buffered_writes.emplace_back(buffer_holder.back().data(), buf_len, - QuicIpAddress(), - QuicSocketAddress(QuicIpAddress::Any4(), 0)); - - // Leave the first self_address uninitialized. - if (i != 0) { - ASSERT_TRUE(buffered_writes.back().self_address.FromString("127.0.0.1")); - } - - std::ostringstream peer_ip_ostream; - QuicIpAddress peer_ip_address; - peer_ip_ostream << "127.0.1." << i + 1; - ASSERT_TRUE(peer_ip_address.FromString(peer_ip_ostream.str())); - buffered_writes.back().peer_address = - QuicSocketAddress(peer_ip_address, i + 1); - } - - InSequence s; - - for (int expected_num_packets_sent : {1, 2, 3, 10}) { - SCOPED_TRACE(testing::Message() - << "expected_num_packets_sent=" << expected_num_packets_sent); - EXPECT_CALL(mock_syscalls_, Sendmmsg(_, _, _, _)) - .WillOnce(Invoke([&](int fd, mmsghdr* msgvec, unsigned int vlen, - int flags) { - EXPECT_LE(static_cast<unsigned int>(expected_num_packets_sent), vlen); - for (unsigned int i = 0; i < vlen; ++i) { - const BufferedWrite& buffered_write = buffered_writes[i]; - const msghdr& hdr = msgvec[i].msg_hdr; - EXPECT_EQ(1u, hdr.msg_iovlen); - EXPECT_EQ(buffered_write.buffer, hdr.msg_iov->iov_base); - EXPECT_EQ(buffered_write.buf_len, hdr.msg_iov->iov_len); - sockaddr_storage expected_peer_address = - buffered_write.peer_address.generic_address(); - EXPECT_EQ(0, memcmp(&expected_peer_address, hdr.msg_name, - sizeof(sockaddr_storage))); - EXPECT_EQ(buffered_write.self_address.IsInitialized(), - hdr.msg_control != nullptr); - } - return expected_num_packets_sent; - })) - .RetiresOnSaturation(); - - int expected_bytes_written = 0; - for (auto it = buffered_writes.cbegin(); - it != buffered_writes.cbegin() + expected_num_packets_sent; ++it) { - expected_bytes_written += it->buf_len; - } - - EXPECT_EQ( - WriteResult(WRITE_STATUS_OK, expected_bytes_written), - TestWriteMultiplePackets(1, buffered_writes.cbegin(), - buffered_writes.cend(), &num_packets_sent)); - EXPECT_EQ(expected_num_packets_sent, num_packets_sent); - } -} - -} // namespace -} // namespace test -} // namespace quic
diff --git a/net/quic/platform/impl/quic_port_utils_impl.cc b/net/quic/platform/impl/quic_port_utils_impl.cc deleted file mode 100644 index 4209b73..0000000 --- a/net/quic/platform/impl/quic_port_utils_impl.cc +++ /dev/null
@@ -1,17 +0,0 @@ -// Copyright (c) 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 "net/quic/platform/impl/quic_port_utils_impl.h" - -#include "net/third_party/quiche/src/quic/core/crypto/quic_random.h" - -namespace quic { - -int QuicPickServerPortForTestsOrDieImpl() { - return 0; // Let the OS find an unused port. -} - -void QuicRecyclePortImpl(int port) {} - -} // namespace quic
diff --git a/net/quic/platform/impl/quic_port_utils_impl.h b/net/quic/platform/impl/quic_port_utils_impl.h deleted file mode 100644 index a0c6aff..0000000 --- a/net/quic/platform/impl/quic_port_utils_impl.h +++ /dev/null
@@ -1,15 +0,0 @@ -// Copyright (c) 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 NET_QUIC_PLATFORM_IMPL_QUIC_PORT_UTILS_IMPL_H_ -#define NET_QUIC_PLATFORM_IMPL_QUIC_PORT_UTILS_IMPL_H_ - -namespace quic { - -int QuicPickServerPortForTestsOrDieImpl(); -void QuicRecyclePortImpl(int port); - -} // namespace quic - -#endif // NET_QUIC_PLATFORM_IMPL_QUIC_PORT_UTILS_IMPL_H_
diff --git a/net/quic/platform/impl/quic_socket_address_impl.cc b/net/quic/platform/impl/quic_socket_address_impl.cc deleted file mode 100644 index 50668ab..0000000 --- a/net/quic/platform/impl/quic_socket_address_impl.cc +++ /dev/null
@@ -1,98 +0,0 @@ -// Copyright (c) 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 "net/quic/platform/impl/quic_socket_address_impl.h" - -#include "net/base/sockaddr_storage.h" -#include "net/quic/address_utils.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h" - -using std::string; - -namespace quic { - -QuicSocketAddressImpl::QuicSocketAddressImpl(const net::IPEndPoint& address) - : socket_address_(address) {} - -QuicSocketAddressImpl::QuicSocketAddressImpl(QuicIpAddress address, - uint16_t port) - : socket_address_(net::ToIPAddress(address), port) {} - -QuicSocketAddressImpl::QuicSocketAddressImpl( - const struct sockaddr_storage& saddr) { - if (saddr.ss_family == AF_INET) { - CHECK(socket_address_.FromSockAddr( - reinterpret_cast<const sockaddr*>(&saddr), sizeof(struct sockaddr_in))); - } else if (saddr.ss_family == AF_INET6) { - CHECK( - socket_address_.FromSockAddr(reinterpret_cast<const sockaddr*>(&saddr), - sizeof(struct sockaddr_in6))); - } -} - -QuicSocketAddressImpl::QuicSocketAddressImpl(const sockaddr* saddr, - socklen_t len) { - if (saddr->sa_family == AF_INET) { - CHECK(socket_address_.FromSockAddr(saddr, len)); - } else if (saddr->sa_family == AF_INET6) { - CHECK(socket_address_.FromSockAddr(saddr, len)); - } -} - -bool operator==(const QuicSocketAddressImpl& lhs, - const QuicSocketAddressImpl& rhs) { - return lhs.socket_address_ == rhs.socket_address_; -} - -bool operator!=(const QuicSocketAddressImpl& lhs, - const QuicSocketAddressImpl& rhs) { - return lhs.socket_address_.address() != rhs.socket_address_.address() || - lhs.socket_address_.port() != rhs.socket_address_.port(); -} - -bool QuicSocketAddressImpl::IsInitialized() const { - return net::GetAddressFamily(socket_address_.address()) != - net::ADDRESS_FAMILY_UNSPECIFIED; - ; -} - -string QuicSocketAddressImpl::ToString() const { - if (!IsInitialized()) { - return "Uninitialized address"; - } - return socket_address_.ToString(); -} - -int QuicSocketAddressImpl::FromSocket(int fd) { - net::SockaddrStorage storage; - if (getsockname(fd, storage.addr, &storage.addr_len) != 0 || - !socket_address_.FromSockAddr(storage.addr, storage.addr_len)) { - return 1; - } - - return 0; -} - -QuicSocketAddressImpl QuicSocketAddressImpl::Normalized() const { - LOG(DFATAL) << "QuicSocketAddressImpl::Normalized() is not implemented."; - return QuicSocketAddressImpl(); -} - -QuicIpAddress QuicSocketAddressImpl::host() const { - return ToQuicIpAddress(socket_address_.address()); -} - -uint16_t QuicSocketAddressImpl::port() const { - return socket_address_.port(); -} - -sockaddr_storage QuicSocketAddressImpl::generic_address() const { - sockaddr_storage raw_address = {}; - socklen_t address_len = sizeof(raw_address); - CHECK(socket_address_.ToSockAddr( - reinterpret_cast<struct sockaddr*>(&raw_address), &address_len)); - return raw_address; -} - -} // namespace quic
diff --git a/net/quic/platform/impl/quic_socket_address_impl.h b/net/quic/platform/impl/quic_socket_address_impl.h deleted file mode 100644 index e6006ba..0000000 --- a/net/quic/platform/impl/quic_socket_address_impl.h +++ /dev/null
@@ -1,47 +0,0 @@ -// Copyright (c) 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 NET_QUIC_PLATFORM_IMPL_QUIC_SOCKET_ADDRESS_IMPL_H_ -#define NET_QUIC_PLATFORM_IMPL_QUIC_SOCKET_ADDRESS_IMPL_H_ - -#include "net/base/ip_endpoint.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_export.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_ip_address.h" - -namespace quic { - -class QUIC_EXPORT_PRIVATE QuicSocketAddressImpl { - public: - QuicSocketAddressImpl() = default; - explicit QuicSocketAddressImpl(const net::IPEndPoint& addr); - QuicSocketAddressImpl(QuicIpAddress address, uint16_t port); - explicit QuicSocketAddressImpl(const struct sockaddr_storage& saddr); - explicit QuicSocketAddressImpl(const sockaddr* saddr, socklen_t len); - QuicSocketAddressImpl(const QuicSocketAddressImpl& other) = default; - QuicSocketAddressImpl& operator=(const QuicSocketAddressImpl& other) = - default; - QuicSocketAddressImpl& operator=(QuicSocketAddressImpl&& other) = default; - friend bool operator==(const QuicSocketAddressImpl& lhs, - const QuicSocketAddressImpl& rhs); - friend bool operator!=(const QuicSocketAddressImpl& lhs, - const QuicSocketAddressImpl& rhs); - - bool IsInitialized() const; - std::string ToString() const; - int FromSocket(int fd); - QuicSocketAddressImpl Normalized() const; - - QuicIpAddress host() const; - uint16_t port() const; - - sockaddr_storage generic_address() const; - const net::IPEndPoint& socket_address() const { return socket_address_; } - - private: - net::IPEndPoint socket_address_; -}; - -} // namespace quic - -#endif // NET_QUIC_PLATFORM_IMPL_QUIC_SOCKET_ADDRESS_IMPL_H_
diff --git a/net/quic/platform/impl/quic_socket_utils.cc b/net/quic/platform/impl/quic_socket_utils.cc deleted file mode 100644 index 2922dcd..0000000 --- a/net/quic/platform/impl/quic_socket_utils.cc +++ /dev/null
@@ -1,419 +0,0 @@ -// Copyright (c) 2012 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 "net/quic/platform/impl/quic_socket_utils.h" - -#include <errno.h> -#include <fcntl.h> -#include <linux/net_tstamp.h> -#include <netinet/in.h> -#include <string.h> -#include <sys/socket.h> -#include <sys/uio.h> -#include <unistd.h> -#include <string> - -#include "base/notreached.h" -#include "net/third_party/quiche/src/quic/core/quic_packets.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h" - -#ifndef SO_RXQ_OVFL -#define SO_RXQ_OVFL 40 -#endif - -using std::string; - -namespace quic { - -QuicMsgHdr::QuicMsgHdr(const char* buffer, - size_t buf_len, - const QuicSocketAddress& peer_address, - char* cbuf, - size_t cbuf_size) - : iov_{const_cast<char*>(buffer), buf_len}, - cbuf_(cbuf), - cbuf_size_(cbuf_size), - cmsg_(nullptr) { - // Only support unconnected sockets. - DCHECK(peer_address.IsInitialized()); - - raw_peer_address_ = peer_address.generic_address(); - hdr_.msg_name = &raw_peer_address_; - hdr_.msg_namelen = raw_peer_address_.ss_family == AF_INET - ? sizeof(sockaddr_in) - : sizeof(sockaddr_in6); - - hdr_.msg_iov = &iov_; - hdr_.msg_iovlen = 1; - hdr_.msg_flags = 0; - - hdr_.msg_control = nullptr; - hdr_.msg_controllen = 0; -} - -void QuicMsgHdr::SetIpInNextCmsg(const QuicIpAddress& self_address) { - if (!self_address.IsInitialized()) { - return; - } - - if (self_address.IsIPv4()) { - QuicSocketUtils::SetIpInfoInCmsgData( - self_address, GetNextCmsgData<in_pktinfo>(IPPROTO_IP, IP_PKTINFO)); - } else { - QuicSocketUtils::SetIpInfoInCmsgData( - self_address, GetNextCmsgData<in6_pktinfo>(IPPROTO_IPV6, IPV6_PKTINFO)); - } -} - -void* QuicMsgHdr::GetNextCmsgDataInternal(int cmsg_level, - int cmsg_type, - size_t data_size) { - // msg_controllen needs to be increased first, otherwise CMSG_NXTHDR will - // return nullptr. - hdr_.msg_controllen += CMSG_SPACE(data_size); - DCHECK_LE(hdr_.msg_controllen, cbuf_size_); - - if (cmsg_ == nullptr) { - DCHECK_EQ(nullptr, hdr_.msg_control); - memset(cbuf_, 0, cbuf_size_); - hdr_.msg_control = cbuf_; - cmsg_ = CMSG_FIRSTHDR(&hdr_); - } else { - DCHECK_NE(nullptr, hdr_.msg_control); - cmsg_ = CMSG_NXTHDR(&hdr_, cmsg_); - } - - DCHECK_NE(nullptr, cmsg_) << "Insufficient control buffer space"; - - cmsg_->cmsg_len = CMSG_LEN(data_size); - cmsg_->cmsg_level = cmsg_level; - cmsg_->cmsg_type = cmsg_type; - - return CMSG_DATA(cmsg_); -} - -// static -void QuicSocketUtils::GetAddressAndTimestampFromMsghdr( - struct msghdr* hdr, - QuicIpAddress* address, - QuicWallTime* walltimestamp) { - if (hdr->msg_controllen > 0) { - for (cmsghdr* cmsg = CMSG_FIRSTHDR(hdr); cmsg != nullptr; - cmsg = CMSG_NXTHDR(hdr, cmsg)) { - char* addr_data = nullptr; - int len = 0; - if (cmsg->cmsg_type == IPV6_PKTINFO) { - in6_pktinfo* info = reinterpret_cast<in6_pktinfo*>(CMSG_DATA(cmsg)); - addr_data = reinterpret_cast<char*>(&info->ipi6_addr); - len = sizeof(in6_addr); - address->FromPackedString(addr_data, len); - } else if (cmsg->cmsg_type == IP_PKTINFO) { - in_pktinfo* info = reinterpret_cast<in_pktinfo*>(CMSG_DATA(cmsg)); - addr_data = reinterpret_cast<char*>(&info->ipi_addr); - len = sizeof(in_addr); - address->FromPackedString(addr_data, len); - } else if (cmsg->cmsg_level == SOL_SOCKET && - cmsg->cmsg_type == SO_TIMESTAMPING) { - LinuxTimestamping* lts = - reinterpret_cast<LinuxTimestamping*>(CMSG_DATA(cmsg)); - timespec* ts = <s->systime; - int64_t usec = (static_cast<int64_t>(ts->tv_sec) * 1000 * 1000) + - (static_cast<int64_t>(ts->tv_nsec) / 1000); - *walltimestamp = QuicWallTime::FromUNIXMicroseconds(usec); - } - } - } -} - -// static -bool QuicSocketUtils::GetOverflowFromMsghdr(struct msghdr* hdr, - QuicPacketCount* dropped_packets) { - if (hdr->msg_controllen > 0) { - struct cmsghdr* cmsg; - for (cmsg = CMSG_FIRSTHDR(hdr); cmsg != nullptr; - cmsg = CMSG_NXTHDR(hdr, cmsg)) { - if (cmsg->cmsg_type == SO_RXQ_OVFL) { - *dropped_packets = *(reinterpret_cast<uint32_t*> CMSG_DATA(cmsg)); - return true; - } - } - } - return false; -} - -// static -bool QuicSocketUtils::GetTtlFromMsghdr(struct msghdr* hdr, int* ttl) { - if (hdr->msg_controllen > 0) { - struct cmsghdr* cmsg; - for (cmsg = CMSG_FIRSTHDR(hdr); cmsg != nullptr; - cmsg = CMSG_NXTHDR(hdr, cmsg)) { - if ((cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_TTL) || - (cmsg->cmsg_level == IPPROTO_IPV6 && - cmsg->cmsg_type == IPV6_HOPLIMIT)) { - *ttl = *(reinterpret_cast<int*>(CMSG_DATA(cmsg))); - return true; - } - } - } - return false; -} - -// static -int QuicSocketUtils::SetGetAddressInfo(int fd, int address_family) { - int get_local_ip = 1; - int rc = setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &get_local_ip, - sizeof(get_local_ip)); - if (rc == 0 && address_family == AF_INET6) { - rc = setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &get_local_ip, - sizeof(get_local_ip)); - } - return rc; -} - -// static -int QuicSocketUtils::SetGetSoftwareReceiveTimestamp(int fd) { - int timestamping = SOF_TIMESTAMPING_RX_SOFTWARE | SOF_TIMESTAMPING_SOFTWARE; - return setsockopt(fd, SOL_SOCKET, SO_TIMESTAMPING, ×tamping, - sizeof(timestamping)); -} - -// static -bool QuicSocketUtils::SetSendBufferSize(int fd, size_t size) { - if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)) != 0) { - LOG(ERROR) << "Failed to set socket send size"; - return false; - } - return true; -} - -// static -bool QuicSocketUtils::SetReceiveBufferSize(int fd, size_t size) { - if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)) != 0) { - LOG(ERROR) << "Failed to set socket recv size"; - return false; - } - return true; -} - -// static -int QuicSocketUtils::ReadPacket(int fd, - char* buffer, - size_t buf_len, - QuicPacketCount* dropped_packets, - QuicIpAddress* self_address, - QuicWallTime* walltimestamp, - QuicSocketAddress* peer_address) { - DCHECK(peer_address != nullptr); - char cbuf[kCmsgSpaceForReadPacket]; - - iovec iov = {buffer, buf_len}; - struct sockaddr_storage raw_address; - msghdr hdr; - - hdr.msg_name = &raw_address; - hdr.msg_namelen = sizeof(sockaddr_storage); - hdr.msg_iov = &iov; - hdr.msg_iovlen = 1; - hdr.msg_flags = 0; - - struct cmsghdr* cmsg = reinterpret_cast<struct cmsghdr*>(cbuf); - cmsg->cmsg_len = sizeof(cbuf); - hdr.msg_control = cmsg; - hdr.msg_controllen = sizeof(cbuf); - - int bytes_read = recvmsg(fd, &hdr, 0); - - // Return before setting dropped packets: if we get EAGAIN, it will - // be 0. - if (bytes_read < 0 && errno != 0) { - if (errno != EAGAIN) { - LOG(ERROR) << "Error reading " << strerror(errno); - } - return -1; - } - - if (hdr.msg_flags & MSG_CTRUNC) { - LOG(DFATAL) << "Incorrectly set control length: " << hdr.msg_controllen - << ", expected " << sizeof(cbuf); - return -1; - } - - if (dropped_packets != nullptr) { - GetOverflowFromMsghdr(&hdr, dropped_packets); - } - - QuicIpAddress stack_address; - if (self_address == nullptr) { - self_address = &stack_address; - } - - QuicWallTime stack_walltimestamp = QuicWallTime::FromUNIXMicroseconds(0); - if (walltimestamp == nullptr) { - walltimestamp = &stack_walltimestamp; - } - - GetAddressAndTimestampFromMsghdr(&hdr, self_address, walltimestamp); - - *peer_address = QuicSocketAddress(raw_address); - return bytes_read; -} - -size_t QuicSocketUtils::SetIpInfoInCmsg(const QuicIpAddress& self_address, - cmsghdr* cmsg) { - string address_string; - if (self_address.IsIPv4()) { - cmsg->cmsg_len = CMSG_LEN(sizeof(in_pktinfo)); - cmsg->cmsg_level = IPPROTO_IP; - cmsg->cmsg_type = IP_PKTINFO; - in_pktinfo* pktinfo = reinterpret_cast<in_pktinfo*>(CMSG_DATA(cmsg)); - memset(pktinfo, 0, sizeof(in_pktinfo)); - pktinfo->ipi_ifindex = 0; - address_string = self_address.ToPackedString(); - memcpy(&pktinfo->ipi_spec_dst, address_string.c_str(), - address_string.length()); - return sizeof(in_pktinfo); - } else if (self_address.IsIPv6()) { - cmsg->cmsg_len = CMSG_LEN(sizeof(in6_pktinfo)); - cmsg->cmsg_level = IPPROTO_IPV6; - cmsg->cmsg_type = IPV6_PKTINFO; - in6_pktinfo* pktinfo = reinterpret_cast<in6_pktinfo*>(CMSG_DATA(cmsg)); - memset(pktinfo, 0, sizeof(in6_pktinfo)); - address_string = self_address.ToPackedString(); - memcpy(&pktinfo->ipi6_addr, address_string.c_str(), - address_string.length()); - return sizeof(in6_pktinfo); - } else { - NOTREACHED() << "Unrecognized net::IPAddress"; - return 0; - } -} - -// static -WriteResult QuicSocketUtils::WritePacket( - int fd, - const char* buffer, - size_t buf_len, - const QuicIpAddress& self_address, - const QuicSocketAddress& peer_address) { - sockaddr_storage raw_address = peer_address.generic_address(); - iovec iov = {const_cast<char*>(buffer), buf_len}; - - msghdr hdr; - hdr.msg_name = &raw_address; - hdr.msg_namelen = raw_address.ss_family == AF_INET ? sizeof(sockaddr_in) - : sizeof(sockaddr_in6); - hdr.msg_iov = &iov; - hdr.msg_iovlen = 1; - hdr.msg_flags = 0; - - const int kSpaceForIpv4 = CMSG_SPACE(sizeof(in_pktinfo)); - const int kSpaceForIpv6 = CMSG_SPACE(sizeof(in6_pktinfo)); - // kSpaceForIp should be big enough to hold both IPv4 and IPv6 packet info. - const int kSpaceForIp = - (kSpaceForIpv4 < kSpaceForIpv6) ? kSpaceForIpv6 : kSpaceForIpv4; - char cbuf[kSpaceForIp]; - if (!self_address.IsInitialized()) { - hdr.msg_control = nullptr; - hdr.msg_controllen = 0; - } else { - hdr.msg_control = cbuf; - hdr.msg_controllen = kSpaceForIp; - cmsghdr* cmsg = CMSG_FIRSTHDR(&hdr); - SetIpInfoInCmsg(self_address, cmsg); - hdr.msg_controllen = cmsg->cmsg_len; - } - - int rc; - do { - rc = sendmsg(fd, &hdr, 0); - } while (rc < 0 && errno == EINTR); - if (rc >= 0) { - return WriteResult(WRITE_STATUS_OK, rc); - } - return WriteResult((errno == EAGAIN || errno == EWOULDBLOCK) - ? WRITE_STATUS_BLOCKED - : WRITE_STATUS_ERROR, - errno); -} - -// static -WriteResult QuicSocketUtils::WritePacket(int fd, const QuicMsgHdr& hdr) { - int rc; - do { - rc = sendmsg(fd, hdr.hdr(), 0); - } while (rc < 0 && errno == EINTR); - if (rc >= 0) { - return WriteResult(WRITE_STATUS_OK, rc); - } - return WriteResult((errno == EAGAIN || errno == EWOULDBLOCK) - ? WRITE_STATUS_BLOCKED - : WRITE_STATUS_ERROR, - errno); -} - -// static -void QuicSocketUtils::SetIpInfoInCmsgData(const QuicIpAddress& self_address, - void* cmsg_data) { - DCHECK(self_address.IsInitialized()); - const std::string& address_str = self_address.ToPackedString(); - if (self_address.IsIPv4()) { - in_pktinfo* pktinfo = static_cast<in_pktinfo*>(cmsg_data); - pktinfo->ipi_ifindex = 0; - memcpy(&pktinfo->ipi_spec_dst, address_str.c_str(), address_str.length()); - } else if (self_address.IsIPv6()) { - in6_pktinfo* pktinfo = static_cast<in6_pktinfo*>(cmsg_data); - memcpy(&pktinfo->ipi6_addr, address_str.c_str(), address_str.length()); - } else { - LOG(DFATAL) << "Unrecognized IPAddress"; - } -} - -// static -int QuicSocketUtils::CreateUDPSocket(const QuicSocketAddress& address, - int32_t receive_buffer_size, - int32_t send_buffer_size, - bool* overflow_supported) { - int address_family = address.host().AddressFamilyToInt(); - int fd = socket(address_family, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP); - if (fd < 0) { - QUIC_LOG(ERROR) << "socket() failed: " << strerror(errno); - return -1; - } - - int get_overflow = 1; - int rc = setsockopt(fd, SOL_SOCKET, SO_RXQ_OVFL, &get_overflow, - sizeof(get_overflow)); - if (rc < 0) { - QUIC_DLOG(WARNING) << "Socket overflow detection not supported"; - } else { - *overflow_supported = true; - } - - if (!SetReceiveBufferSize(fd, receive_buffer_size)) { - return -1; - } - - if (!SetSendBufferSize(fd, send_buffer_size)) { - return -1; - } - - rc = SetGetAddressInfo(fd, address_family); - if (rc < 0) { - LOG(ERROR) << "IP detection not supported" << strerror(errno); - return -1; - } - - rc = SetGetSoftwareReceiveTimestamp(fd); - if (rc < 0) { - QUIC_LOG(WARNING) << "SO_TIMESTAMPING not supported; using fallback: " - << strerror(errno); - } - - return fd; -} - -} // namespace quic
diff --git a/net/quic/platform/impl/quic_socket_utils.h b/net/quic/platform/impl/quic_socket_utils.h deleted file mode 100644 index f17845a0..0000000 --- a/net/quic/platform/impl/quic_socket_utils.h +++ /dev/null
@@ -1,202 +0,0 @@ -// Copyright (c) 2012 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. -// -// Some socket related helper methods for quic. - -#ifndef NET_QUIC_PLATFORM_IMPL_QUIC_SOCKET_UTILS_H_ -#define NET_QUIC_PLATFORM_IMPL_QUIC_SOCKET_UTILS_H_ - -#include <netinet/in.h> -#include <stddef.h> -#include <sys/socket.h> - -#include <string> - -#include "base/macros.h" -#include "net/base/ip_address.h" -#include "net/base/ip_endpoint.h" -#include "net/third_party/quiche/src/quic/core/quic_bandwidth.h" -#include "net/third_party/quiche/src/quic/core/quic_types.h" - -#define MMSG_MORE 0 -#define MMSG_MORE_NO_ANDROID 0 - -namespace quic { -class QuicIpAddress; -class QuicSocketAddress; - -// This is the structure that SO_TIMESTAMPING fills into the cmsg header. It is -// well-defined, but does not have a definition in a public header. See -// https://www.kernel.org/doc/Documentation/networking/timestamping.txt for more -// information. -struct LinuxTimestamping { - // The converted system time of the timestamp. - struct timespec systime; - // Deprecated; serves only as padding. - struct timespec hwtimetrans; - // The raw hardware timestamp. - struct timespec hwtimeraw; -}; - -const int kCmsgSpaceForIpv4 = CMSG_SPACE(sizeof(in_pktinfo)); -const int kCmsgSpaceForIpv6 = CMSG_SPACE(sizeof(in6_pktinfo)); -// kCmsgSpaceForIp should be big enough to hold both IPv4 and IPv6 packet info. -const int kCmsgSpaceForIp = (kCmsgSpaceForIpv4 < kCmsgSpaceForIpv6) - ? kCmsgSpaceForIpv6 - : kCmsgSpaceForIpv4; - -const int kCmsgSpaceForSegmentSize = CMSG_SPACE(sizeof(uint16_t)); - -const int kCmsgSpaceForRecvQueueOverflow = CMSG_SPACE(sizeof(int)); -const int kCmsgSpaceForLinuxTimestamping = - CMSG_SPACE(sizeof(LinuxTimestamping)); -const int kCmsgSpaceForTTL = CMSG_SPACE(sizeof(int)); - -// The minimum cmsg buffer size when receiving a packet. It is possible for a -// received packet to contain both IPv4 and IPv6 addresses. -const int kCmsgSpaceForReadPacket = - kCmsgSpaceForRecvQueueOverflow + kCmsgSpaceForIpv4 + kCmsgSpaceForIpv6 + - kCmsgSpaceForLinuxTimestamping + kCmsgSpaceForTTL; - -// QuicMsgHdr is used to build msghdr objects that can be used send packets via -// ::sendmsg. -// -// Example: -// // cbuf holds control messages(cmsgs). The size is determined from what -// // cmsgs will be set for this msghdr. -// char cbuf[kCmsgSpaceForIp + kCmsgSpaceForSegmentSize]; -// QuicMsgHdr hdr(packet_buf, packet_buf_len, peer_addr, cbuf, sizeof(cbuf)); -// -// // Set IP in cmsgs. -// hdr.SetIpInNextCmsg(self_addr); -// -// // Set GSO size in cmsgs. -// *hdr.GetNextCmsgData<uint16_t>(SOL_UDP, UDP_SEGMENT) = 1200; -// -// QuicSocketUtils::WritePacket(fd, hdr); -class QuicMsgHdr { - public: - QuicMsgHdr(const char* buffer, - size_t buf_len, - const QuicSocketAddress& peer_address, - char* cbuf, - size_t cbuf_size); - - // Set IP info in the next cmsg. Both IPv4 and IPv6 are supported. - void SetIpInNextCmsg(const QuicIpAddress& self_address); - - template <typename DataType> - DataType* GetNextCmsgData(int cmsg_level, int cmsg_type) { - return reinterpret_cast<DataType*>( - GetNextCmsgDataInternal(cmsg_level, cmsg_type, sizeof(DataType))); - } - - const msghdr* hdr() const { return &hdr_; } - - protected: - void* GetNextCmsgDataInternal(int cmsg_level, - int cmsg_type, - size_t data_size); - - msghdr hdr_; - iovec iov_; - sockaddr_storage raw_peer_address_; - char* cbuf_; - const size_t cbuf_size_; - // The last cmsg populated so far. nullptr means nothing has been populated. - cmsghdr* cmsg_; -}; - -class QuicSocketUtils { - public: - QuicSocketUtils() = delete; - - // Fills in |address| if |hdr| contains IP_PKTINFO or IPV6_PKTINFO. Fills in - // |timestamp| if |hdr| contains |SO_TIMESTAMPING|. |address| and |timestamp| - // must not be null. - static void GetAddressAndTimestampFromMsghdr(struct msghdr* hdr, - QuicIpAddress* address, - QuicWallTime* walltimestamp); - - // If the msghdr contains an SO_RXQ_OVFL entry, this will set dropped_packets - // to the correct value and return true. Otherwise it will return false. - static bool GetOverflowFromMsghdr(struct msghdr* hdr, - QuicPacketCount* dropped_packets); - - // If the msghdr contains an IP_TTL entry, this will set ttl to the correct - // value and return true. Otherwise it will return false. - static bool GetTtlFromMsghdr(struct msghdr* hdr, int* ttl); - - // Sets either IP_PKTINFO or IPV6_PKTINFO on the socket, based on - // address_family. Returns the return code from setsockopt. - static int SetGetAddressInfo(int fd, int address_family); - - // Sets SO_TIMESTAMPING on the socket for software receive timestamping. - // Returns the return code from setsockopt. - static int SetGetSoftwareReceiveTimestamp(int fd); - - // Sets the send buffer size to |size| and returns false if it fails. - static bool SetSendBufferSize(int fd, size_t size); - - // Sets the receive buffer size to |size| and returns false if it fails. - static bool SetReceiveBufferSize(int fd, size_t size); - - // Reads buf_len from the socket. If reading is successful, returns bytes - // read and sets peer_address to the peer address. Otherwise returns -1. - // - // If dropped_packets is non-null, it will be set to the number of packets - // dropped on the socket since the socket was created, assuming the kernel - // supports this feature. - // - // If self_address is non-null, it will be set to the address the peer sent - // packets to, assuming a packet was read. - // - // If timestamp is non-null, it will be filled with the timestamp of the - // received packet, assuming a packet was read and the platform supports - // packet receipt timestamping. If the platform does not support packet - // receipt timestamping, timestamp will not be changed. - static int ReadPacket(int fd, - char* buffer, - size_t buf_len, - QuicPacketCount* dropped_packets, - QuicIpAddress* self_address, - QuicWallTime* walltimestamp, - QuicSocketAddress* peer_address); - - // Writes buf_len to the socket. If writing is successful, sets the result's - // status to WRITE_STATUS_OK and sets bytes_written. Otherwise sets the - // result's status to WRITE_STATUS_BLOCKED or WRITE_STATUS_ERROR and sets - // error_code to errno. - static WriteResult WritePacket(int fd, - const char* buffer, - size_t buf_len, - const QuicIpAddress& self_address, - const QuicSocketAddress& peer_address); - - // Writes the packet in |hdr| to the socket, using ::sendmsg. - static WriteResult WritePacket(int fd, const QuicMsgHdr& hdr); - - // Set IP(self_address) in |cmsg_data|. Does not touch other fields in the - // containing cmsghdr. - static void SetIpInfoInCmsgData(const QuicIpAddress& self_address, - void* cmsg_data); - - // A helper for WritePacket which fills in the cmsg with the supplied self - // address. - // Returns the length of the packet info structure used. - static size_t SetIpInfoInCmsg(const QuicIpAddress& self_address, - cmsghdr* cmsg); - - // Creates a UDP socket and sets appropriate socket options for QUIC. - // Returns the created FD if successful, -1 otherwise. - // |overflow_supported| is set to true if the socket supports it. - static int CreateUDPSocket(const QuicSocketAddress& address, - int32_t receive_buffer_size, - int32_t send_buffer_size, - bool* overflow_supported); -}; - -} // namespace quic - -#endif // NET_QUIC_PLATFORM_IMPL_QUIC_SOCKET_UTILS_H_
diff --git a/net/quic/platform/impl/quic_socket_utils_test.cc b/net/quic/platform/impl/quic_socket_utils_test.cc deleted file mode 100644 index 4ccc3865..0000000 --- a/net/quic/platform/impl/quic_socket_utils_test.cc +++ /dev/null
@@ -1,175 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "net/quic/platform/impl/quic_socket_utils.h" - -#include <fcntl.h> - -#include <array> - -#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_test.h" - -namespace quic { -namespace test { -namespace { - -// A test fixture is used to ensure that all sockets are closed down gracefully -// upon test completion. Also provides a convenient API to Bind not presently -// available in QuicSocketUtils. -class QuicSocketUtilsTest : public QuicTest { - protected: - ~QuicSocketUtilsTest() override { - for (int fd : open_sockets_) { - close(fd); - } - } - - int CreateUDPSocket(const QuicSocketAddress& address) { - bool overflow_supported = false; - int fd = QuicSocketUtils::CreateUDPSocket( - address, /*receive_buffer_size =*/kDefaultSocketReceiveBuffer, - /*send_buffer_size =*/kDefaultSocketReceiveBuffer, &overflow_supported); - if (fd != -1) { - open_sockets_.push_back(fd); - } - return fd; - } - - int CreateBoundUDPSocket(QuicSocketAddress* address) { - int fd = CreateUDPSocket(*address); - *address = BindSocket(fd, *address); - if (!address->IsInitialized()) { - close(fd); - fd = -1; - } - return fd; - } - - QuicSocketAddress BindSocket(int fd, const QuicSocketAddress& address) { - QuicSocketAddress bound_address; - - if (fd == -1) { - return bound_address; - } - - sockaddr_storage bind_addr_native = address.generic_address(); - socklen_t bind_addr_size = 0; - - switch (address.host().address_family()) { - case IpAddressFamily::IP_V4: - bind_addr_size = sizeof(struct sockaddr_in); - break; - case IpAddressFamily::IP_V6: - bind_addr_size = sizeof(struct sockaddr_in6); - break; - case IpAddressFamily::IP_UNSPEC: - QUIC_LOG(FATAL) << "Unspecified IP address family"; - } - - int rc = bind(fd, reinterpret_cast<sockaddr*>(&bind_addr_native), - bind_addr_size); - if (rc != 0) { - QUIC_LOG(ERROR) << "Failed to bind socket to " << address.ToString() - << ": " << strerror(errno); - return bound_address; - } - - rc = bound_address.FromSocket(fd); - if (rc != 0) { - QUIC_LOG(ERROR) << "Failed to get bound socket address from fd: " - << strerror(errno); - bound_address = QuicSocketAddress(); - } - return bound_address; - } - - private: - std::vector<int> open_sockets_; -}; - -// This test verifies that QuicSocketUtils creates a non-blocking socket -// successfully by seeing if a read blocks. -TEST_F(QuicSocketUtilsTest, NonBlockingSocket) { - std::array<char, 512> buffer; - - QuicIpAddress localhost = QuicIpAddress::Loopback4(); - QuicSocketAddress addr(localhost, 0); - - int fd = CreateUDPSocket(addr); - ASSERT_NE(-1, fd); - - int fd_flags = fcntl(fd, F_GETFL, 0); - - // Assert so that the test errors out quickly rather than blocking below and - // relying on timeouts. - ASSERT_TRUE(fd_flags & O_NONBLOCK) << "Socket not reporting as non-blocking"; - - QuicIpAddress target_server_addr; - auto walltimestamp = QuicWallTime::Zero(); - QuicSocketAddress remote_addr; - int bytes_read = QuicSocketUtils::ReadPacket(fd, buffer.data(), buffer.size(), - nullptr, &target_server_addr, - &walltimestamp, &remote_addr); - EXPECT_EQ(-1, bytes_read); -} - -// This test verifies that we can successfully WritePacket/ReadPacket between -// two localhost sockets. -TEST_F(QuicSocketUtilsTest, PacketRoundTrip) { - QuicIpAddress localhost = QuicIpAddress::Loopback4(); - QuicSocketAddress client_addr(localhost, 0); - QuicSocketAddress server_addr(localhost, 0); - - int server_fd = CreateBoundUDPSocket(&server_addr); - int client_fd = CreateUDPSocket(client_addr); - - ASSERT_NE(-1, server_fd); - ASSERT_NE(-1, client_fd); - - { - std::array<char, 512> write_buffer; - for (size_t i = 0; i < write_buffer.size(); i++) { - write_buffer[i] = static_cast<char>(i); - } - auto res = QuicSocketUtils::WritePacket(client_fd, write_buffer.data(), - write_buffer.size(), - QuicIpAddress(), server_addr); - ASSERT_EQ(WRITE_STATUS_OK, res.status) - << "Failed to write with error " << res.error_code; - EXPECT_EQ(512, res.bytes_written); - } - - fd_set read_fds; - FD_ZERO(&read_fds); - FD_SET(server_fd, &read_fds); - - timeval select_timeout; - select_timeout.tv_sec = 5; - select_timeout.tv_usec = 0; - - int select_rc = - select(1 + server_fd, &read_fds, nullptr, nullptr, &select_timeout); - EXPECT_EQ(select_rc, 1) << "server_fd didn't become read selectable: " - << errno; - - { - std::array<char, 1024> read_buffer; - QuicIpAddress target_server_addr; - auto walltimestamp = QuicWallTime::Zero(); - QuicSocketAddress remote_addr; - int bytes_read = QuicSocketUtils::ReadPacket( - server_fd, read_buffer.data(), read_buffer.size(), nullptr, - &target_server_addr, &walltimestamp, &remote_addr); - EXPECT_EQ(512, bytes_read); - for (int i = 0; i < bytes_read; i++) { - EXPECT_EQ(static_cast<char>(i), read_buffer[i]); - } - } -} - -} // namespace -} // namespace test -} // namespace quic
diff --git a/net/quic/platform/impl/quic_testvalue_impl.h b/net/quic/platform/impl/quic_testvalue_impl.h deleted file mode 100644 index e24ca0b..0000000 --- a/net/quic/platform/impl/quic_testvalue_impl.h +++ /dev/null
@@ -1,17 +0,0 @@ -// Copyright (c) 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef NET_QUIC_PLATFORM_IMPL_QUIC_TESTVALUE_IMPL_H_ -#define NET_QUIC_PLATFORM_IMPL_QUIC_TESTVALUE_IMPL_H_ - -#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" - -namespace quic { - -template <class T> -void AdjustTestValueImpl(absl::string_view label, T* var) {} - -} // namespace quic - -#endif // NET_QUIC_PLATFORM_IMPL_QUIC_TESTVALUE_IMPL_H_
diff --git a/net/quic/quic_chromium_client_session_peer.cc b/net/quic/quic_chromium_client_session_peer.cc index 8d4747f8..90c54153 100644 --- a/net/quic/quic_chromium_client_session_peer.cc +++ b/net/quic/quic_chromium_client_session_peer.cc
@@ -4,6 +4,7 @@ #include "net/quic/quic_chromium_client_session_peer.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/quic/quic_chromium_client_session.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" @@ -16,9 +17,8 @@ quic::QuicServerId server_id(hostname, session->session_key_.server_id().port(), session->session_key_.privacy_mode()); - session->session_key_ = - QuicSessionKey(server_id, SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */); + session->session_key_ = QuicSessionKey( + server_id, SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow); } // static
diff --git a/net/quic/quic_chromium_client_session_test.cc b/net/quic/quic_chromium_client_session_test.cc index 40ef2277..58906e65 100644 --- a/net/quic/quic_chromium_client_session_test.cc +++ b/net/quic/quic_chromium_client_session_test.cc
@@ -20,6 +20,7 @@ #include "net/base/schemeful_site.h" #include "net/base/test_completion_callback.h" #include "net/cert/cert_verify_result.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/transport_security_state.h" #include "net/http/transport_security_state_test_util.h" #include "net/log/net_log_source.h" @@ -142,7 +143,7 @@ PRIVACY_MODE_DISABLED, SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), destination_(kServerHostname, kServerPort), default_network_(NetworkChangeNotifier::kInvalidNetworkHandle), client_maker_(version_, @@ -1582,39 +1583,39 @@ EXPECT_TRUE(session_->CanPool( "www.example.org", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */))); + NetworkIsolationKey(), SecureDnsPolicy::kAllow))); EXPECT_FALSE(session_->CanPool( "www.example.org", QuicSessionKey("foo", 1234, PRIVACY_MODE_ENABLED, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */))); + NetworkIsolationKey(), SecureDnsPolicy::kAllow))); EXPECT_FALSE(session_->CanPool( "www.example.org", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), - NetworkIsolationKey(), true /* disable_secure_dns */))); + NetworkIsolationKey(), SecureDnsPolicy::kDisable))); #if defined(OS_ANDROID) SocketTag tag1(SocketTag::UNSET_UID, 0x12345678); SocketTag tag2(getuid(), 0x87654321); EXPECT_FALSE(session_->CanPool( "www.example.org", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, tag1, - NetworkIsolationKey(), false /* disable_secure_dns */))); + NetworkIsolationKey(), SecureDnsPolicy::kAllow))); EXPECT_FALSE(session_->CanPool( "www.example.org", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, tag2, - NetworkIsolationKey(), false /* disable_secure_dns */))); + NetworkIsolationKey(), SecureDnsPolicy::kAllow))); #endif EXPECT_TRUE(session_->CanPool( "mail.example.org", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */))); + NetworkIsolationKey(), SecureDnsPolicy::kAllow))); EXPECT_TRUE(session_->CanPool( "mail.example.com", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */))); + NetworkIsolationKey(), SecureDnsPolicy::kAllow))); EXPECT_FALSE(session_->CanPool( "mail.google.com", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */))); + NetworkIsolationKey(), SecureDnsPolicy::kAllow))); const SchemefulSite kSiteFoo(GURL("http://foo.test/")); @@ -1627,7 +1628,7 @@ "mail.example.com", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), NetworkIsolationKey(kSiteFoo, kSiteFoo), - false /* disable_secure_dns */))); + SecureDnsPolicy::kAllow))); } { base::test::ScopedFeatureList feature_list; @@ -1637,7 +1638,7 @@ "mail.example.com", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), NetworkIsolationKey(kSiteFoo, kSiteFoo), - false /* disable_secure_dns */))); + SecureDnsPolicy::kAllow))); } } @@ -1656,9 +1657,9 @@ // Need to create a session key after setting // kPartitionExpectCTStateByNetworkIsolationKey, otherwise, it will ignore the // NetworkIsolationKey value. - session_key_ = QuicSessionKey( - kServerHostname, kServerPort, PRIVACY_MODE_DISABLED, SocketTag(), - network_isolation_key, false /* disable_secure_dns */); + session_key_ = QuicSessionKey(kServerHostname, kServerPort, + PRIVACY_MODE_DISABLED, SocketTag(), + network_isolation_key, SecureDnsPolicy::kAllow); // Need to create this after enabling // kPartitionExpectCTStateByNetworkIsolationKey. @@ -1693,7 +1694,7 @@ EXPECT_TRUE(session_->CanPool( "www.example.org", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), - network_isolation_key, false /* disable_secure_dns */))); + network_isolation_key, SecureDnsPolicy::kAllow))); // Adding Expect-CT data for different NetworkIsolationKeys should have no // effect. @@ -1707,7 +1708,7 @@ EXPECT_TRUE(session_->CanPool( "www.example.org", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), - network_isolation_key, false /* disable_secure_dns */))); + network_isolation_key, SecureDnsPolicy::kAllow))); // Adding Expect-CT data for the same NetworkIsolationKey should prevent // pooling. @@ -1717,7 +1718,7 @@ EXPECT_FALSE(session_->CanPool( "www.example.org", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), - network_isolation_key, false /* disable_secure_dns */))); + network_isolation_key, SecureDnsPolicy::kAllow))); } // Much as above, but uses a non-empty NetworkIsolationKey. @@ -1731,9 +1732,9 @@ const NetworkIsolationKey kNetworkIsolationKey1(kSiteFoo, kSiteFoo); const NetworkIsolationKey kNetworkIsolationKey2(kSiteBar, kSiteBar); - session_key_ = QuicSessionKey( - kServerHostname, kServerPort, PRIVACY_MODE_DISABLED, SocketTag(), - kNetworkIsolationKey1, false /* disable_secure_dns */); + session_key_ = QuicSessionKey(kServerHostname, kServerPort, + PRIVACY_MODE_DISABLED, SocketTag(), + kNetworkIsolationKey1, SecureDnsPolicy::kAllow); MockQuicData quic_data(version_); if (VersionUsesHttp3(version_.transport_version)) @@ -1758,44 +1759,44 @@ EXPECT_TRUE(session_->CanPool( "www.example.org", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), - kNetworkIsolationKey1, false /* disable_secure_dns */))); + kNetworkIsolationKey1, SecureDnsPolicy::kAllow))); EXPECT_FALSE(session_->CanPool( "www.example.org", QuicSessionKey("foo", 1234, PRIVACY_MODE_ENABLED, SocketTag(), - kNetworkIsolationKey1, false /* disable_secure_dns */))); + kNetworkIsolationKey1, SecureDnsPolicy::kAllow))); #if defined(OS_ANDROID) SocketTag tag1(SocketTag::UNSET_UID, 0x12345678); SocketTag tag2(getuid(), 0x87654321); EXPECT_FALSE(session_->CanPool( "www.example.org", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, tag1, - kNetworkIsolationKey1, false /* disable_secure_dns */))); + kNetworkIsolationKey1, SecureDnsPolicy::kAllow))); EXPECT_FALSE(session_->CanPool( "www.example.org", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, tag2, - kNetworkIsolationKey1, false /* disable_secure_dns */))); + kNetworkIsolationKey1, SecureDnsPolicy::kAllow))); #endif EXPECT_TRUE(session_->CanPool( "mail.example.org", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), - kNetworkIsolationKey1, false /* disable_secure_dns */))); + kNetworkIsolationKey1, SecureDnsPolicy::kAllow))); EXPECT_TRUE(session_->CanPool( "mail.example.com", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), - kNetworkIsolationKey1, false /* disable_secure_dns */))); + kNetworkIsolationKey1, SecureDnsPolicy::kAllow))); EXPECT_FALSE(session_->CanPool( "mail.google.com", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), - kNetworkIsolationKey1, false /* disable_secure_dns */))); + kNetworkIsolationKey1, SecureDnsPolicy::kAllow))); EXPECT_FALSE(session_->CanPool( "mail.example.com", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), - kNetworkIsolationKey2, false /* disable_secure_dns */))); + kNetworkIsolationKey2, SecureDnsPolicy::kAllow))); EXPECT_FALSE(session_->CanPool( "mail.example.com", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */))); + NetworkIsolationKey(), SecureDnsPolicy::kAllow))); } TEST_P(QuicChromiumClientSessionTest, ConnectionNotPooledWithDifferentPin) { @@ -1838,7 +1839,7 @@ EXPECT_FALSE(session_->CanPool( kPreloadedPKPHost, QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */))); + NetworkIsolationKey(), SecureDnsPolicy::kAllow))); } TEST_P(QuicChromiumClientSessionTest, ConnectionPooledWithMatchingPin) { @@ -1872,7 +1873,7 @@ EXPECT_TRUE(session_->CanPool( "mail.example.org", QuicSessionKey("foo", 1234, PRIVACY_MODE_DISABLED, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */))); + NetworkIsolationKey(), SecureDnsPolicy::kAllow))); } TEST_P(QuicChromiumClientSessionTest, MigrateToSocket) {
diff --git a/net/quic/quic_http_stream_test.cc b/net/quic/quic_http_stream_test.cc index 38953d8..348030f 100644 --- a/net/quic/quic_http_stream_test.cc +++ b/net/quic/quic_http_stream_test.cc
@@ -27,6 +27,7 @@ #include "net/base/net_errors.h" #include "net/base/test_completion_callback.h" #include "net/base/upload_bytes_element_reader.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_response_headers.h" #include "net/http/transport_security_state.h" #include "net/log/net_log_event_type.h" @@ -399,7 +400,7 @@ base::WrapUnique(static_cast<QuicServerInfo*>(nullptr)), QuicSessionKey(kDefaultServerHostName, kDefaultServerPort, PRIVACY_MODE_DISABLED, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */), + NetworkIsolationKey(), SecureDnsPolicy::kAllow), /*require_confirmation=*/false, /*migrate_session_early_v2=*/false, /*migrate_session_on_network_change_v2=*/false,
diff --git a/net/quic/quic_proxy_client_socket_unittest.cc b/net/quic/quic_proxy_client_socket_unittest.cc index 6e387ef4..6bcc540 100644 --- a/net/quic/quic_proxy_client_socket_unittest.cc +++ b/net/quic/quic_proxy_client_socket_unittest.cc
@@ -18,6 +18,7 @@ #include "base/time/default_tick_clock.h" #include "net/base/test_proxy_delegate.h" #include "net/dns/mock_host_resolver.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_auth_cache.h" #include "net/http/http_auth_handler_factory.h" #include "net/http/http_response_headers.h" @@ -256,7 +257,7 @@ base::WrapUnique(static_cast<QuicServerInfo*>(nullptr)), QuicSessionKey("mail.example.org", 80, PRIVACY_MODE_DISABLED, SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), /*require_confirmation=*/false, /*migrate_session_early_v2=*/false, /*migrate_session_on_network_change_v2=*/false,
diff --git a/net/quic/quic_session_key.cc b/net/quic/quic_session_key.cc index 69706c6b..892032a3 100644 --- a/net/quic/quic_session_key.cc +++ b/net/quic/quic_session_key.cc
@@ -6,6 +6,7 @@ #include "base/feature_list.h" #include "net/base/features.h" +#include "net/dns/public/secure_dns_policy.h" namespace net { @@ -15,20 +16,20 @@ PrivacyMode privacy_mode, const SocketTag& socket_tag, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns) + SecureDnsPolicy secure_dns_policy) : QuicSessionKey(host_port_pair.host(), host_port_pair.port(), privacy_mode, socket_tag, network_isolation_key, - disable_secure_dns) {} + secure_dns_policy) {} QuicSessionKey::QuicSessionKey(const std::string& host, uint16_t port, PrivacyMode privacy_mode, const SocketTag& socket_tag, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns) + SecureDnsPolicy secure_dns_policy) : QuicSessionKey( // TODO(crbug.com/1103350): Handle non-boolean privacy modes. quic::QuicServerId( @@ -38,12 +39,12 @@ privacy_mode == PRIVACY_MODE_ENABLED), socket_tag, network_isolation_key, - disable_secure_dns) {} + secure_dns_policy) {} QuicSessionKey::QuicSessionKey(const quic::QuicServerId& server_id, const SocketTag& socket_tag, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns) + SecureDnsPolicy secure_dns_policy) : server_id_(server_id), socket_tag_(socket_tag), network_isolation_key_( @@ -51,20 +52,20 @@ features::kPartitionConnectionsByNetworkIsolationKey) ? network_isolation_key : NetworkIsolationKey()), - disable_secure_dns_(disable_secure_dns) {} + secure_dns_policy_(secure_dns_policy) {} QuicSessionKey::QuicSessionKey(const QuicSessionKey& other) = default; bool QuicSessionKey::operator<(const QuicSessionKey& other) const { return std::tie(server_id_, socket_tag_, network_isolation_key_, - disable_secure_dns_) < + secure_dns_policy_) < std::tie(other.server_id_, other.socket_tag_, - other.network_isolation_key_, other.disable_secure_dns_); + other.network_isolation_key_, other.secure_dns_policy_); } bool QuicSessionKey::operator==(const QuicSessionKey& other) const { return server_id_ == other.server_id_ && socket_tag_ == other.socket_tag_ && network_isolation_key_ == other.network_isolation_key_ && - disable_secure_dns_ == other.disable_secure_dns_; + secure_dns_policy_ == other.secure_dns_policy_; } bool QuicSessionKey::CanUseForAliasing(const QuicSessionKey& other) const { @@ -72,7 +73,7 @@ other.server_id_.privacy_mode_enabled() && socket_tag_ == other.socket_tag_ && network_isolation_key_ == other.network_isolation_key_ && - disable_secure_dns_ == other.disable_secure_dns_; + secure_dns_policy_ == other.secure_dns_policy_; } size_t QuicSessionKey::EstimateMemoryUsage() const {
diff --git a/net/quic/quic_session_key.h b/net/quic/quic_session_key.h index 6753004..90a99c2 100644 --- a/net/quic/quic_session_key.h +++ b/net/quic/quic_session_key.h
@@ -8,6 +8,7 @@ #include "net/base/host_port_pair.h" #include "net/base/network_isolation_key.h" #include "net/base/privacy_mode.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/socket/socket_tag.h" #include "net/third_party/quiche/src/quic/core/quic_server_id.h" @@ -22,17 +23,17 @@ PrivacyMode privacy_mode, const SocketTag& socket_tag, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns); + SecureDnsPolicy secure_dns_policy); QuicSessionKey(const std::string& host, uint16_t port, PrivacyMode privacy_mode, const SocketTag& socket_tag, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns); + SecureDnsPolicy secure_dns_policy); QuicSessionKey(const quic::QuicServerId& server_id, const SocketTag& socket_tag, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns); + SecureDnsPolicy secure_dns_policy); QuicSessionKey(const QuicSessionKey& other); ~QuicSessionKey() = default; @@ -65,7 +66,7 @@ return network_isolation_key_; } - bool disable_secure_dns() const { return disable_secure_dns_; } + SecureDnsPolicy secure_dns_policy() const { return secure_dns_policy_; } size_t EstimateMemoryUsage() const; @@ -74,7 +75,7 @@ SocketTag socket_tag_; // Used to separate requests made in different contexts. NetworkIsolationKey network_isolation_key_; - bool disable_secure_dns_; + SecureDnsPolicy secure_dns_policy_; }; } // namespace net
diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc index 0286f861..5d39a6c 100644 --- a/net/quic/quic_stream_factory.cc +++ b/net/quic/quic_stream_factory.cc
@@ -36,6 +36,7 @@ #include "net/dns/dns_alias_utility.h" #include "net/dns/host_resolver.h" #include "net/dns/public/secure_dns_mode.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/log/net_log.h" #include "net/log/net_log_capture_mode.h" #include "net/log/net_log_event_type.h" @@ -703,7 +704,7 @@ parameters.cache_usage = HostResolver::ResolveHostParameters::CacheUsage::STALE_ALLOWED; } - if (key_.session_key().disable_secure_dns()) + if (key_.session_key().secure_dns_policy() == SecureDnsPolicy::kDisable) parameters.secure_dns_mode_override = SecureDnsMode::kOff; resolve_host_request_ = host_resolver_->CreateRequest( key_.destination(), key_.session_key().network_isolation_key(), net_log_, @@ -990,7 +991,7 @@ RequestPriority priority, const SocketTag& socket_tag, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns, + SecureDnsPolicy secure_dns_policy, bool use_dns_aliases, int cert_verify_flags, const GURL& url, @@ -1009,7 +1010,7 @@ std::move(failed_on_default_network_callback); session_key_ = QuicSessionKey(HostPortPair::FromURL(url), privacy_mode, socket_tag, - network_isolation_key, disable_secure_dns); + network_isolation_key, secure_dns_policy); int rv = factory_->Create(session_key_, destination, quic_version, priority,
diff --git a/net/quic/quic_stream_factory.h b/net/quic/quic_stream_factory.h index c8b1219..0bcceda7 100644 --- a/net/quic/quic_stream_factory.h +++ b/net/quic/quic_stream_factory.h
@@ -28,6 +28,7 @@ #include "net/base/network_change_notifier.h" #include "net/base/proxy_server.h" #include "net/cert/cert_database.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_server_properties.h" #include "net/http/http_stream_factory.h" #include "net/log/net_log_with_source.h" @@ -127,7 +128,7 @@ RequestPriority priority, const SocketTag& socket_tag, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns, + SecureDnsPolicy secure_dns_policy, bool use_dns_aliases, int cert_verify_flags, const GURL& url,
diff --git a/net/quic/quic_stream_factory_fuzzer.cc b/net/quic/quic_stream_factory_fuzzer.cc index 241c1d6..67e583c 100644 --- a/net/quic/quic_stream_factory_fuzzer.cc +++ b/net/quic/quic_stream_factory_fuzzer.cc
@@ -15,6 +15,7 @@ #include "net/cert/x509_certificate.h" #include "net/dns/context_host_resolver.h" #include "net/dns/fuzzed_host_resolver_util.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_server_properties.h" #include "net/http/transport_security_state.h" #include "net/quic/mock_crypto_client_stream_factory.h" @@ -147,7 +148,7 @@ request.Request( env->host_port_pair, version, PRIVACY_MODE_DISABLED, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), false /* disable_secure_dns */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, true /* use_dns_aliases */, kCertVerifyFlags, GURL(kUrl), env->net_log, &net_error_details, /*failed_on_default_network_callback=*/CompletionOnceCallback(),
diff --git a/net/quic/quic_stream_factory_peer.cc b/net/quic/quic_stream_factory_peer.cc index b6be7df2..0770124 100644 --- a/net/quic/quic_stream_factory_peer.cc +++ b/net/quic/quic_stream_factory_peer.cc
@@ -9,6 +9,7 @@ #include "net/cert/x509_certificate.h" #include "net/cert/x509_util.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/quic/platform/impl/quic_chromium_clock.h" #include "net/quic/quic_chromium_client_session.h" #include "net/quic/quic_http_stream.h" @@ -38,16 +39,14 @@ QuicStreamFactory* factory, const quic::QuicServerId& server_id, const NetworkIsolationKey& network_isolation_key) { - return factory->HasActiveSession( - QuicSessionKey(server_id, SocketTag(), network_isolation_key, - false /* disable_secure_dns */)); + return factory->HasActiveSession(QuicSessionKey( + server_id, SocketTag(), network_isolation_key, SecureDnsPolicy::kAllow)); } bool QuicStreamFactoryPeer::HasActiveJob(QuicStreamFactory* factory, const quic::QuicServerId& server_id) { - return factory->HasActiveJob(QuicSessionKey(server_id, SocketTag(), - NetworkIsolationKey(), - false /* disable_secure_dns */)); + return factory->HasActiveJob(QuicSessionKey( + server_id, SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow)); } // static @@ -56,7 +55,7 @@ const quic::QuicServerId& server_id, const HostPortPair& destination) { QuicSessionKey session_key(server_id, SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); QuicStreamFactory::QuicSessionAliasKey key(destination, session_key); DCHECK(factory->HasActiveJob(session_key)); DCHECK_EQ(factory->all_sessions_.size(), 1u); @@ -69,7 +68,7 @@ const quic::QuicServerId& server_id, const NetworkIsolationKey& network_isolation_key) { QuicSessionKey session_key(server_id, SocketTag(), network_isolation_key, - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); DCHECK(factory->HasActiveSession(session_key)); return factory->active_sessions_[session_key]; } @@ -78,9 +77,8 @@ QuicStreamFactory* factory, const HostPortPair& destination, const quic::QuicServerId& server_id) { - QuicSessionKey session_key = - QuicSessionKey(server_id, SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */); + QuicSessionKey session_key = QuicSessionKey( + server_id, SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow); QuicStreamFactory::QuicSessionAliasKey alias_key = QuicStreamFactory::QuicSessionAliasKey(destination, session_key); for (auto it = factory->all_sessions_.begin();
diff --git a/net/quic/quic_stream_factory_test.cc b/net/quic/quic_stream_factory_test.cc index 8d25776..357fd5c 100644 --- a/net/quic/quic_stream_factory_test.cc +++ b/net/quic/quic_stream_factory_test.cc
@@ -31,6 +31,7 @@ #include "net/dns/mock_host_resolver.h" #include "net/dns/public/dns_query_type.h" #include "net/dns/public/secure_dns_mode.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_response_headers.h" #include "net/http/http_response_info.h" #include "net/http/http_server_properties.h" @@ -341,8 +342,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( destination, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -500,8 +501,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -715,7 +716,7 @@ request.Request( HostPortPair(quic_server_id1.host(), quic_server_id1.port()), version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), - network_isolation_key1, false /* disable_secure_dns */, + network_isolation_key1, SecureDnsPolicy::kAllow, true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -758,7 +759,7 @@ request2.Request( HostPortPair(quic_server_id2.host(), quic_server_id2.port()), version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), - network_isolation_key2, false /* disable_secure_dns */, + network_isolation_key2, SecureDnsPolicy::kAllow, true /* use_dns_aliases */, /*cert_verify_flags=*/0, vary_network_isolation_key ? url_ : GURL("https://mail.example.org/"), @@ -945,8 +946,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -960,8 +961,8 @@ EXPECT_EQ(OK, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); // Will reset stream 3. @@ -975,8 +976,8 @@ EXPECT_EQ(OK, request3.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); stream = CreateStream(&request3); // Will reset stream 5. @@ -1009,8 +1010,8 @@ EXPECT_EQ(OK, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -1048,8 +1049,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_FALSE(HasActiveSession(host_port_pair_)); @@ -1081,8 +1082,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -1111,8 +1112,8 @@ EXPECT_EQ(ERR_IO_PENDING, request->Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); request.reset(); @@ -1144,8 +1145,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -1188,8 +1189,8 @@ QuicStreamRequest request(factory_.get()); EXPECT_THAT(request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback()), IsOk()); @@ -1229,8 +1230,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -1297,8 +1298,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), network_isolation_key, - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), network_isolation_key, SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -1340,8 +1341,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -1375,8 +1376,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -1405,8 +1406,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -1448,8 +1449,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -1529,7 +1530,7 @@ request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), kNetworkIsolationKeys[i], - false /* disable_secure_dns */, true /* use_dns_aliases */, + SecureDnsPolicy::kAllow, true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -1586,7 +1587,7 @@ request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), kNetworkIsolationKeys[i], - false /* disable_secure_dns */, true /* use_dns_aliases */, + SecureDnsPolicy::kAllow, true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -1629,8 +1630,8 @@ EXPECT_EQ(OK, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); std::unique_ptr<HttpStream> stream = CreateStream(&request); @@ -1638,13 +1639,12 @@ TestCompletionCallback callback; QuicStreamRequest request2(factory_.get()); - EXPECT_EQ(OK, - request2.Request( - server2, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */, - true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, - net_log_, &net_error_details_, - failed_on_default_network_callback_, callback.callback())); + EXPECT_EQ(OK, request2.Request( + server2, version_, privacy_mode_, DEFAULT_PRIORITY, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, + net_log_, &net_error_details_, + failed_on_default_network_callback_, callback.callback())); std::unique_ptr<HttpStream> stream2 = CreateStream(&request2); EXPECT_TRUE(stream2.get()); @@ -1692,7 +1692,7 @@ EXPECT_EQ(ERR_IO_PENDING, request2.Request( server2, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */, + NetworkIsolationKey(), SecureDnsPolicy::kAllow, true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback.callback())); @@ -1733,8 +1733,8 @@ EXPECT_EQ(OK, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); std::unique_ptr<HttpStream> stream = CreateStream(&request); @@ -1742,13 +1742,12 @@ TestCompletionCallback callback; QuicStreamRequest request2(factory_.get()); - EXPECT_EQ(OK, - request2.Request( - server2, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */, - true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, - net_log_, &net_error_details_, - failed_on_default_network_callback_, callback.callback())); + EXPECT_EQ(OK, request2.Request( + server2, version_, privacy_mode_, DEFAULT_PRIORITY, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, + net_log_, &net_error_details_, + failed_on_default_network_callback_, callback.callback())); std::unique_ptr<HttpStream> stream2 = CreateStream(&request2); EXPECT_TRUE(stream2.get()); @@ -1758,13 +1757,12 @@ TestCompletionCallback callback3; QuicStreamRequest request3(factory_.get()); - EXPECT_EQ(OK, - request3.Request( - server2, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */, - true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, - net_log_, &net_error_details_, - failed_on_default_network_callback_, callback3.callback())); + EXPECT_EQ(OK, request3.Request( + server2, version_, privacy_mode_, DEFAULT_PRIORITY, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, + net_log_, &net_error_details_, + failed_on_default_network_callback_, callback3.callback())); std::unique_ptr<HttpStream> stream3 = CreateStream(&request3); EXPECT_TRUE(stream3.get()); @@ -1796,25 +1794,23 @@ host_resolver_->rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); QuicStreamRequest request(factory_.get()); - EXPECT_EQ(OK, - request.Request( - server1, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */, - true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, - net_log_, &net_error_details_, - failed_on_default_network_callback_, callback_.callback())); + EXPECT_EQ(OK, request.Request( + server1, version_, privacy_mode_, DEFAULT_PRIORITY, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, + net_log_, &net_error_details_, + failed_on_default_network_callback_, callback_.callback())); std::unique_ptr<HttpStream> stream = CreateStream(&request); EXPECT_TRUE(stream.get()); TestCompletionCallback callback; QuicStreamRequest request2(factory_.get()); - EXPECT_EQ(OK, - request2.Request( - server2, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */, - true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, - net_log_, &net_error_details_, - failed_on_default_network_callback_, callback_.callback())); + EXPECT_EQ(OK, request2.Request( + server2, version_, privacy_mode_, DEFAULT_PRIORITY, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, + net_log_, &net_error_details_, + failed_on_default_network_callback_, callback_.callback())); std::unique_ptr<HttpStream> stream2 = CreateStream(&request2); EXPECT_TRUE(stream2.get()); @@ -1849,25 +1845,23 @@ host_resolver_->rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); QuicStreamRequest request(factory_.get()); - EXPECT_EQ(OK, - request.Request( - server1, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */, - true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, - net_log_, &net_error_details_, - failed_on_default_network_callback_, callback_.callback())); + EXPECT_EQ(OK, request.Request( + server1, version_, privacy_mode_, DEFAULT_PRIORITY, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, + net_log_, &net_error_details_, + failed_on_default_network_callback_, callback_.callback())); std::unique_ptr<HttpStream> stream = CreateStream(&request); EXPECT_TRUE(stream.get()); TestCompletionCallback callback; QuicStreamRequest request2(factory_.get()); - EXPECT_EQ(OK, - request2.Request( - server2, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */, - true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, - net_log_, &net_error_details_, - failed_on_default_network_callback_, callback_.callback())); + EXPECT_EQ(OK, request2.Request( + server2, version_, privacy_mode_, DEFAULT_PRIORITY, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, + net_log_, &net_error_details_, + failed_on_default_network_callback_, callback_.callback())); std::unique_ptr<HttpStream> stream2 = CreateStream(&request2); EXPECT_TRUE(stream2.get()); @@ -1915,25 +1909,23 @@ host_resolver_->rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); QuicStreamRequest request(factory_.get()); - EXPECT_EQ(OK, - request.Request( - server1, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */, - true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, - net_log_, &net_error_details_, - failed_on_default_network_callback_, callback_.callback())); + EXPECT_EQ(OK, request.Request( + server1, version_, privacy_mode_, DEFAULT_PRIORITY, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, + net_log_, &net_error_details_, + failed_on_default_network_callback_, callback_.callback())); std::unique_ptr<HttpStream> stream = CreateStream(&request); EXPECT_TRUE(stream.get()); TestCompletionCallback callback; QuicStreamRequest request2(factory_.get()); - EXPECT_EQ(OK, - request2.Request( - server2, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */, - true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, - net_log_, &net_error_details_, - failed_on_default_network_callback_, callback_.callback())); + EXPECT_EQ(OK, request2.Request( + server2, version_, privacy_mode_, DEFAULT_PRIORITY, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, + net_log_, &net_error_details_, + failed_on_default_network_callback_, callback_.callback())); std::unique_ptr<HttpStream> stream2 = CreateStream(&request2); EXPECT_TRUE(stream2.get()); @@ -1967,8 +1959,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -1990,8 +1982,8 @@ EXPECT_EQ(ERR_IO_PENDING, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -2061,10 +2053,10 @@ QuicStreamRequest request(factory_.get()); int rv = request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */, - true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, - &net_error_details_, failed_on_default_network_callback_, - callback_.callback()); + NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, + /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, + failed_on_default_network_callback_, callback_.callback()); if (i == 0) { EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -2083,8 +2075,8 @@ EXPECT_EQ(OK, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, CompletionOnceCallback())); std::unique_ptr<HttpStream> stream = CreateStream(&request); @@ -2123,8 +2115,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -2145,8 +2137,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -2168,8 +2160,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); } @@ -2180,8 +2172,8 @@ EXPECT_EQ(OK, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); std::unique_ptr<HttpStream> stream = CreateStream(&request2); @@ -2223,8 +2215,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -2249,8 +2241,8 @@ EXPECT_EQ(ERR_IO_PENDING, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -2286,8 +2278,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(ERR_QUIC_HANDSHAKE_FAILED, callback_.WaitForResult()); @@ -2310,8 +2302,8 @@ EXPECT_EQ(ERR_IO_PENDING, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_FALSE(HasActiveSession(host_port_pair_)); @@ -2356,8 +2348,8 @@ EXPECT_EQ(ERR_QUIC_HANDSHAKE_FAILED, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); // Check no active session, or active jobs left for this server. @@ -2380,8 +2372,8 @@ EXPECT_EQ(ERR_IO_PENDING, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_FALSE(HasActiveSession(host_port_pair_)); @@ -2435,8 +2427,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -2470,8 +2462,8 @@ EXPECT_EQ(ERR_IO_PENDING, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -2532,8 +2524,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -2579,8 +2571,8 @@ EXPECT_EQ(ERR_IO_PENDING, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -2628,8 +2620,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -2653,8 +2645,8 @@ EXPECT_EQ(OK, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); stream = CreateStream(&request2); @@ -2754,8 +2746,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -2967,8 +2959,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -3127,8 +3119,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -3296,8 +3288,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -3371,8 +3363,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -3489,8 +3481,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -3554,8 +3546,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -3655,8 +3647,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -3734,8 +3726,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -3809,8 +3801,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -3951,8 +3943,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -4154,8 +4146,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -4365,8 +4357,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -4535,8 +4527,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -4667,8 +4659,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -4839,8 +4831,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -4967,8 +4959,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -5199,8 +5191,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -5358,8 +5350,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -5542,8 +5534,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -5590,8 +5582,8 @@ EXPECT_EQ(ERR_IO_PENDING, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -5683,8 +5675,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -5830,8 +5822,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -6022,8 +6014,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -6182,25 +6174,23 @@ // Create request and QuicHttpStream to create session1. QuicStreamRequest request1(factory_.get()); - EXPECT_EQ(OK, - request1.Request( - server1, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */, - true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, - net_log_, &net_error_details_, - failed_on_default_network_callback_, callback_.callback())); + EXPECT_EQ(OK, request1.Request( + server1, version_, privacy_mode_, DEFAULT_PRIORITY, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, + net_log_, &net_error_details_, + failed_on_default_network_callback_, callback_.callback())); std::unique_ptr<HttpStream> stream1 = CreateStream(&request1); EXPECT_TRUE(stream1.get()); // Create request and QuicHttpStream to create session2. QuicStreamRequest request2(factory_.get()); - EXPECT_EQ(OK, - request2.Request( - server2, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */, - true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, - net_log_, &net_error_details_, - failed_on_default_network_callback_, callback_.callback())); + EXPECT_EQ(OK, request2.Request( + server2, version_, privacy_mode_, DEFAULT_PRIORITY, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, + net_log_, &net_error_details_, + failed_on_default_network_callback_, callback_.callback())); std::unique_ptr<HttpStream> stream2 = CreateStream(&request2); EXPECT_TRUE(stream2.get()); @@ -6328,8 +6318,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -6498,8 +6488,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -6576,8 +6566,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -6720,8 +6710,8 @@ EXPECT_EQ(ERR_IO_PENDING, request1.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -6743,8 +6733,8 @@ EXPECT_EQ(OK, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback2.callback())); std::unique_ptr<HttpStream> stream2 = CreateStream(&request2); @@ -6868,8 +6858,8 @@ EXPECT_EQ(ERR_IO_PENDING, request1.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -7007,8 +6997,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -7071,8 +7061,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -7214,8 +7204,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -7334,8 +7324,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(ERR_QUIC_HANDSHAKE_FAILED, callback_.WaitForResult()); @@ -7358,8 +7348,8 @@ EXPECT_EQ(ERR_IO_PENDING, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_FALSE(HasActiveSession(host_port_pair_)); @@ -7447,8 +7437,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); // Ensure that the session is alive but not active. @@ -7521,8 +7511,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -7636,8 +7626,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -7801,8 +7791,8 @@ EXPECT_EQ(ERR_IO_PENDING, request1.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -7824,8 +7814,8 @@ EXPECT_EQ(OK, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback2.callback())); std::unique_ptr<HttpStream> stream2 = CreateStream(&request2); @@ -7963,8 +7953,8 @@ EXPECT_EQ(ERR_IO_PENDING, request1.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -7986,8 +7976,8 @@ EXPECT_EQ(OK, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback2.callback())); std::unique_ptr<HttpStream> stream2 = CreateStream(&request2); @@ -8135,8 +8125,8 @@ EXPECT_EQ(ERR_IO_PENDING, request1.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -8158,8 +8148,8 @@ EXPECT_EQ(OK, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback2.callback())); std::unique_ptr<HttpStream> stream2 = CreateStream(&request2); @@ -8286,8 +8276,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -8375,8 +8365,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -8521,8 +8511,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -8617,8 +8607,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); // Deliver the network notification, which should cause the connection to be @@ -8660,8 +8650,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -8817,8 +8807,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -8980,8 +8970,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -9135,8 +9125,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -9262,8 +9252,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -9399,8 +9389,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -9593,8 +9583,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -9759,8 +9749,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -9907,8 +9897,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -10049,8 +10039,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -10190,8 +10180,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -10334,8 +10324,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -10433,8 +10423,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -10587,8 +10577,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -10699,8 +10689,8 @@ EXPECT_EQ(OK, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); std::unique_ptr<HttpStream> stream2 = CreateStream(&request2); @@ -10795,8 +10785,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -10921,8 +10911,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -11004,8 +10994,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -11166,8 +11156,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -11249,8 +11239,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -11310,8 +11300,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -11334,8 +11324,8 @@ EXPECT_EQ(ERR_IO_PENDING, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -11464,8 +11454,8 @@ EXPECT_EQ(OK, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -11518,8 +11508,8 @@ EXPECT_EQ(OK, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -11554,13 +11544,12 @@ DVLOG(1) << "Create 2nd session and timeout with open stream"; TestCompletionCallback callback2; QuicStreamRequest request2(factory_.get()); - EXPECT_EQ(OK, - request2.Request( - server2, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */, - true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, - net_log_, &net_error_details_, - failed_on_default_network_callback_, callback2.callback())); + EXPECT_EQ(OK, request2.Request( + server2, version_, privacy_mode_, DEFAULT_PRIORITY, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, + net_log_, &net_error_details_, + failed_on_default_network_callback_, callback2.callback())); QuicChromiumClientSession* session2 = GetActiveSession(server2); EXPECT_EQ(quic::QuicTime::Delta::FromSeconds(10), session2->connection()->ping_timeout()); @@ -11928,7 +11917,7 @@ int rv = request.Request( HostPortPair(kDefaultServerHostName, kDefaultServerPort), version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), network_isolation_keys[i], - false /* disable_secure_dns */, true /* use_dns_aliases */, + SecureDnsPolicy::kAllow, true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback()); EXPECT_THAT(callback_.GetResult(rv), IsOk()); @@ -11989,8 +11978,8 @@ EXPECT_EQ(OK, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -12042,8 +12031,8 @@ EXPECT_EQ(OK, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -12078,8 +12067,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -12101,8 +12090,8 @@ EXPECT_EQ(OK, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -12133,8 +12122,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -12162,7 +12151,7 @@ request2.Request( host_port_pair_, version_, PRIVACY_MODE_ENABLED, DEFAULT_PRIORITY, SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SecureDnsPolicy::kAllow, true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -12214,8 +12203,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -12244,7 +12233,7 @@ request2.Request( host_port_pair_, version_, PRIVACY_MODE_DISABLED, DEFAULT_PRIORITY, SocketTag(), NetworkIsolationKey::CreateTransient(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SecureDnsPolicy::kAllow, true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -12282,8 +12271,8 @@ EXPECT_EQ(ERR_IO_PENDING, request1.Request( destination1, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -12297,8 +12286,8 @@ EXPECT_EQ(OK, request2.Request( destination2, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback2.callback())); std::unique_ptr<HttpStream> stream2 = CreateStream(&request2); @@ -12461,8 +12450,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( destination, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -12503,8 +12492,8 @@ EXPECT_EQ(ERR_IO_PENDING, request1.Request( destination, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url1, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -12519,8 +12508,8 @@ EXPECT_EQ(OK, request2.Request( destination, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2, net_log_, &net_error_details_, failed_on_default_network_callback_, callback2.callback())); std::unique_ptr<HttpStream> stream2 = CreateStream(&request2); @@ -12583,8 +12572,8 @@ EXPECT_EQ(ERR_IO_PENDING, request1.Request( destination, version_, PRIVACY_MODE_DISABLED, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url1, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -12597,8 +12586,8 @@ EXPECT_EQ(ERR_IO_PENDING, request2.Request( destination, version_, PRIVACY_MODE_ENABLED, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2, net_log_, &net_error_details_, failed_on_default_network_callback_, callback2.callback())); EXPECT_EQ(OK, callback2.WaitForResult()); @@ -12625,8 +12614,8 @@ EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); } -// QuicStreamRequest is not pooled if the disable_secure_dns field differs. -TEST_P(QuicStreamFactoryWithDestinationTest, DifferentDisableSecureDns) { +// QuicStreamRequest is not pooled if the secure_dns_policy field differs. +TEST_P(QuicStreamFactoryWithDestinationTest, DifferentSecureDnsPolicy) { Initialize(); GURL url1("https://www.example.org/"); @@ -12668,8 +12657,8 @@ EXPECT_EQ(ERR_IO_PENDING, request1.Request( destination, version_, PRIVACY_MODE_DISABLED, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url1, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(OK, callback_.WaitForResult()); @@ -12682,15 +12671,15 @@ EXPECT_EQ(ERR_IO_PENDING, request2.Request( destination, version_, PRIVACY_MODE_DISABLED, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - true /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kDisable, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2, net_log_, &net_error_details_, failed_on_default_network_callback_, callback2.callback())); EXPECT_EQ(OK, callback2.WaitForResult()); std::unique_ptr<HttpStream> stream2 = CreateStream(&request2); EXPECT_TRUE(stream2.get()); - // |request2| does not pool to the first session, because |disable_secure_dns| + // |request2| does not pool to the first session, because |secure_dns_policy| // does not match. QuicChromiumClientSession::Handle* session1 = QuicHttpStreamPeer::GetSessionHandle(stream1.get()); @@ -12752,8 +12741,8 @@ EXPECT_EQ(ERR_IO_PENDING, request1.Request( destination, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url1, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -12766,8 +12755,8 @@ EXPECT_EQ(ERR_IO_PENDING, request2.Request( destination, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2, net_log_, &net_error_details_, failed_on_default_network_callback_, callback2.callback())); EXPECT_THAT(callback2.WaitForResult(), IsOk()); @@ -12886,8 +12875,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, MAXIMUM_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -12916,8 +12905,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, MAXIMUM_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -12928,8 +12917,8 @@ EXPECT_EQ(ERR_IO_PENDING, request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url2_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_EQ(DEFAULT_PRIORITY, host_resolver_->last_request_priority()); @@ -12968,8 +12957,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), kNetworkIsolationKey, - true /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), kNetworkIsolationKey, SecureDnsPolicy::kDisable, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -13024,8 +13013,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -13079,8 +13068,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -13131,8 +13120,8 @@ EXPECT_EQ(ERR_QUIC_PROTOCOL_ERROR, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -13170,8 +13159,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -13205,8 +13194,8 @@ EXPECT_EQ(ERR_NAME_NOT_RESOLVED, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -13232,8 +13221,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -13288,8 +13277,8 @@ QuicStreamRequest request(factory_.get()); EXPECT_THAT(request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback()), IsOk()); @@ -13326,8 +13315,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); TestCompletionCallback host_resolution_callback; @@ -13387,8 +13376,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -13452,8 +13441,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -13523,8 +13512,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -13602,8 +13591,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -13685,8 +13674,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -13766,8 +13755,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); // Finish dns resolution, but need to wait for stale connection. @@ -13809,8 +13798,8 @@ EXPECT_EQ(ERR_NAME_NOT_RESOLVED, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); } @@ -13835,8 +13824,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -13888,8 +13877,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -13945,8 +13934,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_FALSE(HasLiveSession(host_port_pair_)); @@ -13998,8 +13987,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -14062,8 +14051,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -14120,8 +14109,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -14177,8 +14166,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -14214,8 +14203,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -14283,8 +14272,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -14360,8 +14349,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -14430,8 +14419,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); base::RunLoop().RunUntilIdle(); @@ -14499,10 +14488,10 @@ QuicStreamRequest request1(factory_.get()); int rv = request1.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, tag1, - NetworkIsolationKey(), false /* disable_secure_dns */, - true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, - &net_error_details_, failed_on_default_network_callback_, - callback_.callback()); + NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, + /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, + failed_on_default_network_callback_, callback_.callback()); EXPECT_THAT(callback_.GetResult(rv), IsOk()); EXPECT_EQ(socket_factory->GetLastProducedUDPSocket()->tag(), tag1); EXPECT_TRUE(socket_factory->GetLastProducedUDPSocket() @@ -14516,10 +14505,10 @@ QuicStreamRequest request2(factory_.get()); rv = request2.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, tag1, - NetworkIsolationKey(), false /* disable_secure_dns */, - true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, - &net_error_details_, failed_on_default_network_callback_, - callback_.callback()); + NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, + /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, + failed_on_default_network_callback_, callback_.callback()); EXPECT_THAT(callback_.GetResult(rv), IsOk()); std::unique_ptr<QuicChromiumClientSession::Handle> stream2 = request2.ReleaseSessionHandle(); @@ -14531,10 +14520,10 @@ QuicStreamRequest request3(factory_.get()); rv = request3.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, tag2, - NetworkIsolationKey(), false /* disable_secure_dns */, - true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, - &net_error_details_, failed_on_default_network_callback_, - callback_.callback()); + NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, + /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, + failed_on_default_network_callback_, callback_.callback()); EXPECT_THAT(callback_.GetResult(rv), IsOk()); EXPECT_EQ(socket_factory->GetLastProducedUDPSocket()->tag(), tag2); EXPECT_TRUE(socket_factory->GetLastProducedUDPSocket() @@ -14569,8 +14558,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - /*disable_secure_dns=*/false, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -14606,8 +14595,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - /*disable_secure_dns=*/false, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -14643,8 +14632,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - /*disable_secure_dns=*/false, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); @@ -14682,8 +14671,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -14719,8 +14708,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -14756,8 +14745,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, false /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + false /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -14790,8 +14779,8 @@ EXPECT_EQ(ERR_IO_PENDING, request.Request( host_port_pair_, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, true /* use_dns_aliases */, + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + true /* use_dns_aliases */, /*cert_verify_flags=*/0, url_, net_log_, &net_error_details_, failed_on_default_network_callback_, callback_.callback())); @@ -14960,13 +14949,13 @@ socket_data.AddSocketDataToFactory(socket_factory_.get()); QuicStreamRequest request1(factory_.get()); - EXPECT_EQ(ERR_IO_PENDING, - request1.Request( - kOrigin1, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, use_dns_aliases_, - /*cert_verify_flags=*/0, kUrl1, net_log_, &net_error_details_, - failed_on_default_network_callback_, callback_.callback())); + EXPECT_EQ( + ERR_IO_PENDING, + request1.Request( + kOrigin1, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), + NetworkIsolationKey(), SecureDnsPolicy::kAllow, use_dns_aliases_, + /*cert_verify_flags=*/0, kUrl1, net_log_, &net_error_details_, + failed_on_default_network_callback_, callback_.callback())); EXPECT_THAT(callback_.WaitForResult(), IsOk()); std::unique_ptr<HttpStream> stream1 = CreateStream(&request1); @@ -14975,13 +14964,13 @@ TestCompletionCallback callback2; QuicStreamRequest request2(factory_.get()); - EXPECT_EQ(ERR_IO_PENDING, - request2.Request( - kOrigin2, version_, privacy_mode_, DEFAULT_PRIORITY, - SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */, use_dns_aliases_, - /*cert_verify_flags=*/0, kUrl2, net_log_, &net_error_details_, - failed_on_default_network_callback_, callback2.callback())); + EXPECT_EQ( + ERR_IO_PENDING, + request2.Request( + kOrigin2, version_, privacy_mode_, DEFAULT_PRIORITY, SocketTag(), + NetworkIsolationKey(), SecureDnsPolicy::kAllow, use_dns_aliases_, + /*cert_verify_flags=*/0, kUrl2, net_log_, &net_error_details_, + failed_on_default_network_callback_, callback2.callback())); EXPECT_THAT(callback2.WaitForResult(), IsOk()); std::unique_ptr<HttpStream> stream2 = CreateStream(&request2);
diff --git a/net/quiche/common/platform/impl/quiche_map_util_impl.h b/net/quiche/common/platform/impl/quiche_map_util_impl.h deleted file mode 100644 index 29029d4..0000000 --- a/net/quiche/common/platform/impl/quiche_map_util_impl.h +++ /dev/null
@@ -1,19 +0,0 @@ -// Copyright (c) 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 NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_MAP_UTIL_IMPL_H_ -#define NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_MAP_UTIL_IMPL_H_ - -#include "base/stl_util.h" - -namespace quiche { - -template <class Collection, class Key> -bool QuicheContainsKeyImpl(const Collection& collection, const Key& key) { - return base::Contains(collection, key); -} - -} // namespace quiche - -#endif // NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_MAP_UTIL_IMPL_H_
diff --git a/net/quiche/common/platform/impl/quiche_string_piece_impl.h b/net/quiche/common/platform/impl/quiche_string_piece_impl.h deleted file mode 100644 index 5664d34..0000000 --- a/net/quiche/common/platform/impl/quiche_string_piece_impl.h +++ /dev/null
@@ -1,21 +0,0 @@ -// Copyright (c) 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_STRING_PIECE_IMPL_H_ -#define NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_STRING_PIECE_IMPL_H_ - -#include "third_party/abseil-cpp/absl/hash/hash.h" -#include "third_party/abseil-cpp/absl/strings/string_view.h" - -namespace quiche { - -inline size_t QuicheHashStringPairImpl(absl::string_view a, - absl::string_view b) { - auto pair = std::make_pair(a, b); - return absl::Hash<decltype(pair)>()(pair); -} - -} // namespace quiche - -#endif // NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_STRING_PIECE_IMPL_H_
diff --git a/net/quiche/common/platform/impl/quiche_unordered_containers_impl.h b/net/quiche/common/platform/impl/quiche_unordered_containers_impl.h deleted file mode 100644 index d08485f..0000000 --- a/net/quiche/common/platform/impl/quiche_unordered_containers_impl.h +++ /dev/null
@@ -1,23 +0,0 @@ -// Copyright (c) 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 NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_UNORDERED_CONTAINERS_IMPL_H_ -#define NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_UNORDERED_CONTAINERS_IMPL_H_ - -#include <unordered_map> - -#include "third_party/abseil-cpp/absl/container/node_hash_map.h" - -namespace quiche { - -// The default hasher used by hash tables. -template <typename Key> -using QuicheDefaultHasherImpl = absl::Hash<Key>; - -template <typename Key, typename Value, typename Hash, typename Eq> -using QuicheUnorderedMapImpl = absl::node_hash_map<Key, Value, Hash, Eq>; - -} // namespace quiche - -#endif // NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_UNORDERED_CONTAINERS_IMPL_H_
diff --git a/net/socket/client_socket_pool.cc b/net/socket/client_socket_pool.cc index d1ea3f3..537867b 100644 --- a/net/socket/client_socket_pool.cc +++ b/net/socket/client_socket_pool.cc
@@ -10,6 +10,7 @@ #include "base/check_op.h" #include "base/feature_list.h" #include "net/base/features.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_proxy_connect_job.h" #include "net/log/net_log_event_type.h" #include "net/log/net_log_with_source.h" @@ -72,7 +73,7 @@ SocketType socket_type, PrivacyMode privacy_mode, NetworkIsolationKey network_isolation_key, - bool disable_secure_dns) + SecureDnsPolicy secure_dns_policy) : destination_(destination), socket_type_(socket_type), privacy_mode_(privacy_mode), @@ -81,7 +82,7 @@ features::kPartitionConnectionsByNetworkIsolationKey) ? network_isolation_key : NetworkIsolationKey()), - disable_secure_dns_(disable_secure_dns) {} + secure_dns_policy_(secure_dns_policy) {} ClientSocketPool::GroupId::GroupId(const GroupId& group_id) = default; @@ -113,8 +114,13 @@ result += ">"; } - if (disable_secure_dns_) - result = "dsd/" + result; + switch (secure_dns_policy_) { + case SecureDnsPolicy::kAllow: + break; + case SecureDnsPolicy::kDisable: + result = "dsd/" + result; + break; + } return result; } @@ -171,7 +177,7 @@ SpdySessionKey( group_id.destination(), proxy_server, group_id.privacy_mode(), SpdySessionKey::IsProxySession::kFalse, socket_tag, - group_id.network_isolation_key(), group_id.disable_secure_dns()), + group_id.network_isolation_key(), group_id.secure_dns_policy()), is_for_websockets); } else if (proxy_server.is_https()) { resolution_callback = base::BindRepeating( @@ -180,7 +186,7 @@ group_id.privacy_mode(), SpdySessionKey::IsProxySession::kTrue, socket_tag, group_id.network_isolation_key(), - group_id.disable_secure_dns()), + group_id.secure_dns_policy()), is_for_websockets); } @@ -190,7 +196,7 @@ socket_params->ssl_config_for_proxy(), is_for_websockets, group_id.privacy_mode(), resolution_callback, request_priority, socket_tag, group_id.network_isolation_key(), - group_id.disable_secure_dns(), common_connect_job_params, delegate); + group_id.secure_dns_policy(), common_connect_job_params, delegate); } } // namespace net
diff --git a/net/socket/client_socket_pool.h b/net/socket/client_socket_pool.h index a1b6de3a..4d213ba 100644 --- a/net/socket/client_socket_pool.h +++ b/net/socket/client_socket_pool.h
@@ -19,6 +19,7 @@ #include "net/base/privacy_mode.h" #include "net/base/request_priority.h" #include "net/dns/host_resolver.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_request_info.h" #include "net/log/net_log_capture_mode.h" #include "net/socket/connect_job.h" @@ -113,7 +114,7 @@ SocketType socket_type, PrivacyMode privacy_mode, NetworkIsolationKey network_isolation_key, - bool disable_secure_dns); + SecureDnsPolicy secure_dns_policy); GroupId(const GroupId& group_id); ~GroupId(); @@ -131,25 +132,25 @@ return network_isolation_key_; } - bool disable_secure_dns() const { return disable_secure_dns_; } + SecureDnsPolicy secure_dns_policy() const { return secure_dns_policy_; } // Returns the group ID as a string, for logging. std::string ToString() const; bool operator==(const GroupId& other) const { return std::tie(destination_, socket_type_, privacy_mode_, - network_isolation_key_, disable_secure_dns_) == + network_isolation_key_, secure_dns_policy_) == std::tie(other.destination_, other.socket_type_, other.privacy_mode_, other.network_isolation_key_, - other.disable_secure_dns_); + other.secure_dns_policy_); } bool operator<(const GroupId& other) const { return std::tie(destination_, socket_type_, privacy_mode_, - network_isolation_key_, disable_secure_dns_) < + network_isolation_key_, secure_dns_policy_) < std::tie(other.destination_, other.socket_type_, other.privacy_mode_, other.network_isolation_key_, - other.disable_secure_dns_); + other.secure_dns_policy_); } private: @@ -164,8 +165,8 @@ // Used to separate requests made in different contexts. NetworkIsolationKey network_isolation_key_; - // If host resolutions for this request may not use secure DNS. - bool disable_secure_dns_; + // Controls the Secure DNS behavior to use when creating this socket. + SecureDnsPolicy secure_dns_policy_; }; // Parameters that, in combination with GroupId, proxy, websocket information,
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index 4566433..1fb16fb 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc
@@ -37,6 +37,7 @@ #include "net/base/schemeful_site.h" #include "net/base/test_completion_callback.h" #include "net/dns/public/resolve_error_info.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_response_headers.h" #include "net/http/http_response_info.h" #include "net/log/net_log.h" @@ -84,10 +85,9 @@ ClientSocketPool::SocketType::kHttp, PrivacyMode privacy_mode = PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey network_isolation_key = NetworkIsolationKey()) { - bool disable_secure_dns = false; return ClientSocketPool::GroupId(HostPortPair(host, port), socket_type, privacy_mode, network_isolation_key, - disable_secure_dns); + SecureDnsPolicy::kAllow); } // Make sure |handle| sets load times correctly when it has been assigned a @@ -871,7 +871,8 @@ NetworkIsolationKey(kSiteB, kSiteB), }; - const bool kDisableSecureDnsValues[] = {false, true}; + const SecureDnsPolicy kSecureDnsPolicys[] = {SecureDnsPolicy::kAllow, + SecureDnsPolicy::kDisable}; int total_idle_sockets = 0; @@ -885,14 +886,14 @@ SCOPED_TRACE(privacy_mode); for (const auto& network_isolation_key : kNetworkIsolationKeys) { SCOPED_TRACE(network_isolation_key.ToString()); - for (const auto& disable_secure_dns : kDisableSecureDnsValues) { - SCOPED_TRACE(disable_secure_dns); + for (const auto& secure_dns_policy : kSecureDnsPolicys) { + SCOPED_TRACE(static_cast<int>(secure_dns_policy)); connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketPool::GroupId group_id( host_port_pair, socket_type, privacy_mode, - network_isolation_key, disable_secure_dns); + network_isolation_key, secure_dns_policy); EXPECT_FALSE(pool_->HasGroupForTesting(group_id));
diff --git a/net/socket/client_socket_pool_manager.cc b/net/socket/client_socket_pool_manager.cc index 2eb94d96..e6682d3 100644 --- a/net/socket/client_socket_pool_manager.cc +++ b/net/socket/client_socket_pool_manager.cc
@@ -13,6 +13,7 @@ #include "build/build_config.h" #include "net/base/features.h" #include "net/base/load_flags.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_stream_factory.h" #include "net/proxy_resolution/proxy_info.h" #include "net/socket/client_socket_handle.h" @@ -69,7 +70,7 @@ const ProxyInfo& proxy_info, PrivacyMode privacy_mode, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns) { + SecureDnsPolicy secure_dns_policy) { // Build the string used to uniquely identify connections of this type. // Determine the host and port to connect to. DCHECK(!endpoint.IsEmpty()); @@ -80,7 +81,7 @@ socket_type = ClientSocketPool::SocketType::kSsl; return ClientSocketPool::GroupId(endpoint, socket_type, privacy_mode, - network_isolation_key, disable_secure_dns); + network_isolation_key, secure_dns_policy); } // TODO(https://crbug.com/921369) In order to resolve longstanding issues @@ -111,7 +112,7 @@ bool is_for_websockets, PrivacyMode privacy_mode, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns, + SecureDnsPolicy secure_dns_policy, const SocketTag& socket_tag, const NetLogWithSource& net_log, int num_preconnect_streams, @@ -130,7 +131,7 @@ ClientSocketPool::GroupId connection_group = CreateGroupId(group_type, origin_host_port, proxy_info, privacy_mode, - network_isolation_key, disable_secure_dns); + network_isolation_key, secure_dns_policy); scoped_refptr<ClientSocketPool::SocketParams> socket_params = CreateSocketParams(connection_group, proxy_info.proxy_server(), ssl_config_for_origin, ssl_config_for_proxy); @@ -246,7 +247,7 @@ const SSLConfig& ssl_config_for_proxy, PrivacyMode privacy_mode, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns, + SecureDnsPolicy secure_dns_policy, const SocketTag& socket_tag, const NetLogWithSource& net_log, ClientSocketHandle* socket_handle, @@ -257,7 +258,7 @@ group_type, endpoint, request_load_flags, request_priority, session, proxy_info, ssl_config_for_origin, ssl_config_for_proxy, false /* is_for_websockets */, privacy_mode, network_isolation_key, - disable_secure_dns, socket_tag, net_log, 0, socket_handle, + secure_dns_policy, socket_tag, net_log, 0, socket_handle, HttpNetworkSession::NORMAL_SOCKET_POOL, std::move(callback), proxy_auth_callback); } @@ -286,7 +287,7 @@ group_type, endpoint, request_load_flags, request_priority, session, proxy_info, ssl_config_for_origin, ssl_config_for_proxy, true /* is_for_websockets */, privacy_mode, network_isolation_key, - false /*disable_secure_dns */, SocketTag(), net_log, 0, socket_handle, + SecureDnsPolicy::kAllow, SocketTag(), net_log, 0, socket_handle, HttpNetworkSession::WEBSOCKET_SOCKET_POOL, std::move(callback), proxy_auth_callback); } @@ -302,7 +303,7 @@ const SSLConfig& ssl_config_for_proxy, PrivacyMode privacy_mode, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns, + SecureDnsPolicy secure_dns_policy, const NetLogWithSource& net_log, int num_preconnect_streams) { // QUIC proxies are currently not supported through this method. @@ -312,7 +313,7 @@ group_type, endpoint, request_load_flags, request_priority, session, proxy_info, ssl_config_for_origin, ssl_config_for_proxy, false /* force_tunnel */, privacy_mode, network_isolation_key, - disable_secure_dns, SocketTag(), net_log, num_preconnect_streams, nullptr, + secure_dns_policy, SocketTag(), net_log, num_preconnect_streams, nullptr, HttpNetworkSession::NORMAL_SOCKET_POOL, CompletionOnceCallback(), ClientSocketPool::ProxyAuthCallback()); }
diff --git a/net/socket/client_socket_pool_manager.h b/net/socket/client_socket_pool_manager.h index 496a6e6..6e5bee9 100644 --- a/net/socket/client_socket_pool_manager.h +++ b/net/socket/client_socket_pool_manager.h
@@ -14,6 +14,7 @@ #include "net/base/completion_once_callback.h" #include "net/base/net_export.h" #include "net/base/request_priority.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_network_session.h" #include "net/socket/client_socket_pool.h" @@ -110,7 +111,7 @@ const SSLConfig& ssl_config_for_proxy, PrivacyMode privacy_mode, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns, + SecureDnsPolicy secure_dns_policy, const SocketTag& socket_tag, const NetLogWithSource& net_log, ClientSocketHandle* socket_handle, @@ -155,7 +156,7 @@ const SSLConfig& ssl_config_for_proxy, PrivacyMode privacy_mode, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns, + SecureDnsPolicy secure_dns_policy, const NetLogWithSource& net_log, int num_preconnect_streams);
diff --git a/net/socket/client_socket_pool_unittest.cc b/net/socket/client_socket_pool_unittest.cc index 894ddc0..ce7987f 100644 --- a/net/socket/client_socket_pool_unittest.cc +++ b/net/socket/client_socket_pool_unittest.cc
@@ -13,6 +13,7 @@ #include "net/base/network_isolation_key.h" #include "net/base/privacy_mode.h" #include "net/base/schemeful_site.h" +#include "net/dns/public/secure_dns_policy.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" @@ -50,7 +51,8 @@ NetworkIsolationKey(kSiteB, kSiteB), }; - const bool kDisableSecureDnsValues[] = {false, true}; + const SecureDnsPolicy kDisableSecureDnsValues[] = {SecureDnsPolicy::kAllow, + SecureDnsPolicy::kDisable}; // All previously created |group_ids|. They should all be less than the // current group under consideration. @@ -65,10 +67,10 @@ SCOPED_TRACE(privacy_mode); for (const auto& network_isolation_key : kNetworkIsolationKeys) { SCOPED_TRACE(network_isolation_key.ToString()); - for (const auto& disable_secure_dns : kDisableSecureDnsValues) { + for (const auto& secure_dns_policy : kDisableSecureDnsValues) { ClientSocketPool::GroupId group_id( host_port_pair, socket_type, privacy_mode, - network_isolation_key, disable_secure_dns); + network_isolation_key, secure_dns_policy); for (const auto& lower_group_id : group_ids) { EXPECT_FALSE(lower_group_id == group_id); EXPECT_TRUE(lower_group_id < group_id); @@ -99,38 +101,38 @@ ClientSocketPool::GroupId( HostPortPair("foo", 80), ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */) + SecureDnsPolicy::kAllow) .ToString()); EXPECT_EQ("bar:443 <null null>", ClientSocketPool::GroupId( HostPortPair("bar", 443), ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */) + SecureDnsPolicy::kAllow) .ToString()); EXPECT_EQ("pm/bar:80 <null null>", ClientSocketPool::GroupId( HostPortPair("bar", 80), ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_ENABLED, NetworkIsolationKey(), - false /* disable_secure_dns */) + SecureDnsPolicy::kAllow) .ToString()); EXPECT_EQ("ssl/foo:80 <null null>", ClientSocketPool::GroupId( HostPortPair("foo", 80), ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */) + SecureDnsPolicy::kAllow) .ToString()); EXPECT_EQ("ssl/bar:443 <null null>", ClientSocketPool::GroupId( HostPortPair("bar", 443), ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */) + SecureDnsPolicy::kAllow) .ToString()); EXPECT_EQ("pm/ssl/bar:80 <null null>", ClientSocketPool::GroupId( HostPortPair("bar", 80), ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_ENABLED, NetworkIsolationKey(), - false /* disable_secure_dns */) + SecureDnsPolicy::kAllow) .ToString()); EXPECT_EQ("ssl/foo:443 <https://foo.test https://bar.test>", @@ -139,14 +141,14 @@ PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(SchemefulSite(GURL("https://foo.test")), SchemefulSite(GURL("https://bar.test"))), - false /* disable_secure_dns */) + SecureDnsPolicy::kAllow) .ToString()); EXPECT_EQ("dsd/pm/ssl/bar:80 <null null>", ClientSocketPool::GroupId( HostPortPair("bar", 80), ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_ENABLED, NetworkIsolationKey(), - true /* disable_secure_dns */) + SecureDnsPolicy::kDisable) .ToString()); } @@ -160,12 +162,12 @@ ClientSocketPool::GroupId group_id1( HostPortPair("foo", 443), ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, - NetworkIsolationKey(kSiteFoo, kSiteFoo), false /* disable_secure_dns */); + NetworkIsolationKey(kSiteFoo, kSiteFoo), SecureDnsPolicy::kAllow); ClientSocketPool::GroupId group_id2( HostPortPair("foo", 443), ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, - NetworkIsolationKey(kSiteBar, kSiteBar), false /* disable_secure_dns */); + NetworkIsolationKey(kSiteBar, kSiteBar), SecureDnsPolicy::kAllow); EXPECT_FALSE(group_id1.network_isolation_key().IsFullyPopulated()); EXPECT_FALSE(group_id2.network_isolation_key().IsFullyPopulated());
diff --git a/net/socket/connect_job.cc b/net/socket/connect_job.cc index e81a16d..89773f2 100644 --- a/net/socket/connect_job.cc +++ b/net/socket/connect_job.cc
@@ -9,6 +9,7 @@ #include "base/trace_event/trace_event.h" #include "net/base/net_errors.h" #include "net/base/trace_constants.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_auth_controller.h" #include "net/http/http_proxy_connect_job.h" #include "net/log/net_log.h" @@ -108,7 +109,7 @@ RequestPriority request_priority, SocketTag socket_tag, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns, + SecureDnsPolicy secure_dns_policy, const CommonConnectJobParams* common_connect_job_params, ConnectJob::Delegate* delegate) { scoped_refptr<HttpProxySocketParams> http_proxy_params; @@ -120,8 +121,8 @@ // information to destination sites, and not caching them has a performance // cost. auto proxy_tcp_params = base::MakeRefCounted<TransportSocketParams>( - proxy_server.host_port_pair(), NetworkIsolationKey(), - disable_secure_dns, resolution_callback); + proxy_server.host_port_pair(), NetworkIsolationKey(), secure_dns_policy, + resolution_callback); if (proxy_server.is_http_like()) { scoped_refptr<SSLSocketParams> ssl_params; @@ -155,7 +156,7 @@ scoped_refptr<TransportSocketParams> ssl_tcp_params; if (proxy_server.is_direct()) { ssl_tcp_params = base::MakeRefCounted<TransportSocketParams>( - endpoint, network_isolation_key, disable_secure_dns, + endpoint, network_isolation_key, secure_dns_policy, resolution_callback); } auto ssl_params = base::MakeRefCounted<SSLSocketParams>( @@ -181,7 +182,7 @@ DCHECK(proxy_server.is_direct()); auto tcp_params = base::MakeRefCounted<TransportSocketParams>( - endpoint, network_isolation_key, disable_secure_dns, resolution_callback); + endpoint, network_isolation_key, secure_dns_policy, resolution_callback); return TransportConnectJob::CreateTransportConnectJob( std::move(tcp_params), request_priority, socket_tag, common_connect_job_params, delegate, nullptr /* net_log */);
diff --git a/net/socket/connect_job.h b/net/socket/connect_job.h index 5886eac..4ab86946 100644 --- a/net/socket/connect_job.h +++ b/net/socket/connect_job.h
@@ -22,6 +22,7 @@ #include "net/base/privacy_mode.h" #include "net/base/request_priority.h" #include "net/dns/public/resolve_error_info.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/log/net_log_with_source.h" #include "net/socket/connection_attempts.h" #include "net/socket/socket_tag.h" @@ -190,7 +191,7 @@ RequestPriority request_priority, SocketTag socket_tag, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns, + SecureDnsPolicy secure_dns_policy, const CommonConnectJobParams* common_connect_job_params, ConnectJob::Delegate* delegate);
diff --git a/net/socket/socks_client_socket.cc b/net/socket/socks_client_socket.cc index 1108b50..e146eb3 100644 --- a/net/socket/socks_client_socket.cc +++ b/net/socket/socks_client_socket.cc
@@ -14,6 +14,7 @@ #include "net/base/io_buffer.h" #include "net/dns/public/dns_query_type.h" #include "net/dns/public/secure_dns_mode.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/log/net_log.h" #include "net/log/net_log_event_type.h" #include "net/traffic_annotation/network_traffic_annotation.h" @@ -66,7 +67,7 @@ const NetworkIsolationKey& network_isolation_key, RequestPriority priority, HostResolver* host_resolver, - bool disable_secure_dns, + SecureDnsPolicy secure_dns_policy, const NetworkTrafficAnnotationTag& traffic_annotation) : transport_socket_(std::move(transport_socket)), next_state_(STATE_NONE), @@ -75,7 +76,7 @@ bytes_received_(0), was_ever_used_(false), host_resolver_(host_resolver), - disable_secure_dns_(disable_secure_dns), + secure_dns_policy_(secure_dns_policy), destination_(destination), network_isolation_key_(network_isolation_key), priority_(priority), @@ -310,7 +311,7 @@ HostResolver::ResolveHostParameters parameters; parameters.dns_query_type = DnsQueryType::A; parameters.initial_priority = priority_; - if (disable_secure_dns_) + if (secure_dns_policy_ == SecureDnsPolicy::kDisable) parameters.secure_dns_mode_override = SecureDnsMode::kOff; resolve_host_request_ = host_resolver_->CreateRequest( destination_, network_isolation_key_, net_log_, parameters);
diff --git a/net/socket/socks_client_socket.h b/net/socket/socks_client_socket.h index 95e6daa65..9005b12 100644 --- a/net/socket/socks_client_socket.h +++ b/net/socket/socks_client_socket.h
@@ -21,6 +21,7 @@ #include "net/base/net_export.h" #include "net/dns/host_resolver.h" #include "net/dns/public/resolve_error_info.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/log/net_log_with_source.h" #include "net/socket/stream_socket.h" #include "net/traffic_annotation/network_traffic_annotation.h" @@ -38,7 +39,7 @@ const NetworkIsolationKey& network_isolation_key, RequestPriority priority, HostResolver* host_resolver, - bool disable_secure_dns, + SecureDnsPolicy secure_dns_policy, const NetworkTrafficAnnotationTag& traffic_annotation); // On destruction Disconnect() is called. @@ -143,7 +144,7 @@ // Used to resolve the hostname to which the SOCKS proxy will connect. HostResolver* host_resolver_; - bool disable_secure_dns_; + SecureDnsPolicy secure_dns_policy_; std::unique_ptr<HostResolver::ResolveHostRequest> resolve_host_request_; const HostPortPair destination_; const NetworkIsolationKey network_isolation_key_;
diff --git a/net/socket/socks_client_socket_fuzzer.cc b/net/socket/socks_client_socket_fuzzer.cc index 245e8a3..3bce834 100644 --- a/net/socket/socks_client_socket_fuzzer.cc +++ b/net/socket/socks_client_socket_fuzzer.cc
@@ -16,6 +16,7 @@ #include "net/base/test_completion_callback.h" #include "net/dns/host_resolver.h" #include "net/dns/mock_host_resolver.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/log/test_net_log.h" #include "net/socket/fuzzed_socket.h" #include "net/socket/socks_client_socket.h" @@ -58,7 +59,7 @@ net::SOCKSClientSocket socket( std::move(fuzzed_socket), net::HostPortPair("foo", 80), net::NetworkIsolationKey(), net::DEFAULT_PRIORITY, &mock_host_resolver, - false /* disable_secure_dns */, TRAFFIC_ANNOTATION_FOR_TESTS); + net::SecureDnsPolicy::kAllow, TRAFFIC_ANNOTATION_FOR_TESTS); int result = socket.Connect(callback.callback()); callback.GetResult(result); return 0;
diff --git a/net/socket/socks_client_socket_unittest.cc b/net/socket/socks_client_socket_unittest.cc index 564b4ddd..65ec94d 100644 --- a/net/socket/socks_client_socket_unittest.cc +++ b/net/socket/socks_client_socket_unittest.cc
@@ -17,6 +17,7 @@ #include "net/dns/host_resolver.h" #include "net/dns/mock_host_resolver.h" #include "net/dns/public/secure_dns_mode.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/log/net_log_event_type.h" #include "net/log/test_net_log.h" #include "net/log/test_net_log_util.h" @@ -96,7 +97,7 @@ tcp_sock_ = socket.get(); return std::make_unique<SOCKSClientSocket>( std::move(socket), HostPortPair(hostname, port), NetworkIsolationKey(), - DEFAULT_PRIORITY, host_resolver, false /* disable_secure_dns */, + DEFAULT_PRIORITY, host_resolver, SecureDnsPolicy::kAllow, TRAFFIC_ANNOTATION_FOR_TESTS); } @@ -437,11 +438,10 @@ // |connection| takes ownership of |tagging_sock|, but keep a // non-owning pointer to it. MockHostResolver host_resolver; - SOCKSClientSocket socket(std::unique_ptr<StreamSocket>(tagging_sock), - HostPortPair("localhost", 80), NetworkIsolationKey(), - DEFAULT_PRIORITY, &host_resolver, - false /* disable_secure_dns */, - TRAFFIC_ANNOTATION_FOR_TESTS); + SOCKSClientSocket socket( + std::unique_ptr<StreamSocket>(tagging_sock), + HostPortPair("localhost", 80), NetworkIsolationKey(), DEFAULT_PRIORITY, + &host_resolver, SecureDnsPolicy::kAllow, TRAFFIC_ANNOTATION_FOR_TESTS); EXPECT_EQ(tagging_sock->tag(), SocketTag()); #if defined(OS_ANDROID) @@ -451,20 +451,21 @@ #endif // OS_ANDROID } -TEST_F(SOCKSClientSocketTest, SetDisableSecureDns) { - for (bool disable_secure_dns : {false, true}) { +TEST_F(SOCKSClientSocketTest, SetSecureDnsPolicy) { + for (auto secure_dns_policy : + {SecureDnsPolicy::kAllow, SecureDnsPolicy::kDisable}) { StaticSocketDataProvider data; RecordingTestNetLog log; MockHostResolver host_resolver; SOCKSClientSocket socket( std::make_unique<MockTCPClientSocket>(address_list_, &log, &data), HostPortPair("localhost", 80), NetworkIsolationKey(), DEFAULT_PRIORITY, - &host_resolver, disable_secure_dns, TRAFFIC_ANNOTATION_FOR_TESTS); + &host_resolver, secure_dns_policy, TRAFFIC_ANNOTATION_FOR_TESTS); EXPECT_EQ(ERR_IO_PENDING, socket.Connect(callback_.callback())); - EXPECT_EQ(disable_secure_dns, + EXPECT_EQ(secure_dns_policy == SecureDnsPolicy::kDisable, host_resolver.last_secure_dns_mode_override().has_value()); - if (disable_secure_dns) { + if (secure_dns_policy == SecureDnsPolicy::kDisable) { EXPECT_EQ(net::SecureDnsMode::kOff, host_resolver.last_secure_dns_mode_override().value()); }
diff --git a/net/socket/socks_connect_job.cc b/net/socket/socks_connect_job.cc index 7651ead..586dd24e 100644 --- a/net/socket/socks_connect_job.cc +++ b/net/socket/socks_connect_job.cc
@@ -174,7 +174,7 @@ socks_socket_ptr_ = new SOCKSClientSocket( transport_connect_job_->PassSocket(), socks_params_->destination(), socks_params_->network_isolation_key(), priority(), host_resolver(), - socks_params_->transport_params()->disable_secure_dns(), + socks_params_->transport_params()->secure_dns_policy(), socks_params_->traffic_annotation()); socket_.reset(socks_socket_ptr_); }
diff --git a/net/socket/socks_connect_job_unittest.cc b/net/socket/socks_connect_job_unittest.cc index f7614b0..eb152c2 100644 --- a/net/socket/socks_connect_job_unittest.cc +++ b/net/socket/socks_connect_job_unittest.cc
@@ -17,6 +17,7 @@ #include "net/base/network_isolation_key.h" #include "net/dns/mock_host_resolver.h" #include "net/dns/public/secure_dns_mode.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/log/net_log.h" #include "net/socket/client_socket_factory.h" #include "net/socket/client_socket_handle.h" @@ -69,11 +70,11 @@ static scoped_refptr<SOCKSSocketParams> CreateSOCKSParams( SOCKSVersion socks_version, - bool disable_secure_dns = false) { + SecureDnsPolicy secure_dns_policy = SecureDnsPolicy::kAllow) { return base::MakeRefCounted<SOCKSSocketParams>( base::MakeRefCounted<TransportSocketParams>( HostPortPair(kProxyHostName, kProxyPort), NetworkIsolationKey(), - disable_secure_dns, OnHostResolutionCallback()), + secure_dns_policy, OnHostResolutionCallback()), socks_version == SOCKSVersion::V5, socks_version == SOCKSVersion::V4 ? HostPortPair(kSOCKS4TestHost, kSOCKS4TestPort) @@ -120,7 +121,7 @@ base::MakeRefCounted<SOCKSSocketParams>( base::MakeRefCounted<TransportSocketParams>( HostPortPair(kProxyHostName, kProxyPort), NetworkIsolationKey(), - false /* disable_secure_dns */, OnHostResolutionCallback()), + SecureDnsPolicy::kAllow, OnHostResolutionCallback()), false /* socks_v5 */, HostPortPair(hostname, kSOCKS4TestPort), NetworkIsolationKey(), TRAFFIC_ANNOTATION_FOR_TESTS); @@ -388,17 +389,18 @@ } } -TEST_F(SOCKSConnectJobTest, DisableSecureDns) { - for (bool disable_secure_dns : {false, true}) { +TEST_F(SOCKSConnectJobTest, SecureDnsPolicy) { + for (auto secure_dns_policy : + {SecureDnsPolicy::kAllow, SecureDnsPolicy::kDisable}) { TestConnectJobDelegate test_delegate; SOCKSConnectJob socks_connect_job( DEFAULT_PRIORITY, SocketTag(), &common_connect_job_params_, - CreateSOCKSParams(SOCKSVersion::V4, disable_secure_dns), &test_delegate, + CreateSOCKSParams(SOCKSVersion::V4, secure_dns_policy), &test_delegate, nullptr /* net_log */); ASSERT_THAT(socks_connect_job.Connect(), test::IsError(ERR_IO_PENDING)); - EXPECT_EQ(disable_secure_dns, + EXPECT_EQ(secure_dns_policy == SecureDnsPolicy::kDisable, host_resolver_.last_secure_dns_mode_override().has_value()); - if (disable_secure_dns) { + if (secure_dns_policy == SecureDnsPolicy::kDisable) { EXPECT_EQ(net::SecureDnsMode::kOff, host_resolver_.last_secure_dns_mode_override().value()); }
diff --git a/net/socket/ssl_connect_job_unittest.cc b/net/socket/ssl_connect_job_unittest.cc index 4f1a2f6..3d7cd05de 100644 --- a/net/socket/ssl_connect_job_unittest.cc +++ b/net/socket/ssl_connect_job_unittest.cc
@@ -25,6 +25,7 @@ #include "net/cert/mock_cert_verifier.h" #include "net/dns/mock_host_resolver.h" #include "net/dns/public/secure_dns_mode.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_auth_handler_factory.h" #include "net/http/http_network_session.h" #include "net/http/http_proxy_connect_job.h" @@ -94,12 +95,12 @@ direct_transport_socket_params_( new TransportSocketParams(HostPortPair("host", 443), NetworkIsolationKey(), - false /* disable_secure_dns */, + SecureDnsPolicy::kAllow, OnHostResolutionCallback())), proxy_transport_socket_params_( new TransportSocketParams(HostPortPair("proxy", 443), NetworkIsolationKey(), - false /* disable_secure_dns */, + SecureDnsPolicy::kAllow, OnHostResolutionCallback())), socks_socket_params_( new SOCKSSocketParams(proxy_transport_socket_params_, @@ -425,13 +426,14 @@ } } -TEST_F(SSLConnectJobTest, DisableSecureDns) { - for (bool disable_secure_dns : {false, true}) { +TEST_F(SSLConnectJobTest, SecureDnsPolicy) { + for (auto secure_dns_policy : + {SecureDnsPolicy::kAllow, SecureDnsPolicy::kDisable}) { TestConnectJobDelegate test_delegate; direct_transport_socket_params_ = base::MakeRefCounted<TransportSocketParams>( - HostPortPair("host", 443), NetworkIsolationKey(), - disable_secure_dns, OnHostResolutionCallback()); + HostPortPair("host", 443), NetworkIsolationKey(), secure_dns_policy, + OnHostResolutionCallback()); auto common_connect_job_params = session_->CreateCommonConnectJobParams(); std::unique_ptr<ConnectJob> ssl_connect_job = std::make_unique<SSLConnectJob>(DEFAULT_PRIORITY, SocketTag(), @@ -440,9 +442,9 @@ &test_delegate, nullptr /* net_log */); EXPECT_THAT(ssl_connect_job->Connect(), test::IsError(ERR_IO_PENDING)); - EXPECT_EQ(disable_secure_dns, + EXPECT_EQ(secure_dns_policy == SecureDnsPolicy::kDisable, host_resolver_.last_secure_dns_mode_override().has_value()); - if (disable_secure_dns) { + if (secure_dns_policy == SecureDnsPolicy::kDisable) { EXPECT_EQ(net::SecureDnsMode::kOff, host_resolver_.last_secure_dns_mode_override().value()); }
diff --git a/net/socket/transport_client_socket_pool_unittest.cc b/net/socket/transport_client_socket_pool_unittest.cc index 93e4aad..c790ec16 100644 --- a/net/socket/transport_client_socket_pool_unittest.cc +++ b/net/socket/transport_client_socket_pool_unittest.cc
@@ -32,6 +32,7 @@ #include "net/cert/mock_cert_verifier.h" #include "net/dns/mock_host_resolver.h" #include "net/dns/public/secure_dns_mode.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_network_session.h" #include "net/http/http_proxy_connect_job.h" #include "net/http/transport_security_state.h" @@ -110,7 +111,7 @@ ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), params_(ClientSocketPool::SocketParams::CreateForHttpForTesting()), client_socket_factory_(&net_log_) { std::unique_ptr<MockCertVerifier> cert_verifier = @@ -159,7 +160,7 @@ ClientSocketPool::GroupId group_id( HostPortPair(host_name, 80), ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); return test_base_.StartRequestUsingPool( pool_.get(), group_id, priority, ClientSocketPool::RespectLimits::ENABLED, @@ -258,24 +259,25 @@ } } -TEST_F(TransportClientSocketPoolTest, SetDisableSecureDns) { - for (bool disable_secure_dns : {false, true}) { +TEST_F(TransportClientSocketPoolTest, SetSecureDnsPolicy) { + for (auto secure_dns_policy : + {SecureDnsPolicy::kAllow, SecureDnsPolicy::kDisable}) { TestCompletionCallback callback; ClientSocketHandle handle; ClientSocketPool::GroupId group_id( HostPortPair("www.google.com", 80), ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - disable_secure_dns); + secure_dns_policy); EXPECT_EQ( ERR_IO_PENDING, handle.Init(group_id, params_, base::nullopt /* proxy_annotation_tag */, LOW, SocketTag(), ClientSocketPool::RespectLimits::ENABLED, callback.callback(), ClientSocketPool::ProxyAuthCallback(), pool_.get(), NetLogWithSource())); - EXPECT_EQ(disable_secure_dns, + EXPECT_EQ(secure_dns_policy == SecureDnsPolicy::kDisable, session_deps_.host_resolver->last_secure_dns_mode_override() .has_value()); - if (disable_secure_dns) { + if (secure_dns_policy == SecureDnsPolicy::kDisable) { EXPECT_EQ( net::SecureDnsMode::kOff, session_deps_.host_resolver->last_secure_dns_mode_override().value()); @@ -1055,7 +1057,7 @@ handle.Init(ClientSocketPool::GroupId( kHostPortPair, ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), socket_params, base::nullopt /* proxy_annotation_tag */, MEDIUM, SocketTag(), ClientSocketPool::RespectLimits::ENABLED, callback.callback(), ClientSocketPool::ProxyAuthCallback(), @@ -1333,7 +1335,7 @@ ClientSocketPool::GroupId( kDestination, ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), socket_params, TRAFFIC_ANNOTATION_FOR_TESTS, LOW, SocketTag(), ClientSocketPool::RespectLimits::ENABLED, callback.callback(), ClientSocketPool::ProxyAuthCallback(), &proxy_pool, NetLogWithSource()); @@ -1400,7 +1402,7 @@ ClientSocketPool::GroupId group_id( kEndpoint, ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); // Start the first connection attempt. TestCompletionCallback callback1; @@ -1504,7 +1506,7 @@ ClientSocketPool::GroupId group_id( kEndpoint, ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); // Start the first connection attempt. TestCompletionCallback callback1; @@ -1602,7 +1604,7 @@ ClientSocketPool::GroupId( kEndpoint, ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), socket_params, TRAFFIC_ANNOTATION_FOR_TESTS, LOW, SocketTag(), ClientSocketPool::RespectLimits::ENABLED, callback.callback(), ClientSocketPool::ProxyAuthCallback(), &proxy_pool, @@ -1634,7 +1636,7 @@ TransportClientSocketPool::GroupId group_id( HostPortPair(kHost, 80), ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, kNetworkIsolationKey, - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); ClientSocketHandle handle; TestCompletionCallback callback; EXPECT_THAT( @@ -1672,7 +1674,7 @@ TransportClientSocketPool::GroupId group_id( HostPortPair(kHost, 443), ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, kNetworkIsolationKey, - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); ClientSocketHandle handle; TestCompletionCallback callback; EXPECT_THAT( @@ -1717,7 +1719,7 @@ TransportClientSocketPool::GroupId group_id( HostPortPair(kHost, 80), ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, kNetworkIsolationKey, - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); ClientSocketHandle handle; TestCompletionCallback callback; EXPECT_THAT( @@ -1764,7 +1766,7 @@ TransportClientSocketPool::GroupId group_id( HostPortPair(kHost, 80), ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, kNetworkIsolationKey, - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); ClientSocketHandle handle; TestCompletionCallback callback; EXPECT_THAT( @@ -1817,7 +1819,7 @@ TransportClientSocketPool::GroupId group_id( HostPortPair(kHost, 80), ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, kNetworkIsolationKey, - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); ClientSocketHandle handle; TestCompletionCallback callback; EXPECT_THAT( @@ -1873,7 +1875,7 @@ TransportClientSocketPool::GroupId group_id( HostPortPair(kHost, 80), ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, kNetworkIsolationKey, - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); ClientSocketHandle handle; TestCompletionCallback callback; EXPECT_THAT( @@ -1919,7 +1921,7 @@ const ClientSocketPool::GroupId kGroupId( test_server.host_port_pair(), ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); scoped_refptr<ClientSocketPool::SocketParams> params = ClientSocketPool::SocketParams::CreateForHttpForTesting(); TestCompletionCallback callback; @@ -2046,7 +2048,7 @@ const ClientSocketPool::GroupId kGroupId( kDestination, ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); scoped_refptr<ClientSocketPool::SocketParams> socks_params = base::MakeRefCounted<ClientSocketPool::SocketParams>( nullptr /* ssl_config_for_origin */, @@ -2140,7 +2142,7 @@ const ClientSocketPool::GroupId kGroupId( test_server.host_port_pair(), ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); scoped_refptr<ClientSocketPool::SocketParams> socket_params = base::MakeRefCounted<ClientSocketPool::SocketParams>( @@ -2211,7 +2213,7 @@ const ClientSocketPool::GroupId kGroupId( test_server.host_port_pair(), ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); scoped_refptr<ClientSocketPool::SocketParams> socket_params = base::MakeRefCounted<ClientSocketPool::SocketParams>( std::make_unique<SSLConfig>() /* ssl_config_for_origin */, @@ -2275,7 +2277,7 @@ const ClientSocketPool::GroupId kGroupId( test_server.host_port_pair(), ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); scoped_refptr<ClientSocketPool::SocketParams> socket_params = base::MakeRefCounted<ClientSocketPool::SocketParams>( std::make_unique<SSLConfig>() /* ssl_config_for_origin */, @@ -2355,7 +2357,7 @@ const ClientSocketPool::GroupId kGroupId( kDestination, ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); scoped_refptr<ClientSocketPool::SocketParams> socket_params = base::MakeRefCounted<ClientSocketPool::SocketParams>( nullptr /* ssl_config_for_origin */, @@ -2428,7 +2430,7 @@ const ClientSocketPool::GroupId kGroupId( kDestination, ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); scoped_refptr<ClientSocketPool::SocketParams> socket_params = base::MakeRefCounted<ClientSocketPool::SocketParams>( @@ -2548,7 +2550,7 @@ ClientSocketPool::GroupId( kHostPortPair1, ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), ClientSocketPool::SocketParams::CreateForHttpForTesting(), base::nullopt /* proxy_annotation_tag */, MEDIUM, SocketTag(), ClientSocketPool::RespectLimits::ENABLED, callback.callback(), @@ -2597,7 +2599,7 @@ ClientSocketPool::GroupId( kHostPortPair2, ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), socket_params, base::nullopt /* proxy_annotation_tag */, MEDIUM, SocketTag(), ClientSocketPool::RespectLimits::ENABLED, callback.callback(), ClientSocketPool::ProxyAuthCallback(),
diff --git a/net/socket/transport_connect_job.cc b/net/socket/transport_connect_job.cc index c2791caa..9ad3dae 100644 --- a/net/socket/transport_connect_job.cc +++ b/net/socket/transport_connect_job.cc
@@ -21,6 +21,7 @@ #include "net/base/net_errors.h" #include "net/base/trace_constants.h" #include "net/dns/public/secure_dns_mode.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/log/net_log.h" #include "net/log/net_log_event_type.h" #include "net/log/net_log_source_type.h" @@ -51,11 +52,11 @@ TransportSocketParams::TransportSocketParams( const HostPortPair& host_port_pair, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns, + SecureDnsPolicy secure_dns_policy, const OnHostResolutionCallback& host_resolution_callback) : destination_(host_port_pair), network_isolation_key_(network_isolation_key), - disable_secure_dns_(disable_secure_dns), + secure_dns_policy_(secure_dns_policy), host_resolution_callback_(host_resolution_callback) {} TransportSocketParams::~TransportSocketParams() = default; @@ -270,7 +271,7 @@ HostResolver::ResolveHostParameters parameters; parameters.initial_priority = priority(); - if (params_->disable_secure_dns()) + if (params_->secure_dns_policy() == SecureDnsPolicy::kDisable) parameters.secure_dns_mode_override = SecureDnsMode::kOff; request_ = host_resolver()->CreateRequest(params_->destination(), params_->network_isolation_key(),
diff --git a/net/socket/transport_connect_job.h b/net/socket/transport_connect_job.h index ee12860..5b394234 100644 --- a/net/socket/transport_connect_job.h +++ b/net/socket/transport_connect_job.h
@@ -19,6 +19,7 @@ #include "net/base/network_isolation_key.h" #include "net/dns/host_resolver.h" #include "net/dns/public/resolve_error_info.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/socket/connect_job.h" #include "net/socket/connection_attempts.h" #include "net/socket/socket_tag.h" @@ -38,14 +39,14 @@ TransportSocketParams( const HostPortPair& host_port_pair, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns, + SecureDnsPolicy secure_dns_policy, const OnHostResolutionCallback& host_resolution_callback); const HostPortPair& destination() const { return destination_; } const NetworkIsolationKey& network_isolation_key() const { return network_isolation_key_; } - bool disable_secure_dns() const { return disable_secure_dns_; } + SecureDnsPolicy secure_dns_policy() const { return secure_dns_policy_; } const OnHostResolutionCallback& host_resolution_callback() const { return host_resolution_callback_; } @@ -56,7 +57,7 @@ const HostPortPair destination_; const NetworkIsolationKey network_isolation_key_; - const bool disable_secure_dns_; + const SecureDnsPolicy secure_dns_policy_; const OnHostResolutionCallback host_resolution_callback_; DISALLOW_COPY_AND_ASSIGN(TransportSocketParams);
diff --git a/net/socket/transport_connect_job_unittest.cc b/net/socket/transport_connect_job_unittest.cc index 9dc9725..f7e451f 100644 --- a/net/socket/transport_connect_job_unittest.cc +++ b/net/socket/transport_connect_job_unittest.cc
@@ -19,6 +19,7 @@ #include "net/base/test_completion_callback.h" #include "net/dns/mock_host_resolver.h" #include "net/dns/public/secure_dns_mode.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/log/test_net_log.h" #include "net/socket/connect_job_test_util.h" #include "net/socket/connection_attempts.h" @@ -60,7 +61,7 @@ static scoped_refptr<TransportSocketParams> DefaultParams() { return base::MakeRefCounted<TransportSocketParams>( HostPortPair(kHostName, 80), NetworkIsolationKey(), - false /* disable_secure_dns */, OnHostResolutionCallback()); + SecureDnsPolicy::kAllow, OnHostResolutionCallback()); } protected: @@ -262,20 +263,21 @@ } } -TEST_F(TransportConnectJobTest, DisableSecureDns) { - for (bool disable_secure_dns : {false, true}) { +TEST_F(TransportConnectJobTest, SecureDnsPolicy) { + for (auto secure_dns_policy : + {SecureDnsPolicy::kAllow, SecureDnsPolicy::kDisable}) { TestConnectJobDelegate test_delegate; TransportConnectJob transport_connect_job( DEFAULT_PRIORITY, SocketTag(), &common_connect_job_params_, base::MakeRefCounted<TransportSocketParams>( HostPortPair(kHostName, 80), NetworkIsolationKey(), - disable_secure_dns, OnHostResolutionCallback()), + secure_dns_policy, OnHostResolutionCallback()), &test_delegate, nullptr /* net_log */); test_delegate.StartJobExpectingResult(&transport_connect_job, OK, false /* expect_sync_result */); - EXPECT_EQ(disable_secure_dns, + EXPECT_EQ(secure_dns_policy == SecureDnsPolicy::kDisable, host_resolver_.last_secure_dns_mode_override().has_value()); - if (disable_secure_dns) { + if (secure_dns_policy == SecureDnsPolicy::kDisable) { EXPECT_EQ(net::SecureDnsMode::kOff, host_resolver_.last_secure_dns_mode_override().value()); }
diff --git a/net/socket/websocket_transport_client_socket_pool_unittest.cc b/net/socket/websocket_transport_client_socket_pool_unittest.cc index 9608895..6c9d51f 100644 --- a/net/socket/websocket_transport_client_socket_pool_unittest.cc +++ b/net/socket/websocket_transport_client_socket_pool_unittest.cc
@@ -28,6 +28,7 @@ #include "net/base/schemeful_site.h" #include "net/base/test_completion_callback.h" #include "net/dns/mock_host_resolver.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/log/test_net_log.h" #include "net/socket/client_socket_handle.h" #include "net/socket/connect_job.h" @@ -73,7 +74,7 @@ ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), params_(ClientSocketPool::SocketParams::CreateForHttpForTesting()), host_resolver_(new MockHostResolver), client_socket_factory_(&net_log_), @@ -196,7 +197,7 @@ handle.Init(ClientSocketPool::GroupId( host_port_pair, ClientSocketPool::SocketType::kHttp, PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), ClientSocketPool::SocketParams::CreateForHttpForTesting(), base::nullopt /* proxy_annotation_tag */, kDefaultPriority, SocketTag(), ClientSocketPool::RespectLimits::ENABLED, @@ -1152,7 +1153,7 @@ ClientSocketPool::GroupId group_id( HostPortPair("www.google.com", 80), ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, kNetworkIsolationKey, - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); EXPECT_THAT( handle.Init(group_id, params_, base::nullopt /* proxy_annotation_tag */, kDefaultPriority, SocketTag(), @@ -1182,7 +1183,7 @@ scoped_refptr<TransportSocketParams> params = base::MakeRefCounted<TransportSocketParams>( HostPortPair(kHostName, 80), NetworkIsolationKey(), - false /* disable_secure_dns */, OnHostResolutionCallback()); + SecureDnsPolicy::kAllow, OnHostResolutionCallback()); WebSocketTransportConnectJob transport_connect_job( DEFAULT_PRIORITY, SocketTag(), &common_connect_job_params_, params, @@ -1214,7 +1215,7 @@ scoped_refptr<TransportSocketParams> params = base::MakeRefCounted<TransportSocketParams>( HostPortPair(kHostName, 80), NetworkIsolationKey(), - false /* disable_secure_dns */, OnHostResolutionCallback()); + SecureDnsPolicy::kAllow, OnHostResolutionCallback()); WebSocketTransportConnectJob transport_connect_job( DEFAULT_PRIORITY, SocketTag(), &common_connect_job_params_, params,
diff --git a/net/socket/websocket_transport_connect_job.cc b/net/socket/websocket_transport_connect_job.cc index bcb6ceb..4993f3e6 100644 --- a/net/socket/websocket_transport_connect_job.cc +++ b/net/socket/websocket_transport_connect_job.cc
@@ -16,8 +16,10 @@ #include "net/base/address_list.h" #include "net/base/net_errors.h" #include "net/base/trace_constants.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/log/net_log_event_type.h" #include "net/log/net_log_source.h" +#include "net/socket/socket_tag.h" #include "net/socket/transport_connect_job.h" #include "net/socket/websocket_endpoint_lock_manager.h" #include "net/socket/websocket_transport_connect_sub_job.h" @@ -115,7 +117,7 @@ HostResolver::ResolveHostParameters parameters; parameters.initial_priority = priority(); - DCHECK(!params_->disable_secure_dns()); + DCHECK_EQ(SecureDnsPolicy::kAllow, params_->secure_dns_policy()); request_ = host_resolver()->CreateRequest(params_->destination(), params_->network_isolation_key(), net_log(), parameters);
diff --git a/net/spdy/bidirectional_stream_spdy_impl_unittest.cc b/net/spdy/bidirectional_stream_spdy_impl_unittest.cc index ff93e27..b16793f 100644 --- a/net/spdy/bidirectional_stream_spdy_impl_unittest.cc +++ b/net/spdy/bidirectional_stream_spdy_impl_unittest.cc
@@ -17,6 +17,7 @@ #include "net/base/load_timing_info.h" #include "net/base/load_timing_info_test_util.h" #include "net/base/net_errors.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_request_info.h" #include "net/http/http_response_headers.h" #include "net/http/http_response_info.h" @@ -251,7 +252,7 @@ SpdySessionKey::IsProxySession::kFalse, SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), ssl_data_(SSLSocketDataProvider(ASYNC, OK)) { ssl_data_.next_proto = kProtoHTTP2; ssl_data_.ssl_info.cert =
diff --git a/net/spdy/http2_push_promise_index_test.cc b/net/spdy/http2_push_promise_index_test.cc index 6ec6578..7c8ef81 100644 --- a/net/spdy/http2_push_promise_index_test.cc +++ b/net/spdy/http2_push_promise_index_test.cc
@@ -6,6 +6,7 @@ #include "net/base/host_port_pair.h" #include "net/base/privacy_mode.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/socket/socket_tag.h" #include "net/test/gtest_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -63,14 +64,14 @@ SpdySessionKey::IsProxySession::kFalse, SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), key2_(HostPortPair::FromURL(url2_), ProxyServer::Direct(), PRIVACY_MODE_ENABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */) {} + SecureDnsPolicy::kAllow) {} const GURL url1_; const GURL url2_;
diff --git a/net/spdy/platform/impl/spdy_estimate_memory_usage_impl.h b/net/spdy/platform/impl/spdy_estimate_memory_usage_impl.h deleted file mode 100644 index e3882c5e..0000000 --- a/net/spdy/platform/impl/spdy_estimate_memory_usage_impl.h +++ /dev/null
@@ -1,21 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef NET_SPDY_PLATFORM_IMPL_SPDY_ESTIMATE_MEMORY_USAGE_IMPL_H_ -#define NET_SPDY_PLATFORM_IMPL_SPDY_ESTIMATE_MEMORY_USAGE_IMPL_H_ - -#include <cstddef> - -#include "base/trace_event/memory_usage_estimator.h" - -namespace spdy { - -template <class T> -size_t SpdyEstimateMemoryUsageImpl(const T& object) { - return base::trace_event::EstimateMemoryUsage(object); -} - -} // namespace spdy - -#endif // NET_SPDY_PLATFORM_IMPL_SPDY_ESTIMATE_MEMORY_USAGE_IMPL_H_
diff --git a/net/spdy/platform/impl/spdy_macros_impl.h b/net/spdy/platform/impl/spdy_macros_impl.h deleted file mode 100644 index 3c1da51..0000000 --- a/net/spdy/platform/impl/spdy_macros_impl.h +++ /dev/null
@@ -1,13 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef NET_SPDY_PLATFORM_IMPL_SPDY_MACROS_IMPL_H_ -#define NET_SPDY_PLATFORM_IMPL_SPDY_MACROS_IMPL_H_ - -#include "base/compiler_specific.h" - -#define SPDY_MUST_USE_RESULT_IMPL WARN_UNUSED_RESULT -#define SPDY_UNUSED_IMPL ALLOW_UNUSED_TYPE - -#endif // NET_SPDY_PLATFORM_IMPL_SPDY_MACROS_IMPL_H_
diff --git a/net/spdy/platform/impl/spdy_test_impl.h b/net/spdy/platform/impl/spdy_test_impl.h deleted file mode 100644 index 4bb8f67..0000000 --- a/net/spdy/platform/impl/spdy_test_impl.h +++ /dev/null
@@ -1,16 +0,0 @@ -// Copyright (c) 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 NET_SPDY_PLATFORM_IMPL_SPDY_TEST_IMPL_H_ -#define NET_SPDY_PLATFORM_IMPL_SPDY_TEST_IMPL_H_ - -#include "testing/gmock/include/gmock/gmock.h" // IWYU pragma: export -#include "testing/gtest/include/gtest/gtest-spi.h" // IWYU pragma: export -#include "testing/gtest/include/gtest/gtest.h" // IWYU pragma: export - -using SpdyTestImpl = ::testing::Test; -template <class T> -using SpdyTestWithParamImpl = ::testing::TestWithParam<T>; - -#endif // NET_SPDY_PLATFORM_IMPL_SPDY_TEST_IMPL_H_
diff --git a/net/spdy/platform/impl/spdy_unsafe_arena_impl_test.cc b/net/spdy/platform/impl/spdy_unsafe_arena_impl_test.cc deleted file mode 100644 index 6a2b4a7..0000000 --- a/net/spdy/platform/impl/spdy_unsafe_arena_impl_test.cc +++ /dev/null
@@ -1,136 +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 "net/spdy/platform/impl/spdy_unsafe_arena_impl.h" - -#include <string> -#include <vector> - -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string_piece.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace spdy { -namespace { - -size_t kDefaultBlockSize = 2048; -const char kTestString[] = "This is a decently long test string."; - -TEST(SpdyUnsafeArenaImplTest, Memdup) { - SpdyUnsafeArenaImpl arena(kDefaultBlockSize); - const size_t length = strlen(kTestString); - char* c = arena.Memdup(kTestString, length); - EXPECT_NE(nullptr, c); - EXPECT_NE(c, kTestString); - EXPECT_EQ(SpdyStringPiece(c, length), kTestString); -} - -TEST(SpdyUnsafeArenaImplTest, MemdupLargeString) { - SpdyUnsafeArenaImpl arena(10 /* block size */); - const size_t length = strlen(kTestString); - char* c = arena.Memdup(kTestString, length); - EXPECT_NE(nullptr, c); - EXPECT_NE(c, kTestString); - EXPECT_EQ(SpdyStringPiece(c, length), kTestString); -} - -TEST(SpdyUnsafeArenaImplTest, MultipleBlocks) { - SpdyUnsafeArenaImpl arena(40 /* block size */); - std::vector<std::string> strings = { - "One decently long string.", "Another string.", - "A third string that will surely go in a different block."}; - std::vector<SpdyStringPiece> copies; - for (const std::string& s : strings) { - SpdyStringPiece sp(arena.Memdup(s.data(), s.size()), s.size()); - copies.push_back(sp); - } - EXPECT_EQ(strings.size(), copies.size()); - for (size_t i = 0; i < strings.size(); ++i) { - EXPECT_EQ(copies[i], strings[i]); - } -} - -TEST(SpdyUnsafeArenaImplTest, UseAfterReset) { - SpdyUnsafeArenaImpl arena(kDefaultBlockSize); - const size_t length = strlen(kTestString); - char* c = arena.Memdup(kTestString, length); - arena.Reset(); - c = arena.Memdup(kTestString, length); - EXPECT_NE(nullptr, c); - EXPECT_NE(c, kTestString); - EXPECT_EQ(SpdyStringPiece(c, length), kTestString); -} - -TEST(SpdyUnsafeArenaImplTest, Free) { - SpdyUnsafeArenaImpl arena(kDefaultBlockSize); - const size_t length = strlen(kTestString); - // Freeing memory not owned by the arena should be a no-op, and freeing - // before any allocations from the arena should be a no-op. - arena.Free(const_cast<char*>(kTestString), length); - char* c1 = arena.Memdup("Foo", 3); - char* c2 = arena.Memdup(kTestString, length); - arena.Free(const_cast<char*>(kTestString), length); - char* c3 = arena.Memdup("Bar", 3); - char* c4 = arena.Memdup(kTestString, length); - EXPECT_NE(c1, c2); - EXPECT_NE(c1, c3); - EXPECT_NE(c1, c4); - EXPECT_NE(c2, c3); - EXPECT_NE(c2, c4); - EXPECT_NE(c3, c4); - // Freeing c4 should succeed, since it was the most recent allocation. - arena.Free(c4, length); - // Freeing c2 should be a no-op. - arena.Free(c2, length); - // c5 should reuse memory that was previously used by c4. - char* c5 = arena.Memdup("Baz", 3); - EXPECT_EQ(c4, c5); -} - -TEST(SpdyUnsafeArenaImplTest, Alloc) { - SpdyUnsafeArenaImpl arena(kDefaultBlockSize); - const size_t length = strlen(kTestString); - char* c1 = arena.Alloc(length); - char* c2 = arena.Alloc(2 * length); - char* c3 = arena.Alloc(3 * length); - char* c4 = arena.Memdup(kTestString, length); - EXPECT_EQ(c1 + length, c2); - EXPECT_EQ(c2 + 2 * length, c3); - EXPECT_EQ(c3 + 3 * length, c4); - EXPECT_EQ(SpdyStringPiece(c4, length), kTestString); -} - -TEST(SpdyUnsafeArenaImplTest, Realloc) { - SpdyUnsafeArenaImpl arena(kDefaultBlockSize); - const size_t length = strlen(kTestString); - // Simple realloc that fits in the block. - char* c1 = arena.Memdup(kTestString, length); - char* c2 = arena.Realloc(c1, length, 2 * length); - EXPECT_TRUE(c1); - EXPECT_EQ(c1, c2); - EXPECT_EQ(SpdyStringPiece(c1, length), kTestString); - // Multiple reallocs. - char* c3 = arena.Memdup(kTestString, length); - EXPECT_EQ(c2 + 2 * length, c3); - EXPECT_EQ(SpdyStringPiece(c3, length), kTestString); - char* c4 = arena.Realloc(c3, length, 2 * length); - EXPECT_EQ(c3, c4); - EXPECT_EQ(SpdyStringPiece(c4, length), kTestString); - char* c5 = arena.Realloc(c4, 2 * length, 3 * length); - EXPECT_EQ(c4, c5); - EXPECT_EQ(SpdyStringPiece(c5, length), kTestString); - char* c6 = arena.Memdup(kTestString, length); - EXPECT_EQ(c5 + 3 * length, c6); - EXPECT_EQ(SpdyStringPiece(c6, length), kTestString); - // Realloc that does not fit in the remainder of the first block. - char* c7 = arena.Realloc(c6, length, kDefaultBlockSize); - EXPECT_EQ(SpdyStringPiece(c7, length), kTestString); - arena.Free(c7, kDefaultBlockSize); - char* c8 = arena.Memdup(kTestString, length); - EXPECT_NE(c6, c7); - EXPECT_EQ(c7, c8); - EXPECT_EQ(SpdyStringPiece(c8, length), kTestString); -} - -} // namespace -} // namespace spdy
diff --git a/net/spdy/spdy_http_stream_unittest.cc b/net/spdy/spdy_http_stream_unittest.cc index 20e36b7..925a8e8 100644 --- a/net/spdy/spdy_http_stream_unittest.cc +++ b/net/spdy/spdy_http_stream_unittest.cc
@@ -20,6 +20,7 @@ #include "net/base/load_timing_info_test_util.h" #include "net/base/test_completion_callback.h" #include "net/cert/asn1_util.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_request_info.h" #include "net/http/http_response_headers.h" #include "net/http/http_response_info.h" @@ -134,7 +135,7 @@ SpdySessionKey::IsProxySession::kFalse, SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), ssl_(SYNCHRONOUS, OK) { session_deps_.net_log = &net_log_; }
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc index c71c2f34..d0f6746 100644 --- a/net/spdy/spdy_network_transaction_unittest.cc +++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -34,6 +34,7 @@ #include "net/base/upload_bytes_element_reader.h" #include "net/base/upload_file_element_reader.h" #include "net/dns/mock_host_resolver.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_auth_scheme.h" #include "net/http/http_network_session.h" #include "net/http/http_network_session_peer.h" @@ -423,8 +424,7 @@ SpdySessionKey key(HostPortPair::FromURL(request_.url), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - request_.network_isolation_key, - false /* disable_secure_dns */); + request_.network_isolation_key, SecureDnsPolicy::kAllow); HttpNetworkSession* session = helper.session(); base::WeakPtr<SpdySession> spdy_session = session->spdy_session_pool()->FindAvailableSession( @@ -772,7 +772,7 @@ SpdySessionKey key(HostPortPair("www.example.org", 443), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); auto spdy_session = CreateSpdySession(helper.session(), key, log_); EXPECT_TRUE(spdy_session); @@ -3569,7 +3569,7 @@ SpdySessionKey key(host_port_pair_, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session = spdy_session_pool->FindAvailableSession( key, /* enable_ip_based_pooling = */ true, @@ -3685,7 +3685,7 @@ SpdySessionKey key1(HostPortPair::FromURL(GURL(kUrl1)), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session1 = spdy_session_pool->FindAvailableSession( key1, /* enable_ip_based_pooling = */ true, @@ -3698,7 +3698,7 @@ SpdySessionKey key2(HostPortPair::FromURL(GURL(kUrl2)), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); EXPECT_FALSE(spdy_session_pool->FindAvailableSession( key2, /* enable_ip_based_pooling = */ true, /* is_websocket = */ false, log_)); @@ -3785,7 +3785,7 @@ ProxyServer::FromPacString(kPacString), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> session1 = helper.session()->spdy_session_pool()->FindAvailableSession( key1, true /* enable_ip_based_pooling */, false /* is_websocket */, @@ -3846,7 +3846,7 @@ SpdySessionKey key2( HostPortPair("example.test", 443), ProxyServer::FromPacString(kPacString), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, - SocketTag(), NetworkIsolationKey(), false /* disable_secure_dns */); + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> session2 = helper.session()->spdy_session_pool()->FindAvailableSession( key2, true /* enable_ip_based_pooling */, false /* is_websocket */, @@ -3889,7 +3889,7 @@ SpdySessionKey key1(HostPortPair("www.example.org", 443), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); EXPECT_TRUE(helper.session()->spdy_session_pool()->FindAvailableSession( key1, true /* enable_ip_based_pooling */, false /* is_websocket */, NetLogWithSource())); @@ -3936,7 +3936,7 @@ SpdySessionKey key2(HostPortPair("example.test", 443), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> session1 = helper.session()->spdy_session_pool()->FindAvailableSession( key2, true /* enable_ip_based_pooling */, false /* is_websocket */, @@ -4045,7 +4045,7 @@ SpdySessionKey key1(HostPortPair("www.example.org", 443), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); EXPECT_TRUE(helper.session()->spdy_session_pool()->FindAvailableSession( key1, true /* enable_ip_based_pooling */, false /* is_websocket */, NetLogWithSource())); @@ -4092,7 +4092,7 @@ SpdySessionKey key2(HostPortPair("example.test", 443), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, kSocketTag2, - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); // Complete the third requests's DNS lookup now, which should hijack the // SpdySession from the second request. @@ -4100,7 +4100,7 @@ SpdySessionKey key3(HostPortPair("example.test", 443), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, kSocketTag3, - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); // Wait for the second request to get headers. It should create a new H2 // session to do so. @@ -4189,7 +4189,7 @@ SpdySessionKey key1(HostPortPair(url.host(), 443), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, socket_tag_1, - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); EXPECT_TRUE(helper.session()->spdy_session_pool()->FindAvailableSession( key1, true /* enable_ip_based_pooling */, false /* is_websocket */, NetLogWithSource())); @@ -4211,7 +4211,7 @@ SpdySessionKey key2(HostPortPair(url.host(), 443), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, socket_tag_2, - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); auto trans2 = std::make_unique<HttpNetworkTransaction>(DEFAULT_PRIORITY, helper.session()); TestCompletionCallback callback2; @@ -4332,7 +4332,7 @@ SpdySessionKey key1(HostPortPair(url1.host(), 443), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, socket_tag_1, - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); EXPECT_TRUE(helper.session()->spdy_session_pool()->FindAvailableSession( key1, true /* enable_ip_based_pooling */, false /* is_websocket */, NetLogWithSource())); @@ -4350,7 +4350,7 @@ SpdySessionKey key2(HostPortPair(url2.host(), 443), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, socket_tag_1, - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); auto trans2 = std::make_unique<HttpNetworkTransaction>(DEFAULT_PRIORITY, helper.session()); TestCompletionCallback callback2; @@ -4395,7 +4395,7 @@ SpdySessionKey key3(HostPortPair(url2.host(), 443), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, socket_tag_2, - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); auto trans3 = std::make_unique<HttpNetworkTransaction>(DEFAULT_PRIORITY, helper.session()); TestCompletionCallback callback3; @@ -4443,7 +4443,7 @@ SpdySessionKey key4(HostPortPair(url1.host(), 443), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, socket_tag_2, - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); auto trans4 = std::make_unique<HttpNetworkTransaction>(DEFAULT_PRIORITY, helper.session()); TestCompletionCallback callback4; @@ -5367,7 +5367,7 @@ SpdySessionKey key(host_port_pair_, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session = spdy_session_pool->FindAvailableSession( key, /* enable_ip_based_pooling = */ true, @@ -5986,13 +5986,13 @@ SpdySessionKey session_pool_key_direct( host_port_pair_, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); EXPECT_TRUE(HasSpdySession(spdy_session_pool, session_pool_key_direct)); SpdySessionKey session_pool_key_proxy( host_port_pair_, ProxyServer::FromURI("www.foo.com", ProxyServer::SCHEME_HTTP), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, - SocketTag(), NetworkIsolationKey(), false /* disable_secure_dns */); + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow); EXPECT_FALSE(HasSpdySession(spdy_session_pool, session_pool_key_proxy)); // New SpdyTestUtil instance for the session that will be used for the @@ -6747,7 +6747,7 @@ SpdySessionKey key(host_port_pair_, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session = spdy_session_pool->FindAvailableSession( key, /* enable_ip_based_pooling = */ true, @@ -6856,7 +6856,7 @@ SpdySessionKey key(host_port_pair_, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session = spdy_session_pool->FindAvailableSession( key, /* enable_ip_based_pooling = */ true, @@ -7072,7 +7072,7 @@ SpdySessionKey key0(host_port_pair0, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session0 = spdy_session_pool->FindAvailableSession( key0, /* enable_ip_based_pooling = */ true, @@ -7084,7 +7084,7 @@ SpdySessionKey key1(host_port_pair1, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session1 = spdy_session_pool->FindAvailableSession( key1, /* enable_ip_based_pooling = */ true, @@ -8636,7 +8636,7 @@ SpdySessionKey key(HostPortPair::FromURL(request_.url), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); HttpNetworkSession* session = helper.session(); base::WeakPtr<SpdySession> spdy_session = session->spdy_session_pool()->FindAvailableSession( @@ -8756,7 +8756,7 @@ SpdySessionKey key(HostPortPair::FromURL(request_.url), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session = helper.session()->spdy_session_pool()->FindAvailableSession( key, /* enable_ip_based_pooling = */ true, @@ -8904,7 +8904,7 @@ SpdySessionKey key(HostPortPair::FromURL(request_.url), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session = helper.session()->spdy_session_pool()->FindAvailableSession( @@ -8985,7 +8985,7 @@ SpdySessionKey key(HostPortPair::FromURL(request_.url), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session = helper.session()->spdy_session_pool()->FindAvailableSession( key, /* enable_ip_based_pooling = */ true, @@ -9181,7 +9181,7 @@ HostPortPair::FromURL(request_.url), ProxyServer::FromURI("https://proxy:70", ProxyServer::SCHEME_HTTPS), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, - SocketTag(), NetworkIsolationKey(), false /* disable_secure_dns */); + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session = helper.session()->spdy_session_pool()->FindAvailableSession( @@ -9294,7 +9294,7 @@ SpdySessionKey key1(HostPortPair::FromURL(request_.url), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session1 = helper.session()->spdy_session_pool()->FindAvailableSession( key1, /* enable_ip_based_pooling = */ true, @@ -9309,7 +9309,7 @@ SpdySessionKey key2(HostPortPair::FromURL(request2.url), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session2 = helper.session()->spdy_session_pool()->FindAvailableSession( key1, /* enable_ip_based_pooling = */ true, @@ -9448,7 +9448,7 @@ SpdySessionKey key1(HostPortPair::FromURL(request_.url), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session1 = helper.session()->spdy_session_pool()->FindAvailableSession( key1, /* enable_ip_based_pooling = */ true, @@ -9464,7 +9464,7 @@ SpdySessionKey key2(HostPortPair::FromURL(request2.url), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session2 = helper.session()->spdy_session_pool()->FindAvailableSession( key1, /* enable_ip_based_pooling = */ true, @@ -9612,7 +9612,7 @@ SpdySessionKey key(HostPortPair::FromURL(request_.url), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session = helper.session()->spdy_session_pool()->FindAvailableSession( key, /* enable_ip_based_pooling = */ true,
diff --git a/net/spdy/spdy_proxy_client_socket_unittest.cc b/net/spdy/spdy_proxy_client_socket_unittest.cc index 1f262c27..3e9c678 100644 --- a/net/spdy/spdy_proxy_client_socket_unittest.cc +++ b/net/spdy/spdy_proxy_client_socket_unittest.cc
@@ -18,6 +18,7 @@ #include "net/base/test_completion_callback.h" #include "net/base/winsock_init.h" #include "net/dns/mock_host_resolver.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_proxy_connect_job.h" #include "net/http/http_response_headers.h" #include "net/http/http_response_info.h" @@ -93,8 +94,8 @@ NetLogWithSource())); auto transport_params = base::MakeRefCounted<TransportSocketParams>( - key.host_port_pair(), NetworkIsolationKey(), - false /* disable_secure_dns */, OnHostResolutionCallback()); + key.host_port_pair(), NetworkIsolationKey(), SecureDnsPolicy::kAllow, + OnHostResolutionCallback()); SSLConfig ssl_config; auto ssl_params = base::MakeRefCounted<SSLSocketParams>( @@ -218,7 +219,7 @@ SpdySessionKey::IsProxySession::kFalse, SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), ssl_(SYNCHRONOUS, OK) { session_deps_.net_log = net_log_.bound().net_log(); }
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index 889b6e6..9f249ae0 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc
@@ -1821,7 +1821,7 @@ spdy_session_key_.host_port_pair(), spdy_session_key_.proxy_server(), spdy_session_key_.privacy_mode(), spdy_session_key_.is_proxy_session(), new_tag, spdy_session_key_.network_isolation_key(), - spdy_session_key_.disable_secure_dns()); + spdy_session_key_.secure_dns_policy()); spdy_session_key_ = new_key; return true;
diff --git a/net/spdy/spdy_session_fuzzer.cc b/net/spdy/spdy_session_fuzzer.cc index fada2ab..964454a3 100644 --- a/net/spdy/spdy_session_fuzzer.cc +++ b/net/spdy/spdy_session_fuzzer.cc
@@ -11,6 +11,7 @@ #include "net/base/net_errors.h" #include "net/base/request_priority.h" #include "net/cert/x509_certificate.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/log/net_log_source.h" #include "net/log/test_net_log.h" #include "net/socket/fuzzed_socket_factory.h" @@ -124,7 +125,7 @@ direct_connect, net::PRIVACY_MODE_DISABLED, net::SpdySessionKey::IsProxySession::kFalse, net::SocketTag(), net::NetworkIsolationKey(), - false /* disable_secure_dns */); + net::SecureDnsPolicy::kAllow); base::WeakPtr<net::SpdySession> spdy_session(net::CreateSpdySession( http_session.get(), session_key, bound_test_net_log.bound()));
diff --git a/net/spdy/spdy_session_key.cc b/net/spdy/spdy_session_key.cc index 1b74eb0d..1bc0847 100644 --- a/net/spdy/spdy_session_key.cc +++ b/net/spdy/spdy_session_key.cc
@@ -11,6 +11,7 @@ #include "base/trace_event/memory_usage_estimator.h" #include "net/base/features.h" #include "net/base/host_port_pair.h" +#include "net/dns/public/secure_dns_policy.h" namespace net { @@ -22,7 +23,7 @@ IsProxySession is_proxy_session, const SocketTag& socket_tag, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns) + SecureDnsPolicy secure_dns_policy) : host_port_proxy_pair_(host_port_pair, proxy_server), privacy_mode_(privacy_mode), is_proxy_session_(is_proxy_session), @@ -32,7 +33,7 @@ features::kPartitionConnectionsByNetworkIsolationKey) ? network_isolation_key : NetworkIsolationKey()), - disable_secure_dns_(disable_secure_dns) { + secure_dns_policy_(secure_dns_policy) { // IsProxySession::kTrue should only be used with direct connections, since // using multiple layers of proxies on top of each other isn't supported. DCHECK(is_proxy_session != IsProxySession::kTrue || proxy_server.is_direct()); @@ -48,10 +49,10 @@ bool SpdySessionKey::operator<(const SpdySessionKey& other) const { return std::tie(privacy_mode_, host_port_proxy_pair_.first, host_port_proxy_pair_.second, is_proxy_session_, - network_isolation_key_, disable_secure_dns_, socket_tag_) < + network_isolation_key_, secure_dns_policy_, socket_tag_) < std::tie(other.privacy_mode_, other.host_port_proxy_pair_.first, other.host_port_proxy_pair_.second, other.is_proxy_session_, - other.network_isolation_key_, other.disable_secure_dns_, + other.network_isolation_key_, other.secure_dns_policy_, other.socket_tag_); } @@ -62,7 +63,7 @@ host_port_proxy_pair_.second == other.host_port_proxy_pair_.second && is_proxy_session_ == other.is_proxy_session_ && network_isolation_key_ == other.network_isolation_key_ && - disable_secure_dns_ == other.disable_secure_dns_ && + secure_dns_policy_ == other.secure_dns_policy_ && socket_tag_ == other.socket_tag_; } @@ -78,7 +79,7 @@ host_port_proxy_pair_.second == other.host_port_proxy_pair_.second && is_proxy_session_ == other.is_proxy_session_ && network_isolation_key_ == other.network_isolation_key_ && - disable_secure_dns_ == other.disable_secure_dns_); + secure_dns_policy_ == other.secure_dns_policy_); result.is_socket_tag_match = (socket_tag_ == other.socket_tag_); return result; }
diff --git a/net/spdy/spdy_session_key.h b/net/spdy/spdy_session_key.h index f9e27a5b..b692b02 100644 --- a/net/spdy/spdy_session_key.h +++ b/net/spdy/spdy_session_key.h
@@ -9,6 +9,7 @@ #include "net/base/network_isolation_key.h" #include "net/base/privacy_mode.h" #include "net/base/proxy_server.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/socket/socket_tag.h" namespace net { @@ -35,7 +36,7 @@ IsProxySession is_proxy_session, const SocketTag& socket_tag, const NetworkIsolationKey& network_isolation_key, - bool disable_secure_dns); + SecureDnsPolicy secure_dns_policy); SpdySessionKey(const SpdySessionKey& other); @@ -92,7 +93,7 @@ return network_isolation_key_; } - bool disable_secure_dns() const { return disable_secure_dns_; } + SecureDnsPolicy secure_dns_policy() const { return secure_dns_policy_; } // Returns the estimate of dynamically allocated memory in bytes. size_t EstimateMemoryUsage() const; @@ -105,7 +106,7 @@ SocketTag socket_tag_; // Used to separate requests made in different contexts. NetworkIsolationKey network_isolation_key_; - bool disable_secure_dns_; + SecureDnsPolicy secure_dns_policy_; }; } // namespace net
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc index 5616442..8841902 100644 --- a/net/spdy/spdy_session_pool.cc +++ b/net/spdy/spdy_session_pool.cc
@@ -331,7 +331,7 @@ old_key.privacy_mode(), old_key.is_proxy_session(), key.socket_tag(), old_key.network_isolation_key(), - old_key.disable_secure_dns()); + old_key.secure_dns_policy()); // If there is already a session with |new_key|, skip this one. // It will be found in |aliases_| in a future iteration. @@ -375,7 +375,7 @@ SpdySessionKey new_pool_alias_key = SpdySessionKey( it->host_port_pair(), it->proxy_server(), it->privacy_mode(), it->is_proxy_session(), key.socket_tag(), - it->network_isolation_key(), it->disable_secure_dns()); + it->network_isolation_key(), it->secure_dns_policy()); MapKeyToAvailableSession(new_pool_alias_key, available_session, std::move(pooled_alias_old_dns_aliases)); auto old_it = it;
diff --git a/net/spdy/spdy_session_pool_unittest.cc b/net/spdy/spdy_session_pool_unittest.cc index cacc43ec..50cb955e 100644 --- a/net/spdy/spdy_session_pool_unittest.cc +++ b/net/spdy/spdy_session_pool_unittest.cc
@@ -18,6 +18,7 @@ #include "base/trace_event/traced_value.h" #include "build/build_config.h" #include "net/dns/host_cache.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_network_session.h" #include "net/log/net_log_with_source.h" #include "net/log/test_net_log.h" @@ -211,7 +212,7 @@ SpdySessionKey test_key = SpdySessionKey( test_host_port_pair, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); MockConnect connect_data(SYNCHRONOUS, OK); MockRead reads[] = { @@ -273,7 +274,7 @@ SpdySessionKey key1(test_host_port_pair1, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> session1 = CreateSpdySession(http_session_.get(), key1, NetLogWithSource()); base::WeakPtr<SpdyStream> spdy_stream1 = CreateStreamSynchronously( @@ -288,7 +289,7 @@ SpdySessionKey key2(test_host_port_pair2, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> session2 = CreateSpdySession(http_session_.get(), key2, NetLogWithSource()); base::WeakPtr<SpdyStream> spdy_stream2 = CreateStreamSynchronously( @@ -304,7 +305,7 @@ SpdySessionKey key3(test_host_port_pair3, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> session3 = CreateSpdySession(http_session_.get(), key3, NetLogWithSource()); base::WeakPtr<SpdyStream> spdy_stream3 = CreateStreamSynchronously( @@ -382,7 +383,7 @@ SpdySessionKey test_key = SpdySessionKey( test_host_port_pair, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); MockConnect connect_data(SYNCHRONOUS, OK); MockRead reads[] = { @@ -452,7 +453,7 @@ test_hosts[i].key = SpdySessionKey( HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, - SocketTag(), NetworkIsolationKey(), false /* disable_secure_dns */); + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow); } MockConnect connect_data(SYNCHRONOUS, OK); @@ -497,16 +498,16 @@ test_hosts[1].key.host_port_pair(), ProxyServer::FromPacString("HTTP http://proxy.foo.com/"), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, - SocketTag(), NetworkIsolationKey(), false /* disable_secure_dns */); + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow); EXPECT_FALSE(TryCreateAliasedSpdySession(spdy_session_pool_, proxy_key, test_hosts[1].iplist)); - // Verify that the second host, with a different disable_secure_dns value, + // Verify that the second host, with a different SecureDnsPolicy, // won't share the IP, even if the IP list matches. SpdySessionKey disable_secure_dns_key( test_hosts[1].key.host_port_pair(), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, - SocketTag(), NetworkIsolationKey(), true /* disable_secure_dns */); + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kDisable); EXPECT_FALSE(TryCreateAliasedSpdySession( spdy_session_pool_, disable_secure_dns_key, test_hosts[1].iplist)); @@ -636,7 +637,7 @@ test_hosts[i].key = SpdySessionKey( HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, - SocketTag(), NetworkIsolationKey(), false /* disable_secure_dns */); + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow); } MockRead reads[] = { @@ -692,7 +693,7 @@ test_hosts[i].key = SpdySessionKey( HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, - SocketTag(), NetworkIsolationKey(), false /* disable_secure_dns */); + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow); } MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING)}; @@ -758,7 +759,7 @@ test_hosts[i].key = SpdySessionKey( HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, - SocketTag(), NetworkIsolationKey(), false /* disable_secure_dns */); + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow); } MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING)}; @@ -852,7 +853,7 @@ SpdySessionKey keyA(test_host_port_pairA, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> sessionA = CreateSpdySession(http_session_.get(), keyA, NetLogWithSource()); @@ -885,7 +886,7 @@ SpdySessionKey keyB(test_host_port_pairB, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> sessionB = CreateSpdySession(http_session_.get(), keyB, NetLogWithSource()); EXPECT_TRUE(sessionB->IsAvailable()); @@ -908,7 +909,7 @@ SpdySessionKey keyC(test_host_port_pairC, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> sessionC = CreateSpdySession(http_session_.get(), keyC, NetLogWithSource()); @@ -968,7 +969,7 @@ SpdySessionKey key(HostPortPair::FromURL(url), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> session = CreateSpdySession(http_session_.get(), key, NetLogWithSource()); @@ -1026,7 +1027,7 @@ SpdySessionKey key(HostPortPair::FromURL(url), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> session = CreateSpdySession(http_session_.get(), key, NetLogWithSource()); @@ -1075,7 +1076,7 @@ SpdySessionKey key(HostPortPair("www.example.org", 443), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING)}; StaticSocketDataProvider data(reads, base::span<MockWrite>()); @@ -1140,7 +1141,7 @@ test_hosts[i].key = SpdySessionKey( HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, - SocketTag(), NetworkIsolationKey(), false /* disable_secure_dns */); + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow); } SpdyTestUtil spdy_util; @@ -1297,7 +1298,7 @@ const SpdySessionKey kSessionKey( HostPortPair("foo.test", 443), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, - SocketTag(), NetworkIsolationKey(), false /* disable_secure_dns */); + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow); CreateNetworkSession(); @@ -1359,7 +1360,7 @@ const SpdySessionKey kSessionKey( HostPortPair("foo.test", 443), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, - SocketTag(), NetworkIsolationKey(), false /* disable_secure_dns */); + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow); CreateNetworkSession(); @@ -1488,7 +1489,7 @@ HostPortPair::FromURL(GURL(kSSLServerTests[i].url)), ProxyServer::FromPacString(kSSLServerTests[i].proxy_pac_string), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, - SocketTag(), NetworkIsolationKey(), false /* disable_secure_dns */); + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow); sessions.push_back( CreateSpdySession(http_session_.get(), key, NetLogWithSource())); } @@ -1543,7 +1544,7 @@ HostPortPair::FromURL(GURL(kSSLServerTests[i].url)), ProxyServer::FromPacString(kSSLServerTests[i].proxy_pac_string), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, - SocketTag(), NetworkIsolationKey(), false /* disable_secure_dns */); + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow); sessions.push_back( CreateSpdySession(http_session_.get(), key, NetLogWithSource())); streams.push_back(CreateStreamSynchronously(
diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc index c80996b..75cd731 100644 --- a/net/spdy/spdy_session_unittest.cc +++ b/net/spdy/spdy_session_unittest.cc
@@ -31,6 +31,7 @@ #include "net/base/schemeful_site.h" #include "net/base/test_data_stream.h" #include "net/cert/ct_policy_status.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_request_info.h" #include "net/http/transport_security_state_test_util.h" #include "net/log/net_log_event_type.h" @@ -181,7 +182,7 @@ SpdySessionKey::IsProxySession::kFalse, SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), ssl_(SYNCHRONOUS, OK) {} ~SpdySessionTest() override { @@ -2853,7 +2854,7 @@ PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), NetworkIsolationKey::CreateTransient(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); ssl_.ssl_info.ct_policy_compliance = ct::CTPolicyCompliance::CT_POLICY_NOT_ENOUGH_SCTS; ssl_.ssl_info.is_issued_by_known_root = true; @@ -3649,7 +3650,7 @@ ClientSocketPool::GroupId( host_port2, ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), ClientSocketPool::SocketParams::CreateForHttpForTesting(), base::nullopt /* proxy_annotation_tag */, DEFAULT_PRIORITY, SocketTag(), ClientSocketPool::RespectLimits::ENABLED, @@ -3694,7 +3695,7 @@ SpdySessionKey key1(HostPortPair("www.example.org", 80), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> session1 = ::net::CreateSpdySession(http_session_.get(), key1, NetLogWithSource()); EXPECT_FALSE(pool->IsStalled()); @@ -3703,7 +3704,7 @@ SpdySessionKey key2(HostPortPair("mail.example.org", 80), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); std::unique_ptr<SpdySessionPool::SpdySessionRequest> request; bool is_blocking_request_for_session = false; SpdySessionRequestDelegate request_delegate; @@ -3739,7 +3740,7 @@ ClientSocketPool::GroupId( host_port3, ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), ClientSocketPool::SocketParams::CreateForHttpForTesting(), base::nullopt /* proxy_annotation_tag */, DEFAULT_PRIORITY, SocketTag(), ClientSocketPool::RespectLimits::ENABLED, @@ -3820,7 +3821,7 @@ ClientSocketPool::GroupId( host_port2, ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), ClientSocketPool::SocketParams::CreateForHttpForTesting(), base::nullopt /* proxy_annotation_tag */, DEFAULT_PRIORITY, SocketTag(), ClientSocketPool::RespectLimits::ENABLED, @@ -3853,11 +3854,11 @@ SpdySessionKey key_privacy_enabled( host_port_pair, ProxyServer::Direct(), PRIVACY_MODE_ENABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); SpdySessionKey key_privacy_disabled( host_port_pair, ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); EXPECT_FALSE(HasSpdySession(spdy_session_pool_, key_privacy_enabled)); EXPECT_FALSE(HasSpdySession(spdy_session_pool_, key_privacy_disabled)); @@ -6456,7 +6457,7 @@ PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), NetworkIsolationKey::CreateTransient(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); ssl_.ssl_info.ct_policy_compliance = ct::CTPolicyCompliance::CT_POLICY_NOT_ENOUGH_SCTS; ssl_.ssl_info.is_issued_by_known_root = true; @@ -6645,7 +6646,7 @@ key_ = SpdySessionKey(HostPortPair::FromURL(test_url_), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - kNetworkIsolationKey1, false /* disable_secure_dns */); + kNetworkIsolationKey1, SecureDnsPolicy::kAllow); spdy::SpdyAltSvcIR altsvc_ir(/* stream_id = */ 1); altsvc_ir.add_altsvc(alternative_service_);
diff --git a/net/spdy/spdy_stream_unittest.cc b/net/spdy/spdy_stream_unittest.cc index 09544c5..7c17dfc5 100644 --- a/net/spdy/spdy_stream_unittest.cc +++ b/net/spdy/spdy_stream_unittest.cc
@@ -20,6 +20,7 @@ #include "base/stl_util.h" #include "base/strings/string_piece.h" #include "net/base/request_priority.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_request_info.h" #include "net/log/net_log_event_type.h" #include "net/log/test_net_log.h" @@ -95,7 +96,7 @@ SpdySessionKey key(HostPortPair::FromURL(url_), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); return CreateSpdySession(session_.get(), key, NetLogWithSource()); } @@ -362,10 +363,10 @@ data.RunUntilPaused(); - const SpdySessionKey key( - HostPortPair::FromURL(url_), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, - SpdySessionKey::IsProxySession::kFalse, SocketTag(), - NetworkIsolationKey(), false /* disable_secure_dns */); + const SpdySessionKey key(HostPortPair::FromURL(url_), ProxyServer::Direct(), + PRIVACY_MODE_DISABLED, + SpdySessionKey::IsProxySession::kFalse, SocketTag(), + NetworkIsolationKey(), SecureDnsPolicy::kAllow); const GURL pushed_url(kPushUrl); HttpRequestInfo push_request; push_request.url = pushed_url;
diff --git a/net/spdy/spdy_test_util_common.cc b/net/spdy/spdy_test_util_common.cc index 69c7a51..8d499f9 100644 --- a/net/spdy/spdy_test_util_common.cc +++ b/net/spdy/spdy_test_util_common.cc
@@ -24,6 +24,7 @@ #include "net/cert/mock_cert_verifier.h" #include "net/cert/signed_certificate_timestamp_and_status.h" #include "net/dns/host_resolver.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_cache.h" #include "net/http/http_network_transaction.h" #include "net/http/http_proxy_connect_job.h" @@ -509,10 +510,9 @@ std::make_unique<SSLConfig>() /* ssl_config_for_origin */, nullptr /* ssl_config_for_proxy */); int rv = connection->Init( - ClientSocketPool::GroupId(key.host_port_pair(), - ClientSocketPool::SocketType::kSsl, - key.privacy_mode(), NetworkIsolationKey(), - false /* disable_secure_dns */), + ClientSocketPool::GroupId( + key.host_port_pair(), ClientSocketPool::SocketType::kSsl, + key.privacy_mode(), NetworkIsolationKey(), SecureDnsPolicy::kAllow), socket_params, base::nullopt /* proxy_annotation_tag */, MEDIUM, key.socket_tag(), ClientSocketPool::RespectLimits::ENABLED, callback.callback(), ClientSocketPool::ProxyAuthCallback(),
diff --git a/net/tools/quic/quic_http_proxy_backend.cc b/net/tools/quic/quic_http_proxy_backend.cc index 2ce0081..6060846 100644 --- a/net/tools/quic/quic_http_proxy_backend.cc +++ b/net/tools/quic/quic_http_proxy_backend.cc
@@ -92,8 +92,7 @@ if (proxy_backend_stream == nullptr || proxy_backend_stream->SendRequestToBackend(&request_headers, incoming_body) != true) { - std::list<quic::QuicBackendResponse::ServerPushInfo> empty_resources; - quic_server_stream->OnResponseBackendComplete(nullptr, empty_resources); + quic_server_stream->OnResponseBackendComplete(nullptr); } }
diff --git a/net/tools/quic/quic_http_proxy_backend_stream.cc b/net/tools/quic/quic_http_proxy_backend_stream.cc index 73cfa720d..bce3187 100644 --- a/net/tools/quic/quic_http_proxy_backend_stream.cc +++ b/net/tools/quic/quic_http_proxy_backend_stream.cc
@@ -319,9 +319,7 @@ void QuicHttpProxyBackendStream::SendResponseOnDelegateThread() { DCHECK(delegate_ != nullptr); - // Proxy currently does not support push resources - std::list<quic::QuicBackendResponse::ServerPushInfo> empty_resources; - delegate_->OnResponseBackendComplete(quic_response_.get(), empty_resources); + delegate_->OnResponseBackendComplete(quic_response_.get()); } void QuicHttpProxyBackendStream::CancelRequest() {
diff --git a/net/tools/quic/quic_http_proxy_backend_stream_test.cc b/net/tools/quic/quic_http_proxy_backend_stream_test.cc index 0923abe..6d4235b 100644 --- a/net/tools/quic/quic_http_proxy_backend_stream_test.cc +++ b/net/tools/quic/quic_http_proxy_backend_stream_test.cc
@@ -131,8 +131,7 @@ std::string peer_host() const override { return "127.0.0.1"; } void OnResponseBackendComplete( - const quic::QuicBackendResponse* response, - std::list<quic::QuicBackendResponse::ServerPushInfo> resources) override { + const quic::QuicBackendResponse* response) override { EXPECT_TRUE(task_runner_->BelongsToCurrentThread()); EXPECT_FALSE(did_complete_); EXPECT_TRUE(quic_backend_stream_);
diff --git a/net/tools/quic/quic_http_proxy_backend_test.cc b/net/tools/quic/quic_http_proxy_backend_test.cc index 76c9925c..47d9dd1 100644 --- a/net/tools/quic/quic_http_proxy_backend_test.cc +++ b/net/tools/quic/quic_http_proxy_backend_test.cc
@@ -31,8 +31,7 @@ std::string peer_host() const override { return "127.0.0.1"; } void OnResponseBackendComplete( - const quic::QuicBackendResponse* response, - std::list<quic::QuicBackendResponse::ServerPushInfo> resources) override { + const quic::QuicBackendResponse* response) override { EXPECT_FALSE(did_complete_); did_complete_ = true; task_runner_->PostTask(FROM_HERE, run_loop_.QuitClosure());
diff --git a/net/url_request/http_with_dns_over_https_unittest.cc b/net/url_request/http_with_dns_over_https_unittest.cc index 566c994..a9b1169d 100644 --- a/net/url_request/http_with_dns_over_https_unittest.cc +++ b/net/url_request/http_with_dns_over_https_unittest.cc
@@ -19,6 +19,7 @@ #include "net/dns/host_resolver_proc.h" #include "net/dns/public/dns_over_https_server_config.h" #include "net/dns/public/secure_dns_mode.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_stream_factory_test_util.h" #include "net/log/net_log.h" #include "net/socket/transport_client_socket_pool.h" @@ -255,7 +256,7 @@ ClientSocketPool::GroupId group_id( HostPortPair(request_info.url.host(), request_info.url.IntPort()), ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, - NetworkIsolationKey(), false /* disable_secure_dns */); + NetworkIsolationKey(), SecureDnsPolicy::kAllow); EXPECT_EQ(network_session ->GetSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL, ProxyServer::Direct())
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index f775153..7215881 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc
@@ -24,6 +24,7 @@ #include "net/base/network_change_notifier.h" #include "net/base/network_delegate.h" #include "net/base/upload_data_stream.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_log_util.h" #include "net/http/http_util.h" #include "net/log/net_log.h" @@ -431,8 +432,8 @@ SetPriority(MAXIMUM_PRIORITY); } -void URLRequest::SetDisableSecureDns(bool disable_secure_dns) { - disable_secure_dns_ = disable_secure_dns; +void URLRequest::SetSecureDnsPolicy(SecureDnsPolicy secure_dns_policy) { + secure_dns_policy_ = secure_dns_policy; } // static @@ -556,7 +557,7 @@ load_flags_(LOAD_NORMAL), allow_credentials_(true), privacy_mode_(PRIVACY_MODE_DISABLED), - disable_secure_dns_(false), + secure_dns_policy_(SecureDnsPolicy::kAllow), #if BUILDFLAG(ENABLE_REPORTING) reporting_upload_depth_(0), #endif
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index 316b958..b210964f 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h
@@ -34,6 +34,7 @@ #include "net/base/upload_progress.h" #include "net/cookies/canonical_cookie.h" #include "net/cookies/site_for_cookies.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/filter/source_stream.h" #include "net/http/http_raw_request_headers.h" #include "net/http/http_request_headers.h" @@ -521,8 +522,8 @@ // the request is redirected. PrivacyMode privacy_mode() const { return privacy_mode_; } - // Returns whether secure DNS should be disabled for the request. - bool disable_secure_dns() const { return disable_secure_dns_; } + // Returns the Secure DNS Policy for the request. + SecureDnsPolicy secure_dns_policy() const { return secure_dns_policy_; } void set_maybe_sent_cookies(CookieAccessResultList cookies); void set_maybe_stored_cookies(CookieAndLineAccessResultList cookies); @@ -551,8 +552,9 @@ // the priority of this request must already be MAXIMUM_PRIORITY. void SetLoadFlags(int flags); - // Sets whether secure DNS should be disabled for the request. - void SetDisableSecureDns(bool disable_secure_dns); + // Controls the Secure DNS behavior to use when creating the socket for this + // request. + void SetSecureDnsPolicy(SecureDnsPolicy secure_dns_policy); // Returns true if the request is "pending" (i.e., if Start() has been called, // and the response has not yet been called). @@ -908,7 +910,7 @@ // currently be blocked independently of this field by setting the deprecated // LOAD_DO_NOT_SAVE_COOKIES field in |load_flags_|. PrivacyMode privacy_mode_; - bool disable_secure_dns_; + SecureDnsPolicy secure_dns_policy_; CookieAccessResultList maybe_sent_cookies_; CookieAndLineAccessResultList maybe_stored_cookies_;
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index 393b89a..1dca5d8 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc
@@ -268,7 +268,7 @@ request_->isolation_info().request_type() == net::IsolationInfo::RequestType::kSubFrame; request_info_.load_flags = request_->load_flags(); - request_info_.disable_secure_dns = request_->disable_secure_dns(); + request_info_.secure_dns_policy = request_->secure_dns_policy(); request_info_.traffic_annotation = net::MutableNetworkTrafficAnnotationTag(request_->traffic_annotation()); request_info_.socket_tag = request_->socket_tag();
diff --git a/net/url_request/url_request_quic_unittest.cc b/net/url_request/url_request_quic_unittest.cc index 4fae156d..9ce7d58 100644 --- a/net/url_request/url_request_quic_unittest.cc +++ b/net/url_request/url_request_quic_unittest.cc
@@ -388,257 +388,6 @@ EXPECT_TRUE(request->ssl_info().is_valid()); } -TEST_P(URLRequestQuicTest, CancelPushIfCached_SomeCached) { - if (VersionUsesHttp3(version().transport_version)) { - Init(); - return; - } - - // Skip test if "split cache" is enabled while "partition connections" is - // disabled, as it breaks push. - if (base::FeatureList::IsEnabled( - net::features::kSplitCacheByNetworkIsolationKey) && - !base::FeatureList::IsEnabled( - net::features::kPartitionConnectionsByNetworkIsolationKey)) { - return; - } - - const url::Origin kOrigin1 = - url::Origin::Create(GURL("http://www.example.com")); - const IsolationInfo kTestIsolationInfo = - IsolationInfo::CreateForInternalRequest(kOrigin1); - - Init(); - - // Send a request to the pushed url: /kitten-1.jpg to pull the resource into - // cache. - CheckLoadTimingDelegate delegate_0(false); - std::unique_ptr<URLRequest> request_0 = CreateRequest( - GURL(UrlFromPath(kKittenPath)), DEFAULT_PRIORITY, &delegate_0); - - request_0->set_isolation_info(kTestIsolationInfo); - request_0->Start(); - ASSERT_TRUE(request_0->is_pending()); - - // Spin the message loop until the client receives the response for the first - // request. - delegate_0.RunUntilComplete(); - EXPECT_EQ(OK, delegate_0.request_status()); - - // Send a request to /index2.html which pushes /kitten-1.jpg and /favicon.ico. - // Should cancel push for /kitten-1.jpg. - CheckLoadTimingDelegate delegate(true); - std::unique_ptr<URLRequest> request = - CreateRequest(GURL(UrlFromPath(kIndexPath)), DEFAULT_PRIORITY, &delegate); - - request->set_isolation_info(kTestIsolationInfo); - request->Start(); - ASSERT_TRUE(request->is_pending()); - - // Spin the message loop until the client receives the response for the second - // request. - delegate.RunUntilComplete(); - EXPECT_EQ(OK, delegate.request_status()); - // Wait until all QUIC events are process, some of which happen - // asynchronously. - base::RunLoop().RunUntilIdle(); - - // Extract net logs on client side to verify push lookup transactions. - auto entries = net_log_.GetEntriesWithType( - NetLogEventType::SERVER_PUSH_LOOKUP_TRANSACTION); - - ASSERT_EQ(4u, entries.size()); - - std::string value; - std::string push_url_1 = UrlFromPath(kKittenPath); - std::string push_url_2 = UrlFromPath(kFaviconPath); - - const NetLogSource source_1 = FindPushUrlSource(entries, push_url_1); - EXPECT_TRUE(source_1.IsValid()); - - // No net error code for this lookup transaction, the push is found. - const NetLogEntry* end_entry_1 = FindEndBySource(entries, source_1); - EXPECT_FALSE(end_entry_1->HasParams()); - EXPECT_FALSE(GetOptionalNetErrorCodeFromParams(*end_entry_1)); - - const NetLogSource source_2 = FindPushUrlSource(entries, push_url_2); - EXPECT_TRUE(source_2.IsValid()); - EXPECT_NE(source_1.id, source_2.id); - - // Net error code -400 is found for this lookup transaction, the push is not - // found in the cache. - const NetLogEntry* end_entry_2 = FindEndBySource(entries, source_2); - EXPECT_TRUE(end_entry_2->HasParams()); - EXPECT_EQ(-400, GetNetErrorCodeFromParams(*end_entry_2)); - -#if !defined(OS_FUCHSIA) && !defined(OS_IOS) && !defined(OS_APPLE) - // TODO(crbug.com/813631): Make this work on Fuchsia. - // TODO(crbug.com/1032568): Make this work on iOS. - // TODO(crbug.com/1128459): Turn this on for ARM mac. - - // Wait until the server has processed all errors which is - // happening asynchronously - base::RunLoop().RunUntilIdle(); - // Verify the reset error count received on the server side. - EXPECT_LE(1u, GetRstErrorCountReceivedByServer(quic::QUIC_STREAM_CANCELLED)); -#endif -} - -TEST_P(URLRequestQuicTest, CancelPushIfCached_AllCached) { - if (VersionUsesHttp3(version().transport_version)) { - Init(); - return; - } - - // Skip test if "split cache" is enabled while "partition connections" is - // disabled, as it breaks push. - if (base::FeatureList::IsEnabled( - net::features::kSplitCacheByNetworkIsolationKey) && - !base::FeatureList::IsEnabled( - net::features::kPartitionConnectionsByNetworkIsolationKey)) { - return; - } - - const url::Origin kOrigin1 = - url::Origin::Create(GURL("http://www.example.com")); - const IsolationInfo kTestIsolationInfo = - IsolationInfo::CreateForInternalRequest(kOrigin1); - - Init(); - - // Send a request to the pushed url: /kitten-1.jpg to pull the resource into - // cache. - CheckLoadTimingDelegate delegate_0(false); - std::unique_ptr<URLRequest> request_0 = CreateRequest( - GURL(UrlFromPath(kKittenPath)), DEFAULT_PRIORITY, &delegate_0); - - request_0->set_isolation_info(kTestIsolationInfo); - request_0->Start(); - ASSERT_TRUE(request_0->is_pending()); - - // Spin the message loop until the client receives the response for the first - // request. - delegate_0.RunUntilComplete(); - EXPECT_EQ(OK, delegate_0.request_status()); - - // Send a request to the pushed url: /favicon.ico to pull the resource into - // cache. - CheckLoadTimingDelegate delegate_1(true); - std::unique_ptr<URLRequest> request_1 = CreateRequest( - GURL(UrlFromPath(kFaviconPath)), DEFAULT_PRIORITY, &delegate_1); - - request_1->set_isolation_info(kTestIsolationInfo); - request_1->Start(); - ASSERT_TRUE(request_1->is_pending()); - - // Spin the message loop until the client receives the response for the second - // request. - delegate_1.RunUntilComplete(); - EXPECT_EQ(OK, delegate_1.request_status()); - - // Send a request to /index2.html which pushes /kitten-1.jpg and /favicon.ico. - // Should cancel push for both pushed resources, since they're already cached. - CheckLoadTimingDelegate delegate(true); - std::unique_ptr<URLRequest> request = - CreateRequest(GURL(UrlFromPath(kIndexPath)), DEFAULT_PRIORITY, &delegate); - - request->set_isolation_info(kTestIsolationInfo); - request->Start(); - ASSERT_TRUE(request->is_pending()); - - // Spin the message loop until the client receives the response for the third - // request. - delegate.RunUntilComplete(); - EXPECT_EQ(OK, delegate.request_status()); - // Wait until all QUIC events are process, some of which happen - // asynchronously. - base::RunLoop().RunUntilIdle(); - - // Extract net logs on client side to verify push lookup transactions. - auto entries = net_log_.GetEntriesWithType( - NetLogEventType::SERVER_PUSH_LOOKUP_TRANSACTION); - - ASSERT_EQ(4u, entries.size()); - - std::string value; - std::string push_url_1 = UrlFromPath(kKittenPath); - std::string push_url_2 = UrlFromPath(kFaviconPath); - - const NetLogSource source_1 = FindPushUrlSource(entries, push_url_1); - EXPECT_TRUE(source_1.IsValid()); - - // No net error code for this lookup transaction, the push is found. - const NetLogEntry* end_entry_1 = FindEndBySource(entries, source_1); - EXPECT_FALSE(end_entry_1->HasParams()); - EXPECT_FALSE(GetOptionalNetErrorCodeFromParams(*end_entry_1)); - - const NetLogSource source_2 = FindPushUrlSource(entries, push_url_2); - EXPECT_TRUE(source_1.IsValid()); - EXPECT_NE(source_1.id, source_2.id); - - // No net error code for this lookup transaction, the push is found. - const NetLogEntry* end_entry_2 = FindEndBySource(entries, source_2); - EXPECT_FALSE(end_entry_2->HasParams()); - EXPECT_FALSE(GetOptionalNetErrorCodeFromParams(*end_entry_2)); - -#if !defined(OS_FUCHSIA) && !defined(OS_APPLE) - // TODO(crbug.com/813631): Make this work on Fuchsia. - // TODO(crbug.com/1032568): Make this work on iOS. - // TODO(crbug.com/1087378): Flaky on Mac. - // Verify the reset error count received on the server side. - EXPECT_LE(2u, GetRstErrorCountReceivedByServer(quic::QUIC_STREAM_CANCELLED)); -#endif -} - -TEST_P(URLRequestQuicTest, DoNotCancelPushIfNotFoundInCache) { - if (VersionUsesHttp3(version().transport_version)) { - Init(); - return; - } - - Init(); - - // Send a request to /index2.hmtl which pushes /kitten-1.jpg and /favicon.ico - // and shouldn't cancel any since neither is in cache. - CheckLoadTimingDelegate delegate(false); - std::string url = UrlFromPath(kIndexPath); - std::unique_ptr<URLRequest> request = - CreateRequest(GURL(url), DEFAULT_PRIORITY, &delegate); - - request->Start(); - ASSERT_TRUE(request->is_pending()); - - // Spin the message loop until the client receives response. - delegate.RunUntilComplete(); - EXPECT_EQ(OK, delegate.request_status()); - - // Extract net logs on client side to verify push lookup transactions. - auto entries = net_log_.GetEntriesWithType( - NetLogEventType::SERVER_PUSH_LOOKUP_TRANSACTION); - - ASSERT_EQ(4u, entries.size()); - - std::string value; - std::string push_url_1 = UrlFromPath(kKittenPath); - std::string push_url_2 = UrlFromPath(kFaviconPath); - - const NetLogSource source_1 = FindPushUrlSource(entries, push_url_1); - EXPECT_TRUE(source_1.IsValid()); - const NetLogEntry* end_entry_1 = FindEndBySource(entries, source_1); - EXPECT_TRUE(end_entry_1->HasParams()); - EXPECT_EQ(-400, GetNetErrorCodeFromParams(*end_entry_1)); - - const NetLogSource source_2 = FindPushUrlSource(entries, push_url_2); - EXPECT_TRUE(source_2.IsValid()); - EXPECT_NE(source_1.id, source_2.id); - const NetLogEntry* end_entry_2 = FindEndBySource(entries, source_2); - EXPECT_TRUE(end_entry_2->HasParams()); - EXPECT_EQ(-400, GetNetErrorCodeFromParams(*end_entry_2)); - - // Verify the reset error count received on the server side. - EXPECT_EQ(0u, GetRstErrorCountReceivedByServer(quic::QUIC_STREAM_CANCELLED)); -} - // Tests that if two requests use the same QUIC session, the second request // should not have |LoadTimingInfo::connect_timing|. TEST_P(URLRequestQuicTest, TestTwoRequests) {
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 6a1b4f7..4bd7d18e 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc
@@ -10,6 +10,7 @@ #include "base/callback_helpers.h" #include "base/memory/ptr_util.h" #include "build/build_config.h" +#include "net/dns/public/secure_dns_policy.h" #if defined(OS_WIN) #include <objbase.h> @@ -1360,7 +1361,7 @@ std::unique_ptr<URLRequest> req( context.CreateRequest(GURL("http://example.com"), DEFAULT_PRIORITY, &d, TRAFFIC_ANNOTATION_FOR_TESTS)); - req->SetDisableSecureDns(true); + req->SetSecureDnsPolicy(SecureDnsPolicy::kDisable); req->Start(); d.RunUntilComplete(); @@ -10347,7 +10348,7 @@ // URLRequestInterceptor implementation: std::unique_ptr<net::URLRequestJob> MaybeInterceptRequest( net::URLRequest* request) const override { - EXPECT_TRUE(request->disable_secure_dns()); + EXPECT_EQ(SecureDnsPolicy::kDisable, request->secure_dns_policy()); return nullptr; } };
diff --git a/net/websockets/websocket_basic_stream_adapters_test.cc b/net/websockets/websocket_basic_stream_adapters_test.cc index 2c6a12a..9c13feb 100644 --- a/net/websockets/websocket_basic_stream_adapters_test.cc +++ b/net/websockets/websocket_basic_stream_adapters_test.cc
@@ -19,6 +19,7 @@ #include "net/base/proxy_server.h" #include "net/base/test_completion_callback.h" #include "net/dns/mock_host_resolver.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_network_session.h" #include "net/log/net_log_with_source.h" #include "net/socket/client_socket_handle.h" @@ -71,7 +72,7 @@ ClientSocketPool::GroupId( host_port_pair_, ClientSocketPool::SocketType::kSsl, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), socks_params, TRAFFIC_ANNOTATION_FOR_TESTS /* proxy_annotation_tag */, MEDIUM, SocketTag(), ClientSocketPool::RespectLimits::ENABLED, callback.callback(), ClientSocketPool::ProxyAuthCallback(), @@ -288,7 +289,7 @@ SpdySessionKey::IsProxySession::kFalse, SocketTag(), NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), session_(SpdySessionDependencies::SpdyCreateSession(&session_deps_)), ssl_(SYNCHRONOUS, OK) {}
diff --git a/net/websockets/websocket_basic_stream_test.cc b/net/websockets/websocket_basic_stream_test.cc index 335c786..f9f79e6 100644 --- a/net/websockets/websocket_basic_stream_test.cc +++ b/net/websockets/websocket_basic_stream_test.cc
@@ -20,6 +20,7 @@ #include "net/base/io_buffer.h" #include "net/base/privacy_mode.h" #include "net/base/test_completion_callback.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/log/test_net_log.h" #include "net/socket/connect_job.h" #include "net/socket/socket_tag.h" @@ -146,7 +147,7 @@ ClientSocketPool::GroupId group_id( HostPortPair("a", 80), ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */); + SecureDnsPolicy::kAllow); transport_socket->Init( group_id, null_params, base::nullopt /* proxy_annotation_tag */, MEDIUM, SocketTag(), ClientSocketPool::RespectLimits::ENABLED,
diff --git a/net/websockets/websocket_handshake_stream_create_helper_test.cc b/net/websockets/websocket_handshake_stream_create_helper_test.cc index 2450d886..8eba4ca 100644 --- a/net/websockets/websocket_handshake_stream_create_helper_test.cc +++ b/net/websockets/websocket_handshake_stream_create_helper_test.cc
@@ -18,6 +18,7 @@ #include "net/base/net_errors.h" #include "net/base/privacy_mode.h" #include "net/base/proxy_server.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_network_session.h" #include "net/http/http_request_headers.h" #include "net/http/http_request_info.h" @@ -93,7 +94,7 @@ ClientSocketPool::GroupId( HostPortPair("a", 80), ClientSocketPool::SocketType::kHttp, PrivacyMode::PRIVACY_MODE_DISABLED, NetworkIsolationKey(), - false /* disable_secure_dns */), + SecureDnsPolicy::kAllow), scoped_refptr<ClientSocketPool::SocketParams>(), base::nullopt /* proxy_annotation_tag */, MEDIUM, SocketTag(), ClientSocketPool::RespectLimits::ENABLED, CompletionOnceCallback(), @@ -264,7 +265,7 @@ const SpdySessionKey key( HostPortPair::FromURL(url), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, SpdySessionKey::IsProxySession::kFalse, - SocketTag(), NetworkIsolationKey(), false /* disable_secure_dns */); + SocketTag(), NetworkIsolationKey(), SecureDnsPolicy::kAllow); base::WeakPtr<SpdySession> spdy_session = CreateSpdySession(http_network_session.get(), key, net_log); std::unique_ptr<WebSocketHandshakeStreamBase> handshake =
diff --git a/pdf/BUILD.gn b/pdf/BUILD.gn index 11df0f2..b6da8fb 100644 --- a/pdf/BUILD.gn +++ b/pdf/BUILD.gn
@@ -401,10 +401,7 @@ "ui/thumbnail_unittest.cc", ] - configs += [ - ":common", - "//v8:external_startup_data", - ] + configs += [ ":common" ] data = [ "test/data/" ] @@ -424,6 +421,8 @@ "//cc:test_support", "//components/strings", "//gin", + "//mojo/core/embedder", + "//mojo/public/cpp/bindings", "//ppapi/c", "//ppapi/cpp:objects", "//printing", @@ -431,6 +430,7 @@ "//testing/gmock", "//testing/gtest", "//third_party/blink/public:blink", + "//third_party/blink/public:test_support", "//third_party/blink/public/common:headers", "//third_party/pdfium", "//ui/base:test_support", @@ -440,7 +440,11 @@ ] if (v8_use_external_startup_data) { - data += [ "$root_out_dir/snapshot_blob.bin" ] + deps += [ "//tools/v8_context_snapshot" ] + configs += [ + "//tools/v8_context_snapshot:use_v8_context_snapshot", + "//v8:external_startup_data", + ] } }
diff --git a/pdf/DEPS b/pdf/DEPS index 16cde85e..03c93c3 100644 --- a/pdf/DEPS +++ b/pdf/DEPS
@@ -2,6 +2,8 @@ "+cc/paint", "+content/public/renderer/v8_value_converter.h", "+gin", + "+mojo/core/embedder", + "+mojo/public/cpp/bindings", "+net", "+ppapi", "+printing",
diff --git a/pdf/pdfium/pdfium_engine_exports_unittest.cc b/pdf/pdfium/pdfium_engine_exports_unittest.cc index 189504a..1473b3a 100644 --- a/pdf/pdfium/pdfium_engine_exports_unittest.cc +++ b/pdf/pdfium/pdfium_engine_exports_unittest.cc
@@ -5,9 +5,6 @@ #include "base/files/file_util.h" #include "base/optional.h" #include "base/path_service.h" -#include "base/test/test_simple_task_runner.h" -#include "base/threading/thread_task_runner_handle.h" -#include "gin/v8_initializer.h" #include "pdf/pdf.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/geometry/rect.h" @@ -18,16 +15,6 @@ namespace { -void LoadV8SnapshotData() { -#if defined(V8_USE_EXTERNAL_STARTUP_DATA) - static bool loaded = false; - if (!loaded) { - loaded = true; - gin::V8Initializer::LoadV8Snapshot(); - } -#endif -} - class PDFiumEngineExportsTest : public testing::Test { public: PDFiumEngineExportsTest() = default; @@ -37,11 +24,6 @@ protected: void SetUp() override { - LoadV8SnapshotData(); - - handle_ = std::make_unique<base::ThreadTaskRunnerHandle>( - base::MakeRefCounted<base::TestSimpleTaskRunner>()); - CHECK(base::PathService::Get(base::DIR_SOURCE_ROOT, &pdf_data_dir_)); pdf_data_dir_ = pdf_data_dir_.Append(FILE_PATH_LITERAL("pdf")) .Append(FILE_PATH_LITERAL("test")) @@ -51,7 +33,6 @@ const base::FilePath& pdf_data_dir() const { return pdf_data_dir_; } private: - std::unique_ptr<base::ThreadTaskRunnerHandle> handle_; base::FilePath pdf_data_dir_; };
diff --git a/pdf/pdfium/pdfium_engine_unittest.cc b/pdf/pdfium/pdfium_engine_unittest.cc index 02bef52..6089a0d8 100644 --- a/pdf/pdfium/pdfium_engine_unittest.cc +++ b/pdf/pdfium/pdfium_engine_unittest.cc
@@ -11,7 +11,6 @@ #include "base/test/gtest_util.h" #include "base/test/mock_callback.h" #include "base/test/scoped_feature_list.h" -#include "base/test/task_environment.h" #include "base/time/time.h" #include "pdf/document_attachment_info.h" #include "pdf/document_layout.h" @@ -587,10 +586,6 @@ void ScrollFocusedAnnotationIntoView(PDFiumEngine* engine) { engine->ScrollFocusedAnnotationIntoView(); } - - protected: - base::test::TaskEnvironment task_environment_{ - base::test::TaskEnvironment::TimeSource::MOCK_TIME}; }; TEST_F(PDFiumEngineTabbingTest, LinkUnderCursorTest) {
diff --git a/pdf/ppapi_migration/graphics_unittest.cc b/pdf/ppapi_migration/graphics_unittest.cc index 11029f85..5e096bd 100644 --- a/pdf/ppapi_migration/graphics_unittest.cc +++ b/pdf/ppapi_migration/graphics_unittest.cc
@@ -7,7 +7,6 @@ #include <utility> #include "base/callback_helpers.h" -#include "base/test/task_environment.h" #include "cc/test/pixel_comparator.h" #include "cc/test/pixel_test_utils.h" #include "pdf/ppapi_migration/bitmap.h" @@ -102,9 +101,6 @@ FakeSkiaGraphicsClient client_; std::unique_ptr<Graphics> graphics_; - - private: - base::test::TaskEnvironment task_environment_; }; class SkiaGraphicsScrollTest : public SkiaGraphicsTest {
diff --git a/pdf/test/run_all_unittests.cc b/pdf/test/run_all_unittests.cc index 41b432e..74197f4f 100644 --- a/pdf/test/run_all_unittests.cc +++ b/pdf/test/run_all_unittests.cc
@@ -2,14 +2,53 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <memory> + #include "base/bind.h" #include "base/callback.h" #include "base/test/launcher/unit_test_launcher.h" +#include "base/test/task_environment.h" #include "base/test/test_suite.h" +#include "mojo/core/embedder/embedder.h" +#include "mojo/public/cpp/bindings/binder_map.h" #include "third_party/blink/public/platform/platform.h" +#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h" +#include "third_party/blink/public/platform/scheduler/web_thread_scheduler.h" +#include "third_party/blink/public/web/blink.h" +#include "v8/include/v8.h" + +#if defined(V8_USE_EXTERNAL_STARTUP_DATA) +#include "gin/v8_initializer.h" +#endif namespace { +#if defined(V8_USE_EXTERNAL_STARTUP_DATA) +constexpr gin::V8Initializer::V8SnapshotFileType kSnapshotType = +#if defined(USE_V8_CONTEXT_SNAPSHOT) + gin::V8Initializer::V8SnapshotFileType::kWithAdditionalContext; +#else + gin::V8Initializer::V8SnapshotFileType::kDefault; +#endif // defined(USE_V8_CONTEXT_SNAPSHOT) +#endif // defined(V8_USE_EXTERNAL_STARTUP_DATA) + +class BlinkPlatformForTesting : public blink::Platform { + public: + BlinkPlatformForTesting() = default; + BlinkPlatformForTesting(const BlinkPlatformForTesting&) = delete; + BlinkPlatformForTesting& operator=(const BlinkPlatformForTesting&) = delete; + ~BlinkPlatformForTesting() override { main_thread_scheduler_->Shutdown(); } + + blink::scheduler::WebThreadScheduler* GetMainThreadScheduler() { + return main_thread_scheduler_.get(); + } + + private: + base::test::TaskEnvironment task_environment_; + std::unique_ptr<blink::scheduler::WebThreadScheduler> main_thread_scheduler_ = + blink::scheduler::CreateWebMainThreadSchedulerForTests(); +}; + class PdfTestSuite final : public base::TestSuite { public: using TestSuite::TestSuite; @@ -19,8 +58,28 @@ protected: void Initialize() override { TestSuite::Initialize(); + + mojo::core::Init(); + +#if defined(V8_USE_EXTERNAL_STARTUP_DATA) + gin::V8Initializer::LoadV8Snapshot(kSnapshotType); +#endif + blink::Platform::InitializeBlink(); + platform_ = std::make_unique<BlinkPlatformForTesting>(); + + mojo::BinderMap binders; + blink::Initialize(platform_.get(), &binders, + platform_->GetMainThreadScheduler()); } + + void Shutdown() override { + platform_.reset(); + base::TestSuite::Shutdown(); + } + + private: + std::unique_ptr<BlinkPlatformForTesting> platform_; }; } // namespace
diff --git a/printing/BUILD.gn b/printing/BUILD.gn index 5b7ecdf..d5626f9 100644 --- a/printing/BUILD.gn +++ b/printing/BUILD.gn
@@ -19,7 +19,9 @@ import("//printing/backend/tools/code_generator.gni") } -if ((enable_basic_printing && is_win) || enable_print_preview) { +assert(enable_basic_printing) + +if (is_win || enable_print_preview) { # Windows basic printing or print preview requires pdf enabled. assert(enable_pdf, "Windows basic printing or print preview needs pdf: " +
diff --git a/sandbox/policy/BUILD.gn b/sandbox/policy/BUILD.gn index efa5b741..a24636cb 100644 --- a/sandbox/policy/BUILD.gn +++ b/sandbox/policy/BUILD.gn
@@ -7,6 +7,7 @@ import("//build/config/chromeos/ui_mode.gni") import("//build/config/sanitizers/sanitizers.gni") import("//chromeos/assistant/assistant.gni") +import("//printing/buildflags/buildflags.gni") import("//testing/test.gni") component("policy") { @@ -27,6 +28,7 @@ ":sanitizer_buildflags", "//base", "//build:chromeos_buildflags", + "//printing/buildflags", "//sandbox:common", ] public_deps = [] @@ -169,6 +171,7 @@ ":policy", "//base", "//base/test:test_support", + "//printing/buildflags", "//testing/gtest", ]
diff --git a/sandbox/policy/DEPS b/sandbox/policy/DEPS index 5d3d420..7e27dfd 100644 --- a/sandbox/policy/DEPS +++ b/sandbox/policy/DEPS
@@ -1,5 +1,6 @@ include_rules = [ "+chromeos/assistant/buildflags.h", + "+printing/buildflags", "+sandbox/constants.h", "+sandbox", ]
diff --git a/sandbox/policy/fuchsia/sandbox_policy_fuchsia.cc b/sandbox/policy/fuchsia/sandbox_policy_fuchsia.cc index ff95dd5..18e4a20 100644 --- a/sandbox/policy/fuchsia/sandbox_policy_fuchsia.cc +++ b/sandbox/policy/fuchsia/sandbox_policy_fuchsia.cc
@@ -122,7 +122,6 @@ case SandboxType::kAudio: case SandboxType::kCdm: case SandboxType::kPpapi: - case SandboxType::kPrintBackend: case SandboxType::kPrintCompositor: case SandboxType::kSharingService: case SandboxType::kSpeechRecognition:
diff --git a/sandbox/policy/linux/sandbox_seccomp_bpf_linux.cc b/sandbox/policy/linux/sandbox_seccomp_bpf_linux.cc index d0f6d73..7bdbab95 100644 --- a/sandbox/policy/linux/sandbox_seccomp_bpf_linux.cc +++ b/sandbox/policy/linux/sandbox_seccomp_bpf_linux.cc
@@ -19,6 +19,7 @@ #include "base/notreached.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" +#include "printing/buildflags/buildflags.h" #include "sandbox/linux/bpf_dsl/bpf_dsl.h" #include "sandbox/linux/bpf_dsl/trap_registry.h" #include "sandbox/policy/sandbox_type.h" @@ -181,8 +182,10 @@ return std::make_unique<CdmProcessPolicy>(); case SandboxType::kPrintCompositor: return std::make_unique<PrintCompositorProcessPolicy>(); +#if BUILDFLAG(ENABLE_PRINTING) case SandboxType::kPrintBackend: return std::make_unique<PrintBackendProcessPolicy>(); +#endif case SandboxType::kNetwork: return std::make_unique<NetworkProcessPolicy>(); case SandboxType::kAudio: @@ -252,7 +255,9 @@ case SandboxType::kSharingService: case SandboxType::kSpeechRecognition: case SandboxType::kNetwork: +#if BUILDFLAG(ENABLE_PRINTING) case SandboxType::kPrintBackend: +#endif case SandboxType::kUtility: case SandboxType::kNoSandbox: case SandboxType::kVideoCapture:
diff --git a/sandbox/policy/sandbox_type.cc b/sandbox/policy/sandbox_type.cc index 31c130c..ba5ad56 100644 --- a/sandbox/policy/sandbox_type.cc +++ b/sandbox/policy/sandbox_type.cc
@@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/notreached.h" #include "build/chromeos_buildflags.h" +#include "printing/buildflags/buildflags.h" #include "sandbox/policy/features.h" #include "sandbox/policy/switches.h" @@ -47,7 +48,9 @@ case SandboxType::kGpu: case SandboxType::kPpapi: case SandboxType::kCdm: +#if BUILDFLAG(ENABLE_PRINTING) case SandboxType::kPrintBackend: +#endif case SandboxType::kPrintCompositor: #if defined(OS_MAC) case SandboxType::kNaClLoader: @@ -110,7 +113,9 @@ case SandboxType::kUtility: case SandboxType::kNetwork: case SandboxType::kCdm: +#if BUILDFLAG(ENABLE_PRINTING) case SandboxType::kPrintBackend: +#endif case SandboxType::kPrintCompositor: case SandboxType::kAudio: case SandboxType::kVideoCapture: @@ -223,8 +228,10 @@ return switches::kPpapiSandbox; case SandboxType::kCdm: return switches::kCdmSandbox; +#if BUILDFLAG(ENABLE_PRINTING) case SandboxType::kPrintBackend: return switches::kPrintBackendSandbox; +#endif case SandboxType::kPrintCompositor: return switches::kPrintCompositorSandbox; case SandboxType::kUtility: @@ -294,8 +301,10 @@ return SandboxType::kPpapi; if (sandbox_string == switches::kCdmSandbox) return SandboxType::kCdm; +#if BUILDFLAG(ENABLE_PRINTING) if (sandbox_string == switches::kPrintBackendSandbox) return SandboxType::kPrintBackend; +#endif if (sandbox_string == switches::kPrintCompositorSandbox) return SandboxType::kPrintCompositor; #if defined(OS_WIN)
diff --git a/sandbox/policy/sandbox_type.h b/sandbox/policy/sandbox_type.h index e3dc0ba..f755d326 100644 --- a/sandbox/policy/sandbox_type.h +++ b/sandbox/policy/sandbox_type.h
@@ -10,6 +10,7 @@ #include "base/command_line.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" +#include "printing/buildflags/buildflags.h" #include "sandbox/policy/export.h" #if BUILDFLAG(IS_CHROMEOS_ASH) @@ -67,9 +68,11 @@ kNaClLoader, #endif // defined(OS_MAC) +#if BUILDFLAG(ENABLE_PRINTING) // The print backend service process which interfaces with operating system // print drivers. kPrintBackend, +#endif // The print compositor service process. kPrintCompositor,
diff --git a/sandbox/policy/sandbox_type_unittest.cc b/sandbox/policy/sandbox_type_unittest.cc index 2edf01d..e909a684 100644 --- a/sandbox/policy/sandbox_type_unittest.cc +++ b/sandbox/policy/sandbox_type_unittest.cc
@@ -6,6 +6,7 @@ #include "base/command_line.h" #include "build/build_config.h" +#include "printing/buildflags/buildflags.h" #include "sandbox/policy/switches.h" #include "testing/gtest/include/gtest/gtest.h" @@ -111,11 +112,13 @@ SandboxTypeFromCommandLine(command_line12)); #endif +#if BUILDFLAG(ENABLE_PRINTING) base::CommandLine command_line13(command_line); SetCommandLineFlagsForSandboxType(&command_line13, SandboxType::kPrintBackend); EXPECT_EQ(SandboxType::kPrintBackend, SandboxTypeFromCommandLine(command_line13)); +#endif base::CommandLine command_line14(command_line); command_line14.AppendSwitchASCII(switches::kServiceSandboxType,
diff --git a/sandbox/policy/switches.cc b/sandbox/policy/switches.cc index 5b18559..5f4af18 100644 --- a/sandbox/policy/switches.cc +++ b/sandbox/policy/switches.cc
@@ -6,6 +6,7 @@ #include "build/build_config.h" #include "build/chromeos_buildflags.h" +#include "printing/buildflags/buildflags.h" #if defined(OS_WIN) #include "base/command_line.h" @@ -28,7 +29,9 @@ const char kPpapiSandbox[] = "ppapi"; const char kUtilitySandbox[] = "utility"; const char kCdmSandbox[] = "cdm"; +#if BUILDFLAG(ENABLE_PRINTING) const char kPrintBackendSandbox[] = "print_backend"; +#endif const char kPrintCompositorSandbox[] = "print_compositor"; const char kAudioSandbox[] = "audio"; const char kSharingServiceSandbox[] = "sharing_service";
diff --git a/sandbox/policy/switches.h b/sandbox/policy/switches.h index def8f5d..543816c 100644 --- a/sandbox/policy/switches.h +++ b/sandbox/policy/switches.h
@@ -7,6 +7,7 @@ #include "build/build_config.h" #include "build/chromeos_buildflags.h" +#include "printing/buildflags/buildflags.h" #include "sandbox/policy/export.h" #if BUILDFLAG(IS_CHROMEOS_ASH) @@ -29,7 +30,9 @@ SANDBOX_POLICY_EXPORT extern const char kPpapiSandbox[]; SANDBOX_POLICY_EXPORT extern const char kUtilitySandbox[]; SANDBOX_POLICY_EXPORT extern const char kCdmSandbox[]; +#if BUILDFLAG(ENABLE_PRINTING) SANDBOX_POLICY_EXPORT extern const char kPrintBackendSandbox[]; +#endif SANDBOX_POLICY_EXPORT extern const char kPrintCompositorSandbox[]; SANDBOX_POLICY_EXPORT extern const char kAudioSandbox[]; SANDBOX_POLICY_EXPORT extern const char kSharingServiceSandbox[];
diff --git a/sandbox/policy/win/sandbox_win.cc b/sandbox/policy/win/sandbox_win.cc index 88e747bb..e15afef 100644 --- a/sandbox/policy/win/sandbox_win.cc +++ b/sandbox/policy/win/sandbox_win.cc
@@ -38,6 +38,7 @@ #include "base/win/scoped_handle.h" #include "base/win/win_util.h" #include "base/win/windows_version.h" +#include "printing/buildflags/buildflags.h" #include "sandbox/policy/features.h" #include "sandbox/policy/sandbox_type.h" #include "sandbox/policy/switches.h" @@ -1212,8 +1213,10 @@ return "CDM"; case SandboxType::kPrintCompositor: return "Print Compositor"; +#if BUILDFLAG(ENABLE_PRINTING) case SandboxType::kPrintBackend: return "Print Backend"; +#endif case SandboxType::kAudio: return "Audio"; case SandboxType::kSpeechRecognition:
diff --git a/services/cert_verifier/cert_net_url_loader/cert_net_fetcher_url_loader_unittest.cc b/services/cert_verifier/cert_net_url_loader/cert_net_fetcher_url_loader_unittest.cc index 4bc28892..1828d45 100644 --- a/services/cert_verifier/cert_net_url_loader/cert_net_fetcher_url_loader_unittest.cc +++ b/services/cert_verifier/cert_net_url_loader/cert_net_fetcher_url_loader_unittest.cc
@@ -19,6 +19,7 @@ #include "net/cert/mock_cert_verifier.h" #include "net/cert/multi_log_ct_verifier.h" #include "net/dns/mock_host_resolver.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_server_properties.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/gtest_util.h" @@ -229,7 +230,7 @@ // URLRequestInterceptor implementation: std::unique_ptr<net::URLRequestJob> MaybeInterceptRequest( net::URLRequest* request) const override { - EXPECT_TRUE(request->disable_secure_dns()); + EXPECT_EQ(net::SecureDnsPolicy::kDisable, request->secure_dns_policy()); *invoked_interceptor_ = true; return nullptr; }
diff --git a/services/network/network_context_unittest.cc b/services/network/network_context_unittest.cc index 13c0e817..02bd24d 100644 --- a/services/network/network_context_unittest.cc +++ b/services/network/network_context_unittest.cc
@@ -81,6 +81,7 @@ #include "net/dns/mock_host_resolver.h" #include "net/dns/public/dns_query_type.h" #include "net/dns/public/secure_dns_mode.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/dns/resolve_context.h" #include "net/http/http_auth.h" #include "net/http/http_cache.h" @@ -4347,13 +4348,13 @@ net::ClientSocketPool::GroupId group_id1( test_server.host_port_pair(), net::ClientSocketPool::SocketType::kHttp, net::PrivacyMode::PRIVACY_MODE_ENABLED, kKey1, - false /* disable_secure_dns */); + net::SecureDnsPolicy::kAllow); EXPECT_EQ( 1, GetSocketCountForGroup(network_context.get(), group_id1.ToString())); net::ClientSocketPool::GroupId group_id2( test_server.host_port_pair(), net::ClientSocketPool::SocketType::kHttp, net::PrivacyMode::PRIVACY_MODE_ENABLED, kKey2, - false /* disable_secure_dns */); + net::SecureDnsPolicy::kAllow); EXPECT_EQ( 2, GetSocketCountForGroup(network_context.get(), group_id2.ToString())); }
diff --git a/services/network/proxy_resolving_client_socket.cc b/services/network/proxy_resolving_client_socket.cc index 8a02cc3..b14176b 100644 --- a/services/network/proxy_resolving_client_socket.cc +++ b/services/network/proxy_resolving_client_socket.cc
@@ -20,6 +20,7 @@ #include "net/base/net_errors.h" #include "net/base/network_isolation_key.h" #include "net/base/privacy_mode.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_auth_controller.h" #include "net/http/http_network_session.h" #include "net/http/http_request_headers.h" @@ -302,7 +303,7 @@ proxy_annotation_tag, &ssl_config, &ssl_config, true /* force_tunnel */, net::PRIVACY_MODE_DISABLED, net::OnHostResolutionCallback(), net::MAXIMUM_PRIORITY, net::SocketTag(), network_isolation_key_, - false /* disable_secure_dns */, common_connect_job_params_, this); + net::SecureDnsPolicy::kAllow, common_connect_job_params_, this); return connect_job_->Connect(); }
diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc index dfd830c6..45f952a2 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc
@@ -41,6 +41,7 @@ #include "net/cookies/cookie_inclusion_status.h" #include "net/cookies/site_for_cookies.h" #include "net/cookies/static_cookie_policy.h" +#include "net/dns/public/secure_dns_policy.h" #include "net/http/http_request_headers.h" #include "net/ssl/client_cert_store.h" #include "net/ssl/ssl_connection_status_flags.h" @@ -624,11 +625,9 @@ if (ShouldForceIgnoreTopFramePartyForCookies()) url_request_->set_force_ignore_top_frame_party_for_cookies(true); - if (factory_params_->disable_secure_dns) { - url_request_->SetDisableSecureDns(true); - } else if (request.trusted_params) { - url_request_->SetDisableSecureDns( - request.trusted_params->disable_secure_dns); + if (factory_params_->disable_secure_dns || + (request.trusted_params && request.trusted_params->disable_secure_dns)) { + url_request_->SetSecureDnsPolicy(net::SecureDnsPolicy::kDisable); } // |cors_excempt_headers| must be merged here to avoid breaking CORS checks.
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index c9f788f..338a566 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -3528,6 +3528,21 @@ ] } ], + "IOSDiscoverNoticeCardAutoDismiss": [ + { + "platforms": [ + "ios" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "InterestFeedNoticeCardAutoDismiss" + ] + } + ] + } + ], "IOSErrorPageRefactoring": [ { "platforms": [ @@ -3795,6 +3810,7 @@ "enable_features": [ "FederatedLearningOfCohorts", "FlocIdSortingLshBasedComputation", + "FlocPagesWithAdResourcesDefaultIncludedInFlocComputation", "InterestCohortAPIOriginTrial", "InterestCohortFeaturePolicy" ]
diff --git a/third_party/blink/public/mojom/web_feature/web_feature.mojom b/third_party/blink/public/mojom/web_feature/web_feature.mojom index e2eb5e0..132c3e3 100644 --- a/third_party/blink/public/mojom/web_feature/web_feature.mojom +++ b/third_party/blink/public/mojom/web_feature/web_feature.mojom
@@ -3199,6 +3199,7 @@ kWebAppManifestProtocolHandlers = 3884, kRTCPeerConnectionOfferAllowExtmapMixedFalse = 3885, kNewCanvas2DAPI = 3886, + kServiceWorkerSubresourceFilter = 3887, // Add new features immediately above this line. Don't change assigned // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_context.cc b/third_party/blink/renderer/core/display_lock/display_lock_context.cc index 13a1be147..4e49698 100644 --- a/third_party/blink/renderer/core/display_lock/display_lock_context.cc +++ b/third_party/blink/renderer/core/display_lock/display_lock_context.cc
@@ -793,8 +793,16 @@ auto* compositing_parent = layout_box->Layer()->EnclosingLayerWithCompositedLayerMapping( kIncludeSelf); - compositing_parent->GetCompositedLayerMapping() - ->SetNeedsGraphicsLayerUpdate(kGraphicsLayerUpdateSubtree); + if (compositing_parent) { + compositing_parent->GetCompositedLayerMapping() + ->SetNeedsGraphicsLayerUpdate(kGraphicsLayerUpdateSubtree); + } else { + // If we don't have a compositing layer mapping ancestor in this frame, + // then mark this layer as needing a graphics layer rebuild, since what + // we want is to clear any dangling trees in this subtree or composite + // the frame again if something in the subtree still needs compositing. + layout_box->Layer()->SetNeedsGraphicsLayerRebuild(); + } } forced_graphics_layer_update_blocked_ = false;
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_context_test.cc b/third_party/blink/renderer/core/display_lock/display_lock_context_test.cc index 7d118f06..b85e1d23 100644 --- a/third_party/blink/renderer/core/display_lock/display_lock_context_test.cc +++ b/third_party/blink/renderer/core/display_lock/display_lock_context_test.cc
@@ -3311,6 +3311,34 @@ EXPECT_TRUE(context->HadAnyViewportIntersectionNotifications()); } +TEST_F(DisplayLockContextRenderingTest, LocalFrameGraphicsUpdateForced) { + SetHtmlInnerHTML(R"HTML( + <iframe id="frame"></iframe> + )HTML"); + SetChildFrameHTML(R"HTML( + <style> + .cv { content-visibility: hidden; } + div { + width: 100px; + height: 100px; + } + </style> + <div id=target class=cv></target> + )HTML"); + + UpdateAllLifecyclePhasesForTest(); + + auto* target = ChildDocument().getElementById("target"); + ASSERT_TRUE(target); + ASSERT_TRUE(target->GetDisplayLockContext()); + + target->GetDisplayLockContext()->NotifyForcedGraphicsLayerUpdateBlocked(); + target->classList().Remove("cv"); + + // This should not crash. + UpdateAllLifecyclePhasesForTest(); +} + class DisplayLockContextLegacyRenderingTest : public RenderingTest, private ScopedCSSContentVisibilityHiddenMatchableForTest,
diff --git a/third_party/blink/renderer/core/layout/ng/ng_length_utils.cc b/third_party/blink/renderer/core/layout/ng/ng_length_utils.cc index aaa41167..648d8ace 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_length_utils.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_length_utils.cc
@@ -864,6 +864,27 @@ const base::Optional<LogicalSize> natural_size = ComputeNormalizedNaturalSize( node, border_padding, box_sizing, aspect_ratio); + auto StretchFit = [&]() -> LayoutUnit { + // Only stretch to the available-size if it is definite. + LayoutUnit size = + (space.AvailableSize().inline_size == kIndefiniteSize) + ? border_padding.InlineSum() + : ResolveMainInlineLength<base::Optional<MinMaxSizes>>( + space, style, border_padding, base::nullopt, + Length::FillAvailable(), available_inline_size_adjustment); + + // If stretch-fit applies we must have an aspect-ratio. + DCHECK(!aspect_ratio.IsEmpty()); + + // Apply the transferred min/max sizes. + const MinMaxSizes transferred_min_max_sizes = + ComputeTransferredMinMaxInlineSizes(aspect_ratio, block_min_max_sizes, + border_padding, box_sizing); + size = transferred_min_max_sizes.ClampSizeToMinAndMax(size); + + return size; + }; + auto MinMaxSizesFunc = [&](MinMaxSizesType type) -> MinMaxSizesResult { LayoutUnit size; if (aspect_ratio.IsEmpty()) { @@ -875,13 +896,8 @@ } else if (natural_size) { size = natural_size->inline_size; } else { - // We don't have a natural size - default to stretch if our available - // size is definite. - size = (space.AvailableSize().inline_size == kIndefiniteSize) - ? border_padding.InlineSum() - : ResolveMainInlineLength<base::Optional<MinMaxSizes>>( - space, style, border_padding, base::nullopt, - Length::FillAvailable()); + // We don't have a natural size - default to stretching. + size = StretchFit(); } // |depends_on_block_constraints| doesn't matter in this context. @@ -923,15 +939,10 @@ if (replaced_inline && replaced_block) return LogicalSize(*replaced_inline, *replaced_block); - // We have *only* an aspect-ratio with no sizes (natural or otherwise), here - // we default to stretching to the available-size if available. + // We have *only* an aspect-ratio with no sizes (natural or otherwise), we + // default to stretching. if (!natural_size && !replaced_inline && !replaced_block) { - replaced_inline = - (space.AvailableSize().inline_size == kIndefiniteSize) - ? border_padding.InlineSum() - : ResolveMainInlineLength(space, style, border_padding, - MinMaxSizesFunc, Length::FillAvailable(), - available_inline_size_adjustment); + replaced_inline = StretchFit(); replaced_inline = inline_min_max_sizes.ClampSizeToMinAndMax(*replaced_inline); }
diff --git a/third_party/blink/renderer/core/paint/paint_layer.cc b/third_party/blink/renderer/core/paint/paint_layer.cc index b4fcf08..96115d8 100644 --- a/third_party/blink/renderer/core/paint/paint_layer.cc +++ b/third_party/blink/renderer/core/paint/paint_layer.cc
@@ -1274,10 +1274,6 @@ ancestor_dependent_compositing_inputs_->clip_parent = clip_parent; ancestor_dependent_compositing_inputs_->nearest_contained_layout_layer = nearest_contained_layout_layer; - ancestor_dependent_compositing_inputs_->clipped_absolute_bounding_box = - IntRect(); - ancestor_dependent_compositing_inputs_->unclipped_absolute_bounding_box = - IntRect(); ancestor_dependent_compositing_inputs_->clipping_container = clipping_container; needs_ancestor_dependent_compositing_inputs_update_ = false;
diff --git a/third_party/blink/renderer/core/paint/paint_layer.h b/third_party/blink/renderer/core/paint/paint_layer.h index 41373933..083918c 100644 --- a/third_party/blink/renderer/core/paint/paint_layer.h +++ b/third_party/blink/renderer/core/paint/paint_layer.h
@@ -808,18 +808,6 @@ // better isolation. Member<const PaintLayer> nearest_contained_layout_layer = nullptr; - // These two boxes do not include any applicable scroll offset of the - // root PaintLayer. Note that 'absolute' here is potentially misleading as - // the actual coordinate system depends on if this layer is affected by the - // viewport's scroll offset or not. For content that is not affected by the - // viewport scroll offsets, this ends up being a rect in viewport coords. - // For content that is affected by the viewport's scroll offset this - // coordinate system is in absolute coords. - // Note: This stores LocalBoundingBoxForCompositingOverlapTest and not the - // expanded bounds (ExpandedBoundingBoxForCompositingOverlapTest). - IntRect clipped_absolute_bounding_box; - IntRect unclipped_absolute_bounding_box; - Member<const LayoutBoxModelObject> clipping_container; };
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object.cc b/third_party/blink/renderer/modules/accessibility/ax_object.cc index ef4c724..2b1acd29 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object.cc
@@ -702,32 +702,34 @@ } } - while (true) { - current_node = GetParentNodeForComputeParent(current_node); - if (!current_node) - break; - // When AXMenuList is being used, a menu list is only allowed to parent an - // AXMenuListPopup, which is added as a child on creation. No other - // children are allowed, and null is returned for anything else where the - // parent would be AXMenuList. - if (AXObjectCacheImpl::UseAXMenuList()) { - if (auto* select = DynamicTo<HTMLSelectElement>(current_node)) { - if (select->UsesMenuList()) - return nullptr; - } - } - if (!CanComputeAsParent(current_node)) - return nullptr; + current_node = GetParentNodeForComputeParent(current_node); + DCHECK(current_node); - AXObject* ax_parent = cache.GetOrCreate(current_node); - if (ax_parent) { - DCHECK(!ax_parent->IsDetached()); - return ax_parent->CanHaveChildren() ? ax_parent : nullptr; + // When AXMenuList is being used, a menu list is only allowed to parent an + // AXMenuListPopup, which is added as a child on creation. No other + // children are allowed, and null is returned for anything else where the + // parent would be AXMenuList. + if (AXObjectCacheImpl::UseAXMenuList()) { + if (auto* select = DynamicTo<HTMLSelectElement>(current_node)) { + if (select->UsesMenuList()) + return nullptr; } } - NOTREACHED() << "No parent found."; + if (!CanComputeAsParent(current_node)) + return nullptr; + if (AXObject* ax_parent = cache.GetOrCreate(current_node)) { + DCHECK(!ax_parent->IsDetached()); + // If the parent can't have children, then return null so that the caller + // knows that it is not a relevant natural parent, as it is a leaf. + return ax_parent->CanHaveChildren() ? ax_parent : nullptr; + } + + // Could not create AXObject for this the parent node, therefore there is no + // relevant natural parent. For example, the AXObject that would have been + // created would have been a descendant of a leaf, or otherwise an illegal + // child of a specialized object. return nullptr; }
diff --git a/third_party/blink/renderer/modules/storage/storage_controller.cc b/third_party/blink/renderer/modules/storage/storage_controller.cc index 5c5c9209..1053016 100644 --- a/third_party/blink/renderer/modules/storage/storage_controller.cc +++ b/third_party/blink/renderer/modules/storage/storage_controller.cc
@@ -138,17 +138,6 @@ local_storage_namespace_->RemoveInspectorStorageAgent(agent); } -void StorageController::DidDispatchLocalStorageEvent( - const SecurityOrigin* origin, - const String& key, - const String& old_value, - const String& new_value) { - if (local_storage_namespace_) { - local_storage_namespace_->DidDispatchStorageEvent(origin, key, old_value, - new_value); - } -} - void StorageController::EnsureLocalStorageNamespaceCreated() { if (local_storage_namespace_) return;
diff --git a/third_party/blink/renderer/modules/storage/storage_controller.h b/third_party/blink/renderer/modules/storage/storage_controller.h index 554f6cb..aa6fc61 100644 --- a/third_party/blink/renderer/modules/storage/storage_controller.h +++ b/third_party/blink/renderer/modules/storage/storage_controller.h
@@ -45,7 +45,7 @@ // The LocalStorage StorageNamespace object is owned internally, and // StorageController delegates the following methods to that namespace: // GetLocalStorageArea, AddLocalStorageInspectorStorageAgent, -// RemoveLocalStorageInspectorStorageAgent, DidDispatchLocalStorageEvent +// RemoveLocalStorageInspectorStorageAgent class MODULES_EXPORT StorageController : public mojom::blink::DomStorageClient { USING_FAST_MALLOC(StorageController); @@ -77,16 +77,12 @@ // Cleans up unused areas if the total cache size is over the cache limit. void ClearAreasIfNeeded(); - // Methods that delegate to the internal SessionNamespace used for + // Methods that delegate to the internal StorageNamespace used for // LocalStorage: scoped_refptr<CachedStorageArea> GetLocalStorageArea(const SecurityOrigin*); void AddLocalStorageInspectorStorageAgent(InspectorDOMStorageAgent* agent); void RemoveLocalStorageInspectorStorageAgent(InspectorDOMStorageAgent* agent); - void DidDispatchLocalStorageEvent(const SecurityOrigin* origin, - const String& key, - const String& old_value, - const String& new_value); mojom::blink::DomStorage* dom_storage() const { return dom_storage_remote_.get();
diff --git a/third_party/blink/renderer/modules/webcodecs/audio_encoder.cc b/third_party/blink/renderer/modules/webcodecs/audio_encoder.cc index ced49bec..9d774bf 100644 --- a/third_party/blink/renderer/modules/webcodecs/audio_encoder.cc +++ b/third_party/blink/renderer/modules/webcodecs/audio_encoder.cc
@@ -276,29 +276,6 @@ original_config.options.sample_rate == new_config.options.sample_rate; } -// TODO(crbug.com/1201992): Add AudioFrame::clone() and remove this. -AudioFrame* AudioEncoder::CloneFrame(AudioFrame* frame, ExceptionState&) { - auto* init = AudioFrameInit::Create(); - init->setTimestamp(frame->timestamp()); - - auto* buffer = frame->buffer(); - if (!buffer) - return nullptr; - - // Validata that buffer's data is consistent - for (auto channel = 0u; channel < buffer->numberOfChannels(); channel++) { - auto array = buffer->getChannelData(channel); - float* data = array->Data(); - if (!data) - return nullptr; - if (array->length() != buffer->length()) - return nullptr; - } - - init->setBuffer(buffer); - return MakeGarbageCollected<AudioFrame>(init); -} - bool AudioEncoder::VerifyCodecSupport(ParsedConfig* config, ExceptionState& exception_state) { return VerifyCodecSupportStatic(config, &exception_state);
diff --git a/third_party/blink/renderer/modules/webcodecs/audio_encoder.h b/third_party/blink/renderer/modules/webcodecs/audio_encoder.h index 10557e1..b044eb6 100644 --- a/third_party/blink/renderer/modules/webcodecs/audio_encoder.h +++ b/third_party/blink/renderer/modules/webcodecs/audio_encoder.h
@@ -83,7 +83,6 @@ ParsedConfig* ParseConfig(const AudioEncoderConfig* opts, ExceptionState&) override; bool VerifyCodecSupport(ParsedConfig*, ExceptionState&) override; - AudioFrame* CloneFrame(AudioFrame*, ExceptionState&) override; bool CanReconfigure(ParsedConfig& original_config, ParsedConfig& new_config) override;
diff --git a/third_party/blink/renderer/modules/webcodecs/audio_frame.cc b/third_party/blink/renderer/modules/webcodecs/audio_frame.cc index fa6c70e..0bbe2c0 100644 --- a/third_party/blink/renderer/modules/webcodecs/audio_frame.cc +++ b/third_party/blink/renderer/modules/webcodecs/audio_frame.cc
@@ -14,11 +14,6 @@ // static AudioFrame* AudioFrame::Create(AudioFrameInit* init, ExceptionState& exception_state) { - if (!init->hasBuffer()) { - exception_state.ThrowTypeError("No buffer provided"); - return nullptr; - } - return MakeGarbageCollected<AudioFrame>(init); } @@ -41,6 +36,16 @@ : data_(std::move(buffer)), timestamp_(data_->timestamp().InMicroseconds()) {} +AudioFrame* AudioFrame::clone(ExceptionState& exception_state) { + if (!data_) { + exception_state.ThrowDOMException(DOMExceptionCode::kInvalidStateError, + "Cannot clone closed AudioFrame."); + return nullptr; + } + + return MakeGarbageCollected<AudioFrame>(data_); +} + void AudioFrame::close() { data_.reset(); buffer_.Clear();
diff --git a/third_party/blink/renderer/modules/webcodecs/audio_frame.h b/third_party/blink/renderer/modules/webcodecs/audio_frame.h index 9972f2d6..ffac8bc 100644 --- a/third_party/blink/renderer/modules/webcodecs/audio_frame.h +++ b/third_party/blink/renderer/modules/webcodecs/audio_frame.h
@@ -27,6 +27,11 @@ // audio_frame.idl implementation. explicit AudioFrame(AudioFrameInit*); + // Creates a clone of |this|, taking on a new reference on |data_|. The cloned + // frame will not be closed when |this| is, and its lifetime should be + // independently managed. + AudioFrame* clone(ExceptionState&); + void close(); uint64_t timestamp() const; AudioBuffer* buffer();
diff --git a/third_party/blink/renderer/modules/webcodecs/audio_frame.idl b/third_party/blink/renderer/modules/webcodecs/audio_frame.idl index b8d3854..dd3f1b9 100644 --- a/third_party/blink/renderer/modules/webcodecs/audio_frame.idl +++ b/third_party/blink/renderer/modules/webcodecs/audio_frame.idl
@@ -9,6 +9,9 @@ ] interface AudioFrame { [RaisesException] constructor(AudioFrameInit init); + // Creates a AudioFrame, which needs to be independently closed. + [RaisesException] VideoFrame clone(); + void close(); readonly attribute unsigned long long timestamp; // microseconds
diff --git a/third_party/blink/renderer/modules/webcodecs/encoder_base.cc b/third_party/blink/renderer/modules/webcodecs/encoder_base.cc index c3591e2..93692dc 100644 --- a/third_party/blink/renderer/modules/webcodecs/encoder_base.cc +++ b/third_party/blink/renderer/modules/webcodecs/encoder_base.cc
@@ -116,8 +116,12 @@ DCHECK(active_config_); // This will fail if |frame| is already closed. - auto* internal_frame = CloneFrame(frame, exception_state); + auto* internal_frame = frame->clone(exception_state); + if (!internal_frame) { + // Remove exceptions relating to cloning closed frames. + exception_state.ClearException(); + exception_state.ThrowDOMException(DOMExceptionCode::kOperationError, "Cannot encode closed frame."); return;
diff --git a/third_party/blink/renderer/modules/webcodecs/encoder_base.h b/third_party/blink/renderer/modules/webcodecs/encoder_base.h index ab91374..4877ca2 100644 --- a/third_party/blink/renderer/modules/webcodecs/encoder_base.h +++ b/third_party/blink/renderer/modules/webcodecs/encoder_base.h
@@ -104,9 +104,6 @@ ExceptionState&) = 0; virtual bool VerifyCodecSupport(InternalConfigType*, ExceptionState&) = 0; - // TODO(crbug.com/1201992): Once AudioFrames can be cloned, remove this. - virtual FrameType* CloneFrame(FrameType*, ExceptionState&) = 0; - std::unique_ptr<CodecLogger> logger_; std::unique_ptr<MediaEncoderType> media_encoder_;
diff --git a/third_party/blink/renderer/modules/webcodecs/video_encoder.cc b/third_party/blink/renderer/modules/webcodecs/video_encoder.cc index 0f48bfc..2e2a562b 100644 --- a/third_party/blink/renderer/modules/webcodecs/video_encoder.cc +++ b/third_party/blink/renderer/modules/webcodecs/video_encoder.cc
@@ -368,11 +368,6 @@ return VerifyCodecSupportStatic(config, &exception_state); } -VideoFrame* VideoEncoder::CloneFrame(VideoFrame* frame, - ExceptionState& exception_state) { - return frame->clone(exception_state); -} - void VideoEncoder::UpdateEncoderLog(std::string encoder_name, bool is_hw_accelerated) { // TODO(https://crbug.com/1139089) : Add encoder properties.
diff --git a/third_party/blink/renderer/modules/webcodecs/video_encoder.h b/third_party/blink/renderer/modules/webcodecs/video_encoder.h index 151e666..cbb74fe 100644 --- a/third_party/blink/renderer/modules/webcodecs/video_encoder.h +++ b/third_party/blink/renderer/modules/webcodecs/video_encoder.h
@@ -94,7 +94,6 @@ ParsedConfig* ParseConfig(const VideoEncoderConfig*, ExceptionState&) override; bool VerifyCodecSupport(ParsedConfig*, ExceptionState&) override; - VideoFrame* CloneFrame(VideoFrame*, ExceptionState&) override; void ContinueConfigureWithGpuFactories( Request* request,
diff --git a/third_party/blink/renderer/modules/webcodecs/video_frame.idl b/third_party/blink/renderer/modules/webcodecs/video_frame.idl index 006550f6..46f7aad 100644 --- a/third_party/blink/renderer/modules/webcodecs/video_frame.idl +++ b/third_party/blink/renderer/modules/webcodecs/video_frame.idl
@@ -54,8 +54,7 @@ BufferSource destination, optional VideoFrameReadIntoOptions options = {}); - // Creates of the copy of this VideoFrame, which needs to be independently - // destroyed. + // Creates a copy of this VideoFrame, which needs to be independently closed. [RaisesException] VideoFrame clone(); void close();
diff --git a/third_party/blink/renderer/platform/widget/input/prediction/filter_factory.h b/third_party/blink/renderer/platform/widget/input/prediction/filter_factory.h index e4402a3..a2ded5da 100644 --- a/third_party/blink/renderer/platform/widget/input/prediction/filter_factory.h +++ b/third_party/blink/renderer/platform/widget/input/prediction/filter_factory.h
@@ -5,6 +5,8 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WIDGET_INPUT_PREDICTION_FILTER_FACTORY_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WIDGET_INPUT_PREDICTION_FILTER_FACTORY_H_ +#include <unordered_map> + #include "base/feature_list.h" #include "third_party/blink/public/platform/input/predictor_factory.h" #include "third_party/blink/renderer/platform/platform_export.h"
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 429303e..2042c8a0 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -176,18 +176,16 @@ # --- End CompositeAfterPaint Tests -- # --- BEGIN OOP-R Canvas tests --- -crbug.com/1081534 [ Win7 ] virtual/oopr-canvas2d/fast/canvas/canvas-composite-video-shadow.html [ Pass Failure ] -crbug.com/1081534 [ Win ] virtual/oopr-canvas2d/fast/canvas/canvas-incremental-repaint.html [ Failure ] -crbug.com/1081534 [ Win ] virtual/oopr-canvas2d/fast/canvas/canvas-partial-invalidation-zoomed.html [ Pass Failure ] -crbug.com/1081534 [ Win ] virtual/oopr-canvas2d/fast/canvas/canvas-state-persistence-no-dirty.html [ Pass Failure ] -crbug.com/1081534 [ Win ] virtual/oopr-canvas2d/fast/canvas/canvas-transform-skewed.html [ Failure ] -crbug.com/1081534 [ Linux ] virtual/oopr-canvas2d/fast/canvas/canvas-transform-skewed.html [ Failure ] -crbug.com/1081534 [ Win ] virtual/oopr-canvas2d/fast/canvas/OffscreenCanvas-text-FontFace.html [ Pass Failure ] +crbug.com/1081534 virtual/oopr-canvas2d/fast/canvas/canvas-transform-skewed.html [ Failure ] -# Flakey tests -crbug.com/1081534 [ Win ] virtual/oopr-canvas2d/fast/canvas/OffscreenCanvas-Bitmaprenderer-toBlob-worker.html [ Pass Failure ] -crbug.com/1081534 [ Win ] virtual/oopr-canvas2d/fast/canvas/canvas-clearRect.html [ Pass Failure ] -crbug.com/1081534 [ Win ] virtual/oopr-canvas2d/fast/canvas/canvas-getImageData.html [ Pass Failure ] +# Flaky tests +crbug.com/1081534 virtual/oopr-canvas2d/fast/canvas/OffscreenCanvas-Bitmaprenderer-toBlob-worker.html [ Pass Failure ] +crbug.com/1081534 [ Linux ] virtual/oopr-canvas2d/fast/canvas/canvas-getImageData.html [ Pass Failure ] +crbug.com/1081534 virtual/oopr-canvas2d/fast/canvas/OffscreenCanvas-text-FontFace.html [ Pass Failure ] +crbug.com/1081534 virtual/oopr-canvas2d/fast/canvas/canvas-state-persistence-no-dirty.html [ Pass Failure ] +crbug.com/1081534 virtual/oopr-canvas2d/fast/canvas/canvas-partial-invalidation-zoomed.html [ Pass Failure ] +crbug.com/1081534 virtual/oopr-canvas2d/fast/canvas/canvas-incremental-repaint.html [ Pass Failure ] +crbug.com/1081534 virtual/oopr-canvas2d/fast/canvas/canvas-text-alignment.html [ Pass Failure ] # We're rolling these tests out on Windows first, other platforms to follow. When removing [ Skip ] # for a platform please add the platform tag to the failing tests above. @@ -579,6 +577,9 @@ crbug.com/1135287 external/wpt/css/css-sizing/image-min-max-content-intrinsic-size-change-006.html [ Failure ] crbug.com/1135287 external/wpt/css/css-sizing/image-min-max-content-intrinsic-size-change-007.html [ Failure ] crbug.com/1135287 external/wpt/css/css-sizing/image-min-max-content-intrinsic-size-change-008.html [ Failure ] +crbug.com/1114280 external/wpt/css/css-sizing/replaced-aspect-ratio-stretch-fit-001.html [ Failure ] +crbug.com/1114280 external/wpt/css/css-sizing/replaced-aspect-ratio-stretch-fit-002.html [ Failure ] +crbug.com/1114280 external/wpt/css/css-sizing/replaced-aspect-ratio-stretch-fit-003.html [ Failure ] crbug.com/1008951 external/wpt/css/css-text-decor/text-decoration-subelements-002.html [ Failure ] crbug.com/1008951 external/wpt/css/css-text-decor/text-decoration-subelements-003.html [ Failure ] @@ -5284,7 +5285,6 @@ # Sheiff failures 2021-04-09 crbug.com/1197444 [ Linux ] virtual/scroll-unification-prefer_compositing_to_lcd_text/scrollbars/overlay-scrollbar-over-child-layer-nested-2.html [ Failure Pass Crash ] -crbug.com/1197444 [ Linux ] virtual/composite-bgcolor-animation/external/wpt/css/css-backgrounds/animations/two-background-color-animation-diff-length3.html [ Failure ] crbug.com/715718 external/wpt/media-source/mediasource-remove.html [ Failure Pass ]
diff --git a/third_party/blink/web_tests/WebGPUExpectations b/third_party/blink/web_tests/WebGPUExpectations index 0342ded9..4e31478 100644 --- a/third_party/blink/web_tests/WebGPUExpectations +++ b/third_party/blink/web_tests/WebGPUExpectations
@@ -29,6 +29,7 @@ wpt_internal/webgpu/cts.html?q=webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:format="bc7-rgba-unorm";* [ Failure ] wpt_internal/webgpu/cts.html?q=webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:* [ Failure Crash ] crbug.com/dawn/759 [ Linux ] wpt_internal/webgpu/cts.html?q=webgpu:api,operation,rendering,draw:vertex_attributes,basic:* [ Failure ] +crbug.com/1203413 [ Mac ] wpt_internal/webgpu/cts.html?worker=1&q=webgpu:api,validation,buffer,mapping:* [ Crash ] # Fails or crashes on numerous combinations of backends, hardware, and validation layers wpt_internal/webgpu/cts.html?q=webgpu:api,operation,render_pass,resolve:* [ Skip ] @@ -180,9 +181,8 @@ # Failure in both D3D12 and Vulkan validation layers wpt_internal/webgpu/cts.html?q=webgpu:api,validation,encoding,cmds,index_access:* [ Skip ] -# Assert in debug builds -crbug.com/dawn/614 wpt_internal/webgpu/cts.html?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="writeonly-storage-texture";resourceType="sampledTexMS" [ Crash ] -crbug.com/dawn/614 wpt_internal/webgpu/cts.html?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="readonly-storage-texture";resourceType="sampledTexMS" [ Crash ] +# Assert in debug build +crbug.com/dawn/614 wpt_internal/webgpu/cts.html?q=webgpu:api,validation,createBindGroup:* [ Crash ] # Crash with validation layers (Vulkan/D3D12). crbug.com/dawn/615 wpt_internal/webgpu/cts.html?q=webgpu:api,operation,vertex_state,index_format:* [ Skip ]
diff --git a/third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/two-background-color-animation-diff-length3.html b/third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/two-background-color-animation-diff-length3.html index cfb0bf86..e12d8a7 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/two-background-color-animation-diff-length3.html +++ b/third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/two-background-color-animation-diff-length3.html
@@ -7,7 +7,7 @@ width: 100px; height: 100px; background-color: green; - animation: bgcolor2 10s, bgcolor1 2s 0.001s; + animation: bgcolor2 200s, bgcolor1 100s 0.001s; } @keyframes bgcolor1 { 0% { background-color: rgb(0, 199, 0); }
diff --git a/third_party/blink/web_tests/external/wpt/css/css-sizing/replaced-aspect-ratio-stretch-fit-001.html b/third_party/blink/web_tests/external/wpt/css/css-sizing/replaced-aspect-ratio-stretch-fit-001.html new file mode 100644 index 0000000..0653c82 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-sizing/replaced-aspect-ratio-stretch-fit-001.html
@@ -0,0 +1,8 @@ +<!DOCTYPE html> +<meta name="assert" content="Checks that a replaced element, with an aspect ratio, applies min/max block lengths for stretch-fit sizing."> +<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#intrinsic-sizes"> +<link rel="match" href="../reference/ref-filled-green-100px-square-only.html"> +<p>Test passes if there is a filled green square.</p> +<div style="width: 50px;"> + <svg viewBox="0 0 2 1" style="background: green; max-width: 100px; min-height: 100px;"></svg> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-sizing/replaced-aspect-ratio-stretch-fit-002.html b/third_party/blink/web_tests/external/wpt/css/css-sizing/replaced-aspect-ratio-stretch-fit-002.html new file mode 100644 index 0000000..2be6700 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-sizing/replaced-aspect-ratio-stretch-fit-002.html
@@ -0,0 +1,8 @@ +<!DOCTYPE html> +<meta name="assert" content="Checks that a replaced element, with an aspect ratio, applies min/max block lengths for stretch-fit sizing."> +<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#intrinsic-sizes"> +<link rel="match" href="../reference/ref-filled-green-100px-square-only.html"> +<p>Test passes if there is a filled green square.</p> +<div style="width: 50px;"> + <svg viewBox="0 0 1 1" style="background: green; min-height: 100px;"></svg> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-sizing/replaced-aspect-ratio-stretch-fit-003.html b/third_party/blink/web_tests/external/wpt/css/css-sizing/replaced-aspect-ratio-stretch-fit-003.html new file mode 100644 index 0000000..06dac27 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-sizing/replaced-aspect-ratio-stretch-fit-003.html
@@ -0,0 +1,8 @@ +<!DOCTYPE html> +<meta name="assert" content="Checks that a replaced element, with an aspect ratio, doesn't apply min/max inline lengths for max-content sizing."> +<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#intrinsic-sizes"> +<link rel="match" href="../reference/ref-filled-green-100px-square-only.html"> +<p>Test passes if there is a filled green square.</p> +<div style="width: 100px;"> + <svg viewBox="0 0 1 1" style="background: green; min-width: max-content; max-width: 50px;"></svg> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/webcodecs/audio-frame.any.js b/third_party/blink/web_tests/external/wpt/webcodecs/audio-frame.any.js new file mode 100644 index 0000000..fe8ab84 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/webcodecs/audio-frame.any.js
@@ -0,0 +1,112 @@ +// META: global=window +// META: script=/common/media.js +// META: script=/webcodecs/utils.js + +var defaultInit = { + timestamp: 1234, + channels: 2, + sampleRate: 8000, + frames: 100, +} + +function createDefaultAudioFrame() { + return make_audio_frame(defaultInit.timestamp, + defaultInit.channels, + defaultInit.sampleRate, + defaultInit.frames); +} + +test(t => { + let localBuffer = new AudioBuffer({ + length: defaultInit.frames, + numberOfChannels: defaultInit.channels, + sampleRate: defaultInit.sampleRate + }); + + let audioFrameInit = { + timestamp : defaultInit.timestamp, + buffer: localBuffer + } + + let frame = new AudioFrame(audioFrameInit); + + assert_equals(frame.timestamp, defaultInit.timestamp, "timestamp"); + assert_equals(frame.buffer.length, defaultInit.frames, "frames"); + assert_equals(frame.buffer.numberOfChannels, defaultInit.channels, "channels"); + assert_equals(frame.buffer.sampleRate, defaultInit.sampleRate, "sampleRate"); + + assert_throws_js(TypeError, () => { + let frame = new AudioFrame({ + buffer: localBuffer + }) + }, "AudioFrames require 'timestamp'") + + assert_throws_js(TypeError, () => { + let frame = new AudioFrame({ + timestamp: defaultInit.timestamp + }) + }, "AudioFrames require 'buffer'") + +}, 'Verify AudioFrame constructors'); + +test(t => { + let frame = createDefaultAudioFrame(); + + let clone = frame.clone(); + + // Verify the parameters match. + assert_equals(frame.timestamp, clone.timestamp, "timestamp"); + assert_equals(frame.buffer.length, clone.buffer.length, "frames"); + assert_equals(frame.buffer.numberOfChannels, + clone.buffer.numberOfChannels, "channels"); + assert_equals(frame.buffer.sampleRate, clone.buffer.sampleRate, "sampleRate"); + + // Verify the data matches. + for (var channel = 0; channel < frame.buffer.numberOfChannels; channel++) { + var orig_ch = frame.buffer.getChannelData(channel); + var cloned_ch = clone.buffer.getChannelData(channel); + + assert_array_equals(orig_ch, cloned_ch, "Cloned data ch=" + channel); + } + + // Verify closing the original frame doesn't close the clone. + frame.close(); + assert_equals(frame.buffer, null, "frame.buffer (closed)"); + assert_not_equals(clone.buffer, null, "clone.buffer (not closed)"); + + clone.close(); + assert_equals(clone.buffer, null, "clone.buffer (closed)"); + + // Verify closing a closed frame does not throw. + frame.close(); +}, 'Verify closing and cloning AudioFrames'); + +test(t => { + let frame = createDefaultAudioFrame(); + + // Get a copy of the original data. + let pre_modification_clone = frame.clone(); + + for (var channel = 0; channel < frame.buffer.numberOfChannels; channel++) { + var orig_ch = frame.buffer.getChannelData(channel); + + // Flip the polarity of the original frame's buffer. + for (let i = 0; i < orig_ch.length; ++i) { + orig_ch.buffer[i] = -orig_ch.buffer[i]; + } + } + + // The data in 'frame' should have been snapshotted internally, and + // despite changes to frame.buffer, post_modification_clone should not contain + // modified data. + let post_modification_clone = frame.clone(); + + // Verify the data matches. + for (var channel = 0; channel < frame.buffer.numberOfChannels; channel++) { + var pre_ch = pre_modification_clone.buffer.getChannelData(channel); + var post_ch = post_modification_clone.buffer.getChannelData(channel); + + assert_array_equals(pre_ch, post_ch, "Cloned data ch=" + channel); + } +}, 'Verify frame data is snapshotted and internally immutable'); +
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt index e2103ca..71c3fab32 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -41,6 +41,7 @@ [Worker] attribute @@toStringTag [Worker] getter buffer [Worker] getter timestamp +[Worker] method clone [Worker] method close [Worker] method constructor [Worker] interface BackgroundFetchManager
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt index 3ad687f..12b3048 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt
@@ -336,6 +336,7 @@ attribute @@toStringTag getter buffer getter timestamp + method clone method close method constructor interface AudioListener
diff --git a/third_party/blink/web_tests/webgpu/ctshtml-template.txt b/third_party/blink/web_tests/webgpu/ctshtml-template.txt index 601075fe..2f1a3da 100644 --- a/third_party/blink/web_tests/webgpu/ctshtml-template.txt +++ b/third_party/blink/web_tests/webgpu/ctshtml-template.txt
@@ -32,7 +32,7 @@ <meta name=variant content='?worker=1&q=webgpu:api,operation,rendering,basic:*'> <meta name=variant content='?worker=1&q=webgpu:api,operation,render_pass,storeOp:*'> <meta name=variant content='?worker=1&q=webgpu:api,operation,render_pass,storeop2:*'> -<meta name=variant content='?worker=1&q=webgpu:api,operation,fences:*'> +<meta name=variant content='?worker=1&q=webgpu:api,operation,onSubmittedWorkDone:*'> <meta name=variant content='?worker=1&q=webgpu:api,validation,buffer,create:*'> <meta name=variant content='?worker=1&q=webgpu:api,validation,buffer,destroy:*'> <meta name=variant content='?worker=1&q=webgpu:api,validation,buffer,mapping:*'>
diff --git a/third_party/blink/web_tests/wpt_internal/webgpu/cts.html b/third_party/blink/web_tests/wpt_internal/webgpu/cts.html index 2f98535..6238a0b 100644 --- a/third_party/blink/web_tests/wpt_internal/webgpu/cts.html +++ b/third_party/blink/web_tests/wpt_internal/webgpu/cts.html
@@ -33,7 +33,7 @@ <meta name=variant content='?worker=1&q=webgpu:api,operation,rendering,basic:*'> <meta name=variant content='?worker=1&q=webgpu:api,operation,render_pass,storeOp:*'> <meta name=variant content='?worker=1&q=webgpu:api,operation,render_pass,storeop2:*'> -<meta name=variant content='?worker=1&q=webgpu:api,operation,fences:*'> +<meta name=variant content='?worker=1&q=webgpu:api,operation,onSubmittedWorkDone:*'> <meta name=variant content='?worker=1&q=webgpu:api,validation,buffer,create:*'> <meta name=variant content='?worker=1&q=webgpu:api,validation,buffer,destroy:*'> <meta name=variant content='?worker=1&q=webgpu:api,validation,buffer,mapping:*'> @@ -150,8 +150,8 @@ <meta name=variant content='?q=webgpu:api,operation,command_buffer,image_copy:*'> <meta name=variant content='?q=webgpu:api,operation,compute,basic:*'> <meta name=variant content='?q=webgpu:api,operation,device,lost:*'> -<meta name=variant content='?q=webgpu:api,operation,fences:*'> <meta name=variant content='?q=webgpu:api,operation,memory_sync,buffer,ww:*'> +<meta name=variant content='?q=webgpu:api,operation,onSubmittedWorkDone:*'> <meta name=variant content='?q=webgpu:api,operation,queue,writeBuffer:*'> <meta name=variant content='?q=webgpu:api,operation,render_pass,resolve:*'> <meta name=variant content='?q=webgpu:api,operation,render_pass,storeOp:*'> @@ -161,32 +161,31 @@ <meta name=variant content='?q=webgpu:api,operation,rendering,basic:*'> <meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";*'> <meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";*'> -<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-color";*'> -<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-color";*'> +<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";*'> +<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";*'> <meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";*'> <meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";*'> -<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-color";*'> -<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-color";*'> +<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";*'> +<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";*'> <meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";*'> <meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";*'> <meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";*'> -<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="blend-color";*'> -<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-blend-color";*'> +<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";*'> +<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";*'> <meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";*'> <meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";*'> -<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-color";*'> -<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-color";*'> +<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";*'> +<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";*'> <meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";*'> <meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";*'> -<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-color";*'> -<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-color";*'> +<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";*'> +<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";*'> <meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";*'> <meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";*'> <meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";*'> -<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="blend-color";*'> -<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-blend-color";*'> +<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";*'> +<meta name=variant content='?q=webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";*'> <meta name=variant content='?q=webgpu:api,operation,rendering,blending:formats,*'> -<meta name=variant content='?q=webgpu:api,operation,rendering,blending:multiple_color_attachments,*'> <meta name=variant content='?q=webgpu:api,operation,rendering,blending:clamp,*'> <meta name=variant content='?q=webgpu:api,operation,rendering,depth:*'> <meta name=variant content='?q=webgpu:api,operation,rendering,draw:arguments:first=0;count=0;*'> @@ -335,43 +334,9 @@ <meta name=variant content='?q=webgpu:api,validation,buffer,destroy:*'> <meta name=variant content='?q=webgpu:api,validation,buffer,mapping:*'> <meta name=variant content='?q=webgpu:api,validation,capability_checks,features,query_types:createQuerySet:*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:binding_count_mismatch,*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:binding_must_be_present_in_layout,*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="uniform-buffer";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="storage-buffer";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="readonly-storage-buffer";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="sampler";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="comparison-sampler";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="sampled-texture";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="multisampled-texture";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="writeonly-storage-texture";resourceType="uniformBuf";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="writeonly-storage-texture";resourceType="storageBuf";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="writeonly-storage-texture";resourceType="plainSamp";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="writeonly-storage-texture";resourceType="compareSamp";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="writeonly-storage-texture";resourceType="sampledTex";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="writeonly-storage-texture";resourceType="sampledTexMS"'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="writeonly-storage-texture";resourceType="storageTex";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="writeonly-storage-texture";resourceType="errorBuf";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="writeonly-storage-texture";resourceType="errorSamp";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="writeonly-storage-texture";resourceType="errorTex";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="readonly-storage-texture";resourceType="uniformBuf";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="readonly-storage-texture";resourceType="storageBuf";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="readonly-storage-texture";resourceType="plainSamp";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="readonly-storage-texture";resourceType="compareSamp";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="readonly-storage-texture";resourceType="sampledTex";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="readonly-storage-texture";resourceType="sampledTexMS"'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="readonly-storage-texture";resourceType="storageTex";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="readonly-storage-texture";resourceType="errorBuf";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="readonly-storage-texture";resourceType="errorSamp";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_binding_must_contain_exactly_one_buffer_of_its_type:bindingType="readonly-storage-texture";resourceType="errorTex";*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:texture_binding_must_have_correct_usage,*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:texture_must_have_correct_component_type,*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:texture_must_have_correct_dimension,*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:buffer_offset_and_size_for_bind_groups_match,*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroup:minBindingSize,*'> +<meta name=variant content='?q=webgpu:api,validation,createBindGroup:*'> <meta name=variant content='?q=webgpu:api,validation,createBindGroupLayout:some_binding_index_was_specified_more_than_once,*'> <meta name=variant content='?q=webgpu:api,validation,createBindGroupLayout:visibility,*'> -<meta name=variant content='?q=webgpu:api,validation,createBindGroupLayout:bindingTypeSpecific_optional_members,*'> <meta name=variant content='?q=webgpu:api,validation,createBindGroupLayout:multisample_requires_2d_view_dimension,*'> <meta name=variant content='?q=webgpu:api,validation,createBindGroupLayout:number_of_dynamic_buffers_exceeds_the_maximum_value,*'> <meta name=variant content='?q=webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_bind_group_layout,*'> @@ -445,7 +410,6 @@ <meta name=variant content='?q=webgpu:api,validation,encoding,queries,general:*'> <meta name=variant content='?q=webgpu:api,validation,encoding,queries,resolveQuerySet:*'> <meta name=variant content='?q=webgpu:api,validation,error_scope:*'> -<meta name=variant content='?q=webgpu:api,validation,fences:*'> <meta name=variant content='?q=webgpu:api,validation,image_copy,layout_related:*'> <meta name=variant content='?q=webgpu:api,validation,image_copy,texture_related:*'> <meta name=variant content='?q=webgpu:api,validation,initialization,requestDevice:*'>
diff --git a/third_party/wayland/BUILD.gn b/third_party/wayland/BUILD.gn index cef3d7d..e5802b5 100644 --- a/third_party/wayland/BUILD.gn +++ b/third_party/wayland/BUILD.gn
@@ -11,6 +11,8 @@ "include", "include/src", "include/protocol", + "src/cursor", + "src/egl", "src/src", ]
diff --git a/third_party/webgpu-cts/ts_sources.txt b/third_party/webgpu-cts/ts_sources.txt index 10ef309..983e4132 100644 --- a/third_party/webgpu-cts/ts_sources.txt +++ b/third_party/webgpu-cts/ts_sources.txt
@@ -71,8 +71,8 @@ src/webgpu/util/texture/texel_data.ts src/webgpu/gpu_test.ts src/webgpu/examples.spec.ts -src/webgpu/api/operation/fences.spec.ts src/webgpu/api/operation/labels.spec.ts +src/webgpu/api/operation/onSubmittedWorkDone.spec.ts src/webgpu/api/operation/uncapturederror.spec.ts src/webgpu/api/operation/buffers/mapping_test.ts src/webgpu/api/operation/buffers/map.spec.ts @@ -134,7 +134,6 @@ src/webgpu/api/validation/createView.spec.ts src/webgpu/api/validation/create_pipeline.spec.ts src/webgpu/api/validation/error_scope.spec.ts -src/webgpu/api/validation/fences.spec.ts src/webgpu/api/validation/layout_shader_compat.spec.ts src/webgpu/api/validation/render_pass_descriptor.spec.ts src/webgpu/api/validation/vertex_access.spec.ts @@ -161,6 +160,7 @@ src/webgpu/api/validation/encoding/cmds/render/other.spec.ts src/webgpu/api/validation/encoding/cmds/render/state_tracking.spec.ts src/webgpu/api/validation/encoding/programmable/pipeline_bind_group_compat.spec.ts +src/webgpu/api/validation/encoding/queries/common.ts src/webgpu/api/validation/encoding/queries/begin_end.spec.ts src/webgpu/api/validation/encoding/queries/general.spec.ts src/webgpu/api/validation/encoding/queries/pipeline_statistics.spec.ts
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index bcb62d21..f6438ff 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -9426,6 +9426,41 @@ </description> </action> +<action name="IOS.StartSurface.HideShortcuts"> + <owner>gogerald@chromium.org</owner> + <description> + Recorded when hiding the shortcuts for the Start Surface. iOS only. + </description> +</action> + +<action name="IOS.StartSurface.OpenMostRecentTab"> + <owner>gogerald@chromium.org</owner> + <description> + Recorded when opening the most recent tab after tapping on the Start Surface + return to recent tab tile. iOS only. + </description> +</action> + +<action name="IOS.StartSurface.Show"> + <owner>gogerald@chromium.org</owner> + <description>Recorded when showing the Start Surface. iOS only.</description> +</action> + +<action name="IOS.StartSurface.ShowReturnToRecentTabTile"> + <owner>gogerald@chromium.org</owner> + <description> + Recorded when showing the return to recent tab tile for the Start Surface. + iOS only. + </description> +</action> + +<action name="IOS.StartSurface.ShrinkLogo"> + <owner>gogerald@chromium.org</owner> + <description> + Recorded when shrinking the logo for the Start Surface. iOS only. + </description> +</action> + <action name="IOSAccountsSettingsCloseWithSwipe"> <owner>msarda@chromium.org</owner> <owner>jlebel@chromium.org</owner>
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index bd1746a7..09da5200 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -32322,6 +32322,7 @@ <int value="3884" label="WebAppManifestProtocolHandlers"/> <int value="3885" label="RTCPeerConnectionOfferAllowExtmapMixedFalse"/> <int value="3886" label="NewCanvas2DAPI"/> + <int value="3887" label="ServiceWorkerSubresourceFilter"/> </enum> <enum name="FeaturePolicyAllowlistType"> @@ -47193,6 +47194,7 @@ <int value="482429100" label="OmniboxClobberIsZeroSuggestEntrypoint:disabled"/> <int value="483155358" label="GlobalMediaControlsForChromeOS:disabled"/> + <int value="484581911" label="ServiceWorkerSubresourceFilter:disabled"/> <int value="484596410" label="EnterpriseRealtimeExtensionRequest:disabled"/> <int value="485957747" label="finch-seed-ignore-pending-download"/> <int value="487810392" label="EnablePalmOnToolTypePalm:enabled"/> @@ -47390,6 +47392,7 @@ <int value="651562604" label="RawClipboard:enabled"/> <int value="651844675" label="EasyUnlockPromotions:enabled"/> <int value="652561231" label="CustomContextMenu:enabled"/> + <int value="653308913" label="ServiceWorkerSubresourceFilter:enabled"/> <int value="653795860" label="HelpAppReleaseNotes:disabled"/> <int value="654199907" label="AllowSyncXHRInPageDismissal:disabled"/> <int value="654879464" label="WalletRequiresFirstSyncSetupComplete:enabled"/>
diff --git a/tools/metrics/histograms/histograms_xml/apps/histograms.xml b/tools/metrics/histograms/histograms_xml/apps/histograms.xml index 9c50f46..0f8d4296 100644 --- a/tools/metrics/histograms/histograms_xml/apps/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/apps/histograms.xml
@@ -1258,7 +1258,7 @@ </histogram> <histogram name="Apps.AppListSearchResultInternalApp.Show" - enum="AppListInternalAppName" expires_after="2021-08-22"> + enum="AppListInternalAppName" expires_after="2021-10-24"> <owner>wutao@chromium.org</owner> <summary> The app list search result of an internal app that was shown to the user.
diff --git a/tools/metrics/histograms/histograms_xml/ash/histograms.xml b/tools/metrics/histograms/histograms_xml/ash/histograms.xml index 061ae16f..4302e7b 100644 --- a/tools/metrics/histograms/histograms_xml/ash/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/ash/histograms.xml
@@ -1272,7 +1272,7 @@ </histogram> <histogram name="Ash.Login.Lock.AuthMethod.Switched" - enum="AuthMethodSwitchType" expires_after="2021-09-19"> + enum="AuthMethodSwitchType" expires_after="2022-04-27"> <owner>rsorokin@chromium.org</owner> <owner>tellier@google.com</owner> <owner>cros-oac@google.com</owner> @@ -1282,7 +1282,7 @@ </histogram> <histogram name="Ash.Login.Lock.AuthMethod.Used.ClamShellMode" - enum="AuthMethod" expires_after="2021-09-19"> + enum="AuthMethod" expires_after="2022-04-27"> <owner>rsorokin@chromium.org</owner> <owner>tellier@google.com</owner> <owner>cros-oac@google.com</owner> @@ -1294,7 +1294,7 @@ </histogram> <histogram name="Ash.Login.Lock.AuthMethod.Used.TabletMode" enum="AuthMethod" - expires_after="2021-09-19"> + expires_after="2022-04-27"> <owner>rsorokin@chromium.org</owner> <owner>tellier@google.com</owner> <owner>cros-oac@google.com</owner> @@ -1336,7 +1336,7 @@ </histogram> <histogram name="Ash.Login.Login.AuthMethod.Switched" - enum="AuthMethodSwitchType" expires_after="2021-05-16"> + enum="AuthMethodSwitchType" expires_after="2022-04-27"> <owner>rsorokin@chromium.org</owner> <owner>tellier@google.com</owner> <owner>cros-oac@google.com</owner> @@ -1346,7 +1346,7 @@ </histogram> <histogram name="Ash.Login.Login.AuthMethod.Used.ClamShellMode" - enum="AuthMethod" expires_after="2021-05-16"> + enum="AuthMethod" expires_after="2022-04-27"> <owner>rsorokin@chromium.org</owner> <owner>tellier@google.com</owner> <owner>cros-oac@google.com</owner> @@ -1358,7 +1358,7 @@ </histogram> <histogram name="Ash.Login.Login.AuthMethod.Used.TabletMode" enum="AuthMethod" - expires_after="2021-05-16"> + expires_after="2022-04-27"> <owner>rsorokin@chromium.org</owner> <owner>tellier@google.com</owner> <owner>cros-oac@google.com</owner>
diff --git a/tools/metrics/histograms/histograms_xml/blink/histograms.xml b/tools/metrics/histograms/histograms_xml/blink/histograms.xml index 3dea4c66..1fdc438 100644 --- a/tools/metrics/histograms/histograms_xml/blink/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/blink/histograms.xml
@@ -52,7 +52,7 @@ </histogram> <histogram name="Blink.Animation.CompositedAnimationFailureReason" - enum="CompositorAnimationsFailureReason" expires_after="2021-08-22"> + enum="CompositorAnimationsFailureReason" expires_after="2021-10-24"> <owner>smcgruer@chromium.org</owner> <owner>animations-dev@chromium.org</owner> <summary> @@ -736,7 +736,7 @@ </histogram> <histogram name="Blink.DecodedImage.JpegDensity.KiBWeighted" - units="0.01 bits per pixel" expires_after="2021-08-22"> + units="0.01 bits per pixel" expires_after="2021-10-24"> <owner>deymo@google.com</owner> <owner>compression-dev@google.com</owner> <summary> @@ -1912,7 +1912,7 @@ </histogram> <histogram base="true" name="Blink.MainFrame.UpdateTime" units="microseconds" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <!-- Name completed by histogram_suffixes name="BlinkUpdateTimePreFCPSuffixes" --> <!-- Name completed by histogram_suffixes name="BlinkUpdateTimePostFCPSuffixes" --> @@ -2104,7 +2104,7 @@ </histogram> <histogram base="true" name="Blink.Paint.UpdateTime" units="microseconds" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <!-- Name completed by histogram_suffixes name="BlinkUpdateTimePreFCPSuffixes" --> <!-- Name completed by histogram_suffixes name="BlinkUpdateTimePostFCPSuffixes" -->
diff --git a/tools/metrics/histograms/histograms_xml/bluetooth/histograms.xml b/tools/metrics/histograms/histograms_xml/bluetooth/histograms.xml index 738dfdb5a..e7b5dfc 100644 --- a/tools/metrics/histograms/histograms_xml/bluetooth/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/bluetooth/histograms.xml
@@ -248,6 +248,32 @@ </summary> </histogram> +<histogram name="Bluetooth.Mojo.PendingConnectAtShutdown.DurationWaiting" + units="ms" expires_after="2022-04-21"> + <owner>jonmann@chromium.org</owner> + <owner>cros-system-services-networking@google.com</owner> + <summary> + Records the number of milliseconds a pending connect request has been + waiting on/for the experimental bluetooth::mojom::Adapter implementation. + This metric is only recorded when the class is destroyed. + </summary> +</histogram> + +<histogram + name="Bluetooth.Mojo.PendingConnectAtShutdown.NumberOfServiceDiscoveriesInProgress" + units="count" expires_after="2022-04-21"> + <owner>jonmann@chromium.org</owner> + <owner>cros-system-services-networking@google.com</owner> + <summary> + This metric is emitted when the Mojo Adapter is destroyed, with the value of + how many outgoing connections were active because they were pending on + service discovery. Service discovery should not take so long as to still be + active when the Mojo Adapter is being torn down, so significant counts of + values other than 0 in this metric are a strong signal of incorrect behavior + and should be investigated. + </summary> +</histogram> + <histogram name="Bluetooth.PairingMethod" enum="BluetoothPairingMethod" expires_after="2020-11-08"> <owner>adlr@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/chromeos/histograms.xml b/tools/metrics/histograms/histograms_xml/chromeos/histograms.xml index a597d0c..d5d7c38 100644 --- a/tools/metrics/histograms/histograms_xml/chromeos/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/chromeos/histograms.xml
@@ -301,7 +301,7 @@ </histogram> <histogram name="ChromeOS.CWP.CollectPerf" - enum="ChromeOSProfileCollectionStatus" expires_after="2021-08-22"> + enum="ChromeOSProfileCollectionStatus" expires_after="2021-10-24"> <owner>aalexand@google.com</owner> <owner>gmx@chromium.org</owner> <summary> @@ -604,7 +604,7 @@ </histogram> <histogram name="ChromeOS.HardwareVerifier.Report.IsCompliant" enum="Boolean" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>itspeter@chromium.org</owner> <owner>stimim@chromium.org</owner> <owner>chromeos-hw-checker@google.com</owner>
diff --git a/tools/metrics/histograms/histograms_xml/content/histograms.xml b/tools/metrics/histograms/histograms_xml/content/histograms.xml index b9227f3..f58355c 100644 --- a/tools/metrics/histograms/histograms_xml/content/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/content/histograms.xml
@@ -184,7 +184,7 @@ </histogram> <histogram name="ContentSettings.DefaultAutoplaySetting" enum="ContentSetting" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>engedy@chromium.org</owner> <owner>src/components/permissions/PERMISSIONS_OWNERS</owner> <summary>The default autoplay setting at profile open.</summary>
diff --git a/tools/metrics/histograms/histograms_xml/cookie/histograms.xml b/tools/metrics/histograms/histograms_xml/cookie/histograms.xml index 263c2541..75370d2 100644 --- a/tools/metrics/histograms/histograms_xml/cookie/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/cookie/histograms.xml
@@ -54,7 +54,7 @@ </histogram> <histogram name="Cookie.CookiePrefix" enum="CookiePrefix" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>estark@chromium.org</owner> <summary> Number of times a cookie was set with a name prefixed by @@ -89,7 +89,7 @@ </histogram> <histogram name="Cookie.CookieSourceScheme" enum="CookieSourceScheme" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>estark@chromium.org</owner> <summary> For each cookie added to the store, record whether its source URL has a
diff --git a/tools/metrics/histograms/histograms_xml/cros/histograms.xml b/tools/metrics/histograms/histograms_xml/cros/histograms.xml index 84cb5659..3ef3105 100644 --- a/tools/metrics/histograms/histograms_xml/cros/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/cros/histograms.xml
@@ -93,7 +93,7 @@ </histogram> <histogram name="CrosDisksClient.FormatTime" units="ms" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>austinct@chromium.org</owner> <summary> Time taken for the Chrome OS cros-disks daemon to perform a format
diff --git a/tools/metrics/histograms/histograms_xml/cryptohome/histograms.xml b/tools/metrics/histograms/histograms_xml/cryptohome/histograms.xml index 26fbe40..ba41a2f 100644 --- a/tools/metrics/histograms/histograms_xml/cryptohome/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/cryptohome/histograms.xml
@@ -471,7 +471,7 @@ </histogram> <histogram name="Cryptohome.TimeToInitPkcs11" units="ms" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>apronin@chromium.org</owner> <owner>cros-hwsec+uma@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/data_reduction_proxy/histograms.xml b/tools/metrics/histograms/histograms_xml/data_reduction_proxy/histograms.xml index c54d49f..cf52f7a 100644 --- a/tools/metrics/histograms/histograms_xml/data_reduction_proxy/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/data_reduction_proxy/histograms.xml
@@ -280,7 +280,7 @@ </histogram> <histogram name="DataReductionProxy.LastWeekAggregateKB.Services" - enum="DataUseServicesHash" expires_after="2021-08-22"> + enum="DataUseServicesHash" expires_after="2021-10-24"> <owner>rajendrant@chromium.org</owner> <owner>bengr@chromium.org</owner> <summary> @@ -295,7 +295,7 @@ <histogram name="DataReductionProxy.LastWeekAggregateKB.UserTraffic.Downstream.ContentType" - enum="DataUseContentType" expires_after="2021-08-22"> + enum="DataUseContentType" expires_after="2021-10-24"> <owner>rajendrant@chromium.org</owner> <owner>bengr@chromium.org</owner> <summary> @@ -397,7 +397,7 @@ </histogram> <histogram name="DataReductionProxy.ThisWeekAggregateKB.Services" - enum="DataUseServicesHash" expires_after="2021-08-22"> + enum="DataUseServicesHash" expires_after="2021-10-24"> <owner>rajendrant@chromium.org</owner> <owner>mcrouse@chromium.org</owner> <summary> @@ -412,7 +412,7 @@ <histogram name="DataReductionProxy.ThisWeekAggregateKB.UserTraffic.Downstream.ContentType" - enum="DataUseContentType" expires_after="2021-08-22"> + enum="DataUseContentType" expires_after="2021-10-24"> <owner>rajendrant@chromium.org</owner> <owner>mcrouse@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/login/histograms.xml b/tools/metrics/histograms/histograms_xml/login/histograms.xml index 8ce5de1..76ce14a 100644 --- a/tools/metrics/histograms/histograms_xml/login/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/login/histograms.xml
@@ -226,7 +226,7 @@ </histogram> <histogram name="Login.SessionExitType" enum="LoginSessionExitType" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>iby@chromium.org</owner> <summary> Tracks whether a ChromeOS user was logged out because Chrome repeatedly
diff --git a/tools/metrics/histograms/histograms_xml/media/histograms.xml b/tools/metrics/histograms/histograms_xml/media/histograms.xml index 5b2277d1..2a962f01 100644 --- a/tools/metrics/histograms/histograms_xml/media/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/media/histograms.xml
@@ -2543,7 +2543,7 @@ </histogram> <histogram name="Media.MeanTimeBetweenRebuffers" units="ms" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>dalecurtis@chromium.org</owner> <summary> The total watch time (see Media.WatchTime) of a given playback divided by @@ -3051,7 +3051,7 @@ </histogram> <histogram name="Media.PipelineStatus" enum="PipelineStatus" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>prabhur@chromium.org</owner> <owner>dalecurtis@chromium.org</owner> <summary> @@ -4580,7 +4580,7 @@ </summary> </histogram> -<histogram name="Media.WatchTime" units="ms" expires_after="2021-08-22"> +<histogram name="Media.WatchTime" units="ms" expires_after="2021-10-24"> <owner>dalecurtis@chromium.org</owner> <summary> Watch time is defined as the amount of elapsed media time for audio+video
diff --git a/tools/metrics/histograms/histograms_xml/memory/histograms.xml b/tools/metrics/histograms/histograms_xml/memory/histograms.xml index ba93917..9368f5d 100644 --- a/tools/metrics/histograms/histograms_xml/memory/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/memory/histograms.xml
@@ -1230,7 +1230,7 @@ <histogram name="Memory.Experimental.UserLevelMemoryPressureSignal.RendererPrivateMemoryFootprintBefore" - units="MB" expires_after="2021-08-22"> + units="MB" expires_after="2021-10-24"> <owner>keishi@chromium.org</owner> <owner>tasak@chromium.org</owner> <summary> @@ -2331,7 +2331,7 @@ </histogram> <histogram name="Memory.PressureLevel" enum="MemoryPressureLevel" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>chrisha@chromium.org</owner> <summary> The memory pressure level, which is recorded periodically. This shows the @@ -2496,7 +2496,7 @@ </histogram> <histogram name="Memory.RenderProcessHost.Count.InitializedAndNotDead" - units="processes" expires_after="2021-08-22"> + units="processes" expires_after="2021-10-24"> <owner>alexmos@chromium.org</owner> <owner>creis@chromium.org</owner> <owner>lukasza@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/mobile/histograms.xml b/tools/metrics/histograms/histograms_xml/mobile/histograms.xml index e03f5cd..668accc 100644 --- a/tools/metrics/histograms/histograms_xml/mobile/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/mobile/histograms.xml
@@ -875,7 +875,7 @@ </histogram> <histogram name="MobileFre.Progress" enum="MobileFreProgress" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>bsazonov@chromium.org</owner> <owner>msarda@chromium.org</owner> <owner>droger@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/nearby/histograms.xml b/tools/metrics/histograms/histograms_xml/nearby/histograms.xml index bc09fe87..54df4d6 100644 --- a/tools/metrics/histograms/histograms_xml/nearby/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/nearby/histograms.xml
@@ -111,6 +111,19 @@ </histogram> <histogram + name="Nearby.Connections.InstantMessaging.ReceiveExpress.NumParsingAttempts" + units="attempts" expires_after="2021-08-19"> + <owner>julietlevesque@chromium.org</owner> + <owner>nearby-share-chromeos-eng@google.com</owner> + <summary> + Records the number of parsing attempts it takes the stream parser to check + byte by byte if the data it received forms a valid StreamBody proto. Emitted + every time we get a receive-express HTTP response from the Instant Messaging + API. + </summary> +</histogram> + +<histogram name="Nearby.Connections.InstantMessaging.{Direction}Express.OAuthTokenFetchResult" enum="BooleanSuccess" expires_after="2021-08-19"> <owner>nohle@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/others/histograms.xml b/tools/metrics/histograms/histograms_xml/others/histograms.xml index 9fa7ac0..4f2864e2 100644 --- a/tools/metrics/histograms/histograms_xml/others/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/others/histograms.xml
@@ -3334,7 +3334,7 @@ </histogram> <histogram name="ContextMenu.Shown" enum="BooleanPresent" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>mpearson@chromium.org</owner> <summary> Recorded when a context menu is shown, sliced by whether a web contents was @@ -7265,7 +7265,7 @@ </histogram> <histogram base="true" name="Hwsec.Attestation.Status" - enum="HwsecAttestationOpsStatus" expires_after="2021-08-22"> + enum="HwsecAttestationOpsStatus" expires_after="2021-10-24"> <!-- Name completed by histogram_suffixes name="AttestationOps" --> <owner>garryxiao@chromium.org</owner> @@ -7643,7 +7643,7 @@ </histogram> <histogram name="InProductHelp.Config.ParsingEvent" enum="ConfigParsingEvent" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>nyquist@chromium.org</owner> <owner>xingliu@chromium.org</owner> <summary> @@ -7653,7 +7653,7 @@ </histogram> <histogram base="true" name="InProductHelp.Db.Init" enum="BooleanSuccess" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>nyquist@chromium.org</owner> <owner>xingliu@chromium.org</owner> <!-- Name completed by histogram_suffixes name="IPHDatabase" --> @@ -7675,7 +7675,7 @@ </histogram> <histogram name="InProductHelp.Db.TotalEvents" units="events" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>nyquist@chromium.org</owner> <owner>xingliu@chromium.org</owner> <summary> @@ -7685,7 +7685,7 @@ </histogram> <histogram base="true" name="InProductHelp.Db.Update" enum="BooleanSuccess" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>nyquist@chromium.org</owner> <owner>xingliu@chromium.org</owner> <!-- Name completed by histogram_suffixes name="IPHDatabase" --> @@ -7770,7 +7770,7 @@ </histogram> <histogram name="InProductHelp.ShouldTriggerHelpUI" enum="TriggerHelpUIResult" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>nyquist@chromium.org</owner> <owner>xingliu@chromium.org</owner> <!-- Name completed by histogram_suffixes name="IPHFeatures" --> @@ -8668,7 +8668,7 @@ <histogram name="Lens.ImageClassification.ClassificationTime.SuccessOnQueryResultMs" - units="ms" expires_after="2021-08-22"> + units="ms" expires_after="2021-10-24"> <owner>yusuyoutube@google.com</owner> <owner>benwgold@google.com</owner> <summary> @@ -9061,7 +9061,7 @@ </histogram> <histogram name="MachineLearningService.CpuUsageMilliPercent" - units="1/1000ths of %" expires_after="2021-08-22"> + units="1/1000ths of %" expires_after="2021-10-24"> <owner>alanlxl@chromium.org</owner> <owner>amoylan@chromium.org</owner> <summary> @@ -9166,7 +9166,7 @@ </histogram> <histogram name="MachineLearningService.PeakTotalMemoryKb" units="KB" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>alanlxl@chromium.org</owner> <owner>amoylan@chromium.org</owner> <owner>honglinyu@chromium.org</owner> @@ -9187,7 +9187,7 @@ </histogram> <histogram name="MachineLearningService.TotalMemoryKb" units="KB" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>alanlxl@chromium.org</owner> <owner>amoylan@chromium.org</owner> <owner>honglinyu@chromium.org</owner> @@ -9762,7 +9762,7 @@ </histogram> <histogram name="Mojo.Connector.MaxUnreadMessageQuotaUsed" units="messages" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>siggi@chromium.org</owner> <owner>rockot@chromium.org</owner> <summary> @@ -9866,7 +9866,7 @@ </histogram> <histogram name="MPArch.ChildProcessLaunchFirst" units="units" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>ppi@chromium.org</owner> <summary> The time it takes to spawn the first child subprocess (including sandbox @@ -16574,7 +16574,7 @@ </histogram> <histogram name="TouchBar.Default.Metrics" enum="DefaultTouchBarActions" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>ellyjones@chromium.org</owner> <owner>chrome-mac-dev@google.com</owner> <summary>Tracks the usage of the default touch bar buttons.</summary> @@ -17716,7 +17716,7 @@ </histogram> <histogram name="VoiceInteraction.VoiceResultConfidenceValue" units="%" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>wylieb@chromium.org</owner> <owner>tedchoc@chromium.org</owner> <owner>yusufo@chromium.org</owner> @@ -18106,7 +18106,7 @@ </histogram> <histogram name="WebApp.Preinstalled.EnabledCount" units="apps" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>alancutter@chromium.org</owner> <owner>desktop-pwas-team@google.com</owner> <summary> @@ -19042,7 +19042,7 @@ </histogram> <histogram name="WrenchMenu.TimeToAction" units="units" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>ainslie@chromium.org</owner> <owner>edwardjung@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/password/histograms.xml b/tools/metrics/histograms/histograms_xml/password/histograms.xml index bb0c65a..9d13b97a 100644 --- a/tools/metrics/histograms/histograms_xml/password/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/password/histograms.xml
@@ -164,7 +164,7 @@ </histogram> <histogram name="PasswordManager.AcceptedSaveUpdateSubmissionIndicatorEvent" - enum="SubmissionIndicatorEvent" expires_after="2021-08-22"> + enum="SubmissionIndicatorEvent" expires_after="2021-10-24"> <owner>jdoerrie@chromium.org</owner> <owner>vasilii@chromium.org</owner> <summary> @@ -2100,7 +2100,7 @@ </histogram> <histogram name="PasswordManager.StoresUsedForFillingInLast28Days" - enum="PasswordManagerFillingSource" expires_after="2021-08-22"> + enum="PasswordManagerFillingSource" expires_after="2021-10-24"> <owner>mamir@chromium.org</owner> <owner>treib@chromium.org</owner> <summary> @@ -2167,7 +2167,7 @@ </histogram> <histogram name="PasswordManager.SuccessfulSubmissionIndicatorEvent" - enum="SubmissionIndicatorEvent" expires_after="2021-08-22"> + enum="SubmissionIndicatorEvent" expires_after="2021-10-24"> <owner>jdoerrie@chromium.org</owner> <owner>vasilii@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/platform/histograms.xml b/tools/metrics/histograms/histograms_xml/platform/histograms.xml index da2aa9e6..86f4980 100644 --- a/tools/metrics/histograms/histograms_xml/platform/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/platform/histograms.xml
@@ -593,7 +593,7 @@ </summary> </histogram> -<histogram name="Platform.Meminfo" units="KB" expires_after="2021-10-17"> +<histogram name="Platform.Meminfo" units="KB" expires_after="2021-10-24"> <owner>hajimehoshi@chromium.org</owner> <owner>kouhei@chromium.org</owner> <owner>sonnyrao@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/power/histograms.xml b/tools/metrics/histograms/histograms_xml/power/histograms.xml index be0d295..7eebea8 100644 --- a/tools/metrics/histograms/histograms_xml/power/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/power/histograms.xml
@@ -842,7 +842,7 @@ </histogram> <histogram name="Power.Mac.AppleSMCOpened" enum="BooleanSuccess" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>lgrey@chromium.org</owner> <summary> When metrics collection started, records true if a handle to the System @@ -1111,7 +1111,7 @@ </histogram> <histogram name="PowerML.DimImminent.Action" enum="PowerMLDimImminentAction" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>napper@chromium.org</owner> <owner>thanhdng@chromium.org</owner> <summary> @@ -1121,7 +1121,7 @@ </histogram> <histogram name="PowerML.ModelDim.Result" enum="PowerMLFinalResult" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>napper@chromium.org</owner> <owner>thanhdng@chromium.org</owner> <summary> @@ -1195,7 +1195,7 @@ </histogram> <histogram name="PowerML.SmartDimModel.RequestCanceledDuration" units="ms" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>amoylan@chromium.org</owner> <owner>napper@chromium.org</owner> <owner>napper@chromium.org</owner> @@ -1207,7 +1207,7 @@ </histogram> <histogram name="PowerML.SmartDimModel.RequestCompleteDuration" units="ms" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>amoylan@chromium.org</owner> <owner>napper@chromium.org</owner> <owner>napper@chromium.org</owner> @@ -1232,7 +1232,7 @@ </histogram> <histogram name="PowerML.SmartDimParameter.Result" - enum="PowerMLSmartDimParameterResult" expires_after="2021-08-22"> + enum="PowerMLSmartDimParameterResult" expires_after="2021-10-24"> <owner>napper@chromium.org</owner> <owner>thanhdng@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/search/histograms.xml b/tools/metrics/histograms/histograms_xml/search/histograms.xml index babfe93..d12f5a1 100644 --- a/tools/metrics/histograms/histograms_xml/search/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/search/histograms.xml
@@ -273,7 +273,7 @@ </histogram> <histogram name="Search.ContextualSearch.TranslationsOptInIPHShown" - enum="BooleanPreviouslyShown" expires_after="2021-08-22"> + enum="BooleanPreviouslyShown" expires_after="2021-10-24"> <owner>donnd@chromium.org</owner> <owner>contextual-search-eng@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/service/histograms.xml b/tools/metrics/histograms/histograms_xml/service/histograms.xml index b9dbca21..bb1d4a6 100644 --- a/tools/metrics/histograms/histograms_xml/service/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/service/histograms.xml
@@ -322,7 +322,7 @@ </histogram> <histogram name="ServiceWorker.FetchEvent.MainResource.Status" - enum="ServiceWorkerStatusCode" expires_after="2021-08-22"> + enum="ServiceWorkerStatusCode" expires_after="2021-10-24"> <owner>falken@chromium.org</owner> <owner>chrome-worker@google.com</owner> <summary> @@ -345,7 +345,7 @@ </histogram> <histogram name="ServiceWorker.FetchEvent.Subresource.Status" - enum="ServiceWorkerStatusCode" expires_after="2021-08-22"> + enum="ServiceWorkerStatusCode" expires_after="2021-10-24"> <owner>falken@chromium.org</owner> <owner>chrome-worker@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/subresource/histograms.xml b/tools/metrics/histograms/histograms_xml/subresource/histograms.xml index 22c81baf..d10a000e 100644 --- a/tools/metrics/histograms/histograms_xml/subresource/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/subresource/histograms.xml
@@ -22,7 +22,7 @@ <histograms> <histogram name="SubresourceFilter.Actions2" enum="SubresourceFilterActions2" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>alexmt@chromium.org</owner> <owner>chrome-ads-histograms@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/sync/histograms.xml b/tools/metrics/histograms/histograms_xml/sync/histograms.xml index 1da070d..f0372b1 100644 --- a/tools/metrics/histograms/histograms_xml/sync/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/sync/histograms.xml
@@ -25,6 +25,7 @@ expires_after="2021-09-01"> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Tracks sync backend initialization time during initial sync setup. </summary> @@ -34,6 +35,7 @@ expires_after="2021-09-01"> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Tracks sync backend initialization success rate during initial sync setup. </summary> @@ -43,6 +45,7 @@ expires_after="2021-09-01"> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Tracks sync backend initialization success rate in cases where sync was previously initialized. @@ -53,6 +56,7 @@ expires_after="2021-09-01"> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Tracks sync backend initialization time in cases where sync was previously initialized. @@ -63,6 +67,7 @@ enum="Boolean" expires_after="M92"> <owner>mastiz@chromium.org</owner> <owner>rushans@google.com</owner> + <component>Services>Sync</component> <summary> Records if the entity is marked to be reuploaded. It is recorded on each incoming bookmark update from the server during {UpdateType}. @@ -77,6 +82,7 @@ expires_after="2021-09-12"> <owner>rushans@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Records whether a GUID was found within BookmarkSpecifics, if an originator_client_item_id of valid GUID format was used to replace it, or if @@ -93,6 +99,7 @@ </obsolete> <owner>mamir@chromium.org</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Represents whether the proto field client_tag_hash in locally persisted sync metadata is present and matches the local bookmark's GUID. It's recorded @@ -104,6 +111,7 @@ expires_after="2021-08-22"> <owner>mastiz@chromium.org</owner> <owner>rushans@google.com</owner> + <component>Services>Sync</component> <summary> Records different types of bookmark entities having the same GUIDs. It's recorded on each found duplicate when processing remote bookmarks from the @@ -115,6 +123,7 @@ enum="SyncBookmarkModelMetadataCorruptionReason" expires_after="2021-10-10"> <owner>rushans@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> The reason why the persisted metadata for a bookmark model is considered corrupted. It either has corrupted data or doesn't match the bookmark model. @@ -130,6 +139,7 @@ </obsolete> <owner>rushans@google.com</owner> <owner>mastiz@chromiumg.org</owner> + <component>Services>Sync</component> <summary> Number of remote bookmarks which don't have full title in specifics. Recorded when processing an initial merge. @@ -143,6 +153,7 @@ </obsolete> <owner>rushans@google.com</owner> <owner>mastiz@chromiumg.org</owner> + <component>Services>Sync</component> <summary> Number of remote bookmarks which don't have full title in specifics. Recorded when processing a remote bookmark update. @@ -155,6 +166,7 @@ <owner>rushans@google.com</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Emitted per network Commit() request to the sync server and datatype. Records the outcome of each commit attempt per data type (success or one of @@ -165,6 +177,7 @@ <histogram name="Sync.ConfigureDataTypeManagerOption" enum="SyncFeatureOrTransport" expires_after="2021-09-12"> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Whether the full Sync feature or only the Sync transport layer is being configured. Recorded when configuring the data types for any reason: Most @@ -178,6 +191,7 @@ expires_after="2021-10-10"> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Breakdown of sync data types being configured at first time signin, restart, or user-initiated reconfiguration. This is different from Sync.CustomTypes @@ -196,6 +210,7 @@ </obsolete> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary>Count of model association failures for each type.</summary> </histogram> @@ -203,6 +218,7 @@ expires_after="2021-08-09"> <owner>victorvianna@google.com</owner> <owner>jkrcal@chromium.org</owner> + <component>Services>Sync</component> <summary> Time spent configuring data types for the first sync. Recorded when DataTypeManagerImpl finishes. @@ -213,6 +229,7 @@ expires_after="2021-10-10"> <owner>victorvianna@google.com</owner> <owner>jkrcal@chromium.org</owner> + <component>Services>Sync</component> <summary> Time spent configuring data types for a subsequent (i.e. non-first) sync. Recorded when DataTypeManagerImpl finishes. @@ -225,6 +242,7 @@ Expired in M77. </obsolete> <owner>zea@chromium.org</owner> + <component>Services>Sync</component> <summary> Whether the gaia cookie jar was empty. Recorded on every SESSIONS commit where the gaia cookie jar does not include the signed in user ( @@ -238,6 +256,7 @@ Expired in M77. </obsolete> <owner>zea@chromium.org</owner> + <component>Services>Sync</component> <summary> Whether the gaia cookie jar included the signed in user (matched) or not. Recorded on every SESSIONS commit. @@ -250,6 +269,7 @@ expires_after="2021-08-09"> <owner>vitaliii@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Key derivation method used for sync custom passphrase when a new custom passphrase is set. "Not set" will never be reported for this @@ -264,6 +284,7 @@ expires_after="2021-10-04"> <owner>vitaliii@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Key derivation method used for sync custom passphrase on successful decryption of pending keys, i.e. when a passphrase is requested and the user @@ -278,6 +299,7 @@ expires_after="2021-08-09"> <owner>vitaliii@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> State of the derivation method used for sync custom passphrase on startup. Reported only when the passphrase type is CUSTOM_PASSPHRASE. @@ -288,6 +310,7 @@ units="ms" expires_after="2021-08-09"> <owner>vitaliii@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Time taken to derive keys in Nigori using a given key derivation method. This histogram is always recorded with one of the key derivation method @@ -299,6 +322,7 @@ enum="SyncCryptographerPendingKeysState" expires_after="2021-10-04"> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Breakdown of sync users whose cryptographer has pending keys. </summary> @@ -308,6 +332,7 @@ expires_after="2022-03-07"> <owner>mmoskvitin@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Breakdown of sync users whose cryptographer is fully ready for encryption and decryption (initialized and no pending keys). @@ -318,6 +343,7 @@ expires_after="2022-01-03"> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Histogram that keeps track of how users encrypt their sync data. All users start off with default encryption during initial setup, while a subset of @@ -332,6 +358,7 @@ </obsolete> <owner>treib@chromium.org</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> For users who have *not* selected the "Sync Everything" option, this records all the data types they have selected to sync. Samples are @@ -344,6 +371,7 @@ expires_after="2021-12-16"> <owner>treib@chromium.org</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> For users who have *not* selected the "Sync Everything" option, this records all the data types they have selected to sync. Samples are @@ -360,6 +388,7 @@ expires_after="2021-10-17"> <owner>jkrcal@chromium.org</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Histogram of the run failures for the different sync datatypes. These are failures that occur after startup while the datatype is syncing. This is one @@ -371,6 +400,7 @@ expires_after="2021-10-17"> <owner>jkrcal@chromium.org</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Histogram of the startup failures for the different sync datatypes. These are failures that occur during startup before the data type is fully loaded. @@ -387,6 +417,7 @@ <owner>mastiz@chromium.org</owner> <owner>jkrcal@chromium.org</owner> <owner>chrome-metrics-team@google.com</owner> + <component>Services>Sync</component> <summary> The largest number of active and concurrently syncing devices known to any profile. May be 0 when there are no signed in/syncing profiles open. Logged @@ -402,6 +433,7 @@ </obsolete> <owner>rushans@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Counts the number of cases when there are duplicate sync entities while processing remote update. It is introduced to detect cases when one of those @@ -413,6 +445,7 @@ <histogram base="true" name="Sync.E2ELatency" units="ms" expires_after="M94"> <owner>mastiz@chromium.org</owner> <owner>melandory@chromium.org</owner> + <component>Services>Sync</component> <summary> Recorded for a subset of users (Finch-controlled) per sync reflection, that is, server-side updates that represent a local change. The time represents @@ -430,6 +463,7 @@ </obsolete> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary>A UI event occured.</summary> </histogram> @@ -437,6 +471,7 @@ expires_after="2021-10-10"> <owner>treib@chromium.org</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> An approximate state of sync at startup. Logs a few reasons sync definitely wouldn't be able to start, or that it probably can start. The user having @@ -453,6 +488,7 @@ <owner>melandory@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Histogram tracks the number of invalidations received per sync data type. </summary> @@ -462,6 +498,7 @@ enum="InvalidBookmarkSpecificsError" expires_after="2021-10-01"> <owner>mastiz@chromium.org</owner> <owner>rushans@google.com</owner> + <component>Services>Sync</component> <summary> Records different causes for BookmarkSpecifics to be deemed invalid. Issues are recorded upon verifying validity of specifics received from the server. @@ -472,6 +509,7 @@ enum="SyncKeystoreDecryptionFailure" expires_after="2021-08-15"> <owner>mmoskvitin@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> The reason for a failure decrypting the keystore decryptor token. </summary> @@ -480,6 +518,7 @@ <histogram name="Sync.Local.Enabled" enum="BooleanEnabled" expires_after="2021-10-04"> <owner>pastarmovj@chromium.org</owner> + <component>Services>Sync</component> <summary> Tracks the number of times the local sync backend was enabled by the user. </summary> @@ -487,6 +526,7 @@ <histogram name="Sync.Local.FileSizeKB" units="KB" expires_after="2021-05-31"> <owner>pastarmovj@chromium.org</owner> + <component>Services>Sync</component> <summary> Tracks the size of the local sync backend database file. Recorded every time the roaming profile file is written by the client. @@ -497,6 +537,7 @@ expires_after="2021-11-30"> <owner>pastarmovj@chromium.org</owner> <owner>igorruvinov@chromium.org</owner> + <component>Services>Sync</component> <summary> Error code describing failure to read persisted sync state from local file. Recorded when an error is encountered during opening or reading of the local @@ -507,6 +548,7 @@ <histogram name="Sync.Local.RequestTypeOnError" enum="SyncRequestType" expires_after="2021-05-31"> <owner>pastarmovj@chromium.org</owner> + <component>Services>Sync</component> <summary> Tracks the types of requests that caused errors inside of the local server. </summary> @@ -515,6 +557,7 @@ <histogram name="Sync.Local.RoamingProfileUnavailable" enum="BooleanError" expires_after="2021-05-31"> <owner>pastarmovj@chromium.org</owner> + <component>Services>Sync</component> <summary> Tracks the number of times the Roaming profile cannot be retrieved. </summary> @@ -524,6 +567,7 @@ enum="LocalSyncTransportDataStartupState" expires_after="2021-09-19"> <owner>rushans@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Counts cases when data in sync preferences is invalid. Recorded during sync startup of the Sync transport layer. It happens soon after a signed-in @@ -538,6 +582,7 @@ </obsolete> <owner>mamir@chromium.org</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Recorded after applying the first sync merge for Bookmarks in case of merge failure. Merge failure is detected by missing one or more permanent nodes in @@ -550,6 +595,7 @@ enum="SyncModelTypes" expires_after="2021-10-10"> <owner>victorvianna@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Recorded on every GetUpdatesResponse if the data type is blocked because due to the existence of undecryptable updates sent by the server. This is *not* @@ -564,6 +610,7 @@ <owner>mastiz@chromium.org</owner> <owner>mmoskvitin@google.com</owner> <owner>victorvianna@google.com</owner> + <component>Services>Sync</component> <summary> See Sync.ModelTypeBlockedDueToUndecryptableUpdate. This records the subset of samples of that histogram where at least some of the blocking updates @@ -580,6 +627,7 @@ units="ms" expires_after="2021-08-29"> <owner>jkrcal@chromium.org</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Recorded once per activation of an ephemeral (in-memory) data type; the value is the duration of the setup (time from the start of the configuration @@ -593,6 +641,7 @@ units="ms" expires_after="2021-10-04"> <owner>jkrcal@chromium.org</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Recorded once per activation of a persistent (on-disk) data type; the value is the duration of the setup (time from the start of the configuration of @@ -606,6 +655,7 @@ expires_after="2021-10-17"> <owner>jkrcal@chromium.org</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Counts the number of entries for each model type. For directory types, the count is based on the directory contents (excl. the root node), for USS @@ -618,6 +668,7 @@ <histogram base="true" name="Sync.ModelTypeEntityChange3" enum="SyncEntityChange" expires_after="2021-10-17"> <owner>jkrcal@chromium.org</owner> + <component>Services>Sync</component> <summary> Recorded once for every sync entity change (whenever it is commited to the server or updated from the server). This metric is used for monitoring @@ -632,6 +683,7 @@ <owner>jkrcal@chromium.org</owner> <owner>rushans@google.com</owner> + <component>Services>Sync</component> <summary> Recorded whenever ClientTagBasedModelTypeProcessor triggers a data type failure (recorded for both Start and Run failures). It distinguishes call @@ -643,6 +695,7 @@ expires_after="2021-05-31"> <owner>rushans@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Counts the number of incremental sync updates received by the processor, per datatype. Logged in the model thread prior to any filtering, and includes @@ -654,6 +707,7 @@ expires_after="2021-05-31"> <owner>rushans@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Counts the number of initial sync updates received by the processor, per datatype. Logged in the model thread prior to any filtering. @@ -664,6 +718,7 @@ expires_after="2021-09-05"> <owner>mastiz@chromium.org</owner> <owner>jkrcal@chromium.org</owner> + <component>Services>Sync</component> <summary> Estimated memory usage by sync datatype in kilobytes. Recorded after sync configuration. This metric is used for monitoring general health of sync @@ -675,6 +730,7 @@ enum="SyncModelTypes" expires_after="2021-09-05"> <owner>jkrcal@chromium.org</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Records whenever an orphan metadata is encountered by the ClientTagBasedModelTypeProcessor. @@ -689,6 +745,7 @@ <owner>ortuno@chromium.org</owner> <owner>treib@chromium.org</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Record the LevelDB Status outcome for ModelTypeStore CommitWriteBatch operations. @@ -699,6 +756,7 @@ units="GetUpdatesResponses" expires_after="2021-10-06"> <owner>victorvianna@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Records how long it took from the moment the first update encrypted with this key was received by ModelTypeWorker, to the moment where the key was @@ -716,6 +774,7 @@ </obsolete> <owner>victorvianna@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> See ModelTypeTimeUntilEncryptionKeyFound. This version serves only to visualize M88 data, since the recording code for that version contains a @@ -731,6 +790,7 @@ </obsolete> <owner>victorvianna@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> See ModelTypeTimeUntilEncryptionKeyFound. This version serves only to visualize M88 data, since the recording code for that version contains a @@ -746,6 +806,7 @@ </obsolete> <owner>victorvianna@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> See ModelTypeTimeUntilEncryptionKeyFound. This version serves only to visualize M88 data, since the recording code for that version contains a @@ -757,6 +818,7 @@ units="SyncEntity" expires_after="2021-10-06"> <owner>victorvianna@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Records the number of entities dropped when the data type decided that a certain encryption key was lost and dropped all pending updates encrypted @@ -771,6 +833,7 @@ <owner>jkrcal@chromium.org</owner> <owner>rushans@google.com</owner> + <component>Services>Sync</component> <summary> Recorded whenever a remote update for a particular data type gets dropped for the following reason: @@ -781,6 +844,7 @@ expires_after="2021-10-17"> <owner>mastiz@chromium.org</owner> <owner>melandory@chromium.org</owner> + <component>Services>Sync</component> <summary> Freshness of the sync data per received sync entity update, excluding reflections. The time represents the clock difference from the model being @@ -794,6 +858,7 @@ expires_after="2021-08-22"> <owner>treib@chromium.org</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary>The active sync passphrase type at sync startup.</summary> </histogram> @@ -803,6 +868,7 @@ <owner>mmoskvitin@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary>Sync passphrase type collected at each metrics upload.</summary> </histogram> @@ -813,6 +879,7 @@ </obsolete> <owner>tschumann@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Number of times the Sync engine got stopped because of an account state change, e.g. the user signed out of the web. This should only affect the @@ -830,6 +897,7 @@ </obsolete> <owner>tschumann@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Number of times the Sync engine got stopped because of changed credentials. Today this should not happen (but we have plans to use this path for @@ -846,6 +914,7 @@ </obsolete> <owner>tschumann@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Number of times the Sync engine got stopped because of a change in the managed-sync pref (enterprise configuration). The histogram is emitted by @@ -861,6 +930,7 @@ </obsolete> <owner>tschumann@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Number of times the Sync engine got stopped because of an enterprise policy or the user not being signed in. The histogram is emitted by minute of the @@ -876,6 +946,7 @@ </obsolete> <owner>mastiz@chromium.org</owner> <owner>mamir@chromium.org</owner> + <component>Services>Sync</component> <summary> Emitted when the model type id in the persisted sync metadata mismatches the model type id expected by the processor. It's recorded upon loading the @@ -886,6 +957,7 @@ <histogram name="Sync.PostedClientToServerMessage" enum="SyncClientToServerMessageContents" expires_after="2021-10-10"> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Number of network requests issued by sync to the sync server, grouped by content type. @@ -899,6 +971,7 @@ </obsolete> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> WARNING: Some buckets in this histogram are not recorded due to a bug (crbug.com/1004302), see Sync.PostedClientToServerMessageError2 instead. @@ -913,6 +986,7 @@ expires_after="2021-12-14"> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> A sync error code received from the sync server as a result of a client-initiated request. Note that this excludes network errors (e.g. @@ -923,6 +997,7 @@ <histogram name="Sync.PostedClientToServerMessageLatency" units="ms" expires_after="2021-09-05"> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Time taken for a client-initiated request to be sent over the network and receive the response from the sync server. @@ -933,6 +1008,7 @@ expires_after="2021-09-12"> <owner>mastiz@chromium.org</owner> <owner>jkrcal@chromium.org</owner> + <component>Services>Sync</component> <summary> Emitted per network Commit() request to the sync server and datatype. It helps estimate how much load each datatype puts on the server. Note that the @@ -946,6 +1022,7 @@ expires_after="2021-09-12"> <owner>mastiz@chromium.org</owner> <owner>jkrcal@chromium.org</owner> + <component>Services>Sync</component> <summary> Emitted per network GetUpdates() request to the sync server and datatype. It represents how much load each datatype puts on the server. Note that the sum @@ -959,6 +1036,7 @@ expires_after="2021-09-05"> <owner>mastiz@chromium.org</owner> <owner>jkrcal@chromium.org</owner> + <component>Services>Sync</component> <summary> Emitted per network GetUpdates() request to the sync server, it represents the reason for sending such GetUpdates() request. @@ -972,6 +1050,7 @@ </obsolete> <owner>tschumann@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Counts the number of times a syncable pref got registered using a type that mismatched the type present in the pref store. In these events, the @@ -983,6 +1062,7 @@ enum="RemoteBookmarkUpdateError" expires_after="2021-08-22"> <owner>mastiz@chromium.org</owner> <owner>rushans@google.com</owner> + <component>Services>Sync</component> <summary> Records different issues encountered when processing incremental bookmark updates from the sync server. @@ -993,6 +1073,7 @@ enum="RemoteBookmarkUpdateError" expires_after="2021-08-22"> <owner>mastiz@chromium.org</owner> <owner>rushans@google.com</owner> + <component>Services>Sync</component> <summary> Records different issues encountered when processing remote bookmarks from the sync server during the initial merge procedure. @@ -1003,6 +1084,7 @@ expires_after="2021-09-30"> <owner>mmoskvitin@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> For every user event that is recorded, this histogram records the type of event (i.e. which of the "oneof event" entries in the @@ -1017,6 +1099,7 @@ </obsolete> <owner>melandory@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> WARNING: The recordings here are incorrect (crbug.com/1158476), see Sync.RedundantInvalidationPerModelType2 instead. @@ -1029,6 +1112,7 @@ expires_after="2021-12-16"> <owner>melandory@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Recorded whenever Sync receives an invalidation with a non-fresh version, i.e. a smaller version number than Sync already knew about. The recorded @@ -1042,6 +1126,7 @@ </obsolete> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> For each Chrome window, records the number of tabs present at the time Sync associates the SESSIONS datatype. @@ -1052,6 +1137,7 @@ enum="SyncSharingMessageCommitErrorCode" expires_after="2021-10-10"> <owner>rushans@google.com</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Counts the number of commit results while committing sharing message. </summary> @@ -1061,6 +1147,7 @@ enum="SyncDeferredInitTrigger" expires_after="2021-10-17"> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary>The type of event that triggered sync initialization.</summary> </histogram> @@ -1068,6 +1155,7 @@ expires_after="2021-11-01"> <owner>ydago@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> The time spent waiting for policies to load before starting the sync engine. </summary> @@ -1081,6 +1169,7 @@ </obsolete> <owner>ydago@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Use Sync.Startup.PolicyLoadTimeout2 to Records the sync engine timed out while waiting for policy load before starting. In case of a timeout, the @@ -1094,6 +1183,7 @@ expires_after="2021-11-01"> <owner>ydago@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Records if the policy load delay before starting the sync engine was timed out. In case of a timeout, the sync engine attempts to start ignoring @@ -1105,6 +1195,7 @@ expires_after="2021-12-16"> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Recorded on browser startup if the SyncEngine initialization is deferred by a fixed (configurable) delay due to performance reasons. In some cases, a @@ -1118,6 +1209,7 @@ expires_after="2021-08-15"> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary>Data type that first requests sync initialization.</summary> </histogram> @@ -1125,6 +1217,7 @@ expires_after="2021-09-12"> <owner>treib@chromium.org</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Tracks how sync was turned off. Logged every time sync is told to stop permanently by the user (e.g. it won't come back on by itself). @@ -1135,6 +1228,7 @@ enum="FaviconAvailabilityStatus" expires_after="2021-07-10"> <owner>victorvianna@google.com</owner> <owner>jkrcal@chromium.org</owner> + <component>Services>Sync</component> <summary> Records the availability status (local, sync or non-available) for favicons associated with synced history entries. Recorded when one of the following @@ -1149,6 +1243,7 @@ expires_after="2021-07-10"> <owner>jkrcal@chromium.org</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Records the latency of loading favicons associated with synced history entries. Recorded when one of the following is displayed: entries in @@ -1163,6 +1258,7 @@ expires_after="2021-08-24"> <owner>fernandex@chromium.org</owner> <owner>chrome-signin-team@google.com</owner> + <component>Services>Sync</component> <summary> Enumeration of error conditions that displays an infobar to the user. iOS only. @@ -1173,6 +1269,7 @@ expires_after="2021-10-10"> <owner>treib@chromium.org</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Boolean histogram for whether the "Sync Everything" option was selected by the user. Samples are taken every time the Sync data types are @@ -1185,6 +1282,7 @@ expires_after="2021-11-01"> <owner>mmoskvitin@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Records whether attempt of adding trusted vault keys was successful (i.e. whether pending keys state resolved). @@ -1195,6 +1293,7 @@ expires_after="2021-11-01"> <owner>mmoskvitin@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Records whether user action was required to fetch trusted vault keys upon startup. Recorded only if trusted vault passphrase type is used and at most @@ -1206,6 +1305,7 @@ expires_after="2021-11-01"> <owner>mmoskvitin@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Records number of trusted vault keys fetched upon fetching completion. </summary> @@ -1215,6 +1315,7 @@ enum="TrustedVaultFetchKeysAttempt" expires_after="2021-11-01"> <owner>mmoskvitin@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary>Recorded when fetching trusted vault keys is attempted.</summary> </histogram> @@ -1222,6 +1323,7 @@ enum="TrustedVaultKeyRetrievalTrigger" expires_after="2021-11-01"> <owner>mmoskvitin@google.com</owner> <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> <summary> Recorded when user clicks/taps on trusted vault error button. Buckets represents the UI elements which contain trusted vault error button. @@ -1232,6 +1334,7 @@ units="sync entities" expires_after="2021-10-10"> <owner>victorvianna@google.com</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> This records the number of sync entities that were still undecrypted by the time the data type was disabled (typically during browser shutdown). @@ -1242,6 +1345,7 @@ enum="CombinedHttpResponseAndNetErrorCode" expires_after="2021-09-05"> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Counts of responses (both http code and net error code) for Sync URL fetches. @@ -1254,6 +1358,7 @@ </obsolete> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Time spent waiting for a sync cycle to complete the url fetch. </summary> @@ -1263,6 +1368,7 @@ expires_after="2021-07-31"> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> + <component>Services>Sync</component> <summary> Whether a URL fetch timed out or not. Timing out implies the fetch was stalled for an unknown reason. Note that this records true on timeout and
diff --git a/tools/metrics/histograms/histograms_xml/tab/histograms.xml b/tools/metrics/histograms/histograms_xml/tab/histograms.xml index 8347134d..e01045f 100644 --- a/tools/metrics/histograms/histograms_xml/tab/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/tab/histograms.xml
@@ -437,7 +437,7 @@ </histogram> <histogram name="Tab.Screenshot.Action" enum="TabScreenshotAction" - expires_after="2021-08-24"> + expires_after="2021-10-24"> <owner>skare@chromium.org</owner> <summary> Records actions taken after one or more screenshots of a page were taken. @@ -2248,7 +2248,7 @@ </histogram> <histogram name="Tabs.TabSearch.NumTabsClosedPerInstance" units="tabs" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <summary> @@ -2261,7 +2261,7 @@ </histogram> <histogram name="Tabs.TabSearch.NumTabsOnOpen" units="tabs" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <summary> @@ -2355,7 +2355,7 @@ </histogram> <histogram name="Tabs.TabSearch.WebUI.LoadCompletedTime" units="ms" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <summary> @@ -2366,7 +2366,7 @@ </histogram> <histogram name="Tabs.TabSearch.WebUI.LoadDocumentTime" units="ms" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <summary> @@ -2376,7 +2376,7 @@ </histogram> <histogram name="Tabs.TabSearch.WebUI.TabListDataReceived" units="ms" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <owner>yuhengh@chromium.org</owner> @@ -2426,7 +2426,7 @@ </histogram> <histogram name="Tabs.TabSearch.WindowDisplayedDuration3" units="ms" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <summary> @@ -2468,7 +2468,7 @@ </histogram> <histogram name="Tabs.TabSearch.WindowTimeToShowUncachedWebView" units="ms" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <owner>yuhengh@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/ukm/histograms.xml b/tools/metrics/histograms/histograms_xml/ukm/histograms.xml index f029d7f..5a1bace 100644 --- a/tools/metrics/histograms/histograms_xml/ukm/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/ukm/histograms.xml
@@ -174,7 +174,7 @@ </histogram> <histogram name="UKM.LogUpload.ResponseOrErrorCode" - enum="CombinedHttpResponseAndNetErrorCode" expires_after="2021-08-22"> + enum="CombinedHttpResponseAndNetErrorCode" expires_after="2021-10-24"> <owner>rkaplow@chromium.org</owner> <owner>ukm-team@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/uma/histograms.xml b/tools/metrics/histograms/histograms_xml/uma/histograms.xml index 38e3361..57772b4 100644 --- a/tools/metrics/histograms/histograms_xml/uma/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/uma/histograms.xml
@@ -159,7 +159,7 @@ </histogram> <histogram name="UMA.InitSequence" enum="UmaInitSequence" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>asvitkine@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner> <summary> @@ -252,7 +252,7 @@ </summary> </histogram> -<histogram name="UMA.LogSize.OnSuccess" units="KB" expires_after="2021-08-22"> +<histogram name="UMA.LogSize.OnSuccess" units="KB" expires_after="2021-10-24"> <owner>asvitkine@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner> <summary> @@ -276,7 +276,7 @@ </histogram> <histogram name="UMA.LogUpload.ResponseOrErrorCode" - enum="CombinedHttpResponseAndNetErrorCode" expires_after="2021-08-22"> + enum="CombinedHttpResponseAndNetErrorCode" expires_after="2021-10-24"> <owner>holte@chromium.org</owner> <owner>asvitkine@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner> @@ -480,7 +480,7 @@ </histogram> <histogram name="UMA.ProtoCompressionRatio" units="%" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>asvitkine@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/variations/histograms.xml b/tools/metrics/histograms/histograms_xml/variations/histograms.xml index dab320a7..03efc34 100644 --- a/tools/metrics/histograms/histograms_xml/variations/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/variations/histograms.xml
@@ -136,7 +136,7 @@ </histogram> <histogram name="Variations.Headers.ExperimentCount" units="units" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>asvitkine@chromium.org</owner> <owner>rkaplow@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner> @@ -369,7 +369,7 @@ </histogram> <histogram name="Variations.SeedFreshness" units="minutes" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>asvitkine@chromium.org</owner> <owner>rkaplow@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner> @@ -381,7 +381,7 @@ </histogram> <histogram name="Variations.SeedLoadBlockingTime" units="ms" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>changwan@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner> <summary> @@ -396,7 +396,7 @@ </histogram> <histogram name="Variations.SeedLoadResult" enum="VariationsSeedLoadResult" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>asvitkine@chromium.org</owner> <owner>rkaplow@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner> @@ -408,7 +408,7 @@ </histogram> <histogram name="Variations.SeedProcessingTime" units="ms" - expires_after="2021-08-22"> + expires_after="2021-10-24"> <owner>isherman@chromium.org</owner> <owner>asvitkine@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner>
diff --git a/tools/metrics/histograms/histograms_xml/web_apk/histograms.xml b/tools/metrics/histograms/histograms_xml/web_apk/histograms.xml index 1dde9d7c..4abd8d4 100644 --- a/tools/metrics/histograms/histograms_xml/web_apk/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/web_apk/histograms.xml
@@ -263,7 +263,7 @@ </histogram> <histogram name="WebApk.Startup.Cold.ShellLaunchToSplashscreenVisible" - units="ms" expires_after="2021-08-22"> + units="ms" expires_after="2021-10-24"> <owner>mheikal@chromium.org</owner> <owner>yfriedman@chromium.org</owner> <summary>
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index ad29a0ba..6d1bb89 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -1,16 +1,16 @@ { "trace_processor_shell": { "win": { - "hash": "0938325b9d7b90bcc799b472d97224dfd69a8e4c", - "remote_path": "perfetto_binaries/trace_processor_shell/win/7dadfe6bd3985045d21280ebbc9ba336df6dedd9/trace_processor_shell.exe" + "hash": "68d41a8744343eb9fcadfb004a8eddaf1e8083bc", + "remote_path": "perfetto_binaries/trace_processor_shell/win/dd6f2bc226b22086345c7da0ae62bbc3c3ff850a/trace_processor_shell.exe" }, "mac": { - "hash": "5e665684a52f40da01a63ec8240c471f1c0c9741", - "remote_path": "perfetto_binaries/trace_processor_shell/mac/7dadfe6bd3985045d21280ebbc9ba336df6dedd9/trace_processor_shell" + "hash": "ae04e80011f5918c2c3ec673c3c553d8a4698f18", + "remote_path": "perfetto_binaries/trace_processor_shell/mac/e01ad9a6a83bd8df88dc01bc86fd0ec9080296c7/trace_processor_shell" }, "linux": { - "hash": "c73fdfb21f453613380b6fba9dc8611529df11ea", - "remote_path": "perfetto_binaries/trace_processor_shell/linux/dd6f2bc226b22086345c7da0ae62bbc3c3ff850a/trace_processor_shell" + "hash": "714da13e2699d98df93e72feb9f5eb855d281a40", + "remote_path": "perfetto_binaries/trace_processor_shell/linux/e01ad9a6a83bd8df88dc01bc86fd0ec9080296c7/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/tools/ubsan/blacklist.txt b/tools/ubsan/ignorelist.txt similarity index 97% rename from tools/ubsan/blacklist.txt rename to tools/ubsan/ignorelist.txt index 844d1eb..e917f58 100644 --- a/tools/ubsan/blacklist.txt +++ b/tools/ubsan/ignorelist.txt
@@ -1,5 +1,5 @@ ############################################################################# -# UBSan blacklist. +# UBSan ignorelist. ############################################################################# # YASM does some funny things that UBsan doesn't like. @@ -34,7 +34,7 @@ fun:*(hash|Hash)* ############################################################################# -# Bounds blacklist. +# Bounds ignorelist. # Array at the end of struct pattern: # Maybe UBSan itself can be improved here? # e.g.
diff --git a/tools/ubsan/security_blacklist.txt b/tools/ubsan/security_ignorelist.txt similarity index 90% rename from tools/ubsan/security_blacklist.txt rename to tools/ubsan/security_ignorelist.txt index b5b8fff..1c7a916 100644 --- a/tools/ubsan/security_blacklist.txt +++ b/tools/ubsan/security_ignorelist.txt
@@ -1,9 +1,9 @@ -# This black list is the subset of blacklist.txt that's needed in +# This ignore list is the subset of ignorelist.txt that's needed in # is_ubsan_security builds. is_ubsan_security builds also use -# vptr_blacklist.txt. This file does not duplicate the contents of that file. +# vptr_ignorelist.txt. This file does not duplicate the contents of that file. ############################################################################# -# UBSan security blacklist. +# UBSan security ignorelist. ############################################################################# # YASM does some funny things that UBsan doesn't like. @@ -51,7 +51,7 @@ fun:*(hash|Hash)* ############################################################################# -# Bounds blacklist. +# Bounds ignorelist. # Array at the end of struct pattern: # Maybe UBSan itself can be improved here? # e.g. @@ -74,5 +74,5 @@ fun:*RendererFrameManager*CullUnlockedFrames* ############################################################################# -# -fsanitize=vptr suppressions should go in vptr_blacklist.txt, not here. +# -fsanitize=vptr suppressions should go in vptr_ignorelist.txt, not here. #############################################################################
diff --git a/tools/ubsan/vptr_blacklist.txt b/tools/ubsan/vptr_ignorelist.txt similarity index 91% rename from tools/ubsan/vptr_blacklist.txt rename to tools/ubsan/vptr_ignorelist.txt index 32d70aa..15bcaf3f 100644 --- a/tools/ubsan/vptr_blacklist.txt +++ b/tools/ubsan/vptr_ignorelist.txt
@@ -1,14 +1,14 @@ ############################################################################# -# UBSan vptr blacklist. -# Function and type based blacklisting use a mangled name, and it is especially +# UBSan vptr ignorelist. +# Function and type based ignorelisting use a mangled name, and it is especially # tricky to represent C++ types. For now, any possible changes by name manglings # are simply represented as wildcard expressions of regexp, and thus it might be -# over-blacklisted. +# over-ignorelisted. ############################################################################# # Identical layouts. # If base and derived classes have identifical memory layouts (i.e., the same -# object size) and both have no virtual functions, we blacklist them as there +# object size) and both have no virtual functions, we ignorelist them as there # would be not much security implications. fun:*LifecycleNotifier*addObserver* @@ -24,7 +24,7 @@ # Avoid identical layout cases for 86 different classes in InspectorTypeBuilder, # all of which are guarded using COMPILER_ASSERT on the object size. Two more -# types are also blacklisted due to the template class (JSONArray <-> Array<T>). +# types are also ignorelisted due to the template class (JSONArray <-> Array<T>). src:*InspectorTypeBuilder.h* type:*TypeBuilder* @@ -80,7 +80,7 @@ ############################################################################# # Avoid link errors. # Ubsan vptr needs typeinfo on the target class, but it looks like typeinfo is -# not avaiable if the class is not exported. For now, simply blacklisted to +# not avaiable if the class is not exported. For now, simply ignorelisted to # avoid link errors; e.g., undefined reference to 'typeinfo for [CLASS_NAME]'. # obj/ppapi/libppapi_proxy.a(obj/ppapi/proxy/ppapi_proxy.proxy_channel.o):../../ppapi/proxy/proxy_channel.cc:__unnamed_53: error: undefined reference to 'typeinfo for IPC::TestSink' @@ -121,6 +121,6 @@ # static_cast<StartPageService*> in StartPageServiceFactory::GetForProfile. type:*StartPageService* -# Remove once function attribute level blacklisting is implemented. +# Remove once function attribute level ignorelisting is implemented. # See crbug.com/476063. fun:*forbidGCDuringConstruction*
diff --git a/ui/base/accelerators/accelerator_manager.cc b/ui/base/accelerators/accelerator_manager.cc index ec6bffed..01d842d 100644 --- a/ui/base/accelerators/accelerator_manager.cc +++ b/ui/base/accelerators/accelerator_manager.cc
@@ -7,18 +7,9 @@ #include "base/check.h" #include "base/containers/contains.h" -#if defined(OS_CHROMEOS) -#include "ui/base/ui_base_features.h" -#endif - namespace ui { -AcceleratorManager::AcceleratorManager() { -#if defined(OS_CHROMEOS) - accelerators_.set_use_positional_lookup( - ::features::IsImprovedKeyboardShortcutsEnabled()); -#endif -} +AcceleratorManager::AcceleratorManager() = default; AcceleratorManager::~AcceleratorManager() = default;
diff --git a/ui/base/accelerators/accelerator_manager.h b/ui/base/accelerators/accelerator_manager.h index ef63397..af354b1c 100644 --- a/ui/base/accelerators/accelerator_manager.h +++ b/ui/base/accelerators/accelerator_manager.h
@@ -13,6 +13,10 @@ #include "ui/base/accelerators/accelerator.h" #include "ui/base/accelerators/accelerator_map.h" +#if defined(OS_CHROMEOS) +#include "ui/base/ui_base_features.h" +#endif + namespace ui { // AcceleratorManger handles processing of accelerators. A delegate may be @@ -80,6 +84,13 @@ // Whether the given |accelerator| has a priority handler associated with it. bool HasPriorityHandler(const Accelerator& accelerator) const; +#if defined(OS_CHROMEOS) + void SetUsePositionalLookup(bool use_positional_lookup) { + DCHECK(::features::IsImprovedKeyboardShortcutsEnabled()); + accelerators_.set_use_positional_lookup(use_positional_lookup); + } +#endif // defined(OS_CHROMEOS) + private: // Private helper class to manage the accelerator targets and priority. Each // set of targets for a given accelerator can only have 0 or 1 priority
diff --git a/ui/base/accelerators/accelerator_manager_unittest.cc b/ui/base/accelerators/accelerator_manager_unittest.cc index 2778775..84297781 100644 --- a/ui/base/accelerators/accelerator_manager_unittest.cc +++ b/ui/base/accelerators/accelerator_manager_unittest.cc
@@ -214,6 +214,7 @@ // Use a local instance so that the feature is enabled during construction. AcceleratorManager manager; + manager.SetUsePositionalLookup(true); // Test what would be ctrl + ']' (VKEY_OEM_6) on a US keyboard. This // should match. @@ -235,6 +236,7 @@ // Use a local instance so that the feature is enabled during construction. AcceleratorManager manager; + manager.SetUsePositionalLookup(true); // Test what would be ctrl + ']' on a US keyboard with matching DomCode // and different VKEY (eg. '+'). This is the use case of a positional key @@ -257,6 +259,7 @@ // Use a local instance so that the feature is enabled during construction. AcceleratorManager manager; + manager.SetUsePositionalLookup(true); // Test what would be ctrl + ']' on a US keyboard using positional mapping // for a German layout. The accelerator is registered using the US VKEY and @@ -280,6 +283,7 @@ // Use a local instance so that the feature is enabled during construction. AcceleratorManager manager; + manager.SetUsePositionalLookup(true); // Test ctrl + 'Z' for the German layout. Since 'Z' is not a positional // key it should match based on the VKEY, regardless of the DomCode. In this @@ -303,6 +307,7 @@ // Use a local instance so that the feature is enabled during construction. AcceleratorManager manager; + manager.SetUsePositionalLookup(true); // Test ctrl + 'Z' for the German layout. The 'Y' key (in the US_Z position), // should not match. Alphanumeric keys are not positional, and pressing the
diff --git a/ui/base/ime/chromeos/input_method_manager.h b/ui/base/ime/chromeos/input_method_manager.h index e3bf5d39..5f622e43 100644 --- a/ui/base/ime/chromeos/input_method_manager.h +++ b/ui/base/ime/chromeos/input_method_manager.h
@@ -299,6 +299,12 @@ virtual bool IsAltGrUsedByCurrentInputMethod() const = 0; + // Returns true if the current input method uses position based shortcuts. + // This is true for most layouts, with the exception of layouts that have + // non-standard locations for punctuation such as dvorak. See + // crbug.com/1174326 for more information. + virtual bool ArePositionalShortcutsUsedByCurrentInputMethod() const = 0; + // Returns an X keyboard object which could be used to change the current XKB // layout, change the caps lock status, and set the auto repeat rate/interval. virtual ImeKeyboard* GetImeKeyboard() = 0;
diff --git a/ui/base/ime/chromeos/mock_input_method_manager.cc b/ui/base/ime/chromeos/mock_input_method_manager.cc index 690e66c..22a2fd46 100644 --- a/ui/base/ime/chromeos/mock_input_method_manager.cc +++ b/ui/base/ime/chromeos/mock_input_method_manager.cc
@@ -161,6 +161,11 @@ return false; } +bool MockInputMethodManager::ArePositionalShortcutsUsedByCurrentInputMethod() + const { + return false; +} + ImeKeyboard* MockInputMethodManager::GetImeKeyboard() { return nullptr; }
diff --git a/ui/base/ime/chromeos/mock_input_method_manager.h b/ui/base/ime/chromeos/mock_input_method_manager.h index a498c7c..44529467 100644 --- a/ui/base/ime/chromeos/mock_input_method_manager.h +++ b/ui/base/ime/chromeos/mock_input_method_manager.h
@@ -105,6 +105,7 @@ override; bool IsISOLevel5ShiftUsedByCurrentInputMethod() const override; bool IsAltGrUsedByCurrentInputMethod() const override; + bool ArePositionalShortcutsUsedByCurrentInputMethod() const override; ImeKeyboard* GetImeKeyboard() override; InputMethodUtil* GetInputMethodUtil() override; ComponentExtensionIMEManager* GetComponentExtensionIMEManager() override;
diff --git a/ui/base/prediction/linear_resampling.cc b/ui/base/prediction/linear_resampling.cc index 2f0590d..b0dabac 100644 --- a/ui/base/prediction/linear_resampling.cc +++ b/ui/base/prediction/linear_resampling.cc
@@ -7,6 +7,7 @@ #include <algorithm> #include "base/feature_list.h" +#include "base/metrics/field_trial_params.h" #include "base/strings/string_number_conversions.h" #include "ui/base/ui_base_features.h"
diff --git a/ui/display/manager/display_util.h b/ui/display/manager/display_util.h index 33dc3167..3149e48 100644 --- a/ui/display/manager/display_util.h +++ b/ui/display/manager/display_util.h
@@ -59,7 +59,7 @@ // the element it is closest to in the list. It also ensures that it never // replaces the default zoom value of 1.0 from the list and that the size of the // list never changes. -// TODO(malaykeshav): Remove this after a few milestones. +// TODO(crbug.com/1203004): Remove this after a few milestones. void DISPLAY_MANAGER_EXPORT InsertDsfIntoList(std::vector<float>* zoom_values, float dsf);
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc index cce04278d..3e44ad3 100644 --- a/ui/gl/gl_surface_egl.cc +++ b/ui/gl/gl_surface_egl.cc
@@ -907,7 +907,8 @@ } if (supports_angle_swiftshader) { - if (requested_renderer == kANGLEImplementationSwiftShaderName) { + if (requested_renderer == kANGLEImplementationSwiftShaderName || + requested_renderer == kANGLEImplementationSwiftShaderForWebGLName) { AddInitDisplay(init_displays, ANGLE_SWIFTSHADER); } }
diff --git a/ui/gl/gl_switches.cc b/ui/gl/gl_switches.cc index 9ade60c9..7341e37 100644 --- a/ui/gl/gl_switches.cc +++ b/ui/gl/gl_switches.cc
@@ -34,6 +34,7 @@ const char kANGLEImplementationNullName[] = "null"; const char kANGLEImplementationVulkanName[] = "vulkan"; const char kANGLEImplementationSwiftShaderName[] = "swiftshader"; +const char kANGLEImplementationSwiftShaderForWebGLName[] = "swiftshader-webgl"; const char kANGLEImplementationMetalName[] = "metal"; const char kANGLEImplementationNoneName[] = "";
diff --git a/ui/gl/gl_switches.h b/ui/gl/gl_switches.h index 184f9a44..36c44d1 100644 --- a/ui/gl/gl_switches.h +++ b/ui/gl/gl_switches.h
@@ -34,6 +34,7 @@ GL_EXPORT extern const char kANGLEImplementationNullName[]; GL_EXPORT extern const char kANGLEImplementationVulkanName[]; GL_EXPORT extern const char kANGLEImplementationSwiftShaderName[]; +GL_EXPORT extern const char kANGLEImplementationSwiftShaderForWebGLName[]; GL_EXPORT extern const char kANGLEImplementationMetalName[]; GL_EXPORT extern const char kANGLEImplementationNoneName[];
diff --git a/ui/views/accessibility/ax_virtual_view.cc b/ui/views/accessibility/ax_virtual_view.cc index a1269c3..83265a8 100644 --- a/ui/views/accessibility/ax_virtual_view.cc +++ b/ui/views/accessibility/ax_virtual_view.cc
@@ -298,7 +298,7 @@ return nullptr; } -#if !defined(OS_APPLE) +#if !defined(OS_MAC) gfx::NativeViewAccessible AXVirtualView::GetNSWindow() { NOTREACHED(); return nullptr;
diff --git a/ui/views/accessibility/view_ax_platform_node_delegate.cc b/ui/views/accessibility/view_ax_platform_node_delegate.cc index dfcc3aa..e3cf2a6 100644 --- a/ui/views/accessibility/view_ax_platform_node_delegate.cc +++ b/ui/views/accessibility/view_ax_platform_node_delegate.cc
@@ -262,11 +262,11 @@ ax_platform_node_->NotifyAccessibilityEvent(event_type); } -#if defined(OS_APPLE) +#if defined(OS_MAC) void ViewAXPlatformNodeDelegate::AnnounceText(const std::u16string& text) { ax_platform_node_->AnnounceText(text); } -#endif // defined(OS_APPLE) +#endif // defined(OS_MAC) const ui::AXNodeData& ViewAXPlatformNodeDelegate::GetData() const { // Clear the data, then populate it.
diff --git a/ui/views/accessibility/view_ax_platform_node_delegate.h b/ui/views/accessibility/view_ax_platform_node_delegate.h index 04b5412..014dabc 100644 --- a/ui/views/accessibility/view_ax_platform_node_delegate.h +++ b/ui/views/accessibility/view_ax_platform_node_delegate.h
@@ -54,7 +54,7 @@ bool IsAccessibilityEnabled() const override; gfx::NativeViewAccessible GetNativeObject() const override; void NotifyAccessibilityEvent(ax::mojom::Event event_type) override; -#if defined(OS_APPLE) +#if defined(OS_MAC) void AnnounceText(const std::u16string& text) override; #endif
diff --git a/ui/views/accessibility/view_ax_platform_node_delegate_unittest.cc b/ui/views/accessibility/view_ax_platform_node_delegate_unittest.cc index 0cca805..3ad8483 100644 --- a/ui/views/accessibility/view_ax_platform_node_delegate_unittest.cc +++ b/ui/views/accessibility/view_ax_platform_node_delegate_unittest.cc
@@ -896,13 +896,13 @@ EXPECT_EQ(submenu_item->GetData().GetHasPopup(), ax::mojom::HasPopup::kMenu); EXPECT_EQ(submenu_item->GetPosInSet(), 2); EXPECT_EQ(submenu_item->GetSetSize(), 7); -#if defined(OS_APPLE) +#if defined(OS_MAC) // A virtual child with role menu is exposed so that VoiceOver treats a // MenuItemView of type kSubMenu as a submenu rather than an item. EXPECT_EQ(submenu_item->GetChildCount(), 1); #else EXPECT_EQ(submenu_item->GetChildCount(), 0); -#endif // defined(OS_APPLE) +#endif // defined(OS_MAC) EXPECT_EQ(submenu_item->GetIndexInParent(), 1); // MenuItemView::Type::kActionableSubMenu @@ -921,13 +921,13 @@ ax::mojom::HasPopup::kMenu); EXPECT_EQ(actionable_submenu_item->GetPosInSet(), 3); EXPECT_EQ(actionable_submenu_item->GetSetSize(), 7); -#if defined(OS_APPLE) +#if defined(OS_MAC) // A virtual child with role menu is exposed so that VoiceOver treats a // MenuItemView of type kActionableSubMenu as a submenu rather than an item. EXPECT_EQ(actionable_submenu_item->GetChildCount(), 1); #else EXPECT_EQ(actionable_submenu_item->GetChildCount(), 0); -#endif // defined(OS_APPLE) +#endif // defined(OS_MAC) EXPECT_EQ(actionable_submenu_item->GetIndexInParent(), 2); // MenuItemView::Type::kCheckbox
diff --git a/ui/views/accessible_pane_view_unittest.cc b/ui/views/accessible_pane_view_unittest.cc index 91972aa1..3e06e157 100644 --- a/ui/views/accessible_pane_view_unittest.cc +++ b/ui/views/accessible_pane_view_unittest.cc
@@ -135,7 +135,7 @@ // predictable. On Mac, Deactivate() is not implemented. Note that // TestBarView calls set_allow_deactivate_on_esc(true), which is only // otherwise used in Ash. -#if !defined(OS_APPLE) || BUILDFLAG(IS_CHROMEOS_ASH) +#if !defined(OS_MAC) || BUILDFLAG(IS_CHROMEOS_ASH) // Esc should deactivate the widget. test_view_bar->AcceleratorPressed(test_view_bar->escape_key()); EXPECT_TRUE(widget_main->IsActive());
diff --git a/ui/views/bubble/bubble_border.h b/ui/views/bubble/bubble_border.h index ff5d041c..f521961 100644 --- a/ui/views/bubble/bubble_border.h +++ b/ui/views/bubble/bubble_border.h
@@ -69,7 +69,7 @@ NO_SHADOW, SHADOW_COUNT, -#if defined(OS_APPLE) +#if defined(OS_MAC) // On Mac, the native window server should provide its own shadow for // windows that could overlap the browser window. DIALOG_SHADOW = NO_SHADOW,
diff --git a/ui/views/bubble/bubble_dialog_delegate_view.cc b/ui/views/bubble/bubble_dialog_delegate_view.cc index fa73f2b..05faf6c8 100644 --- a/ui/views/bubble/bubble_dialog_delegate_view.cc +++ b/ui/views/bubble/bubble_dialog_delegate_view.cc
@@ -35,7 +35,7 @@ #include "ui/base/win/shell.h" #endif -#if defined(OS_APPLE) +#if defined(OS_MAC) #include "ui/views/widget/widget_utils_mac.h" #else #include "ui/aura/window.h" @@ -133,7 +133,7 @@ bubble->OnBeforeBubbleWidgetInit(&bubble_params, bubble_widget); DCHECK(bubble_params.parent || !bubble->has_parent()); bubble_widget->Init(std::move(bubble_params)); -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // On Mac, having a parent window creates a permanent stacking order, so // there's no need to do this. Also, calling StackAbove() on Mac shows the // bubble implicitly, for which the bubble is currently not ready. @@ -185,7 +185,7 @@ // This class is responsible for observing events on a BubbleDialogDelegate's // anchor widget and notifying the BubbleDialogDelegate of them. -#if defined(OS_APPLE) +#if defined(OS_MAC) class BubbleDialogDelegate::AnchorWidgetObserver : public WidgetObserver { #else class BubbleDialogDelegate::AnchorWidgetObserver : public WidgetObserver, @@ -196,7 +196,7 @@ AnchorWidgetObserver(BubbleDialogDelegate* owner, Widget* widget) : owner_(owner) { widget_observation_.Observe(widget); -#if !defined(OS_APPLE) +#if !defined(OS_MAC) window_observation_.Observe(widget->GetNativeWindow()); #endif } @@ -204,7 +204,7 @@ // WidgetObserver: void OnWidgetDestroying(Widget* widget) override { -#if !defined(OS_APPLE) +#if !defined(OS_MAC) DCHECK(window_observation_.IsObservingSource(widget->GetNativeWindow())); window_observation_.Reset(); #endif @@ -222,7 +222,7 @@ owner_->OnAnchorBoundsChanged(); } -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // aura::WindowObserver: void OnWindowTransformed(aura::Window* window, ui::PropertyChangeReason reason) override { @@ -242,7 +242,7 @@ BubbleDialogDelegate* owner_; base::ScopedObservation<views::Widget, views::WidgetObserver> widget_observation_{this}; -#if !defined(OS_APPLE) +#if !defined(OS_MAC) base::ScopedObservation<aura::Window, aura::WindowObserver> window_observation_{this}; #endif @@ -472,7 +472,7 @@ } void BubbleDialogDelegate::OnBubbleWidgetActivationChanged(bool active) { -#if defined(OS_APPLE) +#if defined(OS_MAC) // Install |mac_bubble_closer_| the first time the widget becomes active. if (active && !mac_bubble_closer_) { mac_bubble_closer_ = std::make_unique<ui::BubbleCloser>( @@ -565,7 +565,7 @@ anchor_rect_ = GetAnchorView()->GetAnchorBoundsInScreen(); -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // GetAnchorBoundsInScreen returns values that take anchor widget's // translation into account, so undo that here. Without this, features which // apply transforms on windows such as ChromeOS overview mode will see bubbles @@ -773,7 +773,7 @@ void BubbleDialogDelegate::SizeToContents() { gfx::Rect bubble_bounds = GetBubbleBounds(); -#if defined(OS_APPLE) +#if defined(OS_MAC) // GetBubbleBounds() doesn't take the Mac NativeWindow's style mask into // account, so we need to adjust the size. gfx::Size actual_size =
diff --git a/ui/views/bubble/bubble_dialog_delegate_view.h b/ui/views/bubble/bubble_dialog_delegate_view.h index d42a37d..7b565c8 100644 --- a/ui/views/bubble/bubble_dialog_delegate_view.h +++ b/ui/views/bubble/bubble_dialog_delegate_view.h
@@ -21,7 +21,7 @@ #include "ui/views/widget/widget_observer.h" #include "ui/views/window/dialog_delegate.h" -#if defined(OS_APPLE) +#if defined(OS_MAC) #include "ui/base/cocoa/bubble_closer.h" #endif @@ -351,7 +351,7 @@ // Pointer to this bubble's ClientView. ClientView* client_view_ = nullptr; -#if defined(OS_APPLE) +#if defined(OS_MAC) // Special handler for close_on_deactivate() on Mac. Window (de)activation is // suppressed by the WindowServer when clicking rapidly, so the bubble must // monitor clicks as well for the desired behavior.
diff --git a/ui/views/bubble/bubble_dialog_delegate_view_unittest.cc b/ui/views/bubble/bubble_dialog_delegate_view_unittest.cc index 023f2e5e..56df070 100644 --- a/ui/views/bubble/bubble_dialog_delegate_view_unittest.cc +++ b/ui/views/bubble/bubble_dialog_delegate_view_unittest.cc
@@ -614,13 +614,13 @@ Widget* bubble_widget = BubbleDialogDelegateView::CreateBubble(bubble_delegate); bubble_widget->Show(); -#if defined(OS_APPLE) +#if defined(OS_MAC) // All child widgets make the parent paint as active on Mac. // See https://crbug.com/1046540 EXPECT_TRUE(anchor_widget->ShouldPaintAsActive()); #else EXPECT_FALSE(anchor_widget->ShouldPaintAsActive()); -#endif // defined(OS_APPLE) +#endif // defined(OS_MAC) bubble_delegate->SetAnchorView(anchor_widget->GetContentsView()); EXPECT_TRUE(anchor_widget->ShouldPaintAsActive());
diff --git a/ui/views/bubble/bubble_frame_view.cc b/ui/views/bubble/bubble_frame_view.cc index 7c2934f..f05592c5 100644 --- a/ui/views/bubble/bubble_frame_view.cc +++ b/ui/views/bubble/bubble_frame_view.cc
@@ -352,7 +352,7 @@ // the OS doesn't give the user controls to resize a bubble. return gfx::Size(); #else -#if defined(OS_APPLE) +#if defined(OS_MAC) // Allow BubbleFrameView dialogs to be resizable on Mac. if (GetWidget()->widget_delegate()->CanResize()) { gfx::Size client_size = GetWidget()->client_view()->GetMaximumSize(); @@ -360,7 +360,7 @@ return client_size; return GetWindowBoundsForClientBounds(gfx::Rect(client_size)).size(); } -#endif // OS_APPLE +#endif // OS_MAC // Non-dialog bubbles should be non-resizable, so its max size is its // preferred size. return GetPreferredSize();
diff --git a/ui/views/controls/button/button.cc b/ui/views/controls/button/button.cc index b38962e..77e53ac 100644 --- a/ui/views/controls/button/button.cc +++ b/ui/views/controls/button/button.cc
@@ -239,7 +239,7 @@ void Button::SetRequestFocusOnPress(bool value) { // On Mac, buttons should not request focus on a mouse press. Hence keep the // default value i.e. false. -#if !defined(OS_APPLE) +#if !defined(OS_MAC) if (request_focus_on_press_ == value) return; request_focus_on_press_ = value;
diff --git a/ui/views/controls/button/button_unittest.cc b/ui/views/controls/button/button_unittest.cc index 294223c0..dabaea3 100644 --- a/ui/views/controls/button/button_unittest.cc +++ b/ui/views/controls/button/button_unittest.cc
@@ -284,7 +284,7 @@ // Disabling cursor events occurs for touch events and the Ash magnifier. There // is no touch on desktop Mac. Tracked in http://crbug.com/445520. -#if !defined(OS_APPLE) || defined(USE_AURA) +#if !defined(OS_MAC) || defined(USE_AURA) aura::test::TestCursorClient cursor_client(GetRootWindow(widget())); // In Aura views, no new hover effects are invoked if mouse events @@ -302,7 +302,7 @@ button()->SetVisible(true); EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); -#endif // !defined(OS_APPLE) || defined(USE_AURA) +#endif // !defined(OS_MAC) || defined(USE_AURA) } // Tests that the hover state is preserved during a view hierarchy update of a @@ -388,7 +388,7 @@ } // No touch on desktop Mac. Tracked in http://crbug.com/445520. -#if !defined(OS_APPLE) || defined(USE_AURA) +#if !defined(OS_MAC) || defined(USE_AURA) namespace { @@ -428,7 +428,7 @@ EXPECT_EQ(Button::STATE_DISABLED, button()->GetState()); } -#endif // !defined(OS_APPLE) || defined(USE_AURA) +#endif // !defined(OS_MAC) || defined(USE_AURA) // Ensure subclasses of Button are correctly recognized as Button. TEST_F(ButtonTest, AsButton) { @@ -800,7 +800,7 @@ ui::KeyEvent space_press(ui::ET_KEY_PRESSED, ui::VKEY_SPACE, ui::EF_NONE); EXPECT_TRUE(button()->OnKeyPressed(space_press)); -#if defined(OS_APPLE) +#if defined(OS_MAC) EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); EXPECT_TRUE(button()->pressed()); #else @@ -810,7 +810,7 @@ ui::KeyEvent space_release(ui::ET_KEY_RELEASED, ui::VKEY_SPACE, ui::EF_NONE); -#if defined(OS_APPLE) +#if defined(OS_MAC) EXPECT_FALSE(button()->OnKeyReleased(space_release)); #else EXPECT_TRUE(button()->OnKeyReleased(space_release)); @@ -830,7 +830,7 @@ ui::KeyEvent return_press(ui::ET_KEY_PRESSED, ui::VKEY_RETURN, ui::EF_NONE); -#if defined(OS_APPLE) +#if defined(OS_MAC) EXPECT_FALSE(button()->OnKeyPressed(return_press)); EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); EXPECT_FALSE(button()->pressed());
diff --git a/ui/views/controls/button/menu_button_unittest.cc b/ui/views/controls/button/menu_button_unittest.cc index e13b1ff3..60bd89a 100644 --- a/ui/views/controls/button/menu_button_unittest.cc +++ b/ui/views/controls/button/menu_button_unittest.cc
@@ -500,7 +500,7 @@ #endif // USE_AURA // No touch on desktop Mac. Tracked in http://crbug.com/445520. -#if !defined(OS_APPLE) || defined(USE_AURA) +#if !defined(OS_MAC) || defined(USE_AURA) // Tests if the callback is notified correctly when a gesture tap happens on a // MenuButton that has a callback. @@ -547,7 +547,7 @@ EXPECT_FALSE(button()->clicked()); } -#endif // !defined(OS_APPLE) || defined(USE_AURA) +#endif // !defined(OS_MAC) || defined(USE_AURA) TEST_F(MenuButtonTest, InkDropHoverWhenShowingMenu) { ConfigureMenuButton(std::make_unique<PressStateButton>(false));
diff --git a/ui/views/controls/combobox/combobox.cc b/ui/views/controls/combobox/combobox.cc index b0e815c8..461b94c 100644 --- a/ui/views/controls/combobox/combobox.cc +++ b/ui/views/controls/combobox/combobox.cc
@@ -72,7 +72,7 @@ ~TransparentButton() override = default; bool OnMousePressed(const ui::MouseEvent& mouse_event) override { -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // On Mac, comboboxes do not take focus on mouse click, but on other // platforms they do. parent()->RequestFocus(); @@ -104,7 +104,7 @@ DISALLOW_COPY_AND_ASSIGN(TransparentButton); }; -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // Returns the next or previous valid index (depending on |increment|'s value). // Skips separator or disabled indices. Returns -1 if there is no valid adjacent // index. @@ -240,7 +240,7 @@ base::BindRepeating(&Combobox::ArrowButtonPressed, base::Unretained(this)))) { SetModel(model); -#if defined(OS_APPLE) +#if defined(OS_MAC) SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); #else SetFocusBehavior(FocusBehavior::ALWAYS); @@ -430,7 +430,7 @@ bool show_menu = false; int new_index = kNoSelection; switch (e.key_code()) { -#if defined(OS_APPLE) +#if defined(OS_MAC) case ui::VKEY_DOWN: case ui::VKEY_UP: case ui::VKEY_SPACE: @@ -476,7 +476,7 @@ case ui::VKEY_SPACE: show_menu = true; break; -#endif // OS_APPLE +#endif // OS_MAC default: return false; }
diff --git a/ui/views/controls/combobox/combobox_unittest.cc b/ui/views/controls/combobox/combobox_unittest.cc index 16d992a..1369007b 100644 --- a/ui/views/controls/combobox/combobox_unittest.cc +++ b/ui/views/controls/combobox/combobox_unittest.cc
@@ -285,7 +285,7 @@ DISALLOW_COPY_AND_ASSIGN(ComboboxTest); }; -#if defined(OS_APPLE) +#if defined(OS_MAC) // Tests whether the various Mac specific keyboard shortcuts invoke the dropdown // menu or not. TEST_F(ComboboxTest, KeyTestMac) { @@ -359,7 +359,7 @@ // On Mac, key events can't change the currently selected index directly for a // combobox. -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // Tests the behavior of various keyboard shortcuts on the currently selected // index. @@ -504,7 +504,7 @@ PressKey(ui::VKEY_END); EXPECT_EQ(6, combobox_->GetSelectedIndex()); } -#endif // !OS_APPLE +#endif // !OS_MAC TEST_F(ComboboxTest, GetTextForRowTest) { std::set<int> separators; @@ -839,7 +839,7 @@ EXPECT_EQ(ui::MenuModel::TYPE_SEPARATOR, menu_model->GetTypeAt(kSeparatorIndex)); -#if defined(OS_APPLE) +#if defined(OS_MAC) // Comboboxes on Mac should have checkmarks, with the selected item checked, EXPECT_EQ(ui::MenuModel::TYPE_CHECK, menu_model->GetTypeAt(0)); EXPECT_EQ(ui::MenuModel::TYPE_CHECK, menu_model->GetTypeAt(1));
diff --git a/ui/views/controls/editable_combobox/editable_combobox_unittest.cc b/ui/views/controls/editable_combobox/editable_combobox_unittest.cc index 7cf616b..cae9d87 100644 --- a/ui/views/controls/editable_combobox/editable_combobox_unittest.cc +++ b/ui/views/controls/editable_combobox/editable_combobox_unittest.cc
@@ -198,7 +198,7 @@ container->AddChildView(dummy_focusable_view_); widget_->Show(); -#if defined(OS_APPLE) +#if defined(OS_MAC) // The event loop needs to be flushed here, otherwise in various tests: // 1. The actual showing of the native window backing the widget gets delayed // until a spin of the event loop. @@ -270,7 +270,7 @@ const bool alt, const bool shift, const bool ctrl_cmd) { -#if defined(OS_APPLE) +#if defined(OS_MAC) bool command = ctrl_cmd; bool control = false; #else @@ -407,7 +407,7 @@ EXPECT_EQ(u"xabcy", combobox_->GetText()); } -#if defined(OS_APPLE) +#if defined(OS_MAC) TEST_F(EditableComboboxTest, AltLeftOrRightMovesToNextWords) { InitEditableCombobox();
diff --git a/ui/views/controls/label_unittest.cc b/ui/views/controls/label_unittest.cc index 72cfce19..028ee0f6 100644 --- a/ui/views/controls/label_unittest.cc +++ b/ui/views/controls/label_unittest.cc
@@ -51,7 +51,7 @@ namespace { -#if defined(OS_APPLE) +#if defined(OS_MAC) const int kControlCommandModifier = ui::EF_COMMAND_DOWN; #else const int kControlCommandModifier = ui::EF_CONTROL_DOWN; @@ -789,8 +789,8 @@ required_size.width() + border.width()); } -#if !defined(OS_APPLE) -// TODO(warx): Remove !defined(OS_APPLE) once SetMaxLines() is applied to MAC +#if !defined(OS_MAC) +// TODO(warx): Remove !defined(OS_MAC) once SetMaxLines() is applied to MAC // (crbug.com/758720). TEST_F(LabelTest, MultiLineSetMaxLines) { // Ensure SetMaxLines clamps the line count of a string with returns.
diff --git a/ui/views/controls/link.cc b/ui/views/controls/link.cc index 9de45ac1..651ca9a 100644 --- a/ui/views/controls/link.cc +++ b/ui/views/controls/link.cc
@@ -221,7 +221,7 @@ if (GetText().empty()) { SetFocusBehavior(FocusBehavior::NEVER); } else { -#if defined(OS_APPLE) +#if defined(OS_MAC) SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); #else SetFocusBehavior(FocusBehavior::ALWAYS);
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc index 7c081b7..42f8806 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc
@@ -77,7 +77,7 @@ namespace { -#if defined(OS_APPLE) +#if defined(OS_MAC) bool AcceleratorShouldCancelMenu(const ui::Accelerator& accelerator) { // Since AcceleratorShouldCancelMenu() is called quite early in key // event handling, it is actually invoked for modifier keys themselves @@ -522,7 +522,7 @@ menu_pre_target_handler_ = MenuPreTargetHandler::Create(this, owner_); } -#if defined(OS_APPLE) +#if defined(OS_MAC) menu_cocoa_watcher_ = std::make_unique<MenuCocoaWatcherMac>(base::BindOnce( &MenuController::Cancel, this->AsWeakPtr(), ExitType::kAll)); #endif @@ -554,7 +554,7 @@ } void MenuController::Cancel(ExitType type) { -#if defined(OS_APPLE) +#if defined(OS_MAC) menu_closure_animation_.reset(); #endif @@ -1205,7 +1205,7 @@ base::WeakPtr<MenuController> this_ref = AsWeakPtr(); if (event->type() == ui::ET_KEY_PRESSED) { bool key_handled = false; -#if defined(OS_APPLE) +#if defined(OS_MAC) // Special handling for Option-Up and Option-Down, which should behave like // Home and End respectively in menus. if ((event->flags() & ui::EF_ALT_DOWN)) { @@ -1252,7 +1252,7 @@ ui::Accelerator accelerator(*event); -#if defined(OS_APPLE) +#if defined(OS_MAC) if (AcceleratorShouldCancelMenu(accelerator)) { Cancel(ExitType::kAll); return ui::POST_DISPATCH_PERFORM_DEFAULT; @@ -1319,7 +1319,7 @@ } void MenuController::OnMenuItemDestroying(MenuItemView* menu_item) { -#if defined(OS_APPLE) +#if defined(OS_MAC) if (menu_closure_animation_ && menu_closure_animation_->item() == menu_item) menu_closure_animation_.reset(); #endif @@ -1564,7 +1564,7 @@ break; // On Mac, treat space the same as return. -#if !defined(OS_APPLE) +#if !defined(OS_MAC) case ui::VKEY_SPACE: SendAcceleratorToHotTrackedView(event.flags()); break; @@ -1576,7 +1576,7 @@ // Fallthrough to accept or dismiss combobox menus on F4, like windows. FALLTHROUGH; case ui::VKEY_RETURN: -#if defined(OS_APPLE) +#if defined(OS_MAC) case ui::VKEY_SPACE: #endif // An odd special case: if a prefix selection is in flight, space should @@ -1620,7 +1620,7 @@ CloseSubmenu(); break; -#if !defined(OS_APPLE) +#if !defined(OS_MAC) case ui::VKEY_APPS: { Button* hot_view = GetFirstHotTrackedView(pending_state_.item); if (hot_view) { @@ -1728,7 +1728,7 @@ } void MenuController::Accept(MenuItemView* item, int event_flags) { -#if defined(OS_APPLE) +#if defined(OS_MAC) menu_closure_animation_ = std::make_unique<MenuClosureAnimationMac>( item, item->GetParentMenuItem()->GetSubmenu(), base::BindOnce(&MenuController::ReallyAccept, base::Unretained(this), @@ -1742,7 +1742,7 @@ void MenuController::ReallyAccept(MenuItemView* item, int event_flags) { DCHECK(!for_drop_); result_ = item; -#if defined(OS_APPLE) +#if defined(OS_MAC) // Reset the closure animation since it's now finished - this also unblocks // input events for the menu. menu_closure_animation_.reset(); @@ -2915,7 +2915,7 @@ if (last_part.type != MenuPart::Type::kNone) exit_type = ExitType::kOutermost; } -#if defined(OS_APPLE) +#if defined(OS_MAC) // When doing a menu closure animation, target the deepest submenu - that way // MenuClosureAnimationMac will fade out all the menus in sync, rather than // the shallowest menu only. @@ -3243,7 +3243,7 @@ } bool MenuController::CanProcessInputEvents() const { -#if defined(OS_APPLE) +#if defined(OS_MAC) return !menu_closure_animation_; #else return true;
diff --git a/ui/views/controls/menu/menu_controller.h b/ui/views/controls/menu/menu_controller.h index 5c93ce1..90cf0b0 100644 --- a/ui/views/controls/menu/menu_controller.h +++ b/ui/views/controls/menu/menu_controller.h
@@ -29,7 +29,7 @@ #include "ui/views/controls/menu/menu_delegate.h" #include "ui/views/widget/widget_observer.h" -#if defined(OS_APPLE) +#if defined(OS_MAC) #include "ui/views/controls/menu/menu_closure_animation_mac.h" #include "ui/views/controls/menu/menu_cocoa_watcher_mac.h" #endif @@ -778,7 +778,7 @@ // A mask of the EventFlags for the mouse buttons currently pressed. int current_mouse_pressed_state_ = 0; -#if defined(OS_APPLE) +#if defined(OS_MAC) std::unique_ptr<MenuClosureAnimationMac> menu_closure_animation_; std::unique_ptr<MenuCocoaWatcherMac> menu_cocoa_watcher_; #endif
diff --git a/ui/views/controls/menu/menu_controller_unittest.cc b/ui/views/controls/menu/menu_controller_unittest.cc index 0dd94b5..edf2bec 100644 --- a/ui/views/controls/menu/menu_controller_unittest.cc +++ b/ui/views/controls/menu/menu_controller_unittest.cc
@@ -2795,7 +2795,7 @@ EXPECT_EQ(ax_counter.GetCount(ax::mojom::Event::kSelectedChildrenChanged), 2); } -#if defined(OS_APPLE) +#if defined(OS_MAC) // This test exercises a Mac-specific behavior, by which hotkeys using modifiers // cause menus to close and the hotkeys to be handled by the browser window. // This specific test case tries using cmd-ctrl-f, which normally means
diff --git a/ui/views/controls/menu/menu_host.cc b/ui/views/controls/menu/menu_host.cc index 55d36b39..59776a3 100644 --- a/ui/views/controls/menu/menu_host.cc +++ b/ui/views/controls/menu/menu_host.cc
@@ -24,7 +24,7 @@ #include "ui/views/widget/native_widget_private.h" #include "ui/views/widget/widget.h" -#if !defined(OS_APPLE) +#if !defined(OS_MAC) #include "ui/aura/window.h" #endif @@ -32,7 +32,7 @@ namespace internal { -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // This class adds itself as the pre target handler for the |window| // passed in. It currently handles touch events and forwards them to the // controller. Reason for this approach is views does not get raw touch @@ -79,7 +79,7 @@ DISALLOW_COPY_AND_ASSIGN(PreMenuEventDispatchHandler); }; -#endif // OS_APPLE +#endif // OS_MAC void TransferGesture(ui::GestureRecognizer* gesture_recognizer, gfx::NativeView source, @@ -145,7 +145,7 @@ #endif Init(std::move(params)); -#if !defined(OS_APPLE) +#if !defined(OS_MAC) pre_dispatch_handler_ = std::make_unique<internal::PreMenuEventDispatchHandler>( menu_controller, submenu_, GetNativeView()); @@ -215,7 +215,7 @@ HideMenuHost(); destroying_ = true; static_cast<MenuHostRootView*>(GetRootView())->ClearSubmenu(); -#if !defined(OS_APPLE) +#if !defined(OS_MAC) pre_dispatch_handler_.reset(); #endif Close();
diff --git a/ui/views/controls/menu/menu_host.h b/ui/views/controls/menu/menu_host.h index 4797d16..b1872ec 100644 --- a/ui/views/controls/menu/menu_host.h +++ b/ui/views/controls/menu/menu_host.h
@@ -98,7 +98,7 @@ // If true and capture is lost we don't notify the delegate. bool ignore_capture_lost_; -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // Handles raw touch events at the moment. std::unique_ptr<internal::PreMenuEventDispatchHandler> pre_dispatch_handler_; #endif
diff --git a/ui/views/controls/menu/menu_item_view.cc b/ui/views/controls/menu/menu_item_view.cc index 620e578..f9ff1757 100644 --- a/ui/views/controls/menu/menu_item_view.cc +++ b/ui/views/controls/menu/menu_item_view.cc
@@ -53,9 +53,9 @@ #include "ui/views/views_features.h" #include "ui/views/widget/widget.h" -#if defined(OS_APPLE) +#if defined(OS_MAC) #include "ui/views/accessibility/view_accessibility.h" -#endif // defined(OS_APPLE) +#endif // defined(OS_MAC) namespace views { @@ -406,7 +406,7 @@ if (!submenu_) { submenu_ = new SubmenuView(this); -#if defined(OS_APPLE) +#if defined(OS_MAC) // All MenuItemViews of Type kSubMenu have a respective SubmenuView. // However, in the Views hierarchy, this SubmenuView is not a child of the // MenuItemView. This confuses VoiceOver, because it expects the submenu @@ -416,7 +416,7 @@ std::make_unique<AXVirtualView>(); virtual_child->GetCustomData().role = ax::mojom::Role::kMenu; GetViewAccessibility().AddVirtualChildView(std::move(virtual_child)); -#endif // defined(OS_APPLE) +#endif // defined(OS_MAC) // Initialize the submenu indicator icon (arrow). submenu_arrow_image_view_ = AddChildView(std::make_unique<ImageView>());
diff --git a/ui/views/controls/menu/menu_runner_impl.cc b/ui/views/controls/menu/menu_runner_impl.cc index 31c75600..6e54d8d 100644 --- a/ui/views/controls/menu/menu_runner_impl.cc +++ b/ui/views/controls/menu/menu_runner_impl.cc
@@ -73,7 +73,7 @@ namespace internal { -#if !defined(OS_APPLE) +#if !defined(OS_MAC) MenuRunnerImplInterface* MenuRunnerImplInterface::Create( ui::MenuModel* menu_model, int32_t run_types, @@ -270,7 +270,7 @@ show_mnemonics |= ui::win::IsAltPressed(); #elif defined(USE_X11) || defined(USE_OZONE) show_mnemonics |= IsAltPressed(); -#elif defined(OS_APPLE) +#elif defined(OS_MAC) show_mnemonics = false; #endif return show_mnemonics;
diff --git a/ui/views/controls/menu/menu_runner_unittest.cc b/ui/views/controls/menu/menu_runner_unittest.cc index dc01f760..f771216 100644 --- a/ui/views/controls/menu/menu_runner_unittest.cc +++ b/ui/views/controls/menu/menu_runner_unittest.cc
@@ -266,7 +266,7 @@ // This test is Mac-specific: Mac is the only platform where VKEY_SPACE // activates menu items. -#if defined(OS_APPLE) +#if defined(OS_MAC) TEST_F(MenuRunnerTest, SpaceActivatesItem) { if (!MenuConfig::instance().all_menus_use_prefix_selection) return; @@ -291,7 +291,7 @@ EXPECT_EQ(1, delegate->on_menu_closed_called()); EXPECT_NE(nullptr, delegate->on_menu_closed_menu()); } -#endif // OS_APPLE +#endif // OS_MAC // Tests that attempting to nest a menu within a drag-and-drop menu does not // cause a crash. Instead the drag and drop action should be canceled, and the
diff --git a/ui/views/controls/resize_area_unittest.cc b/ui/views/controls/resize_area_unittest.cc index fc38244..300a675 100644 --- a/ui/views/controls/resize_area_unittest.cc +++ b/ui/views/controls/resize_area_unittest.cc
@@ -17,7 +17,7 @@ #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_utils.h" -#if !defined(OS_APPLE) +#if !defined(OS_MAC) #include "ui/aura/window.h" #endif @@ -147,7 +147,7 @@ } // TODO(tdanderson): Enable these tests on OSX. See crbug.com/710475. -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // Verifies the correct calls have been made to // TestResizeAreaDelegate::OnResize() for a sequence of mouse events // corresponding to a successful resize operation. @@ -201,6 +201,6 @@ EXPECT_EQ(0, resize_amount()); } -#endif // !defined(OS_APPLE) +#endif // !defined(OS_MAC) } // namespace views
diff --git a/ui/views/controls/scroll_view.cc b/ui/views/controls/scroll_view.cc index 622f1d0..ab3c97ce 100644 --- a/ui/views/controls/scroll_view.cc +++ b/ui/views/controls/scroll_view.cc
@@ -489,7 +489,7 @@ // if its OverlapsContent matches other bar's. if (horizontal_scroll_bar_mode_ == ScrollBarMode::kEnabled && vertical_scroll_bar_mode_ == ScrollBarMode::kEnabled) { -#if defined(OS_APPLE) +#if defined(OS_MAC) // On Mac, scrollbars may update their style one at a time, so they may // temporarily be of different types. Refuse to lay out at this point. if (horiz_sb_->OverlapsContent() != vert_sb_->OverlapsContent())
diff --git a/ui/views/controls/scroll_view_unittest.cc b/ui/views/controls/scroll_view_unittest.cc index 5043e82..0ac8b39b 100644 --- a/ui/views/controls/scroll_view_unittest.cc +++ b/ui/views/controls/scroll_view_unittest.cc
@@ -30,7 +30,7 @@ #include "ui/views/test/widget_test.h" #include "ui/views/view_test_api.h" -#if defined(OS_APPLE) +#if defined(OS_MAC) #include "ui/base/test/scoped_preferred_scroller_style_mac.h" #endif @@ -247,7 +247,7 @@ } protected: -#if defined(OS_APPLE) +#if defined(OS_MAC) void SetOverlayScrollersEnabled(bool enabled) { // Ensure the old scroller override is destroyed before creating a new one. // Otherwise, the swizzlers are interleaved and restore incorrect methods. @@ -295,7 +295,7 @@ // Adds a ScrollView with the given |contents_view| and does layout. ScrollView* AddScrollViewWithContents(std::unique_ptr<View> contents, bool commit_layers = true) { -#if defined(OS_APPLE) +#if defined(OS_MAC) scroller_style_ = std::make_unique<ui::test::ScopedPreferredScrollerStyle>( use_overlay_scrollers_); #endif @@ -371,7 +371,7 @@ base::RepeatingClosure quit_closure_; -#if defined(OS_APPLE) +#if defined(OS_MAC) std::unique_ptr<ui::test::ScopedPreferredScrollerStyle> scroller_style_; #endif @@ -1185,7 +1185,7 @@ EXPECT_FALSE(test_api.contents_viewport()->layer()); } -#if defined(OS_APPLE) +#if defined(OS_MAC) // Tests the overlay scrollbars on Mac. Ensure that they show up properly and // do not overlap each other. TEST_F(ScrollViewTest, CocoaOverlayScrollBars) { @@ -1351,7 +1351,7 @@ EXPECT_EQ(gfx::ScrollOffset(x_offset, y_offset), test_api.CurrentOffset()); } -#endif // OS_APPLE +#endif // OS_MAC // Test that increasing the size of the viewport "below" scrolled content causes // the content to scroll up so that it still fills the viewport.
diff --git a/ui/views/controls/scrollbar/scroll_bar.cc b/ui/views/controls/scrollbar/scroll_bar.cc index d479c598..e7965de 100644 --- a/ui/views/controls/scrollbar/scroll_bar.cc +++ b/ui/views/controls/scrollbar/scroll_bar.cc
@@ -391,7 +391,7 @@ /////////////////////////////////////////////////////////////////////////////// // ScrollBar, private: -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // static base::RetainingOneShotTimer* ScrollBar::GetHideTimerForTesting( ScrollBar* scroll_bar) {
diff --git a/ui/views/controls/scrollbar/scrollbar_unittest.cc b/ui/views/controls/scrollbar/scrollbar_unittest.cc index 2d74d2a..0dbd82f 100644 --- a/ui/views/controls/scrollbar/scrollbar_unittest.cc +++ b/ui/views/controls/scrollbar/scrollbar_unittest.cc
@@ -220,7 +220,7 @@ EXPECT_NE(nullptr, scrollbar_->menu_runner_); } -#if !defined(OS_APPLE) +#if !defined(OS_MAC) TEST_F(ScrollBarViewsTest, TestPageScrollingByPress) { ui::test::EventGenerator generator(GetRootWindow(widget_.get())); EXPECT_EQ(0, scrollbar_->GetPosition());
diff --git a/ui/views/controls/slider.cc b/ui/views/controls/slider.cc index 30ca1a5..0d58c41 100644 --- a/ui/views/controls/slider.cc +++ b/ui/views/controls/slider.cc
@@ -74,7 +74,7 @@ Slider::Slider(SliderListener* listener) : listener_(listener) { highlight_animation_.SetSlideDuration(base::TimeDelta::FromMilliseconds(150)); SetFlipCanvasOnPaintForRTLUI(true); -#if defined(OS_APPLE) +#if defined(OS_MAC) SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); #else SetFocusBehavior(FocusBehavior::ALWAYS);
diff --git a/ui/views/controls/slider_unittest.cc b/ui/views/controls/slider_unittest.cc index 105484b..cd62f65 100644 --- a/ui/views/controls/slider_unittest.cc +++ b/ui/views/controls/slider_unittest.cc
@@ -287,7 +287,7 @@ } // No touch on desktop Mac. Tracked in http://crbug.com/445520. -#if !defined(OS_APPLE) || defined(USE_AURA) +#if !defined(OS_MAC) || defined(USE_AURA) // Test the slider location after a tap gesture. TEST_P(SliderTest, SliderValueForTapGesture) { @@ -460,7 +460,7 @@ EXPECT_EQ(1, ax_counter.GetCount(ax::mojom::Event::kValueChanged)); } -#endif // !defined(OS_APPLE) || defined(USE_AURA) +#endif // !defined(OS_MAC) || defined(USE_AURA) INSTANTIATE_TEST_SUITE_P(All, SliderTest,
diff --git a/ui/views/controls/tabbed_pane/tabbed_pane.cc b/ui/views/controls/tabbed_pane/tabbed_pane.cc index 5924b41..7a3d405 100644 --- a/ui/views/controls/tabbed_pane/tabbed_pane.cc +++ b/ui/views/controls/tabbed_pane/tabbed_pane.cc
@@ -78,7 +78,7 @@ contents_->SetVisible(selected); contents_->parent()->InvalidateLayout(); SetState(selected ? State::kActive : State::kInactive); -#if defined(OS_APPLE) +#if defined(OS_MAC) SetFocusBehavior(selected ? FocusBehavior::ACCESSIBLE_ONLY : FocusBehavior::NEVER); #else
diff --git a/ui/views/controls/table/table_view.cc b/ui/views/controls/table/table_view.cc index c787085..f691d19 100644 --- a/ui/views/controls/table/table_view.cc +++ b/ui/views/controls/table/table_view.cc
@@ -86,7 +86,7 @@ // Whether the platform "command" key is down. bool IsCmdOrCtrl(const ui::Event& event) { -#if defined(OS_APPLE) +#if defined(OS_MAC) return event.IsCommandDown(); #else return event.IsControlDown(); @@ -503,7 +503,7 @@ return true; case ui::VKEY_UP: -#if defined(OS_APPLE) +#if defined(OS_MAC) if (event.IsAltDown()) { if (GetRowCount()) SelectByViewIndex(0); @@ -516,7 +516,7 @@ return true; case ui::VKEY_DOWN: -#if defined(OS_APPLE) +#if defined(OS_MAC) if (event.IsAltDown()) { if (GetRowCount()) SelectByViewIndex(GetRowCount() - 1);
diff --git a/ui/views/controls/table/table_view_unittest.cc b/ui/views/controls/table/table_view_unittest.cc index 2f8365ac..d48e401 100644 --- a/ui/views/controls/table/table_view_unittest.cc +++ b/ui/views/controls/table/table_view_unittest.cc
@@ -132,7 +132,7 @@ namespace { -#if defined(OS_APPLE) +#if defined(OS_MAC) constexpr int kCtrlOrCmdMask = ui::EF_COMMAND_DOWN; #else constexpr int kCtrlOrCmdMask = ui::EF_CONTROL_DOWN; @@ -1465,7 +1465,7 @@ } // No touch on desktop Mac. Tracked in http://crbug.com/445520. -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // Verifies selection works by way of a gesture. TEST_P(TableViewTest, SelectOnTap) { // Initially no selection.
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc index 23849c06..bbc306c 100644 --- a/ui/views/controls/textfield/textfield.cc +++ b/ui/views/controls/textfield/textfield.cc
@@ -87,7 +87,7 @@ #include "ui/wm/core/ime_util_chromeos.h" #endif -#if defined(OS_APPLE) +#if defined(OS_MAC) #include "ui/base/cocoa/defaults_utils.h" #include "ui/base/cocoa/secure_password_input.h" #endif @@ -211,7 +211,7 @@ ? base::TimeDelta() : base::TimeDelta::FromMilliseconds(system_value); } -#elif defined(OS_APPLE) +#elif defined(OS_MAC) base::TimeDelta system_value; if (ui::TextInsertionCaretBlinkPeriod(&system_value)) return system_value; @@ -242,7 +242,7 @@ if (use_focus_ring_) focus_ring_ = FocusRing::Install(this); -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // Do not map accelerators on Mac. E.g. They might not reflect custom // keybindings that a user has set. But also on Mac, these commands dispatch // via the "responder chain" when the OS searches through menu items in the @@ -1079,11 +1079,11 @@ if (focus_reason_ == ui::TextInputClient::FOCUS_REASON_NONE) focus_reason_ = ui::TextInputClient::FOCUS_REASON_OTHER; -#if defined(OS_APPLE) +#if defined(OS_MAC) if (text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD) password_input_enabler_ = std::make_unique<ui::ScopedPasswordInputEnabler>(); -#endif // defined(OS_APPLE) +#endif // defined(OS_MAC) GetRenderText()->set_focused(true); if (GetInputMethod()) @@ -1118,9 +1118,9 @@ SchedulePaint(); View::OnBlur(); -#if defined(OS_APPLE) +#if defined(OS_MAC) password_input_enabler_.reset(); -#endif // defined(OS_APPLE) +#endif // defined(OS_MAC) } gfx::Point Textfield::GetKeyboardContextMenuLocation() { @@ -1732,7 +1732,7 @@ case ui::TextEditCommand::SCROLL_PAGE_UP: // On Mac, the textfield should respond to Up/Down arrows keys and // PageUp/PageDown. -#if defined(OS_APPLE) +#if defined(OS_MAC) return true; #else return GetRenderText()->multiline(); @@ -2163,7 +2163,7 @@ return ui::TextEditCommand::INVALID_COMMAND; const bool shift = event.IsShiftDown(); -#if defined(OS_APPLE) +#if defined(OS_MAC) const bool command = event.IsCommandDown(); #endif const bool control = event.IsControlDown() || event.IsCommandDown(); @@ -2214,7 +2214,7 @@ return ui::TextEditCommand:: MOVE_TO_BEGINNING_OF_LINE_AND_MODIFY_SELECTION; } -#if defined(OS_APPLE) +#if defined(OS_MAC) return ui::TextEditCommand::SCROLL_TO_BEGINNING_OF_DOCUMENT; #else return ui::TextEditCommand::MOVE_TO_BEGINNING_OF_LINE; @@ -2222,13 +2222,13 @@ case ui::VKEY_END: if (shift) return ui::TextEditCommand::MOVE_TO_END_OF_LINE_AND_MODIFY_SELECTION; -#if defined(OS_APPLE) +#if defined(OS_MAC) return ui::TextEditCommand::SCROLL_TO_END_OF_DOCUMENT; #else return ui::TextEditCommand::MOVE_TO_END_OF_LINE; #endif case ui::VKEY_UP: -#if defined(OS_APPLE) +#if defined(OS_MAC) if (control && shift) { return ui::TextEditCommand:: MOVE_PARAGRAPH_BACKWARD_AND_MODIFY_SELECTION; @@ -2244,7 +2244,7 @@ : ui::TextEditCommand::INVALID_COMMAND; #endif case ui::VKEY_DOWN: -#if defined(OS_APPLE) +#if defined(OS_MAC) if (control && shift) { return ui::TextEditCommand::MOVE_PARAGRAPH_FORWARD_AND_MODIFY_SELECTION; }
diff --git a/ui/views/controls/textfield/textfield.h b/ui/views/controls/textfield/textfield.h index 5e3a9f1..e122698a 100644 --- a/ui/views/controls/textfield/textfield.h +++ b/ui/views/controls/textfield/textfield.h
@@ -53,11 +53,11 @@ class TimeDelta; } -#if defined(OS_APPLE) +#if defined(OS_MAC) namespace ui { class ScopedPasswordInputEnabler; } -#endif // defined(OS_APPLE) +#endif // defined(OS_MAC) namespace views { @@ -85,7 +85,7 @@ kLastCommandId = kSelectAll, }; -#if defined(OS_APPLE) +#if defined(OS_MAC) static constexpr gfx::SelectionBehavior kLineSelectionBehavior = gfx::SELECTION_EXTEND; static constexpr gfx::SelectionBehavior kWordSelectionBehavior = @@ -756,10 +756,10 @@ // View containing the text cursor. View* cursor_view_ = nullptr; -#if defined(OS_APPLE) +#if defined(OS_MAC) // Used to track active password input sessions. std::unique_ptr<ui::ScopedPasswordInputEnabler> password_input_enabler_; -#endif // defined(OS_APPLE) +#endif // defined(OS_MAC) // How this textfield was focused. ui::TextInputClient::FocusReason focus_reason_ =
diff --git a/ui/views/controls/textfield/textfield_model_unittest.cc b/ui/views/controls/textfield/textfield_model_unittest.cc index 309892f..7baea47 100644 --- a/ui/views/controls/textfield/textfield_model_unittest.cc +++ b/ui/views/controls/textfield/textfield_model_unittest.cc
@@ -236,7 +236,7 @@ model.SetText(u"ABC\xFF80\xFF9E", 0); model.MoveCursorTo(model.text().length()); model.Backspace(); -#if defined(OS_APPLE) +#if defined(OS_MAC) // On Mac, the entire cluster should be deleted to match // NSTextField behavior. EXPECT_EQ(u"ABC", model.text()); @@ -251,7 +251,7 @@ model.SetText(u"\U0001F466\U0001F3FE", 0); model.MoveCursorTo(model.text().length()); model.Backspace(); -#if defined(OS_APPLE) +#if defined(OS_MAC) // On Mac, the entire emoji should be deleted to match NSTextField // behavior. EXPECT_EQ(u"", model.text());
diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc index e0974e57..79bbe98c 100644 --- a/ui/views/controls/textfield/textfield_unittest.cc +++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -72,7 +72,7 @@ #include "ui/wm/core/ime_util_chromeos.h" #endif -#if defined(OS_APPLE) +#if defined(OS_MAC) #include "ui/base/cocoa/secure_password_input.h" #include "ui/base/cocoa/text_services_context_menu.h" #endif @@ -218,7 +218,7 @@ // On Mac, emulate InputMethodMac behavior for character events. Composition // still needs to be mocked, since it's not possible to generate test events // which trigger the appropriate NSResponder action messages for composition. -#if defined(OS_APPLE) +#if defined(OS_MAC) if (key->is_char()) return DispatchKeyEventPostIME(key); #endif @@ -335,7 +335,7 @@ // ui::TextInputClient: void InsertChar(const ui::KeyEvent& e) override { views::Textfield::InsertChar(e); -#if defined(OS_APPLE) +#if defined(OS_MAC) // On Mac, characters are inserted directly rather than attempting to get a // unicode character from the ui::KeyEvent (which isn't always possible). key_received_ = true; @@ -498,7 +498,7 @@ } bool TextfieldTest::TestingNativeMac() const { -#if defined(OS_APPLE) +#if defined(OS_MAC) return true; #else return false; @@ -574,7 +574,7 @@ std::vector<uint8_t>(ui::kPropertyFromVKSize); event.SetProperties(properties); } -#if defined(OS_APPLE) +#if defined(OS_MAC) event_generator_->Dispatch(&event); #else input_method_->DispatchKeyEvent(&event); @@ -724,7 +724,7 @@ int menu_index = 0; -#if defined(OS_APPLE) +#if defined(OS_MAC) if (textfield_has_selection) { EXPECT_TRUE(menu->IsEnabledAt(menu_index++ /* Look Up "Selection" */)); EXPECT_TRUE(menu->IsEnabledAt(menu_index++ /* Separator */)); @@ -977,7 +977,7 @@ } #endif -#if defined(OS_WIN) || defined(OS_APPLE) +#if defined(OS_WIN) || defined(OS_MAC) #define MAYBE_KeysWithModifiersTest KeysWithModifiersTest #else // TODO(crbug.com/645104): Implement keyboard layout changing for other @@ -1061,7 +1061,7 @@ SendHomeEvent(true); // On Mac, the existing selection should be extended. -#if defined(OS_APPLE) +#if defined(OS_MAC) EXPECT_STR_EQ("ZERO two three", textfield_->GetSelectedText()); #else EXPECT_STR_EQ("ZERO ", textfield_->GetSelectedText()); @@ -1092,7 +1092,7 @@ // On Mac, the selection should reduce to a caret when the selection direction // changes for a word selection. -#if defined(OS_APPLE) +#if defined(OS_MAC) EXPECT_EQ(gfx::Range(6), textfield_->GetSelectedRange()); #else EXPECT_STR_EQ("345", textfield_->GetSelectedText()); @@ -1100,7 +1100,7 @@ #endif SendWordEvent(ui::VKEY_LEFT, true); -#if defined(OS_APPLE) +#if defined(OS_MAC) EXPECT_STR_EQ("345", textfield_->GetSelectedText()); #else EXPECT_STR_EQ("12 345", textfield_->GetSelectedText()); @@ -1125,7 +1125,7 @@ // Select line towards left. On Mac, the existing selection should be extended // to cover the whole line. SendHomeEvent(true); -#if defined(OS_APPLE) +#if defined(OS_MAC) EXPECT_EQ(textfield_->GetText(), textfield_->GetSelectedText()); #else EXPECT_STR_EQ("12 345", textfield_->GetSelectedText()); @@ -1134,7 +1134,7 @@ // Select line towards right. SendEndEvent(true); -#if defined(OS_APPLE) +#if defined(OS_MAC) EXPECT_EQ(textfield_->GetText(), textfield_->GetSelectedText()); #else EXPECT_STR_EQ("67 89", textfield_->GetSelectedText()); @@ -1151,7 +1151,7 @@ // commands. SendKeyEvent(ui::VKEY_UP); EXPECT_TRUE(textfield_->key_received()); -#if defined(OS_APPLE) +#if defined(OS_MAC) EXPECT_TRUE(textfield_->key_handled()); EXPECT_EQ(gfx::Range(0), textfield_->GetSelectedRange()); #else @@ -1161,7 +1161,7 @@ SendKeyEvent(ui::VKEY_DOWN); EXPECT_TRUE(textfield_->key_received()); -#if defined(OS_APPLE) +#if defined(OS_MAC) EXPECT_TRUE(textfield_->key_handled()); EXPECT_EQ(gfx::Range(11), textfield_->GetSelectedRange()); #else @@ -1191,7 +1191,7 @@ // MOVE_PAGE_[UP/DOWN] and the associated selection commands should only be // enabled on Mac. -#if defined(OS_APPLE) +#if defined(OS_MAC) textfield_->SetText(u"12 34567 89"); textfield_->SetEditableSelectionRange(gfx::Range(6)); @@ -1243,7 +1243,7 @@ ui::TextEditCommand::MOVE_PARAGRAPH_BACKWARD_AND_MODIFY_SELECTION); // On Mac, the selection should reduce to a caret when the selection direction // is reversed for MOVE_PARAGRAPH_[FORWARD/BACKWARD]_AND_MODIFY_SELECTION. -#if defined(OS_APPLE) +#if defined(OS_MAC) EXPECT_EQ(gfx::Range(6), textfield_->GetSelectedRange()); #else EXPECT_EQ(gfx::Range(6, 0), textfield_->GetSelectedRange()); @@ -1255,7 +1255,7 @@ test_api_->ExecuteTextEditCommand( ui::TextEditCommand::MOVE_PARAGRAPH_FORWARD_AND_MODIFY_SELECTION); -#if defined(OS_APPLE) +#if defined(OS_MAC) EXPECT_EQ(gfx::Range(6), textfield_->GetSelectedRange()); #else EXPECT_EQ(gfx::Range(6, 11), textfield_->GetSelectedRange()); @@ -1465,7 +1465,7 @@ SendKeyEvent(ui::VKEY_A); EXPECT_EQ(-1, textfield_->GetPasswordCharRevealIndex()); SendKeyEvent(kHebrewLetterSamekh, ui::EF_NONE, true /* from_vk */); -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // Don't verifies the password character reveal on MacOS, because on MacOS, // the text insertion is not done through TextInputClient::InsertChar(). EXPECT_EQ(1, textfield_->GetPasswordCharRevealIndex()); @@ -2416,7 +2416,7 @@ // Ctrl+Y is bound to "Yank" and Cmd+Y is bound to "Show full history". So, on // Mac, Cmd+Shift+Z is sent for the tests above and the Ctrl+Y test below is // skipped. -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // Test that Ctrl+Y works for Redo, as well as Ctrl+Shift+Z. TEST_F(TextfieldTest, RedoWithCtrlY) { @@ -2433,11 +2433,11 @@ EXPECT_STR_EQ("a", textfield_->GetText()); } -#endif // !defined(OS_APPLE) +#endif // !defined(OS_MAC) // Non-Mac platforms don't have a key binding for Yank. Since this test is only // run on Mac, it uses some Mac specific key bindings. -#if defined(OS_APPLE) +#if defined(OS_MAC) TEST_F(TextfieldTest, Yank) { InitTextfield(2); @@ -2496,7 +2496,7 @@ EXPECT_STR_EQ("efabefeef", textfield_->GetText()); } -#endif // defined(OS_APPLE) +#endif // defined(OS_MAC) TEST_F(TextfieldTest, CutCopyPaste) { InitTextfield(); @@ -3567,7 +3567,7 @@ } // No touch on desktop Mac. Tracked in http://crbug.com/445520. -#if defined(OS_APPLE) +#if defined(OS_MAC) #define MAYBE_TapOnSelection DISABLED_TapOnSelection #else #define MAYBE_TapOnSelection TapOnSelection @@ -3839,7 +3839,7 @@ InitTextfield(); EXPECT_TRUE(textfield_->context_menu_controller()); -#if defined(OS_APPLE) +#if defined(OS_MAC) // On Mac, when there is text, the "Look up" item (+ separator) takes the top // position, and emoji comes after. constexpr int kExpectedEmojiIndex = 2; @@ -3859,7 +3859,7 @@ l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_EMOJI)); } -#if defined(OS_APPLE) +#if defined(OS_MAC) // Tests to see if the BiDi submenu items are updated correctly when the // textfield's text direction is changed. TEST_F(TextfieldTest, TextServicesContextMenuTextDirectionTest) { @@ -3926,7 +3926,7 @@ textfield_->OnBlur(); EXPECT_FALSE(ui::ScopedPasswordInputEnabler::IsPasswordInputEnabled()); } -#endif // defined(OS_APPLE) +#endif // defined(OS_MAC) TEST_F(TextfieldTest, AccessibilitySelectionEvents) { const std::string& kText = "abcdef"; @@ -4115,7 +4115,7 @@ InitTextfield(); // Scroll commands are only available on Mac. -#if defined(OS_APPLE) +#if defined(OS_MAC) textfield_->SetText(u"12 34567 89"); textfield_->SetEditableSelectionRange(gfx::Range(6));
diff --git a/ui/views/controls/tree/tree_view.cc b/ui/views/controls/tree/tree_view.cc index e0b6773..08a33bc 100644 --- a/ui/views/controls/tree/tree_view.cc +++ b/ui/views/controls/tree/tree_view.cc
@@ -84,7 +84,7 @@ drawing_provider_(std::make_unique<TreeViewDrawingProvider>()) { // Always focusable, even on Mac (consistent with NSOutlineView). SetFocusBehavior(FocusBehavior::ALWAYS); -#if defined(OS_APPLE) +#if defined(OS_MAC) constexpr bool kUseMdIcons = true; #else constexpr bool kUseMdIcons = false;
diff --git a/ui/views/controls/views_text_services_context_menu_base.cc b/ui/views/controls/views_text_services_context_menu_base.cc index 531ebe3..ba7f725a 100644 --- a/ui/views/controls/views_text_services_context_menu_base.cc +++ b/ui/views/controls/views_text_services_context_menu_base.cc
@@ -50,7 +50,7 @@ #if defined(OS_WIN) *accelerator = ui::Accelerator(ui::VKEY_OEM_PERIOD, ui::EF_COMMAND_DOWN); return true; -#elif defined(OS_APPLE) +#elif defined(OS_MAC) *accelerator = ui::Accelerator(ui::VKEY_SPACE, ui::EF_COMMAND_DOWN | ui::EF_CONTROL_DOWN); return true; @@ -85,7 +85,7 @@ return command_id == IDS_CONTENT_CONTEXT_EMOJI; } -#if !defined(OS_APPLE) && !BUILDFLAG(IS_CHROMEOS_ASH) +#if !defined(OS_MAC) && !BUILDFLAG(IS_CHROMEOS_ASH) // static std::unique_ptr<ViewsTextServicesContextMenu> ViewsTextServicesContextMenu::Create(ui::SimpleMenuModel* menu,
diff --git a/ui/views/controls/views_text_services_context_menu_base.h b/ui/views/controls/views_text_services_context_menu_base.h index 4651047..34fa409 100644 --- a/ui/views/controls/views_text_services_context_menu_base.h +++ b/ui/views/controls/views_text_services_context_menu_base.h
@@ -34,7 +34,7 @@ bool SupportsCommand(int command_id) const override; protected: -#if defined(OS_APPLE) || BUILDFLAG(IS_CHROMEOS_ASH) +#if defined(OS_MAC) || BUILDFLAG(IS_CHROMEOS_ASH) Textfield* client() { return client_; } const Textfield* client() const { return client_; } #endif
diff --git a/ui/views/examples/dialog_example.cc b/ui/views/examples/dialog_example.cc index 2dd282b..e3a1dab 100644 --- a/ui/views/examples/dialog_example.cc +++ b/ui/views/examples/dialog_example.cc
@@ -317,7 +317,7 @@ void DialogExample::OnPerformAction() { bool enable = bubble_->GetChecked() || GetModalType() != ui::MODAL_TYPE_CHILD; -#if defined(OS_APPLE) +#if defined(OS_MAC) enable = enable && GetModalType() != ui::MODAL_TYPE_SYSTEM; #endif show_->SetEnabled(enable);
diff --git a/ui/views/examples/examples_with_content_main.cc b/ui/views/examples/examples_with_content_main.cc index 31fac3a..b8dd433 100644 --- a/ui/views/examples/examples_with_content_main.cc +++ b/ui/views/examples/examples_with_content_main.cc
@@ -13,7 +13,7 @@ #include "ui/views/examples/examples_window_with_content.h" #include "ui/views_content_client/views_content_client.h" -#if defined(OS_APPLE) +#if defined(OS_MAC) #include "sandbox/mac/seatbelt_exec.h" #endif @@ -69,7 +69,7 @@ if (views::examples::CheckCommandLineUsage()) return 0; -#if defined(OS_APPLE) +#if defined(OS_MAC) base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); // ViewsContentClient expects a const char** argv and // CreateFromArgumentsResult expects a regular char** argv. Given this is a
diff --git a/ui/views/focus/focus_manager.cc b/ui/views/focus/focus_manager.cc index 0727f74..9618d65d 100644 --- a/ui/views/focus/focus_manager.cc +++ b/ui/views/focus/focus_manager.cc
@@ -343,9 +343,9 @@ // Change this to DCHECK once it's resolved. CHECK(!view || ContainsView(view)); -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // TODO(warx): There are some AccessiblePaneViewTest failed on macosx. - // crbug.com/650859. Remove !defined(OS_APPLE) once that is fixed. + // crbug.com/650859. Remove !defined(OS_MAC) once that is fixed. // // If the widget isn't active store the focused view and then attempt to // activate the widget. If activation succeeds |view| will be focused. @@ -532,7 +532,7 @@ if (delegate_ && delegate_->ProcessAccelerator(accelerator)) return true; -#if defined(OS_APPLE) +#if defined(OS_MAC) // On MacOS accelerators are processed when a bubble is opened without // manual redirection to bubble anchor widget. Including redirect on MacOS // breaks processing accelerators by the bubble itself. @@ -597,7 +597,7 @@ DCHECK(view); // |keyboard_accessible_| is only used on Mac. -#if defined(OS_APPLE) +#if defined(OS_MAC) return keyboard_accessible_ ? view->IsAccessibilityFocusable() : view->IsFocusable(); #else
diff --git a/ui/views/focus/focus_manager_unittest.cc b/ui/views/focus/focus_manager_unittest.cc index a18f119..749d785d 100644 --- a/ui/views/focus/focus_manager_unittest.cc +++ b/ui/views/focus/focus_manager_unittest.cc
@@ -765,7 +765,7 @@ GetFocusManager()->ClearFocus(); } -#if defined(OS_APPLE) +#if defined(OS_MAC) // Test that the correct view is restored if full keyboard access is changed. TEST_F(FocusManagerTest, StoreFocusedViewFullKeyboardAccess) { View* view1 = new View;
diff --git a/ui/views/focus/focus_search.cc b/ui/views/focus/focus_search.cc index 1443f3e..e71e5e2c 100644 --- a/ui/views/focus/focus_search.cc +++ b/ui/views/focus/focus_search.cc
@@ -16,7 +16,7 @@ FocusSearch::FocusSearch(View* root, bool cycle, bool accessibility_mode) : root_(root), cycle_(cycle), accessibility_mode_(accessibility_mode) { -#if defined(OS_APPLE) +#if defined(OS_MAC) // On Mac, only the keyboard accessibility mode defined in FocusManager is // used. No special accessibility mode should be applicable for a // FocusTraversable.
diff --git a/ui/views/focus/focus_traversal_unittest.cc b/ui/views/focus/focus_traversal_unittest.cc index 55f5ca1..c8c18a14 100644 --- a/ui/views/focus/focus_traversal_unittest.cc +++ b/ui/views/focus/focus_traversal_unittest.cc
@@ -625,7 +625,7 @@ AdvanceEntireFocusLoop(kTraversalIDs, true); } -#if defined(OS_APPLE) +#if defined(OS_MAC) // Test focus traversal with full keyboard access off on Mac. TEST_F(FocusTraversalTest, NormalTraversalMac) { GetFocusManager()->SetKeyboardAccessible(false); @@ -681,7 +681,7 @@ EXPECT_EQ(THUMBNAIL_CONTAINER_ID, GetFocusManager()->GetFocusedView()->GetID()); } -#endif // OS_APPLE +#endif // OS_MAC TEST_F(FocusTraversalTest, TraversalWithNonEnabledViews) { const int kDisabledIDs[] = {
diff --git a/ui/views/layout/animating_layout_manager_unittest.cc b/ui/views/layout/animating_layout_manager_unittest.cc index 02f66e60..beaa427 100644 --- a/ui/views/layout/animating_layout_manager_unittest.cc +++ b/ui/views/layout/animating_layout_manager_unittest.cc
@@ -4789,7 +4789,7 @@ // TODO(dfried): figure out why these tests absolutely do not animate properly // on Mac. Whatever magic makes the compositor animation runner go doesn't seem // to want to work on Mac in non-browsertests :( -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // Test fixture for testing sequences of the following four actions: // * animating layout manager configured on host view @@ -4984,6 +4984,6 @@ ExpectResetToLayout(); } -#endif // !defined(OS_APPLE) +#endif // !defined(OS_MAC) } // namespace views
diff --git a/ui/views/style/platform_style.cc b/ui/views/style/platform_style.cc index a5d59e7..ae7ded74 100644 --- a/ui/views/style/platform_style.cc +++ b/ui/views/style/platform_style.cc
@@ -34,7 +34,7 @@ const float PlatformStyle::kFocusHaloThickness = 2.f; const float PlatformStyle::kFocusHaloInset = -1.f; -#if !defined(OS_APPLE) +#if !defined(OS_MAC) const int PlatformStyle::kMinLabelButtonWidth = 70; const int PlatformStyle::kMinLabelButtonHeight = 33; @@ -85,7 +85,7 @@ return gfx::Range(cursor_position, previous_grapheme_index); } -#endif // OS_APPLE +#endif // OS_MAC #if !BUILDFLAG(ENABLE_DESKTOP_AURA) || \ (!defined(OS_LINUX) && !defined(OS_CHROMEOS))
diff --git a/ui/views/style/typography_provider.cc b/ui/views/style/typography_provider.cc index dff000d..82acff9 100644 --- a/ui/views/style/typography_provider.cc +++ b/ui/views/style/typography_provider.cc
@@ -14,7 +14,7 @@ #include "ui/views/style/typography.h" #include "ui/views/view.h" -#if defined(OS_APPLE) +#if defined(OS_MAC) #include "base/mac/mac_util.h" #endif @@ -147,7 +147,7 @@ // static gfx::Font::Weight TypographyProvider::MediumWeightForUI() { -#if defined(OS_APPLE) +#if defined(OS_MAC) // System fonts are not user-configurable on Mac, so there's a simpler check. // However, 10.11 do not ship with a MEDIUM weight system font. In that // case, trying to use MEDIUM there will give a bold font, which will look
diff --git a/ui/views/test/menu_test_utils.cc b/ui/views/test/menu_test_utils.cc index f6c55f0a..cd75fd54 100644 --- a/ui/views/test/menu_test_utils.cc +++ b/ui/views/test/menu_test_utils.cc
@@ -10,7 +10,7 @@ #include "ui/base/dragdrop/mojom/drag_drop_types.mojom.h" #include "ui/views/controls/menu/menu_controller.h" -#if defined(OS_APPLE) +#if defined(OS_MAC) #include "ui/views/controls/menu/menu_closure_animation_mac.h" #endif @@ -81,13 +81,13 @@ } void DisableMenuClosureAnimations() { -#if defined(OS_APPLE) +#if defined(OS_MAC) MenuClosureAnimationMac::DisableAnimationsForTesting(); #endif } void WaitForMenuClosureAnimation() { -#if defined(OS_APPLE) +#if defined(OS_MAC) // TODO(https://crbug.com/982815): Replace this with Quit+Run. base::RunLoop().RunUntilIdle(); #endif
diff --git a/ui/views/test/native_widget_factory.cc b/ui/views/test/native_widget_factory.cc index fcda46b..4735bc1 100644 --- a/ui/views/test/native_widget_factory.cc +++ b/ui/views/test/native_widget_factory.cc
@@ -10,7 +10,7 @@ #if defined(USE_AURA) #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" #include "ui/views/widget/native_widget_aura.h" -#elif defined(OS_APPLE) +#elif defined(OS_MAC) #include "ui/views/widget/native_widget_mac.h" #endif @@ -21,7 +21,7 @@ Widget* widget, uint32_t type, bool* destroyed) { -#if defined(OS_APPLE) +#if defined(OS_MAC) return new TestPlatformNativeWidget<NativeWidgetMac>( widget, type == kStubCapture, destroyed); #else
diff --git a/ui/views/test/test_views_delegate.h b/ui/views/test/test_views_delegate.h index b5e5729..e16a0ee 100644 --- a/ui/views/test/test_views_delegate.h +++ b/ui/views/test/test_views_delegate.h
@@ -37,7 +37,7 @@ void set_context(gfx::NativeWindow context) { context_ = context; } #endif -#if defined(OS_APPLE) +#if defined(OS_MAC) // Allows tests to provide a ContextFactory via the ViewsDelegate interface. void set_context_factory(ui::ContextFactory* context_factory) { context_factory_ = context_factory; @@ -57,12 +57,12 @@ #endif void OnBeforeWidgetInit(Widget::InitParams* params, internal::NativeWidgetDelegate* delegate) override; -#if defined(OS_APPLE) +#if defined(OS_MAC) ui::ContextFactory* GetContextFactory() override; #endif private: -#if defined(OS_APPLE) +#if defined(OS_MAC) ui::ContextFactory* context_factory_ = nullptr; #endif bool use_desktop_native_widgets_ = false;
diff --git a/ui/views/test/views_test_base.cc b/ui/views/test/views_test_base.cc index 7cbcbae..f48316d 100644 --- a/ui/views/test/views_test_base.cc +++ b/ui/views/test/views_test_base.cc
@@ -24,7 +24,7 @@ #if BUILDFLAG(ENABLE_DESKTOP_AURA) #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" #endif -#elif defined(OS_APPLE) +#elif defined(OS_MAC) #include "ui/views/widget/native_widget_mac.h" #endif @@ -144,7 +144,7 @@ test_helper_->SimulateNativeDestroy(widget); } -#if !defined(OS_APPLE) +#if !defined(OS_MAC) int ViewsTestBase::GetSystemReservedHeightAtTopOfScreen() { return 0; } @@ -157,7 +157,7 @@ NativeWidget* ViewsTestBase::CreateNativeWidgetForTest( const Widget::InitParams& init_params, internal::NativeWidgetDelegate* delegate) { -#if defined(OS_APPLE) +#if defined(OS_MAC) return new test::TestPlatformNativeWidget<NativeWidgetMac>(delegate, false, nullptr); #elif defined(USE_AURA)
diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc index 6c4141b..dee3f3d 100644 --- a/ui/views/view_unittest.cc +++ b/ui/views/view_unittest.cc
@@ -2285,7 +2285,7 @@ // TODO(themblsha): Bring this up on non-Mac platforms. It currently fails // because TestView::AcceleratorPressed() is not called. See // http://crbug.com/667757. -#if defined(OS_APPLE) +#if defined(OS_MAC) // Test that BridgedContentView correctly handles Accelerator key events when // subject to OS event dispatch. TEST_F(ViewTest, ActivateAcceleratorOnMac) { @@ -2328,11 +2328,11 @@ key_down_accelerator.modifiers()); EXPECT_EQ(view->accelerator_count_map_[key_down_accelerator], 1); } -#endif // OS_APPLE +#endif // OS_MAC // TODO(crbug.com/667757): these tests were initially commented out when getting // aura to run. Figure out if still valuable and either nuke or fix. -#if defined(OS_APPLE) +#if defined(OS_MAC) TEST_F(ViewTest, ActivateAccelerator) { ui::Accelerator return_accelerator(ui::VKEY_RETURN, ui::EF_NONE); TestViewWidget test_widget(CreateParams(Widget::InitParams::TYPE_POPUP), @@ -2414,7 +2414,7 @@ EXPECT_FALSE(focus_manager->ProcessAccelerator(return_accelerator)); EXPECT_EQ(1, view->accelerator_count_map_[return_accelerator]); } -#endif // OS_APPLE +#endif // OS_MAC //////////////////////////////////////////////////////////////////////////////// // Native view hierachy
diff --git a/ui/views/views_delegate.cc b/ui/views/views_delegate.cc index b238d27..dec3ec8 100644 --- a/ui/views/views_delegate.cc +++ b/ui/views/views_delegate.cc
@@ -117,7 +117,7 @@ return false; } -#if defined(OS_APPLE) +#if defined(OS_MAC) ui::ContextFactory* ViewsDelegate::GetContextFactory() { return nullptr; }
diff --git a/ui/views/views_delegate.h b/ui/views/views_delegate.h index d84acfa..27f4562 100644 --- a/ui/views/views_delegate.h +++ b/ui/views/views_delegate.h
@@ -29,7 +29,7 @@ } // namespace gfx namespace ui { -#if defined(OS_APPLE) +#if defined(OS_MAC) class ContextFactory; #endif class TouchEditingControllerFactory; @@ -165,7 +165,7 @@ // maximized windows; otherwise to restored windows. virtual bool WindowManagerProvidesTitleBar(bool maximized); -#if defined(OS_APPLE) +#if defined(OS_MAC) // Returns the context factory for new windows. virtual ui::ContextFactory* GetContextFactory(); #endif
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc index 4f9172e..56a8ac45 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
@@ -622,7 +622,10 @@ if (IsFullscreen() == fullscreen) return; + auto weak_ptr = GetWeakPtr(); platform_window()->ToggleFullscreen(); + if (!weak_ptr) + return; // The state must change synchronously to let media react on fullscreen // changes.
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc index 86a6610..4dcb1abd 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
@@ -466,7 +466,10 @@ } void DesktopWindowTreeHostWin::SetFullscreen(bool fullscreen) { + auto weak_ptr = GetWeakPtr(); message_handler_->SetFullscreen(fullscreen); + if (!weak_ptr) + return; // TODO(sky): workaround for ScopedFullscreenVisibility showing window // directly. Instead of this should listen for visibility changes and then // update window.
diff --git a/ui/views/widget/native_widget_aura.h b/ui/views/widget/native_widget_aura.h index 493ded56..18bc5dd3 100644 --- a/ui/views/widget/native_widget_aura.h +++ b/ui/views/widget/native_widget_aura.h
@@ -22,7 +22,7 @@ #include "ui/wm/public/activation_change_observer.h" #include "ui/wm/public/activation_delegate.h" -#if defined(OS_APPLE) +#if defined(OS_MAC) #error This file must not be included on macOS; Chromium Mac doesn't use Aura. #endif
diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc index 2f44aad..632a62d 100644 --- a/ui/views/widget/root_view.cc +++ b/ui/views/widget/root_view.cc
@@ -113,7 +113,7 @@ if (owner_->GetFocusManager()) // Can be NULL in unittests. v = owner_->GetFocusManager()->GetFocusedView(); // macOS doesn't have keyboard-triggered context menus. -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // Special case to handle keyboard-triggered context menus. if (v && v->GetEnabled() && ((event->key_code() == ui::VKEY_APPS) || @@ -267,7 +267,7 @@ // Accessibility --------------------------------------------------------------- void RootView::AnnounceText(const std::u16string& text) { -#if defined(OS_APPLE) +#if defined(OS_MAC) gfx::NativeViewAccessible native = GetViewAccessibility().GetNativeObject(); auto* ax_node = ui::AXPlatformNode::FromNativeViewAccessible(native); if (ax_node)
diff --git a/ui/views/widget/root_view_unittest.cc b/ui/views/widget/root_view_unittest.cc index fdd4c2c..0138d36 100644 --- a/ui/views/widget/root_view_unittest.cc +++ b/ui/views/widget/root_view_unittest.cc
@@ -119,7 +119,7 @@ // and VKEY_APPS) by the pre-target handler installed on RootView. TEST_F(RootViewTest, ContextMenuFromKeyEvent) { // This behavior is intentionally unsupported on macOS. -#if !defined(OS_APPLE) +#if !defined(OS_MAC) Widget widget; Widget::InitParams init_params = CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); @@ -851,7 +851,7 @@ widget->CloseNow(); } -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // Tests that AnnounceText sets up the correct text value on the hidden view, // and that the resulting hidden view actually stays hidden. @@ -881,7 +881,7 @@ node_data.GetString16Attribute(ax::mojom::StringAttribute::kName)); } -#endif // !defined(OS_APPLE) +#endif // !defined(OS_MAC) TEST_F(RootViewTest, MouseEventDispatchedToClosestEnabledView) { Widget widget;
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc index 8bb2131..a0ad0bc3 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc
@@ -760,7 +760,10 @@ if (IsFullscreen() == fullscreen) return; + auto weak_ptr = GetWeakPtr(); native_widget_->SetFullscreen(fullscreen); + if (!weak_ptr) + return; if (non_client_view_) non_client_view_->InvalidateLayout();
diff --git a/ui/views/widget/widget_interactive_uitest.cc b/ui/views/widget/widget_interactive_uitest.cc index c3736b6..64f69f8 100644 --- a/ui/views/widget/widget_interactive_uitest.cc +++ b/ui/views/widget/widget_interactive_uitest.cc
@@ -183,7 +183,7 @@ // Give the OS an opportunity to process messages for an activation change, when // there is actually no change expected (e.g. ShowInactive()). void RunPendingMessagesForActiveStatusChange() { -#if defined(OS_APPLE) +#if defined(OS_MAC) // On Mac, a single spin is *usually* enough. It isn't when a widget is shown // and made active in two steps, so tests should follow up with a ShowSync() // or ActivateSync to ensure a consistent state. @@ -210,7 +210,7 @@ } void DeactivateSync(Widget* widget) { -#if defined(OS_APPLE) +#if defined(OS_MAC) // Deactivation of a window isn't a concept on Mac: If an application is // active and it has any activatable windows, then one of them is always // active. But we can simulate deactivation (e.g. as if another application @@ -813,7 +813,7 @@ } #endif // defined(OS_WIN) -#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE) +#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC) // Tests whether the focused window is set correctly when a modal window is // created and destroyed. When it is destroyed it should focus the owner window. TEST_F(DesktopWidgetTestInteractive, WindowModalWindowDestroyedActivationTest) { @@ -855,7 +855,7 @@ EXPECT_EQ(gfx::kNullNativeView, focus_changes[1]); EXPECT_EQ(modal_native_view, focus_changes[2]); -#if defined(OS_APPLE) +#if defined(OS_MAC) // Window modal dialogs on Mac are "sheets", which animate to close before // activating their parent widget. views::test::WidgetActivationWaiter waiter(&top_level_widget, true); @@ -1040,7 +1040,7 @@ EXPECT_EQ(GetWidgetShowState(widget.get()), ui::SHOW_STATE_NORMAL); } -#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE) +#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC) TEST_F(WidgetTestInteractive, InactiveWidgetDoesNotGrabActivation) { WidgetAutoclosePtr widget(CreateTopLevelPlatformWidget()); ShowSync(widget.get()); @@ -1056,13 +1056,13 @@ EXPECT_EQ(GetWidgetShowState(widget2.get()), ui::SHOW_STATE_INACTIVE); EXPECT_EQ(GetWidgetShowState(widget.get()), ui::SHOW_STATE_NORMAL); } -#endif // BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE) +#endif // BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC) // ExitFullscreenRestoreState doesn't use DesktopAura widgets. On Mac, there are // currently only Desktop widgets and fullscreen changes have to coordinate with // the OS. See BridgedNativeWidgetUITest for native Mac fullscreen tests. // Maximize on mac is also (intentionally) a no-op. -#if defined(OS_APPLE) +#if defined(OS_MAC) #define MAYBE_ExitFullscreenRestoreState DISABLED_ExitFullscreenRestoreState #else #define MAYBE_ExitFullscreenRestoreState ExitFullscreenRestoreState @@ -1208,7 +1208,7 @@ #endif // defined(OS_WIN) -#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE) +#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC) // Tests that minimizing a widget causes the gesture_handler // to be cleared when the widget is minimized. TEST_F(DesktopWidgetTestInteractive, EventHandlersClearedOnWidgetMinimize) { @@ -1383,7 +1383,7 @@ TestCapture(false); } -#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE) +#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC) // See description in TestCapture(). Creates DesktopNativeWidget. TEST_F(WidgetCaptureTest, CaptureDesktopNativeWidget) { TestCapture(true); @@ -1651,7 +1651,7 @@ // Disabled on Mac. Desktop Mac doesn't have system modal windows since Carbon // was deprecated. It does have application modal windows, but only Ash requests // those. -#if defined(OS_APPLE) +#if defined(OS_MAC) #define MAYBE_SystemModalWindowReleasesCapture \ DISABLED_SystemModalWindowReleasesCapture #elif BUILDFLAG(IS_CHROMEOS_ASH) @@ -1706,7 +1706,7 @@ // Regression test for http://crbug.com/382421 (Linux-Aura issue). // TODO(pkotwicz): Make test pass on CrOS and Windows. // TODO(tapted): Investigate for toolkit-views on Mac http;//crbug.com/441064. -#if BUILDFLAG(IS_CHROMEOS_ASH) || defined(OS_APPLE) +#if BUILDFLAG(IS_CHROMEOS_ASH) || defined(OS_MAC) #define MAYBE_MouseExitOnCaptureGrab DISABLED_MouseExitOnCaptureGrab #else #define MAYBE_MouseExitOnCaptureGrab MouseExitOnCaptureGrab @@ -1801,7 +1801,7 @@ child->AddObserver(&observer); child->Show(); -#if defined(OS_APPLE) +#if defined(OS_MAC) // On Mac, activation is asynchronous. A single trip to the runloop should be // sufficient. On Aura platforms, note that since the child widget isn't top- // level, the aura window manager gets asked whether the widget is active, not @@ -1912,7 +1912,7 @@ DISALLOW_COPY_AND_ASSIGN(WidgetInputMethodInteractiveTest); }; -#if defined(OS_APPLE) +#if defined(OS_MAC) #define MAYBE_Activation DISABLED_Activation #else #define MAYBE_Activation Activation @@ -1957,7 +1957,7 @@ // Widget::Deactivate() doesn't work for CrOS, because it uses NWA instead of // DNWA (which just activates the last active window) and involves the // AuraTestHelper which sets the input method as DummyInputMethod. -#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE) +#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC) DeactivateSync(widget.get()); EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, widget->GetInputMethod()->GetTextInputType()); @@ -2005,7 +2005,7 @@ // Widget::Deactivate() doesn't work for CrOS, because it uses NWA instead of // DNWA (which just activates the last active window) and involves the // AuraTestHelper which sets the input method as DummyInputMethod. -#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE) +#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC) DeactivateSync(parent.get()); EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, parent->GetInputMethod()->GetTextInputType());
diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc index 99c6f75..c8a4a0622 100644 --- a/ui/views/widget/widget_unittest.cc +++ b/ui/views/widget/widget_unittest.cc
@@ -54,7 +54,7 @@ #include "ui/views/win/hwnd_util.h" #endif -#if defined(OS_APPLE) +#if defined(OS_MAC) #include "base/mac/mac_util.h" #endif @@ -897,7 +897,7 @@ }; // This test appears to be flaky on Mac. -#if defined(OS_APPLE) +#if defined(OS_MAC) #define MAYBE_ActivationChange DISABLED_ActivationChange #else #define MAYBE_ActivationChange ActivationChange @@ -1408,7 +1408,7 @@ toplevel->Maximize(); RunPendingMessages(); -#if defined(OS_APPLE) +#if defined(OS_MAC) // Current expectation on Mac is to do nothing on Maximize. EXPECT_EQ(toplevel->GetWindowBoundsInScreen(), toplevel->GetRestoredBounds()); #else @@ -1848,7 +1848,7 @@ } // namespace // No touch on desktop Mac. Tracked in http://crbug.com/445520. -#if !defined(OS_APPLE) || defined(USE_AURA) +#if !defined(OS_MAC) || defined(USE_AURA) // Test that mouse presses and mouse releases are dispatched normally when a // touch is down. @@ -1876,7 +1876,7 @@ widget->CloseNow(); } -#endif // !defined(OS_APPLE) || defined(USE_AURA) +#endif // !defined(OS_MAC) || defined(USE_AURA) // Tests that when there is no active capture, that a mouse press causes capture // to be set. @@ -2255,7 +2255,7 @@ } // No touch on desktop Mac. Tracked in http://crbug.com/445520. -#if !defined(OS_APPLE) || defined(USE_AURA) +#if !defined(OS_MAC) || defined(USE_AURA) TEST_F(WidgetTest, WidgetDeleted_InDispatchGestureEvent) { Widget* widget = new Widget; @@ -2279,7 +2279,7 @@ // Yay we did not crash! } -#endif // !defined(OS_APPLE) || defined(USE_AURA) +#endif // !defined(OS_MAC) || defined(USE_AURA) // See description of RunGetNativeThemeFromDestructor() for details. class GetNativeThemeFromDestructorView : public WidgetDelegateView { @@ -2436,7 +2436,7 @@ // Test Widget::CloseAllSecondaryWidgets works as expected across platforms. // ChromeOS doesn't implement or need CloseAllSecondaryWidgets() since // everything is under a single root window. -#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE) +#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC) TEST_F(DesktopWidgetTest, CloseAllSecondaryWidgets) { Widget* widget1 = CreateTopLevelNativeWidget(); Widget* widget2 = CreateTopLevelNativeWidget(); @@ -2503,7 +2503,7 @@ generator->MoveMouseTo(10, 10); // No touch on desktop Mac. Tracked in http://crbug.com/445520. -#if defined(OS_APPLE) +#if defined(OS_MAC) generator->ClickLeftButton(); #else generator->PressTouch(); @@ -3289,6 +3289,41 @@ IsNativeWindowVisible(top_level_widget->GetNativeWindow())); } +// Used to delete the widget when the supplied bounds changes. +class DestroyingWidgetBoundsObserver : public WidgetObserver { + public: + explicit DestroyingWidgetBoundsObserver(std::unique_ptr<Widget> widget) + : widget_(std::move(widget)) { + widget_->AddObserver(this); + } + + // There are no assertions here as not all platforms call + // OnWidgetBoundsChanged() when going fullscreen. + ~DestroyingWidgetBoundsObserver() override = default; + + // WidgetObserver: + void OnWidgetBoundsChanged(Widget* widget, + const gfx::Rect& new_bounds) override { + widget_->RemoveObserver(this); + widget_.reset(); + } + + private: + std::unique_ptr<Widget> widget_; +}; + +// Deletes a Widget when the bounds change as part of toggling fullscreen. +// This is a regression test for https://crbug.com/1197436 . +TEST_F(DesktopWidgetTest, DeleteInSetFullscreen) { + std::unique_ptr<Widget> widget = std::make_unique<Widget>(); + Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); + params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; + widget->Init(std::move(params)); + Widget* w = widget.get(); + DestroyingWidgetBoundsObserver destroyer(std::move(widget)); + w->SetFullscreen(true); +} + namespace { class FullscreenAwareFrame : public views::NonClientFrameView { @@ -3846,7 +3881,7 @@ bool force_child_ = false; private: -#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE) +#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC) void InitControllers() {} #else class TestFocusRules : public wm::BaseFocusRules { @@ -3870,13 +3905,13 @@ std::unique_ptr<wm::FocusController> focus_controller_; std::unique_ptr<wm::ShadowController> shadow_controller_; -#endif // !BUILDFLAG(ENABLE_DESKTOP_AURA) && !defined(OS_APPLE) +#endif // !BUILDFLAG(ENABLE_DESKTOP_AURA) && !defined(OS_MAC) DISALLOW_COPY_AND_ASSIGN(WidgetShadowTest); }; // Disabled on Mac: All drop shadows are managed out of process for now. -#if defined(OS_APPLE) +#if defined(OS_MAC) #define MAYBE_ShadowsInRootWindow DISABLED_ShadowsInRootWindow #else #define MAYBE_ShadowsInRootWindow ShadowsInRootWindow @@ -4007,7 +4042,7 @@ #endif // defined(OS_WIN) -#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE) +#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC) namespace { @@ -4049,7 +4084,7 @@ const Widget::InitParams::WindowOpacity opacity) { opacity_ = opacity; for (const auto& widget_type : widget_types_) { -#if defined(OS_APPLE) +#if defined(OS_MAC) // Tooltips are native on Mac. See NativeWidgetNSWindowBridge::Init. if (widget_type == Widget::InitParams::TYPE_TOOLTIP) continue; @@ -4066,7 +4101,7 @@ widget_type == Widget::InitParams::TYPE_CONTROL) continue; -#if defined(OS_APPLE) +#if defined(OS_MAC) // Mac always always has a compositing window manager, but doesn't have // transparent titlebars which is what ShouldWindowContentsBeTransparent() // is currently used for. Asking for transparency should get it. Note that @@ -4116,7 +4151,7 @@ CheckAllWidgetsForOpacity(Widget::InitParams::WindowOpacity::kTranslucent); } -#endif // BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE) +#endif // BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC) } // namespace test } // namespace views
diff --git a/ui/views/win/fullscreen_handler.cc b/ui/views/win/fullscreen_handler.cc index 8791362..708d28f 100644 --- a/ui/views/win/fullscreen_handler.cc +++ b/ui/views/win/fullscreen_handler.cc
@@ -70,6 +70,7 @@ fullscreen_ = fullscreen; + auto ref = weak_ptr_factory_.GetWeakPtr(); if (fullscreen_) { // Set new window style and size. SetWindowLong(hwnd_, GWL_STYLE, @@ -102,6 +103,8 @@ new_rect.height(), SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); } + if (!ref) + return; MarkFullscreen(fullscreen); }
diff --git a/ui/views/win/fullscreen_handler.h b/ui/views/win/fullscreen_handler.h index fe17c7f..c76ef18 100644 --- a/ui/views/win/fullscreen_handler.h +++ b/ui/views/win/fullscreen_handler.h
@@ -11,6 +11,7 @@ #include <map> #include "base/macros.h" +#include "base/memory/weak_ptr.h" namespace gfx { class Rect; @@ -54,6 +55,8 @@ // Used to mark a window as fullscreen. Microsoft::WRL::ComPtr<ITaskbarList2> task_bar_list_; + base::WeakPtrFactory<FullscreenHandler> weak_ptr_factory_{this}; + DISALLOW_COPY_AND_ASSIGN(FullscreenHandler); };
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc index 73970de..7ebab24 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc
@@ -2936,8 +2936,11 @@ void HWNDMessageHandler::OnWindowPosChanged(WINDOWPOS* window_pos) { TRACE_EVENT0("ui", "HWNDMessageHandler::OnWindowPosChanged"); + base::WeakPtr<HWNDMessageHandler> ref(msg_handler_weak_factory_.GetWeakPtr()); if (DidClientAreaSizeChange(window_pos)) ClientAreaSizeChanged(); + if (!ref) + return; if (window_pos->flags & SWP_FRAMECHANGED) SetDwmFrameExtension(DwmFrameState::kOn); if (window_pos->flags & SWP_SHOWWINDOW) {
diff --git a/ui/views/window/custom_frame_view_unittest.cc b/ui/views/window/custom_frame_view_unittest.cc index 6a6ab78c..c05b7529 100644 --- a/ui/views/window/custom_frame_view_unittest.cc +++ b/ui/views/window/custom_frame_view_unittest.cc
@@ -156,7 +156,7 @@ widget()->Maximize(); custom_frame_view()->Layout(); -#if defined(OS_APPLE) +#if defined(OS_MAC) // Restore buttons do not exist on Mac. The maximize button is instead a kind // of toggle, but has no effect on frame decorations. EXPECT_FALSE(restore_button()->GetVisible()); @@ -209,7 +209,7 @@ widget()->Maximize(); custom_frame_view()->Layout(); -#if defined(OS_APPLE) +#if defined(OS_MAC) // On Mac, "Maximize" should not alter the frame. Only fullscreen does that. EXPECT_EQ(close_button()->bounds().width(), close_button_initial_bounds.width());
diff --git a/ui/views/window/dialog_delegate.cc b/ui/views/window/dialog_delegate.cc index 6932978..87d538d6 100644 --- a/ui/views/window/dialog_delegate.cc +++ b/ui/views/window/dialog_delegate.cc
@@ -103,7 +103,7 @@ if (!dialog || dialog->use_custom_frame()) { params.opacity = Widget::InitParams::WindowOpacity::kTranslucent; params.remove_standard_frame = true; -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // Except on Mac, the bubble frame includes its own shadow; remove any // native shadowing. On Mac, the window server provides the shadow. params.shadow_type = views::Widget::InitParams::ShadowType::kNone;
diff --git a/ui/views/window/dialog_delegate_unittest.cc b/ui/views/window/dialog_delegate_unittest.cc index bf7ac390..12c40130 100644 --- a/ui/views/window/dialog_delegate_unittest.cc +++ b/ui/views/window/dialog_delegate_unittest.cc
@@ -21,7 +21,7 @@ #include "ui/views/widget/widget.h" #include "ui/views/window/dialog_delegate.h" -#if defined(OS_APPLE) +#if defined(OS_MAC) #include "ui/base/test/scoped_fake_full_keyboard_access.h" #endif @@ -396,7 +396,7 @@ // If the initially focused View provided is unfocusable, check the next // available focusable View is focused. TEST_F(DialogTest, UnfocusableInitialFocus) { -#if defined(OS_APPLE) +#if defined(OS_MAC) // On Mac, make all buttons unfocusable by turning off full keyboard access. // This is the more common configuration, and if a dialog has a focusable // textfield, tree or table, that should obtain focus instead. @@ -409,7 +409,7 @@ dialog->AddChildView(textfield); Widget* dialog_widget = CreateDialogWidget(dialog); -#if !defined(OS_APPLE) +#if !defined(OS_MAC) // For non-Mac, turn off focusability on all the dialog's buttons manually. // This achieves the same effect as disabling full keyboard access. dialog->GetOkButton()->SetFocusBehavior(View::FocusBehavior::NEVER);