diff --git a/AUTHORS b/AUTHORS index 2e5fef9..6ec00b58 100644 --- a/AUTHORS +++ b/AUTHORS
@@ -683,6 +683,7 @@ Peter Gal <pgal.u-szeged@partner.samsung.com> Peter Molnar <pmolnar.u-szeged@partner.samsung.com> Peter Snyder <snyderp@gmail.com> +Peter Wong <peter.wm.wong@gmail.com> Philip Hanson <philip.hanson@intel.com> Philipp Hancke <fippo@andyet.net> Philipp Hancke <philipp.hancke@googlemail.com>
diff --git a/DEPS b/DEPS index 4f2d016..9273595 100644 --- a/DEPS +++ b/DEPS
@@ -121,11 +121,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': 'fdf91af698af417e8b4b883678c6076195d68cac', + 'skia_revision': 'c6444d2f26b19ba76678fdfb83a9c7d654896f67', # 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': 'd1ef638da4a0ab4e8d790bf10c98440269f0cc1e', + 'v8_revision': '946785948ed5d87b5a831116a0a9aee8a6953428', # 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. @@ -133,7 +133,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': 'c05c141619a55ba72aba9a1c1694627093073d03', + 'angle_revision': 'b827f490e46e06ca4132f61ae9dc6c309e874135', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling build tools # and whatever else without interference from each other. @@ -181,7 +181,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '79517a0b0327ab26b68933bbcf4cb0490b1cfadf', + 'catapult_revision': 'daced929e547fb83ac8555a154074c546f10294a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -245,7 +245,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': 'bd48385d5009bbe2fc76d973cdeca96673eb9db8', + 'dawn_revision': 'ec18f9683c28a5a65e36a5c53231d967dbfd4ee9', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -679,7 +679,7 @@ # Build tools for Chrome OS. Note: This depends on third_party/pyelftools. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '7906dd9bb54001e7c5fffb786257296dd005ffad', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '3c5925f8a155af9b280670a95caeac0c35a9ad54', 'condition': 'checkout_linux', }, @@ -1036,7 +1036,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '0e14e4babc1f91e995c3d95f3b0b3f75b97b5cad', + Var('android_git') + '/platform/external/perfetto.git' + '@' + 'd4a22724784e03cfeeb0b3a658b501c1a677b2aa', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + 'ac0d98b5cee6c024b0cffeb4f8f45b6fc5ccdb78', @@ -1199,7 +1199,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + 'f22b9ad8d75bf99652dfc3b1db40e73d9fdd3840', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '00a6ab568bf021a2861ef15e4a679812c58250cb', + Var('webrtc_git') + '/src.git' + '@' + '949099d50de6cdeab8877c8b55093efce244374e', 'src/third_party/xdg-utils': { 'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d', @@ -1240,7 +1240,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@ad2d19ccb8fabf5a964ab34a3a6a77ab7b3ce628', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@27a62fa17e71ff2630c43b8af3e06cfd2d0f3072', 'condition': 'checkout_src_internal', },
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index d8ee9636..93b9958 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -1369,9 +1369,6 @@ # TODO(stevenjb): Investigate whether this is OK. https://crbug.com/644336. "//chromeos/audio", "//chromeos/components/multidevice/logging", - - # TODO(stevenjb): Remove cryptohome dependency. htps://crbug.com/918922. - "//chromeos/cryptohome", "//chromeos/dbus:power_manager_proto", "//chromeos/dbus/services:services", "//chromeos/services/assistant/public:feature_flags", @@ -2208,9 +2205,6 @@ # TODO(stevenjb): Investigate whether this is OK. https://crbug.com/644336. "//chromeos/audio", - - # TODO(stevenjb): Remove cryptohome dependency. htps://crbug.com/918922. - "//chromeos/cryptohome", "//components/account_id", "//components/prefs:test_support", "//components/user_manager:user_manager",
diff --git a/ash/display/mouse_cursor_event_filter_unittest.cc b/ash/display/mouse_cursor_event_filter_unittest.cc index 14bdfc3..ae69bb7 100644 --- a/ash/display/mouse_cursor_event_filter_unittest.cc +++ b/ash/display/mouse_cursor_event_filter_unittest.cc
@@ -159,7 +159,6 @@ // Otherwise, in one edge case, user may press one key repeatedly while moving // the cursor and then the user interface looks weird. // (http://crbug.com/855163). -#if defined(OS_CHROMEOS) TEST_F(MouseCursorEventFilterTest, CursorVisibilityWontFlip) { aura::test::TestWindowDelegate delegate; std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( @@ -186,6 +185,5 @@ generator->PressKey(ui::VKEY_A, ui::EF_NONE | ui::EF_IS_REPEAT); EXPECT_TRUE(manager->IsCursorVisible()); } -#endif // defined(OS_CHROMEOS) } // namespace ash
diff --git a/ash/shelf/shelf_background_animator_unittest.cc b/ash/shelf/shelf_background_animator_unittest.cc index f09cb37..08b0743 100644 --- a/ash/shelf/shelf_background_animator_unittest.cc +++ b/ash/shelf/shelf_background_animator_unittest.cc
@@ -250,15 +250,8 @@ EXPECT_EQ(0, observer_.GetItemBackgroundAlpha()); } -// Crashes on ChromeOS . http://crbug.com/878944 -#if defined(OS_CHROMEOS) -#define MAYBE_FullscreenAppListBackground DISABLED_FullscreenAppListBackground -#else -#define MAYBE_FullscreenAppListBackground FullscreenAppListBackground -#endif - // Verify the alpha values for the SHELF_BACKGROUND_APP_LIST state. -TEST_F(ShelfBackgroundAnimatorTest, MAYBE_FullscreenAppListBackground) { +TEST_F(ShelfBackgroundAnimatorTest, FullscreenAppListBackground) { PaintBackground(SHELF_BACKGROUND_APP_LIST); EXPECT_EQ(SHELF_BACKGROUND_APP_LIST, animator_->target_background_type());
diff --git a/ash/system/message_center/arc/arc_notification_view_unittest.cc b/ash/system/message_center/arc/arc_notification_view_unittest.cc index 59b7c4aa..681afd5 100644 --- a/ash/system/message_center/arc/arc_notification_view_unittest.cc +++ b/ash/system/message_center/arc/arc_notification_view_unittest.cc
@@ -271,9 +271,6 @@ EXPECT_TRUE(IsRemovedAfterIdle(notification_id)); } -// Pinning notification is ChromeOS only feature. -#if defined(OS_CHROMEOS) - TEST_F(ArcNotificationViewTest, SlideOutPinned) { ui::ScopedAnimationDurationScaleMode zero_duration_scope( ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); @@ -316,8 +313,6 @@ notification_view()->GetControlButtonsView()->snooze_button()); } -#endif // defined(OS_CHROMEOS) - TEST_F(ArcNotificationViewTest, PressBackspaceKey) { std::string notification_id(kDefaultNotificationId); content_view()->RequestFocus();
diff --git a/ash/system/message_center/notification_swipe_control_view.cc b/ash/system/message_center/notification_swipe_control_view.cc index 5a8789f..a4943e2 100644 --- a/ash/system/message_center/notification_swipe_control_view.cc +++ b/ash/system/message_center/notification_swipe_control_view.cc
@@ -74,6 +74,9 @@ : NotificationSwipeControlView::ButtonPosition::LEFT; message_center::NotificationControlButtonsView* buttons = message_view_->GetControlButtonsView(); + // Ignore when GetControlButtonsView() returns null. + if (!buttons) + return; bool has_settings_button = buttons->settings_button(); bool has_snooze_button = buttons->snooze_button(); ShowButtons(button_position, has_settings_button, has_snooze_button);
diff --git a/base/message_loop/message_pump_mac_unittest.mm b/base/message_loop/message_pump_mac_unittest.mm index 9063048..80476af6 100644 --- a/base/message_loop/message_pump_mac_unittest.mm +++ b/base/message_loop/message_pump_mac_unittest.mm
@@ -4,6 +4,7 @@ #include "base/message_loop/message_pump_mac.h" +#include "base/cancelable_callback.h" #include "base/mac/scoped_cftyperef.h" #import "base/mac/scoped_nsobject.h" #include "base/macros.h" @@ -128,18 +129,15 @@ // PostedTasks are only executed while the message pump has a delegate. That is, // when a base::RunLoop is running, so in order to test whether posted tasks // are run by CFRunLoopRunInMode and *not* by the regular RunLoop, we need to -// be inside a task that is also calling CFRunLoopRunInMode. This task runs the -// given |mode| after posting a task to increment a counter, then checks whether -// the counter incremented after emptying that run loop mode. -void IncrementInModeAndExpect(CFRunLoopMode mode, int result) { +// be inside a task that is also calling CFRunLoopRunInMode. +// This function posts |task| and runs the given |mode|. +void RunTaskInMode(CFRunLoopMode mode, OnceClosure task) { // Since this task is "ours" rather than a system task, allow nesting. MessageLoopCurrent::ScopedNestableTaskAllower allow; - int counter = 0; - auto increment = BindRepeating([](int* i) { ++*i; }, &counter); - ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, increment); + CancelableOnceClosure cancelable(std::move(task)); + ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, cancelable.callback()); while (CFRunLoopRunInMode(mode, 0, true) == kCFRunLoopRunHandledSource) ; - ASSERT_EQ(result, counter); } } // namespace @@ -153,35 +151,41 @@ // Work is seen when running in the default mode. ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, BindOnce(&IncrementInModeAndExpect, kRegular, 1)); + FROM_HERE, + BindOnce(&RunTaskInMode, kRegular, MakeExpectedRunClosure(FROM_HERE))); EXPECT_NO_FATAL_FAILURE(RunLoop().RunUntilIdle()); // But not seen when running in a private mode. ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, BindOnce(&IncrementInModeAndExpect, kPrivate, 0)); + FROM_HERE, + BindOnce(&RunTaskInMode, kPrivate, MakeExpectedNotRunClosure(FROM_HERE))); EXPECT_NO_FATAL_FAILURE(RunLoop().RunUntilIdle()); { ScopedPumpMessagesInPrivateModes allow_private; // Now the work should be seen. ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, BindOnce(&IncrementInModeAndExpect, kPrivate, 1)); + FROM_HERE, + BindOnce(&RunTaskInMode, kPrivate, MakeExpectedRunClosure(FROM_HERE))); EXPECT_NO_FATAL_FAILURE(RunLoop().RunUntilIdle()); // The regular mode should also work the same. ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, BindOnce(&IncrementInModeAndExpect, kRegular, 1)); + FROM_HERE, + BindOnce(&RunTaskInMode, kRegular, MakeExpectedRunClosure(FROM_HERE))); EXPECT_NO_FATAL_FAILURE(RunLoop().RunUntilIdle()); } // And now the scoper is out of scope, private modes should no longer see it. ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, BindOnce(&IncrementInModeAndExpect, kPrivate, 0)); + FROM_HERE, + BindOnce(&RunTaskInMode, kPrivate, MakeExpectedNotRunClosure(FROM_HERE))); EXPECT_NO_FATAL_FAILURE(RunLoop().RunUntilIdle()); // Only regular modes see it. ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, BindOnce(&IncrementInModeAndExpect, kRegular, 1)); + FROM_HERE, + BindOnce(&RunTaskInMode, kRegular, MakeExpectedRunClosure(FROM_HERE))); EXPECT_NO_FATAL_FAILURE(RunLoop().RunUntilIdle()); }
diff --git a/base/task/cancelable_task_tracker_unittest.cc b/base/task/cancelable_task_tracker_unittest.cc index 7b669bb7..dae5431 100644 --- a/base/task/cancelable_task_tracker_unittest.cc +++ b/base/task/cancelable_task_tracker_unittest.cc
@@ -14,6 +14,7 @@ #include "base/memory/weak_ptr.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" +#include "base/test/bind_test_util.h" #include "base/test/gtest_util.h" #include "base/test/scoped_task_environment.h" #include "base/test/test_simple_task_runner.h" @@ -35,42 +36,6 @@ test::ScopedTaskEnvironment scoped_task_environment_; }; -void AddFailureAt(const Location& location) { - ADD_FAILURE_AT(location.file_name(), location.line_number()); -} - -// Returns a closure that fails if run. -Closure MakeExpectedNotRunClosure(const Location& location) { - return Bind(&AddFailureAt, location); -} - -// A helper class for MakeExpectedRunClosure() that fails if it is -// destroyed without Run() having been called. This class may be used -// from multiple threads as long as Run() is called at most once -// before destruction. -class RunChecker { - public: - explicit RunChecker(const Location& location) - : location_(location), called_(false) {} - - ~RunChecker() { - if (!called_) { - ADD_FAILURE_AT(location_.file_name(), location_.line_number()); - } - } - - void Run() { called_ = true; } - - private: - Location location_; - bool called_; -}; - -// Returns a closure that fails on destruction if it hasn't been run. -Closure MakeExpectedRunClosure(const Location& location) { - return Bind(&RunChecker::Run, Owned(new RunChecker(location))); -} - } // namespace // With the task tracker, post a task, a task with a reply, and get a
diff --git a/base/test/BUILD.gn b/base/test/BUILD.gn index 6134d85..d09d2977 100644 --- a/base/test/BUILD.gn +++ b/base/test/BUILD.gn
@@ -46,6 +46,7 @@ "android/java_handler_thread_helpers.h", "android/url_utils.cc", "android/url_utils.h", + "bind_test_util.cc", "bind_test_util.h", "copy_only_int.h", "fuzzed_data_provider.h",
diff --git a/base/test/bind_test_util.cc b/base/test/bind_test_util.cc new file mode 100644 index 0000000..0b7021f --- /dev/null +++ b/base/test/bind_test_util.cc
@@ -0,0 +1,54 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/test/bind_test_util.h" + +#include "base/bind.h" +#include "base/callback.h" +#include "base/location.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace base { +namespace { + +// A helper class for MakeExpectedRunClosure() that fails if it is +// destroyed without Run() having been called. This class may be used +// from multiple threads as long as Run() is called at most once +// before destruction. +class RunChecker { + public: + explicit RunChecker(const Location& location) + : location_(location), called_(false) {} + + ~RunChecker() { + if (!called_) { + ADD_FAILURE_AT(location_.file_name(), location_.line_number()); + } + } + + void Run() { + DCHECK(!called_); + called_ = true; + } + + private: + Location location_; + bool called_; +}; + +} // namespace + +OnceClosure MakeExpectedRunClosure(const Location& location) { + return BindOnce(&RunChecker::Run, Owned(new RunChecker(location))); +} + +OnceClosure MakeExpectedNotRunClosure(const Location& location) { + return BindOnce( + [](const Location& location) { + ADD_FAILURE_AT(location.file_name(), location.line_number()); + }, + location); +} + +} // namespace base
diff --git a/base/test/bind_test_util.h b/base/test/bind_test_util.h index 0dfcb46..93ef0c10 100644 --- a/base/test/bind_test_util.h +++ b/base/test/bind_test_util.h
@@ -8,6 +8,9 @@ #include "base/bind.h" namespace base { + +class Location; + namespace internal { template <typename F, typename Signature> @@ -31,6 +34,12 @@ std::forward<F>(f)); } +// Returns a closure that fails on destruction if it hasn't been run. +OnceClosure MakeExpectedRunClosure(const Location& location); + +// Returns a closure that fails the test if run. +OnceClosure MakeExpectedNotRunClosure(const Location& location); + } // namespace base #endif // BASE_TEST_BIND_TEST_UTIL_H_
diff --git a/base/win/windows_version.cc b/base/win/windows_version.cc index 0c71efc..5f4079aa 100644 --- a/base/win/windows_version.cc +++ b/base/win/windows_version.cc
@@ -64,8 +64,10 @@ return VERSION_WIN10_RS2; } else if (build < 17134) { return VERSION_WIN10_RS3; - } else { + } else if (build < 17763) { return VERSION_WIN10_RS4; + } else { + return VERSION_WIN10_RS5; } } else if (major > 6) { NOTREACHED();
diff --git a/base/win/windows_version.h b/base/win/windows_version.h index 64f8041..562e1718 100644 --- a/base/win/windows_version.h +++ b/base/win/windows_version.h
@@ -47,6 +47,7 @@ VERSION_WIN10_RS2 = 10, // Redstone 2: Version 1703, Build 15063. VERSION_WIN10_RS3 = 11, // Redstone 3: Version 1709, Build 16299. VERSION_WIN10_RS4 = 12, // Redstone 4: Version 1803, Build 17134. + VERSION_WIN10_RS5 = 13, // Redstone 5: Version 1809, Build 17763. // On edit, update tools\metrics\histograms\enums.xml "WindowsVersion" and // "GpuBlacklistFeatureTestResultsWindows2". VERSION_WIN_LAST, // Indicates error condition.
diff --git a/cc/animation/animation_host.cc b/cc/animation/animation_host.cc index f5d6109..b78c578 100644 --- a/cc/animation/animation_host.cc +++ b/cc/animation/animation_host.cc
@@ -158,17 +158,10 @@ scoped_refptr<ElementAnimations> element_animations = GetElementAnimationsForElementId(element_id); DCHECK(element_animations); - - // |ClearAffectedElementTypes| requires an ElementId map in order to update - // the property trees. Generating that map requires walking the keyframe - // effects, so we have to do it before removing this one. - PropertyToElementIdMap element_id_map = - element_animations->GetPropertyToElementIdMap(); - element_animations->RemoveKeyframeEffect(keyframe_effect); if (element_animations->IsEmpty()) { - element_animations->ClearAffectedElementTypes(element_id_map); + element_animations->ClearAffectedElementTypes(); element_to_animations_map_.erase(element_animations->element_id()); element_animations->SetAnimationHost(nullptr); }
diff --git a/cc/animation/element_animations.cc b/cc/animation/element_animations.cc index dda8db9..01722e1 100644 --- a/cc/animation/element_animations.cc +++ b/cc/animation/element_animations.cc
@@ -84,8 +84,7 @@ return properties; } -void ElementAnimations::ClearAffectedElementTypes( - const PropertyToElementIdMap& element_id_map) { +void ElementAnimations::ClearAffectedElementTypes() { DCHECK(animation_host_); TargetProperties disable_properties = GetPropertiesMaskForAnimationState(); @@ -97,7 +96,7 @@ // mutator_host_client() to be null. if (has_element_in_active_list() && animation_host()->mutator_host_client()) { animation_host()->mutator_host_client()->ElementIsAnimatingChanged( - element_id_map, ElementListType::ACTIVE, disabled_state_mask, + element_id(), ElementListType::ACTIVE, disabled_state_mask, disabled_state); } set_has_element_in_active_list(false); @@ -105,7 +104,7 @@ if (has_element_in_pending_list() && animation_host()->mutator_host_client()) { animation_host()->mutator_host_client()->ElementIsAnimatingChanged( - element_id_map, ElementListType::PENDING, disabled_state_mask, + element_id(), ElementListType::PENDING, disabled_state_mask, disabled_state); } set_has_element_in_pending_list(false); @@ -350,17 +349,15 @@ DCHECK(pending_state_.IsValid()); DCHECK(active_state_.IsValid()); - PropertyToElementIdMap element_id_map = GetPropertyToElementIdMap(); - if (has_element_in_active_list() && prev_active != active_state_) { PropertyAnimationState diff_active = prev_active ^ active_state_; animation_host()->mutator_host_client()->ElementIsAnimatingChanged( - element_id_map, ElementListType::ACTIVE, diff_active, active_state_); + element_id(), ElementListType::ACTIVE, diff_active, active_state_); } if (has_element_in_pending_list() && prev_pending != pending_state_) { PropertyAnimationState diff_pending = prev_pending ^ pending_state_; animation_host()->mutator_host_client()->ElementIsAnimatingChanged( - element_id_map, ElementListType::PENDING, diff_pending, pending_state_); + element_id(), ElementListType::PENDING, diff_pending, pending_state_); } } @@ -470,60 +467,6 @@ return gfx::ScrollOffset(); } -PropertyToElementIdMap ElementAnimations::GetPropertyToElementIdMap() const { - // As noted in the header documentation, this method assumes that each - // property type maps to at most one ElementId. This is not conceptually true - // for cc/animations, but it is true for the current clients: - // - // * ui/ does not set per-keyframe-model ElementIds, so this map will be - // each property type mapping to the same ElementId (i.e. element_id()). - // - // * blink guarantees that any two keyframe models that it creates which - // target the same property on the same target will have the same ElementId. - // - // In order to make this as little of a footgun as possible for future-us, - // this method DCHECKs that the assumption holds. - - std::vector<PropertyToElementIdMap::value_type> entries; - for (int property_index = TargetProperty::FIRST_TARGET_PROPERTY; - property_index <= TargetProperty::LAST_TARGET_PROPERTY; - ++property_index) { - TargetProperty::Type property = - static_cast<TargetProperty::Type>(property_index); - ElementId element_id_for_property; - for (auto& keyframe_effect : keyframe_effects_list_) { - KeyframeModel* model = keyframe_effect.GetKeyframeModel(property); - if (model) { - // We deliberately use two branches here so that the DCHECK can - // differentiate between models with different element ids, and the case - // where some models don't have an element id. - // TODO(crbug.com/900241): All KeyframeModels should have an ElementId. - if (model->element_id()) { - DCHECK(!element_id_for_property || - element_id_for_property == model->element_id()) - << "Different KeyframeModels for the same target must have the " - << "same ElementId"; - element_id_for_property = model->element_id(); - } else { - // This DCHECK isn't perfect; you could have a case where one model - // has an ElementId and the other doesn't, but model->element_id() == - // this->element_id() and so the DCHECK passes. That is unlikely - // enough that we don't bother guarding against it specifically. - DCHECK(!element_id_for_property || - element_id_for_property == element_id()) - << "Either all models should have an ElementId or none should"; - element_id_for_property = element_id(); - } - } - } - - if (element_id_for_property) - entries.emplace_back(property, element_id_for_property); - } - - return PropertyToElementIdMap(std::move(entries)); -} - bool ElementAnimations::KeyframeModelAffectsActiveElements( KeyframeModel* keyframe_model) const { // When we force a keyframe_model update due to a notification, we do not have
diff --git a/cc/animation/element_animations.h b/cc/animation/element_animations.h index 629379a..7c51dc7 100644 --- a/cc/animation/element_animations.h +++ b/cc/animation/element_animations.h
@@ -55,7 +55,7 @@ void SetAnimationHost(AnimationHost* host); void InitAffectedElementTypes(); - void ClearAffectedElementTypes(const PropertyToElementIdMap& element_id_map); + void ClearAffectedElementTypes(); void ElementRegistered(ElementId element_id, ElementListType list_type); void ElementUnregistered(ElementId element_id, ElementListType list_type); @@ -164,15 +164,6 @@ gfx::ScrollOffset ScrollOffsetForAnimation() const; - // Returns a map of target property to the ElementId for that property, for - // KeyframeEffects associated with this ElementAnimations. - // - // This method makes the assumption that a given target property doesn't map - // to more than one ElementId. While conceptually this isn't true for - // cc/animations, it is true for the two current clients (ui/ and blink) and - // this is required to let BGPT ship (see http://crbug.com/912574). - PropertyToElementIdMap GetPropertyToElementIdMap() const; - private: friend class base::RefCounted<ElementAnimations>;
diff --git a/cc/test/animation_timelines_test_common.cc b/cc/test/animation_timelines_test_common.cc index a015f50..4199443 100644 --- a/cc/test/animation_timelines_test_common.cc +++ b/cc/test/animation_timelines_test_common.cc
@@ -126,17 +126,18 @@ } void TestHostClient::ElementIsAnimatingChanged( - const PropertyToElementIdMap& element_id_map, + ElementId element_id, ElementListType list_type, const PropertyAnimationState& mask, const PropertyAnimationState& state) { - for (const auto& it : element_id_map) { - TestLayer* layer = FindTestLayer(it.second, list_type); - if (!layer) - continue; + TestLayer* layer = FindTestLayer(element_id, list_type); + if (!layer) + return; - TargetProperty::Type target_property = it.first; - int property = static_cast<int>(target_property); + for (int property = TargetProperty::FIRST_TARGET_PROPERTY; + property <= TargetProperty::LAST_TARGET_PROPERTY; ++property) { + TargetProperty::Type target_property = + static_cast<TargetProperty::Type>(property); if (mask.potentially_animating[property]) layer->set_has_potential_animation(target_property, state.potentially_animating[property]);
diff --git a/cc/test/animation_timelines_test_common.h b/cc/test/animation_timelines_test_common.h index b18a516..ff76f1d 100644 --- a/cc/test/animation_timelines_test_common.h +++ b/cc/test/animation_timelines_test_common.h
@@ -119,7 +119,7 @@ ElementListType list_type, const gfx::ScrollOffset& scroll_offset) override; - void ElementIsAnimatingChanged(const PropertyToElementIdMap& element_id_map, + void ElementIsAnimatingChanged(ElementId element_id, ElementListType list_type, const PropertyAnimationState& mask, const PropertyAnimationState& state) override;
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index 9889b94..605b3723 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc
@@ -1718,12 +1718,12 @@ } void LayerTreeHost::ElementIsAnimatingChanged( - const PropertyToElementIdMap& element_id_map, + ElementId element_id, ElementListType list_type, const PropertyAnimationState& mask, const PropertyAnimationState& state) { DCHECK_EQ(ElementListType::ACTIVE, list_type); - property_trees()->ElementIsAnimatingChanged(mutator_host(), element_id_map, + property_trees()->ElementIsAnimatingChanged(mutator_host(), element_id, list_type, mask, state, true); }
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index b8489c3..59563f3 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h
@@ -638,7 +638,7 @@ ElementListType list_type, const gfx::ScrollOffset& scroll_offset) override; - void ElementIsAnimatingChanged(const PropertyToElementIdMap& element_id_map, + void ElementIsAnimatingChanged(ElementId element_id, ElementListType list_type, const PropertyAnimationState& mask, const PropertyAnimationState& state) override;
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 9c82ca5..318b967 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -5544,7 +5544,7 @@ } void LayerTreeHostImpl::ElementIsAnimatingChanged( - const PropertyToElementIdMap& element_id_map, + ElementId element_id, ElementListType list_type, const PropertyAnimationState& mask, const PropertyAnimationState& state) { @@ -5552,9 +5552,8 @@ list_type == ElementListType::ACTIVE ? active_tree() : pending_tree(); // TODO(wkorman): Explore enabling DCHECK in ElementIsAnimatingChanged() // below. Currently enabling causes batch of unit test failures. - if (tree && - tree->property_trees()->ElementIsAnimatingChanged( - mutator_host(), element_id_map, list_type, mask, state, false)) + if (tree && tree->property_trees()->ElementIsAnimatingChanged( + mutator_host(), element_id, list_type, mask, state, false)) tree->set_needs_update_draw_properties(); }
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index 25acecad4f..11489c6 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h
@@ -354,7 +354,7 @@ ElementId element_id, ElementListType list_type, const gfx::ScrollOffset& scroll_offset) override; - void ElementIsAnimatingChanged(const PropertyToElementIdMap& element_id_map, + void ElementIsAnimatingChanged(ElementId element_id, ElementListType list_type, const PropertyAnimationState& mask, const PropertyAnimationState& state) override;
diff --git a/cc/trees/mutator_host_client.h b/cc/trees/mutator_host_client.h index f070e67..d3a3e0e 100644 --- a/cc/trees/mutator_host_client.h +++ b/cc/trees/mutator_host_client.h
@@ -44,7 +44,7 @@ // Allows to change IsAnimating value for a set of properties. virtual void ElementIsAnimatingChanged( - const PropertyToElementIdMap& element_id_map, + ElementId element_id, ElementListType list_type, const PropertyAnimationState& mask, const PropertyAnimationState& state) = 0;
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc index 2b78d1a2..1e74c89 100644 --- a/cc/trees/property_tree.cc +++ b/cc/trees/property_tree.cc
@@ -1837,7 +1837,7 @@ bool PropertyTrees::ElementIsAnimatingChanged( const MutatorHost* mutator_host, - const PropertyToElementIdMap& element_id_map, + ElementId element_id, ElementListType list_type, const PropertyAnimationState& mask, const PropertyAnimationState& state, @@ -1849,19 +1849,6 @@ !mask.potentially_animating[property]) continue; - // The mask represents which properties have had their state changed. This - // can include properties for which there are no longer any animations, in - // which case there will not be an entry in the map. - // - // It is unclear whether this is desirable; it may be that we are missing - // updates to property nodes here because we no longer have the required - // ElementId to look them up. See http://crbug.com/912574 for context around - // why this code was rewritten. - auto it = element_id_map.find(static_cast<TargetProperty::Type>(property)); - if (it == element_id_map.end()) - continue; - - const ElementId element_id = it->second; switch (property) { case TargetProperty::TRANSFORM: if (TransformNode* transform_node =
diff --git a/cc/trees/property_tree.h b/cc/trees/property_tree.h index 27281e0..dcf8cb9 100644 --- a/cc/trees/property_tree.h +++ b/cc/trees/property_tree.h
@@ -657,7 +657,7 @@ // this property tree. Returns whether a draw property update is // needed. bool ElementIsAnimatingChanged(const MutatorHost* mutator_host, - const PropertyToElementIdMap& element_id_map, + ElementId element_id, ElementListType list_type, const PropertyAnimationState& mask, const PropertyAnimationState& state,
diff --git a/cc/trees/target_property.h b/cc/trees/target_property.h index f28649c..93fa839 100644 --- a/cc/trees/target_property.h +++ b/cc/trees/target_property.h
@@ -7,8 +7,6 @@ #include <bitset> -#include "base/containers/flat_map.h" - namespace cc { static constexpr size_t kMaxTargetPropertyIndex = 32u; @@ -34,13 +32,6 @@ // A set of target properties. using TargetProperties = std::bitset<kMaxTargetPropertyIndex>; -// A map of target property to ElementId. -// flat_map was chosen because there are expected to be relatively few entries -// in the map. For low number of entries, flat_map is known to perform better -// than other map implementations. -struct ElementId; -using PropertyToElementIdMap = base::flat_map<TargetProperty::Type, ElementId>; - } // namespace cc #endif // CC_TREES_TARGET_PROPERTY_H_
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java index 776acbd83..75ce5f9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
@@ -261,6 +261,8 @@ public static final String PAY_WITH_GOOGLE_V1 = "PayWithGoogleV1"; public static final String PASSWORDS_KEYBOARD_ACCESSORY = "PasswordsKeyboardAccessory"; public static final String PERMISSION_DELEGATION = "PermissionDelegation"; + public static final String PREDICTIVE_PREFETCHING_ALLOWED_ON_ALL_CONNECTION_TYPES = + "PredictivePrefetchingAllowedOnAllConnectionTypes"; public static final String PROGRESS_BAR_THROTTLE = "ProgressBarThrottle"; public static final String PWA_PERSISTENT_NOTIFICATION = "PwaPersistentNotification"; public static final String READER_MODE_IN_CCT = "ReaderModeInCCT";
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java index f8205f7..9b7c104b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
@@ -1307,13 +1307,17 @@ if (!prefs.getNetworkPredictionEnabled()) { return SPECULATION_STATUS_ON_START_NOT_ALLOWED_NETWORK_PREDICTION_DISABLED; } - if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) { + if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled() + && !ChromeFeatureList.isEnabled( + ChromeFeatureList.PREDICTIVE_PREFETCHING_ALLOWED_ON_ALL_CONNECTION_TYPES)) { return SPECULATION_STATUS_ON_START_NOT_ALLOWED_DATA_REDUCTION_ENABLED; } ConnectivityManager cm = (ConnectivityManager) ContextUtils.getApplicationContext().getSystemService( Context.CONNECTIVITY_SERVICE); - if (cm.isActiveNetworkMetered() && !shouldSpeculateLoadOnCellularForSession(session)) { + if (cm.isActiveNetworkMetered() && !shouldSpeculateLoadOnCellularForSession(session) + && !ChromeFeatureList.isEnabled( + ChromeFeatureList.PREDICTIVE_PREFETCHING_ALLOWED_ON_ALL_CONNECTION_TYPES)) { return SPECULATION_STATUS_ON_START_NOT_ALLOWED_NETWORK_METERED; } return SPECULATION_STATUS_ON_START_ALLOWED;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/modules/ModuleInstallUi.java b/chrome/android/java/src/org/chromium/chrome/browser/modules/ModuleInstallUi.java new file mode 100644 index 0000000..7a7ad69d --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/modules/ModuleInstallUi.java
@@ -0,0 +1,123 @@ +// 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. + +package org.chromium.chrome.browser.modules; + +import android.content.Context; + +import org.chromium.chrome.R; +import org.chromium.chrome.browser.infobar.InfoBarIdentifier; +import org.chromium.chrome.browser.infobar.SimpleConfirmInfoBarBuilder; +import org.chromium.chrome.browser.tab.Tab; +import org.chromium.ui.widget.Toast; + +/** + * UI informing the user about the status of installing a dynamic feature module. The UI consists of + * toast for install start and success UI and an infobar in the failure case. + */ +public class ModuleInstallUi { + private final Tab mTab; + private final int mModuleTitleStringId; + private final FailureUiListener mFailureUiListener; + private Toast mInstallStartToast; + + /** Listener for when the user interacts with the install failure UI. */ + public interface FailureUiListener { + /** Called if the user wishes to retry installing the module. */ + void onRetry(); + + /** + * Called if the failure UI has been dismissed and the user does not want to retry + * installing the module. + */ + void onCancel(); + } + + /* + * Creates new UI. + * + * @param tab Tab in whose context to show the UI. + * @param moduleTitleStringId String resource ID of the module title + * @param failureUiListener Listener for when the user interacts with the install failure UI. + */ + public ModuleInstallUi(Tab tab, int moduleTitleStringId, FailureUiListener failureUiListener) { + mTab = tab; + mModuleTitleStringId = moduleTitleStringId; + mFailureUiListener = failureUiListener; + } + + /** Show UI indicating the start of a module install. */ + public void showInstallStartUi() { + Context context = mTab.getActivity(); + if (context == null) { + // Tab is detached. Don't show UI. + return; + } + mInstallStartToast = Toast.makeText(context, + context.getString(R.string.module_install_start_text, + context.getString(mModuleTitleStringId)), + Toast.LENGTH_SHORT); + mInstallStartToast.show(); + } + + /** Show UI indicating the success of a module install. */ + public void showInstallSuccessUi() { + if (mInstallStartToast != null) { + mInstallStartToast.cancel(); + mInstallStartToast = null; + } + + Context context = mTab.getActivity(); + if (context == null) { + // Tab is detached. Don't show UI. + return; + } + Toast.makeText(context, R.string.module_install_success_text, Toast.LENGTH_SHORT).show(); + } + + /** + * Show UI indicating the failure of a module install. Upon interaction with the UI the + * |failureUiListener| will be invoked. + */ + public void showInstallFailureUi() { + if (mInstallStartToast != null) { + mInstallStartToast.cancel(); + mInstallStartToast = null; + } + + Context context = mTab.getActivity(); + if (context == null) { + // Tab is detached. Cancel. + if (mFailureUiListener != null) mFailureUiListener.onCancel(); + return; + } + + SimpleConfirmInfoBarBuilder.Listener listener = new SimpleConfirmInfoBarBuilder.Listener() { + @Override + public void onInfoBarDismissed() { + if (mFailureUiListener != null) mFailureUiListener.onCancel(); + } + + @Override + public boolean onInfoBarButtonClicked(boolean isPrimary) { + if (mFailureUiListener != null) { + if (isPrimary) { + mFailureUiListener.onRetry(); + } else { + mFailureUiListener.onCancel(); + } + } + return false; + } + }; + + String text = String.format(context.getString(R.string.module_install_failure_text), + context.getResources().getString(mModuleTitleStringId)); + SimpleConfirmInfoBarBuilder.create(mTab, listener, + InfoBarIdentifier.MODULE_INSTALL_FAILURE_INFOBAR_ANDROID, + R.drawable.ic_error_outline_googblue_24dp, text, + context.getString(R.string.try_again), context.getString(R.string.cancel), + /* autoExpire = */ true); + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/modules/OWNERS b/chrome/android/java/src/org/chromium/chrome/browser/modules/OWNERS new file mode 100644 index 0000000..b18865e --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/modules/OWNERS
@@ -0,0 +1,2 @@ +agrieve@chromium.org +tiborg@chromium.org
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/MainPreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/MainPreferences.java index da8fd026..1a255a71 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/MainPreferences.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/MainPreferences.java
@@ -20,6 +20,7 @@ import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; import org.chromium.chrome.browser.partnercustomizations.HomepageManager; import org.chromium.chrome.browser.password_manager.ManagePasswordsReferrer; +import org.chromium.chrome.browser.preferences.autofill_assistant.AutofillAssistantPreferences; import org.chromium.chrome.browser.preferences.datareduction.DataReductionPreferences; import org.chromium.chrome.browser.preferences.developer.DeveloperPreferences; import org.chromium.chrome.browser.search_engines.TemplateUrl; @@ -159,8 +160,11 @@ getPreferenceScreen().removePreference(findPreference(PREF_DOWNLOADS)); } - // This checks whether Autofill Assistant is enabled. - if (!ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ASSISTANT)) { + // This checks whether Autofill Assistant is enabled and was shown at least once (only then + // will the AA switch be assigned a value). + if (!ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ASSISTANT) + || !ContextUtils.getAppSharedPreferences().contains( + AutofillAssistantPreferences.PREF_AUTOFILL_ASSISTANT_SWITCH)) { getPreferenceScreen().removePreference(findPreference(PREF_AUTOFILL_ASSISTANT)); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr/ArCoreJavaUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/vr/ArCoreJavaUtils.java index 9575356..9add61f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/vr/ArCoreJavaUtils.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/vr/ArCoreJavaUtils.java
@@ -25,9 +25,9 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.infobar.InfoBarIdentifier; import org.chromium.chrome.browser.infobar.SimpleConfirmInfoBarBuilder; +import org.chromium.chrome.browser.modules.ModuleInstallUi; import org.chromium.chrome.browser.tab.Tab; import org.chromium.components.module_installer.ModuleInstaller; -import org.chromium.ui.widget.Toast; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -37,7 +37,7 @@ */ @JNINamespace("vr") @UsedByReflection("ArDelegate.java") -public class ArCoreJavaUtils { +public class ArCoreJavaUtils implements ModuleInstallUi.FailureUiListener { private static final int MIN_SDK_VERSION = Build.VERSION_CODES.O; private static final String AR_CORE_PACKAGE = "com.google.ar.core"; private static final String METADATA_KEY_MIN_APK_VERSION = "com.google.ar.core.min_apk_version"; @@ -64,6 +64,7 @@ private long mNativeArCoreJavaUtils; private boolean mAppInfoInitialized; private int mAppMinArCoreApkVersionCode = ARCORE_NOT_INSTALLED_VERSION_CODE; + private Tab mTab; @UsedByReflection("ArDelegate.java") public static void installArCoreDeviceProviderFactory() { @@ -94,6 +95,18 @@ } } + @Override + public void onRetry() { + if (mNativeArCoreJavaUtils == 0) return; + requestInstallArModule(mTab); + } + + @Override + public void onCancel() { + if (mNativeArCoreJavaUtils == 0) return; + nativeOnRequestInstallArModuleResult(mNativeArCoreJavaUtils, /* success = */ false); + } + private ArCoreJavaUtils(long nativeArCoreJavaUtils) { mNativeArCoreJavaUtils = nativeArCoreJavaUtils; initializeAppInfo(); @@ -161,22 +174,19 @@ } @CalledByNative - private void requestInstallArModule() { - // TODO(crbug.com/863064): This is a placeholder UI. Replace once proper UI is spec'd. - Toast.makeText(ContextUtils.getApplicationContext(), R.string.ar_module_install_start_text, - Toast.LENGTH_SHORT) - .show(); - + private void requestInstallArModule(Tab tab) { + mTab = tab; + ModuleInstallUi ui = new ModuleInstallUi(mTab, R.string.ar_module_install_text_title, this); + ui.showInstallStartUi(); ModuleInstaller.install("ar", success -> { assert shouldRequestInstallArModule() != success; if (mNativeArCoreJavaUtils != 0) { - // TODO(crbug.com/863064): This is a placeholder UI. Replace once proper UI is - // spec'd. - int toastTextRes = success ? R.string.ar_module_install_success_text - : R.string.ar_module_install_failure_text; - Toast.makeText( - ContextUtils.getApplicationContext(), toastTextRes, Toast.LENGTH_SHORT) - .show(); + if (!success) { + ui.showInstallFailureUi(); + return; + } + + ui.showInstallSuccessUi(); nativeOnRequestInstallArModuleResult(mNativeArCoreJavaUtils, success); } });
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr/VrModuleProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/vr/VrModuleProvider.java index bc9b21b2..6bb8ebed 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/vr/VrModuleProvider.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/vr/VrModuleProvider.java
@@ -115,7 +115,7 @@ @CalledByNative private static void showInstallResult(boolean success) { // TODO(crbug.com/863064): This is a placeholder UI. Replace once proper UI is spec'd. - int toastTextRes = success ? R.string.vr_module_install_success_text + int toastTextRes = success ? R.string.module_install_success_text : R.string.vr_module_install_failure_text; Toast.makeText(ContextUtils.getApplicationContext(), toastTextRes, Toast.LENGTH_SHORT) .show();
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd index 56a9f98..1c301389 100644 --- a/chrome/android/java/strings/android_chrome_strings.grd +++ b/chrome/android/java/strings/android_chrome_strings.grd
@@ -3750,10 +3750,7 @@ <!-- VR module --> <message name="IDS_VR_MODULE_INSTALL_START_TEXT" desc="Text shown on a toast when Chrome starts to download the VR dynamic feature module."> - Installing VR module... - </message> - <message name="IDS_VR_MODULE_INSTALL_SUCCESS_TEXT" desc="Text shown on a toast when Chrome successfully installed the VR dynamic feature module."> - Installed VR module + Installing virtual reality for Chrome… </message> <message name="IDS_VR_MODULE_INSTALL_FAILURE_TEXT" desc="Text shown on a toast when Chrome failed to install the VR dynamic feature module."> Failed to install VR module @@ -3781,17 +3778,22 @@ <message name="IDS_AR_MODULE_TITLE" desc="Title of the Augmented Reality (AR) dynamic feature module. Used, for instance, in the text of dialogs confirming to download the module."> AR </message> - <message name="IDS_AR_MODULE_INSTALL_START_TEXT" desc="Text shown on a toast when Chrome starts to download the AR dynamic feature module."> - Installing AR module... - </message> - <message name="IDS_AR_MODULE_INSTALL_SUCCESS_TEXT" desc="Text shown on a toast when Chrome successfully installed the AR dynamic feature module."> - Installed AR module - </message> - <message name="IDS_AR_MODULE_INSTALL_FAILURE_TEXT" desc="Text shown on a toast when Chrome failed to install the AR dynamic feature module."> - Failed to install AR module + <message name="IDS_AR_MODULE_INSTALL_TEXT_TITLE" desc="Text shown when Chrome references the AR module in install start, success, failure UI (e.g. in IDS_MODULE_INSTALL_START_TEXT, which will expand to 'Installing augmented reality for Chrome…')."> + augmented reality </message> </if> + <!-- Dynamic feature modules --> + <message name="IDS_MODULE_INSTALL_START_TEXT" desc="Text shown on a toast when Chrome starts to download a dynamic feature module."> + Installing <ph name="module">%1$s<ex>augmented reality</ex></ph> for Chrome… + </message> + <message name="IDS_MODULE_INSTALL_SUCCESS_TEXT" desc="Text shown on a toast when Chrome successfully installed a dynamic feature module."> + Installed + </message> + <message name="IDS_MODULE_INSTALL_FAILURE_TEXT" desc="Text shown on an infobar when Chrome failed to install a dynamic feature module."> + Unable to install <ph name="module">%1$s<ex>augmented reality</ex></ph> for Chrome + </message> + <!-- Custom Context Menu Informations --> <message name="IDS_CONTEXTMENU_IMAGE_TITLE" desc="The title of a context menu tab when the item pressed contains more than one type. This indicates that all the actions are related to the image."> IMAGE
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni index 4555a3c..22ad1c7 100644 --- a/chrome/android/java_sources.gni +++ b/chrome/android/java_sources.gni
@@ -16,6 +16,7 @@ "java/src/org/chromium/chrome/browser/ActivityTaskDescriptionIconGenerator.java", "java/src/org/chromium/chrome/browser/AfterStartupTaskUtils.java", "java/src/org/chromium/chrome/browser/AppHooks.java", + "java/src/org/chromium/chrome/browser/modules/ModuleInstallUi.java", "java/src/org/chromium/chrome/browser/AppHooksModule.java", "java/src/org/chromium/chrome/browser/AppIndexingUtil.java", "java/src/org/chromium/chrome/browser/ApplicationLifetime.java",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/autofill_assistant/AutofillAssistantPreferencesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/autofill_assistant/AutofillAssistantPreferencesTest.java index 642f581..a5b6427 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/autofill_assistant/AutofillAssistantPreferencesTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/autofill_assistant/AutofillAssistantPreferencesTest.java
@@ -4,15 +4,16 @@ package org.chromium.chrome.browser.preferences.autofill_assistant; -import android.support.test.InstrumentationRegistry; -import android.support.test.espresso.intent.rule.IntentsTestRule; -import android.support.test.filters.SmallTest; - import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.nullValue; +import android.support.test.InstrumentationRegistry; +import android.support.test.espresso.intent.rule.IntentsTestRule; +import android.support.test.filters.SmallTest; + import org.junit.Assert; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestRule; @@ -48,6 +49,11 @@ public IntentsTestRule<HistoryActivity> mHistoryActivityTestRule = new IntentsTestRule<>(HistoryActivity.class, false, false); + @Before + public void setUp() { + clearAutofillAssistantSwitch(); + } + /** * Set the |PREF_AUTOFILL_ASSISTANT_SWITCH| shared preference to the given |value|. * @param value The value to set the preference to. @@ -70,6 +76,16 @@ } /** + * Removes the |PREF_AUTOFILL_ASSISTANT_SWITCH| shared preference. + */ + private void clearAutofillAssistantSwitch() { + ContextUtils.getAppSharedPreferences() + .edit() + .remove(AutofillAssistantPreferences.PREF_AUTOFILL_ASSISTANT_SWITCH) + .apply(); + } + + /** * Ensure that the on/off switch in "Autofill Assistant" settings works. */ @Test @@ -125,16 +141,43 @@ } /** - * Ensure that the "Autofill Assistant" setting is shown when the feature is enabled. + * Test: if the onboarding was never shown, the AA chrome preference should not exist. + * + * Note: presence of the |PREF_AUTOFILL_ASSISTANT_SWITCH| shared preference indicates whether + * onboarding was shown or not. */ @Test @SmallTest @Feature({"Preferences"}) @EnableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT) - public void testAutofillAssistantPreferenceEnabled() throws Exception { + public void testAutofillAssistantNoPreferenceIfOnboardingNeverShown() throws Exception { + // Note: |PREF_AUTOFILL_ASSISTANT_SWITCH| is cleared in setUp(). final Preferences preferences = PreferencesTest.startPreferences( InstrumentationRegistry.getInstrumentation(), MainPreferences.class.getName()); + ThreadUtils.runOnUiThreadBlocking(new Runnable() { + @Override + public void run() { + MainPreferences mainPrefs = (MainPreferences) preferences.getFragmentForTest(); + Assert.assertThat(mainPrefs.findPreference(MainPreferences.PREF_AUTOFILL_ASSISTANT), + is(nullValue())); + } + }); + } + /** + * Test: if the onboarding was shown at least once, the AA chrome preference should also exist. + * + * Note: presence of the |PREF_AUTOFILL_ASSISTANT_SWITCH| shared preference indicates whether + * onboarding was shown or not. + */ + @Test + @SmallTest + @Feature({"Preferences"}) + @EnableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT) + public void testAutofillAssistantPreferenceShownIfOnboardingShown() throws Exception { + setAutofillAssistantSwitch(false); + final Preferences preferences = PreferencesTest.startPreferences( + InstrumentationRegistry.getInstrumentation(), MainPreferences.class.getName()); ThreadUtils.runOnUiThreadBlocking(new Runnable() { @Override public void run() { @@ -152,7 +195,7 @@ @SmallTest @Feature({"Preferences"}) @DisableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT) - public void testAutofillAssistantPreferenceDisabled() throws Exception { + public void testAutofillAssistantNoPreferenceIfFeatureDisabled() throws Exception { final Preferences preferences = PreferencesTest.startPreferences( InstrumentationRegistry.getInstrumentation(), MainPreferences.class.getName());
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 2833ac1..22eefc6c8 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -7190,18 +7190,6 @@ </message> </if> - <if expr="chromeos"> - <!-- The URL for the Google mailto service. --> - <message name="IDS_GOOGLE_MAILTO_HANDLER_URL"> - https://mail.google.com/mail/?extsrc=mailto&url=%s - </message> - - <!-- The URL for the Google webcal service. --> - <message name="IDS_GOOGLE_WEBCAL_HANDLER_URL"> - https://www.google.com/calendar/render?cid=%s - </message> - </if> - <!-- Translate Bubble --> <if expr="toolkit_views"> <message name="IDS_TRANSLATE_BUBBLE_BEFORE_TRANSLATE_TITLE" desc="Title text for the translate bubble when asking to translate a page."> @@ -8607,6 +8595,9 @@ <message name="IDS_TOOLTIP_TAB_ALERT_STATE_DESKTOP_CAPTURING" desc="Extra tool tip text, when the tab is capturing desktop contents."> This tab is sharing your screen. </message> + <message name="IDS_TOOLTIP_TAB_ALERT_STATE_VR_PRESENTING" desc="Extra tool tip text, when the tab is presenting VR content to a headset."> + This tab is presenting VR content to a headset. + </message> <!-- Tab accessibility labels --> <message name="IDS_TAB_AX_LABEL_MEDIA_RECORDING_FORMAT" desc="Accessibility label text, when the tab is recording media. Example: 'Google Hangouts - Camera or microphone recording'"> @@ -8639,6 +8630,11 @@ <message name="IDS_TAB_AX_LABEL_DESKTOP_CAPTURING_FORMAT" desc="Accessibility label text, when the tab is capturing and sharing desktop content using screen sharing. Example: 'Google Hangouts - Desktop content shared'"> <ph name="WINDOW_TITLE">$1<ex>Google Hangouts</ex></ph> - Desktop content shared </message> + <message name="IDS_TAB_AX_LABEL_VR_PRESENTING" desc="Accessibility label text, when the tab is presenting VR content to a headset. Example: 'A VR-enabled website - VR presenting to headset'"> + <ph name="WINDOW_TITLE"> + $1<ex>A VR-enabled website</ex> + </ph> - VR presenting to headset + </message> <!-- ProcessSingleton --> <message name="IDS_PROFILE_IN_USE_LINUX_QUIT" desc="Text of button in profile in use dialog to quit without doing anything.">
diff --git a/chrome/app/generated_resources_grd/IDS_TOOLTIP_TAB_ALERT_STATE_VR_PRESENTING.png.sha1 b/chrome/app/generated_resources_grd/IDS_TOOLTIP_TAB_ALERT_STATE_VR_PRESENTING.png.sha1 new file mode 100644 index 0000000..e88a3ca --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_TOOLTIP_TAB_ALERT_STATE_VR_PRESENTING.png.sha1
@@ -0,0 +1 @@ +5e26018110d720f1624c821c51175477b7631837 \ No newline at end of file
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index e137338..51eee3a 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -3806,11 +3806,6 @@ flag_descriptions::kDisallowUnsafeHttpDownloadsNameDescription, kOsAll, FEATURE_VALUE_TYPE(features::kDisallowUnsafeHttpDownloads)}, - {"enable-websocket-auth-connection-reuse", - flag_descriptions::kWebSocketHandshakeReuseConnectionName, - flag_descriptions::kWebSocketHandshakeReuseConnectionDescription, kOsAll, - FEATURE_VALUE_TYPE(net::WebSocketBasicHandshakeStream:: - kWebSocketHandshakeReuseConnection)}, {"unsafely-treat-insecure-origin-as-secure", flag_descriptions::kTreatInsecureOriginAsSecureName, flag_descriptions::kTreatInsecureOriginAsSecureDescription, kOsAll,
diff --git a/chrome/browser/android/vr/arcore_device/arcore_device.cc b/chrome/browser/android/vr/arcore_device/arcore_device.cc index 214a3652..75995818 100644 --- a/chrome/browser/android/vr/arcore_device/arcore_device.cc +++ b/chrome/browser/android/vr/arcore_device/arcore_device.cc
@@ -202,7 +202,8 @@ on_request_ar_module_result_callback_ = base::BindOnce(&ArCoreDevice::OnRequestArModuleResult, GetWeakPtr(), render_process_id, render_frame_id, has_user_activation); - arcore_install_utils_->RequestInstallArModule(); + arcore_install_utils_->RequestInstallArModule(render_process_id, + render_frame_id); return; }
diff --git a/chrome/browser/android/vr/arcore_device/arcore_device_unittest.cc b/chrome/browser/android/vr/arcore_device/arcore_device_unittest.cc index 7d46efe..dc03b004 100644 --- a/chrome/browser/android/vr/arcore_device/arcore_device_unittest.cc +++ b/chrome/browser/android/vr/arcore_device/arcore_device_unittest.cc
@@ -92,7 +92,8 @@ bool ShouldRequestInstallArModule() override { return false; }; - void RequestInstallArModule() override{}; + void RequestInstallArModule(int render_process_id, + int render_frame_id) override{}; bool ShouldRequestInstallSupportedArCore() override { return false; }; void RequestInstallSupportedArCore(int render_process_id, int render_frame_id) override{};
diff --git a/chrome/browser/android/vr/arcore_device/arcore_install_utils.h b/chrome/browser/android/vr/arcore_device/arcore_install_utils.h index a29497c..d29771c2 100644 --- a/chrome/browser/android/vr/arcore_device/arcore_install_utils.h +++ b/chrome/browser/android/vr/arcore_device/arcore_install_utils.h
@@ -14,7 +14,8 @@ public: virtual ~ArCoreInstallUtils() = default; virtual bool ShouldRequestInstallArModule() = 0; - virtual void RequestInstallArModule() = 0; + virtual void RequestInstallArModule(int render_process_id, + int render_frame_id) = 0; virtual bool ShouldRequestInstallSupportedArCore() = 0; virtual void RequestInstallSupportedArCore(int render_process_id, int render_frame_id) = 0;
diff --git a/chrome/browser/android/vr/arcore_device/arcore_java_utils.cc b/chrome/browser/android/vr/arcore_device/arcore_java_utils.cc index a02533ef..06a2888 100644 --- a/chrome/browser/android/vr/arcore_device/arcore_java_utils.cc +++ b/chrome/browser/android/vr/arcore_device/arcore_java_utils.cc
@@ -70,9 +70,11 @@ AttachCurrentThread(), j_arcore_java_utils_); } -void ArCoreJavaUtils::RequestInstallArModule() { - Java_ArCoreJavaUtils_requestInstallArModule(AttachCurrentThread(), - j_arcore_java_utils_); +void ArCoreJavaUtils::RequestInstallArModule(int render_process_id, + int render_frame_id) { + Java_ArCoreJavaUtils_requestInstallArModule( + AttachCurrentThread(), j_arcore_java_utils_, + getTabFromRenderer(render_process_id, render_frame_id)); } bool ArCoreJavaUtils::ShouldRequestInstallSupportedArCore() { @@ -85,24 +87,10 @@ int render_frame_id) { DCHECK(ShouldRequestInstallSupportedArCore()); - content::RenderFrameHost* render_frame_host = - content::RenderFrameHost::FromID(render_process_id, render_frame_id); - DCHECK(render_frame_host); - - content::WebContents* web_contents = - content::WebContents::FromRenderFrameHost(render_frame_host); - DCHECK(web_contents); - - TabAndroid* tab_android = TabAndroid::FromWebContents(web_contents); - DCHECK(tab_android); - - base::android::ScopedJavaLocalRef<jobject> j_tab_android = - tab_android->GetJavaObject(); - DCHECK(!j_tab_android.is_null()); - JNIEnv* env = AttachCurrentThread(); - Java_ArCoreJavaUtils_requestInstallSupportedArCore(env, j_arcore_java_utils_, - j_tab_android); + Java_ArCoreJavaUtils_requestInstallSupportedArCore( + env, j_arcore_java_utils_, + getTabFromRenderer(render_process_id, render_frame_id)); } void ArCoreJavaUtils::OnRequestInstallArModuleResult( @@ -131,6 +119,27 @@ return Java_ArCoreJavaUtils_getApplicationContext(env); } +base::android::ScopedJavaLocalRef<jobject> ArCoreJavaUtils::getTabFromRenderer( + int render_process_id, + int render_frame_id) { + content::RenderFrameHost* render_frame_host = + content::RenderFrameHost::FromID(render_process_id, render_frame_id); + DCHECK(render_frame_host); + + content::WebContents* web_contents = + content::WebContents::FromRenderFrameHost(render_frame_host); + DCHECK(web_contents); + + TabAndroid* tab_android = TabAndroid::FromWebContents(web_contents); + DCHECK(tab_android); + + base::android::ScopedJavaLocalRef<jobject> j_tab_android = + tab_android->GetJavaObject(); + DCHECK(!j_tab_android.is_null()); + + return j_tab_android; +} + static void JNI_ArCoreJavaUtils_InstallArCoreDeviceProviderFactory( JNIEnv* env) { device::ArCoreDeviceProviderFactory::Install(
diff --git a/chrome/browser/android/vr/arcore_device/arcore_java_utils.h b/chrome/browser/android/vr/arcore_device/arcore_java_utils.h index 402651c..6dda5308 100644 --- a/chrome/browser/android/vr/arcore_device/arcore_java_utils.h +++ b/chrome/browser/android/vr/arcore_device/arcore_java_utils.h
@@ -21,7 +21,8 @@ explicit ArCoreJavaUtils(device::ArCoreDevice* arcore_device); ~ArCoreJavaUtils() override; bool ShouldRequestInstallArModule() override; - void RequestInstallArModule() override; + void RequestInstallArModule(int render_process_id, + int render_frame_id) override; bool ShouldRequestInstallSupportedArCore() override; void RequestInstallSupportedArCore(int render_process_id, int render_frame_id) override; @@ -39,6 +40,10 @@ base::android::ScopedJavaLocalRef<jobject> GetApplicationContext() override; private: + base::android::ScopedJavaLocalRef<jobject> getTabFromRenderer( + int render_process_id, + int render_frame_id); + device::ArCoreDevice* arcore_device_; base::android::ScopedJavaGlobalRef<jobject> j_arcore_java_utils_; };
diff --git a/chrome/browser/apps/platform_apps/api/BUILD.gn b/chrome/browser/apps/platform_apps/api/BUILD.gn index f88b325..792a997 100644 --- a/chrome/browser/apps/platform_apps/api/BUILD.gn +++ b/chrome/browser/apps/platform_apps/api/BUILD.gn
@@ -73,7 +73,6 @@ "//chrome:strings", "//chromeos/components/multidevice/logging", "//chromeos/components/proximity_auth", - "//chromeos/cryptohome", "//components/account_id", "//components/strings:components_strings_grit", "//components/user_manager",
diff --git a/chrome/browser/chromeos/arc/auth/arc_auth_service_browsertest.cc b/chrome/browser/chromeos/arc/auth/arc_auth_service_browsertest.cc index c86f739..51d66d2 100644 --- a/chrome/browser/chromeos/arc/auth/arc_auth_service_browsertest.cc +++ b/chrome/browser/chromeos/arc/auth/arc_auth_service_browsertest.cc
@@ -562,10 +562,10 @@ const int initial_num_calls = auth_instance().num_account_upserted_calls(); chromeos::AccountManager::AccountKey account_key{ - account_info.gaia, - chromeos::account_manager::AccountType::ACCOUNT_TYPE_GAIA}; - account_manager()->UpsertToken(account_key, - chromeos::AccountManager::kInvalidToken); + "object-guid", + chromeos::account_manager::AccountType::ACCOUNT_TYPE_ACTIVE_DIRECTORY}; + account_manager()->UpsertToken( + account_key, chromeos::AccountManager::kActiveDirectoryDummyToken); EXPECT_EQ(auth_instance().num_account_upserted_calls(), initial_num_calls); }
diff --git a/chrome/browser/chromeos/oauth2_token_service_delegate.cc b/chrome/browser/chromeos/oauth2_token_service_delegate.cc index fef27208..0a34c898 100644 --- a/chrome/browser/chromeos/oauth2_token_service_delegate.cc +++ b/chrome/browser/chromeos/oauth2_token_service_delegate.cc
@@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/logging.h" +#include "base/stl_util.h" #include "chrome/browser/chromeos/account_mapper_util.h" #include "chromeos/account_manager/account_manager.h" #include "content/public/browser/network_service_instance.h" @@ -38,6 +39,26 @@ false /* bool always_use_initial_delay */, }; +// Maps crOS Account Manager |account_keys| to the account id representation +// used by the OAuth token service chain. |account_keys| can safely contain Gaia +// and non-Gaia accounts. Non-Gaia accounts will be filtered out. +// |account_keys| is the set of accounts that need to be translated. +// |account_mapper_util| is an unowned pointer to |AccountMapperUtil|. +std::vector<std::string> GetOAuthAccountIdsFromAccountKeys( + const std::set<AccountManager::AccountKey>& account_keys, + const AccountMapperUtil* const account_mapper_util) { + std::vector<std::string> accounts; + for (auto& account_key : account_keys) { + std::string account_id = + account_mapper_util->AccountKeyToOAuthAccountId(account_key); + if (!account_id.empty()) { + accounts.emplace_back(account_id); + } + } + + return accounts; +} + } // namespace ChromeOSOAuth2TokenServiceDelegate::ChromeOSOAuth2TokenServiceDelegate( @@ -95,14 +116,21 @@ .release(); } +// Note: This method should use the same logic for filtering accounts as +// |GetAccounts|. See crbug.com/919793 for details. At the time of writing, +// both |GetAccounts| and |RefreshTokenIsAvailable| use +// |GetOAuthAccountIdsFromAccountKeys|. bool ChromeOSOAuth2TokenServiceDelegate::RefreshTokenIsAvailable( const std::string& account_id) const { if (load_credentials_state() != LOAD_CREDENTIALS_FINISHED_WITH_SUCCESS) { return false; } - return account_manager_->IsTokenAvailable( - account_mapper_util_->OAuthAccountIdToAccountKey(account_id)); + // We intentionally do NOT check if the refresh token associated with + // |account_id| is valid or not. See crbug.com/919793 for details. + return base::ContainsValue(GetOAuthAccountIdsFromAccountKeys( + account_keys_, account_mapper_util_.get()), + account_id); } void ChromeOSOAuth2TokenServiceDelegate::UpdateAuthError( @@ -142,19 +170,19 @@ return GoogleServiceAuthError::AuthErrorNone(); } +// Note: This method should use the same logic for filtering accounts as +// |RefreshTokenIsAvailable|. See crbug.com/919793 for details. At the time of +// writing, both |GetAccounts| and |RefreshTokenIsAvailable| use +// |GetOAuthAccountIdsFromAccountKeys|. std::vector<std::string> ChromeOSOAuth2TokenServiceDelegate::GetAccounts() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - std::vector<std::string> accounts; - for (auto& account_key : account_keys_) { - std::string account_id = - account_mapper_util_->AccountKeyToOAuthAccountId(account_key); - if (!account_id.empty()) { - accounts.emplace_back(account_id); - } - } + // |GetAccounts| intentionally does not care about the state of + // |load_credentials_state|. See crbug.com/919793 and crbug.com/900590 for + // details. - return accounts; + return GetOAuthAccountIdsFromAccountKeys(account_keys_, + account_mapper_util_.get()); } void ChromeOSOAuth2TokenServiceDelegate::LoadCredentials(
diff --git a/chrome/browser/chromeos/oauth2_token_service_delegate_unittest.cc b/chrome/browser/chromeos/oauth2_token_service_delegate_unittest.cc index e471070..0f5b13ad 100644 --- a/chrome/browser/chromeos/oauth2_token_service_delegate_unittest.cc +++ b/chrome/browser/chromeos/oauth2_token_service_delegate_unittest.cc
@@ -132,6 +132,7 @@ account_info_ = CreateAccountInfoTestFixture(kGaiaId, kUserEmail); account_tracker_service_.SeedAccountInfo(account_info_); gaia_account_key_ = {account_info_.gaia, ACCOUNT_TYPE_GAIA}; + ad_account_key_ = {"object-guid", ACCOUNT_TYPE_ACTIVE_DIRECTORY}; delegate_ = std::make_unique<ChromeOSOAuth2TokenServiceDelegate>( &account_tracker_service_, &account_manager_); @@ -176,6 +177,7 @@ base::ScopedTempDir tmp_dir_; AccountInfo account_info_; AccountManager::AccountKey gaia_account_key_; + AccountManager::AccountKey ad_account_key_; AccountTrackerService account_tracker_service_; AccountManager account_manager_; std::unique_ptr<ChromeOSOAuth2TokenServiceDelegate> delegate_; @@ -189,16 +191,39 @@ DISALLOW_COPY_AND_ASSIGN(CrOSOAuthDelegateTest); }; -TEST_F(CrOSOAuthDelegateTest, RefreshTokenIsAvailableForGaiaAccounts) { +TEST_F(CrOSOAuthDelegateTest, + RefreshTokenIsAvailableReturnsTrueForValidGaiaTokens) { EXPECT_EQ(OAuth2TokenServiceDelegate::LoadCredentialsState:: LOAD_CREDENTIALS_FINISHED_WITH_SUCCESS, delegate_->load_credentials_state()); EXPECT_FALSE(delegate_->RefreshTokenIsAvailable(account_info_.account_id)); + EXPECT_FALSE( + base::ContainsValue(delegate_->GetAccounts(), account_info_.account_id)); account_manager_.UpsertToken(gaia_account_key_, kGaiaToken); EXPECT_TRUE(delegate_->RefreshTokenIsAvailable(account_info_.account_id)); + EXPECT_TRUE( + base::ContainsValue(delegate_->GetAccounts(), account_info_.account_id)); +} + +TEST_F(CrOSOAuthDelegateTest, + RefreshTokenIsAvailableReturnsTrueForInvalidGaiaTokens) { + EXPECT_EQ(OAuth2TokenServiceDelegate::LoadCredentialsState:: + LOAD_CREDENTIALS_FINISHED_WITH_SUCCESS, + delegate_->load_credentials_state()); + + EXPECT_FALSE(delegate_->RefreshTokenIsAvailable(account_info_.account_id)); + EXPECT_FALSE( + base::ContainsValue(delegate_->GetAccounts(), account_info_.account_id)); + + account_manager_.UpsertToken(gaia_account_key_, + AccountManager::kInvalidToken); + + EXPECT_TRUE(delegate_->RefreshTokenIsAvailable(account_info_.account_id)); + EXPECT_TRUE( + base::ContainsValue(delegate_->GetAccounts(), account_info_.account_id)); } TEST_F(CrOSOAuthDelegateTest, ObserversAreNotifiedOnAuthErrorChange) { @@ -327,9 +352,7 @@ EXPECT_TRUE(delegate_->GetAccounts().empty()); // Insert an Active Directory account into AccountManager. - AccountManager::AccountKey ad_account_key{"object-guid", - ACCOUNT_TYPE_ACTIVE_DIRECTORY}; - account_manager_.UpsertToken(ad_account_key, + account_manager_.UpsertToken(ad_account_key_, AccountManager::kActiveDirectoryDummyToken); // OAuth delegate should not return Active Directory accounts. @@ -346,6 +369,50 @@ EXPECT_EQ(account_info_.account_id, accounts[0]); } +// |GetAccounts| should return all known Gaia accounts, whether or not they have +// a "valid" refresh token stored against them. +TEST_F(CrOSOAuthDelegateTest, GetAccountsReturnsGaiaAccountsWithInvalidTokens) { + EXPECT_TRUE(delegate_->GetAccounts().empty()); + + account_manager_.UpsertToken(gaia_account_key_, + AccountManager::kInvalidToken); + + std::vector<std::string> accounts = delegate_->GetAccounts(); + EXPECT_EQ(1UL, accounts.size()); + EXPECT_EQ(account_info_.account_id, accounts[0]); +} + +TEST_F(CrOSOAuthDelegateTest, + RefreshTokenMustBeAvailableForAllAccountsReturnedByGetAccounts) { + EXPECT_EQ(OAuth2TokenServiceDelegate::LoadCredentialsState:: + LOAD_CREDENTIALS_FINISHED_WITH_SUCCESS, + delegate_->load_credentials_state()); + EXPECT_TRUE(delegate_->GetAccounts().empty()); + + // Insert 2 Gaia accounts and 1 Active Directory Account. Of the 2 Gaia + // accounts, 1 has a valid refresh token and 1 has a dummy token. + account_manager_.UpsertToken(gaia_account_key_, kGaiaToken); + + AccountManager::AccountKey gaia_account_key2{"random-gaia-id", + ACCOUNT_TYPE_GAIA}; + account_tracker_service_.SeedAccountInfo(CreateAccountInfoTestFixture( + gaia_account_key2.id, "random-email@domain.com")); + account_manager_.UpsertToken(gaia_account_key2, + AccountManager::kInvalidToken); + + account_manager_.UpsertToken(ad_account_key_, + AccountManager::kActiveDirectoryDummyToken); + + // Verify. + const std::vector<std::string> accounts = delegate_->GetAccounts(); + // 2 Gaia accounts should be returned. + EXPECT_EQ(2UL, accounts.size()); + // And |RefreshTokenIsAvailable| should return true for these accounts. + for (const std::string& account : accounts) { + EXPECT_TRUE(delegate_->RefreshTokenIsAvailable(account)); + } +} + TEST_F(CrOSOAuthDelegateTest, UpdateCredentialsSucceeds) { EXPECT_TRUE(delegate_->GetAccounts().empty());
diff --git a/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc index 34ffc199..0be14eb 100644 --- a/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc +++ b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc
@@ -664,10 +664,13 @@ // kHeartbeatFrequency // kReleaseChannelDelegated // kReportDeviceActivityTimes + // kReportDeviceBoardStatus // kReportDeviceBootMode // kReportDeviceHardwareStatus // kReportDeviceLocation // kReportDeviceNetworkInterfaces + // kReportDevicePowerStatus + // kReportDeviceStorageStatus // kReportDeviceSessionStatus // kReportDeviceVersionInfo // kReportDeviceUsers
diff --git a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc index b7a1ecf..febbf27 100644 --- a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc +++ b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc
@@ -519,6 +519,27 @@ std::make_unique<base::Value>(container.report_session_status()), nullptr); } + if (container.has_report_power_status()) { + policies->Set( + key::kReportDevicePowerStatus, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, + std::make_unique<base::Value>(container.report_power_status()), + nullptr); + } + if (container.has_report_storage_status()) { + policies->Set( + key::kReportDeviceStorageStatus, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, + std::make_unique<base::Value>(container.report_storage_status()), + nullptr); + } + if (container.has_report_board_status()) { + policies->Set( + key::kReportDeviceBoardStatus, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, + std::make_unique<base::Value>(container.report_board_status()), + nullptr); + } if (container.has_device_status_frequency()) { policies->Set(key::kReportUploadFrequency, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD,
diff --git a/chrome/browser/chromeos/settings/device_settings_provider.cc b/chrome/browser/chromeos/settings/device_settings_provider.cc index f53a5a6d..d3ae6f3 100644 --- a/chrome/browser/chromeos/settings/device_settings_provider.cc +++ b/chrome/browser/chromeos/settings/device_settings_provider.cc
@@ -98,9 +98,12 @@ kReleaseChannel, kReleaseChannelDelegated, kReportDeviceActivityTimes, + kReportDeviceBoardStatus, kReportDeviceBootMode, kReportDeviceHardwareStatus, kReportDeviceLocation, + kReportDevicePowerStatus, + kReportDeviceStorageStatus, kReportDeviceNetworkInterfaces, kReportDeviceSessionStatus, kReportDeviceUsers, @@ -471,6 +474,18 @@ new_values_cache->SetBoolean(kReportRunningKioskApp, reporting_policy.report_running_kiosk_app()); } + if (reporting_policy.has_report_power_status()) { + new_values_cache->SetBoolean(kReportDevicePowerStatus, + reporting_policy.report_power_status()); + } + if (reporting_policy.has_report_storage_status()) { + new_values_cache->SetBoolean(kReportDeviceStorageStatus, + reporting_policy.report_storage_status()); + } + if (reporting_policy.has_report_board_status()) { + new_values_cache->SetBoolean(kReportDeviceBoardStatus, + reporting_policy.report_board_status()); + } if (reporting_policy.has_device_status_frequency()) { new_values_cache->SetInteger( kReportUploadFrequency,
diff --git a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc index 729e055..26e4a6f 100644 --- a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc +++ b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
@@ -98,6 +98,9 @@ proto->set_report_session_status(enable_reporting); proto->set_report_os_update_status(enable_reporting); proto->set_report_running_kiosk_app(enable_reporting); + proto->set_report_power_status(enable_reporting); + proto->set_report_storage_status(enable_reporting); + proto->set_report_board_status(enable_reporting); proto->set_device_status_frequency(frequency); BuildAndInstallDevicePolicy(); } @@ -159,18 +162,14 @@ void VerifyReportingSettings(bool expected_enable_state, int expected_frequency) { const char* reporting_settings[] = { - kReportDeviceVersionInfo, - kReportDeviceActivityTimes, - kReportDeviceBootMode, - // Device location reporting is not currently supported. - // kReportDeviceLocation, - kReportDeviceNetworkInterfaces, - kReportDeviceUsers, - kReportDeviceHardwareStatus, - kReportDeviceSessionStatus, - kReportOsUpdateStatus, - kReportRunningKioskApp - }; + kReportDeviceVersionInfo, kReportDeviceActivityTimes, + kReportDeviceBoardStatus, kReportDeviceBootMode, + // Device location reporting is not currently supported. + // kReportDeviceLocation, + kReportDeviceNetworkInterfaces, kReportDeviceUsers, + kReportDeviceHardwareStatus, kReportDevicePowerStatus, + kReportDeviceStorageStatus, kReportDeviceSessionStatus, + kReportOsUpdateStatus, kReportRunningKioskApp}; const base::Value expected_enable_value(expected_enable_state); for (auto* setting : reporting_settings) {
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc index 624a440..d310587 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc
@@ -21,7 +21,6 @@ #include "chrome/browser/profiles/profile_io_data.h" #include "chrome/common/custom_handlers/protocol_handler.h" #include "chrome/common/pref_names.h" -#include "chrome/grit/generated_resources.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_service.h" #include "components/user_prefs/user_prefs.h" @@ -29,7 +28,6 @@ #include "content/public/browser/child_process_security_policy.h" #include "net/base/network_delegate.h" #include "net/url_request/url_request_redirect_job.h" -#include "ui/base/l10n/l10n_util.h" using content::BrowserThread; using content::ChildProcessSecurityPolicy; @@ -350,11 +348,11 @@ AddPredefinedHandler( ProtocolHandler::CreateProtocolHandler( "mailto", - GURL(l10n_util::GetStringUTF8(IDS_GOOGLE_MAILTO_HANDLER_URL)))); + GURL("https://mail.google.com/mail/?extsrc=mailto&url=%s"))); AddPredefinedHandler( ProtocolHandler::CreateProtocolHandler( "webcal", - GURL(l10n_util::GetStringUTF8(IDS_GOOGLE_WEBCAL_HANDLER_URL)))); + GURL("https://www.google.com/calendar/render?cid=%s"))); #else NOTREACHED(); // this method should only ever be called in chromeos. #endif
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc index 9345ac2..0fbe38a 100644 --- a/chrome/browser/extensions/api/tabs/tabs_api.cc +++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -1401,15 +1401,17 @@ return false; } - bool use_renderer_initiated = false; + NavigationController::LoadURLParams load_params(url); + // For the PDF extension, treat it as renderer-initiated so that it does not // show in the omnibox until it commits. This avoids URL spoofs since urls // can be opened on behalf of untrusted content. // TODO(devlin|nasko): Make this the default for all extensions. - if (extension() && extension()->id() == extension_misc::kPdfExtensionId) - use_renderer_initiated = true; - NavigationController::LoadURLParams load_params(url); - load_params.is_renderer_initiated = use_renderer_initiated; + if (extension() && extension()->id() == extension_misc::kPdfExtensionId) { + load_params.is_renderer_initiated = true; + load_params.initiator_origin = url::Origin::Create( + Extension::GetBaseURLFromExtensionId(extension()->id())); + } web_contents_->GetController().LoadURLWithParams(load_params); DCHECK_EQ(url,
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index bfb82b4..c7cd524 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -2103,13 +2103,6 @@ "passing {sdpSemantics:'plan-b'} to the RTCPeerConnection constructor. " "RTCRtpTransceiver support is also enabled in Unified Plan."; -const char kWebSocketHandshakeReuseConnectionName[] = - "Enable WebSocket connection reuse for authentication"; -const char kWebSocketHandshakeReuseConnectionDescription[] = - "Permits the WebSocket handshake to keep the connection open after an " - "authentication failure. The connection may be used for further requests " - "to send credentials. This is sometimes needed for Windows authentication."; - const char kWebvrName[] = "WebVR"; const char kWebvrDescription[] = "Enables access to experimental Virtual Reality functionality via the "
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 261d91c..bc71f2a 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -1256,9 +1256,6 @@ extern const char kWebrtcUnifiedPlanByDefaultName[]; extern const char kWebrtcUnifiedPlanByDefaultDescription[]; -extern const char kWebSocketHandshakeReuseConnectionName[]; -extern const char kWebSocketHandshakeReuseConnectionDescription[]; - extern const char kWebvrName[]; extern const char kWebvrDescription[];
diff --git a/chrome/browser/media/unified_autoplay_browsertest.cc b/chrome/browser/media/unified_autoplay_browsertest.cc index e7bd58d..6877beb 100644 --- a/chrome/browser/media/unified_autoplay_browsertest.cc +++ b/chrome/browser/media/unified_autoplay_browsertest.cc
@@ -112,6 +112,8 @@ url, referrer, disposition, ui::PAGE_TRANSITION_LINK, is_renderer_initiated, from_context_menu); + open_url_params.initiator_origin = + url::Origin::Create(active_contents->GetLastCommittedURL()); open_url_params.source_render_process_id = active_contents->GetMainFrame()->GetProcess()->GetID(); open_url_params.source_render_frame_id =
diff --git a/chrome/browser/media/webrtc/webrtc_internals_perf_browsertest.cc b/chrome/browser/media/webrtc/webrtc_internals_perf_browsertest.cc index 964eb451..f05f325 100644 --- a/chrome/browser/media/webrtc/webrtc_internals_perf_browsertest.cc +++ b/chrome/browser/media/webrtc/webrtc_internals_perf_browsertest.cc
@@ -116,7 +116,8 @@ void RunsAudioVideoCall60SecsAndLogsInternalMetrics( const std::string& video_codec, bool prefer_hw_video_codec = false, - const std::string& video_codec_profile = std::string()) { + const std::string& video_codec_profile = std::string(), + const std::string& video_codec_print_modifier = std::string()) { ASSERT_TRUE(test::HasReferenceFilesInCheckout()); ASSERT_TRUE(embedded_test_server()->Start()); @@ -133,8 +134,10 @@ SetupPeerconnectionWithLocalStream(right_tab); if (!video_codec.empty()) { - SetDefaultVideoCodec(left_tab, video_codec, prefer_hw_video_codec); - SetDefaultVideoCodec(right_tab, video_codec, prefer_hw_video_codec); + SetDefaultVideoCodec(left_tab, video_codec, prefer_hw_video_codec, + video_codec_profile); + SetDefaultVideoCodec(right_tab, video_codec, prefer_hw_video_codec, + video_codec_profile); } NegotiateCall(left_tab, right_tab); @@ -155,8 +158,11 @@ const base::DictionaryValue* first_pc_dict = GetDataOnPeerConnection(all_data.get(), 0); ASSERT_TRUE(first_pc_dict != NULL); - test::PrintBweForVideoMetrics(*first_pc_dict, "", video_codec); - test::PrintMetricsForAllStreams(*first_pc_dict, "", video_codec); + const std::string print_modifier = video_codec_print_modifier.empty() + ? video_codec + : video_codec_print_modifier; + test::PrintBweForVideoMetrics(*first_pc_dict, "", print_modifier); + test::PrintMetricsForAllStreams(*first_pc_dict, "", print_modifier); HangUp(left_tab); HangUp(right_tab); @@ -240,6 +246,15 @@ RunsAudioVideoCall60SecsAndLogsInternalMetrics("VP9"); } +IN_PROC_BROWSER_TEST_F( + WebRtcInternalsPerfBrowserTest, + MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsVp9Profile2) { + base::ScopedAllowBlockingForTesting allow_blocking; + RunsAudioVideoCall60SecsAndLogsInternalMetrics( + "VP9", true /* prefer_hw_video_codec */, + WebRtcTestBase::kVP9Profile2Specifier, "VP9p2"); +} + #if BUILDFLAG(RTC_USE_H264) IN_PROC_BROWSER_TEST_F(
diff --git a/chrome/browser/media/webrtc/webrtc_stats_perf_browsertest.cc b/chrome/browser/media/webrtc/webrtc_stats_perf_browsertest.cc index aaeca1a..92093ab5 100644 --- a/chrome/browser/media/webrtc/webrtc_stats_perf_browsertest.cc +++ b/chrome/browser/media/webrtc/webrtc_stats_perf_browsertest.cc
@@ -127,25 +127,27 @@ void RunsAudioAndVideoCallCollectingMetricsWithAudioCodec( const std::string& audio_codec) { - RunsAudioAndVideoCallCollectingMetrics(audio_codec, kUseDefaultVideoCodec, - false /* prefer_hw_video_codec */, - ""); + RunsAudioAndVideoCallCollectingMetrics( + audio_codec, kUseDefaultVideoCodec, false /* prefer_hw_video_codec */, + "" /* video_codec_profile */, "" /* video_codec_print_modifier */); } void RunsAudioAndVideoCallCollectingMetricsWithVideoCodec( const std::string& video_codec, bool prefer_hw_video_codec = false, - const std::string& video_codec_profile = std::string()) { - RunsAudioAndVideoCallCollectingMetrics(kUseDefaultAudioCodec, video_codec, - prefer_hw_video_codec, - video_codec_profile); + const std::string& video_codec_profile = std::string(), + const std::string& video_codec_print_modifier = std::string()) { + RunsAudioAndVideoCallCollectingMetrics( + kUseDefaultAudioCodec, video_codec, prefer_hw_video_codec, + video_codec_profile, video_codec_print_modifier); } void RunsAudioAndVideoCallCollectingMetrics( const std::string& audio_codec, const std::string& video_codec, bool prefer_hw_video_codec, - const std::string& video_codec_profile) { + const std::string& video_codec_profile, + const std::string& video_codec_print_modifier) { StartCall(audio_codec, video_codec, prefer_hw_video_codec, video_codec_profile); @@ -207,10 +209,12 @@ (video_bytes_received_after - video_bytes_received_before) / measure_duration_seconds; - std::string video_codec_modifier = "_" + video_codec; - perf_test::PrintResult( - "video", video_codec_modifier, "send_rate", video_send_rate, - "bytes/second", false); + std::string video_codec_modifier = + "_" + (video_codec_print_modifier.empty() + ? video_codec + : video_codec_print_modifier); + perf_test::PrintResult("video", video_codec_modifier, "send_rate", + video_send_rate, "bytes/second", false); perf_test::PrintResult( "video", video_codec_modifier, "receive_rate", video_receive_rate, "bytes/second", false); @@ -304,6 +308,15 @@ RunsAudioAndVideoCallCollectingMetricsWithVideoCodec("VP9"); } +IN_PROC_BROWSER_TEST_F( + WebRtcStatsPerfBrowserTest, + MANUAL_RunsAudioAndVideoCallCollectingMetrics_VideoCodec_VP9Profile2) { + base::ScopedAllowBlockingForTesting allow_blocking; + RunsAudioAndVideoCallCollectingMetricsWithVideoCodec( + "VP9", true /* prefer_hw_video_codec */, + WebRtcTestBase::kVP9Profile2Specifier, "VP9p2"); +} + #if BUILDFLAG(RTC_USE_H264) IN_PROC_BROWSER_TEST_F(
diff --git a/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc index 16cf28fc..01b9b749 100644 --- a/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc +++ b/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc
@@ -98,6 +98,14 @@ return subframe_origin.IsSameOriginWith(mainframe_origin); } +void RecordSingleFeatureUsage(content::RenderFrameHost* rfh, + blink::mojom::WebFeature web_feature) { + page_load_metrics::mojom::PageLoadFeatures page_load_features( + {web_feature}, {} /* css_properties */, {} /* animated_css_properties */); + page_load_metrics::MetricsWebContentsObserver::RecordFeatureUsage( + rfh, page_load_features); +} + using ResourceMimeType = AdsPageLoadMetricsObserver::ResourceMimeType; } // namespace @@ -240,27 +248,22 @@ // content. These two features can also be logged from blink for download // originated from clicking on <a download> link that results in direct // download. - web_features.push_back( + blink::mojom::WebFeature web_feature = has_gesture ? blink::mojom::WebFeature::kDownloadInAdFrameWithUserGesture - : blink::mojom::WebFeature::kDownloadInAdFrameWithoutUserGesture); + : blink::mojom::WebFeature::kDownloadInAdFrameWithoutUserGesture; + RecordSingleFeatureUsage(ad_host, web_feature); } if (has_sandbox) { - web_features.push_back( + blink::mojom::WebFeature web_feature = has_gesture ? blink::mojom::WebFeature:: kNavigationDownloadInSandboxWithUserGesture : blink::mojom::WebFeature:: - kNavigationDownloadInSandboxWithoutUserGesture); - } - if (!web_features.empty()) { - page_load_metrics::mojom::PageLoadFeatures page_load_features( - web_features, {} /* css_properties */, - {} /* animated_css_properties */); - page_load_metrics::MetricsWebContentsObserver::RecordFeatureUsage( - ad_host, page_load_features); + kNavigationDownloadInSandboxWithoutUserGesture; + RecordSingleFeatureUsage(ad_host, web_feature); } - blink::DownloadStats::DownloadFlags flags; + blink::DownloadStats::SubframeDownloadFlags flags; flags.has_sandbox = has_sandbox; flags.is_cross_origin = !IsSubframeSameOriginToMainFrame(ad_host, /*use_parent_origin=*/false); @@ -282,8 +285,23 @@ content::NavigationHandle* navigation_handle) { // Main frame navigation if (navigation_handle->IsDownload()) { - blink::DownloadStats::RecordMainFrameHasGesture( - navigation_handle->HasUserGesture(), + content::RenderFrameHost* rfh = FindFrameMaybeUnsafe(navigation_handle); + bool has_sandbox = rfh->IsSandboxed(blink::WebSandboxFlags::kDownloads); + bool has_gesture = navigation_handle->HasUserGesture(); + if (has_sandbox) { + blink::mojom::WebFeature web_feature = + has_gesture ? blink::mojom::WebFeature:: + kNavigationDownloadInSandboxWithUserGesture + : blink::mojom::WebFeature:: + kNavigationDownloadInSandboxWithoutUserGesture; + RecordSingleFeatureUsage(rfh, web_feature); + } + + blink::DownloadStats::MainFrameDownloadFlags flags; + flags.has_sandbox = has_sandbox; + flags.has_gesture = has_gesture; + blink::DownloadStats::RecordMainFrameDownloadFlags( + flags, ukm::GetSourceIdForWebContentsDocument( navigation_handle->GetWebContents()), ukm::UkmRecorder::Get());
diff --git a/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_browsertest.cc b/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_browsertest.cc index e262fba..6f67009 100644 --- a/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_browsertest.cc +++ b/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_browsertest.cc
@@ -76,6 +76,38 @@ } } +// Allow PageLoadMetricsTestWaiter to be initialized for a new web content +// before the first commit. +class PopupPageLoadMetricsWaiterInitializer : public TabStripModelObserver { + public: + PopupPageLoadMetricsWaiterInitializer( + TabStripModel* tab_strip_model, + std::unique_ptr<page_load_metrics::PageLoadMetricsTestWaiter>* waiter) + : waiter_(waiter), scoped_observer_(this) { + scoped_observer_.Add(tab_strip_model); + } + + void OnTabStripModelChanged( + TabStripModel* tab_strip_model, + const TabStripModelChange& change, + const TabStripSelectionChange& selection) override { + if (change.type() == TabStripModelChange::kInserted && + selection.active_tab_changed()) { + DCHECK(waiter_ && !(*waiter_)); + *waiter_ = std::make_unique<page_load_metrics::PageLoadMetricsTestWaiter>( + tab_strip_model->GetActiveWebContents()); + } + } + + private: + std::unique_ptr<page_load_metrics::PageLoadMetricsTestWaiter>* waiter_ = + nullptr; + ScopedObserver<TabStripModel, PopupPageLoadMetricsWaiterInitializer> + scoped_observer_; + + DISALLOW_COPY_AND_ASSIGN(PopupPageLoadMetricsWaiterInitializer); +}; + } // namespace class AdsPageLoadMetricsObserverBrowserTest @@ -586,9 +618,9 @@ } // Download gets blocked when LoadPolicy is DISALLOW for the navigation -// to download +// to download. IN_PROC_BROWSER_TEST_F(AdsPageLoadMetricsObserverResourceBrowserTest, - DownloadBlocked) { + SubframeNavigationDownloadBlockedByLoadPolicy) { ResetConfiguration(subresource_filter::Configuration( subresource_filter::mojom::ActivationLevel::kEnabled, subresource_filter::ActivationScope::ALL_SITES)); @@ -616,63 +648,170 @@ OpenLinkInFrame(rfh, "blocked_nav_download_id", false /* gesture*/); SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); - histogram_tester.ExpectTotalCount("Download.FrameGesture", 0); + histogram_tester.ExpectTotalCount("Download.Subframe.SandboxOriginAdGesture", + 0); } -class MainFrameDownloadHasGestureBrowserTest +class MainFrameDownloadFlagsBrowserTest : public AdsPageLoadMetricsObserverResourceBrowserTest, public ::testing::WithParamInterface< - std::tuple<Origin, bool /* has_gesture */>> {}; + std::tuple<Origin, + bool /* enable_blocking_downloads_in_sandbox */, + SandboxOption, + bool /* has_gesture */>> { + void SetUpCommandLine(base::CommandLine* command_line) override { + bool enable_blocking_downloads_in_sandbox; + std::tie(std::ignore, enable_blocking_downloads_in_sandbox, std::ignore, + std::ignore) = GetParam(); + std::string cmd = enable_blocking_downloads_in_sandbox + ? "enable-blink-features" + : "disable-blink-features"; + command_line->AppendSwitchASCII(cmd, "BlockingDownloadsInSandbox"); + } +}; // Main frame download events are reported correctly. -IN_PROC_BROWSER_TEST_P(MainFrameDownloadHasGestureBrowserTest, Download) { +IN_PROC_BROWSER_TEST_P(MainFrameDownloadFlagsBrowserTest, Download) { Origin origin; + bool enable_blocking_downloads_in_sandbox; + SandboxOption sandbox_option; bool has_gesture; - std::tie(origin, has_gesture) = GetParam(); - SCOPED_TRACE(::testing::Message() << "origin = " << origin << ", " - << "has_gesture = " << has_gesture); + std::tie(origin, enable_blocking_downloads_in_sandbox, sandbox_option, + has_gesture) = GetParam(); + SCOPED_TRACE(::testing::Message() + << "origin = " << origin << ", " + << "enable_blocking_downloads_in_sandbox = " + << enable_blocking_downloads_in_sandbox << ", " + << "sandbox_option = " << sandbox_option << ", " + << "has_gesture = " << has_gesture); + + bool expected_download = + !enable_blocking_downloads_in_sandbox || + sandbox_option != SandboxOption::kSandboxDisallowDownloads; + bool expected_sandbox_bit = !enable_blocking_downloads_in_sandbox && + sandbox_option != SandboxOption::kNoSandbox; base::HistogramTester histogram_tester; ukm::TestAutoSetUkmRecorder ukm_recorder; - std::unique_ptr<content::DownloadTestObserver> download_observer( - new content::DownloadTestObserverTerminal( - content::BrowserContext::GetDownloadManager(browser()->profile()), - 1 /* wait_count */, - content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); - embedded_test_server()->ServeFilesFromSourceDirectory( "chrome/test/data/ad_tagging"); content::SetupCrossSiteRedirector(embedded_test_server()); ASSERT_TRUE(embedded_test_server()->Start()); - GURL main_url = embedded_test_server()->GetURL("foo.com", "/download.html"); - ui_test_utils::NavigateToURL(browser(), main_url); + std::string host_name = "foo.com"; + GURL main_url = embedded_test_server()->GetURL(host_name, "/download.html"); + + std::unique_ptr<page_load_metrics::PageLoadMetricsTestWaiter> + web_feature_waiter; + + if (sandbox_option == SandboxOption::kNoSandbox) { + if (expected_sandbox_bit) { + web_feature_waiter = + std::make_unique<page_load_metrics::PageLoadMetricsTestWaiter>( + web_contents()); + } + ui_test_utils::NavigateToURL(browser(), main_url); + } else { + GURL first_tab_url = + embedded_test_server()->GetURL(host_name, "/frame_factory.html"); + ui_test_utils::NavigateToURL(browser(), first_tab_url); + const char* method = "createFrame"; + std::string subframe_url = + embedded_test_server()->GetURL(host_name, "/frame_factory.html").spec(); + const char* id = "test"; + const char* sandbox_param = + sandbox_option == SandboxOption::kSandboxDisallowDownloads + ? "'allow-scripts allow-same-origin allow-popups'" + : "'allow-scripts allow-same-origin allow-popups allow-downloads'"; + content::TestNavigationObserver navigation_observer(web_contents()); + std::string script = base::StringPrintf( + "%s('%s','%s',%s);", method, subframe_url.c_str(), id, sandbox_param); + web_contents()->GetMainFrame()->ExecuteJavaScriptForTests( + base::ASCIIToUTF16(script)); + navigation_observer.Wait(); + + content::RenderFrameHost* child = content::FrameMatchingPredicate( + web_contents(), base::BindRepeating(&content::FrameMatchesName, id)); + + std::unique_ptr<PopupPageLoadMetricsWaiterInitializer> waiter_initializer; + if (expected_sandbox_bit) { + waiter_initializer = + std::make_unique<PopupPageLoadMetricsWaiterInitializer>( + browser()->tab_strip_model(), &web_feature_waiter); + } + content::TestNavigationObserver popup_observer(main_url); + popup_observer.StartWatchingNewWebContents(); + EXPECT_TRUE( + ExecuteScript(child, "window.open(\"" + main_url.spec() + "\");")); + popup_observer.Wait(); + ASSERT_EQ(2, browser()->tab_strip_model()->count()); + } + + DCHECK(!expected_sandbox_bit || web_feature_waiter); + if (expected_sandbox_bit) { + blink::mojom::WebFeature feature = + origin == Origin::kNavigation + ? has_gesture ? blink::mojom::WebFeature:: + kNavigationDownloadInSandboxWithUserGesture + : blink::mojom::WebFeature:: + kNavigationDownloadInSandboxWithoutUserGesture + : has_gesture + ? blink::mojom::WebFeature:: + kHTMLAnchorElementDownloadInSandboxWithUserGesture + : blink::mojom::WebFeature:: + kHTMLAnchorElementDownloadInSandboxWithoutUserGesture; + web_feature_waiter->AddWebFeatureExpectation(feature); + } std::string link_id = origin == Origin::kNavigation ? "nav_download_id" : "anchor_download_id"; + std::unique_ptr<content::DownloadTestObserver> download_observer( + new content::DownloadTestObserverTerminal( + content::BrowserContext::GetDownloadManager(browser()->profile()), + expected_download /* wait_count */, + content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); OpenLinkInFrame(web_contents(), link_id, has_gesture); - download_observer->WaitForFinished(); + if (web_feature_waiter) + web_feature_waiter->Wait(); SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); - histogram_tester.ExpectUniqueSample("Download.MainFrame.HasGesture", - has_gesture, 1 /* expected_count */); + + if (!expected_download) { + histogram_tester.ExpectTotalCount("Download.MainFrame.SandboxGesture", + 0 /* expected_count */); + return; + } + + blink::DownloadStats::MainFrameDownloadFlags expected_flags; + expected_flags.has_sandbox = expected_sandbox_bit; + expected_flags.has_gesture = has_gesture; + histogram_tester.ExpectUniqueSample("Download.MainFrame.SandboxGesture", + expected_flags.ToUmaValue(), + 1 /* expected_count */); auto entries = ukm_recorder.GetEntriesByName( ukm::builders::MainFrameDownload::kEntryName); EXPECT_EQ(1u, entries.size()); ukm_recorder.ExpectEntrySourceHasUrl(entries.back(), main_url); ukm_recorder.ExpectEntryMetric( + entries.back(), ukm::builders::MainFrameDownload::kHasSandboxName, + expected_sandbox_bit); + ukm_recorder.ExpectEntryMetric( entries.back(), ukm::builders::MainFrameDownload::kHasGestureName, has_gesture); } INSTANTIATE_TEST_CASE_P( /* no prefix */, - MainFrameDownloadHasGestureBrowserTest, - ::testing::Combine(::testing::Values(Origin::kNavigation, - Origin::kAnchorAttribute), - ::testing::Bool())); + MainFrameDownloadFlagsBrowserTest, + ::testing::Combine( + ::testing::Values(Origin::kNavigation, Origin::kAnchorAttribute), + ::testing::Bool(), + ::testing::Values(SandboxOption::kNoSandbox, + SandboxOption::kSandboxDisallowDownloads, + SandboxOption::kSandboxAllowDownloads), + ::testing::Bool())); class SubframeDownloadDownloadFlagsBrowserTest : public AdsPageLoadMetricsObserverResourceBrowserTest, @@ -715,20 +854,16 @@ base::HistogramTester histogram_tester; ukm::TestAutoSetUkmRecorder ukm_recorder; - size_t expected_download_count = - enable_blocking_downloads_in_sandbox && - sandbox_option == SandboxOption::kSandboxDisallowDownloads - ? 0 - : 1; - bool expected_sandbox_bit = - enable_blocking_downloads_in_sandbox - ? sandbox_option == SandboxOption::kSandboxDisallowDownloads - : sandbox_option != SandboxOption::kNoSandbox; + bool expected_download = + !enable_blocking_downloads_in_sandbox || + sandbox_option != SandboxOption::kSandboxDisallowDownloads; + bool expected_sandbox_bit = !enable_blocking_downloads_in_sandbox && + sandbox_option != SandboxOption::kNoSandbox; std::unique_ptr<content::DownloadTestObserver> download_observer( new content::DownloadTestObserverTerminal( content::BrowserContext::GetDownloadManager(browser()->profile()), - expected_download_count /* wait_count */, + expected_download /* wait_count */, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); embedded_test_server()->ServeFilesFromSourceDirectory( @@ -740,32 +875,30 @@ browser()->tab_strip_model()->GetActiveWebContents(); std::unique_ptr<AdsPageLoadMetricsTestWaiter> waiter; - if (expected_download_count > 0) { - if (is_ad_frame) { - if (!waiter) - waiter = std::make_unique<AdsPageLoadMetricsTestWaiter>(contents); - blink::mojom::WebFeature feature = - has_gesture - ? blink::mojom::WebFeature::kDownloadInAdFrameWithUserGesture - : blink::mojom::WebFeature::kDownloadInAdFrameWithoutUserGesture; - waiter->AddWebFeatureExpectation(feature); - } - if (expected_sandbox_bit) { - if (!waiter) - waiter = std::make_unique<AdsPageLoadMetricsTestWaiter>(contents); - blink::mojom::WebFeature feature = - origin == Origin::kNavigation - ? has_gesture ? blink::mojom::WebFeature:: - kNavigationDownloadInSandboxWithUserGesture - : blink::mojom::WebFeature:: - kNavigationDownloadInSandboxWithoutUserGesture - : has_gesture - ? blink::mojom::WebFeature:: - kHTMLAnchorElementDownloadInSandboxWithUserGesture - : blink::mojom::WebFeature:: - kHTMLAnchorElementDownloadInSandboxWithoutUserGesture; - waiter->AddWebFeatureExpectation(feature); - } + if (expected_download && is_ad_frame) { + if (!waiter) + waiter = std::make_unique<AdsPageLoadMetricsTestWaiter>(contents); + blink::mojom::WebFeature feature = + has_gesture + ? blink::mojom::WebFeature::kDownloadInAdFrameWithUserGesture + : blink::mojom::WebFeature::kDownloadInAdFrameWithoutUserGesture; + waiter->AddWebFeatureExpectation(feature); + } + if (expected_sandbox_bit) { + if (!waiter) + waiter = std::make_unique<AdsPageLoadMetricsTestWaiter>(contents); + blink::mojom::WebFeature feature = + origin == Origin::kNavigation + ? has_gesture ? blink::mojom::WebFeature:: + kNavigationDownloadInSandboxWithUserGesture + : blink::mojom::WebFeature:: + kNavigationDownloadInSandboxWithoutUserGesture + : has_gesture + ? blink::mojom::WebFeature:: + kHTMLAnchorElementDownloadInSandboxWithUserGesture + : blink::mojom::WebFeature:: + kHTMLAnchorElementDownloadInSandboxWithoutUserGesture; + waiter->AddWebFeatureExpectation(feature); } std::string host_name = "foo.com"; @@ -806,13 +939,13 @@ waiter->Wait(); SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); - if (expected_download_count == 0) { + if (!expected_download) { histogram_tester.ExpectTotalCount( "Download.Subframe.SandboxOriginAdGesture", 0 /* expected_count */); return; } - blink::DownloadStats::DownloadFlags expected_flags; + blink::DownloadStats::SubframeDownloadFlags expected_flags; expected_flags.has_sandbox = enable_blocking_downloads_in_sandbox ? sandbox_option == SandboxOption::kSandboxDisallowDownloads @@ -820,9 +953,8 @@ expected_flags.is_cross_origin = is_cross_origin; expected_flags.is_ad_frame = is_ad_frame; expected_flags.has_gesture = has_gesture; - unsigned expected_value = blink::DownloadStats::ToUmaValue(expected_flags); histogram_tester.ExpectUniqueSample( - "Download.Subframe.SandboxOriginAdGesture", expected_value, + "Download.Subframe.SandboxOriginAdGesture", expected_flags.ToUmaValue(), 1 /* expected_count */); auto entries = ukm_recorder.GetEntriesByName(
diff --git a/chrome/browser/previews/previews_lite_page_navigation_throttle.cc b/chrome/browser/previews/previews_lite_page_navigation_throttle.cc index e2c592af..41944a1 100644 --- a/chrome/browser/previews/previews_lite_page_navigation_throttle.cc +++ b/chrome/browser/previews/previews_lite_page_navigation_throttle.cc
@@ -84,6 +84,7 @@ content::OpenURLParams url_params( url, handle->GetReferrer(), WindowOpenDisposition::CURRENT_TAB, handle->GetPageTransition(), handle->IsRendererInitiated()); + url_params.initiator_origin = handle->GetInitiatorOrigin(); // crbug.com/916892: When a client redirect occurs on a site before the page // has finished loading, it is not considered a new NavigationEntry and so // clicking "Back" on the redirected page returns to the previous loaded page.
diff --git a/chrome/browser/search/search_unittest.cc b/chrome/browser/search/search_unittest.cc index 0574177..13459c9 100644 --- a/chrome/browser/search/search_unittest.cc +++ b/chrome/browser/search/search_unittest.cc
@@ -238,6 +238,7 @@ content::NavigationController* controller = &contents->GetController(); content::NavigationController::LoadURLParams load_params( GURL(test.end_url)); + load_params.initiator_origin = url::Origin::Create(GURL(test.start_url)); load_params.is_renderer_initiated = true; load_params.transition_type = ui::PAGE_TRANSITION_LINK;
diff --git a/chrome/browser/signin/signin_profile_attributes_updater.cc b/chrome/browser/signin/signin_profile_attributes_updater.cc index 28b580d8..5073663 100644 --- a/chrome/browser/signin/signin_profile_attributes_updater.cc +++ b/chrome/browser/signin/signin_profile_attributes_updater.cc
@@ -15,19 +15,19 @@ #include "components/signin/core/browser/account_info.h" SigninProfileAttributesUpdater::SigninProfileAttributesUpdater( - SigninManagerBase* signin_manager, + identity::IdentityManager* identity_manager, SigninErrorController* signin_error_controller, const base::FilePath& profile_path) - : signin_error_controller_(signin_error_controller), - signin_manager_(signin_manager), + : identity_manager_(identity_manager), + signin_error_controller_(signin_error_controller), profile_path_(profile_path), - signin_error_controller_observer_(this), - signin_manager_observer_(this) { + identity_manager_observer_(this), + signin_error_controller_observer_(this) { // Some tests don't have a ProfileManager, disable this service. if (!g_browser_process->profile_manager()) return; - signin_manager_observer_.Add(signin_manager_); + identity_manager_observer_.Add(identity_manager_); signin_error_controller_observer_.Add(signin_error_controller); UpdateProfileAttributes(); @@ -39,8 +39,8 @@ SigninProfileAttributesUpdater::~SigninProfileAttributesUpdater() = default; void SigninProfileAttributesUpdater::Shutdown() { + identity_manager_observer_.RemoveAll(); signin_error_controller_observer_.RemoveAll(); - signin_manager_observer_.RemoveAll(); } void SigninProfileAttributesUpdater::UpdateProfileAttributes() { @@ -53,8 +53,8 @@ std::string old_gaia_id = entry->GetGAIAId(); - if (signin_manager_->IsAuthenticated()) { - AccountInfo account_info = signin_manager_->GetAuthenticatedAccountInfo(); + if (identity_manager_->HasPrimaryAccount()) { + AccountInfo account_info = identity_manager_->GetPrimaryAccountInfo(); entry->SetAuthInfo(account_info.gaia, base::UTF8ToUTF16(account_info.email)); } else { @@ -79,12 +79,12 @@ entry->SetIsAuthError(signin_error_controller_->HasError()); } -void SigninProfileAttributesUpdater::GoogleSigninSucceeded( - const AccountInfo& account_info) { +void SigninProfileAttributesUpdater::OnPrimaryAccountSet( + const AccountInfo& primary_account_info) { UpdateProfileAttributes(); } -void SigninProfileAttributesUpdater::GoogleSignedOut( - const AccountInfo& account_info) { +void SigninProfileAttributesUpdater::OnPrimaryAccountCleared( + const AccountInfo& previous_primary_account_info) { UpdateProfileAttributes(); }
diff --git a/chrome/browser/signin/signin_profile_attributes_updater.h b/chrome/browser/signin/signin_profile_attributes_updater.h index f79937f..344508d 100644 --- a/chrome/browser/signin/signin_profile_attributes_updater.h +++ b/chrome/browser/signin/signin_profile_attributes_updater.h
@@ -11,15 +11,16 @@ #include "build/build_config.h" #include "components/keyed_service/core/keyed_service.h" #include "components/signin/core/browser/signin_error_controller.h" -#include "components/signin/core/browser/signin_manager_base.h" +#include "services/identity/public/cpp/identity_manager.h" // This class listens to various signin events and updates the signin-related // fields of ProfileAttributes. -class SigninProfileAttributesUpdater : public KeyedService, - public SigninErrorController::Observer, - public SigninManagerBase::Observer { +class SigninProfileAttributesUpdater + : public KeyedService, + public SigninErrorController::Observer, + public identity::IdentityManager::Observer { public: - SigninProfileAttributesUpdater(SigninManagerBase* signin_manager, + SigninProfileAttributesUpdater(identity::IdentityManager* identity_manager, SigninErrorController* signin_error_controller, const base::FilePath& profile_path); @@ -35,17 +36,18 @@ // SigninErrorController::Observer: void OnErrorChanged() override; - // SigninManagerBase::Observer: - void GoogleSigninSucceeded(const AccountInfo& account_info) override; - void GoogleSignedOut(const AccountInfo& account_info) override; + // IdentityManager::Observer: + void OnPrimaryAccountSet(const AccountInfo& primary_account_info) override; + void OnPrimaryAccountCleared( + const AccountInfo& previous_primary_account_info) override; + identity::IdentityManager* identity_manager_; SigninErrorController* signin_error_controller_; - SigninManagerBase* signin_manager_; const base::FilePath profile_path_; + ScopedObserver<identity::IdentityManager, SigninProfileAttributesUpdater> + identity_manager_observer_; ScopedObserver<SigninErrorController, SigninProfileAttributesUpdater> signin_error_controller_observer_; - ScopedObserver<SigninManagerBase, SigninProfileAttributesUpdater> - signin_manager_observer_; DISALLOW_COPY_AND_ASSIGN(SigninProfileAttributesUpdater); };
diff --git a/chrome/browser/signin/signin_profile_attributes_updater_factory.cc b/chrome/browser/signin/signin_profile_attributes_updater_factory.cc index cf7f154a..a7443243 100644 --- a/chrome/browser/signin/signin_profile_attributes_updater_factory.cc +++ b/chrome/browser/signin/signin_profile_attributes_updater_factory.cc
@@ -5,8 +5,8 @@ #include "chrome/browser/signin/signin_profile_attributes_updater_factory.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/signin/signin_error_controller_factory.h" -#include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/signin/signin_profile_attributes_updater.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/signin/core/browser/signin_manager.h" @@ -28,8 +28,8 @@ : BrowserContextKeyedServiceFactory( "SigninProfileAttributesUpdater", BrowserContextDependencyManager::GetInstance()) { + DependsOn(IdentityManagerFactory::GetInstance()); DependsOn(SigninErrorControllerFactory::GetInstance()); - DependsOn(SigninManagerFactory::GetInstance()); } SigninProfileAttributesUpdaterFactory:: @@ -39,7 +39,7 @@ content::BrowserContext* context) const { Profile* profile = Profile::FromBrowserContext(context); return new SigninProfileAttributesUpdater( - SigninManagerFactory::GetForProfile(profile), + IdentityManagerFactory::GetForProfile(profile), SigninErrorControllerFactory::GetForProfile(profile), profile->GetPath()); }
diff --git a/chrome/browser/signin/signin_tracker_factory.cc b/chrome/browser/signin/signin_tracker_factory.cc index b7d810ff..e10b55b5 100644 --- a/chrome/browser/signin/signin_tracker_factory.cc +++ b/chrome/browser/signin/signin_tracker_factory.cc
@@ -4,10 +4,8 @@ #include "chrome/browser/signin/signin_tracker_factory.h" -#include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" -#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" -#include "chrome/browser/signin/signin_manager_factory.h" -#include "components/signin/core/browser/account_consistency_method.h" +#include "chrome/browser/signin/identity_manager_factory.h" +#include "services/identity/public/cpp/identity_manager.h" SigninTrackerFactory::SigninTrackerFactory() {} SigninTrackerFactory::~SigninTrackerFactory() {} @@ -17,7 +15,5 @@ Profile* profile, SigninTracker::Observer* observer) { return std::unique_ptr<SigninTracker>(new SigninTracker( - ProfileOAuth2TokenServiceFactory::GetForProfile(profile), - SigninManagerFactory::GetForProfile(profile), - GaiaCookieManagerServiceFactory::GetForProfile(profile), observer)); + IdentityManagerFactory::GetForProfile(profile), observer)); }
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc index cb22bf80..db1ce09d 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
@@ -955,12 +955,9 @@ // activates the right window. IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchMaximized) { MaximizeWindow(browser()->window()); - content::WindowedNotificationObserver open_observer( - chrome::NOTIFICATION_BROWSER_OPENED, - content::NotificationService::AllSources()); - chrome::NewEmptyWindow(browser()->profile()); - open_observer.Wait(); - Browser* browser2 = content::Source<Browser>(open_observer.source()).ptr(); + // Load about:blank in a new window. + Browser* browser2 = CreateBrowser(browser()->profile()); + EXPECT_NE(browser(), browser2); TabStripModel* tab_strip = browser2->tab_strip_model(); int tab_count = tab_strip->count(); MaximizeWindow(browser2->window()); @@ -1746,7 +1743,8 @@ prefs->GetLastLaunchTime(extension_misc::kChromeAppId)); base::Time time_before_launch = base::Time::Now(); - chrome::NewEmptyWindow(profile()); + // Load about:blank in a new window. + CreateBrowser(profile()); base::Time time_after_launch = base::Time::Now(); const base::Time time_launch = prefs->GetLastLaunchTime(extension_misc::kChromeAppId);
diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc index d83663f..f59d380 100644 --- a/chrome/browser/ui/browser_navigator_browsertest.cc +++ b/chrome/browser/ui/browser_navigator_browsertest.cc
@@ -116,6 +116,7 @@ NavigateParams param(MakeNavigateParams()); param.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; param.url = url; + param.initiator_origin = url::Origin(); param.is_renderer_initiated = !is_browser_initiated; param.uses_post = true; param.post_data = network::ResourceRequestBody::CreateFromBytes(
diff --git a/chrome/browser/ui/omnibox/lookalike_url_navigation_observer_browsertest.cc b/chrome/browser/ui/omnibox/lookalike_url_navigation_observer_browsertest.cc index 9b0aa96..09a962f 100644 --- a/chrome/browser/ui/omnibox/lookalike_url_navigation_observer_browsertest.cc +++ b/chrome/browser/ui/omnibox/lookalike_url_navigation_observer_browsertest.cc
@@ -97,6 +97,7 @@ NavigateParams params(browser(), url, ui::PAGE_TRANSITION_LINK); params.disposition = WindowOpenDisposition::CURRENT_TAB; params.is_renderer_initiated = true; + params.initiator_origin = url::Origin::Create(url); ui_test_utils::NavigateToURL(¶ms); }
diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter_unittest.cc b/chrome/browser/ui/sync/one_click_signin_sync_starter_unittest.cc index ad08bf9..7216975 100644 --- a/chrome/browser/ui/sync/one_click_signin_sync_starter_unittest.cc +++ b/chrome/browser/ui/sync/one_click_signin_sync_starter_unittest.cc
@@ -8,30 +8,17 @@ #include "base/command_line.h" #include "base/compiler_specific.h" #include "base/macros.h" -#include "chrome/browser/signin/account_tracker_service_factory.h" -#include "chrome/browser/signin/chrome_signin_client_factory.h" -#include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" -#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" -#include "chrome/browser/signin/signin_manager_factory.h" +#include "chrome/browser/signin/identity_test_environment_profile_adaptor.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/testing_profile.h" #include "components/browser_sync/browser_sync_switches.h" -#include "components/signin/core/browser/account_tracker_service.h" -#include "components/signin/core/browser/fake_signin_manager.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" #include "content/public/test/test_browser_thread_bundle.h" +#include "services/identity/public/cpp/identity_test_environment.h" #include "testing/gtest/include/gtest/gtest.h" -namespace { - -const char kTestingGaiaId[] = "gaia_id"; -const char kTestingRefreshToken[] = "refresh_token"; -const char kTestingUsername[] = "fake_username"; - -} // namespace - class OneClickSigninSyncStarterTest : public ChromeRenderViewHostTestHarness { public: OneClickSigninSyncStarterTest() @@ -45,12 +32,10 @@ base::CommandLine::ForCurrentProcess()->AppendSwitch( switches::kDisableSync); - SigninManagerBase* signin_manager = - SigninManagerFactory::GetForProfile(profile()); - - signin_manager->Initialize(nullptr); - signin_manager->SetAuthenticatedAccountInfo(kTestingGaiaId, - kTestingUsername); + IdentityTestEnvironmentProfileAdaptor identity_test_env_profile_adaptor( + profile()); + account_info_ = identity_test_env_profile_adaptor.identity_test_env() + ->MakePrimaryAccountAvailable("test@email.com"); } void Callback(OneClickSigninSyncStarter::SyncSetupResult result) { @@ -63,19 +48,21 @@ // ChromeRenderViewHostTestHarness: content::BrowserContext* CreateBrowserContext() override { // Create the sign in manager required by OneClickSigninSyncStarter. - TestingProfile::Builder builder; - builder.AddTestingFactory( - SigninManagerFactory::GetInstance(), - base::BindRepeating( - &OneClickSigninSyncStarterTest::BuildSigninManager)); - return builder.Build().release(); + return IdentityTestEnvironmentProfileAdaptor:: + CreateProfileForIdentityTestEnvironment() + .release(); } protected: void CreateSyncStarter(OneClickSigninSyncStarter::Callback callback) { + std::string refresh_token = + "refresh_token_for_" + + account_info_.account_id; // This matches the refresh token string set + // in identity::SetRefreshTokenForAccount. sync_starter_ = new OneClickSigninSyncStarter( - profile(), nullptr, kTestingGaiaId, kTestingUsername, std::string(), - kTestingRefreshToken, signin_metrics::AccessPoint::ACCESS_POINT_UNKNOWN, + profile(), nullptr, account_info_.gaia, account_info_.email, + std::string(), refresh_token, + signin_metrics::AccessPoint::ACCESS_POINT_UNKNOWN, signin_metrics::Reason::REASON_UNKNOWN_REASON, OneClickSigninSyncStarter::CURRENT_PROFILE, OneClickSigninSyncStarter::NO_CONFIRMATION, callback); @@ -90,17 +77,10 @@ // Number of times that the callback is called with SYNC_SETUP_SUCCESS. int succeeded_count_; - private: - static std::unique_ptr<KeyedService> BuildSigninManager( - content::BrowserContext* context) { - Profile* profile = static_cast<Profile*>(context); - return std::make_unique<FakeSigninManager>( - ChromeSigninClientFactory::GetForProfile(profile), - ProfileOAuth2TokenServiceFactory::GetForProfile(profile), - AccountTrackerServiceFactory::GetForProfile(profile), - GaiaCookieManagerServiceFactory::GetForProfile(profile)); - } + // Holds information for the account currently logged in. + AccountInfo account_info_; + private: DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarterTest); };
diff --git a/chrome/browser/ui/views/extensions/media_galleries_dialog_views_browsertest.cc b/chrome/browser/ui/views/extensions/media_galleries_dialog_views_browsertest.cc index 1b6917f4..d46f068 100644 --- a/chrome/browser/ui/views/extensions/media_galleries_dialog_views_browsertest.cc +++ b/chrome/browser/ui/views/extensions/media_galleries_dialog_views_browsertest.cc
@@ -49,7 +49,7 @@ const GURL about_blank(url::kAboutBlankURL); content::WebContents* content = browser()->OpenURL(content::OpenURLParams( about_blank, content::Referrer(), WindowOpenDisposition::CURRENT_TAB, - ui::PAGE_TRANSITION_TYPED, true)); + ui::PAGE_TRANSITION_TYPED, false)); EXPECT_CALL(controller_, WebContents()) .WillRepeatedly(testing::Return(content)); content::TestNavigationManager manager(content, about_blank);
diff --git a/chrome/browser/ui/views/frame/browser_window_property_manager_browsertest_win.cc b/chrome/browser/ui/views/frame/browser_window_property_manager_browsertest_win.cc index 53ead8e..e284576 100644 --- a/chrome/browser/ui/views/frame/browser_window_property_manager_browsertest_win.cc +++ b/chrome/browser/ui/views/frame/browser_window_property_manager_browsertest_win.cc
@@ -193,7 +193,8 @@ ValidateBrowserWindowProperties(profile2_browser, entry->GetName()); } -IN_PROC_BROWSER_TEST_F(BrowserWindowPropertyManagerTest, HostedApp) { +// TODO(crbug.com/919760): This test is flaky. +IN_PROC_BROWSER_TEST_F(BrowserWindowPropertyManagerTest, DISABLED_HostedApp) { // Load an app. const extensions::Extension* extension = LoadExtension(test_data_dir_.AppendASCII("app/"));
diff --git a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_view_interactive_uitest.cc b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_view_interactive_uitest.cc index ec6732f1..0acc5d1 100644 --- a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_view_interactive_uitest.cc +++ b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_view_interactive_uitest.cc
@@ -177,13 +177,12 @@ ASSERT_FALSE(IsPopupCreated()); } -#if defined(OS_MACOSX) -// Entering fullscreen is flaky on Mac: http://crbug.com/824517 -#define MAYBE_MouseExitFullscreen DISABLED_MouseExitFullscreen -#else -#define MAYBE_MouseExitFullscreen MouseExitFullscreen -#endif -IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest, MAYBE_MouseExitFullscreen) { +// These four tests which cover the mouse/touch fullscreen UI are covering +// behavior that doesn't exist on Mac - Mac has its own native fullscreen exit +// UI. See IsExitUiEnabled() in FullscreenControlHost. +#if !defined(OS_MACOSX) + +IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest, MouseExitFullscreen) { EnterActiveTabFullscreen(); BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); ASSERT_TRUE(browser_view->IsFullscreen()); @@ -211,16 +210,8 @@ ASSERT_FALSE(browser_view->IsFullscreen()); } -#if defined(OS_MACOSX) -// Entering fullscreen is flaky on Mac: http://crbug.com/824517 -#define MAYBE_MouseExitFullscreen_TimeoutAndRetrigger \ - DISABLED_MouseExitFullscreen_TimeoutAndRetrigger -#else -#define MAYBE_MouseExitFullscreen_TimeoutAndRetrigger \ - MouseExitFullscreen_TimeoutAndRetrigger -#endif IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest, - MAYBE_MouseExitFullscreen_TimeoutAndRetrigger) { + MouseExitFullscreen_TimeoutAndRetrigger) { EnterActiveTabFullscreen(); BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); ASSERT_TRUE(browser_view->IsFullscreen()); @@ -273,13 +264,7 @@ ASSERT_TRUE(browser_view->IsFullscreen()); } -#if defined(OS_MACOSX) -// Entering fullscreen is flaky on Mac: http://crbug.com/824517 -#define MAYBE_TouchPopupInteraction DISABLED_TouchPopupInteraction -#else -#define MAYBE_TouchPopupInteraction TouchPopupInteraction -#endif -IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest, MAYBE_TouchPopupInteraction) { +IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest, TouchPopupInteraction) { EnterActiveTabFullscreen(); BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); ASSERT_TRUE(browser_view->IsFullscreen()); @@ -358,16 +343,8 @@ ASSERT_FALSE(browser_view->IsFullscreen()); } -#if defined(OS_MACOSX) -// Entering fullscreen is flaky on Mac: http://crbug.com/824517 -#define MAYBE_MouseAndTouchInteraction_NoInterference \ - DISABLED_MouseAndTouchInteraction_NoInterference -#else -#define MAYBE_MouseAndTouchInteraction_NoInterference \ - MouseAndTouchInteraction_NoInterference -#endif IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest, - MAYBE_MouseAndTouchInteraction_NoInterference) { + MouseAndTouchInteraction_NoInterference) { EnterActiveTabFullscreen(); BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); ASSERT_TRUE(browser_view->IsFullscreen()); @@ -440,15 +417,9 @@ RunLoopUntilVisibilityChanges(); ASSERT_FALSE(host->IsVisible()); } - -#if defined(OS_MACOSX) -// Entering fullscreen is flaky on Mac: http://crbug.com/824517 -#define MAYBE_KeyboardPopupInteraction DISABLED_KeyboardPopupInteraction -#else -#define MAYBE_KeyboardPopupInteraction KeyboardPopupInteraction #endif -IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest, - MAYBE_KeyboardPopupInteraction) { + +IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest, KeyboardPopupInteraction) { EnterActiveTabFullscreen(); BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); ASSERT_TRUE(browser_view->IsFullscreen());
diff --git a/chrome/browser/ui/views/passwords/password_generation_popup_view_views.cc b/chrome/browser/ui/views/passwords/password_generation_popup_view_views.cc index 9832faf..fed18ec 100644 --- a/chrome/browser/ui/views/passwords/password_generation_popup_view_views.cc +++ b/chrome/browser/ui/views/passwords/password_generation_popup_view_views.cc
@@ -98,6 +98,7 @@ : AutofillPopupBaseView(controller, parent_widget), controller_(controller) { CreateLayoutAndChildren(); + SetBackground(views::CreateSolidBackground(GetBackgroundColor())); } PasswordGenerationPopupViewViews::~PasswordGenerationPopupViewViews() = default;
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc index d420bf2..1c64f89 100644 --- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc +++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
@@ -24,12 +24,8 @@ #include "chrome/browser/profiles/profiles_state.h" #include "chrome/browser/signin/account_consistency_mode_manager.h" #include "chrome/browser/signin/account_tracker_service_factory.h" -#include "chrome/browser/signin/chrome_signin_helper.h" -#include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" #include "chrome/browser/signin/identity_manager_factory.h" -#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" #include "chrome/browser/signin/signin_error_controller_factory.h" -#include "chrome/browser/signin/signin_promo.h" #include "chrome/browser/signin/signin_ui_util.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/themes/theme_service.h" @@ -61,17 +57,13 @@ #include "chrome/grit/theme_resources.h" #include "components/prefs/pref_service.h" #include "components/signin/core/browser/account_tracker_service.h" -#include "components/signin/core/browser/gaia_cookie_manager_service.h" -#include "components/signin/core/browser/profile_oauth2_token_service.h" #include "components/signin/core/browser/signin_error_controller.h" -#include "components/signin/core/browser/signin_header_helper.h" -#include "components/signin/core/browser/signin_manager.h" #include "components/signin/core/browser/signin_metrics.h" #include "components/signin/core/browser/signin_pref_names.h" #include "components/sync/driver/sync_service_utils.h" #include "components/vector_icons/vector_icons.h" #include "content/public/browser/render_widget_host_view.h" -#include "services/identity/public/cpp/identity_manager.h" +#include "services/identity/public/cpp/accounts_mutator.h" #include "services/identity/public/cpp/primary_account_mutator.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/base/l10n/l10n_util.h" @@ -429,10 +421,11 @@ avatar_menu_->RebuildMenu(); Profile* profile = browser_->profile(); - ProfileOAuth2TokenService* oauth2_token_service = - ProfileOAuth2TokenServiceFactory::GetForProfile(profile); - if (oauth2_token_service) - oauth2_token_service->AddObserver(this); + identity::IdentityManager* identity_manager = + IdentityManagerFactory::GetForProfile(profile); + + if (identity_manager) + identity_manager->AddObserver(this); // If view mode is PROFILE_CHOOSER but there is an auth error, force // ACCOUNT_MANAGEMENT mode. @@ -468,8 +461,8 @@ } } -void ProfileChooserView::OnRefreshTokenAvailable( - const std::string& account_id) { +void ProfileChooserView::OnRefreshTokenUpdatedForAccount( + const AccountInfo& account_info) { if (view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT || view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT || view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH) { @@ -482,7 +475,8 @@ } } -void ProfileChooserView::OnRefreshTokenRevoked(const std::string& account_id) { +void ProfileChooserView::OnRefreshTokenRemovedForAccount( + const std::string& account_id) { // Refresh the account management view when an account is removed from the // profile. if (view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) @@ -586,10 +580,10 @@ // Unsubscribe from everything early so that the updates do not reach the // bubble and change its state. avatar_menu_.reset(); - ProfileOAuth2TokenService* oauth2_token_service = - ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile()); - if (oauth2_token_service) - oauth2_token_service->RemoveObserver(this); + identity::IdentityManager* identity_manager = + IdentityManagerFactory::GetForProfile(browser_->profile()); + if (identity_manager) + identity_manager->RemoveObserver(this); } bool ProfileChooserView::AcceleratorPressed( @@ -808,10 +802,10 @@ void ProfileChooserView::RemoveAccount() { DCHECK(!account_id_to_remove_.empty()); - ProfileOAuth2TokenService* oauth2_token_service = - ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile()); - if (oauth2_token_service) { - oauth2_token_service->RevokeCredentials( + identity::IdentityManager* identity_manager = + IdentityManagerFactory::GetForProfile(browser_->profile()); + if (identity_manager) { + identity_manager->GetAccountsMutator()->RemoveAccount( account_id_to_remove_, signin_metrics::SourceForRefreshTokenOperation:: kUserMenu_RemoveAccount); PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_REMOVE_ACCT); @@ -1653,9 +1647,10 @@ void ProfileChooserView::SignOutAllWebAccounts() { Hide(); - ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile()) - ->RevokeAllCredentials(signin_metrics::SourceForRefreshTokenOperation:: - kUserMenu_SignOutAllAccounts); + IdentityManagerFactory::GetForProfile(browser_->profile()) + ->GetAccountsMutator() + ->RemoveAllAccounts(signin_metrics::SourceForRefreshTokenOperation:: + kUserMenu_SignOutAllAccounts); } int ProfileChooserView::GetDiceSigninPromoShowCount() const {
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.h b/chrome/browser/ui/views/profiles/profile_chooser_view.h index 0dd4d6f..f0786e1e 100644 --- a/chrome/browser/ui/views/profiles/profile_chooser_view.h +++ b/chrome/browser/ui/views/profiles/profile_chooser_view.h
@@ -21,7 +21,7 @@ #include "chrome/browser/ui/views/profiles/dice_accounts_menu.h" #include "components/signin/core/browser/signin_header_helper.h" #include "content/public/browser/web_contents_delegate.h" -#include "google_apis/gaia/oauth2_token_service.h" +#include "services/identity/public/cpp/identity_manager.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h" #include "ui/views/controls/button/button.h" #include "ui/views/controls/link_listener.h" @@ -46,7 +46,7 @@ public views::LinkListener, public views::StyledLabelListener, public AvatarMenuObserver, - public OAuth2TokenService::Observer { + public identity::IdentityManager::Observer { public: // Shows the bubble if one is not already showing. This allows us to easily // make a button toggle the bubble on and off when clicked: we unconditionally @@ -111,9 +111,10 @@ // AvatarMenuObserver: void OnAvatarMenuChanged(AvatarMenu* avatar_menu) override; - // OAuth2TokenService::Observer overrides. - void OnRefreshTokenAvailable(const std::string& account_id) override; - void OnRefreshTokenRevoked(const std::string& account_id) override; + // identity::IdentityManager::Observer overrides. + void OnRefreshTokenUpdatedForAccount( + const AccountInfo& account_info) override; + void OnRefreshTokenRemovedForAccount(const std::string& account_id) override; static ProfileChooserView* profile_bubble_;
diff --git a/chrome/test/data/policy/policy_test_cases.json b/chrome/test/data/policy/policy_test_cases.json index 4b1aebb..05d6e7dc 100644 --- a/chrome/test/data/policy/policy_test_cases.json +++ b/chrome/test/data/policy/policy_test_cases.json
@@ -3513,6 +3513,15 @@ "ReportDeviceSessionStatus": { }, + "ReportDevicePowerStatus": { + }, + + "ReportDeviceStorageStatus": { + }, + + "ReportDeviceBoardStatus": { + }, + "ReportUploadFrequency": { },
diff --git a/chromeos/BUILD.gn b/chromeos/BUILD.gn index cd13474c..04f54ea 100644 --- a/chromeos/BUILD.gn +++ b/chromeos/BUILD.gn
@@ -41,11 +41,6 @@ "//base", "//base:i18n", "//base/third_party/dynamic_annotations", - "//chromeos/cryptohome", - "//chromeos/dbus:authpolicy_proto", - "//chromeos/dbus:vm_applications_apps_proto", - "//chromeos/login/auth", - "//chromeos/login/login_state", "//components/account_id", "//components/device_event_log", "//components/policy:cloud_policy_proto_generated_compile", @@ -203,12 +198,11 @@ testonly = true public_deps = [ ":chromeos", - "//chromeos/dbus:cryptohome_proto", - "//chromeos/dbus:test_support", ] deps = [ "//chromeos/attestation:test_support", "//chromeos/cryptohome:test_support", + "//chromeos/dbus:test_support", "//chromeos/disks:test_support", "//chromeos/login/auth:test_support", "//chromeos/login/login_state:test_support", @@ -258,7 +252,6 @@ "//base/test:test_support", "//chromeos/attestation:unit_tests", "//chromeos/audio:unit_tests", - "//chromeos/cryptohome", "//chromeos/cryptohome:unit_tests", "//chromeos/dbus:authpolicy_proto", "//chromeos/dbus:cryptohome_proto",
diff --git a/chromeos/account_manager/account_manager.cc b/chromeos/account_manager/account_manager.cc index 28ba2f15..560b81a 100644 --- a/chromeos/account_manager/account_manager.cc +++ b/chromeos/account_manager/account_manager.cc
@@ -19,6 +19,7 @@ #include "google_apis/gaia/gaia_auth_consumer.h" #include "google_apis/gaia/gaia_auth_fetcher.h" #include "google_apis/gaia/oauth2_access_token_fetcher_impl.h" +#include "google_apis/gaia/oauth2_token_service_delegate.h" #include "services/network/public/cpp/shared_url_loader_factory.h" #include "third_party/protobuf/src/google/protobuf/message_lite.h" @@ -97,7 +98,8 @@ const char AccountManager::kActiveDirectoryDummyToken[] = "dummy_ad_token"; // static -const char AccountManager::kInvalidToken[] = ""; +const char* const AccountManager::kInvalidToken = + OAuth2TokenServiceDelegate::kInvalidRefreshToken; class AccountManager::GaiaTokenRevocationRequest : public GaiaAuthConsumer { public: @@ -382,8 +384,7 @@ auto it = tokens_.find(account_key); return it != tokens_.end() && !it->second.empty() && - it->second != kActiveDirectoryDummyToken && - it->second != kInvalidToken; + it->second != kActiveDirectoryDummyToken; } void AccountManager::MaybeRevokeTokenOnServer(const AccountKey& account_key) { @@ -394,13 +395,9 @@ const std::string& token = it->second; - // Stored tokens can be empty for accounts recently migrated to - // AccountManager, for which we do not have LSTs yet. These accounts require - // re-authentication from the user, but are in a valid state (and hence don't - // do a DCHECK here for |!token.empty()|). - if (account_key.account_type == - account_manager::AccountType::ACCOUNT_TYPE_GAIA && - !token.empty()) { + if ((account_key.account_type == + account_manager::AccountType::ACCOUNT_TYPE_GAIA) && + !token.empty() && (token != kInvalidToken)) { RevokeGaiaTokenOnServer(token); } }
diff --git a/chromeos/account_manager/account_manager.h b/chromeos/account_manager/account_manager.h index 31ec902..1f49049 100644 --- a/chromeos/account_manager/account_manager.h +++ b/chromeos/account_manager/account_manager.h
@@ -47,15 +47,17 @@ // See |AccountManager::UpsertToken|. static const char kActiveDirectoryDummyToken[]; - // A special token that marks an account in Account Manager as invalid, but - // does not remove the account. This is useful in scenarios where account - // names are imported from elsewhere (Chrome content area or ARC++) and their - // tokens are not yet known, but at the same time, these accounts need to be - // surfaced on the UI. + // A special token that is guaranteed to cheaply fail all network requests + // performed using it. + // Note that it neither marks an account in Account Manager as invalid, nor + // removes the account. This is useful in scenarios where account names are + // imported from elsewhere (Chrome content area or ARC++) and their tokens are + // not yet known, but at the same time, these accounts need to be surfaced on + // the UI. // Do not use this token for Active Directory accounts, // |kActiveDirectoryDummyToken| is meant for that. // See |AccountManager::UpsertToken|. - static const char kInvalidToken[]; + static const char* const kInvalidToken; struct AccountKey { // |id| is obfuscated GAIA id for |AccountType::ACCOUNT_TYPE_GAIA|.
diff --git a/chromeos/account_manager/account_manager_unittest.cc b/chromeos/account_manager/account_manager_unittest.cc index cc29666..79d45b7 100644 --- a/chromeos/account_manager/account_manager_unittest.cc +++ b/chromeos/account_manager/account_manager_unittest.cc
@@ -331,12 +331,12 @@ EXPECT_TRUE(base::ContainsValue(accounts, kActiveDirectoryAccountKey_)); } -TEST_F(AccountManagerTest, IsTokenAvailableReturnsFalseForInvalidTokens) { +TEST_F(AccountManagerTest, IsTokenAvailableReturnsTrueForInvalidTokens) { EXPECT_FALSE(account_manager_->IsTokenAvailable(kGaiaAccountKey_)); account_manager_->UpsertToken(kGaiaAccountKey_, AccountManager::kInvalidToken); scoped_task_environment_.RunUntilIdle(); - EXPECT_FALSE(account_manager_->IsTokenAvailable(kGaiaAccountKey_)); + EXPECT_TRUE(account_manager_->IsTokenAvailable(kGaiaAccountKey_)); std::vector<AccountManager::AccountKey> accounts = GetAccountsBlocking(); EXPECT_TRUE(base::ContainsValue(accounts, kGaiaAccountKey_)); }
diff --git a/chromeos/cryptohome/BUILD.gn b/chromeos/cryptohome/BUILD.gn index 22a33b5..abaed15 100644 --- a/chromeos/cryptohome/BUILD.gn +++ b/chromeos/cryptohome/BUILD.gn
@@ -2,17 +2,15 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/chromeos/rules.gni") import("//testing/test.gni") import("//third_party/protobuf/proto_library.gni") assert(is_chromeos, "Non-Chrome-OS builds must not depend on //chromeos") -source_set("cryptohome") { - configs += [ "//chromeos:chromeos_implementation" ] +component("cryptohome") { + defines = [ "IS_CHROMEOS_CRYPTOHOME_IMPL" ] deps = [ "//base", - "//chromeos:chromeos_export", "//chromeos/dbus", "//chromeos/dbus:cryptohome_proto", "//chromeos/login/auth:challenge_response_key",
diff --git a/chromeos/cryptohome/DEPS b/chromeos/cryptohome/DEPS new file mode 100644 index 0000000..9063f836 --- /dev/null +++ b/chromeos/cryptohome/DEPS
@@ -0,0 +1,17 @@ +noparent = True + +include_rules = [ + "+base", + "+chromeos/dbus", + "+chromeos/login/auth", + "+components/account_id", + "+components/device_event_log", + "+components/user_manager", + "+third_party/cros_system_api", +] + +specific_include_rules = { + ".*test\.cc|mock.*\.*": [ + "+testing", + ], +}
diff --git a/chromeos/cryptohome/async_method_caller.h b/chromeos/cryptohome/async_method_caller.h index 9f36046..c925fdd 100644 --- a/chromeos/cryptohome/async_method_caller.h +++ b/chromeos/cryptohome/async_method_caller.h
@@ -8,7 +8,7 @@ #include <string> #include "base/callback_forward.h" -#include "chromeos/chromeos_export.h" +#include "base/component_export.h" #include "chromeos/dbus/attestation_constants.h" #include "chromeos/dbus/cryptohome_client.h" #include "third_party/cros_system_api/dbus/service_constants.h" @@ -23,7 +23,7 @@ // within the same code is confusing. // This class manages calls to Cryptohome service's 'async' methods. -class CHROMEOS_EXPORT AsyncMethodCaller { +class COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) AsyncMethodCaller { public: // A callback type which is called back on the UI thread when the results of // method calls are ready.
diff --git a/chromeos/cryptohome/cryptohome_parameters.h b/chromeos/cryptohome/cryptohome_parameters.h index 90a248a1..04dbf38 100644 --- a/chromeos/cryptohome/cryptohome_parameters.h +++ b/chromeos/cryptohome/cryptohome_parameters.h
@@ -11,7 +11,7 @@ #include <string> #include <vector> -#include "chromeos/chromeos_export.h" +#include "base/component_export.h" #include "chromeos/dbus/cryptohome/rpc.pb.h" #include "chromeos/login/auth/challenge_response_key.h" @@ -29,7 +29,7 @@ }; // Identification of the user calling cryptohome method. -class CHROMEOS_EXPORT Identification { +class COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) Identification { public: Identification(); @@ -54,17 +54,18 @@ }; // Creates AccountIdentifier from AccountId. -CHROMEOS_EXPORT AccountIdentifier -CreateAccountIdentifierFromAccountId(const AccountId& id); +COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) +AccountIdentifier CreateAccountIdentifierFromAccountId(const AccountId& id); // Creates AccountIdentifier from Identification. -CHROMEOS_EXPORT AccountIdentifier -CreateAccountIdentifierFromIdentification(const Identification& id); +COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) +AccountIdentifier CreateAccountIdentifierFromIdentification( + const Identification& id); // Definition of the key (e.g. password) for the cryptohome. // It contains authorization data along with extra parameters like permissions // associated with this key. -struct CHROMEOS_EXPORT KeyDefinition { +struct COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) KeyDefinition { enum Type { // Password-based key. The password's text or its hashed/transformed // representation is stored in |secret|. The |challenge_response_keys| field @@ -173,7 +174,7 @@ }; // Authorization attempt data for user. -struct CHROMEOS_EXPORT Authorization { +struct COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) Authorization { Authorization(const std::string& key, const std::string& label); explicit Authorization(const KeyDefinition& key); @@ -185,10 +186,12 @@ // This function returns true if cryptohome of |account_id| is migrated to // accountId-based identifier (AccountId::GetAccountIdKey()). +COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) bool GetGaiaIdMigrationStatus(const AccountId& account_id); // This function marks |account_id| cryptohome migrated to accountId-based // identifier (AccountId::GetAccountIdKey()). +COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) void SetGaiaIdMigrationStatusDone(const AccountId& account_id); } // namespace cryptohome
diff --git a/chromeos/cryptohome/cryptohome_util.h b/chromeos/cryptohome/cryptohome_util.h index 3b17518..2cca060 100644 --- a/chromeos/cryptohome/cryptohome_util.h +++ b/chromeos/cryptohome/cryptohome_util.h
@@ -7,8 +7,8 @@ #include <string> +#include "base/component_export.h" #include "base/optional.h" -#include "chromeos/chromeos_export.h" #include "chromeos/cryptohome/cryptohome_parameters.h" #include "chromeos/dbus/cryptohome/key.pb.h" #include "chromeos/dbus/cryptohome/rpc.pb.h" @@ -18,25 +18,26 @@ // Returns a MountError code from the MountEx |reply| returning // MOUNT_ERROR_NONE if the reply is well-formed and there is no error. -CHROMEOS_EXPORT MountError -MountExReplyToMountError(const base::Optional<BaseReply>& reply); +COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) +MountError MountExReplyToMountError(const base::Optional<BaseReply>& reply); // Returns a MountError code from |reply|, returning MOUNT_ERROR_NONE // if the reply is well-formed and there is no error. -CHROMEOS_EXPORT MountError -BaseReplyToMountError(const base::Optional<BaseReply>& reply); +COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) +MountError BaseReplyToMountError(const base::Optional<BaseReply>& reply); // Returns a MountError code from the GetKeyDataEx |reply| returning // MOUNT_ERROR_NONE if the reply is well-formed and there is no error. -CHROMEOS_EXPORT MountError -GetKeyDataReplyToMountError(const base::Optional<BaseReply>& reply); +COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) +MountError GetKeyDataReplyToMountError(const base::Optional<BaseReply>& reply); -CHROMEOS_EXPORT std::vector<KeyDefinition> GetKeyDataReplyToKeyDefinitions( +COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) +std::vector<KeyDefinition> GetKeyDataReplyToKeyDefinitions( const base::Optional<BaseReply>& reply); // Extracts the account's disk usage size from |reply|. // If |reply| is malformed, returns -1. -CHROMEOS_EXPORT +COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) int64_t AccountDiskUsageReplyToUsageSize( const base::Optional<BaseReply>& reply); @@ -44,23 +45,25 @@ // This method assumes |reply| is well-formed. To check if a reply // is well-formed, callers can check if BaseReplyToMountError returns // MOUNT_ERROR_NONE. -CHROMEOS_EXPORT const std::string& MountExReplyToMountHash( - const BaseReply& reply); +COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) +const std::string& MountExReplyToMountHash(const BaseReply& reply); // Creates an AuthorizationRequest from the given secret and label. -CHROMEOS_EXPORT AuthorizationRequest -CreateAuthorizationRequest(const std::string& label, const std::string& secret); +COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) +AuthorizationRequest CreateAuthorizationRequest(const std::string& label, + const std::string& secret); // Converts the given KeyDefinition to a Key. -CHROMEOS_EXPORT void KeyDefinitionToKey(const KeyDefinition& key_def, Key* key); +COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) +void KeyDefinitionToKey(const KeyDefinition& key_def, Key* key); // Converts CryptohomeErrorCode to MountError. -CHROMEOS_EXPORT MountError -CryptohomeErrorToMountError(CryptohomeErrorCode code); +COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) +MountError CryptohomeErrorToMountError(CryptohomeErrorCode code); // Converts the given KeyAuthorizationData to AuthorizationData pointed to by // |authorization_data|. -CHROMEOS_EXPORT +COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) void KeyAuthorizationDataToAuthorizationData( const KeyAuthorizationData& authorization_data_proto, KeyDefinition::AuthorizationData* authorization_data);
diff --git a/chromeos/cryptohome/homedir_methods.h b/chromeos/cryptohome/homedir_methods.h index 80c0efb..9aff45f 100644 --- a/chromeos/cryptohome/homedir_methods.h +++ b/chromeos/cryptohome/homedir_methods.h
@@ -11,7 +11,7 @@ #include <vector> #include "base/callback_forward.h" -#include "chromeos/chromeos_export.h" +#include "base/component_export.h" #include "chromeos/cryptohome/cryptohome_parameters.h" #include "chromeos/dbus/cryptohome/key.pb.h" #include "chromeos/dbus/cryptohome/rpc.pb.h" @@ -22,7 +22,7 @@ // This class manages calls to Cryptohome service's home directory methods: // Mount, CheckKey, Add/UpdateKey. -class CHROMEOS_EXPORT HomedirMethods { +class COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) HomedirMethods { public: // Callbacks that are called back on the UI thread when the results of the // respective method calls are ready.
diff --git a/chromeos/cryptohome/mock_homedir_methods.h b/chromeos/cryptohome/mock_homedir_methods.h index ebb062af..7a217d8 100644 --- a/chromeos/cryptohome/mock_homedir_methods.h +++ b/chromeos/cryptohome/mock_homedir_methods.h
@@ -8,6 +8,7 @@ #include <string> #include "base/callback.h" +#include "base/component_export.h" #include "base/macros.h" #include "chromeos/cryptohome/homedir_methods.h" #include "chromeos/dbus/cryptohome/rpc.pb.h" @@ -15,7 +16,8 @@ namespace cryptohome { -class CHROMEOS_EXPORT MockHomedirMethods : public HomedirMethods { +class COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) MockHomedirMethods + : public HomedirMethods { public: MockHomedirMethods(); ~MockHomedirMethods() override;
diff --git a/chromeos/cryptohome/system_salt_getter.h b/chromeos/cryptohome/system_salt_getter.h index 57cb91b7..f6dadc9d 100644 --- a/chromeos/cryptohome/system_salt_getter.h +++ b/chromeos/cryptohome/system_salt_getter.h
@@ -11,15 +11,15 @@ #include <vector> #include "base/callback_forward.h" +#include "base/component_export.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/optional.h" -#include "chromeos/chromeos_export.h" namespace chromeos { // This class is used to get the system salt from cryptohome and cache it. -class CHROMEOS_EXPORT SystemSaltGetter { +class COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) SystemSaltGetter { public: typedef base::Callback<void(const std::string& system_salt)> GetSystemSaltCallback;
diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc index 1a55f5a2d..89f8f88 100644 --- a/chromeos/dbus/dbus_thread_manager.cc +++ b/chromeos/dbus/dbus_thread_manager.cc
@@ -38,6 +38,7 @@ #include "chromeos/dbus/modem_messaging_client.h" #include "chromeos/dbus/permission_broker_client.h" #include "chromeos/dbus/power_manager_client.h" +#include "chromeos/dbus/runtime_probe_client.h" #include "chromeos/dbus/seneschal_client.h" #include "chromeos/dbus/session_manager_client.h" #include "chromeos/dbus/shill_device_client.h" @@ -264,6 +265,11 @@ return clients_common_->session_manager_client_.get(); } +RuntimeProbeClient* DBusThreadManager::GetRuntimeProbeClient() { + return clients_browser_ ? clients_browser_->runtime_probe_client_.get() + : nullptr; +} + SeneschalClient* DBusThreadManager::GetSeneschalClient() { return clients_browser_ ? clients_browser_->seneschal_client_.get() : nullptr; } @@ -429,6 +435,12 @@ std::move(client); } +void DBusThreadManagerSetter::SetRuntimeProbeClient( + std::unique_ptr<RuntimeProbeClient> client) { + DBusThreadManager::Get()->clients_browser_->runtime_probe_client_ = + std::move(client); +} + void DBusThreadManagerSetter::SetSeneschalClient( std::unique_ptr<SeneschalClient> client) { DBusThreadManager::Get()->clients_browser_->seneschal_client_ =
diff --git a/chromeos/dbus/dbus_thread_manager.h b/chromeos/dbus/dbus_thread_manager.h index a5b9df3..9eccaff9 100644 --- a/chromeos/dbus/dbus_thread_manager.h +++ b/chromeos/dbus/dbus_thread_manager.h
@@ -53,6 +53,7 @@ class OobeConfigurationClient; class PermissionBrokerClient; class PowerManagerClient; +class RuntimeProbeClient; class SeneschalClient; class SessionManagerClient; class ShillDeviceClient; @@ -161,6 +162,7 @@ OobeConfigurationClient* GetOobeConfigurationClient(); PermissionBrokerClient* GetPermissionBrokerClient(); PowerManagerClient* GetPowerManagerClient(); + RuntimeProbeClient* GetRuntimeProbeClient(); SeneschalClient* GetSeneschalClient(); SessionManagerClient* GetSessionManagerClient(); ShillDeviceClient* GetShillDeviceClient(); @@ -224,6 +226,7 @@ std::unique_ptr<PermissionBrokerClient> client); void SetPowerManagerClient(std::unique_ptr<PowerManagerClient> client); void SetSeneschalClient(std::unique_ptr<SeneschalClient> client); + void SetRuntimeProbeClient(std::unique_ptr<RuntimeProbeClient> client); void SetSessionManagerClient(std::unique_ptr<SessionManagerClient> client); void SetShillDeviceClient(std::unique_ptr<ShillDeviceClient> client); void SetShillIPConfigClient(std::unique_ptr<ShillIPConfigClient> client);
diff --git a/chromeos/dbus/fake_runtime_probe_client.cc b/chromeos/dbus/fake_runtime_probe_client.cc index b356154c..c6270c84c 100644 --- a/chromeos/dbus/fake_runtime_probe_client.cc +++ b/chromeos/dbus/fake_runtime_probe_client.cc
@@ -11,6 +11,10 @@ namespace chromeos { +namespace { +constexpr int kLiveValuesLimit = 42; +} + FakeRuntimeProbeClient::FakeRuntimeProbeClient() : weak_ptr_factory_(this) {} FakeRuntimeProbeClient::~FakeRuntimeProbeClient() = default; @@ -19,6 +23,47 @@ const runtime_probe::ProbeRequest& request, RuntimeProbeCallback callback) { runtime_probe::ProbeResult result; + + for (const auto& category : request.categories()) { + if (category == runtime_probe::ProbeRequest::battery) { + runtime_probe::Battery* battery = result.add_battery(); + battery->set_name("generic"); + auto* battery_fields = battery->mutable_values(); + battery_fields->set_manufacturer("111-22-"); + battery_fields->set_model_name("AA12345"); + battery_fields->set_serial_number("0123"); + // Charge in 1e-6 Ah + battery_fields->set_charge_full_design(5 * 1000 * 1000); + battery_fields->set_charge_full(4 * 1000 * 1000); + battery_fields->set_charge_now(4 * 1000 * 1000 - 10000 * live_offset_); + // Voltage in 1e-6 V + battery_fields->set_voltage_now(10 * 1000 * 1000 - 5000 * live_offset_); + battery_fields->set_cycle_count_smart(1); + battery_fields->set_status_smart(224); + // Temperature in 0.1 deg K + battery_fields->set_temperature_smart(3030 + live_offset_); + continue; + } + + if (category == runtime_probe::ProbeRequest::storage) { + runtime_probe::Storage* storage = result.add_storage(); + storage->set_name("generic"); + auto* storage_fields = storage->mutable_values(); + storage_fields->set_sectors(123456789); + storage_fields->set_type("MMC"); + // Manufacturer ID + storage_fields->set_manfid(123); + storage_fields->set_name("aB1cD>"); + // Product revision + storage_fields->set_prv(1); + storage_fields->set_serial(12345678); + storage_fields->set_oemid(123); + } + } + + // Change offset, but keep it in reasonably small range. + live_offset_ = (live_offset_ + 1) % kLiveValuesLimit; + base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), result)); }
diff --git a/chromeos/dbus/fake_runtime_probe_client.h b/chromeos/dbus/fake_runtime_probe_client.h index 5083069..24aa40d2 100644 --- a/chromeos/dbus/fake_runtime_probe_client.h +++ b/chromeos/dbus/fake_runtime_probe_client.h
@@ -28,6 +28,11 @@ void Init(dbus::Bus* bus) override {} private: + // Used to simulates changes in live values. This field will be iterated + // in small range and live values will be adjusted proportional to this + // value. + int live_offset_ = 0; + // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. base::WeakPtrFactory<FakeRuntimeProbeClient> weak_ptr_factory_;
diff --git a/chromeos/login/auth/BUILD.gn b/chromeos/login/auth/BUILD.gn index 4e68b2b..9609ef14 100644 --- a/chromeos/login/auth/BUILD.gn +++ b/chromeos/login/auth/BUILD.gn
@@ -2,13 +2,12 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/chromeos/rules.gni") import("//testing/test.gni") import("//third_party/protobuf/proto_library.gni") assert(is_chromeos, "Non-Chrome-OS builds must not depend on //chromeos") -source_set("auth") { +component("auth") { defines = [ "IS_CHROMEOS_LOGIN_AUTH_IMPL" ] public_deps = [ ":challenge_response_key",
diff --git a/chromeos/login/login_state/BUILD.gn b/chromeos/login/login_state/BUILD.gn index 45623449..45d0563 100644 --- a/chromeos/login/login_state/BUILD.gn +++ b/chromeos/login/login_state/BUILD.gn
@@ -2,11 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/chromeos/rules.gni") - assert(is_chromeos, "Non-Chrome-OS builds must not depend on //chromeos") -source_set("login_state") { +component("login_state") { defines = [ "IS_LOGIN_STATE_IMPL" ] deps = [ "//base",
diff --git a/chromeos/settings/cros_settings_names.cc b/chromeos/settings/cros_settings_names.cc index e382aaa..0b9afb6 100644 --- a/chromeos/settings/cros_settings_names.cc +++ b/chromeos/settings/cros_settings_names.cc
@@ -94,6 +94,11 @@ const char kReportDeviceActivityTimes[] = "cros.device_status.report_activity_times"; +// A boolean pref that determines whether the board status should be +// included in status reports to the device management server. +const char kReportDeviceBoardStatus[] = + "cros.device_status.report_board_status"; + // A boolean pref that indicates whether the state of the dev mode switch at // boot should be reported along with device policy requests. const char kReportDeviceBootMode[] = "cros.device_status.report_boot_mode"; @@ -107,6 +112,16 @@ const char kReportDeviceNetworkInterfaces[] = "cros.device_status.report_network_interfaces"; +// A boolean pref that determines whether the device power status should be +// included in status reports to the device management server. +const char kReportDevicePowerStatus[] = + "cros.device_status.report_power_status"; + +// A boolean pref that determines whether the storage status should be +// included in status reports to the device management server. +const char kReportDeviceStorageStatus[] = + "cros.device_status.report_storage_status"; + // Determines whether the device reports recently logged in users in device // status reports to the device management server. const char kReportDeviceUsers[] = "cros.device_status.report_users";
diff --git a/chromeos/settings/cros_settings_names.h b/chromeos/settings/cros_settings_names.h index 60c48376..8d37fc16 100644 --- a/chromeos/settings/cros_settings_names.h +++ b/chromeos/settings/cros_settings_names.h
@@ -61,9 +61,12 @@ CHROMEOS_EXPORT extern const char kReportDeviceVersionInfo[]; CHROMEOS_EXPORT extern const char kReportDeviceActivityTimes[]; +CHROMEOS_EXPORT extern const char kReportDeviceBoardStatus[]; CHROMEOS_EXPORT extern const char kReportDeviceBootMode[]; CHROMEOS_EXPORT extern const char kReportDeviceLocation[]; CHROMEOS_EXPORT extern const char kReportDeviceNetworkInterfaces[]; +CHROMEOS_EXPORT extern const char kReportDevicePowerStatus[]; +CHROMEOS_EXPORT extern const char kReportDeviceStorageStatus[]; CHROMEOS_EXPORT extern const char kReportDeviceUsers[]; CHROMEOS_EXPORT extern const char kReportDeviceHardwareStatus[]; CHROMEOS_EXPORT extern const char kReportDeviceSessionStatus[];
diff --git a/chromeos/tpm/BUILD.gn b/chromeos/tpm/BUILD.gn index 09266e31..a4262c9 100644 --- a/chromeos/tpm/BUILD.gn +++ b/chromeos/tpm/BUILD.gn
@@ -38,7 +38,7 @@ ":tpm", "//base/test:test_support", "//chromeos:chromeos_constants", - "//chromeos/cryptohome", + "//chromeos/cryptohome:test_support", "//chromeos/dbus", "//chromeos/dbus:cryptohome_proto", "//components/policy/proto",
diff --git a/components/arc/BUILD.gn b/components/arc/BUILD.gn index adf1652e..91adbfb 100644 --- a/components/arc/BUILD.gn +++ b/components/arc/BUILD.gn
@@ -81,7 +81,6 @@ "//base", "//chromeos", "//chromeos/audio", - "//chromeos/cryptohome", "//chromeos/dbus:login_manager_proto", "//chromeos/dbus:power_manager_proto", "//chromeos/disks", @@ -325,7 +324,7 @@ "//base/test:test_support", "//chromeos", "//chromeos:test_support_without_gmock", - "//chromeos/cryptohome", + "//chromeos/cryptohome:test_support", "//chromeos/dbus:power_manager_proto", "//chromeos/disks:test_support", "//components/account_id",
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc index ac26428..9fe0404 100644 --- a/components/autofill/content/renderer/password_autofill_agent.cc +++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -1223,6 +1223,7 @@ form_util::GetCanonicalOriginForDocument(frame->GetDocument()); password_forms.back().signon_realm = GetSignOnRealm(password_forms.back().origin); + password_forms.back().form_data.origin = password_forms.back().origin; LogSendPasswordForm( SendPasswordFormToBrowserProcess::kPasswordFormSentByNoFormTag); } @@ -1419,6 +1420,14 @@ StoreDataForFillOnAccountSelect(form_data, username_element, password_element); + + // If wait_for_username is true, we don't want to initially fill the form + // until the user types in a valid username. + if (form_data.wait_for_username) { + LogFirstFillingResult(FillingResult::kWaitForUsername); + return; + } + FillFormOnPasswordReceived(form_data, username_element, password_element, &field_data_manager_, logger.get()); }
diff --git a/components/autofill/core/browser/credit_card_save_manager.cc b/components/autofill/core/browser/credit_card_save_manager.cc index ce273610..78c4f2b 100644 --- a/components/autofill/core/browser/credit_card_save_manager.cc +++ b/components/autofill/core/browser/credit_card_save_manager.cc
@@ -86,7 +86,13 @@ weak_ptr_factory_(this) { // This is to initialize StrikeDatabase is if it hasn't been already, so that // its cache would be loaded and ready to use when the first CCSM is created. - client_->GetStrikeDatabase(); + if (base::FeatureList::IsEnabled( + features::kAutofillSaveCreditCardUsesStrikeSystemV2)) { + // Only init when |kAutofillSaveCreditCardUsesStrikeSystemV2| is enabled. If + // flag is off and LegacyStrikeDatabase instead of StrikeDatabase is used, + // this init will cause failure on GetStrikes(). + client_->GetStrikeDatabase(); + } } CreditCardSaveManager::~CreditCardSaveManager() {}
diff --git a/components/infobars/core/infobar_delegate.h b/components/infobars/core/infobar_delegate.h index 51f3fb6..5a0576c8 100644 --- a/components/infobars/core/infobar_delegate.h +++ b/components/infobars/core/infobar_delegate.h
@@ -156,6 +156,7 @@ SUPERVISED_USERS_DEPRECATED_INFOBAR_DELEGATE = 85, NEAR_OOM_REDUCTION_INFOBAR_ANDROID = 86, LITE_PAGE_PREVIEWS_INFOBAR = 87, + MODULE_INSTALL_FAILURE_INFOBAR_ANDROID = 88, }; // Describes navigation events, used to decide whether infobars should be
diff --git a/components/omnibox/browser/clipboard_url_provider.cc b/components/omnibox/browser/clipboard_url_provider.cc index 7fb0965..032f10a 100644 --- a/components/omnibox/browser/clipboard_url_provider.cc +++ b/components/omnibox/browser/clipboard_url_provider.cc
@@ -131,7 +131,8 @@ base::Optional<AutocompleteMatch> ClipboardURLProvider::CreateTextMatch( const AutocompleteInput& input) { // Only try text match if feature is enabled - if (!base::FeatureList::IsEnabled(omnibox::kCopiedTextBehavior)) { + if (!base::FeatureList::IsEnabled( + omnibox::kEnableClipboardProviderTextSuggestions)) { return base::nullopt; } @@ -171,7 +172,8 @@ base::Optional<AutocompleteMatch> ClipboardURLProvider::CreateImageMatch( const AutocompleteInput& input) { // Only try image match if feature is enabled - if (!base::FeatureList::IsEnabled(omnibox::kCopiedTextBehavior)) { + if (!base::FeatureList::IsEnabled( + omnibox::kEnableClipboardProviderImageSuggestions)) { return base::nullopt; }
diff --git a/components/omnibox/browser/clipboard_url_provider_unittest.cc b/components/omnibox/browser/clipboard_url_provider_unittest.cc index ca40830..49f1cc8 100644 --- a/components/omnibox/browser/clipboard_url_provider_unittest.cc +++ b/components/omnibox/browser/clipboard_url_provider_unittest.cc
@@ -90,7 +90,8 @@ TEST_F(ClipboardURLProviderTest, MatchesText) { base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature(omnibox::kCopiedTextBehavior); + base::Feature textFeature = omnibox::kEnableClipboardProviderTextSuggestions; + feature_list.InitAndEnableFeature(textFeature); auto template_url_service = std::make_unique<TemplateURLService>( /*initializers=*/nullptr, /*count=*/0); client_->set_template_url_service(std::move(template_url_service));
diff --git a/components/omnibox/browser/omnibox_field_trial.cc b/components/omnibox/browser/omnibox_field_trial.cc index e303062..df635541 100644 --- a/components/omnibox/browser/omnibox_field_trial.cc +++ b/components/omnibox/browser/omnibox_field_trial.cc
@@ -158,6 +158,16 @@ #endif }; +// Feature to enable clipboard provider to suggest copied text. +const base::Feature kEnableClipboardProviderTextSuggestions{ + "OmniboxEnableClipboardProviderTextSuggestions", + base::FEATURE_DISABLED_BY_DEFAULT}; + +// Feature to enable clipboard provider to suggest searching for copied images. +const base::Feature kEnableClipboardProviderImageSuggestions{ + "OmniboxEnableClipboardProviderImageSuggestions", + base::FEATURE_DISABLED_BY_DEFAULT}; + // Feature to enable the search provider to send a request to the suggest // server on focus. This allows the suggest server to warm up, by, for // example, loading per-user models into memory. Having a per-user model @@ -224,10 +234,6 @@ const base::Feature kOmniboxPopupShortcutIconsInZeroState{ "OmniboxPopupShortcutIconsInZeroState", base::FEATURE_DISABLED_BY_DEFAULT}; -// Feature to differentiate between a copied url and copied text -const base::Feature kCopiedTextBehavior{"CopiedTextBehavior", - base::FEATURE_DISABLED_BY_DEFAULT}; - } // namespace omnibox namespace {
diff --git a/components/omnibox/browser/omnibox_field_trial.h b/components/omnibox/browser/omnibox_field_trial.h index 4b762b9..49a4541 100644 --- a/components/omnibox/browser/omnibox_field_trial.h +++ b/components/omnibox/browser/omnibox_field_trial.h
@@ -39,6 +39,8 @@ extern const base::Feature kExperimentalKeywordMode; extern const base::Feature kOmniboxPedalSuggestions; extern const base::Feature kEnableClipboardProvider; +extern const base::Feature kEnableClipboardProviderTextSuggestions; +extern const base::Feature kEnableClipboardProviderImageSuggestions; extern const base::Feature kSearchProviderWarmUpOnFocus; extern const base::Feature kZeroSuggestRedirectToChrome; extern const base::Feature kDisplayTitleForCurrentUrl; @@ -49,7 +51,6 @@ extern const base::Feature kSpeculativeServiceWorkerStartOnQueryInput; extern const base::Feature kDocumentProvider; extern const base::Feature kOmniboxPopupShortcutIconsInZeroState; -extern const base::Feature kCopiedTextBehavior; } // namespace omnibox
diff --git a/components/page_info_strings.grdp b/components/page_info_strings.grdp index f39ea498..584fbf8e 100644 --- a/components/page_info_strings.grdp +++ b/components/page_info_strings.grdp
@@ -433,4 +433,12 @@ <message name="IDS_PAGE_INFO_BILLING_DETAILS" desc="A one-line summary at the top of the Page Info bubble (which shows when you click the security indicator) if the website has been flagged for a billing interstitial."> These charges could be one-time or recurring and may not be obvious. </message> + + <!-- Misc site settings --> + <message name="IDS_PAGE_INFO_VR_PRESENTING_TEXT" desc="The string used in the page info that states that an active VR presentation is in progress."> + VR session is active + </message> + <message name="IDS_PAGE_INFO_VR_TURN_OFF_BUTTON_TEXT" desc="Label on the button that's used to turn off the VR presentation."> + End session + </message> </grit-part>
diff --git a/components/password_manager/content/browser/bad_message.cc b/components/password_manager/content/browser/bad_message.cc index 8f7ad688..b59280fa 100644 --- a/components/password_manager/content/browser/bad_message.cc +++ b/components/password_manager/content/browser/bad_message.cc
@@ -64,7 +64,9 @@ return CheckChildProcessSecurityPolicyForURL(frame, password_form.origin, reason) && CheckChildProcessSecurityPolicyForURL( - frame, GURL(password_form.signon_realm), reason); + frame, GURL(password_form.signon_realm), reason) && + CheckChildProcessSecurityPolicyForURL( + frame, password_form.form_data.origin, reason); } bool CheckChildProcessSecurityPolicy(
diff --git a/components/password_manager/core/browser/BUILD.gn b/components/password_manager/core/browser/BUILD.gn index 194cf70..b1ffce2d 100644 --- a/components/password_manager/core/browser/BUILD.gn +++ b/components/password_manager/core/browser/BUILD.gn
@@ -446,6 +446,7 @@ "statistics_table_unittest.cc", "store_metrics_reporter_unittest.cc", "suppressed_form_fetcher_unittest.cc", + "sync/password_sync_bridge_unittest.cc", "sync/password_syncable_service_unittest.cc", "sync_credentials_filter_unittest.cc", "sync_username_test_base.cc",
diff --git a/components/password_manager/core/browser/new_password_form_manager.cc b/components/password_manager/core/browser/new_password_form_manager.cc index 93374b6..3409f7e 100644 --- a/components/password_manager/core/browser/new_password_form_manager.cc +++ b/components/password_manager/core/browser/new_password_form_manager.cc
@@ -486,6 +486,7 @@ result->password_overridden_ = password_overridden_; result->retry_password_form_password_update_ = retry_password_form_password_update_; + result->is_submitted_ = is_submitted_; return result; }
diff --git a/components/password_manager/core/browser/new_password_form_manager_unittest.cc b/components/password_manager/core/browser/new_password_form_manager_unittest.cc index 8689e180..b272716 100644 --- a/components/password_manager/core/browser/new_password_form_manager_unittest.cc +++ b/components/password_manager/core/browser/new_password_form_manager_unittest.cc
@@ -1151,6 +1151,7 @@ ASSERT_TRUE(cloned_manager->GetSubmittedForm()); EXPECT_EQ(*form_manager_->GetSubmittedForm(), *cloned_manager->GetSubmittedForm()); + EXPECT_TRUE(cloned_manager->is_submitted()); } // Extracts the information whether parsing was successful from a metric
diff --git a/components/password_manager/core/browser/password_form_filling.cc b/components/password_manager/core/browser/password_form_filling.cc index 4a37556..834ae64 100644 --- a/components/password_manager/core/browser/password_form_filling.cc +++ b/components/password_manager/core/browser/password_form_filling.cc
@@ -144,7 +144,7 @@ new_parsing_enabled || !observed_form.IsPossibleChangePasswordForm(); // Wait for the username before filling passwords in case the - // fill-on-account-select-http feature is active and the main frame is + // FillOnAccountSelectHttp feature is active and the main frame is // insecure. const bool enable_foas_on_http = base::FeatureList::IsEnabled(features::kFillOnAccountSelectHttp) &&
diff --git a/components/password_manager/core/browser/sync/password_sync_bridge.cc b/components/password_manager/core/browser/sync/password_sync_bridge.cc index e503c00..f05fd19 100644 --- a/components/password_manager/core/browser/sync/password_sync_bridge.cc +++ b/components/password_manager/core/browser/sync/password_sync_bridge.cc
@@ -7,6 +7,8 @@ #include "base/logging.h" #include "components/sync/model/metadata_change_list.h" #include "components/sync/model/model_type_change_processor.h" +#include "net/base/escape.h" +#include "url/gurl.h" namespace password_manager { @@ -52,13 +54,22 @@ std::string PasswordSyncBridge::GetClientTag( const syncer::EntityData& entity_data) { - NOTIMPLEMENTED(); - return std::string(); + DCHECK(entity_data.specifics.has_password()) + << "EntityData does not have password specifics."; + + const sync_pb::PasswordSpecificsData& password_data = + entity_data.specifics.password().client_only_encrypted_data(); + + return (net::EscapePath(GURL(password_data.origin()).spec()) + "|" + + net::EscapePath(password_data.username_element()) + "|" + + net::EscapePath(password_data.username_value()) + "|" + + net::EscapePath(password_data.password_element()) + "|" + + net::EscapePath(password_data.signon_realm())); } std::string PasswordSyncBridge::GetStorageKey( const syncer::EntityData& entity_data) { - NOTREACHED() << "PasswordSyncBridge do not support GetStorageKey."; + NOTREACHED() << "PasswordSyncBridge does not support GetStorageKey."; return std::string(); }
diff --git a/components/password_manager/core/browser/sync/password_sync_bridge_unittest.cc b/components/password_manager/core/browser/sync/password_sync_bridge_unittest.cc new file mode 100644 index 0000000..0bd537e --- /dev/null +++ b/components/password_manager/core/browser/sync/password_sync_bridge_unittest.cc
@@ -0,0 +1,60 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/password_manager/core/browser/sync/password_sync_bridge.h" + +#include "components/sync/model/fake_model_type_change_processor.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +using testing::Eq; + +namespace password_manager { + +namespace { + +sync_pb::PasswordSpecifics CreateSpecifics(const std::string& origin, + const std::string& username_element, + const std::string& username_value, + const std::string& password_element, + const std::string& signon_realm) { + sync_pb::EntitySpecifics password_specifics; + sync_pb::PasswordSpecificsData* password_data = + password_specifics.mutable_password() + ->mutable_client_only_encrypted_data(); + password_data->set_origin(origin); + password_data->set_username_element(username_element); + password_data->set_username_value(username_value); + password_data->set_password_element(password_element); + password_data->set_signon_realm(signon_realm); + return password_specifics.password(); +} + +} // namespace + +class PasswordSyncBridgeTest : public testing::Test { + public: + PasswordSyncBridgeTest() + : bridge_(std::make_unique<syncer::FakeModelTypeChangeProcessor>()) {} + ~PasswordSyncBridgeTest() override {} + + PasswordSyncBridge* bridge() { return &bridge_; } + + private: + PasswordSyncBridge bridge_; +}; + +TEST_F(PasswordSyncBridgeTest, ShouldComputeClientTagHash) { + syncer::EntityData data; + *data.specifics.mutable_password() = + CreateSpecifics("http://www.origin.com", "username_element", + "username_value", "password_element", "signon_realm"); + + EXPECT_THAT( + bridge()->GetClientTag(data), + Eq("http%3A//www.origin.com/" + "|username_element|username_value|password_element|signon_realm")); +} + +} // namespace password_manager
diff --git a/components/password_manager/core/common/password_manager_features.cc b/components/password_manager/core/common/password_manager_features.cc index ac49cc6..86209a5 100644 --- a/components/password_manager/core/common/password_manager_features.cc +++ b/components/password_manager/core/common/password_manager_features.cc
@@ -59,7 +59,7 @@ // Enables the experiment for the password manager to only fill on account // selection when the password form was served over HTTP. const base::Feature kFillOnAccountSelectHttp = { - "fill-on-account-select-http", base::FEATURE_DISABLED_BY_DEFAULT}; + "FillOnAccountSelectHttp", base::FEATURE_DISABLED_BY_DEFAULT}; // Integration with Google's Password Manager for signed-in and sync users. const base::Feature kGooglePasswordManager = {
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index 4385b3c..391d727 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -6365,6 +6365,66 @@ 'arc_support': 'This policy has no effect on the logging done by Android.', }, { + 'name': 'ReportDevicePowerStatus', + 'type': 'main', + 'schema': { 'type': 'boolean' }, + 'supported_on': ['chrome_os:73-'], + 'supported_chrome_os_management': ['google_cloud'], + 'device_only': True, + 'features': { + 'dynamic_refresh': True, + }, + 'example_value': False, + 'id': 512, + 'caption': '''Report power status''', + 'tags': ['admin-sharing'], + 'desc': '''Report hardware statistics and identifiers related to power. + + If the policy is set to false, the statistics will not be reported. + If set to true or left unset, statistics will be reported.''', + 'arc_support': 'This policy has no effect on the logging done by Android.', + }, + { + 'name': 'ReportDeviceStorageStatus', + 'type': 'main', + 'schema': { 'type': 'boolean' }, + 'supported_on': ['chrome_os:73-'], + 'supported_chrome_os_management': ['google_cloud'], + 'device_only': True, + 'features': { + 'dynamic_refresh': True, + }, + 'example_value': False, + 'id': 513, + 'caption': '''Report storage status''', + 'tags': ['admin-sharing'], + 'desc': '''Report hardware statistics and identifiers for storage devices. + + If the policy is set to false, the statistics will not be reported. + If set to true or left unset, statistics will be reported.''', + 'arc_support': 'This policy has no effect on the logging done by Android.', + }, + { + 'name': 'ReportDeviceBoardStatus', + 'type': 'main', + 'schema': { 'type': 'boolean' }, + 'supported_on': ['chrome_os:73-'], + 'supported_chrome_os_management': ['google_cloud'], + 'device_only': True, + 'features': { + 'dynamic_refresh': True, + }, + 'example_value': False, + 'id': 514, + 'caption': '''Report board status''', + 'tags': ['admin-sharing'], + 'desc': '''Report hardware statistics for SoC components. + + If the policy is set to false, the statistics will not be reported. + If set to true or left unset, statistics will be reported.''', + 'arc_support': 'This policy has no effect on the logging done by Android.', + }, + { 'name': 'ReportUploadFrequency', 'type': 'int', 'schema': { 'type': 'integer', 'minimum': 60000 }, @@ -14299,5 +14359,5 @@ }, 'placeholders': [], 'deleted_policy_ids': [412], - 'highest_id_currently_used': 511 + 'highest_id_currently_used': 514 }
diff --git a/components/signin/core/browser/BUILD.gn b/components/signin/core/browser/BUILD.gn index 8fd3fa5..6c9ec40 100644 --- a/components/signin/core/browser/BUILD.gn +++ b/components/signin/core/browser/BUILD.gn
@@ -115,12 +115,8 @@ "account_reconcilor_delegate.h", "avatar_icon_util.cc", "avatar_icon_util.h", - "child_account_info_fetcher.cc", - "child_account_info_fetcher.h", "child_account_info_fetcher_android.cc", "child_account_info_fetcher_android.h", - "child_account_info_fetcher_impl.cc", - "child_account_info_fetcher_impl.h", "chrome_connected_header_helper.cc", "chrome_connected_header_helper.h", "cookie_settings_util.cc", @@ -131,6 +127,8 @@ "dice_header_helper.h", "mirror_account_reconcilor_delegate.cc", "mirror_account_reconcilor_delegate.h", + "oauth2_token_service_delegate_android.cc", + "oauth2_token_service_delegate_android.h", "signin_error_controller.cc", "signin_error_controller.h", "signin_header_helper.cc", @@ -204,14 +202,6 @@ } if (is_android) { - sources -= [ - "child_account_info_fetcher_impl.cc", - "child_account_info_fetcher_impl.h", - ] - sources += [ - "oauth2_token_service_delegate_android.cc", - "oauth2_token_service_delegate_android.h", - ] deps += [ "android:jni_headers" ] } }
diff --git a/components/signin/core/browser/account_fetcher_service.cc b/components/signin/core/browser/account_fetcher_service.cc index 1c341005..23a8aa3 100644 --- a/components/signin/core/browser/account_fetcher_service.cc +++ b/components/signin/core/browser/account_fetcher_service.cc
@@ -17,11 +17,14 @@ #include "components/signin/core/browser/account_info_fetcher.h" #include "components/signin/core/browser/account_tracker_service.h" #include "components/signin/core/browser/avatar_icon_util.h" -#include "components/signin/core/browser/child_account_info_fetcher.h" #include "components/signin/core/browser/signin_client.h" #include "components/signin/core/browser/signin_switches.h" #include "services/network/public/cpp/shared_url_loader_factory.h" +#if defined(OS_ANDROID) +#include "components/signin/core/browser/child_account_info_fetcher_android.h" +#endif + namespace { const base::TimeDelta kRefreshFromTokenServiceDelay = @@ -53,8 +56,11 @@ profile_loaded_(false), refresh_tokens_loaded_(false), shutdown_called_(false), - scheduled_refresh_enabled_(true), - child_info_request_(nullptr) {} +#if defined(OS_ANDROID) + child_info_request_(nullptr), +#endif + scheduled_refresh_enabled_(true) { +} AccountFetcherService::~AccountFetcherService() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -91,9 +97,11 @@ void AccountFetcherService::Shutdown() { token_service_->RemoveObserver(this); +#if defined(OS_ANDROID) // child_info_request_ is an invalidation handler and needs to be // unregistered during the lifetime of the invalidation service. child_info_request_.reset(); +#endif invalidation_service_ = nullptr; shutdown_called_ = true; } @@ -113,7 +121,9 @@ DCHECK(!invalidation_service_); DCHECK(!profile_loaded_); DCHECK(!network_fetches_enabled_); +#if defined(OS_ANDROID) DCHECK(!child_info_request_); +#endif invalidation_service_ = invalidation_service; profile_loaded_ = true; MaybeEnableNetworkFetches(); @@ -215,12 +225,12 @@ } } +#if defined(OS_ANDROID) // Starts fetching whether this is a child account. Handles refresh internally. void AccountFetcherService::StartFetchingChildInfo( const std::string& account_id) { - child_info_request_ = ChildAccountInfoFetcher::CreateFrom( - child_request_account_id_, this, token_service_, - signin_client_->GetURLLoaderFactory(), invalidation_service_); + child_info_request_ = + ChildAccountInfoFetcherAndroid::Create(this, child_request_account_id_); } void AccountFetcherService::ResetChildInfo() { @@ -230,6 +240,13 @@ child_info_request_.reset(); } +void AccountFetcherService::SetIsChildAccount(const std::string& account_id, + bool is_child_account) { + if (child_request_account_id_ == account_id) + account_tracker_service_->SetIsChildAccount(account_id, is_child_account); +} +#endif + void AccountFetcherService::RefreshAccountInfo(const std::string& account_id, bool only_fetch_if_invalid) { DCHECK(network_fetches_enabled_); @@ -309,12 +326,6 @@ callback, traffic_annotation); } -void AccountFetcherService::SetIsChildAccount(const std::string& account_id, - bool is_child_account) { - if (child_request_account_id_ == account_id) - account_tracker_service_->SetIsChildAccount(account_id, is_child_account); -} - void AccountFetcherService::OnUserInfoFetchFailure( const std::string& account_id) { LOG(WARNING) << "Failed to get UserInfo for " << account_id;
diff --git a/components/signin/core/browser/account_fetcher_service.h b/components/signin/core/browser/account_fetcher_service.h index 77eb459..7ced83d 100644 --- a/components/signin/core/browser/account_fetcher_service.h +++ b/components/signin/core/browser/account_fetcher_service.h
@@ -13,17 +13,21 @@ #include "base/macros.h" #include "base/sequence_checker.h" #include "base/timer/timer.h" +#include "build/build_config.h" #include "components/keyed_service/core/keyed_service.h" #include "google_apis/gaia/oauth2_token_service.h" #include "ui/gfx/image/image.h" class AccountInfoFetcher; class AccountTrackerService; -class ChildAccountInfoFetcher; class OAuth2TokenService; class PrefRegistrySimple; class SigninClient; +#if defined(OS_ANDROID) +class ChildAccountInfoFetcherAndroid; +#endif + namespace base { class DictionaryValue; } @@ -38,9 +42,6 @@ class InvalidationService; } -// TODO(maroun): Protect with macro for Android only everything that is related -// to child account info fetching. - class AccountFetcherService : public KeyedService, public OAuth2TokenService::Observer { public: @@ -83,8 +84,10 @@ void EnableNetworkFetchesForTest(); - // Called by ChildAccountInfoFetcher. +#if defined(OS_ANDROID) + // Called by ChildAccountInfoFetcherAndroid. void SetIsChildAccount(const std::string& account_id, bool is_child_account); +#endif // OAuth2TokenService::Observer implementation. void OnRefreshTokenAvailable(const std::string& account_id) override; @@ -93,15 +96,16 @@ private: friend class AccountInfoFetcher; - friend class ChildAccountInfoFetcherImpl; void RefreshAllAccountInfo(bool only_fetch_if_invalid); void RefreshAllAccountsAndScheduleNext(); void ScheduleNextRefresh(); +#if defined(OS_ANDROID) // Called on all account state changes. Decides whether to fetch new child // status information or reset old values that aren't valid now. void UpdateChildInfo(); +#endif void MaybeEnableNetworkFetches(); @@ -109,11 +113,13 @@ // Further the two fetches are managed by a different refresh logic and // thus, can not be combined. virtual void StartFetchingUserInfo(const std::string& account_id); +#if defined(OS_ANDROID) virtual void StartFetchingChildInfo(const std::string& account_id); // If there is more than one account in a profile, we forcibly reset the // child status for an account to be false. void ResetChildInfo(); +#endif // Refreshes the AccountInfo associated with |account_id|. void RefreshAccountInfo(const std::string& account_id, @@ -143,12 +149,15 @@ base::Time last_updated_; base::OneShotTimer timer_; bool shutdown_called_; + +#if defined(OS_ANDROID) + std::string child_request_account_id_; + std::unique_ptr<ChildAccountInfoFetcherAndroid> child_info_request_; +#endif + // Only disabled in tests. bool scheduled_refresh_enabled_; - std::string child_request_account_id_; - std::unique_ptr<ChildAccountInfoFetcher> child_info_request_; - // Holds references to account info fetchers keyed by account_id. std::unordered_map<std::string, std::unique_ptr<AccountInfoFetcher>> user_info_requests_;
diff --git a/components/signin/core/browser/account_investigator_unittest.cc b/components/signin/core/browser/account_investigator_unittest.cc index e1cf9c91e7e..01b6e0e 100644 --- a/components/signin/core/browser/account_investigator_unittest.cc +++ b/components/signin/core/browser/account_investigator_unittest.cc
@@ -150,25 +150,23 @@ return account; } -AccountInfo Info(const std::string& id) { - AccountInfo info; - info.account_id = id; - return info; -} - // NOTE: IdentityTestEnvironment uses a prefix for generating gaia IDs: // "gaia_id_for_". For this reason, the tests prefix expected account IDs // used so that there is a match. -const std::vector<AccountInfo> no_accounts{}; -const std::vector<AccountInfo> just_one{Account("gaia_id_for_1_mail.com")}; -const std::vector<AccountInfo> just_two{Account("gaia_id_for_2_mail.com")}; -const std::vector<AccountInfo> both{Account("gaia_id_for_1_mail.com"), - Account("gaia_id_for_2_mail.com")}; -const std::vector<AccountInfo> both_reversed{Account("gaia_id_for_2_mail.com"), - Account("gaia_id_for_1_mail.com")}; -const AccountInfo one(Info("gaia_id_for_1_mail.com")); -const AccountInfo three(Info("gaia_id_for_3_mail.com")); +const std::string kGaiaId1 = identity::GetTestGaiaIdForEmail("1@mail.com"); +const std::string kGaiaId2 = identity::GetTestGaiaIdForEmail("2@mail.com"); +const std::string kGaiaId3 = identity::GetTestGaiaIdForEmail("3@mail.com"); + +const AccountInfo one(Account(kGaiaId1)); +const AccountInfo two(Account(kGaiaId2)); +const AccountInfo three(Account(kGaiaId3)); + +const std::vector<AccountInfo> no_accounts{}; +const std::vector<AccountInfo> just_one{one}; +const std::vector<AccountInfo> just_two{two}; +const std::vector<AccountInfo> both{one, two}; +const std::vector<AccountInfo> both_reversed{two, one}; TEST_F(AccountInvestigatorTest, CalculatePeriodicDelay) { const Time epoch;
diff --git a/components/signin/core/browser/account_tracker_service.cc b/components/signin/core/browser/account_tracker_service.cc index fca1345..cc33936 100644 --- a/components/signin/core/browser/account_tracker_service.cc +++ b/components/signin/core/browser/account_tracker_service.cc
@@ -44,6 +44,10 @@ const char kAdvancedProtectionAccountStatusPath[] = "is_under_advanced_protection"; +// TODO(knn): Remove once deprecated service flags have been migrated from +// preferences. +const char kChildAccountServiceFlag[] = "uca"; + // Account folders used for storing account related data at disk. const base::FilePath::CharType kAccountsFolder[] = FILE_PATH_LITERAL("Accounts"); @@ -104,8 +108,6 @@ const char AccountTrackerService::kAccountInfoPref[] = "account_info"; -const char AccountTrackerService::kChildAccountServiceFlag[] = "uca"; - // This must be a string which can never be a valid domain. const char AccountTrackerService::kNoHostedDomainFound[] = "NO_HOSTED_DOMAIN";
diff --git a/components/signin/core/browser/account_tracker_service.h b/components/signin/core/browser/account_tracker_service.h index 7523c22..85e8756 100644 --- a/components/signin/core/browser/account_tracker_service.h +++ b/components/signin/core/browser/account_tracker_service.h
@@ -48,11 +48,6 @@ // Value representing no picture URL associated with an account. static const char kNoPictureURLFound[]; - // TODO(knn): Move to ChildAccountInfoFetcher once deprecated service flags - // have been migrated from preferences. - // Child account service flag name. - static const char kChildAccountServiceFlag[]; - // Clients of AccountTrackerService can implement this interface and register // with AddObserver() to learn about account information changes. class Observer {
diff --git a/components/signin/core/browser/account_tracker_service_unittest.cc b/components/signin/core/browser/account_tracker_service_unittest.cc index e796e3c..0648a3c 100644 --- a/components/signin/core/browser/account_tracker_service_unittest.cc +++ b/components/signin/core/browser/account_tracker_service_unittest.cc
@@ -21,7 +21,6 @@ #include "components/signin/core/browser/account_info.h" #include "components/signin/core/browser/account_tracker_service.h" #include "components/signin/core/browser/avatar_icon_util.h" -#include "components/signin/core/browser/child_account_info_fetcher.h" #include "components/signin/core/browser/fake_account_fetcher_service.h" #include "components/signin/core/browser/signin_pref_names.h" #include "components/signin/core/browser/test_signin_client.h" @@ -33,6 +32,10 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#if defined(OS_ANDROID) +#include "components/signin/core/browser/child_account_info_fetcher_android.h" +#endif + namespace { // Simple wrapper around a static string; used to avoid implicit conversion // of the account key to an std::string (which is the type used for account @@ -232,7 +235,9 @@ class AccountTrackerServiceTest : public testing::Test { public: AccountTrackerServiceTest() : signin_client_(&pref_service_) { - ChildAccountInfoFetcher::InitializeForTests(); +#if defined(OS_ANDROID) + ChildAccountInfoFetcherAndroid::InitializeForTests(); +#endif AccountTrackerService::RegisterPrefs(pref_service_.registry()); AccountFetcherService::RegisterPrefs(pref_service_.registry());
diff --git a/components/signin/core/browser/child_account_info_fetcher.cc b/components/signin/core/browser/child_account_info_fetcher.cc deleted file mode 100644 index bc8e267..0000000 --- a/components/signin/core/browser/child_account_info_fetcher.cc +++ /dev/null
@@ -1,39 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/signin/core/browser/child_account_info_fetcher.h" - -#include "build/build_config.h" - -#include "services/network/public/cpp/shared_url_loader_factory.h" -#if defined(OS_ANDROID) -#include "components/signin/core/browser/child_account_info_fetcher_android.h" -#else -#include "components/signin/core/browser/child_account_info_fetcher_impl.h" -#endif - -// static -std::unique_ptr<ChildAccountInfoFetcher> ChildAccountInfoFetcher::CreateFrom( - const std::string& account_id, - AccountFetcherService* fetcher_service, - OAuth2TokenService* token_service, - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - invalidation::InvalidationService* invalidation_service) { -#if defined(OS_ANDROID) - return ChildAccountInfoFetcherAndroid::Create(fetcher_service, account_id); -#else - return std::make_unique<ChildAccountInfoFetcherImpl>( - account_id, fetcher_service, token_service, url_loader_factory, - invalidation_service); -#endif -} - -ChildAccountInfoFetcher::~ChildAccountInfoFetcher() { -} - -void ChildAccountInfoFetcher::InitializeForTests() { -#if defined(OS_ANDROID) - ChildAccountInfoFetcherAndroid::InitializeForTests(); -#endif -}
diff --git a/components/signin/core/browser/child_account_info_fetcher.h b/components/signin/core/browser/child_account_info_fetcher.h deleted file mode 100644 index f5891f5c..0000000 --- a/components/signin/core/browser/child_account_info_fetcher.h +++ /dev/null
@@ -1,42 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_SIGNIN_CORE_BROWSER_CHILD_ACCOUNT_INFO_FETCHER_H_ -#define COMPONENTS_SIGNIN_CORE_BROWSER_CHILD_ACCOUNT_INFO_FETCHER_H_ - -#include <memory> -#include <string> - -#include "base/memory/ref_counted.h" -#include "build/build_config.h" - -#if defined(OS_ANDROID) -#include <jni.h> -#endif - -namespace invalidation { -class InvalidationService; -} -namespace network { -class SharedURLLoaderFactory; -} -class AccountFetcherService; -class OAuth2TokenService; - -class ChildAccountInfoFetcher { - public: - // Caller takes ownership of the fetcher and keeps it alive in order to - // receive updates. - static std::unique_ptr<ChildAccountInfoFetcher> CreateFrom( - const std::string& account_id, - AccountFetcherService* fetcher_service, - OAuth2TokenService* token_service, - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - invalidation::InvalidationService* invalidation_service); - virtual ~ChildAccountInfoFetcher(); - - static void InitializeForTests(); -}; - -#endif // COMPONENTS_SIGNIN_CORE_BROWSER_CHILD_ACCOUNT_INFO_FETCHER_H_
diff --git a/components/signin/core/browser/child_account_info_fetcher_android.cc b/components/signin/core/browser/child_account_info_fetcher_android.cc index 29935b1..85c6304d 100644 --- a/components/signin/core/browser/child_account_info_fetcher_android.cc +++ b/components/signin/core/browser/child_account_info_fetcher_android.cc
@@ -8,6 +8,7 @@ #include "base/android/jni_android.h" #include "base/android/jni_string.h" +#include "base/memory/ptr_util.h" #include "components/signin/core/browser/account_fetcher_service.h" #include "components/signin/core/browser/account_tracker_service.h" #include "jni/ChildAccountInfoFetcher_jni.h" @@ -15,9 +16,9 @@ using base::android::JavaParamRef; // static -std::unique_ptr<ChildAccountInfoFetcher> ChildAccountInfoFetcherAndroid::Create( - AccountFetcherService* service, - const std::string& account_id) { +std::unique_ptr<ChildAccountInfoFetcherAndroid> +ChildAccountInfoFetcherAndroid::Create(AccountFetcherService* service, + const std::string& account_id) { std::string account_name = service->account_tracker_service()->GetAccountInfo(account_id).email; // The AccountTrackerService may not be populated correctly in tests. @@ -25,9 +26,8 @@ return nullptr; // Call the constructor directly instead of using std::make_unique because the - // constructor is private. Also, use the std::unique_ptr<> constructor instead - // of base::WrapUnique because the _destructor_ of the subclass is private. - return std::unique_ptr<ChildAccountInfoFetcher>( + // constructor is private. + return base::WrapUnique( new ChildAccountInfoFetcherAndroid(service, account_id, account_name)); }
diff --git a/components/signin/core/browser/child_account_info_fetcher_android.h b/components/signin/core/browser/child_account_info_fetcher_android.h index 0b73cce4..1007fe5 100644 --- a/components/signin/core/browser/child_account_info_fetcher_android.h +++ b/components/signin/core/browser/child_account_info_fetcher_android.h
@@ -9,15 +9,15 @@ #include <string> #include "base/android/scoped_java_ref.h" -#include "components/signin/core/browser/child_account_info_fetcher.h" class AccountFetcherService; -class ChildAccountInfoFetcherAndroid : public ChildAccountInfoFetcher { +class ChildAccountInfoFetcherAndroid { public: - static std::unique_ptr<ChildAccountInfoFetcher> Create( + static std::unique_ptr<ChildAccountInfoFetcherAndroid> Create( AccountFetcherService* service, const std::string& account_id); + ~ChildAccountInfoFetcherAndroid(); static void InitializeForTests(); @@ -25,9 +25,7 @@ ChildAccountInfoFetcherAndroid(AccountFetcherService* service, const std::string& account_id, const std::string& account_name); - ~ChildAccountInfoFetcherAndroid() override; - private: base::android::ScopedJavaGlobalRef<jobject> j_child_account_info_fetcher_; DISALLOW_COPY_AND_ASSIGN(ChildAccountInfoFetcherAndroid);
diff --git a/components/signin/core/browser/child_account_info_fetcher_impl.cc b/components/signin/core/browser/child_account_info_fetcher_impl.cc deleted file mode 100644 index cc0fbf4e..0000000 --- a/components/signin/core/browser/child_account_info_fetcher_impl.cc +++ /dev/null
@@ -1,181 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/signin/core/browser/child_account_info_fetcher_impl.h" - -#include "base/stl_util.h" -#include "base/strings/string_split.h" -#include "base/trace_event/trace_event.h" -#include "base/values.h" -#include "components/invalidation/public/invalidation_service.h" -#include "components/invalidation/public/object_id_invalidation_map.h" -#include "components/signin/core/browser/account_fetcher_service.h" -#include "components/signin/core/browser/account_tracker_service.h" -#include "components/signin/core/browser/signin_client.h" -#include "google/cacheinvalidation/types.pb.h" -#include "google_apis/gaia/gaia_auth_fetcher.h" -#include "google_apis/gaia/gaia_constants.h" -#include "services/network/public/cpp/shared_url_loader_factory.h" - -// TODO(maroun): Remove this file. - -namespace { - -const char kFetcherId[] = "ChildAccountInfoFetcherImpl"; - -// Exponential backoff policy on service flag fetching failure. -const net::BackoffEntry::Policy kBackoffPolicy = { - 0, // Number of initial errors to ignore without backoff. - 2000, // Initial delay for backoff in ms. - 2, // Factor to multiply waiting time by. - 0.2, // Fuzzing percentage. 20% will spread requests randomly between - // 80-100% of the calculated time. - 1000 * 60 * 60* 4, // Maximum time to delay requests by (4 hours). - -1, // Don't discard entry even if unused. - false, // Don't use the initial delay unless the last request was an error. -}; - -// The invalidation object ID used for child account graduation event. -// The syntax is: -// 'U' -> This is a user specific invalidation. -// 'CA' -> Namespace used for all ChildAccount invalidations. -// 'GRAD' -> Indicates the actual event i.e. child account graduation. -const char kChildAccountGraduationId[] = "UCAGRAD"; - -} // namespace - -ChildAccountInfoFetcherImpl::ChildAccountInfoFetcherImpl( - const std::string& account_id, - AccountFetcherService* fetcher_service, - OAuth2TokenService* token_service, - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - invalidation::InvalidationService* invalidation_service) - : OAuth2TokenService::Consumer(kFetcherId), - token_service_(token_service), - url_loader_factory_(url_loader_factory), - fetcher_service_(fetcher_service), - invalidation_service_(invalidation_service), - account_id_(account_id), - backoff_(&kBackoffPolicy), - fetch_in_progress_(false) { - TRACE_EVENT_ASYNC_BEGIN1("AccountFetcherService", kFetcherId, this, - "account_id", account_id); - // Invalidation service may not be available in tests. - if (invalidation_service_) { - invalidation_service_->RegisterInvalidationHandler(this); - syncer::ObjectIdSet ids; - ids.insert(invalidation::ObjectId( - ipc::invalidation::ObjectSource::CHROME_COMPONENTS, - kChildAccountGraduationId)); - bool insert_success = - invalidation_service_->UpdateRegisteredInvalidationIds(this, ids); - DCHECK(insert_success); - } - FetchIfNotInProgress(); -} - -ChildAccountInfoFetcherImpl::~ChildAccountInfoFetcherImpl() { - TRACE_EVENT_ASYNC_END0("AccountFetcherService", kFetcherId, this); - if (invalidation_service_) - UnregisterInvalidationHandler(); -} - -void ChildAccountInfoFetcherImpl::FetchIfNotInProgress() { - DCHECK(thread_checker_.CalledOnValidThread()); - if (fetch_in_progress_) - return; - fetch_in_progress_ = true; - OAuth2TokenService::ScopeSet scopes; - scopes.insert(GaiaConstants::kOAuth1LoginScope); - login_token_request_ = - token_service_->StartRequest(account_id_, scopes, this); -} - -void ChildAccountInfoFetcherImpl::OnGetTokenSuccess( - const OAuth2TokenService::Request* request, - const OAuth2AccessTokenConsumer::TokenResponse& token_response) { - TRACE_EVENT_ASYNC_STEP_PAST0("AccountFetcherService", kFetcherId, this, - "OnGetTokenSuccess"); - DCHECK_EQ(request, login_token_request_.get()); - - gaia_auth_fetcher_ = fetcher_service_->signin_client_->CreateGaiaAuthFetcher( - this, gaia::GaiaSource::kChrome, url_loader_factory_); - gaia_auth_fetcher_->StartOAuthLogin(token_response.access_token, - GaiaConstants::kGaiaService); -} - -void ChildAccountInfoFetcherImpl::OnGetTokenFailure( - const OAuth2TokenService::Request* request, - const GoogleServiceAuthError& error) { - HandleFailure(); -} - -void ChildAccountInfoFetcherImpl::OnClientLoginSuccess( - const ClientLoginResult& result) { - gaia_auth_fetcher_->StartGetUserInfo(result.lsid); -} - -void ChildAccountInfoFetcherImpl::OnClientLoginFailure( - const GoogleServiceAuthError& error) { - HandleFailure(); -} - -void ChildAccountInfoFetcherImpl::OnGetUserInfoSuccess( - const UserInfoMap& data) { - auto services_iter = data.find("allServices"); - if (services_iter != data.end()) { - std::vector<std::string> service_flags = base::SplitString( - services_iter->second, ",", base::TRIM_WHITESPACE, - base::SPLIT_WANT_ALL); - bool is_child_account = base::ContainsValue( - service_flags, AccountTrackerService::kChildAccountServiceFlag); - if (!is_child_account && invalidation_service_) { - // Don't bother listening for invalidations as a non-child account can't - // become a child account. - bool insert_success = - invalidation_service_->UpdateRegisteredInvalidationIds( - this, syncer::ObjectIdSet()); - DCHECK(insert_success); - UnregisterInvalidationHandler(); - } - fetcher_service_->SetIsChildAccount(account_id_, is_child_account); - } else { - DLOG(ERROR) << "ChildAccountInfoFetcherImpl::OnGetUserInfoSuccess: " - << "GetUserInfo response didn't include allServices field."; - } - fetch_in_progress_ = false; -} - -void ChildAccountInfoFetcherImpl::OnGetUserInfoFailure( - const GoogleServiceAuthError& error) { - HandleFailure(); -} - -void ChildAccountInfoFetcherImpl::HandleFailure() { - fetch_in_progress_ = false; - backoff_.InformOfRequest(false); - timer_.Start(FROM_HERE, backoff_.GetTimeUntilRelease(), this, - &ChildAccountInfoFetcherImpl::FetchIfNotInProgress); -} - -void ChildAccountInfoFetcherImpl::UnregisterInvalidationHandler() { - invalidation_service_->UnregisterInvalidationHandler(this); - invalidation_service_ = nullptr; -} - -void ChildAccountInfoFetcherImpl::OnInvalidatorStateChange( - syncer::InvalidatorState state) { - if (state == syncer::INVALIDATOR_SHUTTING_DOWN) - UnregisterInvalidationHandler(); -} - -void ChildAccountInfoFetcherImpl::OnIncomingInvalidation( - const syncer::ObjectIdInvalidationMap& invalidation_map) { - FetchIfNotInProgress(); - invalidation_map.AcknowledgeAll(); -} - -std::string ChildAccountInfoFetcherImpl::GetOwnerName() const { - return std::string(kFetcherId); -}
diff --git a/components/signin/core/browser/child_account_info_fetcher_impl.h b/components/signin/core/browser/child_account_info_fetcher_impl.h deleted file mode 100644 index e5383f6..0000000 --- a/components/signin/core/browser/child_account_info_fetcher_impl.h +++ /dev/null
@@ -1,84 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_SIGNIN_CORE_BROWSER_CHILD_ACCOUNT_INFO_FETCHER_IMPL_H_ -#define COMPONENTS_SIGNIN_CORE_BROWSER_CHILD_ACCOUNT_INFO_FETCHER_IMPL_H_ - -#include <memory> - -#include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "base/threading/thread_checker.h" -#include "base/timer/timer.h" -#include "components/invalidation/public/invalidation_handler.h" -#include "components/signin/core/browser/child_account_info_fetcher.h" -#include "google_apis/gaia/gaia_auth_consumer.h" -#include "google_apis/gaia/oauth2_token_service.h" -#include "net/base/backoff_entry.h" - -// TODO(maroun): Remove this file. - -namespace network { -class SharedURLLoaderFactory; -} - -class GaiaAuthFetcher; - -class ChildAccountInfoFetcherImpl : public ChildAccountInfoFetcher, - public OAuth2TokenService::Consumer, - public GaiaAuthConsumer, - public syncer::InvalidationHandler { - public: - ChildAccountInfoFetcherImpl( - const std::string& account_id, - AccountFetcherService* fetcher_service, - OAuth2TokenService* token_service, - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - invalidation::InvalidationService* invalidation_service); - ~ChildAccountInfoFetcherImpl() override; - - private: - void FetchIfNotInProgress(); - void HandleFailure(); - void UnregisterInvalidationHandler(); - - // OAuth2TokenService::Consumer: - void OnGetTokenSuccess( - const OAuth2TokenService::Request* request, - const OAuth2AccessTokenConsumer::TokenResponse& token_response) override; - void OnGetTokenFailure(const OAuth2TokenService::Request* request, - const GoogleServiceAuthError& error) override; - - // GaiaAuthConsumer: - void OnClientLoginSuccess(const ClientLoginResult& result) override; - void OnClientLoginFailure(const GoogleServiceAuthError& error) override; - void OnGetUserInfoSuccess(const UserInfoMap& data) override; - void OnGetUserInfoFailure(const GoogleServiceAuthError& error) override; - - // syncer::InvalidationHandler: - void OnInvalidatorStateChange(syncer::InvalidatorState state) override; - void OnIncomingInvalidation( - const syncer::ObjectIdInvalidationMap& invalidation_map) override; - std::string GetOwnerName() const override; - - OAuth2TokenService* token_service_; - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_; - AccountFetcherService* fetcher_service_; - invalidation::InvalidationService* invalidation_service_; - const std::string account_id_; - - // If fetching fails, retry with exponential backoff. - base::OneShotTimer timer_; - net::BackoffEntry backoff_; - - std::unique_ptr<OAuth2TokenService::Request> login_token_request_; - std::unique_ptr<GaiaAuthFetcher> gaia_auth_fetcher_; - - bool fetch_in_progress_; - base::ThreadChecker thread_checker_; - - DISALLOW_COPY_AND_ASSIGN(ChildAccountInfoFetcherImpl); -}; - -#endif // COMPONENTS_SIGNIN_CORE_BROWSER_CHILD_ACCOUNT_INFO_FETCHER_IMPL_H_
diff --git a/components/signin/core/browser/fake_account_fetcher_service.cc b/components/signin/core/browser/fake_account_fetcher_service.cc index fde2c9e..c855b354 100644 --- a/components/signin/core/browser/fake_account_fetcher_service.cc +++ b/components/signin/core/browser/fake_account_fetcher_service.cc
@@ -31,22 +31,11 @@ account_tracker_service()->SetAccountInfoFromUserInfo(account_id, &user_info); } -void FakeAccountFetcherService::FakeSetIsChildAccount( - const std::string& account_id, - bool is_child_account) { - SetIsChildAccount(account_id, is_child_account); -} - void FakeAccountFetcherService::StartFetchingUserInfo( const std::string& account_id) { // In tests, don't do actual network fetch. } -void FakeAccountFetcherService::StartFetchingChildInfo( - const std::string& account_id) { - // In tests, don't do actual network fetch. -} - TestImageDecoder::TestImageDecoder() = default; TestImageDecoder::~TestImageDecoder() = default;
diff --git a/components/signin/core/browser/fake_account_fetcher_service.h b/components/signin/core/browser/fake_account_fetcher_service.h index 5a3cafa2..9e1298f 100644 --- a/components/signin/core/browser/fake_account_fetcher_service.h +++ b/components/signin/core/browser/fake_account_fetcher_service.h
@@ -33,14 +33,11 @@ const std::string& given_name, const std::string& locale, const std::string& picture_url); - void FakeSetIsChildAccount(const std::string& account_id, - bool is_child_account); FakeAccountFetcherService(); private: void StartFetchingUserInfo(const std::string& account_id) override; - void StartFetchingChildInfo(const std::string& account_id) override; DISALLOW_COPY_AND_ASSIGN(FakeAccountFetcherService); };
diff --git a/components/signin/core/browser/signin_investigator_unittest.cc b/components/signin/core/browser/signin_investigator_unittest.cc index cba6e20..cb861a03 100644 --- a/components/signin/core/browser/signin_investigator_unittest.cc +++ b/components/signin/core/browser/signin_investigator_unittest.cc
@@ -5,12 +5,13 @@ #include <string> #include "base/test/metrics/histogram_tester.h" +#include "base/test/scoped_task_environment.h" #include "components/prefs/pref_registry_simple.h" -#include "components/prefs/testing_pref_service.h" #include "components/signin/core/browser/signin_investigator.h" -#include "components/signin/core/browser/signin_manager_base.h" #include "components/signin/core/browser/signin_metrics.h" #include "components/signin/core/browser/signin_pref_names.h" +#include "components/sync_preferences/testing_pref_service_syncable.h" +#include "services/identity/public/cpp/identity_test_environment.h" #include "testing/gtest/include/gtest/gtest.h" using signin_metrics::AccountEquality; @@ -24,13 +25,17 @@ class FakeProvider : public SigninInvestigator::DependencyProvider { public: - FakeProvider(const std::string& last_email, const std::string& last_id) { - SigninManagerBase::RegisterProfilePrefs(prefs_.registry()); + FakeProvider(const std::string& last_email, const std::string& last_id) + : identity_test_env_(/*test_url_loader_factory=*/nullptr, &prefs_) { prefs_.SetString(prefs::kGoogleServicesLastUsername, last_email); prefs_.SetString(prefs::kGoogleServicesLastAccountId, last_id); } PrefService* GetPrefs() override { return &prefs_; } - TestingPrefServiceSimple prefs_; + + private: + base::test::ScopedTaskEnvironment task_environment_; + sync_preferences::TestingPrefServiceSyncable prefs_; + identity::IdentityTestEnvironment identity_test_env_; }; } // namespace
diff --git a/components/signin/core/browser/signin_tracker.cc b/components/signin/core/browser/signin_tracker.cc index 0a82a89..230b49e 100644 --- a/components/signin/core/browser/signin_tracker.cc +++ b/components/signin/core/browser/signin_tracker.cc
@@ -4,45 +4,36 @@ #include "components/signin/core/browser/signin_tracker.h" -#include "components/signin/core/browser/gaia_cookie_manager_service.h" -#include "components/signin/core/browser/profile_oauth2_token_service.h" #include "google_apis/gaia/gaia_constants.h" -SigninTracker::SigninTracker(ProfileOAuth2TokenService* token_service, - SigninManagerBase* signin_manager, - GaiaCookieManagerService* cookie_manager_service, +SigninTracker::SigninTracker(identity::IdentityManager* identity_manager, Observer* observer) - : token_service_(token_service), - signin_manager_(signin_manager), - cookie_manager_service_(cookie_manager_service), - observer_(observer) { + : identity_manager_(identity_manager), observer_(observer) { Initialize(); } SigninTracker::~SigninTracker() { - signin_manager_->RemoveObserver(this); - token_service_->RemoveObserver(this); - cookie_manager_service_->RemoveObserver(this); + identity_manager_->RemoveObserver(this); } void SigninTracker::Initialize() { DCHECK(observer_); - signin_manager_->AddObserver(this); - token_service_->AddObserver(this); - cookie_manager_service_->AddObserver(this); + identity_manager_->AddObserver(this); } -void SigninTracker::GoogleSigninSucceeded(const AccountInfo& account_info) { - if (token_service_->RefreshTokenIsAvailable(account_info.account_id)) +void SigninTracker::OnPrimaryAccountSet(const AccountInfo& account_info) { + if (identity_manager_->HasAccountWithRefreshToken(account_info.account_id)) observer_->SigninSuccess(); } -void SigninTracker::GoogleSigninFailed(const GoogleServiceAuthError& error) { +void SigninTracker::OnPrimaryAccountSigninFailed( + const GoogleServiceAuthError& error) { observer_->SigninFailed(error); } -void SigninTracker::OnRefreshTokenAvailable(const std::string& account_id) { - if (account_id != signin_manager_->GetAuthenticatedAccountId()) +void SigninTracker::OnRefreshTokenUpdatedForAccount( + const AccountInfo& account_info) { + if (account_info.account_id != identity_manager_->GetPrimaryAccountId()) return; observer_->SigninSuccess();
diff --git a/components/signin/core/browser/signin_tracker.h b/components/signin/core/browser/signin_tracker.h index cb857e3a..0e6e8c5b 100644 --- a/components/signin/core/browser/signin_tracker.h +++ b/components/signin/core/browser/signin_tracker.h
@@ -8,17 +8,14 @@ #include <memory> #include "base/macros.h" -#include "components/signin/core/browser/gaia_cookie_manager_service.h" -#include "components/signin/core/browser/signin_manager.h" #include "google_apis/gaia/google_service_auth_error.h" - -class ProfileOAuth2TokenService; +#include "services/identity/public/cpp/identity_manager.h" // The signin flow logic is spread across several classes with varying // responsibilities: // -// SigninTracker (this class) - This class listens to notifications from various -// services (SigninManager, OAuth2TokenService) and coalesces them into +// SigninTracker (this class) - This class listens to notifications from the +// IdentityManager services and coalesces them into // notifications for the UI layer. This is the class that encapsulates the logic // that determines whether a user is fully logged in or not, and exposes // callbacks so various pieces of the UI (OneClickSyncStarter) can track the @@ -35,25 +32,21 @@ // (a KeyedService that keeps track of the currently visible // login UI). // -// SigninManager - Records the currently-logged-in user and handles all +// IdentityManager - Records the currently-logged-in user and handles all // interaction with the GAIA backend during the signin process. Unlike -// SigninTracker, SigninManager only knows about the GAIA login state and is +// SigninTracker, IdentityManager only knows about the GAIA login state and is // not aware of the state of any signed in services. -// -// OAuth2TokenService - Maintains and manages OAuth2 tokens for the accounts -// connected to this profile. -// -// GaiaCookieManagerService - Responsible for adding or removing cookies from -// the cookie jar from the browser process. A single source of information about -// GAIA cookies in the cookie jar that are fetchable via /ListAccounts. +// What is more, IdentityManager also maintains and manages OAuth2 tokens for +// the accounts connected to this profile. +// Last, the IdentityManager is also responsible for adding or removing cookies +// from the cookie jar from the browser process. A single source of information +// about GAIA cookies in the cookie jar that are fetchable via /ListAccounts. // // ProfileSyncService - Provides the external API for interacting with the // sync framework. Listens for notifications for tokens to know when to startup // sync, and provides an Observer interface to notify the UI layer of changes // in sync state so they can be reflected in the UI. -class SigninTracker : public SigninManagerBase::Observer, - public OAuth2TokenService::Observer, - public GaiaCookieManagerService::Observer { +class SigninTracker : public identity::IdentityManager::Observer { public: class Observer { public: @@ -73,32 +66,26 @@ // instances with the exception of |account_reconcilor| must be non-null and // must outlive the SigninTracker. |account_reconcilor| will be used if it is // non-null. - SigninTracker(ProfileOAuth2TokenService* token_service, - SigninManagerBase* signin_manager, - GaiaCookieManagerService* cookie_manager_service, + SigninTracker(identity::IdentityManager* identity_manager, Observer* observer); ~SigninTracker() override; - // SigninManagerBase::Observer implementation. - void GoogleSigninSucceeded(const AccountInfo& account_info) override; - void GoogleSigninFailed(const GoogleServiceAuthError& error) override; - - // OAuth2TokenService::Observer implementation. - void OnRefreshTokenAvailable(const std::string& account_id) override; + // identity::IdentityManager::Observer implementation. + void OnPrimaryAccountSet(const AccountInfo& account_info) override; + void OnPrimaryAccountSigninFailed( + const GoogleServiceAuthError& error) override; + void OnRefreshTokenUpdatedForAccount( + const AccountInfo& account_info) override; + void OnAddAccountToCookieCompleted( + const std::string& account_id, + const GoogleServiceAuthError& error) override; private: // Initializes this by adding notifications and observers. void Initialize(); - // GaiaCookieManagerService::Observer implementation. - void OnAddAccountToCookieCompleted( - const std::string& account_id, - const GoogleServiceAuthError& error) override; - // The classes whose collective signin status we are tracking. - ProfileOAuth2TokenService* token_service_; - SigninManagerBase* signin_manager_; - GaiaCookieManagerService* cookie_manager_service_; + identity::IdentityManager* identity_manager_; // Weak pointer to the observer we call when the signin state changes. Observer* observer_;
diff --git a/components/signin/core/browser/signin_tracker_unittest.cc b/components/signin/core/browser/signin_tracker_unittest.cc index e897771..e6114a3 100644 --- a/components/signin/core/browser/signin_tracker_unittest.cc +++ b/components/signin/core/browser/signin_tracker_unittest.cc
@@ -7,16 +7,9 @@ #include "base/compiler_specific.h" #include "base/test/scoped_task_environment.h" #include "build/build_config.h" -#include "components/signin/core/browser/account_consistency_method.h" -#include "components/signin/core/browser/account_tracker_service.h" -#include "components/signin/core/browser/fake_gaia_cookie_manager_service.h" -#include "components/signin/core/browser/fake_profile_oauth2_token_service.h" -#include "components/signin/core/browser/fake_signin_manager.h" -#include "components/signin/core/browser/signin_switches.h" -#include "components/signin/core/browser/test_signin_client.h" -#include "components/sync_preferences/testing_pref_service_syncable.h" #include "google_apis/gaia/gaia_constants.h" #include "google_apis/gaia/google_service_auth_error.h" +#include "services/identity/public/cpp/identity_test_environment.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -49,45 +42,16 @@ class SigninTrackerTest : public testing::Test { public: - SigninTrackerTest() - : signin_client_(&pref_service_), - fake_oauth2_token_service_(&pref_service_), - fake_gaia_cookie_manager_service_(&fake_oauth2_token_service_, - &signin_client_, - &test_url_loader_factory_), -#if defined(OS_CHROMEOS) - fake_signin_manager_(&signin_client_, - &fake_oauth2_token_service_, - &account_tracker_) { -#else - fake_signin_manager_(&signin_client_, - &fake_oauth2_token_service_, - &account_tracker_, - &fake_gaia_cookie_manager_service_) { -#endif - - AccountTrackerService::RegisterPrefs(pref_service_.registry()); - SigninManagerBase::RegisterProfilePrefs(pref_service_.registry()); - SigninManagerBase::RegisterPrefs(pref_service_.registry()); - - account_tracker_.Initialize(&pref_service_, base::FilePath()); - + SigninTrackerTest() { tracker_ = std::make_unique<SigninTracker>( - &fake_oauth2_token_service_, &fake_signin_manager_, - &fake_gaia_cookie_manager_service_, &observer_); + identity_test_env_.identity_manager(), &observer_); } ~SigninTrackerTest() override { tracker_.reset(); } base::test::ScopedTaskEnvironment task_environment_; std::unique_ptr<SigninTracker> tracker_; - sync_preferences::TestingPrefServiceSyncable pref_service_; - AccountTrackerService account_tracker_; - TestSigninClient signin_client_; - FakeProfileOAuth2TokenService fake_oauth2_token_service_; - network::TestURLLoaderFactory test_url_loader_factory_; - FakeGaiaCookieManagerService fake_gaia_cookie_manager_service_; - FakeSigninManagerForTesting fake_signin_manager_; + identity::IdentityTestEnvironment identity_test_env_; MockObserver observer_; }; @@ -100,7 +64,8 @@ EXPECT_CALL(observer_, SigninSuccess()).Times(0); EXPECT_CALL(observer_, SigninFailed(error)); - fake_signin_manager_.FailSignin(error); + // Mimic calling IdentityManager::GoogleSigninFailed(). + tracker_->OnPrimaryAccountSigninFailed(error); } #endif // !defined(OS_CHROMEOS) @@ -108,11 +73,8 @@ EXPECT_CALL(observer_, SigninSuccess()); EXPECT_CALL(observer_, SigninFailed(_)).Times(0); - std::string gaia_id = "gaia_id"; std::string email = "user@gmail.com"; - std::string account_id = account_tracker_.SeedAccountInfo(gaia_id, email); - fake_signin_manager_.SetAuthenticatedAccountInfo(gaia_id, email); - fake_oauth2_token_service_.UpdateCredentials(account_id, "refresh_token"); + identity_test_env_.MakePrimaryAccountAvailable(email); } #if !defined(OS_CHROMEOS) @@ -120,10 +82,8 @@ EXPECT_CALL(observer_, SigninSuccess()); EXPECT_CALL(observer_, SigninFailed(_)).Times(0); - std::string gaia_id = "gaia_id"; std::string email = "user@gmail.com"; - std::string account_id = account_tracker_.SeedAccountInfo(gaia_id, email); - fake_oauth2_token_service_.UpdateCredentials(account_id, "refresh_token"); - fake_signin_manager_.SignIn(gaia_id, email, std::string()); + AccountInfo account_info = identity_test_env_.MakeAccountAvailable(email); + identity_test_env_.SetPrimaryAccount(account_info.email); } #endif
diff --git a/components/signin/ios/DEPS b/components/signin/ios/DEPS index 4dd6307..bb46705a 100644 --- a/components/signin/ios/DEPS +++ b/components/signin/ios/DEPS
@@ -1,4 +1,5 @@ include_rules = [ "+ios/web/public", + "+services/identity/public/cpp", "+third_party/ocmock", ]
diff --git a/components/signin/ios/browser/BUILD.gn b/components/signin/ios/browser/BUILD.gn index 9a5285b7..6ff7baa 100644 --- a/components/signin/ios/browser/BUILD.gn +++ b/components/signin/ios/browser/BUILD.gn
@@ -31,6 +31,7 @@ "//google_apis", "//ios/web", "//net", + "//services/identity/public/cpp:cpp", ] } @@ -83,6 +84,7 @@ "//ios/web", "//ios/web/public/test", "//ios/web/public/test/fakes", + "//services/identity/public/cpp:test_support", "//third_party/ocmock", ] }
diff --git a/components/signin/ios/browser/account_consistency_service.h b/components/signin/ios/browser/account_consistency_service.h index 4488de9..e7ebe23 100644 --- a/components/signin/ios/browser/account_consistency_service.h +++ b/components/signin/ios/browser/account_consistency_service.h
@@ -18,9 +18,9 @@ #include "components/content_settings/core/browser/cookie_settings.h" #include "components/keyed_service/core/keyed_service.h" #include "components/signin/core/browser/gaia_cookie_manager_service.h" -#include "components/signin/core/browser/signin_manager.h" #include "components/signin/ios/browser/active_state_manager.h" #import "components/signin/ios/browser/manage_accounts_delegate.h" +#import "services/identity/public/cpp/identity_manager.h" namespace web { class BrowserState; @@ -41,7 +41,7 @@ // This is currently only used when WKWebView is enabled. class AccountConsistencyService : public KeyedService, public GaiaCookieManagerService::Observer, - public SigninManagerBase::Observer, + public identity::IdentityManager::Observer, public ActiveStateManager::Observer { public: // Name of the preference property that persists the domains that have a @@ -54,7 +54,7 @@ scoped_refptr<content_settings::CookieSettings> cookie_settings, GaiaCookieManagerService* gaia_cookie_manager_service, SigninClient* signin_client, - SigninManager* signin_manager); + identity::IdentityManager* identity_manager); ~AccountConsistencyService() override; // Registers the preferences used by AccountConsistencyService. @@ -155,9 +155,10 @@ const std::vector<gaia::ListedAccount>& signed_out_accounts, const GoogleServiceAuthError& error) override; - // SigninManagerBase::Observer implementation. - void GoogleSigninSucceeded(const AccountInfo& account_info) override; - void GoogleSignedOut(const AccountInfo& account_info) override; + // IdentityManager::Observer implementation. + void OnPrimaryAccountSet(const AccountInfo& account_info) override; + void OnPrimaryAccountCleared( + const AccountInfo& previous_account_info) override; // ActiveStateManager::Observer implementation. void OnActive() override; @@ -176,8 +177,9 @@ GaiaCookieManagerService* gaia_cookie_manager_service_; // Signin client, used to access prefs. SigninClient* signin_client_; - // Signin manager, observed to be notified of signin and signout events. - SigninManager* signin_manager_; + // Identity manager, observed to be notified of primary account signin and + // signout events. + identity::IdentityManager* identity_manager_; // Whether a CHROME_CONNECTED cookie request is currently being applied. bool applying_cookie_requests_;
diff --git a/components/signin/ios/browser/account_consistency_service.mm b/components/signin/ios/browser/account_consistency_service.mm index 39095fa6..f4de0d4 100644 --- a/components/signin/ios/browser/account_consistency_service.mm +++ b/components/signin/ios/browser/account_consistency_service.mm
@@ -221,19 +221,19 @@ scoped_refptr<content_settings::CookieSettings> cookie_settings, GaiaCookieManagerService* gaia_cookie_manager_service, SigninClient* signin_client, - SigninManager* signin_manager) + identity::IdentityManager* identity_manager) : browser_state_(browser_state), account_reconcilor_(account_reconcilor), cookie_settings_(cookie_settings), gaia_cookie_manager_service_(gaia_cookie_manager_service), signin_client_(signin_client), - signin_manager_(signin_manager), + identity_manager_(identity_manager), applying_cookie_requests_(false) { gaia_cookie_manager_service_->AddObserver(this); - signin_manager_->AddObserver(this); + identity_manager_->AddObserver(this); ActiveStateManager::FromBrowserState(browser_state_)->AddObserver(this); LoadFromPrefs(); - if (signin_manager_->IsAuthenticated()) { + if (identity_manager_->HasPrimaryAccount()) { AddChromeConnectedCookies(); } else { RemoveChromeConnectedCookies(base::OnceClosure()); @@ -333,7 +333,7 @@ void AccountConsistencyService::Shutdown() { gaia_cookie_manager_service_->RemoveObserver(this); - signin_manager_->RemoveObserver(this); + identity_manager_->RemoveObserver(this); ActiveStateManager::FromBrowserState(browser_state_)->RemoveObserver(this); ResetWKWebView(); web_state_handlers_.clear(); @@ -363,7 +363,7 @@ switch (cookie_requests_.front().request_type) { case ADD_CHROME_CONNECTED_COOKIE: cookie_value = signin::BuildMirrorRequestCookieIfPossible( - url, signin_manager_->GetAuthenticatedAccountInfo().gaia, + url, identity_manager_->GetPrimaryAccountInfo().gaia, signin::AccountConsistencyMethod::kMirror, cookie_settings_.get(), signin::PROFILE_MODE_DEFAULT); if (cookie_value.empty()) { @@ -490,13 +490,13 @@ AddChromeConnectedCookies(); } -void AccountConsistencyService::GoogleSigninSucceeded( +void AccountConsistencyService::OnPrimaryAccountSet( const AccountInfo& account_info) { AddChromeConnectedCookies(); } -void AccountConsistencyService::GoogleSignedOut( - const AccountInfo& account_info) { +void AccountConsistencyService::OnPrimaryAccountCleared( + const AccountInfo& previous_account_info) { // There is not need to remove CHROME_CONNECTED cookies on |GoogleSignedOut| // events as these cookies will be removed by the GaiaCookieManagerServer // right before fetching the Gaia logout request.
diff --git a/components/signin/ios/browser/account_consistency_service_unittest.mm b/components/signin/ios/browser/account_consistency_service_unittest.mm index 4193365..15bc87674 100644 --- a/components/signin/ios/browser/account_consistency_service_unittest.mm +++ b/components/signin/ios/browser/account_consistency_service_unittest.mm
@@ -14,6 +14,7 @@ #include "components/signin/core/browser/account_reconcilor.h" #include "components/signin/core/browser/account_reconcilor_delegate.h" #include "components/signin/core/browser/account_tracker_service.h" +#include "components/signin/core/browser/fake_gaia_cookie_manager_service.h" #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" #include "components/signin/core/browser/fake_signin_manager.h" #include "components/signin/core/browser/gaia_cookie_manager_service.h" @@ -24,6 +25,8 @@ #import "ios/web/public/test/fakes/test_web_state.h" #include "ios/web/public/test/test_web_thread_bundle.h" #include "ios/web/public/web_state/web_state_policy_decider.h" +#import "services/identity/public/cpp/identity_manager.h" +#import "services/identity/public/cpp/identity_test_environment.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" @@ -59,13 +62,13 @@ scoped_refptr<content_settings::CookieSettings> cookie_settings, GaiaCookieManagerService* gaia_cookie_manager_service, SigninClient* signin_client, - SigninManager* signin_manager) + identity::IdentityManager* identity_manager) : AccountConsistencyService(browser_state, account_reconcilor, cookie_settings, gaia_cookie_manager_service, signin_client, - signin_manager) {} + identity_manager) {} private: WKWebView* BuildWKWebView() override { @@ -90,13 +93,23 @@ MOCK_METHOD1(OnReceivedManageAccountsResponse, void(signin::GAIAServiceType)); }; -// Mock GaiaCookieManagerService to catch call to ForceOnCookieChangeProcessing -class MockGaiaCookieManagerService : public GaiaCookieManagerService { +// Mock GaiaCookieManagerService to catch call to ForceOnCookieChangeProcessing. +// It isn't an actual mock as it is not desirable to extend a Mock from a Fake. +class CustomGaiaCookieManagerService : public FakeGaiaCookieManagerService { public: - MockGaiaCookieManagerService() - : GaiaCookieManagerService(nullptr, - nullptr) {} - MOCK_METHOD0(ForceOnCookieChangeProcessing, void()); + CustomGaiaCookieManagerService() + : FakeGaiaCookieManagerService(nullptr, nullptr), + calls_to_force_on_cookie_change_processing_(0) {} + + uint8_t CallsToForceOnCookieChangeProcessing() { + return calls_to_force_on_cookie_change_processing_; + } + + private: + void ForceOnCookieChangeProcessing() override { + calls_to_force_on_cookie_change_processing_++; + }; + uint8_t calls_to_force_on_cookie_change_processing_; }; // TestWebState that allows control over its policy decider. @@ -147,7 +160,7 @@ SigninManagerBase::RegisterProfilePrefs(prefs_.registry()); web_view_load_expection_count_ = 0; - gaia_cookie_manager_service_.reset(new MockGaiaCookieManagerService()); + gaia_cookie_manager_service_.reset(new CustomGaiaCookieManagerService()); signin_client_.reset(new TestSigninClient(&prefs_)); account_tracker_service_.Initialize(&prefs_, base::FilePath()); token_service_.reset(new FakeProfileOAuth2TokenService(&prefs_)); @@ -155,6 +168,9 @@ new FakeSigninManager(signin_client_.get(), token_service_.get(), &account_tracker_service_, nullptr)); signin_manager_->Initialize(nullptr); + identity_test_env_.reset(new identity::IdentityTestEnvironment( + &account_tracker_service_, token_service_.get(), signin_manager_.get(), + gaia_cookie_manager_service_.get())); settings_map_ = new HostContentSettingsMap( &prefs_, false /* incognito_profile */, false /* guest_profile */, false /* store_last_modified */, @@ -172,6 +188,7 @@ account_consistency_service_->Shutdown(); settings_map_->ShutdownOnUIThread(); ActiveStateManager::FromBrowserState(&browser_state_)->SetActive(false); + identity_test_env_.reset(); PlatformTest::TearDown(); } @@ -201,7 +218,7 @@ account_consistency_service_.reset(new FakeAccountConsistencyService( &browser_state_, account_reconcilor_.get(), cookie_settings_, gaia_cookie_manager_service_.get(), signin_client_.get(), - signin_manager_.get())); + identity_test_env_->identity_manager())); } void SignIn() { @@ -256,13 +273,14 @@ web::TestBrowserState browser_state_; sync_preferences::TestingPrefServiceSyncable prefs_; TestWebState web_state_; + std::unique_ptr<identity::IdentityTestEnvironment> identity_test_env_; // AccountConsistencyService being tested. Actually a // FakeAccountConsistencyService to be able to use a mock web view. std::unique_ptr<AccountConsistencyService> account_consistency_service_; std::unique_ptr<TestSigninClient> signin_client_; std::unique_ptr<FakeProfileOAuth2TokenService> token_service_; std::unique_ptr<FakeSigninManager> signin_manager_; - std::unique_ptr<MockGaiaCookieManagerService> gaia_cookie_manager_service_; + std::unique_ptr<CustomGaiaCookieManagerService> gaia_cookie_manager_service_; std::unique_ptr<MockAccountReconcilor> account_reconcilor_; scoped_refptr<HostContentSettingsMap> settings_map_; scoped_refptr<content_settings::CookieSettings> cookie_settings_; @@ -451,11 +469,11 @@ prefs_.GetDictionary(AccountConsistencyService::kDomainsWithCookiePref); EXPECT_EQ(2u, dict->size()); - EXPECT_CALL(*gaia_cookie_manager_service_, ForceOnCookieChangeProcessing()) - .Times(1); account_consistency_service_->OnBrowsingDataRemoved(); dict = prefs_.GetDictionary(AccountConsistencyService::kDomainsWithCookiePref); + EXPECT_EQ( + 1u, gaia_cookie_manager_service_->CallsToForceOnCookieChangeProcessing()); EXPECT_EQ(0u, dict->size()); } @@ -468,9 +486,9 @@ AddPageLoadedExpectation(kGoogleUrl, false /* continue_navigation */); SimulateGaiaCookieManagerServiceLogout(false); - EXPECT_CALL(*gaia_cookie_manager_service_, ForceOnCookieChangeProcessing()) - .Times(1); account_consistency_service_->OnBrowsingDataRemoved(); + EXPECT_EQ( + 1u, gaia_cookie_manager_service_->CallsToForceOnCookieChangeProcessing()); EXPECT_TRUE(remove_cookie_callback_called_); }
diff --git a/components/sync/base/unique_position_unittest.cc b/components/sync/base/unique_position_unittest.cc index 4169946..08a1f28 100644 --- a/components/sync/base/unique_position_unittest.cc +++ b/components/sync/base/unique_position_unittest.cc
@@ -7,7 +7,6 @@ #include <algorithm> #include <functional> #include <memory> -#include <type_traits> #include <vector> #include "base/base64.h" @@ -216,7 +215,7 @@ // Exercise comparision functions by sorting and re-sorting the list. TEST_F(RelativePositioningTest, SortPositions) { ASSERT_EQ(kNumPositions, kNumSortedPositions); - UniquePosition positions[std::extent<decltype(kPositionArray)>()]; + UniquePosition positions[base::size(kPositionArray)]; for (size_t i = 0; i < kNumPositions; ++i) { positions[i] = kPositionArray[i]; } @@ -232,7 +231,7 @@ // Some more exercise for the comparison function. TEST_F(RelativePositioningTest, ReverseSortPositions) { ASSERT_EQ(kNumPositions, kNumSortedPositions); - UniquePosition positions[std::extent<decltype(kPositionArray)>()]; + UniquePosition positions[base::size(kPositionArray)]; for (size_t i = 0; i < kNumPositions; ++i) { positions[i] = kPositionArray[i]; }
diff --git a/components/sync/driver/glue/sync_backend_host_core.cc b/components/sync/driver/glue/sync_backend_host_core.cc index ccf1e3a..ae71dd5 100644 --- a/components/sync/driver/glue/sync_backend_host_core.cc +++ b/components/sync/driver/glue/sync_backend_host_core.cc
@@ -51,13 +51,13 @@ fetcher, data_use_measurement::DataUseUserData::SYNC); } -void RecordPerModelTypeInvalidation(int model_type, int number_of_ids) { +void RecordPerModelTypeInvalidation(int model_type, bool is_grouped) { UMA_HISTOGRAM_ENUMERATION("Sync.InvalidationPerModelType", model_type, static_cast<int>(syncer::MODEL_TYPE_COUNT)); - if (number_of_ids == 1) { + if (!is_grouped) { // When recording metrics it's important to distinguish between - // many/one case, since "many" case is only common in the deprecated - // implementation. + // many/one case, since "many" aka grouped case is only common in + // the deprecated implementation. UMA_HISTOGRAM_ENUMERATION("Sync.NonGroupedInvalidation", model_type, static_cast<int>(syncer::MODEL_TYPE_COUNT)); } @@ -266,7 +266,8 @@ ModelTypeToHistogramInt(type), static_cast<int>(MODEL_TYPE_COUNT)); - RecordPerModelTypeInvalidation(ModelTypeToHistogramInt(type), ids.size()); + bool is_grouped = (ids.size() != 1); + RecordPerModelTypeInvalidation(ModelTypeToHistogramInt(type), is_grouped); SingleObjectInvalidationSet invalidation_set = invalidation_map.ForObject(object_id); for (Invalidation invalidation : invalidation_set) { @@ -280,6 +281,11 @@ << last_invalidation->second; continue; } + if (!is_grouped && !invalidation.is_unknown_version()) { + UMA_HISTOGRAM_ENUMERATION("Sync.NonGroupedInvalidationKnownVersion", + ModelTypeToHistogramInt(type), + static_cast<int>(MODEL_TYPE_COUNT)); + } std::unique_ptr<InvalidationInterface> inv_adapter( new InvalidationAdapter(invalidation)); sync_manager_->OnIncomingInvalidation(type, std::move(inv_adapter));
diff --git a/components/sync_bookmarks/bookmark_model_type_processor.cc b/components/sync_bookmarks/bookmark_model_type_processor.cc index 4aebc03..27d7af9 100644 --- a/components/sync_bookmarks/bookmark_model_type_processor.cc +++ b/components/sync_bookmarks/bookmark_model_type_processor.cc
@@ -206,9 +206,9 @@ const bool got_new_encryption_requirements = bookmark_tracker_->model_type_state().encryption_key_name() != model_type_state.encryption_key_name(); - updates_handler.Process(updates, got_new_encryption_requirements); bookmark_tracker_->set_model_type_state( std::make_unique<sync_pb::ModelTypeState>(model_type_state)); + updates_handler.Process(updates, got_new_encryption_requirements); // Schedule save just in case one is needed. schedule_save_closure_.Run(); }
diff --git a/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc b/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc index ecd0bbdd..6bb9b2f4 100644 --- a/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc +++ b/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc
@@ -456,6 +456,43 @@ Eq(kEncryptionKeyName)); } +// This tests that when the encryption key changes, but the received entities +// are already encrypted with the up-to-date encryption key, no recommit is +// needed. +TEST_F(BookmarkModelTypeProcessorTest, + ShouldNotRecommitEntitiesWhenEncryptionIsUpToDate) { + SimulateModelReadyToSync(); + SimulateOnSyncStarting(); + // Initialize the process to make sure the tracker has been created. + InitWithSyncedBookmarks({}, processor()); + const SyncedBookmarkTracker* tracker = processor()->GetTrackerForTest(); + // The encryption key name should be empty. + ASSERT_TRUE(tracker->model_type_state().encryption_key_name().empty()); + + // Build a model type state with an encryption key name. + const std::string kEncryptionKeyName = "new_encryption_key_name"; + sync_pb::ModelTypeState model_type_state(CreateDummyModelTypeState()); + model_type_state.set_encryption_key_name(kEncryptionKeyName); + + // Push an update that is encrypted with the new encryption key. + const std::string kNodeId = "node_id"; + syncer::UpdateResponseData response_data = CreateUpdateResponseData( + {kNodeId, "title", "http://www.url.com", /*parent_id=*/kBookmarkBarId, + /*server_tag=*/std::string()}, + syncer::UniquePosition::InitialPosition( + syncer::UniquePosition::RandomSuffix()), + /*response_version=*/0); + response_data.encryption_key_name = kEncryptionKeyName; + + syncer::UpdateResponseDataList updates; + updates.push_back(response_data); + processor()->OnUpdateReceived(model_type_state, updates); + + // The bookmarks shouldn't be marked for committing. + ASSERT_THAT(tracker->GetEntityForSyncId(kNodeId), NotNull()); + EXPECT_THAT(tracker->GetEntityForSyncId(kNodeId)->IsUnsynced(), Eq(false)); +} + // Verifies that the processor doesn't crash if sync is stopped before receiving // remote updates or tracking metadata. TEST_F(BookmarkModelTypeProcessorTest, ShouldStopBeforeReceivingRemoteUpdates) {
diff --git a/components/sync_bookmarks/bookmark_remote_updates_handler.cc b/components/sync_bookmarks/bookmark_remote_updates_handler.cc index cb33c28..2f1a4c6 100644 --- a/components/sync_bookmarks/bookmark_remote_updates_handler.cc +++ b/components/sync_bookmarks/bookmark_remote_updates_handler.cc
@@ -190,6 +190,12 @@ if (tracked_entity && tracked_entity->IsUnsynced()) { ProcessConflict(*update, tracked_entity); + if (!bookmark_tracker_->GetEntityForSyncId(update_entity.id)) { + // During conflict resolution, the entity could be dropped in case of + // a conflict between local and remote deletions. We shouldn't worry + // about changes to the encryption in that case. + continue; + } } else if (update_entity.is_deleted()) { ProcessDelete(update_entity, tracked_entity); // If the local entity has been deleted, no need to check for out of date @@ -202,6 +208,9 @@ // the encryption. continue; } + // TODO(crbug.com/516866): The below CHECK is added to debug some crashes. + // Should be removed after figuring out the reason for the crash. + CHECK(bookmark_tracker_->GetEntityForSyncId(update_entity.id)); } else { // Ignore changes to the permanent nodes (e.g. bookmarks bar). We only // care about their children. @@ -209,6 +218,9 @@ continue; } ProcessUpdate(*update, tracked_entity); + // TODO(crbug.com/516866): The below CHECK is added to debug some crashes. + // Should be removed after figuring out the reason for the crash. + CHECK(bookmark_tracker_->GetEntityForSyncId(update_entity.id)); } // If the received entity has out of date encryption, we schedule another // commit to fix it. @@ -460,8 +472,6 @@ // TODO(crbug.com/516866): Handle the case of conflict as a result of // re-encryption request. - // TODO(crbug.com/516866): Add basic unit test for this function. - // Can only conflict with existing nodes. DCHECK(tracked_entity); DCHECK_EQ(tracked_entity,
diff --git a/components/sync_bookmarks/bookmark_remote_updates_handler.h b/components/sync_bookmarks/bookmark_remote_updates_handler.h index 8ba90f3..9ce5510 100644 --- a/components/sync_bookmarks/bookmark_remote_updates_handler.h +++ b/components/sync_bookmarks/bookmark_remote_updates_handler.h
@@ -85,11 +85,11 @@ const SyncedBookmarkTracker::Entity* tracked_entity); // Processes a conflict where the bookmark has been changed both locally and - // remotely. It applies the general policy the server wins expcet in the case + // remotely. It applies the general policy the server wins except in the case // of remote deletions in which local wins. |tracked_entity| is the tracked // entity for that server_id. It is passed as a dependency instead of - // performing a lookup inside ProcessDelete() to avoid wasting CPU - // cycles for doing another lookup (this code runs on the UI thread). + // performing a lookup inside ProcessDelete() to avoid wasting CPU cycles for + // doing another lookup (this code runs on the UI thread). void ProcessConflict(const syncer::UpdateResponseData& update, const SyncedBookmarkTracker::Entity* tracked_entity);
diff --git a/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc b/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc index c54db65..765909f 100644 --- a/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc +++ b/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc
@@ -10,12 +10,14 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/metrics/histogram_tester.h" #include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/test/test_bookmark_client.h" #include "components/favicon/core/test/mock_favicon_service.h" #include "components/sync/base/hash_util.h" #include "components/sync/base/model_type.h" #include "components/sync/base/unique_position.h" +#include "components/sync/model/conflict_resolution.h" #include "components/sync/protocol/unique_position.pb.h" #include "components/sync_bookmarks/bookmark_model_merger.h" #include "testing/gmock/include/gmock/gmock.h" @@ -33,7 +35,7 @@ namespace { // The parent tag for children of the root entity. Entities with this parent are -// referred to as top level enities. +// referred to as top level entities. const char kRootParentId[] = "0"; const char kBookmarksRootId[] = "root_id"; const char kBookmarkBarId[] = "bookmark_bar_id"; @@ -46,7 +48,9 @@ syncer::UpdateResponseData CreateUpdateResponseData( const std::string& server_id, const std::string& parent_id, + const std::string& title, bool is_deletion, + int version, const syncer::UniquePosition& unique_position) { syncer::EntityData data; data.id = server_id; @@ -57,14 +61,12 @@ if (!is_deletion) { sync_pb::BookmarkSpecifics* bookmark_specifics = data.specifics.mutable_bookmark(); - // Use the server id as the title for simplicity. - bookmark_specifics->set_title(server_id); + bookmark_specifics->set_title(title); } data.is_folder = true; syncer::UpdateResponseData response_data; response_data.entity = data.PassToPtr(); - // Similar to what's done in the loopback_server. - response_data.response_version = 0; + response_data.response_version = version; return response_data; } @@ -73,8 +75,10 @@ syncer::UpdateResponseData CreateUpdateResponseData( const std::string& server_id, const std::string& parent_id, - bool is_deletion) { - return CreateUpdateResponseData(server_id, parent_id, is_deletion, + bool is_deletion, + int version = 0) { + return CreateUpdateResponseData(server_id, parent_id, /*title=*/server_id, + is_deletion, version, syncer::UniquePosition::InitialPosition( syncer::UniquePosition::RandomSuffix())); } @@ -136,6 +140,32 @@ syncer::UniquePosition::RandomSuffix())); } +class BookmarkRemoteUpdatesHandlerWithInitialMergeTest : public testing::Test { + public: + BookmarkRemoteUpdatesHandlerWithInitialMergeTest() + : bookmark_model_(bookmarks::TestBookmarkClient::CreateModel()), + tracker_(std::vector<NodeMetadataPair>(), + std::make_unique<sync_pb::ModelTypeState>()), + updates_handler_(bookmark_model_.get(), &favicon_service_, &tracker_) { + const syncer::UpdateResponseDataList permanent_folder_updates = + CreatePermanentFoldersUpdateData(); + BookmarkModelMerger(&permanent_folder_updates, bookmark_model_.get(), + &favicon_service_, &tracker_) + .Merge(); + } + + bookmarks::BookmarkModel* bookmark_model() { return bookmark_model_.get(); } + SyncedBookmarkTracker* tracker() { return &tracker_; } + favicon::MockFaviconService* favicon_service() { return &favicon_service_; } + BookmarkRemoteUpdatesHandler* updates_handler() { return &updates_handler_; } + + private: + std::unique_ptr<bookmarks::BookmarkModel> bookmark_model_; + SyncedBookmarkTracker tracker_; + testing::NiceMock<favicon::MockFaviconService> favicon_service_; + BookmarkRemoteUpdatesHandler updates_handler_; +}; + TEST(BookmarkRemoteUpdatesHandlerReorderUpdatesTest, ShouldIgnoreRootNodes) { syncer::UpdateResponseDataList updates; updates.push_back(CreateBookmarkRootUpdateData()); @@ -205,27 +235,14 @@ EXPECT_THAT(ordered_updates[5]->entity.value().id, Eq(ids[6])); } -TEST(BookmarkRemoteUpdatesHandlerReorderUpdatesTest, - ShouldProcessRandomlyOrderedCreations) { +TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, + ShouldProcessRandomlyOrderedCreations) { // Prepare creation updates to construct this structure: // bookmark_bar // |- node0 // |- node1 // |- node2 - std::unique_ptr<bookmarks::BookmarkModel> bookmark_model = - bookmarks::TestBookmarkClient::CreateModel(); - SyncedBookmarkTracker tracker(std::vector<NodeMetadataPair>(), - std::make_unique<sync_pb::ModelTypeState>()); - const syncer::UpdateResponseDataList permanent_folder_updates = - CreatePermanentFoldersUpdateData(); - // TODO(crbug.com/516866): Create a test fixture that would encapsulate - // the merge functionality for all relevant tests. - testing::NiceMock<favicon::MockFaviconService> favicon_service; - BookmarkModelMerger(&permanent_folder_updates, bookmark_model.get(), - &favicon_service, &tracker) - .Merge(); - const std::string kId0 = "id0"; const std::string kId1 = "id1"; const std::string kId2 = "id2"; @@ -242,17 +259,16 @@ /*parent_id=*/kId0, /*is_deletion=*/false)); - BookmarkRemoteUpdatesHandler updates_handler(bookmark_model.get(), - &favicon_service, &tracker); - updates_handler.Process(updates, /*got_new_encryption_requirements=*/false); + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); // All nodes should be tracked including the "bookmark bar", "other // bookmarks" node and "mobile bookmarks". - EXPECT_THAT(tracker.TrackedEntitiesCountForTest(), Eq(6U)); + EXPECT_THAT(tracker()->TrackedEntitiesCountForTest(), Eq(6U)); // All nodes should have been added to the model. const bookmarks::BookmarkNode* bookmark_bar_node = - bookmark_model->bookmark_bar_node(); + bookmark_model()->bookmark_bar_node(); ASSERT_THAT(bookmark_bar_node->child_count(), Eq(1)); EXPECT_THAT(bookmark_bar_node->GetChild(0)->GetTitle(), Eq(ASCIIToUTF16(kId0))); @@ -269,89 +285,67 @@ Eq(0)); } -TEST(BookmarkRemoteUpdatesHandlerReorderUpdatesTest, - ShouldProcessRandomlyOrderedDeletions) { - // Prepare deletion updates for this structure: +TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, + ShouldProcessRandomlyOrderedDeletions) { + // Prepare creation updates to construct this structure: // bookmark_bar // |- node0 // |- node1 // |- node2 - std::unique_ptr<bookmarks::BookmarkModel> bookmark_model = - bookmarks::TestBookmarkClient::CreateModel(); - - const bookmarks::BookmarkNode* bookmark_bar_node = - bookmark_model->bookmark_bar_node(); - const bookmarks::BookmarkNode* node0 = bookmark_model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("node0")); - const bookmarks::BookmarkNode* node1 = bookmark_model->AddFolder( - /*parent=*/node0, /*index=*/0, base::UTF8ToUTF16("node1")); - const bookmarks::BookmarkNode* node2 = bookmark_model->AddFolder( - /*parent=*/node1, /*index=*/0, base::UTF8ToUTF16("node2")); - const std::string kId0 = "id0"; const std::string kId1 = "id1"; const std::string kId2 = "id2"; - std::vector<NodeMetadataPair> node_metadata_pairs; - - // Add permanent folders. - node_metadata_pairs.emplace_back(bookmark_bar_node, - CreateEntityMetadata(kBookmarkBarId)); - node_metadata_pairs.emplace_back(bookmark_model->other_node(), - CreateEntityMetadata(kOtherBookmarksId)); - node_metadata_pairs.emplace_back(bookmark_model->mobile_node(), - CreateEntityMetadata(kMobileBookmarksId)); - - node_metadata_pairs.emplace_back(node0, - CreateEntityMetadata(/*server_id=*/kId0)); - node_metadata_pairs.emplace_back(node1, - CreateEntityMetadata(/*server_id=*/kId1)); - node_metadata_pairs.emplace_back(node2, - CreateEntityMetadata(/*server_id=*/kId2)); - - SyncedBookmarkTracker tracker(std::move(node_metadata_pairs), - std::make_unique<sync_pb::ModelTypeState>()); - - // Constuct the updates list to have random deletions order. + // Construct the updates list to create that structure syncer::UpdateResponseDataList updates; + updates.push_back(CreateUpdateResponseData(/*server_id=*/kId0, + /*parent_id=*/kBookmarkBarId, + /*is_deletion=*/false)); updates.push_back(CreateUpdateResponseData(/*server_id=*/kId1, /*parent_id=*/kId0, - /*is_deletion=*/true)); - updates.push_back(CreateUpdateResponseData(/*server_id=*/kId0, - /*parent_id=*/kBookmarksRootId, - /*is_deletion=*/true)); + /*is_deletion=*/false)); updates.push_back(CreateUpdateResponseData(/*server_id=*/kId2, /*parent_id=*/kId1, - /*is_deletion=*/true)); - testing::NiceMock<favicon::MockFaviconService> favicon_service; - BookmarkRemoteUpdatesHandler updates_handler(bookmark_model.get(), - &favicon_service, &tracker); - updates_handler.Process(updates, /*got_new_encryption_requirements=*/false); + /*is_deletion=*/false)); + + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); + + // All nodes should be tracked including the "bookmark bar", "other + // bookmarks" node and "mobile bookmarks". + EXPECT_THAT(tracker()->TrackedEntitiesCountForTest(), Eq(6U)); + + // Construct the updates list to have random deletions order. + updates.clear(); + updates.push_back(CreateUpdateResponseData(/*server_id=*/kId1, + /*parent_id=*/kId0, + /*is_deletion=*/true, + /*version=*/1)); + updates.push_back(CreateUpdateResponseData(/*server_id=*/kId0, + /*parent_id=*/kBookmarksRootId, + /*is_deletion=*/true, + /*version=*/1)); + updates.push_back(CreateUpdateResponseData(/*server_id=*/kId2, + /*parent_id=*/kId1, + /*is_deletion=*/true, + /*version=*/1)); + + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); // |tracker| should have only permanent nodes now. - EXPECT_THAT(tracker.TrackedEntitiesCountForTest(), Eq(3U)); + EXPECT_THAT(tracker()->TrackedEntitiesCountForTest(), Eq(3U)); } -TEST(BookmarkRemoteUpdatesHandlerReorderUpdatesTest, - ShouldPositionRemoteCreations) { +TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, + ShouldPositionRemoteCreations) { // Prepare creation updates to construct this structure: // bookmark_bar // |- node0 // |- node1 // |- node2 - std::unique_ptr<bookmarks::BookmarkModel> bookmark_model = - bookmarks::TestBookmarkClient::CreateModel(); - SyncedBookmarkTracker tracker(std::vector<NodeMetadataPair>(), - std::make_unique<sync_pb::ModelTypeState>()); - const syncer::UpdateResponseDataList permanent_folder_updates = - CreatePermanentFoldersUpdateData(); - testing::NiceMock<favicon::MockFaviconService> favicon_service; - BookmarkModelMerger(&permanent_folder_updates, bookmark_model.get(), - &favicon_service, &tracker) - .Merge(); - const std::string kId0 = "id0"; const std::string kId1 = "id1"; const std::string kId2 = "id2"; @@ -366,23 +360,24 @@ // Constuct the updates list to have creations randomly ordered. syncer::UpdateResponseDataList updates; updates.push_back(CreateUpdateResponseData( - /*server_id=*/kId2, /*parent_id=*/kBookmarkBarId, - /*is_deletion=*/false, /*unique_position=*/pos2)); + /*server_id=*/kId2, /*parent_id=*/kBookmarkBarId, /*title=*/kId2, + /*is_deletion=*/false, /*version=*/0, /*unique_position=*/pos2)); updates.push_back(CreateUpdateResponseData(/*server_id=*/kId0, /*parent_id=*/kBookmarkBarId, + /*title=*/kId0, /*is_deletion=*/false, + /*version=*/0, /*unique_position=*/pos0)); updates.push_back(CreateUpdateResponseData( - /*server_id=*/kId1, /*parent_id=*/kBookmarkBarId, - /*is_deletion=*/false, /*unique_position=*/pos1)); + /*server_id=*/kId1, /*parent_id=*/kBookmarkBarId, /*title=*/kId1, + /*is_deletion=*/false, /*version=*/0, /*unique_position=*/pos1)); - BookmarkRemoteUpdatesHandler updates_handler(bookmark_model.get(), - &favicon_service, &tracker); - updates_handler.Process(updates, /*got_new_encryption_requirements=*/false); + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); // All nodes should have been added to the model in the correct order. const bookmarks::BookmarkNode* bookmark_bar_node = - bookmark_model->bookmark_bar_node(); + bookmark_model()->bookmark_bar_node(); ASSERT_THAT(bookmark_bar_node->child_count(), Eq(3)); EXPECT_THAT(bookmark_bar_node->GetChild(0)->GetTitle(), Eq(ASCIIToUTF16(kId0))); @@ -392,8 +387,8 @@ Eq(ASCIIToUTF16(kId2))); } -TEST(BookmarkRemoteUpdatesHandlerReorderUpdatesTest, - ShouldPositionRemoteMovesToTheLeft) { +TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, + ShouldPositionRemoteMovesToTheLeft) { // Start with structure: // bookmark_bar // |- node0 @@ -402,41 +397,29 @@ // |- node3 // |- node4 - std::unique_ptr<bookmarks::BookmarkModel> bookmark_model = - bookmarks::TestBookmarkClient::CreateModel(); - const bookmarks::BookmarkNode* bookmark_bar_node = - bookmark_model->bookmark_bar_node(); - std::vector<std::string> ids; - std::vector<const bookmarks::BookmarkNode*> nodes; std::vector<syncer::UniquePosition> positions; - std::vector<NodeMetadataPair> node_metadata_pairs; - - // Add permanent folders. - node_metadata_pairs.emplace_back(bookmark_bar_node, - CreateEntityMetadata(kBookmarkBarId)); - node_metadata_pairs.emplace_back(bookmark_model->other_node(), - CreateEntityMetadata(kOtherBookmarksId)); - node_metadata_pairs.emplace_back(bookmark_model->mobile_node(), - CreateEntityMetadata(kMobileBookmarksId)); syncer::UniquePosition position = syncer::UniquePosition::InitialPosition( syncer::UniquePosition::RandomSuffix()); + syncer::UpdateResponseDataList updates; for (int i = 0; i < 5; i++) { ids.push_back("node" + base::NumberToString(i)); - // Use ids as node titles for simplicity and to match CreateEntityMetadata() - // implementation. - nodes.push_back(bookmark_model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/i, base::UTF8ToUTF16(ids[i]))); position = syncer::UniquePosition::After( position, syncer::UniquePosition::RandomSuffix()); positions.push_back(position); - node_metadata_pairs.emplace_back( - nodes[i], CreateEntityMetadata(ids[i], positions[i])); + updates.push_back(CreateUpdateResponseData( + /*server_id=*/ids[i], /*parent_id=*/kBookmarkBarId, /*title=*/ids[i], + /*is_deletion=*/false, /*version=*/0, + /*unique_position=*/positions[i])); } - SyncedBookmarkTracker tracker(std::move(node_metadata_pairs), - std::make_unique<sync_pb::ModelTypeState>()); + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); + const bookmarks::BookmarkNode* bookmark_bar_node = + bookmark_model()->bookmark_bar_node(); + EXPECT_THAT(bookmark_bar_node->child_count(), Eq(5)); + // Change it to this structure by moving node3 after node1. // bookmark_bar // |- node0 @@ -445,18 +428,18 @@ // |- node2 // |- node4 - syncer::UpdateResponseDataList updates; + updates.clear(); updates.push_back(CreateUpdateResponseData( /*server_id=*/ids[3], /*parent_id=*/kBookmarkBarId, + /*title=*/ids[3], /*is_deletion=*/false, + /*version=*/1, /*unique_position=*/ syncer::UniquePosition::Between(positions[1], positions[2], syncer::UniquePosition::RandomSuffix()))); - testing::NiceMock<favicon::MockFaviconService> favicon_service; - BookmarkRemoteUpdatesHandler updates_handler(bookmark_model.get(), - &favicon_service, &tracker); - updates_handler.Process(updates, /*got_new_encryption_requirements=*/false); + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); // Model should have been updated. ASSERT_THAT(bookmark_bar_node->child_count(), Eq(5)); @@ -464,8 +447,8 @@ Eq(ASCIIToUTF16(ids[3]))); } -TEST(BookmarkRemoteUpdatesHandlerReorderUpdatesTest, - ShouldPositionRemoteMovesToTheRight) { +TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, + ShouldPositionRemoteMovesToTheRight) { // Start with structure: // bookmark_bar // |- node0 @@ -474,41 +457,28 @@ // |- node3 // |- node4 - std::unique_ptr<bookmarks::BookmarkModel> bookmark_model = - bookmarks::TestBookmarkClient::CreateModel(); - const bookmarks::BookmarkNode* bookmark_bar_node = - bookmark_model->bookmark_bar_node(); - std::vector<std::string> ids; - std::vector<const bookmarks::BookmarkNode*> nodes; std::vector<syncer::UniquePosition> positions; - std::vector<NodeMetadataPair> node_metadata_pairs; - - // Add permanent folders. - node_metadata_pairs.emplace_back(bookmark_bar_node, - CreateEntityMetadata(kBookmarkBarId)); - node_metadata_pairs.emplace_back(bookmark_model->other_node(), - CreateEntityMetadata(kOtherBookmarksId)); - node_metadata_pairs.emplace_back(bookmark_model->mobile_node(), - CreateEntityMetadata(kMobileBookmarksId)); syncer::UniquePosition position = syncer::UniquePosition::InitialPosition( syncer::UniquePosition::RandomSuffix()); + syncer::UpdateResponseDataList updates; for (int i = 0; i < 5; i++) { ids.push_back("node" + base::NumberToString(i)); - // Use ids as node titles for simplcity and to match CreateEntityMetadata() - // implementation. - nodes.push_back(bookmark_model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/i, base::UTF8ToUTF16(ids[i]))); position = syncer::UniquePosition::After( position, syncer::UniquePosition::RandomSuffix()); positions.push_back(position); - node_metadata_pairs.emplace_back( - nodes[i], CreateEntityMetadata(ids[i], positions[i])); + updates.push_back(CreateUpdateResponseData( + /*server_id=*/ids[i], /*parent_id=*/kBookmarkBarId, /*title=*/ids[i], + /*is_deletion=*/false, /*version=*/0, + /*unique_position=*/positions[i])); } - SyncedBookmarkTracker tracker(std::move(node_metadata_pairs), - std::make_unique<sync_pb::ModelTypeState>()); + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); + const bookmarks::BookmarkNode* bookmark_bar_node = + bookmark_model()->bookmark_bar_node(); + EXPECT_THAT(bookmark_bar_node->child_count(), Eq(5)); // Change it to this structure by moving node1 after node3. // bookmark_bar @@ -518,18 +488,18 @@ // |- node1 // |- node4 - syncer::UpdateResponseDataList updates; + updates.clear(); updates.push_back(CreateUpdateResponseData( /*server_id=*/ids[1], /*parent_id=*/kBookmarkBarId, + /*title=*/ids[1], /*is_deletion=*/false, + /*version=*/1, /*unique_position=*/ syncer::UniquePosition::Between(positions[3], positions[4], syncer::UniquePosition::RandomSuffix()))); - testing::NiceMock<favicon::MockFaviconService> favicon_service; - BookmarkRemoteUpdatesHandler updates_handler(bookmark_model.get(), - &favicon_service, &tracker); - updates_handler.Process(updates, /*got_new_encryption_requirements=*/false); + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); // Model should have been updated. ASSERT_THAT(bookmark_bar_node->child_count(), Eq(5)); @@ -537,8 +507,8 @@ Eq(ASCIIToUTF16(ids[1]))); } -TEST(BookmarkRemoteUpdatesHandlerReorderUpdatesTest, - ShouldPositionRemoteReparenting) { +TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, + ShouldPositionRemoteReparenting) { // Start with structure: // bookmark_bar // |- node0 @@ -547,41 +517,28 @@ // |- node3 // |- node4 - std::unique_ptr<bookmarks::BookmarkModel> bookmark_model = - bookmarks::TestBookmarkClient::CreateModel(); - const bookmarks::BookmarkNode* bookmark_bar_node = - bookmark_model->bookmark_bar_node(); - std::vector<std::string> ids; - std::vector<const bookmarks::BookmarkNode*> nodes; std::vector<syncer::UniquePosition> positions; - std::vector<NodeMetadataPair> node_metadata_pairs; - - // Add permanent folders. - node_metadata_pairs.emplace_back(bookmark_bar_node, - CreateEntityMetadata(kBookmarkBarId)); - node_metadata_pairs.emplace_back(bookmark_model->other_node(), - CreateEntityMetadata(kOtherBookmarksId)); - node_metadata_pairs.emplace_back(bookmark_model->mobile_node(), - CreateEntityMetadata(kMobileBookmarksId)); syncer::UniquePosition position = syncer::UniquePosition::InitialPosition( syncer::UniquePosition::RandomSuffix()); + syncer::UpdateResponseDataList updates; for (int i = 0; i < 5; i++) { ids.push_back("node" + base::NumberToString(i)); - // Use ids as node titles for simplcity and to match CreateEntityMetadata() - // implementation. - nodes.push_back(bookmark_model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/i, base::UTF8ToUTF16(ids[i]))); position = syncer::UniquePosition::After( position, syncer::UniquePosition::RandomSuffix()); positions.push_back(position); - node_metadata_pairs.emplace_back( - nodes[i], CreateEntityMetadata(ids[i], positions[i])); + updates.push_back(CreateUpdateResponseData( + /*server_id=*/ids[i], /*parent_id=*/kBookmarkBarId, /*title=*/ids[i], + /*is_deletion=*/false, /*version=*/0, + /*unique_position=*/positions[i])); } - SyncedBookmarkTracker tracker(std::move(node_metadata_pairs), - std::make_unique<sync_pb::ModelTypeState>()); + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); + const bookmarks::BookmarkNode* bookmark_bar_node = + bookmark_model()->bookmark_bar_node(); + EXPECT_THAT(bookmark_bar_node->child_count(), Eq(5)); // Change it to this structure by moving node4 under node1. // bookmark_bar @@ -591,18 +548,18 @@ // |- node2 // |- node3 - syncer::UpdateResponseDataList updates; + updates.clear(); updates.push_back(CreateUpdateResponseData( /*server_id=*/ids[4], /*parent_id=*/ids[1], + /*title=*/ids[4], /*is_deletion=*/false, + /*version=*/1, /*unique_position=*/ syncer::UniquePosition::InitialPosition( syncer::UniquePosition::RandomSuffix()))); - testing::NiceMock<favicon::MockFaviconService> favicon_service; - BookmarkRemoteUpdatesHandler updates_handler(bookmark_model.get(), - &favicon_service, &tracker); - updates_handler.Process(updates, /*got_new_encryption_requirements=*/false); + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); // Model should have been updated. ASSERT_THAT(bookmark_bar_node->child_count(), Eq(4)); @@ -611,24 +568,12 @@ Eq(ASCIIToUTF16(ids[4]))); } -TEST(BookmarkRemoteUpdatesHandlerReorderUpdatesTest, - ShouldMergeFaviconUponRemoteCreationsWithFavicon) { +TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, + ShouldMergeFaviconUponRemoteCreationsWithFavicon) { // Prepare creation updates to construct this structure: // bookmark_bar // |- node0 - std::unique_ptr<bookmarks::BookmarkModel> bookmark_model = - bookmarks::TestBookmarkClient::CreateModel(); - SyncedBookmarkTracker tracker(std::vector<NodeMetadataPair>(), - std::make_unique<sync_pb::ModelTypeState>()); - const syncer::UpdateResponseDataList permanent_folder_updates = - CreatePermanentFoldersUpdateData(); - // TODO(crbug.com/516866): Create a test fixture that would encapsulate - // the merge functionality for all relevant tests. - testing::NiceMock<favicon::MockFaviconService> favicon_service; - BookmarkModelMerger(&permanent_folder_updates, bookmark_model.get(), - &favicon_service, &tracker) - .Merge(); const std::string kTitle = "Title"; const GURL kUrl("http://www.url.com"); const GURL kIconUrl("http://www.icon-url.com"); @@ -655,32 +600,19 @@ updates.push_back(response_data); - BookmarkRemoteUpdatesHandler updates_handler(bookmark_model.get(), - &favicon_service, &tracker); - EXPECT_CALL(favicon_service, + EXPECT_CALL(*favicon_service(), AddPageNoVisitForBookmark(kUrl, base::UTF8ToUTF16(kTitle))); - EXPECT_CALL(favicon_service, MergeFavicon(kUrl, kIconUrl, _, _, _)); - updates_handler.Process(updates, /*got_new_encryption_requirements=*/false); + EXPECT_CALL(*favicon_service(), MergeFavicon(kUrl, kIconUrl, _, _, _)); + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); } -TEST(BookmarkRemoteUpdatesHandlerReorderUpdatesTest, - ShouldDeleteFaviconUponRemoteCreationsWithoutFavicon) { +TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, + ShouldDeleteFaviconUponRemoteCreationsWithoutFavicon) { // Prepare creation updates to construct this structure: // bookmark_bar // |- node0 - std::unique_ptr<bookmarks::BookmarkModel> bookmark_model = - bookmarks::TestBookmarkClient::CreateModel(); - SyncedBookmarkTracker tracker(std::vector<NodeMetadataPair>(), - std::make_unique<sync_pb::ModelTypeState>()); - const syncer::UpdateResponseDataList permanent_folder_updates = - CreatePermanentFoldersUpdateData(); - // TODO(crbug.com/516866): Create a test fixture that would encapsulate - // the merge functionality for all relevant tests. - testing::NiceMock<favicon::MockFaviconService> favicon_service; - BookmarkModelMerger(&permanent_folder_updates, bookmark_model.get(), - &favicon_service, &tracker) - .Merge(); const std::string kTitle = "Title"; const GURL kUrl("http://www.url.com"); @@ -704,18 +636,17 @@ updates.push_back(response_data); - BookmarkRemoteUpdatesHandler updates_handler(bookmark_model.get(), - &favicon_service, &tracker); - EXPECT_CALL(favicon_service, + EXPECT_CALL(*favicon_service(), DeleteFaviconMappings(ElementsAre(kUrl), favicon_base::IconType::kFavicon)); - updates_handler.Process(updates, /*got_new_encryption_requirements=*/false); + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); } // This tests the case when a local creation is successfully committed to the // server but the commit respone isn't received for some reason. Further updates // to that entity should update the sync id in the tracker. -TEST(BookmarkRemoteUpdatesHandlerReorderUpdatesTest, +TEST(BookmarkRemoteUpdatesHandlerTest, ShouldUpdateSyncIdWhenRecevingAnUpdateForNewlyCreatedLocalNode) { const std::string kCacheGuid = "generated_id"; const std::string kOriginatorClientItemId = "tmp_server_id"; @@ -789,8 +720,8 @@ EXPECT_THAT(entity->bookmark_node(), Eq(&node)); } -TEST(BookmarkRemoteUpdatesHandlerReorderUpdatesTest, - ShouldRecommitWhenEncryptionKeyNameMistmatch) { +TEST(BookmarkRemoteUpdatesHandlerTest, + ShouldRecommitWhenEncryptionIsOutOfDate) { std::unique_ptr<bookmarks::BookmarkModel> bookmark_model = bookmarks::TestBookmarkClient::CreateModel(); auto model_type_state = std::make_unique<sync_pb::ModelTypeState>(); @@ -811,7 +742,7 @@ CreateUpdateResponseData(/*server_id=*/kId0, /*parent_id=*/kBookmarkBarId, /*is_deletion=*/false); - response_data.encryption_key_name = "another_encryption_key_name"; + response_data.encryption_key_name = "out_of_date_encryption_key_name"; updates.push_back(response_data); BookmarkRemoteUpdatesHandler updates_handler(bookmark_model.get(), @@ -821,46 +752,35 @@ EXPECT_THAT(tracker.GetEntityForSyncId(kId0)->IsUnsynced(), Eq(true)); } -TEST(BookmarkRemoteUpdatesHandlerReorderUpdatesTest, - ShouldRecommitWhenGotNewEncryptionRequirements) { - std::unique_ptr<bookmarks::BookmarkModel> bookmark_model = - bookmarks::TestBookmarkClient::CreateModel(); - SyncedBookmarkTracker tracker(std::vector<NodeMetadataPair>(), - std::make_unique<sync_pb::ModelTypeState>()); - - const syncer::UpdateResponseDataList permanent_folder_updates = - CreatePermanentFoldersUpdateData(); - testing::NiceMock<favicon::MockFaviconService> favicon_service; - BookmarkModelMerger(&permanent_folder_updates, bookmark_model.get(), - &favicon_service, &tracker) - .Merge(); - +TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, + ShouldRecommitWhenGotNewEncryptionRequirements) { const std::string kId0 = "id0"; syncer::UpdateResponseDataList updates; updates.push_back(CreateUpdateResponseData(/*server_id=*/kId0, /*parent_id=*/kBookmarkBarId, /*is_deletion=*/false)); - BookmarkRemoteUpdatesHandler updates_handler(bookmark_model.get(), - &favicon_service, &tracker); - updates_handler.Process(updates, /*got_new_encryption_requirements=*/false); - ASSERT_THAT(tracker.GetEntityForSyncId(kId0), NotNull()); - EXPECT_THAT(tracker.GetEntityForSyncId(kId0)->IsUnsynced(), Eq(false)); + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); + ASSERT_THAT(tracker()->GetEntityForSyncId(kId0), NotNull()); + EXPECT_THAT(tracker()->GetEntityForSyncId(kId0)->IsUnsynced(), Eq(false)); - updates_handler.Process({}, /*got_new_encryption_requirements=*/true); - EXPECT_THAT(tracker.GetEntityForSyncId(kId0)->IsUnsynced(), Eq(true)); + updates_handler()->Process({}, /*got_new_encryption_requirements=*/true); + EXPECT_THAT(tracker()->GetEntityForSyncId(kId0)->IsUnsynced(), Eq(true)); // Permanent nodes shouldn't be committed. They are only created on the server // and synced down. - EXPECT_THAT(tracker.GetEntityForSyncId(kBookmarkBarId)->IsUnsynced(), + EXPECT_THAT(tracker()->GetEntityForSyncId(kBookmarkBarId)->IsUnsynced(), Eq(false)); } TEST(BookmarkRemoteUpdatesHandlerReorderUpdatesTest, - ShouldNotRecommitUptoDateEntitiesWhenGotNewEncryptionRequirements) { + ShouldNotRecommitWhenEncryptionKeyNameMistmatchWithConflictWithDeletions) { std::unique_ptr<bookmarks::BookmarkModel> bookmark_model = bookmarks::TestBookmarkClient::CreateModel(); + auto model_type_state = std::make_unique<sync_pb::ModelTypeState>(); + model_type_state->set_encryption_key_name("encryption_key_name"); SyncedBookmarkTracker tracker(std::vector<NodeMetadataPair>(), - std::make_unique<sync_pb::ModelTypeState>()); + std::move(model_type_state)); const syncer::UpdateResponseDataList permanent_folder_updates = CreatePermanentFoldersUpdateData(); @@ -868,18 +788,70 @@ BookmarkModelMerger(&permanent_folder_updates, bookmark_model.get(), &favicon_service, &tracker) .Merge(); + // Create the bookmark with same encryption key name. + const std::string kId = "id"; + const std::string kTitle = "title"; + syncer::UpdateResponseDataList updates; + syncer::UpdateResponseData response_data = + CreateUpdateResponseData(/*server_id=*/kId, + /*parent_id=*/kBookmarkBarId, + /*is_deletion=*/false); + response_data.encryption_key_name = "encryption_key_name"; + updates.push_back(response_data); + BookmarkRemoteUpdatesHandler updates_handler(bookmark_model.get(), + &favicon_service, &tracker); + updates_handler.Process(updates, /*got_new_encryption_requirements=*/false); + // The bookmark has been added and tracked. + const bookmarks::BookmarkNode* bookmark_bar_node = + bookmark_model->bookmark_bar_node(); + ASSERT_THAT(bookmark_bar_node->child_count(), Eq(1)); + ASSERT_THAT(tracker.GetEntityForSyncId(kId), NotNull()); + + // Remove the bookmark from the local bookmark model. + bookmark_model->Remove(bookmark_bar_node->GetChild(0)); + ASSERT_THAT(bookmark_bar_node->child_count(), Eq(0)); + + // Mark the entity as deleted locally. + tracker.MarkDeleted(/*sync_id=*/kId); + tracker.IncrementSequenceNumber(/*sync_id=*/kId); + ASSERT_THAT(tracker.GetEntityForSyncId(kId)->IsUnsynced(), Eq(true)); + + // Push a remote deletion for the same entity with an out of date encryption + // key name. + updates.clear(); + response_data = CreateUpdateResponseData(/*server_id=*/kId, + /*parent_id=*/kBookmarkBarId, + /*is_deletion=*/true); + response_data.encryption_key_name = "out_of_date_encryption_key_name"; + // Increment the server version to make sure the update isn't discarded as + // reflection. + response_data.response_version++; + updates.push_back(response_data); + + base::HistogramTester histogram_tester; + updates_handler.Process(updates, /*got_new_encryption_requirements=*/false); + + // There should have been conflict, and it should have been resolved by + // removing local entity since both changes are deletions. + EXPECT_THAT(tracker.GetEntityForSyncId(kId), IsNull()); + histogram_tester.ExpectBucketCount( + "Sync.ResolveConflict", + /*sample=*/syncer::ConflictResolution::CHANGES_MATCH, /*count=*/1); +} + +TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, + ShouldNotRecommitUptoDateEntitiesWhenGotNewEncryptionRequirements) { const std::string kId0 = "id0"; syncer::UpdateResponseDataList updates; updates.push_back(CreateUpdateResponseData(/*server_id=*/kId0, /*parent_id=*/kBookmarkBarId, /*is_deletion=*/false)); - BookmarkRemoteUpdatesHandler updates_handler(bookmark_model.get(), - &favicon_service, &tracker); - updates_handler.Process(updates, /*got_new_encryption_requirements=*/false); - ASSERT_THAT(tracker.GetEntityForSyncId(kId0), NotNull()); - EXPECT_THAT(tracker.GetEntityForSyncId(kId0)->IsUnsynced(), Eq(false)); + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); + ASSERT_THAT(tracker()->GetEntityForSyncId(kId0), NotNull()); + EXPECT_THAT(tracker()->GetEntityForSyncId(kId0)->IsUnsynced(), Eq(false)); // Push another update to for the same entity. syncer::UpdateResponseData response_data = @@ -890,9 +862,295 @@ // Increment the server version to make sure the update isn't discarded as // reflection. response_data.response_version++; - updates_handler.Process({response_data}, - /*got_new_encryption_requirements=*/true); - EXPECT_THAT(tracker.GetEntityForSyncId(kId0)->IsUnsynced(), Eq(false)); + updates_handler()->Process({response_data}, + /*got_new_encryption_requirements=*/true); + EXPECT_THAT(tracker()->GetEntityForSyncId(kId0)->IsUnsynced(), Eq(false)); +} + +TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, + ShouldResolveConflictBetweenLocalAndRemoteDeletionsByMatchingThem) { + const std::string kId = "id"; + const std::string kTitle = "title"; + + syncer::UpdateResponseDataList updates; + + updates.push_back(CreateUpdateResponseData( + /*server_id=*/kId, + /*parent_id=*/kBookmarkBarId, + /*title=*/kTitle, + /*is_deletion=*/false, + /*version=*/0, + /*unique_position=*/ + syncer::UniquePosition::InitialPosition( + syncer::UniquePosition::RandomSuffix()))); + + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); + ASSERT_THAT(tracker()->GetEntityForSyncId(kId), NotNull()); + ASSERT_THAT(tracker()->GetEntityForSyncId(kId)->IsUnsynced(), Eq(false)); + const bookmarks::BookmarkNode* bookmark_bar_node = + bookmark_model()->bookmark_bar_node(); + ASSERT_THAT(bookmark_bar_node->child_count(), Eq(1)); + + // Remove the bookmark from the local bookmark model. + bookmark_model()->Remove(bookmark_bar_node->GetChild(0)); + ASSERT_THAT(bookmark_bar_node->child_count(), Eq(0)); + + // Mark the entity as deleted locally. + tracker()->MarkDeleted(/*sync_id=*/kId); + tracker()->IncrementSequenceNumber(/*sync_id=*/kId); + ASSERT_THAT(tracker()->GetEntityForSyncId(kId)->IsUnsynced(), Eq(true)); + + // Push a remote deletion for the same entity. + updates.clear(); + updates.push_back(CreateUpdateResponseData( + /*server_id=*/kId, + /*parent_id=*/kBookmarkBarId, + /*title=*/std::string(), + /*is_deletion=*/true, + /*version=*/1, + /*unique_position=*/ + syncer::UniquePosition::InitialPosition( + syncer::UniquePosition::RandomSuffix()))); + + base::HistogramTester histogram_tester; + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); + + // There should have been conflict, and it should have been resolved by + // removing local entity since both changes. + EXPECT_THAT(tracker()->GetEntityForSyncId(kId), IsNull()); + // Make sure the bookmark hasn't been resurrected. + EXPECT_THAT(bookmark_bar_node->child_count(), Eq(0)); + + histogram_tester.ExpectBucketCount( + "Sync.ResolveConflict", + /*sample=*/syncer::ConflictResolution::CHANGES_MATCH, /*count=*/1); +} + +TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, + ShouldResolveConflictBetweenLocalUpdateAndRemoteDeletionWithLocal) { + const std::string kId = "id"; + const std::string kTitle = "title"; + + syncer::UpdateResponseDataList updates; + + updates.push_back(CreateUpdateResponseData( + /*server_id=*/kId, + /*parent_id=*/kBookmarkBarId, + /*title=*/kTitle, + /*is_deletion=*/false, + /*version=*/0, + /*unique_position=*/ + syncer::UniquePosition::InitialPosition( + syncer::UniquePosition::RandomSuffix()))); + + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); + ASSERT_THAT(tracker()->GetEntityForSyncId(kId), NotNull()); + ASSERT_THAT(tracker()->GetEntityForSyncId(kId)->IsUnsynced(), Eq(false)); + + // Mark the entity as modified locally. + tracker()->IncrementSequenceNumber(/*sync_id=*/kId); + ASSERT_THAT(tracker()->GetEntityForSyncId(kId)->IsUnsynced(), Eq(true)); + + // Push a remote deletion for the same entity. + updates.clear(); + updates.push_back(CreateUpdateResponseData( + /*server_id=*/kId, + /*parent_id=*/kBookmarkBarId, + /*title=*/std::string(), + /*is_deletion=*/true, + /*version=*/1, + /*unique_position=*/ + syncer::UniquePosition::InitialPosition( + syncer::UniquePosition::RandomSuffix()))); + + base::HistogramTester histogram_tester; + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); + + // There should have been conflict, and it should have been resolved with the + // local version that will be committed later. + EXPECT_THAT(tracker()->GetEntityForSyncId(kId)->IsUnsynced(), Eq(true)); + const bookmarks::BookmarkNode* bookmark_bar_node = + bookmark_model()->bookmark_bar_node(); + EXPECT_THAT(bookmark_bar_node->child_count(), Eq(1)); + + histogram_tester.ExpectBucketCount( + "Sync.ResolveConflict", + /*sample=*/syncer::ConflictResolution::USE_LOCAL, /*count=*/1); +} + +TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, + ShouldResolveConflictBetweenLocalDeletionAndRemoteUpdateByRemote) { + const std::string kId = "id"; + const std::string kTitle = "title"; + + syncer::UpdateResponseDataList updates; + + updates.push_back(CreateUpdateResponseData( + /*server_id=*/kId, + /*parent_id=*/kBookmarkBarId, + /*title=*/kTitle, + /*is_deletion=*/false, + /*version=*/0, + /*unique_position=*/ + syncer::UniquePosition::InitialPosition( + syncer::UniquePosition::RandomSuffix()))); + + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); + ASSERT_THAT(tracker()->GetEntityForSyncId(kId), NotNull()); + ASSERT_THAT(tracker()->GetEntityForSyncId(kId)->IsUnsynced(), Eq(false)); + const bookmarks::BookmarkNode* bookmark_bar_node = + bookmark_model()->bookmark_bar_node(); + ASSERT_THAT(bookmark_bar_node->child_count(), Eq(1)); + + // Remove the bookmark from the local bookmark model. + bookmark_model()->Remove(bookmark_bar_node->GetChild(0)); + ASSERT_THAT(bookmark_bar_node->child_count(), Eq(0)); + + // Mark the entity as deleted locally. + tracker()->MarkDeleted(/*sync_id=*/kId); + tracker()->IncrementSequenceNumber(/*sync_id=*/kId); + ASSERT_THAT(tracker()->GetEntityForSyncId(kId)->IsUnsynced(), Eq(true)); + + // Push an update for the same entity. + updates.clear(); + updates.push_back(CreateUpdateResponseData( + /*server_id=*/kId, + /*parent_id=*/kBookmarkBarId, + /*title=*/kTitle, + /*is_deletion=*/false, + /*version=*/1, + /*unique_position=*/ + syncer::UniquePosition::InitialPosition( + syncer::UniquePosition::RandomSuffix()))); + + base::HistogramTester histogram_tester; + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); + + // There should have been conflict, and it should have been resolved with the + // remote version. + EXPECT_THAT(tracker()->GetEntityForSyncId(kId)->IsUnsynced(), Eq(false)); + EXPECT_THAT(tracker()->GetEntityForSyncId(kId)->metadata()->is_deleted(), + Eq(false)); + + // The bookmark should have been resurrected. + EXPECT_THAT(bookmark_bar_node->child_count(), Eq(1)); + + histogram_tester.ExpectBucketCount( + "Sync.ResolveConflict", + /*sample=*/syncer::ConflictResolution::USE_REMOTE, /*count=*/1); +} + +TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, + ShouldResolveConflictBetweenLocalAndRemoteUpdatesWithMatchingThem) { + const std::string kId = "id"; + const std::string kTitle = "title"; + const syncer::UniquePosition kPosition = + syncer::UniquePosition::InitialPosition( + syncer::UniquePosition::RandomSuffix()); + + syncer::UpdateResponseDataList updates; + + updates.push_back(CreateUpdateResponseData( + /*server_id=*/kId, + /*parent_id=*/kBookmarkBarId, + /*title=*/kTitle, + /*is_deletion=*/false, + /*version=*/0, + /*unique_position=*/kPosition)); + + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); + ASSERT_THAT(tracker()->GetEntityForSyncId(kId), NotNull()); + ASSERT_THAT(tracker()->GetEntityForSyncId(kId)->IsUnsynced(), Eq(false)); + + // Mark the entity as modified locally. + tracker()->IncrementSequenceNumber(/*sync_id=*/kId); + ASSERT_THAT(tracker()->GetEntityForSyncId(kId)->IsUnsynced(), Eq(true)); + + // Push an update for the same entity with the same information. + updates.clear(); + updates.push_back(CreateUpdateResponseData( + /*server_id=*/kId, + /*parent_id=*/kBookmarkBarId, + /*title=*/kTitle, + /*is_deletion=*/false, + /*version=*/1, + /*unique_position=*/kPosition)); + + base::HistogramTester histogram_tester; + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); + + // There should have been conflict but both local and remote updates should + // match. The conflict should have been resolved. + EXPECT_THAT(tracker()->GetEntityForSyncId(kId)->IsUnsynced(), Eq(false)); + + histogram_tester.ExpectBucketCount( + "Sync.ResolveConflict", + /*sample=*/syncer::ConflictResolution::CHANGES_MATCH, /*count=*/1); +} + +TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, + ShouldResolveConflictBetweenLocalAndRemoteUpdatesWithRemote) { + const std::string kId = "id"; + const std::string kTitle = "title"; + const std::string kNewRemoteTitle = "remote title"; + + syncer::UpdateResponseDataList updates; + + updates.push_back(CreateUpdateResponseData( + /*server_id=*/kId, + /*parent_id=*/kBookmarkBarId, + /*title=*/kTitle, + /*is_deletion=*/false, + /*version=*/0, + /*unique_position=*/ + syncer::UniquePosition::InitialPosition( + syncer::UniquePosition::RandomSuffix()))); + + BookmarkRemoteUpdatesHandler updates_handler(bookmark_model(), + favicon_service(), tracker()); + updates_handler.Process(updates, /*got_new_encryption_requirements=*/false); + ASSERT_THAT(tracker()->GetEntityForSyncId(kId), NotNull()); + ASSERT_THAT(tracker()->GetEntityForSyncId(kId)->IsUnsynced(), Eq(false)); + + // Mark the entity as modified locally. + tracker()->IncrementSequenceNumber(/*sync_id=*/kId); + ASSERT_THAT(tracker()->GetEntityForSyncId(kId)->IsUnsynced(), Eq(true)); + + // Push an update for the same entity with a new title. + updates.clear(); + updates.push_back(CreateUpdateResponseData( + /*server_id=*/kId, + /*parent_id=*/kBookmarkBarId, + /*title=*/kNewRemoteTitle, + /*is_deletion=*/false, + /*version=*/1, + /*unique_position=*/ + syncer::UniquePosition::InitialPosition( + syncer::UniquePosition::RandomSuffix()))); + + base::HistogramTester histogram_tester; + updates_handler.Process(updates, /*got_new_encryption_requirements=*/false); + + // There should have been conflict, and it should have been resolved with the + // remote version. + EXPECT_THAT(tracker()->GetEntityForSyncId(kId)->IsUnsynced(), Eq(false)); + const bookmarks::BookmarkNode* bookmark_bar_node = + bookmark_model()->bookmark_bar_node(); + ASSERT_THAT(bookmark_bar_node->child_count(), Eq(1)); + EXPECT_THAT(bookmark_bar_node->GetChild(0)->GetTitle(), + Eq(ASCIIToUTF16(kNewRemoteTitle))); + + histogram_tester.ExpectBucketCount( + "Sync.ResolveConflict", + /*sample=*/syncer::ConflictResolution::USE_REMOTE, /*count=*/1); } } // namespace
diff --git a/components/viz/service/display/display_resource_provider.cc b/components/viz/service/display/display_resource_provider.cc index eb1ba0a9..05deaec 100644 --- a/components/viz/service/display/display_resource_provider.cc +++ b/components/viz/service/display/display_resource_provider.cc
@@ -891,8 +891,10 @@ } DisplayResourceProvider::LockSetForExternalUse::LockSetForExternalUse( - DisplayResourceProvider* resource_provider) - : resource_provider_(resource_provider) {} + DisplayResourceProvider* resource_provider, + const CreateSkImageCallback& callback) + : resource_provider_(resource_provider), + create_sk_image_callback_(callback) {} DisplayResourceProvider::LockSetForExternalUse::~LockSetForExternalUse() { DCHECK(resources_.empty()); @@ -905,6 +907,16 @@ return resource_provider_->LockForExternalUse(id); } +sk_sp<SkImage> +DisplayResourceProvider::LockSetForExternalUse::LockResourceAndCreateSkImage( + ResourceId id) { + auto metadata = LockResource(id); + auto& sk_image = resource_provider_->resource_sk_image_[id]; + if (!sk_image) + sk_image = create_sk_image_callback_.Run(std::move(metadata)); + return sk_image; +} + void DisplayResourceProvider::LockSetForExternalUse::UnlockResources( const gpu::SyncToken& sync_token) { for (const auto& id : resources_)
diff --git a/components/viz/service/display/display_resource_provider.h b/components/viz/service/display/display_resource_provider.h index 3e790d7..eb2f707 100644 --- a/components/viz/service/display/display_resource_provider.h +++ b/components/viz/service/display/display_resource_provider.h
@@ -188,12 +188,19 @@ // Maintains set of lock for external use. class VIZ_SERVICE_EXPORT LockSetForExternalUse { public: - explicit LockSetForExternalUse(DisplayResourceProvider* resource_provider); + using CreateSkImageCallback = + base::RepeatingCallback<sk_sp<SkImage>(ResourceMetadata)>; + LockSetForExternalUse(DisplayResourceProvider* resource_provider, + const CreateSkImageCallback& callback); ~LockSetForExternalUse(); // Lock a resource for external use. ResourceMetadata LockResource(ResourceId resource_id); + // Lock a resource and create a SkImage from it by using the + // CreateSkImageCallback. + sk_sp<SkImage> LockResourceAndCreateSkImage(ResourceId resource_id); + // Unlock all locked resources with a |sync_token|. // See UnlockForExternalUse for the detail. All resources must be unlocked // before destroying this class. @@ -201,6 +208,7 @@ private: DisplayResourceProvider* const resource_provider_; + CreateSkImageCallback create_sk_image_callback_; std::vector<ResourceId> resources_; DISALLOW_COPY_AND_ASSIGN(LockSetForExternalUse);
diff --git a/components/viz/service/display/display_resource_provider_unittest.cc b/components/viz/service/display/display_resource_provider_unittest.cc index 65a47721..1686ea14 100644 --- a/components/viz/service/display/display_resource_provider_unittest.cc +++ b/components/viz/service/display/display_resource_provider_unittest.cc
@@ -479,7 +479,8 @@ unsigned parent_id = resource_map[list.front().id]; DisplayResourceProvider::LockSetForExternalUse lock_set( - resource_provider_.get()); + resource_provider_.get(), + DisplayResourceProvider::LockSetForExternalUse::CreateSkImageCallback()); ResourceMetadata metadata = lock_set.LockResource(parent_id); ASSERT_EQ(metadata.mailbox_holder.mailbox, mailbox);
diff --git a/components/viz/service/display/skia_renderer.cc b/components/viz/service/display/skia_renderer.cc index 0295ada..cf3b497 100644 --- a/components/viz/service/display/skia_renderer.cc +++ b/components/viz/service/display/skia_renderer.cc
@@ -108,11 +108,8 @@ // to store the new created image later. auto& image = skia_renderer->promise_images_[resource_id]; if (!image) { - auto metadata = - skia_renderer->lock_set_for_external_use_.LockResource(resource_id); - DCHECK(!metadata.mailbox_holder.mailbox.IsZero()); - image = skia_renderer->skia_output_surface_->MakePromiseSkImage( - std::move(metadata)); + image = skia_renderer->lock_set_for_external_use_ + ->LockResourceAndCreateSkImage(resource_id); LOG_IF(ERROR, !image) << "Failed to create the promise sk image."; } sk_image_ = image.get(); @@ -148,22 +145,22 @@ const size_t number_of_textures = (is_i420 ? 3 : 2) + (has_alpha ? 1 : 0); std::vector<ResourceMetadata> metadatas; metadatas.reserve(number_of_textures); - auto y_metadata = skia_renderer->lock_set_for_external_use_.LockResource( + auto y_metadata = skia_renderer->lock_set_for_external_use_->LockResource( quad->y_plane_resource_id()); metadatas.push_back(std::move(y_metadata)); - auto u_metadata = skia_renderer->lock_set_for_external_use_.LockResource( + auto u_metadata = skia_renderer->lock_set_for_external_use_->LockResource( quad->u_plane_resource_id()); metadatas.push_back(std::move(u_metadata)); if (is_i420) { auto v_metadata = - skia_renderer->lock_set_for_external_use_.LockResource( + skia_renderer->lock_set_for_external_use_->LockResource( quad->v_plane_resource_id()); metadatas.push_back(std::move(v_metadata)); } if (has_alpha) { auto a_metadata = - skia_renderer->lock_set_for_external_use_.LockResource( + skia_renderer->lock_set_for_external_use_->LockResource( quad->a_plane_resource_id()); metadatas.push_back(std::move(a_metadata)); } @@ -193,8 +190,7 @@ DrawMode mode) : DirectRenderer(settings, output_surface, resource_provider), draw_mode_(mode), - skia_output_surface_(skia_output_surface), - lock_set_for_external_use_(resource_provider) { + skia_output_surface_(skia_output_surface) { switch (draw_mode_) { case DrawMode::GL: { DCHECK(output_surface_); @@ -216,6 +212,10 @@ } case DrawMode::DDL: { DCHECK(skia_output_surface_); + lock_set_for_external_use_.emplace( + resource_provider, + base::BindRepeating(&SkiaOutputSurface::MakePromiseSkImage, + base::Unretained(skia_output_surface_))); break; } case DrawMode::SKPRECORD: { @@ -1259,7 +1259,7 @@ promise_images_.clear(); yuv_promise_images_.clear(); gpu::SyncToken sync_token = skia_output_surface_->SubmitPaint(); - lock_set_for_external_use_.UnlockResources(sync_token); + lock_set_for_external_use_->UnlockResources(sync_token); break; } case DrawMode::GL: // Fallthrough
diff --git a/components/viz/service/display/skia_renderer.h b/components/viz/service/display/skia_renderer.h index 6c43773..a1535b26 100644 --- a/components/viz/service/display/skia_renderer.h +++ b/components/viz/service/display/skia_renderer.h
@@ -120,6 +120,12 @@ bool IsUsingVulkan() const; const TileDrawQuad* CanPassBeDrawnDirectly(const RenderPass* pass) override; + // Get corresponding GrContext in DrawMode::GL or DrawMode::VULKAN. Returns + // nullptr when there is no GrContext. + GrContext* GetGrContext(); + bool is_using_ddl() const { return draw_mode_ == DrawMode::DDL; } + bool is_using_vulkan() const { return draw_mode_ == DrawMode::VULKAN; } + // A map from RenderPass id to the texture used to draw the RenderPass from. struct RenderPassBacking { sk_sp<SkSurface> render_pass_surface; @@ -148,12 +154,6 @@ const DrawMode draw_mode_; - // Get corresponding GrContext in DrawMode::GL or DrawMode::VULKAN. Returns - // nullptr when there is no GrContext. - GrContext* GetGrContext(); - bool is_using_ddl() const { return draw_mode_ == DrawMode::DDL; } - bool is_using_vulkan() const { return draw_mode_ == DrawMode::VULKAN; } - // Interface used for drawing. Common among different draw modes. sk_sp<SkSurface> root_surface_; sk_sp<SkSurface> non_root_surface_; @@ -203,7 +203,8 @@ // the compositor thread. And the sync token will be released when the DDL // for the current frame is replayed on the GPU thread. // It is only used with DDL. - DisplayResourceProvider::LockSetForExternalUse lock_set_for_external_use_; + base::Optional<DisplayResourceProvider::LockSetForExternalUse> + lock_set_for_external_use_; // Promise images created from resources used in the current frame. This map // will be cleared when the frame is done and before all resources in
diff --git a/content/browser/browsing_data/browsing_data_remover_impl.cc b/content/browser/browsing_data/browsing_data_remover_impl.cc index a872135..3d58ce1 100644 --- a/content/browser/browsing_data/browsing_data_remover_impl.cc +++ b/content/browser/browsing_data/browsing_data_remover_impl.cc
@@ -409,7 +409,7 @@ BrowsingDataRemoverDelegate::EmbedderOriginTypeMatcher embedder_matcher; if (embedder_delegate_) embedder_matcher = embedder_delegate_->GetOriginTypeMatcher(); - bool perform_cleanup = + bool perform_storage_cleanup = delete_begin_.is_null() && delete_end_.is_max() && filter_builder.GetMode() == BrowsingDataFilterBuilder::BLACKLIST; @@ -417,8 +417,8 @@ storage_partition_remove_mask, quota_storage_remove_mask, base::BindRepeating(&DoesOriginMatchMaskAndURLs, origin_type_mask_, filter, std::move(embedder_matcher)), - std::move(deletion_filter), perform_cleanup, delete_begin_, delete_end_, - CreatePendingTaskCompletionClosure()); + std::move(deletion_filter), perform_storage_cleanup, delete_begin_, + delete_end_, CreatePendingTaskCompletionClosure()); } //////////////////////////////////////////////////////////////////////////////
diff --git a/content/browser/browsing_data/browsing_data_remover_impl_unittest.cc b/content/browser/browsing_data/browsing_data_remover_impl_unittest.cc index e98faba..059969e5b 100644 --- a/content/browser/browsing_data/browsing_data_remover_impl_unittest.cc +++ b/content/browser/browsing_data/browsing_data_remover_impl_unittest.cc
@@ -190,7 +190,7 @@ uint32_t quota_storage_remove_mask, const OriginMatcherFunction& origin_matcher, CookieDeletionFilterPtr cookie_deletion_filter, - bool perform_cleanup, + bool perform_storage_cleanup, const base::Time begin, const base::Time end, base::OnceClosure callback) override {
diff --git a/content/browser/dom_storage/dom_storage_context_wrapper.cc b/content/browser/dom_storage/dom_storage_context_wrapper.cc index 4d86ecf..603d6b2d 100644 --- a/content/browser/dom_storage/dom_storage_context_wrapper.cc +++ b/content/browser/dom_storage/dom_storage_context_wrapper.cc
@@ -264,7 +264,7 @@ mojo_task_runner_->PostTask( FROM_HERE, base::BindOnce( - &LocalStorageContextMojo::PerformCleanup, + &LocalStorageContextMojo::PerformStorageCleanup, base::Unretained(mojo_state_), base::BindOnce(&GotMojoCallback, base::ThreadTaskRunnerHandle::Get(), std::move(callback)))); @@ -306,9 +306,10 @@ // mojo_session_state_ is set to null, preventing further tasks from being // queued. mojo_task_runner_->PostTask( - FROM_HERE, base::BindOnce(&SessionStorageContextMojo::PerformCleanup, - base::Unretained(mojo_session_state_), - std::move(callback))); + FROM_HERE, + base::BindOnce(&SessionStorageContextMojo::PerformStorageCleanup, + base::Unretained(mojo_session_state_), + std::move(callback))); return; } std::move(callback).Run();
diff --git a/content/browser/dom_storage/local_storage_context_mojo.cc b/content/browser/dom_storage/local_storage_context_mojo.cc index c5c90e9..dd1f9cc 100644 --- a/content/browser/dom_storage/local_storage_context_mojo.cc +++ b/content/browser/dom_storage/local_storage_context_mojo.cc
@@ -434,11 +434,12 @@ } } -void LocalStorageContextMojo::PerformCleanup(base::OnceClosure callback) { +void LocalStorageContextMojo::PerformStorageCleanup( + base::OnceClosure callback) { if (connection_state_ != CONNECTION_FINISHED) { - RunWhenConnected(base::BindOnce(&LocalStorageContextMojo::PerformCleanup, - weak_ptr_factory_.GetWeakPtr(), - std::move(callback))); + RunWhenConnected( + base::BindOnce(&LocalStorageContextMojo::PerformStorageCleanup, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); return; } if (database_) {
diff --git a/content/browser/dom_storage/local_storage_context_mojo.h b/content/browser/dom_storage/local_storage_context_mojo.h index 293684d8..db50fab 100644 --- a/content/browser/dom_storage/local_storage_context_mojo.h +++ b/content/browser/dom_storage/local_storage_context_mojo.h
@@ -63,7 +63,7 @@ // GetStorageUsage() will not return entries for |origin| anymore. void DeleteStorage(const url::Origin& origin, base::OnceClosure callback); // Ensure that no traces of deleted data are left in the backing storage. - void PerformCleanup(base::OnceClosure callback); + void PerformStorageCleanup(base::OnceClosure callback); void Flush(); void FlushOriginForTesting(const url::Origin& origin);
diff --git a/content/browser/dom_storage/session_storage_context_mojo.cc b/content/browser/dom_storage/session_storage_context_mojo.cc index 4d8777c..443d902 100644 --- a/content/browser/dom_storage/session_storage_context_mojo.cc +++ b/content/browser/dom_storage/session_storage_context_mojo.cc
@@ -287,11 +287,12 @@ } } -void SessionStorageContextMojo::PerformCleanup(base::OnceClosure callback) { +void SessionStorageContextMojo::PerformStorageCleanup( + base::OnceClosure callback) { if (connection_state_ != CONNECTION_FINISHED) { - RunWhenConnected(base::BindOnce(&SessionStorageContextMojo::PerformCleanup, - weak_ptr_factory_.GetWeakPtr(), - std::move(callback))); + RunWhenConnected( + base::BindOnce(&SessionStorageContextMojo::PerformStorageCleanup, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); return; } if (database_) {
diff --git a/content/browser/dom_storage/session_storage_context_mojo.h b/content/browser/dom_storage/session_storage_context_mojo.h index 5a2d7d5..e1ebd6bf 100644 --- a/content/browser/dom_storage/session_storage_context_mojo.h +++ b/content/browser/dom_storage/session_storage_context_mojo.h
@@ -104,7 +104,7 @@ base::OnceClosure callback); // Ensure that no traces of data are left in the backing storage. - void PerformCleanup(base::OnceClosure callback); + void PerformStorageCleanup(base::OnceClosure callback); // Called when the owning BrowserContext is ending. Schedules the commit of // any unsaved changes then deletes this object. All data on disk (where there
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc index 998075d..4010bfb 100644 --- a/content/browser/frame_host/navigation_controller_impl.cc +++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -2800,10 +2800,8 @@ FrameNavigationEntry* frame_entry) { DCHECK_EQ(-1, GetIndexOfEntry(entry)); DCHECK(frame_entry); - // TODO(nasko): Enforce this check once all code is updated to supply - // initiator_origin for renderer initiated navigations. - // DCHECK(!params.is_renderer_initiated || - // params.initiator_origin.has_value()); + // All renderer-initiated navigations must have an initiator_origin. + DCHECK(!params.is_renderer_initiated || params.initiator_origin.has_value()); GURL url_to_load; GURL virtual_url;
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc index 7d36042..29eda146 100644 --- a/content/browser/frame_host/navigation_handle_impl.cc +++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -578,7 +578,7 @@ } void NavigationHandleImpl::WillStartRequest( - const ThrottleChecksFinishedCallback& callback) { + ThrottleChecksFinishedCallback callback) { TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this, "WillStartRequest"); // WillStartRequest should only be called once. @@ -589,7 +589,7 @@ } state_ = WILL_SEND_REQUEST; - complete_callback_ = callback; + complete_callback_ = std::move(callback); if (IsSelfReferentialURL()) { state_ = CANCELING; @@ -624,7 +624,7 @@ bool new_is_external_protocol, scoped_refptr<net::HttpResponseHeaders> response_headers, net::HttpResponseInfo::ConnectionInfo connection_info, - const ThrottleChecksFinishedCallback& callback) { + ThrottleChecksFinishedCallback callback) { // |new_url| is not expected to be a "renderer debug" url. It should be // blocked in NavigationRequest::OnRequestRedirected or in // ResourceLoader::OnReceivedRedirect. If it is not the case, @@ -652,7 +652,7 @@ resource_request_body_ = nullptr; state_ = WILL_REDIRECT_REQUEST; - complete_callback_ = callback; + complete_callback_ = std::move(callback); } void NavigationHandleImpl::WillRedirectRequest( @@ -663,13 +663,13 @@ scoped_refptr<net::HttpResponseHeaders> response_headers, net::HttpResponseInfo::ConnectionInfo connection_info, RenderProcessHost* post_redirect_process, - const ThrottleChecksFinishedCallback& callback) { + ThrottleChecksFinishedCallback callback) { TRACE_EVENT_ASYNC_STEP_INTO1("navigation", "NavigationHandle", this, "WillRedirectRequest", "url", new_url.possibly_invalid_spec()); UpdateStateFollowingRedirect(new_url, new_method, new_referrer_url, new_is_external_protocol, response_headers, - connection_info, callback); + connection_info, std::move(callback)); UpdateSiteURL(post_redirect_process); if (IsSelfReferentialURL()) { @@ -694,14 +694,14 @@ void NavigationHandleImpl::WillFailRequest( RenderFrameHostImpl* render_frame_host, base::Optional<net::SSLInfo> ssl_info, - const ThrottleChecksFinishedCallback& callback) { + ThrottleChecksFinishedCallback callback) { TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this, "WillFailRequest"); if (ssl_info.has_value()) ssl_info_ = ssl_info.value(); render_frame_host_ = render_frame_host; - complete_callback_ = callback; + complete_callback_ = std::move(callback); state_ = WILL_FAIL_REQUEST; // Notify each throttle of the request. @@ -729,7 +729,7 @@ bool is_stream, bool is_signed_exchange_inner_response, bool was_cached, - const ThrottleChecksFinishedCallback& callback) { + ThrottleChecksFinishedCallback callback) { TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this, "WillProcessResponse"); @@ -746,7 +746,7 @@ state_ = WILL_PROCESS_RESPONSE; ssl_info_ = ssl_info; socket_address_ = socket_address; - complete_callback_ = callback; + complete_callback_ = std::move(callback); // Notify each throttle of the response. NavigationThrottle::ThrottleCheckResult result = CheckWillProcessResponse(); @@ -1227,13 +1227,11 @@ NavigationThrottle::ThrottleCheckResult result) { DCHECK(result.action() != NavigationThrottle::DEFER); - ThrottleChecksFinishedCallback callback = complete_callback_; + ThrottleChecksFinishedCallback callback = std::move(complete_callback_); complete_callback_.Reset(); - if (!complete_callback_for_testing_.is_null()) { - complete_callback_for_testing_.Run(result); - complete_callback_for_testing_.Reset(); - } + if (!complete_callback_for_testing_.is_null()) + std::move(complete_callback_for_testing_).Run(result); if (!callback.is_null()) std::move(callback).Run(result);
diff --git a/content/browser/frame_host/navigation_handle_impl.h b/content/browser/frame_host/navigation_handle_impl.h index 06b3b40..fcfa502 100644 --- a/content/browser/frame_host/navigation_handle_impl.h +++ b/content/browser/frame_host/navigation_handle_impl.h
@@ -195,13 +195,13 @@ return appcache_handle_.get(); } - typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> + typedef base::OnceCallback<void(NavigationThrottle::ThrottleCheckResult)> ThrottleChecksFinishedCallback; // Called when the URLRequest will start in the network stack. |callback| // will be called when all throttle checks have completed. This will allow // the caller to cancel the navigation or let it proceed. - void WillStartRequest(const ThrottleChecksFinishedCallback& callback); + void WillStartRequest(ThrottleChecksFinishedCallback callback); // Updates the state of the navigation handle after encountering a server // redirect. @@ -212,7 +212,7 @@ bool new_is_external_protocol, scoped_refptr<net::HttpResponseHeaders> response_headers, net::HttpResponseInfo::ConnectionInfo connection_info, - const ThrottleChecksFinishedCallback& callback); + ThrottleChecksFinishedCallback callback); // Called when the URLRequest will be redirected in the network stack. // |callback| will be called when all throttles check have completed. This @@ -231,7 +231,7 @@ scoped_refptr<net::HttpResponseHeaders> response_headers, net::HttpResponseInfo::ConnectionInfo connection_info, RenderProcessHost* post_redirect_process, - const ThrottleChecksFinishedCallback& callback); + ThrottleChecksFinishedCallback callback); // Called when the URLRequest will fail. |render_frame_host| corresponds to // the RenderFrameHost in which the error page will load. |callback| will be @@ -240,7 +240,7 @@ // custom error page HTML) or let the failure proceed as normal. void WillFailRequest(RenderFrameHostImpl* render_frame_host, base::Optional<net::SSLInfo> ssl_info, - const ThrottleChecksFinishedCallback& callback); + ThrottleChecksFinishedCallback callback); // Called when the URLRequest has delivered response headers and metadata. // |callback| will be called when all throttle checks have completed, @@ -261,7 +261,7 @@ bool is_stream, bool is_signed_exchange_inner_response, bool was_cached, - const ThrottleChecksFinishedCallback& callback); + ThrottleChecksFinishedCallback callback); // Returns the FrameTreeNode this navigation is happening in. FrameTreeNode* frame_tree_node() { return frame_tree_node_; } @@ -315,8 +315,8 @@ } void set_complete_callback_for_testing( - const ThrottleChecksFinishedCallback& callback) { - complete_callback_for_testing_ = callback; + ThrottleChecksFinishedCallback callback) { + complete_callback_for_testing_ = std::move(callback); } CSPDisposition should_check_main_world_csp() const {
diff --git a/content/browser/renderer_host/input/input_router.h b/content/browser/renderer_host/input/input_router.h index 400c761..08e3657 100644 --- a/content/browser/renderer_host/input/input_router.h +++ b/content/browser/renderer_host/input/input_router.h
@@ -103,13 +103,6 @@ // Called when the renderer notifies a change in whether or not it has touch // event handlers registered. virtual void OnHasTouchEventHandlers(bool has_handlers) = 0; - - // Will resolve the given callback once all prior input has been fully - // propagated through the system such that subsequent input will be subject - // to its effects. e.g. Input that follows a scroll gesture that affects - // OOPIF hit-testing will need to wait until updated CompositorFrames have - // been submitted to the browser. - virtual void WaitForInputProcessed(base::OnceClosure callback) = 0; }; } // namespace content
diff --git a/content/browser/renderer_host/input/input_router_impl.cc b/content/browser/renderer_host/input/input_router_impl.cc index b70fb2e..aa915d2 100644 --- a/content/browser/renderer_host/input/input_router_impl.cc +++ b/content/browser/renderer_host/input/input_router_impl.cc
@@ -658,14 +658,6 @@ touch_event_queue_.OnHasTouchEventHandlers(has_handlers); } -void InputRouterImpl::WaitForInputProcessed(base::OnceClosure callback) { - // TODO(bokan): Some kinds of input is queued in one of the various queues - // available in this class. To be truly robust, we should wait until those - // queues are flushed before issuing this message. This will be done in a - // follow-up. https://crbug.com/902446. - client_->GetWidgetInputHandler()->WaitForInputProcessed(std::move(callback)); -} - void InputRouterImpl::ForceSetTouchActionAuto() { touch_action_filter_.AppendToGestureSequenceForDebugging("F"); touch_action_filter_.OnSetTouchAction(cc::kTouchActionAuto);
diff --git a/content/browser/renderer_host/input/input_router_impl.h b/content/browser/renderer_host/input/input_router_impl.h index bbe3cd34..dd4e239 100644 --- a/content/browser/renderer_host/input/input_router_impl.h +++ b/content/browser/renderer_host/input/input_router_impl.h
@@ -101,7 +101,6 @@ const std::vector<gfx::Rect>& bounds) override; void SetMouseCapture(bool capture) override; void OnHasTouchEventHandlers(bool has_handlers) override; - void WaitForInputProcessed(base::OnceClosure callback) override; // Exposed so that tests can swap out the implementation and intercept calls. mojo::Binding<mojom::WidgetInputHandlerHost>&
diff --git a/content/browser/renderer_host/input/synthetic_gesture.cc b/content/browser/renderer_host/input/synthetic_gesture.cc index 35cbaac..f5ba649b 100644 --- a/content/browser/renderer_host/input/synthetic_gesture.cc +++ b/content/browser/renderer_host/input/synthetic_gesture.cc
@@ -56,9 +56,4 @@ return true; } -void SyntheticGesture::WaitForTargetAck(base::OnceClosure callback, - SyntheticGestureTarget* target) const { - std::move(callback).Run(); -} - } // namespace content
diff --git a/content/browser/renderer_host/input/synthetic_gesture.h b/content/browser/renderer_host/input/synthetic_gesture.h index d0d0790..6f5d33057 100644 --- a/content/browser/renderer_host/input/synthetic_gesture.h +++ b/content/browser/renderer_host/input/synthetic_gesture.h
@@ -51,9 +51,6 @@ virtual Result ForwardInputEvents( const base::TimeTicks& timestamp, SyntheticGestureTarget* target) = 0; - virtual void WaitForTargetAck(base::OnceClosure callback, - SyntheticGestureTarget* target) const; - // Returns whether the gesture events can be dispatched at high frequency // (e.g. at 120Hz), instead of the regular frequence (at 60Hz). Some gesture // interact differently depending on how long they take (e.g. the TAP gesture
diff --git a/content/browser/renderer_host/input/synthetic_gesture_controller.cc b/content/browser/renderer_host/input/synthetic_gesture_controller.cc index af36138..eef8cd0 100644 --- a/content/browser/renderer_host/input/synthetic_gesture_controller.cc +++ b/content/browser/renderer_host/input/synthetic_gesture_controller.cc
@@ -24,10 +24,7 @@ DCHECK(delegate_); } -SyntheticGestureController::~SyntheticGestureController() { - if (!pending_gesture_queue_.IsEmpty()) - GestureCompleted(SyntheticGesture::GESTURE_FINISHED); -} +SyntheticGestureController::~SyntheticGestureController() {} void SyntheticGestureController::QueueSyntheticGesture( std::unique_ptr<SyntheticGesture> synthetic_gesture, @@ -76,9 +73,15 @@ return true; StopGesture(*pending_gesture_queue_.FrontGesture(), + pending_gesture_queue_.FrontCallback(), pending_gesture_queue_.current_gesture_result()); - - return !pending_gesture_queue_.IsEmpty(); + pending_gesture_queue_.Pop(); + if (pending_gesture_queue_.IsEmpty()) { + dispatch_timer_.Stop(); + return false; + } + StartGesture(*pending_gesture_queue_.FrontGesture()); + return true; } void SyntheticGestureController::StartGesture(const SyntheticGesture& gesture) { @@ -91,36 +94,14 @@ void SyntheticGestureController::StopGesture( const SyntheticGesture& gesture, + OnGestureCompleteCallback completion_callback, SyntheticGesture::Result result) { DCHECK_NE(result, SyntheticGesture::GESTURE_RUNNING); TRACE_EVENT_ASYNC_END0("input,benchmark", "SyntheticGestureController::running", &gesture); - dispatch_timer_.Stop(); - - if (result != SyntheticGesture::GESTURE_FINISHED) { - GestureCompleted(result); - return; - } - - // If the gesture finished successfully, wait until all the input has been - // propagated throughout the entire input pipeline before we resolve the - // completion callback. This ensures all the effects of this gesture are - // visible to subsequent input (e.g. OOPIF hit testing). - gesture.WaitForTargetAck( - base::BindOnce(&SyntheticGestureController::GestureCompleted, - weak_ptr_factory_.GetWeakPtr(), - SyntheticGesture::GESTURE_FINISHED), - gesture_target_.get()); -} - -void SyntheticGestureController::GestureCompleted( - SyntheticGesture::Result result) { - pending_gesture_queue_.FrontCallback().Run(result); - pending_gesture_queue_.Pop(); - if (!pending_gesture_queue_.IsEmpty()) - StartGesture(*pending_gesture_queue_.FrontGesture()); + std::move(completion_callback).Run(result); } SyntheticGestureController::GestureAndCallbackQueue::GestureAndCallbackQueue() {
diff --git a/content/browser/renderer_host/input/synthetic_gesture_controller.h b/content/browser/renderer_host/input/synthetic_gesture_controller.h index 53d59bad..dcc3b8e 100644 --- a/content/browser/renderer_host/input/synthetic_gesture_controller.h +++ b/content/browser/renderer_host/input/synthetic_gesture_controller.h
@@ -55,9 +55,8 @@ void StartTimer(bool high_frequency); void StartGesture(const SyntheticGesture& gesture); void StopGesture(const SyntheticGesture& gesture, + OnGestureCompleteCallback completion_callback, SyntheticGesture::Result result); - void GestureCompleted(SyntheticGesture::Result result); - void ResolveCompletionCallback(); Delegate* const delegate_; std::unique_ptr<SyntheticGestureTarget> gesture_target_;
diff --git a/content/browser/renderer_host/input/synthetic_gesture_controller_unittest.cc b/content/browser/renderer_host/input/synthetic_gesture_controller_unittest.cc index e51c009..82e72f8 100644 --- a/content/browser/renderer_host/input/synthetic_gesture_controller_unittest.cc +++ b/content/browser/renderer_host/input/synthetic_gesture_controller_unittest.cc
@@ -183,14 +183,6 @@ bool flush_requested() const { return flush_requested_; } void ClearFlushRequest() { flush_requested_ = false; } - void WaitForTargetAck(SyntheticGestureParams::GestureType type, - SyntheticGestureParams::GestureSourceType source, - base::OnceClosure callback) const override { - // Must resolve synchronously since FlushInputUntilComplete will try the - // next gesture after this one. - std::move(callback).Run(); - } - private: bool flush_requested_;
diff --git a/content/browser/renderer_host/input/synthetic_gesture_target.h b/content/browser/renderer_host/input/synthetic_gesture_target.h index 5ab6fba..ef75159 100644 --- a/content/browser/renderer_host/input/synthetic_gesture_target.h +++ b/content/browser/renderer_host/input/synthetic_gesture_target.h
@@ -51,15 +51,6 @@ // multiplier constant, this method returns that constant (in DIPs). If mouse // wheels can specify an arbitrary delta this returns 0. virtual int GetMouseWheelMinimumGranularity() const = 0; - - // This method will cause the system to flush and process all input before - // resolving the given callback. This is used to ensure that all effects of a - // gesture have been fully propagated through the system before performing - // further actions. - virtual void WaitForTargetAck( - SyntheticGestureParams::GestureType type, - SyntheticGestureParams::GestureSourceType source, - base::OnceClosure callback) const = 0; }; } // namespace content
diff --git a/content/browser/renderer_host/input/synthetic_gesture_target_base.cc b/content/browser/renderer_host/input/synthetic_gesture_target_base.cc index aff3ca3..f700f10 100644 --- a/content/browser/renderer_host/input/synthetic_gesture_target_base.cc +++ b/content/browser/renderer_host/input/synthetic_gesture_target_base.cc
@@ -175,13 +175,6 @@ return host_->GetView()->GetMouseWheelMinimumGranularity(); } -void SyntheticGestureTargetBase::WaitForTargetAck( - SyntheticGestureParams::GestureType type, - SyntheticGestureParams::GestureSourceType source, - base::OnceClosure callback) const { - host_->WaitForInputProcessed(type, source, std::move(callback)); -} - bool SyntheticGestureTargetBase::PointIsWithinContents(int x, int y) const { gfx::Rect bounds = host_->GetView()->GetViewBounds(); bounds -= bounds.OffsetFromOrigin(); // Translate the bounds to (0,0).
diff --git a/content/browser/renderer_host/input/synthetic_gesture_target_base.h b/content/browser/renderer_host/input/synthetic_gesture_target_base.h index 53476354..9ebc026 100644 --- a/content/browser/renderer_host/input/synthetic_gesture_target_base.h +++ b/content/browser/renderer_host/input/synthetic_gesture_target_base.h
@@ -61,10 +61,6 @@ int GetMouseWheelMinimumGranularity() const override; - void WaitForTargetAck(SyntheticGestureParams::GestureType type, - SyntheticGestureParams::GestureSourceType source, - base::OnceClosure callback) const override; - protected: RenderWidgetHostImpl* render_widget_host() const { return host_; }
diff --git a/content/browser/renderer_host/input/synthetic_input_browsertest.cc b/content/browser/renderer_host/input/synthetic_input_browsertest.cc deleted file mode 100644 index 96855c9..0000000 --- a/content/browser/renderer_host/input/synthetic_input_browsertest.cc +++ /dev/null
@@ -1,79 +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. - -#include "base/bind.h" -#include "base/callback.h" -#include "base/run_loop.h" -#include "base/test/test_timeouts.h" -#include "cc/base/switches.h" -#include "content/common/input/input_event.h" -#include "content/public/browser/render_widget_host.h" -#include "content/public/browser/render_widget_host_view.h" -#include "content/public/browser/web_contents.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 "third_party/blink/public/platform/web_input_event.h" - -namespace content { - -class SyntheticInputTest : public ContentBrowserTest { - public: - SyntheticInputTest() {} - - void SetUpCommandLine(base::CommandLine* command_line) override { - command_line->AppendSwitch(cc::switches::kEnableGpuBenchmarking); - } - - RenderWidgetHost* GetRenderWidgetHost() const { - RenderWidgetHost* const rwh = shell() - ->web_contents() - ->GetRenderWidgetHostView() - ->GetRenderWidgetHost(); - CHECK(rwh); - return rwh; - } -}; - -class GestureScrollObserver : public RenderWidgetHost::InputEventObserver { - public: - void OnInputEvent(const blink::WebInputEvent& event) override { - if (event.GetType() == blink::WebInputEvent::kGestureScrollBegin) - gesture_scroll_seen_ = true; - } - bool HasSeenGestureScrollBegin() const { return gesture_scroll_seen_; } - bool gesture_scroll_seen_ = false; -}; - -// This test checks that we destroying a render widget host with an ongoing -// gesture doesn't cause lifetime issues. Namely, that the gesture -// CompletionCallback isn't destroyed before being called or the Mojo pipe -// being closed. -IN_PROC_BROWSER_TEST_F(SyntheticInputTest, DestroyWidgetWithOngoingGesture) { - NavigateToURL(shell(), GURL("about:blank")); - WaitForLoadStop(shell()->web_contents()); - - GestureScrollObserver gesture_observer; - - GetRenderWidgetHost()->AddInputEventObserver(&gesture_observer); - - // By starting a gesture, there's a Mojo callback that the renderer is - // waiting on the browser to resolve. If the browser is shutdown before - // ACKing the callback or closing the channel, we'll DCHECK. - ASSERT_TRUE(ExecJs(shell()->web_contents(), - "chrome.gpuBenchmarking.smoothScrollBy(10000, ()=>{}, " - "100, 100, chrome.gpuBenchmarking.TOUCH_INPUT);")); - - while (!gesture_observer.HasSeenGestureScrollBegin()) { - base::RunLoop run_loop; - base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( - FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); - run_loop.Run(); - } - - shell()->Close(); -} - -} // namespace content
diff --git a/content/browser/renderer_host/input/synthetic_pinch_gesture.cc b/content/browser/renderer_host/input/synthetic_pinch_gesture.cc index e11dbf9..346eaad 100644 --- a/content/browser/renderer_host/input/synthetic_pinch_gesture.cc +++ b/content/browser/renderer_host/input/synthetic_pinch_gesture.cc
@@ -36,11 +36,4 @@ return lazy_gesture_->ForwardInputEvents(timestamp, target); } -void SyntheticPinchGesture::WaitForTargetAck( - base::OnceClosure callback, - SyntheticGestureTarget* target) const { - target->WaitForTargetAck(params_.GetGestureType(), - params_.gesture_source_type, std::move(callback)); -} - } // namespace content
diff --git a/content/browser/renderer_host/input/synthetic_pinch_gesture.h b/content/browser/renderer_host/input/synthetic_pinch_gesture.h index bdc7ade..e3c387ef 100644 --- a/content/browser/renderer_host/input/synthetic_pinch_gesture.h +++ b/content/browser/renderer_host/input/synthetic_pinch_gesture.h
@@ -26,8 +26,6 @@ SyntheticGesture::Result ForwardInputEvents( const base::TimeTicks& timestamp, SyntheticGestureTarget* target) override; - void WaitForTargetAck(base::OnceClosure callback, - SyntheticGestureTarget* target) const override; private: SyntheticPinchGestureParams params_;
diff --git a/content/browser/renderer_host/input/synthetic_pointer_action.cc b/content/browser/renderer_host/input/synthetic_pointer_action.cc index de37391..29634705 100644 --- a/content/browser/renderer_host/input/synthetic_pointer_action.cc +++ b/content/browser/renderer_host/input/synthetic_pointer_action.cc
@@ -5,6 +5,7 @@ #include "content/browser/renderer_host/input/synthetic_pointer_action.h" #include "base/logging.h" +#include "third_party/blink/public/platform/web_input_event.h" #include "ui/latency/latency_info.h" namespace content { @@ -50,13 +51,6 @@ return false; } -void SyntheticPointerAction::WaitForTargetAck( - base::OnceClosure callback, - SyntheticGestureTarget* target) const { - target->WaitForTargetAck(params_.GetGestureType(), gesture_source_type_, - std::move(callback)); -} - SyntheticPointerAction::GestureState SyntheticPointerAction::ForwardTouchOrMouseInputEvents( const base::TimeTicks& timestamp,
diff --git a/content/browser/renderer_host/input/synthetic_pointer_action.h b/content/browser/renderer_host/input/synthetic_pointer_action.h index b1c03941..9bc2081 100644 --- a/content/browser/renderer_host/input/synthetic_pointer_action.h +++ b/content/browser/renderer_host/input/synthetic_pointer_action.h
@@ -25,8 +25,6 @@ const base::TimeTicks& timestamp, SyntheticGestureTarget* target) override; bool AllowHighFrequencyDispatch() const override; - void WaitForTargetAck(base::OnceClosure callback, - SyntheticGestureTarget* target) const override; private: enum class GestureState { UNINITIALIZED, RUNNING, INVALID, DONE };
diff --git a/content/browser/renderer_host/input/synthetic_pointer_action_unittest.cc b/content/browser/renderer_host/input/synthetic_pointer_action_unittest.cc index 0d554c5..7b66c3b 100644 --- a/content/browser/renderer_host/input/synthetic_pointer_action_unittest.cc +++ b/content/browser/renderer_host/input/synthetic_pointer_action_unittest.cc
@@ -109,12 +109,6 @@ return 0.0f; } - void WaitForTargetAck(SyntheticGestureParams::GestureType type, - SyntheticGestureParams::GestureSourceType source, - base::OnceClosure callback) const override { - std::move(callback).Run(); - } - WebInputEvent::Type type() const { return type_; } protected:
diff --git a/content/browser/renderer_host/input/synthetic_smooth_drag_gesture.cc b/content/browser/renderer_host/input/synthetic_smooth_drag_gesture.cc index 589ac95..abce8415 100644 --- a/content/browser/renderer_host/input/synthetic_smooth_drag_gesture.cc +++ b/content/browser/renderer_host/input/synthetic_smooth_drag_gesture.cc
@@ -24,13 +24,6 @@ return move_gesture_->ForwardInputEvents(timestamp, target); } -void SyntheticSmoothDragGesture::WaitForTargetAck( - base::OnceClosure callback, - SyntheticGestureTarget* target) const { - target->WaitForTargetAck(params_.GetGestureType(), - params_.gesture_source_type, std::move(callback)); -} - SyntheticSmoothMoveGestureParams::InputType SyntheticSmoothDragGesture::GetInputSourceType( SyntheticGestureParams::GestureSourceType gesture_source_type) {
diff --git a/content/browser/renderer_host/input/synthetic_smooth_drag_gesture.h b/content/browser/renderer_host/input/synthetic_smooth_drag_gesture.h index c89203f..1d9614ec 100644 --- a/content/browser/renderer_host/input/synthetic_smooth_drag_gesture.h +++ b/content/browser/renderer_host/input/synthetic_smooth_drag_gesture.h
@@ -20,8 +20,6 @@ SyntheticGesture::Result ForwardInputEvents( const base::TimeTicks& timestamp, SyntheticGestureTarget* target) override; - void WaitForTargetAck(base::OnceClosure callback, - SyntheticGestureTarget* target) const override; private: static SyntheticSmoothMoveGestureParams::InputType GetInputSourceType(
diff --git a/content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.cc b/content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.cc index 395806d..977fe39 100644 --- a/content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.cc +++ b/content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.cc
@@ -24,13 +24,6 @@ return move_gesture_->ForwardInputEvents(timestamp, target); } -void SyntheticSmoothScrollGesture::WaitForTargetAck( - base::OnceClosure callback, - SyntheticGestureTarget* target) const { - target->WaitForTargetAck(params_.GetGestureType(), - params_.gesture_source_type, std::move(callback)); -} - SyntheticSmoothMoveGestureParams::InputType SyntheticSmoothScrollGesture::GetInputSourceType( SyntheticGestureParams::GestureSourceType gesture_source_type) {
diff --git a/content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.h b/content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.h index 0571a20c..f84013d 100644 --- a/content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.h +++ b/content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.h
@@ -20,8 +20,6 @@ SyntheticGesture::Result ForwardInputEvents( const base::TimeTicks& timestamp, SyntheticGestureTarget* target) override; - void WaitForTargetAck(base::OnceClosure callback, - SyntheticGestureTarget* target) const override; private: static SyntheticSmoothMoveGestureParams::InputType GetInputSourceType(
diff --git a/content/browser/renderer_host/input/synthetic_tap_gesture.cc b/content/browser/renderer_host/input/synthetic_tap_gesture.cc index 08e2d442..54b70a02 100644 --- a/content/browser/renderer_host/input/synthetic_tap_gesture.cc +++ b/content/browser/renderer_host/input/synthetic_tap_gesture.cc
@@ -46,13 +46,6 @@ : SyntheticGesture::GESTURE_RUNNING; } -void SyntheticTapGesture::WaitForTargetAck( - base::OnceClosure callback, - SyntheticGestureTarget* target) const { - target->WaitForTargetAck(params_.GetGestureType(), gesture_source_type_, - std::move(callback)); -} - bool SyntheticTapGesture::AllowHighFrequencyDispatch() const { return false; }
diff --git a/content/browser/renderer_host/input/synthetic_tap_gesture.h b/content/browser/renderer_host/input/synthetic_tap_gesture.h index 1361745..b3d2bfc 100644 --- a/content/browser/renderer_host/input/synthetic_tap_gesture.h +++ b/content/browser/renderer_host/input/synthetic_tap_gesture.h
@@ -22,8 +22,6 @@ SyntheticGesture::Result ForwardInputEvents( const base::TimeTicks& timestamp, SyntheticGestureTarget* target) override; - void WaitForTargetAck(base::OnceClosure callback, - SyntheticGestureTarget* target) const override; bool AllowHighFrequencyDispatch() const override; private:
diff --git a/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.cc b/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.cc index b5cf50fb..851db15 100644 --- a/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.cc +++ b/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.cc
@@ -4,7 +4,6 @@ #include <stdint.h> -#include "base/callback.h" #include "content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.h" namespace content { @@ -51,13 +50,6 @@ : SyntheticGesture::GESTURE_RUNNING; } -void SyntheticTouchpadPinchGesture::WaitForTargetAck( - base::OnceClosure callback, - SyntheticGestureTarget* target) const { - target->WaitForTargetAck(params_.GetGestureType(), gesture_source_type_, - std::move(callback)); -} - void SyntheticTouchpadPinchGesture::ForwardGestureEvents( const base::TimeTicks& timestamp, SyntheticGestureTarget* target) {
diff --git a/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.h b/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.h index f3bb95c..7417dcb 100644 --- a/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.h +++ b/content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.h
@@ -25,8 +25,6 @@ SyntheticGesture::Result ForwardInputEvents( const base::TimeTicks& timestamp, SyntheticGestureTarget* target) override; - void WaitForTargetAck(base::OnceClosure callback, - SyntheticGestureTarget* target) const override; private: enum GestureState { SETUP, STARTED, IN_PROGRESS, DONE };
diff --git a/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.cc b/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.cc index 76effc1..8e1401a1 100644 --- a/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.cc +++ b/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.cc
@@ -54,13 +54,6 @@ : SyntheticGesture::GESTURE_RUNNING; } -void SyntheticTouchscreenPinchGesture::WaitForTargetAck( - base::OnceClosure callback, - SyntheticGestureTarget* target) const { - target->WaitForTargetAck(params_.GetGestureType(), gesture_source_type_, - std::move(callback)); -} - void SyntheticTouchscreenPinchGesture::ForwardTouchInputEvents( const base::TimeTicks& timestamp, SyntheticGestureTarget* target) {
diff --git a/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.h b/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.h index 81ceb36..addfb18 100644 --- a/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.h +++ b/content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.h
@@ -27,8 +27,6 @@ SyntheticGesture::Result ForwardInputEvents( const base::TimeTicks& timestamp, SyntheticGestureTarget* target) override; - void WaitForTargetAck(base::OnceClosure callback, - SyntheticGestureTarget* target) const override; private: enum GestureState { SETUP, STARTED, MOVING, DONE };
diff --git a/content/browser/renderer_host/input/touch_action_browsertest.cc b/content/browser/renderer_host/input/touch_action_browsertest.cc index 832bd54..daf2a80 100644 --- a/content/browser/renderer_host/input/touch_action_browsertest.cc +++ b/content/browser/renderer_host/input/touch_action_browsertest.cc
@@ -230,12 +230,6 @@ // touching the same area and scroll along the same direction. We purposely // trigger touch ack timeout for the first finger touch. All we need to ensure // is that the second finger also scrolled. - // TODO(bokan): This test isn't doing what's described. For one thing, the - // JankMainThread function will block the caller as well as the main thread - // so we're actually waiting 1.8s before starting the second scroll, by which - // point the first scroll has finished. Additionally, we can only run one - // synthetic gesture at a time so queueing two gestures will produce - // back-to-back scrolls rather than one two fingered scroll. void DoTwoFingerTouchScroll( bool wait_until_scrolled, const gfx::Vector2d& expected_scroll_position_after_scroll) { @@ -257,7 +251,8 @@ new SyntheticSmoothScrollGesture(params1)); GetWidgetHost()->QueueSyntheticGesture( std::move(gesture1), - base::BindOnce([](SyntheticGesture::Result result) {})); + base::BindOnce(&TouchActionBrowserTest::OnSyntheticGestureCompleted, + base::Unretained(this))); JankMainThread(kLongJankTime); GiveItSomeTime(800);
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index acfde551..72b1edb 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -319,9 +319,6 @@ std::unique_ptr<content::InputEvent> event) override { DLOG(WARNING) << "Input request on unbound interface"; } - void WaitForInputProcessed(WaitForInputProcessedCallback callback) override { - DLOG(WARNING) << "Input request on unbound interface"; - } void AttachSynchronousCompositor( mojom::SynchronousCompositorControlHostPtr control_host, mojom::SynchronousCompositorHostAssociatedPtrInfo host, @@ -1278,18 +1275,6 @@ input_router_->SendWheelEvent(wheel_with_latency); } -void RenderWidgetHostImpl::WaitForInputProcessed( - SyntheticGestureParams::GestureType type, - SyntheticGestureParams::GestureSourceType source, - base::OnceClosure callback) { - // TODO(bokan): Input can be queued and delayed in InputRouterImpl based on - // the kind of events we're getting. To be truly robust, we should wait until - // those queues are flushed before issuing this message. This will be done in - // a follow-up and is the reason for the currently unused type and source - // params. https://crbug.com/902446. - input_router_->WaitForInputProcessed(std::move(callback)); -} - void RenderWidgetHostImpl::ForwardEmulatedGestureEvent( const blink::WebGestureEvent& gesture_event) { ForwardGestureEvent(gesture_event);
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index 9c34847..768c9f0 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -409,12 +409,6 @@ const blink::WebMouseWheelEvent& wheel_event, const ui::LatencyInfo& latency) override; - // Resolves the given callback once all effects of prior input have been - // fully realized. - void WaitForInputProcessed(SyntheticGestureParams::GestureType type, - SyntheticGestureParams::GestureSourceType source, - base::OnceClosure callback); - // Retrieve an iterator over any RenderWidgetHosts that are immediately // embedded within this one. This does not return hosts that are embedded // indirectly (i.e. nested within embedded hosts).
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc index 2fd497d..6ebfa9c 100644 --- a/content/browser/renderer_host/render_widget_host_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -145,7 +145,6 @@ void OnHasTouchEventHandlers(bool has_handlers) override { has_handlers_ = has_handlers; } - void WaitForInputProcessed(base::OnceClosure callback) override {} bool sent_mouse_event_; bool sent_wheel_event_;
diff --git a/content/browser/storage_partition_impl.h b/content/browser/storage_partition_impl.h index c9fd76a..12a610a 100644 --- a/content/browser/storage_partition_impl.h +++ b/content/browser/storage_partition_impl.h
@@ -121,7 +121,7 @@ uint32_t quota_storage_remove_mask, const OriginMatcherFunction& origin_matcher, network::mojom::CookieDeletionFilterPtr cookie_deletion_filter, - bool perform_cleanup, + bool perform_storage_cleanup, const base::Time begin, const base::Time end, base::OnceClosure callback) override; @@ -259,7 +259,7 @@ const GURL& remove_origin, const OriginMatcherFunction& origin_matcher, network::mojom::CookieDeletionFilterPtr cookie_deletion_filter, - bool perform_cleanup, + bool perform_storage_cleanup, const base::Time begin, const base::Time end, base::OnceClosure callback);
diff --git a/content/browser/web_package/signed_exchange_handler.cc b/content/browser/web_package/signed_exchange_handler.cc index 80f495b..3628fcf 100644 --- a/content/browser/web_package/signed_exchange_handler.cc +++ b/content/browser/web_package/signed_exchange_handler.cc
@@ -486,10 +486,11 @@ cert_fetch_duration); unverified_cert_chain_ = std::move(cert_chain); + DCHECK(version_.has_value()); const SignedExchangeSignatureVerifier::Result verify_result = SignedExchangeSignatureVerifier::Verify( - *envelope_, unverified_cert_chain_->cert(), GetVerificationTime(), - devtools_proxy_.get()); + *version_, *envelope_, unverified_cert_chain_->cert(), + GetVerificationTime(), devtools_proxy_.get()); UMA_HISTOGRAM_ENUMERATION(kHistogramSignatureVerificationResult, verify_result); if (verify_result != SignedExchangeSignatureVerifier::Result::kSuccess) {
diff --git a/content/browser/web_package/signed_exchange_signature_verifier.cc b/content/browser/web_package/signed_exchange_signature_verifier.cc index d1ab700..472fe8df 100644 --- a/content/browser/web_package/signed_exchange_signature_verifier.cc +++ b/content/browser/web_package/signed_exchange_signature_verifier.cc
@@ -52,6 +52,19 @@ // draft-specific string beginning with "HTTP Exchange 1 " instead." // [spec text] // 5.3. "A single 0 byte which serves as a separator." [spec text] + "HTTP Exchange 1 b3"; +constexpr uint8_t kMessageHeaderB2[] = + // 5.1. "A string that consists of octet 32 (0x20) repeated 64 times." + // [spec text] + "\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20" + "\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20" + "\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20" + "\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20" + // 5.2. "A context string: the ASCII encoding of "HTTP Exchange 1"." ... + // "but implementations of drafts MUST NOT use it and MUST use another + // draft-specific string beginning with "HTTP Exchange 1 " instead." + // [spec text] + // 5.3. "A single 0 byte which serves as a separator." [spec text] "HTTP Exchange 1 b2"; constexpr base::TimeDelta kOneWeek = base::TimeDelta::FromDays(7); @@ -137,6 +150,7 @@ } base::Optional<std::vector<uint8_t>> GenerateSignedMessage( + SignedExchangeVersion version, const SignedExchangeEnvelope& envelope) { TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("loading"), "GenerateSignedMessage"); @@ -147,8 +161,13 @@ // Step 5. "Let message be the concatenation of the following byte strings." std::vector<uint8_t> message; // see kMessageHeader for Steps 5.1 to 5.3. - message.insert(message.end(), std::begin(kMessageHeader), - std::end(kMessageHeader)); + if (version == SignedExchangeVersion::kB2) { + message.insert(message.end(), std::begin(kMessageHeaderB2), + std::end(kMessageHeaderB2)); + } else { + message.insert(message.end(), std::begin(kMessageHeader), + std::end(kMessageHeader)); + } // Step 5.4. "If cert-sha256 is set, a byte holding the value 32 followed by // the 32 bytes of the value of cert-sha256. Otherwise a 0 byte." [spec text] @@ -246,6 +265,7 @@ } // namespace SignedExchangeSignatureVerifier::Result SignedExchangeSignatureVerifier::Verify( + SignedExchangeVersion version, const SignedExchangeEnvelope& envelope, scoped_refptr<net::X509Certificate> certificate, const base::Time& verification_time, @@ -287,7 +307,7 @@ return Result::kErrCertificateSHA256Mismatch; } - auto message = GenerateSignedMessage(envelope); + auto message = GenerateSignedMessage(version, envelope); if (!message) { signed_exchange_utils::ReportErrorAndTraceEvent( devtools_proxy, "Failed to reconstruct signed message.");
diff --git a/content/browser/web_package/signed_exchange_signature_verifier.h b/content/browser/web_package/signed_exchange_signature_verifier.h index b34a54a..a922598 100644 --- a/content/browser/web_package/signed_exchange_signature_verifier.h +++ b/content/browser/web_package/signed_exchange_signature_verifier.h
@@ -7,6 +7,7 @@ #include "base/memory/ref_counted.h" #include "base/optional.h" +#include "content/browser/web_package/signed_exchange_consts.h" #include "content/common/content_export.h" #include "net/cert/x509_certificate.h" #include "services/network/ignore_errors_cert_verifier.h" @@ -68,7 +69,8 @@ DISALLOW_COPY_AND_ASSIGN(IgnoreErrorsSPKIList); }; - static Result Verify(const SignedExchangeEnvelope& envelope, + static Result Verify(SignedExchangeVersion version, + const SignedExchangeEnvelope& envelope, scoped_refptr<net::X509Certificate> certificate, const base::Time& verification_time, SignedExchangeDevToolsProxy* devtools_proxy);
diff --git a/content/browser/web_package/signed_exchange_signature_verifier_unittest.cc b/content/browser/web_package/signed_exchange_signature_verifier_unittest.cc index 7f43981..9204092 100644 --- a/content/browser/web_package/signed_exchange_signature_verifier_unittest.cc +++ b/content/browser/web_package/signed_exchange_signature_verifier_unittest.cc
@@ -16,10 +16,10 @@ const uint64_t kSignatureHeaderDate = 1517892341; const uint64_t kSignatureHeaderExpires = 1517895941; -// See content/testdata/sxg/README on how to generate these data. +// See content/test/data/sxg/README on how to generate these data. // clang-format off -constexpr char kSignatureHeaderECDSAP256[] = R"(label; sig=*MEUCIQC7tM/B6YxVgrJmgfFawtwBKPev2vFCh7amR+JTDBMgTQIga9LkS51vteYr8NWPTCSZRy10lcLaFNN9m1G3OBS9lBs=*; validity-url="https://example.com/resource.validity.msg"; integrity="digest/mi-sha256-03"; cert-url="https://example.com/cert.msg"; cert-sha256=*KX+BYLSMgDOON8Ju65RoId39Qvajxa12HO+WnD4HpS0=*; date=1517892341; expires=1517895941)"; -constexpr uint8_t kCborHeadersECDSAP256[] = { +constexpr char kSignatureHeaderECDSAP256B2[] = R"(label; sig=*MEUCIQC7tM/B6YxVgrJmgfFawtwBKPev2vFCh7amR+JTDBMgTQIga9LkS51vteYr8NWPTCSZRy10lcLaFNN9m1G3OBS9lBs=*; validity-url="https://example.com/resource.validity.msg"; integrity="digest/mi-sha256-03"; cert-url="https://example.com/cert.msg"; cert-sha256=*KX+BYLSMgDOON8Ju65RoId39Qvajxa12HO+WnD4HpS0=*; date=1517892341; expires=1517895941)"; +constexpr uint8_t kCborHeadersECDSAP256B2[] = { 0x82, 0xa1, 0x47, 0x3a, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x43, 0x47, 0x45, 0x54, 0xa4, 0x46, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x58, 0x39, 0x6d, 0x69, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2d, 0x30, 0x33, @@ -35,7 +35,25 @@ 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x4c, 0x6d, 0x69, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2d, 0x30, 0x33 }; -constexpr char kSignatureHeaderECDSAP384[] = R"(label; sig=*MGUCMQDm3+Mf3ymTQOF2EUFk+NDIpOIqbFCboYsPD9YOV9rpayKTmAXzUD7Hxtp+XP/8mQECMEfTRcJmvL9QMAMKuDIzQqy/ib8MPeJHap9kQVQT1OdROaYj4EISngkJeT5om9/YlA==*; validity-url="https://example.com/resource.validity.msg"; integrity="digest/mi-sha256-03"; cert-url="https://example.com/cert.msg"; cert-sha256=*8X8y8nj8vDJHSSa0cxn+TCu+8zGpIJfbdzAnd5cW+jA=*; date=1517892341; expires=1517895941)"; +constexpr char kSignatureHeaderECDSAP384B2[] = R"(label; sig=*MGUCMQDm3+Mf3ymTQOF2EUFk+NDIpOIqbFCboYsPD9YOV9rpayKTmAXzUD7Hxtp+XP/8mQECMEfTRcJmvL9QMAMKuDIzQqy/ib8MPeJHap9kQVQT1OdROaYj4EISngkJeT5om9/YlA==*; validity-url="https://example.com/resource.validity.msg"; integrity="digest/mi-sha256-03"; cert-url="https://example.com/cert.msg"; cert-sha256=*8X8y8nj8vDJHSSa0cxn+TCu+8zGpIJfbdzAnd5cW+jA=*; date=1517892341; expires=1517895941)"; + +constexpr char kSignatureHeaderECDSAP256[] = R"(label; sig=*MEUCICLHwHwNFwbVUeu6a9AV8hVxvXfcYkWEMHnPFHYQfN/UAiEA3VQwLi1TJFvihZqasnpzuYlJte2E7Q4YEvtEnVZPOXE=*; validity-url="https://example.com/resource.validity.msg"; integrity="digest/mi-sha256-03"; cert-url="https://example.com/cert.msg"; cert-sha256=*KX+BYLSMgDOON8Ju65RoId39Qvajxa12HO+WnD4HpS0=*; date=1517892341; expires=1517895941)"; +constexpr uint8_t kCborHeadersECDSAP256[] = { + 0xa4, 0x46, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x58, 0x39, 0x6d, 0x69, + 0x2d, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2d, 0x30, 0x33, 0x3d, 0x77, + 0x6d, 0x70, 0x34, 0x64, 0x52, 0x4d, 0x59, 0x67, 0x78, 0x50, 0x33, 0x74, + 0x53, 0x4d, 0x43, 0x77, 0x56, 0x2f, 0x49, 0x30, 0x43, 0x57, 0x4f, 0x43, + 0x69, 0x48, 0x5a, 0x70, 0x41, 0x69, 0x68, 0x4b, 0x5a, 0x6b, 0x31, 0x39, + 0x62, 0x73, 0x4e, 0x39, 0x52, 0x49, 0x3d, 0x47, 0x3a, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x43, 0x32, 0x30, 0x30, 0x4c, 0x63, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x58, 0x18, 0x74, 0x65, + 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3b, 0x20, 0x63, 0x68, 0x61, + 0x72, 0x73, 0x65, 0x74, 0x3d, 0x75, 0x74, 0x66, 0x2d, 0x38, 0x50, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f, 0x64, + 0x69, 0x6e, 0x67, 0x4c, 0x6d, 0x69, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x35, + 0x36, 0x2d, 0x30, 0x33 +}; +constexpr char kSignatureHeaderECDSAP384[] = R"(label; sig=*MGQCMC0aEYoyk7KXfA3xy6RUiIMAk4t3VGe3aLVHZTQ67+ti1NuFP31x6UBhtuc87xXQRgIwUPJLxGuo6K4vGtBvI69lFY9cGUn/FmgiutReZ42Ju/onGt7RL1rjTe8AhsO1Z8xc*; validity-url="https://example.com/resource.validity.msg"; integrity="digest/mi-sha256-03"; cert-url="https://example.com/cert.msg"; cert-sha256=*8X8y8nj8vDJHSSa0cxn+TCu+8zGpIJfbdzAnd5cW+jA=*; date=1517892341; expires=1517895941)"; // clang-format on // |expires| (1518497142) is more than 7 days (604800 seconds) after |date| @@ -99,7 +117,8 @@ } // namespace -class SignedExchangeSignatureVerifierTest : public ::testing::Test { +class SignedExchangeSignatureVerifierTest + : public ::testing::TestWithParam<SignedExchangeVersion> { protected: SignedExchangeSignatureVerifierTest() {} @@ -115,7 +134,7 @@ base::HistogramTester histogram_tester; EXPECT_EQ(SignedExchangeSignatureVerifier::Result::kSuccess, SignedExchangeSignatureVerifier::Verify( - envelope, certificate, VerificationTime(), + GetParam(), envelope, certificate, VerificationTime(), nullptr /* devtools_proxy */)); histogram_tester.ExpectUniqueSample( "SignedExchange.TimeUntilExpiration", @@ -129,7 +148,7 @@ base::HistogramTester histogram_tester; EXPECT_EQ(SignedExchangeSignatureVerifier::Result::kErrInvalidTimestamp, SignedExchangeSignatureVerifier::Verify( - envelope, certificate, + GetParam(), envelope, certificate, base::Time::UnixEpoch() + base::TimeDelta::FromSeconds(kSignatureHeaderDate - 1), nullptr /* devtools_proxy */ @@ -146,7 +165,7 @@ base::HistogramTester histogram_tester; EXPECT_EQ(SignedExchangeSignatureVerifier::Result::kSuccess, SignedExchangeSignatureVerifier::Verify( - envelope, certificate, + GetParam(), envelope, certificate, base::Time::UnixEpoch() + base::TimeDelta::FromSeconds(kSignatureHeaderExpires), nullptr /* devtools_proxy */ @@ -162,7 +181,7 @@ base::HistogramTester histogram_tester; EXPECT_EQ(SignedExchangeSignatureVerifier::Result::kErrInvalidTimestamp, SignedExchangeSignatureVerifier::Verify( - envelope, certificate, + GetParam(), envelope, certificate, base::Time::UnixEpoch() + base::TimeDelta::FromSeconds( kSignatureHeaderExpires + 1), nullptr /* devtools_proxy */ @@ -185,8 +204,8 @@ (*invalid_expires_signature)[0]); EXPECT_EQ(SignedExchangeSignatureVerifier::Result::kErrInvalidTimestamp, SignedExchangeSignatureVerifier::Verify( - invalid_expires_envelope, certificate, VerificationTime(), - nullptr /* devtools_proxy */ + GetParam(), invalid_expires_envelope, certificate, + VerificationTime(), nullptr /* devtools_proxy */ )); SignedExchangeEnvelope corrupted_envelope(envelope); @@ -195,8 +214,8 @@ EXPECT_EQ(SignedExchangeSignatureVerifier::Result:: kErrSignatureVerificationFailed, SignedExchangeSignatureVerifier::Verify( - corrupted_envelope, certificate, VerificationTime(), - nullptr /* devtools_proxy */ + GetParam(), corrupted_envelope, certificate, + VerificationTime(), nullptr /* devtools_proxy */ )); SignedExchangeEnvelope badsig_envelope(envelope); @@ -206,7 +225,7 @@ EXPECT_EQ(SignedExchangeSignatureVerifier::Result:: kErrSignatureVerificationFailed, SignedExchangeSignatureVerifier::Verify( - badsig_envelope, certificate, VerificationTime(), + GetParam(), badsig_envelope, certificate, VerificationTime(), nullptr /* devtools_proxy */ )); @@ -217,16 +236,20 @@ badsigsha256_envelope.SetSignatureForTesting(badsigsha256); EXPECT_EQ( SignedExchangeSignatureVerifier::Result::kErrCertificateSHA256Mismatch, - SignedExchangeSignatureVerifier::Verify(badsigsha256_envelope, - certificate, VerificationTime(), - nullptr /* devtools_proxy */ - )); + SignedExchangeSignatureVerifier::Verify( + GetParam(), badsigsha256_envelope, certificate, VerificationTime(), + nullptr /* devtools_proxy */ + )); } }; -TEST_F(SignedExchangeSignatureVerifierTest, VerifyECDSAP256) { +TEST_P(SignedExchangeSignatureVerifierTest, VerifyECDSAP256) { + // TODO(crbug.com/919424) Remove support for kB2. + bool is_b2 = GetParam() == SignedExchangeVersion::kB2; + auto signature = SignedExchangeSignatureHeaderField::ParseSignature( - kSignatureHeaderECDSAP256, nullptr /* devtools_proxy */); + is_b2 ? kSignatureHeaderECDSAP256B2 : kSignatureHeaderECDSAP256, + nullptr /* devtools_proxy */); ASSERT_TRUE(signature.has_value()); ASSERT_EQ(1u, signature->size()); @@ -245,16 +268,24 @@ envelope.AddResponseHeader("content-encoding", "mi-sha256-03"); envelope.AddResponseHeader( "digest", "mi-sha256-03=wmp4dRMYgxP3tSMCwV/I0CWOCiHZpAihKZk19bsN9RI="); - envelope.set_cbor_header(base::make_span(kCborHeadersECDSAP256)); + if (is_b2) { + envelope.set_cbor_header(base::make_span(kCborHeadersECDSAP256B2)); + } else { + envelope.set_cbor_header(base::make_span(kCborHeadersECDSAP256)); + } envelope.SetSignatureForTesting((*signature)[0]); TestVerifierGivenValidInput(envelope, certlist[0]); } -TEST_F(SignedExchangeSignatureVerifierTest, VerifyECDSAP384) { +TEST_P(SignedExchangeSignatureVerifierTest, VerifyECDSAP384) { + // TODO(crbug.com/919424) Remove support for kB2. + bool is_b2 = GetParam() == SignedExchangeVersion::kB2; + auto signature = SignedExchangeSignatureHeaderField::ParseSignature( - kSignatureHeaderECDSAP384, nullptr /* devtools_proxy */); + is_b2 ? kSignatureHeaderECDSAP384B2 : kSignatureHeaderECDSAP384, + nullptr /* devtools_proxy */); ASSERT_TRUE(signature.has_value()); ASSERT_EQ(1u, signature->size()); @@ -278,11 +309,11 @@ EXPECT_EQ(SignedExchangeSignatureVerifier::Result::kErrUnsupportedCertType, SignedExchangeSignatureVerifier::Verify( - envelope, certlist[0], VerificationTime(), + GetParam(), envelope, certlist[0], VerificationTime(), nullptr /* devtools_proxy */)); } -TEST_F(SignedExchangeSignatureVerifierTest, IgnoreErrorsSPKIList) { +TEST_P(SignedExchangeSignatureVerifierTest, IgnoreErrorsSPKIList) { SignedExchangeSignatureVerifier::IgnoreErrorsSPKIList ignore_nothing(""); SignedExchangeSignatureVerifier::IgnoreErrorsSPKIList ignore_ecdsap256( kPEMECDSAP256SPKIHash); @@ -310,4 +341,9 @@ EXPECT_TRUE(ignore_both.ShouldIgnoreError(cert_ecdsap384)); } +INSTANTIATE_TEST_CASE_P(SignedExchangeSignatureVerifierTests, + SignedExchangeSignatureVerifierTest, + ::testing::Values(SignedExchangeVersion::kB2, + SignedExchangeVersion::kB3)); + } // namespace content
diff --git a/content/common/input/input_handler.mojom b/content/common/input/input_handler.mojom index 4978308..95741e1 100644 --- a/content/common/input/input_handler.mojom +++ b/content/common/input/input_handler.mojom
@@ -260,13 +260,6 @@ // after the event is processed. DispatchNonBlockingEvent(Event event); - // Forces input to be flushed and resolves the callback only once the input - // has been fully processed, meaning its effects are visible to the full - // system. In practice, this will force a redraw and wait until the new - // CompositorFrame (containing all changes caused by prior input) has been - // displayed. - WaitForInputProcessed() => (); - // Attach the synchronous compositor interface. This method only // should be called for Android WebView. AttachSynchronousCompositor(
diff --git a/content/public/browser/storage_partition.h b/content/public/browser/storage_partition.h index 6fe4d0bd..80083ad 100644 --- a/content/public/browser/storage_partition.h +++ b/content/public/browser/storage_partition.h
@@ -183,10 +183,10 @@ // (created_after_time/created_before_time), so when deleting cookies // |begin| and |end| will be used ignoring the interval in // |cookie_deletion_filter|. - // If |perform_cleanup| is true, the storage will try to remove traces - // about deleted data from disk. This is an expensive operation that should - // only be performed if we are sure that almost all data will be deleted - // anyway. + // If |perform_storage_cleanup| is true, the storage will try to remove + // traces about deleted data from disk. This is an expensive operation that + // should only be performed if we are sure that almost all data will be + // deleted anyway. // * |callback| is called when data deletion is done or at least the deletion // is scheduled. // Note: Make sure you know what you are doing before clearing cookies @@ -196,7 +196,7 @@ uint32_t quota_storage_remove_mask, const OriginMatcherFunction& origin_matcher, network::mojom::CookieDeletionFilterPtr cookie_deletion_filter, - bool perform_cleanup, + bool perform_storage_cleanup, const base::Time begin, const base::Time end, base::OnceClosure callback) = 0;
diff --git a/content/public/test/test_storage_partition.cc b/content/public/test/test_storage_partition.cc index a90dea1..691475e 100644 --- a/content/public/test/test_storage_partition.cc +++ b/content/public/test/test_storage_partition.cc
@@ -119,7 +119,7 @@ uint32_t quota_storage_remove_mask, const OriginMatcherFunction& origin_matcher, network::mojom::CookieDeletionFilterPtr cookie_deletion_filter, - bool perform_cleanup, + bool perform_storage_cleanup, const base::Time begin, const base::Time end, base::OnceClosure callback) {}
diff --git a/content/public/test/test_storage_partition.h b/content/public/test/test_storage_partition.h index 9d99e4c..f6f1460 100644 --- a/content/public/test/test_storage_partition.h +++ b/content/public/test/test_storage_partition.h
@@ -153,7 +153,7 @@ uint32_t quota_storage_remove_mask, const OriginMatcherFunction& origin_matcher, network::mojom::CookieDeletionFilterPtr cookie_deletion_filter, - bool perform_cleanup, + bool perform_storage_cleanup, const base::Time begin, const base::Time end, base::OnceClosure callback) override;
diff --git a/content/renderer/accessibility/blink_ax_tree_source.cc b/content/renderer/accessibility/blink_ax_tree_source.cc index 91f7578..143eaf0 100644 --- a/content/renderer/accessibility/blink_ax_tree_source.cc +++ b/content/renderer/accessibility/blink_ax_tree_source.cc
@@ -966,6 +966,7 @@ } if (src.IsScrollableContainer()) { + dst->AddBoolAttribute(ax::mojom::BoolAttribute::kScrollable, true); const gfx::Point& scroll_offset = src.GetScrollOffset(); dst->AddIntAttribute(ax::mojom::IntAttribute::kScrollX, scroll_offset.x()); dst->AddIntAttribute(ax::mojom::IntAttribute::kScrollY, scroll_offset.y());
diff --git a/content/renderer/input/widget_input_handler_impl.cc b/content/renderer/input/widget_input_handler_impl.cc index fbc544cf..e1ac787a 100644 --- a/content/renderer/input/widget_input_handler_impl.cc +++ b/content/renderer/input/widget_input_handler_impl.cc
@@ -160,12 +160,6 @@ DispatchEventCallback()); } -void WidgetInputHandlerImpl::WaitForInputProcessed( - WaitForInputProcessedCallback callback) { - // TODO(bokan): Implement this to actually ensure input is processed. - std::move(callback).Run(); -} - void WidgetInputHandlerImpl::AttachSynchronousCompositor( mojom::SynchronousCompositorControlHostPtr control_host, mojom::SynchronousCompositorHostAssociatedPtrInfo host,
diff --git a/content/renderer/input/widget_input_handler_impl.h b/content/renderer/input/widget_input_handler_impl.h index 4e9fa4e..689f973a 100644 --- a/content/renderer/input/widget_input_handler_impl.h +++ b/content/renderer/input/widget_input_handler_impl.h
@@ -54,7 +54,6 @@ void DispatchEvent(std::unique_ptr<content::InputEvent>, DispatchEventCallback callback) override; void DispatchNonBlockingEvent(std::unique_ptr<content::InputEvent>) override; - void WaitForInputProcessed(WaitForInputProcessedCallback callback) override; void AttachSynchronousCompositor( mojom::SynchronousCompositorControlHostPtr control_host, mojom::SynchronousCompositorHostAssociatedPtrInfo host,
diff --git a/content/renderer/media/stream/media_stream_constraints_util.h b/content/renderer/media/stream/media_stream_constraints_util.h index 544bba0..15434db 100644 --- a/content/renderer/media/stream/media_stream_constraints_util.h +++ b/content/renderer/media/stream/media_stream_constraints_util.h
@@ -10,6 +10,7 @@ #include "base/logging.h" #include "content/common/content_export.h" #include "content/renderer/media/stream/media_stream_audio_processor_options.h" +#include "content/renderer/media/stream/media_stream_constraints_util_sets.h" #include "content/renderer/media/stream/video_track_adapter.h" #include "media/base/video_facing.h" #include "media/capture/video_capture_types.h" @@ -19,12 +20,6 @@ namespace content { -namespace media_constraints { -class ResolutionSet; -template <typename T> -class NumericRangeSet; -} // namespace media_constraints - extern const double kMinDeviceCaptureFrameRate; // This class represents the output the SelectSettings algorithm for video @@ -290,30 +285,6 @@ const blink::StringConstraint blink::WebMediaTrackConstraintSet::*picker, std::string* value); -template <typename ConstraintType> -bool ConstraintHasMax(const ConstraintType& constraint) { - return constraint.HasMax() || constraint.HasExact(); -} - -template <typename ConstraintType> -bool ConstraintHasMin(const ConstraintType& constraint) { - return constraint.HasMin() || constraint.HasExact(); -} - -template <typename ConstraintType> -auto ConstraintMax(const ConstraintType& constraint) - -> decltype(constraint.Max()) { - DCHECK(ConstraintHasMax(constraint)); - return constraint.HasExact() ? constraint.Exact() : constraint.Max(); -} - -template <typename ConstraintType> -auto ConstraintMin(const ConstraintType& constraint) - -> decltype(constraint.Min()) { - DCHECK(ConstraintHasMin(constraint)); - return constraint.HasExact() ? constraint.Exact() : constraint.Min(); -} - // If |value| is outside the range of |constraint|, returns the name of the // failed constraint. Otherwise, returns nullptr. The return value converts to // bool in the expected way.
diff --git a/content/renderer/media/stream/media_stream_constraints_util_sets.h b/content/renderer/media/stream/media_stream_constraints_util_sets.h index 529fee3..d79c525d 100644 --- a/content/renderer/media/stream/media_stream_constraints_util_sets.h +++ b/content/renderer/media/stream/media_stream_constraints_util_sets.h
@@ -16,13 +16,38 @@ #include "base/optional.h" #include "base/stl_util.h" #include "content/common/content_export.h" -#include "content/renderer/media/stream/media_stream_constraints_util.h" +#include "third_party/blink/public/platform/web_media_constraints.h" namespace blink { struct WebMediaTrackConstraintSet; } namespace content { + +template <typename ConstraintType> +bool ConstraintHasMax(const ConstraintType& constraint) { + return constraint.HasMax() || constraint.HasExact(); +} + +template <typename ConstraintType> +bool ConstraintHasMin(const ConstraintType& constraint) { + return constraint.HasMin() || constraint.HasExact(); +} + +template <typename ConstraintType> +auto ConstraintMax(const ConstraintType& constraint) + -> decltype(constraint.Max()) { + DCHECK(ConstraintHasMax(constraint)); + return constraint.HasExact() ? constraint.Exact() : constraint.Max(); +} + +template <typename ConstraintType> +auto ConstraintMin(const ConstraintType& constraint) + -> decltype(constraint.Min()) { + DCHECK(ConstraintHasMin(constraint)); + return constraint.HasExact() ? constraint.Exact() : constraint.Min(); +} + namespace media_constraints { // This class template represents a set of candidates suitable for a numeric
diff --git a/content/renderer/notifications/notification_data_conversions.cc b/content/renderer/notifications/notification_data_conversions.cc index 72c20d6..790609b 100644 --- a/content/renderer/notifications/notification_data_conversions.cc +++ b/content/renderer/notifications/notification_data_conversions.cc
@@ -8,6 +8,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" +#include "third_party/blink/public/mojom/notifications/notification.mojom-shared.h" #include "third_party/blink/public/platform/modules/notifications/web_notification_action.h" #include "third_party/blink/public/platform/url_conversion.h" #include "third_party/blink/public/platform/web_string.h" @@ -23,16 +24,15 @@ const blink::PlatformNotificationData& platform_data) { WebNotificationData web_data; web_data.title = WebString::FromUTF16(platform_data.title); - switch (platform_data.direction) { case blink::PlatformNotificationData::DIRECTION_LEFT_TO_RIGHT: - web_data.direction = WebNotificationData::kDirectionLeftToRight; + web_data.direction = blink::mojom::NotificationDirection::LEFT_TO_RIGHT; break; case blink::PlatformNotificationData::DIRECTION_RIGHT_TO_LEFT: - web_data.direction = WebNotificationData::kDirectionRightToLeft; + web_data.direction = blink::mojom::NotificationDirection::RIGHT_TO_LEFT; break; case blink::PlatformNotificationData::DIRECTION_AUTO: - web_data.direction = WebNotificationData::kDirectionAuto; + web_data.direction = blink::mojom::NotificationDirection::AUTO; break; }
diff --git a/content/renderer/notifications/notification_data_conversions_unittest.cc b/content/renderer/notifications/notification_data_conversions_unittest.cc index d1e90ce..527dd6b 100644 --- a/content/renderer/notifications/notification_data_conversions_unittest.cc +++ b/content/renderer/notifications/notification_data_conversions_unittest.cc
@@ -77,7 +77,7 @@ blink::WebNotificationData web_data = ToWebNotificationData(platform_data); EXPECT_EQ(kNotificationTitle, web_data.title); - EXPECT_EQ(blink::WebNotificationData::kDirectionLeftToRight, + EXPECT_EQ(blink::mojom::NotificationDirection::LEFT_TO_RIGHT, web_data.direction); EXPECT_EQ(kNotificationLang, web_data.lang); EXPECT_EQ(kNotificationBody, web_data.body);
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 14ee1647..e0f1d95 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc
@@ -786,6 +786,11 @@ settings->SetSmartInsertDeleteEnabled(prefs.smart_insert_delete_enabled); settings->SetSpatialNavigationEnabled(prefs.spatial_navigation_enabled); + // Spatnav depends on KeyboardFocusableScrollers. The WebUI team has + // disabled KFS because they need more time to update their custom elements, + // crbug.com/907284. Meanwhile, we pre-ship KFS to spatnav users. + if (prefs.spatial_navigation_enabled) + WebRuntimeFeatures::EnableKeyboardFocusableScrollers(true); settings->SetSelectionIncludesAltImageText(true);
diff --git a/content/renderer/render_widget_unittest.cc b/content/renderer/render_widget_unittest.cc index 0d4622cac..113adb6 100644 --- a/content/renderer/render_widget_unittest.cc +++ b/content/renderer/render_widget_unittest.cc
@@ -203,10 +203,7 @@ } protected: - ~InteractiveRenderWidget() override { - Close(); - webwidget_internal_ = nullptr; - } + ~InteractiveRenderWidget() override { webwidget_internal_ = nullptr; } // Overridden from RenderWidget: bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override {
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 890017a..1963f0f 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -848,7 +848,6 @@ "../browser/renderer_host/input/main_thread_event_queue_browsertest.cc", "../browser/renderer_host/input/mouse_latency_browsertest.cc", "../browser/renderer_host/input/scroll_latency_browsertest.cc", - "../browser/renderer_host/input/synthetic_input_browsertest.cc", "../browser/renderer_host/input/touch_action_browsertest.cc", "../browser/renderer_host/input/touch_input_browsertest.cc", "../browser/renderer_host/input/touch_selection_controller_client_aura_browsertest.cc",
diff --git a/content/test/fuzzer/fuzzer_support.cc b/content/test/fuzzer/fuzzer_support.cc index 73a288d..8ff96f71 100644 --- a/content/test/fuzzer/fuzzer_support.cc +++ b/content/test/fuzzer/fuzzer_support.cc
@@ -42,7 +42,6 @@ gin::V8Initializer::LoadV8Natives(); #endif gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, - gin::IsolateHolder::kStableV8Extras, gin::ArrayBufferAllocator::SharedInstance()); adapter = std::make_unique<RenderViewTestAdapter>();
diff --git a/content/test/mock_widget_input_handler.cc b/content/test/mock_widget_input_handler.cc index 67e15c3..de339f9 100644 --- a/content/test/mock_widget_input_handler.cc +++ b/content/test/mock_widget_input_handler.cc
@@ -104,11 +104,6 @@ std::move(event), DispatchEventCallback())); } -void MockWidgetInputHandler::WaitForInputProcessed( - WaitForInputProcessedCallback callback) { - NOTREACHED(); -} - MockWidgetInputHandler::MessageVector MockWidgetInputHandler::GetAndResetDispatchedMessages() { MessageVector dispatched_events;
diff --git a/content/test/mock_widget_input_handler.h b/content/test/mock_widget_input_handler.h index 43ef32c..4e87ef92 100644 --- a/content/test/mock_widget_input_handler.h +++ b/content/test/mock_widget_input_handler.h
@@ -216,7 +216,6 @@ DispatchEventCallback callback) override; void DispatchNonBlockingEvent( std::unique_ptr<content::InputEvent> event) override; - void WaitForInputProcessed(WaitForInputProcessedCallback callback) override; void AttachSynchronousCompositor( mojom::SynchronousCompositorControlHostPtr control_host, mojom::SynchronousCompositorHostAssociatedPtrInfo host,
diff --git a/docs/README.md b/docs/README.md index c03c6537..933f296 100644 --- a/docs/README.md +++ b/docs/README.md
@@ -154,7 +154,7 @@ * [Web Test Expectations and Baselines](testing/web_test_expectations.md) - Setting expected results of web tests. * [Web Tests Tips](testing/web_tests_tips.md) - Best practices for web tests -* [Web Tests with Manual Fallback](testing/webt_tests_with_manual_fallback.md) - +* [Web Tests with Manual Fallback](testing/web_tests_with_manual_fallback.md) - Writing tests that simulate manual interventions * [Extending the Web Test Framework](how_to_extend_web_test_framework.md) * [Fixing Web Test Flakiness](testing/identifying_tests_that_depend_on_order.md) -
diff --git a/docs/documentation_guidelines.md b/docs/documentation_guidelines.md index 14f2d4d..e934bbc 100644 --- a/docs/documentation_guidelines.md +++ b/docs/documentation_guidelines.md
@@ -65,7 +65,7 @@ If you got this far and have some experience with Chromium's code, you'll have figured out that these guidelines are aspirational more than what the world looks like today. So what do we do when working with existing code. -First off: ***[Documentation changes can be TBRed](https://chromium.googlesource.com/chromium/src/+/master/docs/code_reviews.md#TBR_ing-documentation-updates)***. Even in-code changes. If you have discovered something that isn't documented, have figured out how it works and would like to pay it forward, feel free to write something down and check it in. +First off: ***[Documentation changes can be TBRed](https://chromium.googlesource.com/chromium/src/+/master/docs/code_reviews.md#documentation-updates)***. Even in-code changes. If you have discovered something that isn't documented, have figured out how it works and would like to pay it forward, feel free to write something down and check it in. At the component level, if you are the owner of a component that isn't documented, please add a README.md with content as per the above.
diff --git a/docs/testing/web_tests.md b/docs/testing/web_tests.md index c2c514a..e09fdd2 100644 --- a/docs/testing/web_tests.md +++ b/docs/testing/web_tests.md
@@ -1,4 +1,4 @@ -# Web Tests (formly known as "Layout Tests" "LayoutTests") +# Web Tests (formerly known as "Layout Tests" or "LayoutTests") Web tests are used by Blink to test many components, including but not limited to layout and rendering. In general, web tests involve loading pages @@ -492,8 +492,7 @@ the above command will overwrite the current baselines at their original locations with the actual results. The current baseline means the `-expected.*` file used to compare the actual result when the test is run locally, i.e. the -first file found in the [baseline search path] -(https://cs.chromium.org/search/?q=port/base.py+baseline_search_path). +first file found in the [baseline search path](https://cs.chromium.org/search/?q=port/base.py+baseline_search_path). If there are no current baselines, the above command will create new baselines in the platform-independent directory, e.g.
diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_attach_helper.cc b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_attach_helper.cc index bf31d0e..7dcd7b8 100644 --- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_attach_helper.cc +++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_attach_helper.cc
@@ -183,6 +183,8 @@ // The renderer (parent of the plugin frame) tries to load a MimeHandlerView // and therefore this navigation should be treated as renderer initiated. params.is_renderer_initiated = true; + params.initiator_origin = + url::Origin::Create(parent_site_instance_->GetSiteURL()); web_contents()->GetController().LoadURLWithParams(params); }
diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc index ad0dae9b..a1c6f29 100644 --- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc +++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
@@ -369,6 +369,7 @@ content::OpenURLParams open_params(target_url, content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, true); + open_params.initiator_origin = opener->GetLastCommittedOrigin(); // Extensions are allowed to open popups under circumstances covered by // running as a mime handler. open_params.user_gesture = true;
diff --git a/extensions/renderer/bindings/api_binding_test.cc b/extensions/renderer/bindings/api_binding_test.cc index fb6d022..f13dfd1 100644 --- a/extensions/renderer/bindings/api_binding_test.cc +++ b/extensions/renderer/bindings/api_binding_test.cc
@@ -30,7 +30,6 @@ #endif gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, - gin::IsolateHolder::kStableV8Extras, gin::ArrayBufferAllocator::SharedInstance()); isolate_holder_ = std::make_unique<gin::IsolateHolder>(
diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc index 5670a2e..5577bbbb 100644 --- a/gin/isolate_holder.cc +++ b/gin/isolate_holder.cc
@@ -119,11 +119,10 @@ // static void IsolateHolder::Initialize(ScriptMode mode, - V8ExtrasMode v8_extras_mode, v8::ArrayBuffer::Allocator* allocator, const intptr_t* reference_table) { CHECK(allocator); - V8Initializer::Initialize(mode, v8_extras_mode); + V8Initializer::Initialize(mode); g_array_buffer_allocator = allocator; g_reference_table = reference_table; }
diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h index 8cb2646..413e6c5 100644 --- a/gin/public/isolate_holder.h +++ b/gin/public/isolate_holder.h
@@ -46,12 +46,6 @@ kAllowAtomicsWait }; - // Indicates whether V8 works with stable or experimental v8 extras. - enum V8ExtrasMode { - kStableV8Extras, - kStableAndExperimentalV8Extras, - }; - // Indicates how the Isolate instance will be created. enum class IsolateCreationMode { kNormal, @@ -96,7 +90,6 @@ // external references, |reference_table| needs to point an array of those // reference pointers. Otherwise, it can be nullptr. static void Initialize(ScriptMode mode, - V8ExtrasMode v8_extras_mode, v8::ArrayBuffer::Allocator* allocator, const intptr_t* reference_table = nullptr);
diff --git a/gin/shell/gin_main.cc b/gin/shell/gin_main.cc index eb0c686..5243c46 100644 --- a/gin/shell/gin_main.cc +++ b/gin/shell/gin_main.cc
@@ -82,7 +82,6 @@ { gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, - gin::IsolateHolder::kStableV8Extras, gin::ArrayBufferAllocator::SharedInstance()); gin::IsolateHolder instance( base::ThreadTaskRunnerHandle::Get(),
diff --git a/gin/shell_runner_unittest.cc b/gin/shell_runner_unittest.cc index 1a5ad6b..8c0873a 100644 --- a/gin/shell_runner_unittest.cc +++ b/gin/shell_runner_unittest.cc
@@ -34,7 +34,6 @@ #endif gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, - gin::IsolateHolder::kStableV8Extras, gin::ArrayBufferAllocator::SharedInstance()); gin::IsolateHolder instance(base::ThreadTaskRunnerHandle::Get(), gin::IsolateHolder::IsolateType::kTest);
diff --git a/gin/test/v8_test.cc b/gin/test/v8_test.cc index bb5b7f9..e19e660 100644 --- a/gin/test/v8_test.cc +++ b/gin/test/v8_test.cc
@@ -27,7 +27,6 @@ gin::V8Initializer::LoadV8Natives(); #endif gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, - gin::IsolateHolder::kStableV8Extras, gin::ArrayBufferAllocator::SharedInstance()); instance_ = CreateIsolateHolder();
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc index 4b3ef5cf..006f6f4a 100644 --- a/gin/v8_initializer.cc +++ b/gin/v8_initializer.cc
@@ -204,8 +204,7 @@ } // namespace // static -void V8Initializer::Initialize(IsolateHolder::ScriptMode mode, - IsolateHolder::V8ExtrasMode v8_extras_mode) { +void V8Initializer::Initialize(IsolateHolder::ScriptMode mode) { static bool v8_is_initialized = false; if (v8_is_initialized) return; @@ -224,10 +223,6 @@ static const char use_strict[] = "--use_strict"; v8::V8::SetFlagsFromString(use_strict, sizeof(use_strict) - 1); } - if (IsolateHolder::kStableAndExperimentalV8Extras == v8_extras_mode) { - static const char flag[] = "--experimental_extras"; - v8::V8::SetFlagsFromString(flag, sizeof(flag) - 1); - } #if defined(V8_USE_EXTERNAL_STARTUP_DATA) v8::StartupData natives;
diff --git a/gin/v8_initializer.h b/gin/v8_initializer.h index a749ccb..aa3863a 100644 --- a/gin/v8_initializer.h +++ b/gin/v8_initializer.h
@@ -20,8 +20,7 @@ class GIN_EXPORT V8Initializer { public: // This should be called by IsolateHolder::Initialize(). - static void Initialize(IsolateHolder::ScriptMode mode, - IsolateHolder::V8ExtrasMode v8_extras_mode); + static void Initialize(IsolateHolder::ScriptMode mode); // Get address and size information for currently loaded snapshot. // If no snapshot is loaded, the return values are null for addresses
diff --git a/google_apis/gaia/oauth2_token_service.h b/google_apis/gaia/oauth2_token_service.h index f6d1191f..efddd6a 100644 --- a/google_apis/gaia/oauth2_token_service.h +++ b/google_apis/gaia/oauth2_token_service.h
@@ -11,6 +11,7 @@ #include <memory> #include <set> #include <string> +#include <vector> #include "base/gtest_prod_util.h" #include "base/macros.h" @@ -210,10 +211,15 @@ // Lists account IDs of all accounts with a refresh token maintained by this // instance. + // Note: For each account returned by |GetAccounts|, |RefreshTokenIsAvailable| + // will return true. + // Note: If tokens have not been fully loaded yet, an empty list is returned. std::vector<std::string> GetAccounts() const; // Returns true if a refresh token exists for |account_id|. If false, calls to // |StartRequest| will result in a Consumer::OnGetTokenFailure callback. + // Note: This will return |true| if and only if |account_id| is contained in + // the list returned by |GetAccounts|. bool RefreshTokenIsAvailable(const std::string& account_id) const; // Returns true if a refresh token exists for |account_id| and it is in a
diff --git a/google_apis/gaia/oauth2_token_service_delegate.h b/google_apis/gaia/oauth2_token_service_delegate.h index fde751e..5e0b1ab 100644 --- a/google_apis/gaia/oauth2_token_service_delegate.h +++ b/google_apis/gaia/oauth2_token_service_delegate.h
@@ -5,6 +5,10 @@ #ifndef GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_DELEGATE_H_ #define GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_DELEGATE_H_ +#include <set> +#include <string> +#include <vector> + #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/observer_list.h" @@ -43,14 +47,23 @@ scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, OAuth2AccessTokenConsumer* consumer) = 0; + // Returns |true| if a refresh token is available for |account_id|, and + // |false| otherwise. + // Note: Implementations must make sure that |RefreshTokenIsAvailable| returns + // |true| if and only if |account_id| is contained in the list of accounts + // returned by |GetAccounts|. virtual bool RefreshTokenIsAvailable(const std::string& account_id) const = 0; virtual GoogleServiceAuthError GetAuthError( const std::string& account_id) const; virtual void UpdateAuthError(const std::string& account_id, const GoogleServiceAuthError& error) {} + // Returns a list of accounts for which a refresh token is maintained by + // |this| instance. + // Note: If tokens have not been fully loaded yet, an empty list is returned. + // Also, see |RefreshTokenIsAvailable|. virtual std::vector<std::string> GetAccounts(); - virtual void RevokeAllCredentials(){}; + virtual void RevokeAllCredentials() {} virtual void InvalidateAccessToken(const std::string& account_id, const std::string& client_id,
diff --git a/ios/chrome/browser/about_flags.mm b/ios/chrome/browser/about_flags.mm index 743d055..8409911 100644 --- a/ios/chrome/browser/about_flags.mm +++ b/ios/chrome/browser/about_flags.mm
@@ -485,12 +485,19 @@ {"find-in-page-iframe", flag_descriptions::kFindInPageiFrameName, flag_descriptions::kFindInPageiFrameDescription, flags_ui::kOsIos, FEATURE_VALUE_TYPE(kFindInPageiFrame)}, - {"search-copied-image", flag_descriptions::kSearchCopiedImageName, - flag_descriptions::kSearchCopiedImageDescription, flags_ui::kOsIos, - FEATURE_VALUE_TYPE(kSearchCopiedImage)}, - {"copied-text-behavior", flag_descriptions::kCopiedTextBehaviorName, - flag_descriptions::kCopiedTextBehaviorName, flags_ui::kOsIos, - FEATURE_VALUE_TYPE(omnibox::kCopiedTextBehavior)}, + {"enable-clipboard-provider-text-suggestions", + flag_descriptions::kEnableClipboardProviderTextSuggestionsName, + flag_descriptions::kEnableClipboardProviderTextSuggestionsDescription, + flags_ui::kOsIos, + FEATURE_VALUE_TYPE(omnibox::kEnableClipboardProviderTextSuggestions)}, + {"enable-clipboard-provider-image-suggestions", + flag_descriptions::kEnableClipboardProviderImageSuggestionsName, + flag_descriptions::kEnableClipboardProviderImageSuggestionsDescription, + flags_ui::kOsIos, + FEATURE_VALUE_TYPE(omnibox::kEnableClipboardProviderImageSuggestions)}, + {"copied-content-behavior", flag_descriptions::kCopiedContentBehaviorName, + flag_descriptions::kCopiedContentBehaviorName, flags_ui::kOsIos, + FEATURE_VALUE_TYPE(kCopiedContentBehavior)}, {"new-password-form-parsing-for-saving", flag_descriptions::kNewPasswordFormParsingForSavingName, flag_descriptions::kNewPasswordFormParsingForSavingDescription,
diff --git a/ios/chrome/browser/ios_chrome_flag_descriptions.cc b/ios/chrome/browser/ios_chrome_flag_descriptions.cc index f2530c29..32e4c561 100644 --- a/ios/chrome/browser/ios_chrome_flag_descriptions.cc +++ b/ios/chrome/browser/ios_chrome_flag_descriptions.cc
@@ -218,6 +218,12 @@ const char kContextualSearchDescription[] = "Whether or not Contextual Search is enabled."; +const char kCopiedContentBehaviorName[] = + "Enable differentiating between copied urls, text, and images"; +const char kCopiedContentBehaviorDescription[] = + "When enabled, places that handled copied urls (omnibox long-press, toolbar" + "menus) will differentiate between copied urls, text, and images."; + const char kDetectMainThreadFreezeName[] = "Detect freeze in the main thread."; const char kDetectMainThreadFreezeDescription[] = "A crash report will be uploaded if the main thread is frozen more than " @@ -230,6 +236,16 @@ const char kNewClearBrowsingDataUIDescription[] = "Enable new Clear Browsing Data UI."; +const char kEnableClipboardProviderTextSuggestionsName[] = + "Enable copied text provider"; +const char kEnableClipboardProviderTextSuggestionsDescription[] = + "Enable suggesting a search for text copied to the clipboard"; + +const char kEnableClipboardProviderImageSuggestionsName[] = + "Enable copied image provider"; +const char kEnableClipboardProviderImageSuggestionsDescription[] = + "Enable suggesting a search for the image copied to the clipboard"; + const char kFCMInvalidationsName[] = "Enable invalidations delivery via new FCM based protocol"; const char kFCMInvalidationsDescription[] = @@ -326,11 +342,6 @@ const char kIgnoresViewportScaleLimitsDescription[] = "When enabled the page can always be scaled, regardless of author intent."; -const char kSearchCopiedImageName[] = "Search copied image"; -const char kSearchCopiedImageDescription[] = - "Enable searching from the toolbar search button for an image copied to " - "the system pasteboard."; - const char kSearchIconToggleName[] = "Change the icon for the search button"; const char kSearchIconToggleDescription[] = "Different icons for the search button."; @@ -349,12 +360,6 @@ const char kSSOWithWKWebViewDescription[] = "Using WKWebView instead of UIWebView in SSO"; -const char kCopiedTextBehaviorName[] = - "Enable differentiating between copied text and urls"; -const char kCopiedTextBehaviorDescription[] = - "When enabled, places that handled copied urls (omnibox long-press, toolbar" - "menus) will differentiate between copied text and copied images."; - const char kToolbarContainerName[] = "Use Toolbar Containers"; const char kToolbarContainerDescription[] = "When enabled, the toolbars and their fullscreen animations will be "
diff --git a/ios/chrome/browser/ios_chrome_flag_descriptions.h b/ios/chrome/browser/ios_chrome_flag_descriptions.h index f5dc67a..bfa4cbdd 100644 --- a/ios/chrome/browser/ios_chrome_flag_descriptions.h +++ b/ios/chrome/browser/ios_chrome_flag_descriptions.h
@@ -172,6 +172,11 @@ extern const char kContextualSearch[]; extern const char kContextualSearchDescription[]; +// Title and description for the flag to diffentiate between copied +// urls, strings, and images. +extern const char kCopiedContentBehaviorName[]; +extern const char kCopiedContentBehaviorDescription[]; + // Title and description for the flag to enable drag and drop. extern const char kDragAndDropName[]; extern const char kDragAndDropDescription[]; @@ -180,6 +185,16 @@ extern const char kNewClearBrowsingDataUIName[]; extern const char kNewClearBrowsingDataUIDescription[]; +// Title and description for the flag to enable the clipboard provider to +// suggest copied text +extern const char kEnableClipboardProviderTextSuggestionsName[]; +extern const char kEnableClipboardProviderTextSuggestionsDescription[]; + +// Title and description for the flag to enable the clipboard provider to +// suggest searchihng for copied imagse +extern const char kEnableClipboardProviderImageSuggestionsName[]; +extern const char kEnableClipboardProviderImageSuggestionsDescription[]; + // Title and description for the flag to enable invaliations delivery via FCM. extern const char kFCMInvalidationsName[]; extern const char kFCMInvalidationsDescription[]; @@ -261,10 +276,6 @@ extern const char kIgnoresViewportScaleLimitsName[]; extern const char kIgnoresViewportScaleLimitsDescription[]; -// Title and description for the flag to enable searching for a copied image. -extern const char kSearchCopiedImageName[]; -extern const char kSearchCopiedImageDescription[]; - // Title and description for the flag to toggle the flag of the search button. extern const char kSearchIconToggleName[]; extern const char kSearchIconToggleDescription[]; @@ -283,11 +294,6 @@ extern const char kSSOWithWKWebViewName[]; extern const char kSSOWithWKWebViewDescription[]; -// Title and description for the flag to diffentiate between copied -// text and urls. -extern const char kCopiedTextBehaviorName[]; -extern const char kCopiedTextBehaviorDescription[]; - // Title and description for the flag to enable the toolbar container // implementation. extern const char kToolbarContainerName[];
diff --git a/ios/chrome/browser/signin/account_consistency_service_factory.mm b/ios/chrome/browser/signin/account_consistency_service_factory.mm index 4bde82972..139bb42 100644 --- a/ios/chrome/browser/signin/account_consistency_service_factory.mm +++ b/ios/chrome/browser/signin/account_consistency_service_factory.mm
@@ -12,8 +12,8 @@ #include "ios/chrome/browser/content_settings/cookie_settings_factory.h" #include "ios/chrome/browser/signin/account_reconcilor_factory.h" #include "ios/chrome/browser/signin/gaia_cookie_manager_service_factory.h" +#include "ios/chrome/browser/signin/identity_manager_factory.h" #include "ios/chrome/browser/signin/signin_client_factory.h" -#include "ios/chrome/browser/signin/signin_manager_factory.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -29,7 +29,7 @@ DependsOn(ios::CookieSettingsFactory::GetInstance()); DependsOn(GaiaCookieManagerServiceFactory::GetInstance()); DependsOn(SigninClientFactory::GetInstance()); - DependsOn(ios::SigninManagerFactory::GetInstance()); + DependsOn(IdentityManagerFactory::GetInstance()); } AccountConsistencyServiceFactory::~AccountConsistencyServiceFactory() {} @@ -63,7 +63,7 @@ ios::CookieSettingsFactory::GetForBrowserState(chrome_browser_state), GaiaCookieManagerServiceFactory::GetForBrowserState(chrome_browser_state), SigninClientFactory::GetForBrowserState(chrome_browser_state), - ios::SigninManagerFactory::GetForBrowserState(chrome_browser_state)); + IdentityManagerFactory::GetForBrowserState(chrome_browser_state)); } } // namespace ios
diff --git a/ios/chrome/browser/tabs/tab_model.mm b/ios/chrome/browser/tabs/tab_model.mm index 0005638..baaaac7 100644 --- a/ios/chrome/browser/tabs/tab_model.mm +++ b/ios/chrome/browser/tabs/tab_model.mm
@@ -820,12 +820,12 @@ #pragma mark - CRWWebStateObserver - (void)webState:(web::WebState*)webState - didCommitNavigationWithDetails: - (const web::LoadCommittedDetails&)load_details { + didFinishNavigation:(web::NavigationContext*)navigation { Tab* tab = LegacyTabHelper::GetTabForWebState(webState); [self notifyTabChanged:tab]; - if (!load_details.is_in_page && !self.offTheRecord) { + if (!navigation->IsSameDocument() && navigation->HasCommitted() && + !self.offTheRecord) { int tabCount = static_cast<int>(self.count); UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.TabCountPerLoad", tabCount, 1, 200, 50); } @@ -897,12 +897,6 @@ webState->GetBrowserState())]; } -- (void)webState:(web::WebState*)webState - didFinishNavigation:(web::NavigationContext*)navigation { - Tab* tab = LegacyTabHelper::GetTabForWebState(webState); - [self notifyTabChanged:tab]; -} - - (void)webState:(web::WebState*)webState didLoadPageWithSuccess:(BOOL)success { DCHECK(!webState->IsLoading()); Tab* tab = LegacyTabHelper::GetTabForWebState(webState);
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_accessory_view_controller.mm b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_accessory_view_controller.mm index c8842af7..76985411 100644 --- a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_accessory_view_controller.mm +++ b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_accessory_view_controller.mm
@@ -137,7 +137,6 @@ - (void)loadView { self.view = [[UIView alloc] init]; - self.view.accessibilityViewIsModal = YES; self.view.translatesAutoresizingMaskIntoConstraints = NO; NSMutableArray<UIView*>* icons = [[NSMutableArray alloc] init];
diff --git a/ios/chrome/browser/ui/location_bar/location_bar_view_controller.mm b/ios/chrome/browser/ui/location_bar/location_bar_view_controller.mm index ac87603..04758e9 100644 --- a/ios/chrome/browser/ui/location_bar/location_bar_view_controller.mm +++ b/ios/chrome/browser/ui/location_bar/location_bar_view_controller.mm
@@ -432,7 +432,7 @@ // when it's the first time setting the first responder. dispatch_async(dispatch_get_main_queue(), ^{ UIMenuController* menu = [UIMenuController sharedMenuController]; - if (base::FeatureList::IsEnabled(omnibox::kCopiedTextBehavior)) { + if (base::FeatureList::IsEnabled(kCopiedContentBehavior)) { UIMenuItem* visitCopiedLink = [[UIMenuItem alloc] initWithTitle:l10n_util::GetNSString(IDS_IOS_VISIT_COPIED_LINK) action:@selector(visitCopiedLink:)]; @@ -458,19 +458,19 @@ return true; } - // Remove along with flag kCopiedTextBehavior + // remove along with flag kCopiedContentBehavior if (action == @selector(pasteAndGo:)) { - DCHECK(!base::FeatureList::IsEnabled(omnibox::kCopiedTextBehavior)); + DCHECK(!base::FeatureList::IsEnabled(kCopiedContentBehavior)); return UIPasteboard.generalPasteboard.string.length > 0; } ClipboardRecentContent* clipboardRecentContent = ClipboardRecentContent::GetInstance(); if (action == @selector(visitCopiedLink:)) { - DCHECK(base::FeatureList::IsEnabled(omnibox::kCopiedTextBehavior)); + DCHECK(base::FeatureList::IsEnabled(kCopiedContentBehavior)); return clipboardRecentContent->GetRecentURLFromClipboard().has_value(); } if (action == @selector(searchCopiedText:)) { - DCHECK(base::FeatureList::IsEnabled(omnibox::kCopiedTextBehavior)); + DCHECK(base::FeatureList::IsEnabled(kCopiedContentBehavior)); return !clipboardRecentContent->GetRecentURLFromClipboard().has_value() && clipboardRecentContent->GetRecentTextFromClipboard().has_value(); } @@ -493,7 +493,7 @@ // so we need two different selectors. - (void)pasteAndGo:(id)sender { NSString* query; - if (base::FeatureList::IsEnabled(omnibox::kCopiedTextBehavior)) { + if (base::FeatureList::IsEnabled(kCopiedContentBehavior)) { ClipboardRecentContent* clipboardRecentContent = ClipboardRecentContent::GetInstance(); if (base::Optional<GURL> optional_url =
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_view_controller.mm b/ios/chrome/browser/ui/omnibox/omnibox_view_controller.mm index ef46e57..ad51c641 100644 --- a/ios/chrome/browser/ui/omnibox/omnibox_view_controller.mm +++ b/ios/chrome/browser/ui/omnibox/omnibox_view_controller.mm
@@ -81,7 +81,7 @@ // Add Paste and Go option to the editing menu UIMenuController* menu = [UIMenuController sharedMenuController]; - if (base::FeatureList::IsEnabled(omnibox::kCopiedTextBehavior)) { + if (base::FeatureList::IsEnabled(kCopiedContentBehavior)) { UIMenuItem* visitCopiedLink = [[UIMenuItem alloc] initWithTitle:l10n_util::GetNSString(IDS_IOS_VISIT_COPIED_LINK) action:@selector(visitCopiedLink:)]; @@ -243,19 +243,19 @@ #pragma mark - UIMenuItem - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { - // Remove with flag kCopiedTextBehavior + // Remove with flag kCopiedContentBehavior if (action == @selector(pasteAndGo:)) { - DCHECK(!base::FeatureList::IsEnabled(omnibox::kCopiedTextBehavior)); + DCHECK(!base::FeatureList::IsEnabled(kCopiedContentBehavior)); return UIPasteboard.generalPasteboard.string.length > 0; } ClipboardRecentContent* clipboardRecentContent = ClipboardRecentContent::GetInstance(); if (action == @selector(visitCopiedLink:)) { - DCHECK(base::FeatureList::IsEnabled(omnibox::kCopiedTextBehavior)); + DCHECK(base::FeatureList::IsEnabled(kCopiedContentBehavior)); return clipboardRecentContent->GetRecentURLFromClipboard().has_value(); } if (action == @selector(searchCopiedText:)) { - DCHECK(base::FeatureList::IsEnabled(omnibox::kCopiedTextBehavior)); + DCHECK(base::FeatureList::IsEnabled(kCopiedContentBehavior)); return !clipboardRecentContent->GetRecentURLFromClipboard().has_value() && clipboardRecentContent->GetRecentTextFromClipboard().has_value(); } @@ -274,7 +274,7 @@ // so we need two different selectors. - (void)pasteAndGo:(id)sender { NSString* query; - if (base::FeatureList::IsEnabled(omnibox::kCopiedTextBehavior)) { + if (base::FeatureList::IsEnabled(kCopiedContentBehavior)) { ClipboardRecentContent* clipboardRecentContent = ClipboardRecentContent::GetInstance(); if (base::Optional<GURL> optional_url =
diff --git a/ios/chrome/browser/ui/popup_menu/BUILD.gn b/ios/chrome/browser/ui/popup_menu/BUILD.gn index d22edf9..cc50390 100644 --- a/ios/chrome/browser/ui/popup_menu/BUILD.gn +++ b/ios/chrome/browser/ui/popup_menu/BUILD.gn
@@ -40,7 +40,6 @@ "//base", "//components/bookmarks/browser", "//components/feature_engagement/public", - "//components/omnibox/browser:browser", "//components/open_from_clipboard", "//ios/chrome/app/strings", "//ios/chrome/browser", @@ -51,6 +50,7 @@ "//ios/chrome/browser/reading_list", "//ios/chrome/browser/search_engines", "//ios/chrome/browser/ui", + "//ios/chrome/browser/ui:feature_flags", "//ios/chrome/browser/ui/activity_services", "//ios/chrome/browser/ui/bookmarks", "//ios/chrome/browser/ui/bubble",
diff --git a/ios/chrome/browser/ui/popup_menu/popup_menu_action_handler.mm b/ios/chrome/browser/ui/popup_menu/popup_menu_action_handler.mm index 01469037a..3b552be9 100644 --- a/ios/chrome/browser/ui/popup_menu/popup_menu_action_handler.mm +++ b/ios/chrome/browser/ui/popup_menu/popup_menu_action_handler.mm
@@ -9,7 +9,6 @@ #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" #include "base/strings/sys_string_conversions.h" -#include "components/omnibox/browser/omnibox_field_trial.h" #include "components/open_from_clipboard/clipboard_recent_content.h" #import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/browser_commands.h" @@ -18,6 +17,7 @@ #import "ios/chrome/browser/ui/popup_menu/popup_menu_action_handler_commands.h" #import "ios/chrome/browser/ui/popup_menu/public/cells/popup_menu_item.h" #import "ios/chrome/browser/ui/popup_menu/public/popup_menu_table_view_controller.h" +#import "ios/chrome/browser/ui/ui_feature_flags.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -132,7 +132,7 @@ case PopupMenuActionPasteAndGo: { RecordAction(UserMetricsAction("MobileMenuPasteAndGo")); NSString* query; - if (base::FeatureList::IsEnabled(omnibox::kCopiedTextBehavior)) { + if (base::FeatureList::IsEnabled(kCopiedContentBehavior)) { ClipboardRecentContent* clipboardRecentContent = ClipboardRecentContent::GetInstance(); if (base::Optional<GURL> optional_url = @@ -157,7 +157,7 @@ [self.dispatcher showQRScanner]; break; case PopupMenuActionSearchCopiedImage: { - DCHECK(base::FeatureList::IsEnabled(omnibox::kCopiedTextBehavior)); + DCHECK(base::FeatureList::IsEnabled(kCopiedContentBehavior)); RecordAction(UserMetricsAction("MobileMenuSearchCopiedImage")); ClipboardRecentContent* clipboardRecentContent = ClipboardRecentContent::GetInstance();
diff --git a/ios/chrome/browser/ui/popup_menu/popup_menu_mediator.mm b/ios/chrome/browser/ui/popup_menu/popup_menu_mediator.mm index 51065b5..7b19ac7 100644 --- a/ios/chrome/browser/ui/popup_menu/popup_menu_mediator.mm +++ b/ios/chrome/browser/ui/popup_menu/popup_menu_mediator.mm
@@ -10,7 +10,6 @@ #include "components/bookmarks/browser/bookmark_model.h" #include "components/feature_engagement/public/feature_constants.h" #include "components/feature_engagement/public/tracker.h" -#include "components/omnibox/browser/omnibox_field_trial.h" #include "components/open_from_clipboard/clipboard_recent_content.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/chrome_url_constants.h" @@ -28,6 +27,7 @@ #import "ios/chrome/browser/ui/popup_menu/public/popup_menu_consumer.h" #import "ios/chrome/browser/ui/reading_list/reading_list_menu_notification_delegate.h" #import "ios/chrome/browser/ui/reading_list/reading_list_menu_notifier.h" +#import "ios/chrome/browser/ui/ui_feature_flags.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" #import "ios/chrome/browser/web_state_list/web_state_list_observer_bridge.h" @@ -589,7 +589,7 @@ - (void)createSearchMenuItems { NSMutableArray* items = [NSMutableArray array]; - if (base::FeatureList::IsEnabled(omnibox::kCopiedTextBehavior)) { + if (base::FeatureList::IsEnabled(kCopiedContentBehavior)) { ClipboardRecentContent* clipboardRecentContent = ClipboardRecentContent::GetInstance(); PopupMenuToolsItem* copiedContentItem = nil;
diff --git a/ios/chrome/browser/ui/settings/sync_encryption_passphrase_table_view_controller.mm b/ios/chrome/browser/ui/settings/sync_encryption_passphrase_table_view_controller.mm index 948ba75..07d661a4 100644 --- a/ios/chrome/browser/ui/settings/sync_encryption_passphrase_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/sync_encryption_passphrase_table_view_controller.mm
@@ -4,20 +4,20 @@ #import "ios/chrome/browser/ui/settings/sync_encryption_passphrase_table_view_controller.h" +#include <memory> + #include "base/i18n/time_formatting.h" #include "base/mac/foundation_util.h" #include "base/strings/sys_string_conversions.h" #include "components/browser_sync/profile_sync_service.h" #include "components/google/core/common/google_util.h" -#include "components/signin/core/browser/profile_oauth2_token_service.h" -#import "components/signin/ios/browser/oauth2_token_service_observer_bridge.h" #include "components/strings/grit/components_strings.h" #include "ios/chrome/browser/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/chrome_url_constants.h" #import "ios/chrome/browser/signin/authentication_service.h" #include "ios/chrome/browser/signin/authentication_service_factory.h" -#include "ios/chrome/browser/signin/profile_oauth2_token_service_factory.h" +#include "ios/chrome/browser/signin/identity_manager_factory.h" #include "ios/chrome/browser/sync/profile_sync_service_factory.h" #include "ios/chrome/browser/sync/sync_setup_service.h" #include "ios/chrome/browser/sync/sync_setup_service_factory.h" @@ -31,6 +31,7 @@ #import "ios/chrome/browser/ui/util/uikit_ui_util.h" #include "ios/chrome/grit/ios_strings.h" #import "ios/public/provider/chrome/browser/signin/chrome_identity.h" +#import "services/identity/public/objc/identity_manager_observer_bridge.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util_mac.h" #include "url/gurl.h" @@ -49,7 +50,7 @@ } // namespace @interface SyncEncryptionPassphraseTableViewController () < - OAuth2TokenServiceObserverBridgeDelegate, + IdentityManagerObserverBridgeDelegate, SettingsControllerProtocol> { ios::ChromeBrowserState* browserState_; // Whether the decryption progress is currently being shown. @@ -57,7 +58,8 @@ NSString* savedTitle_; UIBarButtonItem* savedLeftButton_; std::unique_ptr<SyncObserverBridge> syncObserver_; - std::unique_ptr<OAuth2TokenServiceObserverBridge> tokenServiceObserver_; + std::unique_ptr<identity::IdentityManagerObserverBridge> + identityManagerObserver_; UITextField* passphrase_; } @@ -100,9 +102,9 @@ _processingMessage = l10n_util::GetNSString(IDS_SYNC_LOGIN_SETTING_UP); _footerMessage = l10n_util::GetNSString(IDS_IOS_SYNC_PASSPHRASE_RECOVER); - tokenServiceObserver_.reset(new OAuth2TokenServiceObserverBridge( - ProfileOAuth2TokenServiceFactory::GetForBrowserState(browserState_), - self)); + identityManagerObserver_ = + std::make_unique<identity::IdentityManagerObserverBridge>( + IdentityManagerFactory::GetForBrowserState(browserState_), self); } return self; } @@ -406,7 +408,7 @@ // phase to avoid observing sync events for a browser state that is being // killed. syncObserver_.reset(); - tokenServiceObserver_.reset(); + identityManagerObserver_.reset(); } #pragma mark - UIControl events listener @@ -473,9 +475,9 @@ [self reloadData]; } -#pragma mark - OAuth2TokenServiceObserverBridgeDelegate +#pragma mark - IdentityManagerObserverBridgeDelegate -- (void)onEndBatchChanges { +- (void)onEndBatchOfRefreshTokenStateChanges { if (AuthenticationServiceFactory::GetForBrowserState(browserState_) ->IsAuthenticated()) { return;
diff --git a/ios/chrome/browser/ui/tab_grid/grid/grid_cell.mm b/ios/chrome/browser/ui/tab_grid/grid/grid_cell.mm index 721581a..070ffdf 100644 --- a/ios/chrome/browser/ui/tab_grid/grid/grid_cell.mm +++ b/ios/chrome/browser/ui/tab_grid/grid/grid_cell.mm
@@ -40,6 +40,12 @@ } // namespace @interface GridCell () +// The constraints enabled under accessibility font size. +@property(nonatomic, strong) + NSArray<NSLayoutConstraint*>* accessibilityConstraints; +// The constraints enabled under normal font size. +@property(nonatomic, strong) + NSArray<NSLayoutConstraint*>* nonAccessibilityConstraints; // Header height of the cell. @property(nonatomic, strong) NSLayoutConstraint* topBarHeight; // Visual components of the cell. @@ -66,7 +72,6 @@ // Private properties. @synthesize topBarHeight = _topBarHeight; @synthesize topBar = _topBar; -@synthesize iconView = _iconView; @synthesize snapshotView = _snapshotView; @synthesize titleLabel = _titleLabel; @synthesize closeIconView = _closeIconView; @@ -132,6 +137,20 @@ return self; } +#pragma mark - UIView + +- (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection { + BOOL isPreviousAccessibilityCategory = + UIContentSizeCategoryIsAccessibilityCategory( + previousTraitCollection.preferredContentSizeCategory); + BOOL isCurrentAccessibilityCategory = + UIContentSizeCategoryIsAccessibilityCategory( + self.traitCollection.preferredContentSizeCategory); + if (isPreviousAccessibilityCategory ^ isCurrentAccessibilityCategory) { + [self updateTopBar]; + } +} + #pragma mark - UICollectionViewCell - (void)setHighlighted:(BOOL)highlighted { @@ -254,7 +273,15 @@ _titleLabel = titleLabel; _closeIconView = closeIconView; - NSArray* constraints = @[ + _accessibilityConstraints = @[ + [titleLabel.leadingAnchor + constraintEqualToAnchor:topBar.leadingAnchor + constant:kGridCellHeaderLeadingInset], + [iconView.widthAnchor constraintEqualToConstant:0], + [iconView.heightAnchor constraintEqualToConstant:0], + ]; + + _nonAccessibilityConstraints = @[ [iconView.leadingAnchor constraintEqualToAnchor:topBar.leadingAnchor constant:kGridCellHeaderLeadingInset], @@ -264,6 +291,9 @@ [titleLabel.leadingAnchor constraintEqualToAnchor:iconView.trailingAnchor constant:kGridCellHeaderLeadingInset], + ]; + + NSArray* constraints = @[ [titleLabel.centerYAnchor constraintEqualToAnchor:topBar.centerYAnchor], [titleLabel.trailingAnchor constraintLessThanOrEqualToAnchor:closeIconView.leadingAnchor @@ -283,9 +313,25 @@ forAxis:UILayoutConstraintAxisHorizontal]; [closeIconView setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + + [self updateTopBar]; return topBar; } +// Update constraints of top bar when system font size changes. If accessibility +// font size is chosen, the favicon will be hidden, and the title text will be +// shown in two lines. +- (void)updateTopBar { + if (UIContentSizeCategoryIsAccessibilityCategory( + self.traitCollection.preferredContentSizeCategory)) { + [NSLayoutConstraint deactivateConstraints:_nonAccessibilityConstraints]; + [NSLayoutConstraint activateConstraints:_accessibilityConstraints]; + } else { + [NSLayoutConstraint deactivateConstraints:_accessibilityConstraints]; + [NSLayoutConstraint activateConstraints:_nonAccessibilityConstraints]; + } +} + // Sets up the selection border. The tint color is set when the theme is // selected. - (void)setupSelectedBackgroundView {
diff --git a/ios/chrome/browser/ui/tab_grid/tab_grid_bottom_toolbar.h b/ios/chrome/browser/ui/tab_grid/tab_grid_bottom_toolbar.h index 182034a..5427496 100644 --- a/ios/chrome/browser/ui/tab_grid/tab_grid_bottom_toolbar.h +++ b/ios/chrome/browser/ui/tab_grid/tab_grid_bottom_toolbar.h
@@ -7,13 +7,27 @@ #import <UIKit/UIKit.h> +#import "ios/chrome/browser/ui/tab_grid/tab_grid_paging.h" + @class TabGridNewTabButton; -// Bottom toolbar for TabGrid. In horizontal-compact and vertical-regular screen -// size, the toolbar has a translucent background and shows 3 buttons, with -// newTabButton located in the middle. For other screen sizes, the toolbar has a -// transparent background and only shows the newTabButton on the right. +// Bottom toolbar for TabGrid. The appearance of the toolbar is decided by +// screen size and current TabGrid page: +// +// Horizontal-compact and vertical-regular screen size: +// Small newTabButton, translucent background. +// Incognito & Regular page: [leadingButton, newTabButton, trailingButton] +// Remote page: [ trailingButton] +// +// Other screen size: +// Large newTabButton, transparent background. +// Incognito & Regular page: [ newTabButton] +// Remote page: [ ] @interface TabGridBottomToolbar : UIToolbar +// This property together with self.traitCollection control the items shown +// in toolbar and its background color. Setting this property will also set it +// on |newTabButton|. +@property(nonatomic, assign) TabGridPage page; // These components are publicly available to allow the user to set their // contents, visibility and actions. @property(nonatomic, strong, readonly) UIBarButtonItem* leadingButton;
diff --git a/ios/chrome/browser/ui/tab_grid/tab_grid_bottom_toolbar.mm b/ios/chrome/browser/ui/tab_grid/tab_grid_bottom_toolbar.mm index 920f5366..8eec742 100644 --- a/ios/chrome/browser/ui/tab_grid/tab_grid_bottom_toolbar.mm +++ b/ios/chrome/browser/ui/tab_grid/tab_grid_bottom_toolbar.mm
@@ -43,29 +43,47 @@ - (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection { [super traitCollectionDidChange:previousTraitCollection]; - [self setItemsForTraitCollection:self.traitCollection]; + [self updateLayout]; +} + +#pragma mark - Public + +- (void)setPage:(TabGridPage)page { + if (page == _page) + return; + _page = page; + self.newTabButton.page = page; + [self updateLayout]; } #pragma mark - Private -- (void)setItemsForTraitCollection:(UITraitCollection*)traitCollection { - if ([self shouldUseCompactLayout]) { - _newTabButton.sizeClass = TabGridNewTabButtonSizeClassSmall; - [self setItems:@[ - self.leadingButton, _spaceItem, _newTabButton, _spaceItem, - self.trailingButton - ]]; - self.clipsToBounds = NO; - [self setBackgroundImage:_translucentBackground - forToolbarPosition:UIBarPositionAny - barMetrics:UIBarMetricsDefault]; +- (void)updateLayout { + if (self.page == TabGridPageRemoteTabs) { + if ([self shouldUseCompactLayout]) { + [self setItems:@[ _spaceItem, self.trailingButton ]]; + } else { + [self setItems:@[]]; + } } else { - _newTabButton.sizeClass = TabGridNewTabButtonSizeClassLarge; - [self setItems:@[ _spaceItem, _newTabButton ]]; - self.clipsToBounds = YES; - [self setBackgroundImage:_transparentBackground - forToolbarPosition:UIToolbarPositionAny - barMetrics:UIBarMetricsDefault]; + if ([self shouldUseCompactLayout]) { + self.newTabButton.sizeClass = TabGridNewTabButtonSizeClassSmall; + [self setItems:@[ + self.leadingButton, _spaceItem, _newTabButton, _spaceItem, + self.trailingButton + ]]; + self.clipsToBounds = NO; + [self setBackgroundImage:_translucentBackground + forToolbarPosition:UIBarPositionAny + barMetrics:UIBarMetricsDefault]; + } else { + self.newTabButton.sizeClass = TabGridNewTabButtonSizeClassLarge; + [self setItems:@[ _spaceItem, _newTabButton ]]; + self.clipsToBounds = YES; + [self setBackgroundImage:_transparentBackground + forToolbarPosition:UIToolbarPositionAny + barMetrics:UIBarMetricsDefault]; + } } } @@ -97,7 +115,7 @@ barMetrics:UIBarMetricsDefault]; _transparentBackground = [[UIImage alloc] init]; - [self setItemsForTraitCollection:self.traitCollection]; + [self updateLayout]; } // Returns YES if should use compact bottom toolbar layout.
diff --git a/ios/chrome/browser/ui/tab_grid/tab_grid_new_tab_button.mm b/ios/chrome/browser/ui/tab_grid/tab_grid_new_tab_button.mm index 98b1c2d9..ad3f021 100644 --- a/ios/chrome/browser/ui/tab_grid/tab_grid_new_tab_button.mm +++ b/ios/chrome/browser/ui/tab_grid/tab_grid_new_tab_button.mm
@@ -80,22 +80,18 @@ #pragma mark - Public - (void)setPage:(TabGridPage)page { + if (page == _page) + return; switch (page) { case TabGridPageIncognitoTabs: - self.enabled = YES; - self.button.alpha = 1.0; self.button.accessibilityLabel = l10n_util::GetNSString(IDS_IOS_TAB_GRID_CREATE_NEW_INCOGNITO_TAB); break; case TabGridPageRegularTabs: - self.enabled = YES; - self.button.alpha = 1.0; self.button.accessibilityLabel = l10n_util::GetNSString(IDS_IOS_TAB_GRID_CREATE_NEW_TAB); break; case TabGridPageRemoteTabs: - self.enabled = NO; - self.button.alpha = 0.0; break; } self.title = self.button.accessibilityLabel;
diff --git a/ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm b/ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm index 166dc734..a0e1a63 100644 --- a/ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm +++ b/ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm
@@ -793,7 +793,7 @@ } - (void)configureButtonsForActiveAndCurrentPage { - self.bottomToolbar.newTabButton.page = self.currentPage; + self.bottomToolbar.page = self.currentPage; if (self.currentPage == TabGridPageRemoteTabs) { [self configureDoneButtonBasedOnPage:self.activePage]; } else {
diff --git a/ios/chrome/browser/ui/ui_feature_flags.cc b/ios/chrome/browser/ui/ui_feature_flags.cc index 11b56fd..93c94900 100644 --- a/ios/chrome/browser/ui/ui_feature_flags.cc +++ b/ios/chrome/browser/ui/ui_feature_flags.cc
@@ -14,8 +14,8 @@ const base::Feature kOmniboxPopupShortcutIconsInZeroState{ "OmniboxPopupShortcutIconsInZeroState", base::FEATURE_DISABLED_BY_DEFAULT}; -const base::Feature kSearchCopiedImage{"SearchCopiedImage", - base::FEATURE_DISABLED_BY_DEFAULT}; - const base::Feature kSnapshotDrawView{"SnapshotDrawView", base::FEATURE_DISABLED_BY_DEFAULT}; + +const base::Feature kCopiedContentBehavior{"CopiedContentBehavior", + base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/ios/chrome/browser/ui/ui_feature_flags.h b/ios/chrome/browser/ui/ui_feature_flags.h index ce226b9..5f96af5 100644 --- a/ios/chrome/browser/ui/ui_feature_flags.h +++ b/ios/chrome/browser/ui/ui_feature_flags.h
@@ -18,10 +18,10 @@ // popup instead of ZeroSuggest. extern const base::Feature kOmniboxPopupShortcutIconsInZeroState; -// Feature to allow user to search for a copied image. -extern const base::Feature kSearchCopiedImage; - // Feature to take snapshots using |-drawViewHierarchy:|. extern const base::Feature kSnapshotDrawView; +// Feature to rework handling of copied content (url/string/image) in the ui. +extern const base::Feature kCopiedContentBehavior; + #endif // IOS_CHROME_BROWSER_UI_UI_FEATURE_FLAGS_H_
diff --git a/ios/web/download/download_controller_impl.h b/ios/web/download/download_controller_impl.h index 966186b..9caddfe 100644 --- a/ios/web/download/download_controller_impl.h +++ b/ios/web/download/download_controller_impl.h
@@ -42,7 +42,6 @@ // DownloadTaskImpl::Delegate overrides: void OnTaskDestroyed(DownloadTaskImpl* task) override; NSURLSession* CreateSession(NSString* identifier, - NSArray<NSHTTPCookie*>* cookies, id<NSURLSessionDataDelegate> delegate, NSOperationQueue* delegate_queue) override;
diff --git a/ios/web/download/download_controller_impl.mm b/ios/web/download/download_controller_impl.mm index fbdb86d..871dc6e 100644 --- a/ios/web/download/download_controller_impl.mm +++ b/ios/web/download/download_controller_impl.mm
@@ -84,18 +84,11 @@ NSURLSession* DownloadControllerImpl::CreateSession( NSString* identifier, - NSArray<NSHTTPCookie*>* cookies, id<NSURLSessionDataDelegate> delegate, NSOperationQueue* delegate_queue) { NSURLSessionConfiguration* configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:identifier]; - // Cookies have to be set in session configuration before the session is - // created. Once the session is created, the configuration object can't be - // edited and configuration property will return a copy of the originally used - // configuration. - for (NSHTTPCookie* cookie in cookies) { - [configuration.HTTPCookieStorage setCookie:cookie]; - } + std::string user_agent = GetWebClient()->GetUserAgent(UserAgentType::MOBILE); configuration.HTTPAdditionalHeaders = @{ base::SysUTF8ToNSString(net::HttpRequestHeaders::kUserAgent) :
diff --git a/ios/web/download/download_controller_impl_unittest.mm b/ios/web/download/download_controller_impl_unittest.mm index bc66b8b..55d901e 100644 --- a/ios/web/download/download_controller_impl_unittest.mm +++ b/ios/web/download/download_controller_impl_unittest.mm
@@ -31,32 +31,29 @@ // Test fixture for testing DownloadControllerImpl class. class DownloadControllerImplTest : public WebTest { protected: - DownloadControllerImplTest() - : download_controller_(std::make_unique<DownloadControllerImpl>()), - delegate_(download_controller_.get()) { + DownloadControllerImplTest() : delegate_(download_controller()) { web_state_.SetBrowserState(GetBrowserState()); } + DownloadController* download_controller() { + return DownloadController::FromBrowserState(GetBrowserState()); + } + TestWebState web_state_; - std::unique_ptr<DownloadControllerImpl> download_controller_; FakeDownloadControllerDelegate delegate_; }; // Tests that DownloadController::GetDelegate returns delegate_. TEST_F(DownloadControllerImplTest, Delegate) { - ASSERT_EQ(&delegate_, download_controller_->GetDelegate()); + ASSERT_EQ(&delegate_, download_controller()->GetDelegate()); } // Tests that DownloadController::FromBrowserState returns the same object for // each call. TEST_F(DownloadControllerImplTest, FromBrowserState) { - DownloadController* first_call_controller = - DownloadController::FromBrowserState(GetBrowserState()); - ASSERT_TRUE(first_call_controller); - DownloadController* second_call_controller = - DownloadController::FromBrowserState(GetBrowserState()); - - ASSERT_EQ(first_call_controller, second_call_controller); + DownloadController* controller = download_controller(); + ASSERT_TRUE(controller); + ASSERT_EQ(controller, download_controller()); } // Tests that DownloadController::CreateDownloadTask calls @@ -64,7 +61,7 @@ TEST_F(DownloadControllerImplTest, OnDownloadCreated) { NSString* identifier = [NSUUID UUID].UUIDString; GURL url("https://download.test"); - download_controller_->CreateDownloadTask( + download_controller()->CreateDownloadTask( &web_state_, identifier, url, kContentDisposition, /*total_bytes=*/-1, kMimeType, ui::PageTransition::PAGE_TRANSITION_TYPED); @@ -87,30 +84,11 @@ // Tests that DownloadController::FromBrowserState does not crash if used // without delegate. TEST_F(DownloadControllerImplTest, NullDelegate) { - download_controller_->SetDelegate(nullptr); + download_controller()->SetDelegate(nullptr); GURL url("https://download.test"); - download_controller_->CreateDownloadTask( + download_controller()->CreateDownloadTask( &web_state_, [NSUUID UUID].UUIDString, url, kContentDisposition, /*total_bytes=*/-1, kMimeType, ui::PageTransition::PAGE_TRANSITION_LINK); } -// Tests that DownloadController::CreateSession sets cookies correctly into the -// session's NSURLSessionConfiguration object. -TEST_F(DownloadControllerImplTest, SessionCookies) { - NSString* identifier = [NSUUID UUID].UUIDString; - NSURL* cookie_url = [NSURL URLWithString:@"https://download.test"]; - NSHTTPCookie* cookie = [NSHTTPCookie cookieWithProperties:@{ - NSHTTPCookieName : @"name", - NSHTTPCookieValue : @"value", - NSHTTPCookiePath : cookie_url.path, - NSHTTPCookieDomain : cookie_url.host, - NSHTTPCookieVersion : @1, - }]; - NSURLSession* session = download_controller_->CreateSession( - identifier, @[ cookie ], /*delegate=*/nil, /*delegate_queue=*/nil); - NSArray* cookies = session.configuration.HTTPCookieStorage.cookies; - EXPECT_EQ(1U, cookies.count); - EXPECT_NSEQ(cookie, cookies.firstObject); -} - } // namespace web
diff --git a/ios/web/download/download_task_impl.h b/ios/web/download/download_task_impl.h index 49fdfc4..2c40468 100644 --- a/ios/web/download/download_task_impl.h +++ b/ios/web/download/download_task_impl.h
@@ -33,10 +33,9 @@ // remove all references to the given DownloadTask and stop using it. virtual void OnTaskDestroyed(DownloadTaskImpl* task) = 0; - // Creates background NSURLSession with given |identifier|, |cookies|, - // |delegate| and |delegate_queue|. + // Creates background NSURLSession with given |identifier|, |delegate| and + // |delegate_queue|. virtual NSURLSession* CreateSession(NSString* identifier, - NSArray<NSHTTPCookie*>* cookies, id<NSURLSessionDataDelegate> delegate, NSOperationQueue* delegate_queue) = 0; virtual ~Delegate() = default; @@ -80,9 +79,8 @@ ~DownloadTaskImpl() override; private: - // Creates background NSURLSession with given |identifier| and |cookies|. - NSURLSession* CreateSession(NSString* identifier, - NSArray<NSHTTPCookie*>* cookies); + // Creates background NSURLSession with given |identifier|. + NSURLSession* CreateSession(NSString* identifier); // Asynchronously returns cookies for WebState associated with this task (on // iOS 10 and earlier, the array is always empty as it is not possible to
diff --git a/ios/web/download/download_task_impl.mm b/ios/web/download/download_task_impl.mm index b82cd02cc..b62dee28 100644 --- a/ios/web/download/download_task_impl.mm +++ b/ios/web/download/download_task_impl.mm
@@ -338,8 +338,7 @@ observers_.RemoveObserver(observer); } -NSURLSession* DownloadTaskImpl::CreateSession(NSString* identifier, - NSArray<NSHTTPCookie*>* cookies) { +NSURLSession* DownloadTaskImpl::CreateSession(NSString* identifier) { DCHECK_CURRENTLY_ON(web::WebThread::UI); DCHECK(identifier.length); base::WeakPtr<DownloadTaskImpl> weak_this = weak_factory_.GetWeakPtr(); @@ -394,8 +393,7 @@ } completion_handler(); }]; - return delegate_->CreateSession(identifier, cookies, session_delegate, - /*queue=*/nil); + return delegate_->CreateSession(identifier, session_delegate, /*queue=*/nil); } void DownloadTaskImpl::GetCookies( @@ -427,7 +425,7 @@ DCHECK(writer_); if (!session_) { - session_ = CreateSession(identifier_, cookies); + session_ = CreateSession(identifier_); DCHECK(session_); } @@ -437,6 +435,8 @@ NSURL* url = net::NSURLWithGURL(GetOriginalUrl()); session_task_ = [session_ dataTaskWithURL:url]; + [session_.configuration.HTTPCookieStorage storeCookies:cookies + forTask:session_task_]; [session_task_ resume]; OnDownloadUpdated(); }
diff --git a/ios/web/download/download_task_impl_unittest.mm b/ios/web/download/download_task_impl_unittest.mm index e20fa6a..450c074a 100644 --- a/ios/web/download/download_task_impl_unittest.mm +++ b/ios/web/download/download_task_impl_unittest.mm
@@ -91,13 +91,11 @@ // Returns mock, which can be accessed via session() method. NSURLSession* CreateSession(NSString* identifier, - NSArray<NSHTTPCookie*>* cookies, id<NSURLSessionDataDelegate> delegate, NSOperationQueue* delegate_queue) { // Make sure this method is called only once. EXPECT_FALSE(session_delegate_); session_delegate_ = delegate; - cookies_ = [cookies copy]; return session_; } @@ -106,13 +104,9 @@ id session() { return session_; } id<NSURLSessionDataDelegate> session_delegate() { return session_delegate_; } - // Returns the cookies passed to Create session method. - NSArray<NSHTTPCookie*>* cookies() { return cookies_; } - private: id<NSURLSessionDataDelegate> session_delegate_; id configuration_; - NSArray<NSHTTPCookie*>* cookies_ = nil; id session_; }; @@ -541,10 +535,15 @@ EXPECT_CALL(task_delegate_, OnTaskDestroyed(task_.get())); } -// Tests that CreateSession is called with the correct cookies from the cookie -// store. +// Tests that NSURLSessionConfiguration contains up to date cookie from browser +// state before the download started. TEST_F(DownloadTaskImplTest, Cookie) { if (@available(iOS 11, *)) { + // Remove all cookies from the session configuration. + auto storage = task_delegate_.configuration().HTTPCookieStorage; + for (NSHTTPCookie* cookie in storage.cookies) + [storage deleteCookie:cookie]; + // Add a cookie to BrowserState. NSURL* cookie_url = [NSURL URLWithString:@(kUrl)]; NSHTTPCookie* cookie = [NSHTTPCookie cookieWithProperties:@{ @@ -560,9 +559,10 @@ // picked up. EXPECT_CALL(task_observer_, OnDownloadUpdated(task_.get())); ASSERT_TRUE(Start()); - EXPECT_EQ(1U, task_delegate_.cookies().count); - EXPECT_NSEQ(cookie, task_delegate_.cookies().firstObject); + EXPECT_EQ(1U, storage.cookies.count); + EXPECT_NSEQ(cookie, storage.cookies.firstObject); } + EXPECT_CALL(task_delegate_, OnTaskDestroyed(task_.get())); }
diff --git a/ios/web_view/BUILD.gn b/ios/web_view/BUILD.gn index bdfb12f..c4170cf 100644 --- a/ios/web_view/BUILD.gn +++ b/ios/web_view/BUILD.gn
@@ -96,24 +96,24 @@ } ios_web_view_sources = [ - "internal/app/application_context.cc", "internal/app/application_context.h", + "internal/app/application_context.mm", "internal/app/web_view_io_thread.h", "internal/app/web_view_io_thread.mm", "internal/autofill/web_view_autofill_client_ios.h", "internal/autofill/web_view_autofill_client_ios.mm", - "internal/autofill/web_view_autocomplete_history_manager_factory.cc", "internal/autofill/web_view_autocomplete_history_manager_factory.h", - "internal/autofill/web_view_legacy_strike_database_factory.cc", + "internal/autofill/web_view_autocomplete_history_manager_factory.mm", "internal/autofill/web_view_legacy_strike_database_factory.h", - "internal/autofill/web_view_personal_data_manager_factory.cc", + "internal/autofill/web_view_legacy_strike_database_factory.mm", "internal/autofill/web_view_personal_data_manager_factory.h", - "internal/autofill/web_view_strike_database_factory.cc", + "internal/autofill/web_view_personal_data_manager_factory.mm", "internal/autofill/web_view_strike_database_factory.h", - "internal/content_settings/web_view_cookie_settings_factory.cc", + "internal/autofill/web_view_strike_database_factory.mm", "internal/content_settings/web_view_cookie_settings_factory.h", - "internal/content_settings/web_view_host_content_settings_map_factory.cc", + "internal/content_settings/web_view_cookie_settings_factory.mm", "internal/content_settings/web_view_host_content_settings_map_factory.h", + "internal/content_settings/web_view_host_content_settings_map_factory.mm", "internal/cwv_favicon.mm", "internal/cwv_favicon_internal.h", "internal/cwv_html_element.mm", @@ -140,11 +140,11 @@ "internal/cwv_web_view_configuration.mm", "internal/cwv_web_view_configuration_internal.h", "internal/cwv_web_view_internal.h", - "internal/ios_global_state_web_view_configuration.cc", - "internal/language/web_view_language_model_manager_factory.cc", + "internal/ios_global_state_web_view_configuration.mm", "internal/language/web_view_language_model_manager_factory.h", - "internal/language/web_view_url_language_histogram_factory.cc", + "internal/language/web_view_language_model_manager_factory.mm", "internal/language/web_view_url_language_histogram_factory.h", + "internal/language/web_view_url_language_histogram_factory.mm", "internal/passwords/mock_credentials_filter.h", "internal/passwords/mock_credentials_filter.mm", "internal/passwords/web_view_password_manager_client.h", @@ -155,8 +155,8 @@ "internal/passwords/web_view_password_manager_internals_service_factory.mm", "internal/passwords/web_view_password_store_factory.h", "internal/passwords/web_view_password_store_factory.mm", - "internal/pref_names.cc", "internal/pref_names.h", + "internal/pref_names.mm", "internal/signin/ios_web_view_signin_client.h", "internal/signin/ios_web_view_signin_client.mm", "internal/signin/web_view_account_fetcher_service_factory.h", @@ -192,14 +192,14 @@ "internal/translate/cwv_translation_language_internal.h", "internal/translate/cwv_translation_language.mm", "internal/translate/cwv_translation_policy.mm", - "internal/translate/web_view_translate_accept_languages_factory.cc", "internal/translate/web_view_translate_accept_languages_factory.h", + "internal/translate/web_view_translate_accept_languages_factory.mm", "internal/translate/web_view_translate_client.h", "internal/translate/web_view_translate_client.mm", - "internal/translate/web_view_translate_ranker_factory.cc", "internal/translate/web_view_translate_ranker_factory.h", - "internal/translate/web_view_translate_service.cc", + "internal/translate/web_view_translate_ranker_factory.mm", "internal/translate/web_view_translate_service.h", + "internal/translate/web_view_translate_service.mm", "internal/web_view_browser_state.h", "internal/web_view_browser_state.mm", "internal/web_view_early_page_script_provider.h", @@ -208,8 +208,8 @@ "internal/web_view_global_state_util.mm", "internal/web_view_java_script_dialog_presenter.h", "internal/web_view_java_script_dialog_presenter.mm", - "internal/web_view_network_delegate.cc", "internal/web_view_network_delegate.h", + "internal/web_view_network_delegate.mm", "internal/web_view_url_request_context_getter.h", "internal/web_view_url_request_context_getter.mm", "internal/web_view_web_client.h", @@ -220,8 +220,8 @@ "internal/web_view_web_main_parts.mm", "internal/web_view_web_state_policy_decider.h", "internal/web_view_web_state_policy_decider.mm", - "internal/webdata_services/web_view_web_data_service_wrapper_factory.cc", "internal/webdata_services/web_view_web_data_service_wrapper_factory.h", + "internal/webdata_services/web_view_web_data_service_wrapper_factory.mm", "internal/web_view_download_manager.h", "internal/web_view_download_manager.mm", "internal/cwv_download_task_internal.h",
diff --git a/ios/web_view/internal/app/application_context.cc b/ios/web_view/internal/app/application_context.mm similarity index 98% rename from ios/web_view/internal/app/application_context.cc rename to ios/web_view/internal/app/application_context.mm index 6207b501..5902152b 100644 --- a/ios/web_view/internal/app/application_context.cc +++ b/ios/web_view/internal/app/application_context.mm
@@ -25,6 +25,10 @@ #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" #include "ui/base/l10n/l10n_util_mac.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace ios_web_view { namespace {
diff --git a/ios/web_view/internal/autofill/web_view_autocomplete_history_manager_factory.cc b/ios/web_view/internal/autofill/web_view_autocomplete_history_manager_factory.mm similarity index 95% rename from ios/web_view/internal/autofill/web_view_autocomplete_history_manager_factory.cc rename to ios/web_view/internal/autofill/web_view_autocomplete_history_manager_factory.mm index f9874bda..fc38703 100644 --- a/ios/web_view/internal/autofill/web_view_autocomplete_history_manager_factory.cc +++ b/ios/web_view/internal/autofill/web_view_autocomplete_history_manager_factory.mm
@@ -16,6 +16,10 @@ #include "ios/web_view/internal/web_view_browser_state.h" #include "ios/web_view/internal/webdata_services/web_view_web_data_service_wrapper_factory.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace ios_web_view { // static
diff --git a/ios/web_view/internal/autofill/web_view_legacy_strike_database_factory.cc b/ios/web_view/internal/autofill/web_view_legacy_strike_database_factory.mm similarity index 93% rename from ios/web_view/internal/autofill/web_view_legacy_strike_database_factory.cc rename to ios/web_view/internal/autofill/web_view_legacy_strike_database_factory.mm index 299ec02..5ca31549 100644 --- a/ios/web_view/internal/autofill/web_view_legacy_strike_database_factory.cc +++ b/ios/web_view/internal/autofill/web_view_legacy_strike_database_factory.mm
@@ -12,6 +12,10 @@ #include "ios/web_view/internal/app/application_context.h" #include "ios/web_view/internal/web_view_browser_state.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace ios_web_view { // static
diff --git a/ios/web_view/internal/autofill/web_view_personal_data_manager_factory.cc b/ios/web_view/internal/autofill/web_view_personal_data_manager_factory.mm similarity index 95% rename from ios/web_view/internal/autofill/web_view_personal_data_manager_factory.cc rename to ios/web_view/internal/autofill/web_view_personal_data_manager_factory.mm index a397b5f..4914d9f87 100644 --- a/ios/web_view/internal/autofill/web_view_personal_data_manager_factory.cc +++ b/ios/web_view/internal/autofill/web_view_personal_data_manager_factory.mm
@@ -16,6 +16,10 @@ #include "ios/web_view/internal/web_view_browser_state.h" #include "ios/web_view/internal/webdata_services/web_view_web_data_service_wrapper_factory.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace ios_web_view { // static
diff --git a/ios/web_view/internal/autofill/web_view_strike_database_factory.cc b/ios/web_view/internal/autofill/web_view_strike_database_factory.mm similarity index 93% rename from ios/web_view/internal/autofill/web_view_strike_database_factory.cc rename to ios/web_view/internal/autofill/web_view_strike_database_factory.mm index f0ce6c3..288f470 100644 --- a/ios/web_view/internal/autofill/web_view_strike_database_factory.cc +++ b/ios/web_view/internal/autofill/web_view_strike_database_factory.mm
@@ -12,6 +12,10 @@ #include "ios/web_view/internal/app/application_context.h" #include "ios/web_view/internal/web_view_browser_state.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace ios_web_view { // static
diff --git a/ios/web_view/internal/content_settings/web_view_cookie_settings_factory.cc b/ios/web_view/internal/content_settings/web_view_cookie_settings_factory.mm similarity index 94% rename from ios/web_view/internal/content_settings/web_view_cookie_settings_factory.cc rename to ios/web_view/internal/content_settings/web_view_cookie_settings_factory.mm index 01395a6..627e8b7 100644 --- a/ios/web_view/internal/content_settings/web_view_cookie_settings_factory.cc +++ b/ios/web_view/internal/content_settings/web_view_cookie_settings_factory.mm
@@ -10,6 +10,10 @@ #include "ios/web_view/internal/content_settings/web_view_host_content_settings_map_factory.h" #include "ios/web_view/internal/web_view_browser_state.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace ios_web_view { // static
diff --git a/ios/web_view/internal/content_settings/web_view_host_content_settings_map_factory.cc b/ios/web_view/internal/content_settings/web_view_host_content_settings_map_factory.mm similarity index 94% rename from ios/web_view/internal/content_settings/web_view_host_content_settings_map_factory.cc rename to ios/web_view/internal/content_settings/web_view_host_content_settings_map_factory.mm index b5de55e..d6f8526 100644 --- a/ios/web_view/internal/content_settings/web_view_host_content_settings_map_factory.cc +++ b/ios/web_view/internal/content_settings/web_view_host_content_settings_map_factory.mm
@@ -10,6 +10,10 @@ #include "components/prefs/pref_service.h" #include "ios/web_view/internal/web_view_browser_state.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace ios_web_view { // static
diff --git a/ios/web_view/internal/ios_global_state_web_view_configuration.cc b/ios/web_view/internal/ios_global_state_web_view_configuration.mm similarity index 88% rename from ios/web_view/internal/ios_global_state_web_view_configuration.cc rename to ios/web_view/internal/ios_global_state_web_view_configuration.mm index 8f5feeb5..d7345f02 100644 --- a/ios/web_view/internal/ios_global_state_web_view_configuration.cc +++ b/ios/web_view/internal/ios_global_state_web_view_configuration.mm
@@ -10,6 +10,10 @@ #include "ios/web/public/web_thread.h" #include "ios/web_view/internal/web_view_global_state_util.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace ios_global_state { scoped_refptr<base::SingleThreadTaskRunner>
diff --git a/ios/web_view/internal/language/web_view_language_model_manager_factory.cc b/ios/web_view/internal/language/web_view_language_model_manager_factory.mm similarity index 97% rename from ios/web_view/internal/language/web_view_language_model_manager_factory.cc rename to ios/web_view/internal/language/web_view_language_model_manager_factory.mm index b996dcc..25e2e815 100644 --- a/ios/web_view/internal/language/web_view_language_model_manager_factory.cc +++ b/ios/web_view/internal/language/web_view_language_model_manager_factory.mm
@@ -20,6 +20,10 @@ #include "ios/web_view/internal/pref_names.h" #include "ios/web_view/internal/web_view_browser_state.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace ios_web_view { namespace {
diff --git a/ios/web_view/internal/language/web_view_url_language_histogram_factory.cc b/ios/web_view/internal/language/web_view_url_language_histogram_factory.mm similarity index 94% rename from ios/web_view/internal/language/web_view_url_language_histogram_factory.cc rename to ios/web_view/internal/language/web_view_url_language_histogram_factory.mm index d14c8369..40596699 100644 --- a/ios/web_view/internal/language/web_view_url_language_histogram_factory.cc +++ b/ios/web_view/internal/language/web_view_url_language_histogram_factory.mm
@@ -11,6 +11,10 @@ #include "components/pref_registry/pref_registry_syncable.h" #include "ios/web_view/internal/web_view_browser_state.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace ios_web_view { // static
diff --git a/ios/web_view/internal/pref_names.cc b/ios/web_view/internal/pref_names.mm similarity index 78% rename from ios/web_view/internal/pref_names.cc rename to ios/web_view/internal/pref_names.mm index 321cb2ac..41a44ac 100644 --- a/ios/web_view/internal/pref_names.cc +++ b/ios/web_view/internal/pref_names.mm
@@ -4,6 +4,10 @@ #include "ios/web_view/internal/pref_names.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace prefs { const char kAcceptLanguages[] = "intl.accept_languages";
diff --git a/ios/web_view/internal/translate/web_view_translate_accept_languages_factory.cc b/ios/web_view/internal/translate/web_view_translate_accept_languages_factory.mm similarity index 96% rename from ios/web_view/internal/translate/web_view_translate_accept_languages_factory.cc rename to ios/web_view/internal/translate/web_view_translate_accept_languages_factory.mm index 9cc3280d..fe5dbdf 100644 --- a/ios/web_view/internal/translate/web_view_translate_accept_languages_factory.cc +++ b/ios/web_view/internal/translate/web_view_translate_accept_languages_factory.mm
@@ -12,6 +12,10 @@ #include "ios/web_view/internal/pref_names.h" #include "ios/web_view/internal/web_view_browser_state.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { // TranslateAcceptLanguagesService is a thin container for
diff --git a/ios/web_view/internal/translate/web_view_translate_ranker_factory.cc b/ios/web_view/internal/translate/web_view_translate_ranker_factory.mm similarity index 95% rename from ios/web_view/internal/translate/web_view_translate_ranker_factory.cc rename to ios/web_view/internal/translate/web_view_translate_ranker_factory.mm index 79f0542..43c3aa7c7 100644 --- a/ios/web_view/internal/translate/web_view_translate_ranker_factory.cc +++ b/ios/web_view/internal/translate/web_view_translate_ranker_factory.mm
@@ -13,6 +13,10 @@ #include "ios/web_view/internal/pref_names.h" #include "ios/web_view/internal/web_view_browser_state.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace ios_web_view { // static
diff --git a/ios/web_view/internal/translate/web_view_translate_service.cc b/ios/web_view/internal/translate/web_view_translate_service.mm similarity index 95% rename from ios/web_view/internal/translate/web_view_translate_service.cc rename to ios/web_view/internal/translate/web_view_translate_service.mm index fbe15c8..4088776 100644 --- a/ios/web_view/internal/translate/web_view_translate_service.cc +++ b/ios/web_view/internal/translate/web_view_translate_service.mm
@@ -9,6 +9,10 @@ #include "components/translate/core/browser/translate_download_manager.h" #include "ios/web_view/internal/app/application_context.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace ios_web_view { WebViewTranslateService::TranslateRequestsAllowedListener::
diff --git a/ios/web_view/internal/web_view_network_delegate.cc b/ios/web_view/internal/web_view_network_delegate.mm similarity index 85% rename from ios/web_view/internal/web_view_network_delegate.cc rename to ios/web_view/internal/web_view_network_delegate.mm index cfbee6e..4078c1d 100644 --- a/ios/web_view/internal/web_view_network_delegate.cc +++ b/ios/web_view/internal/web_view_network_delegate.mm
@@ -6,6 +6,10 @@ #include "net/base/net_errors.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace ios_web_view { WebViewNetworkDelegate::WebViewNetworkDelegate() {}
diff --git a/ios/web_view/internal/webdata_services/web_view_web_data_service_wrapper_factory.cc b/ios/web_view/internal/webdata_services/web_view_web_data_service_wrapper_factory.mm similarity index 96% rename from ios/web_view/internal/webdata_services/web_view_web_data_service_wrapper_factory.cc rename to ios/web_view/internal/webdata_services/web_view_web_data_service_wrapper_factory.mm index 8f00467..5dda8cc 100644 --- a/ios/web_view/internal/webdata_services/web_view_web_data_service_wrapper_factory.cc +++ b/ios/web_view/internal/webdata_services/web_view_web_data_service_wrapper_factory.mm
@@ -21,6 +21,10 @@ #include "ios/web_view/internal/app/application_context.h" #include "ios/web_view/internal/web_view_browser_state.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace ios_web_view { // static
diff --git a/media/webrtc/audio_processor.cc b/media/webrtc/audio_processor.cc index 299621d..3eaaea9 100644 --- a/media/webrtc/audio_processor.cc +++ b/media/webrtc/audio_processor.cc
@@ -244,6 +244,8 @@ settings_.automatic_gain_control == AutomaticGainControlType::kHybridExperimental; ap_config.Set<webrtc::ExperimentalAgc>(experimental_agc); + } else { + ap_config.Set<webrtc::ExperimentalAgc>(new webrtc::ExperimentalAgc(false)); } // Noise suppression setup part 1. @@ -268,12 +270,6 @@ err |= audio_processing_->gain_control()->Enable(true); DCHECK_EQ(err, 0); } - if (settings_.automatic_gain_control == AutomaticGainControlType::kDefault) { - int err = audio_processing_->gain_control()->set_mode( - webrtc::GainControl::kAdaptiveAnalog); - err |= audio_processing_->gain_control()->Enable(true); - DCHECK_EQ(err, 0); - } webrtc::AudioProcessing::Config apm_config = audio_processing_->GetConfig();
diff --git a/net/disk_cache/simple/simple_backend_impl.cc b/net/disk_cache/simple/simple_backend_impl.cc index b9ba451..45a60d2 100644 --- a/net/disk_cache/simple/simple_backend_impl.cc +++ b/net/disk_cache/simple/simple_backend_impl.cc
@@ -447,39 +447,56 @@ scoped_refptr<SimpleEntryImpl> simple_entry = CreateOrFindActiveOrDoomedEntry( entry_hash, key, request_priority, &post_doom); + // If couldn't grab an entry object due to pending doom, see if circumstances + // are right for an optimistic create. if (!simple_entry) { - // We would like to optimistically have create go ahead, for benefit of - // HTTP cache use. This can only be sanely done if we are the only op - // serialized after doom's completion. - if (post_doom->empty() && - entry_operations_mode_ == SimpleEntryImpl::OPTIMISTIC_OPERATIONS) { - simple_entry = new SimpleEntryImpl( - cache_type_, path_, cleanup_tracker_.get(), entry_hash, - entry_operations_mode_, this, file_tracker_, net_log_, - GetNewEntryPriority(request_priority)); - simple_entry->SetKey(key); - simple_entry->SetActiveEntryProxy( - ActiveEntryProxy::Create(entry_hash, this)); - simple_entry->SetCreatePendingDoom(); - std::pair<EntryMap::iterator, bool> insert_result = - active_entries_.insert( - EntryMap::value_type(entry_hash, simple_entry.get())); - post_doom->emplace_back(base::BindOnce( - &SimpleEntryImpl::NotifyDoomBeforeCreateComplete, simple_entry)); - DCHECK(insert_result.second); - } else { - base::OnceCallback<net::Error(CompletionOnceCallback)> operation = - base::BindOnce(&SimpleBackendImpl::CreateEntry, - base::Unretained(this), key, request_priority, entry); - post_doom->emplace_back(base::BindOnce( - &RunOperationAndCallback, std::move(operation), std::move(callback))); - return net::ERR_IO_PENDING; - } + simple_entry = MaybeOptimisticCreateForPostDoom( + entry_hash, key, request_priority, post_doom); + } + + // If that doesn't work either, retry this once doom is done. + if (!simple_entry) { + base::OnceCallback<net::Error(CompletionOnceCallback)> operation = + base::BindOnce(&SimpleBackendImpl::CreateEntry, base::Unretained(this), + key, request_priority, entry); + post_doom->emplace_back(base::BindOnce( + &RunOperationAndCallback, std::move(operation), std::move(callback))); + return net::ERR_IO_PENDING; } return simple_entry->CreateEntry(entry, std::move(callback)); } +scoped_refptr<SimpleEntryImpl> +SimpleBackendImpl::MaybeOptimisticCreateForPostDoom( + uint64_t entry_hash, + const std::string& key, + net::RequestPriority request_priority, + std::vector<PostDoomWaiter>* post_doom) { + scoped_refptr<SimpleEntryImpl> simple_entry; + // We would like to optimistically have create go ahead, for benefit of + // HTTP cache use. This can only be sanely done if we are the only op + // serialized after doom's completion. + if (post_doom->empty() && + entry_operations_mode_ == SimpleEntryImpl::OPTIMISTIC_OPERATIONS) { + simple_entry = new SimpleEntryImpl( + cache_type_, path_, cleanup_tracker_.get(), entry_hash, + entry_operations_mode_, this, file_tracker_, net_log_, + GetNewEntryPriority(request_priority)); + simple_entry->SetKey(key); + simple_entry->SetActiveEntryProxy( + ActiveEntryProxy::Create(entry_hash, this)); + simple_entry->SetCreatePendingDoom(); + std::pair<EntryMap::iterator, bool> insert_result = active_entries_.insert( + EntryMap::value_type(entry_hash, simple_entry.get())); + post_doom->emplace_back(base::BindOnce( + &SimpleEntryImpl::NotifyDoomBeforeCreateComplete, simple_entry)); + DCHECK(insert_result.second); + } + + return simple_entry; +} + net::Error SimpleBackendImpl::DoomEntry(const std::string& key, net::RequestPriority priority, CompletionOnceCallback callback) {
diff --git a/net/disk_cache/simple/simple_backend_impl.h b/net/disk_cache/simple/simple_backend_impl.h index 5a0d1c3..ca861973 100644 --- a/net/disk_cache/simple/simple_backend_impl.h +++ b/net/disk_cache/simple/simple_backend_impl.h
@@ -220,6 +220,18 @@ net::RequestPriority request_priority, std::vector<PostDoomWaiter>** post_doom); + // If post-doom and settings indicates that optimistically succeeding a create + // due to being immediately after a doom is possible, sets up an entry for + // that, and returns a non-null pointer. (CreateEntry still needs to be called + // to actually do the creation operation). Otherwise returns nullptr. + // + // Pre-condition: |post_doom| is non-null. + scoped_refptr<SimpleEntryImpl> MaybeOptimisticCreateForPostDoom( + uint64_t entry_hash, + const std::string& key, + net::RequestPriority request_priority, + std::vector<PostDoomWaiter>* post_doom); + // Given a hash, will try to open the corresponding Entry. If we have an Entry // corresponding to |hash| in the map of active entries, opens it. Otherwise, // a new empty Entry will be created, opened and filled with information from
diff --git a/net/disk_cache/simple/simple_entry_impl.cc b/net/disk_cache/simple/simple_entry_impl.cc index ec225b0f..cc82cad3 100644 --- a/net/disk_cache/simple/simple_entry_impl.cc +++ b/net/disk_cache/simple/simple_entry_impl.cc
@@ -56,6 +56,21 @@ SIMPLE_ENTRY_WRITE_RESULT_MAX = 6, }; +OpenEntryIndexEnum ComputeIndexState(SimpleBackendImpl* backend, + uint64_t entry_hash) { + if (!backend->index()->initialized()) + return INDEX_NOEXIST; + if (backend->index()->Has(entry_hash)) + return INDEX_HIT; + return INDEX_MISS; +} + +void RecordOpenEntryIndexState(net::CacheType cache_type, + OpenEntryIndexEnum state) { + SIMPLE_CACHE_UMA(ENUMERATION, "OpenEntryIndexState", cache_type, state, + INDEX_MAX); +} + void RecordReadResult(net::CacheType cache_type, SimpleReadResult result) { SIMPLE_CACHE_UMA(ENUMERATION, "ReadResult", cache_type, result, READ_RESULT_MAX); @@ -196,34 +211,19 @@ net_log_.AddEvent(net::NetLogEventType::SIMPLE_CACHE_ENTRY_OPEN_CALL); - bool have_index = backend_->index()->initialized(); - // This enumeration is used in histograms, add entries only at end. - enum OpenEntryIndexEnum { - INDEX_NOEXIST = 0, - INDEX_MISS = 1, - INDEX_HIT = 2, - INDEX_MAX = 3, - }; - OpenEntryIndexEnum open_entry_index_enum = INDEX_NOEXIST; - if (have_index) { - if (backend_->index()->Has(entry_hash_)) - open_entry_index_enum = INDEX_HIT; - else - open_entry_index_enum = INDEX_MISS; - } - SIMPLE_CACHE_UMA(ENUMERATION, - "OpenEntryIndexState", cache_type_, - open_entry_index_enum, INDEX_MAX); + OpenEntryIndexEnum index_state = + ComputeIndexState(backend_.get(), entry_hash_); + RecordOpenEntryIndexState(cache_type_, index_state); // If entry is not known to the index, initiate fast failover to the network. - if (open_entry_index_enum == INDEX_MISS) { + if (index_state == INDEX_MISS) { net_log_.AddEventWithNetErrorCode( net::NetLogEventType::SIMPLE_CACHE_ENTRY_OPEN_END, net::ERR_FAILED); return net::ERR_FAILED; } pending_operations_.push(SimpleEntryOperation::OpenOperation( - this, have_index, std::move(callback), out_entry)); + this, index_state, std::move(callback), out_entry)); RunNextOperationIfNeeded(); return net::ERR_IO_PENDING; } @@ -235,7 +235,10 @@ net_log_.AddEvent(net::NetLogEventType::SIMPLE_CACHE_ENTRY_CREATE_CALL); - bool have_index = backend_->index()->initialized(); + // Don't really care if we're in index or not for this, so avoid extra lookup. + OpenEntryIndexEnum index_state = + backend_->index()->initialized() ? INDEX_HIT : INDEX_NOEXIST; + net::Error ret_value = net::ERR_FAILED; if (use_optimistic_operations_ && state_ == STATE_UNINITIALIZED && pending_operations_.size() == 0) { @@ -244,7 +247,7 @@ ReturnEntryToCaller(out_entry); pending_operations_.push(SimpleEntryOperation::CreateOperation( - this, have_index, CompletionOnceCallback(), + this, index_state, CompletionOnceCallback(), static_cast<Entry**>(NULL))); ret_value = net::OK; @@ -257,7 +260,7 @@ } } else { pending_operations_.push(SimpleEntryOperation::CreateOperation( - this, have_index, std::move(callback), out_entry)); + this, index_state, std::move(callback), out_entry)); ret_value = net::ERR_IO_PENDING; }
diff --git a/net/disk_cache/simple/simple_entry_operation.cc b/net/disk_cache/simple/simple_entry_operation.cc index e0c964e..42d2c73 100644 --- a/net/disk_cache/simple/simple_entry_operation.cc +++ b/net/disk_cache/simple/simple_entry_operation.cc
@@ -23,7 +23,7 @@ length_(other.length_), out_start_(other.out_start_), type_(other.type_), - have_index_(other.have_index_), + index_state_(other.index_state_), index_(other.index_), truncate_(other.truncate_), optimistic_(other.optimistic_) {} @@ -33,21 +33,21 @@ // static SimpleEntryOperation SimpleEntryOperation::OpenOperation( SimpleEntryImpl* entry, - bool have_index, + OpenEntryIndexEnum index_state, net::CompletionOnceCallback callback, Entry** out_entry) { return SimpleEntryOperation(entry, NULL, std::move(callback), out_entry, 0, 0, - 0, NULL, TYPE_OPEN, have_index, 0, false, false); + 0, NULL, TYPE_OPEN, index_state, 0, false, false); } // static SimpleEntryOperation SimpleEntryOperation::CreateOperation( SimpleEntryImpl* entry, - bool have_index, + OpenEntryIndexEnum index_state, net::CompletionOnceCallback callback, Entry** out_entry) { return SimpleEntryOperation(entry, NULL, std::move(callback), out_entry, 0, 0, - 0, NULL, TYPE_CREATE, have_index, 0, false, + 0, NULL, TYPE_CREATE, index_state, 0, false, false); } @@ -55,7 +55,8 @@ SimpleEntryOperation SimpleEntryOperation::CloseOperation( SimpleEntryImpl* entry) { return SimpleEntryOperation(entry, NULL, CompletionOnceCallback(), NULL, 0, 0, - 0, NULL, TYPE_CLOSE, false, 0, false, false); + 0, NULL, TYPE_CLOSE, INDEX_NOEXIST, 0, false, + false); } // static @@ -67,8 +68,8 @@ net::IOBuffer* buf, CompletionOnceCallback callback) { return SimpleEntryOperation(entry, buf, std::move(callback), NULL, offset, 0, - length, NULL, TYPE_READ, false, index, false, - false); + length, NULL, TYPE_READ, INDEX_NOEXIST, index, + false, false); } // static @@ -82,8 +83,8 @@ bool optimistic, CompletionOnceCallback callback) { return SimpleEntryOperation(entry, buf, std::move(callback), NULL, offset, 0, - length, NULL, TYPE_WRITE, false, index, truncate, - optimistic); + length, NULL, TYPE_WRITE, INDEX_NOEXIST, index, + truncate, optimistic); } // static @@ -95,7 +96,7 @@ CompletionOnceCallback callback) { return SimpleEntryOperation(entry, buf, std::move(callback), NULL, 0, sparse_offset, length, NULL, TYPE_READ_SPARSE, - false, 0, false, false); + INDEX_NOEXIST, 0, false, false); } // static @@ -107,7 +108,7 @@ CompletionOnceCallback callback) { return SimpleEntryOperation(entry, buf, std::move(callback), NULL, 0, sparse_offset, length, NULL, TYPE_WRITE_SPARSE, - false, 0, false, false); + INDEX_NOEXIST, 0, false, false); } // static @@ -117,9 +118,9 @@ int length, int64_t* out_start, CompletionOnceCallback callback) { - return SimpleEntryOperation(entry, NULL, std::move(callback), NULL, 0, - sparse_offset, length, out_start, - TYPE_GET_AVAILABLE_RANGE, false, 0, false, false); + return SimpleEntryOperation( + entry, NULL, std::move(callback), NULL, 0, sparse_offset, length, + out_start, TYPE_GET_AVAILABLE_RANGE, INDEX_NOEXIST, 0, false, false); } // static @@ -132,13 +133,13 @@ const int64_t sparse_offset = 0; const int length = 0; int64_t* const out_start = NULL; - const bool have_index = false; + const OpenEntryIndexEnum index_state = INDEX_NOEXIST; const int index = 0; const bool truncate = false; const bool optimistic = false; return SimpleEntryOperation( entry, buf, std::move(callback), out_entry, offset, sparse_offset, length, - out_start, TYPE_DOOM, have_index, index, truncate, optimistic); + out_start, TYPE_DOOM, index_state, index, truncate, optimistic); } SimpleEntryOperation::SimpleEntryOperation(SimpleEntryImpl* entry, @@ -150,7 +151,7 @@ int length, int64_t* out_start, EntryOperationType type, - bool have_index, + OpenEntryIndexEnum index_state, int index, bool truncate, bool optimistic) @@ -163,7 +164,7 @@ length_(length), out_start_(out_start), type_(type), - have_index_(have_index), + index_state_(index_state), index_(index), truncate_(truncate), optimistic_(optimistic) {}
diff --git a/net/disk_cache/simple/simple_entry_operation.h b/net/disk_cache/simple/simple_entry_operation.h index 564195ff..9c51d61 100644 --- a/net/disk_cache/simple/simple_entry_operation.h +++ b/net/disk_cache/simple/simple_entry_operation.h
@@ -9,6 +9,7 @@ #include "base/memory/ref_counted.h" #include "net/base/completion_once_callback.h" +#include "net/disk_cache/simple/simple_histogram_enums.h" namespace net { class IOBuffer; @@ -42,11 +43,11 @@ ~SimpleEntryOperation(); static SimpleEntryOperation OpenOperation(SimpleEntryImpl* entry, - bool have_index, + OpenEntryIndexEnum index_state, CompletionOnceCallback, Entry** out_entry); static SimpleEntryOperation CreateOperation(SimpleEntryImpl* entry, - bool have_index, + OpenEntryIndexEnum index_state, CompletionOnceCallback callback, Entry** out_entry); static SimpleEntryOperation CloseOperation(SimpleEntryImpl* entry); @@ -91,7 +92,7 @@ CompletionOnceCallback ReleaseCallback() { return std::move(callback_); } Entry** out_entry() { return out_entry_; } - bool have_index() const { return have_index_; } + bool have_index() const { return index_state_ != INDEX_NOEXIST; } int index() const { return index_; } int offset() const { return offset_; } int64_t sparse_offset() const { return sparse_offset_; } @@ -111,7 +112,7 @@ int length, int64_t* out_start, EntryOperationType type, - bool have_index, + OpenEntryIndexEnum index_state, int index, bool truncate, bool optimistic); @@ -134,7 +135,9 @@ const EntryOperationType type_; // Used in open and create operations. - const bool have_index_; + // For TYPE_CREATE, only distinguishes whether index exists or NOEXIST. + // Otherwise also indicates whether entry is HIT or MISS in the index. + const OpenEntryIndexEnum index_state_; // Used in write and read operations. const unsigned int index_; // Used only in write operations.
diff --git a/net/disk_cache/simple/simple_histogram_enums.h b/net/disk_cache/simple/simple_histogram_enums.h index 67221b271..0fd28b7 100644 --- a/net/disk_cache/simple/simple_histogram_enums.h +++ b/net/disk_cache/simple/simple_histogram_enums.h
@@ -87,6 +87,14 @@ FD_LIMIT_OP_MAX = 3 }; +// This enumeration is used in histograms, add entries only at end. +enum OpenEntryIndexEnum { + INDEX_NOEXIST = 0, + INDEX_MISS = 1, + INDEX_HIT = 2, + INDEX_MAX = 3, +}; + } // namespace disk_cache #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_HISTOGRAM_ENUMS_H_
diff --git a/net/proxy_resolution/proxy_resolver_v8.cc b/net/proxy_resolution/proxy_resolver_v8.cc index a843839..af83f15 100644 --- a/net/proxy_resolution/proxy_resolver_v8.cc +++ b/net/proxy_resolution/proxy_resolver_v8.cc
@@ -392,7 +392,6 @@ gin::IsolateHolder::Initialize( gin::IsolateHolder::kNonStrictMode, - gin::IsolateHolder::kStableV8Extras, gin::ArrayBufferAllocator::SharedInstance()); has_initialized_v8_ = true;
diff --git a/net/websockets/websocket_basic_handshake_stream.cc b/net/websockets/websocket_basic_handshake_stream.cc index 1d4bf433..f1377e4 100644 --- a/net/websockets/websocket_basic_handshake_stream.cc +++ b/net/websockets/websocket_basic_handshake_stream.cc
@@ -159,10 +159,6 @@ } // namespace -const base::Feature - WebSocketBasicHandshakeStream::kWebSocketHandshakeReuseConnection{ - "WebSocketHandshakeReuseConnection", base::FEATURE_ENABLED_BY_DEFAULT}; - WebSocketBasicHandshakeStream::WebSocketBasicHandshakeStream( std::unique_ptr<ClientSocketHandle> connection, WebSocketStream::ConnectDelegate* connect_delegate, @@ -298,9 +294,6 @@ } bool WebSocketBasicHandshakeStream::CanReuseConnection() const { - if (!base::FeatureList::IsEnabled(kWebSocketHandshakeReuseConnection)) - return false; - return parser() && parser()->CanReuseConnection(); } @@ -356,9 +349,6 @@ } HttpStream* WebSocketBasicHandshakeStream::RenewStreamForAuth() { - if (!base::FeatureList::IsEnabled(kWebSocketHandshakeReuseConnection)) - return nullptr; - DCHECK(IsResponseBodyComplete()); DCHECK(!parser()->IsMoreDataBuffered()); // The HttpStreamParser object still has a pointer to the connection. Just to
diff --git a/net/websockets/websocket_basic_handshake_stream.h b/net/websockets/websocket_basic_handshake_stream.h index ccd371b..106857a 100644 --- a/net/websockets/websocket_basic_handshake_stream.h +++ b/net/websockets/websocket_basic_handshake_stream.h
@@ -11,7 +11,6 @@ #include <string> #include <vector> -#include "base/feature_list.h" #include "base/macros.h" #include "base/optional.h" #include "net/base/completion_once_callback.h" @@ -33,9 +32,6 @@ class NET_EXPORT_PRIVATE WebSocketBasicHandshakeStream final : public WebSocketHandshakeStreamBase { public: - // Feature to enable connection reuse. - static const base::Feature kWebSocketHandshakeReuseConnection; - // |connect_delegate| and |failure_message| must out-live this object. WebSocketBasicHandshakeStream( std::unique_ptr<ClientSocketHandle> connection,
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc index 8c3a4691..0d3db7d 100644 --- a/pdf/pdfium/pdfium_engine.cc +++ b/pdf/pdfium/pdfium_engine.cc
@@ -536,7 +536,6 @@ const char* recommended = FPDF_GetRecommendedV8Flags(); v8::V8::SetFlagsFromString(recommended, strlen(recommended)); gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, - gin::IsolateHolder::kStableV8Extras, gin::ArrayBufferAllocator::SharedInstance()); DCHECK(!g_isolate_holder); g_isolate_holder = new gin::IsolateHolder(
diff --git a/services/identity/public/cpp/accounts_mutator.h b/services/identity/public/cpp/accounts_mutator.h index cc67ed3..ad50733 100644 --- a/services/identity/public/cpp/accounts_mutator.h +++ b/services/identity/public/cpp/accounts_mutator.h
@@ -23,13 +23,11 @@ // server-side if needed. virtual void RemoveAccount( const std::string& account_id, - signin_metrics::SourceForRefreshTokenOperation source = - signin_metrics::SourceForRefreshTokenOperation::kUnknown) = 0; + signin_metrics::SourceForRefreshTokenOperation source) = 0; // Removes all accounts. virtual void RemoveAllAccounts( - signin_metrics::SourceForRefreshTokenOperation source = - signin_metrics::SourceForRefreshTokenOperation::kUnknown) = 0; + signin_metrics::SourceForRefreshTokenOperation source) = 0; private: DISALLOW_COPY_AND_ASSIGN(AccountsMutator);
diff --git a/services/identity/public/cpp/accounts_mutator_impl.h b/services/identity/public/cpp/accounts_mutator_impl.h index 21f1bc1b..234ac79c 100644 --- a/services/identity/public/cpp/accounts_mutator_impl.h +++ b/services/identity/public/cpp/accounts_mutator_impl.h
@@ -23,13 +23,11 @@ // server-side if needed. void RemoveAccount( const std::string& account_id, - signin_metrics::SourceForRefreshTokenOperation source = - signin_metrics::SourceForRefreshTokenOperation::kUnknown) override; + signin_metrics::SourceForRefreshTokenOperation source) override; // Removes all accounts. void RemoveAllAccounts( - signin_metrics::SourceForRefreshTokenOperation source = - signin_metrics::SourceForRefreshTokenOperation::kUnknown) override; + signin_metrics::SourceForRefreshTokenOperation source) override; private: ProfileOAuth2TokenService* token_service_;
diff --git a/services/identity/public/cpp/accounts_mutator_impl_unittest.cc b/services/identity/public/cpp/accounts_mutator_impl_unittest.cc index 8393844a..6c736ea 100644 --- a/services/identity/public/cpp/accounts_mutator_impl_unittest.cc +++ b/services/identity/public/cpp/accounts_mutator_impl_unittest.cc
@@ -9,6 +9,7 @@ #include "components/signin/core/browser/account_tracker_service.h" #include "components/signin/core/browser/fake_account_fetcher_service.h" #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" +#include "components/signin/core/browser/signin_metrics.h" #include "components/signin/core/browser/test_signin_client.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "services/identity/public/cpp/accounts_mutator_impl.h" @@ -112,7 +113,7 @@ return &token_service_observer_; } - AccountsMutatorImpl* accounts_mutator() { return &accounts_mutator_; } + AccountsMutator* accounts_mutator() { return &accounts_mutator_; } private: base::MessageLoop message_loop_; @@ -163,7 +164,8 @@ }, base::Unretained(&run_loop2), account_id)); - accounts_mutator()->RemoveAccount(account_id); + accounts_mutator()->RemoveAccount( + account_id, signin_metrics::SourceForRefreshTokenOperation::kUnknown); run_loop2.Run(); EXPECT_FALSE(token_service()->RefreshTokenIsAvailable(account_id)); @@ -213,7 +215,8 @@ // Now remove everything and check that there are no lingering accounts, nor // refresh tokens associated to |kTestGaiaId| and |kTestGaiaId2| afterwards. base::RunLoop run_loop3; - accounts_mutator()->RemoveAllAccounts(); + accounts_mutator()->RemoveAllAccounts( + signin_metrics::SourceForRefreshTokenOperation::kUnknown); run_loop3.RunUntilIdle(); EXPECT_FALSE(token_service()->RefreshTokenIsAvailable(kTestGaiaId));
diff --git a/services/tracing/perfetto/perfetto_service.cc b/services/tracing/perfetto/perfetto_service.cc index e4f1acc..2713e99 100644 --- a/services/tracing/perfetto/perfetto_service.cc +++ b/services/tracing/perfetto/perfetto_service.cc
@@ -71,9 +71,6 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); service_ = perfetto::TracingService::CreateInstance( std::make_unique<MojoSharedMemory::Factory>(), &perfetto_task_runner_); - // Chromium uses scraping of the shared memory chunks to ensure that data - // from threads without a MessageLoop doesn't get lost. - service_->SetSMBScrapingEnabled(true); DCHECK(service_); }
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 1947b6b58..643e11d0 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -5409,26 +5409,6 @@ ] } ], - "WebSocketHandshakeReuseConnection": [ - { - "platforms": [ - "windows", - "mac", - "chromeos", - "linux", - "android", - "android_webview" - ], - "experiments": [ - { - "name": "Shipped", - "enable_features": [ - "WebSocketHandshakeReuseConnection" - ] - } - ] - } - ], "WebViewUmaLogAppPackageName": [ { "platforms": [
diff --git a/third_party/blink/common/download/download_stats.cc b/third_party/blink/common/download/download_stats.cc index 77746ab..9db43e7 100644 --- a/third_party/blink/common/download/download_stats.cc +++ b/third_party/blink/common/download/download_stats.cc
@@ -9,38 +9,48 @@ namespace blink { -// static -unsigned DownloadStats::ToUmaValue(const DownloadFlags& flags) { +unsigned DownloadStats::MainFrameDownloadFlags::ToUmaValue() const { unsigned value = 0; - if (flags.has_sandbox) - value |= kSandboxBit; - if (flags.is_cross_origin) - value |= kCrossOriginBit; - if (flags.is_ad_frame) - value |= kAdBit; - if (flags.has_gesture) - value |= kGestureBit; + if (has_sandbox) + value |= kMainFrameSandboxBit; + if (has_gesture) + value |= kMainFrameGestureBit; return value; } -// static -void DownloadStats::RecordMainFrameHasGesture(bool has_gesture, - ukm::SourceId source_id, - ukm::UkmRecorder* ukm_recorder) { - UMA_HISTOGRAM_BOOLEAN("Download.MainFrame.HasGesture", has_gesture); +unsigned DownloadStats::SubframeDownloadFlags::ToUmaValue() const { + unsigned value = 0; + if (has_sandbox) + value |= kSubframeSandboxBit; + if (is_cross_origin) + value |= kSubframeCrossOriginBit; + if (is_ad_frame) + value |= kSubframeAdBit; + if (has_gesture) + value |= kSubframeGestureBit; + return value; +} + +void DownloadStats::RecordMainFrameDownloadFlags( + const MainFrameDownloadFlags& flags, + ukm::SourceId source_id, + ukm::UkmRecorder* ukm_recorder) { + UMA_HISTOGRAM_ENUMERATION("Download.MainFrame.SandboxGesture", + flags.ToUmaValue(), kCountSandboxGesture); ukm::builders::MainFrameDownload(source_id) - .SetHasGesture(has_gesture) + .SetHasSandbox(flags.has_sandbox) + .SetHasGesture(flags.has_gesture) .Record(ukm_recorder); } // static void DownloadStats::RecordSubframeDownloadFlags( - const DownloadFlags& flags, + const SubframeDownloadFlags& flags, ukm::SourceId source_id, ukm::UkmRecorder* ukm_recorder) { UMA_HISTOGRAM_ENUMERATION("Download.Subframe.SandboxOriginAdGesture", - ToUmaValue(flags), kCountSandboxOriginAdGesture); + flags.ToUmaValue(), kCountSandboxOriginAdGesture); ukm::builders::SubframeDownload(source_id) .SetHasSandbox(flags.has_sandbox)
diff --git a/third_party/blink/public/BUILD.gn b/third_party/blink/public/BUILD.gn index 771b3c8..cbbbccb 100644 --- a/third_party/blink/public/BUILD.gn +++ b/third_party/blink/public/BUILD.gn
@@ -195,6 +195,7 @@ "platform/web_canvas_capture_handler.h", "platform/web_client_hints_type.h", "platform/web_coalesced_input_event.h", + "platform/web_color_scheme.h", "platform/web_common.h", "platform/web_computed_ax_tree.h", "platform/web_connection_type.h",
diff --git a/third_party/blink/public/common/download/download_stats.h b/third_party/blink/public/common/download/download_stats.h index d40f5ee..e11b2b3 100644 --- a/third_party/blink/public/common/download/download_stats.h +++ b/third_party/blink/public/common/download/download_stats.h
@@ -22,28 +22,39 @@ class BLINK_COMMON_EXPORT DownloadStats { public: - struct DownloadFlags { + struct BLINK_COMMON_EXPORT MainFrameDownloadFlags { + bool has_sandbox; + bool has_gesture; + + MainFrameDownloadFlags() = default; + + unsigned ToUmaValue() const; + + private: + DISALLOW_COPY_AND_ASSIGN(MainFrameDownloadFlags); + }; + + struct BLINK_COMMON_EXPORT SubframeDownloadFlags { bool has_sandbox; bool is_cross_origin; bool is_ad_frame; bool has_gesture; - DownloadFlags() = default; + SubframeDownloadFlags() = default; + + unsigned ToUmaValue() const; private: - DISALLOW_COPY_AND_ASSIGN(DownloadFlags); + DISALLOW_COPY_AND_ASSIGN(SubframeDownloadFlags); }; - // It's only public for testing purposes. - static unsigned ToUmaValue(const DownloadFlags& flags); - - // Log the gesture bit for main frame download to UMA and UKM. - static void RecordMainFrameHasGesture(bool has_gesture, - ukm::SourceId source_id, - ukm::UkmRecorder* ukm_recorder); + // Log the bits in |flags| for a main frame download to UMA and UKM. + static void RecordMainFrameDownloadFlags(const MainFrameDownloadFlags& flags, + ukm::SourceId source_id, + ukm::UkmRecorder* ukm_recorder); // Log the bits in |flags| for a subframe download to UMA and UKM. - static void RecordSubframeDownloadFlags(const DownloadFlags& flags, + static void RecordSubframeDownloadFlags(const SubframeDownloadFlags& flags, ukm::SourceId source_id, ukm::UkmRecorder* ukm_recorder); @@ -52,11 +63,17 @@ // These values are used to construct an enum in UMA. They should never be // changed. - static constexpr unsigned kGestureBit = 0x1 << 0; - static constexpr unsigned kAdBit = 0x1 << 1; - static constexpr unsigned kCrossOriginBit = 0x1 << 2; - static constexpr unsigned kSandboxBit = 0x1 << 3; + static constexpr unsigned kSubframeGestureBit = 0x1 << 0; + static constexpr unsigned kSubframeAdBit = 0x1 << 1; + static constexpr unsigned kSubframeCrossOriginBit = 0x1 << 2; + static constexpr unsigned kSubframeSandboxBit = 0x1 << 3; static constexpr unsigned kCountSandboxOriginAdGesture = 16; + + // These values are used to construct an enum in UMA. They should never be + // changed. + static constexpr unsigned kMainFrameGestureBit = 0x1 << 0; + static constexpr unsigned kMainFrameSandboxBit = 0x1 << 1; + static constexpr unsigned kCountSandboxGesture = 4; }; } // namespace blink
diff --git a/third_party/blink/public/platform/modules/notifications/web_notification_data.h b/third_party/blink/public/platform/modules/notifications/web_notification_data.h index 6c100ef6..1ab0e9a 100644 --- a/third_party/blink/public/platform/modules/notifications/web_notification_data.h +++ b/third_party/blink/public/platform/modules/notifications/web_notification_data.h
@@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_NOTIFICATIONS_WEB_NOTIFICATION_DATA_H_ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_NOTIFICATIONS_WEB_NOTIFICATION_DATA_H_ +#include "third_party/blink/public/mojom/notifications/notification.mojom-shared.h" #include "third_party/blink/public/platform/modules/notifications/web_notification_action.h" #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/platform/web_url.h" @@ -21,14 +22,9 @@ // ultimately WebNotificationData will also be replaced by the mojom one there // via Onion Soup effort. struct WebNotificationData { - enum Direction { - kDirectionLeftToRight, - kDirectionRightToLeft, - kDirectionAuto - }; - WebString title; - Direction direction = kDirectionLeftToRight; + mojom::NotificationDirection direction = + mojom::NotificationDirection::LEFT_TO_RIGHT; WebString lang; WebString body; WebString tag;
diff --git a/third_party/blink/public/platform/web_color_scheme.h b/third_party/blink/public/platform/web_color_scheme.h new file mode 100644 index 0000000..f125105 --- /dev/null +++ b/third_party/blink/public/platform/web_color_scheme.h
@@ -0,0 +1,19 @@ +// 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 THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_COLOR_SCHEME_H_ +#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_COLOR_SCHEME_H_ + +namespace blink { + +// Use for passing preferred color scheme from the OS to the renderer. +enum class WebColorScheme { + kNoPreference, + kDark, + kLight, +}; + +} // namespace blink + +#endif
diff --git a/third_party/blink/public/platform/web_runtime_features.h b/third_party/blink/public/platform/web_runtime_features.h index cf6efc5..60d7d3f 100644 --- a/third_party/blink/public/platform/web_runtime_features.h +++ b/third_party/blink/public/platform/web_runtime_features.h
@@ -94,6 +94,7 @@ BLINK_PLATFORM_EXPORT static void EnableCSSHexAlphaColor(bool); BLINK_PLATFORM_EXPORT static void EnableCSSFragmentIdentifiers(bool); BLINK_PLATFORM_EXPORT static void EnableScrollTopLeftInterop(bool); + BLINK_PLATFORM_EXPORT static void EnableKeyboardFocusableScrollers(bool); BLINK_PLATFORM_EXPORT static void EnableDatabase(bool); BLINK_PLATFORM_EXPORT static void EnableDecodeToYUV(bool); BLINK_PLATFORM_EXPORT static void EnableDisplayCutoutAPI(bool);
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc index 470086f..544e1f6 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
@@ -691,12 +691,8 @@ WTF::ArrayBufferContents::Initialize(AdjustAmountOfExternalAllocatedMemory); DEFINE_STATIC_LOCAL(ArrayBufferAllocator, array_buffer_allocator, ()); - auto v8_extras_mode = RuntimeEnabledFeatures::ExperimentalV8ExtrasEnabled() - ? gin::IsolateHolder::kStableAndExperimentalV8Extras - : gin::IsolateHolder::kStableV8Extras; gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, - v8_extras_mode, &array_buffer_allocator, - reference_table); + &array_buffer_allocator, reference_table); ThreadScheduler* scheduler = ThreadScheduler::Current();
diff --git a/third_party/blink/renderer/bindings/scripts/v8_dictionary.py b/third_party/blink/renderer/bindings/scripts/v8_dictionary.py index 7b5227a2..04860137 100644 --- a/third_party/blink/renderer/bindings/scripts/v8_dictionary.py +++ b/third_party/blink/renderer/bindings/scripts/v8_dictionary.py
@@ -115,6 +115,11 @@ raise Exception( 'Required member %s must not have a default value.' % member.name) + if idl_type.is_nullable and idl_type.inner_type.is_dictionary: + raise Exception( + 'The inner type of nullable member %s must not be a dictionary.' % + member.name) + # In most cases, we don't have to distinguish `null` and `not present`, # and use null-states (e.g. nullptr, foo.IsUndefinedOrNull()) to show such # states for some types for memory usage and performance.
diff --git a/third_party/blink/renderer/core/css/css.dict b/third_party/blink/renderer/core/css/css.dict index a7772b74..6572728 100644 --- a/third_party/blink/renderer/core/css/css.dict +++ b/third_party/blink/renderer/core/css/css.dict
@@ -918,6 +918,9 @@ "reset-size" "dynamic" "non-scaling-stroke" +"no-preference" +"light" +"dark" # at-rules "@charset"
diff --git a/third_party/blink/renderer/core/css/css_quad_value.h b/third_party/blink/renderer/core/css/css_quad_value.h index dc6718c..eebf3f0 100644 --- a/third_party/blink/renderer/core/css/css_quad_value.h +++ b/third_party/blink/renderer/core/css/css_quad_value.h
@@ -39,6 +39,11 @@ return MakeGarbageCollected<CSSQuadValue>(top, right, bottom, left, serialization_type); } + static CSSQuadValue* Create(CSSValue* value, + TypeForSerialization serialization_type) { + return MakeGarbageCollected<CSSQuadValue>(value, value, value, value, + serialization_type); + } CSSQuadValue(CSSValue* top, CSSValue* right,
diff --git a/third_party/blink/renderer/core/css/css_value_keywords.json5 b/third_party/blink/renderer/core/css/css_value_keywords.json5 index 6967328..e4488de 100644 --- a/third_party/blink/renderer/core/css/css_value_keywords.json5 +++ b/third_party/blink/renderer/core/css/css_value_keywords.json5
@@ -1196,5 +1196,10 @@ // pan-up, // pan-down // none + + // (prefers-color-scheme:) media feature + "no-preference", + "dark", + "light", ], }
diff --git a/third_party/blink/renderer/core/css/media_feature_names.json5 b/third_party/blink/renderer/core/css/media_feature_names.json5 index 4640d1a..9c3417d 100644 --- a/third_party/blink/renderer/core/css/media_feature_names.json5 +++ b/third_party/blink/renderer/core/css/media_feature_names.json5
@@ -48,6 +48,7 @@ "min-width", "min-resolution", "pointer", + "prefers-color-scheme", "resolution", "-webkit-transform-3d", "scan",
diff --git a/third_party/blink/renderer/core/css/media_query_evaluator.cc b/third_party/blink/renderer/core/css/media_query_evaluator.cc index e0e5ca2..b5609c8 100644 --- a/third_party/blink/renderer/core/css/media_query_evaluator.cc +++ b/third_party/blink/renderer/core/css/media_query_evaluator.cc
@@ -32,6 +32,7 @@ #include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/blink/public/platform/pointer_properties.h" #include "third_party/blink/public/platform/shape_properties.h" +#include "third_party/blink/public/platform/web_color_scheme.h" #include "third_party/blink/renderer/core/css/css_primitive_value.h" #include "third_party/blink/renderer/core/css/css_resolution_units.h" #include "third_party/blink/renderer/core/css/css_to_length_conversion_data.h" @@ -809,6 +810,26 @@ return false; } +static bool PrefersColorSchemeMediaFeatureEval( + const MediaQueryExpValue& value, + MediaFeaturePrefix, + const MediaValues& media_values) { + WebColorScheme preferred_scheme = media_values.PreferredColorScheme(); + + if (!value.IsValid()) + return preferred_scheme != WebColorScheme::kNoPreference; + + if (!value.is_id) + return false; + + return (preferred_scheme == WebColorScheme::kNoPreference && + value.id == CSSValueNoPreference) || + (preferred_scheme == WebColorScheme::kDark && + value.id == CSSValueDark) || + (preferred_scheme == WebColorScheme::kLight && + value.id == CSSValueLight); +} + void MediaQueryEvaluator::Init() { // Create the table. g_function_map = new FunctionMap;
diff --git a/third_party/blink/renderer/core/css/media_query_exp.cc b/third_party/blink/renderer/core/css/media_query_exp.cc index 8719608..0d274d4 100644 --- a/third_party/blink/renderer/core/css/media_query_exp.cc +++ b/third_party/blink/renderer/core/css/media_query_exp.cc
@@ -72,6 +72,13 @@ ident == CSSValueRec2020; } + if (RuntimeEnabledFeatures::MediaQueryPrefersColorSchemeEnabled()) { + if (media_feature == kPrefersColorSchemeMediaFeature) { + return ident == CSSValueNoPreference || ident == CSSValueDark || + ident == CSSValueLight; + } + } + return false; } @@ -186,7 +193,8 @@ media_feature == kScanMediaFeature || media_feature == kShapeMediaFeature || media_feature == kColorGamutMediaFeature || - media_feature == kImmersiveMediaFeature; + media_feature == kImmersiveMediaFeature || + media_feature == kPrefersColorSchemeMediaFeature; } bool MediaQueryExp::IsViewportDependent() const {
diff --git a/third_party/blink/renderer/core/css/media_values.cc b/third_party/blink/renderer/core/css/media_values.cc index 1a63d54..5f3bc6d 100644 --- a/third_party/blink/renderer/core/css/media_values.cc +++ b/third_party/blink/renderer/core/css/media_values.cc
@@ -176,6 +176,12 @@ frame->GetPage()->GetChromeClient().GetScreenInfo()); } +WebColorScheme MediaValues::CalculatePreferredColorScheme(LocalFrame* frame) { + DCHECK(frame); + DCHECK(frame->GetSettings()); + return frame->GetSettings()->GetPreferredColorScheme(); +} + bool MediaValues::ComputeLengthImpl(double value, CSSPrimitiveValue::UnitType type, unsigned default_font_size,
diff --git a/third_party/blink/renderer/core/css/media_values.h b/third_party/blink/renderer/core/css/media_values.h index c33d2384..bfbf6b9 100644 --- a/third_party/blink/renderer/core/css/media_values.h +++ b/third_party/blink/renderer/core/css/media_values.h
@@ -18,6 +18,7 @@ class CSSPrimitiveValue; class LocalFrame; enum class ColorSpaceGamut; +enum class WebColorScheme; class CORE_EXPORT MediaValues : public GarbageCollectedFinalized<MediaValues> { public: @@ -76,6 +77,7 @@ virtual void OverrideViewportDimensions(double width, double height) = 0; virtual DisplayShape GetDisplayShape() const = 0; virtual ColorSpaceGamut ColorGamut() const = 0; + virtual WebColorScheme PreferredColorScheme() const = 0; protected: static double CalculateViewportWidth(LocalFrame*); @@ -97,6 +99,7 @@ static int CalculateAvailableHoverTypes(LocalFrame*); static DisplayShape CalculateDisplayShape(LocalFrame*); static ColorSpaceGamut CalculateColorGamut(LocalFrame*); + static WebColorScheme CalculatePreferredColorScheme(LocalFrame*); }; } // namespace blink
diff --git a/third_party/blink/renderer/core/css/media_values_cached.cc b/third_party/blink/renderer/core/css/media_values_cached.cc index 5d8f675d..8575866 100644 --- a/third_party/blink/renderer/core/css/media_values_cached.cc +++ b/third_party/blink/renderer/core/css/media_values_cached.cc
@@ -4,6 +4,7 @@ #include "third_party/blink/renderer/core/css/media_values_cached.h" +#include "third_party/blink/public/platform/web_color_scheme.h" #include "third_party/blink/renderer/core/css/css_primitive_value.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/frame/local_frame.h" @@ -30,7 +31,8 @@ strict_mode(true), display_mode(kWebDisplayModeBrowser), display_shape(kDisplayShapeRect), - color_gamut(ColorSpaceGamut::kUnknown) {} + color_gamut(ColorSpaceGamut::kUnknown), + preferred_color_scheme(WebColorScheme::kNoPreference) {} MediaValuesCached::MediaValuesCachedData::MediaValuesCachedData( Document& document) @@ -69,6 +71,7 @@ media_type = MediaValues::CalculateMediaType(frame); display_shape = MediaValues::CalculateDisplayShape(frame); color_gamut = MediaValues::CalculateColorGamut(frame); + preferred_color_scheme = MediaValues::CalculatePreferredColorScheme(frame); } } @@ -192,4 +195,8 @@ return data_.color_gamut; } +WebColorScheme MediaValuesCached::PreferredColorScheme() const { + return data_.preferred_color_scheme; +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/css/media_values_cached.h b/third_party/blink/renderer/core/css/media_values_cached.h index dfa427f..ecf3f7e6 100644 --- a/third_party/blink/renderer/core/css/media_values_cached.h +++ b/third_party/blink/renderer/core/css/media_values_cached.h
@@ -36,6 +36,7 @@ WebDisplayMode display_mode; DisplayShape display_shape; ColorSpaceGamut color_gamut; + WebColorScheme preferred_color_scheme; MediaValuesCachedData(); explicit MediaValuesCachedData(Document&); @@ -61,6 +62,7 @@ data.display_mode = display_mode; data.display_shape = display_shape; data.color_gamut = color_gamut; + data.preferred_color_scheme = preferred_color_scheme; return data; } }; @@ -100,6 +102,7 @@ WebDisplayMode DisplayMode() const override; DisplayShape GetDisplayShape() const override; ColorSpaceGamut ColorGamut() const override; + WebColorScheme PreferredColorScheme() const override; void OverrideViewportDimensions(double width, double height) override;
diff --git a/third_party/blink/renderer/core/css/media_values_dynamic.cc b/third_party/blink/renderer/core/css/media_values_dynamic.cc index 512f184..3eefa6869 100644 --- a/third_party/blink/renderer/core/css/media_values_dynamic.cc +++ b/third_party/blink/renderer/core/css/media_values_dynamic.cc
@@ -4,6 +4,7 @@ #include "third_party/blink/renderer/core/css/media_values_dynamic.h" +#include "third_party/blink/public/platform/web_color_scheme.h" #include "third_party/blink/renderer/core/css/css_primitive_value.h" #include "third_party/blink/renderer/core/css/css_resolution_units.h" #include "third_party/blink/renderer/core/css/css_to_length_conversion_data.h" @@ -141,6 +142,10 @@ return CalculateColorGamut(frame_); } +WebColorScheme MediaValuesDynamic::PreferredColorScheme() const { + return CalculatePreferredColorScheme(frame_); +} + Document* MediaValuesDynamic::GetDocument() const { return frame_->GetDocument(); }
diff --git a/third_party/blink/renderer/core/css/media_values_dynamic.h b/third_party/blink/renderer/core/css/media_values_dynamic.h index 0d52247..700bf511 100644 --- a/third_party/blink/renderer/core/css/media_values_dynamic.h +++ b/third_party/blink/renderer/core/css/media_values_dynamic.h
@@ -48,6 +48,7 @@ WebDisplayMode DisplayMode() const override; DisplayShape GetDisplayShape() const override; ColorSpaceGamut ColorGamut() const override; + WebColorScheme PreferredColorScheme() const override; Document* GetDocument() const override; bool HasValues() const override; void OverrideViewportDimensions(double width, double height) override;
diff --git a/third_party/blink/renderer/core/css/properties/longhands/border_image_outset_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/border_image_outset_custom.cc index 7f0185f..e0f12599 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/border_image_outset_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/border_image_outset_custom.cc
@@ -30,12 +30,10 @@ const CSSValue* BorderImageOutset::InitialValue() const { DEFINE_STATIC_LOCAL( - Persistent<CSSValue>, zeroInteger, - (CSSPrimitiveValue::Create(0, CSSPrimitiveValue::UnitType::kInteger))); - DEFINE_STATIC_LOCAL( Persistent<CSSQuadValue>, value, - (CSSQuadValue::Create(zeroInteger, zeroInteger, zeroInteger, zeroInteger, - CSSQuadValue::kSerializeAsQuad))); + (CSSQuadValue::Create( + CSSPrimitiveValue::Create(0, CSSPrimitiveValue::UnitType::kInteger), + CSSQuadValue::kSerializeAsQuad))); return value; }
diff --git a/third_party/blink/renderer/core/css/properties/longhands/border_image_slice_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/border_image_slice_custom.cc index 00b47d5..83a8d7a 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/border_image_slice_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/border_image_slice_custom.cc
@@ -29,16 +29,14 @@ } const CSSValue* BorderImageSlice::InitialValue() const { - DEFINE_STATIC_LOCAL(Persistent<CSSValue>, hundredPercent, - (CSSPrimitiveValue::Create( - 100, CSSPrimitiveValue::UnitType::kPercentage))); - DEFINE_STATIC_LOCAL( - Persistent<CSSQuadValue>, slices, - (CSSQuadValue::Create(hundredPercent, hundredPercent, hundredPercent, - hundredPercent, CSSQuadValue::kSerializeAsQuad))); DEFINE_STATIC_LOCAL( Persistent<CSSBorderImageSliceValue>, value, - (CSSBorderImageSliceValue::Create(slices, /* fill */ false))); + (CSSBorderImageSliceValue::Create( + CSSQuadValue::Create( + CSSPrimitiveValue::Create( + 100, CSSPrimitiveValue::UnitType::kPercentage), + CSSQuadValue::kSerializeAsQuad), + /* fill */ false))); return value; }
diff --git a/third_party/blink/renderer/core/css/properties/longhands/border_image_width_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/border_image_width_custom.cc index 6b3bd3bd..cbf66971 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/border_image_width_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/border_image_width_custom.cc
@@ -30,12 +30,10 @@ const CSSValue* BorderImageWidth::InitialValue() const { DEFINE_STATIC_LOCAL( - Persistent<CSSValue>, oneInteger, - (CSSPrimitiveValue::Create(1, CSSPrimitiveValue::UnitType::kInteger))); - DEFINE_STATIC_LOCAL( Persistent<CSSQuadValue>, value, - (CSSQuadValue::Create(oneInteger, oneInteger, oneInteger, oneInteger, - CSSQuadValue::kSerializeAsQuad))); + (CSSQuadValue::Create( + CSSPrimitiveValue::Create(1, CSSPrimitiveValue::UnitType::kInteger), + CSSQuadValue::kSerializeAsQuad))); return value; }
diff --git a/third_party/blink/renderer/core/css/style_engine_test.cc b/third_party/blink/renderer/core/css/style_engine_test.cc index de49782..4f0cd8b 100644 --- a/third_party/blink/renderer/core/css/style_engine_test.cc +++ b/third_party/blink/renderer/core/css/style_engine_test.cc
@@ -6,6 +6,7 @@ #include <memory> #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/platform/web_color_scheme.h" #include "third_party/blink/public/platform/web_float_rect.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/core/css/css_font_selector.h" @@ -41,6 +42,7 @@ class StyleEngineTest : public testing::Test { protected: void SetUp() override; + void TearDown() override; Document& GetDocument() { return dummy_page_holder_->GetDocument(); } StyleEngine& GetStyleEngine() { return GetDocument().GetStyleEngine(); } @@ -64,12 +66,17 @@ private: std::unique_ptr<DummyPageHolder> dummy_page_holder_; + RuntimeEnabledFeatures::Backup features_backup_; }; void StyleEngineTest::SetUp() { dummy_page_holder_ = DummyPageHolder::Create(IntSize(800, 600)); } +void StyleEngineTest::TearDown() { + features_backup_.Restore(); +} + StyleEngineTest::RuleSetInvalidation StyleEngineTest::ScheduleInvalidationsForRules(TreeScope& tree_scope, const String& css_text) { @@ -1477,6 +1484,31 @@ GetCSSPropertyColor())); } +TEST_F(StyleEngineTest, MediaQueriesChangeColorScheme) { + RuntimeEnabledFeatures::SetMediaQueryPrefersColorSchemeEnabled(true); + + GetDocument().body()->SetInnerHTMLFromString(R"HTML( + <style> + body { color: red } + @media (prefers-color-scheme: dark) { + body { color: green } + } + </style> + <body></body> + )HTML"); + + UpdateAllLifecyclePhases(); + EXPECT_EQ(MakeRGB(255, 0, 0), + GetDocument().body()->GetComputedStyle()->VisitedDependentColor( + GetCSSPropertyColor())); + + GetDocument().GetSettings()->SetPreferredColorScheme(WebColorScheme::kDark); + UpdateAllLifecyclePhases(); + EXPECT_EQ(MakeRGB(0, 128, 0), + GetDocument().body()->GetComputedStyle()->VisitedDependentColor( + GetCSSPropertyColor())); +} + TEST_F(StyleEngineTest, ShadowRootStyleRecalcCrash) { GetDocument().body()->SetInnerHTMLFromString("<div id=host></div>"); HTMLElement* host = ToHTMLElement(GetDocument().getElementById("host"));
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 932c9f8..f76a4c8 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
@@ -238,13 +238,12 @@ if (state_ != kCommitting && state_ != kUpdating && !update_forced_) return; - // We must have contain: content for display locking. - // Note that we should also have content containment even if we're forcing + // We must have "contain: style layout" for display locking. + // Note that we should also have this containment even if we're forcing // this update to happen. Otherwise, proceeding with layout may cause // unexpected behavior. By rejecting the promise, the behavior can be detected // by script. - auto* style = element_->GetComputedStyle(); - if (!style || !style->ContainsContent()) { + if (!ElementSupportsDisplayLocking()) { FinishUpdateResolver(kReject); FinishCommitResolver(kReject); state_ = state_ == kUpdating ? kLocked : kUnlocked; @@ -302,11 +301,9 @@ return; // Note that although we checked at style recalc time that the element has - // "contain: content", it might not actually apply the containment (e.g. see - // ShouldApplyContentContainment()). This confirms that containment should - // apply. - auto* layout_object = element_->GetLayoutObject(); - if (!layout_object || !layout_object->ShouldApplyContentContainment()) { + // "contain: style layout", it might not actually apply the containment at the + // layout object level. This confirms that containment should apply. + if (!ElementSupportsDisplayLocking()) { FinishUpdateResolver(kReject); FinishCommitResolver(kReject); state_ = state_ == kUpdating ? kLocked : kUnlocked; @@ -574,6 +571,20 @@ timeout_task_is_scheduled_ = false; } +bool DisplayLockContext::ElementSupportsDisplayLocking() const { + DCHECK(element_ && !IsElementDirtyForStyleRecalc()); + // If we have a layout object, check that since it's a more authoritative + // source of containment information. + if (auto* layout_object = element_->GetLayoutObject()) { + return layout_object->ShouldApplyStyleContainment() && + layout_object->ShouldApplyLayoutContainment(); + } + + // Otherwise, fallback on just checking style. + auto* style = element_->GetComputedStyle(); + return style && style->ContainsStyle() && style->ContainsLayout(); +} + // Scoped objects implementation // -----------------------------------------------
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_context.h b/third_party/blink/renderer/core/display_lock/display_lock_context.h index 4bd5eb3..6e726bb1 100644 --- a/third_party/blink/renderer/core/display_lock/display_lock_context.h +++ b/third_party/blink/renderer/core/display_lock/display_lock_context.h
@@ -195,6 +195,11 @@ void FinishUpdateResolver(ResolverState); void FinishCommitResolver(ResolverState); + // Returns true if the element supports display locking. Note that this can + // only be called if the style is clean. It checks the layout object if it + // exists. Otherwise, falls back to checking computed style. + bool ElementSupportsDisplayLocking() const; + std::unique_ptr<DisplayLockBudget> update_budget_; Member<ScriptPromiseResolver> commit_resolver_;
diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc index 51a3ac1..b5e9f38 100644 --- a/third_party/blink/renderer/core/dom/element.cc +++ b/third_party/blink/renderer/core/dom/element.cc
@@ -1480,9 +1480,12 @@ ExceptionState& exception_state) { // TODO(vogelheim): Check whether this applies to non-HTML documents, too. AtomicString name_lowercase = LowercaseIfNecessary(name); - if (GetCheckedAttributeNames().Contains(name_lowercase)) { - String attr_value = - GetStringFromTrustedType(string_or_TT, &GetDocument(), exception_state); + const AttrNameToTrustedType* attribute_types = &GetCheckedAttributeTypes(); + AttrNameToTrustedType::const_iterator it = + attribute_types->find(name_lowercase); + if (it != attribute_types->end()) { + String attr_value = GetStringFromSpecificTrustedType( + string_or_TT, it->value, &GetDocument(), exception_state); if (!exception_state.HadException()) setAttribute(name_lowercase, AtomicString(attr_value), exception_state); return; @@ -1492,9 +1495,9 @@ setAttribute(name_lowercase, value_string, exception_state); } -const HashSet<AtomicString>& Element::GetCheckedAttributeNames() const { - DEFINE_STATIC_LOCAL(HashSet<AtomicString>, attribute_set, ({})); - return attribute_set; +const AttrNameToTrustedType& Element::GetCheckedAttributeTypes() const { + DEFINE_STATIC_LOCAL(AttrNameToTrustedType, attribute_map, ({})); + return attribute_map; } void Element::setAttribute(const QualifiedName& name,
diff --git a/third_party/blink/renderer/core/dom/element.h b/third_party/blink/renderer/core/dom/element.h index be766d6..77a792a 100644 --- a/third_party/blink/renderer/core/dom/element.h +++ b/third_party/blink/renderer/core/dom/element.h
@@ -38,6 +38,7 @@ #include "third_party/blink/renderer/core/html/focus_options.h" #include "third_party/blink/renderer/core/html_names.h" #include "third_party/blink/renderer/core/resize_observer/resize_observer.h" +#include "third_party/blink/renderer/core/trustedtypes/trusted_types_util.h" #include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/scroll/scroll_types.h" @@ -150,6 +151,8 @@ typedef HeapVector<TraceWrapperMember<Attr>> AttrNodeList; +typedef HashMap<AtomicString, SpecificTrustedType> AttrNameToTrustedType; + class CORE_EXPORT Element : public ContainerNode { DEFINE_WRAPPERTYPEINFO(); @@ -220,7 +223,7 @@ ExceptionState&); // Returns attributes that should be checked against Trusted Types - virtual const HashSet<AtomicString>& GetCheckedAttributeNames() const; + virtual const AttrNameToTrustedType& GetCheckedAttributeTypes() const; // Trusted Type HTML variant void setAttribute(const QualifiedName&,
diff --git a/third_party/blink/renderer/core/dom/range.idl b/third_party/blink/renderer/core/dom/range.idl index 09fcdd4..83f4117 100644 --- a/third_party/blink/renderer/core/dom/range.idl +++ b/third_party/blink/renderer/core/dom/range.idl
@@ -19,9 +19,6 @@ */ // https://dom.spec.whatwg.org/#interface-range -// The `HTMLString` reference below is from Trusted Types: -// https://github.com/WICG/trusted-types/, which is still WIP. -// https://crbug.com/739170. [ Constructor, ConstructorCallWith=Document
diff --git a/third_party/blink/renderer/core/exported/web_frame_test.cc b/third_party/blink/renderer/core/exported/web_frame_test.cc index 6dd3f7f..3c575590 100644 --- a/third_party/blink/renderer/core/exported/web_frame_test.cc +++ b/third_party/blink/renderer/core/exported/web_frame_test.cc
@@ -9609,20 +9609,20 @@ LocalDOMWindow* main_window = ToWebLocalFrameImpl(MainFrame())->GetFrame()->DomWindow(); - String destination = "data:text/html:destination"; + KURL destination = ToKURL("data:text/html:destination"); NonThrowableExceptionState exception_state; main_window->open( USVStringOrTrustedURL::FromTrustedURL(TrustedURL::Create(destination)), "frame1", "", main_window, main_window, exception_state); ASSERT_FALSE(remote_client.LastRequest().IsNull()); - EXPECT_EQ(remote_client.LastRequest().Url(), WebURL(KURL(destination))); + EXPECT_EQ(remote_client.LastRequest().Url(), WebURL(destination)); // Pointing a named frame to an empty URL should just return a reference to // the frame's window without navigating it. DOMWindow* result = main_window->open( - USVStringOrTrustedURL::FromTrustedURL(TrustedURL::Create("")), "frame1", - "", main_window, main_window, exception_state); - EXPECT_EQ(remote_client.LastRequest().Url(), WebURL(KURL(destination))); + USVStringOrTrustedURL::FromTrustedURL(TrustedURL::Create(ToKURL(""))), + "frame1", "", main_window, main_window, exception_state); + EXPECT_EQ(remote_client.LastRequest().Url(), WebURL(destination)); EXPECT_EQ(result, WebFrame::ToCoreFrame(*remote_frame)->DomWindow()); Reset();
diff --git a/third_party/blink/renderer/core/frame/settings.h b/third_party/blink/renderer/core/frame/settings.h index cfa2886..3df729d 100644 --- a/third_party/blink/renderer/core/frame/settings.h +++ b/third_party/blink/renderer/core/frame/settings.h
@@ -33,6 +33,7 @@ #include "base/macros.h" #include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/blink/public/platform/pointer_properties.h" +#include "third_party/blink/public/platform/web_color_scheme.h" #include "third_party/blink/public/platform/web_effective_connection_type.h" #include "third_party/blink/public/platform/web_viewport_style.h" #include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h"
diff --git a/third_party/blink/renderer/core/frame/settings.json5 b/third_party/blink/renderer/core/frame/settings.json5 index cb4d605..f11b9dc3 100644 --- a/third_party/blink/renderer/core/frame/settings.json5 +++ b/third_party/blink/renderer/core/frame/settings.json5
@@ -1008,5 +1008,14 @@ initial: 800, type: "int", }, + + // Preferred color scheme from the OS/application passed to the renderer for + // evaluating the prefers-color-scheme media query. + { + name: "preferredColorScheme", + initial: "WebColorScheme::kNoPreference", + invalidate: "MediaQuery", + type: "WebColorScheme", + }, ], }
diff --git a/third_party/blink/renderer/core/html/forms/html_input_element.cc b/third_party/blink/renderer/core/html/forms/html_input_element.cc index 373805c..575d5e40 100644 --- a/third_party/blink/renderer/core/html/forms/html_input_element.cc +++ b/third_party/blink/renderer/core/html/forms/html_input_element.cc
@@ -143,10 +143,11 @@ TextControlElement::Trace(visitor); } -const HashSet<AtomicString>& HTMLInputElement::GetCheckedAttributeNames() +const AttrNameToTrustedType& HTMLInputElement::GetCheckedAttributeTypes() const { - DEFINE_STATIC_LOCAL(HashSet<AtomicString>, attribute_set, ({"src"})); - return attribute_set; + DEFINE_STATIC_LOCAL(AttrNameToTrustedType, attribute_map, + ({{"src", SpecificTrustedType::kTrustedURL}})); + return attribute_map; } bool HTMLInputElement::HasPendingActivity() const {
diff --git a/third_party/blink/renderer/core/html/forms/html_input_element.h b/third_party/blink/renderer/core/html/forms/html_input_element.h index e48c4882..43bf4f66 100644 --- a/third_party/blink/renderer/core/html/forms/html_input_element.h +++ b/third_party/blink/renderer/core/html/forms/html_input_element.h
@@ -62,7 +62,7 @@ void Trace(blink::Visitor*) override; // Returns attributes that should be checked against Trusted Types - const HashSet<AtomicString>& GetCheckedAttributeNames() const override; + const AttrNameToTrustedType& GetCheckedAttributeTypes() const override; bool HasPendingActivity() const final;
diff --git a/third_party/blink/renderer/core/html/html_anchor_element.cc b/third_party/blink/renderer/core/html/html_anchor_element.cc index 2fbbdb18..b5116c1 100644 --- a/third_party/blink/renderer/core/html/html_anchor_element.cc +++ b/third_party/blink/renderer/core/html/html_anchor_element.cc
@@ -60,19 +60,20 @@ void RecordDownloadMetrics(LocalFrame* frame) { if (frame->IsMainFrame()) { - bool has_gesture = LocalFrame::HasTransientUserActivation(frame); - DownloadStats::RecordMainFrameHasGesture( - has_gesture, frame->GetDocument()->UkmSourceID(), + DownloadStats::MainFrameDownloadFlags flags; + flags.has_sandbox = frame->GetDocument()->IsSandboxed(kSandboxDownloads); + flags.has_gesture = LocalFrame::HasTransientUserActivation(frame); + DownloadStats::RecordMainFrameDownloadFlags( + flags, frame->GetDocument()->UkmSourceID(), frame->GetDocument()->UkmRecorder()); return; } - DownloadStats::DownloadFlags flags; + DownloadStats::SubframeDownloadFlags flags; flags.has_sandbox = frame->GetDocument()->IsSandboxed(kSandboxDownloads); flags.is_cross_origin = frame->IsCrossOriginSubframe(); flags.is_ad_frame = frame->IsAdSubframe(); flags.has_gesture = LocalFrame::HasTransientUserActivation(frame); - DownloadStats::RecordSubframeDownloadFlags( flags, frame->GetDocument()->UkmSourceID(), frame->GetDocument()->UkmRecorder()); @@ -200,10 +201,11 @@ ContainerNode::SetActive(down); } -const HashSet<AtomicString>& HTMLAnchorElement::GetCheckedAttributeNames() +const AttrNameToTrustedType& HTMLAnchorElement::GetCheckedAttributeTypes() const { - DEFINE_STATIC_LOCAL(HashSet<AtomicString>, attribute_set, ({"href"})); - return attribute_set; + DEFINE_STATIC_LOCAL(AttrNameToTrustedType, attribute_map, + ({{"href", SpecificTrustedType::kTrustedURL}})); + return attribute_map; } void HTMLAnchorElement::AttributeChanged(
diff --git a/third_party/blink/renderer/core/html/html_anchor_element.h b/third_party/blink/renderer/core/html/html_anchor_element.h index 464ae2a..6c94b3c4 100644 --- a/third_party/blink/renderer/core/html/html_anchor_element.h +++ b/third_party/blink/renderer/core/html/html_anchor_element.h
@@ -71,7 +71,7 @@ ~HTMLAnchorElement() override; // Returns attributes that should be checked against Trusted Types - const HashSet<AtomicString>& GetCheckedAttributeNames() const override; + const AttrNameToTrustedType& GetCheckedAttributeTypes() const override; KURL Href() const; void SetHref(const AtomicString&);
diff --git a/third_party/blink/renderer/core/html/html_base_element.cc b/third_party/blink/renderer/core/html/html_base_element.cc index c72c4f9..24a433a8c 100644 --- a/third_party/blink/renderer/core/html/html_base_element.cc +++ b/third_party/blink/renderer/core/html/html_base_element.cc
@@ -39,9 +39,10 @@ DEFINE_NODE_FACTORY(HTMLBaseElement) -const HashSet<AtomicString>& HTMLBaseElement::GetCheckedAttributeNames() const { - DEFINE_STATIC_LOCAL(HashSet<AtomicString>, attribute_set, ({"href"})); - return attribute_set; +const AttrNameToTrustedType& HTMLBaseElement::GetCheckedAttributeTypes() const { + DEFINE_STATIC_LOCAL(AttrNameToTrustedType, attribute_map, + ({{"href", SpecificTrustedType::kTrustedURL}})); + return attribute_map; } void HTMLBaseElement::ParseAttribute(
diff --git a/third_party/blink/renderer/core/html/html_base_element.h b/third_party/blink/renderer/core/html/html_base_element.h index 5973ef2..32037b3 100644 --- a/third_party/blink/renderer/core/html/html_base_element.h +++ b/third_party/blink/renderer/core/html/html_base_element.h
@@ -39,7 +39,7 @@ explicit HTMLBaseElement(Document&); // Returns attributes that should be checked against Trusted Types - const HashSet<AtomicString>& GetCheckedAttributeNames() const override; + const AttrNameToTrustedType& GetCheckedAttributeTypes() const override; KURL href() const; void href(USVStringOrTrustedURL&) const;
diff --git a/third_party/blink/renderer/core/html/html_embed_element.cc b/third_party/blink/renderer/core/html/html_embed_element.cc index 1f152c3..bc92cca 100644 --- a/third_party/blink/renderer/core/html/html_embed_element.cc +++ b/third_party/blink/renderer/core/html/html_embed_element.cc
@@ -55,10 +55,11 @@ return element; } -const HashSet<AtomicString>& HTMLEmbedElement::GetCheckedAttributeNames() +const AttrNameToTrustedType& HTMLEmbedElement::GetCheckedAttributeTypes() const { - DEFINE_STATIC_LOCAL(HashSet<AtomicString>, attribute_set, ({"src"})); - return attribute_set; + DEFINE_STATIC_LOCAL(AttrNameToTrustedType, attribute_map, + ({{"src", SpecificTrustedType::kTrustedScriptURL}})); + return attribute_map; } static inline LayoutEmbeddedContent* FindPartLayoutObject(const Node* n) {
diff --git a/third_party/blink/renderer/core/html/html_embed_element.h b/third_party/blink/renderer/core/html/html_embed_element.h index 98a1e7c..88985b45 100644 --- a/third_party/blink/renderer/core/html/html_embed_element.h +++ b/third_party/blink/renderer/core/html/html_embed_element.h
@@ -40,7 +40,7 @@ HTMLEmbedElement(Document&, const CreateElementFlags); // Returns attributes that should be checked against Trusted Types - const HashSet<AtomicString>& GetCheckedAttributeNames() const override; + const AttrNameToTrustedType& GetCheckedAttributeTypes() const override; bool IsExposed() const;
diff --git a/third_party/blink/renderer/core/html/html_embed_element.idl b/third_party/blink/renderer/core/html/html_embed_element.idl index fc16063..73cd221 100644 --- a/third_party/blink/renderer/core/html/html_embed_element.idl +++ b/third_party/blink/renderer/core/html/html_embed_element.idl
@@ -20,10 +20,6 @@ // https://html.spec.whatwg.org/#the-embed-element -// The `ScriptURLString` reference below is from Trusted Types: -// https://github.com/WICG/trusted-types/, which is still WIP. -// https://crbug.com/739170. - // TODO(yukishiino): HTMLEmbedElement should not have [OverrideBuiltins]. [ OverrideBuiltins,
diff --git a/third_party/blink/renderer/core/html/html_frame_element.cc b/third_party/blink/renderer/core/html/html_frame_element.cc index 837ecc2..98d28bb8 100644 --- a/third_party/blink/renderer/core/html/html_frame_element.cc +++ b/third_party/blink/renderer/core/html/html_frame_element.cc
@@ -39,10 +39,11 @@ DEFINE_NODE_FACTORY(HTMLFrameElement) -const HashSet<AtomicString>& HTMLFrameElement::GetCheckedAttributeNames() +const AttrNameToTrustedType& HTMLFrameElement::GetCheckedAttributeTypes() const { - DEFINE_STATIC_LOCAL(HashSet<AtomicString>, attribute_set, ({"src"})); - return attribute_set; + DEFINE_STATIC_LOCAL(AttrNameToTrustedType, attribute_map, + ({{"src", SpecificTrustedType::kTrustedURL}})); + return attribute_map; } bool HTMLFrameElement::LayoutObjectIsNeeded(const ComputedStyle&) const {
diff --git a/third_party/blink/renderer/core/html/html_frame_element.h b/third_party/blink/renderer/core/html/html_frame_element.h index ac0ae52..e57302d 100644 --- a/third_party/blink/renderer/core/html/html_frame_element.h +++ b/third_party/blink/renderer/core/html/html_frame_element.h
@@ -40,7 +40,7 @@ explicit HTMLFrameElement(Document&); // Returns attributes that should be checked against Trusted Types - const HashSet<AtomicString>& GetCheckedAttributeNames() const override; + const AttrNameToTrustedType& GetCheckedAttributeTypes() const override; bool HasFrameBorder() const { return frame_border_; }
diff --git a/third_party/blink/renderer/core/html/html_frame_element.idl b/third_party/blink/renderer/core/html/html_frame_element.idl index 0950629..ede4af7 100644 --- a/third_party/blink/renderer/core/html/html_frame_element.idl +++ b/third_party/blink/renderer/core/html/html_frame_element.idl
@@ -20,9 +20,6 @@ // https://html.spec.whatwg.org/#htmlframeelement -// The `URLString` reference below is from Trusted Types: -// https://github.com/WICG/trusted-types/, which is still WIP. -// https://crbug.com/739170. [HTMLConstructor] interface HTMLFrameElement : HTMLElement { [CEReactions, Reflect] attribute DOMString name;
diff --git a/third_party/blink/renderer/core/html/html_iframe_element.cc b/third_party/blink/renderer/core/html/html_iframe_element.cc index 8756653..608e471 100644 --- a/third_party/blink/renderer/core/html/html_iframe_element.cc +++ b/third_party/blink/renderer/core/html/html_iframe_element.cc
@@ -59,11 +59,12 @@ HTMLIFrameElement::~HTMLIFrameElement() = default; -const HashSet<AtomicString>& HTMLIFrameElement::GetCheckedAttributeNames() +const AttrNameToTrustedType& HTMLIFrameElement::GetCheckedAttributeTypes() const { - DEFINE_STATIC_LOCAL(HashSet<AtomicString>, attribute_set, - ({"src", "srcdoc"})); - return attribute_set; + DEFINE_STATIC_LOCAL(AttrNameToTrustedType, attribute_map, + ({{"src", SpecificTrustedType::kTrustedURL}, + {"srcdoc", SpecificTrustedType::kTrustedHTML}})); + return attribute_map; } void HTMLIFrameElement::SetCollapsed(bool collapse) {
diff --git a/third_party/blink/renderer/core/html/html_iframe_element.h b/third_party/blink/renderer/core/html/html_iframe_element.h index dea9767..b4123a90 100644 --- a/third_party/blink/renderer/core/html/html_iframe_element.h +++ b/third_party/blink/renderer/core/html/html_iframe_element.h
@@ -52,7 +52,7 @@ DOMFeaturePolicy* featurePolicy(); // Returns attributes that should be checked against Trusted Types - const HashSet<AtomicString>& GetCheckedAttributeNames() const override; + const AttrNameToTrustedType& GetCheckedAttributeTypes() const override; ParsedFeaturePolicy ConstructContainerPolicy( Vector<String>* /* messages */) const override;
diff --git a/third_party/blink/renderer/core/html/html_image_element.cc b/third_party/blink/renderer/core/html/html_image_element.cc index eb8a7357..b738cd5 100644 --- a/third_party/blink/renderer/core/html/html_image_element.cc +++ b/third_party/blink/renderer/core/html/html_image_element.cc
@@ -134,10 +134,11 @@ HTMLElement::Trace(visitor); } -const HashSet<AtomicString>& HTMLImageElement::GetCheckedAttributeNames() +const AttrNameToTrustedType& HTMLImageElement::GetCheckedAttributeTypes() const { - DEFINE_STATIC_LOCAL(HashSet<AtomicString>, attribute_set, ({"src"})); - return attribute_set; + DEFINE_STATIC_LOCAL(AttrNameToTrustedType, attribute_map, + ({{"src", SpecificTrustedType::kTrustedURL}})); + return attribute_map; } void HTMLImageElement::NotifyViewportChanged() {
diff --git a/third_party/blink/renderer/core/html/html_image_element.h b/third_party/blink/renderer/core/html/html_image_element.h index 63817bf..9d50909 100644 --- a/third_party/blink/renderer/core/html/html_image_element.h +++ b/third_party/blink/renderer/core/html/html_image_element.h
@@ -60,7 +60,7 @@ class ViewportChangeListener; // Returns attributes that should be checked against Trusted Types - const HashSet<AtomicString>& GetCheckedAttributeNames() const override; + const AttrNameToTrustedType& GetCheckedAttributeTypes() const override; static HTMLImageElement* Create(Document&); static HTMLImageElement* Create(Document&, const CreateElementFlags);
diff --git a/third_party/blink/renderer/core/html/html_link_element.cc b/third_party/blink/renderer/core/html/html_link_element.cc index 6510c63..bd4e929 100644 --- a/third_party/blink/renderer/core/html/html_link_element.cc +++ b/third_party/blink/renderer/core/html/html_link_element.cc
@@ -66,9 +66,10 @@ HTMLLinkElement::~HTMLLinkElement() = default; -const HashSet<AtomicString>& HTMLLinkElement::GetCheckedAttributeNames() const { - DEFINE_STATIC_LOCAL(HashSet<AtomicString>, attribute_set, ({"href"})); - return attribute_set; +const AttrNameToTrustedType& HTMLLinkElement::GetCheckedAttributeTypes() const { + DEFINE_STATIC_LOCAL(AttrNameToTrustedType, attribute_map, + ({{"href", SpecificTrustedType::kTrustedURL}})); + return attribute_map; } void HTMLLinkElement::ParseAttribute(
diff --git a/third_party/blink/renderer/core/html/html_link_element.h b/third_party/blink/renderer/core/html/html_link_element.h index 201537d..91fb2c91 100644 --- a/third_party/blink/renderer/core/html/html_link_element.h +++ b/third_party/blink/renderer/core/html/html_link_element.h
@@ -58,7 +58,7 @@ ~HTMLLinkElement() override; // Returns attributes that should be checked against Trusted Types - const HashSet<AtomicString>& GetCheckedAttributeNames() const override; + const AttrNameToTrustedType& GetCheckedAttributeTypes() const override; KURL Href() const; const AtomicString& Rel() const;
diff --git a/third_party/blink/renderer/core/html/html_object_element.cc b/third_party/blink/renderer/core/html/html_object_element.cc index 1e7cb2ec9..8d13336 100644 --- a/third_party/blink/renderer/core/html/html_object_element.cc +++ b/third_party/blink/renderer/core/html/html_object_element.cc
@@ -69,11 +69,12 @@ HTMLPlugInElement::Trace(visitor); } -const HashSet<AtomicString>& HTMLObjectElement::GetCheckedAttributeNames() +const AttrNameToTrustedType& HTMLObjectElement::GetCheckedAttributeTypes() const { - DEFINE_STATIC_LOCAL(HashSet<AtomicString>, attribute_set, - ({"data", "codebase"})); - return attribute_set; + DEFINE_STATIC_LOCAL(AttrNameToTrustedType, attribute_map, + ({{"data", SpecificTrustedType::kTrustedScriptURL}, + {"codebase", SpecificTrustedType::kTrustedScriptURL}})); + return attribute_map; } LayoutEmbeddedContent* HTMLObjectElement::ExistingLayoutEmbeddedContent()
diff --git a/third_party/blink/renderer/core/html/html_object_element.h b/third_party/blink/renderer/core/html/html_object_element.h index ae5b59d3..387ddbff 100644 --- a/third_party/blink/renderer/core/html/html_object_element.h +++ b/third_party/blink/renderer/core/html/html_object_element.h
@@ -51,7 +51,7 @@ void Trace(blink::Visitor*) override; // Returns attributes that should be checked against Trusted Types - const HashSet<AtomicString>& GetCheckedAttributeNames() const override; + const AttrNameToTrustedType& GetCheckedAttributeTypes() const override; const String& ClassId() const { return class_id_; }
diff --git a/third_party/blink/renderer/core/html/html_script_element.cc b/third_party/blink/renderer/core/html/html_script_element.cc index 35f2ca5..dbff4b5 100644 --- a/third_party/blink/renderer/core/html/html_script_element.cc +++ b/third_party/blink/renderer/core/html/html_script_element.cc
@@ -55,10 +55,11 @@ return MakeGarbageCollected<HTMLScriptElement>(document, flags); } -const HashSet<AtomicString>& HTMLScriptElement::GetCheckedAttributeNames() +const AttrNameToTrustedType& HTMLScriptElement::GetCheckedAttributeTypes() const { - DEFINE_STATIC_LOCAL(HashSet<AtomicString>, attribute_set, ({"src", "text"})); - return attribute_set; + DEFINE_STATIC_LOCAL(AttrNameToTrustedType, attribute_map, + ({{"src", SpecificTrustedType::kTrustedScriptURL}})); + return attribute_map; } bool HTMLScriptElement::IsURLAttribute(const Attribute& attribute) const {
diff --git a/third_party/blink/renderer/core/html/html_script_element.h b/third_party/blink/renderer/core/html/html_script_element.h index 98418db..d70d8e9 100644 --- a/third_party/blink/renderer/core/html/html_script_element.h +++ b/third_party/blink/renderer/core/html/html_script_element.h
@@ -47,7 +47,7 @@ HTMLScriptElement(Document&, const CreateElementFlags); // Returns attributes that should be checked against Trusted Types - const HashSet<AtomicString>& GetCheckedAttributeNames() const override; + const AttrNameToTrustedType& GetCheckedAttributeTypes() const override; void text(StringOrTrustedScript& result); void setText(const StringOrTrustedScript&, ExceptionState&);
diff --git a/third_party/blink/renderer/core/html/html_source_element.cc b/third_party/blink/renderer/core/html/html_source_element.cc index 38ed258c..65ddfec 100644 --- a/third_party/blink/renderer/core/html/html_source_element.cc +++ b/third_party/blink/renderer/core/html/html_source_element.cc
@@ -72,10 +72,11 @@ HTMLSourceElement::~HTMLSourceElement() = default; -const HashSet<AtomicString>& HTMLSourceElement::GetCheckedAttributeNames() +const AttrNameToTrustedType& HTMLSourceElement::GetCheckedAttributeTypes() const { - DEFINE_STATIC_LOCAL(HashSet<AtomicString>, attribute_set, ({"src"})); - return attribute_set; + DEFINE_STATIC_LOCAL(AttrNameToTrustedType, attribute_map, + ({{"src", SpecificTrustedType::kTrustedURL}})); + return attribute_map; } void HTMLSourceElement::CreateMediaQueryList(const AtomicString& media) {
diff --git a/third_party/blink/renderer/core/html/html_source_element.h b/third_party/blink/renderer/core/html/html_source_element.h index 40771cd..35163c6 100644 --- a/third_party/blink/renderer/core/html/html_source_element.h +++ b/third_party/blink/renderer/core/html/html_source_element.h
@@ -47,7 +47,7 @@ ~HTMLSourceElement() override; // Returns attributes that should be checked against Trusted Types - const HashSet<AtomicString>& GetCheckedAttributeNames() const override; + const AttrNameToTrustedType& GetCheckedAttributeTypes() const override; const AtomicString& type() const; void SetSrc(const String&);
diff --git a/third_party/blink/renderer/core/html/media/html_media_element.cc b/third_party/blink/renderer/core/html/media/html_media_element.cc index 6e5917d..a6318ab 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.cc +++ b/third_party/blink/renderer/core/html/media/html_media_element.cc
@@ -410,10 +410,11 @@ return result; } -const HashSet<AtomicString>& HTMLMediaElement::GetCheckedAttributeNames() +const AttrNameToTrustedType& HTMLMediaElement::GetCheckedAttributeTypes() const { - DEFINE_STATIC_LOCAL(HashSet<AtomicString>, attribute_set, ({"src"})); - return attribute_set; + DEFINE_STATIC_LOCAL(AttrNameToTrustedType, attribute_map, + ({{"src", SpecificTrustedType::kTrustedURL}})); + return attribute_map; } bool HTMLMediaElement::IsHLSURL(const KURL& url) {
diff --git a/third_party/blink/renderer/core/html/media/html_media_element.h b/third_party/blink/renderer/core/html/media/html_media_element.h index e26c0b3a..3626169 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.h +++ b/third_party/blink/renderer/core/html/media/html_media_element.h
@@ -95,7 +95,7 @@ public: // Returns attributes that should be checked against Trusted Types - const HashSet<AtomicString>& GetCheckedAttributeNames() const override; + const AttrNameToTrustedType& GetCheckedAttributeTypes() const override; static MIMETypeRegistry::SupportsType GetSupportsType(const ContentType&);
diff --git a/third_party/blink/renderer/core/html/media/html_media_element.idl b/third_party/blink/renderer/core/html/media/html_media_element.idl index c568bcf..ecba454 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.idl +++ b/third_party/blink/renderer/core/html/media/html_media_element.idl
@@ -25,9 +25,6 @@ // https://html.spec.whatwg.org/#media-elements -// The `URLString` reference below is from Trusted Types: -// https://github.com/WICG/trusted-types/, which is still WIP. -// https://crbug.com/739170. enum CanPlayTypeResult { "" /* empty string */, "maybe", "probably" }; [ ActiveScriptWrappable
diff --git a/third_party/blink/renderer/core/html/track/html_track_element.cc b/third_party/blink/renderer/core/html/track/html_track_element.cc index 21b74d4..d6c81468 100644 --- a/third_party/blink/renderer/core/html/track/html_track_element.cc +++ b/third_party/blink/renderer/core/html/track/html_track_element.cc
@@ -60,10 +60,11 @@ HTMLTrackElement::~HTMLTrackElement() = default; -const HashSet<AtomicString>& HTMLTrackElement::GetCheckedAttributeNames() +const AttrNameToTrustedType& HTMLTrackElement::GetCheckedAttributeTypes() const { - DEFINE_STATIC_LOCAL(HashSet<AtomicString>, attribute_set, ({"src"})); - return attribute_set; + DEFINE_STATIC_LOCAL(AttrNameToTrustedType, attribute_map, + ({{"src", SpecificTrustedType::kTrustedURL}})); + return attribute_map; } Node::InsertionNotificationRequest HTMLTrackElement::InsertedInto(
diff --git a/third_party/blink/renderer/core/html/track/html_track_element.h b/third_party/blink/renderer/core/html/track/html_track_element.h index e8519bcf..b1e7e6b 100644 --- a/third_party/blink/renderer/core/html/track/html_track_element.h +++ b/third_party/blink/renderer/core/html/track/html_track_element.h
@@ -47,7 +47,7 @@ explicit HTMLTrackElement(Document&); // Returns attributes that should be checked against Trusted Types - const HashSet<AtomicString>& GetCheckedAttributeNames() const override; + const AttrNameToTrustedType& GetCheckedAttributeTypes() const override; const AtomicString& kind(); void setKind(const AtomicString&);
diff --git a/third_party/blink/renderer/core/html/track/html_track_element.idl b/third_party/blink/renderer/core/html/track/html_track_element.idl index bcafa67..001cabc9 100644 --- a/third_party/blink/renderer/core/html/track/html_track_element.idl +++ b/third_party/blink/renderer/core/html/track/html_track_element.idl
@@ -25,9 +25,6 @@ // https://html.spec.whatwg.org/#the-track-element -// The `URLString` reference below is from Trusted Types: -// https://github.com/WICG/trusted-types/, which is still WIP. -// https://crbug.com/739170. [HTMLConstructor] interface HTMLTrackElement : HTMLElement { [CEReactions] attribute DOMString kind;
diff --git a/third_party/blink/renderer/core/inspector/browser_protocol.pdl b/third_party/blink/renderer/core/inspector/browser_protocol.pdl index 773d35b..592ff56 100644 --- a/third_party/blink/renderer/core/inspector/browser_protocol.pdl +++ b/third_party/blink/renderer/core/inspector/browser_protocol.pdl
@@ -2833,8 +2833,9 @@ properties # Database name. string name - # Database version. - integer version + # Database version (type is not 'integer', as the standard + # requires the version number to be 'unsigned long long') + number version # Object stores in this database. array of ObjectStore objectStores
diff --git a/third_party/blink/renderer/core/layout/layout_grid.cc b/third_party/blink/renderer/core/layout/layout_grid.cc index ce5c677..1744bcc4 100644 --- a/third_party/blink/renderer/core/layout/layout_grid.cc +++ b/third_party/blink/renderer/core/layout/layout_grid.cc
@@ -1921,16 +1921,6 @@ return LayoutUnit(); } -bool LayoutGrid::GridPositionIsAutoForOutOfFlow( - GridPosition position, - GridTrackSizingDirection direction) const { - return (position.IsAuto() || - (position.IsNamedGridArea() && - !NamedLineCollection::IsValidNamedLineOrArea( - position.NamedGridLine(), StyleRef(), - GridPositionsResolver::InitialPositionSide(direction)))); -} - LayoutUnit LayoutGrid::ResolveAutoStartGridPosition( GridTrackSizingDirection direction) const { if (direction == kForRows || StyleRef().IsLeftToRightDirection()) @@ -1993,10 +1983,9 @@ : child.StyleRef().GridRowEnd(); bool start_is_auto = - GridPositionIsAutoForOutOfFlow(start_position, direction) || - start_line < 0 || start_line > last_line; - bool end_is_auto = GridPositionIsAutoForOutOfFlow(end_position, direction) || - end_line < 0 || end_line > last_line; + start_position.IsAuto() || start_line < 0 || start_line > last_line; + bool end_is_auto = + end_position.IsAuto() || end_line < 0 || end_line > last_line; if (start_is_auto && end_is_auto) return is_row_axis ? ClientLogicalWidth() : ClientLogicalHeight();
diff --git a/third_party/blink/renderer/core/layout/layout_grid.h b/third_party/blink/renderer/core/layout/layout_grid.h index 8d08fb1fe..45c06b6 100644 --- a/third_party/blink/renderer/core/layout/layout_grid.h +++ b/third_party/blink/renderer/core/layout/layout_grid.h
@@ -199,8 +199,6 @@ PositionedLayoutBehavior = kDefaultLayout) override; void PopulateGridPositionsForDirection(GridTrackSizingDirection); - bool GridPositionIsAutoForOutOfFlow(GridPosition, - GridTrackSizingDirection) const; LayoutUnit ResolveAutoStartGridPosition(GridTrackSizingDirection) const; LayoutUnit ResolveAutoEndGridPosition(GridTrackSizingDirection) const; LayoutUnit LogicalOffsetForChild(const LayoutBox&,
diff --git a/third_party/blink/renderer/core/page/focus_controller.cc b/third_party/blink/renderer/core/page/focus_controller.cc index 3125d9c..1f9eddd8a 100644 --- a/third_party/blink/renderer/core/page/focus_controller.cc +++ b/third_party/blink/renderer/core/page/focus_controller.cc
@@ -1342,15 +1342,7 @@ const LayoutRect& starting_rect, WebFocusType direction, FocusCandidate& closest, - const SkipList& already_checked) { - if (already_checked.Contains(&container)) - return; - - Element* focused_element = - (FocusedFrame() && FocusedFrame()->GetDocument()) - ? FocusedFrame()->GetDocument()->FocusedElement() - : nullptr; - + Node* focused_element) { Element* element = ElementTraversal::FirstWithin(container); FocusCandidate current; current.rect_in_root_frame = starting_rect; @@ -1359,22 +1351,18 @@ for (; element; element = - (IsNavigableContainer(element, direction)) + IsScrollableAreaOrDocument(element) ? ElementTraversal::NextSkippingChildren(*element, &container) : ElementTraversal::Next(*element, &container)) { if (element == focused_element) continue; - if (!element->IsKeyboardFocusable() && - !IsNavigableContainer(element, direction)) + if (!element->IsKeyboardFocusable()) continue; if (HasRemoteFrame(element)) continue; - if (already_checked.Contains(element)) - continue; - FocusCandidate candidate = FocusCandidate(element, direction); if (candidate.IsNull()) continue; @@ -1384,71 +1372,50 @@ } } +void ClearFocusInExitedFrames(LocalFrame* old_frame, + const LocalFrame* const new_frame) { + while (old_frame && new_frame != old_frame) { + // Focus is going away from this document, so clear the focused element. + old_frame->GetDocument()->ClearFocusedElement(); + old_frame->GetDocument()->SetSequentialFocusNavigationStartingPoint( + nullptr); + Frame* parent = old_frame->Tree().Parent(); + old_frame = parent->IsLocalFrame() ? ToLocalFrame(parent) : nullptr; + } +} + bool FocusController::AdvanceFocusDirectionallyInContainer( - Node* start_container, + Node* const container, const LayoutRect& starting_rect, WebFocusType direction, - Node* pruned_sub_tree_root) { - if (!start_container) - return false; + Node* focused_element) { + DCHECK(container); - HeapVector<Member<Node>> stack; - stack.push_back(start_container); + FocusCandidate candidate; + FindFocusCandidateInContainer(*container, starting_rect, direction, candidate, + focused_element); - SkipList already_checked; - if (pruned_sub_tree_root) - already_checked.insert(pruned_sub_tree_root); - - while (!stack.IsEmpty()) { - Node* container = stack.back(); - - FocusCandidate candidate; - FindFocusCandidateInContainer(*container, starting_rect, direction, - candidate, already_checked); - - if (candidate.IsNull()) { - // Nothing to focus in this container, scroll if possible. - // NOTE: If no scrolling is performed (i.e. ScrollInDirection returns - // false), the spatial navigation algorithm will skip this container. - if (ScrollInDirection(container, direction)) - return true; - - stack.pop_back(); - continue; - } - - if (!IsNavigableContainer(candidate.visible_node, direction)) { - // We found a new focus node, navigate to it. - Element* element = ToElement(candidate.focusable_node); - DCHECK(element); - element->focus( - FocusParams(SelectionBehaviorOnFocus::kReset, direction, nullptr)); - return true; - } - - // We now dig into a navigable container. - - HTMLFrameOwnerElement* frame_element = FrameOwnerElement(candidate); - if (frame_element && frame_element->ContentFrame()->IsLocalFrame()) { - // Navigate into a discovered frame. - ToLocalFrame(frame_element->ContentFrame()) - ->GetDocument() - ->UpdateStyleAndLayoutIgnorePendingStylesheets(); - - // Mark this |already_checked| so we can skip this subtree in case - // FindFocusCandidateInContainer() returns it again. - already_checked.insert(candidate.visible_node); - - stack.push_back( - ToLocalFrame(frame_element->ContentFrame())->GetDocument()); - continue; - } - - // Search sub-container. - stack.push_back(candidate.visible_node); + if (candidate.IsNull()) { + // Nothing to focus in this container, scroll if possible. + // NOTE: If no scrolling is performed (i.e. ScrollInDirection returns + // false), the spatial navigation algorithm will skip this container. + return ScrollInDirection(container, direction); } - return ScrollInDirection(start_container, direction); + Element* element = ToElement(candidate.focusable_node); + DCHECK(element); + + // Before focusing the new element, check if we're leaving an iframe (= moving + // focus out of an iframe). In this case, we want the exited [nested] iframes + // to loose focus. This is tested in snav-iframe-nested.html. + LocalFrame* old_frame = (focused_frame_ && focused_frame_->IsLocalFrame()) + ? ToLocalFrame(focused_frame_.Get()) + : nullptr; + ClearFocusInExitedFrames(old_frame, element->GetDocument().GetFrame()); + + element->focus( + FocusParams(SelectionBehaviorOnFocus::kReset, direction, nullptr)); + return true; } bool FocusController::AdvanceFocusDirectionally(WebFocusType direction) { @@ -1461,6 +1428,7 @@ Document* focused_document = current_frame->GetDocument(); if (!focused_document) return false; + focused_document->UpdateStyleAndLayoutIgnorePendingStylesheets(); Node* focused_element = focused_document->FocusedElement(); @@ -1475,7 +1443,6 @@ const LayoutRect start_box = SearchOrigin(visible_rect, focused_element, direction); bool consumed = false; - Node* pruned_sub_tree_root = nullptr; if (IsScrollableAreaOrDocument(focused_element) && !IsOffscreen(focused_element)) { @@ -1485,18 +1452,23 @@ direction, nullptr); if (consumed) return true; - // The scroller had nothing. Let's search outside of it. - pruned_sub_tree_root = focused_element; + // The focused scroller had nothing. Let's search outside of it. } + Node* skipped_tree = focused_element; while (container) { - consumed = AdvanceFocusDirectionallyInContainer( - container, start_box, direction, pruned_sub_tree_root); + consumed = AdvanceFocusDirectionallyInContainer(container, start_box, + direction, skipped_tree); if (consumed) break; + // Containers are not focused “on the way out”. This prevents containers + // from acting as “focus traps”. Take <c> <a> </c> <b>. Focus can move from + // <a> to <b> but not from <a> to the scroll container <c>. If we'd allow + // focus to move from <a> to <c>, the user would never be able to exit <c>. + // When the scroll container <c> is focused, we move focus back to <a>... + skipped_tree = container; // Nothing found in |container| so search the parent container. - pruned_sub_tree_root = container; container = ScrollableAreaOrDocumentOf(container); if (auto* document = DynamicTo<Document>(container)) document->UpdateStyleAndLayoutIgnorePendingStylesheets();
diff --git a/third_party/blink/renderer/core/page/focus_controller.h b/third_party/blink/renderer/core/page/focus_controller.h index ab26339..0eccc0c 100644 --- a/third_party/blink/renderer/core/page/focus_controller.h +++ b/third_party/blink/renderer/core/page/focus_controller.h
@@ -108,7 +108,6 @@ void Trace(blink::Visitor*); private: - using SkipList = HeapHashSet<Member<Node>>; Element* FindFocusableElement(WebFocusType, Element&, OwnerMap&); @@ -123,15 +122,15 @@ bool initial_focus, InputDeviceCapabilities* source_capabilities); - bool AdvanceFocusDirectionallyInContainer(Node* start_container, + bool AdvanceFocusDirectionallyInContainer(Node* const container, const LayoutRect& starting_rect, WebFocusType, - Node* pruned_sub_tree_root); + Node* focused_element); void FindFocusCandidateInContainer(Node& container, const LayoutRect& starting_rect, WebFocusType, FocusCandidate& closest, - const SkipList& already_checked); + Node* focused_element); void NotifyFocusChangedObservers() const;
diff --git a/third_party/blink/renderer/core/page/spatial_navigation.cc b/third_party/blink/renderer/core/page/spatial_navigation.cc index 6e05ab8..70a3f037 100644 --- a/third_party/blink/renderer/core/page/spatial_navigation.cc +++ b/third_party/blink/renderer/core/page/spatial_navigation.cc
@@ -168,7 +168,8 @@ if (rect.IsEmpty()) return true; - if (!frame_viewport.Intersects(rect)) + // A document always intersects with its frame's viewport. + if (node != node->GetDocument() && !frame_viewport.Intersects(rect)) return true; // Now we know that the node is visible in the its own frame's viewport (it is @@ -241,83 +242,55 @@ ToHTMLFrameOwnerElement(node)->ContentFrame()->IsRemoteFrame(); } -bool ScrollInDirection(LocalFrame* frame, WebFocusType direction) { - DCHECK(frame); - - if (frame && CanScrollInDirection(frame->GetDocument(), direction)) { - int dx = 0; - int dy = 0; - int pixels_per_line_step = - ScrollableArea::PixelsPerLineStep(frame->View()->GetChromeClient()); - switch (direction) { - case kWebFocusTypeLeft: - dx = -pixels_per_line_step; - break; - case kWebFocusTypeRight: - dx = pixels_per_line_step; - break; - case kWebFocusTypeUp: - dy = -pixels_per_line_step; - break; - case kWebFocusTypeDown: - dy = pixels_per_line_step; - break; - default: - NOTREACHED(); - return false; - } - - frame->View()->GetScrollableArea()->ScrollBy(ScrollOffset(dx, dy), - kUserScroll); - return true; - } - return false; -} - bool ScrollInDirection(Node* container, WebFocusType direction) { DCHECK(container); - if (auto* document = DynamicTo<Document>(container)) - return ScrollInDirection(document->GetFrame(), direction); if (!container->GetLayoutBox()) return false; - if (CanScrollInDirection(container, direction)) { - int dx = 0; - int dy = 0; - // TODO(leviw): Why are these values truncated (toInt) instead of rounding? - LocalFrameView* frame_view = container->GetDocument().View(); - int pixels_per_line_step = ScrollableArea::PixelsPerLineStep( - frame_view ? frame_view->GetChromeClient() : nullptr); - switch (direction) { - case kWebFocusTypeLeft: - dx = -pixels_per_line_step; - break; - case kWebFocusTypeRight: - DCHECK_GT(container->GetLayoutBox()->ScrollWidth(), - (container->GetLayoutBox()->ScrollLeft() + - container->GetLayoutBox()->ClientWidth())); - dx = pixels_per_line_step; - break; - case kWebFocusTypeUp: - dy = -pixels_per_line_step; - break; - case kWebFocusTypeDown: - DCHECK(container->GetLayoutBox()->ScrollHeight() - - (container->GetLayoutBox()->ScrollTop() + - container->GetLayoutBox()->ClientHeight())); - dy = pixels_per_line_step; - break; - default: - NOTREACHED(); - return false; - } + if (!container->GetLayoutBox()->GetScrollableArea()) + return false; - container->GetLayoutBox()->ScrollByRecursively(ScrollOffset(dx, dy)); - return true; + if (!CanScrollInDirection(container, direction)) + return false; + + int dx = 0; + int dy = 0; + int pixels_per_line_step = ScrollableArea::PixelsPerLineStep( + container->GetDocument().GetFrame()->View()->GetChromeClient()); + switch (direction) { + case kWebFocusTypeLeft: + dx = -pixels_per_line_step; + break; + case kWebFocusTypeRight: + DCHECK_GT(container->GetLayoutBox()->ScrollWidth(), + container->GetLayoutBox()->ScrollLeft() + + container->GetLayoutBox()->ClientWidth()); + dx = pixels_per_line_step; + break; + case kWebFocusTypeUp: + dy = -pixels_per_line_step; + break; + case kWebFocusTypeDown: + DCHECK_GT(container->GetLayoutBox()->ScrollHeight(), + container->GetLayoutBox()->ScrollTop() + + container->GetLayoutBox()->ClientHeight()); + dy = pixels_per_line_step; + break; + default: + NOTREACHED(); + return false; } - return false; + // TODO(crbug.com/914775): Use UserScroll() instead. UserScroll() does a + // smooth, animated scroll which might make it easier for users to understand + // spatnav's moves. Another advantage of using ScrollableArea::UserScroll() is + // that it returns a ScrollResult so we don't need to call + // CanScrollInDirection(). Regular arrow-key scrolling (without + // --enable-spatial-navigation) already uses smooth scrolling by default. + container->GetLayoutBox()->GetScrollableArea()->ScrollBy(ScrollOffset(dx, dy), + kUserScroll); + return true; } static void DeflateIfOverlapped(LayoutRect& a, LayoutRect& b) { @@ -374,16 +347,6 @@ IsScrollableNode(node); } -bool IsNavigableContainer(const Node* node, WebFocusType direction) { - if (!node) - return false; - - return node->IsDocumentNode() || - (node->IsFrameOwnerElement() && - ToHTMLFrameOwnerElement(node)->ContentFrame()) || - CanScrollInDirection(node, direction); -} - bool CanScrollInDirection(const Node* container, WebFocusType direction) { DCHECK(container); if (auto* document = DynamicTo<Document>(container))
diff --git a/third_party/blink/renderer/core/page/spatial_navigation.h b/third_party/blink/renderer/core/page/spatial_navigation.h index 05d9b3f..96f2a5e3 100644 --- a/third_party/blink/renderer/core/page/spatial_navigation.h +++ b/third_party/blink/renderer/core/page/spatial_navigation.h
@@ -86,9 +86,7 @@ CORE_EXPORT bool HasRemoteFrame(const Node*); CORE_EXPORT bool IsOffscreen(const Node*); CORE_EXPORT bool IsOffscreenAfterFrameScroll(const Node*, WebFocusType); -bool ScrollInDirection(LocalFrame*, WebFocusType); bool ScrollInDirection(Node* container, WebFocusType); -bool IsNavigableContainer(const Node*, WebFocusType); CORE_EXPORT bool IsScrollableNode(const Node* node); CORE_EXPORT bool IsScrollableAreaOrDocument(const Node*); CORE_EXPORT Node* ScrollableAreaOrDocumentOf(Node*);
diff --git a/third_party/blink/renderer/core/paint/text_paint_timing_detector_test.cc b/third_party/blink/renderer/core/paint/text_paint_timing_detector_test.cc index 7656053..496c9a7 100644 --- a/third_party/blink/renderer/core/paint/text_paint_timing_detector_test.cc +++ b/third_party/blink/renderer/core/paint/text_paint_timing_detector_test.cc
@@ -63,29 +63,74 @@ void SimulateAnalyze() { GetPaintTimingDetector().GetTextPaintTimingDetector().Analyze(); } + + Element* AppendFontElementToBody(String content) { + Element* element = GetDocument().CreateRawElement(html_names::kFontTag); + element->setAttribute(html_names::kSizeAttr, AtomicString("5")); + Text* text = GetDocument().createTextNode(content); + element->AppendChild(text); + GetDocument().body()->AppendChild(element); + return element; + } + + Element* AppendDivElementToBody(String content, String style = "") { + Element* div = GetDocument().CreateRawElement(html_names::kDivTag); + div->setAttribute(html_names::kStyleAttr, AtomicString(style)); + Text* text = GetDocument().createTextNode(content); + div->AppendChild(text); + GetDocument().body()->AppendChild(div); + return div; + } + + DOMNodeId NodeIdOfText(Element* element) { + DCHECK_EQ(element->CountChildren(), 1u); + DCHECK(element->firstChild()->IsTextNode()); + DCHECK(!element->firstChild()->hasChildren()); + return DOMNodeIds::IdForNode(element->firstChild()); + } + + TextRecord* TextRecordOfLargestTextPaint() { + return GetPaintTimingDetector() + .GetTextPaintTimingDetector() + .FindLargestPaintCandidate(); + } + + TextRecord* TextRecordOfLastTextPaint() { + return GetPaintTimingDetector() + .GetTextPaintTimingDetector() + .FindLastPaintCandidate(); + } + + void SetFontSize(Element* font_element, uint8_t font_size) { + DCHECK_EQ(font_element->nodeName(), "FONT"); + font_element->setAttribute(html_names::kSizeAttr, + AtomicString(WTF::String::Number(font_size))); + } + + void SetElementStyle(Element* element, String style) { + element->setAttribute(html_names::kStyleAttr, AtomicString(style)); + } + + void RemoveElement(Element* element) { + element->GetLayoutObject()->Parent()->GetNode()->removeChild(element); + } }; TEST_F(TextPaintTimingDetectorTest, LargestTextPaint_NoText) { SetBodyInnerHTML(R"HTML( - <div></div> + <body></body> )HTML"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - TextRecord* record = GetPaintTimingDetector() - .GetTextPaintTimingDetector() - .FindLargestPaintCandidate(); - EXPECT_FALSE(record); + EXPECT_FALSE(TextRecordOfLargestTextPaint()); } TEST_F(TextPaintTimingDetectorTest, LargestTextPaint_OneText) { SetBodyInnerHTML(R"HTML( - <div>The only text</div> + <body></body> )HTML"); + Element* only_text = AppendDivElementToBody("The only text"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - TextRecord* record = GetPaintTimingDetector() - .GetTextPaintTimingDetector() - .FindLargestPaintCandidate(); - EXPECT_TRUE(record); - EXPECT_EQ(record->text, "The only text"); + EXPECT_EQ(TextRecordOfLargestTextPaint()->node_id, NodeIdOfText(only_text)); } TEST_F(TextPaintTimingDetectorTest, NodeRemovedBeforeAssigningSwapTime) { @@ -103,22 +148,18 @@ TEST_F(TextPaintTimingDetectorTest, LargestTextPaint_LargestText) { SetBodyInnerHTML(R"HTML( - <div>medium text</div> + <body></body> )HTML"); + AppendDivElementToBody("medium text"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - Text* larger_text = GetDocument().createTextNode("a long-long-long text"); - GetDocument().body()->AppendChild(larger_text); + Element* large_text = AppendDivElementToBody("a long-long-long text"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - Text* tiny_text = GetDocument().createTextNode("small"); - GetDocument().body()->AppendChild(tiny_text); + AppendDivElementToBody("small"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - TextRecord* record = GetPaintTimingDetector() - .GetTextPaintTimingDetector() - .FindLargestPaintCandidate(); - EXPECT_EQ(record->text, "a long-long-long text"); + EXPECT_EQ(TextRecordOfLargestTextPaint()->node_id, NodeIdOfText(large_text)); } TEST_F(TextPaintTimingDetectorTest, UpdateResultWhenCandidateChanged) { @@ -152,26 +193,24 @@ TEST_F(TextPaintTimingDetectorTest, LargestTextPaint_ReportFirstPaintTime) { TimeTicks time1 = CurrentTimeTicks(); SetBodyInnerHTML(R"HTML( - <div> - <div id='b'>size-changing block</div> - <div>a long-long-long-long moving text</div> - </div> + <body></body> )HTML"); + Element* size_changing_text = AppendFontElementToBody("size-changing text"); + Element* long_text = + AppendFontElementToBody("a long-long-long-long moving text"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); TimeTicks time2 = CurrentTimeTicks(); - GetDocument().getElementById("b")->setAttribute(html_names::kStyleAttr, - AtomicString("height:50px")); + SetFontSize(size_changing_text, 50); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - GetDocument().getElementById("b")->setAttribute(html_names::kStyleAttr, - AtomicString("height:100px")); + SetFontSize(long_text, 100); UpdateAllLifecyclePhasesAndSimulateSwapTime(); TextRecord* record = GetPaintTimingDetector() .GetTextPaintTimingDetector() .FindLargestPaintCandidate(); - EXPECT_EQ(record->text, "a long-long-long-long moving text"); + EXPECT_EQ(TextRecordOfLargestTextPaint()->node_id, NodeIdOfText(long_text)); TimeTicks firing_time = record->first_paint_time; EXPECT_GE(firing_time, time1); EXPECT_GE(time2, firing_time); @@ -199,89 +238,62 @@ TEST_F(TextPaintTimingDetectorTest, LargestTextPaint_IgnoreRemovedText) { SetBodyInnerHTML(R"HTML( - <div id='parent'> - <div id='earlyLargeText'>(large text)(large text)(large text)(large text)(large text)(large text)</div> - <div>small text</div> - </div> + <body></body> )HTML"); + Element* large_text = AppendDivElementToBody( + "(large text)(large text)(large text)(large text)(large text)(large " + "text)"); + Element* small_text = AppendDivElementToBody("small text"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - TextRecord* record = GetPaintTimingDetector() - .GetTextPaintTimingDetector() - .FindLargestPaintCandidate(); - EXPECT_TRUE(record); - EXPECT_EQ(record->text, - "(large text)(large text)(large text)(large text)(large " - "text)(large text)"); + EXPECT_EQ(TextRecordOfLargestTextPaint()->node_id, NodeIdOfText(large_text)); - GetDocument().getElementById("parent")->RemoveChild( - GetDocument().getElementById("earlyLargeText")); + RemoveElement(large_text); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - record = GetPaintTimingDetector() - .GetTextPaintTimingDetector() - .FindLargestPaintCandidate(); - EXPECT_EQ(record->text, "small text"); + EXPECT_EQ(TextRecordOfLargestTextPaint()->node_id, NodeIdOfText(small_text)); } TEST_F(TextPaintTimingDetectorTest, LargestTextPaint_ReportLastNullCandidate) { SetBodyInnerHTML(R"HTML( - <div id='parent'> - <div id='remove'>text</div> - </div> + <body></body> )HTML"); + Element* text = AppendDivElementToBody("text to remove"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); SimulateAnalyze(); - TextRecord* record = GetPaintTimingDetector() - .GetTextPaintTimingDetector() - .FindLargestPaintCandidate(); - EXPECT_TRUE(record); - EXPECT_EQ(record->text, "text"); + EXPECT_EQ(TextRecordOfLargestTextPaint()->node_id, NodeIdOfText(text)); EXPECT_NE(LargestPaintStoredResult(), base::TimeTicks()); - GetDocument().getElementById("parent")->RemoveChild( - GetDocument().getElementById("remove")); + RemoveElement(text); UpdateAllLifecyclePhasesAndSimulateSwapTime(); SimulateAnalyze(); - record = GetPaintTimingDetector() - .GetTextPaintTimingDetector() - .FindLargestPaintCandidate(); - EXPECT_FALSE(record); + EXPECT_FALSE(TextRecordOfLargestTextPaint()); EXPECT_EQ(LargestPaintStoredResult(), base::TimeTicks()); } TEST_F(TextPaintTimingDetectorTest, LargestTextPaint_CompareVisualSizeNotActualSize) { SetBodyInnerHTML(R"HTML( - <div> - <div>short</div> - <div style="position:fixed;left:-10px">a long text</div> - </div> + <body></body> )HTML"); + AppendDivElementToBody("a long text", "position:fixed;left:-10px"); + Element* short_text = AppendDivElementToBody("short"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - TextRecord* record = GetPaintTimingDetector() - .GetTextPaintTimingDetector() - .FindLargestPaintCandidate(); - EXPECT_EQ(record->text, "short"); + EXPECT_EQ(TextRecordOfLargestTextPaint()->node_id, NodeIdOfText(short_text)); } +// Depite that the l TEST_F(TextPaintTimingDetectorTest, LargestTextPaint_CompareSizesAtFirstPaint) { SetBodyInnerHTML(R"HTML( - <div> - <div id="shorteningText">large-to-small text</div> - <div>a medium text</div> - </div> + <body></body> )HTML"); + Element* shortening_long_text = AppendDivElementToBody("123456789"); + AppendDivElementToBody("12345678"); // 1 letter shorter than the above. UpdateAllLifecyclePhasesAndSimulateSwapTime(); // The visual size becomes smaller when less portion intersecting with // viewport. - GetDocument() - .getElementById("shorteningText") - ->setAttribute(html_names::kStyleAttr, - AtomicString("position:fixed;left:-10px")); + SetElementStyle(shortening_long_text, "position:fixed;left:-10px"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - TextRecord* record = GetPaintTimingDetector() - .GetTextPaintTimingDetector() - .FindLargestPaintCandidate(); - EXPECT_EQ(record->text, "large-to-small text"); + EXPECT_EQ(TextRecordOfLargestTextPaint()->node_id, + NodeIdOfText(shortening_long_text)); } TEST_F(TextPaintTimingDetectorTest, LastTextPaint_NoText) { @@ -297,61 +309,49 @@ TEST_F(TextPaintTimingDetectorTest, LastTextPaint_OneText) { SetBodyInnerHTML(R"HTML( - <div>The only text</div> + <body></body> )HTML"); + Element* text = AppendDivElementToBody("The only text"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - TextRecord* record = GetPaintTimingDetector() - .GetTextPaintTimingDetector() - .FindLastPaintCandidate(); - EXPECT_EQ(record->text, "The only text"); + EXPECT_EQ(TextRecordOfLargestTextPaint()->node_id, NodeIdOfText(text)); } TEST_F(TextPaintTimingDetectorTest, LastTextPaint_LastText) { SetBodyInnerHTML(R"HTML( <div>1st text</div> )HTML"); + AppendDivElementToBody("s"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - Text* larger_text = GetDocument().createTextNode("2nd text"); - GetDocument().body()->AppendChild(larger_text); + AppendDivElementToBody("loooooooong"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - Text* tiny_text = GetDocument().createTextNode("3rd text"); - GetDocument().body()->AppendChild(tiny_text); + Element* third_text = AppendDivElementToBody("medium"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - TextRecord* record = GetPaintTimingDetector() - .GetTextPaintTimingDetector() - .FindLastPaintCandidate(); - EXPECT_EQ(record->text, "3rd text"); + EXPECT_EQ(TextRecordOfLastTextPaint()->node_id, NodeIdOfText(third_text)); } TEST_F(TextPaintTimingDetectorTest, LastTextPaint_ReportFirstPaintTime) { SetBodyInnerHTML(R"HTML( - <div> - <div id='b'>size-changing block</div> - </div> + <body></body> )HTML"); + AppendDivElementToBody("a loooooooooooooooooooong text"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); TimeTicks time1 = CurrentTimeTicks(); - Text* tiny_text = GetDocument().createTextNode("latest text"); - GetDocument().body()->AppendChild(tiny_text); + Element* latest_text = AppendFontElementToBody("latest text"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); TimeTicks time2 = CurrentTimeTicks(); - GetDocument().getElementById("b")->setAttribute(html_names::kStyleAttr, - AtomicString("height:50px")); + SetFontSize(latest_text, 50); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - GetDocument().getElementById("b")->setAttribute(html_names::kStyleAttr, - AtomicString("height:100px")); + SetFontSize(latest_text, 100); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - TextRecord* record = GetPaintTimingDetector() - .GetTextPaintTimingDetector() - .FindLastPaintCandidate(); - EXPECT_EQ(record->text, "latest text"); + TextRecord* record = TextRecordOfLastTextPaint(); + EXPECT_EQ(record->node_id, NodeIdOfText(latest_text)); TimeTicks firing_time = record->first_paint_time; EXPECT_GE(firing_time, time1); EXPECT_GE(time2, firing_time); @@ -359,83 +359,53 @@ TEST_F(TextPaintTimingDetectorTest, LastTextPaint_IgnoreRemovedText) { SetBodyInnerHTML(R"HTML( - <body> - <div>earliest text</div> - </body> + <body></body> )HTML"); + Element* first_text = AppendDivElementToBody("1st text"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - Text* tiny_text = GetDocument().createTextNode("latest text"); - GetDocument().body()->AppendChild(tiny_text); + Element* second_text = AppendDivElementToBody("2nd text"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - GetDocument().body()->RemoveChild(GetDocument().body()->lastChild()); + RemoveElement(second_text); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - TextRecord* record = GetPaintTimingDetector() - .GetTextPaintTimingDetector() - .FindLastPaintCandidate(); - EXPECT_EQ(record->text, "earliest text"); + EXPECT_EQ(TextRecordOfLastTextPaint()->node_id, NodeIdOfText(first_text)); } TEST_F(TextPaintTimingDetectorTest, LastTextPaint_StopRecordingOverNodeLimit) { SetBodyInnerHTML(R"HTML( - <body> - </body> + <body></body> )HTML"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - for (int i = 1; i <= 4999; i++) { - Element* div = GetDocument().CreateRawElement(html_names::kDivTag); - div->appendChild(GetDocument().createTextNode(WTF::String::Number(i))); - div->setAttribute(html_names::kStyleAttr, - AtomicString("position:fixed;left:0px")); - GetDocument().body()->AppendChild(div); - } + for (int i = 1; i <= 4999; i++) + AppendDivElementToBody(WTF::String::Number(i), "position:fixed;left:0px"); + UpdateAllLifecyclePhasesAndSimulateSwapTime(); - TextRecord* record; - Text* text; - - text = GetDocument().createTextNode(WTF::String::Number(5000)); - GetDocument().body()->AppendChild(text); + Element* text_5000 = AppendDivElementToBody(WTF::String::Number(5000)); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - record = GetPaintTimingDetector() - .GetTextPaintTimingDetector() - .FindLastPaintCandidate(); - EXPECT_EQ(record->text, "5000"); + EXPECT_EQ(TextRecordOfLastTextPaint()->node_id, NodeIdOfText(text_5000)); - text = GetDocument().createTextNode(WTF::String::Number(5001)); - GetDocument().body()->AppendChild(text); + AppendDivElementToBody(WTF::String::Number(5001)); UpdateAllLifecyclePhasesAndSimulateSwapTime(); - record = GetPaintTimingDetector() - .GetTextPaintTimingDetector() - .FindLastPaintCandidate(); - EXPECT_EQ(record->text, "5000"); + EXPECT_EQ(TextRecordOfLastTextPaint()->node_id, NodeIdOfText(text_5000)); } TEST_F(TextPaintTimingDetectorTest, LastTextPaint_ReportLastNullCandidate) { SetBodyInnerHTML(R"HTML( - <div id='parent'> - <div id='remove'>text</div> - </div> + <body></body> )HTML"); + Element* text = AppendDivElementToBody("text"); UpdateAllLifecyclePhasesAndSimulateSwapTime(); SimulateAnalyze(); - TextRecord* record = GetPaintTimingDetector() - .GetTextPaintTimingDetector() - .FindLargestPaintCandidate(); - EXPECT_TRUE(record); - EXPECT_EQ(record->text, "text"); + EXPECT_EQ(TextRecordOfLastTextPaint()->node_id, NodeIdOfText(text)); EXPECT_NE(LastPaintStoredResult(), base::TimeTicks()); - GetDocument().getElementById("parent")->RemoveChild( - GetDocument().getElementById("remove")); + RemoveElement(text); UpdateAllLifecyclePhasesAndSimulateSwapTime(); SimulateAnalyze(); - record = GetPaintTimingDetector() - .GetTextPaintTimingDetector() - .FindLargestPaintCandidate(); - EXPECT_FALSE(record); + EXPECT_FALSE(TextRecordOfLastTextPaint()); EXPECT_EQ(LastPaintStoredResult(), base::TimeTicks()); }
diff --git a/third_party/blink/renderer/core/style/grid_positions_resolver.cc b/third_party/blink/renderer/core/style/grid_positions_resolver.cc index 6e1d5e5e..ede7d1b 100644 --- a/third_party/blink/renderer/core/style/grid_positions_resolver.cc +++ b/third_party/blink/renderer/core/style/grid_positions_resolver.cc
@@ -59,27 +59,6 @@ : grid_container_style.GridAutoRepeatRows().size(); } -bool NamedLineCollection::IsValidNamedLineOrArea( - const String& named_line, - const ComputedStyle& grid_container_style, - GridPositionSide side) { - bool is_row_axis = DirectionFromSide(side) == kForColumns; - const NamedGridLinesMap& grid_line_names = - is_row_axis ? grid_container_style.NamedGridColumnLines() - : grid_container_style.NamedGridRowLines(); - const NamedGridLinesMap& auto_repeat_grid_line_names = - is_row_axis ? grid_container_style.AutoRepeatNamedGridColumnLines() - : grid_container_style.AutoRepeatNamedGridRowLines(); - - if (grid_line_names.Contains(named_line) || - auto_repeat_grid_line_names.Contains(named_line)) - return true; - - String implicit_name = ImplicitNamedGridLineForSide(named_line, side); - return grid_line_names.Contains(implicit_name) || - auto_repeat_grid_line_names.Contains(implicit_name); -} - bool NamedLineCollection::HasNamedLines() { return named_lines_indexes_ || auto_repeat_named_lines_indexes_; } @@ -178,22 +157,6 @@ if (initial_position.IsSpan() && final_position.IsSpan()) final_position.SetAutoPosition(); - if (grid_item.IsOutOfFlowPositioned()) { - // Early detect the case of non existing named grid lines for positioned - // items. - if (initial_position.IsNamedGridArea() && - !NamedLineCollection::IsValidNamedLineOrArea( - initial_position.NamedGridLine(), grid_container_style, - GridPositionsResolver::InitialPositionSide(direction))) - initial_position.SetAutoPosition(); - - if (final_position.IsNamedGridArea() && - !NamedLineCollection::IsValidNamedLineOrArea( - final_position.NamedGridLine(), grid_container_style, - GridPositionsResolver::FinalPositionSide(direction))) - final_position.SetAutoPosition(); - } - // If the grid item has an automatic position and a grid span for a named line // in a given dimension, instead treat the grid span as one. if (initial_position.IsAuto() && final_position.IsSpan() && @@ -457,8 +420,6 @@ if (explicit_lines.HasNamedLines()) return explicit_lines.FirstPosition(); - DCHECK(!NamedLineCollection::IsValidNamedLineOrArea( - named_grid_line, grid_container_style, side)); // If none of the above works specs mandate to assume that all the lines // in the implicit grid have this name. return last_line + 1;
diff --git a/third_party/blink/renderer/core/style/grid_positions_resolver.h b/third_party/blink/renderer/core/style/grid_positions_resolver.h index a747569..1c88015 100644 --- a/third_party/blink/renderer/core/style/grid_positions_resolver.h +++ b/third_party/blink/renderer/core/style/grid_positions_resolver.h
@@ -32,10 +32,6 @@ size_t last_line, size_t auto_repeat_tracks_count); - static bool IsValidNamedLineOrArea(const String& named_line, - const ComputedStyle&, - GridPositionSide); - bool HasNamedLines(); size_t FirstPosition();
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_script_url.cc b/third_party/blink/renderer/core/trustedtypes/trusted_script_url.cc index dd91ac5..a1d527d 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_script_url.cc +++ b/third_party/blink/renderer/core/trustedtypes/trusted_script_url.cc
@@ -4,12 +4,14 @@ #include "third_party/blink/renderer/core/trustedtypes/trusted_script_url.h" +#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" + namespace blink { -TrustedScriptURL::TrustedScriptURL(const String& url) : url_(url) {} +TrustedScriptURL::TrustedScriptURL(const KURL& url) : url_(url) {} String TrustedScriptURL::toString() const { - return url_; + return url_.GetString(); } } // namespace blink
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_script_url.h b/third_party/blink/renderer/core/trustedtypes/trusted_script_url.h index 1dba541..0ea47303 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_script_url.h +++ b/third_party/blink/renderer/core/trustedtypes/trusted_script_url.h
@@ -7,7 +7,13 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" +#include "third_party/blink/renderer/platform/weborigin/kurl.h" + +namespace WTF { + +class String; + +} // namespace WTF namespace blink { @@ -15,17 +21,17 @@ DEFINE_WRAPPERTYPEINFO(); public: - static TrustedScriptURL* Create(const String& url) { + static TrustedScriptURL* Create(const KURL& url) { return MakeGarbageCollected<TrustedScriptURL>(url); } - TrustedScriptURL(const String& url); + TrustedScriptURL(const KURL&); // TrustedScriptURL.idl String toString() const; private: - const String url_; + KURL url_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_type_policy.cc b/third_party/blink/renderer/core/trustedtypes/trusted_type_policy.cc index c439848..468f1ec 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_type_policy.cc +++ b/third_party/blink/renderer/core/trustedtypes/trusted_type_policy.cc
@@ -113,7 +113,7 @@ exception_state.RethrowV8Exception(try_catch.Exception()); return nullptr; } - return TrustedScriptURL::Create(script_url); + return TrustedScriptURL::Create(KURL(script_url)); } TrustedURL* TrustedTypePolicy::CreateURL(v8::Isolate* isolate, @@ -132,7 +132,7 @@ exception_state.RethrowV8Exception(try_catch.Exception()); return nullptr; } - return TrustedURL::Create(url); + return TrustedURL::Create(KURL(url)); } String TrustedTypePolicy::name() const {
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_types_util.cc b/third_party/blink/renderer/core/trustedtypes/trusted_types_util.cc index ccec93a4..66f0e61 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_types_util.cc +++ b/third_party/blink/renderer/core/trustedtypes/trusted_types_util.cc
@@ -70,6 +70,60 @@ return g_empty_string; } +String GetStringFromSpecificTrustedType( + const StringOrTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrTrustedURL& + string_or_trusted_type, + SpecificTrustedType specific_trusted_type, + const Document* doc, + ExceptionState& exception_state) { + switch (specific_trusted_type) { + case SpecificTrustedType::kTrustedHTML: { + StringOrTrustedHTML string_or_trusted_html = + string_or_trusted_type.IsTrustedHTML() + ? StringOrTrustedHTML::FromTrustedHTML( + string_or_trusted_type.GetAsTrustedHTML()) + : StringOrTrustedHTML::FromString( + GetStringFromTrustedTypeWithoutCheck( + string_or_trusted_type)); + return GetStringFromTrustedHTML(string_or_trusted_html, doc, + exception_state); + } + case SpecificTrustedType::kTrustedScript: { + StringOrTrustedScript string_or_trusted_script = + string_or_trusted_type.IsTrustedScript() + ? StringOrTrustedScript::FromTrustedScript( + string_or_trusted_type.GetAsTrustedScript()) + : StringOrTrustedScript::FromString( + GetStringFromTrustedTypeWithoutCheck( + string_or_trusted_type)); + return GetStringFromTrustedScript(string_or_trusted_script, doc, + exception_state); + } + case SpecificTrustedType::kTrustedScriptURL: { + StringOrTrustedScriptURL string_or_trusted_script_url = + string_or_trusted_type.IsTrustedScriptURL() + ? StringOrTrustedScriptURL::FromTrustedScriptURL( + string_or_trusted_type.GetAsTrustedScriptURL()) + : StringOrTrustedScriptURL::FromString( + GetStringFromTrustedTypeWithoutCheck( + string_or_trusted_type)); + return GetStringFromTrustedScriptURL(string_or_trusted_script_url, doc, + exception_state); + } + case SpecificTrustedType::kTrustedURL: { + USVStringOrTrustedURL string_or_trusted_url = + string_or_trusted_type.IsTrustedURL() + ? USVStringOrTrustedURL::FromTrustedURL( + string_or_trusted_type.GetAsTrustedURL()) + : USVStringOrTrustedURL::FromUSVString( + GetStringFromTrustedTypeWithoutCheck( + string_or_trusted_type)); + return GetStringFromTrustedURL(string_or_trusted_url, doc, + exception_state); + } + } +} + String GetStringFromTrustedHTML(StringOrTrustedHTML string_or_trusted_html, const Document* doc, ExceptionState& exception_state) {
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_types_util.h b/third_party/blink/renderer/core/trustedtypes/trusted_types_util.h index c86ca17..5adb8cc 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_types_util.h +++ b/third_party/blink/renderer/core/trustedtypes/trusted_types_util.h
@@ -18,6 +18,13 @@ class StringOrTrustedScriptURL; class USVStringOrTrustedURL; +enum class SpecificTrustedType { + kTrustedHTML, + kTrustedScript, + kTrustedScriptURL, + kTrustedURL, +}; + String CORE_EXPORT GetStringFromTrustedType( const StringOrTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrTrustedURL&, const Document*, @@ -26,6 +33,12 @@ String CORE_EXPORT GetStringFromTrustedTypeWithoutCheck( const StringOrTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrTrustedURL&); +String CORE_EXPORT GetStringFromSpecificTrustedType( + const StringOrTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrTrustedURL&, + SpecificTrustedType, + const Document*, + ExceptionState&); + String CORE_EXPORT GetStringFromTrustedHTML(StringOrTrustedHTML, const Document*, ExceptionState&);
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_types_util_test.cc b/third_party/blink/renderer/core/trustedtypes/trusted_types_util_test.cc index aa97005..f17780d 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_types_util_test.cc +++ b/third_party/blink/renderer/core/trustedtypes/trusted_types_util_test.cc
@@ -189,7 +189,7 @@ } TEST(TrustedTypesUtilTest, GetStringFromTrustedType_TrustedScriptURL) { - String url_address = "http://www.example.com/"; + KURL url_address("http://www.example.com/"); TrustedScriptURL* script_url = TrustedScriptURL::Create(url_address); StringOrTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrTrustedURL trusted_value = @@ -198,18 +198,8 @@ GetStringFromTrustedTypeWorks(trusted_value, "http://www.example.com/"); } -TEST(TrustedTypesUtilTest, GetStringFromTrustedType_TrustedScriptURL_Relative) { - String url_address = "relative/url.html"; - TrustedScriptURL* script_url = TrustedScriptURL::Create(url_address); - StringOrTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrTrustedURL - trusted_value = - StringOrTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrTrustedURL:: - FromTrustedScriptURL(script_url); - GetStringFromTrustedTypeWorks(trusted_value, "relative/url.html"); -} - TEST(TrustedTypesUtilTest, GetStringFromTrustedType_TrustedURL) { - String url_address = "http://www.example.com/"; + KURL url_address("http://www.example.com/"); TrustedURL* url = TrustedURL::Create(url_address); StringOrTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrTrustedURL trusted_value = @@ -218,16 +208,6 @@ GetStringFromTrustedTypeWorks(trusted_value, "http://www.example.com/"); } -TEST(TrustedTypesUtilTest, GetStringFromTrustedType_TrustedURL_Relative) { - String url_address = "relative/url.html"; - TrustedURL* url = TrustedURL::Create(url_address); - StringOrTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrTrustedURL - trusted_value = - StringOrTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrTrustedURL:: - FromTrustedURL(url); - GetStringFromTrustedTypeWorks(trusted_value, "relative/url.html"); -} - TEST(TrustedTypesUtilTest, GetStringFromTrustedType_String) { StringOrTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrTrustedURL string_value = @@ -259,7 +239,7 @@ TEST(TrustedTypesUtilTest, GetStringFromTrustedTypeWithoutCheck_TrustedScriptURL) { - String url_address = "http://www.example.com/"; + KURL url_address("http://www.example.com/"); TrustedScriptURL* script_url = TrustedScriptURL::Create(url_address); StringOrTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrTrustedURL trusted_value = @@ -270,7 +250,7 @@ } TEST(TrustedTypesUtilTest, GetStringFromTrustedTypeWithoutCheck_TrustedURL) { - String url_address = "http://www.example.com/"; + KURL url_address("http://www.example.com/"); TrustedURL* url = TrustedURL::Create(url_address); StringOrTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrTrustedURL trusted_value = @@ -326,7 +306,7 @@ // GetStringFromTrustedScriptURL tests TEST(TrustedTypesUtilTest, GetStringFromTrustedScriptURL_TrustedScriptURL) { - String url_address = "http://www.example.com/"; + KURL url_address("http://www.example.com/"); TrustedScriptURL* script_url = TrustedScriptURL::Create(url_address); StringOrTrustedScriptURL trusted_value = StringOrTrustedScriptURL::FromTrustedScriptURL(script_url); @@ -341,7 +321,7 @@ // GetStringFromTrustedURL tests TEST(TrustedTypesUtilTest, GetStringFromTrustedURL_TrustedURL) { - String url_address = "http://www.example.com/"; + KURL url_address("http://www.example.com/"); TrustedURL* url = TrustedURL::Create(url_address); USVStringOrTrustedURL trusted_value = USVStringOrTrustedURL::FromTrustedURL(url);
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_url.cc b/third_party/blink/renderer/core/trustedtypes/trusted_url.cc index b8b46e3..0093775b 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_url.cc +++ b/third_party/blink/renderer/core/trustedtypes/trusted_url.cc
@@ -4,12 +4,14 @@ #include "third_party/blink/renderer/core/trustedtypes/trusted_url.h" +#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" + namespace blink { -TrustedURL::TrustedURL(const String& url) : url_(url) {} +TrustedURL::TrustedURL(const KURL& url) : url_(url) {} String TrustedURL::toString() const { - return url_; + return url_.GetString(); } } // namespace blink
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_url.h b/third_party/blink/renderer/core/trustedtypes/trusted_url.h index d2f8ee2..df18273a 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_url.h +++ b/third_party/blink/renderer/core/trustedtypes/trusted_url.h
@@ -7,7 +7,13 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" +#include "third_party/blink/renderer/platform/weborigin/kurl.h" + +namespace WTF { + +class String; + +} // namespace WTF namespace blink { @@ -15,17 +21,17 @@ DEFINE_WRAPPERTYPEINFO(); public: - static TrustedURL* Create(const String& url) { + static TrustedURL* Create(const KURL& url) { return MakeGarbageCollected<TrustedURL>(url); } - TrustedURL(const String& url); + TrustedURL(const KURL&); // TrustedURL.idl String toString() const; private: - const String url_; + KURL url_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/xml/dom_parser.idl b/third_party/blink/renderer/core/xml/dom_parser.idl index b478df5..5f9b2ab 100644 --- a/third_party/blink/renderer/core/xml/dom_parser.idl +++ b/third_party/blink/renderer/core/xml/dom_parser.idl
@@ -18,9 +18,6 @@ */ // https://w3c.github.io/DOM-Parsing/#the-domparser-interface -// The `HTMLString` reference below is from Trusted Types: -// https://github.com/WICG/trusted-types/, which is still WIP. -// https://crbug.com/739170. enum SupportedType { "text/html",
diff --git a/third_party/blink/renderer/devtools/front_end/application_test_runner/IndexedDBTestRunner.js b/third_party/blink/renderer/devtools/front_end/application_test_runner/IndexedDBTestRunner.js index 0ab404b2..9cb4080 100644 --- a/third_party/blink/renderer/devtools/front_end/application_test_runner/IndexedDBTestRunner.js +++ b/third_party/blink/renderer/devtools/front_end/application_test_runner/IndexedDBTestRunner.js
@@ -104,6 +104,10 @@ ApplicationTestRunner.evaluateWithCallback(frameId, 'createDatabase', [databaseName], callback); }; +ApplicationTestRunner.createDatabaseWithVersion = function(frameId, databaseName, version, callback) { + ApplicationTestRunner.evaluateWithCallback(frameId, 'createDatabaseWithVersion', [databaseName, version], callback); +}; + ApplicationTestRunner.deleteDatabase = function(frameId, databaseName, callback) { ApplicationTestRunner.evaluateWithCallback(frameId, 'deleteDatabase', [databaseName], callback); }; @@ -256,6 +260,17 @@ } } + function createDatabaseWithVersion(callback, databaseName, version) { + let request = indexedDB.open(databaseName, version); + request.onerror = onIndexedDBError; + request.onsuccess = closeDatabase; + + function closeDatabase() { + request.result.close(); + callback(); + } + } + function deleteDatabase(callback, databaseName) { let request = indexedDB.deleteDatabase(databaseName); request.onerror = onIndexedDBError;
diff --git a/third_party/blink/renderer/modules/DEPS b/third_party/blink/renderer/modules/DEPS index 20352ca..b0697f0 100644 --- a/third_party/blink/renderer/modules/DEPS +++ b/third_party/blink/renderer/modules/DEPS
@@ -1,6 +1,7 @@ include_rules = [ "+base/atomic_sequence_num.h", "+base/memory/scoped_refptr.h", + "+base/strings/char_traits.h", "+mojo/public/cpp/bindings", "+services/network/public/cpp/shared_url_loader_factory.h", "+services/service_manager/public/mojom/interface_provider.mojom-blink.h",
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc index 6892f4dc..70a3096 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc
@@ -932,8 +932,10 @@ CanvasRenderingContext2DSettings* settings = CanvasRenderingContext2DSettings::Create(); settings->setAlpha(CreationAttributes().alpha); - settings->setColorSpace(ColorSpaceAsString()); - settings->setPixelFormat(PixelFormatAsString()); + if (RuntimeEnabledFeatures::CanvasColorManagementEnabled()) { + settings->setColorSpace(ColorSpaceAsString()); + settings->setPixelFormat(PixelFormatAsString()); + } return settings; }
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.idl b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.idl index fee85211..b8f1ecd 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.idl +++ b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.idl
@@ -138,8 +138,7 @@ // Should be merged with WebGL counterpart in CanvasRenderingContext, once no-longer experimental [RuntimeEnabled=Canvas2dContextLostRestored] boolean isContextLost(); - // TODO: This will have to be standardized for feature detection as part of the Canvas ColorSpace proposal. - [RuntimeEnabled=CanvasColorManagement, MeasureAs=GetCanvas2DContextAttributes] CanvasRenderingContext2DSettings getContextAttributes(); + [MeasureAs=GetCanvas2DContextAttributes] CanvasRenderingContext2DSettings getContextAttributes(); // FIXME: factor out to CanvasDrawingStyles // line caps/joins
diff --git a/third_party/blink/renderer/modules/credentialmanager/credential_creation_options.idl b/third_party/blink/renderer/modules/credentialmanager/credential_creation_options.idl index 9b6eb3c2..ec630b6 100644 --- a/third_party/blink/renderer/modules/credentialmanager/credential_creation_options.idl +++ b/third_party/blink/renderer/modules/credentialmanager/credential_creation_options.idl
@@ -9,7 +9,7 @@ typedef (PasswordCredentialData or HTMLFormElement) PasswordCredentialInit; dictionary CredentialCreationOptions { - PasswordCredentialInit? password; - FederatedCredentialInit? federated; - PublicKeyCredentialCreationOptions? publicKey; + PasswordCredentialInit password; + FederatedCredentialInit federated; + PublicKeyCredentialCreationOptions publicKey; };
diff --git a/third_party/blink/renderer/modules/credentialmanager/credential_request_options.idl b/third_party/blink/renderer/modules/credentialmanager/credential_request_options.idl index 8e47265..d413c468 100644 --- a/third_party/blink/renderer/modules/credentialmanager/credential_request_options.idl +++ b/third_party/blink/renderer/modules/credentialmanager/credential_request_options.idl
@@ -11,10 +11,10 @@ }; dictionary CredentialRequestOptions { - FederatedCredentialRequestOptions? federated; + FederatedCredentialRequestOptions federated; boolean password = false; CredentialMediationRequirement mediation = "optional"; - PublicKeyCredentialRequestOptions? publicKey; + PublicKeyCredentialRequestOptions publicKey; };
diff --git a/third_party/blink/renderer/modules/crypto/normalize_algorithm.cc b/third_party/blink/renderer/modules/crypto/normalize_algorithm.cc index 69d7a5d..89e2647 100644 --- a/third_party/blink/renderer/modules/crypto/normalize_algorithm.cc +++ b/third_party/blink/renderer/modules/crypto/normalize_algorithm.cc
@@ -34,6 +34,7 @@ #include <memory> #include "base/stl_util.h" +#include "base/strings/char_traits.h" #include "third_party/blink/public/platform/web_crypto_algorithm_params.h" #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/renderer/bindings/core/v8/array_buffer_or_array_buffer_view.h" @@ -230,16 +231,18 @@ return String(); StringBuilder result; - constexpr const char* separator = ": "; + constexpr const char* const separator = ": "; + constexpr wtf_size_t separator_length = + base::CharTraits<char>::length(separator); - wtf_size_t length = (messages_.size() - 1) * strlen(separator); + wtf_size_t length = (messages_.size() - 1) * separator_length; for (wtf_size_t i = 0; i < messages_.size(); ++i) length += strlen(messages_[i]); result.ReserveCapacity(length); for (wtf_size_t i = 0; i < messages_.size(); ++i) { if (i) - result.Append(separator, strlen(separator)); + result.Append(separator, separator_length); result.Append(messages_[i], static_cast<wtf_size_t>(strlen(messages_[i]))); }
diff --git a/third_party/blink/renderer/modules/indexeddb/inspector_indexed_db_agent.cc b/third_party/blink/renderer/modules/indexeddb/inspector_indexed_db_agent.cc index 327b043..426c2f7 100644 --- a/third_party/blink/renderer/modules/indexeddb/inspector_indexed_db_agent.cc +++ b/third_party/blink/renderer/modules/indexeddb/inspector_indexed_db_agent.cc
@@ -442,7 +442,8 @@ std::unique_ptr<DatabaseWithObjectStores> result = DatabaseWithObjectStores::create() .setName(idb_database->name()) - .setVersion(static_cast<int>(idb_database->version())) + .setVersion( + static_cast<unsigned long long>(idb_database->version())) .setObjectStores(std::move(object_stores)) .build();
diff --git a/third_party/blink/renderer/modules/modules_idl_files.gni b/third_party/blink/renderer/modules/modules_idl_files.gni index e555403e5..7d632ed 100644 --- a/third_party/blink/renderer/modules/modules_idl_files.gni +++ b/third_party/blink/renderer/modules/modules_idl_files.gni
@@ -654,6 +654,7 @@ "peerconnection/rtc_rtp_parameters.idl", "peerconnection/rtc_rtp_receive_parameters.idl", "peerconnection/rtc_rtp_send_parameters.idl", + "peerconnection/rtc_rtp_synchronization_source.idl", "peerconnection/rtc_rtp_transceiver_init.idl", "peerconnection/rtc_session_description_init.idl", "peerconnection/rtc_track_event_init.idl",
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.cc b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.cc index 3afcac72..41e2527 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.cc
@@ -46,6 +46,24 @@ return nullptr; } +HeapVector<Member<RTCRtpSynchronizationSource>> +RTCRtpReceiver::getSynchronizationSources() { + UpdateSourcesIfNeeded(); + HeapVector<Member<RTCRtpSynchronizationSource>> synchronization_sources; + for (const auto& web_source : web_sources_) { + // TODO(https://crbug.com/893172): Rename WebRTCRtpContributingSource to + // reflect that it is used for both SSRCs and CSRCs, e.g. "WebRTCRtpSource". + if (web_source->SourceType() != WebRTCRtpContributingSourceType::SSRC) + continue; + RTCRtpSynchronizationSource* synchronization_source = + MakeGarbageCollected<RTCRtpSynchronizationSource>(); + synchronization_source->setTimestamp(web_source->TimestampMs()); + synchronization_source->setSource(web_source->Source()); + synchronization_sources.push_back(synchronization_source); + } + return synchronization_sources; +} + HeapVector<Member<RTCRtpContributingSource>> RTCRtpReceiver::getContributingSources() { UpdateSourcesIfNeeded();
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.h b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.h index 922196c..8dc7b22 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.h +++ b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.h
@@ -15,6 +15,7 @@ #include "third_party/blink/renderer/modules/mediastream/media_stream_track.h" #include "third_party/blink/renderer/modules/peerconnection/rtc_rtp_contributing_source.h" #include "third_party/blink/renderer/modules/peerconnection/rtc_rtp_receive_parameters.h" +#include "third_party/blink/renderer/modules/peerconnection/rtc_rtp_synchronization_source.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h" #include "third_party/blink/renderer/platform/heap/member.h" @@ -43,6 +44,7 @@ RTCDtlsTransport* transport(); RTCDtlsTransport* rtcp_transport(); RTCRtpReceiveParameters* getParameters(); + HeapVector<Member<RTCRtpSynchronizationSource>> getSynchronizationSources(); HeapVector<Member<RTCRtpContributingSource>> getContributingSources(); ScriptPromise getStats(ScriptState*); @@ -62,9 +64,8 @@ Member<MediaStreamTrack> track_; MediaStreamVector streams_; - // The current SSRCs and CSRCs. getContributingSources() returns the CSRCs. - // TODO(https://crbug.com/893158): Add getSynchronizationSources() and return - // the SSRCs. + // The current SSRCs and CSRCs. getSynchronizationSources() returns the SSRCs + // and getContributingSources() returns the CSRCs. WebVector<std::unique_ptr<WebRTCRtpContributingSource>> web_sources_; bool web_sources_needs_updating_ = true; Member<RTCRtpTransceiver> transceiver_;
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.idl b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.idl index 0c4599f..49b2455 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.idl +++ b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.idl
@@ -10,7 +10,7 @@ [RuntimeEnabled=RTCDtlsTransport] readonly attribute RTCDtlsTransport? rtcp_transport; static RTCRtpCapabilities? getCapabilities(DOMString kind); RTCRtpReceiveParameters getParameters(); + sequence<RTCRtpSynchronizationSource> getSynchronizationSources(); sequence<RTCRtpContributingSource> getContributingSources(); [CallWith=ScriptState] Promise<RTCStatsReport> getStats(); - // TODO(hbos): Support every member of the spec. https://crbug.com/700916 };
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_synchronization_source.idl b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_synchronization_source.idl new file mode 100644 index 0000000..8ba4c43 --- /dev/null +++ b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_synchronization_source.idl
@@ -0,0 +1,8 @@ +// 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. + +// https://w3c.github.io/webrtc-pc/#dom-rtcrtpsynchronizationsource +dictionary RTCRtpSynchronizationSource : RTCRtpContributingSource { + // TODO(hbos): Implement voiceActivityFlag. https://crbug.com/893159 +};
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.cc b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.cc index dab3636..679002e 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.cc
@@ -93,21 +93,6 @@ namespace { -blink::mojom::NotificationDirection ToMojomNotificationDirection( - blink::WebNotificationData::Direction input) { - switch (input) { - case blink::WebNotificationData::kDirectionLeftToRight: - return blink::mojom::NotificationDirection::LEFT_TO_RIGHT; - case blink::WebNotificationData::kDirectionRightToLeft: - return blink::mojom::NotificationDirection::RIGHT_TO_LEFT; - case blink::WebNotificationData::kDirectionAuto: - return blink::mojom::NotificationDirection::AUTO; - } - - NOTREACHED(); - return blink::mojom::NotificationDirection::AUTO; -} - blink::mojom::NotificationActionType ToMojomNotificationActionType( blink::WebNotificationAction::Type input) { switch (input) { @@ -158,11 +143,10 @@ } return blink::mojom::blink::NotificationData::New( - input.title, ToMojomNotificationDirection(input.direction), input.lang, - input.body, input.tag, input.image, input.icon, input.badge, - std::move(vibration_pattern), input.timestamp, input.renotify, - input.silent, input.require_interaction, std::move(data), - std::move(actions)); + input.title, input.direction, input.lang, input.body, input.tag, + input.image, input.icon, input.badge, std::move(vibration_pattern), + input.timestamp, input.renotify, input.silent, + input.require_interaction, std::move(data), std::move(actions)); } };
diff --git a/third_party/blink/renderer/platform/exported/web_runtime_features.cc b/third_party/blink/renderer/platform/exported/web_runtime_features.cc index 0e7d1bb7..e372327 100644 --- a/third_party/blink/renderer/platform/exported/web_runtime_features.cc +++ b/third_party/blink/renderer/platform/exported/web_runtime_features.cc
@@ -152,6 +152,10 @@ RuntimeEnabledFeatures::SetScrollTopLeftInteropEnabled(enable); } +void WebRuntimeFeatures::EnableKeyboardFocusableScrollers(bool enable) { + RuntimeEnabledFeatures::SetKeyboardFocusableScrollersEnabled(enable); +} + void WebRuntimeFeatures::EnableDatabase(bool enable) { RuntimeEnabledFeatures::SetDatabaseEnabled(enable); }
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index b735eb6..571725c 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -461,10 +461,6 @@ status: "experimental" }, { - name: "ExperimentalV8Extras", - status: "experimental", - }, - { name: "ExtendedTextMetrics", status: "experimental", }, @@ -763,6 +759,9 @@ name: "MediaEngagementBypassAutoplayPolicies", }, { + name: "MediaQueryPrefersColorScheme", + }, + { name: "MediaQueryShape", status: "experimental", },
diff --git a/third_party/blink/renderer/platform/weborigin/kurl.cc b/third_party/blink/renderer/platform/weborigin/kurl.cc index 268bfbd0..40dfe35 100644 --- a/third_party/blink/renderer/platform/weborigin/kurl.cc +++ b/third_party/blink/renderer/platform/weborigin/kurl.cc
@@ -874,5 +874,28 @@ StringUTF8Adaptor utf8(string_); return GURL(utf8.Data(), utf8.length(), parsed_, is_valid_); } +bool operator==(const KURL& a, const KURL& b) { + return a.GetString() == b.GetString(); +} + +bool operator==(const KURL& a, const String& b) { + return a.GetString() == b; +} + +bool operator==(const String& a, const KURL& b) { + return a == b.GetString(); +} + +bool operator!=(const KURL& a, const KURL& b) { + return a.GetString() != b.GetString(); +} + +bool operator!=(const KURL& a, const String& b) { + return a.GetString() != b; +} + +bool operator!=(const String& a, const KURL& b) { + return a != b.GetString(); +} } // namespace blink
diff --git a/third_party/blink/renderer/platform/weborigin/kurl.h b/third_party/blink/renderer/platform/weborigin/kurl.h index 617c3944..eb4fa3d7 100644 --- a/third_party/blink/renderer/platform/weborigin/kurl.h +++ b/third_party/blink/renderer/platform/weborigin/kurl.h
@@ -309,32 +309,6 @@ PLATFORM_EXPORT String EncodeWithURLEscapeSequences(const String&); -// Inlines. - -inline bool operator==(const KURL& a, const KURL& b) { - return a.GetString() == b.GetString(); -} - -inline bool operator==(const KURL& a, const String& b) { - return a.GetString() == b; -} - -inline bool operator==(const String& a, const KURL& b) { - return a == b.GetString(); -} - -inline bool operator!=(const KURL& a, const KURL& b) { - return a.GetString() != b.GetString(); -} - -inline bool operator!=(const KURL& a, const String& b) { - return a.GetString() != b; -} - -inline bool operator!=(const String& a, const KURL& b) { - return a != b.GetString(); -} - } // namespace blink namespace WTF {
diff --git a/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py b/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py index de97e4c7..0715149b 100755 --- a/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py +++ b/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py
@@ -108,6 +108,9 @@ 'base::IsTypeInRangeForNumericType', 'base::IsValueNegative', + # //base/strings/char_traits.h. + 'base::CharTraits', + # //base/synchronization/waitable_event.h. 'base::WaitableEvent',
diff --git a/third_party/blink/web_tests/SlowTests b/third_party/blink/web_tests/SlowTests index 7332f28c..24a5fcc 100644 --- a/third_party/blink/web_tests/SlowTests +++ b/third_party/blink/web_tests/SlowTests
@@ -1580,3 +1580,4 @@ crbug.com/914981 [ Mac ] virtual/mouseevent_fractional/fast/events/no-fake-mousemove.html [ Slow ] crbug.com/914981 [ Mac ] virtual/new-remote-playback-pipeline/media/controls/overflow-menu-pointer-selection.html [ Slow ] crbug.com/914981 [ Mac ] virtual/video-surface-layer/media/controls/overflow-menu-pointer-selection.html [ Slow ] +crbug.com/914981 [ Mac ] fast/events/no-fake-mousemove.html [ Slow ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index dd76551..f0fb8fe 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -4333,6 +4333,8 @@ crbug.com/912362 external/wpt/web-animations/timing-model/timelines/timelines.html [ Failure ] +crbug.com/912574 virtual/threaded/animations/responsive/transform-responsive-neutral-keyframe.html [ Crash ] + # Decoding test timeout on Win7. Marked flaky to get imported in case it's flaky timeout everywhere. crbug.com/862938 external/wpt/encoding/textdecoder-fatal-single-byte.any.worker.html [ Pass Timeout ]
diff --git a/third_party/blink/web_tests/animations/animationworklet/animate-multiple-effects-via-main-thread-expected.txt b/third_party/blink/web_tests/animations/animationworklet/animate-multiple-effects-via-main-thread-expected.txt deleted file mode 100644 index d71baf98e..0000000 --- a/third_party/blink/web_tests/animations/animationworklet/animate-multiple-effects-via-main-thread-expected.txt +++ /dev/null
@@ -1,5 +0,0 @@ -CONSOLE MESSAGE: line 79: background-color for the first target is: rgb(0, 128, 128) -CONSOLE MESSAGE: line 81: width for the first target is: 150px -CONSOLE MESSAGE: line 83: box-shadow for the second target is: rgb(0, 128, 128) 4px 4px 25px 0px -CONSOLE MESSAGE: line 85: opacity for the second target is: 0.5 -
diff --git a/third_party/blink/web_tests/animations/animationworklet/worklet-animation-with-invalid-effect.html b/third_party/blink/web_tests/animations/animationworklet/worklet-animation-with-invalid-effect.html deleted file mode 100644 index 87a2e6e..0000000 --- a/third_party/blink/web_tests/animations/animationworklet/worklet-animation-with-invalid-effect.html +++ /dev/null
@@ -1,28 +0,0 @@ -<!DOCTYPE html> -<style> -#target { - width: 100px; - height: 100px; -} -</style> - -<div id="target"></div> -<script src='../../resources/testharness.js'></script> -<script src='../../resources/testharnessreport.js'></script> - -<script> -test(function() { - let playFunc = function() { - let effect = new KeyframeEffect( - document.getElementById('target'), - [ - // No keyframe. - ], - { duration: 1000 } - ); - let animation = new WorkletAnimation('test', effect); - animation.play(); - } - assert_throws('InvalidStateError', playFunc); -}, 'Trying to play invalid worklet animation should throw an exception.'); -</script>
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-commit-expected.html b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-commit-expected.html index ad35377d..9801e1a 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-commit-expected.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-commit-expected.html
@@ -2,7 +2,7 @@ <style> #container { - contain: content; + contain: style layout; width: 150px; height: 150px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-commit.html b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-commit.html index 74ed187..b379dfc 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-commit.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-commit.html
@@ -6,7 +6,7 @@ <style> #container { - contain: content; + contain: style layout; width: 150px; height: 150px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-infinite-timeout-no-commit.html b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-infinite-timeout-no-commit.html index 87ec706..ea416661 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-infinite-timeout-no-commit.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-infinite-timeout-no-commit.html
@@ -7,7 +7,7 @@ <style> #container { - contain: content; + contain: style layout; width: 100px; height: 100px; }
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-timeout-expected.html b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-timeout-expected.html index 09d5a52d4..8f9950ebe 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-timeout-expected.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-timeout-expected.html
@@ -2,7 +2,7 @@ <style> #container { - contain: content; + contain: style layout; width: 100px; height: 100px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-timeout.html b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-timeout.html index 69ef34e..57cdc4e8 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-timeout.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-timeout.html
@@ -6,7 +6,7 @@ <style> #container { - contain: content; + contain: style layout; width: 100px; height: 100px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-commit-expected.html b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-commit-expected.html index ad35377d..9801e1a 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-commit-expected.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-commit-expected.html
@@ -2,7 +2,7 @@ <style> #container { - contain: content; + contain: style layout; width: 150px; height: 150px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-commit.html b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-commit.html index ae762308..412d5aa 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-commit.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-commit.html
@@ -6,7 +6,7 @@ <style> #container { - contain: content; + contain: style layout; width: 150px; height: 150px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-measure-remove.html b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-measure-remove.html index 94fb15d..a0fe8c4 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-measure-remove.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-measure-remove.html
@@ -7,7 +7,7 @@ <style> #container { - contain: content; + contain: style layout; width: 100px; height: 100px; background: lightgreen; @@ -19,7 +19,7 @@ } #empty { background: red; - width: max-content; + width: max-style layout; } #spacer { width: 150px;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-remove-commit-expected.html b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-remove-commit-expected.html index a2fa191..590a7e63 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-remove-commit-expected.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-remove-commit-expected.html
@@ -2,7 +2,7 @@ <style> #container { - contain: content; + contain: style layout; width: 100px; height: 100px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-remove-commit.html b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-remove-commit.html index a7b5f4b..0b5714f 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-remove-commit.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-remove-commit.html
@@ -7,7 +7,7 @@ <style> #container { - contain: content; + contain: style layout; width: 100px; height: 100px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-remove.html b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-remove.html index d7043a1..59a4ef3 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-remove.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/acquire-update-remove.html
@@ -6,7 +6,7 @@ <style> #container { - contain: content; + contain: style layout; width: 100px; height: 100px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/commit-on-added-containment-expected.html b/third_party/blink/web_tests/display-lock/lock-before-append/commit-on-added-containment-expected.html index b8eb2329..9c57f19 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/commit-on-added-containment-expected.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/commit-on-added-containment-expected.html
@@ -2,7 +2,7 @@ <style> .contained { - contain: content; + contain: style layout; width: 100px; height: 100px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/commit-on-added-containment.html b/third_party/blink/web_tests/display-lock/lock-before-append/commit-on-added-containment.html index 12e0c92..911b75c 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/commit-on-added-containment.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/commit-on-added-containment.html
@@ -7,7 +7,7 @@ <style> .contained { - contain: content; + contain: style layout; width: 100px; height: 100px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/commit-on-inline-fails.html b/third_party/blink/web_tests/display-lock/lock-before-append/commit-on-inline-fails.html index 54a7009..495fb5b7 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/commit-on-inline-fails.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/commit-on-inline-fails.html
@@ -7,7 +7,7 @@ <style> #container { - contain: content; + contain: style layout; } </style>
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/commit-while-disconnected-expected.html b/third_party/blink/web_tests/display-lock/lock-before-append/commit-while-disconnected-expected.html index a2fa191..590a7e63 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/commit-while-disconnected-expected.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/commit-while-disconnected-expected.html
@@ -2,7 +2,7 @@ <style> #container { - contain: content; + contain: style layout; width: 100px; height: 100px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/commit-while-disconnected.html b/third_party/blink/web_tests/display-lock/lock-before-append/commit-while-disconnected.html index 962f85de..c484b86 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/commit-while-disconnected.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/commit-while-disconnected.html
@@ -6,7 +6,7 @@ <style> #container { - contain: content; + contain: style layout; width: 100px; height: 100px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/commit-without-acquire-fails-expected.html b/third_party/blink/web_tests/display-lock/lock-before-append/commit-without-acquire-fails-expected.html index e9730df..cab4e96f 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/commit-without-acquire-fails-expected.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/commit-without-acquire-fails-expected.html
@@ -2,7 +2,7 @@ <style> #container { - contain: content; + contain: style layout; width: 150px; height: 150px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/commit-without-acquire-fails.html b/third_party/blink/web_tests/display-lock/lock-before-append/commit-without-acquire-fails.html index f1e3177a..2d7e773 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/commit-without-acquire-fails.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/commit-without-acquire-fails.html
@@ -6,7 +6,7 @@ <style> #container { - contain: content; + contain: style layout; width: 150px; height: 150px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/measure-forced-layout.html b/third_party/blink/web_tests/display-lock/lock-before-append/measure-forced-layout.html index ce86774..056c26bdd 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/measure-forced-layout.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/measure-forced-layout.html
@@ -8,7 +8,7 @@ <style> #container { - contain: content; + contain: style layout; width: 100px; height: 100px; background: lightgreen;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/measure-updated-layout.html b/third_party/blink/web_tests/display-lock/lock-before-append/measure-updated-layout.html index f4c97a3a..8d3c530 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/measure-updated-layout.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/measure-updated-layout.html
@@ -8,7 +8,7 @@ <style> #container { - contain: content; + contain: style layout; width: 100px; height: 100px; background: lightgreen;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/multiple-acquires-all-succeed-expected.html b/third_party/blink/web_tests/display-lock/lock-before-append/multiple-acquires-all-succeed-expected.html index ad35377d..9801e1a 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/multiple-acquires-all-succeed-expected.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/multiple-acquires-all-succeed-expected.html
@@ -2,7 +2,7 @@ <style> #container { - contain: content; + contain: style layout; width: 150px; height: 150px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/multiple-acquires-all-succeed.html b/third_party/blink/web_tests/display-lock/lock-before-append/multiple-acquires-all-succeed.html index eb47bb6..2a0e765 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/multiple-acquires-all-succeed.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/multiple-acquires-all-succeed.html
@@ -6,7 +6,7 @@ <style> #container { - contain: content; + contain: style layout; width: 150px; height: 150px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/timeout-while-disconnected-expected.html b/third_party/blink/web_tests/display-lock/lock-before-append/timeout-while-disconnected-expected.html index 09d5a52d4..8f9950ebe 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/timeout-while-disconnected-expected.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/timeout-while-disconnected-expected.html
@@ -2,7 +2,7 @@ <style> #container { - contain: content; + contain: style layout; width: 100px; height: 100px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/timeout-while-disconnected.html b/third_party/blink/web_tests/display-lock/lock-before-append/timeout-while-disconnected.html index 6d9d2b93..8ff66bf71 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/timeout-while-disconnected.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/timeout-while-disconnected.html
@@ -6,7 +6,7 @@ <style> #container { - contain: content; + contain: style layout; width: 100px; height: 100px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/update-together-with-commit-both-succeed-expected.html b/third_party/blink/web_tests/display-lock/lock-before-append/update-together-with-commit-both-succeed-expected.html index ad35377d..9801e1a 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/update-together-with-commit-both-succeed-expected.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/update-together-with-commit-both-succeed-expected.html
@@ -2,7 +2,7 @@ <style> #container { - contain: content; + contain: style layout; width: 150px; height: 150px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/update-together-with-commit-both-succeed.html b/third_party/blink/web_tests/display-lock/lock-before-append/update-together-with-commit-both-succeed.html index 3b657b6..e0b782f 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/update-together-with-commit-both-succeed.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/update-together-with-commit-both-succeed.html
@@ -6,7 +6,7 @@ <style> #container { - contain: content; + contain: style layout; width: 150px; height: 150px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/update-without-acquire-fails-expected.html b/third_party/blink/web_tests/display-lock/lock-before-append/update-without-acquire-fails-expected.html index e9730df..cab4e96f 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/update-without-acquire-fails-expected.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/update-without-acquire-fails-expected.html
@@ -2,7 +2,7 @@ <style> #container { - contain: content; + contain: style layout; width: 150px; height: 150px; background: lightblue;
diff --git a/third_party/blink/web_tests/display-lock/lock-before-append/update-without-acquire-fails.html b/third_party/blink/web_tests/display-lock/lock-before-append/update-without-acquire-fails.html index ce6ad74..fd29024 100644 --- a/third_party/blink/web_tests/display-lock/lock-before-append/update-without-acquire-fails.html +++ b/third_party/blink/web_tests/display-lock/lock-before-append/update-without-acquire-fails.html
@@ -6,7 +6,7 @@ <style> #container { - contain: content; + contain: style layout; width: 150px; height: 150px; background: lightblue;
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_5.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_5.json index 16971c43..6df4710 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_5.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_5.json
@@ -34859,6 +34859,18 @@ {} ] ], + "css/css-backgrounds/table-cell-background-local.html": [ + [ + "/css/css-backgrounds/table-cell-background-local.html", + [ + [ + "/css/css-backgrounds/table-cell-background-local-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-backgrounds/ttwf-reftest-borderRadius.html": [ [ "/css/css-backgrounds/ttwf-reftest-borderRadius.html", @@ -125890,6 +125902,11 @@ {} ] ], + "css/css-backgrounds/table-cell-background-local-ref.html": [ + [ + {} + ] + ], "css/css-box/META.yml": [ [ {} @@ -183080,31 +183097,11 @@ {} ] ], - "signed-exchange/resources/check-cert-request.sxg": [ - [ - {} - ] - ], - "signed-exchange/resources/check-cert-request.sxg.headers": [ - [ - {} - ] - ], "signed-exchange/resources/failure.html": [ [ {} ] ], - "signed-exchange/resources/fallback-to-another-sxg.sxg": [ - [ - {} - ] - ], - "signed-exchange/resources/fallback-to-another-sxg.sxg.headers": [ - [ - {} - ] - ], "signed-exchange/resources/generate-test-certs.sh": [ [ {} @@ -183120,96 +183117,71 @@ {} ] ], - "signed-exchange/resources/nested-sxg.sxg": [ - [ - {} - ] - ], - "signed-exchange/resources/nested-sxg.sxg.headers": [ - [ - {} - ] - ], - "signed-exchange/resources/sxg-head-request.sxg": [ - [ - {} - ] - ], - "signed-exchange/resources/sxg-head-request.sxg.headers": [ - [ - {} - ] - ], - "signed-exchange/resources/sxg-inner-url-bom.sxg": [ - [ - {} - ] - ], - "signed-exchange/resources/sxg-inner-url-bom.sxg.headers": [ - [ - {} - ] - ], - "signed-exchange/resources/sxg-invalid-utf8-inner-url.sxg": [ - [ - {} - ] - ], - "signed-exchange/resources/sxg-invalid-utf8-inner-url.sxg.headers": [ - [ - {} - ] - ], - "signed-exchange/resources/sxg-invalid-validity-url.sxg": [ - [ - {} - ] - ], - "signed-exchange/resources/sxg-invalid-validity-url.sxg.headers": [ - [ - {} - ] - ], "signed-exchange/resources/sxg-location.html": [ [ {} ] ], - "signed-exchange/resources/sxg-location.sxg": [ - [ - {} - ] - ], - "signed-exchange/resources/sxg-location.sxg.headers": [ - [ - {} - ] - ], - "signed-exchange/resources/sxg-noncacheable.sxg": [ - [ - {} - ] - ], - "signed-exchange/resources/sxg-noncacheable.sxg.headers": [ - [ - {} - ] - ], - "signed-exchange/resources/sxg-utf8-inner-url.sxg": [ - [ - {} - ] - ], - "signed-exchange/resources/sxg-utf8-inner-url.sxg.headers": [ - [ - {} - ] - ], "signed-exchange/resources/sxg-util.js": [ [ {} ] ], + "signed-exchange/resources/sxg/__dir__.headers": [ + [ + {} + ] + ], + "signed-exchange/resources/sxg/check-cert-request.sxg": [ + [ + {} + ] + ], + "signed-exchange/resources/sxg/fallback-to-another-sxg.sxg": [ + [ + {} + ] + ], + "signed-exchange/resources/sxg/nested-sxg.sxg": [ + [ + {} + ] + ], + "signed-exchange/resources/sxg/sxg-head-request.sxg": [ + [ + {} + ] + ], + "signed-exchange/resources/sxg/sxg-inner-url-bom.sxg": [ + [ + {} + ] + ], + "signed-exchange/resources/sxg/sxg-invalid-utf8-inner-url.sxg": [ + [ + {} + ] + ], + "signed-exchange/resources/sxg/sxg-invalid-validity-url.sxg": [ + [ + {} + ] + ], + "signed-exchange/resources/sxg/sxg-location.sxg": [ + [ + {} + ] + ], + "signed-exchange/resources/sxg/sxg-noncacheable.sxg": [ + [ + {} + ] + ], + "signed-exchange/resources/sxg/sxg-utf8-inner-url.sxg": [ + [ + {} + ] + ], "speech-api/META.yml": [ [ {} @@ -301416,19 +301388,19 @@ "testharness" ], "WebCryptoAPI/derive_bits_keys/hkdf.https.any_1-1000-expected.txt": [ - "124cfdd344b5befcab8f65bebc3feb4f33cf6285", + "3642c6237a066760e87572815dbfb662bd0b13d3", "support" ], "WebCryptoAPI/derive_bits_keys/hkdf.https.any_1001-2000-expected.txt": [ - "57c54c40e9aeab789e320ffe5e6f0fcdf79e3226", + "c79e3f28287b319478bb545893a44aadb77100c0", "support" ], "WebCryptoAPI/derive_bits_keys/hkdf.https.any_2001-3000-expected.txt": [ - "67960a92d7b8de3921ad4d38f23b68cab791e93e", + "c20811cfad87381c4860ac7872d6e467d2b0105e", "support" ], "WebCryptoAPI/derive_bits_keys/hkdf.https.any_3001-last-expected.txt": [ - "108a73dbe1311a5ec23601488418401d62d7b956", + "588ac5f3129aad28ca8865507c56df1637b7293b", "support" ], "WebCryptoAPI/derive_bits_keys/hkdf.https.worker-expected.txt": [ @@ -301448,39 +301420,39 @@ "testharness" ], "WebCryptoAPI/derive_bits_keys/pbkdf2.https.any_1-1000-expected.txt": [ - "7263bdd1efbdf924d8db99a180608d599bbe7a0d", + "516c96526d8a39419acae4b00c26e7deffab96b1", "support" ], "WebCryptoAPI/derive_bits_keys/pbkdf2.https.any_1001-2000-expected.txt": [ - "a5fe05c23acf3d5a6d3b71fabe900b9aff86aa55", + "cf396bad76381afb661049b100b91ee979734eb1", "support" ], "WebCryptoAPI/derive_bits_keys/pbkdf2.https.any_2001-3000-expected.txt": [ - "60beff5411337396903bde946d66a5f192be73b5", + "d77cb1d9a229eb9e75832020802a8154a827ba77", "support" ], "WebCryptoAPI/derive_bits_keys/pbkdf2.https.any_3001-4000-expected.txt": [ - "e7681f53d1105cc9fafe89cbf84708523f35ae37", + "6aedba96caea819f6b4332b9bb29187ba735e24f", "support" ], "WebCryptoAPI/derive_bits_keys/pbkdf2.https.any_4001-5000-expected.txt": [ - "ef840cff408cd4d76074345216c5dfc3e715eca6", + "590df5bcd0dd0677b7cd0e207b26d68bdce1b46a", "support" ], "WebCryptoAPI/derive_bits_keys/pbkdf2.https.any_5001-6000-expected.txt": [ - "16b7e942e377552fd7225b42524560b0b69487d6", + "ebf0317d364ac0a25b49054afd12ad9d1981f58e", "support" ], "WebCryptoAPI/derive_bits_keys/pbkdf2.https.any_6001-7000-expected.txt": [ - "d36ea5a7d0444109fb11b82798546cd36d117311", + "d423f156cce510f07b591015a9fa62548a723946", "support" ], "WebCryptoAPI/derive_bits_keys/pbkdf2.https.any_7001-8000-expected.txt": [ - "b55d797341c3ff0ceab529c94c2c63cfdfc228f4", + "6c57ffae01a5fe9510ba272eac457bf8f5c58d98", "support" ], "WebCryptoAPI/derive_bits_keys/pbkdf2.https.any_8001-last-expected.txt": [ - "2c2f2d17173839dada5d0b88112a57d2faa1ce90", + "7efa25ed06b7e151c7d885a6f9f395f0828fbc02", "support" ], "WebCryptoAPI/derive_bits_keys/pbkdf2.https.worker-expected.txt": [ @@ -301580,7 +301552,7 @@ "support" ], "WebCryptoAPI/encrypt_decrypt/aes_gcm.https.worker-expected.txt": [ - "08e98dba4d85bcb967e18f9be0d4c518da40529e", + "8b30a542e6585f274aa14db0546fb6cca42c6db3", "support" ], "WebCryptoAPI/encrypt_decrypt/aes_gcm.https.worker.js": [ @@ -301620,7 +301592,7 @@ "testharness" ], "WebCryptoAPI/encrypt_decrypt/test_aes_gcm.https-expected.txt": [ - "08e98dba4d85bcb967e18f9be0d4c518da40529e", + "8b30a542e6585f274aa14db0546fb6cca42c6db3", "support" ], "WebCryptoAPI/encrypt_decrypt/test_aes_gcm.https.html": [ @@ -301636,7 +301608,7 @@ "support" ], "WebCryptoAPI/generateKey/failures_AES-CBC.https.any-expected.txt": [ - "75c1ad022bc60b03f1283d48e928cab4bb9e4124", + "aecce5aebf5cd596da135a4d38d63782442df21b", "support" ], "WebCryptoAPI/generateKey/failures_AES-CBC.https.any.js": [ @@ -301644,7 +301616,7 @@ "testharness" ], "WebCryptoAPI/generateKey/failures_AES-CBC.https.any.worker-expected.txt": [ - "75c1ad022bc60b03f1283d48e928cab4bb9e4124", + "aecce5aebf5cd596da135a4d38d63782442df21b", "support" ], "WebCryptoAPI/generateKey/failures_AES-CBC.https.worker-expected.txt": [ @@ -301652,7 +301624,7 @@ "support" ], "WebCryptoAPI/generateKey/failures_AES-CTR.https.any-expected.txt": [ - "7615f2a1751c4e7a5c55c47f940dfa77cfc64745", + "0dc2da5e712ed14c415d04e0fca3286528b3b369", "support" ], "WebCryptoAPI/generateKey/failures_AES-CTR.https.any.js": [ @@ -301660,7 +301632,7 @@ "testharness" ], "WebCryptoAPI/generateKey/failures_AES-CTR.https.any.worker-expected.txt": [ - "7615f2a1751c4e7a5c55c47f940dfa77cfc64745", + "0dc2da5e712ed14c415d04e0fca3286528b3b369", "support" ], "WebCryptoAPI/generateKey/failures_AES-CTR.https.worker-expected.txt": [ @@ -301668,7 +301640,7 @@ "support" ], "WebCryptoAPI/generateKey/failures_AES-GCM.https.any-expected.txt": [ - "fb4550d637adbdc23d4a30708d2bd565260520a7", + "eb93c253e21a9394d3b57b40f1557b9d21c421bf", "support" ], "WebCryptoAPI/generateKey/failures_AES-GCM.https.any.js": [ @@ -301676,7 +301648,7 @@ "testharness" ], "WebCryptoAPI/generateKey/failures_AES-GCM.https.any.worker-expected.txt": [ - "fb4550d637adbdc23d4a30708d2bd565260520a7", + "eb93c253e21a9394d3b57b40f1557b9d21c421bf", "support" ], "WebCryptoAPI/generateKey/failures_AES-GCM.https.worker-expected.txt": [ @@ -301684,7 +301656,7 @@ "support" ], "WebCryptoAPI/generateKey/failures_AES-KW.https.any-expected.txt": [ - "f0e0ee855ae4b89727e564cf992c25cbe4443e4f", + "4de69d1e9dfa571eb062018e67969fdaa3317ad2", "support" ], "WebCryptoAPI/generateKey/failures_AES-KW.https.any.js": [ @@ -301692,7 +301664,7 @@ "testharness" ], "WebCryptoAPI/generateKey/failures_AES-KW.https.any.worker-expected.txt": [ - "f0e0ee855ae4b89727e564cf992c25cbe4443e4f", + "4de69d1e9dfa571eb062018e67969fdaa3317ad2", "support" ], "WebCryptoAPI/generateKey/failures_AES-KW.https.worker-expected.txt": [ @@ -301728,7 +301700,7 @@ "support" ], "WebCryptoAPI/generateKey/successes_AES-CBC.https.any-expected.txt": [ - "54dd90dd9487f8f71f98463c58a58030d7965b52", + "c069c39dbb0aa0d3bfa0a31bfaa43a18b2ec63a4", "support" ], "WebCryptoAPI/generateKey/successes_AES-CBC.https.any.js": [ @@ -301736,7 +301708,7 @@ "testharness" ], "WebCryptoAPI/generateKey/successes_AES-CBC.https.any.worker-expected.txt": [ - "54dd90dd9487f8f71f98463c58a58030d7965b52", + "c069c39dbb0aa0d3bfa0a31bfaa43a18b2ec63a4", "support" ], "WebCryptoAPI/generateKey/successes_AES-CBC.https.worker-expected.txt": [ @@ -301744,7 +301716,7 @@ "support" ], "WebCryptoAPI/generateKey/successes_AES-CTR.https.any-expected.txt": [ - "5e97b99fd901429d1cf848a18715320ba72434de", + "8af2672821bfa0a821f9d6084d0e51df80ef7b0e", "support" ], "WebCryptoAPI/generateKey/successes_AES-CTR.https.any.js": [ @@ -301752,7 +301724,7 @@ "testharness" ], "WebCryptoAPI/generateKey/successes_AES-CTR.https.any.worker-expected.txt": [ - "5e97b99fd901429d1cf848a18715320ba72434de", + "8af2672821bfa0a821f9d6084d0e51df80ef7b0e", "support" ], "WebCryptoAPI/generateKey/successes_AES-CTR.https.worker-expected.txt": [ @@ -301760,7 +301732,7 @@ "support" ], "WebCryptoAPI/generateKey/successes_AES-GCM.https.any-expected.txt": [ - "66a8aec81dd63616e13659cc8af475bfc2792ecd", + "eccdc39d79dd45bd0dbeba6f66e0cc55835e65cf", "support" ], "WebCryptoAPI/generateKey/successes_AES-GCM.https.any.js": [ @@ -301768,7 +301740,7 @@ "testharness" ], "WebCryptoAPI/generateKey/successes_AES-GCM.https.any.worker-expected.txt": [ - "66a8aec81dd63616e13659cc8af475bfc2792ecd", + "eccdc39d79dd45bd0dbeba6f66e0cc55835e65cf", "support" ], "WebCryptoAPI/generateKey/successes_AES-GCM.https.worker-expected.txt": [ @@ -301776,7 +301748,7 @@ "support" ], "WebCryptoAPI/generateKey/successes_AES-KW.https.any-expected.txt": [ - "1077cefc64710d90b93c978352bed4c05327f1a7", + "cdf7768d62d4e3e71fcdf01cbd10eb24df111a4e", "support" ], "WebCryptoAPI/generateKey/successes_AES-KW.https.any.js": [ @@ -301784,7 +301756,7 @@ "testharness" ], "WebCryptoAPI/generateKey/successes_AES-KW.https.any.worker-expected.txt": [ - "1077cefc64710d90b93c978352bed4c05327f1a7", + "cdf7768d62d4e3e71fcdf01cbd10eb24df111a4e", "support" ], "WebCryptoAPI/generateKey/successes_AES-KW.https.worker-expected.txt": [ @@ -301884,7 +301856,7 @@ "support" ], "WebCryptoAPI/import_export/symmetric_importKey.https.worker-expected.txt": [ - "60212398533bd1511124e30e4ab896abf3fcd4c6", + "c864d227f16c940b274671df92b0c3fa945ab44b", "support" ], "WebCryptoAPI/import_export/symmetric_importKey.https.worker.js": [ @@ -301904,7 +301876,7 @@ "testharness" ], "WebCryptoAPI/import_export/test_symmetric_importKey.https-expected.txt": [ - "60212398533bd1511124e30e4ab896abf3fcd4c6", + "c864d227f16c940b274671df92b0c3fa945ab44b", "support" ], "WebCryptoAPI/import_export/test_symmetric_importKey.https.html": [ @@ -301992,7 +301964,7 @@ "support" ], "WebCryptoAPI/wrapKey_unwrapKey/test_wrapKey_unwrapKey.https-expected.txt": [ - "50ec3421c21d302a95d3aed9ac70caf7ecb360af", + "2910210ee2ad454db1dcd26a1b55e2c59ee93f0b", "support" ], "WebCryptoAPI/wrapKey_unwrapKey/test_wrapKey_unwrapKey.https.html": [ @@ -302000,7 +301972,7 @@ "testharness" ], "WebCryptoAPI/wrapKey_unwrapKey/wrapKey_unwrapKey.https.worker-expected.txt": [ - "50ec3421c21d302a95d3aed9ac70caf7ecb360af", + "2910210ee2ad454db1dcd26a1b55e2c59ee93f0b", "support" ], "WebCryptoAPI/wrapKey_unwrapKey/wrapKey_unwrapKey.https.worker.js": [ @@ -303108,7 +303080,7 @@ "testharness" ], "background-fetch/idlharness.https.any.serviceworker-expected.txt": [ - "c864b42b9f1d44cbaa2671531348fed32d3c08cd", + "d0dfd483ccc6ef900f607c49faaf641fc381a13e", "support" ], "background-fetch/mixed-content-and-allowed-schemes.https.window.js": [ @@ -303536,7 +303508,7 @@ "testharness" ], "bluetooth/idl/idlharness.tentative.https.window-expected.txt": [ - "6c2db97b148401f781ec99bb383b475a459450e9", + "b5573f68b94b45443f76f0525a0573b7d3739e27", "support" ], "bluetooth/idl/idlharness.tentative.https.window.js": [ @@ -328775,6 +328747,14 @@ "3dc1b0b50c1752a0ca6bd56bfeb3867d036718fb", "support" ], + "css/css-backgrounds/table-cell-background-local-ref.html": [ + "b6088dd39ad951876641441c19d825c8fc0afa75", + "support" + ], + "css/css-backgrounds/table-cell-background-local.html": [ + "e52aa26ef209dccb54f0362ca4a30964904ce7b0", + "reftest" + ], "css/css-backgrounds/ttwf-css3background-border-color-shorthand-missing-bottom.htm": [ "b7bccd77af49810bdd83d4cdf9ec5b7126967283", "visual" @@ -334856,7 +334836,7 @@ "testharness" ], "css/css-font-loading/idlharness.https-expected.txt": [ - "8422407fe35cc786ded3769d1f003dd9cca23dbd", + "c9ecfd5adc387d0909313f7e8519092c9cb1c20b", "support" ], "css/css-font-loading/idlharness.https.html": [ @@ -388180,15 +388160,15 @@ "testharness" ], "encoding/encodeInto.any-expected.txt": [ - "98dc6affc48e33663de0c856757efe25dce75ade", + "dd03ad6d4d8bf9b40a989e1b4edc28e192f06ba4", "support" ], "encoding/encodeInto.any.js": [ - "2abc69744d7018a80f61022c6aa9a8225d050b6c", + "fda0d1b72ce787e940565575abb258012335269a", "testharness" ], "encoding/encodeInto.any.worker-expected.txt": [ - "98dc6affc48e33663de0c856757efe25dce75ade", + "dd03ad6d4d8bf9b40a989e1b4edc28e192f06ba4", "support" ], "encoding/eof-shift_jis-ref.html": [ @@ -390960,7 +390940,7 @@ "support" ], "feature-policy/feature-policy-frame-policy-allowed-for-self.https.sub-expected.txt": [ - "debff0d4c47a7e6ec2f237c5ee9393ff86250a3f", + "4c4f2ba8dc75db6e2514cb4ef43785c82349793b", "support" ], "feature-policy/feature-policy-frame-policy-allowed-for-self.https.sub.html": [ @@ -390972,7 +390952,7 @@ "support" ], "feature-policy/feature-policy-frame-policy-allowed-for-some.https.sub-expected.txt": [ - "95b6551c8732e0b21724ca7a3f2f2d5318bd1459", + "8af8dc4910b18d7ed21dba6bb3b338d5e9f33a52", "support" ], "feature-policy/feature-policy-frame-policy-allowed-for-some.https.sub.html": [ @@ -391788,7 +391768,7 @@ "testharness" ], "fetch/api/idl.any.serviceworker-expected.txt": [ - "9ebb33d55499587af5f83e56c32ed14ba6c2bf6a", + "7687f61f03d86d480149000d2956626d00f5530c", "support" ], "fetch/api/idl.any.sharedworker-expected.txt": [ @@ -396672,7 +396652,7 @@ "support" ], "html/browsers/the-window-object/window-properties.https-expected.txt": [ - "bc228dee1a5cd3a2a940098470ced39e8c016915", + "e55b51a0073c517ea5d86d42f62827cc2cf91ebb", "support" ], "html/browsers/the-window-object/window-properties.https.html": [ @@ -398148,15 +398128,15 @@ "testharness" ], "html/dom/interfaces.https_exclude=(Document_Window_HTML._)-expected.txt": [ - "eab0258ba35e1c17c99c6e3bfe1d0d4ad0a9824d", + "87ecff0ec04ddaa5ea63cad3a1a194d5d0ca3784", "support" ], "html/dom/interfaces.https_include=(Document_Window)-expected.txt": [ - "963dd1ba813d8c919ede4d53cfa1a557fbb4cc26", + "48a5398505d4d0bb16ddfd3079bb9efdd617ab22", "support" ], "html/dom/interfaces.https_include=HTML._-expected.txt": [ - "e29b0c43d7b323c969aed87bd2beff15d5bedb72", + "745b7eefa20cf3623a91e229b6a1d216322e206d", "support" ], "html/dom/interfaces.worker-expected.txt": [ @@ -416108,7 +416088,7 @@ "manual" ], "mediacapture-streams/MediaStreamTrack-getCapabilities.https-expected.txt": [ - "d5eabe74df598012f93701b111c8eab8efc80b3f", + "c245e7eb9b089b3a9fe1d272215dc969054323c7", "support" ], "mediacapture-streams/MediaStreamTrack-getCapabilities.https.html": [ @@ -416148,7 +416128,7 @@ "testharness" ], "mediacapture-streams/idlharness.https.window-expected.txt": [ - "da7a86a02110e86d0302242a95e9b11d354bd8f8", + "b0be4a5647ace311ffc0e90d4c880069079524c6", "support" ], "mediacapture-streams/idlharness.https.window.js": [ @@ -426248,7 +426228,7 @@ "testharness" ], "payment-handler/idlharness.https.any.serviceworker-expected.txt": [ - "e7bb8bf16184ee7dfb1a6e4fb6f05206326084b9", + "e4fbb7e8e220b8a89f6785b38f0074ce659c010f", "support" ], "payment-handler/idlharness.https.any.sharedworker-expected.txt": [ @@ -426548,7 +426528,7 @@ "testharness" ], "payment-request/idlharness.https.window-expected.txt": [ - "4e900cc43a77f732d6ceec06bc82e6cc130e074f", + "a0aed79fd80a99a325f01e22c9a8e8034e70dc21", "support" ], "payment-request/idlharness.https.window.js": [ @@ -427860,7 +427840,7 @@ "testharness" ], "push-api/idlharness.https.any.serviceworker-expected.txt": [ - "d0869e0c2479d67cc748449dbca84525e06e60de", + "4e57b9848f45c399a291595823820882af84503c", "support" ], "quirks/META.yml": [ @@ -438888,7 +438868,7 @@ "support" ], "server-timing/server_timing_header-parsing.https-expected.txt": [ - "c87e661741fc1b57d02637ab9c4f6ff0cd1c79bd", + "4ea8991201087e109fd8e552a3762a77cc796ecf", "support" ], "server-timing/server_timing_header-parsing.https.html": [ @@ -439536,7 +439516,7 @@ "testharness" ], "service-workers/service-worker/fetch-event-redirect.https-expected.txt": [ - "d14fbe880794ca44dc79e7b0b3ae2d545a4f1318", + "44bbf2436f4689cc37efcc086bcb5e1171da14ec", "support" ], "service-workers/service-worker/fetch-event-redirect.https.html": [ @@ -439744,7 +439724,7 @@ "testharness" ], "service-workers/service-worker/interfaces-sw.https-expected.txt": [ - "a91d435b26b834c29f0ab977ab75ede9d8316850", + "15c9fb807acf01293590ddcaee5724cdcf4e4af5", "support" ], "service-workers/service-worker/interfaces-sw.https.html": [ @@ -442216,15 +442196,15 @@ "support" ], "signed-exchange/check-cert-request.tentative.html": [ - "5a89066c012ad9ffedd2b4917550d017b04814f8", + "b1418e929083bf1cd8c591bb42e13a35b0b47a6f", "testharness" ], "signed-exchange/fallback-to-another-sxg.tentative.html": [ - "0dbbd4a84b2d6ee6713530640994f1eda3f9c324", + "8ccba86bd79d42a0d1eb77beb964487e62566375", "testharness" ], "signed-exchange/nested-sxg.tentative.html": [ - "b661a0280f24576e89ef755d8b65973c3f9cbe85", + "f1167f919ab39a85e38778c39fc64305eecd4921", "testharness" ], "signed-exchange/resources/127.0.0.1.sxg.ext": [ @@ -442251,156 +442231,120 @@ "ce95f0699eb8b7d977fd22ecc484bed756d8da7f", "support" ], - "signed-exchange/resources/check-cert-request.sxg": [ - "05f1646cfeb72d4c697ec73cee8855b787667568", - "support" - ], - "signed-exchange/resources/check-cert-request.sxg.headers": [ - "ca41178420c5b2adf70c439435d40b6370535330", - "support" - ], "signed-exchange/resources/failure.html": [ "1071f082b771c0daab9e8130347622ec28b3a0ec", "support" ], - "signed-exchange/resources/fallback-to-another-sxg.sxg": [ - "0a601820cf8264f537308caacde2261d5e412fd1", - "support" - ], - "signed-exchange/resources/fallback-to-another-sxg.sxg.headers": [ - "ca41178420c5b2adf70c439435d40b6370535330", - "support" - ], "signed-exchange/resources/generate-test-certs.sh": [ "01330e46d8f6aad6baab7b1bdb7c228a627eac21", "support" ], "signed-exchange/resources/generate-test-sxgs.sh": [ - "8359a137b8f296654d687ecbb61dc5bba7dbfaf1", + "c208e73a55836bdd0a02daf145127a220e4f6187", "support" ], "signed-exchange/resources/inner-url.html": [ "628a18afa3f77569662dbb04017c0d0925daf30d", "support" ], - "signed-exchange/resources/nested-sxg.sxg": [ - "2970e2df82c9ed697806d04004e676c2d168531c", - "support" - ], - "signed-exchange/resources/nested-sxg.sxg.headers": [ - "ca41178420c5b2adf70c439435d40b6370535330", - "support" - ], - "signed-exchange/resources/sxg-head-request.sxg": [ - "9d09647481c18a0cf8c77af198b2eff15c950b96", - "support" - ], - "signed-exchange/resources/sxg-head-request.sxg.headers": [ - "ca41178420c5b2adf70c439435d40b6370535330", - "support" - ], - "signed-exchange/resources/sxg-inner-url-bom.sxg": [ - "ace5abdd0b0f95f31fca8477008c3fce0f333078", - "support" - ], - "signed-exchange/resources/sxg-inner-url-bom.sxg.headers": [ - "ca41178420c5b2adf70c439435d40b6370535330", - "support" - ], - "signed-exchange/resources/sxg-invalid-utf8-inner-url.sxg": [ - "1f697b74b0d787d7cc30420c2cb68d0388d10b20", - "support" - ], - "signed-exchange/resources/sxg-invalid-utf8-inner-url.sxg.headers": [ - "ca41178420c5b2adf70c439435d40b6370535330", - "support" - ], - "signed-exchange/resources/sxg-invalid-validity-url.sxg": [ - "3266e7e7040e878b2371c412d12a84b232f58860", - "support" - ], - "signed-exchange/resources/sxg-invalid-validity-url.sxg.headers": [ - "ca41178420c5b2adf70c439435d40b6370535330", - "support" - ], "signed-exchange/resources/sxg-location.html": [ "39a475ebd070a5fa0c87de6805759e11f76a400d", "support" ], - "signed-exchange/resources/sxg-location.sxg": [ - "a81854142a5cad67bbc1196d83a0e302b12f1869", - "support" - ], - "signed-exchange/resources/sxg-location.sxg.headers": [ - "ca41178420c5b2adf70c439435d40b6370535330", - "support" - ], - "signed-exchange/resources/sxg-noncacheable.sxg": [ - "38be1eeb3aa041c267f7dc117314d5cb0a864cf2", - "support" - ], - "signed-exchange/resources/sxg-noncacheable.sxg.headers": [ - "ca41178420c5b2adf70c439435d40b6370535330", - "support" - ], - "signed-exchange/resources/sxg-utf8-inner-url.sxg": [ - "c8f8a94ef90bed5383bbfc5742759893a1d21798", - "support" - ], - "signed-exchange/resources/sxg-utf8-inner-url.sxg.headers": [ - "ca41178420c5b2adf70c439435d40b6370535330", - "support" - ], "signed-exchange/resources/sxg-util.js": [ "b31bf98c9b1acce6428331452eefe66e06aa5dc6", "support" ], + "signed-exchange/resources/sxg/__dir__.headers": [ + "ca41178420c5b2adf70c439435d40b6370535330", + "support" + ], + "signed-exchange/resources/sxg/check-cert-request.sxg": [ + "05f1646cfeb72d4c697ec73cee8855b787667568", + "support" + ], + "signed-exchange/resources/sxg/fallback-to-another-sxg.sxg": [ + "1af86c04134574c6a1ca4aa767ad716cab7de432", + "support" + ], + "signed-exchange/resources/sxg/nested-sxg.sxg": [ + "2970e2df82c9ed697806d04004e676c2d168531c", + "support" + ], + "signed-exchange/resources/sxg/sxg-head-request.sxg": [ + "9d09647481c18a0cf8c77af198b2eff15c950b96", + "support" + ], + "signed-exchange/resources/sxg/sxg-inner-url-bom.sxg": [ + "ace5abdd0b0f95f31fca8477008c3fce0f333078", + "support" + ], + "signed-exchange/resources/sxg/sxg-invalid-utf8-inner-url.sxg": [ + "1f697b74b0d787d7cc30420c2cb68d0388d10b20", + "support" + ], + "signed-exchange/resources/sxg/sxg-invalid-validity-url.sxg": [ + "3266e7e7040e878b2371c412d12a84b232f58860", + "support" + ], + "signed-exchange/resources/sxg/sxg-location.sxg": [ + "a81854142a5cad67bbc1196d83a0e302b12f1869", + "support" + ], + "signed-exchange/resources/sxg/sxg-noncacheable.sxg": [ + "38be1eeb3aa041c267f7dc117314d5cb0a864cf2", + "support" + ], + "signed-exchange/resources/sxg/sxg-utf8-inner-url.sxg": [ + "c8f8a94ef90bed5383bbfc5742759893a1d21798", + "support" + ], "signed-exchange/sxg-double-prefetch.tentative.html": [ - "a73c18dddf2e22da00bd4bc6813b5f054bf09a34", + "d682741744fed929bee8e62fbae4857a4bfbf1d5", "testharness" ], "signed-exchange/sxg-fallback-with-fragment.tentative.html": [ - "6d9c9c552325c197ae3354d180ab439872b0c118", + "aae8fa8bd1954e790001e962094a810cff49444c", "testharness" ], "signed-exchange/sxg-head-request.tentative.html": [ - "83b427b6cf19bff8e8c482a3cba7a899dcbe6e73", + "ad65a5892d859b0ae90ccc5885ee07c0d96a04d5", "testharness" ], "signed-exchange/sxg-inner-url-bom.tentative.html": [ - "c694a2236ff900bee4eb226dcd8124098668e3c2", + "7055f5fabec5c148b114dca771db1bbb6d548fef", "testharness" ], "signed-exchange/sxg-invalid-utf8-inner-url.tentative.html": [ - "bc28d8101cc7ac964850bb88907e5e6cd8d2b90b", + "a70bba2fdc1dabe7456699923cf50baa9c5b5d39", "testharness" ], "signed-exchange/sxg-invalid-validity-url.tentative.html": [ - "7264e48b8b7a508213c2e7290a274d318ad29872", + "bb027b1669889b2c6e5fbe51261e2c8cae662ae9", "testharness" ], "signed-exchange/sxg-location-fragment.tentative.html": [ - "9bfac8a15cdd0e18473636298ced3c5b34d6353d", + "92e1efbc20cd337241e42aad1af7c4742a3df2cc", "testharness" ], "signed-exchange/sxg-location.tentative.html": [ - "0d54ea560f47806cc3a3587ee3c7c49249dc5e41", + "17ca0768d6f8e0e1a4bccf707d8e34c6dbfdfc8c", "testharness" ], "signed-exchange/sxg-non-secure-origin.tentative.html": [ - "50a9ce30d80f9e41b6993e368da9f6ac71045cc4", + "84938da76d09dbe4f045b763e49ba95a4936003f", "testharness" ], "signed-exchange/sxg-noncacheable.tentative.html": [ - "82c9fb0d0290e8c7d74cc23736bd00579004a53d", + "1315360745789655acb926d7e8bafea9322c3a25", "testharness" ], "signed-exchange/sxg-prefetch-resource-timing.tentative.html": [ - "f0dc477e730ed45e32c43b70ca546d9790b6839d", + "5b60ab9e1a12e2b169c4972c422ddbe3ebc5f581", "testharness" ], "signed-exchange/sxg-utf8-inner-url.tentative.html": [ - "fc33560d296d9f72ee7858692a20bf2763bd957b", + "85670a786af33c5dbfe19a018dba76847fa649cf", "testharness" ], "speech-api/META.yml": [ @@ -442772,7 +442716,7 @@ "testharness" ], "streams/readable-byte-streams/general.any.serviceworker-expected.txt": [ - "9e7a9d4173fda8dd5ec0cb5df3e79010aefdc546", + "3644dc004fa47db958411e161dad89cda64237cb", "support" ], "streams/readable-byte-streams/general.any.sharedworker-expected.txt": [ @@ -447664,7 +447608,7 @@ "support" ], "webaudio/idlharness.https.window-expected.txt": [ - "1e99acda1386d360603d7fc5ed3f506a04b9bc2c", + "29a7407d0cea2b8823bd4b0dc7251190a2c1432f", "support" ], "webaudio/idlharness.https.window.js": [ @@ -449264,7 +449208,7 @@ "support" ], "webmidi/idlharness.https.window-expected.txt": [ - "85db0f6a3d1aca55117e386a8305728747103d32", + "5cc4ad6b48f1b3969b29d101ff52f7543ceb8e7e", "support" ], "webmidi/idlharness.https.window.js": [ @@ -450008,7 +449952,7 @@ "testharness" ], "webrtc/idlharness.https.window-expected.txt": [ - "468ee2ded5a1148b744854be5ba6cbf66a0e4ee3", + "f8f1f896d8e79478861ed546e42ded2b1954ab1b", "support" ], "webrtc/idlharness.https.window.js": [ @@ -451464,7 +451408,7 @@ "support" ], "webusb/idlharness.https.any-expected.txt": [ - "4f7b6705ec8f79dab64c082fbef78fc882099812", + "506f932711233d182a849c6b98d3441611e8ac0d", "support" ], "webusb/idlharness.https.any.js": [ @@ -451472,7 +451416,7 @@ "testharness" ], "webusb/idlharness.https.any.worker-expected.txt": [ - "59961840a210d9e74c39810f4fcd2b42a93ade83", + "d097c0df8df5b4c542ad31c964c0c42018c1ac2a", "support" ], "webusb/insecure-context.any.js": [ @@ -451620,7 +451564,7 @@ "support" ], "webvr/idlharness.https-expected.txt": [ - "94366ee205aca57a695becb99b3ced5116450ec3", + "ea804e931912babea82616a402f0aaaded2bd9a9", "support" ], "webvr/idlharness.https.html": [ @@ -454636,7 +454580,7 @@ "support" ], "webxr/idlharness.https.window-expected.txt": [ - "8eab4ef685f87d0d17375da88e26ca5b7a8a0ef7", + "55ddab319cbfcc8d7b4bc7dc07ab4331e1daa011", "support" ], "webxr/idlharness.https.window.js": [
diff --git a/third_party/blink/web_tests/external/wpt/animation-worklet/common.js b/third_party/blink/web_tests/external/wpt/animation-worklet/common.js new file mode 100644 index 0000000..d029ab7 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/animation-worklet/common.js
@@ -0,0 +1,33 @@ +'use strict'; + +function registerPassthroughAnimator() { + return runInAnimationWorklet(` + registerAnimator('passthrough', class { + animate(currentTime, effect) { effect.localTime = currentTime; } + }); + `); +} + +function runInAnimationWorklet(code) { + return CSS.animationWorklet.addModule( + URL.createObjectURL(new Blob([code], {type: 'text/javascript'})) + ); +} + +function waitForAnimationFrames(count, callback) { + function rafCallback() { + if (count <= 0) { + callback(); + } else { + count -= 1; + window.requestAnimationFrame(rafCallback); + } + } + rafCallback(); +}; + +// Wait for two main thread frames to guarantee that compositor has produced +// at least one frame. Note that this is a Chrome-only concept. +function waitTwoAnimationFrames(callback) { + waitForAnimationFrames(2, callback); +};
diff --git a/third_party/blink/web_tests/animations/animationworklet/worklet-animation-with-fill-mode.html b/third_party/blink/web_tests/external/wpt/animation-worklet/worklet-animation-with-fill-mode.https.html similarity index 93% rename from third_party/blink/web_tests/animations/animationworklet/worklet-animation-with-fill-mode.html rename to third_party/blink/web_tests/external/wpt/animation-worklet/worklet-animation-with-fill-mode.https.html index 6714855..90abe082 100644 --- a/third_party/blink/web_tests/animations/animationworklet/worklet-animation-with-fill-mode.html +++ b/third_party/blink/web_tests/external/wpt/animation-worklet/worklet-animation-with-fill-mode.https.html
@@ -1,7 +1,9 @@ <!DOCTYPE html> <title>Test that worklet animation works with different fill modes</title> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> +<link rel="help" href="https://drafts.css-houdini.org/css-animationworklet/"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="common.js"></script> <style> .target { @@ -10,6 +12,7 @@ background-color: green; } </style> + <script> function CreateTest(target, effect, verify, test_name) { async_test(t => { @@ -47,7 +50,6 @@ <div id="target5" class='target'></div> <div id="target6" class='target'></div> -<script src="resources/animation-worklet-tests.js"></script> <script> const effect_with_fill_forwards = new KeyframeEffect( target1,
diff --git a/third_party/blink/web_tests/external/wpt/animation-worklet/worklet-animation-with-invalid-effect.https.html b/third_party/blink/web_tests/external/wpt/animation-worklet/worklet-animation-with-invalid-effect.https.html new file mode 100644 index 0000000..9a7688d3 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/animation-worklet/worklet-animation-with-invalid-effect.https.html
@@ -0,0 +1,35 @@ +<!DOCTYPE html> +<title>Test that worklet animation with invalid effect cannot be played</title> +<link rel="help" href="https://drafts.css-houdini.org/css-animationworklet/"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="common.js"></script> + +<style> +#target { + width: 100px; + height: 100px; +} +</style> + +<div id="target"></div> + +<script> +'use strict'; + +test(function() { + registerPassthroughAnimator(); + let playFunc = function() { + let effect = new KeyframeEffect( + document.getElementById('target'), + [ + // No keyframe. + ], + { duration: 1000 } + ); + let animation = new WorkletAnimation('passthrough', effect); + animation.play(); + } + assert_throws('InvalidStateError', playFunc); +}, 'Trying to play invalid worklet animation should throw an exception.'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-grid/abspos/grid-positioned-items-padding-001.html b/third_party/blink/web_tests/external/wpt/css/css-grid/abspos/grid-positioned-items-padding-001.html index 4941d77..643a6883 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-grid/abspos/grid-positioned-items-padding-001.html +++ b/third_party/blink/web_tests/external/wpt/css/css-grid/abspos/grid-positioned-items-padding-001.html
@@ -109,13 +109,13 @@ <div class="grid"> <div class="absolute" style="grid-column: foo / 1; grid-row: foo / 1;" - data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="15"> + data-offset-x="15" data-offset-y="15" data-expected-width="515" data-expected-height="315"> </div> <div class="absolute" style="grid-column: 1 / 2; grid-row: foo / 1;" - data-offset-x="15" data-offset-y="0" data-expected-width="100" data-expected-height="15"> + data-offset-x="15" data-offset-y="15" data-expected-width="100" data-expected-height="315"> </div> <div class="absolute" style="grid-column: foo / 1; grid-row: 1 / 2;" - data-offset-x="0" data-offset-y="15" data-expected-width="15" data-expected-height="50"> + data-offset-x="15" data-offset-y="15" data-expected-width="515" data-expected-height="50"> </div> <div class="absolute" style="grid-column: 3 / foo; grid-row: 3 / foo;" data-offset-x="315" data-offset-y="215" data-expected-width="215" data-expected-height="115"> @@ -193,13 +193,13 @@ <div class="grid directionRTL"> <div class="absolute" style="grid-column: foo / 1; grid-row: foo / 1;" - data-offset-x="515" data-offset-y="0" data-expected-width="15" data-expected-height="15"> + data-offset-x="0" data-offset-y="15" data-expected-width="515" data-expected-height="315"> </div> <div class="absolute" style="grid-column: 1 / 2; grid-row: foo / 1;" - data-offset-x="415" data-offset-y="0" data-expected-width="100" data-expected-height="15"> + data-offset-x="415" data-offset-y="15" data-expected-width="100" data-expected-height="315"> </div> <div class="absolute" style="grid-column: foo / 1; grid-row: 1 / 2;" - data-offset-x="515" data-offset-y="15" data-expected-width="15" data-expected-height="50"> + data-offset-x="0" data-offset-y="15" data-expected-width="515" data-expected-height="50"> </div> <div class="absolute" style="grid-column: 3 / foo; grid-row: 3 / foo;" data-offset-x="0" data-offset-y="215" data-expected-width="215" data-expected-height="115">
diff --git a/third_party/blink/web_tests/external/wpt/css/css-grid/abspos/grid-positioned-items-unknown-named-grid-line-001.html b/third_party/blink/web_tests/external/wpt/css/css-grid/abspos/grid-positioned-items-unknown-named-grid-line-001.html index 24d9d76..6e61f7c 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-grid/abspos/grid-positioned-items-unknown-named-grid-line-001.html +++ b/third_party/blink/web_tests/external/wpt/css/css-grid/abspos/grid-positioned-items-unknown-named-grid-line-001.html
@@ -3,7 +3,7 @@ <title>CSS Grid Layout Test: Grid positioned items unknown named grid line</title> <link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com"> <link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning"> -<meta name="assert" content="This test checks that grid placement properties of absolutely positioned items using unknown named grid lines are treated as 'auto'."> +<meta name="assert" content="This test checks that grid placement properties of absolutely positioned items can reference implicit grid lines."> <link rel="stylesheet" href="support/grid.css"> <style> @@ -58,7 +58,7 @@ data-offset-x="15" data-offset-y="15" data-expected-width="515" data-expected-height="315"> </div> <div class="absolute sizedToGridArea startUnknownLine" - data-offset-x="0" data-offset-y="0" data-expected-width="315" data-expected-height="215"> + data-offset-x="315" data-offset-y="215" data-expected-width="215" data-expected-height="115"> </div> </div> @@ -70,7 +70,7 @@ data-offset-x="0" data-offset-y="15" data-expected-width="515" data-expected-height="315"> </div> <div class="absolute sizedToGridArea startUnknownLine" - data-offset-x="215" data-offset-y="0" data-expected-width="315" data-expected-height="215"> + data-offset-x="0" data-offset-y="215" data-expected-width="215" data-expected-height="115"> </div> </div>
diff --git a/third_party/blink/web_tests/external/wpt/css/mediaqueries/prefers-color-scheme-expected.txt b/third_party/blink/web_tests/external/wpt/css/mediaqueries/prefers-color-scheme-expected.txt new file mode 100644 index 0000000..600af2a --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/mediaqueries/prefers-color-scheme-expected.txt
@@ -0,0 +1,14 @@ +This is a testharness.js-based test. +PASS Should be parseable: '(prefers-color-scheme)' +FAIL Should be parseable: '(prefers-color-scheme: no-preference)' assert_true: expected true got false +FAIL Should be parseable: '(prefers-color-scheme: light)' assert_true: expected true got false +FAIL Should be parseable: '(prefers-color-scheme: dark)' assert_true: expected true got false +PASS Should not be parseable: '(prefers-color-scheme: 0)' +PASS Should not be parseable: '(prefers-color-scheme: none)' +PASS Should not be parseable: '(prefers-color-scheme: 10px)' +PASS Should not be parseable: '(prefers-color-scheme: dark 0)' +PASS Should not be parseable: '(prefers-color-scheme: dark light)' +PASS Should not be parseable: '(prefers-color-scheme: light/dark)' +FAIL Check that no-preference evaluates to false in the boolean context assert_equals: expected true but got false +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/css/mediaqueries/prefers-color-scheme.html b/third_party/blink/web_tests/external/wpt/css/mediaqueries/prefers-color-scheme.html new file mode 100644 index 0000000..705a7ca --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/mediaqueries/prefers-color-scheme.html
@@ -0,0 +1,49 @@ +<!DOCTYPE html> +<link rel="help" href="https://drafts.csswg.org/mediaqueries-5/#prefers-color-scheme" /> +<script type="text/javascript" src="/resources/testharness.js"></script> +<script type="text/javascript" src="/resources/testharnessreport.js"></script> +<style id="testStyle"> </style> +<script> + var sheet = testStyle.sheet; + + function query_is_parseable(query) { + try { + sheet.insertRule("@media " + query + "{}", 0); + return sheet.cssRules.length == 1 && + sheet.cssRules[0].media.mediaText != "not all"; + } finally { + while (sheet.cssRules.length) + sheet.deleteRule(0); + } + } + + function query_should_be_parseable(query) { + test(() => { + assert_true(query_is_parseable(query)); + }, "Should be parseable: '" + query + "'"); + } + + function query_should_not_be_parseable(query) { + test(() => { + assert_false(query_is_parseable(query)); + }, "Should not be parseable: '" + query + "'"); + } + + query_should_be_parseable("(prefers-color-scheme)"); + query_should_be_parseable("(prefers-color-scheme: no-preference)"); + query_should_be_parseable("(prefers-color-scheme: light)"); + query_should_be_parseable("(prefers-color-scheme: dark)"); + + query_should_not_be_parseable("(prefers-color-scheme: 0)"); + query_should_not_be_parseable("(prefers-color-scheme: none)"); + query_should_not_be_parseable("(prefers-color-scheme: 10px)"); + query_should_not_be_parseable("(prefers-color-scheme: dark 0)"); + query_should_not_be_parseable("(prefers-color-scheme: dark light)"); + query_should_not_be_parseable("(prefers-color-scheme: light/dark)"); + + test(() => { + let booleanContext = window.matchMedia("(prefers-color-scheme)"); + let noPreference = window.matchMedia("(prefers-color-scheme: no-preference)"); + assert_equals(booleanContext.matches, !noPreference.matches); + }, "Check that no-preference evaluates to false in the boolean context"); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/encoding/encodeInto.any-expected.txt b/third_party/blink/web_tests/external/wpt/encoding/encodeInto.any-expected.txt index 98dc6af..dd03ad6 100644 --- a/third_party/blink/web_tests/external/wpt/encoding/encodeInto.any-expected.txt +++ b/third_party/blink/web_tests/external/wpt/encoding/encodeInto.any-expected.txt
@@ -52,6 +52,6 @@ PASS Invalid encodeInto() destination: function Float32Array() { [native code] } PASS Invalid encodeInto() destination: function Float64Array() { [native code] } PASS Invalid encodeInto() destination: ArrayBuffer -FAIL encodeInto() cannot operate on a detached buffer (intermediate value).encodeInto is not a function +FAIL encodeInto() and a detached output buffer (intermediate value).encodeInto is not a function Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/encoding/encodeInto.any.js b/third_party/blink/web_tests/external/wpt/encoding/encodeInto.any.js index 2abc697..fda0d1b7 100644 --- a/third_party/blink/web_tests/external/wpt/encoding/encodeInto.any.js +++ b/third_party/blink/web_tests/external/wpt/encoding/encodeInto.any.js
@@ -136,9 +136,14 @@ test(() => { const buffer = new ArrayBuffer(10), view = new Uint8Array(buffer); - const { read, written } = new TextEncoder().encodeInto("", view); + let { read, written } = new TextEncoder().encodeInto("", view); assert_equals(read, 0); assert_equals(written, 0); - self.postMessage(buffer, "/", [buffer]); - assert_throws(new TypeError(), () => new TextEncoder().encodeInto("", view)); -}, "encodeInto() cannot operate on a detached buffer"); + new MessageChannel().port1.postMessage(buffer, [buffer]); + ({ read, written } = new TextEncoder().encodeInto("", view)); + assert_equals(read, 0); + assert_equals(written, 0); + ({ read, written } = new TextEncoder().encodeInto("test", view)); + assert_equals(read, 0); + assert_equals(written, 0); +}, "encodeInto() and a detached output buffer");
diff --git a/third_party/blink/web_tests/external/wpt/encoding/encodeInto.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/encoding/encodeInto.any.worker-expected.txt index 98dc6af..dd03ad6 100644 --- a/third_party/blink/web_tests/external/wpt/encoding/encodeInto.any.worker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/encoding/encodeInto.any.worker-expected.txt
@@ -52,6 +52,6 @@ PASS Invalid encodeInto() destination: function Float32Array() { [native code] } PASS Invalid encodeInto() destination: function Float64Array() { [native code] } PASS Invalid encodeInto() destination: ArrayBuffer -FAIL encodeInto() cannot operate on a detached buffer (intermediate value).encodeInto is not a function +FAIL encodeInto() and a detached output buffer (intermediate value).encodeInto is not a function Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/trusted-types/TrustedTypePolicy-createXXX.tentative.html b/third_party/blink/web_tests/external/wpt/trusted-types/TrustedTypePolicy-createXXX.tentative.html index 475a264..6a0151a 100644 --- a/third_party/blink/web_tests/external/wpt/trusted-types/TrustedTypePolicy-createXXX.tentative.html +++ b/third_party/blink/web_tests/external/wpt/trusted-types/TrustedTypePolicy-createXXX.tentative.html
@@ -36,7 +36,7 @@ assert_equals(el.title, INPUTS.URL); el.title = policy.createURL(INPUTS.HTML); - assert_equals(el.title, INPUTS.HTML); + assert_equals(el.title, ""); }, "Attributes without type constraints will work as before."); test(t => { @@ -71,14 +71,14 @@ const urlTestCases = [ [ s => s, INPUTS.SCRIPTURL ], - [ s => null, "null" ], + [ s => null, "" ], [ s => s + "#duck", INPUTS.SCRIPTURL + "#duck" ], [ s => { throw new Error() }, new Error() ], [ s => s + "#" + aGlobalVarForSideEffectTesting, INPUTS.SCRIPTURL + "#global" ], [ anotherGlobalFunction.bind(aGlobalObject), INPUTS.SCRIPTURL + "#well," ], [ s => anotherGlobalFunction(s), - INPUTS.SCRIPTURL + "#a global var named foo" ], + INPUTS.SCRIPTURL + "#a%20global%20var%20named%20foo" ], ]; function policyBuilder(trustedMethodName, trustedType, defaultArg) {
diff --git a/third_party/blink/web_tests/external/wpt/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html b/third_party/blink/web_tests/external/wpt/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html index 37e245ee..a162d84c 100644 --- a/third_party/blink/web_tests/external/wpt/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html +++ b/third_party/blink/web_tests/external/wpt/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html
@@ -165,7 +165,7 @@ }, "script_url = identity function"); test(t => { - createScriptURLTest('TestPolicyScriptURL2', { createScriptURL: s => null }, "null", t); + createScriptURLTest('TestPolicyScriptURL2', { createScriptURL: s => null }, "", t); }, "script_url = null"); var scriptURLstr = '#duck'; @@ -240,7 +240,7 @@ }, "url = identity function"); test(t => { - createURLTest('TestPolicyURL2', { createURL: s => null }, "null", t); + createURLTest('TestPolicyURL2', { createURL: s => null }, "", t); }, "url = null"); var URLstr = '#x';
diff --git a/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html b/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html index c243757..9bda8d95 100644 --- a/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html +++ b/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html
@@ -9,6 +9,8 @@ </head> <body> <script> + const nullPolicy = TrustedTypes.createPolicy('NullPolicy', {createScript: s => s}); + // TrustedURL Assignments const URLTestCases = [ [ 'a', 'href' ], @@ -29,6 +31,7 @@ assert_element_accepts_trusted_url_explicit_set(window, c, t, c[0], c[1], RESULTS.URL); assert_throws_no_trusted_type_explicit_set(c[0], c[1], 'A string'); assert_throws_no_trusted_type_explicit_set(c[0], c[1], null); + assert_throws_no_trusted_type_explicit_set(c[0], c[1], nullPolicy.createScript('script')); }, c[0] + "." + c[1] + " accepts only TrustedURL"); }); @@ -45,6 +48,7 @@ assert_element_accepts_trusted_script_url_explicit_set(window, c, t, c[0], c[1], RESULTS.SCRIPTURL); assert_throws_no_trusted_type_explicit_set(c[0], c[1], 'A string'); assert_throws_no_trusted_type_explicit_set(c[0], c[1], null); + assert_throws_no_trusted_type_explicit_set(c[0], c[1], nullPolicy.createScript('script')); }, c[0] + "." + c[1] + " accepts only TrustedScriptURL"); }); @@ -58,22 +62,39 @@ assert_element_accepts_trusted_html_explicit_set(window, c, t, c[0], c[1], RESULTS.HTML); assert_throws_no_trusted_type_explicit_set(c[0], c[1], 'A string'); assert_throws_no_trusted_type_explicit_set(c[0], c[1], null); + assert_throws_no_trusted_type_explicit_set(c[0], c[1], nullPolicy.createScript('script')); }, c[0] + "." + c[1] + " accepts only TrustedHTML"); }); + test(t => { + let el = document.createElement('iframe'); + + assert_throws(new TypeError(), _ => { + el.setAttribute('SrC', INPUTS.URL); + }); + + assert_equals(el.src, ''); + }, "`Element.prototype.setAttribute.SrC = string` throws."); + // After default policy creation string and null assignments implicitly call createXYZ let p = window.TrustedTypes.createPolicy("default", { createURL: createURLJS, createScriptURL: createScriptURLJS, createHTML: createHTMLJS }, true); URLTestCases.forEach(c => { test(t => { assert_element_accepts_trusted_type(c[0], c[1], INPUTS.URL, RESULTS.URL); - assert_element_accepts_trusted_type(c[0], c[1], null, window.location.toString().replace(/[^\/]*$/, "null")); + + // Properties that actually parse the URLs will resort to the base URL + // when given a null or empty URL. + assert_element_accepts_trusted_type(c[0], c[1], null, "" + window.location); }, c[0] + "." + c[1] + " accepts string and null after default policy was created."); }); scriptURLTestCases.forEach(c => { test(t => { assert_element_accepts_trusted_type(c[0], c[1], INPUTS.SCRIPTURL, RESULTS.SCRIPTURL); - assert_element_accepts_trusted_type(c[0], c[1], null, window.location.toString().replace(/[^\/]*$/, "null")); + + // Properties that actually parse the URLs will resort to the base URL + // when given a null or empty URL. + assert_element_accepts_trusted_type(c[0], c[1], null, "" + window.location); }, c[0] + "." + c[1] + " accepts string and null after default policy was created."); }); @@ -108,14 +129,4 @@ assert_equals(span.getAttribute('src'), INPUTS.URL); }, "`span.src = setAttributeNode(div.src)` with string works."); - - test(t => { - let el = document.createElement('iframe'); - - assert_throws(new TypeError(), _ => { - el.setAttribute('SrC', INPUTS.URL); - }); - - assert_equals(el.src, ''); - }, "`Element.prototype.setAttribute.SrC = string` throws."); </script>
diff --git a/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html b/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html index 4a5c2cc..0eef00b 100644 --- a/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html +++ b/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html
@@ -71,14 +71,14 @@ URLTestCases.forEach(c => { test(t => { assert_element_accepts_trusted_type(c[0], c[1], INPUTS.URL, RESULTS.URL); - assert_element_accepts_trusted_type(c[0], c[1], null, window.location.toString().replace(/[^\/]*$/, "null")); + assert_element_accepts_trusted_type(c[0], c[1], null, "" + window.location); }, c[0] + "." + c[1] + " accepts string and null after default policy was created"); }); scriptURLTestCases.forEach(c => { test(t => { assert_element_accepts_trusted_type(c[0], c[1], INPUTS.SCRIPTURL, RESULTS.SCRIPTURL); - assert_element_accepts_trusted_type(c[0], c[1], null, window.location.toString().replace(/[^\/]*$/, "null")); + assert_element_accepts_trusted_type(c[0], c[1], null, "" + window.location); }, c[0] + "." + c[1] + " accepts string and null after default policy was created"); });
diff --git a/third_party/blink/web_tests/external/wpt/webrtc/RTCRtpReceiver-getSynchronizationSources.https-expected.txt b/third_party/blink/web_tests/external/wpt/webrtc/RTCRtpReceiver-getSynchronizationSources.https-expected.txt index 446b9981..aea4230 100644 --- a/third_party/blink/web_tests/external/wpt/webrtc/RTCRtpReceiver-getSynchronizationSources.https-expected.txt +++ b/third_party/blink/web_tests/external/wpt/webrtc/RTCRtpReceiver-getSynchronizationSources.https-expected.txt
@@ -1,4 +1,15 @@ This is a testharness.js-based test. -FAIL getContributingSources() should return list of CSRC after connection is established promise_test: Unhandled rejection with value: object "TypeError: receiver.getSynchronizationSources is not a function" +PASS [audio] getSynchronizationSources() eventually returns a non-empty list +PASS [audio] RTCRtpSynchronizationSource.timestamp is a number +PASS [audio] getSynchronizationSources() does not contain SSRCs older than 10 seconds +FAIL [audio] RTCRtpSynchronizationSource.timestamp is comparable to performance.timeOrigin + performance.now() assert_true: expected true got false +PASS [audio] RTCRtpSynchronizationSource.source is a number +PASS [video] getSynchronizationSources() eventually returns a non-empty list +PASS [video] RTCRtpSynchronizationSource.timestamp is a number +PASS [video] getSynchronizationSources() does not contain SSRCs older than 10 seconds +FAIL [video] RTCRtpSynchronizationSource.timestamp is comparable to performance.timeOrigin + performance.now() assert_true: expected true got false +PASS [video] RTCRtpSynchronizationSource.source is a number +FAIL [audio-only] RTCRtpSynchronizationSource.audioLevel is a number [0, 1] assert_equals: expected "number" but got "undefined" +FAIL [audio-only] RTCRtpSynchronizationSource.voiceActivityFlag is a boolean assert_equals: expected "boolean" but got "undefined" Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/webrtc/RTCRtpReceiver-getSynchronizationSources.https.html b/third_party/blink/web_tests/external/wpt/webrtc/RTCRtpReceiver-getSynchronizationSources.https.html index 8068558..36460b4 100644 --- a/third_party/blink/web_tests/external/wpt/webrtc/RTCRtpReceiver-getSynchronizationSources.https.html +++ b/third_party/blink/web_tests/external/wpt/webrtc/RTCRtpReceiver-getSynchronizationSources.https.html
@@ -1,79 +1,111 @@ <!doctype html> <meta charset=utf-8> +<!-- This file contains two tests that wait for 10 seconds each. --> +<meta name="timeout" content="long"> <title>RTCRtpReceiver.prototype.getSynchronizationSources</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="RTCPeerConnection-helper.js"></script> <script> - 'use strict'; +'use strict'; - // Test is based on the following editor draft: - // https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html +async function initiateSingleTrackCallAndReturnReceiver(t, kind) { + const pc1 = new RTCPeerConnection(); + t.add_cleanup(() => pc1.close()); + const pc2 = new RTCPeerConnection(); + t.add_cleanup(() => pc2.close()); - /* - 5.3. RTCRtpReceiver Interface - interface RTCRtpReceiver { - ... - sequence<RTCRtpSynchronizationSource> getSynchronizationSources(); - }; + const stream = await navigator.mediaDevices.getUserMedia({[kind]:true}); + const [track] = stream.getTracks(); + t.add_cleanup(() => track.stop()); + pc1.addTrack(track, stream); - interface RTCRtpSynchronizationSource { - readonly attribute DOMHighResTimeStamp timestamp; - readonly attribute unsigned long source; - readonly attribute byte audioLevel; - readonly attribute boolean? voiceActivityFlag; - }; - */ + exchangeIceCandidates(pc1, pc2); + const trackEvent = await exchangeOfferAndListenToOntrack(t, pc1, pc2); + await exchangeAnswer(pc1, pc2); + return trackEvent.receiver; +} - promise_test(t => { - const pc1 = new RTCPeerConnection(); - t.add_cleanup(() => pc1.close()); - const pc2 = new RTCPeerConnection(); - - t.add_cleanup(() => pc2.close()); - - const ontrackPromise = new Promise(resolve => { - pc2.addEventListener('track', trackEvent => { - const { receiver } = trackEvent; - assert_true(receiver instanceof RTCRtpReceiver, - 'Expect trackEvent.receiver to be instance of RTCRtpReceiver'); - - resolve(receiver); - }); - }); - - return getTrackFromUserMedia('audio') - .then(([track, mediaStream]) => { - pc1.addTrack(track, mediaStream); - exchangeIceCandidates(pc1, pc2); - return doSignalingHandshake(pc1, pc2); - }) - .then(() => ontrackPromise) - .then(receiver => { - const syncSources = receiver.getSynchronizationSources(); - assert_greater_than(syncSources.length, 0, - 'Expect SSRCs to be available after RTP connection is established'); - - for(const ssrc of syncSources) { - assert_true(ssrc instanceof RTCRtpSynchronizationSource, - 'Expect synchronizationSources elements to be instance of RTCSynchronizationSource'); - - assert_equals(typeof ssrc.timestamp, 'number', - 'Expect ssrc.timestamp attribute to be DOMHighResTimeStamp'); - - assert_true(Number.isInteger(ssrc.source) && ssrc.source > 0, - 'Expect SSRC identifier to be unsigned long'); - - assert_true(Number.isInteger(ssrc.audioLevel) && - ssrc.audioLevel >= 0 && ssrc.audioLevel <= 127, - 'Expect ssrc.audioLevel to be byte value from 0-127.'); - - if(ssrc.voiceActivityFlag !== null) { - assert_equals(typeof ssrc.voiceActivityFlag, 'boolean', - 'Expect ssrc.voiceActivity to be either null or boolean'); - } +function listenForSSRCs(t, receiver) { + return new Promise((resolve) => { + function listen() { + const ssrcs = receiver.getSynchronizationSources(); + assert_true(ssrcs != undefined); + if (ssrcs.length > 0) { + resolve(ssrcs); + return; } - }); - }, `getContributingSources() should return list of CSRC after connection is established`); + t.step_timeout(listen, 0); + }; + listen(); + }); +} + +for (const kind of ['audio', 'video']) { + promise_test(async t => { + const receiver = await initiateSingleTrackCallAndReturnReceiver(t, kind); + await listenForSSRCs(t, receiver); + }, '[' + kind + '] getSynchronizationSources() eventually returns a ' + + 'non-empty list'); + + promise_test(async t => { + const startTime = performance.now(); + const receiver = await initiateSingleTrackCallAndReturnReceiver(t, kind); + const [ssrc] = await listenForSSRCs(t, receiver); + assert_equals(typeof ssrc.timestamp, 'number'); + assert_true(ssrc.timestamp >= startTime); + }, '[' + kind + '] RTCRtpSynchronizationSource.timestamp is a number'); + + promise_test(async t => { + const receiver = await initiateSingleTrackCallAndReturnReceiver(t, kind); + // Wait for packets to start flowing. + await listenForSSRCs(t, receiver); + // Wait for 10 seconds. + await new Promise(resolve => t.step_timeout(resolve, 10000)); + let earliestTimestamp = undefined; + let latestTimestamp = undefined; + for (const ssrc of await listenForSSRCs(t, receiver)) { + if (earliestTimestamp == undefined || earliestTimestamp > ssrc.timestamp) + earliestTimestamp = ssrc.timestamp; + if (latestTimestamp == undefined || latestTimestamp < ssrc.timestamp) + latestTimestamp = ssrc.timestamp; + } + assert_true(latestTimestamp - earliestTimestamp <= 10000); + }, '[' + kind + '] getSynchronizationSources() does not contain SSRCs ' + + 'older than 10 seconds'); + + promise_test(async t => { + const startTime = performance.timeOrigin + performance.now(); + const receiver = await initiateSingleTrackCallAndReturnReceiver(t, kind); + const [ssrc] = await listenForSSRCs(t, receiver); + const endTime = performance.timeOrigin + performance.now(); + assert_true(startTime <= ssrc.timestamp && ssrc.timestamp <= endTime); + }, '[' + kind + '] RTCRtpSynchronizationSource.timestamp is comparable to ' + + 'performance.timeOrigin + performance.now()'); + + promise_test(async t => { + const receiver = await initiateSingleTrackCallAndReturnReceiver(t, kind); + const [ssrc] = await listenForSSRCs(t, receiver); + assert_equals(typeof ssrc.source, 'number'); + }, '[' + kind + '] RTCRtpSynchronizationSource.source is a number'); +} + +promise_test(async t => { + const receiver = await initiateSingleTrackCallAndReturnReceiver(t, 'audio'); + const [ssrc] = await listenForSSRCs(t, receiver); + assert_equals(typeof ssrc.audioLevel, 'number'); + assert_greater_than_equal(ssrc.audioLevel, 0); + assert_less_than_equal(ssrc.audioLevel, 1); +}, '[audio-only] RTCRtpSynchronizationSource.audioLevel is a number [0, 1]'); + +// This test only passes if the implementation is sending the RFC 6464 extension +// header and the "vad" extension attribute is not "off", otherwise +// voiceActivityFlag is absent. TODO: Consider moving this test to an +// optional-to-implement subfolder? +promise_test(async t => { + const receiver = await initiateSingleTrackCallAndReturnReceiver(t, 'audio'); + const [ssrc] = await listenForSSRCs(t, receiver); + assert_equals(typeof ssrc.voiceActivityFlag, 'boolean'); +}, '[audio-only] RTCRtpSynchronizationSource.voiceActivityFlag is a boolean'); </script>
diff --git a/third_party/blink/web_tests/external/wpt/webrtc/idlharness.https.window-expected.txt b/third_party/blink/web_tests/external/wpt/webrtc/idlharness.https.window-expected.txt index f8f1f896..493ac14 100644 --- a/third_party/blink/web_tests/external/wpt/webrtc/idlharness.https.window-expected.txt +++ b/third_party/blink/web_tests/external/wpt/webrtc/idlharness.https.window-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 494 tests; 301 PASS, 193 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 494 tests; 302 PASS, 192 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idl_test setup PASS Test driver for asyncInitCertificate FAIL Test driver for asyncInitTransports assert_unreached: Failed to run asyncInitTransports: ReferenceError: RTCSctpTransport is not defined Reached unreachable code @@ -266,7 +266,7 @@ PASS RTCRtpReceiver interface: operation getCapabilities(DOMString) PASS RTCRtpReceiver interface: operation getParameters() PASS RTCRtpReceiver interface: operation getContributingSources() -FAIL RTCRtpReceiver interface: operation getSynchronizationSources() assert_own_property: interface prototype object missing non-static operation expected property "getSynchronizationSources" missing +PASS RTCRtpReceiver interface: operation getSynchronizationSources() PASS RTCRtpReceiver interface: operation getStats() FAIL RTCRtpReceiver must be primary interface of new RTCPeerConnection().addTransceiver('audio').receiver assert_equals: Unexpected exception when evaluating object expected null but got object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'. 'unified-plan' will become the default behavior in the future, but it is currently experimental. To try it out, construct the RTCPeerConnection with sdpSemantics:'unified-plan' present in the RTCConfiguration argument." FAIL Stringification of new RTCPeerConnection().addTransceiver('audio').receiver assert_equals: Unexpected exception when evaluating object expected null but got object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'. 'unified-plan' will become the default behavior in the future, but it is currently experimental. To try it out, construct the RTCPeerConnection with sdpSemantics:'unified-plan' present in the RTCConfiguration argument."
diff --git a/third_party/blink/web_tests/fast/css/font-face-default-font-expected.html b/third_party/blink/web_tests/fast/css/font-face-default-font-expected.html index a9a5edf..c450fec 100644 --- a/third_party/blink/web_tests/fast/css/font-face-default-font-expected.html +++ b/third_party/blink/web_tests/fast/css/font-face-default-font-expected.html
@@ -2,7 +2,7 @@ <head> <style> body { - font-family: Arial; + font-family: Arial, Arimo; } </style> </head> @@ -11,6 +11,6 @@ Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=16348">http://bugs.webkit.org/show_bug.cgi?id=16348</a> @font-face does not affect the default style. </p> - This text should be in Arial. + This text should be in Arial or Arimo. </body> </html>
diff --git a/third_party/blink/web_tests/fast/css/font-face-default-font.html b/third_party/blink/web_tests/fast/css/font-face-default-font.html index ae00176..2d3f7320 100644 --- a/third_party/blink/web_tests/fast/css/font-face-default-font.html +++ b/third_party/blink/web_tests/fast/css/font-face-default-font.html
@@ -9,7 +9,7 @@ } @font-face { font-family: "Times New Roman"; - src: local("Arial"); + src: local("Arial"), local("Arimo-Regular"); } @font-face { font-family: Times; @@ -19,7 +19,7 @@ @font-face { font-family: "Times New Roman"; font-style: italic; - src: local("Arial"); + src: local("Arial"), local("Arimo-Regular"); } </style> </head> @@ -28,6 +28,6 @@ Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=16348">http://bugs.webkit.org/show_bug.cgi?id=16348</a> @font-face does not affect the default style</i>. </p> - This text should be in Arial. + This text should be in Arial or Arimo. </body> </html>
diff --git a/third_party/blink/web_tests/fast/css/font-face-synthetic-bold-italic-for-locally-installed.html b/third_party/blink/web_tests/fast/css/font-face-synthetic-bold-italic-for-locally-installed.html index 075bcec0..602eea8d 100644 --- a/third_party/blink/web_tests/fast/css/font-face-synthetic-bold-italic-for-locally-installed.html +++ b/third_party/blink/web_tests/fast/css/font-face-synthetic-bold-italic-for-locally-installed.html
@@ -3,11 +3,11 @@ <style> @font-face { font-family: fontface; - src: local('Times New Roman'); + src: local('Times New Roman'), local('Tinos-Regular'); } .local { - font-family: 'Times New Roman'; + font-family: 'Times New Roman', 'Tinos'; } .face {
diff --git a/third_party/blink/web_tests/fast/css/fontfaceset-load.html b/third_party/blink/web_tests/fast/css/fontfaceset-load.html index 0b7b1046..e546ee13 100644 --- a/third_party/blink/web_tests/fast/css/fontfaceset-load.html +++ b/third_party/blink/web_tests/fast/css/fontfaceset-load.html
@@ -4,7 +4,7 @@ <style> @font-face { font-family: TestFont; - src: local('Courier New'); + src: local('Courier New'), local('Cousine-Regular'); } @font-face {
diff --git a/third_party/blink/web_tests/fast/css/fontfaceset-multiple-families.html b/third_party/blink/web_tests/fast/css/fontfaceset-multiple-families.html index 671e3105..4d0231c 100644 --- a/third_party/blink/web_tests/fast/css/fontfaceset-multiple-families.html +++ b/third_party/blink/web_tests/fast/css/fontfaceset-multiple-families.html
@@ -4,7 +4,7 @@ <style> @font-face { font-family: TestFont1; - src: local('Courier New'); + src: local('Courier New'), local('Cousine-Regular'); } @font-face {
diff --git a/third_party/blink/web_tests/fast/spatial-navigation/snav-backtrack-out-of-non-navigable-iframe.html b/third_party/blink/web_tests/fast/spatial-navigation/snav-backtrack-out-of-non-navigable-iframe.html deleted file mode 100644 index bb511d2..0000000 --- a/third_party/blink/web_tests/fast/spatial-navigation/snav-backtrack-out-of-non-navigable-iframe.html +++ /dev/null
@@ -1,55 +0,0 @@ -<!-- - This test ensures the correctness of a basic aspect of spatial navigation's - search for candidates to focus: an iframe element without any focusable content - should be ignored. - - * Pre-conditions: - 1) Run chromium with --enable-spatial-navigation. - - * Navigation steps: - 1) Loads this page, focus goes to "start" automatically. - 2) Focus moves from "start" to "end" and return back. ---> -<script src="../../resources/js-test.js"></script> -<script src="resources/spatial-navigation-utils.js"></script> -<script type="application/javascript"> - -var resultMap = [ - ["Down", "end"], - ["Up", "start"], - ["Left", "end"], - ["Right", "start"], - ["DONE", "DONE"] -]; - -if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1); - testRunner.overridePreference("WebKitSpatialNavigationEnabled", 1); - testRunner.waitUntilDone(); -} - -function runTest() -{ - // starting the test itself: get to a known place. - document.getElementById("start").focus(); - - initTest(resultMap, testCompleted); -} - -function testCompleted() -{ - if (window.testRunner) - testRunner.notifyDone(); -} - -window.onload = runTest; -</script> - -<div style="position: relative;"> - <a id="start" href="#" style="position: absolute; top: 10px; left: 50px;">Start</a> - <a id="end" href="#" style="position: absolute; top: 50px; left: 10px;">End</a> - <iframe style="position: absolute; top: 50px; left: 50px;" src="data:text/html,"></iframe> -</div> -<div id="console"></div> -<div>This test tests that an iframe element without any focusable content will be ignored.</div>
diff --git a/third_party/blink/web_tests/fast/spatial-navigation/snav-clipped-overflowed-content.html b/third_party/blink/web_tests/fast/spatial-navigation/snav-clipped-overflowed-content.html index a0075440..923116500 100644 --- a/third_party/blink/web_tests/fast/spatial-navigation/snav-clipped-overflowed-content.html +++ b/third_party/blink/web_tests/fast/spatial-navigation/snav-clipped-overflowed-content.html
@@ -10,14 +10,14 @@ </style> <a id="start" href="a"><img src="resources/green.png" width=30px height=30px></a> -<div class="scroll"> +<div class="scroll" id="scrollerA"> <a id="1" href="a"><img src="resources/green.png" width=30px height=35px></a> <div></div> <img src="resources/green.png" width=200px height=280px> <div></div> <a id="2" href="a"><img src="resources/green.png" width=30px height=30px></a> </div> -<div class="scroll"> +<div class="scroll" id="scrollerB"> <a id="3" href="a"><img src="resources/green.png" width=30px height=35px></a> <a id="4" href="a" style="margin-left: 400px"><img src="resources/green.png" width=30px height=35px></a> </div> @@ -31,23 +31,26 @@ assert_true(internals.runtimeFlags.keyboardFocusableScrollersEnabled); }, "Make sure KeyboardFocusableScrollers is set."); - // These expectations will change once crbug.com/801162 lands: - // We want spatnav, to focus the scroller before scrolling it + // We want spatnav to focus the scroller before scrolling // or searching inside of it, just like seqnav does. var resultMap = [ + ["Down", "scrollerA"], ["Down", "1"], ["Down", "1"], ["Down", "1"], ["Down", "1"], ["Down", "2"], ["Down", "2"], + ["Down", "scrollerB"], ["Down", "3"], ["Right", "3"], ["Right", "3"], ["Right", "3"], ["Right", "4"], ["Down", "5"], + ["Up", "scrollerB"], ["Up", "4"], + ["Up", "scrollerA"], ["Up", "2"], ["Up", "2"], ["Up", "2"],
diff --git a/third_party/blink/web_tests/fast/spatial-navigation/snav-div-scrollable-but-without-focusable-content.html b/third_party/blink/web_tests/fast/spatial-navigation/snav-div-scrollable-but-without-focusable-content.html index 2a479f6..fe7dc30 100644 --- a/third_party/blink/web_tests/fast/spatial-navigation/snav-div-scrollable-but-without-focusable-content.html +++ b/third_party/blink/web_tests/fast/spatial-navigation/snav-div-scrollable-but-without-focusable-content.html
@@ -18,7 +18,7 @@ <img src="resources/green.png" width=240 height=300> </div> <div><a id="end" href="a"><img src="resources/green.png" width=30 height=30></a></div> -This test is to test that a scrollable div can scroll and reveal its content even if it does not have any focusable content. +A scroll container should be scrollable even when it contains no focusables. <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -28,24 +28,25 @@ assert_true(internals.runtimeFlags.keyboardFocusableScrollersEnabled); }, "Make sure KeyboardFocusableScrollers is set."); - // These expectations will change once crbug.com/801162 lands: - // We want spatnav, to focus the scroller before scrolling it + // We want spatnav to focus the scroller before scrolling // or searching inside of it, just like seqnav does. var resultMap = [ - ["Down", "start"], - ["Down", "start"], - ["Down", "start"], ["Down", "scrollerA"], ["Down", "scrollerA"], ["Down", "scrollerA"], ["Down", "scrollerA"], ["Down", "scrollerB"], + ["Down", "scrollerB"], + ["Down", "scrollerB"], + ["Down", "scrollerB"], + ["Down", "end"], ["Up" , "scrollerB"], ["Up" , "scrollerB"], ["Up" , "scrollerB"], ["Up" , "scrollerB"], - ["Up" , "scrollerB"], - ["Up" , "scrollerB"], + ["Up" , "scrollerA"], + ["Up" , "scrollerA"], + ["Up" , "scrollerA"], ["Up" , "scrollerA"], ["Up" , "start"], ];
diff --git a/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-nested.html b/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-nested.html index a9e36947..9eb81e49 100644 --- a/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-nested.html +++ b/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-nested.html
@@ -44,8 +44,8 @@ <script src="resources/snav-testharness.js"></script> <script> var resultMap = [ - // ["Right", "frameA,frameAbody"], crbug.com/801162 - // ["Right", "frameA,frameB,frameBbody"], crbug.com/801162 + ["Right", "frameA,frameAbody"], + ["Right", "frameA,frameB,frameBbody"], ["Right", "frameA,frameB,1"], ["Right", "frameA,frameB,2"], ["Right", "frameA,frameB,3"], @@ -55,8 +55,8 @@ ["Right", "frameA,frameB,7"], ["Right", "frameA,frameB,8"], ["Right", "9"], - // ["Left", "frameA,frameAbody"], crbug.com/801162 - // ["Left", "frameA,frameB,frameBbody"], crbug.com/801162 + ["Left", "frameA,frameAbody"], + ["Left", "frameA,frameB,frameBbody"], ["Left", "frameA,frameB,8"], ["Left", "frameA,frameB,7"], ["Left", "frameA,frameB,6"],
diff --git a/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-no-focusable-content.html b/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-no-focusable-content.html index f897262b..d9cd2cc 100644 --- a/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-no-focusable-content.html +++ b/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-no-focusable-content.html
@@ -14,31 +14,34 @@ <a id="end" href="a">e</a> -<p>Iframes with no focusable content still scrolls.</p> +<p>Iframes with no focusable content still scroll.</p> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="resources/snav-testharness.js"></script> <script> /* - Once crbug.com/801162 is fixed, the expectation will change: The iframe can only be scrolled when being focused. */ var resultMap = [ - ["Down", "start"], - ["Down", "start"], - ["Down", "start"], - ["Down", "start"], - ["Down", "start"], - ["Down", "start"], + ["Down", "frameA,frameAbody"], + ["Down", "frameA,frameAbody"], + ["Down", "frameA,frameAbody"], + ["Down", "frameA,frameAbody"], + ["Down", "frameA,frameAbody"], + ["Down", "frameB,frameBbody"], + ["Down", "frameB,frameBbody"], + ["Down", "frameB,frameBbody"], ["Down", "end"], - ["Up" , "end"], - ["Up" , "end"], - ["Up" , "end"], - ["Up" , "end"], - ["Up" , "end"], - ["Up" , "end"], - ["Up" , "start"], + ["Up", "frameB,frameBbody"], + ["Up", "frameB,frameBbody"], + ["Up", "frameB,frameBbody"], + ["Up", "frameA,frameAbody"], + ["Up", "frameA,frameAbody"], + ["Up", "frameA,frameAbody"], + ["Up", "frameA,frameAbody"], + ["Up", "frameA,frameAbody"], + ["Up", "start"], ]; // Start at a known place. document.getElementById("start").focus();
diff --git a/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-no-scrollable-content.html b/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-no-scrollable-content.html index 7ff71927..408636f6 100644 --- a/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-no-scrollable-content.html +++ b/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-no-scrollable-content.html
@@ -1,49 +1,52 @@ -<div><a id="start" href="a">a</a></div> +<div><a id="start" href="">a</a></div> <iframe id="frameA" src="data:text/html, <body id='frameAbody'> - <a id='1' href='a'>b</a><br> - <a id='2' href='a'>c</a><br> - <a id='3' href='a'>d</a><br> + <a id='b' href=''>b</a><br> + <a id='c' href=''>c</a><br> + <a id='d' href=''>d</a><br> <div style='margin-left:80px'> - <a id='7' href='a'>e</a> + <a id='e' href=''>e</a> </div> </body> "></iframe><br> <iframe id="frameB" src="data:text/html, <body id='frameBbody'> - <a id='4' href='a'>g</a> - <a id='5' href='a'>h</a> - <a id='6' href='a'>i</a> + <a id='g' href=''>g</a> + <a id='h' href=''>h</a> + <a id='i' href=''>i</a> </body> "></iframe><br> -<a id="end" href="a">a</a> +<a id="end" href="">a</a> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="resources/snav-testharness.js"></script> <script> /* - Once crbug.com/801162 is fixed, the expectation will change: Spatnav must focus the iframe before it can search it. */ var resultMap = [ - ["Down", "frameA,1"], - ["Down", "frameA,2"], - ["Down", "frameA,3"], - ["Down", "frameA,7"], - ["Down", "frameB,6"], + ["Down", "frameA,frameAbody"], + ["Down", "frameA,b"], + ["Down", "frameA,c"], + ["Down", "frameA,d"], + ["Down", "frameA,e"], + ["Down", "frameB,frameBbody"], + ["Down", "frameB,g"], + ["Right", "frameB,h"], + ["Right", "frameB,i"], ["Down", "end"], - ["Up", "frameB,4"], - ["Right", "frameB,5"], - ["Right", "frameB,6"], - ["Up", "frameA,3"], - ["Right", "frameA,7"], - ["Up", "frameA,3"], - ["Up", "frameA,2"], - ["Up", "frameA,1"], + ["Up", "frameB,frameBbody"], + ["Up", "frameB,g"], + ["Up", "frameA,frameAbody"], + ["Up", "frameA,e"], + ["Up", "frameA,d"], + ["Up", "frameA,c"], + ["Up", "frameA,b"], + ["Up", "start"], ]; // Start at a known place. document.getElementById("start").focus();
diff --git a/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-recursive-offset-parent.html b/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-recursive-offset-parent.html index 19cb051..bd138ccb 100644 --- a/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-recursive-offset-parent.html +++ b/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-recursive-offset-parent.html
@@ -1,14 +1,14 @@ <table style="text-align: top;" border="0" cellpadding="3px" cellspacing="3px"> <tr> <td valign="top" width="10%"> - <a id="start" href="http://google.com">Link</a><br> + <a id="start" href="">Link</a><br> </td> <td valign="top"> <iframe id="frameA" width="50%" height="100px" frameborder="1" src="data:text/html, <body id='frameAbody'> - <a id='1' href='http://a'>b</a> - <a id='2' href='http://a'>c</a> - <a id='3' href='http://a'>d</a> + <a id='b' href=''>b</a> + <a id='c' href=''>c</a> + <a id='d' href=''>d</a> </body> "></iframe><br> </td> @@ -20,12 +20,12 @@ <script src="resources/snav-testharness.js"></script> <script> var resultMap = [ - // ["Right", "frameA,frameAbody"], crbug.com/801162 - ["Right", "frameA,1"], - ["Right", "frameA,2"], - ["Right", "frameA,3"], - ["Left", "frameA,2"], - ["Left", "frameA,1"], + ["Right", "frameA,frameAbody"], + ["Right", "frameA,b"], + ["Right", "frameA,c"], + ["Right", "frameA,d"], + ["Left", "frameA,c"], + ["Left", "frameA,b"], ["Left", "start"], ]; // Start at a known place.
diff --git a/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-with-offscreen-focusable-element.html b/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-with-offscreen-focusable-element.html index 9e490773..b61300e 100644 --- a/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-with-offscreen-focusable-element.html +++ b/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-with-offscreen-focusable-element.html
@@ -17,7 +17,7 @@ <script src="resources/snav-testharness.js"></script> <script> var resultMap = [ - // ["Down", "frameA,frameAbody"], crbug.com/801162 + ["Down", "frameA,frameAbody"], ["Down", "frameA,1"], ["Down", "frameA,1"], ["Down", "frameA,1"], @@ -27,7 +27,7 @@ ["Down", "frameA,1"], ["Down", "frameA,2"], ["Down", "end"], - // ["Up", "frameA,frameAbody"], crbug.com/801162 + ["Up", "frameA,frameAbody"], ["Up", "frameA,2"], ["Up", "frameA,2"], ["Up", "frameA,2"],
diff --git a/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-with-outside-focusable-element.html b/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-with-outside-focusable-element.html index 9dc7e55..2b6fbfb 100644 --- a/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-with-outside-focusable-element.html +++ b/third_party/blink/web_tests/fast/spatial-navigation/snav-iframe-with-outside-focusable-element.html
@@ -14,7 +14,7 @@ <script src="resources/snav-testharness.js"></script> <script> var resultMap = [ - // ["Down", "frameA,frameAbody"], crbug.com/801162 + ["Down", "frameA,frameAbody"], ["Down", "frameA,a"], ["Down", "c"], ];
diff --git a/third_party/blink/web_tests/fast/spatial-navigation/snav-only-clipped-overflow-content.html b/third_party/blink/web_tests/fast/spatial-navigation/snav-only-clipped-overflow-content.html index 7dfc426..57f1787 100644 --- a/third_party/blink/web_tests/fast/spatial-navigation/snav-only-clipped-overflow-content.html +++ b/third_party/blink/web_tests/fast/spatial-navigation/snav-only-clipped-overflow-content.html
@@ -24,6 +24,7 @@ <script> var resultMap = [ ["Down", "start"], + ["Down", "scroller"], ["Down", "a1"], ["Down", "a1"], // The div has padding so it can be scrolled a little further. ["Down", "a2"],
diff --git a/third_party/blink/web_tests/fast/spatial-navigation/snav-search-beneath-exited-scroller.html b/third_party/blink/web_tests/fast/spatial-navigation/snav-search-beneath-exited-scroller.html index 40f33f3..976a799 100644 --- a/third_party/blink/web_tests/fast/spatial-navigation/snav-search-beneath-exited-scroller.html +++ b/third_party/blink/web_tests/fast/spatial-navigation/snav-search-beneath-exited-scroller.html
@@ -14,7 +14,7 @@ </style> <button id="a">a</button><br> -<div> +<div id="scroller"> <button id='b'>b</button> <p>some text</p> </div> @@ -26,6 +26,7 @@ <script> let resultMap = [ ['Down', 'a'], + ['Down', 'scroller'], ['Down', 'b'], ['Down', 'b'], ['Down', 'b'],
diff --git a/third_party/blink/web_tests/fast/spatial-navigation/snav-stay-in-overflow-div.html b/third_party/blink/web_tests/fast/spatial-navigation/snav-stay-in-overflow-div.html index 03684ab..5439ac4 100644 --- a/third_party/blink/web_tests/fast/spatial-navigation/snav-stay-in-overflow-div.html +++ b/third_party/blink/web_tests/fast/spatial-navigation/snav-stay-in-overflow-div.html
@@ -1,5 +1,5 @@ <style> - div.scroll { + div#scroller { /* The div displays one line of text at once. */ line-height: 1.5em; height: 1.5em; @@ -7,7 +7,7 @@ } </style> -<div class="scroll"> +<div id="scroller"> <a href="#" id="a">a</a><br> <a href="#" id="b">b</a> </div> @@ -21,6 +21,7 @@ ["Down", "a"], // Scrolled so no focus change. ["Down", "b"], ["Down", "c"], + ["Up", "scroller"], ["Up", "b"], ["Up", "b"], // Scrolled so no focus change. ["Up", "a"],
diff --git a/third_party/blink/web_tests/http/tests/devtools/indexeddb/database-version-number-expected.txt b/third_party/blink/web_tests/http/tests/devtools/indexeddb/database-version-number-expected.txt new file mode 100644 index 0000000..23f9b9735 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/devtools/indexeddb/database-version-number-expected.txt
@@ -0,0 +1,35 @@ +Tests that database names are correctly loaded and saved in IndexedDBModel. + +Dumping database: +Dumping database: +testDatabase1 + version: 2147483647 + objectStores: + +Dumping database: +testDatabase1 + version: 2147483648 + objectStores: + testObjectStore1 + keyPath: "test.key.path" + autoIncrement: true + indexes: + +Dumping database: +testDatabase1 + version: 2147483649 + objectStores: + testObjectStore1 + keyPath: "test.key.path" + autoIncrement: true + indexes: + testObjectStore2 + keyPath: null + autoIncrement: false + indexes: + +VM:3 InspectorTest.IndexedDB_callback1 +VM:3 InspectorTest.IndexedDB_callback2 +VM:3 InspectorTest.IndexedDB_callback3 +VM:3 InspectorTest.IndexedDB_callback4 +
diff --git a/third_party/blink/web_tests/http/tests/devtools/indexeddb/database-version-number.js b/third_party/blink/web_tests/http/tests/devtools/indexeddb/database-version-number.js new file mode 100644 index 0000000..60743d7 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/devtools/indexeddb/database-version-number.js
@@ -0,0 +1,104 @@ +// 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. + +(async function() { + TestRunner.addResult(`Tests that database names are correctly loaded and saved in IndexedDBModel.\n`); + await TestRunner.loadModule('application_test_runner'); + // Note: every test that uses a storage API must manually clean-up state from previous tests. + await ApplicationTestRunner.resetState(); + + var indexedDBModel = ApplicationTestRunner.createIndexedDBModel(); + var mainFrameId = TestRunner.resourceTreeModel.mainFrame.id; + var databaseName = 'testDatabase1'; + var securityOrigin = 'http://127.0.0.1:8000'; + var databaseId = new Resources.IndexedDBModel.DatabaseId(securityOrigin, databaseName); + + function dumpDatabase() { + TestRunner.addResult('Dumping database:'); + var database = indexedDBModel._databases.get(databaseId); + if (!database) + return; + TestRunner.addResult(database.databaseId.name); + TestRunner.addResult(' version: ' + database.version); + TestRunner.addResult(' objectStores:'); + var objectStoreNames = []; + for (var objectStoreName in database.objectStores) + objectStoreNames.push(objectStoreName); + objectStoreNames.sort(); + for (var i = 0; i < objectStoreNames.length; ++i) { + var objectStore = database.objectStores[objectStoreNames[i]]; + TestRunner.addResult(' ' + objectStore.name); + TestRunner.addResult(' keyPath: ' + JSON.stringify(objectStore.keyPath)); + TestRunner.addResult(' autoIncrement: ' + objectStore.autoIncrement); + TestRunner.addResult(' indexes: '); + var indexNames = []; + for (var indexName in objectStore.indexes) + indexNames.push(indexName); + indexNames.sort(); + for (var j = 0; j < indexNames.length; ++j) { + var index = objectStore.indexes[indexNames[j]]; + TestRunner.addResult(' ' + index.name); + TestRunner.addResult(' keyPath: ' + JSON.stringify(index.keyPath)); + TestRunner.addResult(' unique: ' + index.unique); + TestRunner.addResult(' multiEntry: ' + index.multiEntry); + } + } + TestRunner.addResult(''); +} + + TestRunner.addSniffer(Resources.IndexedDBModel.prototype, '_updateOriginDatabaseNames', step2, false); + + function step2() { + ApplicationTestRunner.createDatabaseWithVersion(mainFrameId, databaseName, 2147483647, step3); + } + + function step3() { + TestRunner.addSniffer(Resources.IndexedDBModel.prototype, '_updateOriginDatabaseNames', step4, false); + indexedDBModel.refreshDatabaseNames(); + } + + function step4() { + dumpDatabase(); + + indexedDBModel.addEventListener(Resources.IndexedDBModel.Events.DatabaseLoaded, step5); + indexedDBModel.refreshDatabase(databaseId); + } + + function step5() { + indexedDBModel.removeEventListener(Resources.IndexedDBModel.Events.DatabaseLoaded, step5); + dumpDatabase(); + + ApplicationTestRunner.createObjectStore( + mainFrameId, databaseName, 'testObjectStore1', 'test.key.path', true, step6); + } + + function step6() { + indexedDBModel.addEventListener(Resources.IndexedDBModel.Events.DatabaseLoaded, step7); + indexedDBModel.refreshDatabase(databaseId); + } + + function step7() { + indexedDBModel.removeEventListener(Resources.IndexedDBModel.Events.DatabaseLoaded, step7); + dumpDatabase(); + + ApplicationTestRunner.createObjectStore(mainFrameId, databaseName, 'testObjectStore2', null, false, step8); + } + + function step8() { + indexedDBModel.addEventListener(Resources.IndexedDBModel.Events.DatabaseLoaded, step9); + indexedDBModel.refreshDatabase(databaseId); + } + + + function step9() { + indexedDBModel.removeEventListener(Resources.IndexedDBModel.Events.DatabaseLoaded, step9); + dumpDatabase(); + ApplicationTestRunner.deleteDatabase(mainFrameId, databaseName, step10); + } + + function step10() { + ConsoleTestRunner.dumpConsoleMessages(); + TestRunner.completeTest(); + } +})();
diff --git a/third_party/blink/web_tests/inspector-protocol/layout-fonts/unicode-range-order.js b/third_party/blink/web_tests/inspector-protocol/layout-fonts/unicode-range-order.js index 0458051..ba47bf68 100644 --- a/third_party/blink/web_tests/inspector-protocol/layout-fonts/unicode-range-order.js +++ b/third_party/blink/web_tests/inspector-protocol/layout-fonts/unicode-range-order.js
@@ -4,11 +4,11 @@ <style> div { border: 1px solid; padding: 0 8px; margin: 8px 0; } span.ahem { font-family: 'Ahem'; } - span.courier { font-family: 'Courier New', 'Courier'; } + span.courier { font-family: 'Courier New', 'Courier', 'Cousine'; } @font-face { font-family: 'test1'; - src: local('Times'); + src: local('Times'), local('Tinos-Regular'); } @font-face { font-family: 'test1'; @@ -18,7 +18,7 @@ @font-face { font-family: 'test2'; - src: local('Times'); + src: local('Times'), local('Tinos-Regular'); } @font-face { font-family: 'test2'; @@ -28,7 +28,7 @@ @font-face { font-family: 'test3'; - src: local('Times'); + src: local('Times'), local('Tinos-Regular'); } @font-face { font-family: 'test3'; @@ -38,7 +38,7 @@ @font-face { font-family: 'test4'; - src: local('Times'); + src: local('Times'), local('Tinos-Regular'); } @font-face { font-family: 'test4'; @@ -47,13 +47,13 @@ } @font-face { font-family: 'test4'; - src: local('Courier New'), local('Courier'); + src: local('Courier New'), local('Courier'), local('Cousine-Regular'); unicode-range: U+004F-0051; } @font-face { font-family: 'test5'; - src: local('Times'), local('Times New Roman'); + src: local('Times'), local('Tinos-Regular'), local('Times New Roman'); } @font-face { font-family: 'test5'; @@ -62,13 +62,13 @@ } @font-face { font-family: 'test5'; - src: local('Courier New'), local('Courier'); + src: local('Courier New'), local('Courier'), local('Cousine-Regular'); unicode-range: U+0052-0055; } @font-face { font-family: 'test6'; - src: local('Courier New'), local('Courier'); + src: local('Courier New'), local('Courier'), local('Cousine-Regular'); } @font-face { font-family: 'test6';
diff --git a/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-expected.txt index 6d6fb78..2a1cbcb 100644 --- a/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-expected.txt +++ b/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -712,6 +712,7 @@ method fill method fillRect method fillText + method getContextAttributes method getImageData method getLineDash method getTransform @@ -4895,6 +4896,7 @@ method getContributingSources method getParameters method getStats + method getSynchronizationSources interface RTCRtpSender static method getCapabilities attribute @@toStringTag
diff --git a/third_party/blink/web_tests/virtual/webrtc-wpt-unified-plan/external/wpt/webrtc/idlharness.https.window-expected.txt b/third_party/blink/web_tests/virtual/webrtc-wpt-unified-plan/external/wpt/webrtc/idlharness.https.window-expected.txt index d0885b8..4e66c94 100644 --- a/third_party/blink/web_tests/virtual/webrtc-wpt-unified-plan/external/wpt/webrtc/idlharness.https.window-expected.txt +++ b/third_party/blink/web_tests/virtual/webrtc-wpt-unified-plan/external/wpt/webrtc/idlharness.https.window-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 494 tests; 337 PASS, 157 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 494 tests; 339 PASS, 155 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idl_test setup PASS Test driver for asyncInitCertificate FAIL Test driver for asyncInitTransports assert_unreached: Failed to run asyncInitTransports: ReferenceError: RTCSctpTransport is not defined Reached unreachable code @@ -266,7 +266,7 @@ PASS RTCRtpReceiver interface: operation getCapabilities(DOMString) PASS RTCRtpReceiver interface: operation getParameters() PASS RTCRtpReceiver interface: operation getContributingSources() -FAIL RTCRtpReceiver interface: operation getSynchronizationSources() assert_own_property: interface prototype object missing non-static operation expected property "getSynchronizationSources" missing +PASS RTCRtpReceiver interface: operation getSynchronizationSources() PASS RTCRtpReceiver interface: operation getStats() PASS RTCRtpReceiver must be primary interface of new RTCPeerConnection().addTransceiver('audio').receiver PASS Stringification of new RTCPeerConnection().addTransceiver('audio').receiver @@ -277,7 +277,7 @@ PASS RTCRtpReceiver interface: calling getCapabilities(DOMString) on new RTCPeerConnection().addTransceiver('audio').receiver with too few arguments must throw TypeError PASS RTCRtpReceiver interface: new RTCPeerConnection().addTransceiver('audio').receiver must inherit property "getParameters()" with the proper type PASS RTCRtpReceiver interface: new RTCPeerConnection().addTransceiver('audio').receiver must inherit property "getContributingSources()" with the proper type -FAIL RTCRtpReceiver interface: new RTCPeerConnection().addTransceiver('audio').receiver must inherit property "getSynchronizationSources()" with the proper type assert_inherits: property "getSynchronizationSources" not found in prototype chain +PASS RTCRtpReceiver interface: new RTCPeerConnection().addTransceiver('audio').receiver must inherit property "getSynchronizationSources()" with the proper type PASS RTCRtpReceiver interface: new RTCPeerConnection().addTransceiver('audio').receiver must inherit property "getStats()" with the proper type PASS RTCRtpTransceiver interface: existence and properties of interface object PASS RTCRtpTransceiver interface object length
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 2d83534..d42c6ef 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
@@ -5726,6 +5726,7 @@ method getContributingSources method getParameters method getStats + method getSynchronizationSources interface RTCRtpSender static method getCapabilities attribute @@toStringTag
diff --git a/third_party/google_toolbox_for_mac/BUILD.gn b/third_party/google_toolbox_for_mac/BUILD.gn index 8cbca8dc..67768b1 100644 --- a/third_party/google_toolbox_for_mac/BUILD.gn +++ b/third_party/google_toolbox_for_mac/BUILD.gn
@@ -31,8 +31,6 @@ "src/AppKit/GTMUILocalizerAndLayoutTweaker.m", "src/DebugUtils/GTMDebugSelectorValidation.h", "src/DebugUtils/GTMTypeCasting.h", - "src/Foundation/GTMServiceManagement.c", - "src/Foundation/GTMServiceManagement.h", ] libs = [
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 29302345..d798e00 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -15179,6 +15179,9 @@ <int value="509" label="DeviceAuthDataCacheLifetime"/> <int value="510" label="CloudManagementEnrollmentToken"/> <int value="511" label="BrowserSwitcherExternalSitelistUrl"/> + <int value="512" label="ReportDevicePowerStatus"/> + <int value="513" label="ReportDeviceStorageStatus"/> + <int value="514" label="ReportDeviceBoardStatus"/> </enum> <enum name="EnterprisePolicyInvalidations"> @@ -24996,6 +24999,11 @@ <int value="62" label="User Disabled WIN10_RS4"/> <int value="63" label="Fallback to Software WIN10_RS4"/> <int value="64" label="Status Unknown WIN10_RS4"/> + <int value="65" label="Enabled WIN10_RS5"/> + <int value="66" label="Blacklisted WIN10_RS5"/> + <int value="67" label="User Disabled WIN10_RS5"/> + <int value="68" label="Fallback to Software WIN10_RS5"/> + <int value="69" label="Status Unknown WIN10_RS5"/> </enum> <enum name="GPUBlacklistTestResultPerEntry"> @@ -33158,6 +33166,19 @@ <int value="1999" label="Unknown CBError code"/> </enum> +<enum name="MainFrameDownloadSandboxGesture"> + <summary> + For a download that occurs in top frame, record whether the frame is + sandboxed and whether the download involves a transient user gesture. It is + only recorded for downloads originated from navigations or from HTML anchor + download attributes. + </summary> + <int value="0" label="NotSandboxed_NoGesture"/> + <int value="1" label="NotSandboxed_Gesture"/> + <int value="2" label="Sandboxed_NoGesture"/> + <int value="3" label="Sandboxed_Gesture"/> +</enum> + <enum name="MainFrameStorable"> <int value="0" label="Storable"/> <int value="1" label="cache-control: no-store"/> @@ -55878,6 +55899,7 @@ <int value="10" label="Windows 10 RS2"/> <int value="11" label="Windows 10 RS3"/> <int value="12" label="Windows 10 RS4"/> + <int value="13" label="Windows 10 RS5"/> </enum> <enum name="WindowType">
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 54bbae05..ecd706f1 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -24619,6 +24619,9 @@ </histogram> <histogram name="Download.MainFrame.HasGesture" enum="Boolean"> + <obsolete> + Deprecated as of 01/2019. + </obsolete> <owner>yaoxia@chromium.org</owner> <summary> Whether the main frame download involves a transient user gesture. It is @@ -24627,6 +24630,17 @@ </summary> </histogram> +<histogram name="Download.MainFrame.SandboxGesture" + enum="MainFrameDownloadSandboxGesture"> + <owner>yaoxia@chromium.org</owner> + <summary> + For a download that occurs in top frame, record whether the frame is + sandboxed and whether the download involves a transient user gesture. It is + only recorded for downloads originated from navigations or from HTML anchor + download attributes. + </summary> +</histogram> + <histogram name="Download.MaliciousDownloadClassified" enum="DownloadItem.DangerType"> <owner>dtrainor@chromium.org</owner> @@ -112883,6 +112897,15 @@ </summary> </histogram> +<histogram base="true" name="Sync.NonGroupedInvalidationKnownVersion" + enum="SyncModelTypes" expires_after="M75"> + <owner>melandory@chromium.org</owner> + <summary> + The sync datatype of the recieved invalidation. Recorded only for the + invalidations with known version and recieved not in a group. + </summary> +</histogram> + <histogram name="Sync.PageRevisitBookmarksDuration" units="ms"> <obsolete> Deprecated in M66.
diff --git a/tools/metrics/ukm/ukm.xml b/tools/metrics/ukm/ukm.xml index 94e0b3b..440ef0145 100644 --- a/tools/metrics/ukm/ukm.xml +++ b/tools/metrics/ukm/ukm.xml
@@ -1857,6 +1857,12 @@ A boolean denoting whether the download involves a transient user gesture. </summary> </metric> + <metric name="HasSandbox"> + <summary> + A boolean denoting whether the download occurs in a sandboxed browsing + context. + </summary> + </metric> </event> <event name="Media.Autoplay.Attempt"> @@ -4569,7 +4575,8 @@ </metric> <metric name="HasSandbox"> <summary> - A boolean denoting whether the download occurs in a sandboxed subframe. + A boolean denoting whether the download occurs in a sandboxed browsing + context. </summary> </metric> <metric name="IsAdFrame">